LispForum Online!

By Blub | juillet 16, 2008

A new Lisp dedicated forum have seen the day, LispForum. It’s like 20days since it opened and the forum have seen more than 200 members (it’s not that much, but it’s still good :).

Many topics have seen the day, so go for it LispForum is waiting for you!

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Divers | No Comments »

Write with style!

By Blub | juillet 14, 2008

While surfing on that wild yet nice information web, I found something that should interest everyone who’s blogging and maybe feels like most of the readers are not interested in what he’s saying.

The title was “How to write with style”, here are the 7 advices (rules?) for a good paper:

  1. Find a subject you care about
  2. Do not ramble, though
  3. Keep it simple
  4. Have guts to cut
  5. Sound like yourself
  6. Say what you mean
  7. Pity the readers

Original article (definition of all the points) How To Write With Style

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Divers | No Comments »

The Blub Paradox!

By Blub | juillet 14, 2008

Hello,

I’m new member of the Crowtheries.net crew (yet we are only two), so I think that the first thing I’m gonna do is to introduce myself.

What’s the Blub?

Blub is an hypothetical language imagined (first used) by Paul Graham to illustrate the Blub paradox.

Blub falls right in the middle of the abstractness continuum. It is not the most powerful language, but it is more powerful than Cobol or machine language.

What’s the Blub paradox?

Nowadays we have many computer languages that claim (lets say that the programmers claim) that each one is better (more powerful) than the other cause the language A has a feature X that laguage B doesn’t, and then the language A programmer can’t understand how the language B programmers can do any thing with that language without the feature X. So we’ve got the “power comparison” between languages.

Paul Graham describes the Blub paradox in his Beating the Averages , where he talks about the power of LISP (that paper is worth reading).

…our hypothetical Blub programmer wouldn’t use either of them. Of course he wouldn’t program in machine language. That’s what compilers are for. And as for Cobol, he doesn’t know how anyone can get anything done with it. It doesn’t even have x (Blub feature of your choice).

As long as our hypothetical Blub programmer is looking down the power continuum, he knows he’s looking down. Languages less powerful than Blub are obviously less powerful, because they’re missing some feature he’s used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn’t realize he’s looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.

When we switch to the point of view of a programmer using any of the languages higher up the power continuum, however, we find that he in turn looks down upon Blub. How can you get anything done in Blub? It doesn’t even have y.

By induction, the only programmers in a position to see all the differences in power between the various languages are those who understand the most powerful one…

Must read:

Beating the Averages (Paul Graham)

How to become a Hacker (Eric Raymond)

A simple intoduction about myself.

Blub.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Divers | No Comments »

MediaWiki Editor!

By knuthy | juillet 10, 2008

These last days I’m learning SWT, to do so I started working on a MediaWiki Editor (syntax highlighting and some future funny stuffs) which is an idea from Elkhayam (Google is your friend).

While I was working on the RegExp’s I’ve got many problems with them, as the mediaWiki syntax is a bit strange. Here are my first problems with them (all about the Bold&Italic).

So the first thing is the bold , if we have a '''bold''' we should render a ”’bold”’; for ''italic'' we’ll have ”italic”, and for the '''''bold&italic''''' we’ll have ””’bold&italic””’
.

No problem till now, the first thing I thought about was “3 regexp for each case”, that was good till I found out that we can have '' '''bold&italic''' '' which will give same result as the 3rd case.

Still not big problem, just have to change the 3rd regexp so it accepts this case. While doing that (you figured it out :) ) I found out that this case '''''bold&italic''' italic'' (””’bold&italic”’ italic”)… As you can see, 3 regexp makes the work really hard (the hardest part is in the SWT’s editor part, getting style for each group, and so on…).

After a while, I got tired, and decided to see how wikiEd manages the highlighting, so I opened a page and started editing, and guess what? the last problem doesn’t work in wikiEd the result is a bit strange : ””’bold&italic”’ italic”

At the end, was going to give up, but decided to give it a last try before going to sleep… after some tests my last two regexp worked… Here are the two regexp’s I got at the end :

italicPattern="([^']|^)(('{2}|'{5})[^'\n]*('{3})?[^'\n]+('{3})?[^'\n]*('{2}|'{5}))([^']|$)"
boldPattern="([^']|^)(('{3,4}|'{5})[^'\n]*('{2})?[^'\n]+('{2})?[^'\n]*('{3,4}|'{5}))([^']|$)"

