Archive for October, 2007
Programming in Ruby Using SciTE – Windows Issues and Other Tips
0Couple of comments(by Mihail and Jonathan) on my earlier post about programming in Ruby using SciTE editor brought this to my notice: When using SciTE to develop Ruby programs on Windows platform, there are a few issues that one needs to be aware of.
- To run the ruby interactive interpreter (or any other ruby command-line tool) from within SciTE editor on Windows, use full file name of the command, like irb.bat. If not already visible, open the output pane from View -> Output and type irb.bat in it. You should be dropped in the ruby shell; type ‘exit’ to exit the shell. You can any ruby command in this way, e.g. irb.bat, ri.bat. You can also run windows commands that are in the system path in the same way.
- When you run a Ruby program either using Tools -> Go menu item or using F5 key command, SciTE spawns a shell process to run ruby.exe in it. This may result in a DOS box popping up when you run a ruby program. You never will have to deal with this DOS command window directly, if it comes in your way, just minimize it and go back to the SciTE editor. All the output will be visible in the output window(View -> Output if it is not visible) and any input needed by your Ruby program should also be entered in the same output window. To reduce such confusion, it is always a good practice to print a prompt string whenever reading input from the user; if such a prompt string shouldn’t be a part of the interface, keep it anyway in the development version:
[ruby]
print “Enter a number between 5 and 55:”; STDOUT.flush
num = gets.to_i
[/ruby]
Adding a Menu Entry to Invoke irb Command
If you use the Ruby interactive shell frequently and don’t want to type seven characters each time you want to invoke it, then create a menu entry/keyboard shortcut for it. To do this, open the Ruby properties file by selecting Options -> Open ruby.properties menu item and search for Windows-specific settings(PLAT_WIN section).

Add the following lines in that section:
command.name.0.*.rb=irb
command.0.*.rb=irb.bat
command.is.filter.0.*.rb=1
command.0.subsystem.*.rb=1
Use another number in place of ’0′ if you have already bound it to something else. The first line(command.name.0) defines the name to be used in as the menu entry. The second line(command.0) defines the command to be invoked when this menu entry is selected. A value of ’1′ in the third line(command.is.filter.0) indicates to SciTE that the command may modify the contents of the current file(file is reloaded based on the value of load.on.activate setting).
The section in the properties file should look like this:

You can now invoke irb from Tools -> irb or by using Ctrl-0 key command. Note that this menu item will be visible only when editing .rb files. Ctrl-F6 will switch you between the file pane and the output pane.
What about GNU/Linux?
You can add a similar section in PLAT_GTK section if you are using SciTE on GNU/Linux platform, but use irb in the second line in place of irb.bat:
command.name.0.*.rb=irb
command.0.*.rb=irb
command.is.filter.0.*.rb=1
command.0.subsystem.*.rb=1
Add menu items to other frequently used commands in the same way(even links to help documents). For more information, refer to help document available from Help -> SciTE Help.
How to Join or Split Video Subtitle Files Using Subtitle Workshop
15Suppose you rip one of your DVD movies to an encoded/compressed format like DivX/XviD file and store it on your hard drive. Now you want to watch it along with the subtitles in your favourite language. You can search for the subtitles on the web but sometimes it is hard to find a subtitle for a less popular movie. If it so happens that you find yourself half-lucky and succeed in finding the subtitles but for a 2 or 3 part version of the video whereas you have ripped the DVD to only one part, you can either rip the DVD again, this time into 2 or 3 parts to exactly match the number of subtitle files available or you can follow the simpler procedure described below and use Subtitle Workshop to join the downloaded files into one subtitle file. How to split the subtitle files in case you have the video in multiple parts but the subtitle file in only one part is described next.
Joining Subtitle Files Using Subtitle Workshop
- Download and install Subtitle Workshop. Run it from the start menu.

Subtitle Workshop main window:

- Go to Tools -> Join Subtitles or press Ctrl-J on the keyboard.

