Wednesday 21 December 2011

Movgrab Popularity at 400

Movgrab's freshmeat (they're changing their name to 'freecode' but you'd know them as freshmeat if you know them at all) popularity rating has passed the '400' mark. I would like to say that it's smashed through this barrier, but as it's just managed to struggle to 400.13, and will probably drop back below 400 soon, well, I can't really say that.

I've no idea what this number really means, but I think 400 means 'quite popular'. Movgrab is now included in a few linux distributions, like Puppy linux, Arch linux and maybe Debian (someone did contact me asking me to make a change to allow it to be included in the debian build process).

One person has even written a nice-looking frontend to movgrab, I think this frontend comes as part of puppy linux.



You wouldn't think it from the feedback I've had though, despite setting up an email account for people to contact me with bug reports etc, very, very few people have done so. If you're one of those who did (you know who you are) then thanks very much, some of the bug reports I got were things that I'd never have known about it people hadn't taken the time to report them.

Now it's time to get some other projects finished and uploaded!

Thursday 10 November 2011

Using unix consolefonts in your programs

If you're running linux or another unix-style system, then you probably have a little-known directory in '/usr/share/consolefonts'.

This contains 'font files' that can be used with the 'setfont' command to change the default font at the linux console (not on xterm or rxvt or anything like that, at the actual 'text mode' console). If you're looking for how to do that, it's as simple as:

setfont drdos8x16
setfont cybercafe

where the 'name' of the font is it's filename without path or extensions (setfont knows to look in /usr/share/consolefonts).

This post is about how to decode these font-files for use in your own graphics programs.

These fonts have a very simple format, being little more than a collection of bitmaps (not .bmp format, but actual bitmaps, i.e. collections of bytes where every bit is a monocrhome 'pixel' that's on or off). If you're messing about with low-level graphics, they are an easy way of doing text.

There's 3 types of font in the console font directory.

1: Raw Fonts

These usually have the file extension '.fnt' (or .fnt.gz if gzipped). They contain an array of 8x16 bitmaps, or 'glyphs' of the characters in the font. The bitmaps are arranged so that they map to the ascii character set, so to find the bitmap for ascii character 'A' which has an ascii value of 65, you would just get the 65th bitmap in the array. As each character is 8x16, and so 16 lines of 8 bits, or 16 bytes, so you just calculate the position in the bitmap array as '<ascii value> * 16'.

Thus, the first byte of the file is the first 'line' of 8 pixels in the first character. For each bit that is set in those eight bytes, you should set or 'color' a pixel in an image, and leave blank those pixels that match to unset bits in the byte. The second byte is the second line of the character, and so on.

2: PSF Fonts

These are very similar to 'Raw' fonts, except they have a header. This header starts:

Byte 0: 0x36
Byte 1: 0x04
Byte 2: 'Mode' (256 characters or 512 characters)
Byte 3: Character Height

The first two bytes are just for identifiying the file type, and the 'Mode' byte says how many characters are stored in the font-file. If the first bit of this byte is set, then there are 512 characters, otherwise it's 256. The final header byte is the character height, allowing you to have glyphs that are 8x8, or 8x12 or 8x128, or whatever. Notice though, that for basic PSF fonts, the width of the character is still always 8 bits, or one byte.

After this 4-byte header the font is just the same as 'raw' fonts, except you have to consider that each glyph is as many bytes long as the 'Character Height' setting says.

3: PSF2 Fonts

The most advanced type of console font, it seems, are an extended version of 'PSF' fonts, called 'PSF2' fonts. These have an enhanced header:

Byte0: 0x72
Byte1: 0xb5
Byte2: 0x4a
Byte3: 0x86
unsigned int version;
unsigned int headersize; /* offset of bitmaps in file */
unsigned int flags;
unsigned int length; /* number of glyphs */
unsigned int charsize; /* number of bytes for each character */
unsigned int charheight;
unsigned int charwidth;

After the first 4 identifying bytes all the information is unsigned 4-byte integers. Everything does pretty much what it says. As now both the character width and character height can change, so you can no-longer calculate glyph positions in the file with 'lines * NoOfLines', but you can use the helpful 'charsize' value. Thus the glyph bitmap for a given character is found at 'headersize + <ascii value> * charsize'. 'length' tells you how many characters are in the file, and 'charwidth' now means you have to consider that each line of a character might use less than one byte, or stray across two or more bytes. However, the bitmap data is padded to a byte boundary, so if a font has a width of '12', or 'a byte and a half' it will still use 2 bytes for every line in every character.

Some of the default fonts distributed with the linux 'kbd' package (arm8.fnt, cybercafe.fnt) look surprisingly good when used on charts and the like, and they're about the easiest font-type to use in your own programs without turning to libraries like 'Freetype'.

Wednesday 9 November 2011

Howto use Picasa API with Blogger API




When you use the blogger api, the pages you get back contain a type of tag called 'gd:extendedProperty'. These contain some useful data.

Just do an http get to: <blogurl>/feeds/posts/default

So, for this blog you are reading: http://idratherhack.blogspot.com/feeds/posts/default

This will return a big mess o' xml, including the tags:

<gd:extendedProperty name='IS_PUBLIC_BLOG' value='true'/>
<gd:extendedProperty name='PICASAWEB_ALBUM_ID' value='5570923802870618657'/>

It turns out that one of these (PICASAWEB_ALBUM_ID) is a link to the Picasa album that is used by your blog.

You can use this link to upload pictures using the picasa api documented here http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_protocol.html.

When you do the upload you'll get back another mess-o-html which will include a tag called 'content'. This should give you the 'web visible' link for the image, which you can now use in posts to your blog.



Tuesday 18 October 2011

Can you do Rocket Science?



I'm cross-posting this to my 'technical' blog, because I think that it might attract a few people who write non-fiction, and that while most of those will be a 'computery' people, a few might be rocket scientists.

Can you write non-fiction on technical space-related matters, or on aspects of 'Hard SF'? Would you like to be published in an upcoming anthology?

Ian Sales' Rocket Science anthology coming out from Mutation Press (that's the award-winning Mutation Press) hasn't had enough non-fiction submissions, he says he's "Desperate" for them.

