Archive for the 'Other crap languages' Category

11/23 Woops

> How can I write a regexp to match CJK characters?
> Thanks in advance:)

print “Yes!” if varname =~ /^CJK$/

Needless to say the helpful(?) dude providing the unhelpful regex/ruby code was a proud citizen of ASCII-land… Mwahahaha!

03/09 Programming, 빨리빨리, and Translation

Appart from a couple of inaccuracies, this is a good translation of Teach Yourself Programming in Ten Years by Peter Norvig. That a document which starts with the question Why is everyone in such a rush? was translated into Korean – and the link to that translation is at the top of the list… – is definitely amusing, since we know the maladive penchant our [ex-]hosts have for speed over accuracy. If you’re learning Korean, it’s a good sample to work from.

Learn at least a half dozen programming languages. Include one language that supports class abstractions (like Java or C++), one that supports functional abstraction (like Lisp or ML), one that supports syntactic abstraction (like Lisp), one that supports declarative specifications (like Prolog or C++ templates), one that supports coroutines (like Icon or Scheme), and one that supports parallelism (like Sisal).

Hmmph. I guess that list could use some upgrading, since the hype languages of the 21st Century are mostly not in there, and at least one language quoted here [Icon] is not developed any longer – which is a shame, I like Icon… As for Prolog, was it ever alive? ;-)

Python will match a few categories here, my favorite, RB, too, Erlang will cover a lot of ground for you here – not that I am conversant [yet!] in Erlang, but I’m learning! – and while C may come up short, most of these languages were/are written in C. Of course, if you aim to achieve stable and well-performing concurrent programming in C, you’ll end up with Erlang, as they say… :D I don’t think I’ll ever wrap my head around Lisp/Scheme – not that I didn’t try… – and I find Java and C++ repulsive and offending, but it’s probably just a matter of taste and education [or lack thereof…?].

But in the end, be it computer languages or human ones, 10 years is a minimum. Practice makes good, and education alone won’t take you very far [case in point: the profs I had at the Uni. You could tell those who had practiced their language skills and those who had kept their knowledge at the academic level…].

Anyway, this is an attempt at tagging

04/21 Looking at Mono

Make that staring at Mono. I have download the Mac OS X distro, played with the sample projects from Mono: A Developer’s Notebook ($16.47 at Amazon), read a couple of articles.

Hmmm… This C# thing looks like a text-based between C, Python and RB, with plenty of curly braces, but sans RB’s IDE :-( [I mean, try once RB’s IDE, and they’ll pry it away from your dead fingers…]

See this:

// 03-keyfunc/03-regex
using System;
using System.Collections;
using System.IO;
using System.Text.RegularExpressions;

public class ParseHosts {
public static void Main(string [] args) {
string filename;
if (Environment.OSVersion.ToString().StartsWith(”Unix”)) {
filename = string.Format(”{0}etc{0}hosts”,
Path.DirectorySeparatorChar);
} else {
filename = string.Format(”{0}{1}drivers{1}etc{1}hosts”,
Environment.GetFolderPath(Environment.SpecialFolder.System),
Path.DirectorySeparatorChar);
}

if (!File.Exists(filename)) {
Console.Error.WriteLine(”{0} does not exist.”, filename);
Environment.Exit(1);
}

string text;
using (TextReader reader = File.OpenText(filename)) {
text = reader.ReadToEnd();
}

Regex regex =
new Regex(@”(?(\d{1,3}\.){3}\d{1,3})\s+(?(\S+))”);

MatchCollection matches = regex.Matches(text);
foreach (Match match in matches) {
if (match.Length != 0) {
Console.WriteLine(”hostname {0} is mapped to ip address {1}”,
match.Groups[”name”], match.Groups[”ip”]);
}
}
}
}

Nothing really perturbing here, right? In played a little with

monodis

to take a peek at the bytecode. Almost readable.

Hmmmm….