In “Join Subtitles…” window, use the “Add” button to add as many subtitle files as you want to merge together. I could only find two subtitle file version of Paris, je t’aime but the movie that I have is only one part. So I am going to merge these two SRT files together. After adding the files to Subtitle Workshop, the window looks like this:

You can select what format the joined subtitle file should be created in “Output Format:” field((select “SubRip” if you are not sure). You can also check the “Load file after joining and saving” checkbox if you want the joined file to be opened in Subtitle Workshop for further editing(Subtitle Workshop is a powerful tool to do all kind of subtitle editing, only we are going to talk about splitting and joining operations).
- Now comes the only hard part of the process: you need to know or need to find out the frame rate of the movie for which the subtitle was extracted. As only the person who created the subtitle file would know what framerate he was targeting for, chances are that the place you have downloaded the subtitle file from can tell you the framerate of the subtitle file(subscene mostly does). Sometimes it is noted in the file name itself. If you are unable to find out the correct framerate to be used with the subtitle file, your only hope is to guess it from popular framerate values and try them out one after the other. You can try the order as present in the dropdown box which is right to the “Clear” button in the second image in Step 2. I have never seen a subtitle being made for any other framerate.
- After selecting the framerate of both the movie and the subtitle files, you are ready to go. Select your favourite Subtitle file format and click the “Join” button and select a location for the output file and enter a name for it in the pop-up “Save As…” dialog box. The joined file will be created at the selected location which you can use to play with the movie using a media player like VLC. (If you find that the subtitle text keeps getting unsynchronised as the movie plays, then read Step 3 again and try another frame rate. You can also select a custom frame rate directly from “Advanced Settings” in File -> Open File… dialog box of VLC Media Player).
Splitting Subtitle Files Using Subtitle Workshop
If you have a video file in two parts but the subtitle for it is available in only one part then we need to either join the video files into one or split the subtitle file in two parts. Merging two video files is a very time consuming process, what would be far more easier is to split the subtitle file using Subtitle Workshop.
- Start by loading the subtitle file in Subtitle Workshop using File -> Load Subtitle menu item.

- Next go to Tools -> Split Subtitle (this menu item will be disabled until a subtitle file is loaded)

- The Split Subtitle window looks like this:

In this window you can select one of many ways to determine exactly at which point to split the subtitle file. In most cases the simplest way to find this out is to select “End of Video” radio button and browse to the first part of the video file using the “Browse” button. You can also specify the duration of the video file in “Given Time” field if you know it(you can find it out from file properties or by playing the video in a media player). If you want to split the file exactly in half by number of lines in the subtitle file or the duration of the entire video, then click the “Advanced” button to see the options(these are rarely of any use).
After selecting one of the options above(End of Video/Given Time/Given Frame/Advanced), click the “Split” button to split the file into two parts. The values in “Naming,” “Output Directory” and “Output Format” fields can be left with the default values.
The above methods of joining and splitting subtitle files should work without a hitch unless there is a discrepancy between the framerate of your video file and the framerate for which the subtitle was created. Because the split and join operations take no time at all you can always experiment with different framerates(it’s easy to find out the framerate of the video file from its file properties, you need to worry about the subtitle file only). You can also first synchronise the framerates of video file(s) and the subtitle file(s) and then attempt the joining or the splitting operations. Or you can also try different framerates right when you are playing the video in a media player like VLC(I mostly do just this). I will perhaps make another post on how to do such synchronisations using the sameSubtitle Workshop application in the future.
Streaming Music To Nokia N800 using Windows Medial Player 11
5There is no arguing that as soon as you replace the headphones that come with Nokia N800 Internet Tablet with any other decent quality headphones, you have got yourself an excellent music player. The playback quality is good and the user interface of the default media player is far better than that of a typical MP3 player(large size, touch screen etc.). The only downside is that the N800 comes with a meagre storage memory of 256MB! OK, you can stop laughing now, it does come with two memory slots enabling you to expand the storage capacity to 8/16 GB. 2 GB SD cards especially are very cheap on Amazon or eBay. Not interested in spending more money? You have a way out: Nokia N800 is a UPnP AV device which means that all you need to stream your entire music collection from a computer to N800 tablet is a UPnP AV MediaServer.
But what is a UPnP AV MediaServer? Let’s ask Wikipedia for help:
UPnP AV MediaServers store and share digital media, such as photographs, movies, or music [with UPnP AV Clients like N800]. There are UPnP MediaServers available for most operating-systems and many hardware-platforms. Software-based UPnP AV MediaServers can be run on PCs (Personal-Computers), mainly on Microsoft Windows, Linux, BSD, Unix or Mac OS X.
What does this translate to in the context of N800? It means that we can turn any computer that has access to our music collection into a media server that can stream the music to N800 directly over the wifi/network connection. This has become an absolute ‘new’ favourite feature of mine and I no more try to store as much music as I can cramp on the 8GB cards of my N800; instead, I just run a Media Server software on the computer, point it to my entire music collection(~80GB) and access it all from the media player of Nokia N800. Let us see how simple one way to setup N800 with a Media Server software.
If you are a Windows Vista user, almost everything needed to setup N800 for media streaming is already available for you :) It is because Windows Media Player 11 has built-in support for UPnP media streaming. (Not to say that it is any difficult to setup media streaming in GNU/Linux, as we will see in future posts.)
To configure which music/picture folders should be shared with the UPnP devices(N800), fire up Windows Media Player 11 from the Start menu(you use Launchy? Good for you) and go to the Tools -> Options window(pressing the “ALT” key will show the main menu). On the “Library” tab, click the “Monitor Folders” button and add as many folders as you want to share using the “Add” button. When finished, dismiss all the dialog boxes and close or minimise Windows Media Player.
![]() |
![]() |
Boot N800 if it is not already powered on, start the default Media Player(or MediaStreamer if it is installed), and in its Library you will find a new entry listed under the name of your computer, which is the WMP 11 MediaServer. Click this entry to browse all the music and pictures that you have set for sharing.
![]() |
![]() |
Note: If you feel like changing the settings used to share the files in Windows Media Player, then go to the same Library page under Tools -> Options window and click the “Configure Sharing” button. In the pop-up window, click the “Settings…” button and customise the way you want to share the music, pictures and the videos…wait, strike that video part out, it is a hopeless case to try to play video on N800 streamed from Windows Media Player!
![]() |
![]() |
Using Windows Media Player 11 in Vista to stream music to N800 is the easiest setup, but definitely not the only one. You can setup older versions of Windows Media Player if you are a Windows XP user but you need a non-free plugin for that I believe. But the real fun starts when you install and configure a real UPnP MediaServer to work with N800, such as TVersity. Many of them support video transcoding and streaming too! Music can be streamed to N800 using other methods too, over HTTP using SlimServer, DAAP using Rhythmbox etc. And of course you can use other UPnP client software(say MediaStreamer) in N800 and not just the default media player. The possibilities are endless for a capable device with an open development platform! More to come in future posts.
Winding up what I had said in the beginning of the post, media streaming is not a complete replacement for the lack of decent storage available on N800. To carry music wherever you want to take N800, buying additional SD cards is a must. The only other option will be to setup the media stream server to stream music over the Internet and access the shared music from Nokia N800 through a wifi hotspot or a service-enabled phone, in which case, good luck with the streaming speed!
Different Ways of Taking Screenshots in Nokia N800
2I use the following different ways to take screenshots of the screen of my Nokia N800 Internet Tablet depending on which one is most convenient in a given situation.
-
MH Shot Tool
MH Shot tool is an easy to use screen capturing tool that does one job very well: when run, it captures the N800 screen in its current state and provides an option to upload it directly to a Flickr account. I find it to be the fastest way of transferring a picture of my N800 screen to my blog. It also provides the option of saving the image to N800 memory card, but if you want to save the images at a non-default location, then you will have to browse to that location every time you take a screenshot – MH Shot tool doesn’t remember the last-saved location. MH Shot tool also doesn’t support delayed screenshots which means you can’t first start it and then go and prepare the screen for capturing. Because of this you can’t take screenshots of applications running in fullscreen or with menus popping-out.

