Friday, June 29, 2012

HTML5 support on Android 4.1

Hi HTML5 folks,

  If you are a regular visitor, you might notice that I had posted HTML5 Support on Android 4.0 when ICS was just released by Google.

   This time I am back with HTML5 support on Android 4.1 Jelly Bean.
Sadly, I have taken the snapshots from the emulator and I am posting it here. Note that here I am talking about support of HTML5 on stock browser of Android.






Tuesday, April 24, 2012

Implementing HTML5 CORS on the server.

Hi all, I am here once again with some small hack for you all.

You, as a web developer, might have sometime come across a point where you might have needed to fetch some resources from a server with a different domain name as that of others.

You might have resorted to implementing proxy or resorted to a hack called JSONP.

Now, theres no need to take all that hassel, The goodness of Html5 has brought to you something called CORS(Cross Origin Resource Sharing.)

    But there is 1 downside to CORS
1. You need to have control over the server, but thats not a big deal, you need to have JSONP enabled on server either when using JSONP, same for proxy, you have to have something on server.

thats ok for now, I have seen many people who work with multiple domains and all of them have been under their own ownership. Like we have at my workplace.

ok, getting back to CORS now, heres what you need to implement on the server side, in order to get it working.

a simple header  in your HTTP Response.

response.setHeader({
                        "Content-Type": "text/plain",
                        "Access-Control-Allow-Origin": "*" //CORS implementation.
                       });

Putting '*' as the value of the header will allow any origin to make a call to your domain from withing a CORS supporting browser. If you want to restrict the domains which can make a CORS call, separate them by comma, like this.

response.setHeader({
                        "Content-Type": "text/plain",
                        "Access-Control-Allow-Origin": "bar.com, foo.com" //CORS implementation.
                       });


This is the example where I have implemented CORS when I was playing with my api on Nodester.com, which might be disfunctional at this time, coz I have built it just as a part of play, nothing else.

I hope that you have got an idea now.

in case of any quesiton or comment or criticism, feel free to write down below.

UPDATE: Some more sample code on Github
https://github.com/visionmedia/express/blob/master/examples/cors/index.js

Thanks & Cheers,
Have fun.

Friday, April 20, 2012

Code to use Google Docs as database

Sometime back, I had this post about using Google Docs as a database in cloud.
It was, however, only for HTML5 applications.

    I have recently moved that repository to Github and made some changes in the code too, in order to make it readable and understandable.


Download the latest code from there.

Thanks,
have fun.
Cheers.

Sunday, March 4, 2012

How to inhibit caching AppCache manifest.?

Hi all,

   So I am back with some new stuff related to HTML5's fantastic feature called Application Cache or sometimes also referred to as AppCache.

   Application Cache is one of those crazy features which, when I read about it, once again, drove me insane about internet and technology.

A bit of what AppCache is: AppCache is a HTML5 feature which allows chosen resources to be cached entirely into the users browser. Whenever the user visits your website next time, the resources are served from the Application Cache rather than making a HTTP request and fetch them from the server.

This feature can be used to greatly enhance the performance of the web application and save users bandwidth. All static resources like images, css and javascript libraries are suggested to be cached.

  There is a manifest file which specifies which files to be cached in the users browser. The scenario may get worse if the manifest file itself is cached at the users end. So its of utmost importance that user's browser always requests the manifest file to the server. I have listed 2 ways to force the user's browser to do so.

   Imagine the case when the manifest remains cached into the users browser. Whenever the user visits your website, all the resources are served to him from the Application Cache and no request is made to the web server to fetch the changed/updated resources. And this goes on and on until the user the user clears the cache. And you would not like your users to take this hassel, will you? On mobile devices, this scenario gets very difficult to detect and debug.

So I did some web research and found out 2 ways to inhibit caching of manifest file into the users browser.

1. Setting 'Expires' HTTP response headers to least possible time.
- url: /(.*\.(appcache|manifest))
  static_files: \1
  mime_type: text/cache-manifest
  upload: (.*\.(appcache|manifest))
  expiration: "0s"
Explanation: For those who are new to this, in simple language, 'Expires' is a field in HTTP response from the server. 'Expires' tells the client browser that the particular file should be server from the browser cache, until it is as old as the time specified. So in this case, if we set the time to 0 second, whenever the user visits your website, his browser will make a request for a new manifest file and discard the one already in the browser cache.


