Recently, I had an unfortunate incident with my GMail account. It got blocked for around one hour “because of suspicious activity”.

I was doing some User-Agent tests with Firefox and User Agent Switcher with GMail open in one tab so you can imagine my terrible crime… nothing at all :) I didn’t even refreshed a lot the GMail tab.

The feeling of impotence, of not being able to do anything (I use Google for my calendar, documents, emails… even my photos) was very frightening.

Also, the page’s help was very deceiving. It said to click on a link if I thought I was “innocent”. I did so and it sent me to the help. Inside the Answers system I was able to fill a form, which apparently was sent and I was again in the help, looping between the form and the details.

So the only solution was to wait until they decided to release my account back again.

 

Moral of the story: Don’t put too many power in just one place, if someone takes over control of it, you’re screwed.

I will start migrating all important stuff to a @kartones.net account so in case of more “lockdowns” I can at least unplug the domain from Google Apps for Domain and plug it elsewere to keep it working and receiving emails.

 

Moral #2: As soon as there’s money implied, everyone is evil. It’s only a matter of who’s more or less evil compared with the others.

Posted by Kartones | 2 comment(s)
Filed under: ,

Sometimes, learning from past mistakes gives us the best tools to prepare for the future.

This post might be taken as a flame against MS, but I would love to see similar ones related to Linux, Apple and other major companies like IBM. I would write them (because they all have fails, some of them big too), but I lack the knowledge as I have been most of my life in a “Microsoft ecosystem”.

  1. MSN Network: Microsoft’s attempt to conquer the online world by creating “their own internet” (much like AOL but with greater ambitions). It came with Windows 95 and on CDs.
  2. Windows ME: The bastard Windows son. Everybody hated it, nobody can remember anything good about it without cheating and looking at the Wikipedia. Half-way between Windows 98 and Windows 2000, was quickly killed with Windows XP.
  3. Internet Explorer 1-6: We’ve needed 7 versions of IE to start to have a decent browser. Always late (or directly the last) implementing all standards and browser features (like tabs). IE6 has particulary created "the way of the hacks" related to CSS and Javascript, hurting web development even as of today (but hopefully finally dying).
  4. XBox 360 RRoD: Probably the best actual-generation gaming console and at the same time the most hardware failures-prone one in history. During years, almost 100% of built consoles could potentially “achieve” the Red Ring of Death, so MS had to extend the warranty period, change the motherboard and even create a specific motherboard to fix old console models without a chance of having problems again in the future. Fortunately the problem seems to be perfectly solved now and all consoles in stores work without problems.
  5. Live for Windows: After the success of XBox Live, Microsoft got greedy and tried to charge PC users for something they always had for free: online multiplayer. It got so bad acceptance that they switched to just provide PC achievements, DLC and since recently a small online distribution store (as Steam).

As mentions that didn’t promoted to the final list, I had two more candidates:

  1. J++/J#:  Nobody knows anybody that has actually used J++ or more recently J#. It was a failed attempt to bring Java developers to the Visual Studio world and do a lock-in on the Windows platform. Finally Microsoft decided to “retire” J# after Visual Studio 2005.
  2. MSN Search: A terrible “search engine” that for years has only had usage because www.msn.com was the homepage of Internet Explorer. After a long number of versions, they have renamed it to Bing to celebrate a brand new search engine, and seems that it is finally being worth a try and actually providing at least decent results.

 

As usual, this is my personal opinion. I’ve lived almost all the Windows lifecycle (since Windows 3.11) and despite of this list, I still prefer Microsoft products on some areas (like the operating system or the development tools).

 

Note: Although many will claim that Windows Vista should be on this list, I particulary don’t see it as a Windows ME 2. While Windows 7 is for sure “the real Windows Vista”, Vista itself was not bad, only slow, and included a bunch of great features (like the great security enhancements). It just lacked a proper polishing.

Posted by Kartones | with no comments

Most people think that the only way to have a secure login is to make your whole site use SSL. And while in order to have a sniffing-proof site it is indeed required, for most sites just performing a secure login is enough (to avoid sending your username/email + password in clear text through the network).

How does it work? In the past, sites used to have the login page with https, and after logging in would switch to http (once the cookie is set, session created, ectetera). This is not bad, but if your login page is also the landing page for your site, can take a performance hit to start negotiating SSL channels on each visit.

A more elegant and performance wise solution, that many sites now do (like Amazon or Twitter), is to keep even the login page in HTTP, but perform the POST to a HTTPS url:

http calls example

Before any data is sent, the browser will detect that we’re going to post to a secure url and negotiate the SSL/TLS encryption and channel (step 9 in the image), and only send the data after everything is setup (step 14).

After that, we can change again to a HTTP channel and keep browsing at full speed (step 15), but none of our credentials have been exposed.

