Posts

entity framework 4 - EF Code first doesn't load my collection of child objects -

i have 2 objects: public class program { [key] [databasegenerated(databasegeneratedoption.identity)] public long id { get; set; } public string name { get; set; } public virtual icollection<videofile> files { get; set; } } public class videofile { [key] [databasegenerated(databasegeneratedoption.identity)] public long id { get; set; } [required] public string path { get; set; } [required] public virtual program program { get; set; } } the 2 tables correctly created in database, when save program insert files childs too, when tried program file collection come nulls, have lazyload enable, , default entity framework return empty collection when child collection empty why have null?

objective c - CCLayer keeps shifting position -

i using cocos2d , have following code moves layer based on player touching screen. reason, each time code called position of layer shifts 32 in 1 direction or other. cant fathom why happening. there no other code anywhere in program manipulates position of these ccnodes (or other node). -(void) animatestructure:(int)index and:(ccsprite*)asprite at:(cgpoint)apoint { cgpoint point1 = self.position; cgpoint point2 = playersprite.position; id move = [ccmoveby actionwithduration:0.1 position:ccp(32*tempx,32*tempy)]; [self runaction:move]; id move2 = [ccmoveby actionwithduration:0.1 position:ccp(-32*tempx,-32*tempy)]; [playersprite runaction:move2]; self.position = point1; playersprite.position = point2; } not how move actions play-out if set position while action in progress, case here.

java - Best practices for sharing web-tier code (Controllers and JSPs) between similar web apps -

i'm working on rewriting aging web applications. there 2 in particular very, similar, yet share no code today , aim fix that. the projects being rewritten maven, spring mvc, , sitemesh. model tier code easy enough share using jars. don't know of ways share common web-tier code (jsps , controllers) between similar apps. here's background. these apps webstores. 1 normal store (think amazon.com) user can sign into, search products, add shopping cart, , check out. other same thing, it's punchout site. product browse , shopping cart portions identical. sign in , checkout, however, different. i'm oversimplifying, it's enough illustrate problem. there's significant portion of web-tier code in product browse , shopping cart sections should able shared between two. i don't think it's possible have same war file running either "mode" based on environment variable or settings different database. 1 of differences different sprin...

Change input value but not change result in PhpExcel -

i have got problem phpexcel below function function test($a, $b) { // create new phpexcel object single sheet $objphpexcel = new phpexcel(); $activesheet = $objphpexcel->getactivesheet(); $activesheet->setcellvalue('b2',$a); $activesheet->setcellvalue('b3',$b); $activesheet->setcellvalue('c4',"=b2+b3"); $c4 = $activesheet ->getcell('c4')->getcalculatedvalue(); echo "c4:$c4<br/>"; } finally, call function test(10, 20); test(40, 70); test(30, 80); but, result is c4:30 c4:30 c4:30 why getcalculatedvalue() doesn't change result? seems function gets first value. you can change result, performance reasons calculation engine caches result of formula calculation once it's been calculated. if want change underlying data, have flush cache before requesting calculated value again: phpexcel_calculation::getinstance()->clearcalculationcache(); or ...

objective c - Repositioning of a UIView after CGAffineRotation -

i'm drawing map of hexagons inside uiview , next step give in isometric view. this, transformed map using cgaffinetransform, rotation , scaling, reaching goal. now, if map becomes bigger, when rotate it, lower left corner goes out screen, frame before , after transformation: 2012-03-07 17:08:06.160 pratofiorito[941:f803] x: 0.000000 - y: 0.000000 || width: 1408.734619 - height: 1640.000000 2012-03-07 17:08:06.163 pratofiorito[941:f803] x: -373.523132 - y: 281.054779 || width: 2155.781006 - height: 1077.890503 i can't understand new point of origin , how can calculate replace view correctly. can me?

mysql - Whats the best way to add arrays in php dynamically -

i iterating on data dynamically. data contains 3 fields want insert array.. array(field1,field2,field3)..and insert array array (nest it). nest array main array. problem dont know how 1 array out of loop contain nested arrays. $myarray=array(); while($row=mysql_fetch_array($result)) { $myarray+= array(field1,field2,field3); } how add them dynamically..i know wrong way..but how do it?! while ($row = mysql_fetch_assoc($result1) { $myarray[] = array($row['field1'], $row['field2'], $row['field3']); } if want add whole content of each row, i.e. every field in row, can use while ($row = mysql_fetch_assoc($result1) { $myarray[] = $row; } or single line: while ($myarray[] = mysql_fetch_assoc($result)); then can access e.g. field2 of row 5 $myarray[4]['field2'] in question use function mysql_fetch_array. please use mysql_fetch_assoc better way. mysql_fetch_array returns every value twice, once numeric index ...

Java - Reading from an ArrayList from another class -

we've not covered arraylists arrays , 2d arrays. need able read arraylist class. main aim read them in loop , use values stored in them display items. however, have made quick program test out , keep getting error java.lang.indexoutofboundsexception: index: 0, size: 0 @ java.util.arraylist.rangecheck(arraylist.java:604) @ java.util.arraylist.get(arraylist.java:382) @ main.main(main.java:14) here code import java.util.arraylist; public class main { public static void main() { system.out.println("test"); arraylist <objects> xcoords = new arraylist<objects>(); for( int x = 1 ; x < xcoords.size() ; x++ ) { system.out.println(xcoords.get(x)); } } } and class arraylist import java.util.arraylist; public class objects { public void xco() { arraylist xcoords = new arraylist(); //x coords //destroyable xcoords.add(5); xcoords.a...