pátek 28. prosince 2012

Which classifiers can deal with XOR

Machine learning scientists generally dislike XOR problem because not all algorithms can deal with it:
Classifier Precision [%]
k-nn 100
Naive-Bayes 50
Classification Tree 100
Random Forest 100
Multi Layer Perceptron 100
Neural Net 100
Logistic Regression 50
SVM 100
Vote (with NB) 50
Bagging (with NB) 100
AdaBoost (with NB) 50
Bayesian Boosting (with NB) 50
Stacking (with NB) 50

úterý 18. prosince 2012

Java in Eclipse

How to find unused functiones use Core downloads - right click on the class and select "Find Unreferenced Members".

To profile Java applications use JVM Monitor.See http://www.jvmmonitor.org/doc/index.html#Getting_started for instructions.

How to make things fast:
  • Pre-compute rather than re-calculate: any loops or repeated calls that contain calculations that have a relatively limited range of inputs, consider making a lookup (array or dictionary) that contains the result of that calculation for all values in the valid range of inputs. Then use a simple lookup inside the algorithm instead.
    Down-sides: if few of the pre-computed values are actually used this may make matters worse, also the lookup may take significant memory.
  • Don't use library methods: most libraries need to be written to operate correctly under a broad range of scenarios, and perform null checks on parameters, etc. By re-implementing a method you may be able to strip out a lot of logic that does not apply in the exact circumstance you are using it.
    Down-sides: writing additional code means more surface area for bugs.
  • Do use library methods: to contradict myself, language libraries get written by people that are a lot smarter than you or me; odds are they did it better and faster. Do not implement it yourself unless you can actually make it faster (i.e.: always measure!)
  • Cheat: in some cases although an exact calculation may exist for your problem, you may not need 'exact', sometimes an approximation may be 'good enough' and a lot faster in the deal. Ask yourself, does it really matter if the answer is out by 1%? 5%? even 10%?
    Down-sides: Well... the answer won't be exact.

pondělí 26. listopadu 2012

čtvrtek 8. listopadu 2012

How to delay or speed up subtitles in VideoLan (VLC) Player

You can press 'H' and 'J' while the video is running to align the subtitles backward and forward in time. The increments are in milliseconds so it can be pretty easily fine tuned.

pátek 12. října 2012

Co se mi na MATLABU nelíbí

MATLAB používám pro takové to denní skriptování. A jsou tam věci, které mne moc netěší. Jmenovitě:
  1. Nelze napsat var++ pro inkrementaci.
  2. Nelze napsat var1=+var2 součet.
  3. Matice se indexují od 1, a nikoliv od 0. Přitom indexování od 0 je praktičtější.
  4. Import textových dat funguje výborně jen pro numerické hodnoty, s mixem numerických a textových atributů jsou problémy.
  5. Pro vytváření matic se používají hranaté závorky [], pro čtení se ale zase kulaté závorky (). Binec.
  6. Když se funkcím předávají parametry, lze snadno ztratit přehled, co je atribut a co je hodnota:
    fun('Horizontal','Center','Vertical','Bottom')
    R to má vyřešené mnohem elegantněji:
    fun(Horizontal=Center, Vertical=Bottom)
  7. IDE neumí tak pěkně našeptávat jako třeba v Eclipse nebo Netbeans.

čtvrtek 4. října 2012

Belbinův test týmových rolí

Na FELu na ČVUT jsme nedávno dělali Belbinův test týmových rolí. A k mému překvapení 90% studentů patřilo do dvou skupin a zbývajících 10% studentů bylo roztroušeno do zbývajících šesti kategorií. A tohle nerovnoměrné rozložení mne zaujalo.


Na FELu se z 90% nacházejí dvě skupiny lidí, Completer-Finisher a Team Worker



Completer-Finisher je puntičkář, který si všechno dělá sám, protože nedůvěřuje ostatním, že odvedou kvalitní práci. Team Worker je zase člověk, který funguje jako lubrikant týmu, neboť jsou skvělými posluchači a diplomaty. Jejich slabinou je ale nerozhodnost.

