Oct. 1st, 2009

microwtf

Oct. 1st, 2009 02:40 pm
juan_gandhi: (Default)
Yeah, right. I love functional style.
boolean needRerendering = needCertainKindOfData && 
                          provideGeodata(coordinates, circumstances) &&
                          provideTextData(coordinates, circumstances);


Shit. The right solution should be

boolean needRerendering = needCertainKindOfData && 
                          (provideGeodata(coordinates, circumstances) |
                           provideTextData(coordinates, circumstances));


And now it does look like an ugly pseudo-functional trick.
juan_gandhi: (Default)
(извините; это, наверное, никому не интересно, пришли, искупались, поели, заснули - так что, наверное, пишу для одного читателя; ну и ладно)

Read more... )
juan_gandhi: (Default)
лежит на столе и отбрасывает тень

foofl varz

Oct. 1st, 2009 04:55 pm
juan_gandhi: (Default)
There's a lot of foofl technologies now widespread and commonly accepted; it seems like there are some still unknown.

Foofl varz.

If you run a foofl server (either c or java version) on internal network, it will serve a nice page called /varz

What it does is just displaying public static values with their names.

I do not know much about how it's done in c (okay, there are stupid macros there; I used it and immediately forgot), but in Java there's a nice class called Varz.

You instantiate it, giving it a name, and register it. So that varz servlet scan all existing varz and displays their values. You can scan them in your code of course; that's how I had implemented varz setter in orkut, so that our qa could reconfigure their qa servers without rebooting - just change a varz (your change will be logged, with your login name), and the code that relies on a varz value will work differently. command line parameters are also stored in varz, by the way.

Now not all varz in Java are the same. Some varz store strings, others store integers or longs or doubles. Some varz are used for statistics. So that you just bump a varz, and, on the page, you can see the frequency, averaged per 10 minutes, per hour, and the like. Extremely useful to count hits, functionality usage, failures, anything. We were actually required, when implementing a new feature, to provide a varz that would show the percentage of its usage.

Then what. Since your server serves a varz, in a uniform way (it can probably serve it as xml as well, I forget), you can configure borgmon to grab varz from a server farm, doing some integration, and voila, you see the graph. The waves of millions of users that discover the new feature and start using it. All due to a pretty simple class.

It is kind of strange that this is not practiced by everyone around the world. People say, we use logs. Right. You have to write elaborate parsers, waste a lot of time and efforts, to see something from yesterday. With varz, you see stuff right away, as it develops. Security team can immediately see a suspicious behavior - when one of the varzs suddenly peaks. Or a bug. :)
juan_gandhi: (Default)
[livejournal.com profile] spamsink сообщил, что его научная работа завершилась успехом. В юникод добавили десятичную десятку и букву ПЦ.

Поздравим же его и [livejournal.com profile] lleo - наших Кирилла и Мефодия!
juan_gandhi: (Default)
1. Умный и Глупый

Один умный человеу увидел, как глупый человек делает глупые вещи, и говорит ему:
- Зачем ты так делаешь? Делай как я скажу!
- Нет, - ответил ему глупый, - я, хоть, может, и глупо делаю, но я делают то, что хочу, а если буду делать то, что ты прикажешь, то получится не то. что я хочу. Даже если это мне и на пользу.

2. Умный и Глупый

Один умный человек вздумал сделать глупость. Глупый человек увидел это, и стал смеяться.
- Послушай, глупый человек, - говорит умный, - самая глупая вещь, которую я могу сделать, примерно в 12 раз умнее самой умной вещи, которую можешь сделать ты.

3. Умный и Глупый

Один умный человек увидел однажды, как глупый человек делает глупую вещь. И промолчал.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

August 2025

S M T W T F S
      12
3456789
10 11 12 13141516
171819 20212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 23rd, 2025 12:42 am
Powered by Dreamwidth Studios