Heartbleed Explanation

Heartbleed Explanation

Advanced “status” options

Two weeks ago I showed how to filter output of hg status with awk. That simple awk script removes unknown (untracked) files from output and also removes the file status: you get a simple list of modified/added files.

Actually, you can do this without using awk because Mercurial has advanced options for status command:

hg status --quiet --no-status

Or with short aliases:

hg st -q -n

The result is the same: you get the plain list of modified files, and files which are not under source control are ignored.

Java 8 Launch Event

Java logoLast week Oracle launched Java 8, a new release of Java platform which includes many new features, Lambdas and Streams to name a few. See Java 8 Central for more information, or go to Java 8 download page to download it and test-drive its new features.

Today, on March 25, 2014, there will be an online Java 8 launch event. The event starts at 10:00 AM PST, or 21:00 MSK.

Cyrillic displays as question marks in Flickr Stats

Now Flickr has completely broken its stats page: only search requests in English are displayed correctly.

I posted a discussion to the Flickr help forum:

Recently all the search queries in Russian started to show as question marks in Flickr Stats:
Question marks instead of Russian words at Flickr Stats page

Why do I think it’s Russian text that hides beneath question marks? Because it happened before, last year in August. Before August 2013, the stats showed Russian queries, and then they became a mojibake. But at least it could be decoded.

I wrote about this problem to technical support with detailed explanation of what I see. They were keen to resolve login issues which I didn’t have. I explained what was my problem once more, and I have never heard from them again.

Now the stats has become completely broken. The question marks can’t be decoded to anything useful.

Could this problem be fixed, please?

Thank you,

However I have no hope…

A user shared a link to the earlier discussion: BUG: Stats page not displaying correct Big-5 fonts (Traditional Chinese). It describes the same issue I blogged at Mojibake at Flickr. There was also a possible fix suggested. Yet no action has been taken by Flickr devs. They’re too busy creating new UI for viewing photos… Who cares if an old (paid) feature is broken?! Anyway everyone speaks English.

I’ll wait a little… And next week I’ll contact technical support.

Print modified/added files

When working with source control systems, sometimes you need to get a list of modified/added files ignoring generated files which are not under source control. You can use this simple awk script:

awk '{ if ($1 != "?") print $2; }'

With Mercurial, the full command looks this way:

hg status | awk '{ if ($1 != "?") print $2; }'

Replace hg with svn if you use Subversion.

Of course, you can redirect the output of the commands to a file.

Backspace character

In December I asked a question: What’s wrong with this code? I agree that the question was rather broad without context. I just asked it in the same way a friend asked me.

Many people noticed '\b' character in the code… Is it good or bad? Well, it depends.

What is '\b' character?

Quote from an answer by T.J. Crowder at Stack Overflow: On most terminals or consoles, '\b' is a nondestructive backspace. It moves the cursor backward, but doesn’t erase what’s there.

Another answer provides a detailed explanation of how the backspace character works.

If you’re interested, see The “backspace” escape character ‘\b’ in C, unexpected behavior? question.

What can be wrong?

As long as the output is written to terminal or console, it does what it’s supposed to do, most of the time at least. But what about capturing the output to a file? Then you’ll see a weird character in the file.

In my opinion, backspace character in that code serves no purpose. Much better way would be just to remove the last space from the buffer:

sb.deleteCharAt(sb.length() - 1);

It is the safest approach and it has no (possible) undesirable effects.

Another issue is if objs is empty, the opening '[' would be removed from the string. I think the assumption here is that objs is never empty which can be enforced by the calling code.



It’s so true :))