we get signal

2009-08-25

Leveling up in Project Euler: Cube

(tags programming, Ruby, Clojure, Project Euler)

I leveled up in Project Euler! Woot! I'm now a Level 2 "(Regular) Cube".

Project Euler: I leveled up to a Cube!

I solved 59 out of 252, and 45 more than last time. BTW, when I solved the 25th problem, I awarded the "Regular Tetrahedron". These awards are part of the five Platonic Solids. Cool.

Project Euler: 59 out of 252 problems

I'm still using Ruby, basically Ruby 1.9.1 on Windows via the yet-to-hit-1.0-status RubyInstaller. It's much faster and smaller than the One-Click Ruby Installer, which is now officially dead.

I also re-solved some of the initial problems with Clojure. It's hard to wrap my head around it, though.

Now back to playing some games!

Labels: , , ,

2009-03-14

Discrete Math Achievements: Project Euler

(tags programming, Ruby, Project Euler)

I sure need to put these type of posts into my programming blog, but obviously I don't have one at the moment. Still check it, programming Achievements. A whole lot cheeper than DLC.

Project Euler, or You put Achievements in my Programming

Project Euler is a programming site that revolves around posing discrete math problems like finding the sum of all the prime numbers below two million (problem 10). You create an account for free, you fill in your attempted answer, and if you get the answer right, you get a green icon and access to the discussion forums on that problem. I think the best part is it shows your status in Xbox Live-like Achievement icons and also it shows how many people have solved the same problem. Plus the guarantee that the problems are posed such that you will be able to solve them in 60 seconds execution time using a modern computer gives me instant feedback.