And here’s the result in the editor with StyledText

As my teach said “In computer sciences, nothing is impossible, you’ve just to be patient”

If you have any good regexp for the problem put it in comment please.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Divers, Java | No Comments »

[FX_Talk#1] JavaFX and Threading

By knuthy | juin 19, 2008

Here we go, today we’ll start some JavaFX examples and hacks to get through common problems (in fact, it’ll be the problems I encounter).

Today’s example will be about Threading. In the “old” version of JavaFX we’ve got the do/do later construct which handled most of the event processing problems.

Lets say we’ve made a button that when pressed fetch some data from the Internet, this kind of process if often recurrent. A simple but not “effective” one would be :

//some code
    MyCustomButton{
             //some code here...
             onMousePressed:function(e){
                        var result=fetchData();
                        displayFetchedData(result);
             }
    }

In this case after we press the button our interface will be unresponsive till the fetchData() function ends, and that could take longer time than expected.

A solution using do later was used in the JavaFX Script as a Web service client article.

Here’s a quote from the code:
Note:This code wont work in the current version of JavaFX nor in the future ones.

operation WeatherData.update(){
   var content = new StringBuffer("");
   do later {
      var url = new URL( source );
      var is = url.openStream();
      var reader = new BufferedReader(new InputStreamReader(is));
      var line;
      while (true) {
         line = reader.readLine();
         if (line == null) {  break;
         }
         content.append(line);
         content.append("\n");
      } // end while
      is.close();
      text = content.toString();
   } // end do later
}

The do later bloc enables you to run the inner code into an other thread which means that your interface wont stuck. However you wont be able to access any AWT member directly (some devloppers suggested the use java.awt.EventQueue.invokeLater for that problem).

Now that we exposed the two codes, that wont work well or even not compile, what will we do?
I had a problem like the one exposed upper, fetching RSS feeds, Google didn’t give any good result so I decided to use the old but good java.lang.Thread .

So, lets see our interface:

Titles from JavaFX netbeans plugin builds feeds, before and after button is pressed.

Lets see the code:
Note:I’m using rome library for Feed grabbing/parsing

FeedGraber.fx

 import javafx.gui.*;
 import java.lang.System;
 import java.net.URL;
 import com.sun.syndication.feed.synd.SyndEntryImpl;
 import com.sun.syndication.feed.synd.SyndFeed;
 import com.sun.syndication.io.SyndFeedInput;
 import com.sun.syndication.io.XmlReader;
 import java.lang.Thread;
 
 
 public class FeedGraber extends Thread {
    public attribute  titles:ListItem[];           //The result will be put here
    private attribute feedUrl:java.net.URL;
    private attribute entries:List;
    public function run():Void {
        try {
            var feedUrl = new URL("http://deadlock.netbeans.org/hudson/job/JavaFX_NB_daily/rssAll");
            var input = new SyndFeedInput();
            var feed = input.build(new XmlReader(feedUrl));
            var entries = feed.getEntries(); 
            for (i in [0..entries.size()-1]) {
                var element=entries.get(i);
                var entry = element as SyndEntryImpl ;
                insert ListItem{text:entry.getTitle()} into titles;
            }
        } catch (ex) {
            ex.printStackTrace();
            System.out.println("ERROR: " + ex.getMessage());
        }
 
    }
 
}

Now that we made our class that will grab all the titles for us, lets get over the Main.fx

Main.fx

import javafx.gui.*;
 
Frame {
    title: "FX_Talk#1"
    width: 250
    height: 300
    closeAction: function() { java.lang.System.exit( 0 ); }
    visible: true    
 
    var aggregator=FeedGraber{};
 
    content: BorderPanel{
        top:Button{
            text:"Fetch It"
            action:function(){
                aggregator.start();
                //some work here, this work will be done while the data collection
                //is in progress, we better add an animation here.
            }
        }
        center:List{
            items:bind aggregator.titles
        }
    }
}

We can see how much the binding is powerful in JavaFX, we just had to bind our List items to the public attribute of our instance of FeedGraber class.

See, not really hard, just fun and full of tricks.

Resources:
Current JavaFX API
Java Thread

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: JavaFx | No Comments »

Black Crows par “Mate Steinforth”

By knuthy | juin 18, 2008

Sans trop de parlote, la video parle d’elle même.

MTV HD Crow par Mate Steinforth sur Vimeo.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Divers | No Comments »

Plugin JavaFX pour Netbeans 6.1

By knuthy | juin 13, 2008

Plus la date de la sortie du “preview” du SDK JavaFX se raproche (Juillet), plus on voit les changements dans les différents builds du plugin JavaFX. J’ai télécharger le dernier build #58 qui date d’aujourd’hui , et ce qui m’a surpris c’est l’intégration d’une palette sur le bord.

Les nouveautés de ce plugin:

Le seul problème que j’ai rencontré jusqu’à maintenant ( 2h d’utilisation) c’est l’aperçu. En effet, quand l’aperçu est en train de se générer, il ne faut pas le fermer, sinon tout NetBeans bloque.

Liens:
Plugin JavaFX pour Netbeans 6.1
Compilateur JavaFX

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: JavaFx | No Comments »

Doodle #1 “remix”

By knuthy | juin 7, 2008

Il y a quelques jours j’ai installé le nouveau plugin JavaFX pour Netbeans 6.1, plusieurs choses on changées depuit la version interprétée. Avec le “compiled JavaFX” comme tout le monde le nomme, les performances ont été boostés, mais le langage lui même a lui aussi changé.

Joshua Marinacci dans son blog a plusieurs exemples de l’ancien JavaFX parmi eux il y a celui que j’aime bien pour son effet le JavaFX Doodle #1. Le code que vous voyez dans son blog n’est plus valable, vu que plusieurs choses on changés. Donc il serait plus judicieux de faire une réécriture à partir du zéro.

Voir les liens en bas du billet pour plus d’information.

Que fait le script?
Cet exemple représente un canevas noir dans lequel il y a des cellules. Ces cellules sont noires au début, et dés qu’on passe la souris par dessus elles passent au bleu puis perdent leur couleur jusqu’à redevenir noir.

package bluerect;
 
import javafx.ui.*;
import javafx.ui.canvas.*;
import javafx.animation.*;
 
class Cell extends Rect {
    attribute blue : Number=0;      // On initialise à 0 pour faire en sorte que 
                                    // les cellules soient noires au début.
    override attribute fill=bind Color.rgb(0,0,blue);   // On override l'attribut.
                                    // A chaque fois que blue change, fill changera
                                    // aussi. Un attribut qui est en "bind"
                                    // ne peut être modifié directement!
 
    init {                          // Le bloc init{} 
        width=20;
        height=20;
 
        onMouseEntered=function(e){
            var colorAnimation=Timeline{    // L'animation se fait maintenant
                toggle:true                 // avec les Timeline
                keyFrames:[                 // Les KeyFrame's représentent l'état
                KeyFrame{                   // de l'animation a un instant défini
                    time:0s                 // par l'attribut "time" et les valeurs
                    values:blue=>255        // de l'attribut "values", ceci se traduit par
                                            // A l'instant "time" initialiser les valeurs
                                            // définie dans "values"
                    },
                KeyFrame{
                    time:2s
                    values:blue=>0 tween Interpolator.LINEAR // Les valeurs intermédiaires 
                                            // entre chaque KeyFrame seront calculés avec
                                            // l'interpolateur défini après le "tween"
                                            // Voir l'API JavaFX pour connaitre 
                                            // les Interpolator's disponible
                }
                ]
            }
            colorAnimation.start();         // Ceci permet de lancer l'animation
        }
}
}
 
var grid:Rect[];                            
for(j in [0..10]) {
    for(i in [0..30]) {
        insert Cell { x: i*21, y: j*21 } into grid;     // On insert dans un tableau les cellules
    }
}
var finalContent=Group{ content: [Rect { x: 0,
                                         y: 0,
                                         width: 31*21,
                                         height: 11*21,
                                         fill: Color.BLACK
                                         },
                                     grid
                                     ] };
Frame {
    width:31*21
    height:11*21
    visible:true
    content:Canvas { 
        content: finalContent,
        cursor:Cursor.CROSSHAIR
    }
}

Liens: (Tout est en anglais, c’est pas encore documenté en Français)
Les animations en JavaFX compilé
L’API JavaFX (non complète, mais assez utile)
Les changements entre l’ancienne et la nouvelle syntaxe
Le blog incontournable de Chris Oliver
Ressources JavaFX

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Divers, JavaFx | No Comments »

Sabayon

By knuthy | mai 27, 2008

La maintenant, pendant que j’écris ce billet j’installe Sabayon Linux 3.5 Loop3, c’est une distribution Italienne basé sur Gentoo.

Au boot, on voit un screen comme celui du boot d’ubuntu: Mode graphique, mode graphique sans musique, surf anonyme sur internet, installation graphique et mode texte.

Quand j’ai lancé le liveDVD (première option), au moment de l’affichage de l’environnement graphique j’ai eu … un écran noir, et mon écran est passé en veille… un moment de réflexion… bingo! Sabayon utilise les drivers de Nvidia proprio par défaut! Car ma carte graphique a ce problème sur la fiche DVI il faut corriger ça dans le xorg.conf pour que les drivers proprio marchent.

Pas grave, je branche sur le VGA (écran vert… problème sur ma carte graphique), et je relance. Dés que le système boot je vois le splash de Nvidia avec “beta” en bas (c’est le driver 173.08 beta, le tout dernier de Nvidia) , je m’identifie (user/pwd déjà pret) et j’ai un message m’invitant à choisir entre une expérience desktop standard ou extrême :D, vous l’avez devinez, je choisis la seconde!

Le bureau se lance, un KDE qui ressemble à un KDE 3.5.8 avec une barre en haut (l’inverse de Gnome), très fluide, compiz activé, et plein d’icones sur le bureau parmi elles on voit “Battle for wesnoth”, “Second Life”, “Nexuiz”, “Google Earth”… etc. Par curiosité je lance le premier, un jeu vrai semblablement un RPG en 2D, ce qui ma intrigué c’est la vitesse à la quelle il se lance, j’essaye Google Earth, même chose c’est presque (voir même plus rapide que mon Ubuntu installé sur disque :s).

J’ouvre le menu, ça ressemble au menu de KDE 4, pas 3.5.8, je navigue… et oui, c’est KDE 3.5.9! Je lance L’install on disk, une fenêtre qui ressemble à l’installeur de Fedora s’affiche, le truc qu’on remarque (qui ressemble vraiment à celui de Fedora) c’est le choix des environnement graphiques à installer (KDE, GNOME, FluxBox, XFCE ou rien), la fenêtre suivante c’est les catégories de packages à installer, puis une autre avec une liste détaillée des packages à installer, on remarque plusieurs codecs, codecs vidéo et drivers graphiques enfin tout ce qui est nécessaire pour une bonne expérience desktop.

L’installation est un peu longue (peut être que c’est à cause de mon lecteur) mais vu le nombre de packages qu’il va installer on n’en doute pas une seconde.

Donc, en fin de compte, le LiveDVD est très fluide et riche en applications. Coté installeur, tout est apprécié sauf la lenteur de l’installation (plus lente que celle de la Fedora).

Il y aura un prochain billet pour parler de ce qui se passe après installation :)

