Archive for July, 2010

Hello Script for C Language

July 23, 2010

C – the root of all modern language’s syntax. Here is the hello script for C. A ‘Hello Script‘ is a file that contains the most commonly used elements of a programming language so that it can be used as a cheat sheet when working with that language.

Unfortunately, I am not an expert in C – I prefer dynamic languages over static ones. So if you find any problems in the script, please let me know in the comments.

#include <stdio.h>
#include <string.h>

// Function declaration
void hello(char name[]) {
 	char result[50] = "Hello, ";
 	strcat(result, name);
 	printf("%s\n", result);
}

int main() {
	int i;
	// Printing(IO)
	printf("Hello World!\n");

	// Variables, concatenation
	char name[] = "Binny";
	int year = 2008;
	printf("Hello, %s - welcome to %d\n", name, year);

	//If, else
	if (year > 2008) {
		printf("Welcome to the future - yes, we have flying cars!");
	}
	else if(year < 2008) {
		printf("The past - please don't change anything. Don't step on any butterflies. And for the sake of all that's good and holy, stay away from your parents!");
	}
	else {
		printf("Anything wrong with your time machine? You have not gone anywhere, kiddo.");
	}
	printf("\n");

	// For loop
	for(i=0; i<3; i++) {
		printf("%d) Hi there!\n", i);
	}

 	//Numerical Array, while
 	char rules[3][20]; //I am sure there is a better way of doing this using poiters. If you know, please leave a few 'pointers' in the comment.
 	strcpy(rules[0], "Do no harm");
 	strcpy(rules[1], "Obey");
 	strcpy(rules[2], "Continue Living");
 	i=0;
	while(i<3) {
		printf("Rule %d : %s\n", i+1, rules[i]);
		i++;
	}

	// Struct - nearest thing C has to an associated array
	struct structure {
		char hello[20];
		int number;
		char foo[20];
	} associated, new_associated;
	strcpy(associated.hello, "world");
	associated.number = 1337;
	strcpy(associated.foo, "bar");
	printf("hello: %s\n", associated.hello);
	printf("number: %d\n", associated.number);
	printf("foo: %s\n", associated.foo);

	// Function calling
	hello("John Oldman");

	// Writing to a file
 	FILE *out;
 	out = fopen("/tmp/Hello.txt", "w");
 	char *str = "Hello From C";
 	fputs(str, out);
 	fclose(out);

	// Reading and displaying a file.
	FILE *in;
	in = fopen("Hello.c", "r");
	if (in) {
		while (!feof(in))
			printf("%c",fgetc(in));
	}
	fclose(in);

	// Run a system command.
	system("ls");

	return 1;
}

First you have to create the ‘hello world’ application. This is more than just ‘print “Hello World”‘ – it will act as a cheatsheet for you until you familiarize yourself with the language. The point of this application is to use all the most commonly used elements of a language and putting it in a single place so that you can refer to it later.

Your first job is to go to the tutorial, the manual and the internet until you create the Hello World application with the following stuff in it. I will provide an example – how the ‘hello world’ application will look in PHP.

After each step run the application and make sure it works.
Print “Hello World\n”
Why do you think we call it a hello world application? Write the code to print a string ‘hello world’ and save it to a file. Now run it using the interpreter – and make sure it works – see it in action.

// Printing(IO)
print "Hello World!\n";
	
Comments
Put a single line comment(like //) on top of the “print ‘hello world’” code and if your language supports it, a multiline comment(/* – */) as well. Run the script to make sure the comments work as advertised.


// Single line comment.
/*
Mulitline comment.
*/
	

I was just kidding about running the script to test the comments – you did’nt do it, did you?

Use a variable(a string and an integer) and a concatenation operator.
Create a variable called name(string) – and give it your name as the value. Create another integer variable and give it the current year. You don’t have to find it programatically – just put it as 2008 or something. Now you have to print out the a string “Hello, <name> – Welcome to year <$year>”. This string will let you concatenate two different type variable to a string – and it makes me feel like a time traveler ;-) .

Yeah – the value of variable name should appear at <name>. Use the concatenation operator if possible – in PHP, write

print "Hello, " . $name . " - welcome to year " . $year;

instead of

print "Hello, $name - welcome to year $year";

This is because different languages have different concatenation operators. The other stuff is the same almost universally. + refers to addition. – refers to subtraction. * is multiplication. My point is that if you know the operators for one language, you know the operators for almost all languages. But the concatenation operator differs from language to language – its ‘+’ in javascript, ruby. Its ‘.’ in Perl, PHP, etc.

There are exceptions to this rule – ‘=’ is the equality operator in SQL while it all other language its ‘==’. The assignment operator is ‘:=’ in pascal – in all other it is ‘=’. If you notice any difference in any operator write some code using that operator in this section.

Use if/else if/else
Create something like this pseudo code…

if (year > 2008) {
	print "Welcome to the future - yes we have flying cars!"
}
else if(year < 2008) {
	print "The past - please don't change anything. Don't step on any butterflies. And for the sake of all that's good and holy, stay away from your parents!"
}
else {
	print "Anything wrong with your time machine? You have not gone anywhere, kiddo."
}

Who can be a BA (Business Analyst)..Rakesh

July 20, 2010