2. This is the other way to request the manifest file to the server every time your website is visited, but I will not recommend this approach, as it interrupts user and asks to refresh the page.
window.applicationCache.addEventListener('updateready', function(e) {
  if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
    window.applicationCache.swapCache();
    if (confirm('A new version of this site is available. Load it?')) {
      window.location.reload();
    }
  }
}, false);
Explanation: When the user visits your website, the resources are downloaded in the background after the page is loaded. When the user visits the same website again, the resources are loaded from the AppCache and the resources which are changed on the server are downloaded in the background. To see these resources, thus, user must refresh the page. The above code forces the user to refresh the page programmatically

Saturday, February 25, 2012

Some useful IntouchIds



   Few days back my boss dropped me an email. I dont remember what was it all about, but at the lower half,
I found a list of some useful IntouchIds. Just wanted to share them with all of my followers.
Click the link and add them to your contacts right away. :)

See you soon with some technical talk.
  1. Pune Airport*IN.AIRPORT.PNQ
  2. MSEB Pune
  3. BSNL Pune
  4. Pune Traffic Police
  5. Rickshaw Complaint (Pune RTO)
  6. TastyKhana: Food delivery service in Pune
  7. AyAuto: Dial auto rickshaw in Pune*IN.PN.GO.AYAUTO
  8. Autowale: Dial auto rickshaw in Pune
  9. Millenium National School, Pune
  10. LingerOn cafe: Baner Road, Pune

Wednesday, January 25, 2012

What is special about Node.js?



   I am not a Node.js programmer, but an aspirant to give it a try and try to do some real time stuff. Few days back, I came across this link on wired Theres are lots of things given in that link, but I have copied the best lines which I think is the best summations about Node.js

       Node is the successor to Ruby on Rails, the programming framework that made it big when Twitter made it big. “First there was C, which Amazon was written in,” he told us this past spring. “Then there was Perl, and Craigslist was written in Perl. Then there was PHP and Facebook, and then Rails and Twitter. With each of these things, they solved a lot of hard problems, but then new problems arrived. Node solves the next set of hard problems, the problems that come with all this real-time stuff.”


I have been a great fan of real-time things. Also I was amazed when I saw Google doing real time analytics at Google Analytics. Since then, I am just tapping my feet to get Nodejs running of my laptop and have a taste of it. Hope the above paragraph was useful to you.

Thanks.
See you again soon.

Monday, January 16, 2012

Comman line error in BlackBerry app development

Hello all, not much to share with you all, but some serious but silly problem that bugged me for a while. I was trying to create a simple BlackBerry project, HelloWorld and I faced with an error when I started running the project.

Command Line Error - BlackBerry Smartphone Simulator
----------------------------------------------------
Unknown option: World
Try "fledge /help" for command line help.






Later I found the solution on Google.


Solution
Just remove any spaces from your project name. Thats it.




This is a silly thing that RIM allowed to pass in into BlackBerry JDE plugin.
anyways, see you soon with some new stuff.

Sunday, January 8, 2012

Growing your contact network on IntouchId

Hi folks, its been a great time to see ya all.

  Today I am going to talk on something really different. Its not technology, its not programming, its not some kinda break through that I have done. But its about a small innovation, which I believe should grow out and become a de-facto standard of sharing contact information between people.

   Image even in the world of Quad Core smart phones and tablets, we still exchange contact information like an idiot. One guy asks the other for his/her cell no. then the first one types and missed calls the other one and then they save the numbers, that too in a static manner. Tomorrow either of these guys looses the number and they again exchange the contact information in the same static way.

     I mean, common man, we are all living in 2012. Here phones are smarter, TVs are smarter, even Web is smart enough to work, even in the situations of absence of Internet connectivity.

ok, so what exactly is this magic, I am going to talk about. Its the magic.

What is IntouchId?




IntouchId is a great way to share contact information and stay intouch with people forever.
No matter how many cell phone devices you change, no matter if your phone contacts are lost or entire phone is lost.

   And at the top of all, its not only about phone nos. Its about
1. Emails
2. Addresses
3. Contact Notes

They have mobile apps for almost all types of mobiles, Android, Apple iOS, BlackBerry, J2ME and Nokia's Symbian. In addition to this, they also have browser plugins to view your contact information from within the browser.

Beside, IntouchId also creates event pages which help you connect with people you meet at different events and share contact information with them.

Hope you have got an idea of what exactly IntouchId is. If you have any questions, feel free to throw them up in the comments.

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Share This

Share |