A podle mého to sedí. Když se učitel ptal, proč jsme na FELu, asi třetina lidí veřejně a dobrovolně řekla, že jsou tam jen kvůli rodičům. Že rodiče si přáli, aby chodili někam na vysokou, a protože je ze školy nevyhodili, tak tam jsou dodnes. Tohle chování nejlépe vystihuje právě kategorie Team Workera. Samozřejmě někteří žáci zase říkali, že je elektrotechnika baví. Zpravidla to říkali lidé, o kterých vím, že když mají za úkol vytvořit regulátor pro motorek, nespokojí se s regulátorem, který funguje, ale ještě k motorku doprogramují metodu, která na něm zahraje Straussův valčík z Vesmírné Odysei. Typický Finisheři.

Ačkoliv mám výhrady k Belbinovu testu, protože výsledky nejsou příliš stabilní - pokaždé, když jsem si dělal test, byl jsem klasifikován jinak, tak kvantitativně vystihl mé spolužáky přesně. Snad i proto lze Belbinův test volně najít na internetu - pro odborníky není dostatečně stabilní, ale vystihuje lidi natolik dobře, že je přesto používán.

sobota 1. září 2012

Kategorie učitelů

Rozlišuji tři kategorie učitelů:

  1. Mateřské typy co učí, protože buďto oni sami jsou neplodní, nebo jejich partner je neplodný. Touhu po vlastních dětech si kompenzují cizími dětmi v nadměrném počtu. Typicky se jedná o ženy. Poznávací znak: když vidí miminko, zněhnou. Zvláštní podkategorií jsou mladé ženy, které po několika málo letech ve školství odcházejí na mateřskou. Poznávací znak: věk pod třicet let, minimální praxe, po mateřské se do školství nevracejí. Další zvláštní podkategorií jsou učitelé, co děti mají, ale nevychovávali je, protože nemohli (alkoholismus,…) a chtějí si to nahradit. Poznávací znak: starší učitelka s pohnutou historií.
  2. Idealisté věří, že nejlepší způsob jak zlepšit svět, je vychovat lepší lidi. A protože převýchova dospělých lidí je mnohem těžší, než dětí, učí děti. Typicky se jedná o muže. Poznávací znak: na svoji pozici jsou překvalifikovaní - mohli by učit na univerzitě, místo toho učí na základce.
  3. Pedofilové vyhledávají děti, a aby k nim měli přístup, učí. V novinách se vždy čas od času objeví, že nějaký vedoucí mládežnické skupiny své svěřence pohlavně zneužíval. Ale člověk se s tím nesetkává jen v novinách - kolega nedávno nadával, že v Praze je jen jeden slušný floorbalový klub, ale vedoucí v něm hráče sexuálně zneužívá, a tak do něj nešel. Školník na střední škole pracoval jako školník, aby mohl sexuálně obtěžovat pozdě příchozí žačky. Mám ti zapsat pozdní příchod, nebo mne dneska navštívíš? Typicky se jedná o muže. Poznávací znak: jsou svobodní.
  4. Neúspěšní spisovatelé, muzikanti, překladatelé. Tento typ učitelů  je zahořklý z profesního neúspěchu a aby se cítili lépe, obklopují se žactvem a demonstrují, jak jsou oproti žactvu dobří. Typicky hrají překvapeného, když ani po hodině tréninku nedáte salto dopředu. Nakonec hodiny předvedou, že ho oni to salto umí, a dají vám najevo, jaké jste nuly a jak vámi pohrdají. Poznávací znak: nemůžou vystát studenty, kteří jsou lepší než oni. A když hrozí, že žáci by si mohli začít myslet, že jeden z žáků je lepší než učitel, učitel se pokusí nějakou podpásovkou dokázat, že ve skutečnosti je to stále učitel, kdo je lepší.
  5. Láska k předmětu může člověka přimět učit, protože chce vidět, jak se předmětu věnují další lidé. Poznávací znak: učitel se věnuje něčemu ne zcela běžnému. Například taková ruční výroba pilníků je obor, kterému se věnuje jen jeden člověk v celé republice. A pokud chce tohle řemeslo předat dál, tak musí učit.

Pokud znáte další kategorie, jmenujte je v komentáři. Děkuji.


Recenze knihy Proč muži neposlouchají a ženy neumí číst v mapách

Z kraje uvedu, že pokud jste četli "Muži jsou z Marsu, ženy z Venuše" od Graye Johna, budete se cítit jak doma. Allan Pease totiž také píše o rozdílech mezi muži a ženami a používá velmi podobné argumenty jako Gray, ale doprovází to jinými historkami. Někdy lepšími, někdy horšími.

