Monday, October 26, 2009

Ce aş face diferit în Şincai

Acum sunt în Londra, învat Sociologie în anul 2 la City University şi lucrez ca programator pentru a mă întreţine. Am terminat Şincaiul în B, diriginte Boroica.

Un exerciţiu interesant pentru mine a fost să îmi imaginez ce aş face diferit în Şincai dacă aş avea ocazia să încep din nou liceul. Întreg articolul este structurat în jurul acestei liste, iar dorinţa este ca descrierea fiecărei acţiuni să scoată în evidenţă o anumită caracteristică a Şincaiului.

Ce nu vă pot garanta este că Şincaiul meu are vreo legătură cu experienţa voastră. Sora mea, care acum are 29 de ani şi a terminat la Lucaciu, se simţea bătrână când vedea generaţia cu 7 ani mai tânără decât a ei. Eu m-am simţit bătrân în clasa a XII-a când i-am văzut pe cei de-a IX-a. Fără să intru în detalii, îmi era limpede că valorile (pe care abia începeam să le disting) care mi-au ghidat generaţia sunt ostentativ puse la încercare de un nou val de elevi care acum mă trimite imediat cu gândul la post-modernism. Aşadar, vă rog să fiţi suspicioşi la ce vă transmit.

[Aş profita mai mult de profesori. Mi-aş găsi un mentor]
Profesorii sunt una dintre cel mai puţin utilizate resurse din Şincai. Nu am să rezolv acest aparent paradox prin referinţă la cunoştinţele enciclopedice deţinute de majoritatea profesorilor din Şincai, şi nici prin scoaterea în evidenţă a gradului ridicat de profesionalism cu care dascălii noştri ne instruiesc - în parte pentru că acestea variază larg, dar mai ales pentru că sunt secundare cauzei pe care o găsesc esenţială. Uitându-mă înapoi îmi dau seama că lucrul cel mai important pe care l-am preluat de la (anumiţi) profesori nu sunt informaţiile concrete (deşi gramatica limbii engleze încă mă bântuie, integralele şi derivatele au încetat demult să îmi neliniştească somnul). Ce rămâne în mine după aceşti ani sunt perspective, metode, paradigme, atitudini, modele situaţionale, inspiraţie. Mi-am rafinat definiţia corectitudinii în urma lecţiilor lui Boroica; am fost iniţiat în arta comediei stand-up în orele lui Moga; am inceput să mă gândesc mai concret la viitor când scriam gândurile bune în orele lui Breban; am inţeles că am dat importanţă diligenţei cu care făceam flotări deoarece lui Cristea i se părea esenţială metoda; am reuşit să schiţez caracteristicile unui lider carismatic în orele lui Pop V.; mi-am scăldat picioarele într-un ocean al dezbaterilor şi am inteles că pot - şi mai apoi că am datoria - să iau o poziţie faţă de toate marile dezbateri din societate în timp ce discutam cu Moga despre rolul religiei în secolul XXI sau despre interacţiunea dintre erudiţie şi împlinire personală. Profesorii în general pot - şi au datoria - să fie mentori pentru elevii pe care îi formează. Împărtăşesc părerea lui Malcolm Gladwell - şcoala, departe de a-ţi da un bagaj considerabil de cunoştinte pe care să le foloseşti ulterior în viaţă, iţi dă mai degrabă o încredere semi-fondată în abilităţile tale, care fără îndoială deschide mai multe uşi mai târziu. Aşadar, în loc să vă uitaţi la profesori ca la nişte maşini al căror rol e să vă spună lecţia din manual cu voce tare, încercaţi să îi vedeţi ca mentori. Şi dacă psihologia ne-a învăţat ceva, este că oamenii încearcă în mod continuu să se ridice la nivelul aşteptărilor celorlalţi. Va merita.