Posted by Kartones | with no comments
Filed under: , ,

AndroidWhen J2ME appeared, we were all told that it would allow to create Java applications that would run on any capable phone.
Nice utopia, but anybody that has either worked developing or alongside J2ME developers knows that this is, apart from a funny joke, quite distant from reality.

J2ME, if anything, can be said to be “code one, port everywhere”. With the epic mistake of Sun of letting manufacturers implement their own version of J2ME Virtual Machines, the mess that we have currently gives more headaches that solves problems, but still there are quite a lot of non-smartphones in the market so support and application development has to be still present.

False capabilities reporting, all kind of errors, problems and bugs on VM implementations lead to almost 100% of the cases leading to a pack of “builds” for specific devices (or if you’re lucky, family of devices of a brand), each with different fixes and/or hacks to bypass the problems.

So, in conclusion we have a nice idea gone terribly wrong and causing a lot of development problems.

 

Leaving apart other major PDA types (iPhone, Windows Mobile and BlackBerry), Google probably said “Hey, we can do better! Let’s include normal Java and provide better SDKs, more guidelines, an AppStore like Marketplace but free, and everything will go nice”.

And yes, the idea is ok, in fact Google is pumping SDKs at quite a fast pace (although they are more related to special launchs like Google Maps Navigation/Motorola Droid or the Nexus One than to the size of changes and new features).

Android itself is more than decent. IMHO is after the iPhone the best smartphone choice, better than a Blackberry and way better than Windows Mobile (I’ve been a WM user since its 2000 PDAs), the market has a lot of apps…

 

But I see two major problems:

The first one, Google itself noticed it, and is one of the reasons why Nexus One exists: Pushing SDKs is nice, but if the OS version pushing depends on the Operator, your screwed. In Spain, my HTC Magic runs Android 1.6 because Vodafone rolled the update, but HTC Hero is stuck on 1.5 because Orange hasn’t pushed 1.6 (says will push 2.0 but we’ll see).

Nexus One will be able to have direct updates, so problem solved, but at the same time google is now a competitor of the manufacturers and operators. The same problem happens with any Windows Mobile device, you usually get stuck with the OS version it has forever. Apple did it correctly because they only build a single range of models, so they control their OS updates.

 

And the second problem, is the falacy of Java pure multi-platform, projected on Android.

At work, we have one specific device that does not render correctly all transparent pngs on WebKit. Why does it happen, if it’s the same browser everywhere? Why some devices throw errors when others work perfectly with the same code? Why Google didn’t thought about multiple resolutions at first, and then launched a device with a crappier, lower resolution than “the standard” after many apps are out?

 

Those two things, and some stupid limitations (the browser doesn’t allows HTML file upload controls, but if you install Opera Mini under Android, it is able to use them…) are making me wonder if really Android is so platform independent, or if we’re going the way of a “cooler an better” J2ME version 2.

If you have an Android phone with some apps installed, you will probably notice this in a subtle way: almost weekly updates on quite a lot of apps, with update logs like “added multiple resolutions support” and then “fixed a few bugs”, “fixed a problem with xxxxx device”, “updated for the nth time to support Android 2.1” (isn’t it backwards compatible?)…

 

I wish I’m wrong…

Posted by Kartones | with no comments
Filed under: , , ,

book cover

I’ve writen a new book review, this time about the history of John Carmack, John Romero and the company id Software. It’s a biography so don’t expect source code, but a source of motivation ;)

Posted by Kartones | with no comments
Filed under: ,

The year is finishing, so here it is the typical 10 most visited posts of the blog written this year:

  1. Installing Debian 5.0 in Virtual PC 2007
  2. Tip: Modify Windows Vista network connections priorities
  3. Hack your Windows Vista 32 bits to address 4GB or more of RAM
  4. Tip: Increase user process address space to 3GB (and other misc. tweaks)
  5. Community Server 2007: Extend user profile to add Twitter account and auto-tweet
  6. ASP.NET: Split AppSettings and ConnectionStrings to separate files
  7. Building your own feedburner stats with the ASP.NET Charting control
  8. Building a very basic Google Wave extension
  9. The problem of untyped languages: PHP empty() function
  10. Review: FlairBuilder
Posted by Kartones | with no comments
Filed under:

While I’m not an expert, I’m neither an amateur in using Windows. I try to learn useful shorcuts, I combine mouse + keyboard for faster actions, try to have as few running programs as possible (both to improve performance and to avoid unlegible taskbar items) and in general keep my OS as clean and tidy as possible.

Since Windows 7, both the taskbar and start menu have improvements, like pinning programs and shorcuts. Thanks to that, I’ve been able to fully sort my start menu in the fastest way possible for me to use it.

