Archive for the 'linux' Category

Sat
Mar
29

Mark Shuttleworth talk in SF


Last Tuesday I had the privilege of hearing Mark Shuttleworth speak at the BALUG meeting in SF. The format is a little different than with other groups I’ve attended over the years as it was held in a restaurant in Chinatown. You needed to RSVP and pay for dinner ($13) but it was certainly well worth it.

I (thought) I planned well for this trip: that day I took the free Y! shuttle up the SF office (on Sansome) and worked from there. The meeting was only a few blocks away and I made sure to get there really early. I got a great seat, met some great people and waited for dinner and the talk.

The highlights:

  • As he put it, we need to “best express the next”. Others have said the same but we all know it’s true. If we want Linux to succeed on the desktop it really as to be “better” than anything else. Better, is of course, subjective, but Mark is referring to allowing people to better achieve their goals through software. Expressing themselves with more control and granularity. All-the-while making our apps easy to use with less headaches during installation and configuration.
  • He would use Redhat on servers rather than Ubuntu if the application was certified. I find that to be a very noble and positive statement. Use what is best for the job and play nice with others.
  • The Novell deal was bad for open source. The sentiment is that the deal promoted a false sense of security to potential buyers and didn’t really seem to benefit open source at all. It only muddied the water with potential adopters as they might buy into Novell to “keep from getting sued” or at least “be protected” should they be sued.
  • Codecs and DRM are definitely holding us back. New content and media needs to be available to everyone, regardless of platform.
  • He fondly referred to his time spent on the Soyuz as “farting around in outer space”. That was absolutely hilarious.
  • Unrelated to the talk, I was absolutely AMAZED with how many people owned the OLPC I would say out of 300 people about 30% owned one.
  • It was a short, but great talk. BALUG seems to get some great speakers so I’ll definitely be going back.

    The irony:

    So, for all of my planning upfront, I still managed to get home at 2AM. Leaving the restaurant, I got on the right bus going the wrong way, which caused my house of cards to tumble. Missed the train out of SF by 5 minutes, which caused me to miss the connecting light rail to my car. We’ll see if I get this right next time.

    PS: Here’s a fun link: Bug #1 for Ubuntu, filed by Mark Shuttleworth himself. Thanks to Jeff Boulter for the link.

    Fri
    Nov
    30

    Fun with Make


    I usually don’t have a reason to muck around with GNU make but I find myself sitting on a train from Ronkonkoma to Jamaica (LI to Queens, in New York) with not much to do (and no internet access), so I figured I’d do some scribbling. (BTW, I’m using the shell in Mac OS X for this, but all of these commands should work fine on Linux, for using make on Windows, check out sourceforge.net for options)

    The man page provides some good info but what is really helpful is the info documentation. To access it, type:

    info make

    Info is usually too verbose for what people are looking for when working with the shell, but since make is more than just a simple shell command it is definitely worth a read.

    So, what is make?

    From the man page:

    “The purpose of the make utility is to determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them.”

    So, think of it as a management system for your program. As mentioned in the documentation, make is not limited to compiled programs, or even programs at all. If you have some type of file that needs a command (or set of commands) executed after it is modified you can use make for the job!

    An example.

    So, lets create a small C program. We’ll call it junk.c:

    #include

    int main()
    {

    printf(”Hello World\n”);
    return 0;

    }

    Simple enough, right? Good. Now, I would normally compile this program with:

    cc junk.c -o junk

    and once you do that, you’ll see that you have an executable called ‘junk’ which you can run with

    ./junk

    (if not, check permissions and see if you actually have an executable file called ‘junk’)

    Fine. So, lets throw make into the mix. We’ll create a file called “Makefile” (notice the capital ‘M’, the capital ‘M’ is not required, but is convention and convenient as it separates this file from your source files in the same directory) in the same directory. That file looks like this:

    # Makefile
    # build junk executable

    junk : junk.o

    junk.o : junk.c
    cc junk.c

    so, once you this file created, lets run the make command:

    make

    You should receive output similar to this:
    ~/junk supertom$ make
    cc junk.o -o junk
    ~/junk supertom$

    If you run make again, you should receive output similar to this:

    ~/junk supertom$ make
    make: `junk' is up to date.
    ~/junk supertom$

    That’s the whole idea behind the make command. It acts as a manager for your program files. If they need to be recompiled they will be, otherwise it will do nothing. May not be a big deal with our simple program but if you are dealing with lots of program files compiling only the modified files is a big time saver. To force make to recompile in this case just remove the junk executable.

    Ok, back to our example. Looking at our Makefile, “junk” is the ultimate name of our executable and to build it, we need junk.o. In terms of make, both junk and junk.o are called targets. You can think of targets as appearing to the left of the ‘:’ in the file. So, the “junk” target needs file “junk.o” and “junk.o” needs junk.c. Notice the command:

    cc junk.c

    This is command to be run when that target is encountered. Commands that you want executed by make must be prefaced by a tab. The make utility is actually pretty smart when it comes to C files, so if you look at the makefiles for current applications it might not be so verbose. Don’t forget, however, that make can be used for other things, so take not of what is going on in our example.

    Ok, lets pick it up a bit:

    # Makefile
    # builds the junk executable

    prg = junk
    objects = junk.o

    $(prg) : $(objects)

    # what would normally explicitly be here...
    #junk.o : junk.c

    # make knows what to do with .c files so you can actually leave it out
    # it knows that .c -> .o
    # junk.o :

    # and, we can put a var in, like this:
    $(objects) :

    # .IGNORE gets us around the problem of rm not finding the files to delete
    .IGNORE clean :
    rm $(prg) *~ *.o

    tarup :
    tar -czf $(prg).tar.gz $(prg).c

    So, what are the targets in this file? junk, clean and tarup. “junk” is our first target and is the one that will be executed if no other targets are specified. “clean” runs the rm command to remove backup and .o files and tarup executes a command to create a tarball of junk.c. So, I can execute these targets with:

    make clean
    make (or make junk)
    make tarup

    We’ve introduced some new concepts in our Makefile, so lets discuss briefly. One is the concept of variables. See prg and objects at the top? Yup, those are vars. Similar to the bash shell, we declare and initialize with no distinct chars, but then use it with $ and parentheses. You’ll also see that we’re a little less verbose about what is going on. As I mentioned earlier, make is smart about C files and knows what to do with them.

    We’ve also introduced the “phony” target .IGNORE which keeps us from receiving errors from the rm command. Ever try to rm something that didn’t exist? You’ll receive an error. Maybe not such a big deal to you now, but if you try to include it in a dependent sequence of commands, like

    make clean && make

    make will never execute because make clean will return with a status of 1 if there are no ~* or *.o files.

    So, my train ride is about over, but here are some thoughts/reasons/ideas on how/when to use make for non-compiled applications:

    • Creating a “package” out of your application - especially in web programming, we tend to think of these files as separate, but they are heavily dependant on each other. You could use make to create a tarball of your app
    • Things that need to happen before or after a “build” - update a build file with date/time information, suck in a sql file that needs to be included in the package, tag a cvs/svn branch or include some other metadata
    Sat
    Sep
    15

    Finally! Upgraded my laptop to Ubuntu 7.04


    Well, you guys know me - I’m a big procrastinator, but I finally upgraded my laptop to 7.04. This is pretty ironic with the forthcoming release of Gutsy, but hey, I’m usually late to the party.

    So, I was happily running 6.06 on my Dell Inspiron 5150 and decided to upgrade for really no good reason. The cd-rom drive in my laptop is a little wonky so I was planning on using an external drive and doing a fresh install. At the last minute I opted for the net upgrade instead - a risky procedure - upgrades never go well.

    Well for the most part, it did go well. I did the net upgrade from 6.06 to 6.10 and then again to 7.04. I had two issues, one of which is resolved. I couldn’t get the zippy desktop effects to work and it had to do with the libGl libraries. I symlinked to the previous versions and all was good. Also had to put in some stuff in my xorg.conf, but now I have those cool desktop effects. You can see what I changed here:

    supertom@supertom-laptop:~$ ls -l /usr/lib/libGL*
    lrwxrwxrwx 1 root root 21 2007-08-26 22:21 /usr/lib/libGLcore.so.1 -> libGLcore.so.1.0.9631
    -rw-r–r– 1 root root 8961220 2007-06-25 14:33 /usr/lib/libGLcore.so.1.0.9631
    -rwxr-xr-x 1 root root 9916028 2007-02-26 17:21 /usr/lib/libGLcore.so.1.0.9746
    lrwxrwxrwx 1 root root 16 2007-08-26 07:30 /usr/lib/libGLEW.so.1.3 -> libGLEW.so.1.3.4
    -rw-r–r– 1 root root 199848 2007-03-04 21:16 /usr/lib/libGLEW.so.1.3.4
    -rw-r–r– 1 root root 653 2007-02-26 17:22 /usr/lib/libGL.la
    lrwxrwxrwx 1 root root 10 2007-02-26 17:22 /usr/lib/libGL.so -> libGL.so.1
    lrwxrwxrwx 1 root root 26 2007-08-26 22:31 /usr/lib/libGL.so.1 -> /usr/lib/libGL.so.1.0.9631
    -rw-r–r– 1 root root 567704 2007-06-25 14:33 /usr/lib/libGL.so.1.0.9631
    -rwxr-xr-x 1 root root 601272 2007-02-26 17:21 /usr/lib/libGL.so.1.0.9746
    lrwxrwxrwx 1 root root 20 2007-08-26 07:30 /usr/lib/libGLU.so.1 -> libGLU.so.1.3.060502
    -rw-r–r– 1 root root 521000 2007-07-13 05:23 /usr/lib/libGLU.so.1.3.060502

    Unfortunately, my Netgear WG511 stopped working with WPA and I have tried unsuccessfully to fix it so far. I had originally followed the instructions on linuxquestions.org for Dapper but no luck on 7.04. I blacklisted what I believe to be the appropriate drivers and tried different windows drivers under ndiswrappers with no luck. Works fine with WEP. I have a wireless USB adapter which I might give a shot or I might just break down and buy something better supported. This laptop is now 3+ years old, but, other than a cdrom issue (meaning, it doesn’t always work) it works fine, so it would be nice to keep it around, you know?