Posts

c# - can i pass in IQueryable<Foo> into IQueryable<IFoo> if the object implements that interface? -

i have object a: iqueryable<foo> and want pass function expects a: iqueryable<ifoo> foo implements ifoo why wouldn't compile? best way convert have work? co- , contra- variance added in .net 4 bcl, , not exist in .net 3.5 bcl. you can work around limitation in 3.5 using select operation cast interface type: iqueryable<foo> foos = ..; myfunc(foos.select(x => (ifoo)x)); edit (from reed's comment, below): iqueryable<foo> foos = ..; myfunc(foos.cast<ifoo>());

how to push component state changes to multiple different pages using icefaces -

in project want upload image in 1 page(ie:in 1 view),after uploading image event generated , bean1 executed.please provide solution updating loaded image page(ie second view)in use graphicimage component.how refer second view components in bean1 without generating event second view. is possible ajax push using icefaces 1.8.2 discussed above. icefaces uploads file specific path, given by {application root}/{upload directory}/{session id} the upload directory specified in web.xml. session id folder optional, depending on whether specified "uniquefolder" attribute in tag. can set upload path attribute in tag. you can store file path in string or in session variable through actionlistener inputfile. to refer path string bean2 without using backing bean, can bind components "#{bean1.pathstring}". if want use backing-bean, can do: ((bean1) gebean("bean1")).getpathstring() but if extend abstractpagebean . also, bean1 should session s...

JUnit tests for collections -

i've implemented radix trie (aka patricia trie) in java, , thoroughly test it. implements map , sortedmap , navigablemap interfaces, add pretty large number of methods check. =/ i figure people wrote library classes hashmap , treemap must have had suite of junit tests (or similar) ensure behave correctly. know of way source code of these tests? i'd love put code through same paces. in google collections library, there basic test harnesses thoroughly test contracts of various structures, including maps. here link gcode page: http://code.google.com/p/google-collections/

iphone - how can I dismiss keyboard when I will just touch anywhere except UITextField? -

hello have 2 uitextfields in application, , want dismiss keyboard when touch anywhere except uitextfields how can this? use tochesbegin method purpose - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { [yourfirsttextfield resignfirstresponder]; [yoursecondtextfield resignfirstresponder]; } you not need thing else.when touch anywhere on view both textfield resign no need to know 1 having focus.and when touch textfield textfield open keyboard own.

C File updating and creating help -

i have 2 .dat(ascii) files. both sorted. 1: clients file containing ; account number , name ,balance 2: transaction file containing; account number ,date,saleamount(transaction amount) what trying accomplish create new updated clients file has updated balances clients based on adding or subtracting saleamount of matching transaction. my code far enables me : 1: if there not more 1 transactions client code runs writes .dat file clients , updated balances. 2:if there more 1 transactions client code run print screen updated clients , accounts eg: 1 james 540.00 2 john 762.00 3 paul 414.00 4 sam 502.00 will displayed , there 2 transactions john created .dat file while contain 1 james 540.00 2 john 662.00 2 john 762.00 3 paul 414.00 4 sam 502.00 my problem lies here, need find way of having created .dat contain 1 line each client ( account number) my code attached appreciated. #include <stdio.h> #include <string.h> int main(void) { int account, mat...

c - Why doesn't *(ptr++) give the next item in the array? -

int my_array[] = {1,23,17,4,-5,100}; int *ptr; int i; ptr = &my_array[0]; /* point our pointer first element of array */ printf("\n\nptr = %d\n\n", *ptr); (i = 0; < 6; i++) { printf("my_array[%d] = %d ",i,my_array[i]); /*<-- */ printf("my_array[%d] = %d\n",i, *(ptr++)); /*<-- b */ } why display same thing both line , b? displays of values in my_array in order (1, 23, 17, 4, -5, 100). why '++' in line b not point ptr next element of array before dereferenced? if change line printf("ptr + %d = %d\n",i, *ptr++); /*<-- b */ the output same. why this? ptr++ increments ptr returns original value ++ptr increments , returns new value hence joke c++ - it's 1 more c use original value = c

iphone - is it possible to create a 100% leak free ipad application -

i developing ipad app , found memory leaks using instruments , analyzer. tried release objects resulted in crashing of app.. memory leaks allowed in app? if so, until extent allowed? there way remove memory leaks out app getting crashed?? generally speaking, possible make sure code write leak free. not apple frameworks , internal libraries won't leak @ all. if call alloc , new or copy make sure call corresponding release or autorelease . apps leak lot bound crash often. apps crash rejected app store.