.NET (301) administrative (42) Ajax (42) AngularJS (2) ASP.NET (146) bicycle (2) books (201) browser (10) C# (136) cars (1) chess (30) CodePlex (11) Coma (8) database (56) deployment (3) Entity Framework (2) essay (119) flash/shockwave (2) flex (1) food (3) friend (2) game (22) idea (5) IIS (8) javascript (85) LInQ (2) Linux (6) management (4) manga (46) misc (720) mobile (1) movies (104) MsAccess (1) murder (2) music (64) mysql (1) news (101) NuGet (1) permanent (1) personal (68) PHP (1) physics (2) picture (340) places (12) politics (15) programming (524) question (2) rant (123) religion (3) science (44) Sharepoint (3) software (60) space (1) T4 (2) technology (13) Test Driven Development (4) translation (2) VB (2) video (105) Visual Studio (45) web design (47) Windows API (8) Windows Forms (3) Windows Server (6) WPF/Silverlight (63) XML (12)

Monday, June 29, 2015

Postman has to abide to the Chrome security measures (meaning no Referer header)

Whenever you want to test a REST API, Postman is a great tool. It allows configuring all aspects of a request: Method (GET, POST, etc), Headers, keeps previous attempts in history, manages collections of requests and saves them and it is installed as a Chrome extension, bringing it only two clicks away. It does everything! ... or does it? Short story long: no!

Reported as a problem here: Referer header is not sent when set in Postman, the issue appears to be that some headers are "protected" by Chrome, therefore unusable. Well, it is a bug in the sense that Postman should tell you that when you write something there it is completely ignored! There is a solution, that can be found as a link in the bug report, but it involves installing other crap and running Python scripts. Ugh!

Here is a list of the Chrome protected headers:
  • Accept-Charset
  • Accept-Encoding
  • Access-Control-Request-Headers
  • Access-Control-Request-Method
  • Connection
  • Content-Length
  • Cookie
  • Cookie 2
  • Content-Transfer-Encoding
  • Date
  • Expect
  • Host
  • Keep-Alive
  • Origin
  • Referer
  • TE
  • Trailer
  • Transfer-Encoding
  • Upgrade
  • User-Agent
  • Via

So whenever you believe that some web site has used a magical solution to detect your sneaky attempts to access their web API or site and you are wondering what, just remember that it is most likely a Referer header that Postman (via Chrome) silently ignored.

Monday, June 22, 2015

The Judging Eye (Aspect Emperor book 1), by R. Scott Bakker

The Prince of Nothing trilogy was a total masterpiece, full of harrowing experiences of flawed men and women and characters so deep and original that they defied belief. You get the godlike Kellhus, not only freezingly rational and intelligent, but also mastering the Gnosis, the art of magic, while being a textbook example of a charismatic psychopath. You get Akkamian, a worldly sorcerer and spy, a teacher and a hopeless romantic. You get Cnaiür, a monstrous barbarian driven by revenge, but trapped by love. Esmenet, the whore empress mother, being heartbreakingly and treacherously a woman. And all these complex characters get to live in an epic world of different cultures, with politics, and military campaigns and evil creatures serving the No-god, shape shifting assassins and magic schools. In fact, it was so great that I found myself feeling dread of reading more, so terrifying the deep and personal pain of the characters that it was becoming mine.

Now I have finished The Judging Eye, the first book of the Aspect-Emperor trilogy, itself no more than a direct continuation of Prince of Nothing. R. Scott Bakker kind of cheats by using the same basic scaffolding for this story: a military campaign where an innocent and sympathetic character is being eroded by Kellhus' influence, a dark character driven by revenge on a lonely and dangerous quest, against himself slowly warming himself to the presence of a woman, court machinations driven by self serving creatures and the general backdrop of a clash between religions. He does it masterfully, though, switching the characters around and adding new ones to fill the roles left empty. In The Judging Eye one gets something as similar to The Darkness That Comes Before as needed to please the crowds that enjoyed Prince of Nothing, but as different to make it a completely different story. You get more of the same, so to speak, with an emphasis on 'more'. But also a little bit less.