Co jsem si z knihy odnesl:
  1. Historicky muži jsou lovci, ženy matkami. To se projevuje průměrně horší komunikační schopností mužů oproti ženám - zatímco muži neměli při lovu mnoho příležitostí k mluvení, ženy byli doma ve skupině dalších žen a dětí. Konverzace se jim zautomatizovala a tak zvládají najednou konverzovat a vykonávat jinou činnost. Muži to nezvládají a autor to dokládá  výpovědí ženy, která když se na svého muže opravdu naštve, počká, až bude zatloukat hřebíky, a promluví na něj.

    Rozdíl se projevuje i v zorném poli. Muži museli rozpoznat zvěř na dálku, a tak mají zúžené zorné pole. Naproti tomu ženy museli neustále dávat pozor na děti, a tak mají lepší periferní vidění. Autor to ilustruje způsobem vyhledávání másla v lednici. Žena se podívá a vidí. Muž skenuje poličku po poličce, dokud ho nenajde. Ženy řidičky také mají nižší procento bočních srážek, než muži.

    Muži také mají lepší prostorovou orientaci, protože za lovnou zvěří museli jít třeba i několik dní a nesměli se ztratit. Naproti tomu ženy se starali o děti, a tak ani nemohli chodit příliš daleko od domova a nebyl důvod, aby museli mít dobrou prostorou orientaci. Autor to ilustruje na parkování auta - muži nemají s podélném parkováním problém, ženy ho nesnášejí. Nebo viděli jste někdy řidiče taxíku, ženu? Řidiči taxiků totiž musí mít dobrou prostorovou orientaci, aby dovezli zákazníka co nejrychleji a mohli odvézt dalšího klienta.

    Ženy mají mnohem jemnější pokožku než muži, protože muži museli být schopni se brodit houštím za kořistí bez ohledu na drobné tržné rány. Proto se stává, že muž krvácí z nohy a ani o tom neví - když se soustředí na kořist, drobné oděrky necítí.
  2. Muž neustále myslí na sex, žena nikoliv. Preference se ale s věkem mění, a zatímco u ženy chtíč s věkem roste (přibližně do 40 let), u mužů chtíč od 14 let klesá. A to vysvětluje, proč starší dámy vyhledávají mladé zajíčky a starší pánové mladé dívky - sexuálním apetitem si vyhovují. 
  3. Muži v manželství mají častěji sex, protože ženy v manželství jsou jistější a mohou se tedy snadněji uvolnit a dosahují čtyřikrát snadněji orgasmu, než svobodné ženy. A pravidelně orgasmu dosahující ženy jsou svolnější mít sex
Když jsem začal psát tenhle článek, myslel jsem, že těch poznatků bude víc. Není. Stálo tedy za to, číst tuto knihu? Ano, tahle kniha vás může osvítit. Ale připravte se na typicky Americký roztahovačný výklad, kde je vše sto padesátkrát zopakováno.

pátek 31. srpna 2012

Maturity

Se státem zadávanými maturitami je problém, že studenti neví, zda si mají vybrat těžší variantu, a potom třeba propadnout, a nebo raději nic neriskovat a dělat jednodušší variantu. Další problém je, že složitost maturit občas ulétne a propadne víc jak 10% žáků.

Jako řešení se přímo nabízí lehčí a těžší variantu sjednotit. Slabší žák v zadaném čase zvládne správně vyřešit jen jednodušší příklady, zatímco schopnější žák zvládne vyřešit i ty těžší. Celkově by obtížnost maturity byla nastavena tak, aby průměrné skóre bylo kolem 50% a nikdo nedal ani 0% ni 100%. Protože kdyby žáci skórovali 100%, tak se neví, kdo je dobrý na 100%, nebo třeba na 160%. Oba dosáhnou stejného skóre. A obdobně to platí u 0% hranice. A možná že u dolní hranice si přejeme zachovat rozlišovací schopnost více, než u horní. Protože horní hranice jen určuje, kdo bude dělat zkoušky na vysokou školu a kdo bude přijat bez přijímaček. Ale dolní hranice rozlišuje, kdo dá maturitu a kdo nikoliv.

