Skip to main content

124 posts tagged with "in-English"

View All Tags

Power of programming languages

· 2 min read

“The fact that all these [programming] languages are Turing-equivalent means that, strictly speaking, you can write any program in any of them. So how would you do it? In the limit case, by writing a Lisp interpreter in the less powerful language.

That sounds like a joke, but it happens so often to varying degrees in large programming projects that there is a name for the phenomenon, Greenspun's Tenth Rule:

‘Any sufficiently complicated C or Fortran program contains an ad hoc informally-specified bug-ridden slow implementation of half of Common Lisp.’

If you try to solve a hard problem, the question is not whether you will use a powerful enough language, but whether you will (a) use a powerful language, (b) write a de facto interpreter for one, or (c) yourself become a human compiler for one. […]

This practice is not only common, but institutionalized. For example, in the OO world you hear a good deal about ‘patterns’. I wonder if these patterns are not sometimes evidence of case (c), the human compiler, at work. When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I'm using abstractions that aren't powerful enough — often that I'm generating by hand the expansions of some macro that I need to write.”

Paul Graham, “Revenge of the Nerds”.

Adobe Flex in 10 minutes

· 6 min read

If you are a software developer, a web designer or some other sort of techie it's very likely that you have been hearing and/or reading about Adobe Flex lately. Well, if you aren't using it yourself but feel curious about it, or if you just want to have a notion, this extremely quick introduction is for you. Skimming through this post will not turn you into a Flex developer, but it will allow you to nod confidently and even drop some canny words the next time that Flex pops up in a conversation around the watercooler. First things first — what Adobe Flex is not:

  • It is certainly not a tool for generating lexical analysers ;¬)
  • It's not “the new version of Flash” (FKA “Macromedia Flash”). Development of Flash is on-going and the two products coexist. Flex hasn't replaced (and won't replace) Flash anytime soon, the reason for that being that…
  • …Flex is not “an alternative to Flash”. Sorry to disappoint you, but Flex is not a way to get rid of the dependence on the Flash Player. Actually Flex is built on top of Flash and needs Flash Player to run.
  • It's not a technology to build large, native apps that need to work close to the underlying platform or which performance needs to be optimised (read below to see why I believe this).

Flex in a nutshell (a rather small nutshell): Flex is an attempt by Adobe to make Flash attractive to, and suitable for, many software developers who were disregarding Flash as something not serious enough to use for developing “proper software”. Adobe has done a praiseworthy effort in that sense and has brought Flash to the realm of OO programming. Adobe used Eclipse to develop Flex Builder. Flex Builder alone does a lot to make old-skool software developers feel at home — it's a proper IDE with all the features you would expect, plus the extensibility (and the slowness, I'm afraid) of Eclipse. Flex developers use the Flex SDK (command line compilers and component class library; free as in “freedom”) and the Flex Builder (the IDE) to build their applications. Flex apps are written mainly in two languages:

  • Actionscript, an ECMAScript-based language that exists since the first Flash Player.
  • MXML, a loose, proprietary implementation of XML used to define GUI elements.

The output of a Flex project is one or more Flash files (.swf). In terms of the approach to the development process, the single most important change from Flash to Flex is probably removing the “movie” way of thinking. Flash animators are used to the “movie paradigm” in which the time is an essential concept. In their animations they have been working with key concepts like “timeline”, “frame” and “loop”. Flex abandons that approach. I have found that, in general, software developers without any experience with Flash get used to Flex even faster than Flash designers who don't know much about programming. What Flex is good at:

  • Rendering cool interfaces. Animations, transitions, effects, gradients, reflections, customised skins, embedded movies, nice charts, changes in opacity, layouts that are resized well when their container is resized, etc. For a demo, check the Flex 2 Component Explorer.
  • Working on all major desktops and web browsers and many mobile devices. OS's: Windows, Mac OS, Linux and Solaris. Browsers: IE, Gecko-based browsers, Safari, Opera. Mobile devices: many, and more to come.
  • Keeping the same “look & feel” everywhere. You can see the default Flex 2 “look & feel” in the Flex 2 Style Explorer.
  • Integrating and communicating with other Adobe formats. Flash movies, Acrobat documents, ColdFusion, Dreamweaver, etc.

