Al Hoang

December 26, 2006

Wireless drivers and Open Source

Filed under: Open Source, linux, tech, unix — hoanga @ 12:35 am

The Jem report has a
great article describing the intracies and difficulties in
why wireless drivers suck under Linux/FreeBSD and most other Free operating systems out there.
A choice quote from an Atmel representative is extremely enlightening on why some companies are far more open to OSS drivers:

You’ve only got three real chances for success: you can be first to market with a technology, or you can have valuable and unique features that no one else has and the market wants, or you can have the lowest price.

Atmel wasn’t first, didn’t have any new unique features, and wasn’t the cheapest, either. With the PC and OEM markets being somewhat locked out, we repositioned to focus on the embedded space where the market was experiencing and predicting large growth. In the embedded market, if you don’t get documentation to developers, then you both fail.

Basically, the players that are friendly to OSS basically lost the market initiative so OSS drivers are a way to grab a certain sub-segment of the market. Kind of sad to hear this to tell you the truth but understandable.

Read it yourself

December 25, 2006

Island off India claimed by Global warming?

Filed under: geek — hoanga @ 10:50 pm

At least the
Independent seems to think so
. While I don’t deny global warming it’d be nice if
they had more information on how old these island have been above water…

December 21, 2006

gem install mysql failing on Ubuntu fix

Filed under: fixes, programming, ruby, stupid — hoanga @ 12:43 am

The problem

Did you try something stupid (and expect something hopeful) like:

$ sudo gem install mysql

Then get something beautiful like:

ERROR:  While executing gem ... (RuntimeError)
    ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.

Welcome to getting bit by the
policy of the Debian packaging policy problem where one software package can be split into muliple pieces. In general the policy makes sense unless you’re doing development then you have to remember this.

The fix

Assuming you installed mysql server via something like sudo apt-get install mysql-server the next thing you need is the MySQL development headers in order for the Ruby Gem to compile. Simple eh? sudo apt-get install mysql-dev. Well not that but close. It’s (because you need to specify the particular version of development libraries very often):

$ sudo apt-get install libmysqlclient5-dev

Now back to business

$ sudo gem install mysql
Select which gem to install for your platform (i486-linux)
 1. mysql 2.7.1 (mswin32)
 2. mysql 2.7 (ruby)
 3. mysql 2.6 (ruby)
 4. mysql 2.5.1 (ruby)
 5. Cancel installation
> 2
Building native extensions.  This could take a while...
[snip]
creating Makefile

make
gcc [stuff]
gcc [stuff]
make install
mkdir -p /usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib
/usr/bin/install -c -m 0755 mysql.so /usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib

make clean
Successfully installed mysql-2.7

Now back to business.

December 20, 2006

Projector + Car + Tiger = cool

Filed under: geek, tech — hoanga @ 7:01 am

What happens when you combine a projector inside a car with an animated Tiger? You get some really
cool effects on the road for one…


Via Table of Malcontents

The birth of an island

Filed under: geek — hoanga @ 6:59 am

Whoah…


December 19, 2006

Getting a ruby C extension to compile on Windows Part 2

Filed under: gripe, programming, ruby — hoanga @ 3:23 am

In a previous post I mentioned how to get the Ruby C extension to compile under Windows using Visual Studio Express/Studio 2005. However, I left out an important part regarding manifests which have been part of the development process in VC++7 and above.

Manifests are some XML representation of the bindings and and activation (whatever that means) for many things such as classes, libraries, and assemblies. It boils down to you need one if you’re going to deploy a library (DLL) or executable (EXE) made with VC++ 2005. The manifests by default will go into a file called .manifest however for our purposes we will need to embed it into the library (in this case it is a .so not a .dll).

Here’s the howto:

C:\exttest>mt.exe -manifest my_test.so.manifest -outputresource:my_test.so;2
C:\exttest>nmake install
C:\exttest>irb
irb(main):002:0> require 'my_test'
=> true
irb(main):003:0>

The main thing you need to remember is (don’t forget the 2!!)
mt.exe -manifest my_lib_name.so.manifest -outputresource:my_lib_name.so;2

Resources

Wirble: A ruby gem that gives tab-completion + syntax coloring to irb

Filed under: programming, ruby — hoanga @ 2:14 am

Ruby Inside has a
blog post
on an add-on to irb that allows tab-completion and syntax coloring for irb. Way cool!
The install instructions are simple as:

  1. Install Ruby Gems (You DO have this installed, right?)
  2. sudo gem install -y wirble
  3. Then add the following to $HOME/.irbrc

    require ‘rubygems’
    require ‘wirble’
    Wirble.init
    Wirble.colorize

Then enjoy working with ruby in full (ascii) technicolor.

December 14, 2006

Getting a Ruby C extension to compile on Windows

Filed under: japan, ruby — hoanga @ 12:39 am

