SAC

SAC

Saturday, 9 January 2010

The Evolution of a PHP Coder

Sometimes it baffles me to see so much PHP bashing coming from .net coders, some of them aiming their hate towards the language itself, but some others to the coders. I must admit PHP is not the cleanest language you will find out there and I must admit PHP coders are not the elite of the coding world, but there is a reason for this: PHP is accessible.

This means anyone can grab a php script and tweak it, anyone can code a blog or photo gallery script without much effort with basic php knowledge, and the best of all, it costs nothing. No need to spend money on IDEs, compilers or servers, just install apache, php and mysql and get the job done. It is reasonable to think that most newbie coders in the market are working with the most accessible tools, that means, you have higher chances of finding a php newbie than a .net newbie, and this gives us all bad reputation.

But not all of us are or will be newbies forever, some of us make a career working on the web development industry and hey, some of us are good at it! If you need a demonstration of this, I can show you how I have been writing code during the 6 or 7 years that I have been doing it.

First year



//Login script
if($_GET['user']=="jack" && $_GET['password']=="WelcomeToTheBackend"){
  header("location: admin.php?loggedin=1");
  exit();
}


//Admin script
if($_GET['loggedin']==1){
  ?> ... display administration console here ... 


Second year



//Login script
$user = $_POST['user'];
$pass = $_POST['password'];
mysql_connect("localhost","root","");
mysql_select_db("mydb");
$r=mysql_query("select * from users where username='$user' and password='$pass'");
if(mysql_num_rows($r)){
 header("location: admin.php?loggedin=1");
 exit();
}


//Admin script
if($_GET['loggedin']==1){
  ?> ... display administration console here ... 


Third Year



//Login script
$user = $_POST['user'];
$pass = $_POST['pass'];
$sql = new SQLClass();
$sql->connect();
$sql->query("select * from users where username='$user' and password='$pass'");
if(count($sql->res)){
  $_SESSION['user'] = $sql->res;
  header("location: admin.php");
}


//Admin script
if(!$_SESSION['user']){
  exit();
}


Fourth year



//Login script
$user = SecurityClass::validate($_POST['user']);
$pass = SecurityClass::validate($_POST['pass']);

$user = new UserClass();
$user->authenticate($user,$pass);
$system->redirect("admin");


//Admin script
if(!UserClass::userAuthenticated()){
  exit();
}


The point I'm trying to make is, anyone can code in PHP, even idiots like me.

But it takes time to get a professionally acceptable level, a level at which you can measure yourself with coders from other platforms and you can get competitive. Other more strict platforms usually require more experience and skills to begin working with them and that could be a good thing to keep a decent level in the community but it does not make the language or the coders necessarily better.

So you, puny PHP coder reading this blog, if you ever get bullied by the big boys, put in the drive that old CD where you store the older projects, see what you wrote when you started, get scared a bit and then see how much you have improved over the last few years.

Soon you will understand that knowledge and growth are much more valuable than a compiler and an IDE license.

Tuesday, 10 November 2009

10 Software Bugs That Caused Disasters

Software bugs are part of a programmer's life, we deal with them on a daily basis but some of them slip through several stages of Quality Assurance and sometimes can cause headaches to the users. Here is a list of 10 software bugs that cascaded and ended up in real disasters.

  1. In May 1996, a software bug caused bank accounts of over 800 customers of a major US bank to be credited with $924,844,208.32 each. The American Bankers Association claimed it was the largest such error in banking history.

  2. A crew member of the guided missile cruiser USS Yorktown entered by mistake a 0 value when prompted by the computers. The lack of a validation mechanism generated a division by zero and the error crashed the ship's propulsion system and eventually left it dead in the water for several hours in November 1998.

  3. The Ariane 5 rocket exploded in June 1996. The engineers installed software inherited from an older rocket (Ariane 4) which was not ready to handle the input generated by the latest hardware. The Ariane 5 flew faster, generating larger values of some variables. The software being unable to convert a 64 bit floating-point number to a 16 bit integer decided to shut down the navigation system.

  4. In January 2001 a major European railroad company found that many of their trains would not function for being victims of the Y2K effects. Their software was unable to process the "31/12/2000" date.

  5. Between 1985 and 1987 the Therac 25 radiation therapy system ran with a bug that issued lethal radiation doses to the patients who were treated by it, causing the death of five of them and injuries to others.

  6. In July 1962 the Mariner I space probe was destroyed by the ground control team when they discovered that the rocket diverted from its original path. Further research indicated that a formula written on paper was improperly transcribed into source code, causing the computer to miscalculate the rocket's trajectory.

  7. In 1978 the Hartford Coliseum collapsed after thousands of attendants left the building. The CAD software used to design the building contained a bug that miscalculated the resistance of the material.

  8. In 1983 the Soviet Early Warning System triggered off alarms when it falsely detected that the United States had launched five ballistic missiles. The officer in charge reasoned that no such thing was possible since if the US really wanted to attack the Soviet Union they would be launching more than 5 missiles, so he reported it as a false alarm, preventing a massive Soviet military reaction.

  9. During the first Gulf War, the Patriot Missile System installed in Saudi Arabia failed to intercept an incoming Iraqui Scud missile. The attack destroyed an Army barracks causing the death of 28 soldiers and 100 injured. The software that controled the Patriot system rounded wrongly a time value, making the defense mechanisms ignore the incoming threat.

  10. In 1998 the Mars Climate Orbiter crashed on Mars after a 286 days journey from Earth. The software that controlled the thrusters was set up to use imperial units instead of the metric units as specified by NASA, causing the machine to malfunction and crash on the red planet.

Saturday, 17 October 2009

Top 10 Geekiest T-shirts

Ever thought of buying a geek t-shirt to show off all your geekiness at work or among your friends? Would you even dare to wear one?

Here I will show you my 10 favorites:



geek t shirt

Don't let those noobs bother you at the computer shop, your time is valuable!




geek t shirt

And if you don't believe me, think of Google!




geek t shirt

I'm gonna make my baby wear this one if I ever have one, a baby I mean.




geek t shirt

Always show your feelings to your loved one, and do it in the most geeky way!




geek t shirt

Dealing with 10 projects at a time? this t-shirt is for you.




geek t shirt

If you find yourself speaking online-lingo more often than normal english, this t-shirt will suit you (IMHO).




geek t shirt

Static t-shirts are boring! this one is dynamic and the hearts will blink when in proximity of a female with the same model.




geek t shirt

Tired of being asked to fix other people's computers? If you truly abhor noobs, this t-shirt is the right one for you.




geek t shirt

When dealing with computers there is always one more hole left to try.




geek t shirt

Let normal people play rock-paper-scissors. But we normal geeks play rock-paper-scissors-spock-lizard.

Thursday, 15 October 2009

Five Major Browsers Benchmarked

The WebDevelopment blog 6Revisions.com recently published an interesting infograph with the results of the benchmarking they performed on all five major browsers (Mozilla Firefox 3.5, Google Chrome 3.0, Microsoft Internet Explorer 8.0, Opera 10.0, and Apple Safari 4.0), measuring JavaScript speed, average CPU usage under stress, DOM selection, CSS rendering speed, page load time, and browser cache performance. Full article here.

Browser Benchmark

CryEngine3 Available for Development

German developer Crytek made a public announcement today concerning its newest project the CryEngine3, which will power their upcoming game Crysis2. The new engine will be available for other developers to use in their own projects.



The developer of critically acclaimed titles such as Far Cry and Crysis has built a reputation of being the leading company when it comes to proficient technology and graphical innovation. Crysis has been released two years ago and still remains the most used benchmark when testing new graphic cards and processors.

Now the company is decided to turn this reputation into real money as they hope to make their engine be widely adopted by the industry, and represent a challenge to the already established Unreal Engine and others.

Wednesday, 14 October 2009

Work in Progress: TOMAX - Office Supplies in Poland

My brother in law recently asked me to help him develop a minimalistic, yet strongly corporate website to present his services through the web.

TOMAX offers high quality office supplies and distributes them in the region of Podkarpackie in Poland. The website features some pictures of his products, about-us summary, map localization, and contact form.

TOMAX - Office Supplies in Poland

I'm looking for ideas to improve his website so if you have some, share them! :)

Saturday, 10 October 2009

Free Tip: Always remove old drivers before upgrading

This is one very poorly documented fact about hardware maintenance: newer driver installation programs almost never take care of properly deleting their previous versions. And these driver leftovers (programs, libraries, or registry records) can cause you performance issues, startup problems and sometimes will not allow you to effectively install the newer versions.

ASUS GTX 285

I personally experienced this, when I bought the ASUS GTX285 video card I was running the nvidia v185 drivers. Those drivers are supposed to work fine with the card but when I tried some games I noticed that I was getting very low framerates on GTAIV and Empire: Total War, so I upgraded to the latest v186 drivers but the issues got even worse, giving me crashes and even lower FPS.

Troubleshooting my issue and with a little help from Google I stumbled upon this little program: DriverSweeper, whose purpose is to completely remove any specific driver that you indicate. So I fired up the utility, marked everything related to nVidia, and hit the "Clean" button.

Later reinstalled the 186 drivers and my games were working flawlessly again with the highest settings and I was always getting above 40fps.

So here is my tip: Always remove old drivers before upgrading!

DriverSweeper is free, there are paid counterparts that have additional features such as driver backup, safe recovery, online driver compatibility lookup, etc. So which one you use is up to you.