Jun 24 2008

Different way of thinking PHP vs. Ruby

It’s interesting to note the differences between these two. I have found a few weeks before Peter Marklund’s excellent rails 101 pdf (a whopping 340+ pages of slides).

I am still going through it, but as I have a few years php experience (and still finding exciting new functions like compact and extract), I sometimes think about whether some of ruby’s features work the same way as php. The answer is usually: no.

For instance, in ruby you can do:

var1 = vara && varb && varc

a var is false if it’s ‘nil’ or ‘false’ everything else evaluates to true. It’s not the same with php, where 0 or ‘0′ also evaluates to false (and maybe some more).

In the above if all values eval’ to true then the last (varc) one’s value is put into var1. There’s also:

var1 = vara || varb || varc

Which works similarly, but the first variable that evaluates to true is assigned to var1.

 

My favorite one though, is how you can exchange the contents of two variables in ruby:

a, b = b, a

That’s all! (intuitive, you can’t deny)

It - of course - does not work with PHP. However since I was curious if a syntatically similar solution can be achieved with it - after some fiddling I come up with it for PHP:

list($a, $b) = array($b, $a);

Looks similarly (and as I do not know what happens behind the scenes in ruby they might just work the same way - but PHP exposes more of its inner workings)

Well, whatever. The more I know about ruby the more I like it. :) 


Jun 20 2008

Klubberek vagy mi…

…vagy mi a faszom.

Azért érdekes, vannak ezek a reklámból élő fijatalsággot tajtékoztatni óhajtó kis újságocskák, kezdve a pesti tyest-el, majd flyerz, meg exit, et al. (meglátva hogy van még nekik hejj a pijacon). Általában max a képregény jó, ha jó, és van benne (butapest), meg néha az idióta apróhirdetések, és a moziműsor, ha nincs épp net a közelben. Na jó, néha értelmesebb koncertekről, megmozdulásokról is van hír.

Ami kicsapta a biztosítékot nálam legutóbb az a “klubber” szó használata volt. Mi a szar ez???! Minden fost át kell szopni egy az egyben az angolszász okosoktól? Ez faszán, eredetien hangzik, még inkább trendi? Merthogy angol területeken a “clubber” szó az amit a sűrűn bulizgatni járó emberkékre emlegetnek. Leginkább - az én értemezésen szerint - a tuc-tuc, dübörgős, ekizős, goázós, akármizős stílusban utazókra. Na szóval most már vannak klubbereink is. De jóúúúú.

Klubber.
Klubber.
Klubber.

Leírva is hülyén néz ki. Akik ezt a “szavt” használják újabb merényletet követtek el a magyar nyelv ellen. A telcsi, szivcsi, talcsi, köszcsi és egyebekkel együtt. :D


Jun 18 2008

The Air I Breathe

This is a movie that encompasses what life is about. How predictable and yet - at the same time - unpredictable it is. How things happen to us that we and others cause, and how a train of thought changes before coming to an end. In fact it just never comes to an end. The opening quote is a very well chosen one. Just think about it.

You can describe the acts that happen in this movie, but in fact it is not about what happens. It seems to be a kind of gangster movie, where all the lives of the actors depend on one another. It also provides a way of relief at the end (which is quote due - as you could say that some very unfortunate events happen along the way).

Well, what can I say - if you loved the movie “Crash” (2004), then you gonna like this one. Also Brendan Fraser (Mummy) acts very well in his role as the gangster who can predict the future. Sarah Michelle Gellar still looks gorgeous and is a very nice fit for the blonde pop-star-to-be who is sold to the gangsters. :)

“You never can tell” …

 

Trailer:

YouTube Preview Image