How to get the new Google Bar right now

A few days ago Google announced the new design for all Google products, including the new Google Bar.

Google Bar

Like any other new Google feature, it will take time until it’s rolled out for everyone, so here is how you can turn it on right now:

  1. Go to google.com
  2. Press Ctrl-Shift-J (in Chrome) to open the JavaScript console of the Developer Tools
  3. Type (paste) in the following:
document.cookie="PREF=ID=03fd476a699d6487:U=88e8716486ff1e5d:FF=0:LD=en:CR=2:TM=1322688084:LM=1322688085:S=McEsyvcXKMiVfGds; path=/; domain=.google.com";window.location.reload();

 

Reload the page, and voilla!

P.S. If you’re using some other regional domain (like google.co.il), replace the domain in the cookie string.

[via Habrahabr (Rus)]

How to bypass the Call of Duty Elite “Age Gate Failed” page

Since posting my rant on the Call of Duty Elite Website, I’ve been getting a lot of hits on the blog from people struggling with the “Age Gate” page of the website. If for some reason you enter the wrong date of birth at the signup page, you will not be able to return to the signup to enter a new date, and get the “Age Gate Failed” page instead.

This happens because the Call of Duty Elite website stores the date in a cookie in your browser, and if you failed to meet the minimum age requirement, will not let you proceed. To bypass this, and return to the registration page you will simply need to delete the cookies from your browser, either all cookies, or just the ones for callofduty.com. After that, reload the website with Ctrl-F5, and try signing up again. Good luck!

The Horror of Call of Duty Elite Website

I don’t normally blog about this, so please excuse the following rant. As a public service, I search for “plain text” on twitter to find people complaining about sites storing user passwords in plain text. I noticed some people complaining about Call of Duty Elite – an official site for the Call of Duty: Modern Warfare series players from Activision – about their passwords being stored as plain text.

I decided to sign up to the website myself, in order to see for myself the “Forgot password” email that contained my plain text passwords. Below are my experiences:

I started by going to the Call of Duty Elite website and pressing “Join up for free” in the middle of the page. I was taken to a screen where I was prompted to either sign in with my Facebook account, or using a traditional sign up. I’m somewhat reluctant to authenticate with my Facebook account, because sites usually tend to ask for much more information from Facebook that they really require (I prefer using Twitter authentication for this, if available). Besides, my real reason was to register a bogus profile just for the sake of the password recovery email.

I proceeded putting up my email address, password, first and last names, all of which were visually validated. I then tried to select my country. When I clicked the “Select a country” combo box, I was presented with this:

Not only did the list not contain my country (Israel), it was completely unsorted and did not accept keyboard input to quickly lookup the county! This is already a major WTF, since the game is available worldwide, and lots of the countries are missing, but the list is unsorted, something that visually prevents quickly scanning for your country in the logical (alphabetical) location.

I selected a random country at this point, and entered a random date of birth below. I proceeded to click Next, and was presented with the following message:

Can you tell me from looking at this what went wrong? I couldn’t. It took me a while, then I noticed that the title of the page was “Age gate failed”, which led me to understand that I must’ve entered a wrong year (nowhere did it say that I must be at least X years old to sign up). I tried clicking “Back” to get to the signup page, and to my surprise I was redirected back to the “Age gate failed” page.

See what they did there? The Call of Duty Elite website had planted a cookie in my browser, preventing me to go back and enter another date! I thought we were done with this sort of behavior back in early 2000. How very clever, Activision!

So after deleting the cookies, and filling the information again using “correct” bogus data, I was able to sign up, get a verification email, and then finally go to the login page. Once I got there, I clicked “Forgot password”, and the following arrived to my email account:

I was speechless! Not only did it contain my password in plain text, as expected, can you see the little {0} placeholder instead of the sender’s name? I seriously did not expect a multi-billion dollar corporation to deliver such a low-quality service.

Bottom line: if you’re using the website, make sure you change your password to something else. Being a high valued target for hackers, I believe it’s only a matter of time before the “Sony hacking” history repeats itself.

Be safe!

Type in Russian (or any other language) with Google IME

