American vision

New with Machine Learning algorithms.

The original article was published at:

A Tour of Machine Learning Algorithms by 

American vision

How did JavaScript and Node.js become popular for IoT development?

@Quora to How did JavaScript and Node.js become popular for IoT development? u  do not want waste PWR running while(true)  loop-> 4evr checks 4 values, u want system to tell u what happened & then u can react.

Answer by Johan Öbrink:

Two reasons:

Javascript is a fundamentally event driven language

IoT is fundamentally event driven. In that sense, JS is a perfect match. You do not want to spend precious battery power on running a while(true) loop that constantly checks for values and spawns conditional events. Instead you want the system to tell you when and what happened and then you can react to that.

Javascript is easy to get started with

This one should not be underestimated. We've had the possibility to build IoT stuff for ages now. It just hasn't been very easy for non experts. What's happening now is that this power is being put in the hands of everyone. This is through the standardisation of hardware, the reduction of cost and in the simplification of writing software. Getting started with JavaScript is a lot easier than getting started with C. So when it suddenly becomes possible to construct an "intelligent" fork using JS and some stuff from SparkFun, it's obvious that it's going to become popular.

How did JavaScript and Node.js become popular for IoT development?

American vision

What is a coder’s worst nightmare?

Answer on @Quora by @khashmeshab to What is a coder's worst nightmare?

Answer by Masoud Gheysari M:

This is not my nightmare, but something that happened to me in real life. When you read this, it will become YOUR nightmare from now on!

The situation:

  1. I'm a senior software developer working at a large software company,
  2. We write in PHP and use Zend IDE 4.0,
  3. The Ctrl key on my keyboard is kind of broken, sometimes it doesn't respond when pressed,
  4. I'm working on a large enterprise web application for a government project with an approaching deadline.

I got to work in the morning, turned on my computer and started working on a PHP file. I wrote thousands of lines of code, solved many unsolvable problems, and fixed many hard bugs. I had a super productive day. At the end of the day, I asked my boss and my project manager to see the result of my work. I, overflowed by Serotonin resulted from a good work day, presented everything on my computer while they were standing behind me and they got happy.

After they gave me the "nice job" look, I decided to save the file for the last time, commit the changes to our Visual SourceSafe server, and leave work. These all happened in 3 seconds:

  1. I tried to press Ctrl+S to save the file. But I mistakenly pressed Ctrl+A (select all) instead. The whole text of my file got selected.
  2. Once again I tried to press Ctrl+S. But since my Ctrl was semi-broken, this time I didn't press it hard enough and it didn't work. So, my whole thousands of lines of code got erased and got replaced by a single "s".
  3. I panicked. I pressed Ctrl+S once again, and this time it worked, and saved the new file contents (a single byte "s").

These all happened in 3 seconds. I tried to use Ctrl+Z to undo the last change. But as you may know, in early versions of Zend IDE, the undo function was implemented very badly. So it got me to the morning, when I started my work on the file.

There was no backup or SCM revision. I lost everything. I just wanted to cry, and cry, and cry… The good thing was that my boss and the project manager saw the completed work and witnessed the procedure of destroying my own work. I stood there for a few minutes shocked, and then I left work sad and depressed.

Needless to say, I got a new keyboard the next day! But I learned my lesson for life. Nowadays I always backup my work. I install Ditto (a very good open source clipboard manager program for Windows) and periodically "Ctrl+A, Ctrl+C" (copy all) my work into the clipboard just in case. I always use source control software (Git) and commit regularly.

