How to build an Apple Push Notification provider server (tutorial)
RSS Reader the way I need it…
Generally every person who is net freak starts his day by going through his RSS feeds. People like me, subscribe to many RSS feeds about programming, iPhone & Apple tech, Usability and stuff. Everyday I have about 30 unread articles in my reader app (I use NetNewsWire on mac). People start going through these articles and they really end up reading only small percentage of those unread, Usually only 5-6 out of 30. As most of the Articles are about same thing, same news, same product explored or smashed. Thats where the problem begins.
What people want to read at any given moment also depends on the external factors eg. Work place, Kitchen, Bedroom. When I am in Bedroom, I am really not interested in reading stuff about programming, similarly when I am at work place, I am not interested in reading and watching funny jokes and videos. There are many bloggers and site writing about the stuff from micro-gadgets to social and political views. This is the problem too.
The main goal and purpose of subscribing to RSS feeds is to stay connected and stay informed. People are really interested in reading the news or posts and not in the website posting that news. The news is more important, at least more important than the person or site who is posting it. Most of the RSS reader put RSS hosts at the primary position. They show how many unread posts are present on any given site. Of course some people are interested in sites and people who are posting the things as well, but the very definition of the RSS reader according to wiki says “It is a family of web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format.” Here we can clearly see the important thing is entries and news. That is why I think most of the RSS reader apps are doing the things in pretty wrong way, they could do much better.
What most of the apps are doing right now is this…

What I am looking for in reader app is this…

I think Categories and Tags is what people actually need to see as a primary differentiator element. RSS feeds provide Categories in the XML that it sends so it could be done with some efforts. Maybe it will be great if user gets to decide what that user needs as a primary differentiator.
Saare Jahan Se Accha Tabs
On Our Republic Day…This is the only song that comes to my mind, really sounds too good on electric guitar.
Saare Jahan Se Accha ---------------------- 4--------------------- ---7--5-7---4--5--5--- ---------------------- ---------------------- ---------------------- Hindostaan Hamara... ----------------------------- ----------5-6-5-5---6-5------ -----5--7---------7-----7-5-- 5--7------------------------- ----------------------------- ----------------------------- Hum Bulbule Hai Isaki -----------------5------ --6-8---8-8-5--6---8---- 7----------------------- ------------------------ ------------------------ ------------------------ Yeh Gulsitan Hamara Hamara.... ------------------------------- 5-6-8--6----------------------- ----------8--7-5-5--5-5-4------ --------------------------7-5-- ------------------------------- -------------------------------
Enjoy playing the tune…
NSDate and Sqlite3 in iPhone
While working with NSDate and sqlite3 on iPhone the common problem many people face is about storing and retrieving NSDate from sqlite3 database. There are mainly two methods to do so, one is to get the time interval (timeIntervalSince1970) from reference date and save the interval as double value in the database, second is to convert date into string using NSDateFormatter and save the text value in the database.
NOTE: The type of column where we want to store NSDate should be DATETIME in both the methods.
Method 1: using timeIntervalSince1970
Writing NSDate to sqlite3 DB
NSDate *dateToWrite = [NSDate date]; // current date double valueToWrite = [date timeIntervalSince1970]; // save "valueToWrite" in DB as DOUBLE
Read NSDate from sqlite3 DB
//read double from sqlite3 DB n store it in valueFromDB(double) NSDate *dateFromDB = [NSDate dateWithTimeIntervalSince1970:valueFromDB];
Method 2: using NSDateFormatter ( i prefer )
Writing NSDate to sqlite3 DB
NSDate *dateToWrite = [NSDate date]; // current date NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSString *stringToWrite = [dateFormatter stringFromDate:dateToWrite];
//save "stringToWrite" in DB as TEXT [dateFormatter release], dateFormatter = nil;
Reading NSDate from sqlite3 DB
//read TEXT from sqlite3 DB n store it in stringFromDB(NSString*) NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd"]; NSDate *dateFromDB = [dateFormatter dateFromString:stringFromDB]; [dateFormatter release], dateFormatter = nil;
I personally prefer the 2nd method here though it takes more number of lines to do it. ( sometimes it’s better to write more number of lines )
While accessing database file from terminal we can easily read the stored date as it is very much humanly readable.
Happy Coding…
Kal Ho Naa Ho (tabs)
These are the tabs for one of my all time fav song. Tuned up my guitar and played it after real long time.
E-------------------10-8------------------ 2 times B--11--10-11-10-11-------11-10--8-10-8-10- E------6^------------------6^------------- B--6-8----8----6-8~-6--6-8----8--9-8---6-- G------------8-----------------------8---- E-------------------10-8------------------ 2 times B--11--10-11-10-11-------11-10--8-10-8-10- E-------11-10-8---------------------11-10-8------------------ B-10-11---------11-10-10-11~---10-11---------11-10-10-11-86- E------6^------------------6^------------- B--6-8----8----6-8~-6--6-8----8--9-8---6-- G------------8-----------------------8----
Thanks and enjoy the song…. 🙂
Emoji is the Japanese term for the picture characters or emoticons used in Japanese wireless messages and webpages. Originally meaning pictograph, the word literally means e “picture” + moji “letter”. The characters are used much like emoticons elsewhere, but a wider range is provided, and the icons are standardized and built into the handsets. The three main Japanese operators, NTT DoCoMo, au and SoftBank Mobile (formerly Vodafone), have each defined their own variants of emoji.

