Thursday, 30 May 2013

Simple JQuery Slider

Here is a simple Jquery  slider that might be helpful. For a simple slider I googled a bit but end up with some really awful stuff, but I needed a simple one. So I thought of writing one. And here is what I could manage.

For Demo and Code: Visit http://codewithdeepu.com/?p=221

Sunday, 28 October 2012

Objective-C categories

Before we start let us make a point clear, Objective-C categories and Extensions are not the same and dont get confused on these terms.

Alright, Lets start.

Categories are used to create new abilities to an existing class.

 For example, let us take NSString class. If we need to add the ability to strip out all the special character from an NSString, the best way to follow is category. For this purpose we can simply create a category of NSString and add the method we need.

By doing this we are not actually changing any of the basic characteristics of an existing class but adding new features to it.

Now let us discuss about extension. It is always advised to subClass an existing class when ever we need a different behavior in the subClass when compared to parent class.

Hope thats clear. :) 

Thursday, 23 August 2012

Stream Youtube in iOS App: Using HTML & JS

As usual its a "follow the steps" kind of post:
Lets use JWPlayer to stream youtube in iOS :).

Download the JWPlayer files from here.
Now open a new project in xcode as "Single View Application".

Now go to ViewController.xib and add a new webView in it.

Connect this webView to viewController.h and name it as player.




Now add the JWPlayer code to our project, exactly as shown in the image.

Note: "Create Folder Reference To Any Folder Added" must be selected or you simply hit the wall. As you wish :).

Now add the following code to "ViewDidLoad" method:

 NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"readme" ofType:@"html" inDirectory:@"mediaplayer-5.10-viral"]];
  [player loadRequest:[NSURLRequest requestWithURL:url]];



Thats it. :)

Tuesday, 24 July 2012

Doxygen: Create project design doc in few clicks

I found doxygen a very effective and easy tool to create a design docs for my projects rather than making it by myself.


All that we have to do is select our projects root folder and "Run Doxygen". It can create output html format at an output folder we choose.

Simply run the index.html to see the whole design doc.

But it is important that we comment in a particular way so that doxygen can identify it and add them in design doc.


See the example below:


- (returntype *)myMethod
{
    /**     * Comment goes here     */
return nil;   }
or use this format:
 /** * Comment goes here */
- (returntype *)myMethod
{
    return nil; }

Doxygen will identify both.

You can get doxygen here.

Tuesday, 26 June 2012

iOS/Objc Azure Table Integration

" Windows Azure is an open cloud platform that enables you to quickly build, deploy and manage applications across a global network of Microsoft-managed datacenters.You can build applications using any language, tool or framework. "

But from many developers feed back and my own experience I would say "Its not that easy as it would sound!!!". I spend some tiring-hours to solve this out and I don't want other developers also to spend this much time as I have already got a solution.

Before starting let me be quite frank. I am not an expert in Azure, I just found out a solution and I would like to share it for all who might fall in trouble with azure.

In this example I will show how content can be retrieved from an azure table.

I have attached a project in here that you can download and run for yourself.

Change the "account name" and "direct access key" in plist to get content from your table.
You may need to specify your table name in "viewController.m".

Try it by yourself and if you hit a wall, contact me back. May be I can help you.

Thats all for now...

Download Source Code



Monday, 25 June 2012

How to create an ipa file?


So what’s an ipa actually????
ipa is iPhone Application Archive. So its just an archive, a zip file.
Can’t believe me right?
I know you all have made ipa file by changing your target to iOS device and runningProduct->Archive. But there is no fun in it, because you think there is something very suspicious happening that only Apple know, right?
Today we do it all by ourselves, thats where the fun is.
In XCode folder structure, you can see


Products->YourAPPName.app.
Right click on the .app file->Show in finder.
Now create a new folder and name it Payload. Copy the .app file into it and compress the folder. So now you got Payload.zip file.
Now rename it as Payload.ipa.
Just look at the screen, you are now Apple.

Objective-C categories in static library


I would like to make it as simple as possible:
-all_load Loads all members of static archive libraries.
-ObjC Loads all members of static archive libraries that implement an Objective-C class or category.
-force_load (path_to_archive) Loads all members of the specified static archive library. Note: -all_load forces all members of all archives to be loaded. This option allows you to target a specific archive.