Friday, 15 July 2011

java - How to assign a value to a reference? -



java - How to assign a value to a reference? -

i'm trying create roguelike in java practice. code generate floor (right big room wall tiles on edge). i'm trying set tiles in tile array either wall tile or floor tile. although when leave settile method, revert value before entering method. i'm going insane. here's code:

public floor(int width, int height) { this.tiles = new tile[(width+1)*(height+1)]; this.width = width; this.height = height; generatetiles(); boolean test = false; } public tile gettile(int x, int y) { homecoming tiles[y * width + x]; } public void settile(int x, int y, tile tile) { tile tiletoset = gettile(x,y); tiletoset = tile; } private void generatetiles() { (int = 0; < tiles.length; i++) { tiles[i] = new tile(); } //make top wall (int = 0; i<width;i++) { settile(i,0,new walltile()); } } }

your settile doesn't create sense. you're retrieving tile @ position, storing in local variable tiletoset , overwriting value of variable.

what you're trying storing given tile in tiles array. analogous how gettile implemented, can with:

public void settile(int x, int y, tile tile) { tiles[y * width + x] = tile; }

note not equivalent (but seem think is) with:

public void settile(int x, int y, tile tile) { tile tiletoset = tiles[y * width + x]; tiletoset = tile; }

java processing

Google App Script to trigger email -



Google App Script to trigger email -

i'm trying email fire alerting me if column in google sheet =x.

i've tried using notification scheme using using eq operator turn on when cell equals x, changes cell , notification scheme supposed send email right away. it's not working way, email never fires.

i'm think need script fire email if cell =x nice because customize email made more sense. (i.e. "the conference room event beingness held has reached capacity, should remove reservation form")

i new google scripts , utilize little help creating email trigger if cell =x script.

thanks,

dave

you need add together script run onedit.

function onedit() { var sheet = spreadsheetapp.getactivespreadsheet().getsheetbyname("nameofyoursheet"); var currentvalue = sheet.getrange("a5").getvalue(); if (currentvalue == (whatevervalueyourelookingfor)) { mailapp.sendemail("youremail@domain.com", "alert: cell in sheet equal x!", "the message body want send."); } }

email triggers google-apps-script

ios5 - Pull out valueForKeys of an inner NSMutableDictionary iOS -



ios5 - Pull out valueForKeys of an inner NSMutableDictionary iOS -

ok , store json feed array called jsonarray. loop on jsonarray pulling out array keys , storing them strings. add together strings inner dictionary called innerdict, add together dictionary info dictionary key thepostcode using below. innerdict stored within infodict.

-(void)pointinfo{ infodict = [[nsmutabledictionary alloc]init]; (int = 0; < jsonarray.count; i++) { innerdict = [[nsmutabledictionary alloc]init]; info = [[jsonarray objectatindex:i]objectforkey:@"inf"]; thepostcode = [[jsonarray objectatindex:i]objectforkey:@"pc"]; mail service = [[jsonarray objectatindex:i]objectforkey:@"mail"]; url = [[jsonarray objectatindex:i]objectforkey:@"url"]; type = [[jsonarray objectatindex:i]objectforkey:@"items"]; [innerdict setobject:type forkey:@"items"]; [innerdict setobject:info forkey:@"info"]; [innerdict setobject:mail forkey:@"mail"]; [innerdict setobject:url forkey:@"url"]; [infodict setobject:innerdict forkey:thepostcode]; }

the output of infodict looks this:

infodict { "me14 4nn" = { info = ""; items = 4; mail service = ""; url = ""; }; "me15 6lg" = { info = af; items = "0,6,9"; mail service = ""; url = ""; }; "me15 6ye" = { info = ""; items = "4,5,6,7,11"; mail service = ""; url = ""; }; }

now want values of innerdict object i.e "me15 6ye" above , utilize query pull out associated info info, items, mail service , url keys. have been staring @ screen few hours not getting it.

i can pull out lastly object of inner dict using below grab values associated particular postcode innerdict key. brain fried @ moment!

for (nsmutabledictionary *dictionary in infodict) { nslog(@"url %@", [innerdict objectforkey:@"url"]); nslog(@"mail %@", [innerdict objectforkey:@"mail"]); nslog(@"items %@", [innerdict objectforkey:@"items"]); nslog(@"items %@", [innerdict objectforkey:@"info"]); }

to right inner dictionary, utilize objectforkey:

nsdictionary *innerdict = [infodict objectforkey:@"me15 6ye"]; nslog(@"url %@", [innerdict objectforkey:@"url"]); nslog(@"mail %@", [innerdict objectforkey:@"mail"]); nslog(@"items %@", [innerdict objectforkey:@"items"]); nslog(@"info %@", [innerdict objectforkey:@"info"]);

ios ios5 nsdictionary nsmutabledictionary key-value-coding

.net - Is there a way in C# to replace a collection of characters with another collection respectively? -



.net - Is there a way in C# to replace a collection of characters with another collection respectively? -

is there way in c# replace collection of characters collection respectively following:

"abcdef.kindofreplace( "ae", "12"); // result: "1bcd2f"

no there isn't seems me code equivalent to:

var mystring = "abcdef"; var newstring = mystring.replace("a", "1").replace("e", "2");

you write extension method create nicer, big replacement arrays wouldn't particularly efficient.

edit:

as pointed out in comments below utilize stringbuilder in cases have big number of strings/chars replace.

.net regex string replace

ios - UITextField that is always first responder -



ios - UITextField that is always first responder -

i have viewcontroller textfield, next button, , button. want text field editable while having keyboard present. want customize keyboard own, come 1 time figure part out.

edit: keyboard in case keypad 10 digits , backspace key

what best way go this? i've been working around having uitextfield works custom keyboard view, , create first responder when view loads, maybe there improve ways.

thanks in advance!

to create uitextfield utilize keyboard...

in viewdidappear or viewwllappear function this...

[self.textfield becomefirstresponder];

this create keyboard appear , textfield respond input.

to dismiss keyboard have run...

[self.textfield resignfirstresponder];

as long don't run maintain keyboard focus.

ios uitextfield uikeyboard first-responder

iphone - Using pkrevealcontroller on existing Xcode storyboard -



iphone - Using pkrevealcontroller on existing Xcode storyboard -

i trying integrate pkrevealcontroller sliding menu existing ios project has existing storyboard segues, etc. extended uinavigationviewcontroller , linked new class nav controller on storyboard. in app delegate following:

mainnavviewcontroller *frontviewcontroller = [[mainnavviewcontroller alloc] initwithrootviewcontroller:[[myrootviewcontroller alloc] init]]; uiviewcontroller *rightviewcontroller = [[menuviewcontroller alloc] init]; self.revealcontroller = [pkrevealcontroller revealcontrollerwithfrontviewcontroller:frontviewcontroller rightviewcontroller:rightviewcontroller options:nil]; self.window.rootviewcontroller = self.revealcontroller;

when run application, adds sliding menu icon navigation bar, , frontview slides want it. not using title or segues have added on storyboard. i'm trying possible.

i think problem you're instantiating new frontviewcontroller -- that's not 1 that's in storyboard. i'm not sure how this, seek this. add together uiviewcontroller in storyboard -- alter class pkrevealcontroller, , create initial controller in storyboard, don't hook rest of scenes. give mainnavviewcontroller identifier in ib, alter code in app delegate this:

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.revealcontroller = (pkrevealcontroller *)self.window.rootviewcontroller; uiviewcontroller *rightviewcontroller = [[menuviewcontroller alloc] init]; mainnavviewcontroller *frontviewcontroller = [[uistoryboard storyboardwithname:@"mainstoryboard" bundle:nil] instantiateviewcontrollerwithidentifier:@"frontviewcontroller"]; [self.revealcontroller setfrontviewcontroller:frontviewcontroller]; [self.revealcontroller setrightviewcontroller:rightviewcontroller]; homecoming yes; }

iphone ios uinavigationcontroller storyboard

objective c - Image aspect ratio change after inserting it into imageview -



objective c - Image aspect ratio change after inserting it into imageview -

so i'm trying load image photographic camera image view. i've got done, images aspect ratio changes.

i tried setting content mode imageview no effect. here how it:

uiimage *picture=[uiimage imagewithdata:slika]; imageview = uiviewcontentmodescaleaspectfit; [imageview setimage:picture forstate:uicontrolstatenormal];

any ideas?

is image view own view? or it's, example, cell's default imageview?

and should write so:

imageview.contentmode = uiviewcontentmodescaleaspectfit; imageview.image = [uiimage imagenamed:picture];

or

[imageview setimage:picture];

there no method [imageview setimage:picture forstate:uicontrolstatenormal]; uiimageview, available uibutton (and may other uicontrols, uiimageview not subclass of uicontrol - direct subclass of uiview) . button not scale images preserving aspect ratio.

objective-c xcode uiimageview

Warning: implode() [function.implode]: Invalid arguments passed in descpage.php on line 221 -



Warning: implode() [function.implode]: Invalid arguments passed in descpage.php on line 221 -

i getting next error:

warning: implode() [function.implode]: invalid arguments passed in /descpage.php on line 221

i read through site , cannot see covered.

could please have , see if can see cause these issues.

this old amzon store script, don't think programmer updating anymore.

here total code page:

` function push($myarray,$text){ $myarray[] = $text; } if ($details[address]) { force ($descriptors, "<b>$language_text[details_text1]</b> ".($details[address][0])); } if ($details[amazonmaximumage]) { if ($details[amazonmaximumage] < "24") { $maxyears = sprintf("%.0f", $details[amazonmaximumage][0]); force ($descriptors, "<b>$language_text[details_text2]</b> $maxyears ".$language_text[miscellaneous1]); } else{ $maxyears = sprintf("%.0f", $details[amazonmaximumage][0] / 12); force ($descriptors, "<b>$language_text[details_text2]</b> $maxyears ".$language_text[miscellaneous2]); } } if ($details[manufacturermaximumage]) { if ($details[manufacturermaximumage] < "24") { $maxyears = sprintf("%.0f", $details[manufacturermaximumage][0]); force ($descriptors, "<b>$language_text[details_text91]</b> $maxyears ".$language_text[miscellaneous1]); } else{ $maxyears = sprintf("%.0f", $details[manufacturermaximumage][0] / 12); force ($descriptors, "<b>$language_text[details_text91]</b> $maxyears ".$language_text[miscellaneous2]); } } if ($details[amazonminimumage]) force ($descriptors, "<b>$language_text[details_text3]</b> ".($details[amazonminimumage][0])); if ($details[aperturemodes]) force ($descriptors, "<b>$language_text[details_text4]</b> ".($details[aperturemodes][0])); if ($details[aspectratio]) force ($descriptors, "<b>$language_text[details_text5]</b> ".($details[aspectratio][0])); if ($details[audiencerating]) force ($descriptors, "<b>$language_text[details_text6]</b> ".($details[audiencerating][0])); if ($details[audioformat]) force ($descriptors, "<b>$language_text[details_text7]</b> ".($details[audioformat][0])); if ($details[backfinding]) force ($descriptors, "<b>$language_text[details_text8]</b> ".($details[backfinding][0])); if ($details[bandmaterialtype]) force ($descriptors, "<b>$language_text[details_text9]</b> ".($details[bandmaterialtype][0])); if ($details[batteriesincluded]) force ($descriptors, "<b>$language_text[details_text10]</b> ".($details[batteriesincluded][0])); if ($details[batteries]) force ($descriptors, "<b>$language_text[details_text11]</b> ".($details[batteries][0])); if ($details[batterydescription]) force ($descriptors, "<b>$language_text[details_text12]</b> ".($details[batterydescription][0])); if ($details[batterytype]) force ($descriptors, "<b>$language_text[details_text13]</b> ".($details[batterytype][0])); if ($details[bezelmaterialtype]) force ($descriptors, "<b>$language_text[details_text14]</b> ".($details[bezelmaterialtype][0])); if ($details[binding]) force ($descriptors, "<b>$language_text[details_text15]</b> ".($details[binding][0])); if ($details[brand]) force ($descriptors, "<b>$language_text[details_text16]</b> ".($details[brand][0])); if ($details[calendartype]) force ($descriptors, "<b>$language_text[details_text17]</b> ".($details[calendartype][0])); if ($details[cameramanualfeatures]) force ($descriptors, "<b>$language_text[details_text18]</b> ".($details[cameramanualfeatures][0])); if ($details[casediameter]) force ($descriptors, "<b>$language_text[details_text19]</b> ".($details[casediameter][0])); if ($details[casematerialtype]) force ($descriptors, "<b>$language_text[details_text20]</b> ".($details[casematerialtype][0])); if ($details[casethickness]) force ($descriptors, "<b>$language_text[details_text21]</b> ".($details[casethickness][0])); if ($details[casetype]) force ($descriptors, "<b>$language_text[details_text22]</b> ".($details[casetype][0])); if ($details[cdrwdescription]) force ($descriptors, "<b>$language_text[details_text23]</b> ".($details[cdrwdescription][0])); if ($details[chaintype]) force ($descriptors, "<b>$language_text[details_text24]</b> ".($details[chaintype][0])); if ($details[clasptype]) force ($descriptors, "<b>$language_text[details_text25]</b> ".($details[clasptype][0])); if ($details[clothingsize]) force ($descriptors, "<b>$language_text[details_text26]</b> ".($details[clothingsize][0])); if ($details[color]) force ($descriptors, "<b>$language_text[details_text27]</b> ".($details[color][0])); if ($details[compatibility]) force ($descriptors, "<b>$language_text[details_text28]</b> ".($details[compatibility][0])); if ($details[computerhardwaretype]) force ($descriptors, "<b>$language_text[details_text29]</b> ".($details[computerhardwaretype][0])); if ($details[computerplatform]) force ($descriptors, "<b>$language_text[details_text30]</b> ".($details[computerplatform][0])); if ($details[connectivity]) force ($descriptors, "<b>$language_text[details_text31]</b> ".($details[connectivity][0])); if ($details[continuousshootingspeed]) force ($descriptors, "<b>$language_text[details_text32]</b> ".($details[continuousshootingspeed][0])); if ($details[country]) force ($descriptors, "<b>$language_text[details_text33]</b> ".($details[country][0])); if ($details[cpumanufacturer]) force ($descriptors, "<b>$language_text[details_text34]</b> ".($details[cpumanufacturer][0])); if ($details[cpuspeed]) force ($descriptors, "<b>$language_text[details_text35]</b> ".($details[cpuspeed][0])); if ($details[cputype]) force ($descriptors, "<b>$language_text[details_text36]</b> ".($details[cputype][0])); if ($details[cuisine]) force ($descriptors, "<b>$language_text[details_text37]</b> ".($details[cuisine][0])); if ($details[delaybetweenshots]) force ($descriptors, "<b>$language_text[details_text38]</b> ".($details[delaybetweenshots][0])); if ($details[department]) force ($descriptors, "<b>$language_text[details_text39]</b> ".($details[department][0])); if ($details[deweydecimalnumber]) force ($descriptors, "<b>$language_text[details_text40]</b> ".($details[deweydecimalnumber][0])); if ($details[dialcolor]) force ($descriptors, "<b>$language_text[details_text41]</b> ".($details[dialcolor][0])); if ($details[dialwindowmaterialtype]) force ($descriptors, "<b>$language_text[details_text42]</b> ".($details[dialwindowmaterialtype][0])); if ($details[digitalzoom]) force ($descriptors, "<b>$language_text[details_text43]</b> ".($details[digitalzoom][0])); if ($details[displaysize]) force ($descriptors, "<b>$language_text[details_text44]</b> ".($details[displaysize][0])); if ($details[dvdrwdescription]) force ($descriptors, "<b>$language_text[details_text45]</b> ".($details[dvdrwdescription][0])); if ($details[ean]) force ($descriptors, "<b>$language_text[details_text46]</b> ".($details[ean][0])); if ($details[esrbagerating]) force ($descriptors, "<b>$language_text[details_text47]</b> ".($details[esrbagerating][0])); if ($details[externaldisplaysupportdescription]) force ($descriptors, "<b>$language_text[details_text48]</b> ".($details[externaldisplaysupportdescription][0])); if ($details[fabrictype]) force ($descriptors, "<b>$language_text[details_text49]</b> ".($details[fabrictype][0])); if ($details[faxnumber]) force ($descriptors, "<b>$language_text[details_text50]</b> ".($details[faxnumber][0])); if ($details[feature]) force ($descriptors, "<b>$language_text[details_text51]</b> ".($details[feature][0])); if ($details[firstissueleadtime]) force ($descriptors, "<b>$language_text[details_text52]</b> ".($details[firstissueleadtime][0])); if ($details[floppydiskdrivedescription]) force ($descriptors, "<b>$language_text[details_text53]</b> ".($details[floppydiskdrivedescription][0])); if ($details[format]) force ($descriptors, "<b>$language_text[details_text54]</b> ".($details[format][0])); if ($details[gemtype]) force ($descriptors, "<b>$language_text[details_text55]</b> ".($details[gemtype][0])); if ($details[graphicscardinterface]) force ($descriptors, "<b>$language_text[details_text56]</b> ".($details[graphicscardinterface][0])); if ($details[graphicsdescription]) force ($descriptors, "<b>$language_text[details_text57]</b> ".($details[graphicsdescription][0])); if ($details[graphicsmemorysize]) force ($descriptors, "<b>$language_text[details_text58]</b> ".($details[graphicsmemorysize][0])); if ($details[harddiskcount]) force ($descriptors, "<b>$language_text[details_text59]</b> ".($details[harddiskcount][0])); if ($details[harddisksize]) force ($descriptors, "<b>$language_text[details_text60]</b> ".($details[harddisksize][0])); if ($details[hasautofocus]) force ($descriptors, "<b>$language_text[details_text61]</b> ".($details[hasautofocus][0])); if ($details[hasburstmode]) force ($descriptors, "<b>$language_text[details_text62]</b> ".($details[hasburstmode][0])); if ($details[hasincameraediting]) force ($descriptors, "<b>$language_text[details_text63]</b> ".($details[hasincameraediting][0])); if ($details[hasredeyereduction]) force ($descriptors, "<b>$language_text[details_text64]</b> ".($details[hasredeyereduction][0])); if ($details[hasselftimer]) force ($descriptors, "<b>$language_text[details_text65]</b> ".($details[hasselftimer][0])); if ($details[hastripodmount]) force ($descriptors, "<b>$language_text[details_text66]</b> ".($details[hastripodmount][0])); if ($details[hasvideoout]) force ($descriptors, "<b>$language_text[details_text67]</b> ".($details[hasvideoout][0])); if ($details[hasviewfinder]) force ($descriptors, "<b>$language_text[details_text68]</b> ".($details[hasviewfinder][0])); if ($details[height]) force ($descriptors, "<b>$language_text[details_text69]</b> ".($details[height][0])); if ($details[hoursofoperation]) force ($descriptors, "<b>$language_text[details_text70]</b> ".($details[hoursofoperation][0])); if ($details[hours]) force ($descriptors, "<b>$language_text[details_text71]</b> ".($details[hours][0])); if ($details[includedsoftware]) force ($descriptors, "<b>$language_text[details_text72]</b> ".($details[includedsoftware][0])); if ($details[includesmp3player]) force ($descriptors, "<b>$language_text[details_text73]</b> ".($details[includesmp3player][0])); if ($details[ingredients]) force ($descriptors, "<b>$language_text[details_text74]</b> ".($details[ingredients][0])); if ($details[isautographed]) force ($descriptors, "<b>$language_text[details_text75]</b> ".($details[isautographed][0])); if ($details[isbn]) force ($descriptors, "<b>$language_text[details_text76]</b> ".($details[isbn][0])); if ($details[isfragile]) force ($descriptors, "<b>$language_text[details_text77]</b> ".($details[isfragile][0])); if ($details[islabcreated]) force ($descriptors, "<b>$language_text[details_text78]</b> ".($details[islabcreated][0])); if ($details[ismemorabilia]) force ($descriptors, "<b>$language_text[details_text79]</b> ".($details[ismemorabilia][0])); if ($details[isoequivalent]) force ($descriptors, "<b>$language_text[details_text80]</b> ".($details[isoequivalent][0])); if ($details[issuesperyear]) force ($descriptors, "<b>$language_text[details_text81]</b> ".($details[issuesperyear][0])); if ($details[keyboarddescription]) force ($descriptors, "<b>$language_text[details_text82]</b> ".($details[keyboarddescription][0])); if ($details[label]) force ($descriptors, "<b>$language_text[details_text83]</b> ".($details[label][0])); if ($details[legaldisclaimer]) force ($descriptors, "<b>$language_text[details_text84]</b> ".($details[legaldisclaimer][0])); if ($details[length]) force ($descriptors, "<b>$language_text[details_text85]</b> ".($details[length][0])); if ($details[linevoltage]) force ($descriptors, "<b>$language_text[details_text86]</b> ".($details[linevoltage][0])); if ($details[macrofocusrange]) force ($descriptors, "<b>$language_text[details_text87]</b> ".($details[macrofocusrange][0])); if ($details[magazinetype]) force ($descriptors, "<b>$language_text[details_text88]</b> ".($details[magazinetype][0])); if ($details[manufacturer]) force ($descriptors, "<b>$language_text[details_text89]</b> ".($details[manufacturer][0])); if ($details[manufacturerlaborwarrantydescription]) force ($descriptors, "<b>$language_text[details_text90]</b> ".($details[manufacturerlaborwarrantydescription][0])); if ($details[manufacturerminimumage]) force ($descriptors, "<b>$language_text[details_text92]</b> ".($details[manufacturerminimumage][0])); if ($details[manufacturerpartswarrantydescription]) force ($descriptors, "<b>$language_text[details_text93]</b> ".($details[manufacturerpartswarrantydescription][0])); if ($details[materialtype]) force ($descriptors, "<b>$language_text[details_text94]</b> ".($details[materialtype][0])); if ($details[maximumaperture]) force ($descriptors, "<b>$language_text[details_text95]</b> ".($details[maximumaperture][0])); if ($details[maximumcolordepth]) force ($descriptors, "<b>$language_text[details_text96]</b> ".($details[maximumcolordepth][0])); if ($details[maximumfocallength]) force ($descriptors, "<b>$language_text[details_text97]</b> ".($details[maximumfocallength][0])); if ($details[maximumhighresolutionimages]) force ($descriptors, "<b>$language_text[details_text98]</b> ".($details[maximumhighresolutionimages][0])); if ($details[maximumhorizontalresolution]) force ($descriptors, "<b>$language_text[details_text99]</b> ".($details[maximumhorizontalresolution][0])); if ($details[maximumlowresolutionimages]) force ($descriptors, "<b>$language_text[details_text100]</b> ".($details[maximumlowresolutionimages][0])); if ($details[maximumresolution]) force ($descriptors, "<b>$language_text[details_text101]</b> ".($details[maximumresolution][0])); if ($details[maximumshutterspeed]) force ($descriptors, "<b>$language_text[details_text102]</b> ".($details[maximumshutterspeed][0])); if ($details[maximumverticalresolution]) force ($descriptors, "<b>$language_text[details_text103]</b> ".($details[maximumverticalresolution][0])); if ($details[maximumweightrecommendation]) force ($descriptors, "<b>$language_text[details_text104]</b> ".($details[maximumweightrecommendation][0])); if ($details[memoryslotsavailable]) force ($descriptors, "<b>$language_text[details_text105]</b> ".($details[memoryslotsavailable][0])); if ($details[metalstamp]) force ($descriptors, "<b>$language_text[details_text106]</b> ".($details[metalstamp][0])); if ($details[metaltype]) force ($descriptors, "<b>$language_text[details_text107]</b> ".($details[metaltype][0])); if ($details[minimoviedescription]) force ($descriptors, "<b>$language_text[details_text108]</b> ".($details[minimoviedescription][0])); if ($details[minimumfocallength]) force ($descriptors, "<b>$language_text[details_text109]</b> ".($details[minimumfocallength][0])); if ($details[minimumshutterspeed]) force ($descriptors, "<b>$language_text[details_text110]</b> ".($details[minimumshutterspeed][0])); if ($details[model]) force ($descriptors, "<b>$language_text[details_text111]</b> ".($details[model][0])); if ($details[modemdescription]) force ($descriptors, "<b>$language_text[details_text112]</b> ".($details[modemdescription][0])); if ($details[monitorsize]) force ($descriptors, "<b>$language_text[details_text113]</b> ".($details[monitorsize][0])); if ($details[monitorviewablediagonalsize]) force ($descriptors, "<b>$language_text[details_text114]</b> ".($details[monitorviewablediagonalsize][0])); if ($details[mousedescription]) force ($descriptors, "<b>$language_text[details_text115]</b> ".($details[mousedescription][0])); if ($details[nativeresolution]) force ($descriptors, "<b>$language_text[details_text116]</b> ".($details[nativeresolution][0])); if ($details[neighborhood]) force ($descriptors, "<b>$language_text[details_text117]</b> ".($details[neighborhood][0])); if ($details[networkinterfacedescription]) force ($descriptors, "<b>$language_text[details_text118]</b> ".($details[networkinterfacedescription][0])); if ($details[notebookdisplaytechnology]) force ($descriptors, "<b>$language_text[details_text119]</b> ".($details[notebookdisplaytechnology][0])); if ($details[notebookpointingdevicedescription]) force ($descriptors, "<b>$language_text[details_text120]</b> ".($details[notebookpointingdevicedescription][0])); if ($details[numberofdiscs]) force ($descriptors, "<b>$language_text[details_text121]</b> ".($details[numberofdiscs][0])); if ($details[numberofissues]) force ($descriptors, "<b>$language_text[details_text122]</b> ".($details[numberofissues][0])); if ($details[numberofitems]) force ($descriptors, "<b>$language_text[details_text123]</b> ".($details[numberofitems][0])); if ($details[numberofpages]) force ($descriptors, "<b>$language_text[details_text124]</b> ".($details[numberofpages][0])); if ($details[numberofpearls]) force ($descriptors, "<b>$language_text[details_text125]</b> ".($details[numberofpearls][0])); if ($details[numberofrapidfireshots]) force ($descriptors, "<b>$language_text[details_text126]</b> ".($details[numberofrapidfireshots][0])); if ($details[numberofstones]) force ($descriptors, "<b>$language_text[details_text127]</b> ".($details[numberofstones][0])); if ($details[numberoftracks]) force ($descriptors, "<b>$language_text[details_text128]</b> ".($details[numberoftracks][0])); if ($details[opticalzoom]) force ($descriptors, "<b>$language_text[details_text129]</b> ".($details[opticalzoom][0])); if ($details[pearllustre]) force ($descriptors, "<b>$language_text[details_text130]</b> ".($details[pearllustre][0])); if ($details[pearlminimumcolor]) force ($descriptors, "<b>$language_text[details_text131]</b> ".($details[pearlminimumcolor][0])); if ($details[pearlshape]) force ($descriptors, "<b>$language_text[details_text132]</b> ".($details[pearlshape][0])); if ($details[pearlstringingmethod]) force ($descriptors, "<b>$language_text[details_text133]</b> ".($details[pearlstringingmethod][0])); if ($details[pearlsurfaceblemishes]) force ($descriptors, "<b>$language_text[details_text134]</b> ".($details[pearlsurfaceblemishes][0])); if ($details[pearltype]) force ($descriptors, "<b>$language_text[details_text135]</b> ".($details[pearltype][0])); if ($details[pearluniformity]) force ($descriptors, "<b>$language_text[details_text136]</b> ".($details[pearluniformity][0])); if ($details[phonenumber]) force ($descriptors, "<b>$language_text[details_text137]</b> ".($details[phonenumber][0])); if ($details[photoflashtype]) force ($descriptors, "<b>$language_text[details_text138]</b> ".($details[photoflashtype][0])); if ($details[pictureformat]) force ($descriptors, "<b>$language_text[details_text139]</b> ".($details[pictureformat][0])); if ($details[platform]) force ($descriptors, "<b>$language_text[details_text140]</b> ".($details[platform][0])); if ($details[pricerating]) force ($descriptors, "<b>$language_text[details_text141]</b> ".($details[pricerating][0])); if ($details[processorcount]) force ($descriptors, "<b>$language_text[details_text142]</b> ".($details[processorcount][0])); if ($details[publicationdate]) force ($descriptors, "<b>$language_text[details_text143]</b> ".($details[publicationdate][0])); if ($details[publisher]) force ($descriptors, "<b>$language_text[details_text144]</b> ".($details[publisher][0])); if ($details[readinglevel]) force ($descriptors, "<b>$language_text[details_text145]</b> ".($details[readinglevel][0])); if ($details[regioncode]) force ($descriptors, "<b>$language_text[details_text146]</b> ".($details[regioncode][0])); if ($details[releasedate]) force ($descriptors, "<b>$language_text[details_text147]</b> ".($details[releasedate][0])); if ($details[removablememory]) force ($descriptors, "<b>$language_text[details_text148]</b> ".($details[removablememory][0])); if ($details[resolutionmodes]) force ($descriptors, "<b>$language_text[details_text149]</b> ".($details[resolutionmodes][0])); if ($details[ringsize]) force ($descriptors, "<b>$language_text[details_text150]</b> ".($details[ringsize][0])); if ($details[runningtime]) force ($descriptors, "<b>$language_text[details_text151]</b> ".($details[runningtime][0])); if ($details[salesrank]) force ($descriptors, "<b>$language_text[details_text194]</b> ".($details[salesrank][0])); if ($details[secondarycachesize]) force ($descriptors, "<b>$language_text[details_text152]</b> ".($details[secondarycachesize][0])); if ($details[settingtype]) force ($descriptors, "<b>$language_text[details_text153]</b> ".($details[settingtype][0])); if ($details[sizeperpearl]) force ($descriptors, "<b>$language_text[details_text154]</b> ".($details[sizeperpearl][0])); if ($details[size]) force ($descriptors, "<b>$language_text[details_text155]</b> ".($details[size][0])); if ($details[soundcarddescription]) force ($descriptors, "<b>$language_text[details_text156]</b> ".($details[soundcarddescription][0])); if ($details[speakerdescription]) force ($descriptors, "<b>$language_text[details_text157]</b> ".($details[speakerdescription][0])); if ($details[specialfeatures]) force ($descriptors, "<b>$language_text[details_text158]</b> ".($details[specialfeatures][0])); if ($details[stoneclarity]) force ($descriptors, "<b>$language_text[details_text159]</b> ".($details[stoneclarity][0])); if ($details[stonecolor]) force ($descriptors, "<b>$language_text[details_text160]</b> ".($details[stonecolor][0])); if ($details[stonecut]) force ($descriptors, "<b>$language_text[details_text161]</b> ".($details[stonecut][0])); if ($details[stoneshape]) force ($descriptors, "<b>$language_text[details_text162]</b> ".($details[stoneshape][0])); if ($details[stoneweight]) force ($descriptors, "<b>$language_text[details_text163]</b> ".($details[stoneweight][0])); if ($details[studio]) force ($descriptors, "<b>$language_text[details_text164]</b> ".($details[studio][0])); if ($details[subscriptionlength]) force ($descriptors, "<b>$language_text[details_text165]</b> ".($details[subscriptionlength][0])); if ($details[supportedimagetype]) force ($descriptors, "<b>$language_text[details_text166]</b> ".($details[supportedimagetype][0])); if ($details[systembusspeed]) force ($descriptors, "<b>$language_text[details_text167]</b> ".($details[systembusspeed][0])); if ($details[systemmemorysizemax]) force ($descriptors, "<b>$language_text[details_text168]</b> ".($details[systemmemorysizemax][0])); if ($details[systemmemorysize]) force ($descriptors, "<b>$language_text[details_text169]</b> ".($details[systemmemorysize][0])); if ($details[systemmemorytype]) force ($descriptors, "<b>$language_text[details_text170]</b> ".($details[systemmemorytype][0])); if ($details[theatricalreleasedate]) force ($descriptors, "<b>$language_text[details_text171]</b> ".($details[theatricalreleasedate][0])); if ($details[totaldiamondweight]) force ($descriptors, "<b>$language_text[details_text172]</b> ".($details[totaldiamondweight][0])); if ($details[totalexternalbaysfree]) force ($descriptors, "<b>$language_text[details_text173]</b> ".($details[totalexternalbaysfree][0])); if ($details[totalfirewireports]) force ($descriptors, "<b>$language_text[details_text174]</b> ".($details[totalfirewireports][0])); if ($details[totalgemweight]) force ($descriptors, "<b>$language_text[details_text175]</b> ".($details[totalgemweight][0])); if ($details[totalinternalbaysfree]) force ($descriptors, "<b>$language_text[details_text176]</b> ".($details[totalinternalbaysfree][0])); if ($details[totalmetalweight]) force ($descriptors, "<b>$language_text[details_text177]</b> ".($details[totalmetalweight][0])); if ($details[totalntscpalports]) force ($descriptors, "<b>$language_text[details_text178]</b> ".($details[totalntscpalports][0])); if ($details[totalparallelports]) force ($descriptors, "<b>$language_text[details_text179]</b> ".($details[totalparallelports][0])); if ($details[totalpccardslots]) force ($descriptors, "<b>$language_text[details_text180]</b> ".($details[totalpccardslots][0])); if ($details[totalpcislotsfree]) force ($descriptors, "<b>$language_text[details_text181]</b> ".($details[totalpcislotsfree][0])); if ($details[totalserialports]) force ($descriptors, "<b>$language_text[details_text182]</b> ".($details[totalserialports][0])); if ($details[totalsvideooutports]) force ($descriptors, "<b>$language_text[details_text183]</b> ".($details[totalsvideooutports][0])); if ($details[totalusb2ports]) force ($descriptors, "<b>$language_text[details_text184]</b> ".($details[totalusb2ports][0])); if ($details[totalusbports]) force ($descriptors, "<b>$language_text[details_text185]</b> ".($details[totalusbports][0])); if ($details[totalvgaoutports]) force ($descriptors, "<b>$language_text[details_text186]</b> ".($details[totalvgaoutports][0])); if ($details[variationdenomination]) force ($descriptors, "<b>$language_text[details_text187]</b> ".($details[variationdenomination][0])); if ($details[variationdescription]) force ($descriptors, "<b>$language_text[details_text188]</b> ".($details[variationdescription][0])); if ($details[warranty]) force ($descriptors, "<b>$language_text[details_text189]</b> ".($details[warranty][0])); if ($details[watchmovementtype]) force ($descriptors, "<b>$language_text[details_text190]</b> ".($details[watchmovementtype][0])); if ($details[waterresistancedepth]) force ($descriptors, "<b>$language_text[details_text191]</b> ".($details[waterresistancedepth][0])); if ($details[weight]) force ($descriptors, "<b>$language_text[details_text192]</b> ".($details[weight][0])); if ($details[width]) force ($descriptors, "<b>$language_text[details_text193]</b> ".($details[width][0])); $productdescription = implode("<br>",$descriptors); $tmpl->settemplate("productpage"); echo $tmpl->parsetemplate();

?>`

the line mentioned in error message line 221 below:

$productdescription = implode("<br>",$descriptors);

the script seems work fine if hash line out.

can see why this?

thanks in advance help , time.

this "only" warning, because $descriptors variable never initialized or filled value.

add $descriptors = array(); in before line 4 , work expected

function push($myarray,$text){ $myarray[] = $text; } if(!isset($descriptors)) { $descriptors = array(); } if ($details[address]) {

warnings implode

Importing associated models from single csv in rails 3 -



Importing associated models from single csv in rails 3 -

i've been next rails cast episode, importing csv , excel, have different setup.

i have 2 models, usage(amount) & price(amount). have set usage has_one cost , cost belongs_to usage. in csv, have 2 columns, so:

usage,price 1000,0.1 1500,0.11

i'm trying import info can usage.amount & usage.price.amount database.

i had here, , tried there. 1 thing note don't have id column (although tried id column , code question still didn't work).

here code model:

class usage < activerecord::base has_one :price, dependent: :destroy accepts_nested_attributes_for :price def self.import(file) csv.foreach(file.path, headers: true) |row| usage.create! row.to_hash end end end

note: know above has no reference importing price.amount, tried wouldn't work.

any help on appreciated, thanks!

update

here's how got working: (thanks alalani helping next code.)

csv.foreach(file.path, headers: true) |row| u = usage.create(amount: row[0]) u.create_price(amount: row[1]) end

why don't create new instances of class , add together manually?

so do:

def self.import(file) csv.foreach(file.path, headers: true) |row| u = usage.new(:amount => row[0]) u.save p = price.new(:amount => row[1]) p.save u.price << p end end

it seems little bit more work, simple understand whats going on here

ruby-on-rails ruby-on-rails-3 csv import

c# - How does Freetext() work in Indexing Service? -



c# - How does Freetext() work in Indexing Service? -

this query utilize in asp.net(c#) test-application:

select filename,size,path,characterization,rank,create testcatalog..scope('deep traversal of "\\d\mycatalogfolder"') freetext('test') orderby rank desc

i thought works fine until checked results more deeply. recognized there lot of results don't have single occurrence of 'test'! how can prepare query results match search?

is there indexing service expert out there can help?

freetext documentation

freetext not specific string; attempts find occurrences of string or equivalent meaning. if want search specific word or phrase, utilize contains.

where contains(column, 'text')

c# asp.net indexing-service

How to extract data in between a tag in selenium -



How to extract data in between a tag in selenium -

how extract info after class "help file". here text help file link when clicked on leads me form. can of please suggest me how proceed it. newbie selenium, struck on here. tried extracting xpath gives me path of home page using selenium webdriver , eclipse ide. project supports ie.

help file code file

try code:

class="lang-java prettyprint-override">// assume driver in initialized string strtext = driver.findelement(by.id("locator id")).gettext(); // print text of web element system.out.println(strtext);

selenium-webdriver

sql - Not Able to Insert Data into Database String or binary data would be truncated -



sql - Not Able to Insert Data into Database String or binary data would be truncated -

insert [cvsuat].[dbo].[userlevel ]( [client_id] ,[user_level_name] ,[user_level_description] ,[created_by] ,[created_date] ,[modified_by] ,[modified_date] ,[delete_flag] ,[deactivate_flag]) values ('sndbsndbsdnbsndbsnbdnsbdn23','client','','client','2013-03-12 21:31:38.437','client','2013-03-12 21:31:38.437','0','0')

msg 8152, level 16, state 4, line 1 string or binary info truncated. statement has been terminated.

note: table has space [userlevel ] made way before

this caused attempting set much info column.

the problem is, none of values specified in illustration big columns indicated in schema picture. i'd hence assume values you've given either aren't true values, or you've got trigger on table, causing error.

as aside, shouldn't delete_flag , deactivate_flag columns of datatype bit, rather char(1)?

edit:

oh, , 1 more thing - client_id nvarchar, want store unicode info in there. indicate in script, should utilize "n" prefix on strings, so:

insert [cvsuat].[dbo].[userlevel ]( [client_id] ,[user_level_name] ,[user_level_description] ,[created_by] ,[created_date] ,[modified_by] ,[modified_date] ,[delete_flag] ,[deactivate_flag]) values (n'sndbsndbsdnbsndbsnbdnsbdn23','client','','client','2013-03-12 21:31:38.437','client','2013-03-12 21:31:38.437','0','0')

sql sql-server-2008 insert

java - DeployableContainer must be specified error when running Arquillian -



java - DeployableContainer must be specified error when running Arquillian -

i've been trying run arquillian example

https://github.com/arquillian/arquillian-examples/tree/master/arquillian-tutorial

there no error when imported in eclipse

however getting error when run junit test:

java.lang.runtimeexception: not create new instance of class org.jboss.arquillian.test.impl.eventtestrunneradaptor @ org.jboss.arquillian.test.spi.securityactions.newinstance(securityactions.java:160) @ org.jboss.arquillian.test.spi.securityactions.newinstance(securityactions.java:111) @ org.jboss.arquillian.test.spi.securityactions.newinstance(securityactions.java:97) @ org.jboss.arquillian.test.spi.testrunneradaptorbuilder.build(testrunneradaptorbuilder.java:52) @ org.jboss.arquillian.junit.arquillian.run(arquillian.java:93) @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50) @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390) @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) caused by: java.lang.reflect.invocationtargetexception @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source) @ java.lang.reflect.constructor.newinstance(unknown source) @ org.jboss.arquillian.test.spi.securityactions.newinstance(securityactions.java:156) ... 10 more caused by: org.jboss.arquillian.container.impl.containercreationexception: not create container jbossas-managed @ org.jboss.arquillian.container.impl.localcontainerregistry.create(localcontainerregistry.java:85) @ org.jboss.arquillian.container.impl.client.container.containerregistrycreator.createregistry(containerregistrycreator.java:76) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:135) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:115) @ org.jboss.arquillian.core.impl.managerimpl.bindandfire(managerimpl.java:236) @ org.jboss.arquillian.core.impl.instanceimpl.set(instanceimpl.java:74) @ org.jboss.arquillian.config.impl.extension.configurationregistrar.loadconfiguration(configurationregistrar.java:68) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.jboss.arquillian.core.impl.observerimpl.invoke(observerimpl.java:94) @ org.jboss.arquillian.core.impl.eventcontextimpl.invokeobservers(eventcontextimpl.java:99) @ org.jboss.arquillian.core.impl.eventcontextimpl.proceed(eventcontextimpl.java:81) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:135) @ org.jboss.arquillian.core.impl.managerimpl.fire(managerimpl.java:115) @ org.jboss.arquillian.core.impl.managerimpl.start(managerimpl.java:261) @ org.jboss.arquillian.test.impl.eventtestrunneradaptor.<init>(eventtestrunneradaptor.java:56) ... 15 more caused by: java.lang.illegalargumentexception: deployablecontainer must specified @ org.jboss.arquillian.core.spi.validate.notnull(validate.java:44) @ org.jboss.arquillian.container.impl.containerimpl.<init>(containerimpl.java:71) @ org.jboss.arquillian.container.impl.localcontainerregistry.create(localcontainerregistry.java:76) ... 39 more