Edit: some readers have suggested some ideas to prevent this problem, such as using Git, checkout in a Dropbox folder, use a better IDE, replacing my keyboard, etc. And they called me ignorant and unprofessional. So this is my answer:

  1. It was an unfortunate accident. It could happened even to Bill Gates, Steve Jobs, Linus Torvalds, Mark Zackerburg, etc. Even with the best keyboards, IDEs, source control software, etc. I mean if it's going to happen, then it's going to happen.
  2. This story belongs to 8-10 years ago. So no Git or Dropbox or advanced IDEs with features like auto backup, revisions, commits, etc. We even haven't had a stable internet connection inside the company. My monitor as a senior software developer was a 17" CRT monitor for God's sake!
  3. Zend IDE was the official IDE for the company. Visual SourceSafe was the official source control and Windows was the official OS. While personally I prefer using Eclipse (and Git and FreeBSD/Linux), I had no other choice than following the rules. Fortunately Zend IDE 5.0 was based on Eclipse.
  4. Replacing the keyboard is hard for me. I think more professional programmers understand me. Even a slight change in the keys placement, size, smoothness, … can highly reduce your typing performance and increase your use of backspace. So when my keyboard gets broken, I need to spend a lot of time to look for a good replacement.
  5. It's true that keyboards has two Ctrl keys and I could also use the Edit menu. But when you get used some patterns, you would use them without thinking. Also to press Ctrl+S, you use the nearest and easiest Ctrl key to S, in this case the left Ctrl. I don't think anybody use the right Ctrl or the Edit menu ever!
  6. The file I was working on that day was part of a huge proprietary PHP framework. The framework structure dictated how the files should be arranged. From time to time, we had no other way than putting thousands of lines of code in a single file.
  7. I'm a programmer for 20 years. I don't say that I'm too professional and nobody should ask my ways. But I probably have enough experience to know what I'm doing and is this a correct way to do something or not. This was an "accident". It had to happen.

Also: Thanks for the upvotes everybody. This is my highest voted answer to date. Keep upvoting and as soon at it gets to 1K, I'd edit this answer and add another story which I'm pretty sure you'd once again enjoy my bad luck! ;-) I'm pretty unlucky guy, so I can write a new story for each 1K upvotes!

What is a coder's worst nightmare?

American vision

If I want to learn data structures and algorithms, and properly at that, should I get started with CLRS right away? I’m totally a self-le…

Answer on @Quora by @thcormen to If I want to learn data structures and algorithms, and properly at that, should I g…

Answer by Thomas Cormen:

How's your math?  Are you good at understanding proofs?  CLRS is rigorous, and we prove correctness and running times for just about all algorithms in the book.  I often recommend my other book, Algorithms Unlocked, to start with.  AU has far less math than CLRS, but it focuses only on algorithms, not data structures.

If I want to learn data structures and algorithms, and properly at that, should I get started with CLRS right away? I'm totally a self-le…

American vision

How is Javascript used within the Spotify desktop application?

Answer on @Quora How is Javascript used within the Spotify desktop application? : JavaScript on top of C++ which handle files retrievals but JS handles GUI

Answer by Mattias Petter Johansson:

I would bet that the Spotify desktop client is among the top 25 most intricate uses of JavaScript in the world. The Spotify desktop client UI is completely built with JavaScript, resting on top of the same C++ core that the iOS and Android clients uses. The C++ core is responsible for things like playback, providing offline editing of playlists and local files, but rendering and interacting with the UI is handled by JavaScript. The communication between the C++ parts and JavaScript is done through a simple messaging interface simply called bridge. The UI itself is HTML/CSS, which is generated by Handlebars and LESS.

Spotify is internally divided into small (3-12 people) teams called squads. A feature is generally owned by a single squad, and during normal conditions the squad has all it needs to develop and maintain its feature. It's normal for a squad to have iOS, Android, web, and backend developers under its roof. The general idea is that every squad should have the ability to work on its feature pretty much on its own, minimizing the need for the squad to ask other parts of the organization for permission and/or help.

This organization structure, combined with the global-ish nature of JavaScript in the browser, has made us build the desktop client UI out of many small, self-contained web apps called Spotlets. They all run inside Chromium Embedded Framework, each app living within their own little iframe, which gives squads the ability to work with whatever frameworks they need, without the need to coordinate tooling and dependencies with other squads. While this approach has the disadvantage that we have many duplicate instances of different versions of libraries, increasing the size of the app, but it offers the massive advantage that introducing a library is a discussion between a few people instead of decision that involves ~100 people and their various needs. Not only would such a big discussion extremely time-consuming and hard, it would also force  us to use a least-common-denominator approach to picking libraries, instead of picking the ones specifically tailored to the problem domain of each squad. Considering the size of a single song compared to the size of a JavaScript library, this trade-off is a no-brainer for us.

