29jun2009

Google Chrome
Browser performance problems? Simple tricks to the rescue:
“To speed up browsing, Google Chrome resolves domain names before the user navigates, typically while the user is viewing a web page. This is done using your computer’s normal DNS resolution mechanism; no connection to Google is used. As a result, user navigation time in Google Chrome when first visiting a domain is on average about 250ms faster than traditional browsing, and the occasional but painful 1-second-plus delays are almost never experienced.”
And how it works:
“DNS prefetching just resolves domain names before a user tries to navigate, so that there will be no effective user delay due to DNS resolution. The most obvious example where prefetching can help is when a user is looking at a page with many links to various unexplored domains, such as a search results page. Google Chrome automatically scans the content of each rendered page looking for links, extracting the domain name from each link, and resolving each domain to an IP address. All this work is done in parallel with the user’s reading of the page, hardly using any CPU power. When a user clicks on any of these pre-resolved names to visit a new domain, they will save an average of over 250ms in their navigation.”
Check the full article.
Very clever and efficient.
Link deste post
16jun2009
Para quem tem uma alimentação vegetariana ( ou vegana, que é meu caso ), e vai ao FISL, tem alguns restaurantes próximos a PUC de Porto Alegre, porém não são vegans, mas tem opções de lanches vegetarianos, são eles: Café com Pecado Avenida Ipiranga, 5200 Quiosque 29 – Bourbon Shopping Ipiranga – 90610-000 – Porto [...]
Link deste post
11jun2009
Getting Real In The Early 90′s – The Secret Behind the Rise of ID Software
Recently, I’ve finished Masters of Doom by David Kushner for the second time now and it’s interesting the new insights and relations i’ve noticed . When i read it for the first time (july/2005) i wasn’t even working with software development. Now that i’m kinda on the trenches(working as a developer on a small & agile product development team) i’m in better conditions of analyzing it
Games in general always made me curious in terms of how they were made, but Doom was the Coup de grâce that made me pursue programming for a living. The delicate weaving of computer code , art and fun present on games will always interest me. 
Masters of Doom describes in a “novelish” style how the precise weaving of such factors, coupled with REAL team work can create a product able to cause a full paradigm shift in its area. While reading the book you possibly will remember of agile principles and some Getting Real essays
Doom was born out of a womb with brilliant minds working together within an Agile-like environment. It’s noticeable what ID did at its halcyon days had a lot of Agile and Getting Real ideas rooted in it :
Small, highly synergic development team:
Their common objective was fairly simple. Developing games through hard work(crunch mode included) and having alot of fun in the process. Carmack focused on technology, Romero bridging between the technology/design and designers Adrian C., Petersen, Hall and Cloud doing graphical and level design.
Iterative Design:
iD’s development cycle seemed to be of iterative nature. In those times where technology limitations where the main barrier for them to implement their visions, Carmack was the guy that would do anything to overcome this limits so the game experience could the the best possible. Through research and implementation, the team would test the framework and experiment design ideas over it, giving room for the design to emerge. When something clicked, they directed all their efforts to it until it was shipped. Doom, the game who changed the gaming world as we knew was born in this way. [1]
Motivated individuals in environment with all support needed:
Jay Wilbur, as manager would do whatever needed to get the team focused 100% on the product. From standard business stuff to cooking barbecues and filling junk food supplies for the developers.
Build it for yourself/It Shoudn’t Be a Chore:
Being a team of ultimate gaming lovers, they knew how to create fun properly. John Romero always was a hardcore fan of his own work(check out how addicted to Doom he got). The results were notorious , Doom invented a genre, a lifestyle and made ID guys multimillionaires
Fund Yourself:
Id software was assembled with every employee on a Day job at Softdisk. At night and during the weekends everyone would reunite at the Lake House to work on their stuff. They pretty much funded their work on the early days.When good conditions to work full time appeared(after joining ranks with Apogee’s Scott Miller) they so did it.
The book makes clear that as iD success grew exponentially, team union started to fade away. John Romero, the lead game designer(and “product owner”) got too involved with marketing-related activities and other distractions. Quake(Doom’s successor) had a more complex technology and most members of the team felt disoriented in which direction their designs should go. Constant team interaction problems made Quake’s development unroll under a heavy weather[2]. Unity was being lost, Carmack/Romero weren’t synced anymore and the divergence of their ideas on how Quake and Id’s future should be, only increased.
Quake is iD Software’s equivalent of Beatles Let it Be: Great work, highly appraised but it costed the union of a very innovative team. Life would never be the same :
[..] The good mood didn’t last. Like Romero at Ion Storm, Carmack was discovering that the glory days of a small team and easy chemistry were gone [...]
Although always an excellence in technological innovation through Carmack’s work, Id never managed to explore new genres and achieve new game design innovations again. In my view it turned out to be more of a technology company, always providing bleeding edge engine technology. Surely this direction caused their game designer talents to leave over the years(like American McGee & Sandy Petersen)
What Went Wrong?
Scaling is hard
The transformation process of a b2b(buddy to buddy) company to a world synonym of digital entertainment is not easy. I see this happening everywhere, family businesses included. If the entire team is not working together to keep unity solid, the consequences are often bad.
Communication & Feedback
The book explores alot the individual feelings of ID Crew in different times and the impression left is that a communication gap was always present between the team members. Their issues often accumulated in a boilerplate and discussed in tense meetings(one of those got Romero officially fired).
Fame , Fun and Fortune can be harmful distractions
According to the book Romero kinda lost his focus when Doom exploded. Deathmatching competitions , media appearances and related stuff kinda separated him from the work at Id. Although this “Marketing” position was important, the Quake development kickstart was important too. Carmack was left mostly alone during the Quake engine development stage. His trust in Romero greatly reduced during at this period
Everybody together
Again, the moment when Team Members get distant and start working too much time on their own islands, communication isn’t exercised and creative potential isn’t leveraged properly. The empty spaces tends only to grow
Conclusion:
When trying to innovate and create something really remarkable, an agile-way-of-work and good team composition proves to be a powerful ally to achieve groundbreaking results. It is important to keep the “agile core” strong when the whole structure starts to grow.
“In the information age, the barriers just aren’t there. The barriers are self-imposed. If you want to get off and go develop some grand new thing you don’t need millions of dollars of captalization. You need enough pizza and Diet Coke to stick in your refrigerator, a cheap PC to work on, and the dedication to go through with it. We slept on floors. We Waded across rivers” – John Carmack
References:
Masters of Doom (2004) – How Two Guys Created an Empire and Transformed Pop Culture
[1] See Chapters 9 – 10
[2] Pg 272 This is not the id of the past, he thought, the id of “let’s make a great game together and have fun” This is the id of “shut up and work”
Link deste post
10jun2009
This remembers me of the good ol’ crazy nonsense errors from Oracle:

