Labels

css (1) jQuery (7) linux (38) mac (70) php (29) python (1) svn/git (9) trac (4) ubuntu (1) virtualbox (6) vista (2) windows (14)

Friday, 31 October 2008

Fedora Wake On Lan

Fedora by default when shutting down powers down the network adaptor hence disabled wake on lan, to enable it open terminal as root, type the following and press enter

echo "/sbin/ethtool -s eth0 wol g" > /etc/rc.d/rc.local

Replace eth0 with eth1 etc whatever your network connection is set to (probably eth0 or eth1).

Reboot, then next time you shut down it will be ready to wake on lan.

Mac Null character file in trash

I've had this happen twice now you open your trash and see an odd file with some weird null characters with an "o" in the middle.

This is caused by the trash flaking out on an ntfs or fat32 partition when running bootcamp (or at least that's what causes it on mine).

To solve, log into windows, delete all .Trashes files and folders on the drives (note they will be hidden). That should fix it, if it doesn't use windows to run check disk on all drives.

Auto login for Fedora9

Ubuntu has an autologin feature, when I switched to Fedora I missed this, but you can enable it (sort of) by editing /etc/gdm/custom.conf adding the following lines


[daemon]
TimedLoginEnable=true
TimedLogin=usernameofuseryouwanttologin


Then edit /etc/gdm/gdm.schemas

Scroll down until you find daemon/TimedLoginDelay and change the bit in the default tags to however long you want, i.e 1 , 5 , 10 etc

Wednesday, 29 October 2008

SVN Modifications

This is more for my own benefit than anything else but if others find it handy then cool :).

In a previous post I mentioned I was trying out SVN well I find it very useful and now want to move it to another machine (A fedora9 box).

I installed subversion on the box, installed smartsvn (http://www.syntevo.com/smartsvn/index.html) Note when installing smartsvn on fedora the JAVA_HOME path in the smartsvn.sh file needs to be set to /usr (so it will translate to /usr/bin/java)
This was mainly so I can test locally I didn't really need to do it.

Now I had to figure out how to move the repos (I have 4) and keep things working.

After googling around I found the following useful commands:

On the current svn box:
svnadmin dump pathtorepo > file.dmp
That dumps the repo to file.dmp

Then copy the file.dmp to the new server.
On the new server make a directory for your repos and run the following:
svnadmin create repopath
svnadmin load "repopath" < "pathtodumpfile" (Note you will have to edit svnserve.conf to the same on the original server, these can just be copied). Now kill the server killall svnserve Now restart it svnserve -d -r pathtorepos Lastly on the client machine that connects to the svnserver run the following from the directory where you check out to svn switch --relocate "oldaddress" "newaddress" Note you need svn 1.5+ to do the last part on mac I had 1.4.4 not sure if this came with it or not, so I renamed /bin/svn to /bin/svn.old and installed svn from http://subversion.tigris.org/

Just repeat for all repos and you're done :)

Now to make the svnserver run at startup I made a script called svnserve.sh and put it in /etc/init.d/
Its contents are

#!/bin/bash

PATH=/bin:/usr/bin:/sbin:/usr/sbin

case "$1" in

start)
echo -n "Starting"
svnserve -d -r /svn_repository/
;;

stop)
echo -n "Stopping"
kill -9 `ps ax | grep "svnserve" | grep -v grep | awk '{ print $1 }'`
;;

restart)
$0 stop || true
$0 start
;;

*)
echo "Usage: /etc/init.d/svnserve {start|stop|restart}"
exit 1
;;

esac

exit 0

Lastly type
echo "/etc/init.d/svnserve.sh start" >> /etc/rc.d/rc.local
and press enter and this will make the script start at startup.

Oh a note on editing svnserve.conf make sure there are no spaces before any arguments or an error will occur when committing.

Now if you have read this you're probably wondering "Why has he moved his repos?" well this is for two reasons 1) I wanted to put them on a virtual machine so I can carry them around with me if I want to (not hard to move a VM from one pc to another) but I don't want them on the web.

And 2) I was using my desktop which is rather power hungry, I can now put it on an old laptop I have and consume around 1/5th of the electricity I do now.


