Wednesday, February 18, 2009

Time flies when you're busy and PRODUCT LAUNCH!!
I've been insanely busy over the last 4 months (actually closer to 6...), but things have calmed down a bit now. I hope to do this more regularly.

But today I shipped a product: Experienced Man's Guide To Cross-Platform Programming with wxWidgets (Release Announcement).

The product page is: Experienced Man's Guide To Cross-Platform Programming with wxWidgets (Product Page) Think of it as a companion PDF with all my notes from using the wxWidgets book pretty much day in and day out for 3 years.

In addition to being a great resource (I hope) for the wxWidgets community, it's also an experiment: if this book sells well I'll do at least two more (one on the TextMate book and one on the 3rd edition to the Prag Prog's Rails book, after I've had some time to play, read, and transfer the notes I made in the second edition over (if they're still applicable).)

So yeah - check it out!!



 Wednesday, December 3, 2008

libedit and vi key bindings
OS X unix commands sometimes provide a interactive prompt for users to enter text. An example would be the Python or Ruby interactive interpreters. These interactive prompts require ways for users to move their cursors around quickly. The Mac has had standard keyboard shortcuts for text fields since the beginning of time (pretty sure MPW, but don't quote me)... but, it's Unix folks! Pick an editor: vi or emacs.

In the NeXT days, those engineers picked emacs - which is why you can use, say Control-A to jump to the beginning of the line in any Cocoa text field.

But I like vi. What to do? Turns out you can turn on vi bindings for console programs (that link to libedit....) You can even add your own commands!!

On OS X 10.5 most programs are use the same underlaying code to handle interactive text input: libedit. This is a pretty obscure library, compared to the more common (on linux systems) readline.

man editrc is the man page, but to do our task, here is the short of it is:

  1. Create ~/.editrc
  2. Add the line: bind -v
  3. There is no step three! Fire up your interactive console program and try it out!

Mac OS X Hints has more things you can do with .editrc



 Thursday, October 2, 2008

Steps to resize a Windows XP VMWare disk image

Here are the steps to resize a Windows XP VMWare Fusion 2.0 disk image:

  1. Power off machine and delete all snapshots
  2. Virtual Machine -> Settings -> Hard Disks
  3. Set your disk size to the allocation you want... but now we need to expand the partition so Windows uses all that space
  4. Quit VMWare
  5. Use a text editor to add the following line to the configuration (.vmx) file of the virtual machine (VMWare Fusion's virtual machine files are a bundle, so in the Finder right click and Open Package Contents on the sucker. Then find the .wmx file in there.): bios.forceSetupOnce = "TRUE"
  6. Download the live cd .iso from the GParted. This is the Gnome Partition Editor which will - for free - let you edit your partitions. Or you could use a windows partition editor like Partition Magic. But these steps are for GParted. Download the LiveCD .iso
  7. Relaunch VMWare
  8. Virtual Machine -> Settings -> CDs & DVDs. Use the .iso you downloaded above as the disk image.
  9. Run your virtual machine
  10. In the BIOS prompt...
    1. Use the right arrow key to navigate over to the Boot "tab"
    2. Use the down arrow key to navigate down to the CD drive in the list
    3. Press the + key on your numberpad to move the CD drive above the Hard Disk section
  11. In your Mac OS X System Preferences, make sure F10 isn't used by anything (ala: Expose). If it is, unassign F10 for now
  12. Back in the BIOS, hit F10 (Save and Exit) and return
  13. Now you should be in the LiveCD. Follow the instructions to boot it
  14. Eventually you'll be in a graphical UI for GParted. Read the resizing document for GParted. The Resize/Move button opens a dialog where you can adjust these settings. Remember: it's just X-Windows..., so tab down to the edit fields, adjust your space requirements (note the total space label in the dialog and the "new total size" text field. No, I don't think I have those names exact from the interface). Tab down to the Apply button and hit Return. Also: At least for me, the GUI tended to register clicks a few inches away from where the cursor actually was... which made it very hard to hit buttons. You may want to do some experiments (the buttons will show a border when it thinks the cursor is over it - check to see when this border shows up) to see if clicks are registered where you expect them to be - because you have to click the Apply button - no keyboard navigation to this UI element!
  15. When GParted is complete, use the UI to exit (and select that you want to shut down the machine)
  16. Virtual Machine -> Settings -> CDs & DVDs. Set it to automatically detect physical drives (aka: change it to not use the GParted LiveCD anymore
  17. Boot your virtual machine. Windows should check the disk (this is expected and was mentioned in the GParted resize guide).

Yes, this is pain.



 Wednesday, July 23, 2008

The Axiom is Wrong

So in business school, the one axiom they pounded into our heads was: "The goal of the corporation is to maximize shareholder wealth".

Which is great as far as it goes, but thinking it over tonight, it sounds a little naive. I think a better goal would be "... to maximize stakeholder wealth.". (and wealth in this sense not necessarily being money wealth. Perhaps a better word here would be "contentment", or "prosperity"

Why? Because (I believe) it will actually lead towards the goal of the first! By striving to increase the prosperity of your customers, or employees, or whomever, you should, in theory, have better word of mouth advertising (or less furious customers who shout from every treetop how much you suck), happier more efficient employees and possibly a product with more quality.

This approach seems a lot better to me than the approach of maximizing shareholder wealth... which, taken to it's extreme means moving everything overseas (where it's cheaper), using less quality parts, and ticking your customers off because the quality of your product or services degrades... with the added fact that even your old employees can't buy your stuff because they're not getting paid anymore (or won't buy your stuff because they're bitter). Which seems like it would decrease shareholder value!!



 Monday, July 21, 2008

Book Recommendations
I've started something new: book recommendations at my business blog, and I just posted my first one: Book Recommendations: Python. There's going to be more, so stay tuned!!


 Thursday, May 29, 2008

Python and Ruby Differences: 0 == ?

So I've been learning Ruby and Ruby On Rails over the last few weeks for a new project. Today I ran across something, well, different:

if 0 then puts "0 == true!" end

Returns "0 == true". A "Gotcha!" moment for this old C hacker.

Now Python:

if 0: print "0 == true" else: print "0 == false"

Returns "0 == false".

Investigating this a bit more:

$ irb >>> 0 == false => false >>> 0 == true => false

$ py Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:17) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 0 == True False >>> 0 == False True

More info: Ian Bicking talks about Truth in Python and Ruby some too (and other topics).



 Tuesday, May 13, 2008

Different Types of programming personalities and how productive they are

So I go back and forth on the idea that a programmer can be 10 times as productive as other programmers. Part of me says, "No, that level of productivity difference just isn't possible". The other part of me has been there when the better programmer solved the junior's problem in 2 minutes flat, where the junior had been dealing with this for hours. (I've been on both sides of this)

However, TiWeb/DevTopics has an interesting article out: Programmer Productivity and the Teninfinity factor, where they outline 5 classes of programmers: visionary/artist, trailblazer, workhorse, drone, and idiot. And these classifications make sense to me... and I think you need a few of each type (except idiots) on your team.