Open Side Menu Go to the Top

01-18-2016 , 06:02 AM
I guess as an example, here's the cache I wrote:

Code:
var fileCache = {
  getZippedData: function(pathname, callback) {
    var data;
    if (data = this[pathname]) {
      console.log('Pulling from file cache');
      return callback(undefined, data);
    }
    else {
      var thisCache = this;
      fs.readFile(pathname.substr(1), function (err, data) {
        if (err) {
          console.log(err);
          callback(err, data);
        }
        else {
          var fileText = data.toString();
          zlib.gzip(fileText, function(err, data) {
            console.log(fileText.length + ' bytes packed to size ' + data.length);
            thisCache[pathname] = data;
            callback(undefined, data);
          });
        }
      });
    }
  }
};
Here's how I would do it in C++:

Code:
class FileCache {
public:
  using ZippedBuffer = std::pair<uint8_t*, size_t>;
  using Callback = std::function<Json::Value*, ZippedBuffer*>;

  void GetZippedData(const std::string& pathname, const Callback& callback) {
    auto it = _cache.find(pathname);
    if (it != _cache.end()) {
      callback(nullptr, &it->second);
    }
    else {
      std::ifstream inFile{pathname.substr(1)};
      std::ostringstream strstream;
      strstream << inFile.rdbuf();
      std::string fileContents{strstream.str()};
      someAsyncGzipRoutine(fileContents, [this, pathname] (const Json::Value* error, const ZippedBuffer& outBuffer) {
        if (error != nullptr) {
          _cache[pathname] = outBuffer;
        }
        callback(error, outBuffer);
      });
    }
  }
}
  
private:
  std::unordered_map<std::string, ZippedBuffer> _cache;
};
I'll admit that even as a professional C++ programmer, the C++ code took me longer to write out than the JS version (something I'm only just starting with). I can see some value there.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
01-18-2016 , 11:39 AM
Four lines of code for a server?

Rails can name that tune in one. And run it with six more characters!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 01:09 PM
Quote:
Originally Posted by goofyballer
I guess as an example, here's the cache I wrote:

Code:
var fileCache = {
  getZippedData: function(pathname, callback) {
    var data;
    if (data = this[pathname]) {
      console.log('Pulling from file cache');
      return callback(undefined, data);
    }
    else {
      var thisCache = this;
      fs.readFile(pathname.substr(1), function (err, data) {
        if (err) {
          console.log(err);
          callback(err, data);
        }
        else {
          var fileText = data.toString();
          zlib.gzip(fileText, function(err, data) {
            console.log(fileText.length + ' bytes packed to size ' + data.length);
            thisCache[pathname] = data;
            callback(undefined, data);
          });
        }
      });
    }
  }
};
Here's how I would do it in C++:

Code:
class FileCache {
public:
  using ZippedBuffer = std::pair<uint8_t*, size_t>;
  using Callback = std::function<Json::Value*, ZippedBuffer*>;

  void GetZippedData(const std::string& pathname, const Callback& callback) {
    auto it = _cache.find(pathname);
    if (it != _cache.end()) {
      callback(nullptr, &it->second);
    }
    else {
      std::ifstream inFile{pathname.substr(1)};
      std::ostringstream strstream;
      strstream << inFile.rdbuf();
      std::string fileContents{strstream.str()};
      someAsyncGzipRoutine(fileContents, [this, pathname] (const Json::Value* error, const ZippedBuffer& outBuffer) {
        if (error != nullptr) {
          _cache[pathname] = outBuffer;
        }
        callback(error, outBuffer);
      });
    }
  }
}
  
private:
  std::unordered_map<std::string, ZippedBuffer> _cache;
};
I'll admit that even as a professional C++ programmer, the C++ code took me longer to write out than the JS version (something I'm only just starting with). I can see some value there.
The C++ code in my view would be better expressed as a function template. Your class only had one member, basically you've paramaterized ZippedBuffer and Callback. Same could be done for the type that _cache is associated with. By doing that you decouple from the specific STLs you reference.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 01:48 PM
Had my first ever interview for a coding job today. Overwhelming and pretty horrible. I've got a long way to go...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 02:11 PM
Sorry it went so poorly. What sort of questions did they ask?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 02:22 PM
Very basic data modelling stuff mostly. I couldn't really follow a lot of the instructions and was totally unprepared. I had done a project for them last week and thought it would be talking about that/general interview stuff, but I think it was more of a basic technical skills screening interview.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 03:49 PM
Don't feel bad. Technical interviews are hard and not many people do well their first time out.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 08:48 PM


A girl I met traveling (30, seems bright) just posted this on FB. Here is my response.