If maemo hacker repositories are setup in your tablet then you should be able to install it right from the Application Manager. Otherwise go to inz’s mh-shot-tool page (perhaps from your Nokia N800) and click on the .install file. To take screenshots, setup N800′s screen the way you like it and then run the tool from Extras -> MH Shot tool. You will be prompted with a choice to either upload the screenshot to Flickr website or save it in a local folder in N800′s memory card. If you choose to upload it to Flickr, you will have to enter your account username and password but you need to do this only the first time.
This application could be so much more useful if it can allow delayed screenshots too. I also am not sure if there is a way to use a second Flickr account with it.
-
Maemo Screengrabber
Did you ask for delayed screenshots? OK, that was I :) But don’t worry, we’ve got it. The application I use for taking delayed screenshots on my N800 is a very user-friendly osso-screenshot-tool wrapper tool called Maemo Screengrabber. Go to Tuomas Kulve’s page and follow the instructions to install maemo-screen-grabber tool on your Nokia N800. Now when you want to take a screenshot, first (roughly) prepare the screen as you want it and then run the tool from Extras -> Maemo Screengabber. You now get another 5 seconds to make any changes to the screen(e.g. make any menus visible or switch to fullscreen mode) before the screenshot is taken and automatically saved in the “Images” directory.

I wish the capture delay time and the default save location were configurable(see (4) below on how to do this). But many thanks to inz/Santtu and Toumas for making available two useful tools that I probably can’t do without :)
-
VNC using x11vnc
If you want more control over the process of capturing the N800′s screen, and also editing and uploading it to one of the several image hosting websites, your best bet will be to do it from a computer using VNC software. To do that, install a VNC server on N800, install a VNC client on the computer, connect them together, and then take screenshots from the computer in whatever way pleases you. I have written a post about one such way to connect a computer to Nokia N800 using VNC, so probably that will be a good place to get started. Once connected through VNC, the N800 screen from the computer looks like this:

