After the security breach on kernel.org, the administrators of that site had to re-implement the site from scratch, and they had to prioritize the features that would be coming back soonest. They also had the opportunity to exclude features that seemed to be more trouble than they were worth.
One of the latter seems to be the Mercurial-based kernel repository mirror that Matt Mackall had maintained on kernel.org. Matt's repository offered an alternative for developers who didn't care for Git's approach to source control—or at least who just liked Mercurial better.
Matt intends to bring the repository back to life somewhere else, but he's not sure when that might be, and he's also affirmed that the new repository won't be fully compatible with the old. So, people wanting to update their local repositories will need to get a fresh one instead.
Davidlohr Bueso recently inaugurated an argument over user quotas, when he posted a patch to limit regular users' ability to fill up the /tmp directory on Linux systems. His justification was that filling up that directory represents a denial-of-service attack. His patch actually created a quota system for all tmpfs filesystems.
Everyone (except the attackers) agrees that DoS attacks are bad, but this may be an area where it's not so easy to agree on the best approach. Christoph Hellwig, for example, felt that Davidlohr should just use the existing user quota system and apply it to /tmp. Lennart Poettering argued that this would require a lot of user-space configuration that wouldn't be necessary with Davidlohr's approach. And, Alan Cox felt that other security issues were more pressing than this one. No one's argument won the day, and it's not clear that such a long-standing issue will catch Linus Torvalds' attention.
Likewise, long-standing security problems in /proc may not be on the radar either. Vasiliy Kulikov posted a patch to give tighter permissions to /proc/interrupts, but this got a cool reception. Apparently the longtime weaknesses of things like /proc and /tmp are dangerous only if someone already has a login account on a given machine, in which case a variety of other exploits are available as well.
Marek Szyprowski has been working on a contiguous memory allocator for Samsung. The idea is that a lot of smaller embedded systems don't support software jumping around in RAM, and video-editing software can sometimes require a contiguous chunk of memory for its image data. But even on regular systems, contiguous RAM can provide a speedup over fragmented RAM. However, the problem with trying to make everything use contiguous memory is that eventually you get stuck with chunks of RAM that aren't big enough for anyone, and that just hang out, unused, even when the system really needs more RAM. Marek said his code wasn't quite ready for inclusion, but it was coming along.
With our recent transition to a digital-only format, it's now possible to consume Linux Journal in a number of ways. For those so inclined, it's even possible to print each issue and bind it into a paper magazine. (The PDF lends itself quite nicely to that in fact) Electronically speaking, however, it's hard to beat the .epub/.mobi editions.
If you'd like to browse this month's issue without ever leaving your computer, you might want to check out EPUBReader, a Firefox add-on that turns your browser in a mini-library. After installing the add-on, epub files are opened automatically and added to the local epub library. To access your library, simply go to Tools, and select ePub-Catalog. You'll be presented with a list of all your locally stored epub books, and with a simple click, you can be browsing.
EPUBReader includes support for an interactive table of contents, which makes wise use of a computer's widescreen display. It even supports keyboard shortcuts! EPUBReader is free, cross-platform and quite honestly, a really nice e-reader app. Check it out for yourself at www.epubread.com.
TrueCrypt is a fully open-source tool for encrypting data. That data can be on a completely encrypted hard drive, or just an encrypted image file. Thankfully, the encryption works the same regardless of your platform, so Windows and OS X users can share encrypted files between computers.
We really like to use TrueCrypt in combination with Dropbox, another cross-platform tool, to protect our data in the cloud. Pictured here is the OS X version of TrueCrypt, mounting an encrypted image as a local hard drive. Whether you are storing sensitive data or Grandma's secret recipe, TrueCrypt can keep your data private, even if it's stored on someone else's server.
For more information and downloadable binaries for Windows and OS X, visit www.truecrypt.org.
In my past several articles, I've looked at various packages to do all kinds of science. Sometimes, however, there just isn't a tool to solve a particular problem. That's the great thing about science. There is always something new to discover and study. But, this means it's up to you to develop the software tools you need to do your analysis. This article takes a look at the GNU Scientific Library, or GSL. This library is the Swiss Army library of routines that you will find useful in your work.
First, you need to to get a copy of GSL and install it on your system. Because it is part of the GNU Project, it is hosted at www.gnu.org/s/gsl. You always can download and build from the source code, but all major distributions should have packages available. For example, on Debian-based systems, you need to install the package libgsl0-dev to develop your code and gsl-bin to run that code. GSL is meant for C and C++, so you also need a compiler. Most of you probably already are familiar with GCC, so I stick with that here.
The next step is actually the last step. I'm looking at compiling now so that I can focus on all the tools available in GSL. All the header files for GSL are stored in a subdirectory named gsl. So, for example, if you wanted to include the math header file, you would use:
#include <gsl/gsl_math.h>
All the functions are stored in a single library file called libgsl.a or libgsl.so. You also need a library to handle basic linear algebra. GSL provides one (in the file libgslcblas.so), but you can use your own. Additionally, you need to link in the math library. So, the final compile and link command should look like this:
gcc -o hello_world hello_world.c -lgsl -lgslcblas -lm
There are optional inline versions for some of the performance-critical functions in GSL. To use these, you need to include -DHAVE_INLINE with your compile command. To try to help with portability issues, GSL offers some functions that exist only on certain platforms (and not others). As an example, the BSD math library has a function called hypot. GSL offers its own version, called gsl_hypot, that you can use on non-BSD platforms. Some functions have both a general algorithm as well as optimized versions for specific platforms. This way, if you are running on a SPARC, for example, you can select a version optimized for SPARC if it exists.
One of the first things you likely will want to do is check whether you are getting correct results from your code or if there were errors. GSL has a number of functions and data structures available in the header file named gsl_errno.h. Functions return a value of zero if everything is fine. If there were any problems in trying to complete the requested action, a nonzero value is returned. This could be an actual error condition, like a wrong data type or memory error, or it could be a condition like not being able to converge to within the requested accuracy in the function call. This is why you always need to check the return value for all GSL function calls. The actual values returned in an error condition are error codes, defined in the file gsl_errno.h. They are defined as macros that start with GSL_. Examples include the following:
GSL_EDOM — domain error, used by functions when an argument doesn't fall into the domain over which the function is defined.
GSL_ERANGE — range error, either an overflow or underflow.
GSL_ENOMEM — no memory available.
The library will use values only up to 1024. Values above this are available for use in your own code. There also are string versions of these error codes available. You can translate the error code to its text value with the function gsl_errno().
Now that you know how to compile your program and what to do with errors, let's start looking at what kind of work you can do with GSL. Basic mathematical functions are defined in the file gsl_math.h. The set of mathematical constants from the BSD math library are provided by this part of GSL. All of the constants start with M_. Here are a few of them:
M_PI — pi.
M_SQRT2 — the square root of 2.
M_EULER — Euler's constant.
There also are capabilities for dealing with infinities and non-numbers. Three macros define the values themselves:
GSL_POSINF — positive infinity.
GSL_NEGINF — negative infinity.
GSL_NAN — not a number.
There also are functions to test variables:
gsl_isnan — is it not a number?
gsl_isinf — is it infinite?
gsl_finite — is it finite?
There is a macro to find the sign of a number. GSL_SIGN(x) returns the sign of x: 1 if it is positive and –1 if it is negative. If you are interested in seeing whether a number is even or odd, two macros are defined: GSL_IS_ODD(x) and GSL_IS_EVEN(x). These return 1 if the condition is true and 0 if it is not.
A series of elementary functions are part of the BSD math library. GSL provides versions of these for platforms that don't have native versions, including items like:
gsl_hypot — calculate hypotenuse.
gsl_asinh, gsl_acosh, gsl_atanh — the arc hyperbolic trig functions.
If you are calculating the power of a number, you would use gsl_pow_int(x,n), which gives you x to the power of n. There are specific versions for powers less than 10. So if you wanted to find the cube of a number, you would use gsl_pow_3. These are very efficient and highly optimized. You even can inline these specialized functions when HAVE_INLINE is defined.
Several macros are defined to help you find the maximum or minimum of numbers, based on data type. The basic GSL_MAX(a,b) and GSL_MIN(a,b) simply return either the maximum or minimum of the two numbers a and b. GSL_MAX_DBL and GSL_MIN_DBL find the maximum and minimum of two doubles using an inline function. GSL_MAX_INT and GSL_MIN_INT do the same for integer arguments.
When you do any kind of numerical calculation on a computer, errors always are introduced by round-off and truncation. This is because you can't exactly reproduce numbers on a finite binary system. But, what if you want to compare two numbers and see whether they are approximately the same? GSL provides the function gsl_fcmp(x,y,epsilon). This function compares the two doubles x and y, and checks to see if they are within epsilon of each other. If they are within this range, the function returns 0. If x < y, it returns –1, and it returns 1 if x > y.
Complex numbers are used in many scientific fields. Within GSL, complex data types are defined in the header file gsl_complex.h, and relevant functions are defined in gsl_complex_math.h. To store complex numbers, the data type gsl_complex is defined. This is a struct that stores the two portions. You can set the values with the functions gsl_complex_rect(x,y) or gsl_complex_polar(x,y). In the first, this represents “x+iy”; whereas in the second, x is the radius, and y is the angle in a polar representation. You can pull out the real and imaginary parts of a complex number with the macros GSL_REAL and GSL_IMAG. There is a function available to find the absolute value of a complex number, gsl_complex_abs(x), where x is of type gsl_complex. Because complex numbers actually are built up of two parts, even basic arithmetic is not simple. To do basic math, you can use the following:
gsl_complex_add(a,b)
gsl_complex_sub(a,b)
gsl_complex_mul(a,b)
gsl_complex_div(a,b)
You can calculate the conjugate with gsl_complex_conjugate(a) and the inverse with gsl_complex_inverse(a).
There are functions for basic mathematical functions. To calculate the square root, you would use gsl_complex_sqrt(x). To calculate the logarithm, you would use gsl_complex_log(x). Several others are available too.
Trigonometric functions are provided, like gsl_complex_sin(x). There also are functions for hyperbolic trigonometric functions, along with the relevant inverse functions.
Now that you have the basics down, my next article will explore all the actual scientific calculations you can do. I'll look at statistics, linear algebra, random numbers and many other topics.
Many Webcam applications exist for Linux. If you want to play with self-portraits, there's Cheese. If you want to set up a security system in your office, there's Motion. But, if you just want to have some fun, give HasciiCam a try.
HasciiCam does for Webcams what aalib+mplayer does for video files. It renders your live video directly into ASCII. It also has a feature to create a live Web feed of your ASCII video for the whole world to see! HasciiCam might not be the most practical application to use with your Webcam, but if you ever have been fascinated with ASCII art, it might be the most fun. It's most likely packaged with your favorite distro, but if not, the source is available from its Web site: dyne.org/software/hasciicam.
If you love shopping in the Android Marketplace but hate typing on that tiny keyboard, you might like the Web interface to the Marketplace. This isn't a new feature, but it's one I didn't know about, so it seemed apropos to share with the class.
On a desktop computer, simply browse over to market.android.com, and log in with your Google account. (The same account you use on your Android phone.) You can select an app and have it automatically installed on whichever Android device you like! There's no need to touch your phone; it automatically will install the app you chose from the Web site.
As you can tell from the screenshot, I found an excellent productivity app that will be on my new Galaxy S2 in a few moments. Just one more reason to love Android!
The glass is neither half-full nor half-empty: it's twice as big as it needs to be.
—Unknown
I would love to change the world, but they won't give me the source code.
—Unknown
I changed all my passwords to “incorrect”. So my computer just tells me when I forget.
—Unknown
A stitch in time would have confused Einstein.
—Unknown
An effective way to deal with predators is to taste terrible.
—Unknown
This month's issue is about my favorite Linux-related topic, Web development. The Linux-powered Web is a subject I believe we all particularly enjoy, as it is one of those fantastic instances where Linux enters many people's lives without their awareness. It's always fun for geeks like us to know that our work behind the scenes can have such impact on the unsuspecting public. The technologies highlighted in this issue are shaping the current and future Web, so we hope you'll take away some inspiration to go out and make something awesome on-line.
I am more than a little biased, as Drupal powers LinuxJournal.com, but I hope you'll be inspired to try Drupal 7 after this month's introduction to content types and views, and if you'd like to learn even more about Drupal 7, see the following posts on LinuxJournal.com:
“Angela Byron on Drupal 7” by Katherine Druckman: www.linuxjournal.com/content/interview-angie-byron-drupal
“Drupal 7: the Webchick behind the Wheel” by Katherine Druckman: www.linuxjournal.com/article/10999
“Drush: Drupal for People Who Hate Mice” by James Walker: www.linuxjournal.com/article/11000
This month, we also feature an article about HTML5's audio capabilities, which illustrates one of the many exciting new options HTML5 brings to the table. To read more about other HTML5 possibilities, including for mobile applications, see these articles on LinuxJournal.com:
“Augmented Reality with HTML5” by Rick Rogers: www.linuxjournal.com/article/10920
“At the Forge—HTML5”: www.linuxjournal.com/article/10926
You'll find more about these topics and many others in our Web Development section at www.linuxjournal.com/tag/web-development.