code

Programming Style!

I was learning Ruby and I stumbled upon this short note on the programming style. I loved it. The author Huw in “The Book of Ruby” says that “A good programming style has nothing to do with the naming conventions and everything to do with good code structure and clarity.” He also says with his experience that the most important characteristics of well-written code are clarity and lack of ambiguity. Code that is easy to understand and easy to debug is also likely to be easier to maintain.

It makes perfect sense and I loved it, hence I posted it. I am thinking to do this more often as I strongly believe if I write about something I learn, it would retain in my mind for a longer time.

Advertisements

Program to know the version of java and the OS used.

Code:

public class FindVersion

{
public static void main(String[] args)
{
java.util.Properties props = System.getProperties();
System.out.println(“OS: ” + props.get(“os.name”)
+ ” ” + props.get(“os.version”));
System.out.println(“Java: ” + props.get(“java.vendor”)
+ ” ” + props.get(“java.version”));
String classpath = “” + props.get(“java.class.path”);
String ide;
if (classpath.contains(“bluej”))
ide = “BlueJ”;
else
ide = “Unknown”;
System.out.println(“IDE: ” + ide);
}

Output:

OS: Mac OS X 10.9.2
Java: Oracle Corporation 1.7.0_45
IDE: BlueJ

 

Nuts and Bolts of R Language!

Bonjour,

