Loading... Born a day after the American Independence in Jalandhar, Punjab, India, I've spent most part of my life there. Studied till 5th standard in St. Joseph's Convent School, Jalandhar, and later had to join Apeejay School, Jalandhar as, perhaps, the former school decided boys could be troublesome in a girls' school after 5th. After completing schooling in APJ (till 12th), joined National Institute of Technology [NITJ] (again, in Jalandhar) as a Computer Science & Engineering student in 2005. During the worst period of downtime (recession), got an on-campus placement in Accenture in 2008. Graduating from college took another year after that, and finally joined Accenture in mid-2009. This is my story so far... Btw, you can find me on: google+, twitter last.fm github librarything granular steam
@AnuragBhandari twitter updates
Tech enthusiast, open source evangelist, book worm, software developer, sports fan, passionate gamer, movie buff.
  • @Animesh_gupta91 The love triangle was plain bad. It also failed to evoke emotions during the ending religious argument. +1 to OMG there. —
  • @Animesh_gupta91 Did you really like it that much? —
  • Dear @Ionicframework, Ionic Creator and Ionic Lab are no less than X'mas presents. Thank you very much! —
Aug 07

ST makes it pretty straightforward to access webservices or APIs through its various data proxies and Ext.Ajax. But consuming an API protected under basic authentication can be tricky. Both data proxies and Ext.Ajax provide setUsername() and setPassword() methods, and they work fine on most browsers. But in my experience using these methods, I had big time face-palm moments in case of Safari, iOS, and some Android versions. When these methods are used, an ST app sets the Authorization header AND makes all API requests through URLs formed such as this:

http://user:passwd@www.server.com/api/user/2627

I’m not sure why this is such a big deal for some browsers, but they seem to get confused due to the presence of these two things — Authorization header and user:passwd URL.

The trick to solving the issue is to NOT use setUsername() and setPassword(), and instead set the HTTP headers yourself.

Data Proxies have a headers config.

someModel.getProxy().setHeaders({
	'Authorization': 'Basic ' + btoa(username + ':' + password)
});

Ext.Ajax has a defaultHeaders config.

Ext.Ajax.setDefaultHeaders({
	'Authorization': 'Basic ' + btoa(username + ':' + password)
});
Jul 27
  1. Sencha Touch is a great framework, but requires a LOT getting used to. The officials Docs do not always have the answer you’re looking for. ST forums and stackoverflow are excellent resources to consult when in need.
  2. If you are a web developer, DO NOT waste time learning Objective-C or Java for creating native iOS and Android apps. Instead use something like ST to develop a mobile web app, and then convert it into a native app using Cordova / PhoneGap.
  3. Cordova is the renamed, open-source version of PhoneGap.
  4. If your app is data-centeric, most probably it will depend on a webservice / API. If the API and the app are hosted on the same server, no problemo. In case of native apps, that are basically web apps PhoneGapped into native apps, that’d mean calling a remote API, and that is the problem. See same origin policy.
  5. Most googled solutions will point to making the service JSONP supported; but JSONP works only for GET requests. CORS is a recent W3C standard that supports all HTTP methods, but it still doesn’t work for PhoneGapped apps. ASP.NET Web API provides an easy CORS implementation.
  6. The perfect solution is to keep making Ajax calls normally, but using the full URL of the remote API. That will work because a PhoneGapped app doesn’t render in a browser but in a WebView (through a file:// URL). So it’s not restricted by browser’s same origin policy.
  7. ASP.NET MVC 5 and Web API are awesome!
  8. You may frequently encounter annoying cache issues with PhoneGapped apps. Just place a super.clearCache() in your Android app’s main activity’s onCreate().
  9. A PhoneGapped iOS app will run in fullscreen mode, by default, such that the status bar in iOS 7+ will appear over it. A fix is right here!
  10. One can create an IPA archive for testing on iOS devices via Build > *.app > iTunes > ?*.ipa. Believe me, it’s one of the most stupid things you will ever do. This is the correct way to create IPA archives for ad hoc distribution.
  11. Here’s how to create an animated splash screen in Android (though I have yet to figure out how to correctly use this in a ST-PhoneGapped app).
  12. If your device has Android 4.4+, you can remote debug your WebView-based Android apps using Chrome.
  13. JavaScript is yummy!
Tagged with:
Tagged with:
Nov 15

It was bound to happen some day. The existing init system in use by most of the present Linux distros is really not leveraging the performance capabilities of modern hardware to the fullest. Spawning processes one-by-one to get the system up and running costs a lot of precious time, when it is possible to do more in less time using the power of multi-core processors.

It was a welcome surprise to read about this new thingy systemd in the Q&A section of last week’s DistroWatch Weekly. I’m really looking forward to a faster future. :)

Tagged with:
Oct 01

Another of my free time exercises, Unjumble does just that – it unscrambles a jumbled/scrambled word into all possible English dictionary words that can be formed out of that jumbled word. The interface is extremely simple. You have a textbox to input your jumbled word, and as you type, all unjumbled word suggestions start appearing as list items in the combobox below. To copy an unjumbled word to clipboard, just click on it. Simple, isn’t it?

Like QuickCopy, Unjumble was coded in C#, and makes use of SQLite as the portable database to store a huge list of English dictionary words. What’s the most interesting thing about this little app is the algorithm behind it.

There is a pre-prepared database of almost all (58000+) English words [wordlist.txt], stored along with their hashes (words formed by the original words’ individual alphabets in sorted order). The input jumbled word’s hash is then calculated in a similar way, and is compared with the hashes stored in the database. All matches are then displayed in the list box.

I bet, using Unjumble, you’ll never lose your newspaper’s jumbled words game again. ;)

Download: Source Code (1.5 MB) – Installer (1.7 MB)

Tagged with:
preload preload preload