KOPIS.DE http://lifestream.kopis.de/feed en-us http://blogs.law.harvard.edu/tech/rss Sweetcron carsten@kopis.de Sleep graph http://lifestream.kopis.de/items/view/1513/Sleep-graph

cringe

]]>
Tue, 21 Feb 2012 21:01:00 +0100 http://lifestream.kopis.de/items/view/1513/Sleep-graph
Trigger und Motivation http://lifestream.kopis.de/items/view/1512/Trigger-und-Motivation

Diese Woche will ich etwas neues ausprobieren, um mein Training wieder auf Kurs zu bringen. Nachdem das mit dem Kalorienzählen schon ganz gut klappt, will ich meine Trainingsfrequenz steigern und deshalb hab ich etwas über meinen Tagesablauf nachgedacht. Im Prinzip sieht der so aus:

Aufstehen Arbeiten Nach Hause gehen/Einkaufen Training Film gucken oder an meiner Ruby On Rails Anwendung basteln Schlafen

Jetzt ist es aber so, dass ich mir durch jahrelanges Training im Fitnessstudio die Verknüpfung Zuhause == Rumlungern angewöhnt habe. Diese Verknüpfung muss ich jetzt wieder entfernen. Weil das aber schwer bis unmöglich ist, will ich die Verknüpfung jetzt mit Zuhause == Training überschreiben.

Dazu setze ich einen neuen Trigger, der mich in den Trainingsmodus schalten soll. Weil ich besonders gut auf Musik reagiere, habe ich mir dazu Eye Of The Tiger ausgesucht. Mein Plan sieht jetzt so aus:

Nach hause kommen Eye Of The Tiger anschalten Umziehen und trainieren Rumhängen

Damit kann ich hoffentlich die alte Verknüpfung lange genug überschreiben, damit die neue Verknüpfung Vorrang erhält. Im Moment wechsel ich immer zwischen beiden Varianten hin und her, vor allem, wenn ich zu Fuss nach hause gehe und auf dem Weg andere, weniger aufpeitschende Musik höre...

]]>
Tue, 21 Feb 2012 09:00:00 +0100 http://lifestream.kopis.de/items/view/1512/Trigger-und-Motivation
Neues Brot http://lifestream.kopis.de/items/view/1511/Neues-Brot

cringe

]]>
Tue, 14 Feb 2012 20:58:00 +0100 http://lifestream.kopis.de/items/view/1511/Neues-Brot
Es wird Zeit - Kalorienzählen und Training http://lifestream.kopis.de/items/view/1509/Es-wird-Zeit-Kalorienzaumlhlen-und-Training

Letzte Woche war mein Limit erreicht: jetzt ist Schluss! Ich hab schon wieder das Training nicht durchgehalten und stattdessen miserabel gegessen. Und mein Gewicht ist immer noch zu hoch, mein Körperfett hat mittlerweile ein nicht auszuhaltendes Level erreicht. Ab sofort esse ich anständig und trainiere anständig. Und gehe wieder so laufen, wie es mir vor ca. 3 Jahren schon einmal zu einem besseren Fitnesslevel verholfen hat.

Konkret heisst das:

low carb essen (einzige Ausnahme wird selbstgemachtes Brot zum Frühstück sein) Kalorien auf 1700kcal/Tag begrenzen jeden Tag Laufen (oder Badminton spielen) Krafttraining mind. 3x/Woche, eher mehr weniger Rumlungern auf dem Sofa

Ich war also schon wieder 2x laufen (kann man bei MapMyRun sehen), beide Male ca. 5km. Die Geschwindigkeit ist mir dabei erstmal nicht so wichtig. Wichtiger ist die Bewegung allgemein, um meinen Stoffwechsel wieder anzukurbeln. Geschwindigkeitsrekorde habe ich eh noch nie aufgestellt, und Rennen will ich auch nicht mitmachen. Aber tägliches Laufen bzw. eine Stunde auf dem Crosstrainer haben mir geholfen, mein Körperfett in Zaum zu halten - also mache ich das jetzt auch wieder.

