Archive for September, 2005

Using MySQL with .Net

Friday, September 30th, 2005


Continuing research for porting my blog over to WordPress, I started learning how to interact with a MySQL database with C#. I lack experience with MySQL, so this would be a nice little project. At first, I was using an OleDb provider, but continued to get an error DB_E_NOTABLE (0×80040E37) when I tried to access longtext fields or blobs.

After stumbling many times over, I found that the MySQL development site had an article entitled
Exploring MySQL in the Microsoft .NET Environment
. In the article, Venu Anuganti states that MySQL doesn’t officially support OleDb providers such as the MyOLEDB provider. Fortunately, ODBC was a recommended driver. I was able to download the MyODBC driver and install it without and problems. Running my little C# test, I was finally able to read text fields without any errors.

One other thing that I noticed is that I could add a database connection to VS.Net 2005 with both MyODBC and MyOLEDB. The Oledb provider would only show me tables and columns, and would complain about asynchronous connections every time I tried to access data. With MyOLEDB, I saw tables, views, and stored procedures as nodes and I was also able to see data within each table.

Here is a screen shot of my testing tool:



And here is some basic code that I use for it:

6 using System.Data;
7 using System.Data.Odbc;
8 using System.Diagnostics;
9 using System.Globalization;

109 private string ConnectionString
110 {
111 get

112 {
113 return string.Format(
114 CultureInfo.InvariantCulture,
115 @”DRIVER={{MySQL ODBC 3.51 Driver}};SERVER={0};DATABASE={1};UID={2};PASSWORD={3};OPTION=3″,
116 this.Location, this.DataSource,
117 this.UserId, this.Password);
118 }
119 }
120 private void button1_Click(object sender, System.EventArgs e)
121 {
122 OdbcConnection connection = null;
123 OdbcCommand command = null;
124 OdbcDataAdapter adapter = null;
125 DataSet data = null;
126 try

127 {
128 connection = new OdbcConnection(this.ConnectionString);
129 command = connection.CreateCommand();
130 command.CommandText = this.Sql;
131 adapter = new OdbcDataAdapter(command);
132 data = new DataSet();
133 adapter.Fill(data);
134 this.dataGrid1.DataSource = data;
135 }
136 catch(Exception ex)
137 {
138 MessageBox.Show(this, ex.Message);
139 }
140 finally

141 {
142 if(adapter != null)
143 adapter.Dispose();
144 if(command != null)
145 command.Dispose();
146 if(connection != null)
147 {
148 if(connection.State != ConnectionState.Closed)
149 connection.Close();
150 connection.Dispose();
151 }
152

153 }
154 }

I am hoping that my web hosting provider will permit me to access MySQL over the internet rather then restricting me to a local connection from the website itself. If I can reach the database, then I may be able to import blogger entries and haloscan comments without too many problems over to WordPress.

Tags: , , , , , , , , ,

The Rescheduled Lunch

Thursday, September 29th, 2005


A year ago, my coworker and I would have lunch together every day. It has been a long time since we last had lunch together. Lately, plans have been made only to be broken by unforeseen circumstances. Today was no different.

The lunch planned yesterday was rescheduled to today. Yesterdays plans were thwarted since the whole office was going to a Thai Restaurant. Today our plans were foiled again as it was someone’s birthday. The party was supposed to start at noon, but the guest of honor didn’t show up until a little later. It was a surprise party after all.

The party only involved a cake. After a half hour, I sneaked out. I had only a half hour before a meeting so I grabbed some lunch from the deli in our building. There really wasn’t enough time to go out on our lunch break. We shall see what tomorrow brings.

Tags: , , , , , , ,

Preperation for moving day

Thursday, September 29th, 2005


I’ve decided to go with WordPress for my blogging platform. I wanted to test it out at home on one of my computers. I installed MySQL and PHP. I installed the MySQL Administrator to manage the MySQL database to create a user and then give them permission to access a database.

I downloaded WordPress and unzipped it into a directory. Visiting the web site on my local machine told me that MySQL wasn’t available to PHP. I spent the next 3 hours debugging the PHP.ini file and googling for help. I tried the following:

  • in PHP.ini, set extension_dir = “c:\PHP\ext\”
  • uncomment extension=php_mysql.dll
  • download pecl-5.0.5-Win32.zip and copy php_mysql.dll to the “ext” subdirectory

No matter what I would do, I would keep getting this error:

“Unable to load dynamic library ‘c:\PHP\ext\php_mysql.dll’”

Finally I found an answer in a forum post by DoopyNL.

I’ve copyed the file libmysql.dll from the main php folder to \windows\system32 and the error went away and I could use the mysql functionality in PHP.

I found the file in php-5.0.5-Win32.zip and copied it to the directory. As soon as that was done, WordPress installed itself without any problems.

Tags: , , , , , ,

The Possessed Radio

Thursday, September 29th, 2005


I had my own apartment in Moorefield, West Virginia back in 1996. Since I had a job from ten at night to six in the morning, I would sleep during the day. Sometimes this proved hard to do, as my radio was possessed.

In West Virginia, you run into all sorts of odd situations. Mine was due to computer illiteracy. You see, before the internet and even bulletin board systems for that matter, people would chat over CB (Citizens’ band) Radio or Ham Radio (also known as Amateur Radio). Today we have the equivalent technologies being used over the internet such as voice chat and podcasting.

