2012-05-13

Fortran

Listening to a compiler course lecture realized I’ve never really given Fortran a shot.

Fortran and Cobol are two old but still used languages that I really don’t know. I would like to take some time to look at both of these some time soon, at least somewhat.

Standard

2012-05-11

Possible Weekend Projects

  • node / ncurses based text editor
  • node cluster enabled http-server
  • node mud server
  • C based Forth implementation using Flex.

Is C++ Worth The Trouble?

I’ve been trying to decide if it makes sense to invest the time to learn C++ relative to the other C based languages I’m focusing on.

If I merely want Objects or collections, maybe it makes more sense to go to Java/C# than C++? But the advantage of C++ is that you get fast template generated collections with pointer semantics. However, maybe collections in Java/C# can simply be treated as arrays, which is not too far off in capabilities.

The coming changes in C++11 are enough that I’m having a hard time considering the extra cognitive load of keeping C++ straight as it diverges more and more from C.

So I guess the question is, can I use a smaller consistent subset of C++ that is useful to me, without hitting the dark corners of C++?

Things that C++ provides that I like:

  • Qt toolkit is a good cross-platform toolkit for GUIs and other system components
  • Templates and STL allow performant code without having to code datastructures myself.

Are those enough to justify moving from C to C++?

I could use Tk instead of Qt from C. It’s possibly not as crisp as Qt, but equally cross-platform and Tcl is full of useful utility functions.

Assembling 32-bit ASM on 64-bit Ubuntu

as --32 <source-file> -o <object-file>
ld -m elf_i386 <object-file> -o <executable>

C++ Tutorials

This might be a little long in the tooth now, but it was a site that I thought did a pretty decent job teaching C++ and basic Windows programming a while back.

Reliable Software

I believe the author has moved onto dealing with the D programming language these days (and some Haskell).

I’m trying to go through the WinAPI tutorial again, but the current Visual C++ 2010 Express isn’t liking some of the code (maybe I’ve got typos, I’m not sure).

It may be simpler for me to see if Charles Petzold’s Programming Windows has an initial test program.

Object Based C++ (C using Classes)

I wonder if it’s worth just using C++ as a C that can manipulate objects. Under that paradigm in general one wouldn’t create many new classes, but would simply use those already provided by the standard library or other 3rd party libraries. All the code created by the programmer would be essentially C style procedural / functionally composed code except that it could utilize the methods of objects and take advantage of the data structures in the STL.

I’m not sure that I would completely avoid defining new classes in this paradigm, but I would save them for the few new datatypes that were actually necessary and couldn’t be emulated using the already available data structures.

Standard

2012-05-10

Node Clustering

This website is served up by an instance of Node.js. Node.js is a webserver with an event oriented architecture that allows it to handle larger numbers of concurrent connections than some other architectures. However, because it is single threaded, each Node process can only use up to 1 cpu core.

So, I’m thinking about trying to modify the http-server package that I forked on github to enable clustering. Clustering allows Node to start multiple processes to handle the same workload. So, instead of having 1 Node process to serve this website, there would be 1 per CPU core and each worker would be responsible for serving out a subset of the incoming requests.

Standard

2012-05-09

Online Learning

I have recently been exploring various structured online learning resources. I think I may have taken on more than I can reasonably accomplish. The following are the list of topics/courses that I am currently trying to deal with…

Online Classes from Coursera

  • Machine Learning
  • Introduction to Logic
  • Automata
  • Compilers
  • Computer Vision

Language Learning from memrise

  • Japanese Alphabets (Hiragana and Katakana)
  • Japanese Kanji

Code Year from CodeAcademy

  • JavaScript Fundamentals

Graduate School

I’ve been considering for the past day or so looking at Masters programs. I’ve been looking at the Master’s degree in Mathematics from TWU and thinking that it looks like I might be able to get something out of it.

They have a concentration on statistical math and computing that seems interesting to me, and which I think would broaden my horizons.


Prolog

I listened to the first lecture of the Intro to Logic class and it immediately reminded me of Prolog. I’ve never really learned Prolog, so I went ahead and downloaded the gprolog and swi-prolog interpreters and played around with the first section of Learn Prolog Now.

So far, Prolog is obviously connected to logic, I don’t yet know how I would use it for anything useful, but I may keep playing with it, especially if I continue through the course.


Conceptual Models For Understanding

I have been thinking today about mental models that seem helpful in understanding the world. So far the models that I’m aware of having been helpful to me are:

  • Calculus – acceleration and rates of change
  • Supply and Demand curves in Economics
Standard

2012-05-07

Forth4JavaScript

I have ported my Forth implementation from Awk to JavaScript.

It was a fairly easy port, which gives me hope that my desired project to write a version of Awk (or an Awk like language) in JavaScript which extends Awk with some of the higher-order concepts in JavaScript may not be out of the realm of possibility.


Assembly Language Books

GAS Syntax

Intel Syntax

  • Assembly Language Step-By-Step (NASM)

I really like this one. It has one of the best explanations of different numerical bases that I’ve seen. However, it uses NASM as the assembler and I’m concentrating on GAS syntax for the moment.


Compilers

My goal with learning Assembly is to be able to go through Jack Crenshaw’s Let’s Build a Compiler series porting the code samples to use x86 assembly.

Reformatted PDF of tutorial here.

Jack Crenshaw writes his compiler using Pascal and 68000 assembly. It doesn’t look like it will be to difficult to use Gnu Assembler (GAS) syntax in place of the 68000 assembly instructions.

Also, Free Pascal seems to compile his Pascal programs without requiring changes.


Curly Brace Languages Reconsidered

