Archive

Archive for 2009

C++ Templates for XCode 3.2

November 19th, 2009

Here are a couple of Project templates I made for XCode 3.2. One for a WxWidgets based project (wxMac 2.8), and one for a GLUT project. Hope they work.

  • GLUT C++ Project – Initializes GLUT and creates a scene containing a cube which can be rotated using the keyboard arrow keys. toggle an axis widget using ‘w’, toggle fullscreen using ‘o’ and exit using ESC. The FPS is displayed in the titlebar.
  • WxWidgets C++ Project – Initializes a WxWidgets based app with an empty frame.

Programming , , ,

Nethack on OS X 10.6 (Snow Leopard)

November 13th, 2009

O.K. So, this is kind of a followup to a previous post I did about how I like to setup Nethack on my Mac. However, more recently, some of the patches I had used stopped working on later versions of Mac OS (10.5 and 10.6). So I spent a bit of time looking into this today and I got some positive results. (update: I think the problem I had with Menucolor compiling was that it didn’t like the regexp method – I changed this to simply use the wildcard matching.)

Nethack with Status Colors and Menu Colors

Nethack with Status Colors and Menu Colors

Unfortunately, because the two patches I’m applying have resulting conflicts- it meant manually applying the patches to the source code in some cases (also: I’m lazy). I, therefore, don’t have an elegant method of actually applying the two patches that I can pass on. What I am doing instead is providing two things: The complete refined archive of the patched Nethack source which should be ready-to-compile on OS 10.6; And also the .diff file produced from a vanilla copy of the source and my own patched version. I will also provide my new updated nethackrc file. (ok… 3 things :-) )

Here’s some details about the setup this provides:

  1. The Status Colors patch is applied. This is a configurable patch allowing you to color code status effects – hunger, blindness, HP, Gold, AC, etc. It’s very, very cool! :-)
  2. Menucolors patch applied. This is a configurable patch that let’s you apply colors to popup menus. e.g. inventory items can be red for cursed, green for blessed, etc. Again, this patch is very neat!
  3. The initial configuration for getting Nethack to build on mac has been taken care of.

So Here are the links to get everything up and running. I should say at this point that this stuff works on my machine and YMMV. If something is broken and you want my to take a look at it just leave a comment of send an email – I’ll try to fix it if I have time. You may also want to dig through the changes in the patch.

  1. nethack-3.4.3-patched.zip
  2. nh343-_menustatus_orig.diff
  3. .nethackrc

I hope this is useful for someone who wants a nice shiny setup of Nethack on Snow Leopard. :-)

Programming , , , , ,

Eat the Jam!

November 1st, 2009

Ladies and gentlemen, May I present “Eat the Jam!” The only game which combines a high powered pop culture quiz with a taxing conserve based forfeit.

Self , , , , ,

Snow Leopard can DIAF

September 16th, 2009

Hurray! Apple fanboys should be pleased with the release of OS X, version 10.6. Snow Leopard panders to their desire for an all Apple platform. For the rest of us sensible users, Apple have screwed the pooch.

Okay, we have new shiny toys like Quicktime X and – well, that’s about the height of noticeable changes. I’m all for enhancing the user experience, but in this case, in my opinion, it has come at the expense of developer comfort.

What I’m referring to here is the lack of Java support in the new XCode 3.2. I’ve always felt that XCode was a fairly elegant environment for writing all C/C++, Java and Objective-C projects. So- why, Apple, would you arbitrarily drop support for a language? Out of spite? You didn’t even drop support – you just made it frigging irritating to use. Do you enjoy kicking your users in the nuts with each new release?

I’m not even surprised at this stage. I guess I could add the XCode templates back in manually but I’m more in favour of adopting a more portable command line build process… It seems the best way to get away from Apple’s user abuse.

Programming , , , ,

Windows updates

September 10th, 2009

I am forced to use a Windows based laptop in work and one of the more frustrating features is the updates that get pushed out by the IT ‘services’ group. Of course, updates are a good thing, but we do them during downtime when it won’t disrupt actual work. Here are the things I most hate about these Windows updates:

Do it now, or else.

There are updates available for your computer. You can install them now or they will automatically be installed in 15 minutes. After installation your computer will be restarted.

I’m sorry, were you busy?