Aller, moi je vais continuer à jouer un peu à Sauerbraten qui est lui aussi installé, et je peux vous dire que c’est très fluide (je suis en LiveDVD :), c’est probablement ça qui rend l’installation lente ? :D )

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Linux | No Comments »

Alors que Sun fait appel aux autres technologies, Microsoft joue la carte du solo!

By knuthy | mai 26, 2008

On se retrouve dans un vrai MMORPG. Steve Ballmer a écarté tout rapprochement de technologie entre Microsoft Silverlight et Adobe Flash, en ajoutant “Nous sommes en concurrence avec Flash [...] Je suis ouvert à tout mais il n’y a vraiment pas de discussion de fusion avec Adobe. Les développeurs devraient tous apprendre à se servir de Silverlight“.

En parallèle Sun, avec son JavaFX, préfère jouer en group (Plus on est de fous, plus on avance), Bob Brewin (CTO à Sun) a déclaré que Sun a passé un acord avec On2 Technologies pour l’intégration de leurs codecs à JavaFX et ainsi avoir une grande compatibilité. Ce qui offrira une qualité de vidéo supérieure à celle qu’offre Adobe Flash. Ces capacités seront disponible dans le JavaFX SDK de juillet.

Coté développeurs, JavaFX fournit un plugin déjà existant pour NetBeans, mais aussi un outil de transformation qui lie des produits de design comme Adobe Photoshop ou Adobe Illustrator vers JavaFX.

Il est aussi a noté que Sun a déclaré sa propre acceptation de différent langage de script tel que Ruby et Python sur leur Java Virtual Machine.

Vivement Juillet!

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google

Topics: Divers, Java | No Comments »

« Previous Entries