News for hackers. Stuff that matters.
Re:Show HN: Introducing Q.js, a library for modern web apps by enobrev on Tuesday July 16, 2013 @01:27PM (#6053305)
This looks like a very interesting library. Thank you for sharing it. In case you didn't already know, there is already a very well known javascript async library called Q.

https://github.com/kriskowal/q

Re:Show HN: Introducing Q.js, a library for modern web apps by cowbertvonmoo on Tuesday July 16, 2013 @04:06PM (#6054395)
I published Q in 2009. I based it on another project by the same name and API that was published by Tyler Close in 2007. https://waterken.svn.sourceforge.net/svnroot/waterken/server... His work was based on the E programming language and the name is a reference to the underlying event "queue".

Q is around the 20th most depended-upon package in the Node.js package manager, NPM and is downloaded about 100,000 times a month. https://npmjs.org/package/q

I would recommend calling your library Qbix.js with the Qbix name space.

Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @05:20PM (#6054812)
That's a good recommendation. Maybe we'll call it the Qbix library. It's just that our entire large framework (which primarily runs on PHP and Node.js) is called Q, and what I published is just one file from the front-end SDK..
Re:Show HN: Introducing Q.js, a library for modern web apps by bhouston on Tuesday July 16, 2013 @02:24PM (#6053733)
Yes, I also found that immediate confusing. Might be time to start using two letters for the names of JavaScript libraries. ;-)
Re:Show HN: Introducing Q.js, a library for modern web apps by dlsym on Tuesday July 16, 2013 @03:01PM (#6054021)
"Q.md5 - to one-way-encode passwords etc. in insecure websites before sending to the server"

This is a very bad advice which leads to a false sense of security:

1. A fast hash function is not desired for hashing passwords. (Bruteforce)

2. There are TBs of rainbowtables for unsalted md5.

3. If you use a salt, you would have to expose it clientsided.

Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @05:20PM (#6054814)
You are most likely right. I should explain instead that the md5 should be used to verify HMACs sent by a service. However, when sending passwords over the wire, the client should ideally hash it and the username/email + id of the provider should be used as the salt. That way different providers can't impersonate a user on each other's servers. This salt SHOULD be applied on the client side even if you are using https, or you are actually trusting the provider to not misuse or leak your password, e.g. in logs. See for example http://blog.cloudflare.com/cloudflare-prism-secure-ciphers
Re:Show HN: Introducing Q.js, a library for modern web apps by cmircea on Tuesday July 16, 2013 @05:34PM (#6054888)
Fast? I don't think a suitable word exists to express the speed of MD5 on GPUs, but here are the numbers: 8213.6 M/s, AMD 7970.
Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @01:17PM (#6053227)
I've open-sourced one part of our company's Q framework -- the library we use on the front end.

It contains a lot of stuff that took us a while to design and write and test on all browsers. If you wind up using it, I would love to hear your feedback. Ask me any questions if you get stuck. You can also contact me here: http://qbix.com/about

Re:Show HN: Introducing Q.js, a library for modern web apps by nicksergeant on Tuesday July 16, 2013 @01:26PM (#6053296)
There's a very well-known JS library already named "Q", here: https://github.com/kriskowal/q

I'd suggest a name change.

Re:Show HN: Introducing Q.js, a library for modern web apps by lancefisher on Tuesday July 16, 2013 @01:55PM (#6053494)
This is the Q.js I thought they were talking about at first too. I second a name change.
Re:Show HN: Introducing Q.js, a library for modern web apps by stormbrew on Tuesday July 16, 2013 @01:36PM (#6053372)
Yeah, this was very confusing. I thought this was some kind of extension to that library at first.
Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @02:11PM (#6053639)
Well, we started about 2 years ago and our company's been calling it Q internally. This is just the front end SDK for what we built (Q spans PHP, Node.js and front end css/js.) I think we're going to keep the name.
Re:Show HN: Introducing Q.js, a library for modern web apps by alanh on Tuesday July 16, 2013 @02:26PM (#6053758)
This is the biggest piece of feedback you have gotten yet. Q isn’t nearly as famous as e.g. Backbone or Ember or Modernizr, but it is established and well-known. Your name is actually a barrier to this catching on, I think.
Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @02:43PM (#6053884)
What if ours becomes better known? As I said we've started 2 years ago.
Re:Show HN: Introducing Q.js, a library for modern web apps by jjsz on Tuesday July 16, 2013 @03:00PM (#6054004)
This is where you ask yourself "would I like if someone releases a product with the exact same name as my company's and moved us to the second page of Google?".
Re:Show HN: Introducing Q.js, a library for modern web apps by shardling on Tuesday July 16, 2013 @02:56PM (#6053978)
Even if that was somehow relevant (it doesn't really matter what you called it internally if you didn't use the name publicly), the existing Q.js is older!

Here is the first public version, from 3 years ago: https://github.com/Gozala/q/tree/v0.1.0

Re:Show HN: Introducing Q.js, a library for modern web apps by jbigelow76 on Tuesday July 16, 2013 @02:55PM (#6053973)
You may have started two years ago but you only open sourced it for the community two hours ago.
Re:Show HN: Introducing Q.js, a library for modern web apps by tudborg on Tuesday July 16, 2013 @03:04PM (#6054038)
that is a bit childish. the time you began development is not relevant, and seeing as q.js is already popular, it is safe to say it will stay that way. changing the name is great advice. consider it.
Re:Show HN: Introducing Q.js, a library for modern web apps by tlrobinson on Tuesday July 16, 2013 @03:40PM (#6054254)
As a long time user of the original Q (which has been around since at least 2009 [1]), I'd also suggest picking a different name for another reason: searchability.

[1] https://github.com/kriskowal/q/commit/9191ce4c803cc3f8a01fb6...

Re:Show HN: Introducing Q.js, a library for modern web apps by shintoist on Tuesday July 16, 2013 @02:42PM (#6053880)
You are throwing your work away by giving it the same name as an already established JS library.
Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @03:15PM (#6054105)
OK sorry let me put it another way ... the larger library is meant to run on PHP and Node.js, and the Q.js and front end part is just the SDK to use it on a web browser. So when the whole thing is released, it will mostly be a PHP+Node.JS+Web library.
Re:Show HN: Introducing Q.js, a library for modern web apps by devgutt on Tuesday July 16, 2013 @01:56PM (#6053510)
http://qbix.com/contact doesn't point to anything.

Maybe this http://qbix.com/about#contact

Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @02:10PM (#6053631)
Sorry - it's /about
Re:Show HN: Introducing Q.js, a library for modern web apps by alanh on Wednesday July 17, 2013 @02:27PM (#6059310)
You should add a redirect from /contact. http://alanhogan.com/url-as-ui
Re:Show HN: Introducing Q.js, a library for modern web apps by blutack on Tuesday July 16, 2013 @02:56PM (#6053976)
I agree, it's a neat looking library.

  Q.md5 - to one-way-encode passwords etc. in insecure websites before sending to the server
However, I'm not sure promoting unsalted MD5 as a password hashing algorithm and a replacement for https is a good idea.

There are a multitude of alternatives which would be more suitable. Alternatively, don't promote the md5 module as being for passwords.

Re:Show HN: Introducing Q.js, a library for modern web apps by j_baker on Tuesday July 16, 2013 @01:29PM (#6053320)
What does Q do? Apart from providing a "library for modern web apps" (whatever that means).
Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @02:40PM (#6053856)
It has some minor overlap with jQuery but literally it is built to provide a unified solution to all the "other" challenges that an WEB/MOBILE WEB APP developer faces. Such as:

Reusable tools - Q comes with a lot of reusable tools you can just drop onto a page, many with their own back end and they "just work" when you Q.activate the page

Not refreshing the whole page - Q has virtual pages loaded with AJAX and slots (content areas) to fill on the page. Q.handle(url) simply loads the url for example and activates all the tools for you.

Event system - you nee to be able to remove event handlers when the page is unloaded or a tool is removed

Integration with PhoneGap, jQuery, touch vs non touch environments, etc.

But the coolest stuff is the middleware. You can literally write apps that get objects like this:

    Users.byId(uid, function(err, user) { ... } );
and not care how it gets the user object. If it already cached it then it uses the cached version. If it already requested it, it puts your callback on a waitlist instead of sending again. When response comes back it calls all callbacks on the list. It also can do throttling, and batching of requests. And all the while you just have to use the construction above to get objects.

Oh and Q supports socket.io so if you have node running you can update caches via a push so they are almost NEVER out of date!

Furthermore a lot of the time your JS code has a functional programming character, such as "wait until these objects are fetched, then do this". So just use this:

    var p = new Q.Pipe(["user", "stream"], callback);
    Users.byId(uid, p.fill("user"));
    Streams.get(publisherId, streamName, p.fill("stream"))
You can even use it with any unsuspecting library since it produces callbacks you pass to this library.

So basically:

Virtual pages and tools you drop on them, set and forget

Model done via caching and realtime updates, query and no worries. Use Q.pipe to wait for some objects then do what you wanted to do

Connect everything together with event handlers

Boom your app coming together quickly. Other libraries (like jQuery) are for manipulating DOM and other stuff. This library helps you build rich web APPS.

Re:Show HN: Introducing Q.js, a library for modern web apps by ndnichols on Tuesday July 16, 2013 @05:19PM (#6054808)
Is there a cohesive idea or approach here? This just feels like a bunch of unrelated utility functions. And there's basically no documentation, right? The readme description of Q.getter is just "Q.getter - wrapper which makes any getter function smarter, using caching, waiting, throttling, without worrying about ", while the docstring for the method is 30 lines long and I still have no idea what it does or how to use it. It seems like you're doing some really heavy, serious work in this library with a ton of library-specific options, etc. If that's the route you're taking, I think you're going to need real documentation, tutorials, etc. if you expect this to get any uptake.
Re:Show HN: Introducing Q.js, a library for modern web apps by EGreg on Tuesday July 16, 2013 @06:37PM (#6055187)
I completely agree. I just wanted to put out one file from our framework and get some early feedback.

But Q.getter for example is just that easy. Try this:

1) Include Q.js

2) Take any function that gets stuff from any web server and calls one or more callbacks, let's say function X

3) Do this: X = Q.getter(X)

Now use your function :))))

See how it improves efficiency? It caches the result, it prevents multiple requests to the same thing, etc. Next you can tell it what to use for the cache, by another parameter to Q.getter. And finally you can hook up socket.io to update the cache on a push!

Re:Show HN: Introducing Q.js, a library for modern web apps by camus on Tuesday July 16, 2013 @01:31PM (#6053337)
doesnt mean anything and the readme file fails to explain what does that lib do. EDIT : looks like a prototype/dojo utility library , not a framework.
Re:Show HN: Introducing Q.js, a library for modern web apps by ricardobeat on Tuesday July 16, 2013 @04:29PM (#6054536)
Releasing useful tools/libs as open-source is always a good thing, so congratulations and thank you.

However, I believe monolithic libraries are on the way out. Having small, composable libraries is a much better model: well-defined boundaries, easier to test, understand, maintain and contribute to. The shared knowledge that results can also lead to more stable/standardized APIs.

From a quick look, this library covers the same surface as jquery, backbone, underscore, a cookie-handling lib, async, a caching middleware, crypto, and more, added together. Adopting it for a project is a huge commitment, and means that every little piece of it has to fit your project well, or pieces of your project will have to be hammered to conform. I imagine it would spark more interest if it was broken down into smaller libraries.

Re:Show HN: Introducing Q.js, a library for modern web apps by nawitus on Tuesday July 16, 2013 @03:21PM (#6054144)
>Q.mixin - a way to do class inheritance the Javascript way

Note that the next major JavaScript version will have classes and inheritance, and the specification will probably be finalized this year. (Not a critique really).

Re:Show HN: Introducing Q.js, a library for modern web apps by joshontheweb on Tuesday July 16, 2013 @03:16PM (#6054117)
Holy 8 space indentation, Batman!
Re:Show HN: Introducing Q.js, a library for modern web apps by robodale on Tuesday July 16, 2013 @01:45PM (#6053419)
Another one?
Re:Show HN: Introducing Q.js, a library for modern web apps by aconz2 on Tuesday July 16, 2013 @01:39PM (#6053383)
The internet does not need another 5000 sloc JS library attempting to solve every problem in one file. Please put your effort towards improving upon other, focused libs.
Re:Show HN: Introducing Q.js, a library for modern web apps by pearjuice on Tuesday July 16, 2013 @01:53PM (#6053481)
Don't you enjoy your daily dose of obscure Javascript libraries?
Re:Show HN: Introducing Q.js, a library for modern web apps by maxsavin on Tuesday July 16, 2013 @03:15PM (#6054110)
Nice work Greg!
Re:Show HN: Introducing Q.js, a library for modern web apps by camus on Tuesday July 16, 2013 @01:30PM (#6053331)
Change the name, there is already a well known lib named q which deals with promises and and async .
Re:Show HN: Introducing Q.js, a library for modern web apps by codereflection on Tuesday July 16, 2013 @02:38PM (#6053847)
I was just going to say that