As if point 1 didn’t irritate me enough (which is most certainly does), updates frequently occur right in the middle of a large task. Copying a large file or set of files is doomed to failure. In other cases the updates will simply interrupt anything you happened to be doing, forcing you to break your concentration.

Update Dependencies

OK, I’ll install your updates already! Tick, tick, tick… *reboot*
Your updates have been installed. There are new updates to install.

Yes, some updates rely on the presence of previous updates so it takes a couple of runs to get them all installed. which also means a couple of reboots; a couple more minutes of your precious day.

And one of my personal favourites: The “Your computer must be restarted dialog” which always stays on top of other windows. In case you forget.

Software , ,

Saving the World: The American Way

March 7th, 2009

Out of curiosity, I download America’s Army for Mac ealier. Having just completed the Basic training and M.O.U.T. exercise I would like to reflect on some of my favourite lessons so far:

  1. Use of cover: You may not discharge your weapon outside the active room.  Soldier, your mission is to charge screaming into the center of the room unloading single rounds from your weapon. Now go an be an American Hero!
  2. Flash Grenades: Flash grenades can be used to temporarily blind your foe, buying you an additional couple of seconds to clear the room.  However, it takes about 4 seconds to switch between grenades and firearm, so keep your finger on the trigger and prepare to open fire! (Why not send flash grenades in before entering the room? see poimt 1)
  3. Identification: In order to minimise friendly or civilian casualties, it is vital to quickly identify your enemy. Tip: They’re wearing balaclavas and bandannas. Son, the U.S. Army has always prided itself on telling the difference between friend and enemy!

Self , , ,

Fuzebox Kit

February 25th, 2009

I just ordered one of these kits :-)

Fuzebox Starter Pack

Fuzebox Starter Pack

The mainboard is supplied unassembled.

The fact that computers contain hardware is something I can normally overlook. Hardware can spasm out of control, fizzle and burn in impressive colours or simply die slowly, bit-by-bit (if you’ll excuse the pun). I’d be happy to own a computer that operated by magic: no parts – just an abstract concept.

Nevertheless, I’m still fascinated by hardware and have always wanted to try a little project. Having read most of “Hackers: Heroes of the Computer Revolution” now, I’m aware that among the first home computers was the Altair 8800. A kit machine where you would, typcally, buy the components and build it yourself. This was the norm, and, Hackers is full of little accounts of people hacking together hardware into a semblance of what we know as Personal Computers. Steve Wozniak is a notable example: Inventor of the Apple. The next generation Apple II would becomes one of the most popular computers for games hackers in the early 80s.

It’s always struck me as a time now past – today, infinitely more complex machines are fabricated in computer controlled environments. Even if you try to gather parts from vintage hardware, for a novice enthusiast it would be difficult to put together and perhaps more difficult to find connectors to make it usable.

Then I came across the link to this kit.  It’s an 8-bit console kit that seems fairly simple for a starter project and has good instructions. It seems just right for getting into some hardware work. The console itself (although only 8bit) uses S-Video or AV connectors and flash memory (instead of archaic co-ax cables and cartridges)

I’m excited to get started into a new (different) project! :-)

Self , , ,

Quick Org-Mode Hacks

February 25th, 2009

Recently , I’ve come to rely on Emacs for more or less everything I do on a computer. Of course, in work there are some exceptions: We must use Outlook for emails (the bulk), various windows only business tools (the cruft), etc.

But, as far as possible I will use Emacs because I love the simplicity, speed and extensibility.

In particular, I have discovered org-mode which has now taken over my personal scheduling routine. Org-mode is a personal planner for emacs which allows the user to: Create todo lists, schedule items for certain dates, mark items complete, use checklists, add tables. It’s impressive the amount of features this small, text-based operating system can offer.

So here’s some quickie hacks I’ve started working at for org mode. My wishlist is as follows:

  • [X] Store all org-mode schedules together
  • [X] Custom org save function (facilitating above)
  • [   ] Strip TODO/BUG/FIXME lines from source code and:
    • Store in org file called “<project name>”
    • insert links back to source file
    • add tags based on: language, filename, type

The third item is still in progress but I’ll explain my current org setup now and provide some expressions for the customisation:

;; Org Mode
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(setq org-log-done t) ;timestamp on completion

