Moving referenced images in a markdown file to another folder

The other day I was writing a brief report in multimarkdown which had several images and some code. After I finished the report I decided I would move the images from their original folder to another one. Since there were quite a large number of images, and not all of them were residing in the same directory I thought I’d write a small script. Continue reading

To wrap or not to wrap

First of all, if you don’t know what a line wrap is, but you’re constantly using text editors you’re going to want to know. So lets ask Wikipedia,

In text display, line wrap is the feature of continuing on a new line when a line is full, such that each line fits in the viewable window, allowing text to be read from top to bottom without any horizontal scrolling.

Additionally, you can do a soft wrap, which is the break resulting from a line wrap, or a hard wrap as an intentional break–creating a new paragraph. Most modern text editors soft wrap lines by default, that is they adjust the line lengths automatically with adjustments to the width of the user’s window.

While in most situations staying with soft wrapping is not an inconvenience, hard wrapping might just be what you need under several special circumstances. Computer programmers actually make use of hard wrapping on a daily basis, because when working with text editors for checking/writing code you really need your lines perfectly wrapped and properly indented to check your code or for spotting errors.

The actual issue comes from the fact that when compiling, you might get an error pointing to line 87 of your code. If line 87 is soft-wrapped with who knows what other code. It could be truly cumbersome to find the error. Now, the same applies for tex files. And it is really easy to mess up a tex file, especially because you’re actually writing a document (article, presentation, etc.) with–most likely–soft-wrapped paragraphs, as opposed to programming.

If you consider another situation, such as in version control. When carrying out a diff command, it is almost impossible to spot a typo with a soft-wrapped paragraph. Furthermore, fixing this single typo will be considered as a change in whole line (is this what you really want?). The same happens when running a grep command. There’s another typical situation where you wish the editor would best hard wrap. Some mail clients don’t wrap well (or don’t wrap at all) when you’re forwarding or replying to a message. The consequence is that the recipient has to scroll horizontally to what seems and endless line to read the quoted message.

However, not everything is great with hard wrapping. Hard-wrapped paragraphs look nice until you start to edit them. If you hard wrap again, you end up with a much more lines changed in the diff than you originally intended.

So, do I soft wrap or hard wrap?

On the one hand, if you haven’t had any of the problems I’ve mentioned, and you really don’t know what your regular text editor is doing, keep doing what works for you. On the other, there seems to be reasonably compromise as suggested by Will Robertson on stackoverflow. He wraps by sentences,

  • Small changes are comparatively easy to spot in a diff.
  • No re-flowing of text, only changes to, insertions of, or removal of single lines.

Looks a bit weird when you first look at it, but is the only compromise I’ve seen that addresses the two problems of soft and hard wrapping.

If you want to try it, or had a similar issue with wrapping, leave a comment. Who knows, this approach could probably make us write shorter sentences, which in general is much better than really long sentences that hardly let you catch your breath.

Transdroid: a cool way to manage your torrents from your Android device

Whether you have a torrent client on your NAS device or on your desktop, Transdroid is a nice way to manage your torrents from your phone. All popular clients are supported, including µTorrent, Transmission, rTorrent, Vuze, Deluge and BitTorrent 6. You can view and manage the running torrents and individual files. Adding is easy via the integrated search, RSS feeds or the barcode scanner. Monitor progress using the home screen widget or background alarm service.

Last time I checked it had been pulled from the Android market, however if you download directly from their site you can install without problems. I’ve been using it for several months with Transmission installed on my NAS–a WD MyBook World Edition–and it is one helluva tool.

 

Batch convert in ImageMagick

Many a times I wanted to do a batch convert in ImageMagick, however in the many websites I visited looking on how to do this, they always recommended to use the command mogrify. This partly achieves what I want, but at the expense of overwriting the original files.

Instead I found out that one could do this with the convert command in the following way:

convert *.jpg -format -tiff image-%d.tiff

Here I wanted to convert from jpg to tiff format without losing the original files. This works for any conversion you want to do. The additional %d part is for establishing the number for each converted file;i.e. the new files will be image-0.tiff, image-1.tiff, etc.

Hope it works for everyone!

pyLoad for WD MyBook World Edition

For all of you out there that own a WD MyBook World Edition NAS you might find the pyLoad download manager as a true blessing. If you have used or frequently use jdownloader for your downloads, you will find pyLoad very handy. jdownloader is written in java, whereas pyLoad is in python. pyLoad is very light, and it can be operated via command-line, web interface or a regular GUI (not available for NAS devices).

For staters, to be able to install pyLoad you must have Optware up and running. It is a software package repositories maintained by NSLU2 project. They offer access to hundreds of precompiled packages with the latest and greatest software. Go to this link to find out how to install it. Just follow the easy steps and in a few minutes you’re good to go. In that page they also explain how to install pyLoad, although I tried to follow their instructions without success, still don’t know for sure why it didn’t work.

Finally, to install the pyLoad on your WD MyBook you can follow the instructions on this web. It is explained for the D-Link DNS-325 Router, but it worked flawlessly on my WD. There’s one catch, be aware when it asks you for the default Downloads folder. In this webpage they recommend to put /mnt/HD/HD_a2/Downloads/ however in your WD you should put something like /shares/Public/whatever_folder_you_want/.

That’s all. Hope it works for everyone.