Thursday, March 8, 2012

Github SSH Key Audit

I got a mail recently from Github stating that a security vulnerability was recently discovered that made it possible for an attacker to add new SSH keys to arbitrary GitHub user accounts.

I had to approve all my SSH keys at https://github.com/settings/ssh/audit, all cloning/pulling/pushing actions were prohibited through SSH until then. So if you have any problems just follow the link above and enable all your keys again.

The security hole was identified when someone tried to add his SSH keys to the Rails organization, you can read the full story in the official Github forum.

Wednesday, March 7, 2012

Current plugin compilation

I almost reached the end of my laptop's screen :-) I'm curios if new ones are started in a second line. I hope so ;-)



How many of them can you recognize? :-)

Liferay IDE: Cannot remove plugins SDK?

Having problems with removing an installed plugins SDK set up a long time ago? Try updating your Liferay IDE. I tried to remove a 6.0.5 SDK installation I added a while ago with Liferay IDE 1.1, and I wasn't able to remove it for an unknown reason.

There were no notable error messages or exceptions under .metadata/log, I was even able to click on the Remove button - it simple didn't work.

After updating to the most recent Liferay IDE (1.5.2) however, another mystery solved.

Sunday, March 4, 2012

Setting the Default RNG Seed in R

How to set the default seed for the RNG behind the runif(), sample() and other command? Well, there are several ways doing that (like setting .Random.seed directly), but as the documentation states, set.seed() is the recommended way to specify seeds.




> ?set.seed
> set.seed(0)
> runif(1,0,1)
[1] 0.8966972
> set.seed(0)
> runif(1,0,1)
[1] 0.8966972

> set.seed(0)
> sample(1:10, 10)
[1] 9 3 10 5 6 2 4 8 7 1
> sample(1:10, 10)
[1] 1 2 9 5 3 4 8 6 7 10
> set.seed(0)
> sample(1:10, 10)
[1] 9 3 10 5 6 2 4 8 7 1
> sample(1:10, 10)
[1] 1 2 9 5 3 4 8 6 7 10


BTW runif() stands for random uniform, not a "run if..." branching expression. Tricky naming conventions ;-)

Further reading




  • David Smith's blog post at Revolution Analytics

  • > ?set.seed

  • > ?runif

  • > ?sample

Sunday, February 26, 2012

Challenge24 - 2012

I participated for the first time at the Challenge24 contest, http://ch24.org/.

Basically, teams of 3 members may register for the on-line contest, first 30 teams make it to the final.

It was quite a nice experience, the problems we had to solve were extremely challenging (guess that's where the name comes from, heh)! If you're interested, I put up my work to github with all the contest materials, you can find them here:

https://github.com/rlegendi/challenge24-2012

In the final rankings we got a 99th place - below 100 at least :-) -, but taking into account that there were about 399 registered teams (there were only 228 EC Ready) I believe that's a fair result. Especially when you take into account that this was my first try, and most of the teams are veterans ;-) All in all, we got the 15th place among the ~80 Hungarian teams.

There were a few lessons I learned, and I thougth it might be useful for others in the future:

- Do not try to solve any task by hand. There's always a trick in the background (we tried to submit the number of triangles by hand in the first 2 minutes, but of course, there was a trick involved, so we earned a nice -5 points just after the contest started).
- Sometimes bruteforcing works, sometimes doesn't. If you can prototype the solution quickly, try it out as soon as possible. For the Triangles a simple pixel-by comparison worked, but for the Mines, we had to wait ~20m minutes for the first
- Fast prototyping is the key, so I guess scripting languages like Python or Ruby have a slight advantage.
- You need a rock-solid knowledge of the required tools (SCM, programming language, additional libraries). Searching the API and man pages constantly roughly speaking is a waste of time.
- It's esssential to choose a feature rich 3rd party library for handling different graphs, and maybe some compiler generators (like JavaCC or AntLR). The key is fast prototyping again.
- I believe it is a good idea to solve previous contests as a preparation, they are available to download from the ch24.org website. Obviously, I skipped this part because my friends notified me about the contest one day before ;-)

Anyway, thanks for the great contest for the organizers! It was a really nice experience, keep up the good work! I saw professionals may also register for the contest, so I hope I will be able to participate next year too - well, if I finish my PhD for that time, of course ;-) If I have a bit of time (which I lack in general), I'll try to solve the other problems as well.

Monday, December 19, 2011

Java 7: What is new and noteworthy?

Java 7 is here! Well, to be honest it was here a few months ago, but it required a bit of workarounds to use it in production code (especially under Eclipse, you had to use the nightly builds to access the beta support).

Now, the Eclipse Java 7 support is no longer in beta phase: it has been integrated into the existing streams! Hurray!

A set of small enhancements was introduced thanks to Project Coin, check out the list of new Eclipse features.

You can get an overview of the new language features in the Java 7 adoption guide.

If you are interested in details, here are the set of new features collected from the Java tutorial:

- Now we can use Strings in Switch statement. Well, that's a bit strange because we shift from strictly verifiable constants to objects with equals(), but we'll see.
- "Simplified" vararg invocation. I found a reference to this bug entry.
- We have binary literals:

// The number 26, in binary
int binVal = 0b11010;

- We can use underscores in numeric literals. Ah, at last! Perl had this sugar ~20 years ago.

int million = 1_000_000;

- The try-with-resources Statement [Guide] [Tutorial]
- Catching Multiple Exception Types and Rethrowing Exceptions with Improved Type Checking [Tutorial]
- Type Inference and Instantiation with Diamond [Guide] [Tutorial]
- A new NIO.2 implementation.
- Sockets Direct Protocol (SDP), that is said to provide access to high performance network connections.
- Another interesting thing I found while I was browsing the updated tutorials. Swing has a new component called JLayer, and at last we got an embedded YouTube video tutorial!

Anything I missed?

Sunday, December 18, 2011

Comments

This post is about some comments I ocassionally find in my old code. Hope I can update them once in a while :-))

AccessFlags.java, 2005

// DON'T WORRY, I'LL FINISH IT :-)