Tag: Linux

Fedora 23 on a Dell XPS13 (part 1)

Taking advantage of a trip to Canada and a very favourable CAN$:€ exchange rate, I bought a Dell XPS13 (9350 or “late 2015”), following excellent reviews from around the web. Dell sold a ‘developer edition‘ of this laptop (shipping with Ubuntu Linux) but unfortunately it was out of stock on Dell US and I couldn’t find the item on the Dell Canada website. So I bought the Windows version with a touchscreen (it was Black Friday :-)).

fedora_infinity_140x140Here is how to install Fedora 23 on it (and probably most other Linux distribution) … I will focus on three aspects (in brief: everything works out of the box, except the wireless card that needed some additional action):

  1. How to boot and install Fedora Workstation
  2. What works and what doesn’t work out of the box
  3. Some things to do after installation (additional software)

Continue reading “Fedora 23 on a Dell XPS13 (part 1)”

How to write data from Matlab to Excel (especially when you don’t have Excel)

If you are using Matlab on a MS-Windows PC with MS-Excel installed, there is no problem reading and writing data to Excel (in case your users/customers only understand this software but you still want to do the computations in Matlab). Here is the code to read (1st line) and write (2nd line):

inputs = xlsread('inputfile.xls', 'inData', 'A1:B3');
[writeStatus, writeMsg] = xlswrite('outputfile.xls', myMatrix, 'outData', 'A1');

Now, there are several reasons why you may not be able to read and write directly to an Excel file: you have Matlab but

  • you are on MS-Windows but MS-Excel is not installed (if you use OpenOffice.org, csv files in general or on a server where even Microsoft discourage the use of Excel in back-end, see “More information” here);
  • you are on MacOS;
  • you are on Linux;
  • etc.

matlab rubiks cubeMatlab provides a basic way to read and write in these cases: xlsread() will only read some xls files (saved as version 97-2003, which should not be an issue – at least this is an Excel file) ; xlswrite() will only write a .csv file. So you can’t deliver the Excel output.

Fortunately Open Source software is here to help you!

Indeed two recently published code on Matlab Central allow you to write “directly” to Excel.

The first solution is provided by Marin Deresco and apparently uses his own binder to Excel. The most simple code is:

display(['Add Java paths']);
javaaddpath('D:\JExcelAPI\jxl.jar');
javaaddpath('D:\JExcelAPI\MXL.jar');

display(['Writing matrix to file']);
writeStatus = xlwrite('output.xls', myMatrix, 'outData');
display(['writeStatus: "' num2str(writeStatus) '"']); % 1 = success, 0 = failure

I advise you to put the two .jar files in a central location (as done in the code above). That way all you functions will have access to the same version of these files (and updating them for all your projects will be much easier).

But there are three small issues. First the generated matrix will contain only text fields (and they are formatted as text fields, not numbers) ; it doesn’t really matter because Excel can then use this text as numbers directly. Then the second issue is that although it will actually write the requested data, there will be an error when opening the Excel file if you specified a sheet (‘outData’ here) that already exists. Finally you can only start writing at A1.

The second solution is provided by Alec de Zegher, partly in response to the limitation of the previous code. Alec is taking advantage of the Apache POI java library to handle the writing-side. His code also allows to start writing anywhere in the sheet. And it uses the same call structure:

display(['Add Java paths']);
javaaddpath('D:\poi_library\poi-3.8-20120326.jar');
javaaddpath('D:\poi_library\poi-ooxml-3.8-20120326.jar');
javaaddpath('D:\poi_library\poi-ooxml-schemas-3.8-20120326.jar');
javaaddpath('D:\poi_library\xmlbeans-2.3.0.jar');
javaaddpath('D:\poi_library\dom4j-1.6.1.jar');

display(['Writing matrix to file']);
writeStatus = xlwrite('output.xls', myMatrix, 'outData', 'B2');
display(['writeStatus: "' num2str(writeStatus) '"']); % 1 = success, 0 = failure

As you can see there are some more .jar to add. On the other hand, it uses a syntax that is very similar to the previous one and to the original Matlab command. Thanks, Marin and Alec, for this great help!

This was tested on Matlab R2012a on a Windows XP 64-bits and with the MCR (same version) on a Windows 2008 64-bits – according to the respective pages for the code, it should work on Mac and other platforms/configurations too.
Photo credits: matlab rubiks cube by gusset, on Flickr (licence by-nc-sa)