I still have some work to finish just to shrug off my newbie status, eg. to reach first level rank I need to solve 25. The problems aren't too hard, though I am concerned that I am using I am brute forcing a lot using Ruby. Yes Ruby. Using Ruby feels natural to me, because the flow of thinking, typing, and running is uninterrupted (using the REPL inside Emacs is just golden). I am also trying to solve the problems in C++ (it's not that bad) and Clojure (actually haven't started yet). But first I explore using Ruby.

And here I am thinking I should be trying out Python because it has better multi-platform support (Windows is a first-class citizen), execution speed faster than Ruby, and I don't have a problem with whitespace as syntax. While I'm at it, I should just try on JavaScript and Common Lisp versions as well. Or go crazy and try to do it in AutoHotKey, Visual Basic 6 (this one pays money, I'm sad to say), Windows Command Shell, or even Gnu Bash. Yeah right.

These aren't really "push-ups" for regular programmers though, because I think they are far removed from regular application programming, which is just pretty much pushing data from one place to another. Plus I'm pretty sure there are no compiler questions, given that Euler manning the post. But I think it's great practice for thinking about efficiency vs premature optimization (at the design and execution level, etc).

Labels: , ,

2008-02-14

Code philosophy review

(tags programming, Ruby, Lisp, failure)

After the disappointment that was Paul Graham's Arc and the bewildering "Portrait of a Noob" by Steve Yegge, which insisted that comments and static typing are useless metadata, I found Planet Emacsen contributor Bryan Murdock's pointer to the discipline and punish blog a refreshing change.

No scratch that. I am questioning my reality now. That programming blog, which takes a practical and weathered engineer tone, has great links about questioning recent programmer fads, especially the current whipping boy (and my favorite comfort squeeze), Ruby.

All of these great posts I got from discipline and punish blog. Suffice it to say I subscribed.

I am afraid to post anything now about programming now. Best to just keep quiet and fap to Emacs.

Labels: , , ,

2008-01-19

New darlings? Ruby 1.9.0, Scala, Git

(tags programming, Ruby, Scala, version control, Git)

Here's some software related things bumping around in my mind.

Ruby programming language logo

Well the programming language Ruby 1.9.0 was released last month to much back-slapping. I've been sitting on this topic for the last few weeks, and not evidently learning very much, even though there was an native language interview between the two important developers on this release, Yukihiro Matsumoto, the original Ruby designer and Koichi Sasada, the sole person responsible for the 1.9 virtual machine. I originally referenced the Ruby Inside article "Ruby 1.9 Is Released", which had a link to a great side-by-side version testing post by Dave Thomas, but the InfoQ article "Ruby 1.9 - When Will It be Production Ready" gives a great overview after a few weeks of reaction. In short, it's not production ready now. :-( Yes I know that wasn't the point of the release.


I understand that the new virtual machine in Ruby 1.9.0 gives some better performance, but it sounds like NIH syndrome. What about Java's JVM, which has better multiprocessor and multithread support? Not that I know how to use it, but when I do, I'm sure glad that JRuby will be around to support it. Then again I haven't needed those things but I'm not writing those big trusty (web) apps. Okay okay, JVM is a whole other can of worms, and Matsumoto et al is good to stick to the platforms that he knows the best.

The part of programming blogosphere that fawned on Ruby on Rails and alternative programming languages is now casting a bright light on Scala, a programming language built on top of the JVM. I don't know anything about it and I haven't read anything yet that makes me want to use it. There is the theory that the programming bloggers making money and recognition off of books and teaching seminars continually look for the next language, decrying that you are missing the silver bullet (of the moment) if you don't pay attention. Personally I'm all for the invention of new tools, but I hate learning syntax all over again. DWIM, now. At least there are reviewers with loud blogs to read... yeah, I know I should evaluate it for myself.

Git logo for the Windows port git on Msys

Lately, I've been researching Git, the distributed source control management software invented by Linus Torvalds who is also the person who created the kernel Linux. (Does he really need my introduction?) It's been out for more than two years and is very stable because tens of thousands of users have been pounding on it every day. However only recently the Windows port that I want to use, git on msys, has been coming along really nice. Wow, the graphical explorer apps gitk and git gui now just works. I am still a Subversion and TortoiseSVN junkie, even introducing it at my work for the past 3 years because anything is better than zip files with dates on them. Ugh. Although one part of me cheers that many open source projects now are using Subversion instead of archaic CVS, another part wants them to skip to Git. Come on, everybody's doing it. Well it's not a black and white issue though, you can combine CVS with git, or Subversion with git, for example Git for SBCL Hackers (usually using CVS) by my Common Lisp source, Bill Clementson.

I don't think I can foist Git onto work at the moment. The Windows platform is really a second-class citizen from the Git developers perspective, and it shows when core operations break or refuse to function. Well it doesn't lose data, just that checkouts don't work, etc. I also test on a Linux OS-based VM, so I know true for various values of true. I've figured out how to expose a git repository via the web using Apache and WebDAV on Windows, which is my perferred way of publishing. I'm making a short checklist and questions that I want answered, and so far the evaluation is not very satisfactory. But I enjoy the concept of distributed, offline version control.

In fact git is just another straw on my camel-fied back that makes me question my Windows dependence. If I continue to play my game consoles, my primary reason for maintaining my home Windows machines is reduced. Recently I was disappointed that the version of Asus Eee notebook PC coming to Japan will have Windows XP Home installed, instead of a Debian-like Linux distribution. And my drool for the Macbook Air reminds me about how OSX is turning into a great programming development environment. Why should I continue to deal with Windows idiosyncracies? Oh okay, work is forcing me to use it and I like PC gaming (on occasion).

All this cursory exploration is putting me off of my goal of learning Common Lisp. Ugh.

edit: added some pictures, some links

Labels: , , , ,

2007-12-08

Steve Yegge on improving Emacs with JavaScript

(tags Emacs, Lisp, Javascript, programming, Ruby)

I must have been dozing off while reading his latest blog post the first time. Steve Yegge, formerly stealing thunder by writing a Ruby on Rails clone in JavaScript called Rhino on Rails, is now adding his touch to Emacs:

I should also mention I've been working on an Ecma-262 compliant JavaScript interpreter in Emacs-Lisp...

The short synopsis is that I'm building a complete JavaScript environment in Emacs-Lisp, with two goals: (1) create a world-class JavaScript IDE for Emacs, and (2) permit writing Emacs extensions in JavaScript, since (2a) people aren't exactly flocking to elisp, and (2b) JavaScript turns out to be a better language, now that I know them both in excruciating detail. Emacs is a great environment that needs a better extension language, and JavaScript seems well suited to navigate the popularity-vs.-elegance tightrope I'm faced with.

That's the elevator pitch: puts people to sleep in 20 seconds, guaranteed.

No, Mr. Yegge of Google and Effective Emacs fame, you have got me excited! :^)

I hate to say it, but despite the countless of hours I have been tweaking with it, Emacs Lisp is not a production language (though it must be really stable to be on version "22" (really though its version 1.22 but they dropped the 1 decades ago)). It sure doesn't have a great library situation. Then again, this infurates me because I thought Emacs Lisp "higher on the totem pole" than JavaScript, because of its macros and Common Lisp as a close relative.

JavaScript must be the world's most run language, though, because it is the basis for client-side interactivity in all major Internet browsers applications. It is Prototype-based language like Self, Lua (not just a scripting language in World of Warcraft, of course) and Io. JavaScript also lives as the Firefox extension language and as Windows Scripting engine JScript and countless other things. JavaScript allows you to flexibly model with object-orientation, but I don't see how this lets you extend the base language like Lisp macros. I mean, who wouldn't want the ability to redefine what "is" is?

;; Emacs Lisp
(flet ((is (&rest args) (what-I-define-is-is args)))
(what-was-the-question-again))

Since Yegge is only devoting 3 hours of time and will probably be able to release something in a year from now, I'll have time to bone up on more JavaScript and maybe I'll learn that I can rewrite "is" in Javascript and mean what I say.

// JavaScript
function (the_question) {
var is_original = is;
var is = what_I_define_is_is( arguments );
return the_question( arguments );
}(what_was_the_question_again);


Unfortunately this is the best I could come up with and it still doesn't do what I mean. :-/ Or is it Microsoft Windows Script Host 5.6 is unreliable? :-( Maybe I need this?

But you know what, there are already modules that allows you to write Emacs Lisp extensions in another language. For Ruby, there's el4r or EmacsLisp For Ruby. It's not as ambitious as Yegge though, because he's shooting for a JavaScript to Emacs Lisp byte code emitter and a IDE. I myself am not exactly writing Emacs stuff in Ruby though, despite my rabid fanboyism. :-(

Labels: , , , ,

2007-07-09

Rails again but actually making progress

(tags ruby, rails, web development, database)

I've been playing with Ruby on Rails again for my hobby blog. I was able to reformat my old database from PostgreSQL to Sqlite3 via manual Ruby scripting, because I find installing and maintaining PostgreSQL a hassle. Yes I know the installation has improved over the years, even on my preferred platform of Windows. (We'll see how much I miss the industrial-strength features later.)

I got three of the features I've been wanting for a while: readable urls, next and previous immediate post (which is like LiveJournal) and search. I created readable urls with the Rails Routing function. The next and previous functionality are from a simple database query. And search was pretty simple from the database function. It even search Japanese in UTF-8, w00t. Of course its the database doing the heavy lifting and not Ruby on Rails. I am worried though that the data input won't always be UTF-8 and thus corrupt my database.

Other things I want, in decreasing priority:

  • Web-based editor.
  • Permalink and link/image transformation system.
  • Atom 1.0 based XML feed.
  • Get my "we get signal" blogger posts into my system. (Blogger Backup Utility)
  • Reconvert existing blog posts to HTML 4.0 or XML compliant formats.
  • Text markup transformation ala Redcloth/Bluecloth.
  • Fully CSS'd design

But my ultimate goal is to output to a static webhost. I'm so Web 1.0 like that. Will I use wget to make it static? If so, how can I deal with making the web page generation incrementally change?

Or I should just go for a dynamic web host. Really I gotta research these things one of these days.

Labels: , , ,

2007-04-22

Lightweight people prefer Ruby and Haruhi

(tags presentation, Ruby, Japanese, English, China, criticism, anime)

Here's a "lightning talk" called "Diligent People. Lightweight people." done by Masayoshi Takahashi, chairman of the Nihon Ruby-no Kai, the Ruby programming language core and libraries developers (and support) group. (Thanks to _why's post "Chairman Takahashi in Taiwan") This is a rare English sample from the mainly Japanese presentation group.

Basically a lightning talk a short 3 minute speech with big kanji Powerpoint-like (or is it Evangalion-type?) visuals, usually on programming topics. Try it out here: "About Nihon Ruby no Kai" (日本Rubyの会について), but don't forget to maximize your browser.

Masayoshi Takahashi, chairman of Ruby no Kai, explains lightweight programmers prefer scripting languages like Ruby and contemporary Japanese art like Suzumiya Haruhi no Yuuutsu

So Takahashi makes an argument for lightweight ("lazy"!) people and processes instead of "diligent" people, but rather than spoil the humor I urge you to watch the video.

I realize when says "lightweight people prefer scripting languages like Ruby" he is expounding the strengths of unit-testing, dynamism, and less documentation, as much as a 3 minute talk can allow.

But his "lightweight people prefer Haruhi (light novel)" is just icing on the cake. He's definately not saying that Ruby is so like last year's anime, ie. old news. Still any programming language that can be associated with making people dance in the streets is novel.

Labels: , , , , , ,