He's also had nothing like as many submissions from women as he'd like, either of fiction or non-fiction.

'Call for Submissions' is here

Know something about rockets/space/hard sf? Want to tell the world about it? This is your chance.



Friday 7 October 2011

New release of my 'getlock' program

A new version of my 'getlock' locking program is out. I use this to ensure that scripts and programs running out of 'cron' don't start running multiple copies that 'fight' each other. getlock creates a lock file and locks it with fcntrl locking, and then runs the program or script, keeping the file locked for the whole time that program runs. The advantage of this scheme over other locking programs is that if the 'getlock' process is killed or otherwise stops the lock is released automatically.

'getlock' has all sorts of 'timeout' features regarding how long it waits for a lock, and whether it 'steals' a lock from a program that's currently holding it, etc, etc.

The new version has the added feature of an 'abandon timeout', this is a timeout that applies to the running program. If the program has 'frozen' for some reason, then the 'abandon timeout' can be used so that getlock can detect the program is taking too long, and kill it off and exit. I use this, for instance, in situations where a script or program connects to hosts or websites that might become unresponsive, leaving the program waiting for network data that will never come. This can result in a 'hung' program that's holding the lock file and preventing another instance of the process (which will reconnect and start from scratch, and may thus succeed) from starting up.

Get it here:

http://sites.google.com/site/columscode/files/getlock-0.2.tar.gz?attredirects=0

Monday 5 September 2011

Disable Screen Blanking in Linux: How hard can it be?

How hard can it be? Well, prepare to be amazed, I've spend days trying to figure out how to turn off screen blanking under linux, and the internet is full of people bewailing the same issue.

I'm working on a job that has a 'management' screen that's permanently displaying information to any passing users. Unfortunately screen blanking keeps kicking in, and as the screen isn't supposed to have a keyboard or mouse, this is proving to be a problem.

The main cause of difficulty is that there are several different systems that can blank the screen. Firstly, there's the linux console, this is the 'text mode' system that's operational even when you're not running a graphical display (you probably knew that).

Once upon a time, this would have been sufficient to turn off screen blanking at the console:

setterm -blank 0

However, modern monitors can powerdown (which old-skool CRT's generally didn't, as in those days fossil fuel resources grew on trees. But then we cut all the trees down). Powering down is different to blanking the screen, it's actually turning the screen off, so you also need to do

