Officer in Civvies

The life of a soldier at a civilian university.

Archive for the ‘Technology’ Category

CSS 3 – Rounded Corners

Posted by officerincivvies on August 22, 2009

If you can’t see the round corners on this div layer, it’s because you are using IE, so really I have no sympathy for you.

I just discovered a new feature in CSS 3 which is rounded corners in div layers.

This is cool so now you can place images as the background of a div to give it rounded corners without having to use photoshop. You can get images like this:

Now that Firefox is in Version 3 it has support for CSS3. I think most browsers do except for IE. There is still the downside to this that CSS doesn’t have the ability to stretch or shrink images, so if you are trying to shrink a 200 x 200 image to a 100 x 100 div layer with rounded corners you will get something that looks like this.

I am trying to find a way around this problem without using server side scripting languages. My current host doesn’t have the GD PHP library installed so that option is out.

Posted in Technology | 1 Comment »

F-E-A-R

Posted by officerincivvies on August 17, 2009

No, this post isn’t about the game FEAR.

Instead it’s about a genius move that I discovered on bulbapedia with how you can beat a level 100 pokemon using a level 1 rattata. Hence why the abbreviation for Fear is “Fucking Evil Annoying Rodent.”

All you have to do is equip a Focus Sash to your rattata who knows Quick Attack and Endeavor. For your first move use Endeavor, your opponent is likely to use an offensive move which will bring you to 1 HP. Your endeavor will bring your opponent to 1 HP as well. Now finish them off with a quick attack, which is a priority move meaning you will attack first.

There are some flaws to this move, but often it works quite well.

You can read about it here, where I learned about it.

And for a video on this rattata “pwning shit up” take a look here:

Posted in Technology, Videos | Leave a Comment »

PHP – Finding Geographical Location

Posted by officerincivvies on August 2, 2009

In the past on previous websites in the registration field for “Location” I have found users would always lie about that. I hate it. I am working on a new website for a personal project and one thing I wanted to do was with PHP find the geographical location.

Despite what Cory thinks there is no

canHazLocation() or

whereTheHellIsTheUserLocatedIncludingAddress() function.

So after searching through a bunch of random blogs I managed to find this site: http://ip-to-country.webhosting.info/. What they offer is a download-able CSV file which contains the current location of where all the IP ranges are assigned to. Because IPs can change you will need to download this file once a month or so.

There are five columns in the CSV file: IP_FROM, IP_TO, COUNTRY_CODE2, COUNTRY_CODE3, COUNTRY. You need to make a table in your database with those columns (types: double, double, char(2), char(3), char(255)). Then import the CSV file into the table. PHPmyAdmin should have a feature to do this.

Now to find the users location, we can just use the following code:

$ip = getenv('REMOTE_ADDR');

$ip_number = sprintf("%u", ip2long($ip));

$sql = mysql_query("SELECT country FROM ipcountries WHERE ip_from = $ip_number") or die(mysql_error());
$info = mysql_fetch_array($sql);

echo ucfirst(strtolower($info['country']));

An example can be seen here.

Posted in Technology | Leave a Comment »

What to do with my old Xbox

Posted by officerincivvies on January 1, 2009

So I recently got an xbox 360. I still have my old xbox and I am not sure what to do with it. Selling it seems like a bad idea since I either won’t get much for it, or no one will want to buy it. I don’t know anyone who wants an xbox and I don’t want to throw it out.

So I ask, what would you do with your old console? Blowing it up has been done before, but if you have a good idea, and I will film it (if possible) and post the video up here.

Posted in Technology | 1 Comment »