[Aş învăţa mai multă materie - dar nu neaparat materia scolară. Iar prin negare, aş fi mai puţin şmecher]
Când enumeram efectele şcolii asupra caracterului nostru, am omis în mod deliberat şmecheria, din două motive: unu, pentru că ne este în mare parte caracteristică şi doi pentru că am o viziune ambivalentă asupra eticii şmecherului. Şmecherul, înainte de a îndoi regulile în favoarea lui, activitate care necesită consum energetic, încearcă întâi să se prelingă printre pereţii subţiri lăsaţi de spaţiile nebuloase dintre reguli şi să exploateze aceste zone. Învăţăm să fim şmecheri în familie întâi, şi apoi continuăm să ne perfecţionăm în liceu: inventăm motive pentru care ar trebui să fim scuzaţi de la regimul aplicat întregii clase, sau amplificăm cauze reale la dimensiuni epopeice pentru a sensibiliza actori importanţi în favoarea noastră (de exemplu, eu am folosit olimpiada); cerem frumos să facem referate pentru a umfla notele înainte de sfârşitul semestrului; copiem tema înainte să intre profesorul în clasă; ridicăm mâna la începutul anului la întrebările cele mai simple ca să ne tina minte profesorul drept activi la ore; şi câte şi mai câte. Iar pe voi vă rog să mă scuzaţi dacă vi se par hilare strategiile noastre de modă veche. Suntem doar şmecherii din 2006.
Clasa noastră a fost o clasă plină de şmecheri. Motivul principal este că am avut olimpici cu sacii. La matematică, la chimie, la fizică, la engleză, etc. În această situaţie profesorii se purtau cu noi cu mănuşi; ne cam lăsau în pace. Deşi recunoscător în timpul liceului, acest lucru mă nemulţumeste nespus acum. Îmi pare rău ca am privit învăţatul ca pe o povară de care mă debarasam când aveam ocazia. Şi, în mod natural, am ajuns să ştiu doar atât de mult la fiecare materie pentru a nu trece drept ignorant. Sunt multe motive pe care le pot invoca, însă e tardiv pentru mine - dar pentru voi nu.
Aşadar, aş învăţa mai mult - la istorie, la filozofie, la geografie, la germană, la biologie. Observaţi omisiunile importante: matematica, româna, chimia. Singura materie la care am invăţat mai mult decât cerea programa şcolară e informatica - şi bine mi-a prins. Aş fi foarte bucuros să scriu un întreg eseu despre beneficiile fiecărei materii menţionate, dar spaţiul nu îmi permite. Aşa că voi lăsa la latitudinea voastră găsirea motivelor şi vă voi sfătui să vă alegeţi măcar o materie la care să învăţati şi să citiţi mult mai mult decât cere manualul. Pentru mine cel mai mare gol este istoria. Pentru voi?
Concluzionând asupra eticii şmecherului, voi menţiona doar că mă nemulţmeste prin egoismul necesar, dar mă încurajează prin metoda inovatoare. Şmecheria e legată strâns de increderea în sine, de negociere, de tatonarea limitelor, de customizarea condiţiilor date în beneficiul nostru. Mă încurajează pentru că rezolvarea majorităţii problemelor sociale necesită un anumit grad de îndrăzneală şmecheră (şi spun asta în modul cel mai pozitiv), de încredere şi cutezanţă inteligentă. În situaţia din Israel şi Palestina, de exemplu, care mă interesează în mod special, această şmecherie invăţata în scoală poate fi un ingredient esenţial al liderilor care contribuie la soluţionarea conflictului. În dezbaterea dintre agenţie şi structură mă situez destul de clar în prima tabără - cred că societatea este creată, recreată şi întreţinută de acţiunile fiecăruia dintre noi, şi nu invers. Cred, aţadar, că deşi etica şmecherului trebuie depăşită printr-o etică a responsabilităţii, metoda sa este aplicabilă într-o serie largă de situaţii. Cultivaţi-vă, aşadar, şmecheria - dar folosiţi-o inteligent şi etic.