Ok enough of this….Lets see how to enable this keyboard to be used everywhere. (By default this keyboard is only works on iPhones from Japan)
Step1:
- (void)enableEmoji {
#define kPreferencesFilePath @"/private/var/mobile/Library/Preferences/com.apple.Preferences.plist"
#define kEmojiKey @"KeyboardEmojiEverywhere"
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:kPreferencesFilePath];
if (!dict) return;
// Toggle the setting from on to off or vice versa
BOOL isSet = [[dict objectForKey:kEmojiKey] boolValue];
if (!isSet) {
[dict setObject:[NSNumber numberWithBool:YES] forKey:kEmojiKey];
[dict writeToFile:kPreferencesFilePath atomically:NO];
}
}
Note: This code does not work on iPhone Simulators, Works only on devices.
Step2: After running this code for once, go into “Settings” > “General” > “Keyboard” > “Japanese Keyboard”. Enable the “Emoji” keyboard.
Step3: Open any Notes.app & see the magic.
Note: According to Apple Forums its a private API, then how does applications on appStore are allowed to use it?
Flipping bar button like iTunes
This is the example for how to create flipping bar button like iTunes. I faced the same problem while developing solutions for first time, after looking at iTunes app more closely..it seems the flipping thing in Navigation Bar is not a BarButton but button with images ( It does not show highlighted effect ).

