Node.js And NPM – Still Run By Children

This story is pretty funny. (also notice the discussions on Hacker News) The package manager for node.js is npm. Due to a bug regarding security certificates, npm stopped working for a bunch of users.

I’m amused by the way people say “Node.js is cool because it has a package manager!” Almost every modern language/OS has a package manager, such as CPAN, PEAR, apt-get, and yum. One problem with npm is that lots of the packages are junk. Lazy programmers use someone else’s buggy package that meets 80% of their needs, rather than writing their own thing that meets 100% of their needs and, if you’re competent, bug-free. Seriously, people are using packages when rolling your own would only take a couple hours. It takes more than a couple hours to figure out how to configure the package and use it properly and then debug it when it doesn’t work right.

I already wrote about the maintainers of node.js acting like spoiled children. Now, the maintainers of npm are doing the same thing.

Someone posted a comment saying “If you don’t manage npm properly, someone is going to fork it.” That comment was censored on the npm website.

I have zero tolerance for censorship. On every forum where someone censored one of my comments, I stopped contributing. There’s no point participating someplace where you aren’t respected. For example, one of my comments was once censored on Joel on Software, I stopped contributing, and that forum is dead now. That’s one of the big advantages of having my own blog. Nobody can censor me here. My policy is to allow all comments except for obvious spam.

When the node.js and npm people censor people for disagreeing with them, that’s a clear signal that you shouldn’t contribute to their project or use it.

The person whose comment was censored was Rob Colbert. Initially, I had some sympathy for him. However, he’s also a twit. He had a programmer job, and tried to convince his bosses to use node.js. When they (correctly) refused to start using node.js, he quit in protest. What makes him a twit is that he has no savings and now can’t pay his rent, and he’s refusing to take a job where he can’t use node.js.

Also, he’s running his blog off a residential DSL connection, rather than spending $5-$20/month for proper hosting. My Linode is worth $20/month, especially since the Linux administration experience is useful at one of my current jobs.

He also was complaining “Why aren’t any responsible people contributing to node.js? Why do most npm packages suck? All these clueless people are making node.js look bad, and making competent employers reluctant to use node.js.”

There’s a simple answer. When a community is controlled by children, the sensible people stay away. A serious programmer would stay away from the retarded idea of single-threaded Javascript on the server and callback spaghetti continuation-passing-style. The serious programmers have better things to do, so only children contribute to node.js.

There are a large group of people working on node.js (until the next fad), because they follow the hype and not the technical merit. The people who are capable of evaluating technical merit know to avoid node.js. That’s two reasons node.js can’t ever compete with an adult language. First, the community is controlled by children, which smart people notice and stay away. Second, it’s a fundamentally stupid idea, and even if competent people were working on node.js, it’ll never be better than something that isn’t based on a retarded idea.

The weird thing is, in my performance benchmark test, Javascript/V8 came in third, behind C/C++ and Java but ahead of Python and PHP. I still prefer PHP, but now I know to use an external C/C++ program for anything computation-intensive. If I ever run into a situation where PHP can’t perform well enough, I’ll switch to C/C++ rather than one of the inferior solutions.

Incidents like this and Ben Noordhuis show that node.js is run by children and not adults. I’ve already concluded that node.js is a waste of time. Foolishness like this shows that I made the right decision to not invest any time in node.js.

Reader Mail – 02/23/2014 To 03/01/2014

James R. Alkire commented on FAQ.
BMI filed a copyright infringement lawsuit in The U.S. District Court For The District of Massachusetts against me as principal owner of The Fresh Chef Inc. that operates Point Breeze Restaurant located in Webster Mass. I currently have an ASCAP license covering their artists but not one from BMI. My venue is a building first erected in 1888 and since added various spaces bringing a building capacity to 400. I offer recorded music in two of the three spaces and have a Serius Commercial Music package to deliver to my diners that music at a cost of about $350 per year(Serius pays the licensing fees) which is much less than the licensing fees BMI and ASCAp require with their blanket license calculation formulas. Those spaces have a seating capacity of only 200. I also offer live music in two of the three spaces that have again only a 200 capacity. The third space of my restaurant is closed off to the live music areas(used only for private functions) but BMI has only offered me a license for the entire premiss(400 seats) thus increasing the yearly fee to $4,426. ASCAP'S yearly fee is half that because they have allowed me to use the 200 capacity in their calculator formulas. I have told the BMI phone reps every time they called in 2013 that their calculator formula should not apply in a blanket form to my business yet they have gone forward with their lawsuit. My attorney feels we should settle,pay the copyright infringement fees, the $4,426 annual fee and therefore minimizing the lawyer fees for BMI's firm. My question to you and your readers is shouldn't there be a federal consumer protection statute forcing licensing agents to be held to a reasonable standard of fairness. It clearly is not fair to be charged for 400 people when the city licensing/building agent only allows 200 people to be in the space. We need help now because I believe my attorney is correct in his belief that we need to settle quickly. I wish someone could site some favorable case law in this regard. Thank you, JRA

Wait a minute, did you say Serius? Do you mean Sirius Satellite Radio?

For Sirius Satellite Radio, the fee you pay includes the license.

For live music, it's much harder. You have to make sure that the band only plays public domain songs, or songs for which they own the copyright. This means no covers.

The short answer is: You're probably screwed. Your attorney is probably correct by advising you to settle. The licensing extortion cartels know that they own the government and judges, and you aren't going to win. If you contest the amount of the fee (but not whether you owe it at all), there's a separate process for that.

Another point if they're contesting your live music: Their agents use software to determine whether the song played is in their catalog. If the song really isn't in the catalog, but sounds similar to one that is in the catalog, they may give false positives.

If you do contest the fee, make sure that you mention the Sirius deal, which means you already are paying them some money. They're double-dipping if you're paying via Sirius and also them directly.

Also, you can point out the unfairness of the fee schedule if you do contest it. You pay the same fee if your band plays 99% original music and 1% covers, or 100% covers. That is unfair. However, you'd have to know your bands were mostly playing original music if you go that route.

Another possibility is to settle, go along with it for a year (whatever the minimum is) and then cancel at the first opportunity. Stop having live music for a few months, and then when you restart make sure your bands only play songs that don't require a license. It would require strict documentation.

Someone found a bug in your Java. It leads to a 5x slowdown.

for (int i=0; i!=5; ++i)


int card_rank = (int)(hand[i]%13);

int suit_rank = (int)(hand[i]/13);



[missing brace]

Not only does that make the performance worse, it causes it to give the wrong answer. (Three Jacks will come out as a pair of Jacks.)

I should have checked your work. I guess I have to also look at the Python version.

It's just like at work. They release code without testing it. They get annoyed when I ask "Did you even bother testing that the button you just added actually works when you click on it?"

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

Well, the point of submitting the code was to increase scrutiny. I didn't bother with a test harness, or have a golden file to compare against.

I'll take a look at the Java code when I get a chance, but it's well off of my urgent list.

I'm going to re-run the test myself. For the C/C++ version, you can call it with a specific hand rather than shuffling, so you can check your answer. That matters because rand() is implemented differently in various languages.

The other language I'm interested in is Go, for a comparison. People say it's as good as C/C++.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

After fixing that missing closing bracket, the Java code runs in 0.97 sec. Much better than I expected--still not parity but less than 2x C++.

I suggest you choose a starting deck for your C++ code, and I'll push it to Python & Java, and we can compare the results.

I should re-run the test myself. 2x slower is closer to what I expected. Someone on crazyontap said that Java was faster, which I didn't believe.

The only other language I'm seriously interested in is Go. I've heard a lot of hype about it. People are also talking about Rust.

I'll make another version where the hands are fixed rather than shuffled. That would also make it easier to verify the output.

A 2x performance slowdown isn't worth all the "nice" things Java does for you. Actually, I found Java annoying.

Reader Mail – 02/16/2014 To 02/22/2014

fosamax commented on Will GCW Zero Deliver Their Kickstarter Handhelds?.
So things started to move again lately. Shipping resumed and I got a tracking number so I may see the GCW Zero quite soon. I hope I will like it anyway.

I'm still using a Xperia Mini Pro as my main phone. It's a great little device with a physical keyboard. The CPU is the same as in the Xperia Play so it's quite capable but it's only single core. It's quite enough for a bit of GBA on the go (games like advance wars play well with a physical keyboard).

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.
Okay, Java is done. Here's the code.

It fared better than I expected. Runtime is 2.5 seconds. For comparison we have:

C++: 0.56 secs

Java: 2.5 secs

Python: 42.5 secs

So Java is only 5x slower than C++. Thoughts?

5x slower? That really is pretty bad. I've had people swear to me Java was at worst 10%-20% slower than C/C++. They were lying and/or stupid, as I suspected.

Of course, that isn't tuned Java, but I doubt you could tune it enough to overcome the 5x deficit.

So the winner for languages other than C/C++ is Javascript? With only 2.5x-3x slower than C/C++?

I'm really souring on these higher-level languages now that I performed this benchmark test. I always knew it was a little slower, but 5x-40x slower is not acceptable.

Some people will say that for I/O bound operations it doesn't matter as much. Number-crunching is my specialty, so it certainly matters for the stuff I typically write.


I put your code in the ftp directory (in case you ever take it down from your site).

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

My comment didn't come through quite right. I tried to italicize the "only" -- as in Java is "only" 5x slower. I did look into profiling the Java code, but I was less than impressed with JVisualVM, and it didn't prove useful.

Thank you for putting the source with the other examples. If you can, I think you should run all of the samples on the same machine to get better numbers for comparison.

I'm kind of thinking I should put together a C# implementation to compare with .Net. I'd expect it to be on par with Java (possibly slightly better -- IIRC it's better about native types than Java, but I haven't kept up with details like that in a while).

Your score for C++ is close to mine, so I'm confident in the others. I've had bad experiences with Java messing up other things, so I'm not that eager to install the Java SDK on my PC.

5x worse is pretty bad, considering how many people told me Java was "the same" performance as C/C++.

I wonder how older languages would fare, like FOTRAN, COBOL, and Pascal? Those were also written relatively close to the metal, so I think they'd do well.

MP commented on Whatsapp And Mark Zuckerberg Steal $19B From Facebook Shareholders.
The only reason this is dumber than Google's Nest buy is the price. There is no way the app is worth $19B. The only time I've heard of it was when a coworker figured out WhatsApp was killing his Galaxy S3 battery.

I've noticed that on Android. Something that runs in the background can really drain your battery, even if your phone is locked and the screen is off.

If a program runs in the background with frequent updates and push notifications, it can drain your battery AND your data.

What I do now is reboot my phone whenever I'm done, which flushes things that would otherwise be running in the background.

[Apparently the newest version of Android PREVENTS APPS FROM WRITING TO THE EXTERNAL SD CARD. That seems to be another effort by Google to force people to use cloud storage like Google Drive.]

MP commented on Whatsapp And Mark Zuckerberg Steal $19B From Facebook Shareholders.

The external storage issue is more complicated, and I don't know how I feel about it. There are reasonable arguments for why blob of storage should be available for any program (I use different audio players, etc.), and also reasonable security arguments for why programs should be separated.

I'm just bummed at how limited the external storage market has gotten. All the phone vendors except Samsung seem to have given up on them, and then make you pay an extra 100-200 dollars for a measly additional 16 to 32 GB. Meanwhile I picked up a 64GB MicroSD card for my Galaxy Lite (a $150 non-subsidized phone). My only requirement for a phone was 1) external storage available, and 2) removable battery. How hard is this for manufacturers to figure out?

Saurabh commented on Whatsapp And Mark Zuckerberg Steal $19B From Facebook Shareholders.

Whatsapp is quite popular in India. And not because bunch of indians were paid to use it. Majority of the mobile users in India use prepaid and before Whatsapp we used to pay for unlimited SMS plans every month. Due to the surge of cheaper Android handsets, as well as cheap data plans, most of the users now prefer Whatsapp over traditional SMS (also because it support longer messages, images and videos). That being said this buyout is quite ridiculous if facebook thinks it will help users turn to use facebook messenger. Whole point of prefering Whatsapp over facebook was that you don't have to fill lots of details about yourself before using it, your phone no is your username and your contacts are your friend list.

That's the reason to limit the external storage. Why let people use a removable SD card, when you can charge them $100-$200 more for an extra 16G-32G of internal storage? That's been a huge profit center for Apple, charging people a lot more for a little extra storage.

You should be allowed to give an app unlimited access to external storage, if you want. It's your phone! Almost every app I use writes to external storage! (text editor, emulators)

I'm considering switching to T-Mobile. The phone isn't subsidized, but it's more than offset by the cheaper monthly cost. Plus, if I keep my phone more than 2 years, it winds up cheaper.

I miss the physical keyboard on my Droid 3. I didn't get the Droid 4 because it didn't have a removable battery. Do you realize how many times I had to take out my phone's battery to reset it due to an Android OS bug?

I would try something other than Android or iPhone, if there were a viable alternative. Maybe ubuntu phone will be good, but I'm skeptical.

American Idol Cruelty To Contestants

My mother was watching American Idol on Wednesday, and I noticed that it was particularly cruel to the eliminated contestants.

I already commented that American Idol uses Auto-Tune. I’m able to hear the difference now. I noticed it when I thought that the rejected contestants sounded better than the accepted ones.

Most current pop songs on the radio are auto-tuned, so audiences are conditioned to believe that an auto-tuned voice is good and a regular voice is bad. So, when American Idol’s producers favor a contestant, they auto-tune them, and when they disfavor a contestant they don’t auto-tune them. It’s reinforced when the judges sharply criticize the non-auto-tuned performance.

Without auto-tune, the people who are the best singers are overweight, like Pavarotti. With Auto-Tune, singing ability is irrelevant and stars can be picked solely based on appearance. Also, since the star has no real talent other than the marketing hype, they can be discarded and replaced in every few years when they realize they’re being exploited.

There are several places where American Idol is cruel to contestants. The audition phase is cruel to some of the non-picked contestants that the judges ridicule. Why would someone who’s such a bad singer audition for American Idol? The answer is that many of them are decent signers, but they look bad when they’re not auto-tuned and the judges ridicule them.

On Wednesday’s show they did something particularly cruel. They had 20 contestants waiting, only 15 of which would get a chance to sing. The other 5 were already eliminated, but the judges made them sit there and wait.

That was cruel. The audience gets to see the people excited when they’re picked to sing. However, it’s really cruel to the people who were stuck sitting there waiting all night, when the judges had already decided they were eliminated.

Whatsapp And Mark Zuckerberg Steal $19B From Facebook Shareholders

Facebook bought Whatsapp for $19B in cash and stock ($16B buyout and $3B in incentives for the founders to stay with Facebook post-merger). Seriously, that is not a joke. I thought the headline was a joke when I saw it. It’s for real.

Allegedly, it’s a valuation of $40 per user, similar to other deals.

Has anyone here ever heard of Whatsapp before the deal was announced?

Allegedly, most of Whatsapp’s users are in other countries, especially India. Allegedly, that’s the reason Whatsapp sold for so much money, even though most people in the USA never heard about it.

The deal is obviously stupid. This is going to end up like almost all mergers, where they mismanage the acquisition and in a few years all the users leave for a competing product. (One notable exception is YouTube, which is subsidized by Google’s other revenue. One reason a serious YouTube competitor hasn’t emerged is the huge cost of storing and streaming videos.)

Whatsapp has usefulness for at most a couple more years, even if it would be managed well. In a couple years all phones will have a built-in app that does messaging as well or better.

Also, the valuation of $40 per user doesn’t make sense when most of the users are outside the USA, especially in 2nd and 3rd world countries. Facebook makes money from advertising, and advertising to US users is much more valuable to 3rd world users.

Mark Zuckerberg and his backers have special super-voting shares in Facebook, which gives them control of the company even though it’s public. That prevents an “activist investor” from buying up Facebook shares and trying to prevent them from wasting money. Besides, Facebook makes most of its profit off hype and not a legitimate revenue stream, making it unattractive for a typical leveraged buyout. With special super-voting shares, it’s easy for insiders to squander shareholder money on frivolous buyouts.

Given that most of the users are in India, there’s an obvious conspiracy theory. Pay a bunch of people in India $1-$5 each to install the app, then flip it to Facebook for billions. Easy money! (There is one indirect legitimate benefit. Some cell phone plans charge less for data than for text messages, making it a legitimate savings if you use an app instead of text messages. However, most US smartphone plans include unlimited text messaging now. The cost to the cell phone company per text message is negligible. Any data plan benefit to using an app instead of text message is temporary at best, as data plans and text messaging plans improve.)

The founders and backers of Whatsapp swear they didn’t pay for user acquisition. If you believe that, they’ve got an overpriced startup to sell you.

There’s another conspiracy. Allegedly, the same group of insiders control Facebook and Whatsapp. The buyout enables a $19B wealth transfer from Facebook shareholders to Whatsapp’s shareholders and founders. It’s the usual trading favors game. Whatsapp’s backers get a lot of free money, in exchange for unspecified favors later. Facebook is nearing the end of its pump-and-dump lifespan, so milk the shareholders while you can.

The $19B isn’t free money. The cost is dilution for the current Facebook shareholders. The share price of Facebook will tank as insiders dump their overpriced shares on unsuspecting suckers.

Even when the Whatsapp buyout inevitably flops, there will be vague excuses and no accountability.

There’s another theory I heard. Whatsapp owns some patents, presumably the usual type of junk software patent that should never been issued in the first place. Allegedly, Facebook is buying Whatsapp for these patents, either defensively or so they can sue others in the future. Most software patents are things that would be obvious to any software expert in the area, but what counts is the ability to manipulate the legal system. Patents are legal extortion. Facebook might be buying the right to engage in legal extortion in the future, or prevent from being the victim of legal extortion.

This is such an obviously stupid deal that I thought the headline was a joke. It is possible that people in other countries were paid to install and use the app, inflating the numbers. It certainly would cost much less than $19B to buy a bunch of users. The deal is a huge wealth transfer from Facebook shareholders to Whatsapp shareholders. If you were dumb enough to invest in Facebook, you deserve to get robbed.

Reader Mail – 02/02/2014 To 02/08/2014

hgaverin commented on node.js Is VB6 - Does node.js Suck?.
He tells his mentality by bragging about using "[whatever].net". I remind you that .net languages are JIT compile based. Just In Time, compile based means that the raw code is ALWAYS available in UNCOMPILED format for ANYONE to edit or steal. He mentions C++ and VB6, two old languages that are fully able to compile into stand alone executables; and two old languages that are very (read “VERY”) easily multi-threading. C++ is radically powerful. VB6 was designed for Rapid Application Development which can expedite a business’ adapability efforts to changing market environments. Both are fully able to be compiled into stand alone executables, with NO raw code available to ANYONE except the development team. He should have stopped there. But, no, he went on to brag that he was now into coding in ".net" . Then he cursed the users of other languages that he (openly and clearly) pre-stated to not understand sufficiently for a valid boolean response. For him to say that he does not follow the latest trend, and then to brag about using any language that is .net is a reversal of logic. He also went on a rant about mult-threading: If you know how, it can be fairly easy in many languages. He seems to find the tendency of node.js to be single threaded and thus a challenge maybe. Ask someone else for help and adjust it to multi-threading. Industry does not run on crying and whimpering, but rather on self-drive to find solutions, implementing those solutions, and moving on.

I mangaged to read quite a lot of the responses, eventually skipping over the original author's because they approach null, and I thank you others for some insight into other languages. I like C++. I like javascript (and many of its spun off variations).

It is often the programmer (or programmer wannabe) that creates much of the problems in many (probably not all) programming activities. If you have a problem with a language, maybe another language will fit you better. Do not hate someone else that is less or more than you in skill. Do not despise some else that has not acquired your hours of (maybe) experience.

In the past I have cried because of difficulties. Therefore I cannot fault the author for crying about node.js . I can say that he should now try something else. Get a handkerchief, blow your nose, write your own library base to help yourself in your programming endeavors, and move on.

snuprs commented on Design Patterns Suck!.
Another hilarious thing about design patterns is that they encourage developers to repeat themselves.

Whenever you have a recurring "pattern" in your code, you're supposed to factor that out into a method or subroutine or whatever.

But in the case of "design" patterns, they encourage you to do the same thing over and over. It's cut and paste for the ADD generation.

It's fricking hilarious.

I'd like to see someone take the algorithm from this post and do a Java version. I expect it to have performance close to the Javascript version.
fosamax commented on Will GCW Zero Deliver Their Kickstarter Handhelds?.
Lately, the GCW Zero KS turned out to be a SCAM, at least for european backers, since no update was made for more than one month and there are still a lot of Zero to be sent.

So the answer to your question is GCW will not deliver their kickstarter handheld. Period.

Or prove me wrong.

Really? I thought they got their act together and were finally shipping them? Do you have a link/source?

I'm really interested in things like iControlpad, Pandora, GCW Zero. I'm never going to fund any of them through pre-orders or Kickstarter. There's too much risk. I'm only ordering from stock, if I ever do.

fosamax commented on Will GCW Zero Deliver Their Kickstarter Handhelds?.

Just take a look at latest KS comments.

I'm still hoping to be proven wrong but lately things seems to turn out pretty bad.

No updates. No replies to email from the available contacts. No way to get faulty devices fixed. The last sign of life from Justin Barwick is the GCW Zero facebook profile.

Maybe shipments are still on the way but why on earth that lack of communication ?

I totally agree with you that ordering from stock is the way to go. I was even able to get a refurbished pandora since the success of GCW Zero KS campaign.

I paid less for it than for the Zero I'm still waiting for.

I'm sticking with my Android phone as my sole handheld, for now. I'd like to see a viable competitor to Android/iPhone, especially one with a nice physical keyboard. It's going to be awhile still before that happens.

My Samsung Galaxy S4 has no physical keyboard. The physical keyboard was a nice feature that I miss from my Droid 3. The touchscreen typing isn't the same. I might have bought an iControlPad2 from stock, if that didn't turn out to also be a scam.


It does seem shady that stores like iThic have the ability to "order from stock" but the KS backers didn't get their units yet. The advantage of cheating preoders is that units sold on iThic generate $160 new revenue, but fulfilling preorders is just a waste of money. That's very shady. I don't see how any store can be selling GCW Zeros before all the Kickstarter units shipped.

PureWicked.AU commented on Will GCW Zero Deliver Their Kickstarter Handhelds?.

