Tech Trained Monkey

Everyday Problem Solvers

Analysing success

As the 1940’s air war in Europe intensified, the Allies faced a major problem. Their bombers would leave England by the hundreds, but too many of them didn’t return, brought down by extremely heavy enemy flak. The Allies desperately needed to beef up the armor on their planes to provide protection, but armoring an entire plane, or even an entire cockpit, involved far too much weight. How could they choose the few especially vulnerable places to be armored?

A couple of clever engineers solved this problem with a counter-intuitive analysis. After comprehensively logging the locations of flak damage inflicted around the fuselages, engines, and cockpits of planes returning from hundreds of bombing runs, they calculated Read more of this post

Why english

As you know (or not) I’m Brazilian. I was born in Brazil, studied in Brazil, I work in Brazil, and (I’m ashamed to say) never been to a English speaking country. Nevertheless my blog is written in English and more often than not I hear the question “Why English? Why not Portuguese?” and I my answer always is “Because I want to reach as many people as possible”. Reaching people is not why I write this blog (my motives are strictly selfish) but it’s the motive why I do it in English.

I also program in English. When people ask me why I reply: Read more of this post

Advanced Troubleshooting Sql Server Pt.1

Detecting a Bad SPN

Okay, we all know the error that this causes. Even saying SSPI context is bad juju, and I feel dirty when I talk about it, but it has to be said:

Cannot generate SSPI Context

This is a generic error that can be caused by 1000 different things, but experience has shown me that 98% of the time, it is caused by 1 of 2 problems. Either the server is not able to connect to a domain controller to establish the SSPI context or there is an invalid SPN for the SQL Server service in AD. To verify if the domain controller connection may be a problem, I check the System event log. There may be errors stating that SQL Server was not able to connect to a domain controller or kerberos errors. The error logged may have occurred several days before you see the SSPI context errors. 99% of the time, this error is resolved by rebooting the server.

I want to talk about the second cause. An invalid SPN will cause this error. No SPN at all will NOT cause this error. That bears repeating: No SPN at all will NOT cause this error. Adding an SPN to AD will NOT fix this error. Setting up kerberos or constrained delegation when there is an invalid SPN will NOT fix this error. Starting to see a pattern? Read more of this post

What is spaghetti code?

One of the easiest ways for an epithet to lose its value is for it to become over-broad, which causes it to mean little more than “I don’t like this”. Case in point is the term, “spaghetti code”, which people often use interchangeably with “bad code”. The problem is that not all bad code is spaghetti code. Spaghetti code is an especially virulent but specific kind of bad code, and its particular badness is instructive in how we develop software. Why? Because individual people rarely write spaghetti code on their own. Rather, certain styles of development process make it increasingly common as time passes. In order to assess this, it’s important first to address the original context in which “spaghetti code” was defined: the dreaded (and mostly archaic) goto statement.  Read more of this post

I’ve inherited 200K lines of spaghetti code—what now?

kmote asks: I am newly employed as the sole “SW Engineer” in a fairly small shop of scientists who have spent the last 10-20 years cobbling together a vast code base. (It was written in a virtually obsolete language: G2—think Pascal with graphics). The program itself is a physical model of a complex chemical processing plant; the team that wrote it has incredibly deep domain knowledge but little or no formal training in programming fundamentals. They’ve recently learned some hard lessons about the consequences of nonexistent configuration management. Their maintenance efforts are also greatly hampered by the vast accumulation of undocumented “sludge” in the code itself. I will spare you the “politics” of the situation (there’s always politics!), but suffice it to say, there is not a consensus of opinion about what is needed for the path ahead.  Read more of this post

Why integers are lousy primary keys

When I was a noob (about 2 years ago) I took a freelance gig to develop a simple system for a small shop. Very basic stuff. Few weeks ago the owner called me saying that he was very happy but he was facing a problem… You see, his business grew and he now has 3 shops, all of them using my system, and he wants to consolidate on one database. Well, as you can imagine I only managed to accomplish this by replacing the primary keys. They were all integers, now they’re GUIDs. The reason? Integers clash very easily!  Read more of this post

Welcome to Daange

Logo Daange

It’s with great please that I would like to introduce Daange.

Daange is all about events and people. It’s primary focus is to be a simple and easy to understand/operate enviroment for event scheduling, sharing and searching.

This is a colaboration between Leandro Faria and me. This is the 0.1 version, wich means, it’s the very first public beta.

We would like very much to hear back from everyone and see you guys there!

Portfolio

Well I must say that I always enjoyed interviewing candidates, and there’s quite some time that i don’t do it. I like it so much because everytime I open that interview door I see the chance to meet someone that will impress me (and it’s sad to say that some don’t even try) even though they rarely do.  Read more of this post

Creativity, Technology and Necessity

Last sunday I watched The Avengers (awesome movie by-the-way, Kudos to everyone involved) and yes The Hulk is awesome, Scarlett Johansson is hot and Thor does have a mighty hammer, yes, but my favorite character is not a human, it’s a software, and it’s know by “Jarvis”. In fact what I like most about Iron Man movies is not the plot, or characters or Robert Downey Jr. What I like most is the tech, specifically Jarvis.  Read more of this post

About commenting code

I will not lie: I always had a beef with literature and non technical text interpretation. Dont get me wrong: I’ve never misunderstood a math problem text, or a chemestry-phisycs one, but when the literature teacher would say that the poem was about the solitude and the seek of self I was always like “WTF?!? where did she took that from?!? this poem is about a man who enjoys long walks in the desert!!!”. Some say that I might be a little too literal and stuff, and I disagree! I’m practical, rational, precise, objective and I belive that if you want to tell the world about “solitude and seek of self” you should do it clearly and precisely, and not by writing a 200 foot long poem that tells the story about a man walking in a desert.

And yet no one expect to find something like this on poems:

Roses are red

Violets are blue

// Here I’ll define the meaning of life

I don’t live for myself

// And now a recursive definition of life

I live for you

I know, very Shakespeare-like… The point is: Why should a programmer write comments on his own code?!? If something was very hard to figure out and program, it should be very hard to understand and maintain! Right?!?

Follow

Get every new post delivered to your Inbox.