Posts

Showing posts from February, 2010

zend framework2 - ZF2 Make ZendService\ReCaptcha autoloadable -

i have installed matthew weir o phinney's contact module zf2 skeleton application. dependent on zendservice\recaptcha installed composer. works on local machine, won't run on live server. ftp'd files server because don't have ssh access run composer. means uploaded config files local machine, recaptcha service still not autoloading error saying recaptcha service not available. can tell me missing make autoloadable?

.net - What is the best way to secure a WCF service? -

what best way secure wcf service? should add header service calls , have message inspector on client verifies header? i need make sure person provides correct user name , password use service , encrypted. on internet , using http binding. if limited http take performance hit more portable. think can encrypt , secure of http ws-security. transport , message security modes two main mechanisms used implement transfer security in wcf: transport security mode , message security mode. transport security mode uses transport-level protocol, such https, achieve transfer security. transport mode has advantage of being adopted, available on many platforms, , less computationally complex. however, has disadvantage of securing messages point-to-point. message security mode, on other hand, uses ws-security (and other specifications) implement transfer security. because message security applied directly soap messages , contained inside soap envelopes, application data, has

jasperserver - Export report to XHTML format with JasperReports Server -

i need export report in format xhtml of jasperreports server . i'm using url like: http://localhost:8080/jasperreports/report?_repname=test&_repformat=pdf&_datasource=default&_outfilename=mytest.pdf&_replocale=es_do&_repe ncoding=utf-8 . i can export many formats (pdf, html, xls, ...) can't how export xhtml format. changing value parameter _repformat=xhtml not working. it works in ireport preview, not via jr server's url. i can't useful in neither jasper documentation , web forums. have @ answer outlined here: http://community.jaspersoft.com/questions/531694/xhtml-render-or-export

sql server 2008 - How to run sql n times increasing variable and after joining results -

i've transact table (historical) createddate , transact related employee transact table. (inner join in transact_id) this being said, comes problem: need query these table , state month , because during year, createddate can change. e.g. employee update in july create new line, shouldn't affect march total. the solution looks forech , how can join lines @ end? result should like: january - $123 february - $234 march - $123 ... i last state of each employee this: select alltransact.id_employee, alltransact.id_department ( select id_employee, id_department, rank() on (partition id_employee order created_date desc) desc_rank transact_employee transemployee inner join transact on transemployee.id_transact = transact.id_transact , transact.status = 8 , transact.created_date < @currentmonth) alltransact desc_rank = 1 *i don't want copy , past code 12 times. :) you can partition on many colum

Putty skips installation wizard -

i downloaded putty.exe installer windows x86 here- http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html running windows 7. when run executable goes straight putty configuration window without running setup process. don't see welcome dialog shown in first image here- https://www.openshift.com/page/install-and-setup-putty-ssh-client-for-windows can't save configuration , reuse. sounds want download "windows installer" , not .exe. .exe file standalone , not require install. either way has same functionality.

xml parsing - Extract attributes and values from XML file in perl -

this part of output xml file output stanford corenlp: <collapsed-ccprocessed-dependencies> <dep type="nn"> <governor idx="25">mullen</governor> <dependent idx="24">ms.</dependent> </dep> <dep type="nsubj"> <governor idx="26">said</governor> <dependent idx="25">mullen</dependent> </dep> </collapsed-ccprocessed-dependencies> </sentence> </sentences> <coreference> <coreference> <mention representative="true"> <sentence>1</sentence> <start>1</start> <end>2</end> <head>1</head> </mention> <mention> <sentence>1</sentence> <start>33</start> <end>34</end> <head>33</head> &l

java - Why does this throw a NullPointerException? -

null pointer means there programmers error within paramter somwhere, code looked @ ensure haven't missed obvious? it's simple % based poker bot, pretty sure here's "thinks" error is. public action act(set<action> actions) { random generator = new random(); int roll = generator.nextint(100) + 1; //gives number between 1 , 100 system.out.println("roll = " + roll); action myaction = null; if (roll <= 30) { // raise 30% if (actions.contains(action.raise)) { myaction = action.raise; } else if (actions.contains(action.bet)) { myaction = action.bet; } else if (actions.contains(action.call)) { myaction = action.call; } } else if (roll > 30 && roll <= 90) { // call/check 60% if (actions.contains(action.call)) { myaction = action.call; } else if (actions.contains(action.check)) { myaction = action.check

javascript - How to mass change tab width for all JS files across entire repository? -