where do I start, I too ordered an SE, a KS and 100 units before KS started to resell here in Australia for here and the NZ market, not all has gone according to plan for me as many of you may be very well aware, after much jumping up and down I finally got half of my 100 units to resell, though I too would love to finally see my KS+SE units with T'shirts etc.. then I could wear them and people could ask me about the GCW Zero, I am still waiting on 48 units and 2 bonus pledge package things, I have lost many customers due to the time frame and of course the fact that later orders than me (ThinkGeek in particular) sold units to my customers though I was meant to have exclusive rights to the Australian, NZ market... so yes I'm pretty pissed off, if any Aussie's are after any please let me know..

Yes, there are two ways you lose from the delay, if you were planning to resell GCW Zeros as a business.

Loss #1 - Customers can buy their GCW Zero somewhere else. The GCW Zero team is selling units before shipping to you, undercutting your sales and stealing potential customers.

Loss #2 - Moore's Law - If the GCW Zero hardware was cool and current when it was designed, by now it's almost obsolete. A 2 year delay means the hardware is half as good compared to newer stuff. The longer the delay, the more attractive it is to stick with your Android phone or one of the newer Android handhelds with current hardware. For example, the current Open Pandora specs are very lame compared to what you can get from an Android device.

A fool and his money are soon parted. You got played.

My takeaway is "Don't back hardware projects on Kickstarter or via pre-orders. Wait until you can order from stock." There is some cool stuff that potentially could be funded, but it seems that scammers are dominating the preorder market. This is 3 scams I know about now, Pandora (not Kickstarter, but direct preorders got cheated), iControlPad2, and GCW Zero.


This looks promising, a GPD G5A.


Another amusing link for GCW Zero. They're trying to raise money on fundable now.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.
Last entry for Python. After doing some cursory profiling (using built-in cProfile) I made things more pythonic and made some minor performance tweaks (like using xrange instead of range, which is advised in Python 2.7 but not needed in 3.0) I reduced runtime from 60 to 40 sec.

I remain shocked at the Javascript performance.

What's a link to the updated version?

What I really want is a Java version, especially after all the hate on this post. I'm probably not doing it myself, because I don't want the Java SDK and runtime polluting my PC. I expect it to be comparable to the Javascript version. Many people swear that the Java version would run almost as fast as the C/C++ version, but I doubt it.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

The profiled result is here.

I'll take a crack at the Java implementation. It shouldn't be too different from the C++ code, and I have the Java environment for Android tinkering. No promises on when it'll be done, but I too would like to see the comparison.

Since everything is compute + branch bound, I expect Java to suck. I guess the question is how much.

JJ commented on Another Argument Against noSQL.
'' People “prefer” MongoDB because they’re too stupid to set up a relational database and configure it correctly. '

I use SQL, I also use MongoDB.

Momma says I'm not not stupid like the post said I am.


Works for both far as I see it.

Then again, I'm not exactly splitting the atom at work either.

Momma says 'shut up'.

A brilliant argument. You totally convinced me that I'm wrong.

I see this comment thread is going to go like the node.js and Ruby on Rails posts.

It certainly is possible to use MongoDB and noSQL correctly. If you're using noSQL when you don't have many customers or much data, you're almost definitely doing it wrong.

Another Argument Against noSQL

I had an amusing phone interview. I asked what database they were using, and he said MongoDB and mySQL. I asked why MongoDB is better than mySQL. The clueless interviewer replied (paraphrasing) “Setting up a relational database schema is too hard! It’s easier to use a key-value store where you can just stick in arbitrary JSON objects.”

That’s amusing, and what I already suspected. People “prefer” MongoDB because they’re too stupid to set up a relational database and configure it correctly. NoSQL is most attractive to clueless twits. If your data has any kind of nontrivial complexity, such as needing joins, a relational database is better.

(Also, if you want a key-value store, you can have textblobs of JSON in a real database. However, it’s been a mess every time I saw it.)

The interviewer was also complaining about one of his “idiot coworkers” who preferred to do everything in C. He also gave me a technical test. I’m undecided whether I should do it, refuse, or never answer. I do want to meet the guy who likes to do everything in C. After having seen several different “modern”/inefficient languages, I’m thinking of just sticking with C/C++, and writing good libraries for whatever common tasks I have.

Businesses like Google, Facebook, and Twitter need their own custom database, which is some type of noSQL, due to their large volume of data. Your stupid startup isn’t Google. Stick with a real database, and when you get lots of users, then work on improvements (either optimizing your database or switching to noSQL for bottlenecks). People pick noSQL because they want to be “cool like the big boys”, without thinking if it’s appropriate.

Speaking of interviews, I had another amusing conversation.

Twit: What are your rates?
FSK: $X/hr
Twit: What are you getting paid now?
(I know it probably was a mistake to answer.)
FSK: $Y at one job, $Y+epsilon at my other job.
Twit: Oh, so then, if I offer you $Y+epsilon/2, then you’ll be happy!
FSK: Why would I switch jobs for an epsilon/2 pay increase? Do you think I’m an idiot?
[Also, given that I know he's going to be difficult to work with, there's no reason for me to compromise on rates. For $X, I'd be more willing to put up with his nonsense. Actually, $X is probably too low, given that I know he's going to be very annoying.]

Reader Mail – 01/26/2014 To 02/01/2014

Alexandre commented on Only Idiots Use Java For High Frequency Trading.
The only idiots I know are those who say things that doesn't know about. I have a Java implementation algo engine that has the same latency than a C++ implementation. It's much easier to built. It's using Java Real Time, there is no GC pauses for your information. People who says things like "C++ guys are smarter..." are the real idiots. Let them be idiots...

Alexandre commented on Only Idiots Use Java For High Frequency Trading.

Neither Java nor C++. The big players are using FPGA for developing HFT; other parts of system could be done with Java or C++, it depends. A lot of people doesn't know about Java Real Time. It could be used to build very low latency systems. The latency could be as low as with C++.

Anonymous commented on Don't Sign An NDA Before A Programming Job Interview.
Funny, a "major" real estate company asked me to sign an NDA for the interview. I declined. There was also a code assignment after an initial phone call (but before the NDA), not overly difficult and thus not a big deal.