All we need to do is use custom UIBarButtonItem with CustomView for this.
Step 1: Create UIBarButton with CustomView
barButtonSuperView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 34, 30)];
barButtonPrimaryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 34, 30)];
UIButton * primaryButton = [UIButton buttonWithType:UIButtonTypeCustom];
primaryButton.frame = CGRectMake(0, 0, 34, 30);
[primaryButton setBackgroundColor:[UIColor greenColor]];
[primaryButton addTarget:self action:@selector(flipAction:) forControlEvents:UIControlEventTouchUpInside];
[barButtonPrimaryView addSubview:primaryButton];
barButtonSecondaryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 34, 30)];
UIButton * secondaryButton = [UIButton buttonWithType:UIButtonTypeCustom];
secondaryButton.frame = CGRectMake(0, 0, 34, 30);
[secondaryButton setBackgroundColor:[UIColor redColor]];
[secondaryButton addTarget:self action:@selector(flipAction:) forControlEvents:UIControlEventTouchUpInside];
[barButtonSecondaryView addSubview:secondaryButton];
// self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:barButtonSuperView] autorelease];
UIView * barButtonSuperSuperView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 34, 30)];
barButtonSuperSuperView.backgroundColor = [UIColor viewFlipsideBackgroundColor];
[barButtonSuperSuperView addSubview:barButtonSuperView];
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:barButtonSuperSuperView] autorelease];
[barButtonSuperSuperView release], barButtonSuperSuperView = nil;
Step 2: Use UIView transition effects
[UIView beginAnimations:@"BarButtonViewAnimation" context:NULL];
[UIView setAnimationDuration:kTransitionDuration];
[UIView setAnimationTransition:([barButtonPrimaryView superview] ?
UIViewAnimationTransitionFlipFromLeft : UIViewAnimationTransitionFlipFromRight)
forView:barButtonSuperView cache:YES];
if ([barButtonPrimaryView superview]) {
[barButtonPrimaryView removeFromSuperview];
[barButtonSuperView addSubview:barButtonSecondaryView];
} else {
[barButtonPrimaryView removeFromSuperview];
[barButtonSuperView addSubview:barButtonPrimaryView];
}
[UIView commitAnimations];
Here is the complete demo code.
UITableViewCell Selection
I have seen many many applications so far, i mean really awesome applications. Still one thing i see which is almost common with all of them except few one is that Custom UITableViewCells does not change text color when selected/highlighted. I am also a developer and i know these kind of things miss out while developing applications in rapid development cycles and under timeline pressure :(. but then it really shows high level of ignorance from developers side.
The solution is simple. Generally what we do is we create custom UIView and add it inside UITableViewCell. Just we need to do some extra coding in UIView. as shown in TableViewSuite.
CustomCellView.h
#import <UIKit/UIKit.h>
@interface CustomCellView : UIView {
BOOL highlighted;
}
@property (nonatomic, getter=isHighlighted) BOOL highlighted;
@end
CustomCellView.m
#import "CustomCellView.h"
@implementation CustomCellView
@synthesize highlighted;
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
// Initialization code
}
return self;
}
- (void)setHighlighted:(BOOL)isHighlighted {
// If highlighted state changes, need to redisplay.
if (highlighted != isHighlighted) {
highlighted = isHighlighted;
[self setNeedsDisplay];
}
}
- (void)drawRect:(CGRect)rect {
UIColor *nameTextColor;
if( self.highlighted ) {
nameTextColor = [UIColor whiteColor];
} else {
nameTextColor = [UIColor blackColor];
}
// Draw code
}
- (void)dealloc {
[super dealloc];
}
@end
Socha hai – Rock On tabs
I didn find good tabs for it anywhere so here i am posting my own version…
PART1
E--5----------------------------------------------------
B--7--------------------------3--------------2-3--------
G--7------4~----4-6-7---------2--0-2-4-----4-----2h4p2--
D--5--5-7-------------7h9p7~~---------------------------
A--5----------------------------------------------------
E--5----------------------------------------------------
PART2
E-------------------------------------
B---3-3-3-3-3-3-3-3-3-3-3-3-3-3-3-3---
G----2-2-2-2-0-0-0-0-4-4-4-4-2-2-2-2--
D-------------------------------------
A-------------------------------------
E-------------------------------------
PART1 & PART2 together 2 times
D
aasma hai neela kyun
Bm
paani geela geela kyun
G A
gol kyun hai zamee
D
silk mein hai narmi kyun
Bm
aag mein hai garmi kyun
G A
do aur do paanch kyun nahi
.. and so on
YMSG16 Authentication
The new Yahoo messenger v9.0 uses ymsg 16 protocol. For login process client sends username and password to yahoo login server: https://login.yahoo.com, and in response server sends Token which is then used for client authentication process on scs.msg.yahoo.com:5050
This login process goes through multiple steps as follows..
Step 1: Send username and password to login server
Https request url:
https://login.yahoo.com/config/pwtoken_get?src=ymsgr&login=<username>&passwd=<password>
Https response and meaning:
Invalid username : 1235
Wrong password : 1212
Information Valid : 0 ymsgr= <token>partnerid=<pid>
data is used in step 2 for further processing.
Note: and seem to appear in pair for given username and password
Step 2: Send token to login server
Https request url:
https://login.yahoo.com/config/pwtoken_login?src=ymsgr&token=<token>
Https response and meaning:
Invalid ymsgr : 100
Information Valid : 0 crumb=<crumb> Y=<Y-Cookie> T=<T-Cookie> cookievalidfor=
<crumb>, <Y_Cookie>, <T_Cookie> and <B_Cookie> are used in client authentication on receiving challenge string from Pager server.
Note: is received in header of the reponse.
Step 3: After receiving challenge string from pager server
When client receives challenge string from pager server, it sends encrypted response to server. This response is formed using received in Step 2 and challenge received from pager server.
Process for forming response:
crypt = crumb + challenge
hash = MD5(crypt)
response = BASE64(hash)
replace ‘+’ by ‘.’ in response
replace ‘/’ by ‘_’ in response
replace ‘=’ by ‘-’ in response
Client sends this calculated response for received challenge along with <Y_Cookie>, <T_Cookie> and <B_Cookie>.
I’ll always remember…
Firstly, I would like to talk about the first year; there is lot to say about. I was in some other college then I got admission here, in Watumull. Those days were so different than today’s. I was one unknown guy in that class. I still remember, our class was on the fourth floor first room – a ‘window-class’ with very beautiful view of the sea face. In all labs chintu, saili, pappu, neha n me were in one group. Always these girls used to do all calculations n we all guy used to copy those things. We were together as one class, even instrumentation people. I just can’t forget that physics lab (torture place), anna ki cutting while doing metal work, drawing sheets….and the word ‘chavrya’.
Then comes second year, here the first thing happened was, I topped the college… i still remember, I was on the stairs going up… and avinash was running down…”abe vinay, tune top kiya”…yes, these were the words. My class selected me as a CR. Now I was no more some unknown guy. Here the other most important thing, a new person came into our life…Misal Sir… New people took admission…a new category…we used to call them “diploma people”. But very soon they became one of us. I really felt bad about my friends who got drop. And 1 more little funny thing, I made navneet my sister…I can’t forget every person even girls were shocked…”are you mad, how can you do that…” because Watumull was famous as “Navneet’s college”. Hahahahhaha….
Third year…is there anything special. This time I was not topper n all, but my class again wanted me as CR, that was against the rule but still. First time I realized something that cannot be expressed in words. I got ATKT…I failed in exam for the first time in my life (hope it is the last time). Moreover, my life also took a strange turn here, suddenly everything was so different. Don’t want to say much about it, but it was funny that some people were ready to help in that.
Many things happened in between third n fourth year…now again life is so much different. There is not much to say about it surprisingly. Kk, jits, teju – my project group-”Xml guys”. First time we submitted Misal Sir’s journal with more than 2 pages.
Finally, “last but not the least”…I can’t forget your handwriting priya n saili….all my journal work n assignments in every year was aapki meherbani. and one more thing, all you people have malloced special place in my memory…I really can’t forget any one of you. BE COMPS 07 is the best class in the universe.
String theory says that we live in 11 different dimensions, worlds…I can live in infinite number of worlds with you all people. After reading this last sentence kavat will say “chavrya shuru ho gya…”