пятница, 12 марта 2010 г.

Rubik's Cube Assembly Schema

I made this scheme for easily remember necessary steps to assemble 2x2x2, 3x3x3 and 5x5x5 Rubik's cubes.



Startup


In both cases first you need to assemble one row. It's fairly easy and can be done without schematics. On 3x3x3 cube, this step is sometimes referred to as assembling the cross because middle tiles on second row must match colors with tiles in the first row.

2x2x2


In 2x2x2 cube after assembling one row put other row's pieces to their positions (colors may be not on their positions). This is what's scheme's first row is for.

When it's done, look at the cube from the side opposing to fully assembled one. You should get one of positions from scheme's second or third rows. You may encounter several of those positions until you get the cube assembled.

3x3x3


In order to assemble 3x3x3 cube you need to fist assemble second row, then the top one using instructions from lower part of the scheme one by one.

A note on the steps with a star. After you make a round you may find your cube shuffled again. But do not lose cube's orientation. Put one of pieces marked with hatching to active position (where arrow is shown) and repeat same steps again. Maybe, you'll have to repeat same operation for another hatched piece, but after that your cube will regain it's order.

All operations should be performed in the order they are shown in the scheme. The exception is the last row - it's just a counterclockwise version of preceding row and it's technically not needed to assemble the cube.

5x5x5

Start  by assembling 3x3 centers one opposing pair at a time. Next step is assembling edges. If you end up with three edges with two blocks of the same color an one of another, you can assemble all three of them in one move. If you end up with two such edges, use the combination from the picture.

When all centers and edges are assembled use 3x3x3 moves to complete assembly.

четверг, 21 января 2010 г.

vimrc on Windows

In order to save your (g)vim settings under windows do the following:


  1. Set up environment of your choice in gvim.

  2. Issue a :mkvimrc command.

  3. Put the _vimrc file created to the folder c:\Users\YourUserName (or wherever your %HOME% points).

вторник, 27 октября 2009 г.

Dark Visual Studio color scheme

I like dark environment while programming in Visual Studio. Here is how my dark visual studio theme looks like.

Dark Visual Studio color scheme: Solitude

вторник, 11 сентября 2007 г.

Javascript performance nuances

We usually have some vague understanding of performance costs of this and that but just no time to measure them. Here are results of some javascript tests concerning performance. Test were performed on firefox 2.0.6.



Post-increment vs. pre-increment



I was taught on books that payed much (to much as for today's reality) attention to performance. One of the tricks to boost performance was using pre increment instead post increment wherever possible. The reason for this is that post version not only increments but also yields a temporary object, so the rule is the heavier the type you are working with the bigger is penalty of i++ vs. ++i.



In javascript the difference between pre and post versions of int are negligeable. I run a 10 million iterations loop
for(var i=0; i<10000000; ++i);
and
for(var i=0; i<10000000; i++);
Something interesting for me was that the former outperformed the later by only 300 milliseconds while the execution lasted about 2 seconds.



Javascript function call



Another test was the cost of function call. I've compared a time it takes to make a million of and of x = i and x = assign(i) where assign = function(i) {return i}. The result was the function version was five times slower! So you have to have a cause for using a function



Dot and braces accessors



What is a cost of using classes and arrays? Is there any? Whell there is no difference between a['x'] and a.x in terms of performance. But these are 20% slower then using a variable directly.



Regards,
Andrew