Archive for the ‘Programming’ Category
WTF, Microsoft!
So, because the office was closed today, I had the option to work at home so I didn’t lose 8 hours pay. Great idea! So, I make sure to copy the code and database backup of my project before I left work the other night. Get up today to start working.
Sweet! Oh ya, I got to install Visual Studio 2008. No problem, I’ll grab my copy of my file server and install it. LOLWUT? Can’t copy file 67 of 71? Fine, I go find another copy. 2 hours later, it’s installed.
Time to install Sql 2008 Express. Run setup. Wut? .Net framework 3.5 needs to be installed. I thought that came with Visual Studio 2008? Anyway, download it and install it. Rerun Sql Express setup. Now I gotta have Windows Installer 4.5. WTF? Just install! So, download that and install it. Run Sql Express setup AGAIN. OMFG! I need Visual Studio 2008 Service Pack 1 installed! FINE. Download it, run it. Wow, it took 50 minutes to install the damn service pack. Funny, installing THE ENTIRE DAMN VISUAL STUDIO APPLICATION BUNDLE TOOK 20 MINUTES, but a service pack takes 50?
Nice going Microsoft. What should have taken no longer than an hour has now taken me damn near 5.
Another MySQL wtf, staring php5!
Again, I was working on a client project (the same project as this post) on my Windows workstation running AppServ. I ran across some unicode that I needed to insert into MySQL. Did it work? You guessed it, it sure didn’t! Turns out things like © and ® are not things php+mysql care for. I found a few suggestions while googling to “SET NAMES utf8;” and “SET CHARACTER SET utf8;” after connecting to the database. It didn’t work.
Example:
CREATE TABLE `blah` (
`id` int(11) NOT NULL auto_increment,
`blah` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
php code:
mysql_connect('localhost', 'blah', 'blah') || die (mysql_error());
mysql_query('SET NAMES utf8;');
mysql_query('SET CHARACTER SET utf8');
mysql_select_db('blah') || die (mysql_error());
mysql_query('insert into blah (blah) values (\'this © and this ® suck\')') || die (mysql_error());
The result of the insert was was ‘this ‘. It cuts the string off at ©.
I ended up just replacing the extra tags with super coding skills like str_replace(‘©', ''). I am aware of the different stuff that php has to break that down to © and ®. However I was dealing with urls that had these characters in it and running those functions against the whole string would do fun things like turn & into & and what happens if you already have an & in the url because a value is already url encoded?
Fun times. Fun times indeed.