we're doing code clean-up on project i'm on that's grown rather large. we've decided site wide tabs (which soft tabs of 4 spaces) should two-spaces standard (there's been lot of mixing). there easy way accomplish this? we're talking hundreds of js files here. i'd change instance of 4 spaces 2 spaces. there tool don't know of or sublime text or vim way of doing this? open project in sublime text 2, click cmd + shift + f on mac or ctrl + shift + f on windows. enter value want find in first input, , in third input, enter value want change original value to. it open each file , change desired text. save , have day.

ruby - What goes in config.ru for a non-rails app on heroku? -

i have simple ruby (non-rails) app uses resque, , won't start without config.ru on heroku. when add config.ru file following error when running rackup locally: /usr/local/cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:133:in `to_app': missing run or map statement (runtimeerror) /users/nickkarrasch/dropbox/coding/ruby/smsnotifyv2/config.ru:in `<main>' /usr/local/cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval' /usr/local/cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string' /usr/local/cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file' /usr/local/cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config' /usr/local/cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:199:in `app' /usr/local

java - I cannot figure out how to grab input from EditText to pass to another file -

i have user type in information such upc in edittext box , click button next it. how can text box pass other activity when click button? i'm assuming use intent launch activity. the edit text element: <edittext android:id="@+id/edittext1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/textview1" android:cursorvisible="true" android:ems="10" android:inputtype="text" /> code search button: <button android:id="@+id/button2" style="?android:attr/buttonstylesmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/edittext1" android:layout_below="@+id/textview1" android:layout_torightof="@+id/textview1" android:

High JavaScript memory usage with FileReader, images and <canvas> -

i working on image multi upload, sounds good, .. memory issue. script goal survive uploading of 100+ images (300mb+). if find (i still javascript lame) issue, please give me advice. thanks. my code: cfilereader.prototype.proccessfile = function(cb) { // means file var reader = new filereader(); reader.readasdataurl(this); reader.onload = (function (f) { return function(e) { var image = new image(); image.src = e.target.result; image.onload = (function(f) { return function() { var maxwidth = 700, maxheight = 700, imagewidth = this.width, imageheight = this.height; if (imagewidth > imageheight) { if (imagewidth > maxwidth) { imageheight *= maxwidth / imagewidth; imagewidth = maxwidth; }

c# - Toolstrip.Items.AddRange(ToolStripCollection) has odd behavior -

part of application i'm working on involves dynamic toolstrip items added , removed depending on application's state. i'm storing items in various independent toolstrips , adding , removing them when necessary. problem i'm having this: -if new toolstip has 1 item , use method addrange, it's removed new toolstrip, giving item count of 0. -if new toolstrip has multiple items , use addrange, argumentoutofrange error thrown. is there toolstripitemcollections i'm unaware of that's causing this, or there better way go programming this? edit: quick example code toolstrip oldtoolstrip = new toolstrip(); toolstrip newtoolstrip = new toolstrip(); newtoolstrip.items.add(new toolstriptextbox()); newtoolstrip.items.add(new toolstripbutton()); oldtoolstrip.items.addrange(newtoolstrip.items); there bug control: http://www.pcreview.co.uk/forums/possible-bug-toolstrip-items-addrange-t2900540.html

where need to use collections.sort() and comparable and comparator interfaces in java collection? -

i got understanding of collections gone through articles. 'm confusing should implement collections.sort() method , need use comparable interface(compareto() , comparator interface (compare()). comparable interface compare , reference object comparator compare 2 objects. i know situation need use methods ? thanks, you should not implement collections.sort() ; method built-in java . call method without supplying comparator sort natural order , if it's comparable . else, supply comparator sort comparator 's way. you should have class implement comparable , provide compareto method if class has natural ordering , indicated in comparable javadocs. example integer , double , have natural mathematical ordering. you should create class implements comparator when cannot make class of object sort comparable or when want present ordering alternative natural ordering, or when want impose order when there no natural ordering. example reverse natural

ios - Auto Layout with UITextField causes exception -

Image
i'd position uitextfield inside uiviewcontroller view using auto layout (dynamic resizing , 5 pt margin between textfield , superview). create view programmatically using loadview method. header of uiviewcontroller @property (weak, nonatomic) uitextfield *textfield; implementation -(void)loadview{ //frame uiview *frame = [[uiview alloc]initwithframe:cgrectmake(0, 0, 100, 40)]; [self setview:frame]; [self.view setbackgroundcolor:[uicolor redcolor]]; //textfield [self.textfield setdelegate:self]; [self.textfield settranslatesautoresizingmaskintoconstraints:no]; [self.textfield setbackgroundcolor:[uicolor bluecolor]]; [frame addsubview:self.textfield]; [frame addconstraints:[nslayoutconstraint constraintswithvisualformat:@"h:|-(5@50)-[textfield(==10@10)]-(5@50)-|" options:0 metrics:nil

android - java.lang.NumberFormatException: Invalid long: "" -

i getting dob string in format "\/date(588657600000-0400)\/" parsing below. string target = custom.getdob(); if (target == null || target == "") { holder.item3.settext("-"); } else { long millis = long.parselong(target.substring( target.indexof("(") + 1, target.indexof("-"))); java.text.dateformat df = new simpledateformat("mm-dd-yyyy", locale.english); holder.item3.settext(df.format(new date(millis))); } i getting error "04-08 22:44:09.864: e/androidruntime(3837): java.lang.numberformatexception : invalid long: "" . checking before, whether string object contains null or "" , setting "-", still getting exception. update: 04-08 22:59:17.423: e/androidruntime(4175): java.lang.numberformatexception: invalid long: "" 04-08 22:59:17.423: e/androidruntime(4175): @ java.lang.long.invalidlong(long.java:125) 04-08 22:59:17.423: e/and

seo - Removing spam subdomains from Google index -

if google search using "site:mydomain.com" (mydomain isn't mine obviously!) lot of first , 2nd page results contain bogus subdomains. first of all, wtf? why setup links create google index bogus subdomain website? whats scam here? i've had significant drop in google ranking on last 3 months , can't work out why. a sample of these subdomains: w. w3ww. www.lawsuitsettlementamounts.com2960. www.lawsuitsettlementamounts.com4519. www.lawsuitsettlementamounts.com3754. beft.ru5258. wa-go2ui.com10992. wa-go2ui.com10993. i've updated apache2's siteavailable file domain disallow wild card sub domains. other domain or www. allowed. (as per i've told google via webmaster). these bogus links return 403 is enough? should more? after doing bit more research think best response 404 "page not found". i've updated apache configs sites-enable/000-default contain following: edit - i've changed 404 4

Creating an array of linked lists java -

working on problem discovering how connections between nodes long , short distances apart reduce route 1 node another. im creating array of example [500] want each point in array connected 2 before , 2 follow it. , points in array connected random place. need create adjacency matrix (an array of linked lists) , im terrible linked lists. me setting up, here node class created: i going use array of arrays [][] figured since points connected more others linked list better suit needs. edit: yeah guy told me use javas linked list, whill dont understand cycle through array of [500] , create new linked list , set first 2 nodes in linked list positions in array? thanks guys! edit: got sorted out, anyways! public class smallworld { public static void main(string [] args){ list<integer>[] sworld = new list [500]; //fill array nodes. (int = 0; < sworld.length; i++){ sworld [i] = new linkedlist<integer>(); if(i == 0){ sworl

file - C++ return string keeps getting junk -

why return string here have sorts of junk on it? string getchunk(ifstream &in){ char buffer[5]; for(int x = 0; x < 5; x++){ buffer[x] = in.get(); cout << x << " " << buffer[x] << endl; } cout << buffer << endl; return buffer; } ifstream openfile; openfile.open ("bacon.txt"); chunk = getchunk(openfile); cout << chunk; i load of junk in string has junk on end of it, though debug says buffer being filled correct characters. thanks, c++ lot harder java. you need null terminate buffer. make buffer size 6 characters , 0 initialize it. fill first 5 locations you're doing now, leave last 1 alone. char buffer[6] = {0}; // <-- 0 initializes array for(int x = 0; x < 5; x++){ buffer[x] = in.get(); cout << x << " " << buffer[x] << endl; } cout << buffer << endl; return buffer; alternately, leave array size same, use string constructor

.net - CQRS Command Constructs -

i have cqrs command public sealed class requestroute { public requestroute(string fromaddressname, double fromlatitude, double fromlongitude, string toaddressname, double tolatitude, double tolongitude, string userid) { userid = userid; tolongitude = tolongitude; tolatitude = tolatitude; toaddressname = toaddressname; fromlongitude = fromlongitude; fromlatitude = fromlatitude; fromaddressname = fromaddressname; } public string fromaddressname { get; private set; } public double fromlatitude { get; private set; } public double fromlongitude { get; private set; } public string toaddressname { get; private set; } public double tolatitude { get; private set; } public double tolongitude { get; private set; } public string userid { get; private set; } } my programmer's intuition tells me should factor fromxxx , toxxx fields separate class called "address"...but i'm not

Does qemu/kvm support ovf? -

does qemu/kvm support ovf? able boot existing ovf packages? can not find related info both in ovf standard , qemu/kvm website. helpful link on this? thanks. you looking virt-tools contains virt-convert intended used convert ovf format usable qemu. build latest source. git repo https://github.com/virt-manager/virt-manager

jquery change or toggle images when clicked -

i'm trying 'when image1 clicked, show image2, when image2 clicked, show image3, when image3 clicked, show image1...' thing. it works 2 images - image1 goes 2 , image2 goes 1 , on, when 3rd image introduced gets messed up. code is: <img id ="rotate_images" src="img1_on.png"/> <script> $('#rotate_images').on({ 'click': function() { var src = ($(this).attr('src') === 'img1_on.png') ? 'img2_on.png' : 'img1_on.png'; $(this).attr('src', src); var src = ($(this).attr('src') === 'img2_on.png') ? 'img3_on.png' : 'img2_on.png'; $(this).attr('src', src); } }); i sort of know why it's happening - image1 goes image3, because skips first block of code, , image3 goes image2, same reason but...is there add in fix it? help. chris. fixed code:

apache - Use specific PHP file for specific directories -

i trying create mod_rewrite rules rewrite based on first level directory name plus failover rewrite standard file in case none of directory names matched. example: i have units.php, models.php , other.php. other.php file should handle non-assigned requests. http://www.mydomain.com/units/4435 should redirect /units.php?id=4435 http://www.mydomain.com/models/594 should redirect /models.php?id=594 http://www.mydomain.com/anything should redirect /other.php?id=anything http://www.mydomain.com/anything/893 should redirect /other.php?id=anything/893 let me know if makes sense. unsure of how structure rules , conditions achieve want. this have tried sfar. works urls starting 'units' or 'models' 500 error if try other url: rewriteengine on rewritecond %{script_filename} !-d rewritecond %{script_filename} !-f rewriterule ^(units)/(.+)$ /units.php?id=$2 [l,nc] rewriterule ^(models)/(.+)$ /models.php?id=$2 [l,nc] rewriterule ^(.+)$ /other.php?id=$2

c# - MarkdownSharp does not transform list -

the following string transformed markdown list html list: string list = "* item1\n* item 2"; however, if have other string, append list it, output unexpected. string text = "here **bold** text " + list; output: here <b>bold</b> text * item1 * item 2 it seems problem trying transform list exists in block of other text? if problem, intended behavior? i'm not familiar markdownsharp, markdown parsers expect 2 linebreaks ( \n ) between paragraph , paragraph, or new content. so, appending list , remove item1 potentially starting new list. being single linebreak ( \n ), markdownsharp not perceiving content start of new (just stray linebreak). try concatenating list \n\n . string text = "here **bold** text\n\n" + list;

scheme - Number in Sequence that a pair falls in -

i want find number in sequence pair falls in. trying write procedure verifies f(1, n) = 2n - 2 , f(m+1, n+1) = 2f(m, n). works when call (number 99, 100), doesn't work when call (number 100, 100). why doesn't work? sequence number (100, 100)? here procedure: (define (number m n) (if (= m 1) (- (* 2 n) 2) (* 2 (number (- m 1) (- n 1))))) why believe procedure "doesn't work"? function, defined, correctly implementing desired formula - , lead base case when both m , n equal: (- (* 2 1) 2) ; if m equals 1 n equals 1 the above return 0 of course, , multiplications in recursion cancel, because you'll multiplying 0 on , on again: (* 2 (* 2 ... (* 2 0))) => 0 so problem not in procedure itself, in formula it's implementing. make sure it's correct.

Need help to run my android app with extended ListActivity class -

Image
i have 1 activity called main_activity.xml , 2 java classes called main.java & menu.java. in menu.java class extended listactivity class. when run myapp giving popup forceclose. plz help. below code of menu.java: public class menu extends listactivity{ string classes[]={"main","second","third","china"}; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setlistadapter(new arrayadapter<string>(menu.this, android.r.layout.simple_list_item_1, classes)); } @override protected void onlistitemclick(listview l, view v, int position, long id) { // todo auto-generated method stub super.onlistitemclick(l, v, position, id); string selecteditem= classes[position]; try{ class myclass = class.forname("com.example.myapp."+selecteditem); intent myintent=new intent(menu.this, myclass); startactivity(myintent); } catch(classnotf

Error While installing Ruby -

i have used this procedure.i m using linux mint. i getting following error while installing. e: unable locate package libreadline6-dev e: unable locate package libyaml-dev e: unable locate package libgdbm-dev e: package 'ncurses-dev' has no installation candidate e: package 'bison' has no installation candidate e: package 'subversion' has no installation candidate e: package 'libffi-dev' has no installation candidate i think didn't installed rvm requirements . install requirements libreadline6-dev , libyaml-dev , libgdbm-dev ,etc.. think solve problem. install these command sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \ curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \ libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison \ subversion pkg-config or, refer this link.

web - No main class in small Java program + embedding as applet -

i'm having issue code. this. when compile in netbeans says " not find or load main class form" see right in code...what doing incorrectly? second of all, embed on web page compile , ? thank help. i'm week java gui stuff. package gui; import java.applet.applet; import java.awt.*; import java.awt.eventqueue; import java.awt.gridlayout; import javax.swing.*; class form { private static void display() { jtextfield field1 = new jtextfield(); jtextfield field2 = new jtextfield(); jtextfield field3 = new jtextfield(); jtextfield field4 = new jtextfield(); jtextfield field5 = new jtextfield(); jpanel panel = new jpanel(new gridlayout(0, 1)); panel.add(new jlabel("username:")); panel.add(field1); panel.add(new jlabel("password:")); panel.add(field2); panel.add(new jlabel("repeat password:")); panel.add(field3); panel.add(new jlabel

html - I would like to have a background-image with a 'fade out effect'. CSS3 -

is possible achieve fade out transparent effect on image center of image left of image i have tried below , no results #content { display: block; width: 960px; margin: auto; margin-top: 48px; background-image: url(../images/feature-image-wild-horse.jpg), -moz-linear-gradient(left, #444444, #999999); /* ff3.6+ */ overflow: hidden; } one solution use blurred inset box shadow ( https://developer.mozilla.org/en/docs/css/box-shadow ): http://jsfiddle.net/n1ck/nkhdh/4/ #content { width:350px; height:350px; background-image: url(http://placekitten.com/350/350); -moz-box-shadow: inset 70px 0px 50px -10px white; -webkit-box-shadow: inset 70px 0px 50px -10px white; box-shadow:inset 70px 0px 50px -10px white; } if want use gradient, can use :before gradient overlay background image, otherwise gradient won't seen. here's example of how can achieve this: http://jsfiddle.net/n1ck/brqcu/2/ #content { width:350px; height:350px;

hardware - VHDL: Properly clocking another component with respect to setup -

i working on fpga project in vhdl. i need copy 16 bit shift register fifo each time fills (eg after 16 new data bits have been fed shift register, want take newly formed 16 bit word , send fifo) my question is, need set data @ input of fifo 1 clock before asserting clock line on fifo? generic vhdl question, , not specific fifos. basically, possible set data , toggle clock in same operation, or need basic state machine set data on 1 clock edge , toggle fifo clock on next? for instance: fifo_d_in( 7 downto 0 ) <= shift_register; fifo_clk <= '1'; or if( state = 1 ) fifo_d_in( 7 downto 0 ) <= shift_register; state <= two; elsif( state = 2 ) fifo_clk <= '1'; end if; my gut tells me have setup data first, satisfy setup & hold requirements of input registers. thanks! the data must present setup time before clock edge, asserting clock @ same time possible data changes may result in unstable behaviour. one way confi

php - Cakephp calling a function between Model and View -

let have function: function getcarname() { return array(1 => 'bmw', 2 => 'mercedez benz', 3 => 'renault'); } i use function on both model , view, should create 2 same function on apphelper , car model? correct way achieve this? having 2 functions doing same thing bad idea violates don't repeat yourself principle. instead, add function car model , pass data controller(s) view(s) like: $this->set('carnames', $this->car->getcarnames()); the car names available in view via $carnames variable.

linux - How pkmap_page_table is used on kmap? -

pkmap_page_table has pointer of page table kmap when kernel starts. example, pkmap_base 0xffe00000 , fixaddr_start 0xfff00000, if kernel tries use high memory, ttb0's pte should set 0xffe00000 ~ 0xfff00000 virtual address. how pkmap_page_table's pte used making map? , how ttb0's pte modified same pkmap_page_table's pte? thank you. i not sure problem occuring there code sinnpet availble in "understading linux kernel" book. on page 309 ; last lines; "once procress awakened function checks whether process has mapped page invoking page_address() ; if no other process has mapped page yet inner loop restarted."

Fill ComboBox inside a DataGridView with two Different Tables in C#? -

i capable of filling combobox 1 datatable. not able fill same combobox datatable during runtime. first datatable , second datatable contains different data same columns. dtone= abcd.retrivdata(); cnsmnm.datasource = dtone; cnsmnm.displaymember = "one_name"; cnsmnm.valuemember = "one_id"; second datatable dtsecond= efgh.retrivdata(); cnsmnm.datasource = dtsecond; cnsmnm.displaymember = "one_name"; cnsmnm.valuemember = "one_id"; you can use datatable.merge method . this: dtone.merge(dtsecond); cnsmnm.datasource = dtone;

c# - Storing objects to a list and searching for them -

i want able create series of objects in list , search particular result in list (there may 0, 1 or many hits) , display results in text box. this have far, can seem display last object entered. public partial class organiserwindow : form { public organiserwindow() { initializecomponent(); } list<album> albumlist = new list<album>(); private void createalbum_click(object sender, eventargs e) { albumlist.add(new album(albumbox.text, artistbox.text)); } private void searchalbum_click(object sender, eventargs e) { var albumresult = album in albumlist album.albumname != null// == albumbox.text select new { name = album.albumname, artist = album.artistname }; foreach (var item in albumresult) { albumresultbox.text = string.join(environment.newline, item.name + " " + item.artist); } } } public class album {

Why not allocate and deallocate memory frequently in C++ games? -

i'm recent convert c++ game programming - have lot of experience dealing memory management , garbage collection woes in c#, not c++. i've heard vague advice in past avoid allocations , deallocations during gameplay (i.e. new , delete ) , pre-allocate might need front. that's lot more tedious , architecturally complex allocating , freeing game objects needed while game's running (enemies, particles, etc.). i think advice read referring resource-constrained platforms - i'm aiming develop pc, , imagine game state data changing on order of few megabytes @ most. rest textures, sound assets, etc. i'll preloading. so question is: in world of pcs gigabytes of memory, worth headache set elaborate memory pooling, pre-allocation, , forth game state data? or unquestioned "best practice" tradition evolved when maxing out limited platforms, repeated gospel? if 2 mb of game data gets fragmented , spread on 4mb, can't imagine mattering in slightest on

Compiling a Java USB program with unusual errors/warnings -

this question has answer here: javax.usb.usbexception: properties file javax.usb.properties not found 1 answer i developing usb reading java program name of attached usb device. code wrote: import java.io.unsupportedencodingexception; import java.util.list; import javax.usb.*; import javax.usb.usbdevice; import javax.usb.usbdisconnectedexception; import javax.usb.usbexception; import javax.usb.usbhostmanager; import javax.usb.usbhub; import javax.usb.usbservices; public class listusbdevices { public static void main(string[] args) throws securityexception, usbexception, unsupportedencodingexception, usbdisconnectedexception { usbservices services = usbhostmanager.getusbservices(); usbhub roothub = services.getrootusbhub(); list<usbdevice> devices = roothub.getattachedusbdevices(); if (devices.size() > 0) {

authorization - ASP.Net Roles and Membership check for Users in role for multiple roles -

i have users in membership , 1 user can have 1 or more 1 roles assigned. want check specific roles of page example: role1, role2, role3, role4, role5 users have access of role2 , role3 can access page1.aspx , if user have access of role1 , role2 can access because role2 there available. i have implemented membership , have list of user's roles string array of string[] roles = roles.getrolesforuser(user.identity.name); how can check against multiple roles? may need 1 one check using roles.isuserinrole function? i have used; returns 0 count because of partner in capital. how can ignore case? , below right way check array against array? string[] userroles = { "partner", "testsetsr" }; string[] requiredroles = { "contractor", "customer", "sims", "nonclientau", "partner" }; var countinroles = userroles.intersect(requiredroles).count(); you have implement own authorization filter att

How can I delete a node value retaining the attribute in XML in Flex -

i have xml like: <root> <item> <item name="fruit">fruits</item> <item name="vegetable">vegetables</item> </item> </root> how delete node value alone ("fruits" "vegetables") retaining attribute values "fruit" "vegetable" in xml in flex. i think should iterate through items. if want delete values items, so: var i:int = 0; each (var node:xml in xml.item.item) { xml.item.item[i] = ""; i++; } you can specify condition: var i:int = 0; each (var node:xml in xml.item.item) { if (node.@name == 'fruit') xml.item.item[i] = ""; i++; }

java - Spring - how to @Autowire a bean WITHOUT calling ClassPathXmlApplicationContext -

is possible autowire beans without calling: applicationcontext context = new classpathxmlapplicationcontext("applicationcontext.xml"); if mean no-xml conifg try test class t1 { } class t2 { @autowired t1 t1; } public class main { public static void main(string[] args) throws exception { annotationconfigapplicationcontext ctx = new annotationconfigapplicationcontext(); ctx.register(t1.class, t2.class); ctx.refresh(); system.out.println(ctx.getbean(t2.class).t1); } } it show t1 bean injected t2 bean

android - how to cache remote view? -

i need know if possible cache layout remote view ? if how can cache or clean cache there example here tried google could't find example how cache layout remote view for example how cache notification progress ! thank time updatetask = this; //setup notification id , information random r = new random(); notification_id = r.nextint(80-65) + 1; notification_id++; int icon = r.drawable.icon; long when = system.currenttimemillis(); notification = new notification(icon, getstring(r.string.app_name), when); contentview = new remoteviews(getpackagename(), r.layout.custom_notification); contentview.settextviewtext(r.id.text, "cool"+notification_id); notification.contentview = contentview; notification.flags |= notification.flag_no_clear; notification.flags |= notification.flag_ongoing_event; intent notificationintent = new intent(); notificationintent.setflags(intent.fla

web services - How to access the webservice in grails through secure layer -

i have simple method in controller class. class trainingcontroller{ def gettrainingsjson(){ def traininglist = training.list() println "called====" //render traininglist json render "${params.callback}(${traininglist json})" } } which gets list of training, in html page have request follows <script type="text/javascript"> $(function(){ $.getjson('http://localhost:8080/training/gettrainingsjson?callback=?', function(data) { console.log("success"); alert(data); }); }); </script> the request served after login. without login response login page html format. the request across servers (from php grails). want ensure secure communication must established, how authenticate through json using spring security in grails. and how ensure nobody can forge request , resp

angularjs - $http post in Angular.js -

i've started learning angular.js. how re-write following code in angular.js? var postdata = "<requestinfo> " + "<event>getpersons</event> " + "</requestinfo>"; var req = new xmlhttprequest(); req.onreadystatechange = function () { if (req.readystate == 4 || req.readystate == "complete") { if (req.status == 200) { console.log(req.responsetext); } } }; try { req.open('post', 'http://samedomain.com/getpersons', false); req.send(postdata); } catch (e) { console.log(e); } here's have far - function testcontroller($scope) { $scope.persons = $http({ url: 'http://samedomain.com/getpersons', method: "post", data: postdata, headers: {'content-type': 'application/x-www-form-urlenc

css - html select box down arrow looks like mouse -

Image
on ie8,9 , 10 select element looks attached picture. drop down arrow replaced looks more or less mouse. on firefox , chrome looks standard drop down down arrow. i can't find anywhere i've done css alter selects. any suggestions? <td> <select id='allocated' name='alloc' onchange='allocchange()'> <option value='??' selected='selected'>??</option> <option value='1a' >1a</option> <option value='1b' >1b</option> <option value='1c' >1c</option> <option value='2a' >2a</option> <option value='2b' >2b</option> <option value='3a' >3a</option> </select> </td> css not factor - same thing happens when stylesheet not loaded it may default.. can change arrow using css .styleselect select { background: transparent; width: 168px; paddi

sql server - Update column from another join column ,, -

first should easy db'es giving me pain here dont know why ,, i have 2 tables , [table1] named applicationforms , [table2] named wfinstance need update formsubmitdate in table1 starteddate value in table 2 formsubmitdate null. write following query update applicationform set formsubmitdate = wfi.startdate applicationform app , workflowinstances wfi app.formsubmitdate null , wfi.applicationid = app.id when run query sql regenerate query one,, update applicationform set formsubmitdate = wfi.startdate applicationform app inner join workflowinstances wfi on app.id = wfi.applicationid cross join applicationform (app.formsubmitdate null) i tried write statment using join ,, update applicationform set formsubmitdate = wfi.startdate applicationform join workflowinstances wfi on applicationform.id = wfi.applicationid formsubmitdate null and sql ge

c++11 - Exposing member variables methods in C++ -

i have simple object-components design. like: class object1 : public object { component1 _comp1; component2 _comp2; ... componentn _compn; }; is possible expose public: methods of objects1 methods componentk without creating method in object1 calls internally componentk method? i need simple way of doing because it's quite annoying write function every time want expose componentk method. not directly, no. use private inheritance inherit components instead of aggregating them (note private inheritance not express is-a ), , publish of member functions using . this: class object1 : public object, private component1, private component2, ..., private componentn { public: using component1::function1(); using component1::function2(); ... using componentn::functionm(); }; i'm not saying it's best way it, it's a way.

javascript - Angular JS - Using {{}} in script -

i'm new angular don't know if i'm trying right thing here. if not, please point me in right direction. what want do: i'm using json external map data angular-google-maps load in data. json has 100 places, names, latitudes , longitudes. want use angular loop through data , place markers on map each place. html <body ng-controller="examplecontroller"> <input type="text" ng-model="data.message"> <li class="places" ng-repeat="place in places"> <p class="link">{{place.name}}</p> <p>{{place.lat}}</p> <p>{{place.lng}}</p> <div class="google-map" center="centerproperty" zoom="zoomproperty" markers="markersproperty" latitude="clickedlatitudeproperty" longitude="clickedlongitudeproperty" mark-click="true" draggable="true&quo

apache - Is meta charset required if AddDefaultCharset is set? -

is there reason why should keep <meta charset='utf-8'> in html head when .htaccess file has adddefaultcharset utf-8 ? just serving files on web rather redundant. since people may want save page file , open later without context of web server though, it's practice embed information document using meta tag.

Proper way of defining a javascript variable? -

is below javascript code have proper variable declaration, or other way define ? may know method of variable declarations ? var jqfuncs = { runfunc: { "jsonp": { run: function (id) { var demobox = $('#' + id); demobox.html('<img id="loading" src="images/loading.gif" />'); $.getjson("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?", { tags: "jquery", tagmode: "any", format: "json" }, function (data) { demobox.empty(); $.each(data.items, function (i, item) { demobox.append('<a href="' + item.link + '" target="_blank"><img style="max-width:150px;" src="' + item.media.m + '" alt="' + item.title + '" title="' + item.title + '" />'); if (i == 10) r

C# error - "Not all code paths return a value" -

this simple method. use entity framework data , check values in if statement . right method marked red. this method: private bool issoleinproduction(long? shoelastid) { if (shoelastid == null) { messagebox.show(resources.error_save, "error", messageboxbuttons.ok, messageboxicon.error); return false; } isoleservice soleservice = unitydependencyresolver.instance.getservice<isoleservice>(); list<sole> entity = soleservice.all().where(s => s.shoelastid == shoelastid).tolist(); if (entity.count() != 0) { foreach (var items in entity) { if (items.status == 20) { return true; } else { return false; } } } else { return false; } } what missing? you need take a

sql - How to fetch liferay entity through custom-finder in custom plugin portlet? -

how can fetch liferay entities through custom-finder using custom sql? following sql query written in default.xml ( i have trimmed down query bare minimum logic remains simple. since included few functions , joins couldn't use dynamicquery api ): select grp.* group_ site = 1 , active_ = 1 , type_ <> 3 relevant code in mycustomgroupfinderimpl.java : session session = null; try { session = opensession(); // fetches query string default.xml string sql = customsqlutil.get(find_only_active_sites); sqlquery sqlquery = session.createsqlquery(sql); sqlquery.addentity("group_", groupimpl.class); // sqlquery.addentity("group_", portalclassloaderutil.getclassloader().loadclass("com.liferay.portal.model.impl.groupimpl")); return (list<group>) queryutil.list(sqlquery, getdialect(), 0, queryutil.all_pos); } catch (exception e) { throw new systemexception(e); } { closesession(sessi

java - Array compare string -

hi im trying figure out why code isn't doing want do. when run code if statement in loop. changed logic around loop time. im not sure why . (int col =0; col< s ; col++){ system.out.print(col+ ": "); (int row = 0; row<s; row++) { x=val[row][col]; if (table[row][col]==row) { system.out.print(x+1); } //system.out.print(val[col][row]+" "); if (row+1==s) system.out.println(); } } you have semicolon @ end of if statement, remove it. if (x==2);

deployment - How to deploy multiple applications together -

i have following: windows service wrote, used 2 following apps: client app. agent app. both client , agent can't function without service. our current installation using clickonce (the service not yet deployed). what want: 2 separate installations - client+service, agent+service. because have many machines perform tasks clients send them, , don't need client. also, not wants client wants make machine agent well. deploy logical packages - doesn't make sense deploy client, example, because can't run itself. doesn't make sense deploy service itself. maintain versions compatibility - how handle following scenario: installed agent+service version 1, installed client+service version 2. elevated privileges: possible install windows service on machine using account has elevated privileges, current privileges aren't elevated? can make silent installation? clickonce nice not mandatory. if there better solutions meet requirements, switch th

How to parse complex XML to multiple inserts and updates in SQL server? -

i have found examples of parsing xml inserts. these examples simple. this: <person> <name>martin</name> </person> <person> <name>john</name> </person> but have xml similar - need have inserts other tables child elements. <root> <family> <name>smith</name> <address>some road 1</address> <persons> <person> <name>tina</name> <hobbies> <hobby>some hobby 1</hobby> <hobby>some hobby 2</hobby> </hobbies> </person> <person> <name>martin</name> <hobbies> <hobby>some hobby 1</hobby> <hobby>some hobby 2</hobby> </hobbies> </per

python - A pythonic way to remove all instances of an element without generating a new list -

there many questions similar ( here one ) solutions i've seen use list comprehension or filter , ways generate new list (or new iterator in case of filter in python 3.x). there solutions remove instances modifying list ( like this , and this ), , last resort. however, asking see if there more elegant ("pythonic" question calls it) way of doing it. why disregarding solutions generate new list: iterating on collection of lists, , python allows me modify "current" list iterating over, not replace entirely: >>> ll= [[1,2,3], [2,3,4], [4,5,6]] >>> l in ll: if l[0] == 2: l = [10] >>> ll [[1, 2, 3], [2, 3, 4], [4, 5, 6]] #replacement didn't happen >>> l in ll: if l[0] == 2: l.remove(2) >>> ll [[1, 2, 3], [3, 4], [4, 5, 6]] #modification succeeded you need use slice assignment replace list elements instead of list itself: for l in ll: if l[0] == 2:

Python and Django Blog Sample Project -

i newbie python django, , have started sample project "blog". currently blog posts added database manually, want @ front end providing form user. created model.py , views.py files, unable see these fields on front end. have copied of code below: models.py : class posts(models.model): author = models.charfield(max_length = 30) title = models.charfield(max_length = 100) bodytext = models.textfield() timestamp = models.datetimefield() class postform(modelform): class meta: model = posts views.py : def home(request): content = posts.objects.all()[:5] return render_to_response('index.html',{'posts' : content}) def save_blog(request): form = postform if request.post: form = postform(request.post) if form.is_valid(): form.save return render_to_response('index.html',{'form' : form},context_instance=requestcontext(request)) url.py : from djang