Archive for the ‘Uncategorized’ Category

How to convert from pixels to millimeters

Wednesday, July 2nd, 2008

I am working with PHP and FPDF to generate a PDF invoice. The designers have created a couple of very helpful documents, there are three total. The first is a mockup of the invoice. The second shows fonts, font sizes, and font colors. The last document show the positioning of all elements on the invoice. My only problem, is that the document was made with pixels at a resolution of 300 DPI rather than in millimeters. Anyone that is familiar with FPDF will know that PDF’s created with FPDF can not be generated with pixels in mind. PDF documents in FPDF can only use point (pt), millimeteres (mm), centimeters (cm), or inches (in). (more…)

Two IP Address on a single network card on FreeBSD

Monday, June 30th, 2008

I needed to get one of my servers to respond to another IP Address. I have mostly used Linux and not FreeBSD. Linux is quite easy, but I have never done anything like this on FreeBSD, so here is how I got it work properly. (more…)

Rounding to the nearest half dollor (or quarter dollar)

Wednesday, June 18th, 2008

One of my recent projects required that I round the price I was calculating to the nearest half dollar. This started out at a pain. Rounding to the floor, or to the ceiling, or normal rounding is quite easy. But I have never had to round to the nearest half dollar. (or quarter dollar) After a little bit of time thinking about it, I came up with a solution. (more…)

Getting MySQL to run on FreeBSD 7.0

Thursday, April 10th, 2008

During my server migration, I decided that I was going to switch from five or six random Linux distributions to using a single operating system. My place of employment seems to have a fondness for FreeBSD so I decided to give it a whirl. Although very similar to the several Linux distributions I use, FreeBSD has some differences. First installing software, I have finally gotten accustom to apt-get on the Debian based distributions I use as well as YUM (Which is on the RedHat Linux variants) because FreeBSD uses an entirely different package management system I had to learn something new. (Which is always a good thing)

FreeBSD uses two different methods. I am going to focus on the Ports collection since this way seems to be the most flexible, I must warn you though, compiling everything can become a pain in the neck if you have a slow machine. Fortunately for me, all of the servers I am using in the Server Migration are new and quite fast.

The Ports collection is relatively easy to use. Simply go into the ports collection.

server# cd /usr/ports

Now you will need to find the package you want to install (I will forgo the instructions on how to do this, as I am assuming that you know how to do that already.) In my case I started with MySQL 5

server# cd databases/mysql50-server
server# make install clean
server# mysql_install_db
server# chown -R mysql:mysql /var/db/mysql
server# /usr/local/bin/mysqld_safe -user=mysql&
server# mysqladmin -u root password <password>
server# vi /etc/rc.conf

Now you will need to tell the server to automatically start the MySQL daemon when the computer restarts. Add the following line to your rc.conf file (Which you will be editing if you have followed the previous steps.)


There you go, as long as no error messages show up, your MySQL 5.0 server will be running and will be usable.

Political Madness

Thursday, December 6th, 2007

Right vs. Left that is how it has always been, Republicans vote against anything the Democrats want. Democrats vote against anything the Republicans want. For our own good this dangerous trend must end! (more…)

Changing auto_increment on MySQL

Thursday, December 6th, 2007

From time to time, when programming with MySQL, I have needed to change the auto_increment value to something other than the default (Typically it starts counting with 1 and goes up from there). To change this, simply use the following command:

mysql> ALTER tablename AUTO_INCREMENT=new_number

There you go, it is that easy to change the auto increment value for MySQL.

NOTE: I have discovered that MySQL will not allow you to set the auto_increment value to a number smaller that what is currently set. The data must be truncated and then set to get it to work properly.

Against all odds

Friday, July 20th, 2007

“The house always wins.” or so everyone says. But in this case, everyone is wrong. The Caesar in Indiana had a big problem where the players took the house. This story at Yahoo, “Is winning on a faulty slot machine [a] crime?” talks about this. I have found it interesting that all of a sudden when the house starts to loose, then they go after everyone that has won. (more…)

Welcome to

Friday, June 1st, 2007

In response to the many topics on which I have opinions on, I have decided to begin this blog. Its goal is to provide the world with my point of view. This will allow the world to know my views, and to understand how I think.

Please return often and comment on my views. I love to hear about the way others think on these topics.

Switch to our mobile site