Monday, January 6, 2014

I'm sick of site spam

Is this a way of fighting back?


The pragprog.com site tries to make it easy for our readers. We don’t want them to have to jump through hoops to register an account, post to forums, or note an erratum.  We don’t want to ban external links—they are useful when people want to reference some resource or gist.


And, of course, that means we attract out share of spammers, adding links to external sites and products. 


I spend a bit of time each week searching this out and deleting it. But I sometimes miss things, particularly when it is a site link in a user’s profile.


But Google notices, and it complains. Not to me, but to the owner of the site the links reference. That’s fair—the site owner paid someone to spam us, and Google complains to them, threatening to put their page rank in the crapper unless they remove the spam link.


But they can’t remove it, because it was added by some kid in link factory somewhere.


So instead they write to us. Here’s a typical email. 


from: Mr Woc <webmaster@worldofchat.co.uk>


Hi,


I work for the company touchlineban.co.uk.


Your web page:


http://forums.pragprog.com/users/73905


is linking to our domain and we have been given an email from Google regarding our linking habits!


Since this letter from Google our site is suffering very badly, I need to get this link removed.


Therefore I politely request that you remove the link to our site touchlineban.co.uk immediately or as soon as is possible.


Many thanks for your cooperation in advance.


If you have any questions please contact me here:


webmaster@touchlineban.co.uk


Also if you have any other domain linking to us please can these links be removed too?


Kind regards


I get these emails quite frequently.


So, this time I responded:


I will remove the link if you give me the name of the company you employed to add it in the first place.


I got a wonderful response:


from: Woccy <webmaster@touchlineban.co.uk>


It was a long long time ago i have no idea sorry, ive got thousands of links and hired 100s of people over the years.


Far easier for you to remove them otherwise i just have to put the url on a disavow file, which is never good for any site, as I have to get rid of the links one way or another


Ive replied from the touchlineban email too so you know its my site.


Many thanks


Jc


Oh, my heart bleeds. The poor fellow. He’s hired 100s of people to spam sites like ours, and has polluted the web with thousands of links to his football management site. He can’t be expected to remember any details.


So, here’s my thinking. What would happen if I create a page on our site where I collect every single spam link I find, and leave those links active forever?


Would this cause some pain to the folks who spammed us in the first place?


And would it hurt our own page rank? Is there a way to let Google know what we’re doing?

Saturday, January 4, 2014

Reactive systems have no top

Back when I used to consult into projects in trouble, there was a trick that always worked, Look for classes or modules named XxxManager. These puppies would always be at the epicenter of the structural spaghetti. Invariably they’d be doing too much, with lots of conditional code and a fair amount of poking into the business of the things they were supposed to be managing.


So we’d pick them apart, split out functionality, and see if there was a way to either eliminate them, or turn them into something less coupled (my favorite approach when appropriate would be to turn each into a state machine).


But, as they say, the cobbler’s children have no shoes. I fell into the trap myself this week.


Over the Christmas break, I’ve been amusing myself by writing a terminal emulator in Coffeescript. Part of the intent is to allow me to record and then play back interactive sessions. The playback will have a bunch of bells and whistles (including fast forward, rewind, step-by-step and so on).


image


To manage all this (yes, there’s that word) I wrote a class called Driver.


Perhaps it was the eggnog, but the usual alarm bells were muted. I happily coded away for half a day, hacking more and more stuff into the driver. We had events, callbacks, a little RxJS, and lots of asking other objects for status.


And it bogged down. Every change got more difficult. Every test harder to write. And it wasn’t fun.


So I took the dog for a walk, and the dog told me I was being stupid. I’d written a manager class. It wasn’t called PlaybackManager—that would have been a giveaway. I’d called it Driver. That kind of pathetically meaningless name should also have been a giveaway, but until the dog pointed it out, I’d kinda spaced it out.


So I got back, gave the dog a treat, rolled back the code to the start of day, and looked for a good name for a class that would drive the playback. I ended up with VcrControls. What did it control? A class called Player. The Player class had methods such as play()rewind(), and step(). The VcrControls object sat between the UI and the player. And the code just fell into place.


In a way, this is a variant of the “tell, don’t ask” rule. 


Reactive systems have no top—they are lots of components that transform data and events. There’s no place for anything called a manager in such a system. And careful naming (cf Driver…) is a quick way of working out when you break the rule.

Monday, December 30, 2013

Tuesday, December 24, 2013

Friday, December 20, 2013

Deploying Elixir

When any serious app is 100% done, there’s another 50% left to do, and that 50% is deployment. For complicated or large apps, there’s no easy way to do this.


A reader asked me about Elixir and deployment:



There is definitely a lot of excitement around Elixir and I like it. What I am concerned with is are their any production deployment issues with Elixir? I have not don’t one myself but Elixir depends a lot on Erlang and Erlang libraries which have some kind of unique release process or so I have been told. I am not sure if I understood it correctly but I believe Erlang is released in such a away that it is self reliant and doesn’t depend on any external dependencies. How would Elixir behave if the system Erlang version moves ahead?



And I responded:


Elixir is just Erlang, as far as Erlang is concerned. This means that Elixir code can be deployed alongside Erlang code—the two coexist.


However, you have to be careful when looking at Erlang deployments.  Up until now, these have tended to be large-scale, distributed, and highly redundant systems. The goal has been seriously high reliability. Now no system like this can be deployed just by pushing a button—there’s a lot of planning, and a lot of configuration and scripting.


As a result, a “classical” Erlang deploy can be a big beast. Your Elixir code can join in this fun if it wants to.


But Elixir also offers simpler options. For example, deploying an Erlixir web app to Heroku is just about as easy as deploying any app to Heroku—just push to a repository.


So the short answer is that deployment in any language is not just one topic—it varies greatly depending on the application’s characteristics. At the large scale end, Erlang (and by extension Elixir) has a great story—it is mature and proven. At the small scale, deployments such as Heroku make it easy. And in the middle—well, that’s where the interesting stuff will happen.


Friday, November 1, 2013

Pragmatic Royalties—2013 Edition

Back in 2009, I posted a summary of the breakdown of the royalties we paid on our titles. Susannah, our managing editor, has been suggesting for a while that I should update it. I was surprised by what I found.


Here are the 2009 numbers:


image



Compare with 2013:


image



Below $10k, the numbers are about the same. That’s not surprising—mostly they reflect the vanity titles that were around in 2009. But above the $10k mark, things are a little different.


In 2009, 70% of titles made more than $25k. By 2013, that number has grown to 74%.


In 2009, 41% of titles made over $50k. By 2013, it’s 46%.


And while roughly the same percentage of titles made between $75k and $100k (12% in  2009, 13% now), there’s a big increase in the $100–$200k wedge, up from 4% to 12%. The only drop at the top is the >$400k wedge, and that simply reflects that we haven’t had a title as big as the Rails and Ruby books recently, while the overall number of titles has grown.


These numbers were pleasantly surprising. I know that as a business we are insulated from the plummeting fortunes of more conventional publishers. But I hadn’t realized that were were even more attractive to authors now than back in 2009.


Maybe it’s time for you to consider writing a book