So you can now just use the typical screen capturing tools that you have always used on your computer, and after capturing, you can edit the screenshots to your heart’s content and finally upload it to your favourite image hosting websites.
-
Screenshots from the terminal(osso-screenshot-tool)
If you are feeling adventurous and want to take screenshots from the terminal, one way to do it is to use osso-screenshot-tool directly(you can install it from the Application Manager; obviously xterm also needs to be installed). Its wrapper mentioned in (2) above is preferable unless you want to take screenshots from within a script(custom delays, multiple automated multiple screenshots, custom save locations, oh my!) or something like that. Recommended only if you are comfortable using the terminal but if you are already sold on this, René Seindal has a thisgood post to get started.

NOTE: I also keep hearing people talk about a certain CPU load applet (osso-statusbar-cpu, needs osso-screenshot-tool to be already installed) that it also takes delayed screenshots, and that it is actually meant for ITOS2006(N770) but installs just fine on N800 too. But I could never get it to work on my Nokia N800.
-
Maemo Scratchbox
If you have Maemo Scratchbox installed on your computer and you want to take screenshots of an application that can be installed in it, then taking screenshots from here will be simpler as you don’t have to worry about connecting N800 to the computer(or have anything to do with N800 at all). If you don’t know what Maemo Scratchbox is, you can forget that I ever mentioned it! (Or get started with Maemo LiveCD.)
My toolset includes MH Shot tool, Maemo Screengrabber, VNC(x11vnc + VNC client), osso-screenshot-tool and the Scratchbox, but mostly I try to use VNC. Which ones are your favourites?






Recent Comments