[Aş citi mai mult. Ştiri, filozofie, sociologie şi istorie mai ales. M-aş gândi mai mult la statutul meu de elev]
De când am venit în Londra - şi de fapt cu mult inainte de asta - mi-a devenit dureros de clar că nu am citit nici pe departe cât aş fi vrut. Până acum priveam clasicii cu circumspecţie şi cu o oarecare emotie; 'nu îi voi putea inţelege încă', îmi spuneam. 'Şi, de altfel, nici nu am timp'. Prin clasici eu mă gândesc mai mult la Platon, Descartes sau Weber. Dar nici beletristica nu strică, nici literatura de specialitate. De când am început să citesc am descoperit - într-un proces analog proverbului 'mâncând iţi vine pofta' - o resursă aparent inepuizabilă de întrebări şi dileme care ies la iveală din mine din ce în ce mai vocal. Şi aici revin la şcoală. Dacă vorbiţi frumos cu doamna bibliotecară să îl aducă pe Foucault în câteva copii, veţi vedea că instituţia în care vă aflaţi are istoric legături puternice cu clinicile de psihiatrie şi cu închisorile, cu un sistem de represie şi socializare care a trebuit inventat şi perfecţionat pentru a răspunde nevoilor noului jucător pe scena luptei de putere - statul. Şcoala a obţinut un control foarte eficient (gândiţi-vă doar la raportul numeric dintre elevi şi profesori) asupra corpului vostru în primul rând şi asupra minţii voastre în al doilea. Ieşim prin cealaltă parte a furcilor caudine ale şcolii obişnuiţi să ascultăm de superiori, disciplinaţi, uşor de condus, obişnuiţi cu program fix şi regulat de muncă, bucuroşi de oscioarele pe care ni le aruncă sistemul. Suntem, aşadar, bine pregătiţi să mergem la serviciu. Care 'serviciu', la rândul său, este o invenţie nou-nouţă în istoria societăţii umane. Dar să nu merg prea departe. Ce e important să scot la iveală este că profesorii, deşi poate mulţi nu doresc asta, sunt actori principali în perpetuarea sistemelor sociale prevalente acum. Deşi acest lucru nu este rău în sine, multitudinea problemelor sociale care asteaptă o soluţie nu poate fi eliminată păstrând aceeaşi structură în funcţionare. Iar rolul meu şi al vostru e să aruncăm cu atenţie un şurub în locul potrivit în marea maşinărie şi să facem câte o rotiţă sau două să o ia înapoi.


[Aş profita de colegi mai mult]
Aşa cum Silicon Valley e un musuroi de antreprenori, genii şi finanţatori într-ale tehnologiei, sau cum Academia Nick Bolletieri e fabrică de campioni de tenis, Şincaiul este un butoi de fermentare al spumei spumelor. În mare parte şi mai eficient decât în alte locuri, în Şincai este predominantă meritocraţia. Calitatea oamenilor cu care interacţionaţi este ridicată, atât în ce îi priveşte pe elevi cât şi pe profesori. A profita de acest lucru este esenţial pentru liniştea emoţională subsecventă. Eu am început o firmă în timpul liceului cu un coleg de an, am făcut campanii de reciclare cu colegii de clasă, am înfiinţat un consiliu al elevilor sprijinit de profesori. Farmecul unui loc ca Şincaiul este că ai la îndemână toţi oamenii necesari pentru a face lucrurile să se întâmple.


Concluzia nu este una neprevăzută. În mare, aş profita doar mai mult de lucrurile pe care Şincaiul le are deja. Şi am scris întreg eseul acesta pentru a vă încuraja pe voi să o faceţi. Cred că tot ce trebuie e o masă critică de elevi şi profesori pentru a înclina balanţa către efervescenţa şi atmosfera elitist-constructivă care încă stă latentă în zidurile Şincaiului. Fiecare aniversare este o amintire a acestui lucru.

Thursday, September 10, 2009

Javascript injection from Flex into the HTML wrapper - problems with IE, of course

Here are some tips which might save someone some headaches (which you inevitably get when you start working with Internet Exploder).

First and foremost, if you want to communicate from Flex to (regular) Javascript using ExternalInterface in Internet Exploder (I was testing on version 6), you had better put an id attribute on the [object] and [embed] elements, or else it will either silently fail, or give you the wonderfully descriptive and logical error message 'null' is null or not an object. If I didn't know any better, I'd say it's rather philosophical. Oh, and it's always at character 118, line 1. I dare you to find it :)
You find this information if you read the first note on the Adobe documentation page for ExternalInterface.

When I said 'regular' earlier, I meant javascript that's already embedded in the page. Now, if you want to do nifty stuff like Javascript injection, you would probably use Abdul Qabiz's fantastic component. The reason I needed it was that our Flex application needed to be completely independent of the html wrapper it happened to find itself in, but also needed to open IFrames and move them around and do all kinds of nifty stuff (you can tell I like this word). That meant that the script would have to be embedded at runtime in the page by Flash.

Sounds doable, right? In Firefox, yes. In IE, haha, you've got another thing coming. IE and 'simplicity' have proven to be at opposite ends of the spectrum, time and time again.