Reference Manager 10 with Wine

Reference Manager is a commercial reference management software package. It is extensively used in biomedical research, along with Endnote (sold by the same company), mainly because the main OS in these labs is Windows from Microsoft. I used it at the university and still have some reference databases in its format (with file extension .rmd).

This evening, I had to go back into one of those proprietary, closed databases I still had (most of my references were later re-entered in a BibTeX file). I could have borrowed my wife’s computer running Windows or tried some Open Source software that can open .rmd files. But it would have been too easy. So I tried it with Wine, a program that allows Microsoft Windows applications to run under Linux. In Wine AppDB, it is written people had tried version 9 and 11. In the old time, I bought a student license for version 10.

I’m running Fedora 14 and Wine 1.3.24. The installation didn’t cause any problem. Launching the application neither. I can easily open existing database and see the reference summary (bottom part of the screen, see screenshot below). But I can’t properly see the reference details (upper part of the screen). In fact, all the details are there but they are not properly rendered. If you click in one of these fields, you’ll see the text from these fields. But once you’ll click elsewhere, the previously clicked field will disappear. The search function in the database is working. The export of a bibliography list from a selection of references in the application works. I was not able to test the integration with MS-Word. Note that it cannot search in PubMed (but it’s probably due to the fact the update for PubMed was not installed).

Screenshot of Reference Manager under Linux via Wine
Reference Manager running under Linux via Wine

I also submitted an entry in the Wine AppDB ; it is currently reviewed.

Installing Fedora 13 on a Toshiba Satellite L670-10K

I quickly needed a new laptop to continue working and I found a Toshiba Satellite L670-10K. It’s a nice entry-level laptop with a dual core processor (I didn’t know Intel was still doing Pentium-branded processors) and a 17″ screen (read the specs for other details). I downloaded the latest Fedora Linux (version 13, 64 bits ; and version 14 is coming soon) and installed it from the LiveCD. Nearly everything was recognized out-of-the-box: screen resolution, graphical card (Intel, with 3D effects), wired network, webcam, card reader, sound card, etc.

The only thing that was not recognized was the wireless network card: a Realtek RTL8191SE. Here is how to install it. On the Toshiba website for (Windows) wireless drivers, it is always associated with the RTL8192SE model. So don’t be surprised if the driver downloaded from the Realtek website is a file with RTL8192 in its name although you clicked on the link for the RTL8191SE-VA2 model. Unpack this file. The LiveCD doesn’t come with some packges so you have to install them (via the System menu, Administration, Add/Remove software). These packages are: kernel-devel, gcc and make. Once it’s done, do a simple “make;make install” as root and reboot the laptop. Your wireless connection is now up and running!

Wireless UFO?

If you want to have Flash on your 64-bits Linux, Adobe released version 10.1 of their Flash player with native 64 bits support. Download Flash player “Square”, unpack the archive and copy the (only) file “libflashplayer.so” in directory /home/yourusername/.mozilla/plugin, restart Firefox. You have now a Flash-enabled browser!

Finally, I must have done something wrong, somewhere but I kept having the first configuration screen after installation, even after subsequent reboots. After a quick search, I didn’t find anyone with the same issue. YMMV. In order to skip this screen (after you went through them a first time), just add the line “RUN_FIRSTBOOT=NO” in the file /etc/sysconfig/firstboot and voilà!

In conclusion, I’m very pleased with this laptop and Fedora. My Linux desktop was ready in just a few minutes. Let’s work, now! 🙂

Happy Software Freedom Day 2010!

Today, September 18th 2010, it’s Freedom Software Day all over the world. It is an annual worldwide celebration of Free Software, a public education effort with the aim of increasing awareness of Free Software and its virtues, and encouraging its use.

On the SFD website, there isn’t a lot of events registered for Belgium. There is only one, in fact, in Oostende (LiLiT is doing an install party in Liege but I can’t see any reference to SFD; still, it’s a good initiative!). Well, a SFD on September 18th in Belgium might not have been a good idea if the goal is to increase awareness of Free Software: more than half of the population is celebrating the Walloon Region or preparing a Sunday without car in Brussels (while others are just looking for a government since April 2010!). So, at a personal level, I decided to give Ubuntu a try (10.04 LTS).