Celkově by se jednalo o zjednodušení. Žák by si variantu dopředu nevolil, učitelé by rozdávali jen jedno řešení a Cermat by vypracovával jen jedno zadání.Většina lidí by to tedy přivítala. Jediný problém by bylo, že někteří žáci by mohli mít problém se srovnat s tím, že u maturity nedosáhli 100%, jako obvykle dosahovali ve škole. Tohle je problém pro marketing, aby vysvětlil, že nikdo nemá dosáhnout 100% a jen promile se k tomu má přiblížit.

Druhá část řešení maturit je hodnotit výsledky relativně, a nikoliv absolutně. Z Cermatu několikrát přímo zaznělo, že maturitní testy byly koncipovány tak, aby 8% žáků je nedalo. Ale z novin víme, že jim to každoročně ulítne a někde propadne mnohem víc žáků. Proto by mělo být na rovinu řečeno, že 8% žáků s nejslabším skórem maturitu nedá. Cermatu by odpadli skandály, že jim to někde ulítne, a žáci by si nestěžovali, že jich 50% vyletělo. Problém by opět mohl být jak žákům, kteří jsou uvyklí na absolutní hodnocení, vysvětlit, že relativní hodnocení je pro ně lepší. Ale to je opět záležitost pro marketing, aby ukázalo, že v novém systému se nesoupeří mezi spolužáky, ale mezi školami. A třeba se může říci, že hranice pro průchod se snížila z 8% na 6%. Což může být pravda a přitom se nemusí nic fakticky změnit, protože většinou se stejně u maturit ukázalo, že průměrně projde víc žáků, než se plánuje, protože Cermat se jistí, aby se často nestávaly takové extrémy, jako že 50% žáků vyletí.

sobota 25. srpna 2012

Error 20 on Canon 450d

Recently some water got inside my camera and I had to disassemble it and clean it. The final casualty was that the clock battery (MS614SE) had been damaged and I had to buy a new one. Including the shipping fee the repair cost was $4.

However, after the assembly when I tried to make a photo I got:

Err 20
Shooting is not possible due
to an error.
Turn the camera off and on
again or re-install the
battery

The solution turned out to be simple: unscrew the long screw next to the zero mark and replace it with a short screw. The fix works because the long screw is mechanically blocking the gears inside. 


pátek 24. srpna 2012

Why I Love And Hate Macbook Air

What do I like:
  1. The antidust black rubber on the lid. It works.
  2. The LED on lid signalizing that the camera is working. When it's not turn on, the LED is almost invisible. Nice touch.
  3. The laptop is silent when not used on 100%.
  4. I love the SSD. It's small (now I would choose 256GB) but fast. 
What do I dislike:
  1. The build in camera is noisy. But it is excusable as it has to be really thin (just 1mm or so) to fit into the lid.
  2. The speakers are surprisingly loud and clear. Of course they miss depth of HiFi system as we are still talking about a laptop. But still I am impressed as you can fill whole room with music from this laptop. The only annoying problem I have with the audio on Macbook Air is that it takes 3 seconds after headphone plugging until the sound is actually redirected to the headphones. This lag is irritating on otherwise lag-less laptop.
  3. The power socket has the same size as USB. And that's bad as I sometimes plug USB cable into the power socket and then I wonder why the printer doesn't work :). But Apple solved this issue in 2012 version by making the power socket wider and thinner. Alleluia.
  4. Aluminum is cold and unpleasant to touch.But I expected that and covered the laptop with leather.
  5. No Ethernet. Hence I have to use an ugly USB pigtail.
  6. Only 4GB of RAM. But there have been some special versions with 8GB. 
  7. The SD card reader is not deep enough to hide the card completely. Hence the card is sticking out from the laptop by 1 cm. And once I have cracked a card in the reader because of that. And you can't use the slot to conveniently expand the disk size.  

Articles at my blog follows Pareto

I analyzed the logs on my blog and I confirmed my expectations. The number of readers of each individual article follows Pareto Law:

Why did I start to write this blog?

At my high school I was drilled to write a poem or an essay each week. And when I left my high school I often found myself perfecting a text in my mind. And while I was doing that I couldn't think about anything else nor sleep. The only thing helping me was to sit behind a table, take a keyboard, and pour it down to the screen emptying my brain for other things. From the beginning I was writing the texts just for myself as it was my sleeping pill. But after a disk failure when I recovered everything but my notepad I felt pity for all the hours I have spend writing and I started publishing my "nightmares" on web to keep them safe. And while I used to be happy that no one reads my articles I am starting to feel bad that I am wasting my time on unhelpful articles, which even aren't precised to the best high school standard anymore. Hence I decided to prune and edit the articles to make them useful for broad audience.