The Programming Ruby book is one of those must have references if you’re going to program Ruby. I still use it all the time when I’m looking up information on Ruby. One thing I’ve started playing with is getting a C extension to work with Ruby. Chapter 21 of Volume 2 of Programming Ruby gives you a great example for writing a C extension from scratch and getting it to compile and work in a UNIX-based environment however it falls short on handholding you through the Windows process. Here’s my notes on what you need:

Executive Summary

  1. Install Visual Studio Express or some other Visual C++ variant
  2. Install the Platform SDK (You need this if you want windows.h and you DO)
  3. Make minor changes in Ruby config.h (Not necessary for all versions of Visual Studio)
  4. Write the MyTest code and extconf.rb file from the book
  5. Run ruby extconf.rb to generate a nmake-based Makefile
  6. Startup a command prompt with the SDK environment variables set
  7. Run nmake to compile the library
  8. Done!

The detailed version

Download Visual Studio

Unless you’re using cygwin or mingw as your compiler you’ll probably want to get Visual Studio. The latest incarnation is Visual Studio 2005 which is a free download. I’ve found that it’s a pain to find the right URL to download it from on Microsoft but that’s Microsoft for you.

Download the Windows Platform SDK

Since the Windows version of Ruby ties in with many Win32 libraries it’s necessary to get the Platform SDK. If you DON’T download it you will see strange error messages when trying to compile your Ruby extension such as this:

c:\ruby\lib\ruby\1.8\i386-mswin32\win32/win32.h(32) : fatal error C1083: Cannot
open include file: 'windows.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

windows.h is NOT included by default in Visual Studio 2005 (but I believe it is in older versions of Visual Studio) so you need the platform SDKs to get the right development libraries. While it would be nice if the C-based version of Ruby could easily hook into the .Net platform, this would probably require significant hacking the mkmf library in Ruby to get it to work transparently. I doubt that will happen soon.

Once again, I found Microsoft’s website really annoying to navigate in order to try to find the Platform SDK so you might want to click here then make sure you have the latest platform SDK (As of this writing the latest was R1)

Tweak $RUBY_HOME/lib/ruby/1.8/i386-mswin32/config.h

For some versions Visual Studio (noteably Visual Studio 2005), the config file located in $RUBY_HOME/lib/ruby/1.8/i386-mswin32/config.h (Usually $RUBY_HOME installs to C:/Ruby) will require a tweak to allow compilation. Or you could rebuild Ruby from scratch yourself but I prefer to use the All-in-one installer. In the config.h file delete or comment out the following lines:

#if _MSC_VER != 1200
#error MSC version unmatch
#endif

Finally! Let’s compile it already

Okay now you’re ready to finally to actually compile your code. In order to get all the environment variables set properly you might want to launch a command prompt from the shortcuts the Platform SDK makes in the Start Menu then make sure to run vsvars32.bat from Visual Studio’s directory (Usually in C:\Program Files\Microsoft Visual Studio 8\VC\bin). Now with that all set you can finally compile something! (whew!):

C:\cygwin\home\foo\exttest>ruby extconf.rb
creating Makefile

C:\cygwin\home\foo\exttest>nmake

Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -nologo -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:/ruby/lib/ruby/1.
8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6  -c -Tcmy_test.c
cl : Command line warning D9035 : option 'Og-' has been deprecated and will be r
emoved in a future release
cl : Command line warning D9002 : ignoring unknown option '-G6'
my_test.c
        cl -nologo -LD -Femy_test.so my_test.obj msvcrt-ruby18.lib  oldnames.lib
 user32.lib advapi32.lib wsock32.lib  -link -incremental:no -debug -opt:ref -opt
:icf -dll -libpath:"c:/ruby/lib" -def:my_test-i386-mswin32.def -implib:my_test-i
386-mswin32.lib -pdb:my_test-i386-mswin32.pdb
   Creating library my_test-i386-mswin32.lib and object my_test-i386-mswin32.exp

C:\cygwin\foo\exttest>irb
irb(main):001:0> require 'my_test'
=> true
irb(main):002:0> test = MyTest.new
=> #

References

December 13, 2006

What would Knuth say in this situation…

Filed under: Uncategorized — hoanga @ 1:24 am



December 10, 2006

The Free Software Foundation and Dogfood

Filed under: geek, unix — hoanga @ 10:00 am

Found this via LWN:

By performing a simple Netcraft check, we can see the FSF servers running what GNU/Linux distro? Debian, of course! If the concept hasn’t violated your cortex just yet, I must remind you of this double standard of distribution selection.

I spoke with Richard Stallman about this. He didn’t seem to be nearly as disappointed as I was:

We did not install any of that non-free software, so it is ok for us to run Debian. But we cannot recommend its servers to the public. Other people might install the non-free software from the site.

In general, I’m usually ambivalent about the whole double-standard accusations that occurs (all the time) in the Open Source / Free Software community but what I find amusing in this case is that the Free Software Foundation who are supposed to be a bunch of rather highly technical people can’t be bothered to to insist on running their own services on Free Software.

While beggars can’t always be choosers doesn’t it make sense to eat your own dog food? From the standpoint of usability. A technologist that can’t be bothered to use the software they espouse suggests to me that the software doesn’t actually fulfill its job. Though I wouldn’t call it a hard and fast rule just something to raise suspicions.

