Monday, May 24, 2010

User-Defined Literals, a new feature in C++0x

Going through the latest draft. There's going to be a way to define your own custom literals.

For example:


long double operator "" w(long double);
std::string operator "" w(const char16_t*, size_t);
unsigned operator "" w(const char*);

int main()
{
1.2w; // calls operator "" w(1.2L)
u"one"w; // calls operator "" w(u"one", 3)
12w; // calls operator "" w("12")
"two"w; // error: no applicable literal operator
}


Could come in handy...

Saturday, May 22, 2010

German Sensitivity

My grandmother has been receiving, for the last few decades, a small monthly payment from the German government. Compensation, you know, for trying to exterminate her.

She recently asked me to translate for her this letter they sent. It's in dense official German and printed in small letters she can't really read. The letter informed her she was given a new identification number. It is to be used in all future communications with them.

Get it? They're assigning holocaust survivors identification numbers. How efficient...

How to protect all your Google searches

Google started allowing people to search using https.

Every one should configure this as their default search method. It's very easy to do.

Why should you do this? Because:

1. Your searches will be much more secure from any snooping 3rd parties.
2. The more encryption there is in the world, the better. It makes it harder for "bad guys" to filter out the "uninteresting" communication when they eavesdrop. (think of it this way: if all communication was encrypted it would be much harder for hackers to choose what to intercept)
3. Why not? You won't notice the difference (but hackers will) and it doesn't change the way you search.

Here's how to configure Chrome so that every time you search it goes through https.

1. Menu -> Options -> Basics -> Manage (default search engine).
2. Click Add and copy paste the following values into the boxes:
2.1. Name: Google Secure
2.2. Keyword: Google
2.3. URL: https://www.google.com/search?q=%s
3. Click Ok.
4. Now choose "Google Secure" (it's what you just created) and click on "Make Default". That's the important part.

Now Chrome will always use https when you search from the search-bar.