LJ Archive


diff -u: What's New in Kernel Development

Zack Brown

Issue #231, July 2013

Tejun Heo has replaced Jeff Garzik as the official SATA maintainer. Jeff, who's been contributing to Linux since the early days, announced that he's moving away from kernel development altogether and is going to work on other open-source projects. I'm sure they'll be better for his interest.

Sarah Sharp has made a number of updates to the REPORTING-BUGS document, cleaning it up and making it easier for frustrated and stressed bug victims to follow. Along with other details, the new text clarifies exactly what information to include, whom to contact and when, and how long to wait before pinging the person again.

Ahmad Sharif, one of the ChromeOS developers, has announced Quipper, a new open-source library that creates perf reports. In fact, in addition to presenting information, it converts perf data to Google's protobuf format, which Ahmad argues is more stable and flexible than perf's native data format. The whole point of Quipper, and perf, is to help developers figure out how to make their code run faster.

Tim Bird recently asked about the best way for a GPS receiver to interface with the kernel. His company, Sony, was interested in writing up some Linux support for its GPS devices. However, as Greg Kroah-Hartman pointed out, this is not an easy question to answer, thanks to the diversity of hardware implementations and the tendency of some implementations to masquerade as others. In Sony's case, the best solution would depend on the hardware involved. So the real answer would require Sony to divulge the details of its hardware, which it may not be ready to do.

Simon Glass has submitted some patches to implement the ChromeOS Embedded Controller. This code would allow Chromebooks to charge their batteries, read keyboard input and do other tasks related to making the thing go. Samuel Ortiz accepted the patches without needing too many changes. ChromeOS, like Android, seems well accepted into kernel architecture.

Non-Linux FOSS: Classic Shell

Shawn Powers

Issue #231, July 2013

Even those of us on the Linux side of the fence have been watching Microsoft's Windows 8 roll-out—albeit for us, it has been with morbid fascination. Granted, we're not without our drastic changes (ahem, Unity), but the new interface Microsoft has chosen for version 8 is seemingly unusable for most people. The iconic Start menu has been taken away without a clear replacement.

If you're stuck on a Windows 8 machine and wish you had a Start menu, fear not; the Open Source community is here to help. With Classic Shell, not only can you get a Start menu back, but you also can choose what it looks like and configure every aspect of the menu system you can imagine. Prefer the Windows XP look? No problem. Is Windows 7 your idea of the perfect Windows experience? No problem there either.

Classic Shell is an open-source project originally developed back in the Windows Vista days. Thankfully, it's been updated for the Windows 8 platform, and thanks to Microsoft's design decisions, it's more useful than ever! Grab yourself a copy today at www.classicshell.net.

Figure 1. The configuration options offer more features than Microsoft ever offered in its Start menu (screenshot from www.classicshell.net).

There's Browser in My SSH

Shawn Powers

Issue #231, July 2013

No, there's SSH in my browser! Although it may not be as logical of a combination as chocolate and peanut butter, for Chromebook users, an HTML5 SSH client is pretty amazing. Granted, Google's “crosh” shell has SSH abilities, but it's a very limited implementation. With the Chrome extension “Secure Shell”, it's easy to SSH in to remote servers and interact like a traditional terminal window—mostly.

Secure Shell is getting better all the time, and at the time of this writing, it supports port forwarding, logging in with keys, socks proxying and even many keyboard shortcuts for programs like Irssi. The keyboard shortcut support isn't perfect, but for me at least, it's manageable.

Figure 1. It's simple. It's texty. It's awesome.

