Actually

It's Randolph Connor Berry

~~~ A journal of daily thoughts, hopes, and explorations ~~~
Archives

2012.05.20

Tradgedies

Tradgedies would be more dramatic if the flaw that led to destruction was also the character's strength

2012.05.17

Less vs. Sass

There's a post on Hacker News today comparing Less and Sass for CSS preprocessing.

I don't know enough about either of them to know which one to choose, but I know that I need to learn at least one of them.

More Less

Less plugins that seem useful

Possible Weekend Projects

I'd really like to accomplish one of these this weekend:

2012.05.16

Unfamiliar Languages To Learn

Here are a few languages that I've messed around a little with recently. They are all outside the C-derived paradigm, so I don't really want to focus on them right now. But at some point in the future I'd like to give each of them enough of a shot that I have a reasonable idea of their usefulness and strengths

Concurrency Languages / Frameworks

Here are languages I'm interested in as far as supporting significant concurrency.

I've been experimenting with Node and am fairly pleased with it so far. At some point I also want to spend more time with Erlang.

I've had a fair amount of fondness for JavaScript and Erlang for a number of years, so I think I'd be happy to be using either of them.

I can imagine writing prototypes of web-facing stuff in Node and then where necessary implementing backend stuff in Erlang. There might be other architectures that make sense in combining the two languages.

Go is a languages I haven't really used yet, but am trying to keep aware of. I'm not entirely sure how I feel about it yet. I like the idea of it, and the ideas expressed in it, but I'm a little wary of focusing on it yet. Go doesn't have a good story on Windows yet, which isn't really necessary, but I like languages that are fairly cross-platform. Also, it's interoperability with other languages is still low. That is, it can call C libraries, but there isn't really a good way for other languages to call Go code. As a result, for the moment at least I might be more likely to write low level stuff in C with the hope that it could be used in whatever other languages I work with.

2012.05.15

Essential JavaScript Libraries

Here's a list of JavaScript libraries that seem to come up really frequently as being useful to real people doing development.

I need to spend some time looking at these.

Other Interesting JavaScript Libs

A few other libraries I think are interesting, though not necessary.

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.

2012.05.11

Possible Weekend Projects

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:

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.

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.

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

Language Learning from memrise

Code Year from CodeAcademy

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 computering 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:

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

I really like this one. It has one of the best explainations of different numberical bases that I've seen. However, it uses NASM as the assembler and I'm concetrating 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 ...

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 syntac languages, which would be possibly the following list:

and possibly

That seems like a more managable 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:

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.

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:

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:

PouchDB

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

Stuff To Look At Someday

2012.05.03

Libs to Checkout

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

2012.05.02

Databases I Know How To Deal With

Databases I'd Like To Know

Things To Look Up

Check Out Sometime

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...

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.

2012.04.30

Things I'm Working On

Things I'm thinking about

Ideally this would allow you to deploy a particular script / set of scripts with a minimal node installation all packaged as an executable.

More just to see if I can get it to work, than because there's any real need at this point. I still like the idea of it being hosted on my own server, but I don't think it's a bad thing to also have a copy on a public repository.

Things to Look at:

Node based http proxy server. This should be useful if I want to run multiple node app servers behind one public endpoint.

Node handler for Mongrel2 webserver. Lets you front node apps with Mongrel2 (I think).

Things I'd Like to Look at / Do:

Today I Learned - tac and rev

I learned about 2 unix shell commands today.

The command "tac" will output a file in line by line reverse order.

The command "rev" will reverse a string each line of a file character by character.

I can see real uses for tac - in fact I am using it to generate the archive listing for this blog. I'm not aware of a real use for rev at this point, unless you wanted to test for palindromes using bash (Project Euler #4).

Initial Upload of Forth4Awk

I've put an initial upload of Forth4Awk up on github here.