First, the “quick access” Start Menu items list (instead of most recent ones, I manually pin and unpin them):
ordered Start Menu items

Second, the All Programs “root” level, with my custom categories (folders):
ordered Start Menu items

And finally, each category contains those shorcuts related to it, and nothing else:
ordered Start Menu items

I even have a 4th category under “Utils” called “Configuration”: Inside it I store all non commonly accessed apps like CCleaner or the antivirus scan on demand shorcut. the parent folder contains software used more frequently, the subfolder software of the same category but less frequent.

In the beggining takes a bit to get used to it, and requires discipline to order everything as soon as you install any new software, but pays a lot in productivity, as you always know where to click in less than a second (because you always have few items).

This Windows 7 improvements allow me now to have my “ultimate clean desktop”: 0 icons :)

I can do everything with the start menu and two start menu icons: One for the browser, and other for folder shorcuts (if you add multiple folder shorcuts to the task bar, they group under a single icon ;)

Posted by Kartones | with no comments
Filed under: ,

Gravatar is a website that, after registering and adding an email, allows you to set an avatar (image) associated to that email, so that sites that query them for gravatar images will return your same image to all of them.

Although Community Server doesn’t stores emails of user comments, I wanted to see how the avatars are obtained from Gravatar.com.

The url you have to build is well explained in their website, so I will just place a basic C# code that calculates the MD5 hash and inserts it on the url:

string email = "me@mydomain.com";

System.Security.Cryptography.MD5CryptoServiceProvider CryptoService
;
byte
[] InputBytes = System.Text.Encoding.ASCII.GetBytes(email.Replace(" ", "").ToLower())
;
string
emailHash
;

CryptoService = new System.Security.Cryptography.MD5CryptoServiceProvider()
;
                        
InputBytes = CryptoService.ComputeHash(InputBytes)
;
emailHash = BitConverter.ToString(InputBytes).Replace("-", "")
;

string
gravatarURL = string.Format("http://www.gravatar.com/avatar/{0}.jpg", emailHash);

And we’re done, the final URL pointing to a gravatar.

The following image gets one of my email adresses’ gravatar (if I change it from the cigar dog one day on my gravatar account, it will change automatically):

c61d22dc19219891c72b7b08e59ac71f.jpg?s=128

There are options (as querystring parameters) as getting the image in a specific resolution, or getting the identicon.

Posted by Kartones | with no comments
Filed under: , , ,

Note: This post is more for the bloggers of Kartones.Net.

First of all, my hosting provider changes its name and gets better facilities and hardware, so I’m getting a free upgrade to Windows Server 2008, SQL Server 2008 and IIS 7. This means that the site should go a bit faster soon (I’m finally getting PHP 5 and MySQL 5 too, although I’m not using them here).

The migration will take place on one of the weekends of december (I don’t know yet which one), so keep it in mind just in case the site goes down for some minutes.

 

Also, I found that the internal web-based post editor doesn’t supports Opera or Google Chrome, so I tried to upgrade TinyMCE. Unfortunately, CS2007 comes with support for 2.x, and 3.x has breaking changes, so I’ll have to do a real migration instead of a simple override of .js files. In exchange, I’ll try to minimize the controls and js needed so t hat post editing loads faster than it does now (it doesn’t even uses CSS sprites!).

I plan to make some small improvements to the mobile version too, the stats page is still broken (the Google Analytics part) and I have some more ideas to enhance the community.

 

Finally, I have a small dumb “proof of concept” project (very similar to a demo in the scope) that might end up being of more general interest than only for my “tests”.

Posted by Kartones | with no comments
Filed under:

Some coding guidelines and best practices advice against the use of continue and break statements.

With continue the solution is easy, placing an if (or if it existed to call continue, negate it to execute the code).

But with break, it is not always so easy. Some times, in fact the resulting code is more messed up or harder to read (usually because of too much ifs), so I use break sometimes in my code if avoiding it is going to be worse for readability.

The most common case of using the break statement is looping through an indexed array of elements searching for something:

int[] numbers = { 1, 2, 3, 4, 5 };
for
(int index = 0; index < numbers.Length;
index++)

    if (numbers[index] == 3)
    {
       
break;
   
}
}

How to avoid here the break? As one of my bosses taught me, remember the tools at your disposal; A for loop contains three parts: initialization expression, condition expression and loop/increment expression. Nothing forbids us to add additional checks to the condition expression, as in the following improved code:

int[] numbers = { 1, 2, 3, 4, 5 };
bool
found
= false;
for
(int index = 0; index < numbers.Length && !found;
index++)
{
    if (numbers[index] == 3)
    {
        found
= true;
   
}
}

We are short-circuiting the loop, but in a soft and more elegant way (and not commonly seen in the code!).

Posted by Kartones | 5 comment(s)
More Posts Next page »