# Blogs

## Getting a Proper Random Number on a Computer

99.9% of the time, I see people using random number generator in their software.

Say you have a random function **b()** that generates random bits. Each time you call **b()**, you either get 0 or 1.

Now, in most cases people are going to get a larger number, say you write a function **r()** which returns 8 such bits. You could write it like this:

int r() { return (b() << 7) | (b() << 6) | (b() << 5) | (b() << 4) | (b() << 3) | (b() << 2) | (b() << 1) | (b() << 0); }

Assuming you have a ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## Some Math

The mean of a set of values [math](x_1, x_2, ..., x_n)[/math] is often represented by [math]\overline{x}[/math]. The calculation of the mean is:

[display]\overline{x} = \mu = {\sum_{i=1}^n x_i \over n}[/display]

The mean may make use of weights (p):

[display]\overline{x} = \mu = {\sum_{i=1}^n x_i p_i \over \sum_{i=1}^n p_i}[/display]

You may want to normalize your weights, which means that their sum will equal 1, with the following:

[display]w_i = {p_i \over {\sum_{j=1}^n p_j}}[/display]

With normalized weights, you can simplify with the following:

[display]\overline{x} = \mu = ...

- Admin's blog
- Login to post comments
- Read more

## Very Difficult Game of Shinsen-Sho

I like a game of Shisen-Sho once in a while. Usually, it's pretty easy. I may have to try 2 or 3 times, but I finish those games fast.

This one, though, it was way harder and it took me many tries before succeeding. But it worked. After a while and many attempts, I finally resolved it.

Unfortunately, the game does not allow us to save the game, I'm wondering whether the author would be willing to offer such an option at some point. I guess I have to post an issue asking such if it's not already available in the latest version.

There is the game as a screenshot (Click to ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## Solve a in a power n equal b

Finding the value of **a** in equation (1):

a^{n} = b |
(1) |

can be resolved using logarithms.

First, transform equation (1) to equation (2):

ln(a^{n}) = ln(b) |
(2) |

Now we can easily extract the power (n) by changing it into a multiplication:

n × ln(a) = ln(b) | (3) |

From equation (3), we know what the logarithm of a is equal to:

(4) |

Finally, we can write an equation as a = *something*.

... |

- Alexis Wilke's blog
- Login to post comments
- Read more

## About Radon Gas

I learned about Radon gas as I'm now working in Real Estate at Diverse Realty.

The gas reacts quickly and when that happens it emits some radio active energy. If you are close by, you will therefore be radiated.

We have found, over time, that a small amount of radiation is good for us. Not only that, we actually emit radiation ourselves. More than what Radon gas in our homes generates.

Actually, a smoke alarm system makes use of a decaying bit of radio active material. Those rays go in all directions for a long time.We channel a certain amount in two specific tubes, one of which is ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## I visited your website...

Every single day I receive an email that tells me they visited my website. There is the one for today:

*« I recently visited your website and wanted to comment on how nice it looks. »*

What I find really interesting is that I manage something like 20 websites and they NEVER tell me which website has a problem. It's like those telemarketers who call you telling you they can fix your credit credit card and immediately tell you there is nothing wrong with it... (you bet, they are always $0 since otherwise you pay a whooping 27%+ interest, who in their right mind would accept such ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## SMS From Me

SMS From Me is a new service by Made to Order Software Corporation.

This service lets your marketing funnel send SMS from YOUR phone to your prospect.

There are so many services out there that will offer you to send text messages on your behalf... that's scary! But all of them use these 3 to 6 digit numbers that have nothing to do with **YOU**.

What SMS From Me offers is a way to send SMS messages to your prospect directly from YOUR phone. This means it is starting a two way conversation with your leads without any intervention from you until your prospect replies to that first text ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## Create an area that ends with in a triangle

I wanted to create a website header where a background is a large quadrilatere that ends (bottom) with a triangle. So the top is like a rectangle and the two points at the bottom are not at the same level (one is higher than the other, the Y coordinate are different.)

It took me some time on how to do that without using multiple images or multiple divs, etc. And really to make it work cleanly we need an image as a background.

So the image should be large enough for a full screen desktop (crazy big for some these days, mine was big for a while at 1920x1080, now it's a dwarf, right?! ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## Neat CSS3 trick to avoid that "still loading" flash...

Have you noticed how when you hover the mouse over certain buttons, they flash? This is because the button is made of two images. One when you do not hover it and one when you do hover it.

The basic CSS generally makes use of a background with a URL to an image:

.button { background: url(images/button.png) no-repeat 0 0; } .button:hover { background: url(images/button-bright.png) no-repeat 0 0; }

This works great. When you hover you see the bright button. That a really nice effect. Only, the client has to load that button in their browser and most often, there is a flash ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## Where is RAII not going to work?

As I was getting ready to publish a new web application, I noticed some problems, pages marked as being CREATE when I could clearly see that they were marked as NORMAL (ready to be viewed.)

Looking into it closer, this was created by a status not being saved properly. We use Cassandra as our backend and my status was handled in a way similar to:

page->set_status(CREATE); ... [create the page here] ... page->set_status(NORMAL);

The logic is perfect and I could see that the status was set to NORMAL before moving on to creating the next page. However, for some pages, the database ...

- Alexis Wilke's blog
- Login to post comments
- Read more

## Syndicate