I still need to do some work to figure out branching. I'm thinking about basically using a quotation mechanism to create code branches. This would push it more in the direction of Factor than real Forth. But this implementation already allows a little more flexibility in data types than normal Forth, so I'm kind of ok with that possibility.

Moving Last Load

We moved the last load of our shed tonight. So we are officially all moved ot of the old house now.

I'm waiting on the steps of the old house in hope that the black cat will reappear. He was here earlier but has not remained as we had hoped. I'm hoping if he comes back that I can lead him to the new house.

2012.04.29

Node Powered Blog

This is the first post on this blog that is now being generated via node.js. I'm pretty happy that I've accomplished that, although it did take me probably 10 hours of research and trying things to achieve basically the equivalent of what I accomplished fairly easily with PHP.

I think now, I could probably put a new system together with Node.js roughly as quickly as I could with PHP. So, probably at this point they are equivalent in terms of ease of deployment.

I'm glad I have this working, but if I'd known it would be this much effort, I'm not sure I would have gone through with this.

Things I Learned About Node.js / JavaScript

  1. fs.readFileSync() returns it's items without any default order that I can detect.
  2. Mustache.js (templating system) doesn't have any way to enforce ordering in collections, that I can tell.
  3. The Array object has a sort() method.
  4. The Array object has a reverse() method.

Moving Finished

We are finally out of the house. It's good to be out of the old house and into the new house. I've been fairly drained from all the moving this weekend. But I'm so thankful for all the help I've had from my friends. There is no way we could have made it without all the help we had.

Thanks to everyone who has helped us this weekend.

Powered By ...

Here are the various pieces that currently make up this blog system.

  1. Node.js - the javascript engine / framework that runs the static site generation, and also the webserver that serves the content.
  2. http-server - the web server written in node.js that actually serves the pages.
  3. Marked - an implementation of the Markdown html transformer for node.
  4. Mustache.js - an implementation of the Mustache templating system in JavaScript.
  5. Make to control the build process.
  6. w3m for previews before deployment.
  7. Vim for entering the posts.
  8. scp to deploy to the live server.

2012.04.28

Moving Day Really

Today is really when the moving day seems to have been for real. Five guys helped me move all the major furniture this morning. Now it's mostly a process of picking up little things, and then cleaning.

The cat hid for several hours. I was beginning to be afraid that she had run off or gotten hurt in the chaos. I didn't see where she could still be hiding after we had moved most of the stuff. But she finally came out.

I'm not sure what to do about getting her and the interloper cat, into the new place. She shouldn't be a problem but I don't entirely know how to tell the black cat that we've moved. Maybe it will follow me again. If not, maybe I will just pick it up and drive or carry it to the new place.

Node

I've been thinking about node.js since last night. I think I can probably use it to generate the site, as well as serve it. I still need to identify a good Markdown library for JavaScript.

I'm not sure it will be as concise as using php. But it shouldn't be too bad, and it will have the nice effect of getting me to work with a language that I like and an interesting framework. It will also mean that I am sing the same language for both the generation and the display of the content.

2012.04.27-B

Backlog of Old Posts

One of the reasons that I wanted to create my own blog software is so that I would have easy access to all of my old posts. Currently I have a number of old posts in a couple of online hosted blogs. I'm probably going to have to manually capture the data out of those.

My hope is that going forward, I can do a better job of keeping all of my posts available for any future blog format that I want to use.

2012.04.27-A

Testing a new post

This is a test to see what happens if I manually add a post other than my automatic daily post.

2012.04.27

Moving Day

Today is the day Jayne and I begin moving into the new house. This one has been nice, but it is really too small for us, and with a baby on the way, it's not practical to stay here.

Testing New Post Method

This a test to see if I can script a little of the posting processes.

Second Test

I'm not totally sure how best to deal with the idea of there being multiple posts on a day.

It is simpler to treat each day as it's own thing, but that makes it a little stranger when I think about how to do indexing of specific posts.

Static Blog Stuff

