Sunday, November 27, 2011

Setting up GNUstep in Windows

GNUstep is a wonderful project that aims to replicate Cocoa APIs for a variety of Unix-like OSes and Windows. In effect this lets you get started playing with Objective C and a coding environment similar to Xcode, without owning a Mac or resorting to illegally running OSX on non-Apple hardware.


I've only just begun, but the whole GNUstep project seems more solid than I expected (although about as ugly as I'd expect from a GNU project).


It wasn't completely clear where to begin, since there are several different pages talking about GNUstep, ProjectCenter (the visual project builder), and Windows. So here is what I ended up doing to get started. I'm on Windows 7 64-bit.



  1. http://www.gnustep.org/experience/Windows.html has good instructions on getting started on Windows. (Unfortunately to use ProjectCenter, you can't use the latest GNUstep versions since they're incompatible. As of this writing, GNUstep 0.29.0 stable was released very recently in Nov 2011, while ProjectCenter 0.60 was released December 2010. Since I mainly cared about using ProjectCenter, I chose the GNUstep versions that were released prior to ProjectCenter 0.60.)
  2. Download from http://ftp.gnustep.org/pub/gnustep/binaries/windows/
    1. gnustep-msys-system-0.25.1-setup.exe (July 15, 2010)
    2. gnustep-core-0.25.0-setup.exe (May 15, 2010)
      
      
    3. gnustep-devel-1.1.1-setup.exe (July 15, 2010)
    4. SystemPreferences-1.1.0-1-setup.exe
    5. gorm-1.2.12-setup.exe
  3. Install the exes in the order downloaded, shown above. I used the default C:\GNUstep target.
  4. Download ProjectCenter 0.6.0 tar.gz from http://ftp.gnustep.org/pub/gnustep/dev-apps/ into e.g. C:\GNUstep\home\Andrew
  5. In your Start menu, run "Shell" under GNUstep. (I renamed this to "GNUstep Shell" to be more sensible for Windows 7 start menu autocomplete.)
    Note: Non-administrator users must right-click and choose Run as Administrator (thanks Winston Lee).
  6. Install ProjectCenter
    1. Untar ProjectCenter--from the shell: tar xzvf ProjectCenter-0.6.0.tar.gz
    2. cd ProjectCenter-0.6.0
    3. make
    4. make install
  7. Run ProjectCenter from the shell (just type ProjectCenter)
  8. Run gorm from start menu.
  9. Follow tutorial at http://www.gnustep.org/experience/PierresDevTutorial/index.html
    1. ProjectCenter doesn't recognize gorm for some reason, which is why I have to run gorm separately.
    2. Also, builds don't work from within ProjectCenter, but thankfully GNUstep generates makefiles for everything, so from the GNUstep shell you can just type "make" inside your project, and it'll generate a ProjectName.app directory for you. Inside that directory, you'll find Windows binaries to run the app.
I'm really excited about this, because although I do intend to do a bit of development, and of course builds, for iOS apps using a Mac, GNUstep gives me a bit more choice where I want to do development from.

One more thing: there are other projects that go along with GNUstep. See https://github.com/ANindie/cocos2d-GNUstep for a work-in-progress cocos2d port. Given that cocos2d-GNUstep is written and tested on Ubuntu, maybe I'll want to use Ubuntu instead of Windows for this stuff.

Sunday, November 20, 2011

backbone.js nice new logo