Thanks to the following sites:
http://bindernet.blogspot.com/2006/02/move-svn-repository.html
http://www.robgonda.com/blog/index.cfm/2005/7/8/SVN-port--firewall
http://wordaligned.org/articles/one-svnserve-multiple-repositories
http://webkit.org/blog/97/svn-repository-location-change/
http://svnbook.red-bean.com/en/1.1/re27.html

Remotely make a mac sleep.

I'm lazy this is well known, and instead of getting up to switch my mac mini into sleep I wanted to make it sleep remotely so here's how I do it.

Firstly on the remote mac create open terminal, type "nano sleep" press enter this will open the nano editor, type the following two lines

#!/bin/bash
osascript -e 'tell app "Finder" to sleep'

Then press Ctrl-X and enter this will save the file.

Now type "chmod 0700 sleep" and press enter this will allow the file to be executed, when run the computer will sleep.

Ok next we need to connect to the mac remotely, go into preferences then sharing, make sure remote login is checked.

Now back to terminal, type "ssh-keygen -t dsa" and press enter
Press enter when the name comes up.
Type a password and press enter when asked.

This will create two files id_dsa and id_dsa pub.

Type "cd .ssh" press enter.

Type cat "id_dsa.pub >> authorized_keys" and press enter, this will allow the keys to be used to connect.

Finally we need to copy the id_dsa file to the computer you want to use to remotely shut down the mac.

Now on the computer (I'm assuming it's another mac) you need to open terminal, type "nano sleepremote" press enter.

Type the following lines

#!/bin/bash
ssh -i /users/<your>/.ssh/id_dsa <remote>@<remote> -t ./sleep

Replacing <your> with the user on your local computer <remote> with the username of the remote computers user <remote> with the ip address of the remote computer this can also be the name i.e mac.local

Press Ctrl-X and enter

Type "chmod 0700 sleepremote" press enter, this will allow the file to be executed.

Now if you have spotlight enabled you should be able to to access the file via "cmd + space" to open spotlight and type "sleepremote" pressing enter will run the script and sleep the remote computer. The first time it will ask you for the passphrase but this can be stored in your keychain.

To wake the computer again I recommend http://www.readpixel.com/wakeonlan/

Sunday, 26 October 2008

Speaking clock...

Anyone in the UK probably knows about the speaking clock...you dial 123 and it tells you the time...well since we've switched to Virgin for our phone line the clock has changed...it now says "Hi it's tinkerbell the time is..." in a very cartoon like voice...oh how disturbing!! Who came up with that one?

Monday, 20 October 2008

The "Wonders" of electronic banking

The post just came, I have a letter from the student loans company saying I'm getting a grant! W00! This is good since I didn't know it was coming.

Uh Oh bad news! The account number is my old bank..ok simple enough you can update it online...I go to the site to update my information...it asks me for a password..eh? I've never used the site before ok so I try to reset it..it says my information is invalid hrmm this isn't working...back to the letter oo a phone number to call..I call the phone number..sit on hold for 10 minutes...give up.

Back to the site! The site has another phone number...call them..get through wee change my bank info..oh dear the payment's already gone through..but how can that be the bank account doesn't exist, the advisor tells me to call my old bank.

Onto my old banks website...call them up...they ask for my card number...I don't have a card stupid machine >.< I sit and ignore the messages for a while until I get through to a human.."hello there can I have your account number"..."I don't know my accounts closed"...I explain the situation..after 15 minutes of hunting and searching the advisor tells me that the payment will have been rejected and sent back to the student loans company today.. (note it was sent out on the 16th 4 days ago...) and should be with them within 4 working days..so sometime at the end of the week..then another 4 days to get to me..so hopefully I will get the grant within 2 weeks.

Now why does that have to be so complicated >.> and why does everything take 4 'working' days, if we are in the modern world, which me typing in this blog means we are, then computers are the ones doing the rejecting of money transfers so why do they not do it on a weekend? Do computers now get time off? Do they get to sit in front of the fire and toast their transistors on a Sunday evening with a good book? And lastly..where is my money for those 4 working days? Is it mine? Is it the banks? The loan companies? Or does it belong to Groucho Marx?

The modern world has gone mad...