Out of principle I don't want to be under an NDA, i.e. in a position where I cannot speak or act freely. Also the NDA covered confidential information that maybe wasn't even divulged during the interview. So basically, if I signed the NDA and ever used or talked about something that they considered their confidential information then they could pursue me in court. Doesn't that basically turn into a non-compete then? Adding further insult, the main HQ of the company is located in another state so if they were to pursue me in court, I'd have to appear in that (distant) state.

Don't sign NDA's for interviews.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.
I wrote a Python implementation at home. Here on a Core 2 Quad 2.4GHz I get a cpp time of about 470 ms per run, and in Python about 60s per run, or over 120x slower. I don't have profiling tools for Python, and haven't done any testing for correctness.

My python code is here. I kept as much of the original style as I could. I think your shuffle algorithm isn't robust in its randomness, but I kept the same algorithm (shouldn't affect timing anyway).

This should give you another data point at least.

Really? 60 seconds for one hand on Python? That's pretty awful. I'm glad I didn't waste time learning Python, especially with the 2.0 vs 3.0 fiasco.

Testing for correctness is easy. Compare the output to the CPP version! You can set the hand manually instead of letting it deal for you.

Actually, my shuffling algorithm is the correct one. Assuming the rng is fair (it isn't though), it will produce every possible hand with equal probability.

I did not do

for (i is 1 to n)

Swap i with random position between 1 and n

I did

for (i is 1 to n)

Swap i with random position between i and n

Mine is correct.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

Re: shuffle algorithm--yes, I read your code wrong, my mistake. Using the % operator on a rand() result can add bias as well.

Re: Python, my version I tested on is ActivePython It should work in 3+ (though I could have used the // operator in 3+). Since I'm unclear on what typically exists in server environments, I left it at 2.7.

You may want to run my code on your platform to get more useful timing numbers.

That is correct, %n on rand is slightly wrong. If I wanted to be perfect, I should exclude the result when rand returns between MAXINT and floor(MAXINT/n)*n. It is a negligible error.

There are other issues with using rand(), such as the fact that it will repeat eventually. There are 52! possible ways to shuffle a deck, but rand() repeats before 52! hands are dealt. It is good enough if your goal is to deal sample practice hands.

60 seconds was convincing enough to me. 470ms per hand for the C++ version is close to the result on my PC, about 10% faster. I thought Python would do a lot better.

What I am convinced is that nothing beats C/C++ (other than raw assembly). I've heard people swear up and down that other languages are faster, but I haven't seen it in practice.

The other interesting test would be Java or .NET. I expect those would be worse than C/C++ also, but I'm not going to put the time in to try it.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

If the process were I/O bound or had high overhead in malloc/free then I'd think .Net might have a shot. I didn't fully convert everything to "Pythonic" style -- getting rid of all globals, for instance, which might optimize better -- but I don't see much more gain.

It really seems to be a compute-bounded case, which is where C++ shines. Even techniques like JIT wouldn't be expected to help because you're processing random values, so the predictive branching can't get better each time you run through a loop.

I'd really be shocked to see anything beat well-written C++ in performance. The advantage of the other languages is primarily development time. I can crank out a Python script to convert data, etc. much faster than C++.

I believe that's why Rails works for many people--if your business model fits Rails precisely. I genuinely like the Ruby language, but community support seems to favor Python, which is why I adopted it as my primary scripting language (after Perl in the late 90s and Ruby in the mid-2000s).

As far as using rand() goes, yes the cycle is limited, but it's reasonable to test as proof of concept. If I were to write my own rand() function again I'd use a standard AES256 approach (crypto hashes are excellent pseudo-random # generators) rather than the old Mersenne twister implementation I used in a simulated annealing project from a few years back.

I find it pretty amazing that chrome js seems to be the best approach after C++. Kinda stunning.

If you want to write your own RNG, a better way is to take the XOR of your custom RNG with a standard RNG. If you XOR two independent RNGs, the result should be no less random than either of them. I thought about taking the XOR of several simple linear congruential random number generators with different periods, leading to a RNG with a VERY LONG period. I was looking for 256 bit and 1024 bit random number generators, but couldn't find anything decent.

Another advantage of writing your own RNG is in certain types of games, if you want to remember the state of the RNG.

My specialty is software that does calculations, which is why I still like C/C++ better than other languages. After doing lots of Javascript and PHP, I'm starting to appreciate strongly typed languages now that I did a little C/C++ again. The compiler errors in C/C++ are so much better than those in Firebug and PHP. For example, C/C++ will give an 'unused local variable' warning, which doesn't happen in Javascript and PHP.

The main reason is that, in C/C++, each arithmetic operation (usually) translates to 1 assembly instruction. For those other weakly typed languages, the interpreter does a lot of extra operations verifying the type of the object. Some older languages like FORTRAN and COBOL might outperform the 'modern' languages, because they were also designed closer to assembly.

I also don't buy that 'modern' languages lead to faster productivity. At one of my current jobs, they're using Javascript and angular.js. It takes them a couple weeks to implement one UI screen (and there's 3 people!), whereas I know it'd take me 3 days per screen using my choice of tools. Even worse, those twits can't implement anything without breaking something else. I guess Test Driven Development (TDD) is necessary if you're incompetent. The site is slow to load and crashes all the time. It's another doomed startup, mediocre execution of a mediocre idea.

Rails is useful if you're cranking out a toy demo of a stupid startup website idea. If you're writing something complicated, which is my specialty, Rails is more of a handicap than a help. A lot of these 'modern' fancy frameworks are useless if you try to implement something that isn't covered by the framework. At the same job, they're using D3. It's taking them longer for them to figure out how to make D3 behave the way they want and figuring out the correct D3 inputs, than it would take for them to just open a canvas object and draw on it directly. Seriously, it isn't that hard to open a canvas object, draw some axes, text, and your chart. Using a 3rd party library is another layer of indirection that makes the website slower.

It is surprising that Javascript/V8 crushed PHP and Python.

commented on Reader Mail - 12/29/2013 To 01/04/2014.
Hello FSK, what is happening with you? It's been a while since you last posted.

Yeah, I know. They took away the local train on the subway, so now I don't get a seat. It took away my blogging time.

I should get back to it, been too lazy.

Reader Mail – 01/19/2014 To 01/25/2014

Don Hoffman commented on About FSK.
I own a restaurant in Pennsylvania. I used to have live bands, karaoke, and djs. I was paying Ascap and BMI up til the end of 2012. I called ascap and bmi that i would be doing anymore live or recorded music. They had me fill out forms to that i have cancelled my account. Now come 2014, bmi calls and says i need to fill out another form which i did via email and fax. Then i had to do the same with ascap. Ascap comes back and says they can not cancel my account because i have tv's that are unmuted. They want bill me 1.28 per occupancy for music jingles from commercials or if a sporting event on tv is playing music. I told them i pay the cable companies for there service and direct tv for the nfl ticket. They said they own the copy rights to the music and i have public place. I am now taking the matter to my state representative and the better business bureau. Any suggestions on anything else i can do.

There isn't much you can do. Most of the TVs in restaurants are muted for precisely this reason. Sounds weird, but that's the way it is. The commercials pay for a license to use the music, but due to the bizarre way copyright law works, that doesn't also include the right for you to play it in your business.

Unfortunately, the music licensing cartels own Congress and the judges. Don't expect success. I know it's a drain on your business. Nonsense like this is one of the reasons the economy is so bad. Also, once you do sign a contract with the licensing cartels, they got you now. They'll make all sorts of excuses to prevent you from ending it, and the contract includes high interest rates and fees if you pay late.

One loophole that may work in your favor is that, if you have fewer than a certain number of speakers, you may not have to pay the fee.

Architect commented on Software Architects Suck - Never Trust A Software Architect.
Wow. This was pretty long winded.let's face it there are a lot of people in software that don't know what they're doing and can cover up their bullshit with documentation and politics.

I'm a software architect. But you know what, I earned that position and title through 15 years of hard work designing and implementing software solutions. I still write code. I still deploy software and automate processes. What I do that our developers don't is interface with clients, join sales calls as technical support, and lead our software evolution in a sustainable manner.

So get off your high horse as a developer. We know you've been in the trenches. Software is hard work, get over it. Realize that you own your own career and go work with people who will appreciate you and your skills.

Reader Mail – 12/29/2013 To 01/04/2014

Ken Carlson commented on About FSK.
I am a lawyer in the LA area, helping local restaurant owners in our little mountain village of Idyllwild, California, deal with ASCAP and BMI.

In 1966, the Justice Department criminally prosecuted BMI and ASCAP for Antitrust violations, and the plea bargain resolving those actions because euphemistically known as the "Consent Decree." In each of those cases, the organization is required to offer less than the "blanket" license to anyone who asks for it, like a restaurant. The goon squads that contact these small businesses defraud them by claiming that they have to pay the same as everyone else, but the Consent Decree says otherwise. If the parties cannot agree on a reasonable price, then the NY Dist. Court will take the case.

The Consent Decrees do not identify what kind of subset a given licensee might request, so I chose selected genres of music played in my clients' restaurants: jazz, folk, soft rock, etc. from given eras. ASCAP and BMI refused to give a license by genre, claiming that they have no way of doing that. Thus, for the past 3 years, my clients have paid nothing, waiting for the price BMI and ASCAP would offer. My clients continue to have music, and will only have to pay the reduced rate retroactively, if and when the issue is ever resolved. Rather than be shut down, we put BMI and ASCAP on the defense.

Defense? Absolutely. The Consent Decree requires them to treat all similarly situated licensees equally. If one of my clients pays only 5% of the blanket license, because they are only licensing that 5% of the entire repertoire, BMI and ASCAP's revenues go from $1000 per year to $50 per year, for example, from every such restaurant. If we get it, everyone else has to.

From another perspective, such a genre-based licensing would upset BMI and ASCAP's entire structure. Right now, since they don't know what songs are played in a restaurant, all of that money [with elevator music, shopping malls, stores, mechanic shops, etc] goes into the radio station pool, to be distributed based upon who is hot this week. We may play James Taylor songs in our restaurant, but Beyonce gets that money because of her air time. If BMI and ASCAP had to assign genres to their songs, the natural result would be mini-pools, where soft rock performers would want to get their share of the soft rock restaurant license money. The radio top 40 artists would be deprived of that income, and it would go to the rightful owners in at least a closer designation than the radio pool. When you consider that live music played in restaurants caters to the older crowd who can afford the entertainment restaurant, and that the catering means oldies, you would have all of the oldies performers suddenly getting royalties again, to their delight. Thus, the consumers win, the restaurant owners win, the artists win, and BMI and ASCAP bite the bullet.

When you consider the impact of millions of businesses demanding genre-based licenses at greatly reduces prices, it is billions of dollars in income shifting, and billions to the truly-entitled oldies artists. If you ask BMI and ASCAP, they flatly say it's impossible, since they have millions of songs in their database. However, if they simply set up a page on their site for the copyright owners to log in with an assigned username and password, they can assign their own genres to their songs, going directly into the database. I told them that they can hire a kid from a closed record store to help them assign genres, sine they feign inability. They also try to confuse the issue by saying that any song can be played in any style [the Triple Nickel case], but this is different: the song itself has an assigned genre, so if it's in the license of the restaurant, they can play it, and if not, not. What's the problem with that? They have no answer. The Department of Justice has not prohibited genre-based licensing, so it's only the BMI and ASCAP reluctance that creates the problem.

As long as they continue to defraud the public, saying that the restaurant MUST buy the blanket license, and that it is in violation of the Consent Decree to offer a lower price, the restaurants and other businesses paying protection money are just being shaken down. One irony is they they use their criminal plea bargain as the basis for their extortion. The other irony is that BMI and ASCAP are supposed to be helping their members, but since most of their repertoire are oldies, now, they're betraying their fiduciary duty to the vast majority of their members, and lining their own pockets with their commission from the overcharging.

Actually, it is now possible to write software that identifies a song being played. So, it would be easy to install a program that automatically analyzes each song played and charge per song. The licensing cartels do not do this, because they maximize their revenue by overcharging for a bulk license. The bulk license favors the songs that already hits, most of which are owned by the large corporations that back the licensing cartels.

Even though copyrights are issued to individuals, you typically have to sign away your copyright in order to get published. So, copyright is theoretically a system that promotes individual rights, but you have to sell those rights to the gatekeepers to get promoted. The Internet changes this somewhat, but the media cartel still has a lot of power.

If you know where to look, you can find royalty-free music. That's music you can legally play without paying any licensing fees. Maybe you should look into this and advise your clients to do this? If you made a collection of royalty-free music, along with a letter saying you legally reviewed it, that could be an interesting product.

The correct answer is "Intellectual property is not a valid form of property." Patents, copyrights, and trademarks all lead to legal extortion, as your clients are facing with music licensing. It was a mistake to allow them to be treated as property, but unfortunately that's the way the system is set up now.

commented on NFL Players Are Underpaid For The Playoffs And Super Bowl.
They can suck it up & play

Most have 1 catch the ball ..they make plenty & beyond

People are starving & they are buying guns girls cars for heck of it.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.
If you posted the code in all languages, maybe we could crowdsource optimizations?

Also, are you familiar with ASM.js? It could go a long way in FF.

Are you really interested? If someone's interested in doing that, I'll post it. The code only sort of works. It isn't polished.

Asm.js still isn't as fast as a native binary, but it'd be closer.

I do plan on finishing it, but I'll probably just have the calculation done on the server, with PHP doing a shell_exec to the C program.

It also would be interesting to try other languages, like Java, VB/C#.NET, Ruby, Python, etc. I still say that the C/C++ version would perform best.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

*I'm* interested, but my career has been in C++, with a smattering of C# and Python. I have no serious Javascript experience.

OK, I uploaded my code. Here it is.

The Javascript is awful, because I wrote it before I learned jQuery. For the javascript version, you need the card images, so the page renders correctly in the client.

Hmm, the Javascript version runs faster when I turn Firebug off. I guess Firebug slowed it down a lot.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

Just poking around at the C++ I get 250-300ms for each test (depending on targeting x86 v. x64, etc.) or about 8 million calls to evaluate_hand_96 per second (that's getting called about 2.6 million times). Which seems reasonable to me in raw numbers (this is on a 3.6 GHz i7, Win7x64, Visual Studio 2010), coming in at around 450 clock cycles per evaluate_hand_96. I tried running it through VTune Amplifier but I think the profiling doesn't give helpful results because the inner loops are so small that sampling isn't terribly useful. I tried removing the function pointers and converting some logical ops to arithmetic ones (I think I shaved off 50ms, but it could be a result of the optimization settings).

I've read the code enough to understand the structure, but I haven't looked to see why the inner loop is getting so many calls. Assuming that's really how much work needs to get done, I don't see an obvious way to tune it up without multithreading, etc.

I haven't looked at the other code yet (I will over the weekend), but you can contact me at the included email if you like.

1. Multithreading kind of defeats the purpose, because I want to compare Javascript, PHP, and C/C++.

1.a. When I want to run it to loop over every hand and make a full strategy table, I can do multiple processes.

2. I think that's one advantage of C++ with full optimization. It inlines the functions.

Also, Visual Studio, when you compile for release, automatically turns on full optimization for you. With gcc, I had to remember to do that myself on the command line.

3. The overhead for a function call is MUCH LESS in C/C++, compared to Javascript or PHP. (especially for code like this, where I'm not allocating many variables or using the heap)

4. If you optimize the code in one language then, to make it a fair comparison, it has to be optimized in each language. I thought that the exact same algorithm in each language would be the most valid comparison.

The inner loop gets so many calls because, when you draw 5 cards, it needs to evaluate 47*46*45*44*43/5! possibilities for what you could draw. When you draw 4 cards, it needs to evaluate 47*46*45*44/4! possibilities. That's a lot of iterations. Drawing all 5 cards is stupid sometimes, like when you have a pair, but for completeness I always check every possibility.

Also, I put the function pointers in, because I want the same code to work with multiple video poker variants. I'm also doing Double Joker Wild, which means a completely different function to evaluate the hand. Other video poker variants give a bonus for certain 4-of-a-kinds, which also would require a completely different evaluation function.

MP commented on FSK Benchmark Test - C/C++ vs. Javascript vs. PHP.

Yah, I figured that sounded like it was about right for the combinatorics, but doing a quick calculation of 47 choose 5 comes up with 1.5e6 not 2.6e6. I figured multi-threading was out for purposes of comparison, and that any optimization for one language should be for all--I just tackled first what I know best.

47_choose_5 is 1.5E6. 47_choose_4 is 1.7e5, but you draw 4 cards 5 times (5 different possibilities for holding one card).

When I do the double joker wild variant, it'll be a 54 card deck.

Also, I don't want the code to take shortcuts, by making assumptions such as "always hold a pair". In some video poker variants (especially with wild cards), a pair is a bad hand to hold. I could take shortcuts by making the code more intelligent, but that would limit the ease of modifying it for various video poker variants.