Categories
GNU/Linux Free Software & Open Source

Debian on Lenovo Thinkpad X240

I recently got myself a new computer, the Lenovo Thinkpad X240. It’s my first Thinkpad so I cannot compare it to previous models. My old laptop is a Dell XPS m1530 that’s about 5 years old by the time of this writing. Still very functional but I wanted an upgrade in hardware and a lighter computer to travel with.

The pros:

– weight
– matte screen and higher resolution
– keyboard
– speed (processor, RAM, SSD, USB3)

The cons:

– GNU/Linux compatibility
– wireless
– brightness controls
– FN key and FN Lock

So let’s go and review the whole thing:

### BIOS

It came with Windows 8 pre-installed, but I immediately installed Debian Testing (Jessie) on it. This machine comes with UEFI boot, but fortunately it has a Legacy mode to behave like normal BIOS. Installing like normal boot instead of UEFI boot is a lot easier and you don’t have to struggle with the disk partitions and boot options. On the boot configuration settings, disable secure boot and set it to legacy boot first instead of UEFI boot first.

### Hardware

Lenovo X240 open

The X240 is very light, even with the additional 6 cell battery instead of the default 3 cell battery. It is a 12.5″ computer, so it can be comparable to a Macbook Air or similar computer. The case is plastic, but feels very well built and durable.

X240 width

There are no indicating LEDs anywhere except for the power button LED that indicates if the computer is on, off or suspended (blinking). There are no hard disk writing indication, battery charging indicator, wireless, bluetooth or any. Just an additional led behind the screen, the dot in the “ThinkPad” logo lights following the power button LED and that’s it.

This is a bit confusing specially when charging the laptop, since the charger also lacks any LED indicator, so the only way to know if your computer is charging is with the software indicators in your desktop environment (the battery monitor icon in your system tray).

It has no HDMI port, but it has the old VGA adapter and a mini digital port for external monitors. Only 2 USB ports, both are USB 3.0, and one with power over USB. My model came with a fingerprint reader, an SD card reader, a 720p webcam and an Ethernet port.

### Keyboard

Lenovo X240 Keyboard

It seems that all new Lenovo models are coming with the new “chicklets” style keyboard and its new layout. I’ve heard some criticism about it, but since this is my first Thinkpad, I’m not biased. Comparing to other laptop keyboards, it is nice. The keys feel good and not fragile and is very silent. My only compliant was the strange placement of the Fn key where I usually expect the Ctrl key. Fortunately for me as an Emacs user I map my CapsLock key to an additional Ctrl and use that instead, so my key stroke memory doesn’t get much affected by that. What I didn’t like is that the F keys are now by default media keys and to use them as F keys you need to press Fn+key or Fn+Esc to activate ‘Function key lock’ then press the F key you need. So, for example, if you want to reload your browser and immediately lower the volume of the speakers, you have to strike additional keys.

The screen brightness control keys by default didn’t work for me, but there is a fix. You need to load the thinkpad acpi kernel module on boot. So edit /etc/modules file and add:

thinkpad_acpi

Then you’ll need to add this to your /etc/default/grub file and check that your kernel options are as follows:

RUB_CMDLINE_LINUX_DEFAULT="quiet acpi_osi=!Windows2012 acpi_backlight=vendor"

This will enable the volume, mute, brightness and wireless media keys. I haven't been able to make the microphone mute button work.

The keyboard backlight works by default using FN+spacebar and it looks nice. It has three states: dim, bright and off.

### Pointers

As many other previous ThinkPads, the X240 still keeps the nipple mouse or clit mouse or however you've heard it's called. The downside is on the trackpad, now called clickpad which has no hardware buttons but does have a larger surface area. By default on Debian Jessie + KDE the clickpad works but it's not precise. When trying to press for a click it inevitably moves from the target area, so clicking is hard. Right click worked out of the box for me by just pressing the pad on its bottom right area. Clicking can be fixed by addding:

sudo apt-get install kde-config-touchpad

and configure single tap clicking, two-finger scrolling and three finger tap for middle click. If you like to use the /nipple/ pointer and miss the buttons for it on the top of the pad, you can configure the button area to be on the top part instead of the bottom part in the X config file.

Make sure you have the following in your file /usr/share/X11/xorg.conf.d/50-synaptics.conf

    # This option enables the bottom right corner to be a right button on
    # non-synaptics clickpads.
    # This option is only interpreted by clickpads.
    Section "InputClass"
            Identifier "Default clickpad buttons"
            MatchDriver "synaptics" 
            #Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
            Option "SoftButtonAreas" "60% 0 0 5% 40% 60% 0 5%"
    #       To disable the bottom edge area so the buttons only work as buttons,
    #       not for movement, set the AreaBottomEdge
            #Option "AreaBottomEdge" "82%"
            Option "AreaTopEdge" "4%"
    EndSection

I found this solution at this blog

### Wireless

The wireless card is an Intel 7620 rev 6. After having to struggle with a Broadcom card for many years I thought my wireless card struggle days were going to be over. Well, turns out that the 7620 card is a very recent card and is not very well supported yet. By default it doesn't work with Debian. To make it work you need to enable the non-free repository and install