Plastová okna

Nevýhody plastových oken jsou:
  1. Nevíte, z jak kvalitního plastu jsou udělány. Plast se dá hodně vylepšit přidáním plnidel, například přidáním barviva se změní barva, přidáním UV stabilizátoru se plast ochrání před degradujícími účinky ultrafialového záření, přidáním tvrdidla se plast stane odolnějším na poškrábání, nebo přidáním změkčovače se plast stane na dotek mnohem příjemnější. A potom se taky do plastů dají přidat plnidla "vycpávky", jejichž úkolem je snížit cenu výsledné hmoty, protože jsou mnohem levnější než plast. A to jak je plast namíchán napohled nepoznáte. A tak na jedné základní škole namontovali plastová okna. Vypadaly nádherně bíle a i dobře fungovaly. Ale po pěti letech začaly šednout a škola to reklamovala, neb měla osmiletou záruku. Ovšem společnost, která okna dodala a namontovala, se raději rozhodla zbankrotovat, než je všechny vyměnit, protože ji to tak vyšlo levněji.
    Naproti tomu u dřeva máte výhodu, že víte, že je to dřevo. A tak víte, co od dřevěného okna očekávat.
  2. Nevidíte do rámu. V mé základní škole vyměnily všechna okna za plastová. Fungovaly výborně. Ale jednou se v létě v tělocvičně otevřelo okno a nikdo ho potom nezavřel. Kdo by ho taky zavíral, když se k němu muselo šplhat po žebříku šest metrů a ještě týden měly být pekelný vedra. Ale po týdnu, když vedra opadla, se zjistilo, že sklo vypadlo z rámu. Ze zdi trčelo pár plastů a na zemi rozbité sklo. Po prošetření se nakonec ukázalo, že okno drželo obdélníkový tvar jen díky sklu, na které byly naraženy plasty. Plasty ale nejsou nijak pevné, a tak se z obdélníkového křídla nejdřív vytvořil kosoběžník a nakonec sklo úplně vypadlo. Tentokrát ztráta nebyla nijak velká - učitelé dostali nakázáno vždy při opuštění učebny zkontrolovat, zda jsou okna zavřená, a dalším ztrátám se zabránilo. Ale v případě jednoho našeho klienta byla ztráta mnohem vyšší. Klient si nechal postavit celo prosklenou stěnu. A ačkoliv ji měl vyprojektovanou v hliníku, rozhodl se, že ušetří a nechá si ji udělat z plastu. A když mu to firma vyrobila a namontovala, tak se celá stěna uprostřed prohýbala o pět centimetrů téměř i při bezvětří. Nevím, co s tím nakonec udělal, ale pokud se ta stěna vyráběla znova, tak to byla ztráta přes 100.000 Kč.
  3. Zloději je snadno otevřou. Rám plastových oken je totiž dutý a měkký. Stačí tedy aku vrtačka a kus drátku a jste hned vevnitř, jak je popsáno na iDnes: Policii trápí navrtávači oken, po celé zemi vykradli přes 300 domů.
Samozřejmě lze udělat dobrá plastová okna. Plasty si mohou zachovat své vlastnosti třeba i tisíciletí. A většina výrobců již do plastových oken dává kovové výztuže. Výrobci začátečníci stočí kus armovacího drátu a je hotovo. Výrobci, co to už dělají profesionálněji, vkládají do rohů rámů prefabrikované úhelníky z kovu. A nakonec profesionální výrobci používají svařovaný rám, který je sice pracný na výrobu, ale je nejpevnější. A to, že se plastová okna dají snadno navrtat, vás v osmém patře panelákového domu nemusí moc zajímat.

Nicméně, ať už se rozhodnete pro jakékoliv okno, platí, že okna se musí každoročně seštelovat, jinak jdou špatně zavírat a ničí se. A toho se právě dá využít k rozeznání kvalitního výrobce od nekvalitního - kvalitní bude nabízet, že vám každoročně seřídí okna, a tím vám prodlouží záruku.

pondělí 20. srpna 2012

The best castle in Heroes 2

