Wednesday, 28 August 2013

Spam has moved to copy/paste and URL hashes

One of my responsibilities is to create an email newsletter for some friends of mine. In order to do that I scour the Internet using Google Alert, RSS feeds and other nefarious means like that. The job consists of opening each page, copy pasting the URL, the title and then finding the most effective way to express the content of the page, which is often one of the first paragraphs. And what do I get when doing that? A sort of weird marketing spam that is as annoying as it is (in my view) pointless.

Here is what happens: first you go to a page using a normal URL, let's say you googled it. Once it loads you look at the address bar and see what is called a hash added to the URL, probably used to identify your visits for marketing purposes. Example NewScientist: mouse over the link to see the actual URL, then click on it to see what actually happens. I have tracked this to the AddThis scripts, when configured with the parameter data_track_addressbar:true. So in case you wondered if the site you are visiting chose to add that ugly hash there, yes it has!

Another thing that happens: You select a paragraph of a page, you copy it, you paste it in your email only to see added stuff to the text, like "See more - some URL". Check it out at Astro Bob's. Try copying something from the blog and pasting it into Notepad. The crappy string at the end is added by ShareThis, usually by its WordPress plugin. This time it was their fault, as they added some crap in the plugin. All Astro Bob has to do [hint! hint!] is to disable the feature.

Now all that remains is to understand why. According to marketing reports, the sharing of information on the Net via copy&paste is more than 80%. So they want people to be able to control what happens with the information they publish, and it is a reasonable goal, but this is not the solution. Instead, what users will do is either get annoyed with the spam they have to clear from URLs and pasted text or, and that should concern the site owners, not copy from them at all. And if you thought having your information disseminated on the Internet without your knowledge and/or consent was bad, wait until nobody cares about it at all.

Sunday, 25 August 2013

Re-boot

I wrote a bunch of posts regarding my past employment, but said nothing about the new one. In fact, I was a bit superstitious, didn't want to jinx what was going to happen. Now it shall all be revealed! Well, long story short I will be relocating to Italy (re-boot, get it?)and working at the European Commission's Joint Research Centre in Ispra. That's it, cheers!

Just kidding. How does one get to, first, have the opportunity in the first place and, second, actually decide to go? For the first point I would have to say pure blind luck. I happen to have a LinkedIn profile that shows a lot of experience in the field of Microsoft .NET and so they called me, since they needed someone like that, and I turned out not to be a complete wacko (only a partial one) at the interview. The second point is actually the most complicated. Most Romanian developers of my experience are rooted, so to speak. Married, many with children and obligations, relatives and social circles, they often find it too hard or completely impossible to relocate to another country. Luckily for me, I have no children, I don't have any social circles to talk about, I will probably talk to and visit my relatives just as much from Italy as from Bucharest and I have one of the most understanding wives one could want. She stays behind, at least temporarily, to mind the fort, continue her own career and take care of the dog, while I go on to the adventure of my lifetime.

I may be exaggerating, but I will check out several experiences that I have never had before:
  • living alone - I know it sounds strange, but in 36 years I have never lived alone. I was either living with my parents, with my business partner or with a girlfriend or wife
  • living in another country - I have worked in Italy before, a few disparate weeks, but never lived in another country for long enough to understand the local culture and experience the way locals see the world
  • living in a small town - Ispra is a 5000 people enclave, so it's not even a small town, more of a village
  • working for the European Commission or some other governmental organization like that - I am afraid of the bureaucracy, frankly, I hope there is some sort of separation between devs and that sort of thing
  • working with actual new technologies - I thought there are some people that inflate their resumes in order to get jobs they don't really deserve, but I never imagined that most companies would misrepresent themselves to appear more attractive as a workplace. I've heard a lot about what great new project I will be working on, only to be relegated to some legacy crap that no manager wants to rewrite even when it's bankrupting their company. Oh, I really hope the JRC people didn't bullshit me about an ASP.Net MVC 4.5 web site with Web API's, AngularJS and Google Maps.
  • staying separated from my wife, but not being mad at each other - not that I have ever stayed separated from her while being angry, but still. Our relationship started as a long distance one, since we were living in different cities, and only after a year we moved in together. I am curious as to how this reversal will affect us. I believe it will strengthen our bond, but there are alternative scenarios.
  • working and living in a truly multicultural environment - the place will have Italian, French, German, Swiss, Romanian and who know what many other types of people. I will have the opportunity to relearn all the European languages, express myself in them, learn about other cultures from the horse's mouth, so to speak.