If you're a Chromebook user and want a real SSH client, give the “Secure Shell” extension a try. Heck, regardless of the OS you're using (I'm looking at you, Windows), it's a fast way to get a secure connection. It's being developed by Google, and it's free via the Play Store: goo.gl/irXYG.

Sleep as Android

Shawn Powers

Issue #231, July 2013

I sleep poorly. In fact, insomnia has plagued me for years. As it turns out, even when I think I'm sleeping well, I'm usually not. There's nothing worse than a shoddy night's sleep followed by an abrupt alarm going off when you've finally settled into a deep slumber.

Enter: Sleep as Android.

By using the accelerometer in your phone, Sleep as Android not only tracks how restful your sleep was during the night, but it also determines the best moment to wake you up. Rather than setting an exact time to wake up, you enter a “time range” in which you'd like to be woken. Sleep as Android looks for a time during that range where you're sleeping lightly (or not at all) and goes off. More times than not, it means waking up feeling refreshed, as opposed to my normal routine: groggy and coffee-starved. If you have trouble sleeping, or just prefer to wake up feeling refreshed, give Sleep as Android a try. It's free for two weeks, then only $2.99 if you want to keep it. I've listed only some of the features here, but check it out, it's truly an awesome program: https://sites.google.com/site/sleepasandroid/home.

Screenshot from the Google Play Store

Developing Your Own Scientific Python Code

Joey Bernard

Issue #231, July 2013

In many cases, scientific research takes you into totally new areas of knowledge, never before explored by others. This means the computational work you need to do may be totally new as well. Although typically such code development still happens in C or FORTRAN, Python is growing in popularity. This is especially true in physics.

If you are just working on a small code base, a basic text editor is fine; however, once your project reaches a certain size, using a proper IDE is a huge advantage. Luckily, an open-source project seeks to fill this exact niche: Spyder. Spyder is available for Windows, Mac OS X and Linux. You should be able to find a package for your distribution, but if not, you always can grab the binaries or source code at the main Spyder Web site (code.google.com/p/spyderlib).

Spyder actually is written in Python, and it has been designed with a plugin architecture. This means you can add extra functionality by installing plugins. If you can't find a plugin for the functionality you need, you always can write your own.

When you start Spyder, several panes open and a temporary Python script that you can use to start editing appears. The main pane is the editor, where the temporary script is loaded and ready for you to start working. The right-hand side of the window is broken into two more panes. The bottom pane is the console to a running Python interpreter. Here you can see that Spyder automatically loads NumPy, SciPy and matplotlib on startup, so you already have most of the tools you likely will need ready to go.

Figure 1. When you start Spyder, several information panes along with the main editor pane appear.

You can use this console just as you would any other Python interpreter. The top pane has multiple tabs. The first tab that opens at start up is an object inspector. This tab lets you look at the details of any objects being used in your code. The other tabs available are a variable inspector and a file explorer.

Figure 2. The object inspector lets you look at the details of any objects you may want to use.

Let's begin by looking at the main editor pane. Like any other programming editor, Spyder provides full-color highlighting of Python syntax. Rope is used to provide code introspection capabilities to the editor. If you start typing a function call, Spyder makes suggestions for code completion.

Pyflakes provides on-the-fly code analysis. Any errors in your code are highlighted right away with a triangle symbol in the margin. When you hover over it, details for the error are displayed in a pop-up window. You also can set breakpoints in the editor that are used by the Python debugger. This way, you have a bit of control over how your code runs when you run it under the pdb debugger.

Figure 3. You can set all of the options for the editor window in the preferences section.

The console pane provides a full set of tools for controlling multiple interpreters. When you run a script from the editor, you have the option of starting up a new interpreter in which to run it. Or, you can run it in an existing interpreter. You can set this behavior in Spyder's preferences. You also simply can create a new interpreter from the console pane directly.

Figure 4. The preferences for the console section control things like whether it is monitored and so forth.

Also interesting is that you can create IPython interpreters in the console. Then, you have all of the extra functionality provided by IPython at your disposal. One of these advanced features is the ability to use multiple IPython engines in parallel. From the console in Spyder, you can create these IPython engines that will run in the background, ready to be used for whatever parallel processing you may have in mind. So, not only can you develop your new scientific code as a parallel program, you also can work with it directly from Spyder, in parallel. All of these extra interpreters and engines run as separate processes, which means they will not affect Spyder itself or cause it to hang if something bad happens within one of the Python interpreters.

One of the extra tabs in the top-right pane brings up the variable explorer. This pane gives you a list of all the variables currently active in the memory space within Spyder. It shows the name, type, size and value for each of the variables accessible in the global namespace. This applies to both the internal Python interpreter and any external ones. The variable explorer can handle all of the standard data types, like strings, integers and floats. It also includes an array editor that can be used to edit lists and tuples. The array editor provides a nice environment for editing complex data types.

Figure 5. The variable explorer gives you a list of everything within the global namespace.

Spyder provides even more tools though. By right-clicking on a list or tuple, you can do some basic data analysis. Spyder allows you to plot the values in the data object to see what it looks like. Or, you can look at a histogram of the values if a statistical analysis would make more sense.

Figure 6. Spyder lets you plot the data within a list or tuple.

All of these tools are handy, but by themselves, they aren't enough if you are developing a large code base. In such cases, you will need some kind of project-level organization. Spyder can help in that situation too. You can create a project in order to encapsulate a group of files as a single unit. Creating a new project makes a new folder to store all of the associated files. Opening this new project creates a new pane where you can work with the project files. By right-clicking on the project, you can create a new file, folder, module or package. When you create a new file, Spyder opens it up in the editor, ready for you to start working on it.

Figure 7. If you are working on a larger code base, the project explorer will come in very handy.

The last tool you should be aware of is the profiler. The first step in program development is writing code that works. After that, your job is to write code that is as efficient as possible. The rule of thumb is to optimize last, and only what needs to be optimized. But, what part of your program is that? Without reliable measurements, you won't know what needs optimizing. In Spyder, you can click on the menu item Run→Profile or press F10. This runs your code under the Python profiler, giving you a breakdown of where all the time is being spent. Once you have this information, you can focus your energies where they will do the most good.

Figure 8. The profiler opens a new pane at the bottom of the window, showing you numbers of calls and time for each function.

Hopefully, you can take Spyder and run with it while developing your own scientific Python code. Although lots of IDEs exist for developing code, there aren't very many setups geared toward developing scientific code. With Spyder, you should have a head start in developing your new breakthrough code, solving the problem that could win you the next Nobel Prize.

Android Candy: MightyText, Mighty Awesome

Shawn Powers

Issue #231, July 2013

I'll admit, I've always been impressed with Apple's iMessage program. With its integration into texting, it seamlessly combines instant messaging and SMS into a single communication stream. Whether on an iPhone, iPod, iPad or Macintosh, the messages can be seen and sent to other Apple devices. The only downfall is that you can send only SMS messages to non-Apple phones from your actual iPhone with a texting plan.

MightyText takes the idea of integration in a slightly different, but also slightly more awesome, direction. If you have an Android phone, once you install the Free MightyText application, you can text back and forth from any browser on any computer, regardless of the operating system! It includes MMS pictures, group texting and all the other cool features that traditionally are available only from a phone.

If you've been wavering back and forth about getting an iPhone or an Android device, MightyText might be the application that seals the deal for you. It was for me. In fact, MightyText is so incredibly useful, we've given it the Editors' Choice award this month. Check it out now at mightytext.net.

The Web app syncs up when you log in from a computer. It doesn't matter where the discussion started, it's always there!

They Said It

Electricity is really just organized lighting.

—George Carlin

I am somewhat exhausted; I wonder how a battery feels when it pours electricity into a non-conductor?

—Arthur Conan Doyle

Enthusiasm is the electricity of life. How do you get it? You act enthusiastic until you make it a habit.

—Gordon Parks

There is a force more powerful than steam and electricity: the will.

—Fernán Caballero

Soon now, the faint tinkling of a broken filament will become another sound of another century.

—Jane Brox

LJ Archive