How to install liveusb-creator on Debian 5 Lenny (Failed)

I never got this to work properly so I used the following steps to uninstall:

locate liveusb

Manually delete the results

First install the following packages on Debian

sudo apt-get install python-qt4 python-qt4-dbus python-urlgrabber syslinux

Download Fedora’s liveusb-creator from the project site

https://fedorahosted.org/liveusb-creator/

Extract then run as root

sudo python setup.py install

Now you can run Fedora’s liveusb-creator on Debian 5 Lenny

sudo liveusb-creator

C# Marshalling is no fun

I’ve been spending the past week working on Mac which is very close to FreeBSD, and I have been working on the simple goal of getting a MAC address for a network interface. I was able to find plenty of sample code on the net on how to do it, but they were all written in C. My gaol then became to do the same thing in C# using P/Invoke and Marshalling. I’ve been working on this for three days and I have learned two things. One, P/Invoke and Marshalling is extremely hard and confusing because you lose code reuse, meaning that every structure has to be redefined, along with macros and function signatures. System level code uses tons of nested structures, and defined variables and so on. So implementating just one P/Invoke function which takes a structure can get messy really quickly. I guess back then developers assumed everyone would be using header files which would automatically resolve all of these special structures macros and so on.

The second thing that I learned is that trying to work with pointers in C# is (dangerous) and extremely annoying. C allows developers to do many hackish things with pointers in order to cast, or just to different places in memory and so on. C# has various limitations on how to use pointers; so there is no direct mapping from C pointer handling to C# pointer handling. With that said, once again, converting system level C code to C# requires good understanding and experience with C pointers, and C# marshalling in order to get things done. Overall, I’m learning a lot, and spending a lot of time learning about different marshalling options but I did not expect it to be this hard. Also, marshalling tends to get confusing because they are so many different ways to represent data, you have IntPtr, char arrays, byte arrays, keywords such as in, out, ref, and functions such as Marshal.PtrToStructure, Marshal.Copy, Marshal.ReadByte, and so much stuff.

In the end, my advice is, do not underestimate marshalling (or anything else in programming), and pointers are extremely annoying to deal with. So try to avoid marshalling and pointers as much as possible

Mac is not so bad

So today I spent the whole day programming on a Mac-Mini (by Apple) and it turns out that it was not so bad. It was mainly because it was not such a big change from Linux to a Mac. Mac OS X is BSD/Mach based and it comes with many common free (open-source) software tools by default. Here is a short list: bash, grep, curl, vim, x11, and so on. Basically all of my favorite shell tools were readily available. I also found out that the Mac kernel (Darwin) is open-source (well under Apple’s open source license). I also got a chance to browse through some header files and most of the kernel seems to be a close match with the FreeBSD kernel which Apple proudly advertises on their developer website. All in all, Mac showed me what Linux can become and also what FreeBSD can also become. Mac OS X is a combination of many open-source/closed source software and you definitely get the Unix feel when you use it. Now I see why Macs are more stable than windows, because it is built on top of well-tested BSD software. I still love Linux, but I have found a new appreciation for Macs (and BSD systems as well).

The perils of using Managed Languages for young programmers

Although I’m not really a young programmer per say (since I’ve been programming since 2002), I still feel young due to my inexperience with programming. The majority of my programming has been with managed languages such as Java and C#. Now I love using managed languages because they make programming so much easier since you don’t have to deal with memory; that’s the whole point of managed languages is to manage memory. I have always been curious about unmanaged languages such as C/C++, but I never got the opportunity to work with them until now. I’m currently looking into using a network modeler written in C++ and I am starting to understand how complicated memory management could be. The main thing that I learned is that local objects to a function are allocated on the stack instead of the heap. Since both Java and C# uses the “new” keyword for declaring objects, I was always under the impression that the heap was always used for all objects, and only generic types such as int, char, and so on were stored on the stack. It turns out that in C++, objects can also be declared on the stack and that using the stack is much faster than the heap. C++ provides two ways of declaring an object, with the new keyword that requires using the “delete” keyword to reclaim the memory, or without it and it gets auto-managed. Nobody ever told me there was auto-management in C++. I also learned about auto_ptr and so on. Anyways, my point is that just using managed languages is great and I would use them for my application development projects, but being oblivious to C/C++ can be a great disservice. It’s sad that noone emphasizes learning C/C++ and everyone is depending on Java/C# to do the dirty work.

Debian vs Ubuntu vs Fedora

Debian = stable, just works, no commercial support, takes years for releases (I use that for my work machine because I don’t want to update every 6 months)

Ubuntu = Less stable than debian, 6 months of testing vs 2-3 years for debian, commercial support (I use that on my laptop because I don’t use it often and I need new drivers)

Fedora = bleeding-edge, newest stuff, not for production, no commercial support ( I use that on my dual-boot home pc, since I don’t really care)

Each have their own purposes, Debian for serious work, Ubuntu for more update yet stable stuff, Fedora for living on the edge. Hope this helps.

Next Page »


My Tweets

  • @christangrant publication=production find top tier conferences/journals try to publish twice a year 4-6 pubs=great CV 1 week ago
  • PhD 101: You are always competing to be top 10 out of 100, good news is only top 20 knows that 1 week ago
  • iPhone OS, Mac OS is filled with BSD kernel code but Apple gets all credit and money; BSD OSes struggle for funding 1 week ago
  • listening to gangsta rap while coding, best of both worlds, LOL 2 weeks ago
  • has the best job, I write code to help solve the people's problems, p2p=people2people 2 weeks ago