The first two lines create global keyboard shortcuts (key-bindings) which are available from anywhere within Emacs. ‘Ctrl-c l’ will store a link to a url or file, ‘Ctrl-c a’ will open your org-mode agenda (where you can view your calendar, appointments, todo items. This is the thing I have come to rely on :-) )

the add-to-list command tells Emacs to use org-mode by default for any file with a .org extension. the last line sets the org-log-done variable to true: This means that when we mark a todo item as complete it will be timestamped with the completion date. I like this feature.

So that’s just a bit of simple customisation. Now I’ll add a couple of functions that take care of saving my tasks.

(setq org-mode-file-dir "~/.emacs.d/org-files")
(setq org-agenda-files (append (list org-mode-file-dir)
org-agenda-files))

These two functions set variables telling emacs where to find org-mode files containing agenda items. The first is my own private directory added to behave as a default location for saving.

(defun smh-org-mode-save-buffer ()
(interactive)
(if (equal nil (buffer-filename))
(let ((input (read-from-minibuffer "Org Topic: " (buffer-name))))
(write-file (concat org-mode-file-dir input ".org")))
(save-buffer)))

Next I added a custom save function which simplifies the process of saving. If the current buffer is not already linked to a file (buffer-filename is nil) then it will prompt for an Org Topic. I like to think of organising things by topic. The default topic will be the name of the buffer if you supplied one previously. When a topic is given it will store the file as .org in the org-mode-file-dir. One the other hand, if the buffer is already linked to a file it will simple save as normal.

(add-hook 'org-mode-hook
(lambda () (define-key 'org-mode-map "\C-x\C-s"
'smh-org-mode-save-buffer)))

Finally I created a mode-specific key binding: I do this by adding a hook to org-mode… This means whenever org-mode gets called the hooked functions will also be evaluated. I have redefined the ‘save’ keystroke for org-mode to call my custom save function.

This is what I have so far and I find it quite helpful for organising Tasks and Todos manually.  My next step is to analyse source code and look for TODO, BUG or FIXME lines and create org-mode files automatically.

Programming , , , , , , ,

The Open Plan Office

February 20th, 2009

Right! This is a rant. I currently work in an Open Plan office. This is designed to encourage a better atmosphere where people can discuss things and collaborate? Or is it easier for a boss to keep an eye of who’s slacking off? Whatever the intention, I notice the following effects:

  • All barriers for sound are removed. This typically make the office very noisy. You are likely to hear: One half of a conference call, One half of a heated discussion about insurance or heating installation, sighs, coughs, yawns, shuffles, footsteps, coffee slurping, chairs creaking, necks cracking, fingers typing. If, like me, you tend to shift your attention quite rapidly it becomes a cacophony.
  • At any given time, there is at least one pair of eyes looking at you – and you are guaranteed to look back. This causes that awkward social phenomena of “mutual paranoia” wherein both parties stare at each other wondering how long the other has been watching.

What’s the alternative? I think individual cubicles is the other extreme. It encourages isolation (The geek in me just had a brief moment of excitement as I typed that, but the human in me wants to cling to the hairline cord of social adeptness). At Microsoft, I think they had a fairly good solution. The office was separated into cubicles, but each cubicle had 3-4 people… usually on the same projects. This means that sounds from elsewhere are well muted and you can still lean round for a chat with your colleague.

Well, the company I work for are hoping to move to new premises at some point in the near future. (Deliberate vagueness avoids trouble). I really want to suggest a move away from open plan but I don’t think the idea would be taken seriously: Next to MEETINGS it’s the best excuse for the lack of productivity!

Typed at 1am- please forgive spelling/grammar. :-)

Self , , ,

Maybe People are ready for Linux

February 7th, 2009

I just came across a video on reddit. Basically, two guys “demo Windows 7″ to an unsuspecting public in Australia. What the people don’t know is that they’re really looking at KDE 4:

This is really encouraging and demonstrates that people have this fear of things that are new to them. Linux is mature enough to be a desktop operating system in my opinion – but we need to break down the image of Windows. Microsoft have done half the work, How can we step up and say “Yeah, Vista was bad, Windows is going downhill, but look: there’s a great alternative!”

 

original article: here

Self , ,