I won't drone on about the specifics too much. But here are some major points to keep in mind:

For me the workaround didn't work yet... I'm trying to tweak it somehow to get it going. And it's great how you feel completely in the dark when it comes to these things, as the documentation seems to be lacking. It would have been great if IE6 had had the public bug tracking application IE7 and 8 do. But it would have probably crashed very early on, due to overuse.

Wednesday, August 12, 2009

Ideas for optimizing flash / flex applications

Optimizing the memory consumption, processor cycles used and even user experience in a flash application is as complex as it is important. Not very many projects out there reserve time for the explicit task of optimizing the application, which is why I think developers should incorporate some of these techniques in their daily development, or in the initial planning of the architecture of the application.

A good place to start for optimization advice is Adobe's advice for reducing SWF file size in Flex applications. A lot of the ideas there pertain well to improving user experience as well - as is, for instance, splitting the application in modules, loading external swcs, and loading content at runtime where possible. Adobe also offer a rather valuable tool for Flex developers, the linker dependencies xml which you can export as part of the compilation process. Here's an AIR application called AIR Link Report visualizer which will spare you from having to read plain xml by presenting dependencies in nicely arranged lists and offering a nifty visualisation chart showing you the breakdown of the packages used in your application.

User experience is given a lot of attention in this tutorial about SWF framerate optimization done by Lee Brimelow.

As processor cycles are concerned, it usually comes down to fine-grained changes in your code. For me, this is the fun part.
Depending on your current knowledge, you might want to start off with Grant Skinner's great presentation about resource management.
A comprehensive list of possible code optimizations is maintained by Joa Ebert, read it with both eyes. Also watch out for valuable links to more details on particular subjects, such as this list of bitwise operations: Bit Twiddling Hacks. Next, you can get your head around the debate about the int / uint / Number types in Flash by reading Grant Skinner's discussion on them (prompted by this blog post), and this post which also looks at flash player versions for a more detailed approach.

I will keep adding to this list as I discover new articles on the topic. If you have your favourites, show them off.

Monday, August 10, 2009

Running the ftp ant task in eclipse with version 2.0 of the Apache Commons-Net library

...doesn't work!

