Posted by Lena Herrmann Wed, 27 Oct 2010 14:02:00 GMT

I'm happy to announce the immediate availability of my thesis! It was handed in in July 2010 as my diplom thesis in the academic program of Media Informatics at Beuth Hochschule für Technik Berlin (University of Applied Sciences). A German Diplom is comparable to a combined bachelor's and master's degree. Originally it has been written in German, so I'm very happy it's also available for English speaking readers now: thanks a lot to the awesome Sander Van de Moortel for translating it into English, and to CouchOne for sponsoring the translation. Read also my thank you notes for more gratefulness.

I hope the thesis is an interesting read and useful for your research or development!

9 comments |

Posted by Lena Herrmann Mon, 11 Oct 2010 15:34:00 GMT

If you have a couchapp and want to have nice URLS, go read this blogpost. If you still don't get it, here is how to do it. It doesn't work with my outliner app, because it is so entangled with old couchapp and jquery.couch.js versions and I'm not up to upgrade hell right now. But I'll write it down for my next project and for you, yay.

Let's say you have an app running at http://account.couchone.com/mydb/_design/doingnotes/index.html and want to add the additional URL http://account.couchone.com/index.html. First you have to set up a virtual host. (Want to know why? Go back read the blogpost). If you are using a hosted CouchDB instance and don't have access to the local.ini file, you can also do this remotely:

3 comments |

Posted by Lena Herrmann Thu, 05 Aug 2010 10:41:00 GMT

I'm done!! Three weeks ago I handed in my diplom thesis. The practical part was the design and implementation of a distributed, replicatable outliner with the NoSQL database CouchDB. As theoretical work I evaluated Distributed Systems, CouchDB, various web technologies and programming strategies. I still have to pass the oral exam, but my degree is finally very close - soon I can call myself a graduated computer scientist. Yay!

As soon as academic procedures allow it, I'll publish the text and the source code of the thesis here. Until then I'd like to say thank you to a few people. As the foreword of thesis won't get as much attention as this blog, I'll do it here.

no comments |

Posted by Lena Herrmann Thu, 20 May 2010 11:20:00 GMT

I'm currently writing my thesis, using LaTeX. As the programming part of my thesis was mostly done in Javascript, I have to include some bits of Javascript source code in the LaTeX document. For this I'm using the listings package. With this package you can "include the source code of any programming language within your document". Unfortunately Javascript is not in the list of supported programming languages. (In return, the list contains languages like Oberon-2, Promela or RSL, which are probably being used way more often than Javascript ... er.)

Luckily @awendt pointed me to these links: Javascript Quelltexte in LaTeX and a thread on a mailinglist. I changed those examples only a bit, I'm posting my result here mainly in the hope it will produce a Google hit for "javascript latex source code" :-)

10 comments |

Posted by Lena Herrmann Thu, 29 Apr 2010 10:40:00 GMT

I recently wrote a testsuite for CouchDB's Javascript HTTP API. Among the things I tested were the security methods. That's those that deal with authentication - like signup, login, logout and so on. The challenge was to make sure my tests wouldn't interfere with the CouchDB setup of the person running the tests.

Background

CouchDB stores the information about the database users in a special database, the authentication_db. The default authentication_db is called "_users". So this is where your user data is saved when you sign up without taking care about the details, e.g. when you use the signup method provided by the JQuery HTTP API. Read more about the ways to interact with the authentication_db in the HTTP API documentation (JQuery methods), and read more about general CouchDB security in the CouchDB Wiki or in The Definitive Guide.

How to set the authentication_db

When you e.g. create database users from within your tests, how can you make sure they don't mess up the actual authentication_db, the one the unsuspecting user might use in production?

no comments |

Posted by Lena Herrmann Wed, 28 Apr 2010 12:07:00 GMT

CouchDB is a database that I quite like. In fact, I haven't done much else this winter, as the programming part of my thesis involved diving into many of CouchDB's features. I had just finished my little program and was desperately looking for an excuse not to start writing the thesis. Mercifully Jan from Couchio came along and asked if I wouldn't like to write a testsuite for CouchDB's Javascript HTTP API, and the documentation with it. I wanted!

What is this HTTP API?

If you have worked with CouchDB from a Javascript program before (eg Sammy.js is a good companion for a simple web application), you have probably used the methods a file named couch.js provides. With this interface you can easily access the most common CouchDB functionality without having to handle the XMLHttpRequest yourself. It allows you to create a "database object" and then perform things on this object, for example save or delete documents:

3 comments |

Posted by Lena Herrmann Mon, 22 Mar 2010 12:52:00 GMT

Last thursday I gave a talk at the monthly meeting of the Berlin JS Usergroup. I was talking about JSpec, a Javascript Unit Testing framework. Thanks to all who were there to listen and ask questions!

Here are the slides. When you have a look at them, make sure to also read the notes (next to the comments), so the slides make sense to you.

To find more information about JSpec, check out the README on github, or read the blog post I wrote about it recently.

1 comment |

Posted by Lena Herrmann Mon, 15 Feb 2010 16:17:00 GMT

How to refactor a long chunk of asynchronous code is one thing I learned during my Javascript & CouchDB project. It's not a difficult thing, but I thought it was before I figured out how to do it, so I guess it might be interesting for Javascript newbies.

Asynchronous code

In the first couple of weeks I struggled with this new style of coding before I got the hang of it. If you're fairly new to Javascript, you're probably used to just assign a variable in one line and use it in the next line. In the asynchronous world you query for a value and do stuff with it in the callback function of the query.

To illustrate - "normal" code looks like this:

2 comments |

Posted by Lena Herrmann Sun, 31 Jan 2010 21:22:00 GMT

All green!

One major pain at testing with culerity so far was a HtmlUnit bug that causes a ScriptException with PUT AJAX requests in jQuery. When you tried to test an update you got a "java.lang.IllegalArgumentException: The content cannot be null". Fortunately, this bug is fixed now. With latest HtmlUnit build culerity should run fine, and I tell you how.

I assume you have culerity installed already. If not, follow these instructions for testing Rails apps or these for testing Couchapps.

no comments |

Posted by Lena Herrmann Mon, 04 Jan 2010 12:07:00 GMT

Selecting a unit test framework for a JavaScript-only application - not a task with an obvious answer! Coming from the Rails world, where most people work with either TestUnit or RSpec, I was a bit lost when I started researching. This table on wikipedia was quite helpful for a first overview. But: JsUnit, JSTest, jsUnitTest, jsUnity - these are actually different frameworks, and there's even many more ...

I narrowed the selection down to those being currently developed, or are in use in "big" projects. JsUnit seems to be one of the major players, but I found almost no documentation, and the code base hasn't changed a lot in the last years. That's not a negative thing in itself, but having an active community around is a good thing. QUnit is used for testing JQuery, it looked like you could work with it as well, but its syntax and setup didn't make me go "wow" exactly. Same goes for JQUnit, about which I had read good stuff in several blog posts. It's also what Sammy.js is tested with.

I like RSpec, so when I had my first look at ScrewUnit, I was delighted to find there's BDD syntax for JavaScript too ...

4 comments |