So far it looks like PHP is the way I'm going for the static site. Actually it's a Frankenstein concoction of make, bash, php, and possibly awk.

The primary benefit of this approach is that it's easy to add to incrementally. The danger of this approach is that at some point it may well collapse under the weight of all the hacks I'm doing.

There are ways in which the approach I was going after with Tcl would be cleaner, but for the moment this seems like it will work.

Node + Frankenblog

So, now I've added node.js to the set of things involved in this particular blog implementation. I know that if I'm using node as the webserver, that may sort of defeat the point of having a static site, but it was simple to set up a node webserver that just reads my static file.

I'll almost certainly have to rework this as I get more entries. But for now, I actually have a website up.

I could probably also have used any number of other small webservers, I've used cherrypy in the past and I like it, but I've seen occasional strange errors from chrome when using niche webservers. I may end up seeing the same issue with node.js but so far it seems to be serving the page up correctly.

Node Permissions

So, one thing that's not ideal with node is that running it on port 80 requires that it be run with Root privileges. It can drop to a normal user once the server object is created. But I haven't figured out a way to have it run under a normal user at port 80.

I can get it to drop to a normal user after it is started, but if I'm running it in a dtach session (or screen or tmux), I don't see a way to run that session under the normal user. Possibly if the user was able to sudo that could happen, but I'm wary of allowing sudo on my public server.

Testing Publishing

This is a test to see if my change to how this blog publishes actually works the way that I think it should.

Testing Seamless Publishing

Now I'm testing whether the scripts I've got installed will actually upload a post without a lot of manual work.

New Blogging Thoughts

I don't know whether I'll actually find this method of blogging to be easier than what I've been doing. I hope that it will inspire me to blog more, but it may be that it will only inspire me for a little while and then I will be back to being fairly passive regarding public writing

Node "http-server"

I found a package for node that implements a simple static http server called "http-server" (Exactly what it says on the tin)

I modified it to add the ability to switch to a non-root user if it is started as root (so it can server on ports less than 1024).

My version with the changes is here. The original is here.

Github Editing

I've been editing this node.js "http-server" package directly on GitHub. That's probably not the "right" way to do things. I'll have to look at actually cloning my repository so that I can just commit working code instead of potentially breaking things on the public repository as I'm playing around.

Blog vs Journal Format

I guess this is actually a journal instead of a blog.

I prefer to be able to read all the posts in a day chronologically. I think it makes sense for each day to be listed in reverse chronological order, but in a particular day, I have so many short updates (at least right now), that it really breaks the flow of thoughts to read a snippet, and then have to go back up for the next snippet.

I'm not sure how I'll communicate that to anyone that would actually read this.

Node for All

I am now thinking about trying to implement the pieces of this blog that are currently done using PHP using node. I don't really have any real need to do that. But I'm intrigued by Node, now that I'm using it.

Conceptually, there's a lot that I like about Javascript - it was one of the first languages that really gave me a feeling of joy to work with. But it's been years since I was really deep into it. So much has happened in that time.

At the time I was into it, jquery was just begining to be used. I developed my own Ajax library because I kept running into bugs in all the other ones that I tried around that time. JQuery was really the first JavaScript library that I came across that I was really impressed with. But it's been so long, that I really don't remember much about it.

2012.04.26

First Post

This is my first attempt at making a static blog using php.

I'm hoping it will work.

Second Post

Here I am trying again. I'm still trying to figure out what would be the best way to deal with what infrastructure I actually need to do a static blog.

I guess there does need to be some way to do individual posts instead of just putting them all on one page.

Third post

I've been playing with php and tcl for writing a static site generator. So far I'd guess they are about equal. There are some things I like more about how tcl operates and there are also things I like about the way that PHP works.

Tcl feels more dynamic, the way that I am using it. You basically have a database of entries, that you can interact with, and then when you are ready you can write out the entries.

PHP feels more static. You have files which get parsed and included by the master script. There's no interacting with the processing while it is occuring.