Ausserdem war ich Samstag im Ausweichfitnessstudio trainieren. Mein üblicher PITT-Trainingsplan ist anstrengend genug und hat mir auch früher schon gute Dienste geleistet. Die Gewichte bei den einzelnen Übungen werde ich wieder etwas genauer verfolgen, um wirklich immer eine Steigerung der Intensität zu erreichen. Dazu gibt's später sicher noch die ein oder andere Tabelle - aber Google Docs ist auf einem Tablet leider nicht bedienbar...

Der Plan steht also: anständig essen, anständig trainieren. Und die Motivation ist auch wieder da, ich muss mich nur oft genug in Machopose ohne Tshirt vor den Spiegel stellen.

]]>
Sun, 12 Feb 2012 17:25:00 +0100 http://lifestream.kopis.de/items/view/1509/Es-wird-Zeit-Kalorienzaumlhlen-und-Training
IMG_20120212_110154.jpg http://lifestream.kopis.de/items/view/1510/IMG_20120212_110154.jpg

cringe

]]>
Sun, 12 Feb 2012 11:10:00 +0100 http://lifestream.kopis.de/items/view/1510/IMG_20120212_110154.jpg
Abfüllung http://lifestream.kopis.de/items/view/1508/Abfllung

cringe

Leider viel zu wenig Flaschen...

]]>
Tue, 07 Feb 2012 17:42:00 +0100 http://lifestream.kopis.de/items/view/1508/Abfllung
IMG_20120205_124303.jpg http://lifestream.kopis.de/items/view/1506/IMG_20120205_124303.jpg

cringe

]]>
Sun, 05 Feb 2012 14:23:00 +0100 http://lifestream.kopis.de/items/view/1506/IMG_20120205_124303.jpg
Eis http://lifestream.kopis.de/items/view/1507/Eis

cringe

]]>
Sun, 05 Feb 2012 12:33:00 +0100 http://lifestream.kopis.de/items/view/1507/Eis
Building a simple blog with NodeJS and Express http://lifestream.kopis.de/items/view/1497/Building-a-simple-blog-with-NodeJS-and-Express

After installing NodeJS and creating a basic web application with Express I wanted to get deeper into the world of node and build another simple, but useable web app. Because I like to blog, I decided to build a blog.

You can check out the result at https://github.com/MoriTanosuke/blode/ and clone it.

I decided to stick with express and jade as my templating engine, because I already now how to use those. But because this blog is made with jekyll and I like to think that I can eventually replace the jekyll blog with a node blog, I wanted my blog entries written in Markdown. Fortunatly, node can easily display markdown with node-markdown.

I started with a simple route that walks down into a directory "blog", gets all files and renders a template when the files are fetched:

