Tag Archives: Programming

WordPress plugins

WordPress is the software I run this, and several other websites on. One reason I like WordPress is it’s plugin structure. Plugins add features and functions to your website. Here are my favorites:

All In One SEO Pack is a complete search engine optimizer. It combines the best practices in search engine optimization, in one simple to use package, including keywords, page descriptions, title updates and many other features.

Google XML Sitemaps creates sitemaps.org compatible sitemap of your website, which makes it easier for Google, Yahoo, ASK.com and MSN to find web pages on your website.

Ultimate Google Analytics inserts Google Analytics code into your website, without having to modify your WordPress templates. Google Analytics is a website statistics package that tracks traffic sources, web hits and a wealth of information about the people are on your website. I prefer it to WordPress Stats.

FeedBurner FeedSmith redirects all RSS readers to FeedBurner.com. FeedBurner is a great way to track and manage your RSS subscribers. Since FeedBurner is serving up your RSS feeds (instead of your web host), it lightens the load on your website.

Sociable automatically adds links on your posts and pages to popular social bookmarking sites (Digg, Del.icio.us, StumbleUpon, Technorati and many, many others). It’s another great way for readers to find you.

WordPress Database Backup is On-demand backup of your WordPress database. You should backup your database on a regular basis and before major upgrades and this plugin makes it a snap.

There are plenty of other fine WordPress Plugins, these are the few that I almost always install

Learn to program with Scratch


There isn’t anything better to learn the concepts of programming than Scratch, a GUI based, programming kit from MIT. It’s like programming with Lego Blocks!

I started programming with BASIC, FORTRAN and COBOL in the 70s, and I have programmed in C, C+, Pascal, COBOL, FORTRAN, PERL, Assembly and all kinds of scripting languages. Noting is more frustrating than having to look up how to put something together in a language you don’t know. You spend all your time looking in reference manuals.

Forget Object Oriented programming languages for learning. Not only do you have to learn the language, you have to learn the object library.

That is not the case with Scratch. Everything you need to know is on screen. You just drag the programming elements into program execution area and click them together.

You can build multi-threaded programs in minutes! You will very quickly learn the concepts like FOR LOOPS, WHILE LOOPS and IF THEN statements, and be ready for other languages like Pascal or VisualBasic, then move on to more challenging languages like PERL, with it’s super-powerful pattern matching regular expressions and advanced Object-oriented languages like C++, Java or Delphi.

You should start out by trying to write simple games. Nothing will teach you more. You will have to let the player have a turn, computer have a turn, display information on the screen and save data.

After writing games in high-school, I got my first job programming. The tech manager wanted to teach me about finite-state machines. I realized it was the same way I had coded my games. The only thing I would have gotten from a college degree would have been the names of what I already knew.

So, get Scratch, write games, have fun. You’ll be surprised what you will learn.

Internet Explorer 6 CSS bug, margins, padding and how to fix it.

I ran into a bug using the Zeke template for WordPress . Zeke is a very nice 3 column theme by Michael D. Pollock.

There isn’t an easy way to implement 3 columns in CSS and Zeke does it as two, two column groups.

#wrap , 960px wide

#contentleft, float left, within #wrap

#contentPost (s)float left, within #contentleft #midcontentfloat right,within #contentleft
#rightcontentfloat rightwithin #wrap

The theme was working just fine with FireFox and Internet Explorer 7, but Internet Explorer 6 was not. The middle column, #midcontent, was sliding to left, just enough to cause the Post (s) to slide down below the entire middle column.

There is a well know bug in Internet Explorer 6 in the way it renders content that floats, when it’s contained within floating content. According to this link, IE6 doubles the margins. The Zeke WordPress theme doesn’t use much in the way of margins and the “display: inline;” fix mentioned in the article didn’t work.

I noticed that Zeke does use quite a bit of “padding” and discovered that IE6 was indeed getting the padding wrong.

According to this website (and others) it is possible to have CSS tags that IE6 processes and other browsers ignore, just by placing a _ in front of the tags. I was able to copy the “padding” line for #midcontent and create a new line that only IE6 would process, without the padding on the right.

Edited to add:  You need both padding: and the _padding: lines in your #midcontent section.

See the code below:

#wrap {
padding: 0 5px;
clear: both;
width: 960px;
margin: 0 auto;
#contentleft {
width: 680px;
float:left;
padding: 0;
margin: 0;
}
#content {
width: 499px;
float: left;
margin: 0 1px 0 0;
padding: 0;
}
#midcontent {
width: 160px;
float: right;
margin: 0;
padding: 10px 10px 15px 0;
_padding: 10px 0px 15px 0; /* this did the trick. Only IE6 should process this line */
}
#contentright {
width: 250px;
float: left;
padding: 15px 0 15px 15px;
margin: 0;
}

