Sunday, September 23, 2012

Zend Framework doesn't support bulk inserts

Frameworks have definitely made life easier for a developer. Specially web applications who always face a threat of being hacked, if developed from scratch. But today, developers of these applications worry no more about making applications safe from hacking. Framework do this job for them. They only need to follow the framework's recommendations.

Many of the modern frameworks provide their own api's for doing common tasks. For example if we were to develop a database driven application we are required to do simple sql related tasks like insert, select or update. DB related tasks are handled by DB related api's of framework and contain method for almost every sql operation.

Couple of days ago i got a chance to play around Zend Framework version 1.11. After seeing the depth of this framework with endless possibilities i became a fan of it. Although Zend Framework documentation need lot of improvements, but O my! they might be the first to adopt PHP 5.3 features like closures and namespaces for their Zend Framework 2.

Unfortunately, there is one part i was said to find out inside about Zend Framework that it cannot do multiple/bulk or batch insert in one query. I know what you guys are thinking about.

"Even the simplest PHP/MySQL frameworks have bulk insert feature".

If Zend Framework has a room left for a feature, we would love to have this one implemented.

Wednesday, February 22, 2012

Make Facebook application or page without purchasing SSL

Facebook has put restrictions over developers to make Facebook pages and apps secure. Now the question is how to secure our pages and apps on Facebook. To secure your pages and apps, you need to purchase SSL license for the domain on which your app or page is hosted. There are different companies out there who sell SSL license online. The price of SSL license start from $9 and goes on.

Although price of a SSL license is cheap but it not FREE. Lot of developers are seeing this restriction really annoying. Due to new restrictions the old Facebook apps and pages have stopped working.

But no worries my dear developer friends. If your Facebook page and app is not dynamic and consist of Javascript and HTML you guys can host them on Dropbox.

Dropbox is a file hosting/sharing service. Dropbox allows you to upload files and then you can get links for each file for web browsing.

HOW TO DO.
GO to Dropbox website.
Download their application for Windows/Mac. Whatever OS you are using. INSTALL IT.
[For Windows]
After installing Dropbox application will ask to make new account. Fill the form and you are done with Dropbox setup.
Go inside My Document -> Dropbox->Public.
make a folder naming your Facebook app/page. Like mine is 'myfacebookapp'
copy all your app/page files inside your folder.
If you have index.html as default file to run. Right click on it and Select Dropbox->copy public link.
You will get a link like.

http://dl.dropbox.com/someletter/somenumbers/yourfacebookappfoldername/index.html

Now go to your app/page settings in Facebook developer account.
Edit your app settings.

[For App]
Canvas URL: http://dl.dropbox.com/someletter/somenumbers/yourfacebookappfoldername/index.html/
Secure Canvas URL: https://dl.dropbox.com/someletter/somenumbers/yourfacebookappfoldername/index.html/

[For Page]
Page Tab URL: http://dl.dropbox.com/someletter/somenumbers/yourfacebookappfoldername/index.html/
Secure Page Tab URL: https://dl.dropbox.com/someletter/somenumbers/yourfacebookappfoldername/index.html/

P.S: Don't forget to put trailing slash '/' at the end of each URL, otherwise you will get an error.

And here you go.
Tadaaaaa.......

Saturday, January 21, 2012

jQ.Mobi another smartphone/tablet web application development api lanched

Why we prefer smart phones over old non-smart phones. You guys are right, they are capable of storing more contacts, messages and notes. But there is one another advantage they have on old phones.


"Let me call them old phones, because they are old and not smart."


Yes, they have a relatively efficient/new web browser and lots of third party applications. Old phones are also not getting updates that is why their web browsers can only show websites which contain WAP or HTML4 content. According to a survey smart phone users spend more time on applications rather than using internet on mobile's browser. This mean a huge cloud of third party applications is the only reason behind buying a smart phone.


But some of you might not agree with the above conclusion. Third party applications are also available for almost every old handset. They are not productive and easy to use as compared to Computer applications, but they still exist. Today, when we buy a smart phone we expect that its applications will give us a experience close to computer application. People are now looking at smart phones and tablets as an alternative of a computer.


For publishers it is like the biggest hurdle, because there are lot of brands of smart phones out there in market.


"From publishers i mean companies who make applications/softwares. Now don't get confused by the word software, it is another name for application."


If publishers want their application made to run on each brand's smartphone/tablet. They will have to create departments to develop application for each brand. Every department require employees with relevant skills. Now you understand why it is a hefty job?


