Composing generators in JavaScript

It’s really nice, how one can compose generator functions in JavaScript using yield* to delegate from one generator to another.

function* parents() {
  yield "Sonja";
  yield "Florian";
}

function* children() {
  yield "Linda";
  yield "Mathea";
}

function* family() {
  yield* parents();
  yield* children();
  
  // And not to forget...
  yield "Grampa";
}

for(var name of family()) {
  console.log(name);
}

Output:

Sonja
Florian
Linda
Mathea
Grampa

Accessing Context Initialization Parameters in JSP page

Wow, took me over half an hour to find out how to access Context Initialization Parameters directly in a JSP page. Simple, if you know how. I wonder, why this is so badly documented. Anyway, here’s how:

${initParam['PARAM_NAME']}

Source: http://www.informit.com/articles/article.aspx?p=30946&seqNum=7

Sharing GIT repositories with SSH for Mercurial users

I have used Mercurial for a lot of my private projects now and was always very satisfied with it. It’s a great source code management tool. I am working with different machines, so I need a shared repository to get access to the latest revisions everywhere. Since I have a virtual machine hosted at Linode, I setup a user named hg with SSH access. Now for every new project I created a directory inside the home directory of the hg user. Then I cloned the local project to the directory on my virtual machine. The cool thing with Mercurial is that you can clone in any direction not only from extern to local but also your local repository to an extern one. Just call hg clone . ssh://hg@hg.example.com/myproject to clone the current project to an SSH share. And from that point on I could easily push and pull to and from the SSH share.

Now since the whole developer world seems to move toward GIT I wanted to get some experience with it and use it for my next project. But I had some trouble to set up a shared repository with a SSH account. I had to do quite a bit of research to find the solution. So here I go:

On the server:

  • Create a directory for your project, i.e. myproj
  • cd into the this directory
  • Execute git –bare init

On the workstation:

  • Add the project to a local git repository of not already done
  • Execute git remote add origin git@git.example.com:myproj
  • Execute git push origin master
From now on you can fetch and merge changes from the server and push your changes to the server.

Quotation

I think phones have capacitive buttons for the same reason laptops have reflective screens, and TVs in stores have their brightness and contrast turned all the way up. It looks really cool when you see it in a store, and you don’t notice how screwed up it really is until after you’ve already bought it.

http://ignco.de/389