HP ProBook 4540s brightness control in Ubuntu 13.10

The HP ProBook 4540s is a good choice when you need a GNU/Linux machine, but there are some hit and miss on the details. The thing I found most tedious is the brightness controls using the keyboard: they simply don’t work at all.

My soloution

See the kernel parameters actually used:

$ cat /proc/cmdline 
BOOT_IMAGE=/boot/vmlinuz-3.11.0-15-generic root=UUID=8850c025-676a-4e8c-ac83-4ed1147b88d4 ro quiet splash vt.handoff=7

If there’s no reference to acpi_backlight, that’s the problem. Add the parameter to /etc/default/grub changing the following line from

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

Done

Markdown Viewer Firefox Extension Screenshot

Markdown Viewer Firefox Extension

I’m spanning the use of Markdown in every place I can: project documentation, blogging, note taking etc.

A useful Firefox extension I found is Markdown Viewer. It let you view Markdown files, HTML formatted, directly in the browser window. It’s useful when you have md files on the local filesystem that you want to quickly preview.

Problem: Firefox tries to download every .md file

I found a really annoying problem using this extension and I’m going to describe how I solved it: let’s say I have a file called notes.md in my home directory (/home/max/notes.md), I should view that file in Firefox visiting the url file:///home/max/notes.md.
At this point Firefox wants to download it and there’s no easy way to force it to use the extension.

The solution is to edit a configuration file

$ vi ~/.mozilla/firefox/*.default*/mimeTypes.rdf

and add a text/plain dedicated area with the md extension specified:

<RDF:Description RDF:about="urn:mimetype:text/plain"
    NC:value="text/plain"
    NC:fileExtensions="md"
    NC:description="Text Document">
  <NC:handlerProp RDF:resource="urn:mimetype:handler:text/plain"/>
</RDF:Description>

The last thing is to restart Firefox and everything should now work.

My set up

Just a side note: I’m running Ubuntu 13.10 with Firefox 26.0 and Markdown Viewer 1.3.

References

The comments on the extension page.

Detect Markdown files in vim

Quick tip which force vim to recognize .md files as Markdown formatted files:

  • create, if not exists, the needed directory
    mkdir -p ~/.vim/ftdetect/
    
  • create the file ~/.vim/ftdetect/markdown.vim with this content
    autocmd BufNewFile,BufRead *.md,*.mkdn,*.markdown :set filetype=markdown
    

Done.

Markdown on Save

Markdown

If you don’t know what Markdown is, then you should. I suggest you to read the Wikipedia page which gives some historical intro, too.

Markdown on Save

“Markdown on Save” is a WordPress plugin which allows you to write articles in Markdown format and have them correctly displayed on your WordPress blog.

I’m actually testing this plugin now, with this article and I will tell you my personal experience.
I found some weird initial problems, but the plugin looks great and I think it will be my default choice from now on.

Problems

The plugin does not have a valid header

The first problem I had was at the end of the installation process: I received the message “The plugin does not have a valid header.” and so it was not activated.

The solution was simple: I went to Plugins, Installed plugins and clicked Activate under Markdown on Save section.

Done.

How do I use it?

Yes, there was some misleading factors which led me to loose some minutes tinkering what I’ve had to do:

  • the first time I opened the new post page, there wasn’t any indication of the plugin functionality
  • searching on web I found the WordPress.org official plugin page where the author talked about a box marked as “This post is formatted with Markdown” to click. I hadn’t it. Then I found it, it didn’t seem a checkbox so I got confused (and there wasn’t any describing text).
    the Markdown box
  • I’ve a personal css for <code> blocks which are rendered with display: block; style. This is not totally compatible with the style of this plugin HTML output, so I’ve tweaked a bit the source code to embed the Markdown HTML result in a special div to apply special formatting. Here’s my opinion on that: there’s no way to dynamically understand that a page was from Markdown source or from the WordPress standard compose method. Maybe this is a good choice, but it doesn’t fit my needs

Conclusions

Many thanks to the author of the plugin, it’s quite perfect.

How to watch a 3D video in regular 2D

How to watch a 3D video in regular 2D

The problem

Let’s say you want to rip a 3D movie, but you want to be able to play it on every device (2D or 3D), don’t rip it twice, but keep the 3D version (SBS) and play it on PC with vlc.

My situation

Ubuntu Linux 13.04 with vlc player installed:

max@yoda:~$ vlc --version
VLC media player 2.0.8 Twoflower (revision 2.0.8a-0-g68cf50b)
VLC version 2.0.8 Twoflower (2.0.8a-0-g68cf50b)
Compiled by buildd on panlong.buildd (AugĀ  2 2013 01:37:47)
Compiler: gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute it under the terms of the GNU General Public License;
see the file named COPYING for details.
Written by the VideoLAN team; see the AUTHORS file.

My solution

Keep only the “left eye” playing it at a resolution of 32:9 and cropping it at 1920/2 = 960px, all from command line:

max@yoda:~$ vlc my-movie-3d-SBS-1080p.mkv --aspect-ratio 32:9 --crop 960x1080+0+0