Read it yourself

December 8, 2006

Getting Mercurial Win32 to use SSH and vim right

Filed under: geek, mercurial, programming, tech — hoanga @ 11:36 pm

I’ve been playing with Mercurial a bit recently as I wanted to get the hang of a Distributed Source Code Management (DSCM) tool better. I’ll save my reasoning for choosing Mercurial for another time. Let’s get to the troubleshooting part.

Mercurial provides a Windows version and some instructions on getting it running for basic cases however what I found I needed were:

  • Repository syncing via SSH
  • Getting vim to fire up as my default editor when I made commits

After a little bit of head-scratching I finally figured out these are the steps you need to get those working:

  1. Install Mercurial Win32
  2. Install cygwin and make sure to also choose openssh from the packages you install with cygwin. If you like some other ssh client from the command line you can use that but I couldn’t get plink to work properly but cygwin worked fine for me
  3. Install the Windows version of vim and make sure that vim is added to your PATH (I believe you have to check this setting during install)
  4. Ensure vim works from the command line and you can use ssh from cygwin
  5. Configure in %MERCURIAL_HOME%\Mercurial.ini (Default is C:\Mercurial\Mercurial.ini) the following:

    [ui]
    editor = vim
    ssh = C:\cygwin\bin\ssh.exe

Dumb trivial aside: It seems you can call cygwin commands directly without the cygwin shell if you have C:\cygwin\bin in your path. Although it might get confusing since cygwin also does path munging to make it feel more like UNIX

Now you should be able to use hg from either cygwin or the normal Windows shell properly. Enjoy.

December 7, 2006

Why software patents are a serious pain

Filed under: tech — hoanga @ 1:31 am

ArsTechnica had a story on
a company named BlackBoard acquiring a patent in relation to e-learning systems. Here’s a snippet:


a broad e-learning patent held by education and course management software company Blackboard. The patent, which was awarded in January of this year, covers “Internet-based education support system and methods” … Specifically, the patent describes an Internet system in which different access rights to various course management resources can be granted to different users.

Read it yourself

December 5, 2006

Getting a remote instance of Firefox running with a local instance

Filed under: geek, linux, unix — hoanga @ 8:47 pm

I needed to access some web-based interface on a machine that was accessible only through an isolated network. Luckily, X11 display forwarding makes this a trivial job. However, Firefox isn’t giving me any love. Normally, you would try to do something below to start a X11 forwarded session via ssh between a machine named client1 and a machine named server1

client1$ ssh -X server1
server1$ firefox

What this does is that it ends up trying to open a new window / tab on client1 rather than on server1 and forwarding its display back home. After gnashing my teeth on this, I found the answer at this URL. THe key magic is you need to set the MOZ_NO_REMOTE value to 1 (Oh yeah, I love these features) so that it prevents Firefox from trying to query the local machine for any Firefox instances. So to fix the above example try this (assuming bourne shell syntax):

client$ ssh -X server1
server1$ export MOZ_NO_REMOTE=1
server1$ firefox

You might have to try giving the -P option to fire up a different profile in Firefox as well but what I show above worked for me.

December 2, 2006

Ars’s Final score for the Wii Review confusing

Filed under: geek, tech — hoanga @ 9:14 am

I read through Ars’s review on the Wii and I find their final score (an 8 out of 10) a little hard to understand just like this poster:


quote:
Originally posted by bluewire:
Great review!

I’m still befuddled by how the Zune got a 7 and the Wii got an 8. What a headscratcher…

Personally, I give the Wii a 9 myself. It’s not perfect but it’s damn impressive for what it does. While I enjoy graphic tour de forces I care less about them these days and care more about games that push the envelope in interactivity and immersibility. What do those mean? I’ll write about them in some other post but for now just take that the latest graphics engine doesn’t always convince me the game will be great. Merely that it will look great.

Then I read this Ars post
and it’s all clear to me.:

First of all, you’re assuming that scores are some kind of objective function that can be compared between sortal types. That’s clearly false. A Zune would make a lousy game machine, and a Wii would fare poorly as an MP3 player.

Rather, consider each to be a rating of how the reviewer felt relative to other reviews that reviewer made, other category exemplars, and special credits and debits. The Zune is a 7 because:

Compared to an iPod it’s a 2,
-5 for the DRM
+1 because MicroSoft gets a special bonus for being braindead but still trying hard
+1 because the competition with Apple might improve the iPod
-3 because its not really competition
+1 because they did something innovative (wireless)
-4 because it sucks
+1 because “Zune” sounds funny
-2 because “Zune” sounds funny
-1 for the online store.

That makes 7, well, assuming you use the Ars 4 bit register to count.

The numbers really matter less than the words inside but it’s a shame since sometimes you need an executive summary and the executive summary for Ars has been slipping if you ask me compared to earlier articles.

The ArsTechnica Wii Review

Powered by WordPress

Protected by AkismetBlog with WordPress