Main

Computing Archives

October 7, 2004

Fun with Mathcad - oh and my 400th entry!

I have to say I detest using Mathcad. I have to at the moment though, argh! It should be ok. It makes some of the stupidest errors known though, look at what it told me earlier:

Mathcad, argh!

All I can say is thanks! Stupid bloody software. Then bloody paint didn't save the colour correctly - great! Oh and this blog is now 400 entries old and going strong!

November 7, 2004

Using Firefox yet?

I have been meaning to post about this for a while but haven't got around to it till today. The reason I remembered to post this today is that for some reason I was using Internet Explorer today and guess what happened. Yep I got a "browser hijacker" on my comp. Great! Luckily I have lots of anti-adware etc programs installed and so was a process of running the right one. In this case it turn out Lavasoft Ad-aware was the only one to work. Anyway's my point is - USE FIREFOX - it is faster, more secure, cooler and most importantly not MICROSOFT!


Have you got it yet? Remember download Mozilla Firefox - it is only 4mb!

Get Firefox! 

November 10, 2004

PHP Rocks!


Yesterday I was working on the NAM 2005 registration page at have now decided that not only do I like PHP but I think it is great. Everything I need to do can easily be accomplished. It has excellent functionality for what I need to do on the web. Combined with xhtml this is going to be how I will redesign my website. Yes I am bored of the current design. Time for a change I think. Probably won't get around to it for a while as I have too much work to do.


November 13, 2004

site in flux

you may have noticed that the site seems to be doing odd stuff at the moment.


well that is 'cause I am updating the design.


at the moment most of the blog should work. there are still lots of probs with this in IE. DAMN MICROSOFT SHITE! It works fine in Firefox.


You probably can see the new site design now - hope you like it .I feel it is much better.


None of the site actually works at the moment - apart from this and the majority of my blog.


Will get it all up and running within 24 hours! argh

December 18, 2004

Firefox reaches the masses....


Firefox have put their advert in the New York Times.. about damn time. Excellent news though. They better keep it up. It is by far the best web browser available. I love it. Much better than the crap that Microsoft have to offer. How hard is it to create a web browser that conforms to the internationally agreed standards. Maybe one of the thousands of Microsoft employees can answer that. I doubt it - they are too busy making up there new version of xhtml. It is not entirely Microsoft's problem. Netscape started this.



As Firefox goes - I *want* one of their t-shirts:
http://www.mozillastore.com/products/clothing/launchtshirt

More:

+ Mozilla Press Release - http://www.mozilla.org/press/mozilla-2004-12-15.html

Free website hosting?

Fancy some free web hosting? Try http://www.port5.com/port5/support.htm I have seen a few people using this to store so astronomical images they have taken. So if you are looking to do something similar then this might be what you need. I don't know what they are like etc and so would not claim that they are good. I use phpwebhosting.com - who I pay. They have been excellent over my 3 years with them so if you want a bit more advanced package I would recommend them.

December 22, 2004

Is Google the largest censor in the world?

The other day I was thinking to myself about censorship. I can't remember why I started to think about this and I wondered how Google must deal with the bogus entries that pop up on the internet. It would be conceivable that these could easily overrun their search engine and become top all the time. Then I thought well actually I wonder if google censored and if so what google censored. A quick search around brought up http://www.google-watch.org/ a website that seems to be dedicated to pointing things out about Google's actions. I gave it a read. It was quite interesting and some of the things they suggest have some founding. I especially like the about the Abu Ghraib torture case - search for images and you get 1, yahoo.com have loads but I guess this could just be google being on the safe side but I guess this is censorship. I also feel they have the right to censor images results if they see fit - it is their site! Google does not censor the page links though and if you follow them you can find some rather distguisting scenes which I am not going to go into (otherwise I would have a big rant about the USA army and Donald "not as smart as the duck" Rumsfeld).

After further looking at this site it became clear to me that Google has some sort of censorship, but I feel that they are entitled to this. They have never really stood up and proclaimed themselves as the freedom for sharing information alliance (or something along those lines). They are a commercial organisation and they can do what they want. It does also appear that the person behind this site is disgruntled at google for the way his original site was dealt with their pagerank system. For more see: http://www.google-watch-watch.org/.

End of the day, though Google may appear to have some censorship - so what. Even with the case of the Abu Gharib prison you can still get the information via the search engine. It is up to them what they keep on their servers, isn't it? One final thought - remember Google doesn't always have the answer. It is not God (unless God is a bunch of computer servers and scripts.. interesting though!)!

More:

+ Google - http://www.google.co.uk/

+ Google Watch - http://www.google-watch.org/

+ Google Watch Watch - http://www.google-watch-watch.org/

+ Wiki Article - http://en.wikipedia.org/wiki/Google_Watch

January 3, 2005

Electronic Publications

I find it quite difficult at the best of times to read large documents on the web but I feel it is a great resource. No paper, storage space is minimum and costs are heavily reduced. I came across an interesting website full of online books the other day. It is http://www.nap.edu/. This is mostly scientific publications but is well worth a look. I came across a book I intend to read "Schrödinger's Rabbits: The Many Worlds of Quantum". It is available to read online at http://www.nap.edu/books/0309090512/html/

January 8, 2005

Bluetooth Hacking and security

It seems that Bluetooth is not as secure as people think it is. I do think the majority of the world lives in this bubble where they believe that everything they do electronically is secure. You say to people do you have a firewall. They either respond with "umm, whats that" or "I turned that thing on in windows". Ok most people just don't know. Maybe they should learn or ask about stuff. It really annoys me when people get virus' and then they moan that they haven't done anything. Indeed they haven't - that is the problem. In the world we live in you need to have a firewall. If you don't have one you are screwed. Turn on the windows one - that is a start. The rest do some research. It will be worth it in the long run - seriously. Buy a router!

Back to Bluetooth. I was doing some reading around and I am not going to claim I understand half of this but heck it makes interesting reading. It appears that some Bluetooth phones are increasingly open to attack. Not a good thing. If you are concerned about your Bluetooth handset then check with your phone company. I know Nokia have released some patches already.
More:
+ Bluetooth Hacking (pdf) - http://trifinite.org/Downloads/21c3_Bluetooth_Hacking.pdf + trifinite.org - http://trifinite.org/

January 23, 2005

Anti Virus Software

I ranted on the other day about people not having anti virus software or firewall software but I did not offer any useable advice. So here are a few pointers. Get an anti virus program. Norton is excellent but you have to pay - it is probably worth it though, especially if you don't want to be messing about with hunting down the final remnants of the Virus yourself. I personally use Grisoft's AVG. I really like this and would highly recommend it. It is also free which helps out quite well. The latest version can be found at: http://free.grisoft.com/doc/2.
Anti-virus programs don't take care of every sort of malicious program that could screw up your computer so I would recommend installing some anti spyware programs. I personally use a combination of Spybot, HijackThis, Spyware Blaster, Ad-Aware. These can all be found with a simple google search and in general the basic version is free. Give them a go you might just fin that your computer is running a little faster.

January 30, 2005

Shopping trip = purchase of computer games

Late this afternoon me and my house mate, Andy (a.k.a. Geordie), went out to do some game shopping. What did we come back with? Well he got: Farcry, LOTR: Battle for middle earth (what I have seen is fantastic!) and Battlefield Vietnam. I went for a slightly cheaper option, still ended up quite expensive in the end! I picked up Gangsters 2 for £2.99 (second hand from gamestation - best game shop in the UK). This is a game I have wanted to play for a long time. It is old now but from what I have played so far shows promise though the control are a bit counter intuitive. I also brought UFO: Aftermath which is part of the wonderful XCOM series (and I am currently installing it now)- these games define my gaming as a young teenager. This was also second hand and cost £5 I picked up Haegemonia, I have played this before (Geordie owns it) and it is absolutely wonderful so I thought i'd buy it since it was on offer. Oh and finally I went and got Rollercoaster Tycoon 3, this was the most expensive one cost £22. So far I am in two minds about this game - when I decide what I think about it I will right a full review - if I can be bothered.

February 1, 2005

Grand Theft Auto free to download

Rockstar games have released GTA, GTA 2 and Wild Metal free for download on their website under the classics section. Excellent. Now I know what I will be doing instead of any meaningful research! :-) To obtain these games go to: http://www.rockstargames.com/classics/. Well done to Rockstar for producing such excellent games and for being so nice to put their cracking (well revolutionary) games online for free.

February 13, 2005

PC-PALS Forum

I have successfully helped to transfer the pc-pals.com forum from an old and in need of attention Yabb SE forum into a nice shiny new PhpBB one. Took long enough though. Lets hope they enjoy using it in the future. I am sure they will. They probably will have to put up with me posting on their lots now. See: http://pcpals.phpwebhosting.com/phpBB2/

March 1, 2005

LaTeX programs for MS Windows

I love to use LaTeX (a typesetting program based on TeX), it makes my work look and feel so professional. I normal just do this via a text editor in windows or, more often, in linux. Recently though I have started to fiddle around with using some graphical interfaces. For windows there are a few good programs out there. I really like to use TeXaide as it allows me to easily visualize equations. I would highly recommend this piece of software. An excellent website, full of useful stuff, is: http://symphony.arch.rpi.edu/~hendep2/publications/latex/ Well worth a read.

March 2, 2005

Yahoo celebrates 10th Birthday!

Happy 10th birthday Yahoo!! What an odd thing to say. Happy birthday to a website. Well it did revolutionize the internet. I personally don't use it anymore. I did have my first email address on their though. Haven't used it in years now. I have my own mail server so don't need to. I used to use it as a search engine, google now deals with that. I wonder what use it has for me now? Probably not much but it was there when I needed it, back in the day. I am sure many people still use it and it is still an excellent resource, just one I don't need anymore. Oh if you have a yahoo id you can get free ice cream to celebrate their 10th birthday, see: http://advision.webevents.yahoo.com/yahoo_birthday/ but only for the next 35 minutes or so..

March 6, 2005

Game Review: Playboy - The Mansion

I decided to get hold of a copy of Playboy - The Mansion, a concept that seemed interesting. After playing it I am a bit disappointed. It is just too 'samey' and very similar to the Sims. I expected this but it is almost identical. It has lots to uncover and it, for some unknown reason, is quite addictive. I think I will probably end up playing it for a while and it will grow on me. It isn't a bad game, but it is nothing outstanding and not worth the price on the label. The main problem is the issue of their never being a deadline on time, you can just go on and on - little pointless. End of the day it is still cool to be playing Hef.
More:
Official Game site: http://www.playhef.com/
Gamespot.com Review:
http://www.gamespot.com/pc/strategy/playboymansion/review.html

March 10, 2005

FORTRAN 77

I have recently started using FORTAN 77, a programming language that was invented 5 years before I was born (in 1978 - don't ask why 77 then!)! It is fast and powerful, though a bit out of date. In general I am enjoying using it though I have a mind set towards C++ at times, when I remember my C++ coding that is! FORTRAN 77 itself was created by a team at IBM lead by John Backus. Fortran stands for FORmula TRANslation and is mainly used by scientists - it would be no good for developing tools for mobile phones for example but is damn powerful when it comes to data manipulation. It has been updated regularly but most people still use good old FORTRAN 77. If anyone wants to learn some FORTRAN 77 take a look at http://www.star.le.ac.uk/%7Ecgp/prof77.html, this is an excellent manual that I stumbled across today. Oh what fun that would be ;-)

April 4, 2005

Spell check add-on for Firefox

If you are using Mozilla Firefox as your web browser (if you aren't then get it from http://www.mozilla.org/products/firefox/) then there are now a myriad of different add-ons available. I personally use SAGE which is a feed reader. Quite useful to get the latest news. One thing I have always thought would be good for web forms, that don't have the functionality built into them, is a spell checker. Well I shall now introduce you to Spellbound, http://spellbound.sourceforge.net/. This is a rather useful and I personally like it, though I haven't used it much yet but I know I am bound to. All I need now is a grammar checker and off I go :-)

April 14, 2005

Hard disk storage animation

This flash animation is all about hard disks and the flipping of bytes (http://hitachigst.com/hdd/research/recording_head/pr/PerpendicularAnimation.html) ... take a look its quite funny.

May 27, 2005

BitTorrent Blitzed

The Feds have shut down EliteTorrents.org, supposedly one of the best sites in the torrent community, I personally have never used BitTorrent. The webiste now has a big warning from the Feds that goes something like this: "HAS BEEN PERMANENTLY SHUT DOWN BY THE FEDERAL BUREAU OF INVESTIGATION AND U.S. IMMIGRATION AND CUSTOMS ENFORCEMENT

Individuals involved in the operation and use of the Elite Torrents network are under investigation for criminal copyright infringement".
Another one for the MPAA eh? (Motion Picture Association of America).
Some more info can be found here: [Reuters], [SlashDot.org], [Geek.com].
Oh and remember (probably only people from the UK will get this) that piracy funds terrorism, even when it costs no one a penny and that's a matter of FACT. :=)

June 4, 2005

Max Payne 3...(?)

...maybe not but almost. The makers of the Max Payne games are going to be bringing us another psychological action thriller - Alan Wake.




This game has been classified by many as the best game to come out of E3 (well in close competition to UT2007). Personally I can not wait - I love the max payne games. Lots of fun and not too long that you get a bored of it, to be honest I doubt I would have gotten bored of it. I can't wait for this now.

More:

Alan Wake Official Site

Gamespy Preview

August 15, 2005

Star Trek: A final Unity

My brother-in-law decided he wanted to have a go of [Star Trek: A final Unity] today and asked my help to get it to work, it seems it didn't want to work in windows xp. This is a curse that many old games suffer with xp. This game was releases in 1994 so I wasn't expecting it to be easy, it shouldn't have been this hard though (I remember doing this the first time round and it was a bitch then though!)! The first major problem was it was not detecting the hardware correctly and was telling me that the computer doesn't have the minimum specifications to work! I thought this was funny but it was also causing a huge problem. Why oh why isn't installing anything easy. Essentially because this failed it would not allow me to install the game. Argh! I then immediately though [DOS Box], which is a program that emulates DOS and does it expertly. I first came across this when I was trying to get [X-COM: Terror from the Deep] working (another brilliant game from a similar era). It did the trick then, it didn't now. In all fairness it was probably because I didn't use the correct setup, but before I started playing around with this I came up with another idea.

I decided to copy over all the *.lst files from the cdrom to a new directory on my computer, this directory is where I will "install" the game. Once this was done it was just a process of unzipping STTNGINS.ZIP which is on the Cdrom.

Now that this is completed it essentially means that the optimal version is "installed". This is not quite true as we haven't setup the configuration file which would normally have been setup during the install.exe process. To do this all you need to do is change, in your new directory, the STTNG.ini file. This is a rather simple parameter file and contains all the settings you need to get this to run. The settings I used were (you can probably use the defaults but will find no sound!):

Audio=SB8
Port=0x220
IRQ=0x7
DMA=0x1
Video=HI8
Sound=ON
Music=ON
Voices=ON
Movies=ON
Advice=0x0
VolMusic=0x7fff
VolSound=0x7fff
Dialogs=ON
Scale=ON
DPixel=ON
Path=C:\STTNG\
CD=D:\
UniVESA=OFF


Another thing that you should note, this still didn't work correctly directly from windows (it might if you run the sttng.exe in windows 95 compatibility mode, but I didn't try this). You have to still really use DOS Box and try and the settings right. Remember to mount the cdrom drive (mount d d:\) and the c:\ drive. Oh it might also take longer than expected to boot but this really depends on how you have dos box setup.

I hope this is of help to someone, if not then I have just ranted on - like usual!

More old games...to download!

I occasionally feel in the mood to play some old games and I go off on a hunt around the web to see if I can find it (normally quicker than hunting through countless boxes). Today I came across [oldgames.org] which has quite a few good oldies. I actually haven't tried many of them but SimFarm seemed to work! It is all abandonware, so I guess it is legit and saves you having to hunt around for old games. Most can probably be found in a bin at [gamestation] for 50p! There are some great games on there. At a glance I'd recommend giving Dune 2, Prince Of Persia, X-Com: UFO Defence (probably my favorite on the list!), SimCity 2000 (close behind the previous!), SimTower (I spent ages of my first christmas at home from uni playing this...only 3 years ago!) a go! You probably need [Dos Box] to play them though.

August 21, 2005

Star Wars: Empire at War

LucasArts have released the first trailer for the upcoming Empire at War game and it looks brilliant!

See the trailer at: [LucasArts]

This is to be probably the most graphically detailed space stratergy game ever made and promises a huge amount of control. The only problem is we have to wait till february.

August 23, 2005

SQL Random Rows Code


Time for another piece of SQL code. This might, like the [previous one], be useful to someone. What this one does it from a database in the SDSS database, with objID and plate in, returns them in a random order. Now why would you want to do this? Well, maybe, you just want to return a random sample from the SDSS without having to download the sample (due to its size it is unfeasible to download it all) and run some C program. This allows the randomization to be completed without having to download any data. The idea for this came from [SqlTeam.com].


-- don't bother with useless row counts

set nocount on

declare @rand_temp float

CREATE TABLE #temp (objID bigint NOT NULL, Ran_Num float NULL, plate int NOT NULL)

INSERT #temp (objID, plate) SELECT objID, plate FROM z_table

--assign a new random value to each key value in #temp

DECLARE Random_Return CURSOR

FOR SELECT Ran_Num FROM #temp

OPEN Random_Return

FETCH NEXT FROM Random_Return

into @rand_temp

WHILE @@Fetch_Status != -1

BEGIN

UPDATE #temp SET Ran_Num = rand()

WHERE CURRENT OF Random_Return

FETCH NEXT FROM Random_Return

into @rand_temp

END

CLOSE Random_Return

DEALLOCATE Random_Return

--export the data from the temp table

select *

INTO z_random

from #temp

order by Ran_Num



September 10, 2005

Lego Computer

This is just so cool! (or is it just me being a geek?)

November 4, 2005

God violates Intel trademark


Ok this is an oldish article but it made me laugh. [TheRegister]



jesus_inside

Past, present and future of CSS layout


Interesting article about CSS (Cascading Style Sheets) [W3.org] in particular I am very interested in the future developments of CSS and I can see some rather cool changes.

December 31, 2005

Time to go 3D with our webdesigns

You may have noticed that most of this site has had a complete makeover (it will all be done soonish) and I'll write more about that soon but not now. Now I am here to give you an interesting link! I have for years wondered why 3d elements were missing from operating systems, ok it would be odd to have a 3d menu system and it would be quite useless baring in mind we have a 2d display. Anyway I do rant on at times. I am actually here to write about 3d website design. Well it is not really 3d in the sense I have just wrote about but it is layering, which essentially introduces the z direction into our geometrical arguement. You might think its odd to suggest that this is new stuff since essentially this can be achieved with traditional css, heck I know I have come up with it on many occasions when I really didn't want it to. That is the point, it wasn't meant for this. To really do the layering so you can layer images over each over nicely you need some nice image editing suite, I use photoshop for this! That means you can't really do it dynamically as you go along, though I bet with some fancy php you could do it in some sense but it would not be elegant and quick. Well the future is z-indexing. Essentially each "z-index" gives you another layer and you can build up nice layered images. I believe [this] is a really funky example. Probably not the best to sell the idea to budding designers though! Anyway there is a much better and more thought provoking discussion over at [24ways.org], take a read.

January 4, 2006

Now this is the way to advertise Linux

No word can describe the natural beauty of the new Linux marketing plans...

linux_ad

This is taken from [this] site, which has even more girls dressed up in Linux geer. Obviously some look better than others, like you would expect :-). Oh and this page includes higher resolution images, for your viewing pleasure. lol.

January 6, 2006

Malicious antispyware tools

The concept of software developers coming up with Viruses and other malicious code has always interested me, I normally have put it down to paranoid conspiracy talk and that there are some good programmers out there fighting the evil demons. Saying all this I came across [this] interesting article which is mostly about a spyware "remover tool" called Spyware Cleaner (note: I really wouldn't use it, use Spybot or something), oh and SpyAxe (again, stay away!). This provides a really interesting discussion and really just puts across good evidence about these companies engaging in some rather dodgy buisness practices. If you want to know more about safe computing take a look at [this] article off the [PC-Pals] forum - some of the info is probably a little outdated but the core ideas and ethos you should have towards computing do not change over time!

January 7, 2006

New ASR website...

Well, thats it, done. At long last I we have finished the new University of Birmingham Astrophysics and Space Research Group's website!! YAY. It was long and at times very annoying, but I think we are pleased with the final outcomes, oh take a look at the [ASR Site] if you really want. It took lots of effort and is, I think, a huge improvement over the old site! I have a few minor corrections to make but heck the main stuff is done. Now I can sleep at night without seeing php and css floating around the room!

January 10, 2006

Wanna exclude robots?

Oh and I'm talking about from your website, we aren't quite at the point when you want to stop them from walking in to your house. No robots scripts are great if you don't want a certain robot picking up your site and indexing it incorrectly or if what I'm interested in (as I'm too lazy to be bothered by the previous) and stop robots from visiting certain pages; especially ones containing personel data. The last thing you want to essentially end up doing is allowing people to find all the info on one person via a quick google search. Anyway if you want to do this I suggest that you take a read of [robotstxt.org] which provides basically all you need to know to get this setup, its a very good page.

January 21, 2006

20 years and still as annoying

It will be 20 years since the first computer virus was written! Well it didn't do much harm, needing floppy disc (do you remember them!) to get around the place! Anyway, 20 years(!) bloody hell... it can only get worse. Take a look at this [BBC Article]

January 30, 2006

Play C64 games online!!

If I hadn't got it enough things to distract myself with instead of working now I have an excellent site full of crack C64 games to play... take a look at c64.com and you will be hapily suprised.

February 14, 2006

The Ten Commandments for C Programmers

Take a look at [this], it is funny though probably quite geeky. I dont care!

February 19, 2006

I think I like fink..

I decided I needed something to make my life easier in installing ports of software to the mac, so I have installed [fink].. it seems to work like apt on debian or yum on other systems... good, cause that makes getting software so easy.

March 6, 2006

If Microsoft made cars...

This is funny, thanks Tom, take a look at: [BoreMe]

April 7, 2006

Laser Keyboard??

laser_keyboard

I want one!! Please santa.. well maybe not quite at that price. Still though how cool is that. If you wanna know more I suggest you take a look at: [Virtual Laser Keyboard]

April 9, 2006

More to get the masses using Linux:

linux

She uses linux so why don't you!

How Gates is gonna take Linux out...

gates_penguin

(I'm not sure of the reference for this image...sorry that I can't give proper credit)

April 10, 2006

Project Looking Glass

3D desktop? If you thought the Mac's way of operating was cool then with nice transparency and 3d alternate desktops... well you will love Project Looking Glass. Fully 3D... it is in very alpha stages at the moment though I do have a friend who has gotten it install on a linux box. Take a further look at [sun.com]. Here is a rather cool and astronomical screenshot I found earlier:

looking_glass

Installing Vista on a mac....

Well Vista is out in pre-release form.. i.e. without SR1 :-)

Anyway some wacked out souls are trying, and being successful, in installing it on a mac.. why would u wanna remove that beautiful OS and put shitty windows on I don't know, anyway more info and screen shots here: [osx86project] and [engadget.com]

April 11, 2006

Making GNOME Look Like OS X

A very interesting read [here]... something I might have to have a play with if I get chance at the weekend. I love GNOME but I do love MAC OS X.... so if my desktop was as pretty as my laptop more the better! :-)

April 15, 2006

Irish Virus

A quite special description of this very very dangerous Irish virus. A big thank you to the mate of mine who posted this image on the pc help forum (you know who you are if you are reading this). LOL

irish_virus

May 3, 2006

Microsoft announce RSS icons to be orange...

Yep thats right, the new IE will be using the same icons as the mozilla ones, respect to mozilla and in a sense to M$ for being sensible for the user at large. [MSDN BLog]

May 8, 2006

Setting up network printers on my mac

Now that was easy! I was expecting it to take hours but nope, nice and simple. Well it wasn't when I didn't realise that I had to use LPD. On my journey for a bit of advice I came across, [this].

May 11, 2006

WinPatrol 9.8.1

A good way of stopping spyware is to have a program that helps you stop stuff being installed, WinPatrol does this. I recently gave it a donwload and along with Spybot I think it is doing a good job... though I hate the fact that I have to use all these, even if they are good, programs just because the OS (in this case bloody M$ windows) is shite. Take a look at reviews and comments (and even download it) on WinPatrol [here]

May 12, 2006

Connect your Creative Zen to your Mac

As a Mac laptop user I thought it would be useful that I connected up my creative zen mp3 player, heck cause when I am not listening to music on my laptop and I'm not out home it has to be on my mp3 player. Since lots of the music I download I do on my laptop I have to have a way to connect the two. I, at first, since Apple and Creative are competitors thought this might be difficult. Turns out there is no real support in a sense but then I stumbled across [XNJB] which does the job of connecting and uploading and download tracks nicely. It also allows playlists to be created and does everything I need, wicked. Sorted. So if you are wondering how to do this, do this!

May 17, 2006

AppZapper

Zap, bye bye, goes that rather annoying application that you just couldn't be arsed to get rid of. Annoyingly Mac OS X doesn't come with an uninstaller (it has the best installer I know of but.. argh!), which isn't the worst thing as you can still remove the applications manully.. but some times you really want to clear out all the shite. So I downloaded and test [AppZapper]. It did the trick nicely and since I had a coupon for it I could get it for $9.99... which is about a fiver, I guess. So what the hell I decided to get it. It is a nice program and gives me the freedom to install any crap I wan't being to immediately delete it if, indeed, it is crap.

May 20, 2006

Running software remotely or in the background

This is something I keep meaning to do with my scripts, it is normally not an issue but has become while whilst at Lizzie's the last few days whilst I have been ill. It would have been rather useful to setup a task and let it run without my laptop being connected to the network. I knew there had to be an easy solution and indeed there is ... nohup taskname & ... does the trick! :-) Anyway for more useful info on this... [read from more knowledgable people].

May 21, 2006

Kororaa - linux with Xgl, yay!

Do you want a linux distribution that looks good and by looks good I mean great! It has that Mac OS X feel to it. I suggest you go get the LiveCD then within 5 minutes you will be enjoying a treat of the this new technology! kororaa is great. I think I may have to install it on my laptop. You can get the LiveCD from [here], go have fun! It's free and doesn't take any knowledge or much effort!

and now pretty multiple windows on the mac

I know this has been around for ages but since I was trying out xgl I though I would go about installing mutliple desktops on my mac, I came across [VirtueDesktops] which does the job nice and simply, lots of fun.. and since I have a tiny 12" laptop will help with my clutter!

Multiple Desktop Sessions on Mac OS X Tiger

Moving one step further from just having multiple desktops, lets do it so you can use another computer to use your mac, with vnc installed: OSXvnc 1.6

May 25, 2006

Hapland 3 released

Oh no! Time to distract myself with the fun of hapland yet again, this addictive and possibly pretty annoying (cause you have to complete it) game is back! Yet another environment is designed full of strange and odd goings on... to play it you need Flash 8... go and take a look over at [foon.co.uk]

June 10, 2006

A reminder why you should use Linux and not Windows

This is a quite interesting / at times annoying (cause it reminds you of annoying moments) animation... [Link]

June 14, 2006

A better windows error

can't touch this...

hammertime

June 18, 2006

Live SUSE

It's about time I regave SUSE a chance and I noticed today that you can now (this probably occured ages ago) donwload a live bootable dvd. I think I shall do this later and give it a go. I'm quite happy with my fedora installation but its always fun to give something new a go. Anyway if you fancy downloading SUSE Linux 10.1 live or installable go to [SUSE Linux 10.1].

July 3, 2006

Firefox's Blake Ross's Agenda - annihilate Bill Gates

Take a look at the image of the first slide... [nwsoruce.com] I wish I was there for that. If you are lazy this is what it says:

Project Goals

*Annihilate Bill Gates and feast on the bloody remains of his shattered empire

*Liberate the world from the encumberring bondage of prop*ty software

Anyway the rest of the article isn't the most interesting but that says it all. lol. T

The real firefox??

Take a look at [thingsthatmakeyougoaahh.com]. They have a nice cute animal on that page and yes it does look like a firefox! I do wonder if it isn't just a dog with some red painted on it... eitherway it looks cute!

July 8, 2006

Blu-ray and HD DVD Hacked Already

HAHA, how simple but so effective... [gizmodo.com]

July 14, 2006

Windows Fundamentals for Legacy PCs

Older hardware to use newer operating systems, is this M$'s way out of supporting old operating systems... and make some more money... ? Take a look at [Windows Fundamentals for Legacy PCs]

MSN and Yahoo can talk to each other

Looks like MSN and yahoo are forming some sort of evil alliance to fight against the good forces of Google.... well maybe not quite that dramatic but it does look as if that must be the reason. Both must be terrified of Google since it now has so many cool services all integrated... if you wanna know a lot more take a look: [here]

Welcome to Google Spreadsheets

I wonder how long it will take for google to have all the desktop packages available via their site... now you can do spreadsheets... give it a go [here]

qastrocam - astrophotography in linux..

After a linux solution to your astronomical imaging? Then take a look at [qastrocam]. I have yet to try it but expect I will be using it in the near future. I have heard lots of good things about it though. Oh the website is in French but there is a nice babel fish translation tool at the top...

July 24, 2006

Mac vs. PC videos...

After the mac put out a bunch of cool vids advertising their product there have been a bunch of home made versions appear (by a number I mean a lot). Anyway on youtube you will find loads. Here are a couple I really like... the original mac one [pc virus] and there is always the one that includes linux [but we aren't all geeks]. Oh, and sometimes a picture is worth a thousand words - [microsofts response]

July 29, 2006

ie7.com

If this is not a reason to move over to Firefox then I can't think of one... [http://www.ie7.com/]

WordPod - put books on your iPod

I am going on a long trip to India and don't really want to carry a bunch of books, and heck I can get them free from [Project Gutenberg] so I though I would use my iPod's notes feature... it would actually be quite annoying to do this but there is a nice tool already designed to do the job [WordPod].. works well (is free!) and allows me to do just what I want, read! :-)

July 31, 2006

Microsoft to charge for Office betas

Microsoft is to start charging $1.50 for beta versions of Office 2007. From 2 August anyone wanting to download the software will have to pay the small fee. So if you want it free, do it now! :-) I would probably recommend going for the free Open Office but heck if it is free doesn't hurt to give it a go... get it [here]

August 5, 2006

Trying linux, another method...

Still want to give linux a go? Fancy trying it from within Windows? Well DSL (Damn Small Linux) might have the answer. The whole point in Damn Small Linux is to get a bootable (with useful apps) version of linux as small as possilbe and infact it is damn small. For 50mb you can once again have an operating system. Another great thing is that you can boot this version of linux from within your windows installation. I wouldnt say you will get the best installation or linux experience from doing this, but it does give you a damn good start. Also for someone like me, this is great. When I use windows, linux is no more than a click on the desktop (or in my case a double click and my screen changes to my linux desktop, but thats a different story! :-) ).

Anyway more info on Damn Small Linux - [http://www.damnsmalllinux.org]

And this is the file you want to download: [LINK]

August 12, 2006

VLC media player

Whilst trying to work here in India I also have a need for evening entertainment, so I encoded a couple of DVDs so I could watch them off my laptop. Anyway I must have done one with a different audiocodec or something, well eitherway quicktime on my mac refused to give me sound. So whilst looking for a solution (and reinstalling a bunch of codecs) I came across VLC media player. I gave me the solution immediately and seems like a rather useful tool allowing me to do lots of different thing from within one application. Also it is cross platform which is rather useful. So you windows and linux persons can also use it. I'll probably install it when I reconfigure my fedora o/s at home to a debian based one. Anyway take a look [VLC media player]

August 21, 2006

Vista Marketing

vista

August 22, 2006

Ultimate Boot CD

Ever need a boot cd with loads of handy utils to get your system back up and running? Well I recently cause myself to have a rather large MBR (master boot record) problem with my hard disk whilst installing, failing to at the time, ubuntu over fedora. I now have it fixed by using the tools on the Ultimate Boot CD. I actually found that I couldnt repair grub at all and fdisk wouldnt allow me to remove the mbr, but a couple of the tools on this did. So yay... now I have ubuntu :-) Oh the ultimate boot cd is available for free: [here]

September 3, 2006

Ubuntu Guide

I came across a great guide to installing pretty much anything / setting up anything you could think of in Ubuntu earlier... [ubuntuguide.org]. Now that has saved me a lot of time messing about. A complete (and by complete I mean with every tool I could use in linux) linux installation in under an 1 hour with this and the live install cd, not bad at all!

September 14, 2006

A PS3-Based Supercomputer?

Well yes, it looks like it will be happening - and no it doesn't involve plugging a bunch of the unfinished and delayed PS3 together. It invovles IBM using the chips that were devloped for the PS3 and putting them in the to-be-best supercomputer in the world. See: [redherring.com]

September 16, 2006

Go full screen with Quicktime

I hate quicktime, I normally use other programs but sometimes you need it. I hate the fact that on the mac it will not go to fullscreen.... well there is a simple fix [here]

Windows Backup Tool

I came across a very useful windows backup tool today. It works a bit like rysnc - which is just what I wanted to be honest! It is from 2BrightSparks and is called
SyncBackSE - they have a paid and free version, guess what I went for (the free one!). It does the trick nicely. You can even schedule it easily. If you want the free version see: [here]. It will take about 5 minutes to get into and trust me it might save your life....

September 24, 2006

iPod People

Like the iPod ads? They do look rather cool don't they. Anyway I came across a couple of interesting pages on how to do this. I have attempted to do it myself but my efforts aren't great, if I get some more time I will try and do some better ones that are worthy of posting. Anyway here are some links, the first is a bit more basic [www.photoshopsupport.com] but the second [www.macmerc.com]is a bit more advanced and probably will get the best results.

November 7, 2006

New Microsoft Firefox

Well here is something I never thought I would see... Microsoft Firefox - http://www.msfirefox.com/. I particularly like the enchanced features: "Tired of slow image rendering? Microsoft Firefox 2007 can deliver online pornography at blazing fiery speeds. By using a proprietary dynamic algorithm, anything that remotely resembles a tit or a boob will download up to 10 times faster! " lol....

and if you didn't gather its a complete but convincing piss-take! :-)

December 9, 2006

Darwiin Remote

I can see myself having some fun with this later... DarwiinRemote is a tiny software which reads data from and sends data to Nintendo Wii Remote... ooh fun. See [here]

December 12, 2006

Is it windows or is it a mac?

A bit of playing around with Windows XP and of course some [Crystal XP] can go a long way in helping make windows xp more tolerable. I decided today that I would finally play around with it and wow(!) I'm pleased I did....

desktop

More fun with Crystal XP

WOW, it even looks cool with music...

crystal_music

December 15, 2006

Speed Test your connection

Ever wondered how fast your connection is? Is your ISP giving you anything near to what they say? Take a look at [speedtest.net] and you might just find out! I currently have almost what I would expect, so good on ya telewest:

Notepad 2, a light flexible upgrade!

When I am using Windows I have to say I spend most of my time using the most useful app on there, yes notepad! I use other text editors for most of my work, normally on my Mac or Linux machine, for those I use xemacs or aquamacs. They do the job great but I have never been to happy with anything for Windows. I just have stayed with notepad. Though I think I have just stumbled across a very useful replacement. This has been called notepad2 but has nothing to do with microsoft and it adds some rather useful little features that you could so do with in notepad, give it a go... [notepad2] it won't take up much space and runs from the exe...

Sunbird - control your life!

I use, and still will, [Google Calendar] to control my life but one thing I don't like about it is when I don't have a webconnection - this doesn't happen often. So I decided I wanted one tool that I could use on linux, windows and mac os x... turns out Mozilla already have this and it is called [Sunbird]. It works pretty well and allows me, via the remote calendar, to connect to my google account and dump the data into it.. nice and handy!

December 30, 2006

Real Star Constellations on the Wii

This is great... get the weather on the Wii and find where the stars should be!

[here for more]

February 3, 2007

Linux: you know you want to

If you have thought trying Linux is hard and alien to windows then you have been wrongly informed. It isn't too dissimilar. In fact the only difference in using it can be the installation procedure, you have to do and I know most people probably never have had to. So if you find yourself wanting to install and modern and competitive desktop try Ubuntu, there are some good guides out there and I would recommend, [this one]

February 13, 2007

Top 10 Flickr hacks...

by Thomas Hawk... quite an interesting article [here]

If you use the first example of the hacks you can get all my images thumbnailed nicely... see [http://www.flickrleech.net/user/ringsofsaturnrock]

February 17, 2007

Vista first look: Bugs and confusion

This article, ,[Vista first look: Bugs and confusion] quite nicely describes what I feel about Vista. Vista is good but when I have used it I just would prefer to be using a Mac.

No proprietary software in schools!

I really feel we should teach a wide range of IT tools in Schools. Currently we focus too much on microsoft technologies and people just don't have a clue about how you can do things for free! You don't need to buy £200 office you can get open office for free etc... There currently is a petition (yes another one in the same day) to the UK government to try and change policy on this and, of course, to save the country some money! [Teach Open Source]

February 25, 2007

Wow - XP on 8MHz processor

Some people obviously have lots of time to waste, but if you are gonna waste it - waste it in a geek way! :-) [8MHz XP!]

May 9, 2007

Introducing Microsoft's Ofone...

In a funny attempt to combat Apple's wonderful Mac/Pc adverts (well maybe not but I'm thinking it is likely) the below video has appeared from Microsoft (or at least by people who won't get sued by them for having a laugh)... nice way to tackle the Apple iPhone.

Microsoft Re-Designs the Ipod Packaging

Following on from the earlier ofone blog entry.. my girlfriend after watching the ophone video followed a link to this piece of interesting video. You just know this is what microsoft would do, though saying that I think there is something to be said for having some details on a box other than just a nice and shiny looking iPod (though that sold it for me biggrin.gif)

May 14, 2007

Cunning Microsoft advert...

Good reason to go out an buy microsoft office? No, us Geeks would never get any biggrin.gif

microsoft advert

The Reason I use Ubuntu...

The Reason I use Ubuntu... its linux for human beings.. well see the picture, you will understand huh.gif

Ubuntu

oh if this inspires you to want to give Ubuntu linux ago, try [here]

May 19, 2007

The GCX project

GCX is an astronomical image processing and photometry application written in C using Gtk+-1.2, and provided under the Gnu General Public License. It was tested on Linux, FreeBSD and OS/X (using the X Window System). I have recently been playing around with this, well worth a look at if you are interested in Astro Imaging on a non-mircosoft platform. [The GCX project]

May 23, 2007

Astronomical Linux

I'm pretty sure I have mentioned this in the past but I have noticed a bit of a change since I last did (whenever that was, I'm tired and being too lazy to search the archives!)... but if you are an astronomer and want to switch over to linux to do your imaging etc... then you should really give Lin4Astro go. Lin4Astro is a pretty solid Linux distribution that has a combination of the usual and bloody essentially linux tasks and some very cool and sophisticated astronomical software. This should nicely fill most observers needs and of course is being developed continously, oh and its free!! Take a look... [lin4astro.org].

Oh and on that note take a look at [usinglinux.org] for a decent list of useful astronomical software available on linux (this list is very far from exhaustive though).

In other news, cause I'm tired and in the need for a bit of a rant... I think I may have just completed my first paper to be submitted to the Monthly Notices of the Royal Astronomical Publication... wooo hooo.... better check it in the morning though as tiredness has really kicked in now!

May 25, 2007

Why have Aero when you can have Beryl...

Windows Vista comes with Aero to do some cool 3d effects in your desktop... well xgl has been around for linux for a while (and the mac does some nice 3d rendering) but if you a fan of free software then Beryl has to be heaven, of course you have also like having a pretty linux desktop. If you don't know what I mean take a look at this video... even if you aren't ever going to use linux just take a look I think you might find it cool:


Oh and if you want to get Beryl some pretty useful stuff can be found on their site and if you know how to use Linux its pretty straight forward.

June 2, 2007

Running Windows Apps on Ubuntu (/linux)

I have been running ubuntu for quite some time now and recently started played around with running windows applications on it. To do this I have been using the Wine package. [Wine] is an Open Source implementation of the Windows API on top of X, OpenGL, and Unix. Essentially this allows you to run windows apps through it. Quite nifty as there are more than a couple of Windows programs that I can't live without. The first, and what I will show you how to setup, is Fairuse Wizard - a tool for extracting dvd content.

If you are using ubuntu then the installation is pretty simple (it is for most Linux distro's I suggest you take a look at the [Wine pages] for more info on diffenet ones). So how do we get it working ok, at the terminal windows type:

> sudo aptitude install wine

This will ask you if you are sure in a bit, obiously say yes if you want to try this :-)

Now you need to configure wine so run:

> winecfg

Load the "Drives" tab, and click "Autodetect...".

Once you have done this it will assign windows drive letters to your drives.

Now:

> cd .wine/

and list the directory contents (ls) or in the file manager (make sure you can view hidden files) go to the .wine directory. You should now see the directory drive_c (or similar).

Now you need to get the fairuse (or whatever) setup file, so use:

wget http://www.fairusewizard.com/Release/FU-Setup_LE.exe

Now Run the installer with Wine

> wine FU-Setup_LE.exe

Now install the program like you would in windows, the look might not be the same but it should work.

Once installed, with any luck you have a desktop icon (if so run this), just run the executable from the correct directory with wine and you are go...

> wine FU.EXE

Here is the proof...

fair use wizard on ubuntu

Now one less reason why I need windows on a regular basis...

June 8, 2007

Ban the teaching of proprietary software in schools

Recently an e-petition was given to the government on the use of open source software in schools (see: [here]). I signed it. I thought it was an interesting question and I feel that people leave schools underprepaired for using anything apart from commerical software. Anyway, the goverment has responded to this... it is an interesting response (see [here]) and is postivie to using open source software as they point out they have an agency which looks into such matters. Though it has some nice comments I do wonder and doubt if within a decade we will see the use of open source software in schools... they say they want to prepare people for work, well thats fine but maybe giving them a wider education would work. It would be good if they just had other tools installed and maybe just some basic training in the open source tools. I can see a situation were both M$ Office and Open Office is installed and the students can choose which they prefer and it is marked accordingly - also Open Office is free and students whose parents can only afford a basic machine at home can easily get open office at no cost!

June 14, 2007

New PPS site...

I finally have gotten around to put the new Poynting Physical Society website together.. and I was able to finally get around to trying out a few PHP ideas I had on it biggrin.gif... take a look at: [ppsbham.co.uk]

July 27, 2007

Black Google Would Save Energy

It is believed that an all white computer screen, such as the Google page, uses 74 watts to display, whereas a black screen consumes only 59 watts and so a black version of google, such as blackle.com would infact save energy! Sounds ok, apart from the eye strain doesn't it? Well I'm not entirely sure I believe it though as surely this doesn't apply to LCDs... not sure though, but the Wall Street Journal backs this up here.

Maybe its worth it.. but I think I'd rather not deal with the awkwardness of reading and save energy elsewhere...

October 26, 2007

Astrophysicist Replaces Supercomputer with Eight PlayStation 3s

The PS3 may be finding a new calling in the realm of science and research. I'm not sure that this is the most cost-effective way as surely an inhouse built machine would be cheaper but eitherway its pretty cool: [www.wired.com]

November 21, 2007

The TeX showcase

Ever wanted to see what you can do with TeX? (if you don't know what TeX is then its a typesetting program that makes your work look swish). Then take a look at the TeX showcase - [www.tug.org/texshowcase].

March 23, 2008

My new laptop - the Asus eeePC

It doesn't seem too long ago I got all excited and went and got my mac book pro. As time has gone on I have loved that laptop (and still do) but I wanted to get a really small and truly light one. I had heard about the [eeePC] a while ago now and then the other day we came across it at, you may be surprise, Toys R Us! Turns out they were out of stock and after going back on Friday it was still the same case. After running around and a tip off from one of my mates (cheers Tony!) we managed to get on at Curry's. I have to say I have fully fallen in love with it!

The key reasons I got one was: Size: 225 mm x 164 mm x 35 cm, Weight: 920g incl battery. Remarkable! It was also only £250.. so it is not going to break the bank.. and god forbid it happening but if it did get stolen its not quite the same as the £1,500 for the mac...

Though a bit small for my fingers its absolutely wonderful. It comes with a custom built version of [xandros] (a linux OS). Its a pretty cool operating system and after a few tweaks (take a look at [eeeuser.com]) you easily can have a fully windowing system and not just the default tabbed display. I now have an installation of XUbuntu running off a memory stick... which I will eventually replace with a SD card.. so I don't forget to bring the OS with me! :-D If you have one and fancy doing it take a quick look at: [installing_alt_op] or [ubuntu-eee.tuxfamily.org]. A cool video showing what you can do with Ubuntu on this small machine can be found on [youtube.com].

What else to say but this thing is cool and has probably lead me to way too much distraction as of this weekend... and probably will in the next week!

For further reading the [wiki page] provides some interesting background... and if you want to know what it looks like on the inside then some cool (but maybe also crazy!) person took his apart [tweaktown.com].

April 3, 2008

Ubuntu @ home and in a can!

Well I finally did it I moved my main desktop machine over to boot only Ubuntu (been running it on other machines for donkeys), I'm not sure what the finally straw with booting windows and running X in it but something was and thats that. Ubuntu is a pleasure to install and use - I'll blog more about what I've got running and how when I get time but you probably don't need to hear this but for any of you windows fans out there I will try and convert... oh and if you still fancy using windows, well you can run it inside ubuntu (8second boot up...)

ubuntu_windows

oh and if you are ubuntu fan.... now get it in drink form:

ubuntu_can

its pretty good cola.

April 6, 2008

Vista inside Ubuntu..

Am I pleased.. I think so. I have Vista working in virtual machine under Ubuntu. It works. It is slow but then again I don't intend to ever use Vista I just wondered if I could get it to work and maybe use it to help fixed problems that friends and family come across. Oh and below is the "proof":

vista_ubuntu

April 7, 2008

Messing about with Ubuntu

I'm a bit unsure what the title of this entry should be and I'm a bit unsure about what I should actually mention. I had intended this to be a collection of things I did after I had installed Ubuntu on my machine. This could be, for some of you, the most boring entry you have ever seen. Hopefully some of the geekier readers will like this. I'm still not sure what is going to go here / if it will be of use for anyone. At least I will use it as a point of reference for myself. Hell that's what this blog is all about. It is about me being too lazy to keep detailed notes and diaries.. and hopefully to give some of you an insight into my mind and what I'm upto. Lets be honest I'm pretty sure my most dedicated reader is my Mom (hi Mom - trust me this entry is not one for you... but if any of this sounds better than that Microsoft Vista installation I dumped on you...!biggrin.gif).

Oh well here goes. Hopefully this might inspire some of you to give Ubuntu a go, its simple really and to install you just pop in the cd and off you go...

Audio Visual

Probably the most important, lets get some metal on while we do the rest...

Sort out your soundcard...

[http://ubuntuforums.org]


Install Mplayer and Multimedia Codecs (libdvdcss2,w32codecs) in Ubuntu 7.10 (Gutsy Gibbon)

"MPlayer is a movie and animation player that supports a wide range of codecs and file formats, including MPEG 1/2/4,DivX 3/4/5, Windows Media 7/8/9, RealAudio/Video up to 9, Quicktime 5/6, and Vivo 1/2. It has many MX/SSE (2)/3Dnow(Ex) optimized native audio and video codecs, but allows using XAnim’s and RealPlayer’s binary codec plugins, and Win32 codec DLLs. It has basic VCD/DVD playback functionality, including DVD subtitles, but supports many text- based subtitle formats too. For video output, nearly every existing interface is supported. It’s also able to convert any supported files to raw/divx/mpeg4 AVI (pcm/mp3 audio), and even video grabbing from V4L devices."

[http://www.ubuntugeek.com]

Use amarok for your music! works great with your ipod... sudo apt-get install amarok - and you can use it with last.fm - and there are tons of scripts out there! [amarok]

Copying DVDs (note: this is for legit purposes...) - XDVDShrink: [XDVDShrink]

This and some important codecs can all be installed using Automatix2 - [Automatix2]

Mounting your disks...

How to fstab - [http://ubuntuforums.org]


The configuration file /etc/fstab contains the necessary information to mount the disk. This file comes read at the start of the system and can be modified only by root user. [ubuntu.com]


How to edit and understand /etc/fstab [tuxfiles.org]

I finally got it to work by setting up the fstab correctly and then chown the directory it was mounted so I owned it! This took me longer to think of than I would have expected, silly brain as it was a pretty obvious thing to do.

Reading NTFS disks, Ubuntu Gutsy did this for me ok but for reference [ubuntuforums.org].


Booting

Grubb issues, don't we love to hate it! :-D

How to restore Grub from a live Ubuntu cd [ubuntuforums.org]

Recovering Ubuntu after installing Windows - if you dual boot: [help.ubuntu.com]
(I'd suggest you don't dual boot.. well if you only want to use a few windows task or play simple games - if this is you then think Wine or booting windows in a virtual machine).


Run other operating system's inside Ubuntu!

Virtualbox, how to: http://howtoforge.com/virtualbox_ubuntu

Create and Manage Virtual Machines Using VirtualBox: [www.ubuntugeek.com]

Once installed remember to add yourself to the group that can use Virtualbox - if stuck try this page (note in French!): [doc.ubuntu-fr.org]

Windows apps inside Ubuntu

Wine is what you want, and irfan view rocks for image manipulation: [help.ubuntu.com]

How to run Windows applications on Ubuntu - [www.zolved.com] (this use a gui interface for adding packages, I'd recommend you use the above one which uses the commandline and apt-get, much faster if you can deal with the fear of not clicking...)


Mail

Copying over thunderbird files from Windows: copied over files and then edited profiles.ini so path was the old one...

[General]

StartWithLastProfile=1

[Profile0]

Name=default

IsRelative=1

Path=b1na6jtf.default

.. open up thunderbird and there you go, all your files and settings! ref: [ubuntuforums.org]

Backup

Making system images - VERY USEFUL!! Why repeat all of the above and below ever again! Creating Custom Ubuntu Live-CD With Remastersys: [www.ubuntugeek.com]

Create, Recover and Automate System Images - the above did the trick for me so I did not use the below in the end but its worth a look at: [ubuntuforums.org]

How to create an ISO image, pretty straightforward but always useful to check! [www.tech-recipes.com]

Simple Ubuntu Desktop Backup with Backerupper - I haven't tried this yet, I have rsync scripts todo my backup in conjuction with crontab... [www.ubuntugeek.com]

Backup Ubuntu using rdiff-backup - I'm guessing this is similar to rsync, I haven't tried this yet. When I get chance I should add some stuff on rsync: [www.ubuntugeek.com]

Backup and Restore Your Ubuntu System using Sbackup - a GUI, I might run scared but this is probably very useful for the person who runs scared of the commandline :-D (I used to have that fear!) [www.ubuntugeek.com] (more on this at: [www.zolved.com])

Networking

How to open bittorrent ports from the command line: [www.ubuntugeek.com]

Ubuntu Firewall confusion, interesting posts about opening ports in ubuntu: [ubuntuforums.org]

Installing a firewall... I haven't done this - I have a hardware firewall and ubuntu does not have open ports: [www.linux.com]


Misc

13 Things to do immediately after installing Ubuntu - some are obvious and some seem already there, [linuxondesktop.blogspot.com] - I'm also recommend the ubuntuguide.org

JAVA - [www.javalobby.org]

Epiphany Browser - nice and light weight.. [ubuntu-tutorials.com]

Fonts - not really needed, but oh one likes to play... [ubuntu.wordpress.com] [www.zolved.com] and how to install Microsoft fonts, but there is some copyright issues - I haven't done this: [ubuntu.wordpress.com]

Enable Smooth fonts on Ubuntu Linux - [www.howtogeek.com] - I'm not sure this really made much of a difference!

XBOX 360 Controller, I'm still to try this one... [ubuntuforums.org]

Keyboard shortcuts - [ubuntuforums.org]

SKYPE - don't get me started, this is the only thing I'm having problems with (though its really the usb phone and not skype)! [help.ubuntu.com]


Interesting sites

[www.ubuntugeek.com]

[www.brunolinux.com]

[fullcirclemagazine.org]

[www.justuber.com]

What app do you need? [www.gnomefiles.org]

To all you wannabe converts, remember that Linux is not Windows! Its much better :D [http://linux.oneandoneis2.org/LNW.htm"]

How to get good help on linux forums, interesting read, [ubuntucat.wordpress.com]


April 16, 2008

How to get USB working for VirtualBox in Ubuntu

In Ubuntu Gusty some changes were made to the way it handles usb, anyway to get USB support for Virtual Box you need to edit `/etc/init.d/mountdevsubfs.sh and uncomment the 4 lines around line 40 (Magic to make /proc/bus/usb work). Then execute /etc/init.d/mountdevsubfs.sh start - this will then enable the use of USB in Virtual Box (oh you probably want to do the above as sudo).

Now there is a nice and geeky post biggrin.gif

April 22, 2008

Best 404 ever...

yes, its a game... time to waste some time breaking blocks!!

[best 404].

May 16, 2008

Football Manager 2008 on Ubuntu

I knew the day would come. I love the football manager series and I'm ashamed to say that it was probably the reason I hung on to having Windows installed on my machine for so long. If you have no idea what I'm talking about [the game's site]. Its a pretty addictive game. Anyway, I've been missing it. So I decided to try and figure out how to install it in Ubuntu. Installing games in Ubuntu is all about the WINE. So after popping the disc in the drive and typing wine setup.exe and it crashing I knew I was going to have to do some playing. This is not a bad thing, I'm a geek, I like playing. I read a post ([this one, post 39]) which gave some very good background info and suggested that there was a problem with the copyright protection. So I booted up my windows virtual machine, [see this post] about how to install Virtual Box and get Windows running like any other application in Ubuntu, and installed it in there. This is when the confirmation of the securerom (?I think) protection was obvious. The game wouldn't run. I downloaded the latest patch from the FM site and there you go it ran! Wooh!. It is just a simple process of then copying over the files from the virtual machine into the .wine/ directory and running the task, like: wine "C:\Program Files\Sports Interactive\Football Manager 2008\fm.exe" --fullscreen_width=1280 --fullscreen_height=1024

I've been happy able to play the game and beat West Brom U18's!

May 20, 2008

Civilization IV on Ubuntu

Following on from installing Football Manager 2008 on my ubuntu machine (see: [here], I decided that I would try and install another of my favourite games... Civilization IV. I have to say it was probably slihtly easier than Football Manager (in that it did not need a virtual machine to install it) but it did involve actually doing a few different things. All good fun, especially when the game works. So what to do? (oh this is all on Ubuntu 8.04 LTS)

1. Get Wine, sudo apt-get install wine and set it up, fairly simple - keep the defaults if unsure.
2. I have the DVD version of Civ4 but some people might have a CD version, if so copy over the CAB file to your hard disk off CD2.
3. Insert the DVD (or CD1) and run the installer with Wine. Cancel the DirectX setup. If you have the CD version, when it asks for the second disk just use the CAB file. The installer should finish successfully.
4. If you try and run the game it will not work. It will moan about you not having the correct dvd, guess why? Yep good old of copyright protection. The solution is first to patch the game to the latest version (I used the patch 1.61) - get from: [here]. Do not install Xfire. There should be an error pop up at the end, this is safe to not worry about.
5. You now need to grab a few directx related files - d3dx9_26.dll, msxml3.dll, msxml3r.dll (you can get them [here] or [here].)
6. Copy the DLLs into the Civ 4 directory. (something like /home/user/.wine/c_drive/games depending on where you installed it.)
7. You will need a cracked executable, i.e. one that will avoid the copy protection. I'm not going to post a link here but a google search should easily allow you to find one.
8. Now replace the Civ 4 executable with the cracked one.
9. Run winecfg, and add an override for msxml3 (native, builtin). Turn off “Emulate a virtual desktopâ€, set vertex shaders to none, and turn on pixel shaders. You might need to change a few of the other graphics options, especially if you want to make it go full screen.
10.Run Civ4 biggrin.gif but only so it can create the config files, once it gets to the menu exit. Don't worry we are almost there.
11. Open the CivilizationIV.ini file in a text editor (probably located in /home/username/My Games/). Change the EnableVoice = 0 to fix the audio. Set the ScreenHeight and ScreenWidth to your screen’s height and width.
12. Play Civ4! biggrin.gif (just don't change the resolution settings in the game).

Simple image resizing in Ubuntu

I quite often process my images before I stick them online and so don't often need to bulk resize them, but occasionally it is quite useful. When I had both Ubuntu and windows installed I just revert to using IrfanView, a great little program. I do actually have it install through wine but being me I wanted a better solution. Then it dawned on me, why don't I just use ImageMagick - I do this on a couple of websites. The first thing you need to do is get the package:

sudo apt-get install imagemagick

After ImageMagick installation, you can use mogrify.

Make sure you are in the correct directory and then just use:

mogrify -resize 640 *.jpg

which will rename all the files (assuming they have the extension .jpg) to a width of 640 NOTE THIS WILL OVERWRITE YOUR FILES, so it worth copying them to another directory first so you don't lose your high res images, but if you can use the commandline then you probably can figure this out!

Oh you can also fix the size but this will of course lose the aspect ratio...

mogrify -resize 640×480! *.jpg

May 23, 2008

Imperialism on Ubuntu

One of my favourite games ever is Imperialism (you can find a review of this old game, [here], from the title you can guess the idea. Its Civ like in some ways but completely different in many ways, its turn based and you aim to conquer the world - so I guess its similar. The units don't have quite the same freedom but it brings so many different and cool things. Anyway after my experiments with getting more recent games working on Ubuntu I thought I'd give and older one a go. Now I have this working though a few things aren't quite ideal and I'm yet to properly have a game. To wet your appetite here is a screenshot...

imperialism

If you have a copy of Imperialism then follow the below, if you don't skip down a bit (it might actually be quicker... but you lose movies and sound if you don't have the disk - nothing much really though and it makes the installation quicker).

So does it install straight out of the box with Wine, answer nope. There are a few issues and I reckon I could have probably gotten around them, the most important is the 16-bit issue, but you can around this by setting,

sudo sysctl -w vm.mmap_min_addr=0

before you run wine. This is not ideal and still the installer crashes, you need to run it in Windows 98 compatibility mode but it still doesn't work... bloody windows. So the solution - like with [installing football manager 2008] it is much easier to just boot up a virtual machine with XP (or some other windows installation) on. Make sure you run the setup.exe in Windows 95 compatibility mode. You should then be able to install the software. Don't worry with Directx 5! You won't need this. Once installed copy over the install directory to your ./wine/drive_c/ area. In Ubuntu now run the program, does this at the command line. It should now run, it might ask you to change the screen resolution. I did not. I have tried this install procedure a few times and it seems that you need to run the game twice after install to get it to work (not sure if it needs to create some files...). It then seems to work like a dream. Oh you might want to install the patch (probably best to do this in the VM before you copy it over... you can find the patch [here] or [here] (after thought: It's much quicker to grab the files with the patch applied as suggested below...).

Currently I can't get it to work with a menu item, but I don't mind using the command line, its fairly easy to just type:

wine /home/me/.wine/drive_c/Program\ Files/Imperialism_1/Imperialism/Imperialism.exe

How to get a copy? Buy one - well that is not that easy now. So see: [here] - follow the links to the yahoo group and join. You will find a nice patched copy. It is all installed, so you should have to just type wine Imperialism.exe in the correct directory (I quickly tried this and it seemed to work well).

If you want to learn more about Imperialism I suggest looking at either [this site] or [this one] though the later is in French and mostly aimed at the Mac version of the software (which I've run on my powerbook before, great fun!). Oh and don't forget the Daily Imperialist and the attached yahoo group

Oh I also remembered a nice "tip" (yeah a cheat effectively): Balanced Resources
In the new game screen, ctrl click on the globe and type "Pippin". The red country will start out with balanced resources.

August 6, 2008

Bash rename

This is one more for myself than anyone else as I keep forgetting how todo it.... but if anyone is interested. I normally don't use bash - I'm not entirely sure why I don't (if you don't know what bash is, then I wouldn't worry - its the Bourne Again Shell and is based on the Bourne shell, sh, the original command interpreter). Anyway, this is a very simple thing todo.. but every time I come todo it I have to look it up, so I'm going to just look it up here...

Just to add some text at the front:

for i in *; do mv "$i" "photo${i}.jpg" ; done

To remove some text in the string:

for i in *.jpg; do mv "$i" "${i/Yourself}" ; done

and to rename as a numeric string... my most common task...

number=0
for i in *.jpg; do mv "$i" "$number" ; (( number += 1 )); done

September 13, 2008

Tumblr pages...

I've been trying out Tumblr as a means of bloging and I like it - I think I might attempt to maintain an astronomy blog over on their system for a while and see what happens... if you want to take a look at my fledgling new blog see: starrydude.tumblr.com.

Security in Ubuntu

I'm a Ubuntu user - yep that's a type of Linux. I love it and I find it so much more natural than M$ Windows (and of the versions, though I do have time for XP as I have spent a lot of time using that - mostly games though). Anyway... lots of people are going over to using Linux and I keep urging people to try out Ubuntu as its quite easy to get the hang of and the usual questions about viruses and firewalls come up. I understand that this is natural you are used to using Windows... my initial reaction is don't panic but if you are worried take a look around the web and install some tools. A great site full of useful info is [ubuntugeek.com] - so go take a look and get your Ubuntu installation nice and secure.

October 12, 2008

How to: Create an ISO with ubuntu

Have a CD that you can't be bothered to constantly boot up? Or just to make a nice backup of a directory... then you can make an image of it. In Ubuntu this is rather easy at the commandline:

For folders all you have to do is:

mkisofs -r -o file.iso /location_of_folder/

and don't forget to make a checksum:

md5sum file.iso > file.iso.md5

For CD's this is a bit complicated and you can do:

sudo umount /dev/cdrom dd if=/dev/cdrom of=file.iso bs=1024

Of course you could use graphical tools like Braserio.

Installing Xbox Media Center on Ubuntu

I've wanted to be able to control my media collection on my Xbox 360 for a while and I wasn't sure of a good way of doing this without M$ Windows... but now I've come across: http://www.howtoforge.com/installing-xbmc-on-ubuntu-8.04 - seems to work well....

November 15, 2008

Emulators in Ubuntu

I love playing games. I also love playing around with linux... so what better than playing around with old games by getting them to work on Ubuntu? How about instead of just getting PC games working we try and get old console games working? Even better. Shame that lots of people have already been doing this. That's ok - I just get to use the end product, probably better in terms of the amount of time I would waste on this....

The first one I will mention is zsnes, a great little emulator for SNES games (well doh! it say it on the tin). Anyway, its simple to install in Ubuntu, just type: "sudo apt-get install zsnes" at the command line (or look the GUI repository software installer) - assuming you have the universe repositories setup. It works pretty well and I'd recommend taking a look [here] for further guidance.

Another emulator I have tried is DeSmuME - which is an emulator for the nintendo DS... to install "sudo apt-get install desmume".

Anyway, I'm going to go and have a play with those... and I'll post more back when I get chance but for a few excellent guides on lots of emulators I'd suggest you take a look at: linuxlinks.com and [thepemberton.com]

December 7, 2008

TOVO T1000 - WiFi phone

Tesco direct (their online service) have been [offering a number of cheap wifi phones] recently (including the Tovo T1000). I have been after just the thing recently, though I'd rather it have worked with Skype I did not mind particularly.It is also much cheaper than its competitors so with a bit of a push from my girlfriend I went and ordered it.

It came the other day but I got my first chance to play with it today... In short argh(!) but wooh!

OK, the Tovo service seems absolutely abysmal. It just does not work out of the box at all. The actually hardware of the phone though is pretty nice albeit like a late 90s Nokia (but I kinda like that). After about 10 minutes I had it working on my network and a few minutes later I was logged into the phone via a web browser on my computer. I was quite pleased with that. Then the fun and bloody annoyingness stated. The Tovo website is so incredibly slow it makes a 56K modem look fast. Anyway, I went through the registration procedure and that all seemed fine - put in my details on the phone... and nothing. Nothing at all. The test line just took me to some automated response "this account is not activated" or some s**te like that. I played around with various different settings and hunted around the tovo website to no avail. I came to the conclusion that I should use another service provider. Personally I would have loved to have used skype but that doesn't work with [SIP]. So I did a bit of trawling and decided that [callwithus.com] would do the trick... and indeed it did (I actually spent about an hour trying to get other services to work and I'm not sure what I was doing wrong with them but I have a few ideas). Callwithus definitely had the most useful help ([config page]) including a "what someone else has done" [screen grab] this is for the UTstarcom which is the same model, just the tovo is a re badged version). Also another good reference point (which I had found earlier but forgot about during most of the above is: [www.skifactz.com] - its darn useful!).

Once I was using callwithus things went quite smoothly (to run an echo test you just have to call - 3246) and then I added a couple of quid onto my account and 1p a minute local line calls was at hand. I call my parents to test it out and all was well. The audio quality is pretty good (my mom tends to moan about this with Skype and didn't say a word, so it must be good!).

The only thing I need todo with it now is to get a local number associated with my account, which I will do later - once I've done this I've got everything I wanted from it.

In short the phone is cheap, well worth it... TOVO is not worth the time spent but with the handset you are free to use other services. If you do so it will work and once you get over a few hiccups it works well. In the end I expect this will be a well spent 20 quid.

Here are a few useful links:
[http://www.callwithus.com/configuration]
[http://www.skifactz.com/wifi/wifi_sip_phone.htm]
[http://www.skifactz.com/wifi/wifi_sip_phone_f1000_parameters.htm]
[http://wiki.ekiga.org/index.php/Fun_Numbers]
[http://www.callwithus.com/faq#did]

December 12, 2008

An astronomers guide to writing a blog

With the International Year of astronomy on our doorstep this is a great time to promote astronomy and of course in the technological world we live in this also means online. There are a large number of fascinating websites offering astronomical delights but few really have a personal touch. For IYA there is a global project called “Cosmic Diaries†that will involve a few professional astronomers writing about their daily lives (as a blog). Sounds interesting, but I'm a bit unsure if this is entirely a good idea, for example will people be so open to tell us about their latest theory? I doubt it. Also professional astronomers tend not to have a huge amount of time spare and don't really do science that is readily accessible to the public. If I was to tell you about a double-double radio galaxy I'd discovered at 610 MHz with the GMRT then I'd have to spend an awful amount of space describing what this all meant. Now some might do that, but I doubt all would. For those that know the stuff I'm sure it would be interesting, but for those that don't they will just leave with an impression of astronomy being impenetrable. This, as you all know, is not true. Amateurs are the foot soldiers of the astronomical community, you are the people who do this for fun... and make it fun for everyone else - you aren't the ones worrying about data analysis (well you might be but probably not of the astronomical kind) when you go to bed. Thus, I'm going to suggest that you would be much better placed to run blogs for IYA. You will be able to put over that enthusiasm in a different way. So why not run a blog as an astronomy society? With 10 of you blogging content will be easily produced and will vary nicely - making an interesting read.

So how do you write a blog? Well if you where to use a popular search engine you will find countless documents on this, so I'd encourage you todo this.. but here are a few ideas.

The actual site - do I need my own website? Personally I run my own webserver with Moveable Type installed (if you are that way inclined then this is a rather simple installation) but if you are not or don't want the added cost of webspace then I'd suggest using one of the following (there are of course many others): Blogger.com, tumblr.com, livejournal.com, freeopendiary.com, wordpress.com, MuseCrafters.com, www.vox.com. For ease of use and setup Blogger and Tumblr can't be beaten in my opinion (I've run blogs on both). Be careful with your identity. Remember, you can be anonymous to most of your readers. This is one of the best aspects of blogging. No one has to know who you are!

The content, what do we put on here? Anything you like - just what you have observed might be interesting, or even just what your society is doing / has done. I'd always suggest using pictures when possible (but do remember copyright rules and give credit when appropriate). Don't expect to get too many visitors to begin with - writing a popular blog doesn't happen overnight. The essence of the blog stems from journalling which means the blog is FOR YOU. Work it how you feel most appropriate but with multiple authors you will quickly amaze a range of interesting stuff. Since we are talking about writing a scientific blog then I'd very much encourage you to ensure that you try and explain every term you use, or at the least create a link to another website (wikipedia can normally do the trick) that has more details - and hopefully penetrable for all. Oh and don't forget to tell people about it. Register it with blogging monitors like technorati.. and tell you friends!

Just to give you an idea about a few blogs, here are two I maintain www.krioma.net/blog (my personal one) and starrydude.tumblr.com/(my completely astronomy one). I'd also suggest taking a look at other peoples such as orbitingfrog.com/blog/ or blogs.discovermagazine.com/badastronomy/

January 4, 2009

Getting Spore to work...

Nope this is not going to be a long post on how to get Spore to work on Ubuntu, that might come later, I don't really have time at the moment for that - though I do enjoy the challenge I fancied the challenge of the game first this time. To be honest I wish I had gone to the effort of trying to figure out how to install it in Ubuntu as I probably spent about the same amount of time as I did in bloody Vista. I'm not a Vista fan but I have it on my machine for this exact reason - to play games I can't be bothered to mess about installing. Not that installing all games is particularly hard in Ubuntu, most in fact are rather trivial, but the newer games with sophisticated uses of graphics can be tricky.

Anyway, I was happy installing it, everything was going well. Then I got an error message saying that it is unable to install the graphics package. Hmm, so I tried retry... nothing. So I thought maybe this isn't too crucial (with the thought at the back of my head going "its bound to be"). So I continued on, I had another message like this... can't think what it was of now. Argh! So I navigated to the directory (sorry folder for you windows people) and noticed that the graphics package file and a bunch of others appeared to be zero file size... not a good thing. So I though, hmm maybe the disk needs remounting (i.e. taking the disc out and putting it back in). That resulted in no net gain.. still not able to read the files. So here I am thinking I got a duff disc. After a short rant and rave at the computer my lovely girlfriend reminded me that she kept the receipt ('twas a Christmas present) - so I always had the option of taking it back. Me being, well me, I persisted. Still nothing, so I though about copying over the files to the hard disk to see if I could install without the disc - this does not always work though. Of course, I still had the problem with my computer not seeing the files. So out pops my Power Book G4 (and good old MacOSX), of course Spore can be played on this system - but my laptop is not fancy enough for this. To my pleasure a quick look at the commandline told me that indeed the files weren't blank.. and quick copy over onto the local hard drive and a copy onto my Ipod to swap onto Vista on my desktop (normally I'd just have mounted the mac as an external drive over the network but alas I can't do that with Vista). All the files appeared. I followed the normally install procedure - all went smoothly. Annoying registration filled in and job done. Spore on my machine! Woop!

Seriously though, what the heck happened? I expect that something with the DVD must have been incompatible with my hardware or Vista. A bit of searching around (i.e. using google with the error message) suggests that I'm not the only one to have seen this issue! Oh well, at least it all works now. As for the game itself, WOW, its been a while since I was quite taken a back like this with a game... I should really stop writing this and get back to conquering the Universe.. or go and revolve... I'm not sure biggrin.gif

Oh and if you are wondering how you get this to work on Ubuntu... well there are a few guides out there: http://mydailytech.com/post/spore-on-linux/ and http://linuxoutlaws.com/spore look pretty interesting.

January 18, 2009

Convert images to a document (Ubuntu)

I'm currently working on refurbishing the University of Birmingham Astronomical Society's Grubb telescope which dates back to 1882. Anyway, I'm not here to write about this, I essentially have a big bunch of pictures that I took when we took it apart and now I'm putting it back together I thought it would be rather useful to put the images together in order in one document. Of course, there are a number of ways I could do this - but I wanted a nice and quick solution, and I didn't want to just print out the lot. I'm a Ubuntu user and as such I have a myriad of useful Linux tools all ready at the command-line and a nice a quick solution was todo the following:

Firstly make the images a bit smaller, they were all 2048 x something and that is just going to end with a large document so using mogrify I resized them:

mogrify -resize 800 *.jpg

This took 30 seconds or so, I had 60 images and so is easily scalable up to larger documents. Once complete I just used another ImageMagick tool, convert:

convert *.jpg output.pdf

This simply takes all the jpegs and adds them into a pdf, in alphabetical order. Excellent, job done. I can now print out the document using evince to get as many pages as I like out onto an A4 sheet... (I wonder how much grease and muck will get over the print out when we get around to putting all the bits together... I'll let you know).

October 11, 2009

Pyphot version 1 released

I've released the [first version of Pyphot] - a bash/python image analysis script that uses sextractor to extract sources and complete photometry. Its still very much in its infancy and is currently really only designed to deal with basic data taken at the [University of Birmingham Observatory], I'm hoping after I've had a few users try it to add enhancements and make it robust (so that any instrument data can be thrown at it...).

This follows the first version of [Pyspec] which has now had some enhancements to it and has been tested on a number of machines now... it also now includes some idiot proofing :-D

October 18, 2009

Organising FITS data

Over my years of teaching undergraduate astronomy labs I've seen many different ways that students save observational data, well its all FITS but the filename and extensions can vary. I'm intending to plough through the whole data archive of the University of Birmingham Observatory extracting spectra and photometry on the cleanish data. A simple solution when you get back from observing is to tell the students to simply rename the files, however, the archive (since I've been lazy when I made it) was just a compressed archive of all the raw data from the year (well source by source with all necessary calibration files). Of course I'm way too lazy to rename everything manually and so I'd like a little script todo this and to determine (since sometimes the students/staff don't call bias frames bias1.fit etc or dark frames dark - I swear this is so illogical and I wonder how many hours can be wasted) what type of frame the observation was. This is actually pretty trivial todo using bash and grep and eventually I will building this into [pyspec]/[pyphot]... but for now here is the script: [organise.sh]

Pyspec flux calibration

Something we haven't done often enough, probably because we tend not to bother observing standard stars, is correct flux calibration with the [Wast Hills] data, however this is an issue when calculating winds from stars (e.g. P-Cygni). I think this is the only group over the past 5 years we have run that has attempted todo this and not with a proper standard star but Vega. It sort of worked, anyway the moral of the story is to take standard stars when observing then you can calibrate you data. I've put together a little tool (not integrated with pyspec yet) that does this... for more info see the [pyspec page].

flux calibrated data example

December 4, 2009

Convert decimal to sexigesimal in awk

Yesterday I had the need to convert a decimal number to a sexigesimal one - I know there are lots of astronomical tools out there todo this but I felt then need to do this in awk... so here it is:

awk '{if ($2>=0) {h=($1/15); h2=h-(h%1); m=(h-h2)*60; m2=m-(m%1); s=(((h-h2)*60)- m2)*60; d=($2-$2%1); am=($2-d)*60; am2=am-(am%1); as=((($2-d)*60 -am)*60); print h2, m2, s,d, am2, as} else{h=($1/15); h2=h-(h%1); m=(h-h2)*60; m2=m-(m%1); s=(((h-h2)*60)- m2)*60; d=($2-$2%1); am=(d-$2)*60; am2=am-(am%1); as=((am - (d-$2)*60)*60); print h2, m2, s,d, am2, as} }' sourcelist.dat

were sourcelist.dat is a space separated file with ra and dec in decimal.

This is a typical thing that you might want to do in astronomy, though you tend to want to take the position in HMS and make a decimal number, don't ask why I wanted to go the other way.

December 6, 2009

Using Awk to add a column to a file

I had a need to add an extra column of numbers (all the same) to dataset the other day... so simple todo with an awk script

#!/usr/bin/awk -f BEGIN { } { printf("%10d %10d %6d\n", $1, $2 ,"10"); }

Just save the above input like something like add_column.awk, make it executable (something like chmod 700 add_column.awk) and run it (the above just adds "10" to each line and is simple to change to a variable or some other string):

add_column.awk yourinputfile > youroutputfile

and job done.

December 10, 2009

Going from sexigesimal to decimal...

I decided (and since I had todo this today) that for consistency (see [my post from there other day]) I should post how to convert between astronomical sexigesimal and decimal coordinates in awk:

awk '{h=($2*15)+($3/60)*15+($4/3600)*15; h2=$5+($6/60)+($7/3600); print $1,h,h2}' input > output

see its nice and simple really... the input file given here simply as "input" should contain a list of Source Name (which is $1, not necessary but you normally have it...), RA (in H M S, all separated by spaces) and DEC (D M S, again space separated).... enjoy.

December 11, 2009

Converting Video for the Ipod on a linuxbox

After my flights to and from Puerto Rico the other day I decided it was about time I put a few other video clips onto my ipod (I've watched Master & Commander way too many times on it). The problem is how the heck did I convert them in the first place. I actually have this awful feeling it was quite a few years back and I used an evil Windows program todo it! Well, how do you do it in Linux... simply really install ffmpeg (and a few related things), in Ubuntu it should be as easy as:

sudo apt-get install ffmpeg

.. but just in case [read here]. Then its just about running said task and waiting for the processing to finish. Simples. Oh run something like:

ffmpeg -i Input.avi -f mp4 -acodec libfaac -ar 44100 -ab 128 -vcodec mpeg4 -maxrate 2000 -b 1500 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -s 320x240 -r 30000/1001 outfile.mp4

January 17, 2010

Football Manager 2010 on Ubuntu

By far my favourite computer game is [Football Manager] and for Christmas I was given the latest incarnation, FM2010. Now I could just play it on Windows, and indeed I probably will at some point, but that's not me. I never use Windows unless I have to these days (I only ever need to windows to play games). So I went about trying to get it to work on [Ubuntu]. [FM2008 was pretty easy to install] but I had a few problems with this one. For some reason I just couldn't get the correct settings in [Wine].

So in the end I just went and installed [PlayOnLinux] which has a nice install script for the game and it WORKED! The install went smoothly (make sure you don't do the via steam option though). I first had issues with the graphics but all I did was make sure that fm.exe was added to the list of programs to run in XP mode in winecfg. I also think that you have to make sure you run kill all tasks running with the wine prefix and then simulate the windows reboot. After doing that - job done. I have a few issues with the graphics and the 3D engine is currently not working, but I probably wouldn't use that anyway...

ubuntufm2010

February 10, 2010

Turning a PDF into an animated GIF

Today I was asked to take a bunch of PDF files (essentially frames of the animation) into an animated GIF. This is actually a fairly simple task todo with [imagemagick] and its fast too. Simply all you have todo (assuming the PDF, or other image files etc are in order) is:

convert -delay 20 -loop 0 frame*.pdf output.gif

The -delay 20 specifies the time between frames and the -loop 0 tells the image to loop forever.
Quite nice really (the animation is for a conference and so I won't post it).

The only issue I had is I wanted it to stay on the last frame for a while, but this was simply accomplished by a bit of bash before running the above:

for i in $(seq 28 1 38) do cp -r frame27.pdf frame$i.pdf done

Thus this took frame 27 and copied it in a sequence from 28 to 38. Sweet.

Finally I was asked to put two animations next to each and this can be done by using the append functionality:


for i in $(seq 01 01 38)
do
convert frameset1/frame$i.pdf frameset2/frame$i.pdf +append output$i.pdf
done

This adds the same frame number from each set next to each other in one larger image. Once this is done it is a simple procedure of running the earlier animation script on the newly created pdfs.


February 13, 2010

Playing with gnuplot

The otherday it was about time I tried out [gnuplot] for a change. I used to do all of my scientific ploting (and actually a lot of my analysis) in [R]. These days I tend to use [python+matplotlib]... but I wanted something that would allow me quickly to visualise data and plot functions without much effort... this is where [gnuplot] really does seem to be powerful.

I came across an excellent intro to gnuplot page: [Plotting Data with gnuplot].

Here is an example plot of what you can easily produce in a few seconds. Pretty swish.

gnuplot example

Oh and gnuplot is nicely in the [Ubuntu] repositories... you probably want to get:

sudo apt-get install gnuplot-x11

February 28, 2010

Basic Parallelisation in Bash

I have recently started writing some quite CPU intensive code and since we have a nice cluster here (without any management software on it) I decided that it would be best for me to take advantage of the number of cores on them. Actually, this works nicely on my desktop which has four cores anyway (and 4GB of RAM). Essentially, I'm lazy and this basically runs my pipeline in parallel for different sources by sending off different jobs to different cores (to the maximum number that you specify)... and then when they finish runs then next few... and so on until they are all done. No longer do I have to worry about waiting for the jobs to finish and wasting time by missing their finishing point. I also no longer have to have lots of [screen] sessions or loads of terminals open... bliss...

Oh here is my basic [Bash] script:

#!/bin/bash
#By Samuel George; www.krioma.net
#Original: 27/02/2010
array=(`ls -d */`)
#My scripts run in sub directories, replace with your list of commands to run.
len=${#array[*]}
maxjobs=1
jobnumber=0
#loop over the maximum number of jobs based on the number of files in array
while [ $jobnumber -lt $len ]; do
jobsrunning=0
while [ $jobsrunning -le $maxjobs ]
#start jobs up till maximum and then wait for them to finish before continuing.
do
#go into the directory and run - this is an oddity of my processing
#replace with your own functions
cd "${array[$jobnumber]}"
"run.sh" &
#go back a dir
cd ../
#add to counter so that you know how many jobs are running at once.
jobsrunning=$(( $jobsrunning + 1 ))
#keep a running total, such that the script will loop over all the jobs you want running jobnumber=$(( $jobnumber + 1 ))
done
wait
#keep a listing of where you are.
echo $jobnumber
done

Stick this in a shell script, chmod 700 file.sh and job done.

There is definitely room for improvement here. For example this code will wait till all of the processes in the inner loop, ideally you'd want it to move on after the first one is finished. Watch this space... well that might not happen since my tasks all take about the same time to finish in.

March 13, 2010

CSS Image Maps

Earlier today I was asked to add an image with floating text to the [FAS] website. It's been a while since I had todo any proper CSS and so quite eager to give it ago. It turns out that what I needed to do is fairly simple. The basic CSS does the work:


and so on until you have all the elements you want. Then just create a list in html:



and job done! See [for an example], well this is what I produced for the FAS site. The main bulk of this was inspired from: [CSS How to]... so a big thanks to that excellent page.

March 16, 2010

Converting ps to png

I guess this entry is more of a reminder for myself as I keep forgetting the syntax todo this... its pretty simple and since I use the command all the time you'd have thought I'd have remembered it!

convert -density 100 input.ps -flatten output.png

This just give 100dpi, which is fine for the purposes I have...

If you need todo some fancy things and things such as converting from eps this should work, however you might want to look up [Converting .eps to .png Easily]

March 21, 2010

Convert video to PSP format on Linux

At Christmas I bought a [PSP] and since then I've only really used it to play games - I guess that was the primary reason to get it... but I'm about to go on a long flight and not trusting the entertainment systems / waiting around at [George Bush International] I thought it was about time I put a few movies on there. I'm a bit of a linux head (I'm primarily a [Ubuntu] user), if you hadn't already guess and I wanted to do it on here. In fact assuming you have [ffmpeg] installed (its in the Ubuntu repo) its fairly simple:

ffmpeg -i "InputFile.avi" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -s 320x240 "OutputFile.mp4"

then just copy that over to your psp memory stick (assuming it is mounted as disk):

cp -r OutputFile.mp4 /media/disk/VIDEO

Job done. biggrin.gif

April 17, 2010

Removing CTRL M characters

Sometimes if you modify or create a file in Windows or DOS and then copy it to a Linux (well Unix like) file system you get ^M characters at the end of each line. These are annoying when trying to run scripts on files (or things like latex) and can be nicely removed using the vi editor. Open you file with vi and then do:

ESC:%s/^M//g

You can get the ^M by pressing Ctrl V and then Ctrl M.

May 6, 2010

Tickmarks in matplotlib

Over time I've become more and more a lover of Python. I still don't use half of the fancy stuff and very much use it as a scripting language, but as you can see from some previous posts I really do think that it is well suited for astronomical purposes. Anyway, I digress, one thing that was bugging me was producing publication quality plots. I've still got things to tweak with my plots but I think I'm finally happy with my script and thought I'd share one vital thing - tickmark lenghts. It took me ages to figure out what paramter this was called and lets be honest if no body else gets any use from this I'm bound to the next time I forget / can't find any code with this implmeneted in. So here we go, how change tickmark lengths in matplotlib:

import string, sys, math, scipy, numpy, pylab 
from pylab import * 
#DATA 
x = [0,1,2,3,4]; y = [2,3,4,5,6] 
#Plotting 
fig = plt.figure(figsize=(9, 8)) 
fig.subplots_adjust(left=None, bottom=0.2, right=None, top=0.97,wspace=None, hsp
ace=None)

ax1 = fig.add_subplot(111)
ax1.semilogx(x,y)
setp(gca().get_ymajorticklabels(), fontsize='large')
setp(gca().get_xmajorticklabels(), fontsize='large')
labels = setp(gca(), ylabel='y axis', xlabel='x axis')
setp(labels, fontsize='large')
for l in ax1.get_xticklines() + ax1.get_yticklines():
l.set_markersize(6)
l.set_markeredgewidth(1.2)

for l in ax1.yaxis.get_minorticklines()+ax1.xaxis.get_minorticklines():
l.set_markersize(3)
l.set_markeredgewidth(1.2)


save = "test.eps"
pylab.savefig(save)



May 9, 2010

Installing fonts in Ubuntu

Something I always forget how-to-do is installing fonts, so I thought I'd put this short entry together... its actually pretty simple if you want them just for one user. You can either do this graphically or as I prefer at the command line:

Simply make a directory called ".fonts" in your home directory:

mkdir .fonts

and then drag and drop to install fonts graphically or simply

cp font.ttf $HOME/.fonts/

Then open the program you want to use them in, job done.

May 14, 2010

Degrees to steradians

I quite often find myself wanting to convert from square degrees to [steradians] (SI unit
for solid angle), its simple but I waste too much time doing it (just recalling if its pi/180 or the otherway etc), so I've wrote a PHP function to do it - [deg2sr.php]. Oh, I've also wrote a python implementation of this:

#!/usr/bin/python 
#usage: deg2sr.py -v 0  #convert square degrees to steradians.
import string, sys, math, scipy, numpy, pylab, os
from numpy import *
values_pass = sys.argv[2:]  #return value passed to script
deg = (double(values_pass[0]))
sr = ((pi/180)**2)*deg
print deg, sr

Simply copy this and save it and run as deg2sr.py -v 10 (where 10 is the number of square degrees).

July 9, 2010

matplotlib convolution animation

I've recently been doing quite a few convolutions, quite important in the paper I'm working on (hopefully to finish soon, more on that soon I hope), and I thought I'd demonstrate a nice example of how todo a convolution in python with the aid of scipy, numpy and matplotlib (actually this is as much a posting for myself so I don't have to go hunting through my python script directory). It's actually fairly straight forward, but before that I should just recap what a convolution is.

Essentially a convolution is just an integral that expresses the amount of overlap of one function as it is shifted over by another. This is of great importance in radio astronomy. In synthesis imaging (the key to all large interferometer imaging), the measured dirty map is a convolution of the "true" CLEAN map with the dirty beam (this is determined from the Fourier Transform of the uv-data that is taken by the telescope). If you want to know more about this kind of thing, specifically for radio astronomy, take a look at the [NRAO workshop pages] - tons of info. Mathematically the convolution of two functions is (over infinite range):

convolution_inf

Here is an example of the convolution (the green curve) of two rectangular (top hat) functions, there is a slight issue with my plotting that makes them not quite look rectangular (lack of points basically):

Convolution of two tophats

As you can see the final product is a triangle. This is really quite simple to code and I've aimed to make this a nice an accessible program by doing things in a simplistic manner - take a look at [convolve.py]. The animation is produced using imagemagick and the convert task at the end of the script, if you don't have this then just comment it out.

August 2, 2010

Make grids of images

Ever need to create subplots (or a nice mosaic of images) and can't be bothered to figure out how todo it in what ever programming language, or have to open up photoshop or gimp and have to manually reposition everything? Well Imagemagik (like always) can solve this(!) and a friend of mine wanted to do this automatically the other day so I created a little bash script to do the job: combine_intogrid.sh

Here is an example of the output (I used (the top left image) an image I took of M51 and applied some filters to it (see bottom of post for filters):

final

For just one set of images (say you want a 4x1 mosaic you have to run this:


convert \( image1.png image2.png image3.png image4.png +append \) -background none -append final.png

and say for a 2x2 then its just:


convert \( image1.png image2.png +append \) \( image3.png image4.png +append \) -background none -append final.png

The script is essentially designed todo more than one directory at a time and was for astronomical images (hence the use of source in the directories) just replace this and off you go - it will loop through all your directories making nice mosaics of your images.

Filters / process to convert the one image into the 4 used for the mosaic:

convert image1.jpg image1.png
convert image1.png -negate image2.png
convert image2.png -blur 5x2 image3.png
convert image1.png -level 25%,100% image4.png
convert \( image1.png image2.png +append \) \( image3.png image4.png +append \) -background none -append final.png
mogrify -resize 400 final.png


August 14, 2010

Awk sexigesimal to decimal

Ages ago I put on here some awk scripts to convert between decimal numbers and sexigesimal (i.e. very useful with astronomical catalogues) and I think I've also gone the other way... anyway here is an updated and a more useful bash script todo this, still using awk at the heart of it (this goes from sexigesimal to decimal):


#!/bin/bash
filein=$1
fileout=$2

cat $filein | awk '{if ($4>= 0) {h=($1*15)+($2/60)*15+($3/3600)*15; h2=$4+($5/60)+($6/3600); print h,h2,$7,$8,$9}; if ($4< 0) {h=($1*15)+($2/60)*15+($3/3600)*15; h2=$4-($5/60)-($6/3600); print h,h2,$7,$8,$9,$10} }' > $fileout

put this in whateveryoulike.sh and there you go.

August 28, 2010

My most useful scripts... so far

Over time I've wrote quite a few scripts todo lots of different things, from making [videos work on my PSP] to [astronomical coordinate system transformations]. A lot of these have been documented on my blog, lots more sit on my computer ready to go online (I will eventually put more online) either way things are a mess and I decided it would be a good idea if I put them in one place, so over on my research pages I did - so go take a look at my [most useful tools page]. Definitely one for geeks.

September 2, 2010

Syntax Highlighting in Nano

Being an astronomer my life at work quite often involves me using a commandline text editor. I'm a big fan of nano/pico and overwhelming prefer them to vi (I know this topic is easy the start a flame war - I'm just not one for vi, never could remember the commands etc). Now today my other half (being the geek that she is) wondered if I knew how todo syntax highlighting in nano since vi by default on her system does this and people were suggesting she did that. Me, I'm not one for syntax highlighting on the commandline (if I want that I just open up gedit/emacs)... but I thought this would be interesting to see if nano can, and indeed it can... so here is simply how to do it:

Put the following into ~/.nanorc

# Colour setup
include "/usr/share/nano/asm.nanorc" # Assembler
include "/usr/share/nano/sh.nanorc" # Bourne shell scripts
include "/usr/share/nano/c.nanorc" #C/C++
include "/usr/share/nano/groff.nanorc" # Groff
include "/usr/share/nano/html.nanorc" #HTML
include "/usr/share/nano/java.nanorc" # Java
include "/usr/share/nano/man.nanorc" # Manpages
include "/usr/share/nano/nanorc.nanorc" #Nanorc
include "/usr/share/nano/perl.nanorc" # Perl
include "/usr/share/nano/python.nanorc" # Python
include "/usr/share/nano/ruby.nanorc"# Ruby
include "/usr/share/nano/tex.nanorc" # TeX

and it is that simple!

Oh and some other useful settings to include:

set mouse # Enable mouse support, i.e. set the marker!
set boldtext

September 24, 2010

Symbols in matplotlib

I always forget what symbols (or should I say markers?) are which in matplotlib so here is a reminder to myself - [take a look at this useful page].

November 9, 2010

Random number in c++

This is really more of a reminder for myself... how to draw random numbers fast in c/c++. (download [random.cpp]) and compile like so: g++ -O2 -o random random.cpp

#include ‹iostream›
#include ‹cmath›
#include ‹fstream›
#include ‹cstdlib›
using namespace std;
#define PI M_PI
#define RAD PI/180.0
#define SIG5 5.0*sig
#define SIG10 10.0*sig
#define SIG20 20.0*sig

unsigned long long int rdtsc();

int main (int argc, char* argv[]) //take in commandline arguements
{
int ii = 0;
srandom(rdtsc());
while (ii ‹ 100)
{
cout ‹‹ rand(); //RAND_MAX;
cout ‹‹ "\t";
cout ‹‹RAND_MAX;
cout ‹‹ "\n";
ii +=1;
}

return 0;
}


unsigned long long int rdtsc(void) //Call a Random number.
{
unsigned long long int x;
unsigned a, d;

__asm__ volatile("rdtsc" : "=a" (a), "=d" (d));

return ((unsigned long long)a) | (((unsigned long long)d) ‹‹ 32);;
}

November 22, 2010

Simple median in python

Yesterday I was doing some python scripting for work on [GALFACTS] and I wanted to take the median of an array. I know I could simply use the [numpy] function but I specifically wanted to alter the behaviour to skip NaNs (in the end I ended up doing this a different way using the isnan functionality) and so I wrote a short script to calculate the median, thought I'd post it as a short example of some simple python programming / you never know if it will come in handy again (for me or anyone else). The full script can be retrieve from my [research script dump], oh and below:


#Function to determine the median of an passed array/list of number
def takemedian(inputvalues):
     sortedvalues = sorted(inputvalues) #sort values
     total_len = len(sortedvalues)
     if (total_len % 2) == 1:
         return sortedvalues[((total_len+1)/2)-1]
     else:
         upperval = sortedvalues[(total_len)/2]
         lowerval = sortedvalues[(total_len/2)-1]
         return (float(lowerval + upperval)) / 2


#test function
def validatemedian(correct, takemedianvalue):
     print "Test Median is: %.2f, takemedian function value is: %.2f, Is Correct? %s" % (correct, takemedianvalue, correct==takemedianvalue)

#test what the ouput is
validatemedian(5.0, takemedian([0,1,2,3,4,5,6,7,8,9,10]))

November 24, 2010

Awk csv and cut the header...

Something I keep having to look up how todo so I'm putting it here for future reference:

Suppose you have a comma separated file, say the list of Abell clusters: e.g. first line:

1,1.89167,16.50972,0.1249,514.3,3.342

and you want to convert this into a nice tab spaced data set and cut off the header...

awk -F',' '{printf("%10.8f\t%10.8f\t%10.8f\t%10.8f\t%10.8f\t%10.8f\n", $1,$2,$3,$4,$5,$16)}' abell_all.csv > temp_abellcut

len=$(wc -l temp_abellcut | awk '{print $1 -1}')
tail -n $len temp_abellcut > abell_all.dat
rm -rf temp_abellcut
echo "id ra dec z D search_radius" > abell_all.header


... and bob's ya uncle.

January 29, 2011

Word Documents with PHP

I've just had the need to automatically generate word documents for the [FAS website] and I have to say I was surprised quite how simple that was with PHP. Well its kinda a fudge in that all I do is write HTML that openoffice understands and set the doctype to msword... does the trick nicely and here is a quick example ([inspiration for this]:

$filename ="yourdoc.doc";
$fp = fopen($filename, "w");
$test = "here is something really important that must be in a word document - argh";
fputs($fp, $test);
fclose($fp);
header('Content-disposition: attachment; filename=$filename);
header("Content-Type: application/msword");
readfile($filename);

Of course I was extracting the data from a mysql database and parsing that into the document - quite please with that really.

Oh and page breaks when making .doc files in php are useful:
<p style="page-break-before: always" >

February 4, 2011

Fitting data with python

As an astronomer I do lots of data fitting with python (utilising scipy) and thought it was about time I'd put up one of my basic procedures:

#!/usr/bin/python #by Samuel George; 03/02/2011
import matplotlib; matplotlib.use('Agg') #avoid X11 issues.
import scipy, pylab, asciidata
from pylab import *
from scipy import optimize
from scipy.stats.stats import spearmanr as spearcor

def fitting_func(logx, logy, logyerr): # fitting
     fitfun = lambda p, x: p[0] + p[1] * x # define fitting function
     errfun = lambda p, x, y, yerr: (y - fitfun(p, x)) / yerr
     p0 = [0.0, 0.0]
     out = optimize.leastsq(errfun, p0, args=(logx, logy, logyerr), full_output=1)
     index = out[0][1]
     amp = 10.0**out[0][0]
     index_Err = sqrt( out[1][0][0] )
     amp_Err = sqrt( out[1][1][1] ) * amp
     r = spearcor(logx,logy) #Spearman rank correlation test
     return out[0],out[1],index,amp,index_Err,amp_Err,r #p[0], p[1], covariance matrix, index of powerlaw, amp powerlaw, errors+spearman rank

pout, covar,index,amp,indexErr,ampErr,r = fitting_func(log10(xdata), log10(ydata), (errory / log10(ydata)))

This code can also be found [here]

March 13, 2011

Converting mov to avi

A friend with an iphone sent me a .mov file today - I really don't like that format for video so of course I wanted to convert it to a nicer .avi file and this couldn't be simpler with [ffmpeg]:

ffmpeg -i input.mov -aspect '16:9' -sameq -vcodec libxvid output.avi

- this maintains the aspect ratio (I'm using 16:9 as that is what the file was) and uses the same quality as the input.

April 17, 2011

FITS files in Python

[Pyfits] is a really useful python module that allows you to read in and write out [FITS] files. Since most astronomical data comes in FITS file format its darn important that you can read them in. Here are some basic instructions on how todo this:

Firstly ensure you have the most useful pre-requisites ([Pyfits], [numpy ], [scipy]) and import them:

import pyfits, numpy, scipy

Now read in the file:

input_file = "A.fits"
hdulist = pyfits.open(input_file)

Get the data:

img_data = hdulist[0].data

Get the header:

img_header = hdulist[0].header

To read a specific item from the header:

h3 = float(hdulist[0].header['CDELT3'])

To update a specific header item:

hdulist[0].header.update('BUNIT','PI')

To output the FITS file, overwritting if necessary and converting to 32bit floats:

pyfits.writeto("output.fits",float32(img_data),img_header,clobber=True)

June 20, 2011

Awk sexigesimal to decimal... again

This is the third update to my bash/awk script for turning coordinates given often into something useful. [The old version] didn't give a large precision in the output coordinates, this is better:

#!/bin/bash

filein=$1
fileout=$2
cat $filein | awk '{if ($4>= "'"0.0"'") {h=($1*15.0)+($2/60.0)*15+($3/3600.0)*15; h2=$4+($5/60.0)+($6/3600.0); printf("%10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f\n", h,h2,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)}; if ($4< "0.0") {h=($1*15)+($2/60.0)*15+($3/3600.0)*15; h2=$4-($5/60.0)-($6/3600.0); printf("%10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f %10.8f\n", h,h2,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)} }' > $fileout

Stick the above in whateveryoulike.sh, chmod it so it runable (say chmod 700 whateveryoulike.sh) and run it as: whateveryoulike.sh input.dat output.dat - where input.dat has a list of sexigesimal RAs and DECs.

September 7, 2011

Python: blackbody curves

I decided to put a little bit of python code together as a demonstration of how to define a function by calculating the blackbody curve of an object (see the bottom of the entry if you want to know what this is), anyway I thought I'd share this little snippet of code.. its not anything particularly outstanding but tis neat. How to define a blackbody:

def blackbody_at_f_t(freq,kB,T,c,h): #T in K, f in Hz return 2*h*(freq**3)/(c**2)*(1/(exp((h*freq)/(kB*T))-1))

You just need to pass freq - the observing frequency (in Hz), kB - the Boltzmann constant (in J/K), T - the temperature (in K), c - the speed of light (in m/s) and h - the Planck constant (in JS). This show just how simple python can be to define a function. Below is an example of actually using this, and of course we can nicely vectorise things too... and plot!

def blackbody_at_f_t(freq,kB,T,c,h): #T in K, f in Hz return 2*h*(freq**3)/(c**2)*(1/(exp((h*freq)/(kB*T))-1))

#Python Libraries
from pylab import *
from scipy import *
from numpy import *

#constants
kB=1.38066E-23; # Boltzmann's constant in J/K
c=3.0E8
h = 6.63E-34 #Planck's constant (JS)

logspace = 10.**linspace(1.0, 20, 5000) #logspacing of frequency
T =2.715 #K cosmic background radiation
out = blackbody_at_f_t(logspace,kB,T,c,h)
fig = plt.figure(figsize=(6, 6))
ax1 = fig.add_subplot(111)
plot(logspace/1E9,out,'r-',markersize=0.5)
ax1.set_xlabel('Frequency (GHz)', fontsize=10); ax1.set_ylabel('Energy Density (J/Hz)', fontsize=10)
xlim(0.0,800)
show()

The whole above code can be found in [blackbody.py]

and you end up with blackbody curve of the cosmic microwave background:

Blackbody curve for CMB


A black body is a theoretical object that absorbs 100% of the radiation that hits it, hence it appears to be black. Due to this nature its also a perfect emitter of thermal radiation. which it radiates in a characteristic spectrum that depends on the body's temperature - as can be seen above for the cosmic microwave background. If you want to know more about the cosmic microwave background try [here]

September 12, 2011

Python: Julian date

As an astronomer a fast an easy way to calculate the Julian date of an observation is always handy. As I'm currently doing a bunch of python demos and adding some new libraries to some of my tools I though I'd share this one. Oh and if the first sentence confused you: The Julain date or JD is the the interval of time in days and fractions of a day since January 1, 4713 BC Greenwich noon. Now this is how you calculate it:

def julian_date(YY,MM,DD,HR,Min,Sec,UTcor): return 367*YY - (7*(YY+((MM+9)/12))/4) + (275*MM/9)+ DD + 1721013.5 + UTcor/24 - 0.5*sign((100*YY)+MM-190002.5) + 0.5 + HR/24.0 + Min/(60.0*24.0) + Sec/(3600.0*24.0)

So all you need to do is supply the year (YY), month (MM), day (DD), hour (HR), minute (Min), Second (Sec) and the time difference from UT (UTcor) and their is your JD. So for example:

YY = 2011 #year MM = 9 # month DD = 7 #day UTcor = 0 #ut offset HR = 12 #hour Min = 53 #minute Sec = 0 LONG = 0 #degrees, -ve if West +ve if East latitude = 0 #The latitude of the telescope; a scalar JD = julian_date(YY,MM,DD,HR,Min,Sec,UTcor)

You can also grab the function from: jd.py.

I'm probably going to put a php version up on the webpage for people to use too...

October 18, 2011

Combining measurement sets

Something I'm bound to forget how todo, as I don't do it very often, is to combine to measurement sets in CASA. So here is a quick reminder...

concat(vis=['in1.ms','in2.ms'], concatvis='out.ms')


I tried this on a GMRT dataset combining the USB and LSB data and it seems to have worked correctly (well I'll find out once I've done the imaging!)

October 19, 2011

^M hell...

Why does my script not work? Why does the interpreter throw some stupid error - oh yeah its probably because the file was saved in windows and now has lots of ^M's in it. Its simple to remove these, and well I've written about this [before] - so was nice and quick this morning to figure that out :-) - once I realized that was the issue. In essence (for once) vi is your friend.

October 31, 2011

FTP automatically

A friend of mine asked me to help with an FTP issue he was having recently. This reminded me of some older code I had to automatically FTP files to another server. I tend not to do this with FTP these days - I tend to remotely sync with rsync or some tool like that. Anyway, FTP can be really useful if you are trying to go through a list of files or something like that. Here is a little script that allows you to FTP files (in bash) without much hassle or the need to use the FTP console (note the example is for ascii mode):

#!/bin/bash HOST='someftplocation.com' USERNAME='whatever' PASSWORD='whatever'

ftp -n -v $HOST << EOT
ascii
user $USERNAME $PASSWORD
prompt
cd whereyouwannput it
put yourfile.txt
bye
EOT
sleep 12

November 1, 2011

Casacore installation on Ubuntu

Here are some steps to install casacore on Ubuntu (specifically 10.04 LTS ran as a virtual machine with VirtualBox on Ubuntu 11.10). This posting uses provided packages where possible and avoids, if necessary the installation of packages from source. This is mostly meant as a reference for myself and hence includes a few things that I had to specifically do and probably won't work for anyone else, I hope it does, but we all know what computers are like! Of course, you should go and see the latest on the [google code casacore] page. This is using casacore version 1.3.0.

wget casacore (see link above) and unpack.

sudo apt-get install build-essential

sudo apt-get install scons fort77 subversion g++ cmake libblas-dev liblapack-dev libqdbm-dev libfftw3-dev libcfitsio3-dev libboost-python-dev slang-cfitsio flex bison gfortran libhdf5-serial-dev libreadline5-dev python-scipy python-matplotlib python-pyfits

Download wcslib - and run make, make install

wget ftp://ftp.atnf.csiro.au/pub/software/wcslib/wcslib.tar.bz2
tar -xf wcslib.tar.bz2
cd wcslib-4.8.2
./configure --prefix=/usr/local/include/wcslib/
make && make install && cd ..

When compiling casacore I had a specific problem where a header file couldn't be found from wcslib, so quick fix;

sudo cp -r wcsconfig.h /usr/local/include/wcslib #from the wcslib dir

and that seemed to fix it.

Now install casacore with scons:

scons --prefix=/usr/local --enable-shared
sudo scons install

There are many different options available for the compilation - all the above does is make the shared libraries too... you should look into this but remember that the options.cache file needs to be removed if you do another make.

November 7, 2011

ADASS XXI & magnetic fields

I'm currently in Paris - at [ADASS XXI] - a computational astronomy conference. I have a poster at the conference on Probing magnetic fields with GALFACTS. If you are interested the poster, which shows the first big rotation measure cube from GALFACTS in take a look at the pdf

adass

. I'm going to put a blog together over at cyberska.org - but later in the week I'll write up some of the highlights.

Oh and on the social note, I got to go to the l'Observatoire de Paris:

l'Observatoire de Paris

November 8, 2011

Output spectra in IRAF

I was going through a few old notes and thought I'd post this. It's something that was always useful during the undergraduate labs at the University of Birmingham. In IRAF go: onedspec > wspectext. You should change the parameters using wspectext, we always found that using header=no and wformat=%0.2f the most useful.

For more information on IRAF including a manual that I wrote a while back see [the UoB obsering laboratory pages].

November 10, 2011

ADASS Overview

The 21st [ADASS] is over and I have had an interesting week full of astronomical software. The most impressive, I could be biased, web based software was the FITS viewer of [cyberska.org] in its raw "wow" effect. Though I did enjoy seeing many of the GPU talks and the speed ups that are possible, if you know what you are doing, on these massively parallel systems - might have to try and do a bit more [CUDA] as a result of this. Anyway, I've been maintaining a blog over at cyberska.org where I have been keeping rough notes with links to what has been going on.. so if you are interested in reading more take a look at:

ADASS Day 0

ADASS Day 1

ADASS Day 2

ADASS Day 3

ADASS Day 4

Oh and a brief discussion (and a link to) my poster can be found in [my previous blog entry on this].

November 13, 2011

Testing if a file exists in python

The other day I was asked a question from a friend who was trying to run a pipeline on a bunch of data but wanted to check if a file existed before processing it. In python this is rather straightforward, you could either use the os module and test if a file exists (though this might have problems with speed of accessing files):

import os print os.path.exists("test.txt")

and then test if this is true or false, but you probably want to avoid race conditions. It is also much better programming standard to use a try statement, so something like:

filename = "test.txt" try: open(filename) except IOError as e: print 'Does not exist'

nice and then execute your code inside the try statement - or something along those lines with your code.

November 30, 2011

UK counties, php array

Whilst making an update to the FAS Membership and Renewal System (MARS) I decided to add a drop down box for the list of counties, so that we can force people to pick one that is up-to-date... anyway, I created a php array of these and thought it might be handy for someone so they could just copy and paste it:

$listcounties = array("Avon","Bedfordshire","Berkshire","Buckinghamshire", "Cambridgeshire","Cheshire", "Cleveland", "Cornwall", "Cumbria", "Derbyshire", "Devon", "Dorset", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Herefordshire", "Hertfordshire", "Isle of Wight", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "London", "Merseyside", "Middlesex", "Norfolk", "Northamptonshire", "Northumberland", "North Humberside", "North Yorkshire", "Nottinghamshire", "Oxfordshire", "Rutland", "Shropshire", "Somerset", "South Humberside", "South Yorkshire", "Staffordshire", "Suffolk", "Surrey", "Tyne and Wear", "Warwickshire", "West Midlands", "West Sussex", "West Yorkshire", "Wiltshire", "Worcestershire", "Clwyd", "Dyfed", "Gwent", "Gwynedd", "Mid Glamorgan", "Powys", "South Glamorgan", "West Glamorgan", "Aberdeenshire", "Angus", "Argyll", "Ayrshire", "Banffshire", "Berwickshire", "Bute", "Caithness", "Clackmannanshire", "Dumfriesshire", "Dunbartonshire", "East Lothian", "Fife", "Inverness-shire", "Kincardineshire", "Kinross-shire", "Kirkcudbrightshire", "Lanarkshire", "Midlothian", "Moray", "Nairnshire", "Orkney", "Peeblesshire", "Perthshire", "Renfrewshire", "Ross-shire", "Roxburghshire", "Selkirkshire", "Shetland", "Stirlingshire", "Sutherland", "West Lothian","Wigtownshire","Antrim","Armagh","Down","Fermanagh","Londonderry","Tyrone");

December 1, 2011

C/C++ libraries

Its been ages since I did any proper C/C++ so I had to remind myself of a few things, particularly the compilation of libraries. Libraries are really useful as it simplifies multiple use and sharing of components. I'm a Linux person so I'm going to look at this with a Linux hat on. In Linux there are two types; Static libraries (.a) and dynamically linked shared object libraries (.so). Let take a look at static libraries.

Lets create a library, firstly lets define some code, say in a file example1.c:

To create a library you can do:

cc -c example1.c

which compiles the code. Then you need to make the libary:

ar -cvq libexample.a example1.o

(you can of course include other object files here)

Say you call the function in you maincode.c to now compile this do:

cc -o maincode maincode.c libexample.a


December 8, 2011

Gaussian Fitting in python

I spend a lot of my time working on noise statistics and of course and an important part of this is how to fit signals. I was asked earlier for an example code on how to fit a Gaussian, in particular fitting well defined signals. In python this is quite straight forward as you already have a bunch of nice libraries to count on.

So the first thing todo is to ensure you have these libraries. These are scipy, numpy, matplotlib and asciidata. Of course, you don't need matplotlib if you don't want todo the plotting but or asciddata if you don't want to import an ascii file. (note: to students in 3rd year obs lab at Brum - you have this on hydra)

If you want to create some test data you can do something like:

from pylab import * gaussian = lambda x: 1*exp(-(3-x)**2/10.) #change the parameters as you see fit data = gaussian(arange(100)) x_pos = arange(100)

Now on to the fitting, this is simplistic and works well with "clean" data.


import warnings
warnings.simplefilter("ignore",DeprecationWarning)
import matplotlib
matplotlib.use('Agg') #avoid X11 issues.
import scipy, numpy, pylab, asciidata
from numpy import *
from pylab import *
from scipy import *
from scipy.optimize import leastsq

gauss_fit = lambda p, x: p[0]*(1/sqrt(2*pi*(p[2]**2)))*exp(-(x-p[1])**2/(2*p[2]**2)) #1d Gaussian func
e_gauss_fit = lambda p, x, y: (gauss_fit(p,x) -y) #1d Gaussian fit

data = "test_gauss.dat" #your input data - should be x,y
demo = asciidata.open(data)
x_pos = double(demo[0]) #this is expected to be pixel number
y_power = double(demo[1])

v0= [1.0,mean(x_pos),1.0] #inital guesses for Gaussian Fit. $just do it around the peak
out = leastsq(e_gauss_fit, v0[:], args=(x_pos, y_power), maxfev=100000, full_output=1) #Gauss Fit
v = out[0] #fit parammeters out
covar = out[1] #covariance matrix output

xxx = arange(min(x_pos),max(x_pos),x_pos[1]-x_pos[0])
ccc = gauss_fit(v,xxx) # this will only work if the units are pixel and not wavelength

fig = figure(figsize=(9, 9)) #make a plot
ax1 = fig.add_subplot(111)
ax1.plot(x_pos,y_power,'gs') #spectrum
ax1.plot(xxx,ccc,'b--') #fitted spectrum
ax1.axvline(x=xxx[where(ccc == max(ccc))[0]][0],color='r') #max position in data
setp(gca(), ylabel="power", xlabel="pixel position")
pylab.savefig("plotfitting.png")

print "p[0], a: ", v[0]
print "p[1], mu: ", v[1]
print "p[2], sigma: ", v[2]


Here is the output plot (red line is the maximum, blue is the fit and green points are the data):

plotfitting


This code can all be found in a more useful format [simplegaussfit.py]

Download this, change the input data parameter to your asciifile and run as simplegaussfit.py - ensuring you have the correct file permissions to execute (you can change this with chmod).


Related to this page is another page I had on [fitting arbitrary functions to data].

December 9, 2011

Multiple Gaussian Fitting in Python

Yesterday I showed you [how to fit a single Gaussian in some data]. Today lets deal with the case of two Gaussians. This came about due to some students trying to fit two Gaussian's to a shell star as the spectral line was altered from a simple Gaussian, actually there is a nice P-Cygni dip in there data so you should be able to recover the absorption line by this kind of fitting. Anyway, fitting 2 Gaussian's is basically the same thing as fitting one in python but with the added function. I'm thinking I'll work up how to deal with a whole spectrum including source finding. In this case what you have to deal with is that there are two sources and so a rough estimation of the peak position of both is crucial to the fit (well in the way it is implemented).

You basically want to end up with something like this:

Fit 2 Gaussians in Python

Where the green points are the data, the blue dashed line the fit and the red line where the maximum is in the array. The fitting is done via a least-squares fitting routine.

In this example we will first start by generating some data, skipping the input from a file (but you can use the code from the 1 Gaussian example).

import scipy, numpy, pylab, asciidata from numpy import * from pylab import * from scipy import * from scipy.optimize import leastsq

#generate some data
gaussian = lambda x: 3*exp(-(10-x)**2/10.) + 1*exp(-(30-x)**2/10.)#change the parameters as you see fit
y_power = gaussian(arange(100))
x_pos = arange(100)

gauss_fit = lambda p, x: p[0]*(1/sqrt(2*pi*(p[2]**2)))*exp(-(x-p[1])**2/(2*p[2]**2))+p[3]*(1/sqrt(2*pi*(p[5]**2)))*exp(-(x-p[4])**2/(2*p[5]**2)) #1d Gaussian func
e_gauss_fit = lambda p, x, y: (gauss_fit(p,x) -y) #1d Gaussian fit


v0= [1,10,1,1,30,1] #inital guesses for Gaussian Fit. - just do it around the peaks
out = leastsq(e_gauss_fit, v0[:], args=(x_pos, y_power), maxfev=100000, full_output=1) #Gauss Fit
v = out[0] #fit parameters out
covar = out[1] #covariance matrix output


xxx = arange(min(x_pos),max(x_pos),x_pos[1]-x_pos[0])
ccc = gauss_fit(v,xxx) # this will only work if the units are pixel and not wavelength

fig = figure(figsize=(9, 9)) #make a plot
ax1 = fig.add_subplot(111)
ax1.plot(x_pos,y_power,'gs') #spectrum
ax1.plot(xxx,ccc,'b--') #fitted spectrum
ax1.axvline(x=xxx[where(ccc == max(ccc))[0]][0],color='r') #max position in data
setp(gca(), ylabel="power", xlabel="pixel position")
pylab.savefig("plotfitting.png")

print "p[0], a1: ", v[0]
print "p[1], mu1: ", v[1]
print "p[2], sigma1: ", v[2]
print "p[3], a2: ", v[0]
print "p[4], mu2: ", v[1]
print "p[5], sigma2: ", v[2]


The full detailed listing is given in [multiplegaussfit.py]

December 10, 2011

Spectral Extraction in Python

I've wrote about how to read in FITS files in Python before, but I thought I'd readdress as I've been writing lots about fitting and wanted to build up to fitting properly calibrated data. So in this example I will add how to extract a spectra too. For this example I'm going to use a calibration lamp taken at the University of Birmingham Observatory. Both the script described here and the data will be given below. The output looks like:

Spectral Plotting

So let's start with reading in a FITS file. Firstly ensure you have the most useful per-requisites ([Pyfits], [numpy], [scipy]) and import them:

import pyfits, numpy, scipy

Now read in the file:

input_file = "A.fits"
hdulist = pyfits.open(input_file)

Get the data:

img_data = hdulist[0].data

Get the header:

img_header = hdulist[0].header

(more on FITS)

Now lets use some calibration data (which can be downloaded):

import pyfits, numpy, scipy, pylab
from scipy import *
from pylab import *
input_file = "Neon.fits"
hdulist = pyfits.open(input_file)
img_data = hdulist[0].data

We know that the spectra, by looking at the FITS file with DS9 has data in a small aperture. For now we will ignore any averaging. Lets take line 144 as we know there is data.

data_use = img_data[144]

Plot the spectra:

fig = figure(figsize=(9, 9)) #make a plot
ax1 = fig.add_subplot(111)
ax1.plot(img_data[144]) #spectrum
setp(gca(), ylabel="Un-normalised power", xlabel="Pixel Position")
pylab.savefig("plot_spectra.png")


We have now extracted the data for a spectral column. I will follow this post up in the not to distant future with how to now identify the lines and run spectral calibration. Once you have this you can apply to a target spectra. Of course I've so far also ignored dark/bias counts but these can be easily dealt with.

The above can be downloaded as extract_spectra.py and the data Neon.fits (this is zipped, use gunzip).

December 14, 2011

CASA leap seconds issue

I had an odd CASA issue yesterday. It was complaining about missing leap second information for TAI_UTC! Seemed really quite odd to me as I hadn't done anything to my installation... anyway simple fix is to update the latest leap second information into CASA by running a simple command in the root casa install directory:

cd $CASA_ROOT/data rsync -avz rsync.aoc.nrao.edu::casadata .

December 18, 2011

Creating FITS files in c++

A simple example, very similar to that given in the CFITSIO guidebook, on how to create a FITS file using CFITSIO. In this case I'm also building against some casacore libraries, but these aren't going to be used in this little code snippet but the idea is to use casacore todo further analysis. I'm hoping to post more here over time. Anyway the code (this can also be found as a filebuild_fits.cpp:

/* Create a FITS file, using cfitsio and some casacore libraries by Samuel George 21-11-2011 Compile: g++ build_fits.cpp -o build_fits -lcasa_casa -lcfitsio */ #include // STL iostream #include #include

extern "C"{
#include
}

using std::cerr;
using std::cout;
using std::endl;
using std::string;

int main()
{
cout << "Create a FITS file" << endl;
int lenTime(10), status (0), lenFreq(20);
long naxis(2), naxes[2] = {lenTime,lenFreq};
long nelements (lenTime*lenFreq);
long fpixel (1), exposure (1500);
char comment[] ="Total Exposure Time";
cout << comment << endl;
float pixels[lenFreq][lenTime];
// create an array of pixels
try {
for (int ii(0); ii < lenTime; ii++){
for (int jj(0); jj pixels[jj][ii] = 10.0*(ii+jj);
}
}
} catch (string message) {
cerr << "Error creating pixel array" << message << endl;
}

try { // write the image to a fits file...
fitsfile *fptr;
fits_create_file (&fptr, "!output.fits", &status);
fits_create_img (fptr, FLOAT_IMG,naxis,naxes,&status);
/* Write a keyword - its the address you pass */
fits_update_key(fptr,TLONG,"EXPOSURE",&exposure,comment,&status);
//write an array to the image
fits_write_img(fptr, TFLOAT, fpixel, nelements, pixels[0],&status);
fits_close_file(fptr,&status);
status = 0 ;
} catch (std::string message) {
cerr << message << endl;
}
}

Save the code and compile like so:

g++ build_fits.cpp -o build_fits -lcasa_casa -lcfitsio

and then run with ./build_fits

December 22, 2011

Casacore installation: Addendum

So I was installing Casacore (as described here) on another machine and found I needed to do:

sudo cp -r lib/libcasa_*.so /usr/lib sudo cp -r /usr/local/lib/libwcs*.so* /usr/lib/

To allow me to use some of the libraries. Bit odd but all seems to work, thought I should take a note of this!

December 24, 2011

Recover data with ddrescue

Been handed a dead hard drive and want to try and recover some of the data? That's the problem I had the other day. So I turned to some good old linux tools to try and recover the data. One of my favourite recovery tools is ddrescue. It works really well and given enough time can do a pretty solid job of data recovery - of course a better solution is proper backups but that's not always the way people go. Anyway, this is as much a note for myself but here is how to do some basic recovery using it:

sudo ddrescue -r 3 /dev/sde2 imaging loging

This images /dev/sed2 and produces the image file "imaging" with the log "logging".

To try and extract files you could use something like foremost

sudo foremost -w -i imaging -o /recovery/foremost

To make an audit of the files that can be recovered, recovering them with:

sudo foremost -i imaging -o /recovery/foremost2

January 2, 2012

Convert 3gp to a better format

By default my phone camera takes video in 3gp format - which isn't the best for sharing around... so here is how to convert it using ffmpeg on linux:

Firstly you might need to install ffmpeg and some libraries:

sudo apt-get install ffmpeg libavcodec-extra-52

You can just do:

ffmpeg -r 1 -i VIDEO0032.3gp -f avi -r 24 -vcodec libxvid -acodec libmp3lame movie.avi

but this gives some crapy quality - a better way is:

ffmpeg -r 1 -i VIDEO0034.3gp -f mp4 -acodec libmp3lame -ar 44100 -ab 128 -vcodec mpeg4 -maxrate 2000 -b 1500 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -r 30000/1001 outfile2.mp4

January 26, 2012

Integration in R

A reminder to myself of something I did quite a while go, how to do integration with [R].

dj <- c(6.8543973e+00,6.0742026e+00, 5.1180908e+00, 6.8335044e+00, 5.5119610e+00, 5.5103389e+00, 4.8272714e+00, 6.3162468e+00, 4.9450749e+00, 6.0684488e+00, 3.9246411e+00, 5.1356979e+00, 5.3176933e+00, 5.0402740e+00)

integrand <- function(i) {sum(dj[i] - i - 5 )^2}
integrate(Vectorize(integrand), lower = 0, upper = 10)

Of course the [R documentation] is of great use too.


February 11, 2012

Burn files over multiple DVDs

My GMRT observations are producing single files of approximately 8GB with the current setup. When I leave the observatory and get on a plane I like to have a copy of my data on DVD too as it makes me feel better (knowing I have a backup). I know in the future this won't be possible but it is now. The data link is just too slow to nicely copy these over. The data is too large to fit on a single DVD, but this can be rectified by splitting the files:

split -d -b 4480m FILE.ms.tar.gz

Then just burn the files that are produced titled x followed by number in sequence.

If you need to put the files back together then you can just do:

cat x* > FILE.ms.tar.gz

March 5, 2012

Setting up a Virtual Webserver

This is a quick guide on how to setup a webserver in a virtual machine. This is based on using Virtualbox and Ubuntu, so it might not work with all version of linux and though the install instructions inside the virtual machine will work with any virtualisation tool the rest of the info, of course, will not. This is as much a reminder to myself as I seem to always forget to do one thing when doing this. Its really useful being able to just create a VM and fire off testing without having to compromise your normal desktop. I do this for many different coding projects, allowing me to have the exact environment I need / users have.

Firstly, lets install virtualbox (of course you could install one of many other virtualisation products):

sudo apt-get install virtualbox

Follow the on screen instructions on how to create a guest os in virtual box, quite straight forward. I tend to use a dynamically allocated disk. Start up the OS and find the image file you wish to boot (I've been using Ubuntu 10.04).

Like you would do for any operating system install this to the local disk.

To make life easier lets first setup SSH to the system.

sudo apt-get install openssh-client openssh-server

Now turn off the guest OS and in virtual box go: settings > network > adapter 2 > Enable

and change to attached to: Host-only adapter using vboxnet0

Reboot the guest OS.

Now we need to edit: /etc/network/interfaces to (you need to run something like sudo pico /etc/network/interfaces/), adding:

auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0

Now to finish the network setup, run:

sudo ifup eth1

Lets now restart the network:

sudo /etc/init.d/networking restart

We should now be able to ssh in to the system using: ssh your-username@192.168.56.101

If you don't want to have to remember the IP address you can add this to your /etc/hosts files, with:

192.168.56.101 yourvirtualos

Lets now install the important webserver tools:

sudo apt-get install apache2 php5 libapache2-mod-php5

Create a directory called "public_html" in your home directory,

mkdir public_html

and lets configure apache and get it running:


cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/userdir.conf userdir.conf
sudo ln -s ../mods-available/userdir.load userdir.load
sudo /etc/init.d/apache2 restart

sudo pico /etc/apache2/mods-available/php5.conf

change to:

<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
# <IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_value engine Off
# </Directory>
# </IfModule>
</IfModule>


i.e. comment out <IfModule... </IfModule>

And there you have it a webserver running in a virtual machine. Nice and straight forward really and takes about 10 minutes. Really useful for doing some web testing before uploading.

To test this just go to: http://192.168.56.101/ on either your main desktop or in your guest OS.

March 12, 2012

Talk bingo generator

During my [talk on Saturday at the University of Birmingham] I played talk bingo. The idea is that as I give the talk the younger members of the audience can be entertained by playing a game that requires them to pay attention. Whenever I give a talk I tend to use a subset of words (and indeed this can be played with a rather small number of words in any extragalactic seminar) from the field of astronomy. So all I did was generate a bunch of random bingo games and I say the words the audience cross them out. Eventually they will call bingo and I offer a small prize. On Saturday, due to a bit of a mix up with computers this didn't quite go as to plan but I think all were quite entertained. I suggested to a few that I'd put this together in a useful format.

So do you want to play talk bingo? You can use my [online talk bingo generator] on my research pages. It should be quite straight forward to use. Just provide the words (with space seperation) and a size of the grid and off you go. It produces html tables which can nicely be copied to openoffice for easy printing.

For those of you who might be interested in implementing this yourselves, here is the basic code (this is what I used for Saturday and I've changed it a bit to work nicely on my website, testing for max sizes and taking in input):

$random_text = array("Telescope","Dish","Data","Array","Universe","MeerKat","LOFAR","Space","Wave","Moon","Shock","Life","Transit","SKA","Radio","Exoplanet","Aurora","HD209458b","Arecibo","GMRT","ASKAP","POSSUM","GALFACTS","Galaxy","Jupiter","Sun","Earth","Magnetic","Gas","Electron","Kepler","Space","Venus","Mars","EVLA","Aliens","WOW","SETI","Radar");
$number_of_games = 50;
$number_elements= 25;
$elementsinrow = 5;
$intro = "";
for ($j = 0; $j < $number_of_games; $j++) {
   $rand_keys = array_rand($random_text, $number_elements);
   $sizeof_arr = sizeof($random_text); //echo $sizeof_arr;
   $intro .= "<table border=\"1\"><tr>";
   $b = 0;
   for ($i = 0; $i < $number_elements; $i++) {
      $intro .= "<td><font size=\"6\">" .    $random_text[$rand_keys[$i]] . "</font></td>";
   $b +=1;
   if ($b > 4){
      $intro .= "</tr>";
      $b = 0;
   }
   }
   $intro .= "</table><br /><br />";
}
echo $intro;

As you will see its nothing particularly fancy, but darn useful

March 17, 2012

SSH Keys and multi machine processing

A lot of my processing can be parallelised effectively by just splitting up the data and running on many machines. To accomplish this I use SSH keys so I can start jobs over the network from one bash script. Works nicely and is quite effective - the only downside is normally having to send data over NFS.

Anyway, crucial to this is the ability to install SSH keys, this can be done quite easily.

Firstly make sure that you have ssh'd from the machines you want to set this up on before. Simply just ssh into another machine, this will create a .ssh in your home directory with the proper permissions.

Now on your main machine run:

ssh-keygen -t dsa

This will generate a key. It will ask you for a passphrase. If you are hoping to spawn loads of jobs over many machines then don't put anything here (otherwise you'll be asked for the passphrase instead of your password!). Of course this is a security risk - so make sure you trust your network etc.

Now copy this key over to the other machines, in this case I'm using a virtual machine at 192.168.56.101, so:

scp ~/.ssh/id_dsa.pub 192.168.56.101:.ssh/authorized_keys2

Now on the machine you just copied it over (in my case ssh 192.168.56.101) run:

ssh-agent sh -c 'ssh-add < /dev/null && bash'

This will add the key and allow you to effectlviely have passwordless login - and allow for some nice multi-machine processing - we do this for lots of the Arecibo data we have to deal with, allows us to effectively run on 100 cores without any fancy software just a small bash script that loops over an array of machines.

March 30, 2012

Concatinating measurement sets in CASA

Combining data from different spectral windows or different days is quite useful. Quite often I will image these seperately and then combine in the image domain. It is useful, however, to be able to combine these into one measurement set, its just easier to keep track of the files - and time based flagging in the case of many spectral windows is probably the same (e.g. one antenna is down, well it will be for both spectral windows). Anyway, in AIPS this was quite straightforward and it was something I did often. I've only just needed a reason todo this in CASA and again its fairly easy. You just need to use the task "concat". I've put together a little script thats in two files from the commandline and runs this, see the code below:

from os import sys #python library to read input from command line
inputfile1 = str(sys.argv[3:][0])
inputfile2 = str(sys.argv[3:][1])
visoutfile = 'combined.ms'
print inputfile1,inputfile2,visoutfile
concat(vis=[inputfile1,inputfile2], concatvis=visoutfile)

Save this (as concatms.py) and run as:
casapy -c "concatms.py file1.ms file2.ms"

Assuming the two files are different frequency ranges you will end up with a file that has two spectral windows in.

April 13, 2012

Data interpolation in python

Quite often in my day to day work I end up having to flag out bad data. In many cases this just creates a gap and normally this is fine just to throw away. There are occasions however, such as when creating the bandpass of reciever that its still quite useful to have some idea as to what is going on in the normally flagged out channels - especially when its large chunks of data. To solve this we use interpolation. This post isn't about explaining data interpolation - for that I suggest you take a look at wiki.

When interpolating I like to use splines. In linear interpolation we use a linear function for each intervale,s with splines we use low-degree polynomials in each of the intervals chosing a polynomial that nicely fits the sections together. Generally works quite well.

Python has many different ways todo interpolation, be it spline or not. There is a huge variety of interpolation functions and I'd urge you to explore the scipy help for an exhaustive list. In this example I'm going to use the spline functions from scipy.signal

Firstly, import the functions required (asciidata is to read in the data and is not needed):

from scipy import *
from numpy import r_, sin
from scipy.signal import cspline1d, cspline1d_eval

I've defined a function to do the actual work:

def spline_lowchan(beamdata):
   lastzero = max(where(beamdata == 0)[0]) #first 146 channels are 0
   startchan = lastzero+1
   x = r_[startchan:len(beamdata)]
   dx = x[1]-x[0]
   newx = r_[0:startchan:1] # notice outside the original domain
   y = beamdata[startchan:]
   cj = cspline1d(y,lamb=0)
   newy = cspline1d_eval(cj, newx, dx=dx,x0=x[0])
   aa = list(newy)
   bb = list(y)
   mod = aa + bb
   return mod

The function is called like:

output = spline_lowchan(originaldata)

Where originaldata is the initial bandpass (just a sequence of numbers in an array or list)

In the above example of interpolating the function is assuming that the first set of data is all set to 0, hence the where is 0. We then interpolate the data over the range where there is no signal. We then add this to the original signal, hence allowing the region without any useful data to have an interpolated data set. Not perfect but gives a better idea of what might be happening. Of course this is not really how you should treat the edges but the cspline1d method very well when you say lose a few data points out of a bandpass.

May 1, 2012

How to make an image in radio astronomy

Radio Astronomy 101

In a rather simplistic viewpoint: you get uv data from your array (bottom right); you convolve it with a point spread function (top right) to get a nicely uniformly gridded data set (top left) and then you take the FFT of it to get a pretty image (bottom left).

Of course that's a gross under-estimate of what you need todo but highlights a key point - you have to grid the data. This is computationaly expensive and something I'm working on at the moment. The above plots are really just an example of a small python script I've developed to try out a few ideas. In reality, you'd have some source structure in there and hopefully your final image would be something that would be much more representative on the sky than the criss-cross pattern you seen in the final image (bottom left).

May 15, 2012

ALMA at the SSE imaging

We've been working on a bunch of things for the upcoming ALMA Summer Science Exhibition stand including a hands on ALMA simulator.

I've just finished adding our "Send to twitter" function with a bit of windows based commandline wizardy - I'm actually very pleased with it. So here is a bit of an Easter egg, me through the eyes of the ALMA SSE Imager - a bit of Earth rotation really brings out my features - can you guess what is on my t-shirt?

me through ALMA imager

About Computing

This page contains an archive of all entries posted to Krioma.net Blog in the Computing category. They are listed from oldest to newest.

Astronomy is the previous category.

Film is the next category.

Many more can be found on the main index page or by looking through the archives.

Get Firefox! Valid XHTML 1.0! Valid CSS! RSS Feed BlogUniverse - listed Powered by Apache Creative Commons License ringsofsaturnrock's Most Interesting Photos on Flickriver

Powered by
Movable Type 3.38