Now, everything is working great!

HD-DVD decryption keys in the news

There are posts on it at Zedomax, Digg.com and The Edge of I-Hacked. Click here to Google it…

I have read that Toshiba has sent a “cease and desist” letter to people posting the key on the web. I’ve tried to verify that information, but can’t actually find the pages, only links to pages that should be there.

This all reminds me of when 2600 Magazine linked to the program to decode DVDs. The U.S. courts ruled that 2600 couldn’t link to the actual program and couldn’t post the actual program. Shortly later, websites popped up that gave the information, without actually giving away a program that would do it. 42 ways to distribute DeCSS was my favourite website. They had it in the comments of a GIF, in the web page comments, written in a programming language that didn’t exist and even a DeCSS T-Shirt. I still wear mine.

What is ironic here is that this code is actually on HD-DVDs, so it’s can’t be a secret. It’s like using a hide-a-key for your car, having someone posting that fact on the web and then trying to get them to stop posting. Once the information is out there, it takes on a life of it’s own.

Information is dead, long live information.

SmallBASIC

SmallBASIC is a free, cross platform BASIC on SourceForge. SmallBASIC runs on Windows, Linux, DOS, PalmOS and Nokia 7790. It is a great tool to teach programming or just for tinkering.

I have it on my home computer and on my Palm Pilot. I originally downloaded it to teach programming to my kids. Instead, I have been playing with it. Once I start working on a program, I don’t like to stop. I keep thinking of new features to add or ways to make it work better.

That’s OK, the kids have been more interested in finding guitar tabs on the internet and playing the flight simulator than programming.

If you enjoy programming, SmallBASIC is almost too much fun.

Autorun TrueCrypt from a USB drive

TrueCrypt is free open-source disk encryption software for Windows Vista/XP/2000 and Linux. I use at work and at home.

Edited to add:

  • These instructions were written for version 4.3a and will work for version 6.0.
  • I also have an easy to follow HowTo using TrueCrypt’s built in “Traveling Disk Setup”
  • Additional information on making AUTORUN work…

It is possible to install TrueCrypt to a USB drive with an AUTORUN.INF file so that you have a self-contained, encrypted, portable storage.

Here is what I get when I insert my USB drive.
truecryptmount.jpg

I can just select “Mount TryeCrypt Volume” enter my password and begin working.

truecryptfiles.jpgWith the version I am using, I installed TrueCrypt to my machine, then copied TryeCrypt.exe and TrueCrypt.SYS to the root directory of the USB drive. I then used TrueCrypt to create a large file in the root directory of the USB drive called MyData.tc.

The last step was to create the AUTORUN.INF file below. Note that the my example mounts the TrueCrypt volume as drive I:. To change the letter, change the /li and /di parameters to meet your needs.

AUTORUN.INF

[autorun]
label=MyData
icon=truecrypt.exe


action=Mount TrueCrypt Volume
open=truecrypt /v MyData.tc /li /q /a /m rm /e


shell=mounttc
shell\mounttc=&Mount
shell\mounttc\command=truecrypt /v MyData.tc /li /q /a /m rm /e


shell=dismounttc
shell\dismounttc=Dismount
shell\dismounttc\command=truecrypt /di /q


shell=runtc
shell\runtc=Run TrueCrypt
shell\runtc\command=truecrypt

I used to dislike anything that “AutoRan” when I put the disk in the computer, now that I can make my own AUTORUN.INF files, they are cool!

If you are looking for more information, Microsoft Developer network (MSDN) has an article, which covers all the options in a AUTORUN.INF file and DailyCupofTech an article AUTORUN.INF Tweaking.

A number of people (including me) have had trouble with Autorun NOT working. First, make sure you have the latest patches and drivers.

Then, go into the registry with REGEDIT (Start->Run->RegEdit)

Look at this information:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\CDRom

If this is 0 (Zero) set it to 1 (One)

Then check (Windows 95 through XP, not Vista)

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\NoDriveTypeAutoRun

If this is 149 (0x95 hex) set it to 145 (0x91 hex)

For details on the above information, check out document, KB 330135. It details things to try when AUTORUN or AUTOPLAY do not work and document, KB 136214 which details the second registry edit.

http://support.microsoft.com/kb/330135

http://support.microsoft.com/kb/136214

Microsoft has more hits than I can catalog when searching for AUTOPLAY at search.msdn.microsoft.com

http://search.msdn.microsoft.com/Default.aspx?query=autoplay&brand=msdn&locale=en-us&refinement=

 