The screen is all blurred to maintain privacy because that’s my work PC.
I’ve got this pretty awesome message by trying to save a file during a build. That’s the kind of thing that makes a programmer day.
Link deste post
8jun2009
For the last few weeks, I’ve been working with PayPal API at my job. Besides the usual PayPal payment method, PayPal provides a direct credit card transaction solution too and it’s named Website Payments Pro. When we’re dealing with credit card numbers, we should be careful with fraudulent, illegal and false number cards. In my past experience, I’ve seen some credit card validators but never worried about how it was done. But this time, I had to take a look on how the validator works because of Discover credit card, which is not in use in Brazil.
A very quick search in the internet and I found the base algorithm to validate the most common credit card brands (Visa, MasterCard, Diners Club, Amex and Discover). It is the Luhn Algorithm. The Luhn Algorithm doubles every second digit from the rightmost of the provided number. For instance, if we have a number 529126, it will double the bolded digits. Then, it sums the doubled digits and undoubled digits ( (5×2) + 2 + (9×2) + 1 + (2×2) + 6) = 10 + 2 + 18 + 1 + 4 + 6 = (1 + 0) + 2 + (1 + 8 ) + 1 + 4 + 6 = 23 ). At last, it will verify if the resulted number is a multiple of 10.
So, let’s run into the code. The Luhn Algorithm implemented by me looks like the following:
public static bool LuhnAlgorithm(string creditCardNumber)
{
bool alt = false;
int sum = 0;
if (String.IsNullOrEmpty(creditCardNumber))
{
throw new ArgumentNullException("creditCardNumber", String.Format(CultureInfo.CurrentCulture, "the credit card number can't be null!"));
}
if (!Regex.IsMatch(creditCardNumber, @"^\d*$"))
{
throw new ArgumentException("Invalid Credit Card Number", "creditCardNumber");
}
foreach (char digit in Reverse(creditCardNumber))
{
int digitToSum = int.Parse(digit.ToString());
if (alt)
{
digitToSum = digitToSum * 2;
if (digitToSum > 9)
{
digitToSum -= 9;
}
}
sum += digitToSum;
alt = !alt;
}
return (sum % 10 == 0);
}
The Reverse method is:
public static string Reverse(string s)
{
char[] charArray = s.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
Now that we have the credit card number validator, we should check if the number is valid for the provided brand. To accomplish this task, we will use Regular Expressions. The table below shows how each brand implements their credit card numbers:
| Card Type |
Prefix |
Length |
Regular Expression |
| AMEX |
34, 37 |
15 |
^3[4, 7][\d]{13}$ |
| MASTERCARD |
51-55 |
16 |
^5[1-5][\d]{14}$ |
| DINERS |
300-305
36, 38 |
14 |
^30[0-5][\d]{11}$
^3[6,8][\d]{12}$ |
| DISCOVER |
6011 |
16 |
^6011[\d]{12}$ |
| VISA |
4 |
13
16 |
^4[\d]{12}$
^4[\d]{15}$ |
And that’s it. Just validates the credit card string number with the regular expression after the Luhn Algorithm and you will have a reliable credit card validator. The complete method will be like this:
public static bool ValidateCreditCardNumber(string creditCardNumber, string creditCardType)
{
if (!LuhnAlgorithm(creditCardNumber))
{
return false;
}
switch (creditCardType)
{
case "visa":
return ValidateVisa(creditCardNumber);
case "masterCard":
return ValidateMasterCard(creditCardNumber);
case "diners":
return ValidateDinersClub(creditCardNumber);
case "amex":
return ValidateAmex(creditCardNumber);
case "discover":
return ValidateDiscover(creditCardNumber);
default:
return false;
}
}
The discover validator method:
public static bool ValidateDiscover(string creditCardNumber)
{
return (Regex.IsMatch(creditCardNumber, @"^6011[\d]{12}$"));
}
Link deste post