I recently came across the problem of needing to "pretty print" a json output to debug a JSON API call. The only script i came across was a .NET application?!?! anyway, a few lines of python did the trick (i guess 1 line of perl would've done the job, but it doesn't have a standard JSON library)


import sys
import json

x = json.load(sys.stdin)
print json.dumps(x, indent = 2)

pretty sophisticated, right? well... 10 minutes of googling solved by 1 minute of coding.. great

usage is obvious i guess...

Herbys-i7:~ herbert$ curl -s \
  "http://xxx/data/admin?cmd=listInactiveUsers&format=djson" \
  | jsontidy
  "users": [
      "username": "test5", 
      "id": "d3292a0c-d152-42b1-98d0-335ded789bc6"
      "username": "test2", 
      "id": "0d947487-bccc-4742-bf4e-0b0afeb2011f"

Of course you could also do it in one line.. how about using the following in your .bash_profile?

alias jsontidy='python -c "import sys,json;json.dump(json.load(sys.stdin), sys.stdout, indent=2)"'

Hey, we have Signatures !!! Great, isn't it ? ;)

Posted by Herbert Poul

Assigned Tags: json, debug, development

It has been a while since i have made my last blog post, so it is slowly time again to show that i am still alive. So I figured i'll simply write about our newly founded company. We still need to get a valid tax UID number - but other than that we are all set and already hard at work.


TaPo-IT OG (Yes, very creative name, we really thought hard and long about it! This was the best we came up with) will focus on solutions for Enterprise Resource Planning using OpenERP. We are also providing development services specifically in Mobile and Web Development. So we are always looking for *interesting* Android, iPhone projects as well as Java, Python and PHP Projects.

More will be coming in the (near) future - Our first mobile application Billdroid will shortly receive an update which finally makes it a bit useful. I will probably try to keep this blog up to date in the future.

p.s. Thanks to Mac for your beautiful logo design.
Hey, we have Signatures !!! Great, isn't it ? ;)

Posted by Herbert Poul

Assigned Tags:


Attachments: tapo-it_logo_current.png (4.8 KB)

The pain of SEO

2010-03-23 23:08:33

Can anyone share some insights into the world of SEO? I know all (ie. most) of the tools, all the terminology and i think the most important techniques. I have even read books about SEO ("The Art of SEO") (let alone months of searching through the web).

But i still can't figure out how to rank high - or sometimes even rank for a given keyword - or how to find out the most important keywords to look out for (Yeah, i know about google adword's keyword tool, google trends and adwords).

For example I have no clue why the terms: surfen lernen can't find the website http://www.surfen-lernen.com on google germany. It is in the first position on yahoo.de but i am not able to find it on google at all. Another odd thing is that searching for: site:surfen-lernen.com on google the root site is on the last page of the search results.

(And yes, i hope this post will change the search rankings ;) - hey, this site has PR 4 after all ... wrong audience (umm. none?), topic and language.. but it still has to count for something, right?)
Hey, we have Signatures !!! Great, isn't it ? ;)

Posted by Herbert Poul

Assigned Tags: soe, surfen lernen


Freelancer Business Card

2010-02-15 00:52:25

Just ordered new business cards.. Basically just for fun to see how they look like. Here are the digital previews. I will post again once i receive them ; ) what do you think?

Herbert Poul - Freelancer Business Card - Front

Herbert Poul - Freelancer Business Card - Front

(Somehow i forgot to add a nice Sun Certified Java Programmer-logo.. well, maybe next time)
Hey, we have Signatures !!! Great, isn't it ? ;)
Another few hours of my life lost due to spammers. (And a few Mac OS quirks i don't want to get into now : ) ). Anyway.. If you have any kind of form on your website you are guaranteed that you will receive spam in one form or another. To make it the least annoying for your real customers and users I think it's the best way to employ some kind of passive spam checking.

I previously only heard of Akismet which is only free for non-commercial users. But since i don't want to get into trouble I made a quick google search and found TypePad AntiSpam - The nice thing about it? It is completely free (at least right now) - but provides the same API as akismet.

So I simply downloaded the Python Akismet library and created a very simple utility function and base form in django to do the checking. So only when spam is recognized the user will have to fill out the captcha.

The whole magic lies in simply changing the baseurl:

from akismet import Akismet
# base url for TypePad AntiSpam would be:
#   api.antispam.typepad.com/1.1/

Akismet.baseurl = settings.AKISMET_BASEURL

You can also take a look at my full code for the form, which uses the Captcha Field from SCT.
Hey, we have Signatures !!! Great, isn't it ? ;)

Posted by Herbert Poul

Assigned Tags: spam, captcha, django, akismet, typepad antispam


Attachments: captcha_check.png (185.9 KB) , spamcheckedform.py (2.9 KB)

After a short discussion yesterday about CMS's I remembered the history of my own web applications. Usually when talking about Wikis I am pretty convinced I have developed three - The first in perl around 2002, another in java in 2005 and my current wiki in 2008 with python. But this is actually not true.

There was another really basic wiki script which dates back to 2001 - developed in perl as well. It has no copyright comments and no timestamp whatsoever. Only the articles were timestamped, the oldest dating back to early 2001. It used flat files to store the articles, generated static html pages and was not really sophisticated. but it had the basic functionality of a wiki. Everyone could create new pages, edit old pages, preview page edits and they were instantly seen online on the website. This 120 line script would basically do

As you can see, it was a pretty sophisticated Wiki about Startrek knowledge :) Most articles were actually contributed by visitors, and not by myself. So the wiki concept was actually a success even back then.