It's magical that Heroes 2 doesn't age. The graphics is still nice as it doesn't attempt to be realistic, but indeed stylized. And it works. It works so well that time to time I return to play it. And as I switch castles all the time to increase the variety I try to imagine an ideal castle with ideal creatures.

My ideal castle would have following creatures:
  1. Skeletons. They are expensive, but that's not a concern as your dead enemies are a free source of them. And they have extremely high damage (2-3) for a first class creature.
  2. Gargoyles as they are fast and you get them with each recruited hero. Hence if you need a hero just for exploring, you recruit a hero and leave the relatively slow skeletons in the castle. As the hero's troop now contains only fast units the hero can now move further each round. Additionally flying troops are handy for blitzkrieg in the first week.
  3. Elves. Each castle should have some shooters. And you really want to have some shooters for the blitzkrieg in the first week. Furthermore they have average or above average speed hence they don't slow down your heroes and that's quite a unique feature for a low-level shooter. The only problem is that in the first week you are going to have just a few of them.
  4. Vampire (Lords) as they can resurrect them self. You just have to wait until you collect 15 of them and then they are invincible as with each attack they refill their rows to the full rank. The only problem is if the enemy concentrates all his power to vampires and kill them all in one round. Or if the opponent has only strong units as they die slowly and you can't fully benefit from vampire lord's special feature.
  5. Hydras. They are ridiculously slow but as they have a lot of hit points and they are cheap they are perfect for defense. And they are usable for attack as well. Once I didn't have enough money to buy dragons but I had teleport spell and I could afford to buy 40 hydras. So I have been decimating the enemy with just these 40 hydras. It was satisfying to see all enemies troops to get bitten by 40 hydras at once.   
  6. Paladins. They have ridiculously low number of hit points but they cause extremely high damage. Their secret of successful use lies in getting resurrect spell because for each spell point you can resurrect one paladin. And six resurrected paladins each turn is not bad at all. Additionally it's commonly easier to build the cathedral than a dragon tower. Of courmage by giving up of the dragons you also give up of dragon and Armageddon combo. But as you commonly have many skeletons in your group you don't want to cast Armageddon anyway.
Overall I think the castle is reasonably balanced. It has two fliers. A shooter. And a defender. The first level unit is useful during the whole game as skeletons are available from the beginning of the game and the number of skeletons grows so quickly that they are one of the most important units inlate game if not the most important. And the last level unit is affordable enough to enter the field in the middle epoch when others are still collecting resources to recruit the last level unit or even to build the dwelling structure (yes, black dragons, we are talking about you). The strategy in the first week is to build dwellings for the first four lowest units, the well and the statue. You are left with one free day which gives you some extra money to recruit units, build a ship dock or a market. In the first two weeks you recruit only skeletons, gargoyles and elves. On a small map you have good chances to successfully attempt for a blitzkrieg. In the case your castle is attacked you build swamp for hydras to have a defensive unit with many hit points. In the second week you commonly build swamp and the cathedral. At the beginning of the third week you should have plenty paladins and even enough money to recruit them. At the beginning of the fourth week you should have enough resources to update vampire's dwelling and recruit all 18 vampire lords. From now your forces will compose only from skeletons, elves, paladins and vampire lords as gargoyles are now rendered obsolete. In each epoch you are using three to four different units thus you can always accept some new units that wish to join you.

The castle is dark oriented - skeletons, gargoyles, vampires and hydras are already dark and in the dark fantasies there are always some dark elves and dark knights. Hence from a design point of view the castle makes sense and there shouldn't be any penalty for mixed troop just because you have elves and skeletons together. However, the castle is mixing undead and living creatures and that is causing some troubles. Even if we omit morale penalty for undead in the troop there are some spells for entirely live or undead troops like mass bless or dead ripple and their usefulness is now crippled. But it's possible to live with that till you don't get them in your own mage guilds (just like you don't get death ripple if you play as a knight).

What's your opinion about my castle?

sobota 18. srpna 2012

Why am I reluctant to updates?

When it comes to updates I am careful. Once I have left Windows Update to update my computer and my network printer stopped working. I discussed the problem it with uncle Google and he found out that it's because of the withdrawn support for Raw Sockets in Windows XP SP2. But the funny thing is that this update is not present in only one particular patch. Indeed it's present in about 60 patches including the patch for Spider Solitaire. Does Spider Solitaire has anything to do with networking? No. It's an offline game. And even if you go to update detailed description there still isn't any note about any change in networking.

