webdevRefinery Forum: Kyek - Viewing Profile - webdevRefinery Forum

Jump to content

Reputation: 1085 Excellent
Group:
Administrators
Active Posts:
6870 (5.66 per day)
Most Active In:
General Discussion (1783 posts)
Joined:
20-February 10
Profile Views:
27371
Last Active:
User is offline Jun 12 2013 05:13 AM
Currently:
Offline

My Information

Member Title:
Founder of wdR
Age:
29 years old
Birthday:
March 9, 1984
Gender:
Male Male
Location:
Philadelphia, PA, USA
Expertise:
HTML
CSS
PHP
Java
Javascript
Node.js
SQL

Contact Information

E-mail:
Private

Latest Visitors

Topics I've Started

  1. Toady :)

    08 June 2013 - 01:52 PM

    So in my couple free hours at night, I've been entertaining an obsession called Toady.

    Toady is an IRC bot. Big whoop, right? Sure. Until you change Toady's code and it takes effect without a restart, or even reconnecting it to the server. Or until you go to install a new third-party Toady mod, and you realize that Toady's entire public package manager for mods is only about 200 lines long, and half of that is jsdoc.

    Obviously, Toady is written in Node.js, but recently I've been digging deeper into the core to see what I could make Node do that hasn't been widely explored yet. Things like editing the require() cache in a running application, resolving module keys, selectively rerouting stdout and stderr, and using npm programmatically to turn it into a package manager just for Toady mods.

    It's nothing Earth-shattering; I mean, it's all in the Node.js docs, so it's not like I'm hacking the node source or anything. It's just that so much of it hasn't been touched in mainstream Node applications -- ESPECIALLY the concept of reloading modules without restarting the application -- that I had to play with it. And it's turned into a pretty solid and easily extensible IRC bot, to boot :). Right now there aren't a ton of third-party mods to make it fun (actually, at the time of this posting, there's exactly one), but I hope to write a few more once I can convince myself to stop tweaking the framework ;-).

    Check it out: https://github.com/TomFrost/Toady
  2. Superhero JS

    20 March 2013 - 09:46 AM

    I haven't gotten a ton of time to peruse this yet, but so far it seems like a pretty epic information repository for people who have used Javascript without really knowing javascript.

    http://superherojs.com
  3. Gettin' ticky with it

    19 March 2013 - 09:09 AM

    Node 0.10.0 was released last week, and is generally awesome. Isaacs put together a nice blog post for the changelog here but I think the most important thing to note is how very seriously they screwed process.nextTick().

    According to the docs for versions previous to v0.10, calling nextTick() with a callback function would cause that function to execute in the next pass through the event loop -- the next "tick". This was never accurate. When you called process.nextTick() before, it added your callback function to a 'nextTick' queue, and it would empty that queue TWICE in a single trip through the event loop. Once before preparing the IO callbacks for that iteration of the loop, and once after the callbacks were run. As a result, it was hard to rely on it, because consider this code:

    process.nextTick(function() {
        doSomething();
        process.nextTick(function() {
            doSomethingElse();
        });
    });
    


    Will doSomethingElse() run after any queued IO is taken care of, or will it execute immediately after doSomething()? With process.nextTick() as it was, you would never know. That needed to change.

    So the thinking was this:
    • the nextTick queue needs to be emptied just once per loop.
    • nextTick alone is a bad solution, as people were using it when they DID want immediate execution, as well as when they wanted something to happen on the next tick.
    • To address the above, we need TWO functions. nextTick(), and setImmediate().
    • Ideally, if you set a function to execute immediately, PLUS if that function also sets something to happen immediately as it runs (and so on and so on until a set cap is hit) it will all happen at that moment, while the queue is being emptied.


    So for Node v0.10.0, they did exactly that. The nextTick queue empties once per loop, and there's now a way to set something to happen on the next tick, as well as a way to set something to happen immediately in the current tick.

    The way to set something to happen immediately is called process.nextTick().
    The way to set something to happen in the next tick is called setImmediate().
    I am not joking.


    I understand why the decision was made -- it's a really hard call. setImmediate is on the window object and is already documented as a way to break up long-running logic by having pieces of the logic execute after events have been handled. So if you're on the Node team, do you continue this loosely-documented proposal as-is, or do you use your weight to push a more sensible naming convention and keep your codebase logical? I would have gone with option 2, since the only entity behind setImmediate() in its current form is Internet Explorer and this hasn't stopped the greater standards community from realizing better versions of those concepts in the past.

    So if you make any use at all of process.nextTick(), it's best to read that blog post and decide whether you want your code to actually execute on the next tick, or as immediately as possible in one lump. And once you decide that ... call the function named the exact effing opposite of what you want. What a ridiculous decision.

    Regardless though, this is important because if you were using process.nextTick() to break up any potentially heavy processing so that it doesn't block your IO handlers, you need to use setImmediate() now or you WILL block your IO (which steams me even more, because if the functionality matched the name, no one would even have to change their code). For example, the following function will complete ALL of its loops before the tick completes:

    function lotsOfTicks(count) {
        if (!count)
            count = 0;
        if (count < 1000000) {
            process.nextTick(function() {
                lotsOfTicks(count + 1);
            });
        }
    }
    
    lotsOfTicks();
    


    Happy fuming!
  4. New Trends in Open Source

    12 March 2013 - 01:05 PM

    Normally, open source means putting your project up on a public repo, making sure it doesn't contain security credentials, the code is sane/safe, etc. But recently, another company has taken a different approach to open source:

    http://phone.directo...o-36256851.html

    (If they happen to fix it before you see the link... screenshotted xD http://i.tomfro.st/3IjUe.png . There's even more code further down than that, but advertising that you're susceptible to easy SQL injection is probably as bad as it gets xD)
  5. Want to keep your web app secure?

    24 January 2013 - 03:01 PM

    Then please do your best not to show up in these search results.

    https://github.com/s...sults&type=Code

    Ouch, devs. Ouch.

Comments

  • 6 Pages +
  • 1
  • 2
  • 3
  • Last »
  1. Photo

    hydralisk 

    12 Mar 2012 - 12:18
    STUPID N00BIE
  2. Photo

    Fike 

    06 Jan 2012 - 17:49
    Check your inbox! ^_^
  3. Photo

    Fosjam 

    22 Dec 2011 - 12:34
    Psst, would it be possible to get Imp in the new IRC rooms? Both preferably. Just to make things easier. And also to keep them inhabited.
  4. Photo

    fauverism 

    07 Nov 2011 - 07:17
    Hey Kyek,
    Expect more of me on the WebDev, I love the vibe that this site gives off!
    ®
  5. Photo

    Leamsi 

    06 Nov 2011 - 23:07
    So, I was wondering; are you Ok with the type of threads I've been posting on the site? I've seen a few "controversial" threads started (specificly My sex thread, and Mo3's drug thread.) And, they kindof started to go downhill at points. I was just wondering if your OK with these, and if your not, i'll stop posting stuff like that. Thanks, reply on my profile please. (or...
  6. Photo

    sparkhh 

    06 Aug 2011 - 15:44
    Hey kyek, if you can please can you look into the PM i sent you about a month back, 11july :) I am really looking for some proper advice. I am very confused what to do in it.
    Just a small answer would do great, i know you are very very busy and i wouldnt have PM'd you as such :)
  7. Photo

    JustinP 

    28 Jun 2011 - 19:12
    Can you fix the "New Content" button so when clicking it from PMs, it links to new posts instead of newly joined members? Thanks.
  8. Photo

    Fosjam 

    22 May 2011 - 06:07
    Roll had saved the picture so I could have reuploaded it and changed the icon, but this was easier ;)
  9. Photo

    Fosjam 

    22 May 2011 - 05:27
    Just so you know, you broke the supporters icon. It was hosted on your site rather than Imps.
  10. Photo

    callumacrae 

    18 May 2011 - 11:15
    To be unhelpful! :D
  11. Photo

    Fike 

    23 Apr 2011 - 15:24
    Ah, that would be a nice project. Something like, people in the community pitch in with code :D
  12. Photo

    Fike 

    23 Apr 2011 - 15:18
    Ah, I wasn't around the scene at the time of Appulous. Yeah, if you need any help with IPB, I'm your man :). Had more than 6 months experience with IPB and know most of the system. Or a mini mod or anything. :D
  13. Photo

    Fike 

    23 Apr 2011 - 15:13
    thanks for the rep :). Didn't you do work at Hackulous?
  14. Photo

    Ruku 

    12 Apr 2011 - 15:06
    Harsh! I'm still going to be a grammar nazi in all of my posts, if it's any consolation? :p
  15. Photo

    sparkhh 

    07 Apr 2011 - 08:25
    Hey kyek,
    Would really appreciate some directions, SVG based application.
    http://www.webdevrefinery.com/forums/topic/8090-virtual-circuit-designer/page__pid__82184#entry82184
    Thank you.
  • 6 Pages +
  • 1
  • 2
  • 3
  • Last »

Enter your sign in name and password


Sign in options
  Or sign in with these services