EJ68

Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript follows the format established by Scott Meyers’s seminal Effective C++ but is arguably even more useful, thanks to the popularity of JavaScript and the many pitfalls and blind corners introduced by its syntactically forgiving, dynamically typed, shake-it-like-a-Polaroid-picture philosophy and coding style. Buy it, read it, forget it, read it again. This book is one for the desert island.

It’s probably fair to say that JavaScript has always had a bit of a problem with code quality. Derrick Pallas, writing for the Daily WTF, circa 2007, is representative of the frustration:

The advent of JavaScript has made it really easy to write web pages that interact with you. Really, it’s insanely easy. The barrier to entry: way too low. It’s not that all JavaScript is bad, just that most JavaScript is not written with simplicity, correctness, consistency, or completeness in mind.

(more…)

CSGO Sites Becoming More Lucrative for Coders in 2020

With esports now becoming a global phenomenon and CSGO at the very forefront of it all, the internet has seen a huge increase in CSGO gambling.
For example, sites such as CS:GOBook.com are often created with a very quick turnaround and with the CSGO gambling scene in 2020 ever changing, companies are always looking for competent devs who bring something new to the table.

Git for the Antisocial: Setting Up a Local-Only Git Repository

Scenario: You want to use git but you don’t want to expose your code on a site like GitHub and you don’t want to deal with setting up your own remote repository from scratch. You want a simple, private, LOCAL repository. Is this possible with git? Is it possible to use git locally? Is it possible to use git without GitHub?

For all that git is often described as a “distributed” version control tool and sometimes confused with GitHub itself[1], you can and should sometimes be using git locally (without GitHub) if you’re using git (or GitHub) at all. Git may not be appropriate for every project, but more importantly, GitHub isn’t an appropriate venue for every project that uses git. Since setting up a local-only git repository takes all of ten seconds…

(more…)

Live Chat Support System Developed for Online Casinos

With more and more gamblers choosing to play their favourite games online, the need for high level support on the platform has grown too.
For instance, sites with casino live chat support are created with great sophistication thanks to iGaming developers clued up on the latest web dev techniques.

Florida: A New Poker Mecca?

I’m sitting in a $2/$5 No Limit Hold’em game somewhere on the Treasure Coast. A cup of brown sludge sits in a protective cupholder on a sidetable nestled between my seat and the seat of the player to my right, who we’ll call Billy Bob. Billy Bob runs a profitable landscaping business but sadly has hemorrhaged three $500 buy-ins in the last hour and looks primed to lose a fourth. It’s October 2011. Uncapped No Limit Hold’em has only existed in Florida for a year and three months. I’ve been here three weeks.

(more…)

Defensive Programming Example #1

The other day I stumbled across this bit of C# code, intended to randomly return one of four messages.

// Choose one of 4 messages to display randomly
string theMsg = "";
Random r = new Random();
switch(r.Next(4))
{
    case 0: theMsg = "Hey!"; break;
    case 1: theMsg = "Whats up?"; break;
    case 2: theMsg = "Salutations."; break;
    case 3: theMsg = "Hail-"; break;
    default: throw new ArgumentException(); break;
}
return theMsg;

Few programmers would have trouble grokking what this code does. It’s intelligible and, in its current form, not too much of a maintenance headache. But defensive programming isn’t just about making your code intelligible; it’s about making your code tolerant to quick changes made under pressure, and incremental changes made over time, by people other than yourself, including the future version of yourself who no longer remembers the code.

In that light, this code has a lot of problems:

(more…)

Of Gravatars and Robohashes

Webmasters who use Gravatar to decorate comments with custom avatar images will be familiar with the d parameter of the Gravatar image request.

<img src="http://www.gravatar.com/avatars/8ca7425c8a9da807b9bf6934f10d59fa.jpg?d=monsterid" alt="" />

You can specify values like monsterid, wavatar, identicon, or retro here and Gravatar will generate a unique avatar image corresponding to the MD5 hash of the user’s email address. You’ve seen these all around the web:

There are just a couple problems with these sets of generative graphics:

(more…)

Movie Doppelgangers: B-Movie Ripoffs of Hollywood Blockbusters

[Skip to the Movie Doppelgängers poster.]

Well, another $5 down the drain. The other night I stopped by Blockbuster to rent a copy of Battle: Los Angeles. Blockbuster is a bit of a ghost town these days, the sort of place that makes you think:

Huh, wonder what my first move would be if the undead attacked, right here, right now.

I was in a hurry and I kept imagining the clerk would morph into a zombie and I’d be forced to defend myself with stacks of $5 previously-owned titles from the bargain bin. So in my haste/nervousness I ended up grabbing a copy of what looked like Battle: Los Angeles, but was in fact Battle OF Los Angeles. Silly me.

(more…)

Coding the Tweet, Redux

A few months ago we built a simple Twitter desktop client with oAuth support using C# and .NET.

Since then, there have been some breaking changes in the Twitter oAuth implementation, including a new PIN-based authorization mechanism for desktop Twitter clients. If you’ve been getting 401 Unauthorized errors, this is probably why.

(more…)

Are Commercial Databases Worth It?

I’ve worked with expensive SQL Server and Oracle setups for most of my career. I’ve defended them viciously against all comers and contrarians. I’ve participated in late-night guerilla flame wars and drunken bar brawls. And I’ve sought out with relentless tunnel vision those pieces of propaganda which support my foregone conclusion: that SQL Server and/or Oracle are (or were) the best choices for the organization.

I used to be a commercial database advocate.

These databases have put food on my table for a dozen years, you see. I am (or was) what you might call an entrenched practicioner, not necessarily an expert, but a practicioner. And in the manner of entrenched practicioners around the world, I’ve treated you heretics with the sadistic undercutting and poisonous rancor you’ve deserved!

(more…)

Coding the Tweet: Building a Custom Branded Twitter Application

UPDATE: The Coding the Tweet demo application and source code have been updated to support PIN-based authorization through oAuth.

With millions of users and an ecosystem saturated with over 700 custom applications, Twitter’s all the rage these days. Love it or hate it, Twitter has become a powerful medium for connecting with people and marketing your skills to a wider audience. As the saying goes:

Twitter marches on.

(more…)

A Pokersource Poker-Eval Primer

Pokersource Poker-Eval, the open-source poker hand evaluation library, takes a lot of flack for being “low-level”. In The Great Poker Hand Evaluator Roundup, I wrote:

The Poker-Eval library is implemented in highly optimized, heavily macro’d C for unadulterated speed, but language mappings for .NET, Java, and Python are provided. Now, I’ll be honest. The first time I saw the poker-eval source code, I immediately unlearned about sixty-two months of best-practices software development…

That statement was a little tongue-in-cheek, but still: it seems like every time someone suggests Pokersource Poker-Eval, a disclaimer immediately follows:

Don’t use this library unless you’re a competent C programmer! Danger, Will Robinson!

Just the other day, for example, I was looking at poker-related questions on Stack Overflow when I came across this: How Do I Programatically Calculate Poker Odds?

Hello, I’m trying to write a simple game/utility to calculate poker odds. I know there’s plenty of resources that talk about the formulas to do so, but I guess I’m having trouble translating that to code. Particularly, I’m interested in Texas Hold-em …

I understand that there are several different approaches, one being that you can calculate the odds that you will draw some hand based on the cards you can see. The other approach is calculating the odds that you will win a certain hand. The second approach seems much more complex as you’d have to enter more data (how many players, etc.)

I’m not asking that you write it for me, but some nudges in the right direction would help :-)

One of the answers suggested using Pokersource:

Take a look at pokersource if you have reasonably strong C abilities. It’s not simple, I’m afraid, but some of the things you’re looking for are complex. The poker-eval program that uses the library will probably do much of what you want if you can get the input format correct (not easy either). Sites such as this one or this also use this library AFAIK.

Still, it could be worse, you could be wanting to calculate something tricky like Omaha Hi-lo…

Again with the disclaimer! And it occurred to me: you know what? All this FUD is really kind of bogus. As of this writing, Pokersource is still the best and most complete library of publically available poker-related code in the world. Period. What’s more: the Pokersource evaluator is extremely easy to use provided you understand the Pokersource way of doing things.

So I thought, why not put together a brief Pokersource Poker-Eval primer?

(more…)