Escaping sqlite string in obj-c

iPhone

Problem adding "%" inside your sql queries? read below.

const char *sqlStatement = "select fname,lname from students where lname like ?001 and fname like ?002";

Notice that the parameter tokens, ?001 and ?002 do not have quotes around them.
This statement needs to be prepared in the usual way.

NSString *fnameSearch = [NSString stringWithFormat:@"%%%@%%", fnameSearchWord];

NSString *lnameSearch = [NSString stringWithFormat:@"%%%@%%", lnameSearchWord];

 

Notice the %% characters in the format string. This results in one % in the output string.
%@ is the replacement token for your string parameter.  
Finally, you have to bind your strings to the prepared statement like this:

 

sqlite3_stmt *compiledStatement;

if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK

{

  sqlite3_bind_text(compiledStatement, 1, [fnameSearchWord UTF8String], -1, SQLITE_STATIC);

  sqlite3_bind_text(compiledStatement, 2, [lnameSearchWord UTF8String], -1SQLITE_STATIC);

while(sqlite3_step(compiledStatement) == SQLITE_ROW)

{

// continue data manipulation here.

 }

}

pjblog skin?

Site News

i was bored and tried googling my domain name and came up with this

http://bbs.pjhome.net/viewthread.php?tid=56947&extra=&page=1

its a chinese site you can use google translate to translate the site.

anyways this pjhome is like a blogsite/cms or whatever it is. they made a skin using my site theme, yes kinda funny don't know what to say.

How to enable GRPS/EDGE/3G/HSDPA with Sun Cellular on iPhone

iPhone

First you need to activate your data service.

Just Send

ACTIVATE to 2300

Then go to Settings > Network > Cellular Data Network (assuming you're using 3.x)

Cellular Data

APN: minternet

Username:

Password:

Leave Username and Password as blank.

Fire up Safari and you're done!

btw. Sun Cellular data rates is 10php per 30 mins.

OS X 10.5.8 now available via Software Update

Apple

Surprise, Mac users — Apple released an update to OS X this afternoon and it is now available for download via Software Update. The update to Leopard, 10.5.8, seems to be a relatively minor one with the following changes listed in the updater:

compatibility and reliability issues when joining AirPort networks.

an issue that could cause some monitor resolutions to no longer appear in Displays System Preferences.

issues that may affect Bluetooth reliability.

The install will also upgrade users to Safari 4.0.2. Woo hoo. Apple listed two new support entries related to the update for those looking for more details. They can be found here and here. Get a move on, Apple fans.

twitter api

Ruby on Rails , PHP

another boring day. been reading about this twitter api. and decided to test a few :D.

fortunately i was able to make it work well some of them.

first thing i tried was using cURL to update status in twitter.

Posting Twitter status via cURL

curl --basic --user username:password --data status="I'm twittering with curl!" http://twitter.com/statuses/update.xml

isn't that cool? updating tweets via cli.

but i ddn't stop with that i decided to read more and found this very nice tutorial http://www.jaisenmathai.com/blog/2009/03/31/how-to-quickly-integrate-with-twitters-oauth-api-using-php/

after that i also googled for ruby on rails regarding twitter api. so i tried Sinitter

Sinitter is an application to demonstrate the integration of Twitter OAuth with sinatra and also serves as a live test for the twitter_oauth Ruby gem.

 

http://apiwiki.twitter.com/Twitter-API-Documentation for more info about twitter api.