Thursday, November 20, 2008

My thoughts on game consoles

If you are confused between Wii, Playstation 3 or Xbox 360 here is what I have to tell you, by the end of this short article you should have a good idea of what you want

If you are a kid, a grand parent who hasn't played any video games, gay (I hate to say this but the games are pretty damn gay!), a retard who can't learn to play complex games you should go for Wii. Wii only has stupid games, graphics simply sucks, it has the best browser among all of the game consoles though. The controllers are creatively designed, if you have a kid you better buy a wii so that he can move his body when he plays and he doesn't become fat. Wii doesn't play dvds and etc unless you crack it using third party software which is stupid

If you are not any of the above, then you are stock between Xbox and PS3
It has been said by many people that Xbox has better graphics, but the difference is not really that high unless you are a gaming freak, in which case you will own both won't you?

If there are games that you are obsessed with and are only available in either one of these two consols then your choice is also clear, why are you even reading this?

If you still haven't gotten your answer, then go for PS3 because:

  1. PS3 gives you blu-ray! Get HDMI cable and you will get the best damn picture quality ever! I'm sure you don't mind being able to play 50GB blu ray disks beside your games, or do you? While PS3 plays DVDs, Divx and Xvid files, Xbox doesn't even play dvds you'll have to buy an extra kit for that, isn't that a rip off?
  2. PS3 gives you free online game playing while Xbox charges you for that
  3. PS3 gives you larger hard disk compared to Xbox for the same price

This short review was written in November 2008, things might have changed by the time you read it

How to hide php extensions

Hiding php extensions is a really good thing to do. Not only it makes your website more search engine friendly and professional looking but it makes it safer!

Why does it make it safer one might ask? My answer is because it hides your php pages and doesn't let the attackers directly communicate them and test passing different parameters as variables to your pages and test result!

Let me make it more clear, let's say you have a page that shows a pice of news, your page should look like this news.php?id=85

Now an attacker can simply change that id to anything that he wants, he can change it to a string instead of a number, he can try to do some SQL injections or other nasty things, but if you hide your page, the same page will look something like news/85 or even news/85.html

Now many attackers will just assume your page is a html file and stop trying to hack you to begin with. However if they continue, they will not be able to see any desirable results because trying a string instead of 85 will give them a 404 error!

In other words you are adding another security layer to your php files, there are good ways to stop sql injection within php but adding another security layer is always better especially if your website is under heavy attack! It's like having more rows of soldiers in a war!

You can hide your php extensions by using apache's .htaccess file capabilities, you should also know regular languages to use this feature effectively. Here is a sample I have used for one of my projects

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([0-9]+)\.aspx$ foo.php?id=$1

Here the users will see news/85.aspx in their browsers, but apache will redirect 85 to my foo.php file and then show the results from that page!

So not only I have kept my foo.php save from visitors, and not only hackers have no chance of passing anything but one numerical value to my php, I have also made hackers think I'm using asp.net instead of php, so they will be trying to use their asp.net knowledge to hack a php based application, which is a hard thing to do.

Application path in vb.net

Dot net had made a total mess in giving you the path that your application is running

There are many ways to get your current path, unfortunately some of them work for some types of programs but don't work for others. I have tried this one and this one.

I have had to write programs that work in every one of the following types of applications
  • Windows applications
  • Dll files
  • Dll files registered as COM objects
  • Windows Services
  • Web based applications
  • Web services
And I realized the following way of getting the application path works for all of them

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.Location)

So people should use this instead of anything else.

I have noticed some people make the horrible mistake of mistaking "current directory" with what I have been referring to as "application path". They are VERY different things, current application may change if the user does something like opening his browser and going to c:\foo, the programmer may not notice this since he hasn't opened any folders when he was coding, so be careful of that too