bespin

August 4, 2009

Screenshot

The open web is evolving in to the best platform for application development. Bespin is an initiative by mozilla labs to create a web based code editor which aims to increase developer productivity, enable compelling user experiences, and promote the use of open standards.

Mozilla labs has taken the pain to survey programmers spread across various development platforms who are developing for open web to come up with a proposed set of features.

Here is what bespin focuses on

Ease of Use — the editor experience should not be intimidating and should facilitate quickly getting straight into the code

Real-time Collaboration — sharing live coding sessions with colleagues should be easy and collaboratively coding with one or more partners should Just Work

Integrated Command-Line — tools like vi and Emacs have demonstrated the power of integrating command-lines into editors; Bespin hase done it, too

Extensible and Self-Hosted — the interface and capabilities of Bespin should is highly extensible and easily accessible to users through Ubiquity-like commands or via the plug-in API

Wicked Fast — the editor is just a toy unless it stays smooth and responsive editing files of very large sizes, bespin aims in being really fast.

Accessible from Anywhere — the code editor should work from anywhere, and from any device, using any modern standards-compliant browser

So if you are a developer, go on get involved!


how i blog – in cartoon.

August 4, 2009

phd012903s

phd013103s

This is the way i blog!


e71 ?

August 3, 2009

phd041906s

Yeah! Finally i dumped my rusty old n73 and got hold of the new e71.

Its really sleek, hold right in the palm, has a qwerty keypad which of course takes time to get used to and to explore the full functionality.

The cool part is, it runs a ARM 11 369 MHz processor with 110 MB internal storage and 128 MB RAM. Accessing the wi-fi and surfing feels not that cool but the mailbox runs in sync with my gmail inbox, so as a mail comes in the phone beeps! Tats pretty cool.

And since it runs a Symbian OS 9.2, Series 60 v3.1 UI, i could create programs in java on the go! Yay! The donuts always for me!!


googles tweet – solved the google way!

August 3, 2009

Google created an official google account on twitter and announced their arrival on to the micro blogging scene.

The 1st tweet was

I’m 01100110 01100101 01100101 01101100 01101001 01101110 01100111 00100000 01101100 01110101 01100011 01101011 01111001 00001010

This is nothing but a text coded in binary. Since each binary word is 8 characters long, it is most probably written in the extended 8-bit ASCII code. In fact, it can be read with a simple ASCII chart (link)

Most charts like the one above will only provide you with the decimal equivalent for each ascii value. So since out of laziness i decided to code a java program to convert binary into decimal so i can read googles tweet.

The conversion is quite simple. Each position is to be multiplied by increasing powers of two from the right and then these numbers are added together. eg: 1010 = 1 * 8 + 0 * 4 + 1 * 2 + 0 * 1 = 10.

Program :

static double toDecimal (String s)
 {
 int l = s.length();
 int ceq=0;
 double result = 0;
 int i=0,j=0;

 for (i = l-1; i >= 0; i--,j++)
 {
 if (s.charAt(i)=='0')
 { ceq=0; }
 if (s.charAt(i)=='1')
 { ceq=1; }
 result = result + (ceq * Math.pow(2,j));
 System.out.println("result "+result);    
 }

 return result;
 }

So after running the tweet i got

I’m feeling lucky\n

phd012606s


zip a word file ? think again.

August 3, 2009

I was helping out one of my friend to send a huge word file over the Internet. Like most of the people around, I took the word file and zipped it. Guess what, to my surprise, there wasn’t even a 10% reduction in the file size (usually it gets reduced by 40%).

This made me curious and i did a little search over the topic today. Its because Office 2007 files are pre-zipped, thats the reason why we get the extension .docx , .pptx etc.. You can even open them using Winzip by simply renaming their extensions to .zip. So why zip a file thats already zipped. Rar it!  🙂

Ref : http://office.microsoft.com/en-us/help/HA100069351033.aspx


Method Overloading

July 30, 2009

To be a good programmer, understanding of Object oriented programming concepts is by far the most important thing. The one problem with freshmen programmers is that they are only being able to write classes, doing encapsulation and inheritance when asked about OOPs. It is not what you should call good OOP. So as an awareness and a guide this article talks about Method Overloading one of the OOP concept.

Method overloading is a feature found in various programming languages such as Ada, C#, C++, D and Java that allows the creation of several methods with the same name which differ from each other in terms of the type of the input and the type of the output of the function.

This article is Java specific and method overloading is one of the ways that Java implements polymorphism.

Method overloading is one of Java’s most exciting and useful features. When an overloaded method is invoked, Java uses the type and/or number of arguments as its guide to determine which version of the overloaded method to actually call. Thus, overloaded methods must differ in the type and/or number of their parameters. While overloaded methods may have different return types, the return type alone is insufficient to distinguish two versions of a method. When Java encounters a call to an overloaded method, it simply executes the version of the method whose parameters match the arguments used in the call.

// Demonstrate method overloading.
class OverloadExample {
void test() {
System.out.println("No parameters");
}
// Overload test for one integer parameter.
void test(int a) {
System.out.println("a: " + a);
}
// overload test for a double parameter
double test(double a) {
System.out.println("double a: " + a);
return a*a;
}
}

class Overload {
public static void main(String args[]) {
OverloadExample ex = new OverloadExample();
double fop;
// call all versions of test()
ex.test();
ex.test(50);
fop = ex.test(777.7);
System.out.println("a * a = " + fop);
}

Output :

No parameters
a: 50
double a: 777.7
a * a = 604817.29

When an overloaded method is called, the compiler looks for a match between the arguments used to call the method and the method’s parameters. This may not be right all the time. Take the below shown code for instance.

class OverloadExample {
// Overload test for one integer parameter.
void test(int a, int b) {
System.out.println("a: " + a +" b: " + b );
}
// overload test for a double parameter
void test(double a) {
System.out.println("(double) a: " + a);
}
}

class Overload {
public static void main(String args[]) {
OverloadExample ex = new OverloadExample();
double fop;
// call all versions of test()
ex.test (50, 60);
ex.test(50);
ex.test(777.7);
}
}

Which gives the output

a: 50 b: 60
(double) a: 50.0
(double) a: 777.7

This happens because, Java can automatically convert an integer into a double and thus results in the call test(double) for an integer value. Of course, if test(int) had been defined, it would have been called instead. Java will employ its automatic type conversions only if no exact match is found.


The Hungarian Notation.

July 30, 2009

In search of efficient programming tips, I happened to stumble upon a naming convention called The Hungarian Notation. It was Microsoft’s Chief Architect Dr. Charles Simonyi’s creation.

Was quite excited to find a convention that fulfills the Mnemonic as well as the Suggestive value of naming. But got disappointed on further reading about it. Even though it was the most used convention during the early days in Microsoft, (when the development environment was C/C++), as they released the .Net framework, it was specifically stated in the Developer’s Guide[1] that Hungarian notation shall not be used for naming. So it looks like its of less or null usage.

Even though its not used these days, a self derived methodology based on this notation shall be adapted in our programming style.

Read more about the notation in Visual Studio 6.0 Technical Articles – Hungarian Notation

References – .[1] NET Framework Developer’s Guide General Naming Conventions