Applescript & SMS Server Tools

Linux, Mac, Miscellaneous, Windows 2 Comments »

I’ve set up SMS Server Tools on my Mac Mini so that I can send text messages from my PC and I thought someone might be able to use the Applescript I’ve created or even suggest a better way of doing things.

If you’re not familiar with SMS Server Tools it’s a really great utility for sending text messages from your PC (I use the term generically) it works on (almost?) all UNIXs and Windows too. It works by having folders which it monitors for text message files and then sending them via the phone. It was very easy to set up just download the source, make, make install, edit the config file and away you go.

Read the rest of this entry »

Help My Phone Won’t Charge! - Here’s the Solution

Linux, Mac, Miscellaneous No Comments »

A while ago I had an old Nokia N-95 plugged into a Gentoo box and I was using SMS Server Tools to send myself text message alerts. I got rid of that sim and so stopped using it. The phone has been sat in a drawer since then along with a couple of others.

I recently decided I wanted to set it all up again, this time on my Mac Mini. I was trying out different phones and settings but I couldn’t get the N95 or an old Motorola V series phone to do anything even after plugging them both in! Read the rest of this entry »

PHP Daylight Savings Error When Dealing With Timestamps

Internet, Kquestion, Linux No Comments »

Last night I was working on determining how long a user had been logged into a PHP application but was having a problem with subtracting timestamps and this is how I solved it.

I was storing two timestamps (as a UNIX timestamp) in the database. One designating the date-time the user logged into the application and the other the date-time of the last activity the user performed. Because I was using UNIX timestamps, which are just the number of seconds sine the UNIX epoch, I subtracted one from the other and used that difference as the input to the PHP function date().

I couldn’t for the life of me work out why the date function was saying that I was logged in for an hour longer than I should have been and it was driving me crazy. It turns out that the reason was that my timezone locale setting in PHP is ‘Europe/London’ and that this causes the date function to adjust for British Summer Time (GMT + 1) thus when I used my timestamp difference in the date() function it translated the difference into a readable format but also added an extra hour.

The solution is to use gmdate() which is identical to the date() function except that the time returned is in Grenwich Mean Time format.

HowTo: Convert Between Windows & Unix Line Endings Using PERL

Linux, Mac, Windows No Comments »

You may or may not know that Windows and Unix end lines in text files differently. Windows uses both a line feed and carriage return characters whereas Unix uses only the line feed character. This can be annoying if you’re working with documents on both systems interchangeably and you need to preserve a lot of indentation . One example for me is xml files I like writing them in a plain text editor because I cannot find an xml editor I get on with.

The solution is to use PERL:

  • To convert Unix style line endings to Windows style
    • perl -p -e ’s/\n/\r\n/’ < unixfile.txt > winfile.txt
  • To Convert Windows style line endings to Unix style
    • perl -p -e ’s/\r$//’ < winfile.txt > unixfile.txt

The use of single quotation marks in both command lines is important because it prevents the shell from trying to evaluate anything inside.

That’s it. A simple way to quicky convert line endings letting you get on with the job.

Resize Windows / Linux Dual Boot Partitions Easily With Gparted

Linux, Windows No Comments »

I dual boot a couple of my machines and whilst I was looking for a way to reapportion the size between two partitions I came across Gparted. It’s a Gnome based GUI for the GNU Parted program for creating, destroying, resizing, checking, and copying partitions, and the file systems on them.

What I really liked is there’s a linux livecd available so all you have to do is burn the disk image stick it in and aside from a few simple commands to boot the cd correctly it loads and starts Gparted.

Read the rest of this entry »

Removing GRUB From a Drive Partition

Linux, Mac No Comments »

Ever needed to get rid of GRUB from a partition but didn’t know how? I managed to install GRUB onto my swap partition whilst setting up dual booting with Gentoo on a Mac Mini and faced this same problem. Using rEFIt it automatically detected GRUB on the partition and it showed up as a bootable option. I couldn’t be doing with that so I started looking for the solution. Loads of forum posts suggested fixmbr or fdisk but I didn’t want to replace GRUB I wanted shot of it. Anyway turns out the solution was to use dd.

# dd if=/dev/0 of=/dev/sdX bs=446 count=1

Where sdX is the partition to clean.

KDE: Starting an Application in a Specific Desktop

Linux No Comments »

I’ve been looking for a way to start specific applications on specific desktops so things are more organized. For example I like to have my mail client (KMail) on the second desktop out of the way but there when I need it and I don’t like having to either start it in that desktop or move it to desktop two if I’ve had the application start automatically.

The utility to achieve this is kstart which is used to launch applications with special window properties such as to be full screen, below other windows or to not have an entry on the taskbar. The syntax is as follows;

user@host ~$ kstart [options] command

the specific argument (option) for my example is –desktop 2 and the whole command ‘kstart –desktop 2 kmail’ I’ve got mine set up as a .desktop shortcut in ~/kde/Autostart but you don’t have to have it there or use it in shortcuts it could be used in scripts or anywhere. I think this utility is great hence the post and hopefully it’ll take people less time than it did me to find the answer in future.

WP Theme & Icons by N.Design Studio | Akismet has gobbled 358 spam comments...Mmmm Tasty :-)
Entries RSS Comments RSS Log in