I speak Russian, but I never bothered to learn how to properly type it on the keyboard. Every time I needed to search or write something, I would use a transliteration service, such as translit.ru, then copy the translated text to clipboard and paste it to the target window (such as a Skype chat session).

I have recently discovered Google IME (Input Method Editor) – an extension of Google Transliteration, brings the transliteration service to Windows as another language on your keyboard!

Here is how it works: after installing Google IME in your language, you will have that language added in your languages bar. Then, when you switch to that language using Alt-Shift, you then can type in English letters, and Google IME will automatically convert it to the target language (even suggesting the correct spelling if you made a mistake!).

Suppose I want to type “который час?” (“what time is it?”). I switch to the Russian language, then type the word “kotoryj”:

Upon pressing space, the first option will be selected, and kotoryj will be replaced with который. This works everywhere, from input fields to Word documents! When I’m done, I switch back to English using Alt-Shift.

For convenience, there’s also a toolbar that appears when the IME language is selected. If you don’t know how to transliterate a particular character, there’s a helpful character picker which you can use.

Horosho!

Watch my “Tips for Easy Unit Testing–Dealing with Legacy Code” Webinar

Today I did a very successful webinar about unit testing legacy code with Typemock Isolator. This is a deep-level talk, including a detailed code demo. I urge you to watch the previous webinars if you’d like a more entry level talk.

Enjoy!

I appreciate your feedback!

Watch my “Tips for Easy Unit Testing” Webinar Video

The video from the webinar is now online, you can watch it below:

Note: There was a problem with Visual Studio towards the end of the demo. Luckily I have done a similar demo for my previous webinar, Supercharging your Unit Testing. You are invited to watch it for in-depth view of Typemock Isolator!

Feedback and comments welcome!

Enjoy!

 

Where unit testing fails

Note: I wrote this post before watching Uncle Bob’s excellent NDC 2011 talk called Transformation Priority Premise, which talks exactly about the subject below, however I am still not convinced. I will write a follow-up to this post.

I remembered a story from a few years ago about “some guy” who tried to build a Sudoku solver using TDD (Test Driven Development) five times, failing and giving up, while “another guy” simply wrote a solver that worked.

A search led me to a thread on reddit, leading to this post by Ravi Mohan. As it happens, “some guy” who tried the TDD approach was Ron Jeffries, one of the fathers of Extreme Programming (XP), while the “other guy” was an algorithm and AI expert Peter Norvig. I highly recommend reading the original post and the updates, it makes for very thought provoking read (the original links to Ron Jeffries’ articles are broken, but you can find them by searching for sudoku on his site).

So what happened? How is it that the very people who preach TDD fail to implement it themselves? I believe the problem lies with grasping one of the most fundamental principles of unit testing, and that is – what not to test.

In one of the Software Craftsmanship Israel group meetings, our programming task for the evening was to implement a program that detects whether a given number was a Lychrel number. On the projector screen a summary of what a Lychrel number was, and some samples. We decided to split into pairs of people who knew how to write code using TDD (myself included), and people who were less experienced in writing tests. And so we began…

A Lychrel number is a number that does not form a palindrome when digits are reversed and then added together iteratively. For example: 56 + 65 = 121, 125 + 521 = 646, therefore both not Lychrel numbers. The smallest suspected Lychrel number is 196, failing to form a palindrome after more than 2 million iterations. This is also known as 196-algorithm.

Some 30 minutes passed before I realized that something didn’t feel right. We had written almost 10 test cases, all of which just asserted against known inputs and outputs we used from the projector screen. Several of us started arguing whether or not we should test the method IsPalindrome, since it was an implementation detail, and not a part of the interface.

I then remembered the story about the Sudoku solver and it made sense to me, just as it made sense to Vlad Levin – TDD is not an algorithm generator! The solution to the Lychrel number had just one solution – implementing the algorithm. There was no design that was needed, therefore TDD did not help in this case. All it had given us was a convenient way to input values to a function and getting a result.

