Posts

Primefaces datatable rowReorder get row -

i'm trying row object, in case of class story.class, while reordering row in primefaces datable. indexes, reorderevent, unfortunately not enough since have more 1 datatable reuse same rowreorder listener. here code fragments: <p:ajax event="rowreorder" listener="#{reorderstoryview.onrowreorder}" /> the following code line returns null: story story2 = context.getapplication(). evaluateexpressionget(context, "#{story}", story.class); the following code line returns not current rowdata, have problems determine row data get: story story =(story)((datatable)event.getcomponent()).getrowdata(); can't find additional information problem, maybe can me out. thx in advance /d you can read source table adding line listener code: string source = ((datatable)event.getsource()).getclientid(); an example listener method: public void onrowreorder(reorderevent event) { int = event.getfromindex(); ...

c# - Unexpected behavior using Enumerable.Empty<string>() -

i expect enumerable.empty<string>() return empty array of strings. instead, appears return array single null value. breaks other linq operators defaultifempty , since enumerable not, in fact, empty. doesn't seem documented anywhere, i'm wondering if i'm missing (99% probability). gameobject class public gameobject(string id,ienumerable<string> keywords) { if (string.isnullorwhitespace(id)) { throw new argumentexception("invalid", "id"); } if (keywords==null) { throw new argumentexception("invalid", "keywords"); } if (keywords.defaultifempty() == null) { //this line doesn't work correctly. throw new argumentexception("invalid", "keywords"); } if (keywords.any(kw => string.isnullorwhitespace(kw))) { throw new argumentexception("invalid", "keywords"); } ...

netlogo - Ask turtles to move to patch that is their state variable -

in model, have turtles start @ random location. location saved state variable home-xy using patch-here command. stored format (patch 234 345) . want turtles return location @ end of procedure. i've tried following 2 pieces of code: ask turtles [ move-to home-xy ] ask turtles [ let x [pxcor] of home-xy let y [pycor] of home-xy move-to patch x y ] these not work, think represent problem enough. thank you. not sure why first code didn't work. tested , it's fine (returns centre of patch started): turtles-own [home-xy] setup clear-all create-turtles 20 [ setxy random-xcor random-ycor set home-xy patch-here ] reset-ticks end go ask turtles [ setxy random-xcor random-ycor ] end go-home ask turtles [ move-to home-xy ] end you might want inspect turtle , make sure home-xy being set properly.

php - mb_stripos not working with accented characters -

i'm trying make mb_stripos work accented characters can't find way it. $word = "leilao"; $text = "leilao leilões lllleeil"; $result = mb_stripos($text, $word); //works $word = "leilão"; $text = "leilão leilões lllleeil"; $result = mb_stripos($text, $word); //doesn't works i checked mb_internal_encoding() , set utf-8 can me? what need search in long text if array of keywords exists , return true. need accented character found aswell. there way it? thanks in advance! [update] i found problem. i'm trying text database,and set utf8. //after query assign this: $text = $rows[0]["description"]; if use mb_detect_encoding result ascii encoding. , there no function change that! tried all, iconv , mb_convert_encode , utf8_encode , result ascii . , need match accented characters/words result 0.

r - How to read logical data with header from file -

i want read following table #logical.table col_a col_b row_a true false row_b false true the resulting object in r should have column , row names file(at least 1 of them) , logical columns , rows i tried: matrix(ncol=2, byrow=t, scan(file = 'logical.table', what=true, skip=1)) miss col/row-names. deleting rownames, w<-read.table(file='logical.table', colclasses = "logical", header=t) is.logical(w[1]) , is.logical(w[1,]) return false solution derwin mcgeary wrote: x <- read.table(file="logical.table") works fine. logical columns use x[,col] , logical rows ended t(x)[,row] . the function read.table smart enough read file , give appropriate row , column names. x <- read.table(file="logical.table") str(x) cut , pasted example including line #logical.table , still worked.

java - Loading information from file in different ways -

my program has working: bank bank = new bank(); bank.openaccount(new checkingaccount(10100, new customer("first", "last"),500.00,false)); bank.openaccount(new checkingaccount(10101, new customer("first", "last"),2000.00,true)); bank.openaccount(new savingsaccount(2010, new customer("first", "last"),5000.00,0.02)); now trying load information file instead, ran bit of wall. want new customer information include both first , last name stored in separate index positions separate variables, while work: new customer[first_index], i can't seem accept 2 index positions without creating new customer again. turn causing issue method in accounts i'd keep same format. how can go doing this? public checkingaccount(int accountnumber, customer owner, double currentbalance, boolean freechecks) { super(accountnumber, owner, currentbalance); this.freechecks = freecheck...

gcc - GNU assembly Inline: what do %1 and %0 mean? -

i new gnu assembly inlining, have read multiple write ups still not understand going on. understanding: movl %eax, %ebx\n\t move whatever in %eax ebx , not add contents each other addl %eax, %ebx\n\t add contents of %eax ebx , keep @ right register addl %1, %0\n\t confused, adding 1 , 0? why need have %0 there? the whole asm inline block looks like: asm [volatile] ( assemblertemplate : outputoperands [ : inputoperands [ : clobbers ] ]) or asm [volatile] ( assemblertemplate : outputoperands) in assemblertemplate assembly code, , in output/inputoperands, can pass variable between c , asm. then in asm, %0 refers first variable passed outputoperand or inputoperand, %1 second, etc. example: int32_t = 10; int32_t b; asm volatile ("movl %1, %0" : "=r"(b) : "r"(a) : ); this asm code equivalent "b = a;" a more detailed e...