dracoblue.net

log4j like logging in node.js (from Spludo)

One core feature of spludo, is the powerful logging system. This system is entirely independent from spludo, so you may use it in your own (even non-spludo) nodejs project with ease.

Like described in the tutorial about configuration, you can easily add logging facality to every prototyped class:

DocsManager = function() {
    // ...
}

extend(true, DocsManager.prototype, Logging.prototype);

DocsManager.prototype.logging_prefix = 'DocsManager';

It's important to add #logging_prefix, otherwise the methods won't know which class originally had the function implemented.

Usually you use it with just one parameter:

Continue reading ...

In javascript, node.js, open source, spludo by DracoBlue @ 07 Oct 2010 | 487 Words

node.js facebook client for graph and rest api

Today I finished packaging the node-facebook-client. The first version 1.0.0 contains the functions necessary to:

- do signed and unsiged requests
  > graph api
  > rest api
- generate a session from an
  > accesstoken
  > code+redirect_uri (oauth 2.0)
  > ... or by using a session-key (facebook connect)
- validate a signature from facebook
- sign a request for facebook

An example and the source code can be found at the official

github page of node-facebook-client.

Download node-facebook-client 1.0.0 here at dracoblue.net. It should work with any nodejs version after 0.2.0.

If you want to install by using npm, do:

npm install facebook-client

Comments and patches appriciated as usual!

In javascript, node-facebook-client, node.js, open source by DracoBlue @ 05 Oct 2010 | 122 Words

ISO 8601 Date String with Node.JS for AmazonWS

When I tried in javascript to calculate the ISO 8601 Date String, I noticed that there is already such method on the

Date object.

This method is called toISOString and is not yet documented at the mdc page.

This date format is needed for instance for the amazon web services.

If you need a implementation anyways (even though toISOString should be available), here is a plain javascript implementation:

function toISO8601(date) {
    var pad_two = function(n) {
        return (n < 10 ? '0' : '') + n;
    };

    var pad_three = function(n) {
        return (n < 100 ? '0' : '') + (n < 10 ? '0' : '') + n;
    };

    return [
        date.getUTCFullYear(),
        '-',
        pad_two(date.getUTCMonth() + 1),
        '-',
        pad_two(date.getUTCDate()),
        'T',
        pad_two(date.getUTCHours()),
        ':',
        pad_two(date.getUTCMinutes()),
        ':',
        pad_two(date.getUTCSeconds()),
        '.',
        pad_three(date.getUTCMilliseconds()),
        'Z',
    ].join('');
}

It takes a javascript date object and converts it to an iso 8601 date string.

In javascript, node.js by DracoBlue @ 03 Oct 2010 | 154 Words

Spludo update 1.0.1 released

I had a very nice talk to some folks at my company about the spludo framework. Thanks for all the positive feedback!!

Today I want to give you guys a small update to spludo, which contains some of the neat features I was previewing on friday:.

Changelog:

* group and chain are truely async now
* added "spludo-gen controller" (wizard to create a new controller)
* views can now be in sub folders
* added partial + partials in .ejs
* .ejs-Views recompile the view as soon as it is changed

There is also a very short topic about

how to use partials with spludo in the user guide.

Download spludo 1.0.1 or install it by using npm.

In javascript, node.js, open source, spludo by DracoBlue @ 26 Sep 2010 | 129 Words

Removing @since and @author from JavaDoc

Today I was polishing up the release for spludo and I removed all @author + @since tags from the javascript doc.

In first place, I thought I might keep them in. But, I was unsure about a good guideline how to keep them up to date.

Let's take for instance @since. What does this exactly mean. It may mean when the function or class was added. But what if the signature changed? Is this a different function or still the same? Are this still the same @authors?

I came to the conclusion that they are hard to maintain and git/subversion give me the info I need in a way more convenient way. So I removed them with this commit.

In coding standards, open source, spludo by DracoBlue @ 19 Sep 2010 | 122 Words

Page 15 - Page 16 - Page 17

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About