Quote:
Don't spend a lot of money. Most of this stuff you can teach yourself if you have the aptitude. There are plenty of free self-driven online programs (Code Academy I think?). I took a couple of community college classes and created some side projects to get started. Might not work for everyone but it worked for me.
Thoughts? You guys are a lot closer to some of this stuff than I am.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 09:34 PM
meh I can't imagine that doing a bootcamp is a bad idea if you can easily afford it. Not everyone is self motivated to learn on their own.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 09:40 PM
Well she was basically broke traveling in South America working for tourist companies or teaching English. Maybe she has some money saved up or something. I'm not very self-motivated either but community college nudged me into it and then someone paid me to write an e-commerce site in perl lol.

Quote:
It's all good thanks for the help! I want to apply to Ada developer academy it's just for women and it's free and it's a year long program with an intern program with sponsors of the school
And job placement too
That sounds awesome if she can get in.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 11:25 PM
Quote:
Originally Posted by suzzer99


A girl I met traveling (30, seems bright) just posted this on FB. Here is my response.



Thoughts? You guys are a lot closer to some of this stuff than I am.
GA, dev boot camp, and code dojo all kind of suck. I've read a couple horror stories from CD and I've interviewed several people from GA and DBC.

DBC in particular seems shady in that they appear you accept everyone who had the money. It's very common for their 3 month course to stretch to 6 months because students aren't ready to progress.

I'm an App Academy grad and I've interviewed a couple of other grads. We ended up not hiring either of them, one accepted another offer before his on site interview and the other was technically competent but didn't know what kind of role she wanted.

The program wasn't perfect but I learned a ton and I think it sets people up well for success.

I work with a girl that is a bloc grad and she's a very good junior engineer. I don't know how much of that can be traced back to bloc since her live in bf is a Google engineer so she had a much stronger support system than most.

My advice is to explore enough that she knows she wants to be a programmer for reasons beyond just money and to find a program that at least defers payment until job placement.

Suzzer, we're fb friends if you want to put her in touch with me I'm happy to give more detailed feedback about my own experience
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2016 , 11:34 PM
Awesome I will - thanks!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 12:29 AM
Quote:
Originally Posted by blackize5
technically competent but didn't know what kind of role she wanted.
Can you expand on this one please? I mean, if people are able to change minors in college during a 6 year education, why should someone who just started programming 6 months prior know about the entire development world?

And does it make a huge difference if said person shows interests in front-end or back-end work?

I'm just asking because I honestly never had a job where I had some massive expectations. I just progressed through and the incoming knowledge seldom had anything to do with the job at hand, and seldom had anything to do with the job I had 6 months later.

And also, if in a startup, people often wear many hats, would someone not having a specific interest be beneficial to the company? "I only do JS when the entire server is burning" would be a crummy spot, yeah?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 12:45 AM
Sure, happy to elaborate.

At the time we had a junior full stack engineer posting, a senior full stack engineer posting, and a junior product manager (no coding) posting. During her interview for the jr full stack position she let slip that she had applied for the product posting too and said she would be happy with either role.

We let her know that the product role had no coding aspect to it and she affirmed that she knew that and that she's ok with it.

That seemed like a red flag to us that she had just spent a few months gaining these coding skills and didn't seem to care if she got to put them to use or not.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 12:50 AM
Ah, makes sense.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 03:42 AM
Generally I am against a bootcamps but if since she's a chick, she definitely has a leg up on getting hired. Everyone is out there trying to hit their quotas.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:50 AM



Updates: got socket.io up and running so I'm sending map data through that instead of including it in the html. Still weirds me the **** out to use a typeless language - do you JS programmers just learn by heart what things mean eventually? Or do I need to free myself entirely from the prison of thinking in types?

Like, things like
- calling app.listen() instead of http.listen() made my express routing do bad weird things that made me not happy (not really a type issue I guess since obviously both of those are functions that exist and are valid)
- accidentally sending a Buffer into my socket instead of a string because I didn't call toString() on the return value from fs.readFileSync, which made an ArrayBuffer come out the other end and made me be like "wtf am I supposed to do with this" until I fixed the server side
- constantly ****ing up what functions I can send an object into versus what functions I have to send a JSON string into and only finding out at runtime that I messed up
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 07:36 AM
Goofy,

Usually type hints in documentation, which really sucks because it ends up being way more verbose than most typed languages.

For example:
http://usejsdoc.org/tags-param.html#examples

Some editors like Webstorm can pick up on these to help give you type-intelligent code complete too.

There's http://www.typescriptlang.org/Tutorial too, but now we're going into a different realm and adding something like this adds a lot of complexity.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 09:50 AM
Quote:
Originally Posted by goofyballer
do you JS programmers just learn by heart what things mean eventually?
yes. Most of the work that goes into learning an open source framework in JS is memorizing or knowing how to quickly access parameter types. A lot of them (jQuery) use duck typing in a systemic way which you can sort of remember i.e. the first function in a parameter list will be the callback regardless of if its the 2nd or 3rd parameter.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 10:46 AM
Quote:
Originally Posted by blackize5
I'm an App Academy grad and I've interviewed a couple of other grads. We ended up not hiring either of them, one accepted another offer before his on site interview and the other was technically competent but didn't know what kind of role she wanted.