Unfortunately I lost interest and hence the script got lost in one of many server migrations.

(Btw. My first usable program I remember has celebrated it's 10th birthday this year. It was a nice TCL script for eggdrop bots for a nice RPG game you can play on IRC channels (one channel representing one startrek space ship ;) ): http://yourhell.com/~kahless/scriptrpg.tcl *sniff* - so another three years and my programs are half the age of myself. this is getting weird. )
Hey, we have Signatures !!! Great, isn't it ? ;)

Posted by Herbert Poul

Assigned Tags:


Attachments: treksite_wiki.png (271.8 KB)

Surfcamps24 - Making Of

2009-11-15 20:47:32

Sometimes it is getting really frustrating to search for, or create the perfect generic product which can be used for every possible website and purpose. Be it an open source django forum and wiki or a web content management and portal software. So it can be really refreshing to reset and implement the simplest possible solution for a very simple problem: Getting content on the web.

Well. That sounds easy. I have done it dozens of times and written three frameworks for it - in Perl (MHP), Java (Galena) and lately Python (SCT).

Okay. Screw it. Start from scratch and do the simplest solution possible. (And well, do it in portugal.. it helps)

The result?

  • Content editable using a simple wysiwyg editor
  • Navigation, advertisings, headers, etc. editable in the administration interface
  • Surfcamps administration, listing, categorizing
  • News section editable using wysiwyg editor, in categories and with permissions (obviously)
  • Ratings of surfcamps by guests
  • Comments for news and contest entries.
  • Contest page to upload images and vote for them - with facebook sharing and everything
  • simple user management with a very easy registration, email validation & co - so you are basically registered before you know it :)
  • Booking form - with customizable fields for every surfcamp.
  • Sending HTML validation emails and newsletter (including images) - managed right from the admin interface
  • improved surfing skills ;) (Well .. kinda)

Or in bare metrics ..
  • 1700 lines of python code (based on django)
  • 1000 lines of html code
  • 3-4 weeks of work
  • Who cares about metrics?! ;)

Surfcamps24 - Wellenreitcamps für Deinen Traumurlaub
Hey, we have Signatures !!! Great, isn't it ? ;)
I recently got very disappointed by any markup language i was using for my django forum, wiki and blog - basically because BBCode and Markdown are all easy to write but very limiting, while (X)HTML is powerful, but hard to write by hand. (Actually I found it easier to write HTML than to work around bbcode limitations for another part of my blog (which is still not finished, but not due to html :) ))

So when someone on the SCT forum started to ask why I was using markdown in the wiki I sparked a small discussion about the pros/cons of WYSIWYG vs. editing markup by hand. I even carried it over to another thread.

So what are the pros and cons of WYSIWYG?

  • +: Very userfriendly (if done right)
  • +: Very powerful (you can add custom features, like wiki links, inserting attachments as images, resizing/alt texts of images, etc.)
  • +: You don't need to learn a new markup language for every forum, wiki or blog
  • -: Security might be a problem - you need to validate (X)HTML very carefully to avoid XSS
  • -: Some might want to edit pages offline, or manage them in a text based version control system.
  • -: Diffs are not that straight forward
  • -: Hard to do "right" (WYSIWYG is not that simple and might require extra work for every browser - and you need extensions for your forum/wiki/blog features)

So - does anyone have other pros/cons for wysiwyg vs. markup editing? any experiences? :)
Hey, we have Signatures !!! Great, isn't it ? ;)

Posted by Herbert Poul

Assigned Tags: wysiwyg, sct, markup, markdown

There is actually quite an easy guide on how to upgrade the hard drive of a macbook pro (which obviously voids warranty). So if you have 3 hours to kill, buy a new 500 GB hard drive and play around with your macbook pro. (Although the hardest part was finding a fitting T-6 Torx screwdriver - i didn't even knew something like that existed.)

I'm pretty amazed that time machine worked perfectly (after a few back/forth in the recovery dialog because it doesn't recognize partitions you create while the dialog is already open.. ie. create your partitions and AFTERWARDS start the recovery dialog :) ). It just took about 1.5 hours to restore the 90 GB backup, and I could continue working just as i left off on my old HD (Just faster and without those annoying "Your startup disk is almost full" warnings).
Hey, we have Signatures !!! Great, isn't it ? ;)

Posted by Herbert Poul

Assigned Tags:


Not enough time for my todo list

2009-05-18 16:39:17

I once had the problem of having no ideas when i needed a programming project. Somehow this changed significantly ..

Things i would LOVE to code, but have no time:

Any advice on how to prioritize these would be appreciated :) (and no.. there is no money in any of these projects ;) )
Hey, we have Signatures !!! Great, isn't it ? ;)

Previous | Page 2 | Next


RSS Feed

Personal website and blog of Herbert Poul. Also check out my Photo Gallery.

Herby's Photo Gallery



You are not logged in.