Realized today that Scala might qualify as a curly brace language, which would bring the list of possible curly brace languages to …

  • C
  • C++
  • Java
  • C#
  • Awk
  • PHP
  • JavaScript
  • Go
  • Scala
  • Perl

That seems like an overly long list of languages to concentrate on, especially since there are a number of languages on the list that have non-trivial semantic divergences from C.

So, I’m thinking again about restricting myself to what I’m calling C-derived syntax languages, which would be possibly the following list:

  • C
  • C++
  • Awk
  • PHP
  • JavaScript

and possibly

  • Java
  • C#

That seems like a more manageable list. There are less real oddities to work around in the differences in those languages, whereas the earlier list had enough languages with real semantic differences that it would be hard to learn them all and keep them straight in the time remaining in this year.


Major Differences in C, C++, Java, and C

The primary places that the syntax of these languages differ from C or each other is in their handling of the following:

  • Objects
  • Generics / Templates
  • Lambda Expressions (anonymous functions / objects)
  • Inner Functions / Classes
Standard

2012-05-05

Node Tutorials

here


Denton Orchestera

Last night was the first concert of hopefully many of a new Denton professional orchestra.


read.js vs readline

I need to look up these two modules and see what the differences are and which is most reasonable to use for capturing stdin or a file line by line.

Standard

2012-05-04

Curly Brace Languages

A couple of days ago I said that I was only concentrating on C derived languages this year. I’m thinking about restating that as "Curly Brace" languages.

If that’s the criteria, the probably the following languages fit:

  • C
  • C++
  • Java
  • C#
  • Awk
  • Perl
  • PHP
  • JavaScript
  • Go

This seems like a fairly decent set of languages to have a grasp on. There’s a range of programming idioms possible in these, and most concepts in Computer Science show up in at least one of these languages.

Go and Perl are the most fringe as far as how closely their syntax tracks with the other languages on the list. Perl has some unexpected gotchas that have bitten me in the past, and Go seems a little mind-bending in terms of it’s coroutine support.


Languages For Next Year

At some point this year will end (Dec, 31, 2012 to be exact) and I will have finished my year of curly braces.

At that point I’m not sure what to concentrate on for the next year.

Here are a few possibilities that seem interesting:

  • Erlang – I have a deep fondness for this language, but have not really given it enough attention. It would be cool to go through Learn You Some Erlang.
  • Scheme and Forth – Both of these languages exemplify structures that show up in compiler substrates. I wouldn’t mind knowing how to implement either of them in detail.
  • Begin/End blocks languages (Algo derived?). I could find a number of languages in this catagory.
    • Ruby
    • Pascal
    • Lua

PouchDB

here – Interesting, a portable reimplementation of the CouchDB api, written as a layer over IndexedDB.


Stuff To Look At Someday

  • WebMachine – Erlange webserver
Standard

2012-05-03

Libs to Checkout

  • Stylus (CSS?)

Node.js Exec Shell Command

var util = require('util');
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { util.puts(stdout); }

exec("ls -la", puts);

Pandora Indian Music

I’ve been wanting to find a source of contemporary Indian music for a while. It’s one of the styles of music I find most enjoyable for background music.

Today I realized that Pandora has a "Contemporary Bollywood" station in their "World" music section.

I’m checking it out to see if it will work for me as background music for when I’m coding / researching.

It may have too much interesting stuff going musically on to really work as coding/reading music, I’ll have to see. So far a kind of electronic / trance music like what Andy Hunter does has been the best kind of music for me to actually get work done to.

However, I really like Indian music, so I’m happy at least to have found a source for when I’m not trying to work, even if it turns out to work only as general background music but not work background.


JQuery

I’m going to have to take some time to review JQuery if I’m going to continue to write stuff in JavaScript / Node.js. It’s been long enough since I did anything with JQuery that all I really remember is that $ does something. It’s a mark of how long ago that was, that at the time Prototype was the incumbent js library, and JQuery was the new young upstart.


MongoDB

Mongodb looks pretty interesting. I especially like their web shell tutorial for trying it out. I’m going to have to give it a chance. I’m not sure where it stands in the continuum of CoucheDB and Redis. I’ll have to take some time to see how it compares to those. I think it’s supposed to be pretty fast, but not as distributed out of the box as CouchDB


GIT Submodule Foreach command

This lets you do the same command on each git submodule under a directory (I think).

So,

git submodule foreach git pull

will update all the relevant submodules


CSS Handling Libraries

  • Less
  • Sass
  • Stylus
Standard

2012-05-02

Databases I Know How To Deal With

  • Oracle
  • MySQL
  • SQL Server
  • SqlLite

Databases I’d Like To Know

  • PostgresSQL
  • CouchDB
  • Redis

Things To Look Up

  • MongoDB
  • Whether Node.js and Erlang can work together
  • How do you query CouchDB
  • Less and Sass
  • Angular.js

Check Out Sometime

  • Vows – Async Testing
Standard

2012-05-01

Languages I’m Concentrating On

I’ve kind of decided that this year I’m going to concentrate on languages with a C derived syntax. So for the moment that means I’m focusing on the following languages…

  • C
  • C++
  • Awk
  • JavaScript
  • PHP

I’m haven’t decided if Java, C# or Perl fit the class of C derived syntax.


Node . Async File Reads

I figured out how to change my basic hello world blog server to read the blog file in a non-blocking fashion.

Basically instead of calling response.end with the file as an argument, you call file read, with a callback function that sends the data to response.end.

So it’s

fs.readFile('<filename>', '<encoding>', function (err, data) {
    response.end(data);
});

instead of

response.end(fs.readFileSync('<filename>', '<encoding>'));

It doesn’t matter because I’m using the http-server package which I assume already does that non-blocking, but I will check the code now that I’m thinking about it.

Standard