Tuesday, December 29, 2009

mutex

I got an email offer to attend a web seminar ("webinar" :-& ) by some company selling Real-Time Operating Systems. A RTOS is an operating system that, unlike usual PC operating systems, can guarantee that some task will be performed before some future moment, if properly used. The guys were charging $39 for the exquisite privilege of attending their online seminar about mutexes and semaphores. Not any seminar about mutexes and semaphores, but an introductory seminar on mutexes and semaphores. Mutexes and semaphores are used so that two programs don't work on the same data at the same time, in order to avoid corrupting said data. Here's an introduction to mutexes and semaphores. Enjoy.
P.S. Some time ago a colleague was asked by a professor what "methods" does a semaphore have ("P" and "V"). "And which one of them increments the semaphore?" Dude, how the fuck should I know, I don't speak Dutch and I don't care for Verhogen! Can't you just call them increment and decrement or up and down like normal people?

Tuesday, October 27, 2009

ads

I was browsing the Web for Information. There it was, the front page. An annoyingly blinking red-on-green banner was announcing that I am the 999999th visitor and it was congratulating me. I would've smiled if it weren't blinking red-green/green-red. Of course I couldn't have been the 1e6-1th visitor because (a) that's too improbable and (b) that site claims to have one million visitors, yeah right! So I scroll down, trying to ignore the ad, and I see this other banner, a vertical one this time. This one is blinking red/blue. It's saying that I'm the 10000th visitor, but this time, "this is no joke!". This time I laugh. At least this number was plausible, visitor-count-wise. Of course it would've been much cooler to be the 999999th visitor because (a) the number is almost 100 times bigger and (b) it's not one million, it's one million minus one (that's being creative!). But sadly, the lesser number was more probable, and besides, that wasn't a joke. Deciding that I had to settle for ten thousand, I scroll down and laugh again when another red-green/green-red banner (this time neither horizontal nor vertical, but squareish) informs me that I'm the 999999th visitor after all! OK, now I'm confused.
I fire up a new browser but this time under the guest user so that my files would stand a lesser chance of being trashed by malware. Wow, now I'm suddenly the 12796869939th visitor! That site must have a lot of traffic, given that I was at most the 999999th about 10 minutes ago. The "this is no joke" banner disagrees by a much smaller percentage this time, indicating 12769870797. The square one says 12796871217, but there's a twist: I'm the 12796bla-blath visitor to see "this lucky banner", so maybe there are other sites showing the same banner and there goes my "not enough visitors visiting this crap" argument down the toilet. The small difference could even be explained by the different times my browser queried the ad server for the three banners while loading the crap. [must be a very big server.] I hit Refresh and lo and behold, I'm either the 999999th or the 10000th visitor again. This clearly can't be, because I already visited the site before as both the 999999th and the 10000th, under a different identity.

So I hold my breath and click the first banner.

It asks for my name, address, and e-mail address. There you go. Move along, nothing to see here, and quit clicking stupid adverts and quit encouraging spammers by opening their e-mails and clicking on their links and buying their cockpills, because if you encourage spammers and spammers send me spam, then you're indirectly to blame. The fuck!

Friday, September 18, 2009

taxi

I was in a cab one night and I glanced over the driver's dashboard, where the display was showing the total distance the car had traveled. It was about 170 Mm. I suddenly realized that such a distance is similar (of the same order of magnitude) to the distance to the Moon, or to one light-second (approx. 300 Mm). To realize that, during the course of a few years, a car can travel one light-something, where that something fits on the usual human timescale, is wonderfully mind-warping.

Tuesday, May 26, 2009

math

(fourth grade) Math Problem:

A mother is 25 years older than her son.
In 7 years, the mother will be 5 times older than her son.


Where is the son's father?










































Answer:

Let the child's age be c years and the mother's age be m years.
Now, m = c + 25.
In 7 years, m + 7 = 5 * (c + 7).
Substituting the first equation into the second one, we get
c + 32 = 5c + 35, from which 4c = -3, or c = -0.75.

So the child is minus nine months old, therefore the father is most probably in the mother.

Saturday, May 23, 2009

sex

After vast experimentation, we found the optimal parameters for sex:
* frequency: low, around 0.8 Hz
* amplitude: as large as possible (e.g. 15 cm)
* waveshape: approximately square wave
* duty cycle: cca. 80%
Something like this:

Monday, May 18, 2009

brideparade