exports.list = function(req, res){ var walk = require('walk'), fs = require('fs'), options, walker; // walk into directory "blog" var walker = walk.walk('blog'); var fs = new Array(); walker.on("file", function(root,file,next){ // get the file, but remove file extension var f = root + "/" + file['name'].substring(0, file['name'].lastIndexOf('.')); // push without /blog prefix fs.push(f.substring(f.indexOf('/'))); next(); }); walker.on("end", function() { res.render('blog', { title: 'Entries', files: fs }) }); };

Then I created a simple view named 'blog' which displays all the files:

h1= title !=partial('listing', {files: files})

Ok, I cheated a little bit, because the actual file listing is done in a partial, which basically is a reusable part of a view. The partial 'listing' isn't complicated either:

ul - each file in files li a(href='#{file}') #{file}

As you can probably tell, this jade partial will render a simple unordered list with links to the given files. Ok, so now I have a list of files under directory /blog. What happens when I click one of the links?

Another route takes over:

exports.entry = function(req, res){ var md = require('node-markdown').Markdown; res.render('entry', { content: md('' + require('fs').readFileSync('blog/' + req.params.year + "/" + req.params.month + "/" + req.params.day + "/" + req.params.title + ".markdown")), title: req.params.title }); };

Now this route builds a filename from the given parameters, reads its content, renders the content as markdown and renders the template 'entry':

div.entry !{content}

div.nav ul li a(href='/') back

div.comments p Feel free to add your comment system here.

Again, a very basic template. I simple put all the markdown into a div with class entry, add a link to the homepage and another div for a later addition of comments, probably using disqus.

Now I have 2 routes: one route walks through my filesystem and gets a list of files, another route displays the given content and adds a very basic navigation. What's missing at this point is the connection between the routes.

Here is the relevant part from my app.js file that connects my routes with actual URLs the user enters into the browser address bar:

app.get('/', routes.list); app.get('/:year/:month/:day/:title', routes.entry); app.get('*', function(req, res){ res.send('Uh, what?', 404); });

The first route shows the homepage with the list of entries. The second route displays an entry when the user clicked a link. The third route is an error handler that will display a very helpful error message when the user enters a non-existant URL.

Remember, if you want to check out my code, clone me from github and run the blog on your own machine:

git clone git@github.com:MoriTanosuke/blode.git cd blode node app.js

Now you can open http://localhost:3000 and check the blog out.

For my development I used a very nice script, node-supervisor. It watches your files and restarts node when needed. That way every time I save a file in my editor, the server restarts and I can reload the page to see my changes. Just run the application with supervisor instead of node:

npm install node-supervisor supervisor app.js

I really like my development cycle fast and without manually restarting stuff every couple of minutes.

The one thing gone awry

When I tried to put a basic stylesheet in place, I noticed that I couldn't open the stylesheet at http://localhost:3000/stylesheets/style.css. I thought about this for a couple of minutes and verified that the file is actually in the directory /public/stylesheets in my application.

After searching the internets I found that in my app.js the following lines were present:

app.configure(function(){ // ... app.use(app.router); app.use(express.static(__dirname + '/public')); });

If I got the explanation right, this means that my own routes come before the static assets. So when I tried to open my stylesheet the error handler kicked in because none of my 2 other rules applied. The solution to this is re-ordering the configuration:

app.configure(function(){ // ... app.use(express.static(__dirname + '/public')); app.use(app.router); });

Now the static assets are always served before my own routes apply. Everything works, my stylesheet is in place.

]]>
Tue, 31 Jan 2012 03:58:00 +0100 http://lifestream.kopis.de/items/view/1497/Building-a-simple-blog-with-NodeJS-and-Express
First webapp with NodeJS and ExpressJS http://lifestream.kopis.de/items/view/1498/First-webapp-with-NodeJS-and-ExpressJS

After installing Node yesterday I wanted to get my first real web application running today. I decided to use ExpressJS as my web framework, for no special reason. So, how do I get to my first simple web app?

Assuming I have nvm and node installed I can easily install npm (the node package manager) from here. To get express onto your machine, run this commands:

curl http://npmjs.org/install.sh | sh #install npm npm install -g express

It took me a couple of minutes to figure out that for express you need node v0.6.x. I installed v0.7.1, so I had to install v0.6.9 before trying to install express. You can check your installed version with this command:

nvm ls

If there is no v0.6.x, install it and then activate it:

nvm install v0.6.9 nvm use v0.6.9

Now you can create your first webapp with express:

express my-first-webapp && cd my-first-webapp npm install

express created a webapp skeleton for you and npm installed all the dependencies. Now you can go ahead and run the webapp:

node app.js

Open http://localhost:3000 and you'll see a little message that is generated with node and express.

]]>
Mon, 30 Jan 2012 22:17:00 +0100 http://lifestream.kopis.de/items/view/1498/First-webapp-with-NodeJS-and-ExpressJS
Install NodeJS with NVM http://lifestream.kopis.de/items/view/1499/Install-NodeJS-with-NVM

Today I started my first steps into the world of server-side javascript with nodejs. First thing was installing NVM, the node version manager. You can do that with this simple steps:

git clone git://github.com/creationix/nvm.git ~/.nvm . ~/.nvm/nvm.sh

After that you can go ahead and install nodejs:

nvm install v0.7.1

Now you need to download an IDE, a compiler, an enterprise service bus... oh no, wait. Just open your texteditor, paste the following text:

var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/');

save it as simpleserver.js and then run it with

node simpleserver.js

Now you can point your browser to http://127.0.0.1:1337/ and you'll see the response of your first application with nodejs.

]]>
Mon, 30 Jan 2012 09:00:00 +0100 http://lifestream.kopis.de/items/view/1499/Install-NodeJS-with-NVM
Weizensauerteigbrot http://lifestream.kopis.de/items/view/1494/Weizensauerteigbrot

