Thursday, August 23, 2012

Javascript break out of frames script

Javascript break out of frames script.
A simple way to break out of frames on page load.

<script type="text/javascript">
if (top != self)
top.location = self.location;
</script>

Friday, August 10, 2012

10 things to look for in an entry level software developer


10 things to look for in an entry level software developer
Takeaway: With the right traits — and a bit of coaching — an entry level developer can prove to be a wise hire.

People are often afraid to hire entry level developers because they are relatively expensive to hire and it can take months before their productivity is high enough to justify hiring them. In addition, their lack of experience makes it hard to evaluate their abilities before you take them on. At the same time, bringing aboard entry level developers can make for a good long term investment in your company if you are willing to mentor them. Look for these 10 qualities in an entry level programmer to have the best chance of success.

1: Good attitude

All employees should have a good attitude, but it is even more important for entry level employees. They have a lot to learn, and the wrong attitude will keep them from learning what they need to. Another factor to consider is that the ROI on entry level developers is already poor; their salaries are much higher than entry level employees in other careers, and it can take months for them to meaningfully contribute to the bottom line. When someone is a “long term investment” in the future of the company, it is really important that they not make someone regret having them around long term.

2: Computer experience

While it is true that the typical programmer does not need to spend much time in server rooms or inside the guts of PCs, it is also true that the more general and advanced computer experience they have, the better able they are to understand how to fix problems with their code. For example, I’ve spent a lot of my career as a systems administrator, and I am constantly finding myself using tools and skills I learned while working with servers to find and fix bugs in code. The more computing experience an entry level developer can bring to the table, the better.

3: Work ethic

What takes an experienced developer a few hours may take an entry level developer a week. Clearly, it is critical that entry level programmers be willing to put in the time. I am not saying that they should be expected to work 60 hours a week and fire ‘em if they can’t! But what I am saying is that there needs to be the attitude of “I’m not happy until this task is done right,” and if that means paying some dues, some dues need to be paid.

4: Ability to learn

Because entry level developers lag so far behind experienced developers, they must be able to get their knowledge levels up quickly. To make this worse, inexperienced developers can often cause friction on the entire team, between the errors that need to be fixed and the help that the rest of the team needs to provide. The longer an entry level programmer takes to learn the job, the longer it takes for the company to start seeing its investment pay off.

5: Educational history

Not every developer goes to college, and not every college makes good developers. But educational history can provide an important understanding of what someone’s capabilities and interest are. A person with a science or math degree from a respected institution is likely to  have strong logic skills, for example.

6: Previous job experience

Even if someone is new to software development, it does not mean that they are new to the workforce. Previous job history can tell you a lot about who they are. I did not major in computer science, but I worked a number of programming jobs and other computer jobs during college. On the other hand, I saw people with CS degrees who were flipping burgers in school. I really liked working with computers, and that’s why I was working with them even when I did not need to be. Today, I look for the same thing in entry level programmers.
For “second chancers” (people who are making a major career shift), the previous job experience can be useful to know about. There are a lot of other jobs out there that hone the raw skills that go into a good developer, and it gives these folks a big leg up when they start writing code.

7: Lack of preconceived notions

The development industry is filled with dogma. And so long as that dogma is well founded, there is nothing wrong with it. Sadly, too many entry level developers parrot something a professor or online pundit has said, without fully understanding the reason or context. Or worse, they are stuck on an idea that isn’t very good to begin with. Good entry level programmers will respect the opinions of their teachers and mentors but be willing to hear new ideas and approaches to problems.

8: Passion for programming

It is pretty easy to separate those who went into development for a paycheck from those who went into it because they were interested in it. Finding the folks with a real desire to be in this industry is critical, because when the chips are down, things like “work ethic” and “good attitude” depend heavily on the desire to learn and grow in the industry. And again, entry level programmers are a long term commitment. If they’re just chasing a paycheck, you can bet that as soon as the job you have given them sweetens their resume, they will be headed to greener pastures.

9: Ability to ask questions

One of the most important things for an entry level developer to do is to ask questions. When someone lets the fear of sounding foolish get in the way of asking questions, it makes for a rocky relationship. A good entry level developer is willing to ask questions because it is better to spend a few minutes having a discussion than to lose two days trying to track an answer down.

10: Soft skills

In many software development shops, the programmers are little more than machines following a blueprint someone else made to crank out code. But most places need programmers to do more than sit at a desk grinding away. In my experience, soft skills, like written and oral communications and the ability to work with others, are much harder to teach than technical skills. If someone lacks these skills, it will be hard to have the risk you take in hiring them pay off in the long run.

Source: Justin James TechRepublic

Mars in first color image sent back by Curiosity

Mars in first color image sent back by Curiosity. 
New images returned from NASA's Curiosity rover, which landed on Mars Sunday evening, show a three-dimensional view from the rover's left and right front Hazard Avoidance cameras.



Curiosity's rear left and right Hazard Avoidance cameras acquire black-and-white pictures from 
left and right stereo "eyes," which are merged to provide three-dimensional information.      



During Curiosity's spectacular technical landing on Mars Sunday night, the entry, descent, and landing (EDL) required the rover to jettison hardware as it completed each phase of the operation.

In this wide view of the landing area, taken by NASA's Mars Reconnaissance Orbiter, we can see the four main pieces of equipment, captured by the High-Resolution Imaging Science Experiment camera about 24 hours after landing.

