January 2012
1 post
2 tags
The New Resistance: Aftermath of the Serbian...
On 5 October 2000, almost twelve years ago, Serbia has won its freedom. Its people have ousted Slobodan Milošević, and ended an almost ten-year-long rule of the Serbian Socialist Party (SPS). And then what? For the next twelve years, have the Serbs seen any improvement?
The key to revolution’s success was a youth organization called Otpor. Today, Otpor’s founders are traveling...
October 2011
2 posts
6 tags
5 tags
September 2011
5 posts
3 tags
Node Web Development
Quit scratching your head already. Of course you’re doing it, scratching your
head and mumbling to yourself, “What’s a browser language doing on the
server?” In truth, JavaScript has a long and largely unknown history outside
the browser. JavaScript is a programming language, just like any other
language, and the better question to ask is “Why should...
1 tag
Herman's Thought Soup →
People who follow me on Twitter know about it, but I thought I’d leave a short note here as well. So anyway, there’s this thing, a blog about anything and everything Herd-Hound-related. There will be quite a few posts about the technical stuff that goes on under the hood, but also the business stuff. Stay tuned. ;)
1 tag
3 tags
Packt launch sixth annual Open Source Awards
The 2011 Open Source Awards was launched today by Packt, inviting people to visit www.PacktPub.com and submit nominations for their favorite Open Source project. Now in its sixth year, the Awards continue in its aim of encouraging, supporting, recognizing and rewarding all Open Source projects.
The 2010 Open Source Award Winners included the Open Source Content Management System (CMS) Award...
2 tags
Show Me Your Email!
If you sign up for a social networking account, you can understand that the terms of service contain stuff like “you give us permission to publicly display your information for the purpose of providing you the service”. How would you feel if your email provider had the same in their TOS?
I was thinking about email today. I use email for everything and anything. My social networking...
August 2011
6 posts
4 tags
New Node.js Book from Packt
Node.js is the new cool thing on the web, and everybody seems to be talking about it these days. And when everyone starts talking about something you start seeing books on the subject. Some time ago, I’ve caught David’s anouncement of the book he was writing, and was wondering about when it will be available, when Packt contacted me asking for a review of David’s Node web...
2 tags
Bullet-proofing Setters and Getters
JavaScript has two very handy methods that you can use on an object:
__defineSetter__(), and __defineGetter__(). They allow you to write
accessor functions for your objects. Here, I’ll show you how to write them so
they are as tamper-free as possible.
I needed a bullet-proof pattern for accessors for my
Daimyo library that I use to hook Herd
Hound to Samurai payment
gateway.
Now,...
5 tags
Classic Web Form POST in AJAX apps
So, you have an AJAX app that has to do a normal POST (not an AJAX post) using a regular web forms for whatever reason? While the solution outline here is not complete (it does not cover doing cross-domain requests), here’s a simple pattern I used to make Ashigaru jQuery plugin work with the Samurai payment gateway.
The problem I was facing was that Herd Hound is a single-page web...
5 tags
The Best Git UI for Vim: Fugitive
Tim Pope, known to many Vim (and Rails) users as just tpope, very well known for his many vim- projects (including the infamous pathogen plugin), has this to say about his Fugitive plugin for Vim:
I’m not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time. Check out these features: […]
And he didn’t lie. Fugitive is so awesome it may well...
4 tags
Passing by Value vs Passing by Reference in...
A thing that I’ve heard desktop application developers say about web developers is that web developers don’t know what phrases passing by value and passing by reference mean. I’m sure most of us, web developers, know what those mean. If you don’t, you should learn them ASAP!
To recap, passing by value means that the value that you pass to a function gets cloned and...
4 tags
Profilejs: V8 profiling for Express framework
I’ve started using Danny Coates’ node-inspector recently. It works very well as a graphical debugger (runs in a webkit browser), and it can also serve as a profiler in conjunction with v8-profiler.
I wanted a tool that would profile all requests for me, so I could browse and pick through the logs afterwards, but I couldn’t find one. So I decided to write a middleware for...
July 2011
17 posts
2 tags
Iframe ad killer
Most ads I’ve seen are inside an iframe. That makes them very easy to target and murder with a bit of JavaScript. Here’s a small bookmarklet that will do just that:
iframe killer
Drag that bookmarklet (link) to your bookmarks toolbar, and click it whenever you see too many flash or image banners on the page.
Mind you, this also kills legitimate iframes, so it’s not 100%...
2 tags
The Cost of User Input Sanitizing
You might have heard of ‘user input validation’. That’s all cool and dandy, but have you heard of ‘user input sanitizing’? It is a concept as important as validation. The former checks for validity of the user input, and the latter prepares the user input for further processing by the software.
Now, you might think that proper validation might mostly eliminate the...
5 tags
Blocking vs Non-blocking: Node vs Bottle
Node.js boasts real-time performance. Of course, depending on hardware, it may
show some level od delay in responses, but it is usually able to handle
requests as soon as they come in. I have built two simple hello world apps, one
running on top of Node.js, and one running on top of Bottle/Bjoern. Bjoern is a
non-blocking WSGI server written in C, and it should perform very well on its
own, but...
6 tags
Serial Expresso Testing with Mongo Fixtures
Expresso is a test runner for Node.js. It boasts “high speed parallel testing”. It means it can run your whole test suite of a couple of thousands of tests in less than a second… but this post is not about that. This post is about taking it slow, and running tests one by one like you might be used to from other environments (Python, anyone?).
Isn’t slow… err…...
2 tags
Mouse and Vim for the Lazy
Have you ever noticed that, when you have line numbers enabled in Vim, you can’t select just the code? You know, the numbers get selected as well. I was too lazy to fix that problem for a while now, and today I took a stab at it finally. Solution was deceivingly simple.
One method mentioned involved adding mouse button bindings to vimrc, and then adding more options to Xdefaults, but I...
3 tags
MicroJournal: Personal Desktop Microjournaling
I’ve never been a Twitter addict, mostly because my short notes were public there. But I do need to write shit down as it happens. So I decided to write my own microjournaling app as part of my quest to learn more about Bash scripting.
Thus MicroJournal has been born. It’s a small app, that allows you to write down essential (and slightly less essential) notes and observation...
3 tags
Simple Desktop Timer With OSD
I needed a really simple timer which would take the number of seconds and play a sound clip. Since I’m into writing Bash scripts these days, I decided do this in Bash. Result is a funky little tool that will get the job done very nicely.
To use the script, you will need a few things other than Bash. You will need mplayer (or you can hack the script to play sounds with something else),...
4 tags
Vimified: Vim-Centered Software Collection
I tend to spend most of my day in Vim. Well, most of my day is relative, as I certainly do engage in activities like eating, playing with kids, and sleep. Nuances aside, some of the Vim’s features like HJKL movement, and command mode have become second nature to me, so much so that I started looking for software that behaves more or less the same way in areas outside text editing. Here are...
4 tags
Multiple File Renaming With sed
Of course, there are many tools that specialize in renaming files, but none of them is quite as powerful as sed. In fact, sed does much more than just rename files. After all, sed’s main is a stream editor, whose job is to edit incoming text anyway you like.
We will cover a very simple example, which doesn’t do sed much justice, but I think a more complex example is not very...
4 tags
Per-directory Disk Usage from CLI
There are many tools out there for checking disk usage of directories. However, command-line users have a very powerful tool called… well, shell, what else. :) The Linux shell has many small tools that aren’t necessarily very powerful on their own, but do a beautiful job when used together. Here we will combine a few tools to get the list of largest subdirectories in the current...
5 tags
Laptop Battery Info With Bash, sed, and AWK
My Ubuntu 11.04 system recently begun showing signs of Redmondism, freezing up from time to time, and also breaking software with updates. When the MongoDB server refused to start after I asked it politely, I’ve decided to reinstall Arch Linux as was my original intent anyway. The pure geek awesomeness is finally back on my laptop.
So, while all the packages were being installed, I god a...
4 tags
Mongoose Validation and Virtual Fields
Mongoose, MongoDB ORM for node.js, allows you to create virtual fields. However, virtual fields cannot be validated using the standard method of field validation. I will first explain how to add validation to normal, non-virtual fields, and then describe a method for handling virtual fields.
Suppose we have a model called User. Normally, we have a schema definition for the model.
var mongo =...
4 tags
Node.js: Simply Awesome
I’m one of those guys that get fired up about new shiny toys every now and then. And the latest shiny toy is Node.js. Aaah, shiny! A few years of web development experience behind me now allows me to make a slightly more informed opinion, however, and I would like to share it here with you.
First of all, what is Node.js anyway. I remember the weird experience I had when I first saw...
4 tags
3 tags
Loveffee Beta Launched
I love and drink coffee every day. Sometimes, I desperately need it, and other times I just enjoy it. So it’s occurred to me, for health reasons and otherwise, that I might want to keep track of how much of it I actually drink. The beta version of Loveffee was thus born.
UPDATE: The official Loveffee blog is now live, as well as the Twitter feed and support forums.
Loveffee is for...
3 tags
The Real Acme?
Have you ever hear of the Acme corporation? If you grew up on Warner Bros’ animation like i have, you’ve probably seen a large number of Acme stuff, and you couldn’t really decide if you liked them or not. Since then, I’ve learned that there are other Acme as well, never nearly as popular or imaginary. Today, I bought my first Acme product, ever real, and every useful.
...
2 tags
A synonym is a word you use when you can’t spell the word you first...
– Burt Bacharach
June 2011
11 posts
5 tags
JavaScript String Concatenation Speed Test
One performance recommendation I’ve seen was about concatenating really long strings. Unless you are using bits of JavaScript to prettify your pages, AJAX+DHTML web apps use tons of these long strings as templates, just as a server-side web framework would do. Unfortunately, JavaScript has no support for multiline strings, so we end up using multiple single-line strings, and concatenating...
5 tags
JavaScript Array-Looping Speed Test
It’s been said over and over again that the standard method of looping through array items in JavaScript (the for loop) is not very efficient. I wanted to check this for myself so I ran three implementations of array loop through the firebug profiler. While testing only in FireFox 4 is certainly not anything resembling scientific, I believe the drastic differences between execution times is...
3 tags
Two GAE Datastore Query Optimization Tips
I’ve done some adjustments to the Herd Hound app to make it run a bit faster, and here are two tips you can use to optimize performance of your datastore queries.
Use of limit with count method
There are two reasons (that I can think of right now) you might call count. One is when you want to know the total number of items in a query result, and one is when you want to see if there are...
4 tags
Appstats and Bottle on GAE
Google app engine apps are fairly easy to profile, thanks to the Appstats library. I’ll show you here how to configure the Appstats for use with your bottle app here.
First you need to enable the appstats built-in component in the builtins: section in app.yaml:
builtins:
....
- appstats: on
You will also need a login handler, as discussed in the previous post.
Finally, you need to...
3 tags
GAE Bottle Login Handler
While I have my own home-brewed auth system for Herd Hound, there are a couple of situations where I needed to authenticate using Google account. In particular, those are some built-in functionalities like datastore admin, or mapreduce. These things have a built-in interface and they need a way to authenticate users, so they call on the default login handler located at /_ah/login_required. There...
4 tags
Migrating GAE Datastore Schema
Inevitable fate of all web apps is evolution (the only other option being death, that is). During the lifetime of a web app, you will constantly modify it, add new features, remove old ones, and reconsider bad choices you’ve made in the past. The bad choices may not necessarily be bad, but merely a result of different parameters you operated by before. As the application evolves, so does the...
4 tags
Searching within Multiple Files in Vim
So, Vim is one of the most advanced programmers’ editors around. One of the features I was missing for a long time was the ability to list all TODO and FIXME lines in my code. Well, turns out you can do this pretty easily even without a special plugin.
The command that does it is lvimgrep. It uses the Vim’s internal grep functionality and does a regex-enabled search within your...
2 tags
Land of the Gray
(Photo: ell brown)
There’s a joke that is going around for quite some time now in Serbia. “Who needs hooligans when you have elderly citizens?” If you’ve seen Polanksy’s Tenant, you get the idea. Recently, I’ve been subject of a complaint filed by one of our neighbors. It was something about water dripping down from one of the drainage holes on our balcony...
4 tags
3 tags
Counting Lines of Code, and Herd Hound
I won’t lie to you, Herd Hound is the largest codebase I’ve ever written. Nope, not bragging. Just saying I’ve never written large stuff. So I was wondering, how many lines of code it has exactly. That’s how I found the CLOC (Count Lines of Code) tool to aid me in this. I must say I was quite surprised.
Now, I know some of you reading this have probably written 3 or 30...
3 tags
Sharpen the Axe: the Dark Side →
“Folks like me who have made tool-making a big part of their life lean on it all the time. Sometimes, too much. There are a couple of dark sides: the one that people talk about most is that it’s important to actually finish sharpening the axe and get back to chopping. Often tool building is far more fun than actually doing the job at hand.” (from the article)
May 2011
9 posts
Dear DELL
When someone buys a product, he usually wants it to get a job done.
For him, and not anyone else. Yes, we’re all selfish like that, and
I’m sure you’re not too different either. You don’t buy stuff that
won’t primarily work for you, even if it’s a gift that is supposed to
make YOUR loved ones happy. ;)
Anyhow, DELL has a reputation with Linux users because...
4 tags
Dear Google
Yes, I’ve seen your whinage about the blidness of the googlebot to web 2.0 content. So I wanted to write a line or two here, since comments on your blog are disabled.
AJAX != Flash. The reason those are not the same is that AJAX is a mix of standard technologies with open specs, whereas that is not the case in Flash. The reason your googlebot thinks it’s the same shit is...
2 tags
Open-Source FTW (Again)
So, I ran Windows for a while on my new DELL Inspiron N-series laptop. It features a funky new gizmo called Optimus (and no, again, it doesn’t transform into a truck). This tech gave me a lot of headache with the older Ubuntu release (10.10), and also Arch Linux. Finally found a solution today, and I’m back on Linux.
First of all, it’s a weird thing. Optimus is not advertised...
2 tags
3 tags
onbeforeunload Event Browser Support
Today, I was reading about the onbeforeunload event. I have a custom event system for Herd Hound app, so I wanted to destroy all event handlers before allowing the browser to navigate away from the page. For this I thought I’d use the onbeforeunload event, but then I read it wasn’t widely supported. As most frontend engineers, I have a multitude of browsers installed on my laptop, so I...
2 tags
Vim JavaScript Indentation
JavaScript indentation doesn’t seem to be an easy thing to implement. I don’t know why, but there are so many plugins that get it wrong. I’ve struggled with some of the quirks in such plugins, but I think I’ve finally found the one that works. I won’t bother you with details. Go check out Better JavaScript Indentation. Make sure you’ve removed other similar...
3 tags
Some conclusions about webdev
After a complete reconstruction of Herd Hound core, I’ve come to some conclusions I want to note down here, in case I decide to revisit them some time in future.
Event-driven is good
Web apps are mostly asynchronous, and concurrent most of the time. Event-driven design the the best match for this type of app.
Never add event handlers from within event handlers
You may fire events,...
3 tags
Herd Hound Rewrite and App Rebirth
When i started coding on Herd Hound, working 15 to 17 hours a day on average (including the day job), under a lot of pressure, and very tired all the time (no shit, right?), I’ve started with a very vague notion of what the app would look like. What I knew was that the backend would be a very simple web service providing data in JSON form, with a single URL that would return the actual user...