Thursday 28 August 2008

Removing line feed characters from dos files for use in UNIX

Here are a couple of commands to remove line feeds from files created in windows for use in UNIX.
I had a list of usernames in a csv which I wanted to run an ldap search on however the line feed characters were causing this to mess up the command

To get around this you can either run

dos2unix current.csv newfile.csv

or you can open the text file in vi. The text file looked like this

johnhe02^M
paulke04^M
marymc04^M
elainp02^M
jimfor01^M
markad01^M
johnmc12^M


then basically open up your command prompt by pressing the colon key ":", and enter the following

%s/^M//g

Note to get the ^M character you hold down ctrl and press V and then M (V and M must be pressed while holding down ctrl)

Another way to acheive the same results as dos2unix is by using the flip command. Thanks to Jadu Kumar Saikia for pointing this out :o)

Wednesday 2 July 2008

Online FTP client and file editor

The online ftp client, http://www.net2ftp.com/, I have been using for a while, to get around my works firewall and update my website is for some reason inaccessible. For anyone looking for an alternative, http://www.web2ftp.com/ is quite nice. I used to use it previously, and then the host shut it down due to misuse, which was the reason I started using net2ftp in the first place. It is not as feature rich as net2ftp, but it does what it says on the tin.

UPDATE (3rd July '08)
I tried to log in to web2ftp this morning and got the following error.

Web2FTP deactivated !!!Sorry, but we had to deactivate our free service Web2FTP.We have introduced new security functions as logging User actions, Ip-Numbers and blocking whole IP-Ranges from Asian and African networks, but some users continued to upload Phishing sites. We are working on a new solution for registered user.Leverkusen, 03.07.2008

Saturday 21 June 2008

Setting up jUploadr for ubuntu

jUploadr is a nice little java application which allows you to upload photos to flickr, zooomr and any other photo sharing site you are a member of which allows api access. When you read the FAQs for linux, which are virtually non existent, it basically says that you have to run the application by typing the following into the command line.

./jUploader

This is a touch on the crappy side as many users may not be confident enough with command line working, It also means that you need to remember where you stored to directory and run cd to change to that directory.

It's much easier to add the application to the top panel and here's how you do it.
  • Download jUploadr for linux
  • Once you have extracted the contents of the tar file to your desktop, enter the following into your command line.
sudo mv jUploadr-1.1.2-linuxGTK-i386 /usr/bin/jUploadr-1.1.2-linuxGTK-i386

  • Note that jUploadr-1.1.2-linuxGTK-i386 should be changed to whatever the version you have is called. Run ls on your Desktop to find out and allow an easy copy and paste.
  • Right click on the top panel and select "add to panel"
  • Select "Custom Application Launcher"
  • The main bit here is to browse to the file "jUploadr" within the directory you just moved to /usr/bin.
  • Click on the little spring platform image and this lets you select the icon to chose. Navigate to the directory you just moved to /usr/bin and click open, you then have the choice of 3 image files to select.
  • There you go. Just click and this will open jUploadr.

Friday 6 June 2008

Nominate Ubuntu for SourceForge's OSS award

SourceForge are holding their annual Community Choice Awards for open source software. I have nominated Ubuntu Linux. If you want to nominate Ubuntu as well, click the link below.



You can view last years winners and nominees here, http://sourceforge.net/community/cca07.

Thursday 5 June 2008

Gmail displaying annoying error about full cache

When I upgraded to Internet Explorer 7, on Windows XP SP2, I started getting an error on gmail which says

Your browser's cache is full and may interfere with your Google Mail experience.

Since clearing my cache did not help in the slightest so I tried a few other things.


  • Tools > Internet Options > Advanced tab. make sure that “Do not save encrypted pages to disk” is unchecked.
  • Tools > Internet Options > Browsing History Settings, Change “Check for newer version of pages at every visit” to "automatically". This originally worked for me but then something happened on my laptop and then it started again.
  • The size of my cache was sitting at 1024MB so I lowered this to 250MB. (From Browsing History Settings again)
  • The final thing I tried ended up getting rid of the error. I added mail.google.com to the list of allowed sites.
  • Somewhere advised that deleting your temp Internet files and recreating it might help but I didn't try this, nor can I advise if it works.

If anyone has anything else that can be added please leave a comment and I'll add it in.

UPDATE: The message came back after adding mail.google.com to my list of allowed pop ups. After further rooting around I found that if you access gmail through https://mail.google.com/ using secure http the message disappears. As far as I'm aware you still need to go into your internet options on explorer and ensure that “Do not save encrypted pages to disk” is unchecked.

This poses a problem if you access your gmail through google toolbar however, google allows you to edit the xml behind the custom buttons such as gmail. Here's what you have to do in order to get your gmail button on your google toolbar pointing to https://mail.google.com/.

  • Click the settings button on your toolbar.
  • Click on "Custom Buttons"
  • Find the gmail option and click "Edit"
  • Click "Advanced"
  • Press ctrl + f and search for http://mail.google/ and change all instances to https://. There should be 3 urls you need to change.
  • If you like, you can change the message you get which tells you that you have new gmail. Search for or just and between the tags, put something like, "Hey bawbag! Check your email."

You can also do this "advanced edit" in forefox's google toolbar, however firefox doesn't cause gmail the confusion that internet explorer does.

UPDATE (again) - gmail now offers you the option under "settings", to always use https. Tick this option and this whole problem goes away which is good because the iGoogle gadget still takes you to the http: site.

Tuesday 27 May 2008

Dogpile search gadget for iGoogle

While comparing Google with Dogpile I discovered that there was no dogpile search gadget for iGoogle so I created one.

Use this button to add the uk dogpile search gadget to your iGoogle page


Use this button to add the dot com version of dogpile to your iGoogle page.


Enjoy

Find out where spam came from using Gmail

When registering for an account on any online service it's always best to check the site's privacy policy to see what a site will do, or will not do, with the details you provide.

Personally I can't be arsed with all that fannying around so I just fire in my details and hope my spam filter is up for the challenge, and to be honest, Gmail's spam filter is very good. A way in which you can find sort this out is to sign up with your email address as username+sitename@gmail.com. So if I was a wary customer signing up for Blogger, I would enter mine as graham.macleod+blogger@gmail.com.

You can even have these filtered accordingly, by going into Gmail and select Settings, then Filters and Create a new filter. Add in the address which you signed up with into the To field, and on the next step select Apply the label and then create a new label, I.e. Blogger.

If any spam comes in, you can view which email address it was sent to and therefor tell which site's admin's balls you can go and break. Make sure you don't select Delete it at step 2 of the filter making process as you will still want to receive authentic emails from that site.

This doesn't always work and sites with more advanced registration processes may not accept it. It can't hurt though, unless you have had to enter a mountain of personal info and because an error was detected, you have to start again. But in that case, the website is shit and you should think twice about registering in the first place.

Thursday 22 May 2008

Getting high off nutmeg

Have you ever thought to yourself, while sitting home on your own on a Friday night, "I miss those nights when I used to go out clubbing, get mashed and stay up until 10pm the next day feeling shit."? Well to recreate that feeling legally and inexpensively, all you need is a nutmeg seed and a grinder to get completely off your tits. WARNING: May be the shittiest high of your life.



Grind up a tablespoon of fresh nutmeg (not the ready ground stuff) and mix it with milk and add sugar to taste. Neck it and wait an hour. If you still don't feel anything after an hour, repeat. I've heard that up to 3 tablespoons is "safe" but any more and you risk having a pretty shit time, like not being able to walk for a few hours, nasty hallucinations for example, feeling like you are melting.

To start with you might feel slightly nauseous.

Then you get dry mouth and red eye.

After a couple of hours you'll start to feel drowsy.

WARNING: Nutmeg contains an MAO which should not be mixed with any other MAOs for example antihistamines, alcohol etc. for a full list of MAOs see the Erowid site.

It has been rumoured that you can hallucinate while on nutmeg but I reckon it's all bollocks. I'd be interested in hearing anyones experiences on nutmeg.

Wednesday 21 May 2008

Devastatin' Dave The Turntable Slave is my new hero

Look at him there with his can-do attitude and shiny leather trousers. How can you not idolise the man who gave the world lyrics such as...

Zip dip zap, a zip wit a wabbit,
Zippy dipa wippa got a cocaine habit,
Scooby dooby bip a zip bop blam,
It started with a quarter now it is a gram.

Let's just stop and think for a second. (Like you needed any prompt to start thinking, after such a thought provoking blast of lyrical wizardry.)

You ready for another? OK here goes...


Zoom zoom with a scooby doo bop,
Buy yourself into projects you're tryin to cop,
Rip and a rap I wrote with a rhyme,
I think you better call the cocaine hotline,

Yeah. did you hear that? That's the sound of a million wraps of cocaine beign flushed down the toilet. Dave, or DDTTS as his mates know him, and AIDS are the only 2 things from the 80's worth writing about. One will fuck you up... and the other is AIDS. Recognise.

Tuesday 20 May 2008

Why do we still get gmail invites

Back in the day it was necessary to beg the lucky few who actually had a Gmail account, to send you an invite, in turn you dished these out. The reason for this was to keep the load on Google's servers to a manageable level.
You started out with a few invites which, as Google's capacity increased, also increased. eventually I ended up with 100 or so. I have dished out 15 as can bee seen in the screenshot below.

Why is Google still displaying this facility to invite other people to Gmail, when you can simply go to www.gmail.com and sign up for one by clicking on a link on the homepage?

Come on Google. I know we can minimise it so that it is barely noticeable but it's still there. At least give us an option to hide it completely.

Friday 16 May 2008

Sharing folders between host and guest on VirtualBox

While trying to share folders between VirtualBox and ran into a few problems. Here is a run through of how to do it so that hopefully you don't have to suffer for a couple of hours searching google.

Note: This was done using Ubuntu 7.10 Gutsy as the host and Win XP as the guest.

1. Ensure you are not running the OSE version of VirtualBox.
2. Start your virtual machine and click Devices > Install Guest Additions. If nothing happens click Devices > Unmount CD/DVD-rom, then try again.
3. Click Devices > Shared folders
4. Click the add button and on the next screen and enter the path of the shared folder I.e. "/home/graham/whatever" (without the quotes|) and then add in the name for the shared folder. This name you have just given the folder is the important part.
5. Open a DOS command prompt and enter the following
net use z: \\vboxsvr\whatever

The "whatever" part is the name that you gave the shared folder while specifying the path.
After this the Z drive or whichever drive letter you assigned it to should appear under "My Computer".

Monday 12 May 2008

XHTML 1.0 Strict Java Applets

While coding a program for a college submission, I spent ages trying to get the page to validate as XHTML 1.0 strict. I eventually came across Shayne Steele's webspace (link no longer working) at Florida State's computer science department which has this page that explains the various parts required by the object tag.

Check out Shayne's page ot just copy and paste the code below. all you need to change is the Class name and the height and width of the applet/object.


<object type="application/x-java-applet"
height="500"
width="500"
classid="java:YourClassName.class">
<!--[if IE]>-->
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
height="500"
width="500"
codebase="data"
type="application/x-java-applet">
<param name="code" value="YourClassName">
</object>
<!--<![endif]-->
</object>

Tuesday 22 April 2008

Encrypting mailto: links to avoid spam

Anyone who has placed a mailto: link on their website may or may not have noticed an increase in spam email. Gmail has an excellent spam filter so I never really have much of a problem.

There have been a few different ways suggested on how to put a "Spam Proof" email link on your website.

Linda Roeder suggests using javascript although the main argument I have against this is the same reason I keep my javascript to a bare minimum... What if javascript is turned off?

Another way that has been suggested is to make an image with just your email address but this involves any users to take a note and manually type in your address into an email.

You can also put a form on your site allowing people to send you feedback, but what if you actually want people to know your email address for future correspondence?

The best way I have found so far is by encrypting your email address. This works by substituting each letter in the address including the "at" and any dots into html character code.

This might sound like a lot of hard work but web designer Rob Spangler provides a quick and easy to use tool on his blog. Simply enter your email address and if you don't want your email address to display to users, what text you want to display in the link. This then transforms a plain text version of your address, easily trawlable from the web. Into a nicely encrypted mailto link such as the one below

graham.macleod@gmail.com (view the page source to see the encrypted version)

Keep in mind, it's always best to give users the choice of using a mailto link and also a feedback form since not everyone uses a mail client and for some people, clicking on a mailto link will cause
an unconfigured outlook express to open up.

How long it will take for the spammers to pick up on this method I don't know but at least our mailboxes will be safer for a while.

Saturday 5 April 2008

Garfield minus Garfield

One of the cleverest and simplest, projects I've stumbled upon while surfing is Garfield minus Garfield.



"Who would have guessed that when you remove Garfield from the Garfield comic strips, the result is an even better comic about schizophrenia, bipolar disorder, and the empty desperation of modern life? Friends, meet Jon Arbuckle. Let’s laugh and learn with him on a journey deep into the tortured mind of an isolated young everyman as he fights a losing battle against loneliness in a quiet American suburb."

I would recommend subscribing to the blogs rss feed as you get one or two per day and they always manage to make me piss myself luaghing.

Thursday 3 April 2008

Trip to Amsterdam

2 of my mates, Tommy and Rosco, my girlfriend and I flew out from Edinburgh Airport at 2pm on Thursday the 27 of March for 3 nights. I can't remember that much of it to be honest.
I do remember however, sitting in a pub in the red light district trying to convince Rosco to get a reach around from a skanky ho' (she wasn't actually that skanky to be fair) and then him falling off his stool and breaking the leg (of the stool).
You can see the photos on my flickr.
Most of the days were spent either in the coffeeshops or pubs.

Some of the coffeeshops we visited were

  • Rookies - purchased some Santa Maria
  • Stix - purchased some Bubblegum
  • The Seville - Played pinball and the machine broke

On the last night, before we went out, we had a game of cards while getting pissed up. You can see my funky victory dance below

You can't say I don't have mad skillz.

P.s. Rosco never did get his reach around. The romance was shattered as soon as we saw a guy wearing an anorak walk into her window and her closing the curtain after him.

Thursday 6 March 2008

Dokuwiki it is

So far DokuWiki has performed extremely well. Since my team will all be using IE v7, setting the wiki as one of the search providers will provide a quick and simple way to search the Knowledge Base.





We are currently waiting on management giving us the go ahead for the server space and the domain name but we are stocking up our test wiki with knowledge procedures and the usual miscellaneous information that is kept on the file server with no way to usefully search it.