In another case I couldn't connect to WebDAV on Vista. Windows Vista was a new operating system and I expected some problems. Hence I updated the system to a newly released service pack. It took a whole day to download 6GB service pack and all the updates. But WebDAV still didn't work. Fine. I asked uncle Google and he found a patch from Microsoft, which is not automatically deployed with Microsoft updates. And it somehow helped (I have got from the second step of a wizard into the third step. But after two days of debugging I gave up in the fifth step from seven steps and installed Total Commander with WebDAV plugin and I got connected in less then five minutes).

If the updates I want aren't automatically deployed with Windows update and updates that I don't want are sneaked as Spider Solitaire update, how can I trust Windows update?       

What I Hate on Fairy Tale Dimensions Website

I love the idea that fairy tale can be described by their mood. And www.mot.us/fairytale does that. However, the chosen style is inappropriate:
  1. Fairy tales are written on paper, which ages. Hence the dominant color of the style should be beige and not red. An example of a webpage that respects that was Studentský Underground. And even youtube and mixer.cz are using paper background:

    Youtube

    Mixer.cz
  2. The front logo shouldn't be just a generic text but a picture characterizing the content. My idea is five colorful vertical stripes, each decorated by a white pictogram, depicting five fairy tale factors. The reference picture depicting the idea:

    Here we can see four cups. But hey, they associate strong emotions.
  3. Fairy tales are written with a serif font. But the web is using sans serif. That's plain wrong.

neděle 12. srpna 2012

My Firefox Addons

My favorite Firefox addons are:
  1. Adblock Plus with Element Hiding Helper. It's really easy with them to get rid of any flashing item on web including text and jumping frames.


  2. Customize Your Web can automate clicking on dialogs that just slows you down.  
  3. Locationbar2 can enhance your url bar so it's more tablet friendly.



  4. OutWit Hub is a perfect tool for web mining since it can mine everything you can access with your Firefox. Hence no problems anymore with obscure security, which is there just to prevent automated tools from data mining.
  5. Rewind/Fastforward Buttons add a button to quickly return to the previous domain. For example you are searching for something and click on the first link from Google. At the beginning it looks good but after 5 clicks you want to return to Google and try another link. Traditionally you would have to click back 5 times. With this extension you just click a button once.


  6. BugMeNot helps to quickly bypass registration forms.


  7. And finally Nightly Tester Tools that allows to run old addons even in new versions of Firefox.

Distribution of Friends on Facebook

I looked at the distribution of friends' friend count. I thought that I will just see an another example of Pareto distribution. Little did I know...


The distribution has a long tail but once the number of friends hit 150 it goes down quickly.


I thought ok, it's because they are mine friends and not a general population. I am more likely to be friend with someone who has many friends then with someone who has just a few friends. Hence my tail must be clipped at the tail.


I sampled people of the same frequent name and I have got the same strange result. I thought ok, it's because Facebook truncates the output to the first 300 people who are likely to be my friends. Hence the plot contains people with many friends.


But if I sample a rare name I still get a deformed curve. I have concluded that it can because of some power users with many friends. By Dunbar number our brain is designed to accommodate up to 150 friends with whom we maintain friendly relationship. And if we cross this limit we begin to neglect some of our friends. Hence I filtered all people with more than 150 friends.

And guess what, Pareto curve fitted the data perfectly!


To take away from this exercise:
  1. Be careful about the population you sample. If you ask people in a bus how far do they travel you will get a higher average than if you ask people at a bus station of the bus. A nice article called Why Your Friends Have More Friends Than You Do describes it nicely.
  2. Be careful about the extremes. They are likely to be somehow biased.  
Edit: once I wrote this article I found a similar article directly from Facebook and they observed the same things as I did! 

pondělí 6. srpna 2012

Co dělat, když jste neplodní

Máte tři možnosti:
  1. Být se s někým, kdo je taky neplodný, a adoptovat děti. Protože ani jeden z vás nemůže mít vlastní děti, partner vám nemůže vyčítat, že kvůli vám nemá vlastní děti. Navíc k dětem se oba dva budete chovat jako k vlastnímu, protože ani jeden z vás nemůže mít vlastní děti.
    Tenhle přístup není nerealistický, protože asi 10% populace je neplodné.
  2. Být s někým, kdo už děti má a další nechce a jen hledá partnera k výchově svých dětí. Nevýhodou je, že partner bude asi o dost starší než vy a pokud děti jsou už vyrostlé, tak vás špatně přijmou jako rodiče.
    Pravděpodobným partnerem je vdovec/vdova.
  3. Být s někým, kdo nechce mít děti ani v pozdějším věku.