The latest versions of all Spotlets are zipped and bundled with the desktop client binary on every release, assets and all. However, we can also live-deploy new versions of the apps into the running clients of users. This is very useful for emergency releases, but we can also release Spotlets to certain user groups, such as employees or designated testers only. We can even release apps that aren't originally bundled with the client, which is very handy during our hack weeks, allowing us to quickly get apps into the hands of non-techie decision makers in the company. After demoing your thing, you end off with "and now type this uri into the search field of your desktop client, to try it out with your own account!". This whole system was originally invented as part of the now-defunct Spotify Apps initiative, to support third-party developers adding functionality to the client.

While teams are autonomous, there is functionality that we all would like to share because we explicitly want it to work the exact same way in all apps. For instance, we have a CSS framework called GLUE. It was originally a fork of Twitter Bootstrap, but we've diverged heavily from that over time. Generic functionality such as some list and buttons, we also provide shared components for, but it's very easy for squads to just just templates, or just partially use functionality from the shared frameworks. It's important that squads are able to control their own reality and can pick the best solution for their problem domain, instead of having a company tool forced down their throats just because it's in-house.

We use npm extensively. We have our own internal npm repository where we publish internal modules, and we package the code together using a Browserify-like tool. npm has been magnificent for us. For the browser-specific testing, we use Mocha and PhantomJS.

If you like my writing, don't miss out on more of it – 
follow me on Quora and Twitter (

How is Javascript used within the Spotify desktop application?

American vision

Am I a mediocre software engineer? (see details)

Answer on @Quora by Eddie Offermann to Am I a mediocre software engineer? (see details)

Answer by Eddie Offermann:

If I received those questions, even modified to suit a language I code in a great deal (I do very little C#), I'd probably look blankly at them for a moment and excuse myself from the interview, knowing they were looking for a different person because if they were looking for *me* they'd be asking a different set of questions. I wouldn't ask these sorts of questions in an interview – they tell me almost nothing about what your actual abilities are as a software engineer. It's as if you were being hired as a copywriter and the interviewer started asking you about pluperfect tense verbs and relative clauses. It tells me if you know the language and the terms used to describe it, but little about how you'd actually write. A different interviewer would quite possibly see you very differently with a different set of questions.

What I'm saying is – you may or may not be a good software engineer. You obviously aren't conversational about some straightforward C# structures and terminology – but I don't even find that to be unusual. A lot of us can't talk for crap and it has little or nothing to do with our ability as engineers. This company, however, may really need you to be quite verbal and very conversationally familiar about technical aspects of C# and OOP in general, irrespective of your ability when you're actually writing.

Now, if you've genuinely done very little, you may not meet their expectations for this job – and with only two years of experience, you probably *are* mediocre. I think I'm great but at this point I'd better be – I've probably been programming since before you were born, as have many of the people you'll end up working alongside if you haven't already. When I'd been doing this for two years, I'm pretty sure I sucked.

If they're looking for someone with a lot more experience, there's nothing you can do but to keep working elsewhere. You had a bad interview. Learn from it, keep working, keep coding, keep getting better, and you'll have better interviews.

Am I a mediocre software engineer? (see details)

American vision

Am I a mediocre software engineer? (see details)

#Experienced? @Quora  Am I a mediocre software engineer? or the interviewer sucked lemmons(see details)

Answer by Clay Loveless:

As others have said, it might be worth considering his suggestion.

But here's what I can tell you: I went to college to study acting. I learned programming (hacking HTML and perl scripts in the mid-90s) on my own because I didn't want to go the typical starving actor route of waiting tables.

Oh yeah: I started getting "serious" about learning things like OOP when I was twenty-nine.

I had interviews like the one you're describing. I don't have a CS degree, and still have to look up words like "polymorphism." I still think "transmogrifier" every time I come across it.

Despite all these alleged shortcomings, I have started and sold two SaaS businesses, am now an advisor to several other SaaS businesses, and am working on a new one of my own.

I'm probably a mediocre coder too. But if you ship, and it works, and customers pay and are happy, who cares?

F that guy. Code on.

Am I a mediocre software engineer? (see details)