Thursday, June 12, 2014

Android: Open Facebook official app from your own app with different intents

Opening Facebook's official android app from your own app is really easy. You just need to create an intent with correct uri and start and activity with that intent. The app will open with the right page, group, picture, video or etc.

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);

where uri could be any of the following:

fb://root
fb://feed
fb://feed/{userID}
fb://profile
fb://profile/{userID}
fb://page/{id}
fb://group/{id}
fb://place/fw?pid={id}
fb://profile/{#user_id}/wall
fb://profile/{#user_id}/info
fb://profile/{#user_id}/photos
fb://profile/{#user_id}/mutualfriends
fb://profile/{#user_id}/friends
fb://profile/{#user_id}/fans
fb://search
fb://friends
fb://pages
fb://messaging
fb://messaging/{#user_id}
fb://online
fb://requests
fb://events
fb://places
fb://birthdays
fb://notes
fb://places
fb://groups
fb://notifications
fb://albums
fb://album/{%s}?owner={#%s}
fb://video/?href={href}

Thursday, June 5, 2014

Android game engines

I want to try my hand at game development for smart phones. I am familiar with Android and own 4-5 Android devices so the platform choice is straight forward. But I cant seem to decide which game engine to start with. I have tried googling a lot and there is no clear winner. The most popular game engines seem to be Unity, Corona and Cocos2D. Cocos2D is the only one of these which is totally free. So I think I will start with Cocos2D. If someone has other suggestions please let me know.

Friday, January 10, 2014

Email from Google+ circles - No thanks.

Just received an email from Google touting the new FEATURE of GMail:
Starting this week, when you're composing a new email, Gmail will suggest your Google+ connections as recipients, even if you haven't exchanged email addresses yet.
Until today I have never been worried about random people adding me to their circles on Google+. I mean who cares if some random guy from some country you never heard of added you to their circles. Doesn't matter. Right? They couldn't see my status, posts, pictures or anything that I share with my circles except  for what is shared publicly. But not now. Now (s)he can send me an email. Sure they can send me just one email and can't start another conversation with me unless I respond to their first email but my inbox is already too littered as it is and I don't want even a single unwanted email coming in my direction. And even if you limit the number of unwanted email from one account to just one, what is stopping spammers from creating new accounts for just one email per person?And if I want someone to be able to talk/email to me, I will share my email address with them, so stop forcing Google+ on me. Microsoft is already making a good case for their email service with really nice interface and no spam (so far).

Those of you who share this sentiment, nip it in the bud. Turn it off. For doing this just go to your gmail account, then go to Settings. Under general tab you will find a setting for Email Via Google+. Turn it off.


And for fan of memes, here is something that pretty accurately describes my feelings at the moment.


Friday, January 3, 2014

I am so tired of Unity: Part 2 AKA I like Kubuntu/KDE

I have been trying Kubuntu for last week or so and so far I am really liking it. I must say that I am impressed. KDE looks a lot more polished and stable than Unity or even GNOME 3 for that matter. The UI is really sleek and stylish. The effects are good looking and so are fonts and icons. The text in title bars, buttons, menus and everywhere else is thinner and a lot more smoother than it is in Ubuntu. And most importantly I really like Kate. I am used to Notepad++ and Gedit always felt so ancient in comparison. But Kate seems like a good replacement. I think I will stick around for a while.

Friday, December 27, 2013

I am so tired of Unity

I am an avid Ubuntu user. It has been my primary OS since 2008 i.e for almost six years now. But I am now getting tired of Unity, not Ubuntu, just Unity. For those not familiar with the term, Unity is the desktop environment of Ubuntu. Ubuntu switched to Unity from GNOME a while ago when GNOME 3 was about to be released. I have read that Canonical did not agree with the direction GNOME was heading in and when they were not able to sort their differences with GNOME they decided to create their own desktop environment for Ubuntu and so Unity was created. But this is what I have read on internet and considering how reliable internet is, I am not sure what really happened but the fact remains that Ubuntu switched to Unity.

