I'm at the Chaos Communications Congress in Hamburg. There's not much to recognize me by, I'm just the guy dressed all in black (like that really narrows it down) who is using an ancient compaq laptop with bits missing off it, and who speaks no German.
Thursday, 27 December 2012
I'm at Chaos Communications in Hamburg
I'm at the Chaos Communications Congress in Hamburg. There's not much to recognize me by, I'm just the guy dressed all in black (like that really narrows it down) who is using an ancient compaq laptop with bits missing off it, and who speaks no German.
Friday, 7 December 2012
Movgrab Popularity now 600
This week saw the release of version 1.1.14 of Movgrab, resulting in its 'Freecode/Freshmeat' popularity rating rising to over 600! Like all measures of popularity the freecode rating is... a number, that means... something. Maybe. Still, whether it's a meaningless figure of not, I still get a thrill out of watching it go higher.
This release adds support for files > 2GB on Gnu systems, adds support for downloading from Animehere, and fixes a problem with downloading 3gp files from youtube. All these changes/bugs were suggested or reported by movgrab users. Thanks to Karol Blazewicz, Deeice, Matthias B, Ndracs and others for taking the time to contact me, and thanks again to Abhisek Sanyal for his lifesaving patch to get youtube working again. Feedback from users is what will keep movgrab moving forwards!
My other projects languish with ratings well below 100. I've not had time to really work on them, and most of them are 'first releases' that have serious bugs. It's time for movgrab to take the back seat for a while I think, and for someone else to have some attention.
This release adds support for files > 2GB on Gnu systems, adds support for downloading from Animehere, and fixes a problem with downloading 3gp files from youtube. All these changes/bugs were suggested or reported by movgrab users. Thanks to Karol Blazewicz, Deeice, Matthias B, Ndracs and others for taking the time to contact me, and thanks again to Abhisek Sanyal for his lifesaving patch to get youtube working again. Feedback from users is what will keep movgrab moving forwards!
My other projects languish with ratings well below 100. I've not had time to really work on them, and most of them are 'first releases' that have serious bugs. It's time for movgrab to take the back seat for a while I think, and for someone else to have some attention.
Wednesday, 14 November 2012
Movgrab Popularity Passes 500
I don't quite know what the 'Popularity' ratings on freshmeat/freecode really mean, but movgrab has passed a new level, reaching a score of 541. I think this means it's really quite popular. It's now included in a number of linux distros, and one 'extra programs pack' for the mac.
My other programs aren't getting anything like the same degree of love. I guess people don't need another FTP server, and Alaya, my dav aware webserver apparently still has too many bugs when run on other people's systems (hoping to solve those in a future release). Perhaps their time will come when they are more mature.
My other programs aren't getting anything like the same degree of love. I guess people don't need another FTP server, and Alaya, my dav aware webserver apparently still has too many bugs when run on other people's systems (hoping to solve those in a future release). Perhaps their time will come when they are more mature.
Monday, 26 March 2012
Ready for my close up, Mr DeMille
I've been quiet on this blog recently, busy, you know how it is. But I've got to boast about this, someone has made a youtube video about my movie downloader program 'movgrab'.
It's at youtube: http://www.youtube.com/watch?v=R9YhoYay_Q4
Movgrab has been getting a lot of love recently, with people blogging about it all over the place. I've also had one or two feature requests that I'm going to try to implement sometime. But I must admit, I like the youtube vid best of all.
It's at youtube: http://www.youtube.com/watch?v=R9YhoYay_Q4
Movgrab has been getting a lot of love recently, with people blogging about it all over the place. I've also had one or two feature requests that I'm going to try to implement sometime. But I must admit, I like the youtube vid best of all.
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!
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'.
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
'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.
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.
Subscribe to:
Posts (Atom)