2010-12-18

Getting Leiningen 1.4.1 working on Windows (and a weird bug)

First the bug, don't make a project named "test" in Leiningen or else it will throw a NullPointerException.

Second, when getting Leiningen 1.4.1 installed on Windows 7 64bit, I had to jump through a few hoops.  Firstly, don't place the lein folder in "Program Files (x64)".  Put it in "Program Files" instead.  The parentheses will mess up the lein.bat script otherwise.

Secondly, after running "lein self-install", you'll have to fetch the downloaded "leiningen-1.4.1-standalone.jar" file from "C:\Users\my_user_name_here\AppData\Local\VirtualStore\Program Files\lein" and move it into "C:\Program Files\lein".  (Refer to this).

I'm assuming you've copied the lein folder into "C:\Program Files" of course.

2010-12-13

The problem of Object Oriented Programming is an education one

Over on Hacker News, there's been some discussion about OOP and specifically about inheritance and encapsulation.  The general idea seems to have moved within the discussions from understanding OOP as primarily about inheritance to it being primarily about encapsulation (an excellent read on its own, by the way).

As neilk points out in the HN discussion,
Skillful practictioners [sic] of OOP, even in languages like Java, know this stuff already...To a first approximation, inheritance is always wrong. The Design Patterns book advocates composition...
Here I will point out that the essential problem with OOP, and programming in general, is really that the quality of the code is dependent on the skills of the "Skillful practitioners".

This obvious observation has big ramifications: encapsulation, as enforced by the compiler, is a technological solution to what is a human behavioral problem, and there are many ways of solving the behavioral problems.  The question is which one is more effective.

2010-12-12

Command line utilities missing from Mac OS X

Here I am setting up my Mac so that I can do Clojure programming as I did on my other Ubuntu Linux computer and what do I find?  Loads of missing command line utilities I didn't know I used.

I'm using Fink as the package manager for unix/linux stuff here as it's what I'm used to using from years ago, and it seems okay, excerpt on Mac OS X 10.6 they don't have the binaries pre-built yet I guess.  So I'm compiling all kinds of stuff from scratch.

So here's a partial listing of the programs missing or seriously outdated on the default Mac install that I got through Fink.  Some of them are a little oudated in Fink too though, and installing these will install a slew of other useful things along with it.

  • watch
  • clamav
  • emacs
  • srm
  • git
  • gcc
  • ghostscript

Also, I needed LaTeX.  It's best to get that through MacTex though (don't bother with the i-Installer stuff you might find elsewhere).

2010-12-08

Stop appealing to neuroscience to explain brain-based behaviour!

The Fall 2010 edition of the University of Calgary's Alumni Magazine has an article, "Parenting in the 21st century" by Betty Rice with a quote from Judy Arnall, stating "we now know that the frontal lobes in teens do not finish developing until age 25 --- who knew that there was a biological basis for those illogical decisions they make at 21?"

Who knew?  How about everything who understands that the brain is the seat of decision making [1].  Every decision a person makes originates from their brain, whether the decision is logical or not.  So is there a biological basis for illogical (or logical) decision making?  Of course there is, the basis is called the brain!

It is pretty well useless to base discussion on parenting and teaching around vacuous statements like Arnall's, because it only provides an explanation that uses a variable that, under normal circumstance, cannot be controlled.  It's not like we can make the frontal lobes develop faster, so what use is it to tell us about it in the context of parenting or teaching (other than to use it as an excuse for undesirable teenage behaviour)?

The appeal to neuroscience terms somehow blinds readers to the absurd vacuousness.  This is the problem of "The Seductive Allure of Neuroscience Explanations" (see the very detailed writeup on the paper of that name over at Neuroskeptic).

Granted, I'm pulling a short part of a quote from Arnall, but I feel the appeal to neuroscience explanations must be addressed independently, because neuroscience explanations are so incredibly seductive [2].


[1] Deep philosophical discussions regarding the seat of consciousness, freedom, etc, notwithstanding here, so that we may deal with the issue at hand.

[2] So seductive that there's an entire field in teaching called "brain-based learning", as though we know so much about the brain that it can immediately translate into classroom based approaches.  You'd think that if it were the case, building artificial intelligence wouldn't be so hard, as it currently is.  But it's seductive to many to hear that such and such an approach to teaching doesn't work because it doesn't grow the dendrites in the brain, rather than say something more useful, like that it doesn't work because it bores the children immensely when that material is presented that way.  It's more useful because while we can't control the rate of dendrite growth directly, we can control the presentation style so to reduce boredom.

2010-12-07

WikiLeaks could've saved Jack Bauer a lot of trouble

