Galaxy Ace – Gingerbread update
Posted: September 1, 2011 Filed under: Android 38 Comments »Great news for Galaxy Ace users in India. The official Gingerbread update became available yesterday (31st August 2011) through Samsung Kies.

What is Gingerbread
Android is an operating system and Gingerbread is the latest version of it, for mobile phones. The Gingerbread series is 2.3.x with the latest being 2.3.4.

How do I update
You would have to update your firmware through Samsung Kies. Its a software that you can download from here: www.samsungapps.com/about/onPc.as. (After downloading, you might have to update the sotware itself, as the link might not provide the latest version directly.) No linux version of the software exists. So you might have to login into Windows.
Once you have an updated Kies, you should be able to see something like this.

Connect your device now. Wait for Kies to detect your phone. Kies should automatically say that you have new firmware updates to be installed on your phone. Follow the instructions and you’d have Gingerbread installed on your phone.
Restart your phone to ensure that all updates have been installed.
What’s new in Galaxy Ace Gingerbread
You’d be able to see a few changes in looks in your phone now. Before looking at them, go to Settings->About Phone and check the Android version. You should be able to see 2.3.4 and Build Number showing GINGERBREAD.DDKQ5.

What’s New
The immediate observation after upgrading is the change to the system notification bar. Icons are much more compact and they look a bit more sleeker.

You can also see that the GPS and Sound icons have changed. Earlier silent mode was highlighted. Now its the opposite. If you disable silent mode on your phone, the icon is highlighted. You can also view whether vibration is enabled or not.
When you are typing text, you can see that the circular hold icon is replaced by a rectangular one.