In terms of user experience, you can’t beat the installation process of Ubuntu (my comparison criteria are Fedora 13 and any version of Windows XP, Vista or 7 that are not on a PC-specific image disc). Seven configuration screen with rather simple questions and that’s it. There are choices you can’t make like the selection of software you want to be installed and available on the next reboot. But, most of the general software is there: a web browser, a word processor, some games, a rudimentary movie player and a music player. The “Software Center” is also readily visible so you can’t miss it and it seems to be an obvious choice if you want to install any other software.

New Ubuntu desktop for Freedom Software Day 2010

The real test will now be if one can actually work with it. If I don’t post any furious comment against some features or if I don’t post anything about the installation of some software in the coming days / weeks, you’ll know I’m still working with this Linux flavour.

Fedora 11 is out (since a week or so)

This week, I nearly emptied my internet quota by downloading and seeding the new Fedora Core 11. For those who don’t know yet, Fedora is a Linux-based operating system that showcases the latest in free and open source software. What I particularly like in this GNU/Linux distribution is that its developers prefer to make changes to the original software instead of applying fixes specifically for Fedora ; in this way, all the other distributions may also take advantages of the improved software. You’ll find many reviews and “tours” on the web about this new Fedora. In the next paragraphs, I’ll just highlight some of the most interesting points I saw until now. Coming from a Fedora 9 also helps to pinpoint the major improvements (mainly from a user point-of-view).

Fedora 11 screenshot

The first nice thing I noticed was the reduced time to boot my ageing laptop (ok, 2 years is not so old) and its simplicity (just a progress bar in the bottom of the screen). I won’t give you numbers. Anyway, numbers would have been specific to my computer. But I can tell you it’s quite faster than with the Fedora Core 9. And anyway faster than Vista. In general, I think it’s a big improvement for the user experience: after all, most users just boot their machine to use it as a tool, not to wait with amazement that everything is loaded.

Another nice thing is to finally get new versions of some software. OpenOffice is in version 3.1, Netbeans is in version 6.5, Python 2.6, … One thing I was waiting since a long time is Istanbul, a screen recorder. Otherwise, all the other main software I use are also present: Gimp, Inkscape, vim, gthumb, xmms, etc. The only thing a little bit tricky was to add the ability to read two proprietary formats: mp3 and flash. For mp3, you have to add the fusion nonfree repository and it’s clearly explained here. For Flash, I was surprised that Adobe offers an installation procedure just identical to any other software on Fedora, based on yum. I was also pleased to see projects like bioperl and biopython already available at the installation step (along with XDrawChem and JMol which will allow me to read old molecules I drew a few years ago with proprietary software like Chemdraw). One last thing a was eager to see in action is the ext4 filesystem (Fedora being the first distribution to include it by default). To be honest, I don’t see the difference.

XDrawChem and JMol in Fedora 11

Finally, if I have to summarize the experience with this Fedora Core 11 so far, it will be: smooth installation, up-to-date software, no surprise, ready to work after 1 day (I had to play with nearly all the new toys inside). I think GNU/Linux is really ready for the desktop 🙂

Taking automated screenshots from a live video camera

Following my previous post, I attached a video camera to the composite input of my tv tuner. One good thing I didn’t noticed yesterday is that mplayer can be told to directly use pvr:// as a source instead of the generic tv:// (with many options). So you just have to enter mplayer pvr:// -tv device=/dev/video1:input=0 in order to watch tv.

