Hard Drive Needs Defragging

My old hard drive needs defragging. Look at all the red in the defrag analysis below:

Degrag Analysis

I’ve ordered a 100 GB hard drive on Amazon but I don’t want to copy over all these fragmented files. I downloaded PerfectDisk 7.0 because the Windows 2000 built-in degragger does not do a very good job. The demo version of PerfectDisk 7.0 will allow me to defrag this drive until I get my new hard drive.

Posted in General | Leave a comment

Hard Drive Went Bad

My 80 GB hard drive went bad on me today. I have lost some of my email, data, and work from 6/17 thru 7/13. Fortunately I never put Linux on my old 40 GB hard drive like I intended to do so I have simply reverted back to that. I bought this hard drive from Computer Geeks at http://www.geeks.com with a 90 day warranty and it went bad in a month so they better give me a refund or a replacement.

Posted in General | Leave a comment

Problem Solving Skills: Verify The Solution

Working in the Information Technology field really develops your problem solving skills and requires you to think logically. One of the most important steps in quickly solving a problem is to test your assumptions.

Technical errors are sometimes quite cryptic. Many problems are cryptic because you are unable to reproduce an error that was reported by a client. This uncertainty concerning a technical problem usually requires an initial educated guess. At first you might guess that there really isn’t a problem. One of the worst assumptions you can make is to assume that there is a technical problem when in fact there is just user confusion.

You might also assume that the problem is due to the web browser the client is using. If somebody is using an old browser like Netscape Communicator then they might see odd display problems that you won’t see in Internet Explorer. This is often the cause of some really perplexing JavaScript errors that you can’t track down until it dawns on you that need to look at it in another browser.

Other times it is the database that can cause confusion. If you maintain a development web site and a production web site which use separate databases then you need to be aware of the possibility that the data has become out of sync between them. A record may be missing from your production database and cause an error to be reported. If the record is not missing from your development database you won’t be able to reproduce the error. You will be initially puzzled until you question your assumption that the data is the same.

In addition to questioning your assumptions about the nature of the problem and the factors involved, it is vitally important that you do not assume the problem is solved after you correct some technical issue. You always need to test your solution to make sure the problem is really fixed. Time and again I’ve thought I’d tracked down the problem and reported it solved to the client only to have them tell me that they are still getting the error. I’ve learned that you need to verify the solution yourself before telling anyone that it is fixed. This last assumption, that you’ve fixed the problem, is the most important one to question. Test the application and make sure you don’t get the error.

Posted in General | Leave a comment

DSL Connection Woes

I’ve been having a lot of problems with my Verizon DSL line. I keep losing my Internet connection. Today I moved all of my computer equipment into another room to be closer to the phone jack and to use a shorter phone line. I think this has solved the problem.

I have a much bigger desk in this other room which gives me plenty of room for my scanner, MIDI keyboard, drawing tablet, and two printers. My desk was getting crowded in the previous room!

Posted in General | Leave a comment

Hard Drive Upgrade

Today I upgraded my hard drive from 40 GB to 80 GB. I used PowerQuest’s Drive Copy 4.0 to transfer the operating system and data from my old hard drive to my new hard drive. I made the new hard drive a slave drive for the data copy and then changed it back to a master drive. I did not have to reinstall anything.

I may use the old hard drive for a new version of Linux. My master drive is a removable hard drive so I can swap out drives to run different operating systems on the same machine. I currently run Windows 2000 Professional, Windows XP, and Mandrake Linux on this system.

Posted in General | Leave a comment

StoreFront 6.0 URL Rewriting

I have a small project involving converting web addresses like category.aspx?id=6 into more search engine friendly web addresses like category6.aspx or even better sports_memorabilia.aspx. Search engines don’t like dynamic web pages with their lengthy query string values and would prefer a web address to a static web page with a HTML file extension. There are URL Rewrite server components that can trick search engines into seeing HTML static web pages that are actually dynamic web pages which just had the URL rewritten. www.caraccessories.com uses a URL Rewrite server component. Unfortunately, these URL Rewrite server components need to be installed on the web server and even worse, you need to restart the web services for any changes to take effect!

