Posts

r - Subset with unique cases, based on multiple columns -

i'd subset dataframe include rows have unique combinations of 3 columns. situation similar 1 presented in this question, i'd preserve other columns in data well. here's example: > df v1 v2 v3 v4 v5 1 7 1 100 98 2 7 2 98 97 3 8 1 c na 80 4 8 1 c 78 75 5 8 1 c 50 62 6 9 3 c 75 75 the requested output this, i'm looking unique cases based on v1, v2, , v3 only: > df.new v1 v2 v3 v4 v5 1 7 1 100 98 2 7 2 98 97 3 8 1 c na 80 6 9 3 c 75 75 if recover non-unique rows great too: > df.dupes v1 v2 v3 v4 v5 3 8 1 c na 80 4 8 1 c 78 75 5 8 1 c 50 62 i saw related question how in sql ( here ), can't in r. i'm sure it's simple messing unique() , subset() hasn't been fruitful. in advance. you can use duplicated() function find unique combinations: > df[!duplicated(df[1:3]),] v1 v2 v3 v4 v5 1 7 1 100 98 2 7 2 98 97 3 8 1 c na 80 6 9 3 c 75 75 to duplicates, can check in both directions: > df[duplicated(df[1:3]) | duplicated(df[1:3], fromlast...

c# - Could not load file or assembly ... An attempt was made to load a program with an incorrect format (System.BadImageFormatException) -

i have 2 projects, projecta , projectb . projectb console application, depends on projecta . yesterday, working fine, today when run projectb this: badimageformatexception unhandled : not load file or assembly 'projecta, version=1.0.0.0, culture=neutral, publickeytoken=null' or 1 of dependencies. attempt made load program incorrect format. both regular projects, no dependencies on other non-.net projects. both .net - there no native code, , no p/invoke. have other projects depend on projecta , still work fine. things have tried: make sure both projects set "any cpu," build checkbox checked. are. make sure both projects same target framework (.net 4.0 client profile) . under projectb --> references --> projecta --> properties, make sure "copy local" set "true" _ (i verified projecta.dll being copied correctly) clean/rebuild solution. tried manually deleting /bin , /obj folders in both projects. restart visual studio. re...

c# - How do you get the text from a listbox by index? -

i trying text entry in winforms listbox index, seem stumped. logical thing can think of is: listbox.items[index].tostring but not return desired result. does know how this? what have in listbox? if there string values in listbox, code correct except missing braces: string value = listbox.items[index].tostring(); if things in listbox sort of object, may need override tostring() desired result, or cast thing out of listbox desired type , access appropriate property. example: myclass = (myclass)listbox.items[index]; string value = my.somepropertyofmyclass;

objective c - Check for first launch of my application -

how check if first launch of of application using nsuserdefaults , running code first time app opens? this should point in right direction: static nsstring* const hasrunapponcekey = @"hasrunapponcekey"; nsuserdefaults* defaults = [nsuserdefaults standarduserdefaults]; if ([defaults boolforkey:hasrunapponcekey] == no) { // code want run on first use... [defaults setbool:yes forkey:hasrunapponcekey]; }

A jar used in android library project is not visible in the project using that library -

i have 3 android projects this, library projecta projectb i have used admob's jar file in library, projecta , b use library project reference, library.jar the admob jar not directly added in project or b. hoping since , b referencing library project , library references admob jar, access classes of admob jar in projects , b without explicitly using admob jar in a/b. project a/b not have specific code classes related admob jar. related code in library , code meant run when projects compiled. so happens runtime crash saying class not found. if add admob jar projects there no runtime problem. please advise me correct way of doing it.. thanks, found answer, in project properties -> java build path -> order , import , checked admob jar file , worked :)

Ruby Asynchronous Net::HTTP? -

does net::http support asynchronous syntax? i'm looking code below. the block called on main thread after net::http has either received response server (in case, error nil ) or encountered error connecting server (in case response nil ). net::http.get('http://stackoverflow.com') |response, error| if error puts "connection error: #{error.message}" elsif response.status_code != httpok puts "unexpected status code: #{response.status_code}" puts response.body else puts "success!" puts response.body end end the following questions provide answers i'm looking block-based solution. asynchronous http request in ruby asynchronous http requests ruby have @ eventmachine , em-http-request gems. equivalent above code be require 'rubygems' require 'eventmachine' require 'em-http' http_ok = 200 em.run http = em::httprequest.new('http://example.com').get http.errback puts "connection error: #{http.er...

javascript - Geolocation Code Not Working for iPhone / iPod Touch / iPad -

we did testing @ apple store, , found out our geolocation code (getting latitude , longitude), not working iphone, ipod touch, or ipad. did have add code work macbook / imac. anyone know code latitude / longitude works sure on ipod touch / iphone / ipad devices? code: // needed iphone / ipad / itouch <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=aizasydrorw0ri-1v-5bixc4t_zlehcbbwgzyuq&amp;sensor=true"></script> // needed imac / macbook <script src="http://code.google.com/apis/gears/gears_init.js" type="text/javascript"></script> <script src="http://gaychat.me/js/geo.js" type="text/javascript" ></script> <script type="text/javascript"><!-- var ua = navigator.useragent.tolowercase(); var isandroid = ua.indexof("android") > -1; var isiphone = ua.indexof("iphone") > -1; var isipod = ua.indexof("ipod")...