sudo apt-get install firmware-iwlwifi

This will enable your card and make it work, but if you suspend the computer, you'll loose bluetooth conectivity. To fix that you need to disable the 802.11n compatibility in the driver configuration. Add this to a file in a new file called: /etc/modprobe.d/wifi-disable11n.conf

options iwlwifi 11n_disable=1

I have experienced some instability with it. At random times the driver would just stop working and your card will seem working and connected but no traffic goes on. If you suspend the computer with the card in that state, it will not suspend and will hang the system. Once the wifi card is stuck the only way to bring it back is with a restart. I've tried rfkill, unloading and loading the module, but nothing works.

Another issue is that it will not connect to a wireless-n router, even when disabling n-band in the driver configurations. I had to configure my home router to only use b/g bands for it to connect.

**UPDATE**: Debian Jessie has upgraded to the Linux kernel 3.13, enabling the use of the iwlwifi driver version 22.24.8.0, which doesn't need any of the changes mentioned and doesn't crash anymore.

### Conclusion

Not being able to compare to other previous Series X Thinkpad models, I cannot say if the X240 is an improvement or not. I've seen a lot of criticism to it, and I don't blame them. Some indicating LEDs would be nice to have, and why does a new computer model in 2014 doesn't have an HDMI port and has the old VGA port instead? There are weird hardware choices in this, but overall I'm enjoying the portability and speed of the computer. I'm hoping that my GNU/Linux compatibility issues (specially the WiFi card issues) get fixed over time.

Do you have some other configuration or fix tips for Debian on the X240? What to you think of this model? Share some ideas with me on the comments.

Categories
GNU/Linux Free Software & Open Source

PRISM Break: A list of resources for privacy and freedom

Unchained

With the recent news scandal about the NSA surveillance program code named PRISM more people is starting to question their use of cloud services thinking about their privacy. I’ve talked about free network services and ugly cloud stories but this is the ugliest of all stories going mainstream.

The autonomo.us group was focused in producing free network services and established the “definition” of what makes a free network service with the Franklin Street Statement. There is also a big list of self-hosted software you can use to replace most of the popular web based applications and services.

But in addition to that list, Peng Zhong created a web site called PRISM Break with a nice and easy to understand list of software, both desktop and web services to help protect your privacy.

I’ve already been using several of these programs and discovered new ones. It might be scary to run your own instances of web services or change the software you’ve always used, but freedom and privacy are worth a shot. I hope these list gets bigger with new software developments and current offerings get better as more people use them and get more attention.

Categories
Emacs GNU/Linux Free Software & Open Source Programming & Web Development

Easy CSS editing with Emacs

Editing CSS in Emacs is very easy since the standard CSS mode comes included by default. But developer Julien Danjou created this nice minor mode called rainbow-mode which will display the color of the code as the background of the code’s text. It is very useful to immediately see the colors right there in the style sheet instead of trying to remember each code and then test in the browser window.

One of the problems I had was when opening any CSS file, it would open by default css-mode, but I had to manually load rainbow-mode every time. The elisp function auto-mode-alist is used to detect a file type by its name and running a function associated with it, generally the function to enable a major mode to edit that type of file. For minor modes I couldn’t find anything that would allow me to launch them without inhibiting the mayor mode’s startup.

So since auto-mode-alist takes a regular expression for the file type and only one function as its arguments, I wrote a function that will run both and use that as the second argument to execute.

;; CSS and Rainbow modes 
(defun all-css-modes() (css-mode) (rainbow-mode)) 

;; Load both major and minor modes in one call based on file type 
(add-to-list 'auto-mode-alist '("\\.css$" . all-css-modes)) 

Hope you find it useful and you like the combination of css-mode and rainbow-mode as much as I do.

Categories
GNU/Linux Free Software & Open Source personal

Debian and the girlfriend

Ada with the laptop

We got a new computer for the girlfriend some months ago. Since her old laptop was running Debian Lenny and she loved it, but the software packages were quite outdated, I decided to install Kubuntu 10.10 on her new laptop. Assuming that it would be easier to use with all of Canonical’s and community customizations, handle and detect new hardware drivers better and will have more updated software.

Turns out that she barely used her new laptop, complaining a lot about it. First, she had to get used to the new KDE 4 environment, when she got so used to KDE 3.5 on Debian Lenny, but change is something we all have to face. But the real problems were that hardware was not working properly, the touchpad had no scrolling and since its a single button pad with virtual buttons, the right button click didn’t work. Also, the Dolphin file manager would sometimes not refresh the files on the folders, so she couldn’t see some files that were recently saved. When trying to shutdown it would freeze up or the KDE shutdown menu window would not draw any options. When finally shutting down, it sometimes hanged at the end of the process, thus not turning off the computer.

After about a month of complaints and frustrations, she demanded me to install Debian back. I explained to her my initial decision to go with Kubuntu and that a new version 11.04 was coming out in a few days and that might fix her problems. But her argument was strong: “I need stability, and I don’t like to be on the bleeding edge since I’m not technical, I can’t troubleshoot the issues. Its fine for me to stay with the same stack of software for two years until the next Debian stable release.”