setterm -powerdown 0

But there is also 'powersave'. I don't know how this differs from powerdown, but you should also do

setterm -powersave 0

So that's three commands needed for you to be sure that you've switched off screen blanking/turning off in the console alone, before we've even started X.

Incidentally, the 'setterm' command has many interesting features, including the ability to change the color of the screen text and background, take a textmode 'screen dump', turn on blink, underline, reverse, bold, linewrap, the cursor, etc, etc. This means it can be used in shell scripts to output text in different colors or bold or blink.

Now, we start the dreaded 'X', and enter his (yes, 'X' is definitely male) dark cabinet of madness.

X has its own screensaver, that defaults to blanking the screen if no screensaver is set up. You can check the status of this by running the command:

xset -q

This will print out the status of the various things that 'xset' can mess with. One of them will be:

Screen Saver:
prefer blanking: yes allow exposures: yes
timeout: 1200 cycle: 600

If timeout is non-zero, then the screen saver will kick in after that many seconds. Turn it off with:

xset s off

But this still isn't the end of it. There's one more thing that can powerdown/blank your screen. It's called 'DPMS', and I think it relates to the monitor's own ability to power itself down independent of the computer using it. If 'xset -q' shows:

DPMS (Energy Star):
Standby: 1200 Suspend: 1800 Off: 2400
DPMS is Enabled

Then again, the monitor is going to go into low-power modes (including 'Off') after the time has elapsed. This final hurdle can be overcome with:

xset -dpms

And now, with luck, you should find that your screen doesn't blank. Maybe.


Saturday 2 July 2011

Stuff that Works Under Linux: Wifi



Finding hardware that works with linux can STILL be a frustrating experience even after all these years. Manufacturers persist on focusing on 'Windows and mac'. This makes some sense nowadays when apple has come back from the brink and everyone has an macbook (or whatever they call them now) but it was really weird ten years ago. Ten years ago NO ONE owned apple products, as evidenced by the way that a mac in a public place would gather a crowd of wary onlookers, rather like the crowd that might surround a crashed alien starship once they'd got over the initial panic and the joy of looting had begun to pale.

I used to complain 'More people use linux than macs, so why do manufacturers keep supporting this dying platform, and ignoring linux?'

To which people would say: "Oh no, lots of people use macs"

To which I would respond, "Oh yeah? Anyone you know?"

People: "Well yes, sure."

Me: "Who?"

People: "Oh lots of people we know use macs. Lots."

Me: "Name one."

People: "Uh, well, there's... um... Jim?"

Me: "Jim? That's funny, you've never spoken of him before, he mustn't get out much. Does graphic design, does he?"

People: "Well yes, that's why he needs a mac. Uh-huh. Yes. Honest."

These mysterious 'Jims' and 'Sams' and 'Sues' always did graphic design, leading me to claim that it was the same guy, who just got around a lot (and sometimes wore a skirt).

Apple has always enjoyed some weird must-support-the-underdog loyalty from the public, evidenced by the fact that, in the days when the company was hanging by its fingernails over the abyss of chapter-11 bankruptcy BECAUSE IT WASN'T SELLING ANYTHING, and Michael Dell was saying they should just kill it, asset-strip the corpse, and give the money to the shareholders, people were prepared to lie and invent pretend friends in order to claim they knew someone who used macs. No-one used macs. Most people had never even seen one.

