katy lavallee

katy lavallee

25 thoughts; 2 streams
last posted June 27, 2015, 9:24 p.m.
0

a skeptical, libertarian, day-dreamin', cheese-eatin', scifi-watchin', TV-obsessin', guitar-plinkin', pet-spoilin', django-lovin' web developer living in dfw

(if you want to talk to me i'm @katylava on twitter)

near dallas, tx
Joined on Feb. 4, 2014, 7:05 p.m.
get recent cards as: atom

I haven't posted in over a year because I'm primarily a Node developer now. I still don't understand the advantages of [almost] everything being async, but I feel like it must be better or why the hell would anyone deal with callback hell. Also our stuff scales really well and I never have to think about threads. Whenever we find something slow, it's almost always in rendering Express views... not any dev-opsy thing.

I've casually read up on Python's asyncio, but until I use it I won't understand it. I think with asyncio, you have to explicitly decide what is async, instead of things being async by default. It seems like asyncio is really low-level, and you have to manage a lot of the things that Node handles for you. It doesn't seem very fun to use.

Additionally, the Node community has grown so fast. While I used to be able to find a Python library for just about anything, now I have trouble. But, I can usually find several Node libraries.

I really miss so much about Python, and I still don't like writing Javascript, but Node is usually a more practical choice for me now.

14 thoughts
updated June 27, 2015, 9:24 p.m.

"I've learned the key to finishing such a big project is to do something on it every day. It doesn't matter if you spend just a couple of minutes or hours so long as you don't have long periods of ignoring it."
-- Paul Mulwitz, guy who builds planes in his spare time

This is a productivity tip closely related to procrastination. How many times do we procrastinate because we haven't touched a project in a long time, making the steps ahead are uncertain?

source

11 thoughts
updated April 8, 2014, 3:28 p.m.
11 thoughts
updated April 8, 2014, 3:28 p.m.
14 thoughts
updated June 27, 2015, 9:24 p.m.

Streams by this user that have been favorited by others.

No favorited streams yet.

0

I haven't posted in over a year because I'm primarily a Node developer now. I still don't understand the advantages of [almost] everything being async, but I feel like it must be better or why the hell would anyone deal with callback hell. Also our stuff scales really well and I never have to think about threads. Whenever we find something slow, it's almost always in rendering Express views... not any dev-opsy thing.

I've casually read up on Python's asyncio, but until I use it I won't understand it. I think with asyncio, you have to explicitly decide what is async, instead of things being async by default. It seems like asyncio is really low-level, and you have to manage a lot of the things that Node handles for you. It doesn't seem very fun to use.

Additionally, the Node community has grown so fast. While I used to be able to find a Python library for just about anything, now I have trouble. But, I can usually find several Node libraries.

I really miss so much about Python, and I still don't like writing Javascript, but Node is usually a more practical choice for me now.

0

Node debugging hack

I was getting stack traces from errors that had been passed back to several callbacks, and I couldn't figure out where the calling code was that started off the chain. So I came up with this ugly beast.

function injector(callback) {
    var trace = new Error().stack;
    return function(err, res) {
        if (err) {
            err.injection += trace + '\n' + new Error().stack + '\n\n';
        }
        callback(err, res);
    };
}

Which can then be called like so with async:

var myLib = require('myLib');

async.each([
    function oneThing(cb) {
        myLib.doSomethingAsync(injector(cb));
    },
    function twoThing(cb) {
       myLib.aDifferentAsync(injector(cb));
    }
], function(err, res) {
    // handle results
});

In injector, the first call to new Error().stack will tell you whether it was oneThing or twoThing that ultimately generated the error. The second will tell you where in myLib the call came from.

Before this my stack traces only had information from deep in the dependency tree.

I haven't tried this yet on a callback with an error that's already been injected. I wonder if all that info would be needed or if the most recent call would be enough.


Just realized, since I'm not using this in production, I can do this instead:

function injector(callback) {
    var trace = new Error().stack;
    return function(err, res) {
        if (err) {
            console.trace(trace);
        }
        callback(err, res);
    };
}
0

I wish I could use Nunjucks instead of EJS. I think it has enough embedded logic to do the stuff we do.

0

EJS is hideous. I hate looking at it's stupid face.

0

So many useless stacktraces.

0

"I've learned the key to finishing such a big project is to do something on it every day. It doesn't matter if you spend just a couple of minutes or hours so long as you don't have long periods of ignoring it."
-- Paul Mulwitz, guy who builds planes in his spare time

This is a productivity tip closely related to procrastination. How many times do we procrastinate because we haven't touched a project in a long time, making the steps ahead are uncertain?

source

0

I'm still not clear on what the advantages are of working with callbacks and asychronicity and event loops and such. I get that it can be useful for the app to be doing more than one thing at a time... but how much of a difference does that really make?

0

I'm reading this node book and I'm really impressed by the simplicity and elegance in writing node and express apps. Of course, the book has trivial examples, but I can imagine being able to keep it simple even with a "real" app.

Aside from having to write Javascript instead of Python, I think I will enjoy writing node apps.

I should really play with Flask though... it might just be that this is the first I've really dived into a micro-framework.

0

Yeah node is definitely not the new PHP. You have to know what the fuck you're doing to use node.

Ok, I suppose you don't have to, but there's a lot more to it that you should than the basics of "make web app go", which is all PHP is.

0

I don't think I'll ever grok the event loop.

0

Momentum is a really nice extension for Chrome to help focus. It has a very minimal interface with a new gorgeous background photo every day. You can enter your main focus front and center, and you can put your 3 todos for the day in the lower right corner, and collapse them so they don't bother you while you are focusing on your current task.

It also has the current time, an inspirational quote, and the current weather.

0

I made this list hoping it would be a go-to for when I feel like procrastinating... I could look at this list before I decide to watch TV or take a nap. It's not working out very well because the main reason I procrastinate is either that I'm tired (for no good reason) or I'm anxious. The slow breathing (or yoga) doesn't really help... sometimes it makes me more anxious because it's not working.

If anyone has any tips to get past that point, please please tell me (I'm @katylava on Twitter). Well, any tips that don't involve medication (anti-anxiety meds put me to sleep).

Thankfully I only have this problem at home, not at work. I do get really sleepy at work, but I can't put my head down and there's nothing else to do, so at the very least I stare at my open files until something comes to mind. At home however, I don't have that external pressure so I have to rely solely on willpower points.

0

I've finished my first week at my new job where I'm a node developer. I'm very impressed with the code my new colleagues have written. I've heard people say that node is the new PHP, but from what I've seen so far I don't think that's true.

We're also using MongoDB in smart ways, which surprised me considering all the jokes about how bad it is.

I do miss Python, though, I did write a fab script to get my node dev env up and running.

Mostly I'm worried I'll lose touch with the Python community. I'm not going to PyCon this year like I hoped (I have never been before either). I was on the fence for a while, and then I decided to go, but before I got around to it, the tickets were sold out. Probably for the best because I don't think I could have taken vacation at that time anyway.

Having a regular job now I only get 2 weeks vacation a year, I need that to see family, so I probably won't be going to any conferences unless work sends me, and they don't have a reason to send me to a Python conference.

That was a bit rambly, but hey, it's called "thoughstreams" after all.

0

NO, you cannot play just one game.

(You probably shouldn't play games on your breaks either.)

0

Pick three things to get done today (or less, if it's later in the day, but no more). Write them down. Focus on one at a time.

See "How to Focus" below.

0

How to Focus

  1. Set aside blocks of time to work, and during that time, turn off or silence all notifications. Don't keep your email open. Block distracting sites if possible (find a browser plug-in to help you with this).

  2. Keep a minimalist work area. Remove clutter and put away notes not related to what you are trying to focus on.

  3. Put a note about what you are focussing on in an easily-visible place. For example, a post-it on your monitor (assuming it's the only one there, which it should be).

Related to #1, it's helpful to dedicate your computer to work only (at least during working hours). Try using your phone or tablet during breaks to check your social networks, instead of your desktop. Of course, this is after you spend some time looking at something other than a screen.

0

If procrastinating due to anxiety, do 5 -10 minutes of slow breathing and stretching.

Then try one of the other things here.

0

If you aren't sure what the next step is, start reading the relevant documents and making notes. After a little while you will sort it out.

0

Set a timer for 25 minutes. Either do what you are supposed to do, or do nothing at all. Don't do something else.

Turn off or silence all notifications and block distracting sites if possible.

0

Just open the files you are supposed to be working on, take a look at them, and figure out the next step. Write it down and take a break.

0

Open up a temp document and just start typing your thoughts. Eventually you'll figure out why you are procrastinating, then you can tackle the why.

0

"As a guideline, if the relationship between exports and module.exports seems like magic to you, ignore exports and only use module.exports." -- yes, ok, thank you for this because I still don't get it.

0

Ok, I read the Express API docs and it seems pretty cool. It's straight-forward and fairly elegant too.

0

I had to test this to make sure it was true before saying... go home JavaScript... you're drunk.

10:55:57 🌵 node
> var test = [1, 2, 3, 11, 15, 21, 10]
undefined
> test.sort()
[ 1,
  10,
  11,
  15,
  2,
  21,
  3 ]
0

EJS templating is giving me horrible flashbacks to PHP development.

Thoughts by this user that have been liked by others.

No liked thoughts yet.