čtvrtek 2. srpna 2012

Adwords pro Dropbox

Tak jsem si zvětšil dva Dropbox účty a to zadarmo. Návod v Angličtině je na lifehacker.com. Principiálně použijete $100 nebo $75 od Googlu, co dostane zdarma k novému Adwords účtu, k propagaci vašeho referral linku. A za každého uživatele, který si nainstaluje Dropbox pomocí vašeho linku dostanete 250MB (stejně jako ten, kdo instaluje Dropbox), a to až do 16GB.

úterý 31. července 2012

Panoramatic pictures and HDR

The best application for panoramic pictures I have found is ICE from Microsoft. The application is small to download, easy and fast to operate and it creates the best seamless pictures I have ever got from any panoramic software I have ever tried. And a bonus: it's free.

In the case of HDR I am indifferent. HDRtist is extremely simple to use and it aligns the pictures correctly; however, it creates a strong hallo around dark objects and the processing is incredibly slow. Furthermore, in respect to the main idea of the application, simplicity, the application should automatically crop the pictures. So the resulting HDR picture doesn't have dark and light borders caused by the aligning of the source pictures with different exposure.

Luminance HDR has a good automatic alignment tool and it creates nice realistic photos. It's my choice.

Picturenaut has a bad automatic alignment - it just shifts the pictures, but it doesn't rotate them. Hence for handheld shots it's unusable.

EasyHDR is maybe good, but in may hands it felt like rubbish.


HDRExpress has a bad alignment tool and creates strange white lines in the processed HDR photos.

úterý 17. července 2012

Chinese zodiac

I have found out that Chinese believe that people can be matched by the Chinese zodiac. Chinese zodiac differs from European zodiac that it doesn't categories people by the month but by the year. However, they have 12 signs as well and after the 12th sign the 1st sign goes. Let's look at the match table, where 1 means less compatible and 10 more compatible:


Rat Ox Tiger Rabbit Dragon Snake Horse Goat Monkey Rooster Dog Pig
Rat 9 6 4 7 10 7 3 4 10 6 8 8
Ox 6 8 4 8 7 9 5 2 4 9 7 7
Tiger 4 4 5 5 6 3 9 4 2 4 9 7
Rabbit 7 8 5 8 7 7 5 9 4 2 8 9
Dragon 10 7 6 7 9 8 8 7 10 9 2 8
Snake 7 9 3 7 8 8 4 7 4 9 8 4
Horse 3 5 9 5 8 4 8 8 5 6 9 6
Goat 4 2 4 9 7 7 8 9 5 5 4 9
Monkey 10 4 2 4 10 4 5 5 9 4 8 7
Rooster 6 9 4 2 9 9 6 5 4 4 5 5
Dog 8 7 9 8 2 8 9 4 8 5 7 7
Pig 8 7 7 9 8 4 6 9 7 5 7 8
Courtesy of http://www.findyourfate.com/chineseastro/grid.htm

I don't know about you but I don't see much. Let's do some visualization:
Conditional formatting in Excel. High levels are green, low levels are red.
That looks interesting - there are diagonal strips. Let's use Matlab to check that the strips aren't there by accident. To do that we will do random permutation test and measure uniformity. To measure the uniformity we can look at the average standard deviation in a row. And for the beginning we shift each column up by the column index multiplied by integer.

As depicted by the graph from Matlab, the maximal uniformity is reached when i=1
To visualize the result, we can use Excel again:
Excel plot when i=1
This looks meaningfully. But is it significant?

Minitab's t-test.
Minitab didn't identify the lowest value as an outlier. Hence, over finding is not significant. This is because our test is not strong enough. Nevertheless, if we generated more permutations (that are truly random), we would conclude that our finding is significant. 

And what did we find? The signs are sorted by the year. For example the difference between the rat and the dragon is four years. And they are good match. Based on our analysis of Chinese zodiac we can conclude that the hypothesized ideal age difference is in multiplies of 4 years and the worst age difference is in multiplies of 6 years.