At my old apartment, I would hear a one-sided conversation of someone talking on a CB through my radios speakers. It did not matter if the radio was on or off – or even unplugged for that matter! This made it really hard for me to get to sleep even when I would attempt to muffle every speaker in the apartment.

From what I gather, the person on the CB was probably running so much power through there transmitter, that the FCC might raise an eyebrow. I suspect that it may have been the family living above me. I would sometimes hear children being allowed to talk, but it was usually a man and sometimes his wife.

The thing that I hated most about it was when they were looking for someone and just call out for them continuously.

Hey Cosmo!
You there Cosmo?
Cosmo are you there?
Anyone seen Cosmo?
Cosmo
Cosmo
Cosmo
Hey Cosmo!

Tags: , , , , , , ,

Left Behind

Wednesday, September 28th, 2005


Yesterday, my co-worker and I agreed to have lunch today. Later in the day another coworker reminded me that I had agreed (last week?) to eat at a Thai restaurant with the rest of the office. I canceled plans with the first coworker and confirmed with the second that I would be eating at the Thai restaurant.

So today I notice it is 11:30 and I didn’t know what time everyone would leave for lunch. I go in search for her and other individuals and discover that just about everyone has gone missing. I have no idea where this Thai Restaurant is.

I sent a message to the first coworker that I initially agreed to have lunch with saying “I think they forgot me”. She came out of her office and gave me the bad news that she was already in the middle of her lunch since she had thought I was going to the restaurant.

Oh so sad.

Tags: , , , , ,

Running on Knoppix

Tuesday, September 27th, 2005


My computer spent most of the night last night downloading over 3 gigabytes of the Knoppix bootable DVD with a bit torrent client. I had tried FTP first, but the download speed was very slow and continued to fail on different mirrors.

I installed the NERO software that came with my SONY DVD/CD ReWritable Drive (DRX-720UL) and was able to burn the ISO image to a DVD. I wasn’t sure if my computer would permit me to boot off of a DVD. I have booted it off of a normal CD in the past, but I figured DVD’s may be different.

The option to choose the DVD drive came up and I was in. The last time I tried Knoppix, I could only get a color depth of 16 colors. It appears that I have everything now at a descent resolution. I was even able to save a personal configuration file to my iPod so that it can remember a few of my preferred settings.



I’m still looking around, but I have already seen that the Mono development environment is here. I had also told bit torrent to download monoppix after it completed Knoppix, but it may have been all for nothing. I haven’t seen MySQL yet. I thought I had seen a file related to it in the root directory when looking at the contents from windows.

Audacity is installed here as well. I have used that program for podcasting in the past. Well, I’m going to muck around a bit more. This is really nice.

Bandit

Monday, September 26th, 2005


Out of five kittens rescued last week, Bandit is the only survivor of his litter. His last sibling was euthanized this morning. All of the kittens came down with a respiratory illness. We had thought that the last two were really pulling through fine until I was woken up last night.

Bandit is very small. He shivers a lot and I don’t know if it is too cold, or if he is frightened or sick. Angel watches over him constantly and makes sure he gets his medicine and special milk. She has a warm rubbery water pack that she lets him lay on to keep him warm.

He let me get a few pictures without a flash, but started to become picture shy.


Bandit

A rescued foster Kitten

Sad little Bandit

We are hoping for the best for this little guy. Every day that passes brings with it a better chance for him to survive. He is very adorable.

Tags: , , , ,

Knoppix

Monday, September 26th, 2005


Many people would like to try out a different operating systems, but they don’t want to install it over an existing system already in place. Others just might not have a spare computer to toy with. And then there is me. I’m just too lazy to go through the hassel of installing another OS.

Knoppix is one operating system that I find quite handy to use when I want to toy around with Linux. You download an ISO file, burn it to a CD/DVD and boot up your computer with the disc in the drive. There is no installation. Everything runs rite off the disc.

Knoppix has everything. It has your graphic art programs, programming environments, web browsers, document editing software, email, games, and more. And when you are done, just eject the disc and reboot. You are back to using your original operating system as if nothing ever happened. Afraid of viruses? Worry no more! With Knoppix, you just reboot the system.

A few days ago, they came out with version 4.0.2 on DVD and a “Lite” CD version. The DVD version has over 3.5 GB to download, but you can buy an actual disc if you don’t have the bandwidth. The CD version may only be able to hold about 600 MB, but the Knoppix folks use compression to fit 2 GB of data within that small space.



Tags: , ,

RSS for VA Bloggers

Monday, September 26th, 2005


I maintain a small directory of blogs in Virginia. I decided to give this directory a little RSS feed so that people could load it up into there news feed programs. Now when a new site is added, you don’t have to go to the directory to find out about it.



RSS Feed

Validate my RSS feed

Tags: , , ,

Dollar Days

Sunday, September 25th, 2005


My mother in-law came over today with the kids. We took off and went to Rent-A-Center and found that they were closed. We were going to go home, but a certain individual in our party wanted to go to the toy store. We decided to set our destination towards Mr. Dollar.

We went through the aisles and my niece would pick out something here and there. We walked out with a sheet of Halloween Stickers, foam letter block puzzles, a bubble set, and a white teddy bear with a heart.

I had some fun blowing bubbles with the kids until most of it was spilled. We played with what little solution we had left and then went back inside and played on the Atari Flashback 2.

Mom had brought over the two kittens that had survived from a respiratory illness so that they could get some of there shots. After she came back with Angel, we ordered Chinese food.

Tags: , , , ,