Not everything is perfect. I feel that the inner dialogues of the characters have become more opaque, more strained. The metaphors flow just as in the previous books, but they communicate less, one makes more of an effort to get them and feel what the author meant, giving it a slight air of pompousness. I mean even a little kid philosophizes more than all the adults I know. The book has slightly more action scenes than I remember in Prince of Nothing, but they also feel more confusing. For all of Bakker's talent, I think he doesn't really understand combat and physical violence. He more than compensates with emotional and visceral violence, I agree, but I can't stop myself thinking of all the tactical applications that were never explored in battles purportedly fought by hardened veteran mercenaries.

His biggest sin, I believe, is that he doesn't follow through with the revelations that he awards the reader. I remember he was doing something similar in Prince of Nothing as well. He takes one through the labyrinthine mental processes of a character that marches uneventfully, but he fails to explain what exactly is happening - or at least what the characters are thinking - when something extraordinary happens. For example, in one scene, they discover a crazed individual with an eye on his heart, driven mad by the darkness that his heart is plunged into. A very powerful image. Yet Bakker doesn't explain anything. How was that possible? How did Akka know to look at his heart? What the hell were hordes of Sranc doing in a sterile dead mountain tunnel? No, instead we get to read about every single internal thought that the characters have about themselves and their lives. To quote from the book: "the work of a race that has gone insane for staring inward".

Bottom line: there is so much introspection in this book that barely anything happens. Falling into his own trap, Bakker gets seduced by his characters to the point of ignoring the universe in which they live. The book remains incredibly good and so I will venture to read the next one in the series. I already lament the fact that the third book of the Aspect-Emperor is not yet published and dread the moment when I will finish the second.

Sunday, June 14, 2015

Chess Pastebin won't accept my PGN!

There is a nice web site called Chess Pastebin that allows one to publish a chess game as a PGN, comment on it using a Disqus form and share it with whomever you wish. However when I tried to use it, it refused to accept my PGN (extracted from Chess Arena). After many trials I realized that it considered invalid a move written as 10. .. some move instead accepting only 10... some move (no spaces between the dot of the move number and the dots representing a black move after a variation). So just replace ". .." with "..." to get a PGN acceptable by Chess Pastebin.

Friday, June 12, 2015

In vino veritas

I've always heard this when I was young, as a Latin proverb - and therefore old and wise: in vino veritas. I've always interpreted it as "alcohol loosens the tongue", but today I had a revelation. Yeah, alcohol does remove some inhibitions, but usually the things we say to other people while inebriated are really dumb things that only a drunken man would say. They are not truth, they are wishful thinking, fears, pains. Instead, I propose that the real truth of the wine is you cannot so easily lie to yourself!

Indeed, I've noticed this in several situations, highly emotional ones or normal ones - it doesn't matter, when I have drunk alcohol and I am thinking to myself I always reach the conclusion that lying to myself, no matter how comforting, is not worth it, and I often expose and dispel things like hypocrisy, pettiness, delusion and so on. My best psychotherapy was always alone, drunk or comfortably inebriated, having the opportunity and courage to confront myself.

Now, that might seem boisterous or even something a drunken man would write. And that is true. However, it doesn't invalidate the argument. I have recently counseled a good friend who just lost his mother (he didn't lose her, he knows where she is, but she just died) to drink - alone - and speak to himself. I only wanted to help using my own experience, but that prompted me to think a little about it and that materialized into this blog entry. Drink a little with your friends, relax, chill, do whatever social thing you want to do, perform whatever ritual your tribe is comfortable with, but that only removes the stress. It does little else. At worst, it makes a fool out of you. True drunkenness is lonely and revealing and bitter. It is not pleasant, it is, at best - when done right, or when lucky - therapeutic.