All in all, this is the gist of it. You can see that I am excited enough (setting the stage for future disappointment). My plane leaves Bucharest next Friday, on the , while actual work begins on the . Hopefully this will generate a deluge of technical blog posts that will compensate the lack experienced in the last two years.

ASP.NET MVC 4 Recipes, by John Ciliberti

Book cover When I first opened the ASP.NET MVC 4 Recipes, by John Ciliberti I was amazed. It seemed to transcend the reference book and go into a sort of interactive path thing. You know interactive books, where you read the book and at certain points you get to choose what the characters do by going to read one page or another? This is what Recipes seemed to be. You get to a point where the author tells you which chapters to read and in which order based on your role in the organization. That is and will remain a wonderful concept and I would see more books steal it for themselves. However, the actual content of the book did not feel as great as its presentation, I am afraid to say. This is not to mean it is a bad book, only that I expected a lot more from it from reading its "mission statement". The book is Microsoft centric, obviously, but it says very clear that it will solve problems with Microsoft products as a rule. For example it favours KnockoutJS as a JavaScript framework. But that's not really annoying, though.

I think what bothered me most was that the content was all over the place. There are some chapters in which there are specific problems. The problem is described, then the solution is provided. Very nice. But then there are some problems that are vague and general with a very specific solution, lending a lot of lines to some issues and moving past others in a hurry. Of course, I would have liked all of the problems to have their own book and that was impossible, but the compromise here did not feel as great; I thought some of the problems were not really something someone would have more than once, and sometimes never, so using the book as a reference helps only so much. Some examples of problems to be solved: You would like to begin working with ASP.NET MVC Framework, but you do not understand the MVC pattern and why it is beneficial. - why would you start reading an ASP.Net MVC book if you don't even understand the MVC pattern? You would google something first. Or: You have started using the new .NET asynchronous programming pattern and love its relative simplicity compared to other programming models. However, you would like to have a better understanding of the code generated by the compiler so that you can improve the designs of your asynchronous methods. So you jump from not knowing what MVC is to wanting to read IL. Maybe I am just mean, but it soon turned into a very hard to read book from jumping from one issue to another like that, from level to level. Not to mention some "loaded" problems that have a description several lines long in the form of "you have found that your company strategy sucks, because of 1,2 and 3, and you want 4,5 and 6 because 7,8 and 9". It doesn't sound like my problem at all :)

Bottom line: I have not started working with ASP.Net MVC, yet, nor do I believe that my first job with it would be as an architect, so I will have an opinion on how it works in real life in a few months, probably. The book seems useful now, but not the ASP.Net MVC start to end tutorial that I wanted when I started reading it, and maybe that is why I had such a critical eye for it.

Thursday, 22 August 2013

Bradley Manning gets 35 years in prison, Snowden is on the run, journalists get harassed and you are being under surveillance for reading this article

In a recent news article I've read that Bradley Manning has received a 35 years prison sentence. I can't even begin to understand how to feel about this. On one hand, he was a member of an organisation that specifically prohibited what he has done. On the other hand, the same organisation was swearing to anyone having ears that it doesn't do what Manning revealed they did. The multiple levels of "law" that are apparent both in this case and the Edward Snowden case are sure to make even jurists scratch their heads. In cases where some guy is arrested based on a secret law, incarcerated and pretty much tortured in a secret prison then sentenced by a secret court, it all seems like an alternate reality. We've had people close their web businesses, then declaring they can't discuss why they did it because it would be illegal. Please feel free to read the links above, although that may well put you in a special category for US surveillance, for all I know. (OK, let's not be mean!)

The thing with Manning, though, is that he was a mere private, a kid. By the accounts revealed in the court, he was the product of an alcoholic mother and had gender identity issues, as well. He revealed some information (I will be discussing that in a moment), then he was pretty much caught and incarcerated. Do pay attention to the last paragraphs of the Ars Technica article on his sentencing:
During one period of his pretrial incarceration, Manning's clothing was confiscated every night, and he was then forced to stand for inspection by guards while naked. He was also prevented from sleeping between 5am and 8pm and not allowed to have sheets on his bed.
. Then they sentence to guy to 35 years in prison, maybe he can get out in 8 if he "behaves well". This is the story of a screwed up kid with a conscience that now gets even more screwed up. Of course, there is the possibility that he gets out of prison, writes a book, sells the movie rights and becomes a rich hero of the masses...