I did have a machine that never ran my AUTORUN file. I eventually made it into a print server…

Autorun a personal Wiki from a USB drive

Last week, Lifehacker listed EverNote as the download of the day. EverNote reminds me of the Newton interface, often described as an endless roll of toilet paper. Some of the drawing tools were similar also. I was really excited with the possibilits, but was not going to pay for the Pro version, just so I could sync to a USB drive and carry my database with me.

I did a little bit of looking around and found this: TiddlyWiki a self contained wiki. It’s a wiki website and the software to edit the website, all stored neatly in ONE file.

I can use this to build a database of interesting stuff. It’s like having Google Notebook in your pocket.

To make it even easier to use, I built an autorun.inf file on the USB drive, to open the TiddlyWiki everytime I inserted the USB drive.

First, I saved an empty TiddlyWiki to my USB drive as AllMyNotes.HTA. I saved it as an HTA rather than an HTML due to the way XP service pack 2 handles HTML files vs HTA. As an HTA, AllMyNotes opens in an explorer window without the usual IE controls, giving lots more screen space. Next I found an icon file I liked (Google: Free Icons) and saved it to the root of the USB drive as Notes.ico Last, I created the autorun.inf file.

Autorun.inf

[autorun]
action=Open AllMyNotes
icon=notes.ico
label=Eric's Notes
shellexecute=AllMyNotes.hta

Now, when I insert the USB drive I get this menu:
autorun.jpg

When I click on the top item, my Wiki opens up. Cool. Tiddlythemes.com has a collection of alternately styled TiddlyWikis.

It takes a little time to get used to how Wikis work, but once you get the hang of it, it is super easy to start building your own Wiki.

Optimizing Windows XP on an older machine

I have a new laptop at home, thanks to a friend of mine. It is an HP Omnibook XE GD. 850 Mhz AMD Duron, 256M RAM.  In the spirit of keeping it green, it’s a hand-me-down of a hand-me-down and I’m proud to have it.  I was able to load Windows XP without any trouble and it works quite well.

I’ve read a few web site with tips on Optimizing and Speeding up Windows XP, including:

There is a lot of information out there, some more useful than others. Here is what works best for me. Nothing on this list requires registry edits (RegEdit). These are all things you can easily do.

When mechanics build race car, they remove what they don’t need, then build up the suspension and chassis, re-tune the engine and put on racing tires. We’re going to do that to XP…

We don’t want the computer doing anything it doesn’t have to. Begin by getting rid of computer viruses and spyware. If you have anti-virus software, make sure it is up-to-date and do a full system scan. Clean off anything that is found.

If you do not have anti-virus software, go to TrendMicro.com and look under “Home & Home and Office” for the Free Online Housecall Scan. This will download some software to your computer and scan it. It does not leave behind a program that monitors your computer, it is a one-time scan. This is ideal, because once the scan is complete, it will not keep running, wasting CPU time.  An alternative is the open source ClamWin.  It doesn’t scan real-time, but is great if you want to scan “right now”.

If you WANT to have continuously running anti-virus software, AOL is giving away Active Shield (from Kaspersky) if you sign up for a free e-mail address. Go to www.AOL.com, scroll to the bottom and click on the Anti-Virus link. I installed this on my wife’s 200Mhz machine and it is hardly noticeable. This is no longer available.

Do NOT use “Complete” security suites. They usually do way more than you need and they keep the computer busy doing it. All you really need to add to XP is a little anti-virus software. The firewall built into XP is more than adequate. If you use Firefox browser and stick to your normal websites and don’t open e-mail attachments, you should be able to keep your machine relatively free of viruses and spyware.

Spyware blockers are bad news. They don’t really help you. The spyware is still running, battling it out with the blocker inside your CPU. Get rid of the spyware, then get rid of the spyware blockers. TrendMicro’s Housecall and AOL’s Active Virus Shield both do a great job of getting rid of spyware, but if you want a little extra reassurance, go to www.safer-networking.org and get a copy of Spybot Search & Destroy. It will scan you machine and remove the spyware. Spybot S&D has an immunize feature, but it will just slow you down. Once you are clean, you can remove the Spybot S&D.

Next, get rid of programs you don’t use. Every extra program and add-in either takes time when the system boots, or CPU time when it is working.

Programs to uninstall: Toolbars from Yahoo, Google, AOL and any others. You shouldn’t need more than one toolbar and if you use FireFox, you shouldn’t need any.

Screen Savers. There are lots of fun/free screen savers on the Internet. Most will take CPU time. Just set the power management to turn off the screen. You will blank your screen and save electricity also! If you want it password protected, select the Blank screen screen saver.