I came home this morning looking forward to a good sleep, only to see the news: there's been a "Brides' Parade" in Bucharest! Now I can't really understand how I missed that, given that I crossed about half the city... maybe it was because we were busy spending meaningful time together instead of dressing up and parading... maybe it was because I was too drunk... I don't know. The Brides' Parade featured "past, present and future brides" (basically any woman would qualify) in wedding dresses parading on some street, possibly in a 1900s car. I hate it when "historical cars" run on the road, they're ugly, obsolete and environmentally unfriendly (mwahahaha). But I digress. The fun part was watching a relatively young girl in a wedding dress being interviewed by some reporter: "So, are you married?" "No, no :)" "Are you getting married today?" "No, no! :) No guy will take me! :) Heeeey! Guuuys! Take me! Take me!!!! I'm [fucking] yours!!!!! Take me!!" Yeah. Yeah. Ok. Great for you.
Parade. Feel fine. Waste time. Feel good. Exhibit yourselves. Feel nice. Display your young, succulent flesh on the counter. Feel great. Spend. Feel wonderful. Burn, age, wither away,... death of the soul, indoctrinated in false grace. Be happy.

One six six! The number of the bitch!
One four four! The number of the whore!

Friday, April 24, 2009

bits

I've had to learn the hard way that whenever you're taking a business trip (or a leisure trip for that matter) there are certain essentials that you have to bring with you, such as your towel. While having a laptop with your familiar environment and your favorite tools and music can make your life easier, it's not absolutely essential, given that you probably have an Internet-accessible box at home or at work. What is essential is a quick, straightforward way to get the job done. You need to be able to link your bits with their bits and measures. A simple way to patch your technological know-how into their system. Thanks to Microsoft et al deprecating "legacy" serial and parallel ports, now there isn't any simple, immediate way to interface stuff directly to a PC-class computer. You usually interface stuff directly to a microcontroller-class computer, but even that needs to be PC-linked to be programmed. So even if you're certain that you can find all the needed parts on-site, you still must always bring your own USB AVR programmer.

Tuesday, April 7, 2009

please