The darker areas in all four debris spots are from disturbances of the bright dust on Mars, revealing the darker material below the surface dust.




During Curiosity's descent, the lens cover on the rover's camera got covered with a thin film of dust. Here, we see a comparison between the dust coated lens on the left and the lens after the protective covering was removed. The Hazard Avoidance camera, or Hazcam, took this image of Mount Sharp in the distance on August 6, 2012.



Curiosity's parachute and back shell are seen on the surface of Mars in this image captured by the High-Resolution Imaging Science Experiment camera on NASA's Mars Reconnaissance Orbiter about 24 hours after the parachute helped gently set the rover on the surface. When the back shell hit the ground, bright dust was kicked up, exposing darker material underneath.


This close-up view shows Curiosity's heat shield, center, which helped the rover survive the harrowing journey through the martian atmosphere, on the surface of Mars, captured by the High-Resolution Imaging Science Experiment camera on NASA's Mars Reconnaissance Orbiter about 24 hours after landing.



The impact of Curiosity's sky crane, which helped deliver the rover to the surface of Mars by lowering it the final 20 feet on a tether, exposed the darker material underneath the surface dust when it landed after being jettisoned away from the rover.      




This picture of the martian landing site of NASA's Curiosity rover puts a color view obtained by the rover in the context of a computer simulation derived from images acquired by orbiting spacecraft. The view looks north, showing a distant ridge that is the north wall and rim of Gale Crater.

The color image was obtained by Curiosity's Mars Hand Lens Imager on August 6 PT, the first martian day after Curiosity's landing on August 5 PT. It has been rendered about 10 percent transparent so scientists can see how it matches the simulated terrain in the background. The MAHLI image was taken while the camera's transparent dust cover was still on. Curiosity's descent coated the cover with a thin film of dust.

The computer simulation is a digital elevation model that incorporates data from the High Resolution Imaging Science Experiment and Context Camera on NASA's Mars Reconnaissance Orbiter and the High Resolution Stereo Camera on ESA's Mars Express.

The peak seen on the left side of the MAHLI image is about 15 miles (24 kilometers) distant with a height of about 3,775 feet (1,150 meters). The box with arrows at the upper left indicates direction. The arrow pointing up is "up" with respect to the gravity of Mars. The arrow pointing to the right is east. North would be an arrow pointing into the image (that is, the MAHLI view is toward the north).

The MAHLI is located on the turret at the end of Curiosity's robotic arm. At the time the MAHLI image was acquired, the robotic arm was in its stowed position. It has been stowed since the rover was packaged for its November 26, 2011, launch.

When the robotic arm, turret, and MAHLI are stowed, the MAHLI is in a position that is rotated 30 degrees relative to the rover deck. The MAHLI image shown here has been rotated to correct for that tilt, so that the sky is "up" and the ground is "down." Here, MAHLI is looking out from the front left side of the rover. This is much like the view from the driver's side of cars sold in the U.S.

The main purpose of Curiosity's MAHLI camera is to acquire close-up, high-resolution views of rocks and soil at the rover's Gale Crater field site. The camera is capable of focusing on any target at distances of about 0.8 inch (2.1 centimeters) to infinity. This means it can, as shown here, also obtain pictures of the Martian landscape. This was the first time the MAHLI focus mechanism was operated since before launch and it performed flawlessly. 

Recursive Functions


Recursive functions

Recursive functions are functions that call themselves. Several problems are naturaly defined recursively. Those problems may be solved by using recursive functions.

Example: Factorial of a positive integer number.
0! = 1
1! = 1
n! = n * (n-1)! , if n > 1

int factorial(int val){
if(val <= 1)  //stop condition.
return 1;
else
return val * factorial(val-1);  //recursive call.
}

Stop condition: Condition to stop recursive calling and return. Written before recursive calling.
Recursive calling: The problem to solve should be simpler than the previous problem. The recursive calling ends at stop condition.

Advantages: compact code, easier to write and understand.
Disadvantages: intensive stack usage, recursive functions aren't faster than equivalent non recursive functions.

Some usage examples: String manipulation, linked list operations, binary tree operations.

Example: Count number of characters in a string.

int count(char *st)
{
if(*st == '\0')
return 0;
else
return 1+conut(st+1);
}

Example: reverse a string.

void puts_inv(char *st)
{
if(*st == '\0')
return;
else
{
puts_inv(st+1);
putchar(*st);
}
}



Examples of incorrect recursive functions:

long int factorial(long int val)
{
return val * factorial(val-1);
if(val <= 1) return 1;
}

long int factorial(long int val)
{
if(val <= 1) return 1;
else return val * factorial(val);
}

long int factorial(long int val)
{
if(val <= 1) return 1;
else return val * factorial(val+1);
}

C function for getting user input


C function for getting user input.
Reads up to uinput-1 characters from stdin to uinput, removes \n adn adds \0. 
Returns number of characters of uinput.

int getUserInput(char *uinput, int size){

size_t last;

fgets(uinput, size, stdin);

if (strlen(uinput) > 0){
last = strlen(uinput) - 1;
if (uinput[last] == '\n'){ //if last char is \n replace with \0
uinput[last] = '\0';
} else {
//no \n in buffer, discard additional characters.
fscanf (stdin, "%*[^\n]"); 
(void) fgetc (stdin); // discard \n
}
}
return strlen(uinput);
}