Remove Yahoo Widgets, Google Gadgets, Desktop Sidebar, Rocket Doc Weather Bug. Yes, they are fun, but with them, my system booted slower and ran slower. If you need a launcher, use the Quick Launch Toolbar. You can even move it off the TaskBar and to the screen edge.

Click Start->Control Panel->Add Remove Programs and start removing!

OK and Reboot when done.

desktop.jpgTune-up Settings: If you are using Wallpaper, remove it. If you have many icons on you desktop, get rid of them. Every time you open, close or move a window, the CPU has to redraw everything, including the desktop. If you clean off the desktop, there is less work for the CPU to do.

Start->Control Panel->Display-Desktop and set the background to None. OK

Since you are in Control Panel, disable all sounds. Start->Control Panel->Sounds and Audio Devices->Sounds and select the No Sounds theme. OK.

Now, we are going to trim down some of XPs visual effects.

Start->Control Panel->System->Advanced

Uncheck things labeled “Animate” “Fade” or “Slide”. I like to leave ON:

  • Show shadows under menus
  • Show shadows under mouse pointer
  • Show windows contents while dragging
  • Smooth edges of screen fonts
  • Use visual styles for windows and buttons

Now that we’ve removed anything we don’t need, we need to delete junk files and cleanup the registry.

The freeware CCleaner is a great little (2.6 meg) utility for this job.  I’ve used it on a few machines now and am quite happy with the results.  I use it to clean the C drive and to cleanup the registy.

If you don’t want to download CCleaner, you can use Windows Drive Cleanup: Open your My Computer (Windows key-E) right click the C: drive, click Properties, click Drive Cleanup. Click Temporary Internet files, Offline Webpages, Recycle Bin, Temporary Files, Temporary Offline Files, Offline files.  Click OK. This won’t make the system faster, but you should do this before you defragment the drive. To defragment, open your My Computer (Windows key-E) right click the C: drive, click Properties, click Tools, click Defragment Now, click Defragment.

Do NOT adjust the page file settings. It won’t make your system better and it can cause problems. The same is true of memory/cache optimizers. I have yet to find one that makes an improvement.

Keeping it Fast: Do NOT install software you don’t need! If you like to download and install trial software, do it on another computer, not your main computer. Installing software loads entries in the Registry and there isn’t a way to clean the registry. Once the registry gets messy, the only way to speed the machine is to backup your important files and reinstall everything. Don’t even think of trying RegClean, it was made for Windows 95!

While these tips won’t turn every computer into a race car, it will help you tune up an old machine and keep it running. The longer you can keep it running, the longer it will stay out of the landfill…

Are we there Yet?

Transitioning from Netfirms.com to MyHosting.com was amazingly simple. Ericsprojects.com is running on WordPress for the blog and Coppermine Photo Gallery (CPG) for the photo albums. Both use SQL databases to store the information, so the process involved was to export the databases, copy the website files to the new host, then recreate the databases.

Both WordPress and CPG use MySQL databases. I was able to use PHPAdmin tool at Netfirms to export the WordPress database and the CPG database into .SQL files (text). The SQL file contained the SQL commands to recreate the tables and then insert the data.

My hosting plan at MyHosting.com only includes one database, so I decided to put both WordPress and CPG into the same database. Since the tables that WordPress and CPG use have different names, this will not be a problem. The only problem that this will cause is that I have to be careful about how I back them up or export them otherwise I’ll have both WordPress and CPG in the same export file.

MyHosting.com also uses PHPAdmin, so importing the WordPress and CPG tables was trivial. I did find two problems with the import process. First, there was something about the comments that was throwing it off. Comments start with a — (the font doesn’t show it properly, but that’s two dashes), so I deleted any line that started with –. Second, there were a few options on the CREATE statements that were causing problems. They were the “ENGINE=MyISAM” and “DEFAULT CHARSET=latin1”. I used search and replace to remove these from the files and they imported great. I did set the default sort order, so the “DEFAULT CHARSET” was not needed.

As part of the move, I wanted to change the folder structure a bit. Netfirms, by default, installed CPG into a folder called /Gallery/NFPicturePro/. I wanted to shorten that up a bit, so when I moved the files, I just created a new folder called /cpg/. I used search and replace to change the the .SQL files that I had exported from WordPress and CPG, so they referenced the correct folder.

I have been using EditPad from JGSoft to edit the .SQL files. There is a Pro version and free Lite version. I have found the Lite version to be more than adequate for my editing needs. You can have multiple files open and the search and replace is awesome. EditPadLite is on just about every machine I use.