(In case you are not familiar with running ant in eclipse, read both parts of the very good O'reilly article on that topic: part1, part2).

Now, if you want to use the ftp ant task in eclipse (which is not a core ant task), you will need to install some more java classes. Read this article for the details. However, keep in mind that you need version 1.4.1 of the Apache Commons-Net library, and not 2.0, which at the time of writing is the latest version (I'm using eclipse 3.4.0). If you use version 2, however, and you get something like this from eclipse:

Could not create type ftp due to java.lang.UnsupportedClassVersionError: org/apache/commons/net/ftp/FTPClientConfig (Unsupported major.minor version 49.0)

it means you're stubborn :). So use version 1.4.1.

UPDATE
Courtesy of Gary, a Java informed friend, here's the real reason for the error:
"The error 'Unsupported major.minor version 49.0' means that java 5 is required. Its possible that you have configured somewhere to use java 1.4 (v4).
if you make sure you have java 5 installed and configure eclipse to use this version then you should be okay."

Sunday, June 7, 2009

Israel and Palestine: do we really need more evidence?

If you needed any more evidence that Israel is engaging in violent, unethical and systematically planned harassment against the Palestinians, you should watch "People and the Land" (part 1, part 2, part 3, part 4, part 5, part 6). It is not an incredibly good documentary, but it makes its point.

In fact, you would have to be a very poor film maker not to get this message across. What is happening is blatantly clear to any person with a droplet of sense. Israel policy and American support for it are unmoved by UNSC resolutions condemning it, by human rights organisations recording their consistent violations of basic human rights, by the suffering of the Palestinians and by the pressure of the international community.

Liz Coleman, Bennington College's president, in her speech at TED 2009 about the dying-out liberal arts education in the USA, mentions (at min 5:23) five processes or goals which further erode the link between education and civic engagement: "Oversimplifications of civic engagement", "Idealisation of the expert", "Fragmentation of knowledge", "Technical mastery" and "Neutrality". Of these the second and last are key to why the situation in Palestine is allowed to continue internationally. "Experts" like Alan Dershowitz fuel an artificial debate, where there is nothing left to prove. Pressure groups against the occupation are scattered, while Israeli lobbying is well organised and powerful. And both their influences in the international community are decided neither by just argument or evidence, but by power flows. America has been pumping money into Israel like there's no tomorrow (also watch, if you haven't, part 6 of People and Land), and simultaneously using its veto right in the United Nations Security Council to prevent resolutions against Israel from being adopted (tens of times, in almost all cases it being the only state to disagree). Even so, Israel is on top of the international 'villains', with 32 UNSC resolutions violations, all related to the Palestinian "problem".

This is a clear-cut case. It is simple and straighforward. It is true that both sides are engaging in such activities, but Israel is by far the champion. It should be made to take a break.

Perhaps I will be urged by some to go back to my programming. I am also aware that my knowledge of the issue is still limited. But I am stretching my imagination to its limits in trying to figure out what piece of undiscovered evidence can demonstrate my ignorance or blind partisanship. I am going for the stretch by reading, in paralel, Dershowitz's "The case for Israel" and Chomsky's "Fateful Triangle". If you have any other suggestions, I am open.

So, do we really need more evidence?

Saturday, June 6, 2009

Home shweet home: watch Luc Besson's new movie

YouTube are hosting, promoting and showing "Home", the documentary by Luc Besson about the environmental issues threatening our planet, they have recently announced on their blog.

I have just finished watching it, and I have mixed thoughts about it. On the one hand I think it's quite a bad production, and I have yet to understand why Luc received awards for it (maybe for the breadth of his research if nothing else). On the other hand, I do think that, given the current campaign to see it, a mass viewing would be beneficial.

Firstly, the film struck me as 'cheesy' - the narrator(ess) is trying to be inspiring and awe-inducing, but the result is something we've all seen and heard tens of times; and when it spans 90 minutes, it becomes really old really fast. Secondly, there are quite a few unsupported claims there, do listen to what she sais with both ears. And thirdly, the actual narrated text is gradeschool material (not necessarily in content, but in form) - the sentences are overly simple, repetitions and truisms abound ("Everything is linked" said a gazillion times), and if it weren't for the great images, the film could have been summarised in 5 minutes.

Now this is not to say that the message of the film ("We are threatening the Earth, and unless we change radically we are bound to endanger our existence; the first steps have been taken, but much more commitment is needed") is not a valid one (in fact, I believe in it quite a lot) or that the intentions of the producers are to brainwash people into doing something about the ecologic crisis (I would endorse that, to be honest). In fact, there were some moments in the film when I felt I had to spring to my feet and start doing something - and surely forget about the beef wrap I was eating, which was so blatantly contributing to deforestation of the Amazon rainforests. I do sincerely believe that the more people will see this film, the more "commitment" we will make as a species for living in sync with nature. But I also believe firmly that other such films (the only example I can think of right now is the very good documentary We Feed The World), were they equally promoted, would induce a much bigger change. I just feel a lot of people will see "Home" as propagandistic (which it is) and will also disregard the actual issues underlying its creation (or not watch it in the first place).

And now comes the philosophico-ethical question - is it 'right' to promote material which you regard as inappropriate in itself in order to further a goal which you believe in, just because you think that particular material has the greatest chance of making an impact through quantitative access to it, rather than through its quality? What about the law of unintended consequences?

I will answer 'yes' to this one, and I urge you to see "Home" and discuss it (and be quick, it is up there only until the 14th of June).
What would you answer?

Tuesday, April 28, 2009

PureMVC improved: commands can be singletons

While working with PureMVC on some games in Flash CS3 I thought it would be quite useful to be able to specify that some commands should not be recreated each time they are run (as is the default behaviour), but rather only once, and the same instance should be used all throughout. In games where certain commands occur often (eg. the one associated with the message 'Deal' in card games) this would be an important memory save.

So I set out to adapt PureMVC. I tweaked the Controller::executeCommand function the most, with some meddling with Controller:registerCommand, Facade::registerCommand, and their respective interfaces. Overall, only 4 files changed, with only the controller suffering essential functionality alteration. The only change in the API is that when you use registerCommand in your implementation of the Facade, you now have a third parameter, called 'singleton', of type Boolean, which defaults to false. If it is set to true, only one instance of that particular command will be created and then reused all throughout the life of the application.

Example of singleton command initialization:

this.registerCommand(STARTUP, StartupCommand, true);


You can download the changed PureMVC framework here.