Recently I discovered a better way to do this for ASP.NET web applications. For an ASP.NET web application, you can rewrite the URL in the Application_BeginRequest subroutine of a global.asax.vb file. This works quite effectively for StoreFront 6.0 although you still need to use ASPX for the file extension instead of HTML.

Posted in General | 1 Comment

C# Recursion – File Processing

I have made an important improvement to my C# script that parses an entire web application for significant code. I have added the ability to parse subdirectories using a recursive function. This was necessary because not all web applications keep all their scripts in one directory. Many web applications try to organize the scripts by using subdirectories. My C Sharp script needed to parse all the files in the root directory and then move on to parse the files in all the subdirectories. It does this by using a function to process a directory and then recursively calls that function for each subdirectory within that directory.

I use my C# script to search web application files for SQL statements; INSERT INTO, DELETE FROM, and UPDATE SET kinds of SQL Statements. I get a list of table names from the database information schema and then plug that table name into the SQL statement fragment in order to find the web application files that are adding records, deleting records, or updating records in that table. This gives me a very useful report on the web application design. I even output the line numbers where the SQL statements can be found. It saves me a lot of time when I need to search through the code of a web application that I did not create.

Posted in General | Leave a comment

Williamsport News Feeds

I’ve gathered all the local news feeds I can find into my BlogLines account. BlogLines lets you see how many subscribers a feed has and for many local news feeds like the Williamsport Sun Gazette, I am the only subscriber. Of course, this does not mean that their RSS news feed doesn’t have other subscribers who are using other RSS feed readers.

The local feeds that I found include; Newswatch 16 (a local TV station), the Williamsport Sun Gazette, PCToday (the local community college), the Times Leader (a newspaper in Scranton), and my own blog feed which I added because you need a least one BlogLines subscriber to get your blog or feed in the BlogLine directory. Being the only subscriber to the Sun Gazette news feed means that they have me to thank for their inclusion in the BlogLines directory.

My BlogLines Feeds

Posted in General | Leave a comment

PHP Secure Administration Scripts

I have written some code to secure the database administration scripts I use to manage my books database. Now my simple web application has a log in page and you cannot access any other pages without a valid log in. All of the database administration pages are written in PHP and they allow me to manage a table in this web site’s MySQL database.

I could not write my code as elegantly as I would have liked. PHP handles sessions in a peculiar fashion and I had to set the directory where it can save a file for a session. I did not like that. ASP does not use files to manage sessions. Now I have a directory that is collecting files every time I start a session.

Also, the PHP method for doing a redirect does not work very well. It was doing the redirect regardless of the condition that my code was testing. I had to use JavaScript to change the window location.

It works but I plan to spend some more time trying to improve the code because this is a fairly typical requirement for any web application.

Posted in General | 2 Comments

Universal Data Link Wikipedia Entry

Today I came across something I never heard of before, the Microsoft Universal Data Link (UDL) file type. It is used for database connections. I tried to look it up on Wikipedia but they did not have a page on it so I decided to create my first Wikipedia entry.

Wikipedia UDL page

Wikipedia is a free online encyclopedia which anybody can edit. It has thousands of people contributing encyclopedia articles so it is a major repository of information. Unlike traditional encyclopedias it is being constantly updated and contains current information and articles on very obscure subjects. There has been some controversy over the authority and accuracy of the articles which anyone can edit and corrupt but I think the collective knowledge of thousands of people is better than the knowledge of select experts.

Posted in General | 1 Comment

More Web Applications Installed on my Mandrake Linux Server

Tonight I installed two more web applications on my Mandrake 8.2 Linux server. These web applications finally give me a reason to use my Linux system. And I am gaining experience in installing the types of web applications that are typically deployed by web developers. The web development company that employed me did not encourage the use of Linux or open source web applications. They are really behind the times but now that I’m cut loose from them I don’t intended to limit myself in my expertise.

First I installed phpBB, a bulletin board system that is so popular that I’ve already used it many times as a user. It was the easiest PHP application to install. I didn’t run into too many problems. You do need to delete the install and contrib directories before it will allow you to log in. Also I was unable to log into the administration menu until I changed my server name.

In the screen shot below you can see that it is complaining that the config.php file can’t be written but at least it offers to download the file someplace rather than giving me an error.

