Logging From JavaScript

24. November, 2011

Logging is a recurring issue in JavaScript. There are a  couple of frameworks which support you. I’ve picked out two:

Some pros and cons:

log4javascript is very powerful. It contains lots of options, it has timers, several appenders (in page or using a popup window), the console supports tons of filters. If you know log4j, you’ll find almost everything replicated. If you need fewer options, there is even a lite version.

Despite the many options, log4javascript is still simple to set up and use (so it’s not like log4j in every respect). The default setup needs 3 lines of code (not counting the script element to load the framework).

There are two minor points: The console is pretty big and the in-page version can’t be moved.

Blackbird is a really small logging framework. No frills, just the basics. So no exception logging, for example. A profiling option is the most complex feature. In the world of the logging frameworks, it’s the iPhone: Nice look and only the useful features. The console is always in page, it sits in one of the four browser corners, it can be hidden and shown with F2.

My main complaint about Blackbird is that you can’t use the mouse to move the console. Also disabling the framework needs several lines of code. A single variable would have been more comfortable.

 


Peace Between Java and SQL

23. November, 2011

There are various attempts to get Java and SQL to behave with each other. We have JDBC, OR mappers like Hibernate and EclipseLink, language support like in Groovy. All of those have advantages and drawbacks.

JDBC is powerful but low-level. The API is not really friendly. You need to write a lot of boiler plate code for even simple tasks.

Languages like Groovy wrap JDBC to make simple tasks simple. The code becomes much more readable but changes in the database schema become runtime errors.

OR mappers try to turn a relational database into a OO database. It works better than you’d expect but it also causes odd problems and leaks into design of your code: You must no’t use the ID field in equals, hiding the session in a thread-local variable can cause exceptions when you use lazy loading, failing to understand the requirements of the OR mapper causes spurious bugs. At least the OR mappers will complain when the schema changes.

Enter jOOQ. It’s like a OO wrapper for JDBC:

  • You get all the power of JDBC if you need it
  • The readability of a fluent interface
  • The database schema is part of the code (so you get compile time errors if it changes)
  • You can iterate over results as if they were a plain Java collection

Related:


David Eaves Keynote at DjangoCon

17. November, 2011

David Eaves gave a great speech at the DjangoCon: The Science of Community Management: DjangoCon Keynote

It raises many important points that you should be aware of when you are or are planning to get involved with a OSS project. All those have communities and if you don’t keep an eye on staying the lone rider committer, you’ll eventually get tangled up in the social net – the community.

This can be a painful experience, especially when you’re a coder. We, as a species, are wary of human interaction and social forces when we maybe should be aware instead. One symptom is that people start to bother you with stupid questions. The natural reaction is to troll. This works (people will leave you along) but it also means spending from your reputation budget.

Realizing that “stupid question == someone cares about my work” can turn this into a win-win situation.

Go see the talk.


How To Get Technical Support – by I Can Barely Draw

14. November, 2011

How to get support from your ISP.


Why You Shouldn’t Deploy Overnight

8. November, 2011

If you’re with a big company and want to do it “right”, chances are that you’re only allowed to deploy during the night, on weekends and never, never, never in December (or any other date were mission critical systems must not fail).

Looking for some reasons why this is wrong? Go here: Why are you still deploying overnight?

In a nutshell: You’re deploying overnight because your processes are brittle, the product is riddled with bugs and you have no fall-back strategy.

Overnight deployment is nothing but a red flag saying that you’re not doing it “right”.


Raphaël – Impressive Vector Graphics Framework for JavaScript

2. November, 2011

If you need a framework for vector graphics, try Raphaël.

MIT License, impressive demos, readable source code.


Follow

Get every new post delivered to your Inbox.

Join 340 other followers