Noticed the input=0 above? This tells the tuner to take the video signal from the tv (read the mplayer man page to see how to change the channel). Now, since I connected my video camera to the composite video in, I need to tell mplayer to use it with input=1. One last thing: taking a screenshot in mplayer is done by pressing the ‘s’ key (with option -vf screenshot. In summary, the image below was taken with mplayer pvr:// -tv device=/dev/video1:input=1:noaudio -vo x11 -vf screenshot
(camera facing the screen).

blurry capture of computer screen taken by camera connected to tv tuner

Now I want to take one screenshot every 5 seconds, even when I’m not there to press the ‘s’ key! For this purpose, we need to use a fifo file and mplayer in slave mode. Mplayer in slave mode will listen to commands we automatically send into the fifo file (by a different process, see below). This is how we do this:

mkfifo myfifofile.tmp
mplayer -slave -input file=myfifofile.tmp pvr:// -tv device=/dev/video1:input=1:noaudio -vo x11 -vf screenshot

And from another console, we can type echo "screenshot 0" >> myfifofile.tmp to take the screenshot. To automate all this, the following simple bash code is sufficient:

#!/bin/bash
# will send mplayer screenshot command every 5 seconds to fifo file
# stop this with Ctrl + C
LIMIT=0
while [ $LIMIT -lt 1 ]; do
echo "screenshot 0" >> myfifofile.tmp
sleep 5
done

In the end, stop the bash script with Ctrl + C and quit mplayer with echo "quit" >> myfifofile.tmp.

A first step toward TV on my Linux laptop

I recently got a Hauppauge WinTV-PVR-USB2 (a TV tuner, video recorder and FM receiver) because I read it was well supported on GNU/Linux. The following post explains how I installed it on a Fedora Core 9. If you want to install it with another Linux distribution, some information may vary but most of the following steps will be exactly the same.

First connect the USB device, the list of USB devices shows my system has recognised it:

[root@localhost ~]# lsusb
Bus 002 Device 003: ID 2040:2900 Hauppauge
...
[root@localhost ~]# dmesg
usbcore: registered new interface driver pvrusb2
pvrusb2: Hauppauge WinTV-PVR-USB2 MPEG2 Encoder/Tuner : V4L in-tree version
pvrusb2: Debug mask is 31 (0x1f)
firmware: requesting v4l-pvrusb2-29xxx-01.fw
pvrusb2: ***WARNING*** Device fx2 controller firmware seems to be missing.
pvrusb2: Did you install the pvrusb2 firmware files in their proper location?
pvrusb2: request_firmware unable to locate fx2 controller file v4l-pvrusb2-29xxx-01.fw
pvrusb2: Failure uploading firmware1
pvrusb2: Device initialization was not successful.
pvrusb2: Giving up since device microcontroller firmware appears to be missing.

Although my tuner is fully recognised, the system needs a firmware in order to make it work. Where is the firmware? A quick search on a well-known search engine redirects us to Mike Isely’s website where he explains how to get the driver (Mike actually also wrote the driver for this TV tuner). Although I got the CD with drivers for Windows, I prefer to use the latest driver that can be found on the Hauppage support website. Mike also writes you can get the driver from the ivtv project.

So I uncompress the driver in the “win_driver” directory and launch Mike Isely’s fwextract.pl script:

[jepoirrier@localhost hauppauge]$ mkdir win_driver
[jepoirrier@localhost hauppauge]$ unzip hauppauge_cd_3.4d1.zip -d win_driver/
[jepoirrier@localhost hauppauge]$ ./fwextract.pl

The script extracted 4 drivers (2 decoders and 2 encoders) and dmesg already told me the two I need: v4l-pvrusb2-29xxx-01.fw and v4l-cx2341x-enc.fw (as encoder). To know where to put these files, check a little bit on the web (this depends on your GNU/Linux distribution). On the Fedora Core 9, it’s in /lib/firmware, so:

[root@localhost hauppauge]# cp v4l-cx2341x-enc.fw /lib/firmware
[root@localhost hauppauge]# cp v4l-pvrusb2-29xxx-01.fw /lib/firmware

Unplug your USB cable, re-plug it and a dmesg should give you a long list of what your system detected, the most interesting part being the last line where it request the firmware and doesn’t stop: firmware: requesting v4l-cx2341x-enc.fw 🙂 Now check your video devices and you should have an additional /dev/videox:

[root@localhost hauppauge]# ls /dev/vid*
/dev/video /dev/video0 /dev/video1

In my case, /dev/video1 is the one I need …

Now, how to watch TV? TVTIME seems to be good but, unfortunately, my video card driver doesn’t support hardware YUY2 overlay (I have an ATI Radeon Mobility HD 2600 with the open source radeon driver). No problem: mplayer /dev/video1 shows a very beautiful snow. Now I need an antenna or a cable to connect to my tuner …

mplayer -vo x11 /dev/video1 -vf and then s

Pixel lapse under Linux

pixel-lapse under Linux

Finally, I got a working pixel lapse software under Linux 🙂 It’s a bit late (and I have to work tomorrow), code is rather dirty but I’ll publish it as soon as possible (btw that’s why I needed a webcam and a library to read it yesterday). Originally,

"pixel lapse" photography is the process of creating an image one pixel at a time. Beginning in the upper left corner, pixels are captured sequentially at a set rate until the entire image is formed.

Unfortunately, their software only runs on MacOS and Windows and requires Quicktime. Here, I "only" use OpenCV which is free and available under all the OS mentioned in this post. More details soon …

The “full-size” (640×480) image is here on Flickr

Edit on November 5th, 2008: version 0.1 of the software is available here.