Thursday, February 21, 2013
Introducing Google Official Blog Reader
Try it here. http://www.hashfold.com/news/
Note: It uses user's internet to pull the news updates.
send me your feedback and ideas to improve the performance and look n feel of the page.
Tuesday, December 4, 2012
Automatically take screenshots every few seconds from a video
The MPlayer tool could be used to do it on a command line.
download mplayer from http://www.mplayerhq.hu/design7/dload.html
The below command will capture the frame at 10 seconds interval till the end of the video (video length - 1 second):
mplayer -vo jpeg -sstep 10 -endpos 499 myvideo.avi --- suppose video is 500 seconds long
People could use this tool to generate pictures out of video and upload to get feedback from their friends/users.
Friday, January 20, 2012
Publishing Android applications - Part 4
Here is the detailed documentation on how to publish already developed application:
http://developer.android.com/guide/publishing/publishing.html
Before we move on for publishing the application, there are few things we need to do:
testing. testing:
Make sure you test your application on emulator thoroughly and then on the real device.
this article lists out some keyboard shortcuts to change the orientation of the device. This will help
test your application in different orientation. Creating virtual devices of different sizes and testing the application
on them will help find any presentation issues with your application.
Performance and SDK compatibility: make sure your application performs as expected and
there are no bottleneck in the speed. Apart from this, try to develop the application for older SDK versions
so that it can run on most of the Android devices. e.g. SDK 2.1 is currently installed on almost 50% of Android devices.
If you develop on later versions then your application will not be compatible and hence will not be installed on these many devices.
Getting ready for the publishing...
1. give required permissions to your application
<uses-permission android:name="android.permission.INTERNET"/>
2. choose right icon and name of the application
<application android:label="@string/my_app_name" android:icon="@drawable/my_icon">
3. increment version number in manifest file
...package="com.example" android:versionCode="1"
android:versionName="1.0"...
note that on every update, you need to increment the value of versionCode where as
versionName is your choosen name of the version.
4. SDK compatibility
make sure you set right values for android:minSdkVersion, android:targetSdkVersion and android:maxSdkVersion attributes.
5. export and sign your application and generate .apk file
go to File > Export
click on "Export Android Application"
now fill in all the options and generate the .apk file. make sure you store the .key file for later application update.
now navigate to http://market.android.com/publish and upload the application.
Monday, January 16, 2012
Login to your Google Account on Without Typing Anything
Logging in to your accounts using public computers may be at risk due to virus, key loggers or any other programs which may collect your account credentials and later compromise your account.
Today Google came up with the novel idea “allowing users to login using their trusted phones”.
Here is the solution:
Step 1: open https://accounts.google.com/sesame on the computer which you feel might be at risk.
opening the above link will show a QR code.

Step 2: make sure you have smart phone with QR code reader application (e.g. Google Goggle, Bakodo, Red Laser etc). Scan the bar code shown on your computer screen (from Step 1).
Step 3: you will be shown a URL to open and sign in with your google account (Gmail or iGoogle).
Step 4: within a few moments, Google will sign-in the page and your page on screen will redirected to either Gmail or iGoogle as per your selection in Step 3.
Step 5: now continue using your google account on the computer.
Step 6: After you are done your work on the computer, don’t forget to sign off manually.
All is fine so far and loved the creative way to reduce the risk of account take over. This is fantastic and a great way to avoid risk.
However I did not like “Step 6”, why? its because sign-up and sign-in are done differently and from different devices. Since Google has knowledge about both of these devices, so why can’t allow sign off using my device? what if I forgot to sign-off from computer, any way to do the same from my phone device which was used to sign-in? how about when user marks in his device for sign-off and the next action on google account (related to the session with the same QR code) on the computer logs off automatically?
This may be another checkpoint where there needs some improvements.
Google has solved its problem here however the same problem exists for other websites and for whole internet space. The internet needs it badly, to make surfing a better experience.
Hope Google still working on this to make it a general solution which whole industry could benefit.
Well done and Good Luck Google!!!
-a programmer’s opinion.
Sunday, January 1, 2012
Wordpress: how to generate DocBook style posts
The site uses "DocBook XSL Stylesheets" tool to generate the contents and manage the revisions. As we all know that most of the blogging sites are based on WordPress. I have done my homework on how easy it is to convert the wordpress posts into revision based article.
sample screenshot:

Here is the code base which you can try out.
Note that all these code changes have to happen in your theme code.
1. functions.php
add below function to functions.php file.
[php]
<?php
function get_post_revision_info($postId) {
global $wpdb;
$sql = "("
. " SELECT ID, post_author, post_name, post_modified, post_parent, post_type"
. " FROM wp_posts"
. " WHERE post_parent =".$postId.""
. " AND post_type = \"revision\""
. " )"
. " UNION"
. " ("
. " SELECT ID, post_author, post_name, post_modified, post_parent, post_type"
. " FROM wp_posts"
. " WHERE id =".$postId.""
. " AND post_type = \"post\""
. " ) ORDER BY `ID` ASC";
$posts=$wpdb->get_results($sql);
$header="";
$lastrevision = "1";
$output="";
$postYear = date('Y'); ;
if ($posts)
{
$cnt = 1;
$output .= "<h3>Revision History</h3>";
$output .="<table>";
foreach ($posts as $post)
{
$lastrevision = $cnt;
$author = get_the_author_meta( 'display_name', $post->post_author);
$datetime = strtotime($post->post_modified);
$modified = date( 'm.d.Y', $datetime);
$rev = "Revision ".$cnt.".0";
$updated = "updated";
if($post->post_type == "post")
{
$updated = "created";
$postYear = date( 'Y', $post->post_modified ); //post created date
}
$output .="<tr>";
$output .="<td>".$rev."<td>"."<td> </td>";
$output .="<td>".$updated."<td>"."<td> </td>";
$output .="<td>".$modified."<td>"."<td> </td>";
$output .="<td>".$author."<td>"."<td> </td>";
$output .="</tr>";
$cnt++;
}
$output .="</table>";
}
else
{
$output .= "no revision history found.<br />";
$output = $sql;
}
$curYear = date('Y'); ;
$copyright = "Copyright © ".$postYear . (($postYear != $curYear) ? '-' . $curYear : ''). " ".get_the_author();
$header .= "Author ".get_the_author()."<br>";
$header .= "Current Version ".$lastrevision.".0"."<br>"; //1.0, 2.0...
$header .= $copyright."<br>";
$header .= date("m.d.Y")."<br>";
$footer = "<h3>Excerpts:</h3>";
$footer .= "<i>".get_the_excerpt()."</i><br/><br/>";
$footer .= "<h2>Article Details</h2>";
return "<h2>".$header."</h2><br/>".$output."<br/><br/>".$footer."<br/>";
}
[/php]
2. single.php
add below code (a call to post_revision_info) in single.php
[php]
<div class="entry-content">
<?php print get_post_revision_info(get_the_ID()); ?>
[/php]
This is my first version of the code. it may not generate the well-formed HTML code or may not suit to your theme.
so please change the code according to your need.
your comments will encourage me to come up with more articles on the related topic.
Monday, December 12, 2011
How To: Building Android Application with easy steps–Part 1
What is Android?
Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
Below are the steps to prepare the Android environment before really getting into the development:
Step 1. Download Eclipse
1.1 click Eclipse Classic
1.2 save the .zip file and extract it to your preferred location
Step 2. Installing Android SDK
2.1 start eclipse by clicking on the eclipse application extracted as shown in the above image.
2.2 now click on Help->Install New Software… option which will launch the below window:
2.3 now put https://dl-ssl.google.com/android/eclipse/ under “Work with” option and click on Add button.
2.4 type name ‘android’ in the new popup window and click OK
2.5 select All components and click Next
2.6 Click next in the next screen and then select “I Accept the terms…” and click Finish
the new window will popup to start downloading of the SDK ad shown below:
2.7 click OK on any warning message window
2.8 restart the eclipse
2.9. eclipse restart done and a new window shown to select where to install the SDK
select the location and click Finish
2.10 have patience, the installation step will take a while to download Android SDK as well as Google APIs.
Eclipse will now look like this…
2.11 make sure things are installed correctly.
click on Window->Preferences->Android
the details should show what you have just downloaded
Step 3. creating Android device
Android emulator runs on a specific device type. There are lots of android devices available on market.
The AVD Manager (AVD – android virtual device) have almost all of them configured. What you need to do is to create one of them in AVD Manager for your testing purposes. You can always create different device types and test the application before publishing to the android market.
Click on Windows->AVD Manager
Now click on New and fill the device information and click Create Device
At this moment, the eclipse is setup with the Android SDK and it is ready to be used.
Add-On: how to download and install
different version of the Android SDK?
So far we know that SDK version is used in creating the virtual device (using AVD Manager mentioned in Step 3 above). If there is a requirement to test the application on different device, then you need to make sure you have that version of the SDK available in your system. In order to download the new version, do below:
1. click Windows->Android SDK Manager
2. select required packages and then click “Install *** packages…”
3. in the next window, click on “Accept all” and click Install button
it will take a while to download and setup new SDK
In our next tutorial, we will go through the steps and create a sample application from scratch.
put your comments in case you have any questions for me to answer about these steps.
reference: http://developer.android.com/index.html
Android website have steps to follow in order to setup the SDK and start using it in eclipse or out of eclipse.
1. Preparing Your Development Computer
2. Downloading the SDK Starter Package
3. Installing the ADT Plugin for Eclipse
4. Adding Platforms and Other Components
1. Available Components
2. Recommended Components
5. Exploring the SDK (Optional)
Next Steps
Troubleshooting