What Flex is not good at:

  • Computationally expensive software. As we saw before, Flex stresses GUI aesthetics, intuitive design, portability, compatibility with existing Flash files and other Adobe tools, easy deployment, etc. And it was aimed at the web (in spite of Air). So don't expect it to be any good at doing system calls, invoking hardware drivers, messing with the network at low-level, fine-tuning loops to save cycles of CPU, dealing with gigabytes of data, delivering real-time, etc. Because Flex apps are deployed as Flash files, every Flex app “lives” inside the Flash security sandbox, which prevents it from accessing many of the resources of the computer. Also, Flash is a proprietary format that doesn't run natively but is interpreted by the Flash Player. That extra layer of translation decreases the performance.
  • Classic Flash stuff. Don't bother to learn Flex if all you need to do is Flash banners and simple animations. For that you will need a timeline, drawing tools and accuracy at pixel-level. Flex is not designed for that.
  • Being extrovert with its neighbours. I hear that even Air makes it quite difficult to launch an external executable from a Flex application.

Now, the “hello world” is mandatory, so here it goes. This application simply displays a customised greeting (it's a “hello world” on steroids). We'll make the GUI inherit from the layer that processes the information, in a “code-behind” manner. First, the Actionscript class contained in the file info/tripu/blog/flex/SimpleApp.as. This class extends the standard Application class and defines what to do with data:

package info.tripu.blog.flex {

import mx.controls.Alert;
import mx.core.Application;

public class SimpleApp extends Application {

public function greet (who:String): void {
Alert.show ('Hello, ' + who + '!');
}

}

}

Second, the MXML application HelloWorld.mxml. It defines the GUI by using an instance of the class SimpleApp and adding a couple of visual controls to it. Notice how the AS class that we created before is now used straight as an XML element:

<?xml version="1.0" encoding="utf-8"?>

<tripu:SimpleApp xmlns:tripu="info.tripu.blog.flex.*" xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:TextInput id="user" text="world" />
<mx:Button label="Greet" click="{greet (user.text)}" />

</tripu:SimpleApp>

The result of compiling those two files in a Flex project is this Flash file, HelloWorld.swf (you'll need Flash Player version 8 or above to see the embedded Flash object):

Casio EX-word XD-SP7500 Japanese-Spanish-English

· One min read

Today I ordered this little marvel:

  • 27 thesaurus and dictionaries of Japanese, Spanish and English.
  • Quick jump among dictionaries.
  • Hand-written kanji recognition.
  • Encyclopedias with images.
  • Dictionaries of proverbs, computer jargon, business and economics, kanji and katakana.
  • 10K spoken Japanese words (not synthesised but actual human voice).
  • Backlight.
  • SD card slot.
  • USB port.
  • Speaker plus headphone output.

Hopefully it will find its way from Japan to the UK and will be safe with me in a few days. Isn't it beautiful?

“So clearly beautiful to me”

· One min read

“A lot of these songs are just a response to what struck me as beauty. Whether it was a curious emanation from a being or an object or a situation or a landscape, you know, that had a very powerful effect on me as it does on everyone, and I prayed to have some response to the things that were so clearly beautiful to me; and there were a lot!

Leonard Cohen

More on L. Cohen

· 2 min read

Holy cow. Right after posting the previous entry I learnt that Leonard Cohen was inducted into the “Rock & Roll Hall of Fame”… only five days ago. That is good news for three reasons: a) it's good to check, from time to time, that L. Cohen is still alive; b) his appearance at the event proved that he is still brilliant with words and that the pitch of his voice has dropped down yet one more octave, entering the range of infrasounds; and c) there is still hope for a music industry that can spot an amazing lyricist among all the rubbish, and pay tribute to him even after so many years.

L. Cohen

There are people whose soul vibrates in resonance at the same harmonics as Leonard Cohen's. For all those people (of whom, if my reckoning is right, there are exactly zero among the handful of readers of this blog) let me link a few items about Leonard Cohen that are dear to me:

“No we can't”

· 2 min read

No we can't. We can't vote Obama. Not this side of the Atlantic. I like his approach. For what little I know, he seems a good candidate, and I would probably vote for him. If I could. I like politics, and I acknowledge the importance of American politics at a planetary scale. But to recite campaign slogans as if they were true is naïve. It is naïve in our own country, with our own politicians; but it is even more naïve when we are just a passive audience buying a distant show. Besides, they don't care that much about us anyway. You don't wave flags because you know nationalities are coincidences, there is no pride in toponyms but geography and history. You don't repeat toothpaste slogans because advertising slogans are void. Why then repeat slogans of political parties? You know they are designed by the same people who write slogans for toothpaste, and for very similar purposes. Believe in ideas, believe in policies, believe even in politicians. I understand the excitement in Europe about Obama, but I think it's a bit exaggerated. For three reasons. First, we can't vote in November. Second, even if Obama wins there will be far less change in the USA than we would like to see. Third, blogging for Obama in Europe has an impact that is almost nil in the USA (remember how Europe voted for Kerry four years ago but its ballot sank somewhere in the Atlantic half-way to Washington).

Migrating

· One min read

English: throughout this week this blog will be highly unreliable due to planned engineering works. I'm migrating the domain tripu.info along with this web site and all *@tripu.info e-mail addresses to a new server. Expect funny things to happen. Apologies in advance if that puts bogus entries in your RSS or if I miss any message from you during the process.

Español: durante los próximos días voy a migrar esta bitácora y mis direcciones de correo tipo *@tripu.info a un nuevo servidor. Yo me voy a liar y tu agregador de RSS a lo peor también. Y puede que pierda algunos emilios durante el proceso. Pido disculpas de antemano.

Bookdropping

· 3 min read

The other day, as my train slowly entered the station and arrived to the platform, I noticed something falling to the floor when somebody got up to leave the train. The mature woman sitting behind me had dropped something accidentally. Or so I thought. It was a book. I stooped to pick it up for her — trying to read its title at the same time, of course. It was “On Beauty”, by Zadie Smith. I already knew that book because it received very good critics and won some important prize, and had been since heavily promoted here in England. I had been seeing it in the hands of commuters lately. I handed the book back to the lady expecting the preceptive “oh thank you very much” plus broad smile that I so much appreciate since I arrived to this country. Instead of that, the woman made me a gesture of subtle negation and stammered out something that I didn't understand. Suddenly it dawned on me: this lovely lady is a bookcrosser in disguise! I was happy with the possibility of rescuing a book from the wild for the second time in my life. But I saw no sticker of Bookcrossing on its cover. Why? Then the woman, noticing my confusion, looked at me again in guiltiness and confessed in a whisper: “I can't stand it. I don't like it. Do you want it?” Sure. Her guilty confession kept me laughing at intervals for the rest of that day. She was no bookcrosser. She was a bookdropper. Cool. Next time you realise that you actually loathe a book that you began to read just because all your friends were loving it, don't suffer. Instead, perform a sophisticated act of generous bookdropping in some crowded place. (Just make sure before that nobody is close enough as to offer it back to you). That might save yourself hundreds of boring pages and quite a few pathetic attempts to highbrow comments among your mates. And it's a smart, environmentally friendly move which Al Gore himself would be proud campaigning for. I wonder how many books are bought (and maybe read) just because of ads and trends. I myself have put it now in my queue, but after some other more important books. By the way, bookdropping.com is already registered, but bookdropping.info remains available…

Go to Flickr to see this
image

Learning Linux/Un*x

· One min read

I've got a friend who is a software engineer too, but who has never worked with Linux or Unix. Now he wants to start learning something about it, so he asked me about good sources for beginners. My friend is a Java programmer with some work experience, so when I say “beginners” I just mean “newbies to Linux”, not “computer illiterates” or “programming dummies”. What he wants to learn (or rather what I believe would be best for him to learn) are the basics about Linux installation, configuration and administration, command line rudiments and tools, typical open source programming languages and environments and general development methodology. There must be some good general introductory-but-not-too-basic books, documents, tutorials and web sites out there. It's just that the ones I can think of (which I may have used in the past myself) are either in Spanish (which he can't read), a bit too old or centred on very specific aspects. Can you recommend any good source? What was your first book about Linux? Any classic must for beginners? He prefers books to web sites.