I just noticed the new backbone.js logo (edit 2016-12-05: old link was http://documentcloud.github.com/backbone/). Very professional looking!

Old logo:

New logo:


Wednesday, October 26, 2011

Brainstorming Aesthetics

Yesterday I posted[1] about "writing it down" as an obvious and simple methodology that should not be skipped. Well, looking through my EverNote notes I realize I did start writing things down at the beginning. One problem with those notes, though, was that they're just stream-of-consciousness, mixing different levels of detail in too many words. Reading the notes from start to finish makes them understandable, but they did not serve to add structure to my thoughts. Instead they only served the purpose of leaving a record.

A better, structured brainstorming approach does the following things:

  1. Uses concise wording.
  2. Uses symbols and pictures, avoiding prose, when appropriate.
  3. Breaks out levels of detail into separate groups. Programmers should be adept at this.
  4. Lays out ideas to facilitate reorganization. One reason electronic brainstorming is very powerful.
  5. Gives multiple "entry points" for re-examination. If your brainstorm requires reading from top to bottom to make sense, then it's not as good as it can be. More entry points mean more opportunities for additions and updates in the future.
As an example of #3, breaking out levels of detail into separate groups: if a server needs to generate a token and send it to the client as part of some process, that's all I need to say for the top level. How the token is generated may belong to a different level of detail. Writing both together muddles the intent, and makes the notes difficult to read.

That's all I can think of now. If you have more suggestions, let me know.

Tuesday, October 25, 2011

Write it down

Recently I was thinking through a programming problem in my free time, for several days. (Authorization of purchases and content delivery.) After a week passed, I knew I had considered all the different cases, but couldn't get the whole flow pictured in my head. At each step of the authorization process, different issues come up where either a legit customer may lose data, or a pirate gains unauthorized access to content.

I was reluctant to write things down on paper (or electronically), since I felt I needed many changes to get it right. Writing it down would only add more overhead as I changed the design around. Unsurprisingly, I have a similar sentiment towards test-driven development, where in many cases the project being built out is too uncertain in requirements, and new features may be desirable later on, such that writing tests up front only adds overhead later on. Unit testing in general, though, is highly desirable.

After the week passed, I was at the point where I wanted to write down the design, so I could pick at it without spinning my wheels thinking about the same scenarios over and over. As you've probably guessed, writing it down helped me immediately see a couple problem spots and get the design down from start to finish. It also helped to have visual separation between the components of the process. In my head I would jump back and forth between components, like initial purchase versus restoring purchase history, trying to think "where can I reuse this security token and when do I need to generate a new one?" and things like that. Writing it down, even in just simple numbered lists, helped me split up concerns and stop wasting mental energy juggling different pieces.

The message of this post is hopefully obvious to most people, and even for me it is something I've learned and relearned many times over the years. It's just times like these, when my pride creeps up on me and makes me believe I can handle thinking all the way through moderately complex designs in my head, that I disregard an obviously useful methodology.

Thursday, October 6, 2011

backbone.js: Model.initialize() is called at the end

When is Model.initialize() called in backbone.js?

Just a quick post to indicate that in backbone.js, Model.initialize(attrs) is called after everything else is done, like setting the attributes if you passed them into the constructor. I'm only writing this down because it took me a few minutes to find the answer. I had to look at the annotated source.

The docs, and some blog posts, only say things to the effect of "you can provide an initialize function, which will be called at the time of construction" which is ambiguous--is it before or after the attributes are set on the object?

But now that I know the answer, I realize it doesn't matter--I don't want to be designing initialization code that is so fine-grained that it matters whether I set the attributes once or twice.

Wednesday, June 8, 2011

Ubuntu 10.04: Failed to compile rebar files! (redefining macro "DEPRECATED")

Update July 2011:
Install Erlang R14B03 and use the latest rebar from github. It now works.
(Thanks enri for commenting.)


Ignore old stuff below:

I was getting this error trying to compile rebar for Erlang project management:

Recompile: src/rebar
include/rebar.hrl:17: redefining macro ''DEPRECATED''
Failed to compile rebar files!

The only google result was http://www.zelfendo.tk/blog/?p=433 in Chinese.

The summary of how to fix:
  1. Don't use https://github.com/basho/rebar; do use: hg clone https://bitbucket.org/basho/rebar
  2. sudo apt-get install erlang m4 fop xsltproc unixodbc libssl-dev unixodbc-dev openjdk-6-jdk freeglut3-dev libwxgtk2.8-dev libncurses5-dev build-essential

Sunday, May 15, 2011

Encounter with a House Centipede

It was almost pitch black, with a faint light streaming through the makeshift curtain--a white sheet hanging from the gated window. I awoke to the loud sounds of the toilet flushing. Oh my god who's in my apartment? It's still going.... Oh, they must be working on the building plumbing again. What the hell, it's like 3 or 4 am!

I drifted back to sleep. Dreams about shady businessmen out to rob me, and puppies.

I was slowly brought back to the waking world again when I felt an itch. It grew stronger, until I was finally pulled into consciousness. I felt its dozens of tiny legs tickling my neck. I rolled away and quickly jumped up from my mattress pad on the floor. There was an inch-long thing scurrying about where I was just laying. It was making figure eights and not seeming to be headed anywhere. Of course I wanted to get a better look at whatever it was that was just having relations with my neck, so I turned on the light. It quickly scampered into a hole in the wooden floor beside the heater. I should tell the super about that bug and that hole. Maybe I should buy some pesticide myself at the hardware store, and pour it into the hole. Argh, the store opens at 10am. Hmm, may as well look up what kind of bug it was.

And so I turned to trusty all-knowing Google and searched for various terms, "identify insects nyc", "black and white striped legs insects" (since it seemed to leave a leg behind which I picked from my neck). A pretty useful exterminator site was the first hit. After not being satisfied with the results, though, I figured I'd give up and leave it for another day. Since it came from a hole in the wood, maybe it was a carpenter ant?

I mindlessly threw the insect leg onto the floor, figuring I'd sweep it up later. After a minute or so, I saw the thing crawl back out of the hole and come towards me again! Did it detect its leg? It stopped at the edge of the mattress pad, in the shadow. And it just sat there. Now was my chance--I grabbed some paper towel and SMASH! Deaded it.

I picked up the carcass and examined it closely--looked like it had a lot of legs, most of which were detached. And a cucumber-shaped body. Reminded me of a centipede, so I searched Google Images. And yep, that was exactly right. After more searching I determined that these house centipedes actually hunt other insects and are not harmful to humans. Dammit!

Worth reading if you want to know more about house centipedes: This guy's page was also a Google search result. He seems to have had a long history with these house centipedes during his residence in NYC.

Oh yeah, and before lying down again, I noticed about 6 more legs just lying there in the middle of my mattress pad.

Saturday, May 7, 2011

Opening Electric/Gas account with ConEdison

Since I'm moving to my own place for the first time, I'll write a series of posts about dealing with the various companies involved.
First thing was of course dealing with brokers and the apartment management, but I'll save the post about that for a bit later. (I have had a good experience with both so far.)

Dealing with ConEdison was extremely easy. Just called 1 800-75-CONED (1-800-752-6633) at which point I was directed to call 212-243-1900 since my cell phone area code is outside NYC.


So I called the second number, tried using the Express self-service phone option, but when I pressed 2 to open an account and 1 to say I was not a current account holder, I was redirected to the waiting queue again, and was put on hold for about 15-20 minutes (probably reasonable for 10am Saturday in early May). Then  the guy answered, didn't catch his name though. I told him I wanted to open a gas/electric account.


He took down my address, borough (Manhattan), phone number, and social security number. Asked about things like if I needed special consideration for always-on electrical equipment for health purposes. Asked if the electricity was already on, which it was. Asked for move-in date, which was May 3 this year. Asked if I wanted a 7% discount on this thing where I select a particular electric company; I didn't know what it was, even after asking him I was unclear, so I declined. Didn't provide my email address, since I asked about it and he said there would be some promotions sent along with regular notifications. He asked about direct billing, which I declined, since I will probably enroll in e-billing instead.


And that was that. Extremely simple, hassle-free setup of standard utilities with a large company.

Monday, April 18, 2011

Glasses from zennioptical.com

I just received my new glasses from zennioptical.com. It was $32.95 for one pair. It's a decent-looking frameless style, without any special add-ons like extra-thin lenses or anti-reflective coating. I got the standard Single Vision lens (as opposed to bifocals or progressive lenses), and the 1.57 Mid-Index lenses which were a free upgrade from the default 1.50. (The 1.57 lenses are a bit thinner and lighter.) The "extra strength" charge for astigmatism came out to $9. Shipping & Handling was $4.95.

So far they are great. When I first put them on I felt some dizziness as expected. The lenses were smaller than I am used to, so I seem to keep peeking past the lenses. But I'm quickly getting used to them, and for the first hour I have been extremely pleased with the value. Basically for a 2 week wait for the shipping, I got a 90% discount for a decent pair of glasses (that luckily fit me very well too).

Measuring the pupil distance (PD) was simple: get a friend to measure the distance between your pupils using a millimeter ruler, while you stare straight into the distance. My PD was 60 mm, which is pretty average.

Anyway, it feels great to finally get a new pair of glasses after years with my old pair. My left eye feels so good getting the boost it needs. I'm looking forward to not having headaches from having one weak lens.