Being in software development for few years and then in BI for the last 2
years, I believe I know enough and have seen enough to share my $0.02 with
you.

There are many different kinds of Business Analysts. There are BAs that
focus on analyzing business processes and performances. Very oftens, they
use BI tools like Business Objects and Cognos to assist their analysis. For
those BAs who know how to use BI tools and how to develop reports/metadata,
they can be quite technical as compare to those who do not use any BI tool.

There are also IT Business Analysts. These BAs usually work with Project
Managers to gather business requirements, create functional specs and so on,
and then pass on the information to the development team to write the code.
These BAs have to have some technical knowledges besides business
knowledges.

In these days and age, any Jane, Jack and Harry is an architect. I believe
the term is being mis-used and over-used. A true BI Architect should have
BOTH business knowledges and technical knowledges. This person should have
HAND-ON experiences from end to end of the entire development process. In
another word, not just talk the talk, but be able to walk the walk.

On the other hand, data warehouse is a different world. This area is the
most technical of the whole BI/DW realm. In my humble opinion, it is not for
the faint of the heart. In BI, you can get away without a computer science
or engineering degree. But for data warehouse, you cannot get too far
without a CS or engineering degree because of the lack of foundation. You
must understand databases very well….not as a user (e.g. a software
developer is merely a database user) but as a
administrator/designer/builder. You must know dimensional modeling. You must
know how to write code, e.g. PL/SQL, cron job, Perl scripts, etc etc. You
must also understand the business rules very well or you won’t be collect
the right data.

In order to determine which direction you want to take, you need to do some
self-evaluation:
1. what is my background (i.e. college degree, work experiences, etc)?
2. what industry specific knowledge (I mean business knowledge) do I have?
3. what type of work fits my personality? Do I like to work with business
users? Do I like to work with data which could be extremely boring?
4. and last but not least, what makes me happy? You won’t last very long if
you are not happy with what you are doing.

Time Management – Why Traditional Techniques Don’t Work for Everyone

July 16, 2010

Do you find yourself continually running out of time or not getting everything done that you had hoped to? Do the phrases “I can’t believe that’s the time” or “I didn’t get that finished today” seem all too familiar. In order optimise your time it is essential that you manage yourself effectively.

Whether you have lost focus and motivation or have found yourself overwhelmed with activity, step back and analyse yourself, prioritise your effort and organise your daily actions.

From my experience in training and coaching leaders, managers and entrepreneurs to be their best, I understand that people think about and process time differently. For example, you probably know some one who never wears a watch, yet they always know the time or indeed the opposite – someone who checks their watch every few minutes because they are not sure of the time.

How you relate to time depends on what you focus on. Perhaps you spend your time thinking about the future or maybe you tend to live in the moment.

If you are future orientated you tend to be very aware of time and always wondering what you are going to do next. Planning and prioritising techniques work well for you keeping you goal focused and on time for appointments. In addition to that use the following tips to make most of your time:

  • Know what you want to achieve and keep focused on the end result.
  • Work from a prioritised daily “to do” list, ticking off completed items as you go.
  • Change your diaries and organisers to display the weeks and months ahead at a glance.
  • Imagine how you will feel when you have completed your task.

If you tend to live in the moment, you will find that traditional time management tips and techniques are not that effective for you. You may find yourself deeply engrossed in your work and time may lapse without your realisation. Your ability to multitask allows you to start many projects at one time, yet this may leave you overcommitted or even forgetting important appointments. Use the following tips to optimise your time:

  • Use timers or alarms to increase your awareness of how long you are spending on task.
  • Discipline yourself to complete tasks before starting new ones.
  • Break down large goals into step by step tasks.
  • Use a page a day diary or organiser.
  • Learn to say ‘no’ when you are over committing yourself.
  • De clutter your office, your projects and your ‘to do’ lists on a regular basis.
  • Focus you mind by asking the question “what is the best use of my time right now?”

Day by day, we are presented with the necessity to achieve more in less time. Whether you are future orientated or live in the moment, self management is the key to managing your time effectively.

How do you think about time and what can you do to make the most of it?

Why Business Intelligence?

July 14, 2010

What is Business Intelligence?

In a 1958 article, IBM researcher Hans Peter Luhn used the term business intelligence. He defined intelligence as: “the ability to apprehend the interrelationships of presented facts in such a way as to guide action towards a desired goal.”

Business Intelligence is a set of techniques and tools which analyzes external and internal data available to an organization.  Business Intelligence is a larger term consisting of Datawarehousing as well as techniques and tools for analyzing Data e.g. for a large retailer having multiple branches across different regions around the world there is a need to find exact inventory, sales, costs etc. with precision.

Why do we need it? In the everyday world where the C-level executives struggle with quality information there is a need and demand for accurate overall picture of the companies or businesses. How do they find out which product or region or sales team is the highest performer and which is not?  By using Business Intelligence tools and techniques they can precisely find out where their strengths are and what are the areas of improvement.

Some of the leading Software packages for Business Intelligence are:

  • Cognos
  • Business Objects
  • SAP BW
  • Hyperion
  • Microsoft Solutions
  • OBIEE

The major vendors are SAP(owns Business Objects), Oracle(OBIEE), IBM(Cognos). There is an enormous scope to improve one’s bottom line by using Business Intelligence.