Ada, ballet & GNU

So I went ahead and installed Debian Squeeze on her laptop, expecting a lot of time spent in forums to get her new hardware working, configuring files, compiling drivers, etc. To my great surprise, everything worked out of the box, with very minimum custom configurations. She immediately started installing all her favorite software and was very happy with her new system’s stability and fast responsiveness. Software was (to the time of this writing) decently recent, and very stable so now she has completely ditched her old computer, feeling perfectly comfortable. Although she still misses KDE 3.5, she’s getting used to KDE 4 and customizing it her way.

Oh, and she made it all pink.

Categories
GNU/Linux Free Software & Open Source

A message from Richard Stallman on Software Freedom Day

Richard Stallman, the initiator of the Free Software movement, published a very easy to understand video message on what software freedom is about.

If you can’t see the video, you can download Richard Stallman’s video message here.

If you wonder why there’s no embedded Flash video version from a site like Youtube, please download the video, watch it and you’ll get your answer. (Although if only I could restrict Youtube to make it webm format only, that might be okay)

Categories
GNU/Linux Free Software & Open Source Programming & Web Development

command line tools for web developers

Computer Data Output

Many people are typically afraid of the terminal. Yes, it might look scary for some, retro for others, but for the practical busy programmer, the terminal is the best tool you can have.

Lately for my day job, I’ve been required to work with lots of static web pages, as I’ve mentioned on several of my previous posts. So for my daily tasks, I’ve been using a lot of command line tools on the terminal that make my work a lot faster.

Here are some of the tools that I’ve been using and how I’ve used them:

  • find

    Helps me list and filter certain types of files for processing. For example find . -name *.html This will give me a list of all files with .html extension under the current directory and subdirectories.

  • sed

    GNU sed is very handy to do all kinds of text manipulation without having to write a whole script about it. For example one common task would be search and replace a text or regular expression pattern on a file. Example: sed -e "s/My Search/My replace/g" myfile.html

  • xargs

    This is a ‘piping’ command, it will take the output of one tool and place it as arguments for the subsequent tool in the line. Example: find . -name *.temp -print0 | xargs sed -n -e "s/Hello/Goodbye/g" This will find all .temp files, then on each of them will search the word “Hello” and will replace it with the word “Goodbye”.

  • tidy

    When you have a bunch of legacy HTML code or “messy” (X)HTML documents you must parse, a good idea is to first clean up the code before working with it. Tidy is a command line tool that will help you with the task of cleaning, reformatting and indenting any messy (X)HTML document. It even does a good job cleaning MS Word generated HTML files!

  • GNU make

    This is an “old school” tool, for the ones that grew up with web development and away from C/C++ development. Make is used to automate certain tasks and in a given order, checking for dependancies. In the web development process, I use make to automate repetitive tasks, such as deploying files to the testing server, making a tag in my version control system and publishing the site on the production server, cleaning up temporary files, and so on. So I write a Makefile with these tasks, and every time I have to upload my code to the testing server I only execute something like make upload and it will do the task. For example, cleaning up all temporary files on my project would involve me doing: find . -name *.temp | xargs rm -rf. I can create a Makefile with the following:

    clean:
    find . -name *.temp | xargs rm -rf

    then every time I need to cleanup my codebase, I simply run make clean Hope you get the idea 😉

  • git

    My preferred version control system for the past 4 years has been Git. Its a distributed version control system that is very simple and very practical to use because its extremely fast and doesn’t get in your way while programming. It has lots of features and tools for the everyday tasks and its a very good practice to version control *all* your projects, even if you’re the only developer of them. Since its distributed, you don’t need to setup a server for it and you can replicate your repository on any media and with as many copies you like. Version controlling your projects will save you from troubles like accidentally deleting files, or, using local code branches, you can easily experiment new features without affecting your main “stable” version of your code. There’s a lot to say about version controlling and Git and I guess I haven’t written about it before (strange since its a big topic for me), so I guess I’ll put more of these details for another post. Just take my advice, use git and version control all your projects. You’ll thank me later.

  • rsync

    Rsync is a great tool to synchronize files and directories from one location to another. This can be on the same machine or on different (remote) machines. The typicall use of rsync is for automated backups. You can use it as so, or you can also use it to mirror your website on another folder or machine. I use it to deploy my files on the testing and/or production servers. This way I don’t have to be worried about forgetting to upload a file, the whole project can be synchronized with one single command on multiple machines. You can configure rsync to connect through ssh (more on this below) to move your files around in a secure, encrypted file transfer.

  • ssh & scp

    You definately don’t want your files to be going through the network in plain sight. I know, some might say: “who cares?” but really, its better to be paranoid and careful about your data. You never know. So the best way to transport your files from one machine to another is through a secure encrypted channel. This is what SSH does for you. With ssh you can connect securely to your server’s command line to execute command there, or you can securely copy files from one machine to another using scp.

There might be several other tools that I use daily but these are the ones more present in my mind as I’ve been using them a constantly.

What command line tools do you use for your web development tasks? Do you have other ideas on which the tools listed here can be used? Send me your comments, this might get interesting and useful for all of us.