Thursday, 16 October 2008

SVN Woes

I don't know if I'm just being blind or what but is it me or is SVN http://subversion.tigris.org/ really badly documented.

I installed it on my main desktop so I can keep track of all the changes I make to projects..then I find when I commit changes I get authorization failed.

Now why didn't someone just say "check the password file in the conf directory in the repository"?

I go into the file find the password database isn't set, that anonymous access is set to read only etc etc >.> a quick addition of a user and woomph! I can get in and commit yay!

Wednesday, 15 October 2008

M263 is on its way

Well I have just submitted part 1 of my first TMA for my next course M263 "Building blocks of software".

And as usual it comes with an application in java which I can convert to use on a mac..here is how.

1) Copy the files from the CD for the application and download any updates from the website
2) Open terminal, type java -jar <pathtofile>/M263.jar which will launch the program no problem.

If you'd rather have a normal mac app, firstly you will need the jar bundler app.
In finder select go to folder and tyoe /usr/share/java/Tools there should be a file called jar bundler if there isn't you will need to install it from your mac os x cds.

Ok open jar bundler where it says main class click choose then navigate to the M263.jar file you copied. Next click classpaths and files, click add navigate to where the M263.jar file is but don't add it, add the js.jar, jsc.jar and M263js.jar then click build information and create application, save it where you want and voila! You have your clickable app.

Blogger via email

Just found something interesting, you can blog via email.

Under bloggers settings under email there is an address you can send to that will publish your email as a blog, handy!

One problem is that anyone can email that address and it will do it, so to make that somewhat difficult I set the email to an md5 value a nice random 32 character string should prevent spam :)
Sent from my BlackBerry® wireless device

Windows Update auto restart (vista)

I have windows update scheduled to automatically install updates...unfortunately it did this while I was converting a video file I had left the pc alone and it decided to reboot itself gah!



So I thought "There must be a way to switch this off" and guess what there is, assuming you have business/ultimate you can go start > run gpedit.msc


Choose administrative templates > windows components > windows update and there are a whole host of options which are self explanatory.

Tuesday, 14 October 2008

Ever wondered how much your mac costs you?

Just been spending some time...few hours...trying to figure out how to power my mac on via a lan...you can't <.>


You can wake one from sleep but not from power off. How irritating anyway next question to sneak into my mind was "How much more power does a sleeping mac take compared to a shut down mac" why computers when switched off use up power I've no idea (well I know my pc does for the network card so it can be woken on a lan but since a mac can't do that why does it? Pass...).



Anyway being the frugal sod I am, I have a power watt per hour meter.



A mac when shut down (mac mini this is) uses 9 watts per hour.

A sleeping mac uses 12 watts per hour.

3 watts difference.



Our electricity costs approximatly 10 pence per kilo watt hour.



So simple maths brings that 1 watt per hour is 10/1000 = 0.010 pence per hour.

We have 3 watts per hour so that's 0.030 pence per hour.

24 hours in a day makes it 0.72 pence per day

365 days in a year makes 262.8 pence per year.

Which is £2.62 a year to run a mac in sleep state instead of off.



Now the actual cost will be less due to the fact that for an undetermined amount of time the mac will be on which will make the difference between sleep and shutdown 0 since it will be in neither state.



Now just for curiosities sake if the mac was on 24/7/365 and uses approximately 45 watts of power an hour, this will vary depending on what it's doing but is a good average for my mac mini, it will cost £39.42 imho that's really really cheap :)



Now my desktop is another matter (not really fair to compare the two since it's huge and has 3 monitors...but oh well) it uses approximately 320 watts per hour which if on 24/7/365 would cost £280 a year. Still not too much.



Ok enough rambling! [/end ramble]

Thursday, 9 October 2008

Thunderbird signature oddness!

I just noticed when sending replies in thunderbird the signature wasn't appearing (or so I thought) turns out by default thunderbird appends the signature to the END of a reply..why? Don't know.

Anyway I found this article which basically tells you to go to > tools > account settings > select the account you want > go to composition and addressing > change "Start my reply below to quote" to "Start the reply above the quote" > then under that change the "place my signature below my reply" to "below my reply (above the quote)"