That's my two cents about the subject, but I feel I need to explain a passage above: "comfortably inebriated". Sometimes, especially if confronted with strong emotions (or even boredom or gluttony, why not?), we drink too much. We don't consider the "alcoholemy", the amount of alcohol in the blood, the rates of absorption and so on. If there is a "sweet spot" a place where the quantity of alcohol in our blood is good for us, the only way to maintain it is to compute the ingested quantity compared to the quantity of blood one has and maybe some empirical factors like tiredness, personal resistance to intoxication, body mass, what you ate and so on. More simply: find the number of minutes that you can afford to drink a beer and then continue to drink beers every such interval so that you not get completely wasted. Of course, the equations are slightly more complicated, but you get the gist of it. I submit that you probably don't need to get completely drunk to reach that sweet spot, instead just research and find the perfect combination for you. More than a few times I got wasted after I had stopped drinking, as the alcohol in my guts was getting absorbed.

I may be wrong. There is always the dark specter of acquired resistance to any intoxicant, so that while the experiment may be perfectly scientific and true, one would need increasing quantities of the drug to get to the same result. However, empirical evidence of people who started drinking a little bit, then more and more, shows that there is a point where they stop and get the same result with similar quantities of alcohol. There is the sad case of alcoholics, but I believe that to be a small percentage of people experimenting with alcohol.

Anyway, the thing to remember: a few (more) beers could be as good as a year of therapy, if you are willing to drop the veil and be honest... to yourself. Anyone else wouldn't understand anyway.

American Gods, by Neil Gaiman

audiobook cover Another really nice book I am glad I readlistened to. In 2001 Neil Gaiman published this book, American Gods, and then,ten years later, a special tenth anniversary edition, with the "author's preferred text" and including an additional 12,000 words, was published by William Morrow in June 2011. Both versions of the book were adapted to audiobooks, the first just narrated, the second with a full (and talented) cast. This second version I listened to, on YouTube no less. Long story short, I liked the book a lot, even if it was a bit too long winding.

The story is not only interesting in concept - gods being created and fed by people's beliefs, then being forgotten and dying as belief wanes, but also in its many details borrowed from the world's superstitions and religions. We start with a man in prison, a calm, cerebral man, but also big and muscular. He is about to be freed from prison and return to his wife and his best friend to start his life anew. From then he is just thrown into this crazy world of supernatural beings, but not like all these lazy TV shows where there are vampires and werewolves at war, but slowly and subtly. Gods are at the same time what we remember them to be: big spiders, thunderbirds, gods of war, but also men and women that can be killed. They can be pitiful beings, old creatures that resent the newness of the world and of its people. I also liked that there was not a lot of the major religions, just a few hints at the end. No Christian or Muslim stuff, I mean. At the end of the audio book there is an appendix, Shadow meeting Jesus, that the author wrote but decided to keep out of the book because it didn't feel like it was part of it. I agree with him.

There is also a kind of Lord of the Rings ending to the book. Even if the main story arches ended, there are still several chapters after that. I could have lived without them, I guess. This verbosity is also the problem with the book. Laden with details and side stories and keeping the pace slow can be slightly boring. I never read the version published in 2001, but it was shorter, which was probably for the better. I liked that Gaiman left a lot of hints in his writing and even I was able to see through them. That was maybe another reason why the pace felt too slow, since I've glimpsed a little of the whole story and then just waited for it to reach that point. However, that is the exact reaction of the protagonist, when he figures stuff out. He feels like he already knew, but refused to actually bring it into consciousness.

The adaptation of the book was top notch, the protagonist, but more than this the man called Wednesday, were interpreted by talented actors and I found myself drawn into the story like a man slowly being pulled down in quicksand. Give it a try.

It was announced by Starz in July 2014 that they are preparing an adaptation of the book into a TV series. Also, while there are other Gaiman books and stories in the same universe (like Anansi Boys, from 2005, which some call American Gods #2), the author announced he is working on a direct sequel of the book only in 2011.