But times have changed and now the mac has become so ubiquitous that I recently went to a Linux User Group, and everyone had macs (Huh? Isn't that like going to a church service and finding everyone is wearing t-shirts that say "SATAN IS LORD!!"?). But still, I continue to wonder why linux is so badly supported.

Part of the problem, I think, is corporate attitudes to open-sourcing their driver code/protocols. Now, I've always thought this was odd. Back in the day I remember that large numbers of network cards didn't work under linux, because vendors wouldn't make information available about how to talk to the card. This stuff was all classified 'company secrets'.

Which leads one to wonder what the heck was in those cards? If the cards allowed you to signal to arbitrary points in space-time, or had a secret setting that caused them to print money (erudite readers will realise these two features amount to the same thing) then I could understand this, but they didn't, they just sent messages at the industry-standard speed down a wire. This means that the big secret that couldn't be revealed must have consisted of an interface of the form:


int SendPacket(char *Destination, char *Data, int Length);
int RecvPacket(char *Source, char *Data, int Length);


Sorry, but that's not world-changing technology that anyone's going to steal! WE ALREADY HAVE THAT!

My suspicion was always that what they were hiding was BAD DESIGN. Coding practices and protocol design so horrifically deranged that they could have a walk-on part in an H.P. Lovecraft story.

Hmm, I'm rambling rather badly here, let's pull things back to the point. The new equivalent of those network cards (whose vendors all went out of business, I think. Or rather, I hope) are Wifi cards. There's loads of them, and only a few of them seem to work with linux.

Indeed so bad is the support for wifi cards in linux that someone's come up with something called ndiswrapper that lets you use windows wifi drivers under linux. I tried this, but the very first sign that we weren't going to get on, was that it required me to install perl. I don't want to install perl just to use a piece of hardware/COMPILE A KERNEL/send an email/etc/etc/etc any more than I want to install Python to be able to compile X, gnome or KDE to play old arcade games or browse the web, or install windows to be able to use my computer. But this is another rant. Anyways, this time I gave in, and installed the huge, bloated, misshapen camel-monster that is perl onto my (previously) small and slick system. After doing that, and installing ndiswrapper and going through the time-consuming business of extracting the windows drivers and installing them, everything functioned as expected.

Meaning it DIDN'T F****ING WORK!

So I ripped all that stuff back off my system (though I'm sure there's a few camel-colored tentacles left twitching around in there somewhere) and went out and bought some hardware that's supported by the vanilla linux kernel.

Anyways, below is a list of some wifi stuff that I found works under linux without horrible camel-powered bodges. Many of these devices will be old technology, because I'm the kind of person who likes to find use for the things that the surplus sheeple everyday folks cast aside.



One interesting note: If found that stuff that works under linux, also works under windows, and b(stuff that doesn't work under linux, won't work under windows next year). I have a lot of old technology come my way, and when I find a card or dongle that doesn't work under linux, I try to give it to one of the windows-using relatives who come to me asking if I've got a wifi thing they can use. They come back to me telling me that they couldn't get it to work, and promptly steal one of my linux-compatible devices, and later report delightedly that it 'just worked'. This confirms something I've long said, b(if it doesn't work under stock linux, it's junk). It might work under windows right now, but in a year the company will have folded, you won't be able to get drivers any more, or there'll be a new version of windows under which it doesn't work. Buying cheap tech often means buying cheap tech five times over, where paying double means you get something that lasts five times as long. Do the math.

Right, onto the devices.



SAFECOM SWMULZ-5400

These are great, they're the little wifi-dongle that could. Provided you have Zydas zd-1211b chipset support compiled into your kernel, they just work. This model supports 54g wifi speeds, supports 'ad-hoc' mode as well as the usual 'managed' mode, and seems to have moderately good range. Just about any wifi dongle with the same zd-1211b chipset should work under linux without needing ndiswrapper or any special treatment. Here is a page listing devices that have this chipset. So good are these, that I carry one in about in a pocket, because you never know when someone's going to say "hey, my wifi's stopped working", or something like that.




WIFI-SKY IDU-2850UG-10G

If you've got reception issues, this is the beast for you. It uses the adopts Realtek RTL8187+RTL8225-VF chipset, but unfortunately the in-kernel linux driver doesn't seem to support ad-hoc mode, nor does it support the 'high transmit power' feature of the device. However you can stick and stonking great aerial on the thing (it comes with a good one), and this improves communications considerably. It also looks cool. Supports speeds up to 56g.




TP-LINK TL-WN610G

If you're using PCMCIA, I've found this is a nice, basic card. My one of these seems to have started playing up recently, but that's only after many years of daily service, so I'd still recommend the card. It supports speeds of up to 108 Meg 'super-g', but I think this requires a special access point, so realistically it's 54g like everything else.



NETGEAR MA401

Okay, this is an old, old, old card, it's going to be hard to find these days. But it just works. It only does 11b speeds. But it works. And it keeps working. Mine's been dropped, sat on, stepped on and is now held together with large blobs of superglue, but it works. Old tech tends to work, and keep working, whereas newer stuff is cost-engineered to extract the maximum money from your pocket while providing the most substandard parts possible, and designed to mortally fail a week after you warranty runs out. Buy the old stuff, it can take a kicking and keep on ticking.

Don't, however, assume that this one good card means that netgear products generally work with linux. My experience is that they're very hit-and-miss.



PLUSCOM WP-RT2561T

It does seem that if you see 'Ralink chipset' on a product, you're in with a good chance of having it work under linux. This pluscom card uses the Ralink 'RT2561' chipset.


Okay, that's the good, now for the bad and the ugly.




Belkin products

YOU PAYS YOUR MONEY; YOU TAKES YOUR CHANCE I have a number of Belkin F5D7050uk USB dongles, and they work very well under linux. But this is another of those devices where you have to be very sure you've got the right version of the device. My units are 'Version 3' (I think), and use the Ralink chipset, so they work under linux. However, other versions use a zydas, intersil or realtek chipset. These all look the same, and unless you're buying from ebay with a vendor who states the chipset, you're taking a gamble as to which version you get. I think all these versions have chipsets that should work under linux, but I don't know it for sure, so I can't really recommend them.

I've gotten other belkin hardware, like PCI wifi cards, to work under linux, but I've often found it's a real battle. I'd put belkin stuff under the 'ugly' category.


Linksys products:

AVOID My experience is that they flat-out don't work under vanilla linux kernels.

D-Link "Air Plus G" and other products using the Texas Instruments 'Acx100' chipset

AVOID I used a D-Link DWL-640G+ for some years, but the driver never got into the mainline kernel, and further development appears to have now been abandoned. The drivers probably won't even work with recent kernels, so these cards are scrap.


And that's all I've got.

Wednesday 22 June 2011

Movgrab Status

Current status output of movgrab ('movgrab -test-sites'). This shows which downloader sites are broken, and which I can't figure out, or which seem to have shut down. Long-term broken sites will eventually get removed from the list.

Checking youtube okay
Checking metacafe BROKEN
Checking dailymotion okay
Checking break okay
Checking ehow okay
Checking vimeo BROKEN
Checking almostkilled okay
Checking 5min okay
Checking vbox7 BROKEN
Checking blip.tv okay
Checking ted okay
Checking myvideo okay
Checking clipshack okay
Checking mytopclip okay
Checking redbalcony okay
Checking mobango okay
Checking berkeley okay
Checking yale okay
Checking sdnhm okay
Checking uchannel BROKEN
Checking princeton okay
Checking uctv.tv okay
Checking reuters okay
Checking clipfish.de okay
Checking liveleak okay
Checking academicearth okay
Checking photobucket okay
Checking videoemo okay
Checking videosfacebook okay
Checking aljazeera okay
Checking mefeedia okay
Checking myvido1 okay
Checking iviewtube okay
Checking washingtonpost okay
Checking cbsnews okay
Checking france24 okay
Checking euronews okay
Checking metatube okay
Checking motionfeeds okay
Checking izlese BROKEN

Tuesday 21 June 2011

Movgrab at 300 popularity level on freshmeat

Hurrah!!

My video-downloader program 'movgrab' passes the meaningless but psychologically important level of 300 in its popularity score on freshmeat.

That makes it nearly as popular as Bitcoin

It's the most popular I've ever been!

Sunday 19 June 2011

Three URL Shorteners that don't need authentication, XML or JSON

Here's three URL shorteners that will allow you to get a shortened link without needing authentication, and with very simple APIs. These are useful if you're writing blogging or microblogging (twitter-style) applications.

All three take a simple HTTP GET request. As you have to include the URL you want shortened in the request, you have to HTTP encode it (you know, all that %20 stuff). All of them return one line of text, which is the shortened version of the URL.

You should be able to test them by simply using a webbrowser and going to the link. Don't forget to replace the line phrase <url goes here> with an http-encoded url.

Cli.gs http://cli.gs/api/v1/cligs/create?appid=autoblog-0.1&url=<url goes here>

Linkee http://api.linkee.com/1.0/shorten?format=text&input=<url goes here>

Is.gd http://is.gd/create.php?format=simple&url=<url goes here>

Saturday 18 June 2011

Howto Change Blogger Settings with the GData API

I've just discovered an undocumented (or I couldn't find any docs for it anyways) way to change the settings of your Blogger/Blogspot blog via the GoogleData API.

I discovered this as a result of the recent 'breakage' of my API client. I was using a blog-posting 'endpoint' URL that wasn't supposed to work, but had been working until recenty.

Geeky Groups near Birmingham UK

I've recently been getting more into meeting like-minded people, which is to say 'geeks'. After years of trying to pretend that I'm not one (in the same way that I tried to pretend my eyesight wasn't failing when I was a kid) I've finally decided to come out.

This new sociability probably started when I visited the c-base hackerspace in Berlin,



where I got horribly drunk and threw up in their loos. It wasn't all my fault though, I didn't pour all that Jager down my own throat. Well, okay, literally speaking I did, but someone kept filling the glass, so I feel there's shared responsiblity.

Anyways, since then I've been to the Nottinghack hackerspace in Nottingham. They did a frankly wonderful lockpicking workshop, and if they ever do another of these and you can go to it, I'd urge you to do so. You'll learn a lot (most of it alarming).

How to fix your broken Blogger client program

For about a month now I and other people have been unable to use the blogger api to update our blogs. This is one of a raft of problems caused by a recent update of the blogger system, and some other ones (including the fact my OpenID is broken) are still outstanding. However, the OpenID thing isn't a big deal, whereas the api blog posting is something I use a lot.

I can happily report that the Blogger/Google people have come through for us and found the problem. I had been losing hope, because as a linux user I'm used to having people break stuff, and then say the problem is that I'm running linux. But, though it's admittedly taken them a while, google's blogger team have dug to the bottom of the problem and found the cause. Maybe I should have more faith in future, we'll see.

If you've found that your blogger API client program has stopped working in the last month, then what follows is what you need to do to get it working again.

Friday 27 May 2011

Google's Blogger Service is Broken

Since about 2011/05/22 google's "Blogger" service (where this blog is hosted) has been experiencing serious problems. You can see a list of increasingly irate people here . It's a weird fault that hits different people in different ways. Some can't log in, some can't log out, some can log in but can't post.

I've not been as heavily affected as some, I can still log in to the website and post to my blog. However, I can't use the 'blogger api' to post from applications. Other people using blogging applications like MacJournal or ScribeFire are having the same problem.

The amazing thing is how long it's taking google to fix this, days. Also it seems to me (though I may be wrong) that this is linked to a recent decision by google to turn on 'Spam Checking' on everyone's blog comments. They didn't ask us if we wanted this turned on, they didn't suggest we turn it on, they just went and turned it on for us. They did this a while back with 'google buzz', turning it on and in the process revealing users gmail contacts to the whole world. I conclude from this (assuming I'm right about the cause) that google learns nothing from history.

But there's a bigger issue there. We're told that everything is moving into 'the cloud', that big competent companies will 'look after our data' and make thing effortless for us. You know, big competent companies like BP, or Toyota, or Enron, or Sony, or Google, or any bank, or...

These big companies aren't exactly covering themselves with glory these days. Would you really trust them with your business critical data?

Tuesday 10 May 2011

Things I wish people had told me about 1: Bind Mounts

Stuff I wish people had told me about No. 1

Bind Mounts

Quite often I find myself wanting to run processes in a chroot. This is especially true for file services being served up by ftp or http. Unfortunately I often find that files I want people to get access to are outside the directory that I want to chroot them into.

Now, symbolic links won't work across chroot, and though you can use a hard-link to make files individually available within a chroot, it becomes a lot of work for a lot of files.

Just recently though, I discovered that you can do this:


mkdir /home/PublicData
mount --bind /home/PublicData /home/chroot/PublicData

These 'bind mounts' allow you to 'mount' a directory onto another directory. So, you create an empty directory with a particular name, then call the mount command to mount another directory onto your empty directory, so that when people enter the 'empty' directory, they are teleported to the other directory.

This means that you can choose which directories to make available to people who are in some kind of chroot jail. Very useful!

I wish someone had told me about this earlier.

Tuesday 12 April 2011

Root's bash profile not working when su

A reaccuring annoyance for me is getting root's bash_profile to work, and everytime I fix it, I promptly forget what I did, so here's a post for me to refer to if noone else!


Things like the users PATH and other environment variables can be set up in a file in their home directory called .bash_profile. If they're using the Bourne Again Shell then this file gets read when they login, and any commands in it are run to set up their environment. But in my experience it never works for root.

There's a difference between root and other users though, I almost never login as root, I login as another user and then 'su' to root. Turns out that an 'su' doesn't count as a login, and '.bash_profile' only gets read and run for login shells. If other types of shell get started up, say by being launched from a program or whatever, then another file '.bashrc' is read instead. So, if I put the same commands in /root/.bashrc that I normally would in /home/user/.profile, then they will work when I 'su'.

Finally there are 'global' bashrc and profile files that can be put in /etc, and these will be run for all users before any profile or bashrc in their home directory is run. Note that these files don't have the leading '.', so instead of /home/user/.bashrc, it's /etc/bashrc. And for the profile, it's /etc/profile instead of /etc/bash_profile as you might expect! Oh, and finally, these global files don't seem to work for /root.

So, to get the PATH and prompt etc set for everyone, create /etc/profile for all users but root, and then copy it to /root/.bashrc, and /root/.bash_profile and that should cover 'su' and 'login' shells for root too.

Monday 4 April 2011

Nvidia drivers fail without 'smp_lock.h'

If you install a very recent kernel from www.kernel.org, and then try to install the NVIDIA graphics drivers, you may find that the driver install fails. The NVIDIA installer actually compiles the drivers against your kernel source tree, but recent kernels seem to have dropped a file that's called 'smp_lock.h'. Unable to find this file that it expects to have, the NVIDIA driver compile process fails.

A quick and dirty solution that worked for me was to simply locate 'smp_lock.h either under /usr/include/linux, or in an old kernel source tree, and drop it into the include/linux directory of your new kernel source tree. If you can't get a copy of a the file, then try making an empty file with the same name, I think even that will probably work. You should then find that the NVIDIA install process gets by that hurdle at least. It worked for me!

Monday 7 February 2011

I'm up on "Daily Science Fiction"



Well, on Friday my story "Imaginary Enemies" went out on the Daily Science Fiction mailing list. My first pro-paying publication. What feed-back I've seen from readers is good, no one hated it, many people are saying they liked it. I'd like to thank my friends and family, and Sainsbury's for doing the catering. I'm sure my sudden success won't change me.

Actually, I was kinda hoping it would change me, but no signs yet.

Anyways, in a week or so it's apparently going to get posted to the Daily SF website for everyone to see, even those who aren't on the mailing list, and no doubt then the bidding war for film rights will start!!

Friday 28 January 2011

Broadband speedtests that don't need flash or java

Look, I don't want to install flash or java just to find out how fast my internet connection is. I just want something that downloads a file and gives me a result. Here are some websites that do this basic thing.
1) Tracert.org
http://www.tracert.org/bandwidth_meter/

For me the best one, almost magical in fact. You just click 'start test', and it works. Works in old versions of firefox without flash, and seems to produce results that agree with other tests.

2) Ten Meg
http://tenmeg.myby.co.uk/

Yes, it requires you to watch a couple of images downloading and click a button when they're done, but it works in browsers without flash, java, activex, siverlight, perl, ruby, php, gtk, etc, etc, etc, etc.


3) ISP GEEKS
http://www.ispgeeks.com/wild/modules.php?name=Bandwidth_Meter_DSL

Described as their 'Mobile Speed Test', doesn't seem very accurate (perhaps because they're in the USA and I'm in the UK), but it gives a rough idea and doesn't need flash etc.

4) Broadband speed checker
http://www.broadbandspeedchecker.co.uk/

Seems to work in I.E. without flash, though it says it would like to have flash 8. Unfortunately seems to be broken in earlier versions of firefox.

5) Toast.net
http://performance.toast.net/

Again, not massively accurate, but simple and kinda fun waiting for the picture to download!

6) Mobile test
http://i.dslr.net/iphone_speedtest.html

Aimed at mobile phone browsers, but if you click the 'wifi' option, it seems to give a fairly accurate result (but that could be a co-incidence).