Fixing tootlip background color in Eclipse

The problem

Under Ubuntu the Eclipse tooltip (the one that shows up when you hover over a function or variables) has an anoying black background color. This is due to the fact that Eclipse takes the default background color from the system colors and in Ubuntu the tooltips are white on black.

The solution

As pointed out here there are 2 possible solutions:

  1. Tweaking Ubuntu. This isn’t as easy as you’d think! A good explantion can be found here.
  2. Fixing the color in Eclipse. This is the method I prefer:
    1. Open the window > preferences dialog.
    2. Goto C/C++ > Editor or Java > Editor settings.
    3. In the listbox titled Appearance color options
      1. Select Source hover background
      2. Unselect System default
      3. Choose the color you like, e.g. #f5f5c5
    4. Close the dialog.
Posted in Programming, System Administration | Tagged , , , , , | Leave a comment

Restore a file from SVN repository

Suppose you have removed a file from SVN and want to restore it. Should be easy, and it actually is as CRG points out here. I rewrite his method in case it disappears.
Continue reading

Posted in Programming, System Administration | Tagged , , | Leave a comment

Exponential slider

The problem

At work I was confronted with a “simple” problem: I have a slider to select values from 0 to 5000 (actually the slider is used to set the the diameter of a circle in meters). If I use the slider as is I can only set values with a fixed interval, for example 0, 100, 200, 300, etc. However I want to be able to set small sizes with high accuracy, thus I would like the scale to go like 0,1, 2, 4, 7, 11,16, 23, etc.
Continue reading

Posted in Programming | Tagged , , , | 9 Comments

Facebook Hacking Cup – Round 2 – Scott’s New Trick – Solution

Preparation

This problem needs some module arithmetic concepts before we can give a solution.
Continue reading

Posted in Programming | Tagged , , , , | 2 Comments

Facebook Hacking Cup – Round 2 – Scott’s New Trick

Description

Little Scott recently learned how to perform arithmetic operations modulo some prime number P. As a training set he picked two sequences a of length N and b of length M, generated in the following way:
Continue reading

Posted in Programming | Tagged , , , | Leave a comment

Facebook Hacking Cup – Round 1B – Slot Machine Hacker – Solution

The problem is actually so simple that a brute force approach is possible:
Continue reading

Posted in Programming | Tagged , , , | Leave a comment

Facebook Hacking Cup – Round 1B – Slot Machine Hacker

Description

You recently befriended a guy who writes software for slot machines. After hanging out with him a bit, you notice that he has a penchant for showing off his knowledge of how the slot machines work. Eventually you get him to describe for you in precise detail the algorithm used on a particular brand of machine. The algorithm is as follows: Continue reading

Posted in Programming | Tagged , , | Leave a comment

Facebook Hacking Cup – Round 1A – Turn on the Lights – Solution 1

The problem can be solved using linear algebra. However there’s also a brute force method which is usable for a board with a maximum of 18 columns. Here I’ll describe the brute force approach. Continue reading

Posted in Programming | Tagged , , , | 1 Comment

Facebook Hacking Cup – Round 1A – Turn on the Lights

(for the solution see here)

Description

A simple game consists of a grid of RxC buttons. Each button will be either lighted, or unlighted. Whenever you push a button, the state of that button, and its (up to) four neighbors will toggle — lighted buttons will become unlighted and unlighted buttons will become lighted. Note that the neighbors do not ‘wrap’ and thus a corner button has only two neighbors, while an edge buttons has three.
Continue reading

Posted in Programming | Tagged , , | Leave a comment

Facebook Hacking Cup – Round 1A – Wine Tasting – Solution

Acknowledgements

So this problem seems suite simple. After some thinking I came up with the idea that C(n,k)*(n-k-1)! would give me the number of combinations with exactly k correct wines out of n glasses. Infact C(n,k) is the number of ways in which you can select k wines out of n and (n-k-1)! is the number of ways in which you can re-arrange the remaining wines without getting one right. In fact the firts glass can be chosen from n-k-1 (not n-k because then you could choose the correct one), the next one can be chosen from n-k-2 and so on.
Continue reading

Posted in Programming | Tagged , , , , | Leave a comment