Posts

facebook graph API with objective c -

how can name using facebook id using facebook graph api? used code image data id: uiimage* new_image=[uiimage imagewithdata:[nsdata datawithcontentsofurl:[nsurl urlwithstring:@"http://graph.facebook.com/id/picture?type=normal"]]]; nsdata *imagedata = uiimagepngrepresentation(new_image); how user's name? make \get request to: http://graph.facebook.com/ {user-id}?fields=username you'll response as- { username: "xxxxx", id: "9999999" } example

java - Importing dates from CSV with jOOQ -

i have csv file i'm trying import via jooq's loadcsv method. i'd import straight mysql database date column, csv file has dates formatted yyyymmdd instead of yyyy-mm-dd . there way can pass custom date format (or date parser) jooq import process? thanks! as of jooq 3.3, there no support such data type transformations in loader api. have registered issue #3221 add support useful feature. suspect should feasible (java 8 syntax): ctx.loadinto(author) .loadcsv(csv) .fields(author.id, author.first_name, author.last_name) .values( row -> author.id.getdatatype().convert(row[0]), row -> row[1].split(" ")[0], row -> row[1].split(" ")[1] ) .execute(); contributions welcome, of course ;-)

ios - Can Only add one object to NSMutableDictionary -

i have datepicker , uibarbuttonitem, when uibarbuttonitem pressed invokes method add selected date nsmutabledictionary. code shown below: diarydatearr = [[nsarray alloc] initwithobjects:diarydate, nil]; nsstring *datekeystr = [nsstring stringwithformat:@"datekey%d", dicdates.count+1]; diarykeystrarr = [[nsarray alloc] initwithobjects:datekeystr, nil]; dicdates = [[nsmutabledictionary alloc] initwithobjects:diarydatearr forkeys:diarykeystrarr]; nsarray * allkeys = [dicdates allkeys]; for(nsstring *key in [dicdates allkeys]) { nslog(@"%@",[dicdates objectforkey:key]);} nslog(@"count : %d", [allkeys count]); however, seemingly works until count how many keys within nsmutabledictionary , count returned 1, if click button twice of 2 different dates should theoretically (or @ least how to) should add date selected in date picker making count 2. never changes 1 how objects , keys not being placed dictionary? regards count returning number of ...

javascript - Passing Multiple Variables to a PHP page -

i want pass multiple variables city1 , area1 (javascript variables) in url php page got stuck in on part shown below. doing wrong? $("#list").load("selectcity.php?city1="+city1&"area1="+area1); $.ajaxsetup({ cache: false }); the & character should inside quotes , not outside quotes. corrected code : $("#list").load("selectcity.php?city1="+city1+"&area1="+area1); $.ajaxsetup({ cache: false }); get parameters separated character & . passing 2 parameters file separated & . ? sign in url indicates next characters coming after get parameters. or can use $.get easy set , works fine $.load : $.get("selectcity.php", {"city1": city1, "area1": area1}, function(response){ $("#list").html(response); });

ruby on rails - Trying to build a one to one relationship between two preexisting models -

i new rails , trying build 1 one relationship between 2 preexisting models (test , test_type) in rails. here workflow. has_one :test_type - tests model belongs_to :test - test_types model rails g migration add_test_type_to_test test_type:references rake db:migrate now looks has worked ok when try verify looks hasn't. rails console @type = testtypes.new :name => "my type" @type.save @test = tests.new :name => "my test" testtypes.find(1) //returns record ok @test.test_type //returns nil @test.test_type = testtypes.find(1) //nameerror: uninitialized constant tests::testtype @test.test_type //still nil according output finds type in database doesn't seem able add test class indicates me relationship not working. is able tell doing wrong? does work if change 1 line of code belongs_to :test -> has_one :test make one-on-one relationship. think error comes fact have not added test_type instance test_type attribute of test o...

sql server - Need help to execute SQL in text file with SQLCMD -

i want load excel file ( .xls ) table in database. database on own computer , have sa account in sql server 08. excel file contains - id name 1 dog 2 cat 3 fish the file ( demo.txt ) sql code: insert [mydb].[dbo].[relative] select * openrowset('microsoft.jet.oledb.4.0','excel 8.0; database=c:\my temp files\excel','select * [sheet1$]'); the sqlcmd code: sqlcmd -s mypc\sql2008 -i "c:\my temp files\sql\demo.txt" the error in sqlcmd : msg 7308, level 16, state 1, server mypc\sql2008, line 1 ole db provider 'microsoft.jet.oledb.4.0' cannot used distributed queries because provider configured run in single-threaded apartment mode. a fix (which not solve problem) above error http://blog.sqlauthority.com/2010/11/03/sql-server-fix-error-ms-jet-oledb-4-0-cannot-be-used-for-distributed-queries-because-the-provider-is-used-to-run-in-apartment-mode/ sp_configure 'show advanced options'...

utf 8 - Convert Japanese characters to UTF-8 for php json_encode -

i have japanese string in (utf-8 encoded) database '利用規約' passed php's json_encode function , receive warning: php warning: json_encode(): invalid utf-8 sequence in argument is there way convert valid utf-8 in order avoid this? if db utf-8 why php have problem string? update: turns out error in fact due problem sprintf , multibyte characters couple lines earlier. utf8_encode should work you. http://www.php.net/manual/en/function.utf8-encode.php if utf8_encode doesn't work, try mb_convert_encoding: mb_convert_encoding($string,"utf-8","auto");