Archive for October, 2006

You are now browsing the archive for October in 2006.

Dream #12: I, Starcraft AI

I and a friend, Kragnir, started playing the Starcraft campaign in virtual-realtiy. After some maps, we moved to la large house. We lived on the 200:th level, After Kragnir had collected the money that three people owed him (about 20 Swedish Kronor each), we continued playing. After some time, we realised that we were just computers, the Starcraft AI.

This is when I woke up by my alarm clock. The first thing I did before I really woke up was to check for a laptop under my pillow and press F10.

Happy Spam

I just got this email from “nitaigouranga@aol.com”:

Call out Gouranga be happy
Gouranga Gouranga Gouranga!
That which brings the highest happiness

I actually made me feel happier. Is this a collaborative movement from spammers all over the world to make the attitude towards spamming more positive?

Dream #11: Aki Sings Sonata Arctica

My two years younger brother, Aki, was going to hold a speech for my entire class. He quoted a Sonata Arctica song, but forgot what he was doing and started to sing.

Haiku #30: Cosy Feeling

That cosy feeling.
The open source. Open love.
It’s my revision.

I just contributed to an open source project for my first time, which means that I’m now officially a good person. It was WordPress that took my virginity, with bug #3282. Ok, I’m not the one who attached the patch — but I submitted the ticket, and I was trying to figure out how svn worked when a certain Mark Jaquith beat me to it.

Anyway, I suppose I learnt something. How svn works, that is. Oh, not to forget that a bug was fixed. Thanks to me! This made my day. Unfortunately it’s less than two hours left of it.

HBH Logical 6: Space Rock

Logical challenge #6 in Hellbound Hackers is called “Space Rock”:

Suppose you are working for the science department and the NASA brought you a rock from space and before you are supposed to do anything with it you need to get the volume. But in your office you only have a pencil, a ruler and a glass of water and of course the rock. Using only those things, how can you get a close estimate of the volume of the rock?

This is such a classic puzzle that everyone should know it. Especially those who are in fourth grade or higher. The principle to be used is called “Archimedes Principle”, named after a Greek intelligent guy called Archimedes. He laid down in his bathtub, when he noticed the water around him rising. Get it yet?

Do the following, assuming that the rock fits into the glass, the glass is a cylinder and the water won’t flow over:

  1. Mark the water level on the glass with the pencil.
  2. Put the rock in the glass.
  3. Measure the difference between the new water level and the old one.
  4. Measure the radius of the glass.
  5. Calculate the volume of the rock: r2*pi*dh where r is the radius of the glass, pi is about 3.14 and dh is the change in the water level.

I’m just wondering why NASA don’t have better equpiment, why they give the stone to some office guy and WHY they allow him to wet it.

Determination of the Empirical Formula of Copper Sulfide

Introduction

The aim of this experiment is to determine the empirical formula of copper sulfide, which is formed when copper and sulfur are heated together. The independent variables are the amount of copper and sulfur, but they will not be varied. The dependent variable is the amount of copper sulfide formed. The controlled variables were among other the size of the beaker and the temperature that the experiment was conducted in.

Materials and Methods

Materials used:

  • Copper (Cu)
  • Sulfur (S)
  • Bunsen burner
  • Clay triangle
  • Crucible
  • Crucible tong
  • Scale
  • Spoon

First, the copper was weighed on the scale. The copper was then heated together with the sulfur over the Bunsen burner, after which the newly formed copper sulfide was weighed.

Results

First, the Cu was weighed on the scale. Its weight can be found in Table 1: Measured Values.

Table 1: Measured Values
Substance Weight [g]
Copper (Cu) 0.49
Copper sulfide 0.62
Sulfur (S) 0.13

The weight of the substance was measured after the reaction had occurred. The substance, which probably was copper sulfide, weighed 62 g. Because there was initially 49 g of Cu, there must be 13 g of S.

We will use the following formula to calculate the amounts of the mentioned substances in moles:

n = m / M

Where n is the amount of substance in moles, m is the mass of the substance, and M is the molar mass of it. The values of molar mass are according the elements’ respective Wikipedia articles.

Table 2: Calculations
Substance m (mass) [g] M (molar mass) [gmol-1] n (mass) [mol]
Copper (Cu) 0.49 63.546 0.0077
Sulfur (S) 0.13 32.065 0.0041

Conclusion

The amount of copper, 0.0077 mol, is approximately double the amount of sulfur, 0.0041 mol. From this, we can conclude that the amount of copper in copper sulfide is twice as large as the amount of sulfur. This means that the empirical formula of copper sulfide is
Cu2S.

Since the amount of sulfur was not exactly half the amount of copper, we had an error somewhere. Probably, not all sulfur reacted with the copper and left some pure sulfur.

Evaluation

The method for making the copper and sulfur react is flawed, because it is not given that all sulfur will react. This is difficult to improve in a standard lab, though.

Another flaw is that the experiment was only conducted once, which means that errors are difficult to spot. We should have performed it at least thrice.

Haiku #29: Protoss Carriers

Stargate, Fleet Beacon
Build, select and attack-move
Protoss. Imbalanced.

Really. Not even an army of Scourge stand a chance against massed Protoss Carriers.

WordPress Plugin: Hello Anyone

Hello Anyone is a variant of Matt Mullenweg’s Hello Dolly WordPress plugin. Hello Anyone allows you to choose any lines to be randomly displayed on every page in your Admin panel. You can easily manage the lines and the CSS.

Screenshot with example from WordPress Plugin: Hello Anyone
Screenshot with options page from WordPress Plugin: Hello Anyone

Download and Install

  • Download Hello Anyone 1.0.
  • Unzip the file and then upload it to your plugin directory (/wp-content/plugins/) and activate it under the “Plugins” tab.
  • Go to “Hello Anyone” under the “Options” tab and start adding lines!

Changelog

  • 2006-10-21, version 1.0:

    • Initial release

HBH Logical 5: 3 Fuses

Hellbound Hackers’ fifth logical challenge is called “3 fuses”.

After a hurricane, you notice that your lights will not turn on… The switches wont work so you go down to the basement to check the fuse box. You notice that 3 fuses are off. If you can only take one trip upstairs to check if the fuse you selected worked, how do you determine whether fuse a, b, or c is the right fuse to turn on your lights?

This one really requires some thinking outside of the box. Pretty much anyone can deduce that it is impossible to solve this puzzle by only turning on one fuse (unless that’s the working one).

I find it very difficult to give any sort of clues to this kind of problem, and therefore the solution will be a bit straight-forward.

You must first turn one fuse on for a while. After this, switch it off and turn another one on. Now, go up the stairs. If the lights are on, the fuse that is switched on is the right one. If not, touch the lights. If they are warm, it was the first switch, because the lights were heated up. In the case that they are cold, the last fuse, which you didn’t touch, was the correct one.

Bug in Matt Mullenweg’s “Hello Dolly”

I was looking through the source code of Matt Mullenweg’s WordPress plugin, Hello Dolly, which is shipped with the latest WordPress releases. It contains a minor bug on line 44:

$chosen = wptexturize( $lyrics[ mt_rand(0, count($lyrics) ) ] );

The range in the mt_rand() is too large. Suppose there is only one line, then mt_rand()’s range will be 0 to 1 — that’s one too much, since only element 0 exists. When this bug occurs, no text will be displayed. The risk for it to occur in the standard Hello Dolly plugin is 1 in 29, which is the number of lines plus one (the 0).

The bug could be fixed easily by changing count($lyrics) to count($lyrics) - 1.

Earlier Posts »
FireStats iconAnvänder FireStats