The program wasn't perfect but I learned a ton and I think it sets people up well for success.
From the resumes I've seen, it seems to me that the value of top bootcamps is more in signaling, credentialing and career counseling than actual technical skills you learn - would that be fair? It seems to me that AA only accepts people who, for the most part, are smart enough to learn on the job, have strong credentials, well at least in terms of non-technical things that companies look for and are culturally close to startup ecosystem mainstream.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 11:53 AM
I would say that's partially accurate.

Certainly a large part of why the top few camps are successful is their very selective admissions process.

AA in itself isn't much of a signal/credential and their career counseling can be boiled down to: send a ton of applications, prepare like crazy, and basic salary negotiation.

They do a pretty good job at teaching a decent amount of depth in a variety of topics. And then things that aren't necessarily taught directly, like code quality, are enforced to a good degree by TA choice reviews and pair programming.

The pairing is quite valuable as it lets some of the stronger students disseminate tricks and good practices while encouraging some diversity of thought and strengthening technical communication skills.

I'm happy to talk more about this later, my plane is taking off.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 12:54 PM
Quote:
Originally Posted by goofyballer
Still weirds me the **** out to use a typeless language - do you JS programmers just learn by heart what things mean eventually? Or do I need to free myself entirely from the prison of thinking in types?
I straddle both worlds using Python and PL, which is weakly typed and strongly typed respectively. In the latter, you have to define the return types as well.

Perhaps I'm just too dumb to figure it out, but I never understood the type -vs- typeless debate, but my two cents:

What difference does it make if you call the following with ints, doubles, floats, or numerics?

Code:
average(x, y)
In a typed language, you have a choice between function overloading or local type coercion (I dislike both options). Clearly, you don't take averages of strings.

What if you want to get user_name by user_id

Code:
get_username_by_userid(user_id)
The function name makes it clear that you are calling by some integer.

At a higher level, I think that most of the power of typeless comes from not passing single arguments, but passing along collections, such as arrays, JSON, dctionaries, vectors, or whatever the collection of items are in your code. With that said, I don't ever mix data types in a collection. Of course, JSON "helpfully" converts everything to a string, which I personally find irritating, but to each their own.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 01:12 PM
Quote:
Originally Posted by blackize5
AA in itself isn't much of a signal/credential
Well, any kind of selective bootcamp signals that 1) they are able to pass some kind of selective admissions process and 2) they are serious about a technical career. 1) is mostly why people care about a degree from a good college and 1) and 2) are entirely why people care about an MBA degree from a top school.

I've been mostly wondering why solid CS graduates from 2nd-tier state colleges demand quite a bit less out of school than top bootcamp graduates even though they are generally better programmers and much stronger in terms of fundamentals.

Quote:
and their career counseling can be boiled down to: send a ton of applications, prepare like crazy, and basic salary negotiation.
One thing I did notice was that their projects were designed to be easily presented and they were presented in a very similar way on a very boilerplatey, but good-looking portfolio page. Everything they did is on GitHub, their cover letters and resumes are uniformly well-written and well-presented. But I don't know how much is the bootcamp and how much is just standard advice that's out there and the fact that these people at one point pursued careers outside of tech where resume, cover letters, etc are more important.

Quote:
They do a pretty good job at teaching a decent amount of depth in a variety of topics. And then things that aren't necessarily taught directly, like code quality, are enforced to a good degree by TA choice reviews and pair programming.

The pairing is quite valuable as it lets some of the stronger students disseminate tricks and good practices while encouraging some diversity of thought and strengthening technical communication skills.
This kind of setup sounds definitely good for motivation and learning.

I don't think I would hire out of bootcamps but I would definitely encourage people to go to bootcamps.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 01:13 PM
For stuff like numbers, obviously types matter less, but the distinction becomes more important when you're passing around different types of objects and assumptions are being made by other code about what properties or methods exist for the objects you pass. In C++ the compiler (and IDEs) tell you if you're using something wrong, in weakly typed languages I guess you find out at runtime?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 02:09 PM
For compile -vs- runtime errors, I don't see a huge difference, but I guess that has much more to do with the compiler / interpreter you are running. I don't know enough about node to know how it works. I don't see a huge difference between Python / PL / Clojure in the timing of the errors unless I am using the REPL stuff.

If I try to do this in Python:

Code:
s = set()
s.append(1) ## should be s.add(1)
I'll get an error at incantation and the program won't run at all. I experience the same in everything else I've used, so I'd have to defer that to node people.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m