phpBB Installation

It did shut me out of the Administration menu for quite a while until I figured out that my browser was just having problems with the server name which needs to be localhost because this system cannot resolve any other DNS name.

phpBB Administration

After installing phpBB I installed WordPress 2.0.2 which is now one of my favorite web applications. I’ve used Blogger before for very occasional blogging but I didn’t really get into blogging until I was running a blog on my very own web site. WordPress did not give me many problems except for the fact that my download was corrupt. I had to use Firefox to download a good file. Unfortunately my linux server is cut off from the Internet so there is not much point in running a blog on it:

WordPress

Posted in General | Leave a comment

Dot Net Nuke and Crystal Reports

Last night I installed Dot Net Nuke 4.0.2 on my system. It gave me almost as much trouble as a Linux web application install. The two aspects I found tricky were renaming the release.config file to web.config and then updating the database connection string in two places in the web.config file instead of just one place. Dot Net Nuke has been on my radar for awhile now. It is an ASP.NET web application framework that many web developers like to use because it gives them much of the functionality they would need to create from scratch if not using DNN. However I come across a lot of uncompleted projects that were started using Dot Net Nuke. I get the impression that developers use it to give the impression that a project is well under way and then they abandon the client. Customizing Dot Net Nuke for the specific functionality a project requires is probably very difficult and developers either bail at that point or find other work and leave a project that the client finds difficult to get completed.

I also played around with Crystal Reports. Crystal Reports has been in Visual Studio.NET for a long time but I never looked at it. I’m not particularly impressed. I don’t like the report formats or the report design tools. I would rather create my own reports using HTML and make them as plain or fancy as I please. I don’t like to fiddle with imprecise positioning of window boxes and text controls in Visual Studio’s terrible design view.

Posted in General | Leave a comment

Blogging For Dummies Book Review

Tonight I finished reading Blogging For Dummies by Brad Hill. Amazon recently added it’s very own version of the blog called the plog which allows writers to have a blog on Amazon targeted to their readers. If you have bought a book by the author you will automatically see their blog on Amazon. Naturally Brad Hill was quick to pick up on this because he is supposed to be an expert on blogging so he has a plog.

Surprisingly his book only has two Amazon reviews right now. I always make the effort to write an Amazon review of a book I’ve read because I’ve heard these reviews are read by authors and publishers. I like to review the obscure books I’m reading and I try to write really intriguing reviews. It is fairly easy to contact an author directly by e-mail so I probably shouldn’t waste my time on this indirect contact method.

Any way, the Blogging For Dummies book was worth the money because it gave me lots of web addresses and resources to check out. It should be of some value in promoting my business through blogging. Being a geek, it could have been more technical for me.

Posted in General | 1 Comment

Installed phpMyAdmin On Mandrake 8.2 Linux

I’ve found it easier to install web applications on my Mandrake 8.2 Linux system which is running Apache-AdvancedExtranetServer/1.3.23 and PHP 4.1.2. I recently installed phpMyAdmin 2.8.0.3 with only a few minor problems, mostly in editing the config.inc.php file and then changing its permissions. Use this command to change its permissions after editing the file: chmod 664 config.inc.php. Here are the lines in the configuration file that I changed. It is safe for me to post this on the Internet because my Mandrake 8.2 Linux system has no Internet access. I have to figure out how to get it to connect to Verizon DSL.

$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address
$cfg['Servers'][$i]['port'] = '3306'; // MySQL port - leave blank for default port
$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mysql.sock'; // Path to the socket - leave blank for default socket
$cfg['Servers'][$i]['connect_type'] = 'socket'; // How to connect to MySQL server ('tcp' or 'socket')
$cfg['Servers'][$i]['extension'] = 'mysql'; // The php MySQL extension to use ('mysql' or 'mysqli')

Here is a screen shot of phpMyAdmin which I managed to take using Ksnapshot.

phpMyAdmin Screenshot

Posted in General | Leave a comment

Corel Linux Upgrade Woes