cringe

Das sieht doch schon ganz gut aus. :-)

]]>
Sun, 29 Jan 2012 18:46:00 +0100 http://lifestream.kopis.de/items/view/1494/Weizensauerteigbrot
Neuer Versuch: Weizensauerteigbrot http://lifestream.kopis.de/items/view/1495/Neuer-Versuch-Weizensauerteigbrot

cringe

]]>
Sun, 29 Jan 2012 18:11:00 +0100 http://lifestream.kopis.de/items/view/1495/Neuer-Versuch-Weizensauerteigbrot
Linsensuppe http://lifestream.kopis.de/items/view/1496/Linsensuppe

cringe

]]>
Sun, 29 Jan 2012 17:17:00 +0100 http://lifestream.kopis.de/items/view/1496/Linsensuppe
Know your CRLF in git http://lifestream.kopis.de/items/view/1500/Know-your-CRLF-in-git

Today I wanted to install nodejs on my debian machine, and I got stuck with strange errors about command not found. I hate to admit it, but it was the fault of strange CRLF and the fix was setting my git defaults to a sensible value:

git config --global core.autocrlf false

If you want the reasoning behind this, read http://code52.org/line-endings.html and then set it. But set it.

After that I could install nodejs with one simple line of nvm. I'll write about that soon.

]]>
Sun, 29 Jan 2012 09:00:00 +0100 http://lifestream.kopis.de/items/view/1500/Know-your-CRLF-in-git
2012-0-24_20.58.41 http://lifestream.kopis.de/items/view/1492/2012-0-24_20.58.41

cringe

]]>
Tue, 24 Jan 2012 20:59:00 +0100 http://lifestream.kopis.de/items/view/1492/2012-0-24_20.58.41
2012-0-24_20.49.43 http://lifestream.kopis.de/items/view/1493/2012-0-24_20.49.43

cringe

]]>
Tue, 24 Jan 2012 20:50:00 +0100 http://lifestream.kopis.de/items/view/1493/2012-0-24_20.49.43
2012-0-24_18.53.48 http://lifestream.kopis.de/items/view/1491/2012-0-24_18.53.48

cringe

]]>
Tue, 24 Jan 2012 18:54:00 +0100 http://lifestream.kopis.de/items/view/1491/2012-0-24_18.53.48
Das erste Brot http://lifestream.kopis.de/items/view/1501/Das-erste-Brot

Heute habe ich das erste Mal (ok, das zweite Mal, aber das erste Mal wollt ihr ganz bestimmt nicht wissen...) ein eigenes Brot gebacken. Ich habe dazu meinen eigenen Sauerteig angesetzt und mit einem einfachen Weizensauerteigrezept weiterverarbeitet. Die Zutaten waren ungefähr

350g Sauerteig 350g Weizenmehl 20g Salz 250ml Wasser 10g Hefe

Das ganze habe ich zu einem Teig vermischt, der zwar recht klebrig war, sich aber mit etwas Mehl gut genug behandeln liess, um ihn in eine kleine Kastenform zu geben.

Da drin hab ich den Teig dann ca. 20min gehen lassen. Danach für 10min bei 250°C in den Ofen und anschliessend bei 180°C für 60min fertigbacken lassen.

Das Ergebnis:

]]>
Tue, 24 Jan 2012 09:00:00 +0100 http://lifestream.kopis.de/items/view/1501/Das-erste-Brot
2012-0-22_10.0.52 http://lifestream.kopis.de/items/view/1490/2012-0-22_10.0.52

cringe

]]>
Sun, 22 Jan 2012 10:04:00 +0100 http://lifestream.kopis.de/items/view/1490/2012-0-22_10.0.52