the project pom defines bunch of profiles - arquillian-weld-ee-embedded, arquillian-glassfish-embedded, , arquillian-jbossas-managed. none of them active default. need activate 1 of these run tests, since profiles bring in arquillian container adapter.

without container adapter in classpath, you're see java.lang.illegalargumentexception exception message "deployablecontainer must specified".

java junit jboss-arquillian

c# - Hard code a value into a data table -



c# - Hard code a value into a data table -

how hard code value 1 fields of info table. have.

//create info table temporary storage datatable mytable = new datatable(); protected void createtable(datatable mytable) { mytable.columns.add("pilotid"); mytable.columns.add("start_date"); mytable.columns.add("end_date"); mytable.columns.add("hours"); }

you can utilize datacolumn.expression set column constant value.

for example:

// number mytable.columns["pilotid"].expression = "1"; // string mytable.columns["pilotid"].expression = "'mypilot'";

then every row added info table have same constant value in column. datarow throw exception if code tries alter constant value.

c# datatable

c# - Access dynamically created text box in a custom template for an ajax tab -



c# - Access dynamically created text box in a custom template for an ajax tab -

i have tabcontainer in aspx page follows

<asp:tabcontainer id="tabcontainer" runat="server" activetabindex="0"> </asp:tabcontainer>

