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

2012-04-30

New Blog

I have a new blog up now at http://www.connorberry.com. For the moment at least, new posts will be there rather than here. Maybe eventually there will be an RSS feed or something from that location.

Perhaps I will post here when there is noteworthy content at the other location.


Things I’m Working On

  • Getting a viable archive listing for posts.

Things I’m thinking about

  • Creating a packaging utility for Node.js applications.

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

  • Getting this blog to publish to github pages.

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:

  • Creating applications for KDE with Qt.
  • Creating cross-platform applications with Qt.
  • Create an updated Awk that is embeddable / extendable and has better support for large scale scripting

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.

Standard

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

  • fs.readFileSync() returns it’s items without any default order that I can detect.
  • Mustache.js (templating system) doesn’t have any way to enforce ordering in collections, that I can tell.
  • The Array object has a sort() method.
  • 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.

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

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.

Standard

2012-04-27

New Blog Attempt

I’ve been playing around with a new blog format at http://www.connorberry.com.

I don’t know if it will end up replacing this blog or not. I’d like it to in some ways, because I really want to have all the data from my posts in a place that I can get the data easily if I want to try something else.


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.


Post Order

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.


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.


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.


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.


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


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.


Testing a new post

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

Standard

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.

Standard

2012-04-24

I want a new Awk

Things I want in an Awk

  • Embeddable in C/C++
  • Extensible via C/C++
  • Module or include ability for other awk code
  • better local variable support
  • functions (and arrays?) as first class values (like in JavaScript or Lua)
  • better support for pipelines / coprocesses – either like |& in Gawk or in Perl.
  • No artificial limitations on open files etc.

I think that all of these things could be achieved without breaking compatitibility with traditional Awk syntax. I think a few possible syntax extensions could be added, but which would degrade gracefully into traditional awk when not used (basically a local variable syntax, and “’s or |&).

I think that making Arrays like Lua’s tables wouldn’t effect the current semantics, but would allow a form of object orientation, and modularization. Promoting Arrays and functions to first class values so they can be passed around, would also greatly increase their power.

Gawk already includes a basic file include mechanism. Something like that would probably be sufficient, as long as Arrays could hold function values for modularization.

All the rest of the items are really issues of architecture. I basically want to steal all the good stuff from Lua and backport it to Awk. Lua is ridiculously fast for a scripting language, I’d like to try to see that same kind of speed for Awk where possible. I’d like to turn Awk into a full scripting language that is capable of the same kinds of glue tasks that other full scripting languages can handle.

The only other major issue is licensing. I’d like this awk to be available under a BSD style license so that it could potentially be used in the same kinds of embedding scenarios that Lua is used for. Currently the most full featured awk (Gawk) is GPL, which limits the ability to embed it into commercial software.

Standard

2011-12-16

Emacs SSH

Just found an interesting trick with emacs that helps with moving around files when I’m using it via my phone over ssh.

Emacs movement keys use a leading Control character (C-n, C-p, etc), or you can usually use arrow keys. However both are a pain on my phone.

But C-x z is the repeat command in emacs, and after the first C-x z, you can just keep repeating z, and it will keep repeating the previous command.

So now I only have to do one C-p and then C-x z and can keep pressing z to go backwards by line in the file.

Again, mostly useful on my phone, but I use emacs from my phone a fair amount.

Or I could just enable evil mode and use vim style movement keys 🙂


Evil

Found out about evil-local-mode which seems like it is designed to do what I want, ie enable/disable vi keybindings on a buffer local basis. I think I’m sold on evil-mode for Emacs now.


Connorize vs Jaynify

Wondering about the linguistic tendencies or unspoken rules / guidelines that govern what is an acceptable way to form an adverb out of a noun. Not sure I’m using the correct terms there.

Standard