At Typemock where I work I am sometimes asked via support how to test the DataSet or the DataReader, and whether our product can be used to mock the database. Yes, Typemock Isolator can be used to mock just about any object, the question is asking the wrong thing. You could create a fake DataReader filled with test data, but that would be too much work and very hard to maintain, and in the end will give you no benefit over using a real database. If you want to test whether your data access code works correctly – make it an integration test instead.

When I write unit tests today I try abstract my problem space. I no longer start at the very bottom, but rather I focus on the business requirement. A unit in unit test is not necessarily a method or even a class – it could be several classes collaborating together to achieve a business requirement. If your specification says “given a country, get an alphabetized list of cities”, don’t write tests for the sorting algorithm – it’s an implementation detail that you shouldn’t bother testing. Your assert should verify is that the list was indeed alphabetized, not which algorithm was used to sort it.

Many people very new to unit testing sometimes give up. They find it hard to know what to test, and end up spending many hours testing the wrong thing. When it later breaks, they find it too much of a hassle to maintain both the code and the tests, so they give up the later. The road to successful unit testing begins with understanding what unit testing is, but most importantly – what it isn’t.

Making the Internet better, one site at a time

Sometime ago my friend @omervk and myself created Plain Text Offenders – a wall of shame for websites that store and email your own password to you in plaintext. I didn’t expect this kind of explosion – hundreds of submissions already posted and dozens of new ones arriving every day!

I have just learned that Smashing Magazine have contacted us about the post on the wall of shame, saying that they took care of the issue, and no longer email plaintext passwords! Of course, we happily obliged by amending the original post.

Way to go, Smashing Magazine! We hope that more and more sites will take notice, and then take steps to make the Internet a better and safer place for all of us.

Book Review: “Clean Coder: A Code of Conduct for Professional Programmers” by Robert “Uncle Bob” Martin

The Clean Coder: A Code of Conduct for Professional Programmers (Robert C. Martin Series)In popular culture, computer programmers, sometimes confused with sysadmins, are often described as teenage punks, sitting in a dark, lit only by the glow of their monitor, empty cartons of pizza and Mountain Dew bottles scattered strategically around, frantically hacking away on their keyboard.

What does it mean to be a professional programmer? Is it wearing a suit and tie to work? Is it having certifications or diplomas decorating the walls of your office? Is it working hard, sometimes overtime and weekends, just to show your dedication?

To Uncle Bob, this is not what professional programmer means. The things commonly mistaken for professionalism, such as a dress code, are not what’s important, at the end of the day. Having developers act professionally towards the code and towards each other, however, is.

“Clean Coder” is a collection of anecdotes and stories about the 42-year programming career of Robert Martin, and he shares his rich experience of what it means to be a professional programmer. It’s knowing when to say no even to the most persistent of managers, and saying yes by committing to a task, and standing behind your commitment. It’s writing the best code possible by not sacrificing any of the principles of good coding practices, even in times of pressure. It’s asking for help and helping others, instead of hacking away with your headphones on.

If you value your chosen profession, you should definitely read this book, especially if you are working in less-then-ideal corporate environment – it’s up to you to drive changes in your work place, if the settings do not allow you to act professionally. If your company is not using source control – set it up yourself, and make sure to teach your team how to use it. If you’re not writing unit tests or waiting for QA to test for bugs – learn how to test your code, so that you’ll be able to know for sure that it works. Keep your skills sharp and your tools sharper. That’s what it means to be a professional programmer!

Microsoft Security Essentials bad UX excluding a process/directory

I was trying to add the Visual Studio processes to the Microsoft Security Essentials exclude list, but I couldn’t understand why the “Save Changes” button was disabled, even after I chose “Browse…”, and selected the file name.

Take a look at this screenshot, can you tell why?

Apparently, in the latest version of MSE they added an “Add” button, which you have to explicitly press in order to, well, add the very thing you just browsed for to a list below. This goes completely against every other program in the world, where selecting something in the browse dialog is usually enough – I never even bothered to look for the Add button, because I didn’t expect it to even be there.

A quick image search for the exclude dialog shows that in previous versions there was no Add button.

So if you don’t understand why nothing happens after trying to exclude things in MSE, make sure don’t have any extra buttons to press!