Over the weekend I tried to upgrade my Corel Linux system for PHP 4.0. Unfortunately I was unable to accomplish this because Corel Linux is so obsolete. All I managed to do was upgrade Apache from 1.3.3 to 1.3.35 and PHP from 3.0.5 to 3.0.16. I did document my Apache HTTP server configuration file, httpd.conf, in my notes and gained some experience but it was extremely frustrating. I ought to scrap my Corel Linux system but everything works and it took me a long time to get it that way. I have the Linux version of WordPerfect Office 2000 Deluxe installed on that system. It includes WordPerfect and Paradox 9.

My other Linux system is Mandrake 8.2 which is much better. Unfortunately it is installed on a removable hard drive for my best PC which means I have to swap out my Windows 2000 Professional hard drive for that one. So it requires a lot of hard drive swapping to work on Mandrake 8.2. If I had more disk space I could run Mandrake 8.2 as a virtual server.

Posted in General | Leave a comment

X Bitmap Format

The XBM image format is a simple image file format that can only be used for black and white line art. But the cool thing about XBM files is that you can create them through JavaScript. This means you can add an image to a web page without using an image file. Instead the image is text within the HTML source code. Although black and white line art isn’t very fancy it does have the advantage of not allowing the user to right click on the image to save it.

The following sample code will create a little trash can icon but it does not work in Internet Explorer. Try to view this in Firefox instead. I was unable to get an example to work properly in this blog entry. You will need to create your own web page.

<HTML>
<HEAD>
<TITLE>XBM Image Format</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<script type="text/javascript">
var strXBM = "#define trash_width 16\n"
strXBM = strXBM + "#define trash_height 16\n"
strXBM = strXBM + "static char trash_bits[] = {"
strXBM = strXBM + "0x00, 0x01, 0xe0, 0x0f, 0x10, 0x10, 0xf8, 0x3f, 0x10, 0x10, 0x50, 0x15,"
strXBM = strXBM + "0x50, 0x15, 0x50, 0x15, 0x50, 0x15, 0x50, 0x15, 0x50, 0x15, 0x50, 0x15,"
strXBM = strXBM + "0x50, 0x15, 0x10, 0x10, 0xe0, 0x0f, 0x00, 0x00};"
</SCRIPT>

<H1>XBM Image Format</H1>
<IMG SRC="javascript:strXBM">
</BODY>
</HTML>
Posted in General | Leave a comment

Information Schema

Yesterday I blogged about how to document a MySQL database by a rather involved process of importing the database into SQL Server and then Microsoft Access. Actually you could simply use phpMyAdmin 2.5.0 to display the same information by clicking the Structure and then the Data Dictionary links. However importing a MySQL database into SQL Server and Microsoft Access is still a useful task.

phpMyAdmin 2.5.0 probably queries the information_schema table to obtain its information about the database design. The information_schema is a special database table that contains data about all the other databases and tables on the database server. Querying the information_schema table can be very useful for dynamically generating code. You could construct tedious INSERT and UPDATE SQL statements or stored procedures based on this information. I have found the correct syntax for running information_schema queries on SQL Server and MySQL:

SQL Server Queries

SELECT table_name FROM information_schema.tables WHERE table_catalog = ‘dbName’
tables in a database

SELECT column_name, data_type, numeric_precision, character_maximum_length,is_nullable, column_default
FROM information_schema.columns
WHERE table_name = ‘tableName’
columns in a database

MySQL Queries

select table_name, create_time from information_schema.tables where table_schema = ‘books’
tables in a database

select column_name, data_type, numeric_precision, character_maximum_length,is_nullable, column_default from information_schema.columns where table_name = ‘reading’
columns in a database

Posted in General | Leave a comment

How To Document A MySQL Database Design

My blog software is WordPress which is using a MySQL database. My task is to document the database design. Let us see how I accomplish this goal.

My first step is to back up the database because I need a local copy to work with. I log into phpMyAdmin 2.5.0 and export the database as a SQL text file. There is no need to describe this step because it is well documented on the Internet. This gives me a phpMyAdmin MySQL-Dump file which reveals the database design but not in a format I find very readable.

Next I want to import the database backup into my local MySQL Database Server. First I need to create the database “wordpress”, then I use the MySQL Administrator’s Restore option to restore the database using the SQL file, making sure the target schema is my new database and the checkbox “Create database(s) if they don’t exist” is checked.