Other noticeable features are:
- Most importantly, Indic languages are now supported.
- The phone appear to be a bit faster
- Increased battery life
- Improved copy-paste functionality upon select-all
- A new system app called Downloads available now
- The line traced while typing text using swype also appears more transparent now
- WiFi bug seems to have been fixed
- No noticeable bugs yet
Do let me know if you are encountering any problems or have found other new features too.
Setting up Kate snippets
Posted: June 13, 2011 Filed under: editor, kate, Linux 2 Comments »Kate is one of the best editors around and I have always felt most comfortable with it. It is very intuitive and at the same pleasing to the eye. Most of the gnome population haven’t heard of it and I feel it trumps gedit any day. (http://kate-editor.org/about-kate/)
Recently, I discovered that that there is not much online material available for snippets in Kate and after a little bit poking around, I finally got what I wanted. I felt that putting up a blog post would be a good idea too.
Setting up Kate snippets:
1. Open Kate. Go to Settings Menu. Click Configure Kate.
2. Go to the Plugins tab. Enable Kate Snippets. You will notice that Kate Snippets tab appears automatically in the left pane.
3. Click the Kate Snippets tab on the left pane. You will observe a few sample snippets and also the option to add a New Snippet File. Click it.
4. As an example, I will be creating a snippet to help me with coding in C++ on SPOJ. So, I’ll give the snippet a name “C++ for SPOJ” and LGPL v2+ License. Of course, my name is Anirudh and I’ll give the same for Authors.
You will see a screen like this.
5. We wouldn’t inadvertently want our snippet to be applied for other type of files. So change the File type from * to C++. Click the button at the bottom-left to create a New Snippet. Set the Match/Name value in the right pane to spoj.
Insert the following in the Snippet Content:
#include <iostream>
using namespace std;
int main() {
${cursor}
return 0;
}
The ${cursor} informs Kate where your cursor should be, after inserting your snippet. You should end up with something like this.
6.Save the snippet, enable the snippet and go back to Kate. Save the file with .cpp extension. Now type spoj in your editor and press Ctrl+Space.. You will see a little drop down box showing suggestions. Just press Enter.

Voila! Your snippet works perfectly!

Understanding WordPress for Android – Part 3
Posted: June 10, 2011 Filed under: Android, GSoC, wordpress 1 Comment »I managed to squeeze in time for another blog post about the app. So here it is.
As I mentioned in my previous blogpost (http://anirudhspider.wordpress.com/2011/06/08/understanding-wordpress-for-android-part-2/), I will be explaining the code for the app’s splash screen here.
What is a Splash screen?
Quoting Wikipedia, “A splash screen is an image that appears while a game or program is loading. It may also be used to describe an introduction page on a website.” (http://en.wikipedia.org/wiki/Splash_screen)
The existing app has a really cool splash screen which I do not wish to lay my hands upon and spoil.
splashScreen.java
Let’s start with splashScreen.java. If you have downloaded the source code, you’ll find it in your src/org/wordpress/android/folder, or under src->org.wordpress.android in your Eclipse Package Explorer (left pane, by default). If you haven’t downloaded the source code, you can view it here: http://android.trac.wordpress.org/browser/trunk/src/org/wordpress/android/splashScreen.java
I have also posted it below for your convenience.
package org.wordpress.android;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;
import android.widget.TextView;
public class splashScreen extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
getWindow().setFormat(PixelFormat.RGBA_8888);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
setContentView(R.layout.splashscreen);
//Display the current version number
PackageManager pm = getPackageManager();
try {
PackageInfo pi = pm.getPackageInfo("org.wordpress.android", 0);
TextView versionNumber = (TextView) findViewById(R.id.versionNumber);
versionNumber.setText("Version " + pi.versionName);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
new Handler().postDelayed(new Runnable(){
public void run() {
/* Create an Intent that will start the Main WordPress Activity. */
Intent mainIntent = new Intent(splashScreen.this,wpAndroid.class);
splashScreen.this.startActivity(mainIntent);
splashScreen.this.finish();
}
}, 2900); //2900 for release
}
}
Note that the line numbers refer to the above source code.
Lines 3-12: They are the necessary import statements. In case you miss any import statements and Eclipse shows an error, press Ctrl+Shift+O (in Linux and Windows). Eclipse will automatically find and add the necessary import statements.
Line 14: public class splashScreen extends Activity {
This is where the code actually starts. splashScreen being an Activity obviously extends the Activity class. (In case you do not know what an Activity is, an Activity is what the user is actually able to view. For more details: http://developer.android.com/reference/android/app/Activity.html )
Lines 17-19:
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
The onCreate function is an integral part of the Activity life cycle and as the name implies, it is called once the Activity is created. We are overriding the onCreate method. Whenever the onCreate method is overridden, we must call super.onCreate() to save the state of the previous activity. ‘icicle’ is the name of the Bundle objects that are passed to the onCreate method. This is the default name provided in the earlier versions of the SDK. The new SDK defaults the name to ‘savedInstanceState’.
Lines 20&21:
getWindow().setFormat(PixelFormat.RGBA_8888);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
Line 20 sets the format. Can you see that the background gradient is uniform and non-patchy? It is because of the FLAG_DITHER flag.
Line 23: setContentView(R.layout.splashscreen);
Sets the xml layout provided in splashscreen.xml. Lets have a quick look at it.
splashscreen.xml
If you have downloaded: found at res/layout/splashscreen.xml
If you haven’t: http://android.trac.wordpress.org/browser/trunk/res/layout/splashscreen.xml
Code:
<LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center|center" android:background="@drawable/home_gradient" android:orientation="vertical"> <ImageView android:layout_marginTop="-60dip" android:paddingLeft="20dip" android:paddingRight="20dip" android:scaleType="centerInside" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/wordpress_logo" android:src="@drawable/wordpress_home"></ImageView> <TextView android:text="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dip" android:typeface="serif" android:shadowDx="0" android:shadowDy="2" android:shadowRadius="1" android:shadowColor="#FFFFFF" android:textColor="#444444" android:textSize="20dip" android:id="@+id/versionNumber" android:gravity="bottom"> </TextView> </LinearLayout>
As you can see, it contains a vertical LinearLayout with 2 elements: an ImageView and a TextView. The ImageView renders the logo while the TextView provides the version number of the app.
Back to splashscreen.java
Lines 25-34:
//Display the current version number
PackageManager pm = getPackageManager();
try {
PackageInfo pi = pm.getPackageInfo("org.wordpress.android", 0);
TextView versionNumber = (TextView) findViewById(R.id.versionNumber);
versionNumber.setText("Version " + pi.versionName);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Obtain the version number from the package (from the manifest xml?) and sets it to the TextView.
Lines 36-42:
new Handler().postDelayed(new Runnable(){
public void run() {
/* Create an Intent that will start the Main WordPress Activity. */
Intent mainIntent = new Intent(splashScreen.this,wpAndroid.class);
splashScreen.this.startActivity(mainIntent);
splashScreen.this.finish();
}
An Intent is an abstract description used to jump from one Activity to another. The Intent mainIntent is used to transfer control from the current splashScreen.java file to wpAndroid.java. (The number 2900 in Line 43 is the number of milliseconds for which the splash screen is to be displayed.)
What does that mean? Yeah, you got that right. Coming up next, wpAndroid.java!
Understanding WordPress for Android – Part 2
Posted: June 8, 2011 Filed under: Android, GSoC, wordpress 2 Comments »You have set up the development environment, downloaded the source code and created a new project. Now, we can start going through the source code. I hope you are familiar with developing Android Apps. If not, it is ok. You can refer to http://developer.android.com/ in case you are not able to understand something that has been explained here. I will also be providing links to the official documentation wherever necessary.
AndroidManifest.xml
As with every application, the WordPress app has an AndroidManifest.xml file. It is the first piece of information that describes the different activities, services, broadcast receivers, content providers, user permissions and all other important details. (To know more, have a look at http://developer.android.com/guide/topics/manifest/manifest-intro.html )
To view the manifest file, open it in Eclipse. If you don’t want to develop but just want to view it, you can view it here: http://android.trac.wordpress.org/browser/trunk/AndroidManifest.xml
Line 2. The attributes of the <manifest> tag specify the version name, package details, etc.
Line 3. As you can see in the <uses-sdk> tag, you can develop this app for devices that run on Android, right from Cupcake (android:minSdkVersion="3") and is also best viewed in a device running Froyo (android:targetSdkVersion="8").
Line 4 and 5: They describe the details of how the app looks before it is launched, in your android device. It specifies the logo image, label and the style. You can find the logo in your project at res/drawable/app_icon.png and the theme it uses from Line 61 of res/values/styles.xml (http://android.trac.wordpress.org/browser/trunk/res/values/styles.xml)
I will be discussing each Activity and its corresponding xml later. (Same with the service and receiver tags)
It is obvious what the remaining xml code describes. Understanding what the <supports-screens>,<uses-permission> and <uses-feature> tags describe, shouldn’t be a problem.
Before moving on, we need to find out which activity is called first. If you have a quick look at http://developer.android.com/guide/topics/intents/intents-filters.html#ccases, the activity with the android.intent.action.MAIN action and the android.intent.category.LAUNCHER is started at first. A quick scan through the AndroidManifest.xml file reveals that the activity with the android:name="splashScreen" is the one that is launched, when the application starts.
So, next stop: splashScreen.java !!
Still don’t believe me?
Posted: June 7, 2011 Filed under: Android, GSoC, wordpress Leave a comment »
If blogging from inside the app like how I am doing right now, doesn’t make you believe how great this is, then u must try writing one on your own.
Although this is an open source project run by the community, I believe that most of the work so far, has been done by Dan Roundhill, who is the mentor for my GSoC project as well. http://danroundhill.com
I can also add media from inside the app, like this photo of my laptop.
This took me about 5 minutes to blog about. Its that easy!
Understanding WordPress for Android – Part 1
Posted: June 7, 2011 Filed under: Android, GSoC, wordpress Leave a comment »The app itself
The latest release is version 1.4.1 and it was released on April 18 2011. It is available for free in the market. I own a Samsung Galaxy Ace running Froyo and it works flawlessly on my mobile. You can use the app to maintain multiple blogs including both, self-hosted blogs and those hosted at WordPress.com.
The Description of the app in the marketplace reads thus:
“Write new posts, edit content, and manage comments on your WordPress blog.
WordPress for Android is an Open Source app that empowers you to write new posts, edit content, view stats, and manage comments with built-in notifications.
WordPress for Android supports both WordPress.com and self-hosted WordPress (2.9.2 or higher) blogs.”
Get the app from the market
There is nothing more important than having a first-hand experience of any product that you are working on. So, download the app directly through your mobile’s Android market or from https://market.android.com/details?id=org.wordpress.android and install it in your Android mobile.
Run it and check whether it works fine in your mobile. Browse through the app. It shouldn’t take you more than half an hour to figure out all features in that app.
Get the source code from the dev site
If you want to start developing, get your Eclipse IDE set up for Android app development. If it is your first time, refer to http://developer.android.com/sdk/index.html to setup your development environment. Hope you have installed subversion and know how to use it too. If you don’t, you can read up on this: http://svnbook.red-bean.com/
Head towards http://android.trac.wordpress.org/. You will find that their source is located at http://android.svn.wordpress.org/. <strong>Note.</strong>Do not use the svn site for browsing the source code. It is not created with that purpose in mind. If you want to browse the source code, you can do so at http://android.trac.wordpress.org/browser.
The trunk folder provides the latest build and you can work on it. To get the code into your system, do this from your terminal:
svn checkout http://android.svn.wordpress.org/trunk/
Rename the folder to the project name of your choice. Now open Eclipse. Press Ctrl+N and create a New Android Project. In the next step, select the option “Create project from existing source:” and point it to the location where you have checked out your wordpress android app code. Provide necessary details such as Project name, Build Target, Application name, Package Name and other details. You are ready to develop on the Android app of WordPress now.
Understanding WordPress for Android – Part 0
Posted: June 7, 2011 Filed under: Android, GSoC, wordpress Leave a comment »One of the apps which I never expected to see in the Android marketplace was the WordPress app.
https://market.android.com/details?id=org.wordpress.android
Seriously, was it possible to bring in the power of blogging into one’s Android mobile? Microblogging was easy. There are thousands of Twitter apps for Android to do that. But how could a mobile be sufficient to blog on WordPress??
Trust me, it is really an awesome app!
It was the time when organizations where applying for Google Summer of Code. Within a few weeks, I got to know that the Android app had been selected as a project as well! I was so eager to work on it to realize it’s full potential myself. I also wanted to work on a GSoC project. I applied and worked hard to get it, and finally I did.
You can find more details about the app here: http://android.wordpress.org/
If you also wanna be a developer, this is the place to be: irc://freenode/wordpress-mobile
I have been working on changing the UI of the app for a few weeks now. I just realized that the best way to progress quickly would be to be blog about this blogging app. So here I am.
I will be initially giving a brief introduction to the app and then moving on to the explain the code later.
Macbuntu in Ubuntu 11.04
Posted: June 7, 2011 Filed under: Linux, Ubuntu 9 Comments »Those of you who used Macbuntu earlier on your Ubuntu 10.10 and have shifted to Ubuntu 11.04 would have noticed that the Macbuntu theme isn’t available. It seems that the project has been stalled and they don’t seem to have a version for 11.04 yet. Searching for it on Google takes you to a site where you are asked to download a remastered Ubuntu distro of size >700 Mb! If you have already downloaded Ubuntu 11.04, you wouldn’t feel like downloading another complete distro just for the sake of the Macbuntu theme.
So, what is the solution? Use the code for 10.10!! With a few minor changes, you can use the Macbuntu theme for your 11.04 Ubuntu Classic desktop as well. I do not know how it integrates with Unity yet, as I don’t use Unity. (I have also heard that it doesn’t integrate very well with Unity.)
So, what are the changes to be made?
First download the source code for the Macbuntu theme from the SourceForge project site, if you already haven’t. http://sourceforge.net/projects/macbuntu/
After downloading, extract the file to some location that you can remember. Rename the folder from Macbuntu-10.10 to Macbuntu-11.04 to avoid confusion later.
Now open the file install.sh in the text editor of your choice. I use vim, so the code is as follows.
vim install.sh
After opening the file, you would see the following code in lines 19 and 20:
UBUVER="10.10"
UBUNTU="Ubuntu $UBUVER"
Change it to read
UBUVER="11.04"
UBUNTU="Ubuntu $UBUVER"
Do the same to your uninstall.sh file.
Now run the install.sh file.
./install.sh
Now follow the installation instructions and reboot your system.
After rebooting, you might want to adjust your Indicator Applet icons, make sure Docky is installed and adjust your Compiz settings too.
If you want to uninstall, you can always run
./uninstall.sh
to remove Macbuntu from your system.
Note.If you have any clarifications or if something just doesn’t work, you can always post them in the Comments section below.
UI mock-up for a Non Dashboard page
Posted: April 8, 2011 Filed under: Uncategorized 1 Comment »This is my UI mock-up for a Non Dashboard page. Quick Access dashboard will ensure that users can access other stuff really quickly now.
Not that I have replaced the button for Dashboard with a large button to return to the previous page. Please note that I might come up with something more useful later, in this space.
This is my mock-up with my Quick Access Dashboard pulled up. It displays the dashboard.
Facts about WordPress – My first plugin
Posted: April 2, 2011 Filed under: Uncategorized 1 Comment »<?php
/**
* @package WordPress_Facts
* @version 1.0
*/
/*
Plugin Name: Facts about WordPress
Plugin URI: http://anirudhspider.wordpress.com/wordpressfacts
Description: This is a plugin which you can use to display random wordpress facts in your admin panel.
Version: 1.0
Author: Anirudh S
Author URI: http://anirudh24seven.wordpress.com
License: GPL2
*/
/* Copyright 2011 Anirudh S (email : anirudh24seven@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
function random_fact_line() {
/** These are the random facts */
$line = “WordPress is an open source Content Management System.
Wordpress is powered by PHP and MySQL.
Wordpress was first released on May 27, 2003, by Matt Mullenweg.
Native WordPress applications exist for Android, iPhone/iPod Touch, iPad, Windows Phone 7 and BlackBerry.
In 2009 WordPress won the best Open Source CMS Award.
Wordpress version 1.2 was codenamed Mingus and was released on 22 May 2004.
Wordpress version 1.5 was codenamed Strayhorn and was released on 17 February 2005.
Wordpress version 2.0 was codenamed Duke and was released on 31 December 2005.
Wordpress version 2.1 was codenamed Ella and was released on 22 January 2007.
Wordpress version 2.2 was codenamed Getz and was released on 16 May 2007.
Wordpress version 2.3 was codenamed Dexter and was released on 24 September 2007.
Wordpress version 2.5 was codenamed Brecker and was released on 29 March 2008.
Wordpress version 2.6 was codenamed Tyner and was released on 15 July 2008.
Wordpress version 2.7 was codenamed Coltrane and was released on 11 December 2008.
Wordpress version 2.8 was codenamed Baker and was released on 10 June 2009.
Wordpress version 2.9 was codenamed Carmen and was released on 19 December 2009.
Wordpress version 3.0 was codenamed Thelonius and was released on 17 June 2010.
Wordpress version 3.1 was codenamed Reinhardt and was released on 23 February 2011.”;
// Here I split the $line query into separate lines based on the newline character (\n)
$line = explode( “\n”, $line );
// From the lines that have been generated, I generate a random line out of them for Random Facts
return wptexturize( $line[ mt_rand( 0, count( $line ) - 1 ) ] );
}
// This just echoes the chosen line, we’ll position it later
function random_fact() {
$chosen = random_fact_line();
echo “<p id=’fact’><b>Random Fact:</b> $chosen</p>”;
}
// Now we set that function up to execute when the admin_notices action is called
add_action( ‘admin_notices’, ‘random_fact’ );
// We need some CSS to position the paragraph
function fact_css() {
// If this is not present, the fact would not be at the top right, but at the top left. From Hello Dolly plugin documentation- “This makes sure that the positioning is also good for right-to-left languages”
$x = is_rtl() ? ‘left’ : ‘right’;
echo “
<style type=’text/css’>
#fact {
float: $x;
padding-$x: 15px;
padding-top: 5px;
margin: 0;
font-size: 11px;
}
</style>
“;
}
add_action( ‘admin_head’, ‘fact_css’ );
?>