Then there is the extent of the information he leaked, information that was then published by another entity, Wikileaks, which at least in theory should have restricted publishing any material that exposed specific people to harm. Wikileaks continues to do well, just as the news outlets that published information like this from Manning and Snowden (arguably harassed by governments, but still in business), which for me makes no sense, since that should mean the publishing of those articles is legal. So the only illegal thing these guys did was give information that is legal to publish to publishing entities. It is hard to see this as anything else than punishing people for telling on you. I see it like a bad teacher beating children who told on him to their parents, bureaucratic institutions that are flexing their muscles when being confronted with even the idea of oversight. Can anyone explain to me how this is different?

Now, obviously the upbringing and psychology of the guy leaking government information shouldn't even be on the table here. What we should be discussing is what is reported in those leaks and what the effect on the people (and their serving government) is. However, that is way over my head. I can read reports of torture of an American private by Americans and be flabbergasted, I can feel disgust when watching the video of a helicopter pilot shooting dead a dozen people kilometres away because he thinks he sees an RPG, and they are actually reporters with a camera, but there are a lot of documents that were leaked, from foreign diplomacy and espionage on allies to reports of wrongdoings by army and intelligence entities. I can't claim to know enough about this stuff to make a statement, but as far as I can see, nobody really appears to know enough about this. It seems like the little government oversight we expect as people was missing to begin with. And that is what worries me. Stop making examples out of people who come forward with untoward things because you can't adapt to the reality of the people who hired you!

Monday, 19 August 2013

LSD: My Problem Child, by Albert Hoffman

Book cover This is the second book about LSD that I read, after The Center of the Cyclone: An Autobiography of Inner Space, by John C. Lilly and it is also the autobiography of a scientist, but unlike Lilly, who seemed to have gone bonkers while writing his book, Hoffman maintains a scientific attitude about the whole thing, objective when needed, subjective in more personal chapters that he clearly delimits from the others. LSD: My Problem Child is the story of the invention of the drug, straight from its inventor, Albert Hoffman, a then chemist for pharma company Sandoz. In a nutshell I loved the book, the style, the author's integrity and the fine ironies that he slips from time to time. As you can see in the link above, the book is already free online so there is no real reason not to read it.

Hoffman explains in the book how, while researching the chemical properties of the ergot and attempting to potentate substances already discovered to have positive medical effects, he created Lysergic acid diethylamide. The substance had no visible effects on the test animals so he went on testing other substances. Five years it took for Hoffman to return to LSD in order to further understand its function. Usually a very thorough chemist, he touched some of the substance and only then the effect was understood. This simple anecdote hints on how many interesting chemicals we might have gone unnoticed, even after someone created them.

The method by which chemists work to find useful chemicals in nature is also very interesting. They take a plant, let's say, that has a specific effect that is testable via animal experiments. They isolate the active substance that produces that effect. Then they attempt to recreate the substance synthetically. After doing that, they test all kinds of related substances that they create via simple chemical operations from the original substance. This often leads to more powerful drugs or even completely new effects. Quoting from the book: "Of the approximately 20,000 new substances that are produced annually in the pharmaceutical-chemical research laboratories of the world, the overwhelming majority are modification products of proportionally few types of active compounds. The discovery of a really new type of active substance - new with regard to chemical structure and pharmacological effect - is a rare stroke of luck."

It took another five to ten years for LSD to reach mainstream. Until then psychologists and psychiatrists were using it to more effectively reach the patients and LSD was considered a wonder-drug. Sandoz was extremely happy with Hoffman's discovery. But then it became a subject of abuse. A counterculture of recreational use for LSD led to an institutional backlash that made the drug illegal, even if it was not addictive, not toxic and one could not overdose accidentally. However, it was essential to take it in a controlled environment, with someone to act as a guide and safety net. Many people did not do this and hurt themselves or others or had psychotic breaks. To get someone out of an LSD trip was simple: either guide them via calm words or (the technical solution) give them a calmer agent like cloropromazine which immediately cuts off the "high".

How come the black market is filled with toxic, addictive, nasty drugs, but someone considers LSD to be a problem? Anyway, I am quoting again from the book, a little bit that talked about experiments on primates, but one that I took to be a fine ironic jab at society's reaction to the drug: "A caged community of chimpanzees reacts very sensitively if a member of the tribe has received LSD. Even though no changes appear in this single animal, the whole cage gets in an uproar because the LSD chimpanzee no longer observes the laws of its finely coordinated hierarchic tribal order."

