Archive for ‘Technology’

Symbolic links in Windows

Friday, April 4th, 2008

Symbolic links can be very useful, but if you are a Windows user, you’ve had to use junction points because there hasn’t been native support for symbolic links until recently.

Windows Vista and Windows Server 2008 now support symbolic links mklink command. See Junfeng Zhang’s write up on the mklink command.

For those using Windows 2000 or XP, you’ll still need to use junction points to achieve a similar effect. Microsoft has a KB article on creating junction points, but there are some drawbacks to manually trying to manually manage junction points.

Fortunately, there are tools available that ease the pain of using junction points and prevent you from having to know all of the command line options. One such tool is NTFS Link, which provides shell integration for junction points. You can simply right-click in a folder and select New > NTFS Junction Point. Then select the target folder to link to and a “new” folder, named “Link to target folder” will be created in the directory you are in.

So, if you are a Windows user, you now have a couple of different options for creating and using symbolic links!

Finding files containing a certain value

Tuesday, March 4th, 2008

Searching for files containing a certain string/text/value is something that I do quite often. There are a number of ways to perform a “find files containing ‘foo’” search, but for me, nothing beats the simplicity and power of the command line!

In Windows:

findstr /s /n /i /p foo *

The above example of findstr will print out the relative file name/path and line number (/n) in a recursive (/s), case insensitive (/i) search for the string foo (foo) in all files (*), ignoring files with non-printable characters (/p).

For a literal string, you can use the /c option:

findstr /s /n /i /p /c:"foo bar" *

There are a number of other options, but those are the ones I use most often. To restrict your search to certain files, just change the * to the pattern you are looking for, like: *.txt or *.css, etc.

For Unix:

grep -rni foo *

The above example of grep will print out the relative file name/path, matching content and line number (-n) in a recursive (-r), case insensitive (-i) search for the string foo (foo) in all files (*).

To search for a literal string, just put the search pattern in quotes.

If you just want to see the relative file name/path and don’t care about the line number/content, you can use:

grep -rli foo *

And since these are commands I use all the time, I usually set up “shortcuts”, so that I don’t have to type out long commands with lots of options.

In Windows, you can create a batch file, called grep.bat for example, with the following:

findstr /s /n /p /i /c:"%1" %2

Then from the command line, just type grep foo *. For this to work, grep.batch needs to be in a folder that is in your PATH environment variable.

In Unix, there are a number of ways to do this, but I tend to just create an alias. For example, from the command line:

alias search='grep -rni'

Then from the command line, just type search foo *. Of course, you can just about any word/letter in place of search, just as long as it’s not a reserved/system keyword. Lastly, you can add the alias command to a startup file and it will be available to you every time you log in.

Why I hate Gmail

Friday, February 29th, 2008

Ok, so I don’t really hate Gmail, but I am pretty annoyed right now. Every time I try to send an email, I get an alert saying “An error occurred trying to send the message”.

Despite my best-efforts to follow Gmails TOS, I believe that my account has been disabled…hopefully only temporarily. And here’s why:

Read the rest of this entry »

Why I love Gmail

Saturday, January 5th, 2008

I manage 14 different email addresses through one single Gmail account. Any idea how many spam emails I get to those addresses in a 30-day period?

Read the rest of this entry »

Running Ubuntu 7.10 in VMWare Player

Tuesday, October 30th, 2007

I wanted to check out the latest Ubuntu release, so I downloaded the following VMWare image:
http://isv-image.ubuntu.com/vmware/Ubuntu-7.10-server-i386.zip

After extracting the 2 files, I opened Ubuntu-7.10-server-i386.vmx in VMWare Player. A dialog appeared asking me if I had moved or copied the image opened, so I selected “I copied it”.

After which, I received an “error” saying something like “This CPU is VT-Capable but VT is not enabled …”. It appears that even though the image I downloaded was for an i386 machine, it was defined as a 64-bit machine in the vmx file. After the OS loaded, I logged in (ubuntu/ubuntu) and did a shutdown:

Read the rest of this entry »

Clearing VMWare Player Recent Virtual Machines list

Friday, October 26th, 2007

The VMWare Player does not include an option to clear the list of “Recent Virtual Machines” (why not?!?!). Since the list of virtual machines that I had opened was growing quite long, I set out to find a way to clear it myself.

After searching in a few places (Windows XP), I came across the file that holds this information. It’s called preferences.ini and is located in:
[drive]:\Documents and Settings\[user]\Application Data\VMWare

UPDATE: In Windows Vista, the file is located in:
[drive]:\Users\[user]\AppData\Roaming\VMWare

At the bottom of the file, you should see entries like (where X is a sequential number):

pref.mruVMX.filename = "..."
pref.mruVMX.displayname = "..."

Just delete/reorder the entries as desired, save, then start VMWare Player to see the changes. VMWare Player will need to be closed before you make the changes, or they will not be saved.

Shared object error during cPanel Apache build

Tuesday, October 23rd, 2007

I was trying to add PHP Zip support on my cPanel server today and when Apache went to restart, it failed with the folowing error:

Cannot load /usr/local/apache/libexec/mod_bwlimited.so into server: /usr/local/apache/libexec/mod_bwlimited.so: cannot open shared object file: No such file or directory

After a Google search, I found that I needed to run:

cd /usr/local/cpanel/apache

/usr/local/apache/bin/apxs -iac mod_auth_passthrough.c
/usr/local/apache/bin/apxs -iac mod_bwlimited.c
/usr/local/apache/bin/apxs -iac mod_log_bytes.c

I was able to start Apache afterwards and everything is back to normal…

Configuring WordPress

Tuesday, October 9th, 2007

I’ve been playing with configuring WordPress (WP) for this site. After doing some research, I had a plan for how I wanted it to work. Basically, I wanted to use WP to manage my site (like a CMS) as well as for a blog.

After a lot of trial and error, I think I’ve achieved the effect I was looking for. I installed WordPress in the /blog directory. Copied the index.php and .htaccess file into / and edited index.php:

require('blog/wp-blog-header.php');

In wp-admin, under Options > General, I changed “WordPress address (URL)” to http://www.ericmmartin.com/blog and “Blog address (URL)” to http://www.ericmmartin.com. I then created 2 pages, one called Home and one called Blog. Lastly, under Options > Reading, I set the Front Page option to “A static page (select below)” and Home for the Front page and Blog for the Posts page.

Currently, I’ve installed the WP-Syntax, Akismet, Add Your Own Headers and Exec-PHP plugins.

The rest is still a work in progress, but so far, I’m happy with WordPress!