These companies thought their way out of this problem by identifying, which application is by default available in every smartphone.


"Applications which are already available inside a new device are called default applications. Company install them on the device and they cannot be removed by any user."


They found out that web browser is the only application which is available in every smart phone and tablet by default. So companies started developing api's or libraries which can be used to make applications. These libraries are consist of HTML and javascript files. By including these api's, applications use resources of web browser available inside the smartphone/tablet. Due to the heavy use of javascript in these api's, applications some time run slow on the smartphone. Although these api's are facing compatibility issues, but they are still popular inside the publishers because they run on almost every smartphone/tablet.


jQ.Mobi is another api/library for making mobile applications. They have specially optimized their api to avoid lag or slow down while running on mobile devices. Although their api is in beta testing phase, but i hope pretty soon they will capture nice share of mobile application development.

Saturday, January 14, 2012

Grooveshark's HTML5 app is on the news

It is everywhere on the internet that Grooveshark has launched beta version of their music app created in HTML5. Yes, it is a big moment for HTML5 and a good alternative of mobile native app. It occurred that Grooveshark moved towards their web app after getting their native iOS app removed from Apple App Store. The fun part is that you can now access Grooveshark app on any modern browser.


Being a tech savvy person, i was interested to know which mobile api they used for transitions and touch capabilities. Because there are mobile api's available on the internet like jQueryMobile and Sencha Touch. But unfortunately, i got no clue about the api after seeing the source code of their web app. Although jQuery is being used inside the minified javascript files Grooveshark used in their app. Although mobile web apps have a past of being laggy on mobile browsers, but Grooveshark's beta app run smoothly on iOS browser with a simple layout and small footprint of javascript.


HTML5 Tag Check
HTML5 new tags like header, footer, article, section and nav are not used inside the app. Basically due to their limited implementation on mobile browsers. On the other hand they have used script text/templates to speed up client side rendering and updating. Facebook sharing tags are also implemented inside the source to make it available for sharing within your friends.

Wednesday, January 11, 2012

StencylWorks a nice tool to easily make games without coding

Games are now getting more popular than movies. Major proportion of game revenue is coming from mobile devices. Even on the freelance websites now most of the outsourced work is related to gaming. After the evolution of powerful mobile devices called smart phones, developers are now capable of making more detailed,eye catching games. Companies like Rovio and Zynga made a fortune by selling their games for web and mobile platforms. Flash gaming is still unbeatable on web giving birth to HTML5 games. No doubt the importance of traditional console or PC gaming is there, but companies are now making mobile versions of their game as well. Game making tools which support variety of platforms are now becoming popular within game developers.

The previous paragraph is all about Corporate GIANTS making cash by developing games with their HUGE studios and a list of teams named inside the credits of their game. But you should not let your hopes run dry, because they also took a start from one or two guys. If your game idea is unique then you should go for it. Think about the guy who gave the idea of ANGRY BIRDS, he was also like us. Once you are done with your game idea, pick a tool that can develop your game easily and quickly. Thats where StencylWorks comes in.

StencylWorks is a FREE game making tool by Stencyl company. It is available for Windows, Mac and Linux. Currently it can publish games to flash,iPhone and iPad but Stencyl has future plans to extend its tool to also publish games for android and HTML5. StencylWorks has a nice website containing a wiki and an active forum to get started with it. StencylWorks is free for the whole development and testing of games on flash and iOS. But to publish your game on App Store you need to purchase their license.

Tuesday, December 27, 2011

My first iPhone app is finally launched on app store




The STORY
It all began when my Boss said to me "One of client wants iPhone app to be made for their website". Here was my chance to learn iPhone app development. So i said "Yes, i will make this app, i am on it from right now". He then asked for time frame for the app completion. I said everything has to be learned that is why it will take lot of time.

The HARDWARE
After searching on Google i found out that iphone development can only be done on MAC OS not WINDOWS. I went to Apple website for the mac prices and they were pretty expensive. It also came to my mind that at this moment my Boss would not want to buy a pricy machine. According to the investment point of view Bosses do think of the revenue they will generate before buying a machine. In my case it was only one iPhone app, which was still to be developed, so i went online to search for other options. I found MAC OS, which can be installed on an INTEL based machine. The odds of MAC OS able to run whole machine hardware were few. Nothing is better than anything so i downloaded the copy of MAC OS and burned to a DVD. I grabbed a free INTEL Pentium 4 machine from office and successfully installed MAC OS on it. MAC OS was installed on the machine but it was not picking machine's Ethernet and Audio. I went online to find drivers for MAC OS. After several hours i found kext files for machine's ethernet and audio. I copied those files to required folders by reading the instructions written inside the help file. After that i ran a shell script provided with it and ethernet and audio was working fine. me so clever.... right?