Then I download and install the ODBC driver for MySQL. You can get it here: http://dev.mysql.com/downloads/connector/odbc/3.51.html I want to create a SQL Server database version of the WordPress MySQL database so I create a new SQL Server database and start the DTS Import / Export Wizard.

Because I installed the ODBC driver for MySQL I now find a new option in the data source drop down list:

MySQL-DTS-Import-Export

When I select that option I discover that I need to create a Data Source Name for the MySQL database I want to import:

MySQL Data Source Name

I click the Test button and find I can connect to the database:

Success; connection was made!

When I attempt to import all the tables, I get 11 tables copied but 2 show errors:

DTS Import Status

There was an error importing the wp_links table Error at Destination for Row number 1. Errors encountered so far in this task: 1. Insert error, column 11 (‘link_updated’, DBTYPE_DBTIMESTAMP), status 10: Integrity violation; attempt to insert NULL data or data which violates constraints. Unspecified error

wp_links error

And an error importing the wp_users table Error at Destination for Row number 1. Errors encountered so far in this task: 1. Insert error, column 13 (‘dateYMDhour’, DBTYPE_DBTIMESTAMP), status 10: Integrity violation; attempt to insert NULL data or data which violates constraints. Unspecified error

wp_users error

To solve these errors I just edit the SQL Server database design for these tables and allow these fields to accept NULL values:

wp_links NULL

wp_users NULL

Then I attempt to import just these two tables again and this time it works:

Executing Package

Since that went pretty well I attempt the same thing with Microsoft Access. I try to import the MySQL database using ODBC Databases as the file type and select my data source name which already exists now. Unfortunately Microsoft Office Access has a problem and needs to close:

Microsoft Office Access has encountered a problem and needs to close.

Since that does not work I just export my SQL Server database to my Access database which succeeds with no errors:

Sucessfully copied 13 table(s) from Microsoft SQL Server to Microsoft Access.

Now that I have all my tables and data in Access I can document the database design using its documentation wizard. Select Tools from the menu and then select Analyze and then Documenter. Click the Select All button and then the OK button.

Access Documenter

Now I can export the table design reports as web pages so you can view them online. Select File from the menu and then Export. Select HTML as the “save as type”. The table design reports will be exported as web pages complete with navigation links. You can view the talbe design of the MySQL database used by the WordPress blog here:

http://www.williamsportwebdeveloper.com/design/wordpress_db.html

Posted in General | Leave a comment

C# Object Oriented Programming

Tonight I started learning the Object-Oriented Programming aspects of C#. I’m reading the free online chapter of Microsoft Visual C#.NET 2003 Kick Start by Steven Holzner at http://www.samspublishing.com/articles/article.asp?p=101373&seqNum=6

Web development is based on scripting languages, JavaScript, VBScript, PHP, Perl so you don’t learn much OOP doing this kind of programming. I have some grasp of the general concepts but I need to learn the details and start creating some classes.

Posted in General | Leave a comment

C Sharp for ASP.NET

Today I download the MySQL Connector/Net, an ADO.NET driver for MySQL, and wrote a C# ASP.NET page to connect to my books database. I now have 13 topics on C# in my Notes.chm compiled help file. An extensive language reference is available in the Visual Studio help system but I prefer to keep my own notes. Microsoft isn’t going to provide any information on MySQL and their code examples aren’t always that helpful. What they should do is build in a method of annotating their help system. It would be cool if I could add my notes to that.

I don’t blog enough about my network administration skills. I recently bought a Manual Data Switch from TRIPP LITE for connecting two printers to one PC. I have a laser printer and an inkjet printer for envelopes. I hate having to switch my one printer cable. Unfortunately, I need a pass-through serial cable to connect the data switch to my LPT1 printer port. I thought I had the right cable but when I looked up the part number on the Internet I discovered that it was a 25 pin serial cable for transferring data between two PCs. I don’t know why I ever bought such a cable. I never used it so I didn’t know what it was. However I consider myself to be a clever fellow because my cable would not work and I found out why by looking up the part number. It would have been a mistake to assume the data switch did not work. I’ve learned not to make assumptions when troubleshooting computer problems.

Posted in General | Leave a comment