I see more and more people embedding phrases such as "Please consider the environment before printing this email." near the end of their e-mails. I can only agree: please consider the environment before printing anything. For instance: energy/cut trees/oil/whatever needed for printing the document versus energy spent by you turning on your laptop to read the document while traveling (by train, of course). Stuff spent for printing and reading by daylight (or by incandescent light (inefficient) or econo-bulb (mercury-containing)) versus reading on LCD (or CRT) monitor, in darkness or in lit room. Think before you (don't) print. If I could be bothered to dig up the data, I'm sure I could find at least 8 cases in which it would be more "environmentally responsible" to actually print the fucking paper. I saw a documentary about loggers recently. Their company administers a huge area of forests, cutting down old trees and planting new ones instead, continuously. They claimed that younger trees absorb more CO_2 than old trees, therefore they're actually helping the environment. So there, when you're feeling lonely and depressed and nobody likes you because you're an environazi drone, go print a nice flower or something.

Wednesday, April 1, 2009

foolcoffee doubleclock

I had a Digital Computers course where we had these logic design and implementation lab classes. We had to implement various modules in Verilog and run them in a low-end FPGA. But during the first lab we weren't yet familiar with Verilog, so we were supposed to enter a digital schematic graphically. The schematic was designed the hardcore, old-school way, by building a state machine on paper, assigning bits to states, writing equations, translating them to flip-flops and gates et cetera. The state machine was for a (famous with past and current students at our faculty) "coke vending machine". It never worked as supposed and I suspect (being too lazy to prove though) that the equations suggested in the lab documentation were wrong. Years have gone by and, while having a break in the faculty hallway, I found that maybe one of our graduates, now employed at a vending machine company, has finally got it working:

Sunday, March 29, 2009

vi

vi in an ancient text editor present on Unix-like operating systems, known for its two modes: a normal mode where letters and numbers mean commands such as move one word to the left, delete 3 lines et cetera, and an insert mode where chars are inserted into the text. Normal chars can also be deleted with backspace, but somehow \n (newline) can't. If you accidentally press q in the middle of the line, you can press Backspace and undo that. If you accidentally press Enter in the middle of the line, or for some reason you want to join two lines, you hit Esc to exit insert mode, then Shift-j to Join the lines, then i to enter insert mode again. That's wonderful ain't it? Now, on large computers people can use whatever editor they want if they hate vi. But on small embedded systems such as home routers and set-top boxes, vi seems to be preferred (due to its inclusion in the BusyBox userland, which is probably due to it being part of the UNIX standard), and even though there are ways to install other software, it takes time which I may not want to waste. Therefore - fuck vi, vi sucks.

copyright

Came up with this while drinking with other computer engineers. Steps to become a rich lardass:
1. Write computer malware (virus, internet worm, whatever, can be mostly harmless)
2. Let it spread
3. Go public
4. Spend zero to 6 months in jail or do community service or pay a small fine or something
5. Sue antivirus companies for copyright infringement because of your virus signature that they include in their product which they distribute without your written permission
6. Collect $5 per antivirus copy/update distributed

Then, foreach virus_writer joe in earth.people {the above}
And suddenly you can't have antiviruses anymore. Dude, sick, what the fuck.

urth our

This evening was Earth Hour again. Earth Hour is a rotating, evening-following event lasting approx. one local hour and 24 global hours. People are supposed to turn off their lights as a message towards wasting less energy. Instead, they gather and light candles, which as some including myself point out, is actually very energy-inefficient. Early news reports show people gathering under slogans such as "screw current events" (ro: nu fi la curent), obviously referring to electrical current, and lighting tons of candles. This is incredibly stupid. Electricity is one of the cleanest means to transport energy, and is readily obtained from solar radiation, wind et cetera. Candles release toxic gases into the atmosphere and some are actually made from fossil fuels (paraffin wax). Their luminous efficiency is shit, compared to even the most inefficient incandescent light bulbs and electrical power plants. Way to go dudes, way to go. Now it's actually cool and eco to burn oil derivatives, at least as long as it's diesel which doesn't need electric sparks, because, you know, electricity is satanic and stuff mwahahah \m/.
As a response to critics, the World Wildlife Fund (who came up with Earth Hour) said it's purpose is not to save energy or money, but symbolic. LOL!
Therefore I say: the purpose of hunting is not to kill animals and endanger more species, but symbolic. It's also fun. Not that I endorse it, but I can certainly see how some people find hunting challenging, rewarding, fun. Coincidentally, about 1 hour ago I saw a documentary claiming that the guy whose killing started World War One was a prolific hunter who used to travel the Austrohungarian Empire by train shooting every animal in sight. He supposedly killed about 300 k before being shot to death himself.
Sometimes I just get tired of ranting. Sometimes I just accept the fact that I live in a defective world full of defective people, including myself. For instance, if astronauts can phrase their speeches in such defective ways as to suggest that space smells, what the fuck can I expect from normal people? Please spare me the "it's metaphoric, dude!" explanation -- many people actually don't know that void can't carry sound or smell and many people couldn't care less, sadly. Wordings like "space smells of ozone" and "a whiff of vacuum" do nothing to help that.
After all, why the hell do I expect stuff from astronauts. Astronauts are more like soldiers than like scientists. They get too much hype anyway: Dood, let's off the lights and light them candles and watch the space shuttel land and celebrate urth our!!
Whatever makes you happy, people.

Tuesday, March 24, 2009

work

Today I extended my "to do" note window 64 pixels downwards in order to prevent scrolling the "to do" list. It can grow 448 more pixels before reaching screen height. Depending on whether the speed at which the tasks are executed is influenced by the length of the "to do" list, or by the entries' age, the screen is predicted to fill up somewhere around September or October. I guess there is little or no influence, so I better plan on buying a higher resolution display. Put that on the "to do" list.

Wednesday, February 4, 2009

lemons

Embedded Systems exam at the Bucharest Polytechnic.
"A lemon battery can supply an average of 0.1mA at 1V for about an hour.
1. How many lemon batteries are needed to run a 100W light bulb?
2. How many instructions can an ATmega128L execute while running from a lemon battery? Assume that an ATmega128L uses an average of 4nJ to execute an instruction."
At the students' request, further (obvious) assumptions were specified:
a) To simplify, assume that the lemon has an ideal U-I characteristic (it can deliver anything up to 0.1mA at 1V).
b) It also has an ideal U-t characteristic (at 0.1mA, it holds 1V for one hour then suddenly drops to zero).
c) Assume there is an ideal DC-DC converter between the lemon and the ATmega128L, providing it with the required voltage.
After thinking about it, and after remembering the jokes about ideal spherical lemons in vacuum, I decided that additionally, the ATmega128L's clock frequency should be set such that it draws exactly 0.1mA from the 1V lemon supply, or that it should enter very low power sleep modes as needed.
Answers:
1. 100W/(1V*0.1mA) == one fucking million (whoa)
2. 1V*0.1mA*3600s/4nJ == 90 fucking million (yeah).
Required frequency for ATmega128L to complete 90Minstr in 3600s:
f = 90M/3600s = 25kHz.
Current drawn by ATmega128L at 2.7V (minimum operating voltage) in order to assure 0.1mA from lemon, given ideal converter: 0.1mA*1V/2.7V = 37uA.
Typical current drawn by real ATmega128L at 2.7V at 25kHz, extrapolated from datasheet graph: 50uA (pretty close actually).
So there you go: light a bulb long enough to take a shit, or execute 10 trillion 8-bit computer instructions. Meanwhile, a high-end "PC" processor would do maybe 4 trillion 64-bit instructions, making it better than the microcontrollers, but not that much better. Moral of story: do something useful -- turn off lights, run computers (*).