The SOFTWARE
Xcode is IDE for developing MACOS and iPhone apps. Xcode consist of an Interface Builder, iPhone/iPAD Simulator and profiling instruments. I already downloaded Xcode 3.1.2 available back then. When i tried to installed Xcode on MAC OS it gave me an error that i can only be installed on versions 10.5.5 and above. I was so much mad at this point as i was so close to start developing my first iPhone app. I again went on Google search and found a solution for tempering MAC OS version. I changed it from 10.5.2 to 10.5.5. Fortunately it solved the error and Xcode was successfully installed on machine. I felt so relieved after trying hello world iPhone app and watching it running on simulator.

The CODE
Objective-C a form is C is used for scripting iPhone apps and it has a different syntax for accessing members and calling methods. Cocoa Touch API is used for making apps for touch devices of Apple like (iPod,iPhone,iPad). Cocoa Touch API written in Objective-C which works as a wrapper for Apple mobile devices with few hardware resources. Cocoa Touch API follows a MVC architecture. I learned to use uicontrols inside cocoa touch such as uitableview, uilabel, uiimageview, uipickerview, uitextfield, uiacitivityindicatorview and etc. I also learned how make http request and get response using NSURLConnection. I also incorporated three20 Api to my app for showing picture gallery. Three20 reduces the hassle of asynchronous downloads preventing developer to write a buggy code for it. Memory management in Xcode is really powerful which enable developers to write error free apps in one go.

The DEPLOYMENT
Simualtor in Xcode gives a quick way to test apps for iPhone and iPad. But it is not enough because it lacks lot of features that is inside a real device like camera, accelerometer, core location etc. Specially, if you are making a game then each test should be done on device. Important thing in deploying app to a device is code signing which involves developer to create a account at Apple Developer Account(ADP). There is $99 fee for creating this account. Using this account you can create provisioning profiles for developer deployment, Adhoc deployment and deployment of Apple App store. I created for developer account provision profile and deployed it to a device for testing. When my app was ready to be launched i code signed my app with Apple App store provisioning profile. After i prepared app store binary i logged in to itunessconnect, i created a new application and filled my app information into. Then i submitted my binary to apple for reviewing. After 7 days my application got reviewed but unfortunately it was rejected not conforming to apple guidelines. They also gave reasons for the rejection. I corrected my iphone app according to the provided reason and resubmitted the binary to apple. But this time i was lucky and my application got published to Apple app store.

Overall EXPERIENCE
The only drawback of MAC OS as a virtual machine is that it can't code sign your app for deployment. I don't know whether MAC OS on VMWARE can do code signing. But it made me realize that its better not to waste more time and purchase a pricy mac. Boss then arranged a used MAC MINI which i further used within deployment phase. Xcode is a great IDE and apple making it more useful for developers by updating it. The worse part is you can't update your already installed Xcode. Every build of Xcode is a new installation. New Xcode 4.0 even have GIT(source version system) incorporated with it,creating provisioning profiles is made easy and it can be done inside Xcode.

Thursday, January 20, 2011

Implement Singleton Design Pattern in different Languages

Below are some code snippets which shows how to implement Singleton pattern.

Java

public class FileWriting {
    static private FileWriting _instance = null;   
    protected FileWriting(){
       
    }   
    static public FileWriting getInstance() {
      if(null == _instance) {
         _instance = new FileWriting();
      }
      return _instance;
    }
}

FileWriting javaObj = FileWriting.getInstance();



PHP

<?php
 class FileWriting{
    protected static $_instance;
    protected function __construct()
    {
       
    }
    public static function getInstance()
    {
        if(!self::$_instance)
        {  
            self::$_instance = new FileWriting();
        }
        return  self::$_instance;
    }
  } 
  phpObj = FileWriting::getInstance();
?>



Objective-C

@interface FileWriting : NSObject {
}
-(FileWriting*)getInstance;
@end

@implementation FileWriting
static FileWriting *_instance;
-(FileWriting*)getInstance{
   if(_instance==nil){
      _instance = [FileWriting alloc];
   }
   return _instance;
}
@end


Now to make an object of FileWriting interface.

FileWriting *objc_inst = [[FileWriting alloc] getInstance];