What I liked about the book very much was how thoroughly and objectively Hoffman researched LSD and other psychedelics (he also identified and separated psilocybin, another psychoactive substance present in "magic mushrooms" used by native Americans in religious rituals). He not once preached the recreational use of the drugs, deplored the misuse of these kinds of substances, but he also kept a strong position that they do no harm and can have amazing effects when used for medical purposes and the correct way. Far from being a "druggie" book, this is one of those autobiographies that you can't let down from your hands until finishing reading it. I recommend it wholeheartedly.

Tuesday, 13 August 2013

Double Dexter, by Jeff Lindsay

book cover The sixth book in the Dexter series is not really better than the others. I would have thought that five rehearsals would have resulted in a slightly better book, but instead it seems as if Jeff Lindsay is slowly losing the inspiration he started with book after book. In Double Dexter, the police is impossibly incompetent and this time even Dexter falls into the same category. It takes him chapters to do and act like he was supposed to and a lot later than even an average reader would see it coming. The opponent is inconsistent and not really a challenge, if it weren't for Dexter's apparent drastic drop in IQ.

If you have not read any of the books so far and maybe just watched the CBS series, be warned that they are completely different beasts. The show writing is clearly better and the plots are divergent to the point of being different stories altogether, but with the same character. Not that this eighth and final season is great writing anymore, but that's a different subject altogether.

Bottom line: Having read Double Dexter, I cannot say that I hated it, I really like the character, but I think Lindsay is bored with Dexter. Maybe he should just invent someone else and start writing better books.

Sunday, 11 August 2013

AngularJS, by Brad Green, Shyam Seshadri

Book cover I have been hearing about the AngularJS library for a few months now, people often praising it as the new paradigm of web development. It is basically a JavaScript MVC framework that makes heavy use of markup language in order to declare the desired behaviour. Invented at Google by Miško Hevery, it uses cacheable templates, databinding and dependency injection to combine the various components that otherwise are independent and testable. It also comes with its own testing framework (unit and end-to-end) and a way to describe unit tests Jasmine (BDD)style.

So I started reading about this new framework in the book intuitively called AngularJS, written by Brad Green and Shyam Seshadri. They start with an anecdote, discussing how they were working on a web application at Google. They have already written 17000 lines of code in about 6 months and it was almost finished, albeit with great frustration related to development speed and testability. This guy, Miško Hevery, tells everyone that by using a framework that he wrote in his spare time (you gotta love devs!) they could rewrite the whole application in two weeks. He was wrong, they did it in three weeks and at the end the whole thing has only 1500 lines of code and was fully testable. This was a great beginning for the book, as it starts with a promise and then (sorry, couldn't help the pun - you will see what I mean if you read the book or know AngularJS already) it describes how to achieve your goals. The book itself is not large, about 160 PDF pages, and can be used as both a primer and a reference. It describes the basic concepts of AngularJS and how they can be put to work, with some small app examples at the end. Of course, you have a link to where to download all their code samples.

What do I think about the book? It was pretty good. It shows the authors' preference towards Linux setups, but it is not annoying. Each chapter is clear and to the point. The framework itself, though, is original enough that after a few chapters it is almost impossible to understand everything without tinkering with the code yourself. Unfortunately I didn't have the time and disposition to do that, so just because I've read the book doesn't mean I know how to work with Angular, but I am confident that when I will actually start working with it, it will all come together in my mind. Also, as I was saying, the book can easily be used as a reference. It is not a complete overview, not every AngularJS feature and gotcha can be found in its pages, but it's good enough.

What do I think about the framework? It seems pretty spectacular. My only experience with JavaScript MVC frameworks is from a short brush off with BackboneJS. At a time I thought I would be working with it a lot and was boasting here that interesting posts would appear. Alas, it was not to be. Sorry about that, maybe better luck with Angular. Backbone was pretty interesting, but it had a horrendous way of working with data models and it was very easy to break something and not realize where it came from. There seems to be a lot more thought put into Angular. An interesting point is that the writers advertise TDD as a way of actually working and claim they do so themselves. I have seen many people trying and giving up, but I have hopes for JavaScript. You don't need to compile things, you don't need complicated servers or time consuming deployment steps: just change stuff and run the tests and/or refresh a page. I like the fact that the creators of AngularJS put this much work into making everything testable.

So go ahead: read the book and try the framework!

Update 24 Aug 2013: I've started reading dev blogs again and I've stumbled upon a 70 minute video by Dan Wahlin presenting AngularJS. His explanations seemed a lot more down to Earth than those in the book so I felt that his video really complements rather well what is written there. Here it is: