Thursday, 17 December 2009

Linux Tips: Vim autoconfigure for different filetypes

Thanks to Ajay Somani, over at http://ajayfromiiit.wordpress.com/ for this post that finally helped me solve a long term gripe with vim.

When I'm in 'programmer' mode, I use vim with syntax highlight turned on.
When I'm in 'wannabe fiction writer' mode, I use it with spell check turned on.

And these two personas keep fighting like Jekyll and Hyde. Because I have both of these turned on, vim insists on syntax highlighting my fiction, interpreting apostrophes as quotes and then coloring everything after them. Worse still, it spell-checks my C-code. It'll highlight some text in red, and then spell-check it, and decide it's mis-spelt, and thus surround it in a background colored.... red. This results in large blocks of red-on-red text that cannot be... uh... read.

The solution, it turns out, is to add this magic line to my vimrc:

autocmd BufEnter *.txt set spell

Wednesday, 16 December 2009

HTTPS: No one uses it

I spent a whole night battling to get secure http working in 'Movgrab', only to discover that no-one uses it. I couldn't find a single proxyserver that supported 'straight' https (some of them might support use of the 'upgrade' header, but as of right now, I don't understand that). So then I switched to using https to connect directly to video-sharing websites. Any google website (youtube, videos.google.com) bounces me straight to www.google.com if I try to use https. Many other sites let you use it for the initial connection, but insist on redirecting you to http: when you try to get video. The rest don't support https at all.

I don't know, I would have thought that in these days of 'Web 2.0' secure browsing would have been the norm by now.

Tuesday, 15 December 2009

Hey, movgrab people!

So, I posted movgrab to www.freshmeat.net on Sunday. Since then, I've not heard anything, but through my advanced psychic superpowers I happen to know that visits to my new technical blog have jumped dramatically. The only explanation for this, I believe, is that people are downloading movgrab, and seeing the mention of my blogs on the help-page (or the website they download it from).

So, if you're coming here having used movgrab, leave a comment. Did it compile on your system? Does it work as advertised? Will it change your life? Did using it open a portal to the dungeon dimensions (if it did, and you're thinking of suing, you're out of luck, I included a disclaimer covering exactly this eventuality).

Come on people, I needs to know!


Sunday, 13 December 2009

My first code release up on freshmeat!

Big day for me today. I've been writing software projects for simply years, maybe even decades, and every one of them has grown and grown, but it's never finished, it's never ready for release. Finally I've gotten my first project completed!

Okay, it's a fairly trival app. Movgrab is a command-line app for downloading flash/mp4/mp3 movies and audio from websites that offer that kind of thing. This is useful to we linux luddites who are still using machines that most people wouldn't even use for email these days (for instance, I've got a bunch of pentium-1 laptops that I use as 'holiday' or 'travel' laptops, because no one is likely to bother stealing them, and if they get smashed or something, then I've not lost very much). On weedy machines like the one I'm typing this blog-post on, web-browsers like firefox don't run well. Unfortunately light-weight webbrowsers don't support flash. The solution? Download the movies and watch them with a command line player, rather than in a web-browser.

There are other downloader applications out there of course, but few of them are command-line 'C' programs like movgrab. Most of them require you to install scripting languages and libraries, which can be a headache, I find. Also, few of them support as many download types as movgrab does (including BBC iplayer, youtube, metacafe, dailymotion, crazymotion, uchannel, various university webcasts etc, etc).

More important than the app is the underlying library ('libUseful') that allowed it to be written. Writing movgrab meant adding a lot of code to the library to support HTTP transfers, and this is being used in a lot of other projets too.

So, there is a new website over at http://sites.google.com/site/columscode, where one can download this first of my masterpieces.