Not a big or very deep observation, but the whole story plot of the latter half of the most recent season (8) of the TV show, 24, shows Jack Bauer going through a lot of pain and trouble that he could've avoided had he been using the internet.

Jack had some incriminating video on a cell phone that he needed to show to the world to prove some other implausible plot point.  He goes through a lot of pain, gun shot wounds, etc, to try to get that to the mainstream media.

But why didn't he just upload the video onto YouTube, WikiLeaks, etc?  He could've saved the world with 30 minutes of work.  Less if he got his friend Chloe to do that (and why didn't she, the computer hacker guru, figure to do that herself?).

I realized it's fun to watch Jack go through all the challenges of fighting "the system" with guns and snipers, but really, 30 minutes on a computer could've done the same thing.  How the world has changed with globally networked computers...

2010-12-06

Easier Personal File Sharing in Ubuntu

I don't know why it's so hard to get file sharing right in Ubuntu Linux [1] (Mac OS X makes it so easy).  But now there's a way for easy personal file sharing in Ubuntu.  This is meant for you sharing files with, basically, yourself, or at most one or two other people who you don't mind letting use your computer (ie, you don't mind making them an account on your computer to log in with).  If you need file sharing that's more complicated than that, you better find a more comprehensive solution, using Samba, or whatever else.

My solution basically boils down to using SSH to do the network connections, a fire wall to control whether to allow sharing of files or not at any time, user accounts to control who can log in to get at shared files, and SFTP on connecting computers to access the shared files in your Ubuntu Linux computer.  This means that you can't just share any single folder, but must share everything in a single home directory, or else you'll have to do some file permissions judo (but if you must do that, then you might as well get a proper file sharing service going).

On your Ubuntu computer, using the Synaptic package manager or Ubuntu Software Center, install sshd and a fire wall control program (I can suggest Firestarter and Firewall configuration).

sshd seems to configure itself just fine, so you just need to configure your firewall.  The pertinent part about your firewall is setting up a rule to allow access from certain IPs to your computer's port 22.  I allow every computer in my subnet 192.168.0.x to access my files, so I have a rule allowing 192.168.0.0/24 (the 24 shows that the first 24 bits are subnet masked) to access my computer's port 22.

If you only want to allow yourself access to your home folder's files, you're already set up!  This was my own use case (just wanting to share my own files with myself on multiple computers).  If others who don't have an account of your computer wants to be able to access files on your computer, you will have to create a user account for them on your computer, and do some folder permission judo, or else copy those files to that user's home folder, to let them get access to them.

In any case, so now, on another computer, you can SFTP into the first computer (where you installed sshd) using the IP address of that computer.  If you use Ubuntu on this second computer, you can do this in Nautilus (just type in the address bar sftp://your_user_name@ip.address.right.here).  If you're on Windows, you can use Filezilla as a SFTP program.  I don't recall which program Macs can use, but there's certainly one.

And that's it!  When you want to "shut down" file sharing, just close down the firewall rule.



[1] I've tried both the File Sharing and Personal File Sharing packages in Ubuntu.  They were more hassle and unreliable than I cared for in my extremely simple use-case.

2010-12-05

Visual Studio C++ 2005 Side by Side DLL Configuration Errors

Previously, I had experienced the "modern" Windows 7 version of DLL Hell, ie, the Side by Side Configuration errors.  I had to reinstall Win7, so I had to experience this Side by Side DLL Hell all over again...  So here's a better and quick explanation of how to fix it:

Programs compiled in Visual Studio C++ may have a number of dynamic link library dependencies.  The dependency is specific down to the version of a library, so the Side by Side (SXS) feature allows Windows to manage having multiple versions of a library available for programs to link to.  These libraries are stored at C:\Windows\winsxs (so you can go have a look and see if you have a particular library needed).

Usually, programs so compiled have a manifest file of what dependencies is needed embedded in the binary of the compiled program.  You can ask Visual Studio to compile with the manifest file split out as a separate XML file by, in Visual Studio, going to Project > Properties > Manifest Tool > Input and Output, and setting the Embed Manifest option to No.  Then compile the program, and opening the XML file, your_program_name.exe.manifest, in any text editor.  It'll tell you which library you need, and which version.

For me, it turns out I needed two different versions of both the C/C++ standard libraries, and the MFC libraries.  After much searching, I found where you can download them from Microsoft:
"Normally," given that you have Visual Studio installed, you should have the necessary copy of those libraries available for redistribution to users without the necessary libraries in your Bootstrapper folder: C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x.  But for whatever reason the copy I have there doesn't have the right version.

 Finally, there is some relevant discussion here.