  • Basic arithmetic is the same. 1+1 = 2 | 5*6 = 30  and so on
  • Printing a string is just typing in  “Hello, World!”.
  • T and F are short hand for True and False simultaneously. i.e., T == True and F == False
  • To store a value in a variable. You do this : x <- 35
  • You can reassign any value to a variable any time. You can assign a string like this: x <- “Hello DataScience! R lang is awesome”
  • printing the value of x is simple.. Just type x and hit return! That will do the magic.It should print 35 as we assigned it earlier
  • you can assign logical values to the variables too.. Do this: x <- T or x <- True
  • You have a sweet function called sum to add up numbers.. like this sum(2,3,4) gives you 9 as output
  • To repeat a string or a number you can use “rep” function like this rep(“Bonjour”, times = 3)
  • Like everywhere.. there is a function called sqrt to find the square root. sqrt(16) gives 4
  • help(functionname) gives you the function’s documentation and syntax. For ex: help(sum) gives all the details of the function
  • example(functionname) gives you the usage of the function and what arguments are valid for the function
  • One can write the script in a file and can save it with .R extension for later usage and execution
  • list.files() gives you the list of files in the current directory
  • To run a script. We need to use source function and the argument is the file name. like: source(hello.R)

Hmm. That ends the basics of R Language. You’ve learned how to create and access variables, and how to call functions. You’ve learned how to run pre-made scripts. And you’ve learned how to access R’s help functionality when you need it.

Cheers,

SZ

Google Summer of Code Tenth Instance Celebrations India 2014

Its been ten years since the inception of Google Summer of Code. Students through out the world have participated in this program and have achieved fame and glory. After spending a couple of years by contributing to a few open source projects, I got an amazing chance to participate in this prestigious program. I participated in Google Summer of Code for two consecutive years in 2012 and 2013. It was one hell of a ride. I consider this as the greatest achievement of my life. It really changed everything in my life. It got me great connections, fame in the community, recommendations, jobs, scholarships and invitations to speak at conferences.

Google Summer of Code (GSoC) is quite an amazing program — it provides an opportunity for students to learn and contribute to free and open source software by working on real projects (and get paid for it!). To put it simply, GSoC is a ticket to the exciting journey of the Open Source world. The Google Summer of Code program was announced very early, immediately after the GSoC 2013 program. Though I am not eligible to participate as a student for this year’s program, I am very excited to participate as a mentor for the National Resource for Network Biology(NRNB). When the Open Source Programs team at Google announced the stunning “10 things” initiative, I was thrilled to not only see India on the list of countries the team was visiting, but also honored to participate in the event. I was especially proud to learn that India stands second in the world in GSoC participation with 1042 students and 368 mentors since the program’s inception.

The event was held at the local Google office inHyderabad on February 21. The room was filled with students and mentors from previous years of GSoC as well as several open source enthusiasts who came from all across India to attend this wonderful event. The evening kicked off with the presentation on GSoC by Google Open Source Programs Office team members, Stephanie Taylor and Cat Allman. They also spoke about the Google Code-in, their success with these initiatives, and what the team has planned for the future. Next, there were short talks by previous GSoC students who described their projects, the organizations they worked with and their personal experience as a GSoC’er. I was one of the speakers and was happy to share my work as a student with NRNB.

After the talks, there was a raffle for all the attendees.  One lucky student won a brand new Google Nexus 7 tablet. The evening wrapped up with a scrumptious dinner, knowledge sharing, photo sessions and tons of Google swag. The event was a phenomenal success. I would like to thank the entire team of the Google Open Source Office for initiating such brilliant  programs which encourage student programmers to contribute to free and open source projects. I hope that there will be an exponential increase in the number of Indian student participants in the coming years!

IRC.. Blog… Learning and Programming in R…. Tweeting…. simultaneously! – Nerd Life

Bonjour,

Tonight I am doing something very crazy which I haven’t done since very long time. The title of the blogpost says it all. But yes, I want to make it a habit now. Though I don’t have a beer in my hand right now like Mark did when he was coding, I do have chilled H2O to cheer me up.

Lets get started. I have been going through the courses on codeschool . There are plenty of uber cool courses on it. But many are paid. Some are free and they do let you to download some of their screencasts which is pretty amazing. There are some courses on drive, how to use the drive api for the application development and today I was encountered with the R language tutorials which were sponsored by O’Reilly [hence they are free].

I started with R now. I am going through baby steps right now in R. Learning how to evaluate expressions and logical values in R 😀

More to come!

Cheers,

SZ

Google Summer Of Code

Hello again,

Lets get started with a brief introduction of Google Summer Of Code.

What is Google Summer Of Code?

Google Summer of Code (GSoC) is a global program that matches students up with open source, free software and technology-related organizations to write code and get paid to do it! The organizations provide mentors who act as guides through the entire process, from learning about the community to contributing code. The idea is to get students involved in and familiar with the open source community and help them to put their summer break to good use.

Accepted students gain exposure to real-world software development, and employment opportunities in areas related to their academic pursuits. Participating organizations are able to identify and bring in new developers. Best of all, more source code is created and released for the use and benefit of all; all code produced as part of the program is released under an open source license. The fact that you get to write code that people from all over the world can use – how cool is that!

This program has brought together thousands of students and mentors from over 100 countries worldwide. At the time of writing, over 200 open source projects, from areas as diverse as operating systems and community services, have participated as mentoring organizations for the program. Successful students have widely reported that their participation in GSoC made them more attractive to potential employers and that the program has helped greatly when embarking on their technical careers.

How to approach and how to get involved it in this program?

Many of my friends, colleagues asked me this particular question and here is the answer for it.

Firstly, you need to get to know your strength i.e., your skill set.

Secondly and the most important and confusing task is to choose an organization so that you can start contributing the code by writing enhancements or by documenting or by adding patches to the bugs.

You can look out for some of the open source organizations which got selected in the previous years of GSOC.

http://google-melange.appspot.com/gsoc/accepted_orgs/google/gsoc2012

http://google-melange.appspot.com/gsoc/accepted_orgs/google/gsoc2011

http://google-melange.appspot.com/gsoc/accepted_orgs/google/gsoc2010

and so on..

You can just type in your desired language in the text box which says “tags” and can filter the organizations which uses that particular  language  in their software.

Then go to the organization website.Learn about the software, and if you find it  interesting join their mailing lists. Find out the IRC channel of that particular organization, Join the channel and introduce yourself in that channel.

Speak to the main moderators or administrators of that organization or any of the other core developers about your interest in contributing code by working in that organization. Firstly , they would advice you to build and run the software on your local system.(You can download(Link will be available on their main website) their entire code from the code bases[version control systems] like github, svn, source forge etc.. ). When you successfully accomplish this task, they will definitely guide you to solve some bugs in their software which are hosted on their bug tracking sites like bugzilla.org, bugtracker.net, buggenie.com , etc..

From now your hard work begins,

Start with the low hanging bugs i.e., easy bugs and apply patches. Before working on a particular bug, you should not forget to assign that bug to yourself or else you might get into trouble.You can atleast inform the developers in that organization that you are working on a particular bug so that they prevent other developers from working on the bug which you have chosen.

After applying the patch, just inform the developers to check the patch. If they are satisfied with your patch they will commit your patch and change the status of the bug to resolved.

In this way you need to fix some bugs and also write some enhancements to get good appreciation from the developers in that community (organization).

When the Google Summer Of Code is announced and if the organization which you have been working gets selected to participate in GSOC, You can apply to the projects which are present in their project ideas list. Discuss about the project idea with the assigned mentors and win their hearts and show the confidence that you would definitely be able to complete that particular project.

Understand the project goal and try to analyze it properly. You can start preparing for that particular project which you have applied and you can sketch the road map how to accomplish that particular project goal. In this way  you can give a kick start!

Remember that you can apply for 20 different projects 🙂

 

All the very best ! Good Luck

P.S: I am SriHarsha.P(IRC: apple cool, ShellZero) , Google Summer Of Code 2012 Intern, worked for OpenMRS.org(The Uber Cool Awesome Organization)

More information regarding how to choose a right project and how to write a proposal will be updated soon in my next blogpost 🙂