DailyJS

DailyJS

The JavaScript blog.


TagAPIs
Featured

libraries APIs parsing

Hello.js, ineed

Posted on .

Hello.js

Andrew Dodson sent in hello.js (GitHub: MrSwitch / hello.js, License: MIT, npm: hellojs), a client-side API wrapper for OAuth2-based REST APIs. It presents a unified API that normalizes paths and responses for Google Data Services, Facebook Graph and Windows Live Connect.

One of the advantages of hello.js is it's modular. There are hello.js modules for Dropbox, LinkedIn, SoundCloud, and Yahoo.

The module API allows you to define things like jsonp functions, so it should be flexible enough to handle a lot of modern services.

HelloJS has been on Hacker News, with a discussion on security, and endorsements from users:

HelloJS is great. I've used it in my last project. It just works. It's well tested, and well documented. There's very little option twiddling required. It just worked seamlessly when I was trying to setup Twitter, Google, LinkedIn and Facebook OAuth logins.

ineed

Ivan Nikulin wrote in to say parse5 has a new SAX-style HTML parser which powers the ineed project:

ineed allows you collect useful data from web pages using simple and nice API. Let's collect images, hyperlinks, scripts and stylesheets from www.google.com:

var ineed = require('ineed');

ineed.collect.images.hyperlinks.scripts.stylesheets.from('http://www.google.com',  
  function (err, response, result) {
    console.log(result);
  });

Internally, ineed uses streams of HTML tokens so it doesn't have to spend time building and traversing a DOM tree. It seems like an ideal way to handle lots of otherwise awkward scraping tasks.

Featured

APIs storage indexeddb

Query IndexedDB Like MongoDB

Posted on .

Kent Safranski sent in Indexed, a library that wraps around IndexedDB with a friendly MongoDB-inspired API.

You can insert objects like this:

indexed('myDB').insert({  
  name: 'John Doe'
  email: 'jdoe@email.com'
}, function(err, data) {
  if (err) {
    console.error(err);
  } else {
    console.log(data);
  }
});

And fetch them again with find:

indexed('myDB').find({  
  _id: 28972387982
}, function(err, data) {
});

You can even use MongoDB-style operators:

indexed('myDB').find({  
  someNumber: { $gt : 25 }
}, function(err, data) {
});

You'll probably like this if you work with databases in Node. It's actually part of a larger project called Riggr, a framework based around RequireJS, Knockout and jQuery. Although I think indexed.js is cool enough that it should be a separate module, rather than being bundled in with Riggr.

Kent wrote a detailed blog post about indexed.js here: Indexed: Query IndexedDB Like Mongo.

Featured

APIs node modules bitcoin images

Node Roundup: 0.8, ES6 Modules, Kapitalize, Avatars.io

Posted on .

You can send in your Node projects for review through our contact form or @dailyjs.

Node 0.8

Node 0.8 has been released, and Isaac Schlueter has written up a detailed post with some impressive benchmarks: Node v0.8.0. In terms of compatibility, reports from the community seem positive so far. As always, keeping an eye on the nodejs Google Group is a wise idea to gauge potential issues.

As I've been researching material for the Windows and Node series, I'm excited about the future of cross-platform addons:

GYP was used already in Node v0.6 to build on Windows, but now it defines the build on all platforms. Node is still in the process of migrating external addon modules to GYP, and node-gyp is included with npm. In future releases, node-waf will be officially deprecated.

The REPL has been improved -- long lines now wrap correctly, and built-in modules are automatically loaded without needing a require. For example, typing net will automatically return the net module. There's no magic to this, repl.js now defines a list of built-in modules that are automatically loaded when a command matches one.

Work has already started on 0.9, and Isaac mentions the long talked about HTTP refactoring. However, 0.6 releases will continue to the end of 2012, so don't fret if you're still heavily invested in 0.6.

ES6 Modules: A Simpler Proposal

The ECMAScript Modules Proposal represents a major point of contention in the JavaScript community. Frustrated at discussing it in 140 characters, Isaac Schlueter finally wrote what he really thinks of it all in On ES 6 Modules.

This isn't politics. We're not voting for parties. The goal is to figure out the best API, which is a complex thing. The solution space is wide, and it is naive to reduce it to a boolean prematurely.

The discussion is ongoing, but Brendan Eich responded directly here: ES Modules: suggestions for improvement

Static module systems are static, in dependency prefetching, in binding, and in export vs. import checking.

Kapitalize

Kapitalize (License: MIT, npm: kapitalize) is a Bitcoin client that has a chainable API and supports the Bitcoin API.

var kapitalize = require('kapitalize')()

kapitalize  
.auth('Macintyre', 'mypassword')
.set('host', '127.0.0.1')
.set({
    port:8332
})
.getNewAddress()
.getBalance()

The module includes tests, and documentation can be found in the readme.

Avatars.io

Avatars.io is a new service that makes avatars easier to work with for developers. The Avatars.io client library (License: MIT, npm: avatars.io) by Vadim Demedes is a Node module that works with this service:

AvatarsIO.upload('path/to/image.jpg', function(err, url) {  
  // url is a URL of just uploaded avatar
});

On a related note, Chute (npm: chute) by the same author is a client for Chute, which allows sets of photos to be uploaded and managed using a simple API.

Featured

speech APIs

JavaScript Speech Recognition

Posted on .

Elias sent us a link to his JavaScript speech recognition API at
speechapi.com. It uses Flash to record audio and sends it to a server, then the server returns suggestions to a
callback. You have to register to use the API. Using the API looks like
this:

var speechle;

function TheSettings() {
  var info = {'Userid':'eli', 'Logging':'true'};
  var eventCallbacks={'OnResult':'result', 'OnLogging':'logging', 'OnFinishTTS':'finishTTS'};
  var grammar={'Text':'one,two', 'Type':'simple'};
  speechle = new SPEECHLE(info,eventCallbacks,grammar);
}
</code>

The site has a few demos. One which worked pretty reliably for me was
the random quiz.

A similar technology is WAMI which uses
Java instead. You can try a demo in the WAMI
sandbox
.

Standards

There are W3C standards relating to speech recognition:

See the Voice Browser Activity for a
centralised pool of related W3C resources.