am creating tabs above containter using c# code on oninit event of page

protected override void oninit(eventargs e) { lstcategories = service.getcategories(); numberofcategories = lstcategories.count; createtabs(); base.oninit(e); } protected void createtabs() { seek { (int = 0; < numberofcategories; i++) { tabpanel asptab = new tabpanel(); asptab.id = lstcategories[i].id.tostring(); asptab.headertext = lstcategories[i].name; mycustomtemplate obj = new mycustomtemplate(lstcategories[i].id); asptab.contenttemplate = obj; tabcontainer.tabs.add(asptab); } } grab (exception ex) { } } public class mycustomtemplate : itemplate { public table tbl; public textbox tbxquantity; public image img; public int countofitemsperrow = 2; public mycustomtemplate(int paramcategoryid) { categoryid = paramcategoryid; } public void instantiatein(control container) { initialisetheproperties(); container.controls.add(tblhardware); } public table initialisetheproperties() { //intialize mater table tbl = new table(); //create row mater table tablerow row = new tablerow(); tablecell cell = new tablecell(); img = new image(); img.imageurl = httpruntime.appdomainappvirtualpath +"/images/"+"1.jpg"; cell.controls.add(img); tblhardware.rows.cells.add(cell); tbxquantity = new textbox(); tbxquantity.id ="tbxquantity"; cell.controls.add(tbxquantity); tblhardware.rows.cells.add(cell); tblhardware.rows.add(row); //return tbl; } } }

now trying on btnclickevent

public void btnsave_click(object sender, eventargs e) { seek { command cntrl = page.findcontrol("tbxquantity"); } grab (exception ex) { } }

it returns null. doing wrong? kindly help

as found reply above question posted myself, help fellow folks encounter same or similar problem.

string strquantity=((system.web.ui.webcontrols.textbox)(((ajaxcontroltoolkit.tabcontainer)(btn.parent.findcontrol("tabcontainer"))).tabs[0].findcontrol("tbxquantity"))).text

thank "stackoverflow" maintaining site , give thanks members help developers me.

c# asp.net

html5 - Django spaceless template tag advantages -



html5 - Django spaceless template tag advantages -

i've been wondering lot recently, purpose of django's spaceless template tag?

obviously removes whitespaces html tags, other increment speed @ pages load?

what mean inquire is, removing whitespaces html files help in way?

a newline/space character, yes, , increment file size big loops , human readability optimized template files (like big fk list).

it's exceedingly easy , safe throw in {% spaceless %} in base of operations template.

it lets maintain template code indented readability spaceless html rendering (i'm thinking commas mutual scenario).

django html5 django-templates

python - Django custom save decorator causing Internal Error in formset saving (inline in admin) -



python - Django custom save decorator causing Internal Error in formset saving (inline in admin) -

i have custom save method , custom decorator run django's model save() before , after custom save:

models.py:

from django.contrib.auth.models import user django.db import models def save_decorator(method_to_decorate): def wrapper(self, *args, **kwargs): super(type(self), self).save(*args, **kwargs) method_to_decorate(self, *args, **kwargs) super(type(self), self).save(*args, ** kwargs) homecoming wrapper class the_image_abstract(models.model): class meta: abstract = true create_time = models.datetimefield(editable=false) class avatar(the_image_abstract): #i'm using track avatar class in template. there should improve way. user = models.onetoonefield(user, related_name='avatar') @save_decorator def save(self, *args, **kwargs): "my stuff here" pass

this works when avatar saved or modified in admin page. raises internal error when avatar saved formset in inline of model (formset worked before adding decorator). going wrong here? saw posts people receiving error when using postgres , using postgres don't think case caused postgres.

request method: post request url: http://localhost/admin/auth/normal_user/add/ django version: 1.4.3 exception type: internalerror exception value: current transaction aborted, commands ignored until end of transaction block exception location: /home/eras/projects/kart/venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py in execute_sql, line 912 python executable: /home/eras/projects/kart/venv/bin/python python version: 2.7.3

any help appreciated!

thanks,

eras

ok found reason why happening. had decorator trying save model before non null fields had no default value set. i'm not still sure why causing error when saving new objects in admin inlines (formset). setting mandatory fields value before running custom save function solved problem.

python django

virtualization - Install software on VM that is deployed in cloud -



virtualization - Install software on VM that is deployed in cloud -

is possible after have deployed virtual machine (vm) cloud platform, update vm installing new software, without redeploy vm?

i know might depend on cloud use, possible without need redeploy?

yes. depending on operating scheme can install whatever software want. example, if you're using linux can utilize apt-get or yum or if you're using windows can download whatever installers need.

however, if software requires restart install properly, you'll need check , see if cloud platform supports vm restart.

cloud virtualization virtual-machine

c++ - How to instantly check the zero value of a structure without checking its each element? -



c++ - How to instantly check the zero value of a structure without checking its each element? -

suppose have byte structure, :

struct one_byte { char b1 : 1, b2 : 1, b3 : 1, b4 : 1, b5 : 1, b6 : 1, b7 : 1, b8 : 1; }foo;

in cases i'll need check (foo == 0), have 8 commands :

if(foo.b1 == 0 && foo.b2 == 0 && foo.b3 == 0 && ...and on

is there portable & convenient way can instantly check 0 value single command? tried functions & templates, perform slowly. , tried union, compiler doesn't back upwards bit[array]....

use union, intended for

union { struct { char b1:1,b2:1,b3:1,b4:1,b5:1,b6:1,b7:1,b8:1; } bits; unsigned char byte; } u;

then can either assign straight byte

u.byte = 15;

or bits individually

u.bits.b3 = 1;

exemple

int main() { u.byte = 0; printf("%x\n", u.byte); u.bits.b3 = 1; u.bits.b4 = 1; printf("%x\n", u.byte); homecoming 0; }

will output

0 c // 12 in decimal, since b3 , b4 set 1

c++ performance structure zero

c# - EWS Save Guid per Calendar Appointment -



c# - EWS Save Guid per Calendar Appointment -

i need save guid per every appointment. i've tried utilize policytag , archivetag,but got ,

"the property policytag valid exchange exchange2013 or later versions.",

exception.

does have similar exchange 2010? understand there appointment.id contains self-generated id. prefer not utilize it. give thanks you.

a way deal problem create extended property, , set guid appointment, , wont alter unless made re-create appointment (after property)

private static readonly propertydefinitionbase appointementidpropertydefinition = new extendedpropertydefinition(defaultextendedpropertyset.publicstrings, "appointmentid", mapipropertytype.string); public static propertyset propertyset = new propertyset(basepropertyset.firstclassproperties, appointementidpropertydefinition); //setting property appointment public static void setguidforappointement(appointment appointment) { seek { appointment.setextendedproperty((extendedpropertydefinition)appointementidpropertydefinition, guid.newguid().tostring()); appointment.update(conflictresolutionmode.alwaysoverwrite, sendinvitationsorcancellationsmode.sendtonone); } grab (exception ex) { // logging exception } } //getting property appointment public static string getguidforappointement(appointment appointment) { var result = ""; seek { appointment.load(propertyset); foreach (var extendedproperty in appointment.extendedproperties) { if (extendedproperty.propertydefinition.name == "appointmentid") { result = extendedproperty.value.tostring(); } } } grab (exception ex) { // logging exception } homecoming result; }

this solution works in case of single appointments , in case of using on premises exchange. problem here in case of meetings in online web access (owa), such office 365, properties of appointments copied original appointment organizer, among these properties extended properties appoinmentid among them. hence avoid trouble, create appointment id of attendee similar 1 original in organizer, , add together email address service owner (the service produced notification). without solution , appointment in internal scheme have similar appointmentid original booking , considered one, or might have different 2 appointments same id.

private static void setguidformeetingappiontment(appointment appointment) { var log = ""; seek { if (!appointment.ismeeting) return; if (appointment.service.impersonateduserid == null) return; /* * tricky case if appointment created @ attendee no guid. * in case application should original appointment organizer's side, , guid, paste in new booking * attendee side, , add together attendee emailaddress. */ if (getguidformeetingappointement(appointment).length <= 36) { // if attendee, original appointment organizer's service if (appointment.service.impersonateduserid.id != appointment.organizer.address) { log += "1/5 getting original event of meeting\n"; if (exchangeliteservice.services.containskey(appointment.organizer.address)) { // finditemsresults<appointment> originalappointments; var originalappointments = exchangeliteservice.services[appointment.organizer.address].findappointments(wellknownfoldername.calendar, new calendarview(appointment.start, appointment.end, 1)); if (originalappointments == null) return; //there must original appointment. if (!originalappointments.any()) return; //there must original appointment. var originalappointment = originalappointments.first(); // there should 1 appointment @ specifict time , date. log += "2/5 getting guid original event of meeting\n"; var originalappointmentid = getguidformeetingappointement(originalappointment); if (string.isnullorempty(originalappointmentid)) return; // original appointment must have guid already. var orignalappointmentidguid = originalappointmentid.substring(0, 36); log += "3/5 attaching email address guid extracted\n"; var newappointmentid = orignalappointmentidguid + "_" + appointment.service.impersonateduserid.id; log += "4/5 setting new guid meeting appointment\n"; appointment.setextendedproperty((extendedpropertydefinition)appointementidpropertydefinition, newappointmentid); log += "5/5 updateing meeting appointment\n"; appointment.update(conflictresolutionmode.alwaysoverwrite, sendinvitationsorcancellationsmode.sendtonone); } else //then user invited organizer outside system. { // delete if there similar exchangeliteservice.oncalldeletebookingfrominternal(appointment.service.impersonateduserid.id, appointment.start, appointment.end); //assign new var appointmentidguid = guid.newguid().tostring(); var newappointmentid = appointmentidguid + "_" + appointment.service.impersonateduserid.id; appointment.setextendedproperty((extendedpropertydefinition)appointementidpropertydefinition, newappointmentid); appointment.update(conflictresolutionmode.alwaysoverwrite, sendinvitationsorcancellationsmode.sendtonone); } //get guid part of (without address of organizer) } else // if organizer { log += "if new meeting appointment , notification organizer\n"; var appointmentidguid = guid.newguid().tostring(); var newappointmentid = appointmentidguid + "_" + appointment.service.impersonateduserid.id; appointment.setextendedproperty((extendedpropertydefinition)appointementidpropertydefinition, newappointmentid); appointment.update(conflictresolutionmode.alwaysoverwrite, sendinvitationsorcancellationsmode.sendtonone); } } else { log += "if updated meeting appointment , has guid already\n"; var appointmentid = getguidformeetingappointement(appointment); var appointmentidguid = appointmentid.substring(0, 36); var newappointmentid = appointmentidguid + "_" + appointment.service.impersonateduserid.id; appointment.setextendedproperty((extendedpropertydefinition)appointementidpropertydefinition, newappointmentid); appointment.update(conflictresolutionmode.alwaysoverwrite, sendinvitationsorcancellationsmode.sendtonone); } } grab (exception ex) { //logging exception } }

c# guid ews exchange-server-2010

actionscript 3 - Fighter game as3, problems with KeyboardEvent.KEY_DOWN -



actionscript 3 - Fighter game as3, problems with KeyboardEvent.KEY_DOWN -

well problem i'm having troubles fighter in game. if utilize key_down event and/or enter_frame, when hold downwards kick or punch button fighter continuously causes harm enemy want him either to, illustration kick , homecoming still position or kick , able hold position cause harm 1 time. here's code:

stage.addeventlistener(keyboardevent.key_down, enterattack); stage.addeventlistener(keyboardevent.key_up, exitattack); stage.addeventlistener(event.enter_frame, attackyes); stage.addeventlistener(event.exit_frame, attackno); function enterattack(evt:keyboardevent):void { if (evt.keycode == 84) { attack = true; } } function exitattack(evt:keyboardevent):void { attack = false; } function attackyes(evt:event):void { if (attack) { hero.gotoandstop("punch1"); checkhitred(); checkifdead(); } } function attackno(evt:event):void { if (!attack) { hero.gotoandstop("still"); } }

i trying remove listener somewhere made fighter didn't attack.

is there way prevent holding downwards kick/punch button?

any help appreciated

you have devise cooldowns abilities, e.g. "kick" can happen 1 time per 20 frames. so, when player presses kick button, char kick, damage, , sets cooldown variable. come in frame listener starts decrement counter, , subsequent kick commands ignored while cooldown active.

stage.addeventlistener(keyboardevent.key_down, enterattack); stage.addeventlistener(event.enter_frame, enterframe); var kickcooldown:int=0; function enterattack(evt:keyboardevent):void { if (evt.keycode == 84) { if (!kickcooldown) { attack = true; kickcooldown=15; } } } function enterframe(evt:event):void { if (attack) { hero.gotoandstop("punch1"); attack=false; // have attacked once, dealing harm checkhitred(); checkifdead(); } if (kickcooldown>0) kickcooldown--; // waiting cooldown end else hero.gotoandstop("still"); // if ends, homecoming hero "still" posture }

actionscript-3 flash

dotnetnuke - DNN 7.0 : Can i migrate the .jsp pages in an web application into DNN? -



dotnetnuke - DNN 7.0 : Can i migrate the .jsp pages in an web application into DNN? -

i want migrate pages of web application containing .jsp pages dnn 7.0. how can it?i tried searching in google search results shows migrates .net .netnuke. in advance

if jsp pages content, can manually pull content on dotnetnuke pages html modules on them.

if jsp pages functionality, forms, etc, need convert them .net based modules using either c# or vb.net.

the lastly option, , easiest start with, not long term solution, embed jsp pages dnn site using iframe module.

jsp dotnetnuke

r - When a function is equal to a certain value -



r - When a function is equal to a certain value -

i extremely new r, solution relatively simple. have next function calculate stopping distance average car:

distance <- function(mph){(2.0*(mph/60))+(0.062673*(mph^1.9862))}

and i'm plotting stopping distances 1 mph 60 mph:

range = distance(1:60)

but need mark stopping distance equal 120 ft. don't have thought how done in r, i'd write function where, stoppingdistance(x), maximum speed of auto in mph. function should use, , there easy way check if value of distance(x) (as it's written above) equal value?

one way find when function -120 equal 0:

distance <- function(mph, dist=0){(2.0*(mph/60))+(0.062673*(mph^1.9862))-dist} uniroot(distance, c(1, 60), dist=120) ## $root ## [1] 44.63998 ## ## $f.root ## [1] -5.088982e-06 ## ## $iter ## [1] 6 ## ## $estim.prec ## [1] 6.103516e-05

and see if worked:

distance(44.63998) ## [1] 120

r statistics

java - How to obtain a String between nested Tags -



java - How to obtain a String between nested Tags -

within project seek replace text within tags. seek string beanshell out of html file.

<code> var teststring = "<a href='test/keyword/common'>here our keyword should replaced</a><img src='test/keyword/again'/> </code>

now keyword between <code>a</code> tags should replaced. doable regex or substring or else?

in limited cases can regexps. i'd recommend html parsing/manipulation library such jsoup or jtidy. it'll give much more robust , (likely) more readable/comprehensible solution.

java beanshell

Perl RegEx Parse block of notes on 10 digit number -



Perl RegEx Parse block of notes on 10 digit number -

ok, here's thing. have note in old sql server text format. puts notes record in 1 big blob of data. need take blob of text , parse out create 1 row each note entry separate columns timestamp, user, , note text. way do can think of utilize regex locate unix timestamp each note , parse on that. know there split function parsing on delimiters, removes delimiter. need parse on \d{10} retain 10 digit number. here sample data.

create table test_table ( job_number number, notes varchar2(4000) ) insert test_table values (12345, '1234567890 username notes text notes text notes text notes text 5468204562 username notes text notes text notes text notes text 1025478510 username notes text notes text notes text notes text') (12346, '2345678901 username notes text notes text notes text notes text 1523024512 username notes text notes text notes text notes text 1578451236 username notes text notes text notes text notes text') (12347, '2345678902 username notes text notes text notes text notes text 2365201214 username notes text notes text notes text notes text 1202154215 username notes text notes text notes text notes text')

i see 1 record each note this.

job_number dttm user notes_text ---------- ---------- ---- ---------- 12345 1234567890 username notes text notes text notes text notes text 12345 5468204562 username notes text notes text notes text notes text 12345 1025478510 username notes text notes text notes text notes text 12346 2345678901 username notes text notes text notes text notes text 12346 1523024512 username notes text notes text notes text notes text 12346 1578451236 username notes text notes text notes text notes text 12347 2345678902 username notes text notes text notes text notes text 12347 2365201214 username notes text notes text notes text notes text 12347 1202154215 username notes text notes text notes text notes text

thank help can provide

text::parsewords can handle quoted strings , split on comma. can skip ahead in input using flip-flop operator 1 .. /values/. particular skip method may need revised.

then matter of parsing strings, can done splitting using lookahead assertion , capturing various entries in each substring. regex in split:

my @entries = split /(?<!^)(?=\d{10})/, $data;

has negative lookbehind assertion avoid matching @ start of string ^, , lookahead assertion match 10 numbers. split @ numbers , maintain them.

the data file handle used demonstration, replace <data> <> utilize argument file name.

use strict; utilize warnings; utilize text::parsewords; $format = "%-12s %-12s %-10s %s\n"; # format printing @headers = qw(job_number dttm user notes_text); printf $format, @headers; printf $format, map "-" x length, @headers; # print underline while (<data>) { next while 1 .. /values/; # skip info s/^\(|\)$//g; # remove parentheses ($job, $data) = quotewords('\s*,\s*',0, $_); # parse string @entries = split /(?<!^)(?=\d{10})/, $data; # split entries $entry (@entries) { # parse each entry ($dttm, $user, $notes) = $entry =~ /^(\d+)\s+(\s+)\s+(.*)/; printf $format, $job, $dttm, $user, $entry; } } __data__ create table test_table ( job_number number, notes varchar2(4000) ) insert test_table values (12345, '1234567890 username notes text notes text notes text notes text 5468204562 username notes text notes text notes text notes text 1025478510 username notes text notes text notes text notes text') (12346, '2345678901 username notes text notes text notes text notes text 1523024512 username notes text notes text notes text notes text 1578451236 username notes text notes text notes text notes text') (12347, '2345678902 username notes text notes text notes text notes text 2365201214 username notes text notes text notes text notes text 1202154215 username notes text notes text notes text notes text')

output:

job_number dttm user notes_text ---------- ---- ---- ---------- 12345 1234567890 username 1234567890 username notes text notes text notes text notes text 12345 5468204562 username 5468204562 username notes text notes text notes text notes text 12345 1025478510 username 1025478510 username notes text notes text notes text notes text 12346 2345678901 username 2345678901 username notes text notes text notes text notes text 12346 1523024512 username 1523024512 username notes text notes text notes text notes text 12346 1578451236 username 1578451236 username notes text notes text notes text notes text 12347 2345678902 username 2345678902 username notes text notes text notes text notes text 12347 2365201214 username 2365201214 username notes text notes text notes text notes text 12347 1202154215 username 1202154215 username notes text notes text notes text notes text

regex perl

clojure - How to make list by recursion? -



clojure - How to make list by recursion? -

in many cases want create list recursion function can not find right way how it.

for illustration (not usefull shortest can find) want take elements list 1 1 , create new list same first one.

(defn f [x] (list (first x) (if (not= (rest x) '()) (f (rest x)) '() ))) (f '(1 2 3))

i want get

(1 2 3)

but get

(1 (2 (3 ())))

i want not utilize flatten. illustration imput

(f '([1 1] [2 2] [3 3]))

will destroyed flatten.

replace list cons:

(defn f [x] (cons (first x) (if (not= (rest x) '()) (f (rest x)) '())))

operation (list x y) returns list of 2 elements: (x y). operation (cons x y) returns list head (i.e. first element) x , tail (the rest of list) y y should list itself.

clojure lisp

javascript - HTML5 Audio API - "audio resources unavailable for AudioContext construction" -



javascript - HTML5 Audio API - "audio resources unavailable for AudioContext construction" -

i'm trying create graphic equalizer type visualization html5 sound - chrome @ point, using webkitaudiocontext.

i'm finding unusual , unpredictable behaviour when seek alter source of sound i.e. play different song. read somewhere should wait until "canplay" event on sound triggered before connecting context / analyser:

var context, sourcenode, analyser, javascriptnode, audio; var ctx = $("#songcanvas").get()[0].getcontext("2d"); function loadsong(url) { if (audio!=undefined) { audio.pause(); } sound = new audio(); audio.src = url; audio.addeventlistener("canplay", function(e) { setupaudionodes(); }, false); } function setupaudionodes() { context = new webkitaudiocontext(); javascriptnode = context.createjavascriptnode(2048, 1, 1); javascriptnode.connect(context.destination); analyser = context.createanalyser(); analyser.smoothingtimeconstant = 0.3; analyser.fftsize = 512; sourcenode = context.createmediaelementsource(audio); sourcenode.connect(analyser); analyser.connect(javascriptnode); sourcenode.connect(context.destination); javascriptnode.onaudioprocess = function() { var array = new uint8array(analyser.frequencybincount); analyser.getbytefrequencydata(array); ctx.clearrect(0, 0, 1000, 325); ctx.fillstyle="rgba(32, 45, 21,1)"; drawspectrum(array); } audio.play(); } function drawspectrum(array) { ( var = 0; < (array.length); i++ ){ var value = array[i]; ctx.fillrect(i*5,325-value,3,325); } };

the first 3 or 4 times alter source, works, fails "uncaught syntaxerror: sound resources unavailable audiocontext construction"

full demo here http://jsfiddle.net/eagqn/

i'd recommend staying away creating javascriptnode if you're going drawing spectrum. instead seek utilizing requestanimationframe method save cpu cycles , closer constant 60fps (is useful if window/tab in background function wrapped in requestanimationframe wait until window in focus 1 time again before firing).

the reason you're getting error because a) can create single audiocontext per window, b) should disconnecting mediaelementsource when you're finished using it, , c) should removing actual audio element too.

here's demo changes outlined above: http://jsbin.com/acolet/1/

class="snippet-code-js lang-js prettyprint-override">window.audiocontext = window.audiocontext || window.webkitaudiocontext; var context = new audiocontext(), audioanimation, sourcenode, analyser, audio, songs = document.getelementbyid('songs'), canvas = document.getelementbyid('songcanvas'), width = canvas.width, height = canvas.height, // context canvas draw on ctx = canvas.getcontext('2d'), gradient = ctx.createlineargradient(0, 0, 0, height), bar = { width: 2, gap: 2, ratio: height / 256 }; gradient.addcolorstop(1.00,'#000000'); gradient.addcolorstop(0.75,'#ff0000'); gradient.addcolorstop(0.25,'#ffff00'); gradient.addcolorstop(0.00,'#ffff00'); ctx.fillstyle = gradient; songs.addeventlistener('click', loadsong, false); function loadsong(e) { e.preventdefault(); var url = e.target.href; if (!url) homecoming false; if (audio) audio.remove(); if (sourcenode) sourcenode.disconnect(); cancelanimationframe(audioanimation); sound = new audio(); audio.src = url; audio.addeventlistener('canplay', setupaudionodes, false); } function setupaudionodes() { analyser = (analyser || context.createanalyser()); analyser.smoothingtimeconstant = 0.8; analyser.fftsize = 512; sourcenode = context.createmediaelementsource(audio); sourcenode.connect(analyser); sourcenode.connect(context.destination); audio.play(); drawspectrum(); } function drawspectrum() { var freq = new uint8array(analyser.frequencybincount); analyser.getbytefrequencydata(freq); ctx.clearrect(0, 0, width, height); audioanimation = requestanimationframe(drawspectrum); ( var = freq.length - 1; >= 0 ; i-- ){ var x = * (bar.width + bar.gap); var y = height - (freq[i] * bar.ratio); ctx.fillrect(x, y, bar.width, height); } } class="snippet-code-css lang-css prettyprint-override">body { font-family: sans-serif; background-color: #000; } { color: #fff; text-decoration: none; } ul { padding: 20px 0; width: 100px; } ul, canvas { float: left; } class="snippet-code-html lang-html prettyprint-override"><ul id="songs"> <li><a class="song" href="http://upload.wikimedia.org/wikipedia/en/4/45/acdc_-_back_in_black-sample.ogg">acdc</a></li> <li><a class="song" href="http://upload.wikimedia.org/wikipedia/en/9/9f/sample_of_%22another_day_in_paradise%22.ogg">phil collins</a></li> <li><a class="song" href="http://upload.wikimedia.org/wikipedia/en/1/1f/%22layla%22%2c_derek_and_the_dominos_song_%28sample%29.ogg">clapton</a></li> </ul> <canvas id="songcanvas" width="400" height="128"></canvas>

javascript html5 html5-audio webkitaudiocontext

codeigniter - store session cart to database -



codeigniter - store session cart to database -

sorry asking old questions, , know i've read before inquire here, it's can utilize database adding more cart without limitation. seek utilize ci_sessions table store session still no luck, can adding 6 items maximum.

please help me, looking illustration 2 days , result nothing

edited view

<table id="box-table-a" summary="employee pay sheet"> <thead> <tr> <th scope="col">description</th> <th scope="col">price</th> <th class="centered" scope="col">options</th> </tr> </thead> <tbody> <?php foreach ($foto_produk->result() $key => $value) {?> <tr> <td><?php echo $value->description;?></td> <td><?php echo $value->price;?></td> <td class="centered"><input type="checkbox" name="produk_foto[]" value="<?php echo $value->id;?>" /></td> </tr> <?php }?> </tbody> </table>

here's controller code

if($this->input->post('produk_foto')){ $id_foto = $this->input->post('produk_foto'); foreach ($id_foto $key => $value) { $this->db->where('id', $value); $query = $this->db->get('foto_product'); if($query->num_rows() > 0){ foreach($query->result() $ids => $rows){ echo $rows->id.'<br />'; $data_produk = array( 'user_data'=> array( 'id' => $rows->id, 'price' => $rows->price, 'name' => $rows->description, 'qty' => $rows->aantal ) ); $this->cart->insert($data_produk); } } } }

and view code

<?php if(!$this->cart->contents()):?> <div class="alert-box warning">the regular products empty.</div> <div class="clearfix"></div> <?php else:?> <hr> <h4>regular products</h4> <div class="order_detail" id="display"> <table> <thead> <tr> <th>description</th> <th>quantity</th> <th>price per item(s)</th> <th>total</th> <th>remove</th> </tr> </thead> <tbody> <?php foreach($this->cart->contents() $rows):?> <tr> <td style="font-weight:bold;"><?php echo $rows['name'];?></td> <td> <?php echo form_open(current_url());?> <input type="text" size="3" name="quantity" value="<?php echo $rows['qty'];?>" /> <input type="hidden" size="3" name="rowid" value="<?php echo $rows['rowid'];?>" /> <input type="submit" name="update" value="update" /> <?php echo form_close();?> </td> <td><?php echo $rows['price'];?></td> <td><?php echo $this->cart->format_number($rows['subtotal']);?></td> <td><a href="<?php echo base_url('index.php/en/payment/delete_item_product/'.$rows['rowid'].'');?>">delete</a></td> </tr> <?php endforeach;?> </tbody> <tfoot> <tr> <td colspan="3">total products</td> <td colspan="3">&euro; <?php echo $this->cart->format_number($this->cart->total());?></td> </tr> <tr> <td colspan="3">total shipping</td> <td colspan="3"></td> </tr> <tr> <td colspan="3"></td> <td colspan="3" style="padding:0;text-align:center;"> <p>total :</p> <span class="tot">&euro; <?php echo $this->cart->format_number($this->cart->total());?></span> </td> </tr> </tfoot> </table> </div> <?php endif;?>

with code want insert using checkbox array, , have more 6 checkbox

thank in advance

ok it's solved self..

i don't know in name of product there special characters..

and shame of me..

but give thanks anyway

codeigniter session shopping-cart

html helper - Displaying multiple values with Telerik ASP.Net MVC extensions with the ForeignKey column -



html helper - Displaying multiple values with Telerik ASP.Net MVC extensions with the ForeignKey column -

from i've read, doesn't seem possible associate foreignkey column multi-select listbox. true?

if it's not true, famiiar using foreginkey column , know how accomplish code snippet, if possible.

if it's true it's not supported (i have latest extensions of tools), how go implement this? if telerik doesn't have work around, i'd to below.

the next best thing display users in multiple rows (each distinct value selected specified group), guess. how implement scenario using foreignkey or otherwise? meaning, there can many users many groups. image worth one thousand words. please see below i'd implement.

fyi, have value , text info both columns, the groups column not listbox; it's textbox , has text value displayed. the users listbox have value selected each user (assume users listbox contains list of 10 users).

grid abc groups column (contains text value) users column (this foreignkey listbox) ----------------------------------- ----------------------------------------------------------- grp1 user1 grp1 user2 grp1 user3 grp2 user2 grp2 user3

personally suggest create hierarchy of grid edit such relation.

e.g.

grp1 user1 user2 user3 grp2 user2 user3

implementation hierarchy editing can found here.

option 2 -> since extensions not have multi select not easy add together such editor template. anyway if implement multi-select somehow hand can utilize add together editor shown here.

regarding foreignkey - not option.

html-helper telerik-grid telerik-mvc

android - When to use ShapeRenderer, Mesh + SpriteBatch, Box2D and Scene2D in Libgdx? -



android - When to use ShapeRenderer, Mesh + SpriteBatch, Box2D and Scene2D in Libgdx? -

i'm new in android game development , after started libgdx shaperenderer , did little more search, became confused if started right foot.

so, know when should utilize shaperenderer, mesh + spritebatch, box2d , scene2d.

libgdx has quite lot of (mostly orthogonal) apis rendering. i'm still learning way around many of them, can give overview of different parts.

shaperenderer lets , set basic flat-colored polygons , lines on screen. not particularly efficient (it uploads lot of vertex info on each render). can quick going. oriented screen (it defaults orthographic project on total screen , units pixels).

the mesh class gives more direct command on geometry, you're exposed lot more of details (like encoding colors floats , storing vertex data, color data, , texture info in same float array, , concept of index arrays).

the spritebatch oriented around "sprites" (generally rectangular areas texture in them). hides of complexity (and flexibility) of texturing meshes.

box2d physics modeling, , not of other api parts mentioned (which rendering).

finally, scene2d creating animated user-interface elements buttons, lists, , sliders. powerful plenty (and has plenty neat , flexible back upwards animations , interaction events) can implement quite lot of "game" in too.

you can utilize raw "opengl" commands (see gl20), too.

you can totally mix-and-match these different primitives (one caveat must "flush" , "end" whatever shaperenderer/spritebatch/mesh render before starting different flavor). so, example, might utilize scene2d "main menu" , meta actions in game, spritebatch render core of game, , utilize shaperenderer generate debug overlays (think visualizing bounding boxes, etc).

also note of libgdx geared towards 2d. raw opengl , mesh apis can used build 3d objects.

check gdx-invaders example see how uses mesh, opengl, , spritebatch. (i think illustration pre-dates scene2d, there none of that...). worthwhile on implementation of these classes see they're doing underneath covers.

android libgdx box2d scene2d

php - Iteration over an object -



php - Iteration over an object -

i need help please regarding pdostatement::commit (from phpnet manual)

i don't understand illustration #1, because of part of code:

foreach ($fruits $fruit) { $sth->execute(array( $fruit->name, $fruit->colour, $fruit->calories, ) );

1# - iterate on object, array or what? - i've tried both ... , of course, both give errors - definitely, -> operator tells me it's object, still don't understand syntax. - possible iterate/acces simultaneously more 1 property of object? 2# - when said "insert multiple records...", understand "more 1 row", wrong?

thank you.

they iterate on array $fruits apparently. declared , filled out of scope of given code snippet. $fruits contains object given field. create class, fill $fruits. "when said "insert multiple records...", understand "more 1 row", wrong?" - means 0 n rows.

php

ruby on rails - Cannot get devise ajax to work -



ruby on rails - Cannot get devise ajax to work -

what trying login via ajax, homecoming form (with errors) if authentication failed. default, devise homecoming generic error. here controller:

class sessionscontroller < devise::sessionscontroller respond_to :js def new self.resource = build_resource(nil, :unsafe => true) clean_up_passwords(resource) render_user_form(resource, false) end def create self.resource = warden.authenticate!(scope: resource_name, recall: "#{controller_path}#new") sign_in(resource_name, resource) render_user_form(resource, true) end def render_user_form(resource, success) render json: { success: success, content: render_to_string(partial: 'users/login_form', locals: { user: resource }) } end end

new , create actions taken devise::sessionscontroller , customised, advised here: custom sign in devise

yet returns error:

"you need sign in or sign before continuing."

my js:

$('#login-form').bind 'ajax:success', (xhr, data, status) -> alert data.content

can help correctly structuring this?

trick alter devise config , register:

config.http_authenticatable_on_xhr = false config.navigational_formats = ["*/*", :html, :json]

ruby-on-rails devise

java - send mail using localhost instead of gmail -



java - send mail using localhost instead of gmail -

so, i'm trying send e-mail via javamail , glassfish: here code(i find here http://www.javasrilankansupport.com/2012/05/send-email-in-java-mail-api-using-gmail.html)

private session m_session; private message m_simplemessage; private internetaddress m_fromaddress; private internetaddress m_toaddress; private properties m_properties; @override public void sendmail(string mail) throws exception { seek { m_properties = new properties(); m_properties.put("mail.smtp.host", "smtp.gmail.com"); m_properties.put("mail.smtp.socketfactory.port", "465"); m_properties.put("mail.smtp.socketfactory.class","javax.net.ssl.sslsocketfactory"); m_properties.put("mail.smtp.auth", "true"); m_properties.put("mail.smtp.port", "465"); m_properties.put("mail.debug", "false"); m_properties.put("mail.smtp.ssl.enable", "true"); m_session = session.getdefaultinstance(m_properties,new authenticator() { protected passwordauthentication getpasswordauthentication() { homecoming new passwordauthentication("user@gmail.com","password"); // username , password } }); m_simplemessage = new mimemessage(m_session); m_fromaddress = new internetaddress("user@gmail.com"); m_toaddress = new internetaddress(mail); m_simplemessage.setfrom(m_fromaddress); m_simplemessage.setrecipient(recipienttype.to, m_toaddress); m_simplemessage.setsubject("test letter"); m_simplemessage.setcontent("hi, test letter.","text/plain"); transport.send(m_simplemessage); } grab (messagingexception ex) { ex.printstacktrace(); } }

but after using function on server grab thos exceptions:

javax.mail.messagingexception: not connect smtp host: localhost, port: 25; nested exception is: java.net.connectexception: connection refused: connect @ com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:1934) @ com.sun.mail.smtp.smtptransport.protocolconnect(smtptransport.java:638) @ javax.mail.service.connect(service.java:295) @ javax.mail.service.connect(service.java:176) @ javax.mail.service.connect(service.java:125) @ javax.mail.transport.send0(transport.java:194) @ javax.mail.transport.send(transport.java:124) @ com.kma.summer2012.facade.passwordrecoveryfacadeimpl.sendmail(passwordrecoveryfacadeimpl.java:49) @ com.kma.summer2012.server.crumbsuserserviceimpl.sendmailrecovery(crumbsuserserviceimpl.java:83) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ com.google.gwt.user.server.rpc.rpc.invokeandencoderesponse(rpc.java:561) @ com.google.gwt.user.server.rpc.remoteserviceservlet.processcall(remoteserviceservlet.java:208) @ com.google.gwt.user.server.rpc.remoteserviceservlet.processpost(remoteserviceservlet.java:248) @ com.google.gwt.user.server.rpc.abstractremoteserviceservlet.dopost(abstractremoteserviceservlet.java:62) @ javax.servlet.http.httpservlet.service(httpservlet.java:688) @ javax.servlet.http.httpservlet.service(httpservlet.java:770) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1550) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:281) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:175) @ org.apache.catalina.core.standardpipeline.doinvoke(standardpipeline.java:655) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:595) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:161) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:331) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:231) @ com.sun.enterprise.v3.services.impl.containermapper$adaptercallable.call(containermapper.java:317) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:195) @ com.sun.grizzly.http.processortask.invokeadapter(processortask.java:860) @ com.sun.grizzly.http.processortask.doprocess(processortask.java:757) @ com.sun.grizzly.http.processortask.process(processortask.java:1056) @ com.sun.grizzly.http.defaultprotocolfilter.execute(defaultprotocolfilter.java:229) @ com.sun.grizzly.defaultprotocolchain.executeprotocolfilter(defaultprotocolchain.java:137) @ com.sun.grizzly.defaultprotocolchain.execute(defaultprotocolchain.java:104) @ com.sun.grizzly.defaultprotocolchain.execute(defaultprotocolchain.java:90) @ com.sun.grizzly.http.httpprotocolchain.execute(httpprotocolchain.java:79) @ com.sun.grizzly.protocolchaincontexttask.docall(protocolchaincontexttask.java:54) @ com.sun.grizzly.selectionkeycontexttask.call(selectionkeycontexttask.java:59) @ com.sun.grizzly.contexttask.run(contexttask.java:71) @ com.sun.grizzly.util.abstractthreadpool$worker.dowork(abstractthreadpool.java:532) @ com.sun.grizzly.util.abstractthreadpool$worker.run(abstractthreadpool.java:513) @ java.lang.thread.run(thread.java:722) caused by: java.net.connectexception: connection refused: connect @ java.net.dualstackplainsocketimpl.connect0(native method) @ java.net.dualstackplainsocketimpl.socketconnect(dualstackplainsocketimpl.java:69) @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:339) @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:200) @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:182) @ java.net.plainsocketimpl.connect(plainsocketimpl.java:157) @ java.net.sockssocketimpl.connect(sockssocketimpl.java:391) @ java.net.socket.connect(socket.java:579) @ java.net.socket.connect(socket.java:528) @ com.sun.mail.util.socketfetcher.createsocket(socketfetcher.java:288) @ com.sun.mail.util.socketfetcher.getsocket(socketfetcher.java:231) @ com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:1900) ... 42 more

as understand, main problem function want utilize localhost , 25 port instead of gmail, , can't figure why. note telnet smtp.gmail.com 25, telnet smtp.gmail.com 465 work well. suggestions cause of this?

try fixing of these common javamail mistakes. see how connect gmail using javamail.

java smtp gmail javamail glassfish-3