growth hormone side effects
 
0

My picture from the future

Posted by sohrabkhan on Feb 21, 2010 in Uncategorized

This is how I see myself after a few decades (or maybe soon)

Me after a few decades or maybe soon

 
0

My first android app

Posted by sohrabkhan on Nov 18, 2009 in Uncategorized

Today I’ve completed developing my very own android app. It’s a converter for currencies, distances, weights, temperature; For currencies it retrieves the exchange rate from a web server at runtime and calculates the result.

Screenshots:

Currencies

Distances

Weights

Temperature

Click Here to Download (Android based Device)

Click Here for Details (Computer)

The currency converter converts between 145+ currencies and can retrieve rates for Gold, Silver, Palladium & Platinum.

I’ve named it Live Converter since it retrieves the currencies exchange rate at runtime.

My next project will be developing a racing game for the android platform.

 
5

Managing application configurations using the Java Properties Class

Posted by sohrabkhan on Mar 11, 2009 in Uncategorized

Using java.util.Properties class a developer can manage application configurations. The Properties class extends the java.util.HashTable class, which manages key/value pairs of both the Object class. The properties class maintain similar key/value pairs of Strings. The keys represent the ‘name of the property’ whereas the value represent the ‘value of the property’.

The Properties class provide methods for doing the following:

  • storing the properties list to an OutputStream (e.g. file) or an XML file.
  • retrieve the properties list from an InputStream (e.g. file) or an XML file.
  • retrieve a property value from the list if given a property name
  • print the list of all the properties to a PrintStream (e.g. Console)
  • return an enumeration of all the keys from the properties list.

The properties class can return a default value for a property if the requested property’s value cannot be found.

To initialize a properties class simply do the following:

Properties properties = new Properties();

To add key value pairs i.e. property name its value simply do the following:

properties.setProperty(“name”, “value”);

Default Properties:

To create default properties, simply instintiate a properties object as shown above.

Properties defaultProperties = new Properties();

Set its default values as shown above.

defaultProperties.setProperty(“file-name”,”properties.prop”);
defaultProperties.setProperty(“author”,”admin”);

Now these default properties can be supplied to another Properties object as defaults as follows:

Properties prop = new Properties(defaultProperties);

If you call the prop.getProperty(“file-name”) method on the prop the properties.prop will be returned, since the prop object does not have that in its values so it will check the default properties. If found it will return the default property otherwise a null will be returned.

Example 1:

The following is a very simple example of handling properties with defaults in java:

/**
* This class creates default properties & handles retrieving/updating properties
*/

public class PropertyManager {

private Properties properties;

public PropertyManager() {

properties = new Properties(getDefaultProperties());

}

public String getProperty(String name) {

return properties.getProperty(name);

}

public void setProperty(String name, String value) {

properties.setProperty(name, value);

}

private Properties getDefaultProperties() {

Properties defaultProperties = new Properties();
defaultProperties.setProperty(“file-name”, “properties.prop”);
defaultProperties.setProperty(“version”, “1.3.3″);
defaultProperties.setProperty(“author”, “admin”);
return defaultProperties;

}

}

/**
* This class uses the ProperyManager to retrieve / update its properties. If it requires a property it
* will supply the PropertyManager’s getProperty() method the property name. The PropertyManger
* will check its properties object; if it find one it will retrieve it, if not then it will check its default
* properties which will be returned otherwise a null will be returned.
*/

public class PropertiesUser {

private static PropertyManager propManĀ  = new PropertyManager();

public static void main(String[] args) {

propMan.setProperty(“version”, “2.1″); //put the version property and set its value as “2.1″
System.out.println(“File Name:” + propMan.getProperty(“file-name”)); //print the filename, default will be used
System.out.println(“Version:” + propMan.getProperty(“version”)); //print the version,
System.out.println(“Author:” + propMan.getProperty(“author”)); //print the author, default will be used.

}

}

The output for this program will be as follows:

—————————————————

File Name:properties.prop
Version:2.1
Author:admin

—————————————————

The PropertyUser class does not set the PropertyManager’s properties object with “file-name” property’s value so the default property value is returned. And set’s version” as “2.1″ so “2.1″ is returned.

Saving properties to a file:

Properties can be saved to a file by calling the Properties class store method. e.g.

PrintWriter writer = new PrintWriter(“prop.p”);
properties.store(writer,”Properties Example”);

Properties can be retrieved from a file by calling the Properties class load method e.g.

FileReader reader = new FileReader(“prop.p”);
properties.load(reader);

You can then call the get and set and use these properties in you program as shown in the program above.

 
0

Rayman Raving Rabbids

Posted by sohrabkhan on Mar 9, 2009 in Uncategorized

Very funny Rayman Raving Rabbids trailer Collection:

Bunnies Transformers

Bunnies can’t phone

Ninja Rabbid

Rabbid Thanksgiving

Rabbid 007

Rabbid Christmas

Rabbids Heroes Spoof:

Rabbids Invasion of Olympics

Bunnies can’t date

Rabbids invade White House

 
1

Concurrent Versions System

Posted by sohrabkhan on Mar 9, 2009 in Uncategorized

Concurrent Versions System aka CVS is an open source version control system. It basically keeps track of all changes in a set of files. It is a must have, if more than one developers work on an application.

The CVS consists of a Server and a client machine, although both can be on the same machine as well. This client server architecture is ideal for more than one developers working on a project. These machines can be either connected throught LAN or the internet.

Im writing this post to show a step by step guide into how CVS can be used by Java Developers using Netbeans IDE.

(the rest will be published soon)

 
6

Synchronize Contacts between iPhone, Windows Mobile, Symbian 60 phones & Google

Posted by sohrabkhan on Mar 6, 2009 in Uncategorized

iPhone : Windows Mobile : Symbian

iPhone : Windows Mobile : Symbian

I bought an iphone and wasn’t able to sync contacts from my previous Windows Mobile 6.1 phone. Usually I used to select all the contacts and then send them on the bluetooth. But iPhone won’t connect to other phones on the bluetooth. And that’s because Apple has imposed limitations on the bluetooth connectivity. That’s the main reason why I’m writing this post. A great solution to this problem is Google Mobile.

Google has created a solution for almost all the mobile devices to sync contacts. The following is a step by step guide to synchronizing contacts between different phones:

Copyright © 2013 Sohrab Khan. Sponsored by Web Directory, Business Directory, Link Directory. Powered by Wordpress Themes .