Unity has its own merits but it has made it difficult for me to perform day to day operations. For example whenever I have to run an app for which I don't have a launcher icon I have to click the home button and then type the app name for it to appear in the app list and then click on it. I don't like that. I also do not like that there is not button to minimize all windows. I also do not like the fact that every program has its menu in the top panel. When I have two windows open side by side and I need to use their menu, I have to first select the window and then move my pointer miles away to top panel to get to the menu. Similarly I like the close button for a window to be in the top left or top right corner of the screen when they are maximized. This makes closing them easy. But with Unity this is no longer possible. There are a lot of other similar issues which are not a big deal them self but together they make it really difficult for me to perform everyday operations.

But this does not mean I am giving up on Ubuntu, I am not ready to go back to Windows, but I have decided to give Kubuntu a try as well and see how I feel about KDE. No matter whom I end up with, KDE or Unity, I will still be using Ubuntu.

Wednesday, September 18, 2013

WebOS and Nokia - I wish

A mobile phone's hardware specifications are important but in today's world its the software (the Operating System) that dictates the user experience. Most high end phones today, from HTC, Motorolla, Samsung, Apple, Nokia and others, have almost the same hardware specs, with little or no differences. What distinguishes them from each other is the software on top of the hardware. And because of that Motorola, Samsung and HTC are no different for me. They try to give an illusion of uniqueness by making their own UI on top of Android but it does not effect most parts of my user experience.

Because of this, I have always been against Nokia making an Android handset. I have always thought that Nokia would be better off maintaining their unique identity. If they started making Android handsets they would be just another handset manufacturer in a long list of companies including Samsung, HTC, Motorolla, Huawei and many other Chinese and Korean and other handset manufacturers. But that would be a disgrace, I mean its Nokia which was once synonymous with mobile phone.

WebOS was the operating system on Palm Pre hand sets. I never got a chance to use WebOS but I have seen a lot of screen shots and read a lot of reviews when it came out and I was very excited about Palm Pre but unfortunately it never came to my country. The reviews for Palm Pre were good but what all the reviewers really liked and were talking about was its operating system i.e WebOS. So when HP bought Palm and later closed it altogether, I wished that Nokia would buy all the rights to WebOS and use it as the main operating system for their handsets. This way they would get a really great mobile operating system which would complement their existing handsets like Lumia nicely and could easily compete with the likes of Android and iOS.


I still wish Nokia would do this but I do not think this is going to happen now, with Nokia now being part of Microsoft and all, but the heart wants what the heart wants :)

Friday, August 30, 2013

Endianity conversion for a 24bit Integer

Recently while working on SSL protocol I came across 24-bit (3 byte) integers. I never thought any one would ever use a 24-bit integer. There are no default types or any type in stdint.h to create such a variable. So the best one could do is use 3 byte arrays and keep typecasting them to int - ignoring most significant byte on read and not writing the most significant byte on write.
The problem I faced was that I had to change the endianity of these 24-bit integers as the data is written to and read from network. I did not want to use a function call so I came up with following macros. They dont seem right to me i.e they are more weird looking and complicated than I wanted to so if someone has a simple solution, please share.

The following macro takes a pointer to 3 bytes containing 24 bit unsigned integer, converts the endianity of the integer value and returns it as int with most significant byte always 0
#define GET_NO_UINT24(src)  ((((*(uint32_t*)src)<<16)|((*(uint32_t*)src) & 0xFF00)|(((*(uint32_t*)src)>>16) & 0xFF)) & 0xFFFFFF)
The next macro takes 2 arguments. The first one is a pointer to 3 byte array for storing 24-bit integer and the second argument is the value to be stored.
#define PUT_NO_UINT24(dst,src) ((((unsigned char*)dst)[2]=(unsigned char)((src))), (((unsigned char*)dst)[1]=(unsigned char)((src)>>8)), (((unsigned char*)dst)[0]=(unsigned char)((src)>>16)))