Duff show

février 14, 2008

html5 working draft published!

Classé dans : Technology, development, new technology, open source, web 2.0 — duff @ 1:14

Since 1999, there is no new features in HTML language.

The language is really poor and have not evolved with the needs of user. To fix that, we can use javascript to manipulate the DOM but it is take a lot of lines of code to do small things. We have AJAX to have better performance by not refresh the whole page.

And we have Flash, Silverlight, Moonlight, XUL,… which are basically plug-in over your browser to add a lot of cool things to your browser.

And a lot of people talked about who will win … but we have forget the HTML standard which have not evolved during a long time. The working draft of HTML 5 seems very promising.

This is a working draft, so all can evolved but we can see what they want to do…

To sum up they add a lot of missing things witch is done with AJAX, javascript, …

So, I will try to sum up what we will have in this HTML5:

  • Document structure: section, header, footer, article, aside will be useful to cut your document in area
  • Multimedia flag: video, audio will replace the object flag and will be more easier to use and canvas will allow dynamic drawing (ever in Firefox 2)
  • forms: the specification of WHATWG show what will be done here. But nothing is currently in the working draft. But we can hope new input attributs: calendar, timepicker, email, … and repeater to avoid to have a list same flags…
  • new controls: Datagrid to make tabular or hierarchical set of rows of elements. progress and meter will be cool to show to user that he have to wait. it is better than a GIF or an Ajax progress bar. And we have some other things as command and menu
  • area post: it will replace Ajax for a lot of things… here we have datatemplate, rule and nest flag to manage the template dynamically. I have not understand all here but sounds promising….
  • storing data in database: but in local and this will be persistant during the session.
  • catch drag&drop without javascirpt ;-)

This draft will evolved maybe in good maybe in bad way but hope standard will bring a lot of missing things. I do not think we will have all features of flash/silverlight in HTML5 but we will get a lot of cool new things. We will still be far from rich browser plugin but we get lot of cool new things in standard…

août 28, 2007

image resizing

Classé dans : Technology, development, new technology — duff @ 5:56

Seam Carving is a new algorithm to resize an image by ading or removing some layer in the image. This algorithme is so powerfull that you can make someone disapear from a photo!!

Here is another image algorithme from microsoft (photosynch) which can take a photo and rebuild a 3d environment.

You have all algorithme which analyse an image to get strange behaviour or character recognition…

A lot of other algorithme use the artificial neural network to have result. This kind of algorithme is based on human system. This system will have 2 states:

  • the first state who learned from reallife result.
  • the second one witch take a decision from what it have learned. In this state it can be wrong. The more you make the system learned in first state, the more you will have good result.

This system can be good to analyse complexe system as meteo, optical character recognition, stock exchange, …

août 22, 2007

Compiz released!!

Classé dans : News, new technology — duff @ 1:18

Compiz have a lot of activity during summer !!

A new release is just out. The 0.5.4 is very important because it is thefirst release with the merge of fork of compize (Beril, compize.Extra) and compize. Now we have a system more stable, more flexible and with a lot of new plugin. This merge will lead to a real integration in a lot of linux distrib.

The logo have change too!

compize logo

Small video of a new features:

juillet 30, 2007

refresh silverlight

Classé dans : .NET, new technology — duff @ 3:55

A small refresh of the previous release have been done and contains a lot of bugfix in the engine! It is just a refresh. So do not hope to have a real release but you will found a lot of bugfix.

You can read it on the blog of Tim.

Here you have link to download it!

SVG vs Moonlight

Classé dans : Mono, News, linux, new technology — duff @ 6:28

We have a lot of demo for silverlight which can be used for moonlight.

And Vladimir have done a demo to show that SVG can done the same thing and is fully open source.

Even if MS is behing SilverLight it is open source for main part and remake for other part.

So you can compare it here :

svg

It is really slow but works and now silverlight:

silverlight

To conclude, it is quite the same thing even if Silverlight/moonlight have more image and is a lot faster. So SVG need a real performance improove to become usable in web development.

juillet 18, 2007

desktop 3D

Classé dans : News, new technology — duff @ 3:43

I have ever talked about this funny desktop.

I am not sure that it is really great to work with file.

but It will be comercialize a day! And we have now a real compagny behind this project name bumptop. Is he the new bill gates?

juin 21, 2007

performance

Classé dans : Mono, Technology, development, new technology — duff @ 6:52

Il y a pas mal de temps, j’etait un membre actif de DOLServer qui est un emulateur de serveur DAOC entièrement ecris en C#.

Dans un soft server on a souvent a faire attention au performance. Il faut dire que l’on est parti avec un server qui pouvait acceuillir 30 personnes et qui prennais 100% du CPU et 900 Mo de ram et que l’on a fini à une utilisation normal du CPU et de la memoire (je n’ai pu les chiffres en tête) et surtout du coup la capacité d’avoir sur une machine classique jusqu’a 300 personnes sans problème. On a aussi améliorer le temps de lancement en passant de 6 minutes a 30 secondes…

Tout cela, n’est pas un miracle… cela vient surtout d’optimisation de plusieurs modules clés. En l’ocurance l’access à la Database qui est souvent ce qui ralentit le plus. La gestion des packets de données recu et émis. Ces 2 systemes on été grandement améliorés par l’utilisation de cache et le banissement de relation au niveau des requetes qui nous faisait faire n+1 select. Problème souvent rencontré dans hibernate. Je ne m’etends pas la dessus cependant on fait souvent cela sans s’en rendre compte et pas que dans hibernate.

Je sais que meme en construisant une requete, on est souvent appelé a prendre tout ce qui n’est pas déjà dans une autre table et on fait un “not in” et la les performance chute. En effet, en fait le “not in”/”in” dans une requete fait qu’il va relancer la requete pour chaque passage. Je suis passer de 30 a 0.75 secondes sur une seul requete comme ca.

select * from ma_table
where id not in (select id from ma_table_d_archive)

devient

select * from ma_table t,(select id from ma_table minus select id from ma_table_d_archive) a
where t.id = a.id

ou encore  avec le “not exists”/”exists”

select * from ma_table t
where NOT EXISTS (select ‘1′ from ma_table_d_archive a WHERE t.id = a.id)

ou par la création d’une table temporaire:

create table temp as (select id from ma_table minus select id from ma_table_d_archive).

Tout cela n’a pour but que d’eviter le recalcule de la 2eme requete a chaque passage dans la première.

Une autre astuce: est de créé des index pour améliorer la recherche et les forcer a l’utilisation si le SGBD prends le mal ( voir le plan d’execution)
Une autre astuce (bis): Si vous faite beaucoup d’insertion dans une DB, on supprime les index et on les recré après.

On aussi fait un thread spécialement dédié à la sauvegarde qui tourne en boucle et sauve toute les 10 minutes. Cela évite de sauver toutes les 5 secondes parcequ’un joueur change de position. Bref, pensez à quel champs/table doivent etre en base en continue car critique et quel champs peuvent perdre 10 minutes de temps en cas de crash.

Après bien sûr pour le code il n’y a pas de règle sauf une testé, testé et encore testé!! Et oui il faut testé et c’est bien souvent comme ca que l’on voit ce qui est lent dans le code. Comme j’ai déjà fait le travail dessus. Les delegates sont super lent en .NET 1.1 (beaucoup plus rapide en .NET 2.0) et les locks peuvent conduire a des grosses perte de temps car cela fait dormir un thread en attendant qu’un autre est fini.

Pour le reste des modules, nous avons le WorlManager qui s’occupe de retrouver une personne ou un objet dans le monde et très souvent on veux tout ce qui se trouve dans une aire circulaire autour du joueur qui est plus ou moins grande (quand il parle, pour mettre a jour les items, quand il change de vetement,…). Ce module était clé car il est appelé souvent et il est surtout très lent. Je ne vais pas vous faire tout l’historique cependant voici ce qu’on avait a l’origine:

un systeme qui testait 1 par 1 tous les objets et qui calculait la distance entre notre joueur et les objets de la carte.

Nous avons commencer par séparer les objet du monde par type ( item, joueur, porte, …)

Puis nous avons fait uniquement les test dans la zone du joueur (et les zones adjacentes) .

world manager sans optim

Puis nous avons fait un systeme de sous zone ou on testait les zone non vide. Ce qui bien plus rapide car on ne test que les 2 coins de la zone. Donc, dés qu’il y a plus de 2 joueurs dans la zone c’est top.

world manager avec optim

Ce systeme fonctionne en fait par dicotomie.

Nous avons aussi redeveloppé notre propre system de hashtable qui fonctionnait aussi par dicotomie. Un entier servant de flag pour les 32 prochaines places. Je m’explique, nous avions en plus de notre collection d’objet une collection de int. Et chaque bit du int servais a indiquer si la place correspondante etait vite ou non. Ce qui permet de trouver vite les place libre avant de faire grossir sa collection pour rien. Ici on aurait pu utilise 2 liste chainé ( une pour le plein et l’autre pour le vide).

collection

En fait tout cela rejoint une notion très importante que je cachais sous l’utilisation de dicotomie et qui est la complexité.

La complexité qu’est ce que c’est et bien c’est une notion mathematique qui dit de combien d’evenement maximum vous aller faire pour faire ce que vous voulez.

Par exemple, vous rechercher un nombre dans une suite de nombre (1 a 10 par exemple). Quel est la meilleur facon d’avoir le resultat rapidement?

Au première abord on fait comme suit:

Est ce que c’est 1?
Est ce que c’est 2?
Est ce que c’est 3?
.
.
Est ce que c’est n?

On dit alors qu’il faut parcourir n fois au maximum la list pour trouver notre nombre. Donc c’est une complexité d’ordre n (grand Tau de n mais bon on fait l’abus de language…)

Autre methode maintenant je pose un autre type de question:

Est ce que c’est supérieur a n/2 ?
Est ce que c’est supérieur n/4 (respectivement 3n/4) ?
.
.

On voit bien vite que notre problème sera résolue plus rapidement avec 10 la première fois 10 iteration avec la 2eme methode (en 3 ou 4 fois c’est plié). Ici on dit que la complexité est de type log (n).

D’ailleur en therme probabiliste,pour 10, l’esperance de gain est de 11/2 (=Sum(1,10,1/10)) pour la premiere methode et de 17/5 (=3 x 6/10 + 4 x 4/10) pour la 2eme. Or 17/5 >11/2. Donc déjà pour 10 on va netement plus vite…

Sans s’en rendre compte on vient en fait de testé les arraylists toute betes et les arbre AVL. Personnelement, j’ai utilisé des splay tree qui sont presque la meme chose que les arbres AVL et c’est vrais que le gain de performance a la recherche est impressionnant.

Pour résumer voila les diferrentes complexités:

Notation Type de complexité Exemple
O(1) complexité constante (indépendante de la taille de la donnée) une liste a 1 seul element
O(log(n)) complexité logarithmique arbre avl, splay tree, arbre binaire en e generale…
O(n) complexité linéaire itération sur une liste simple d’objet (arraylist, array d’objet ),…
O(nlog(n)) complexité quasi-linéaire -
O(n2) complexité quadratique tout ce qui est trie (sortlist ou list.sort par exemple),produit cartésien de 2 table en BDD,…
O(n3) complexité cubique -
O(np) complexité polynomiale -
O(nlog(n)) complexité quasi-polynomiale -
O(2n) complexité exponentielle -
O(n!) complexité factorielle -

remarque: l’hashtable n’est pas de rang n je pense car elle utilise une table de hashage pour retrouver plsu vite ses element et je ne sais pas si il n’y a pas quelquechose genre splay tree pour la table de hashage…

On notera que la complexité est vallable pour les listes avec beaucoup d’element car on néglige des thermes qui quand on a peu d’element devienne plus trop négligeable.

  • Utiliser des caches
  • Retravailler vos requetes et specialement les jointures (2 selectAll que l’on raccroche coté code valent mieux qu’un produit cartésien n*m selects)
  • jamais de in/no in dans une requete en base
  • créé des index
  • quand on ajoute beaucoup d’élements, on supprime les index pour les recréé après.
  • penser par dicotomie et spécialement a toujours avoir une compléxité en log (n) sur les modules clés
  • testé la rapidité de vos codes
  • utilisé des listes appropriés (listDictionnary pour les petites listes et hashtable pour les grosses par exemple en C#)
  • testé
  • et encore testé

juin 13, 2007

application block

Classé dans : Mono, Technology, development, new technology — duff @ 9:13

What is application block?

When you start to develop more than 2 applications, you will see that we have some part of code in common. All this common part, db layer, caching system, authentication process, File export, reporting, file import, configuration, log system, … are the block application!

In a lot of firm we used a Toolbox where we find all this kind of application block to share it across all project.

Microsoft have released some application block long time ago but it have never been really used by Dev. Here or here, or even Part1, Part2 you have good tutorial about that.

In another part of the web, you have something marvelous which release name Ruby on Rails which is a framework + Tools to generate all by template. It is good for web but nothing for Winforms, only on ruby. But a lot of other little son appeared for other language (Monorails for .NET, Django for python, …)

What we see here is that Ruby made something totally expandable with some basic example. Sharing tempalte is really important and the issue with basic ToolBox is that it is used only in one entreprise. So we have not the power of community. Community is always better above all. Wikipedia, open-source project,… are just few example of community powerful. Tool are not linked to a non free IDE (do not need Visual Studio…). Ruby not have only template of business class but too for view part. Ruby make the structure too. So lot of other things in ruby in fact…

At the End VS2005 make snipset in VS2005 to have small template system. But we still have nothing for structure and db layer and view template, business template…

Microsoft have released some framework WWF(workflow) , WCF(communication), WPF & Silverlight(presentation), LINQ(database and Xml), … And finally it is not so good.WWF bring work-flow but is far from a work-flow application as Worky or WorkflowGen. WCF only manage service to trigger action but we have nothing about data file transfer. WPF is realy cute but no template or automation here.To much complicated and no console tool or good GUI… You always have to write XML file so we change the language to gain some lines but nothing as good as ruby. No auto generation thanks to template system.

MS have done too profiler for .NET 2.0. So a lot of thing but nothing really easy to used /user friendly and quick. Nothing which rox all. We have framework syndrome with some expandable class but no real business class to used. It give some authentication process but nothing to say, I want to authenticate via user table in DB or via Active directory, or even via config file…

So, .NET need a real tool to make not only template as ruby but to manage small template (snipset) , middle template ( controller, viewer, model) and Big template (authentication process, File importation, Search Engine, File exportation, work-flow, …). So all we see is different little framework but not a big framework which done all, expandable, centralized, pluginable , which can be linked to IDE or console, cross-language, cross-platform, open source,… To sum up which take power of community with all basic things in it.

I hope I will see something similar in Mono. I know that just a dream but we really need it to have not to always reinvent the wheel.

juin 12, 2007

I-PHONE

Classé dans : News, Technology, new technology — duff @ 2:26

L’I-Phone va-t-il révolutioné le monde des portables comme I-Pod celui des lecteurs MP3?

C’est la question que beaucoup se pose.

Voici déjà les specs technique du I-Phone disponnible:

specs i phone

Screen size 3.5 inches
Screen resolution 320 by 480 pixels (160 ppi)
Input method Multi-touch
Operating system OS X
Storage 4GB or 8GB
GSM Quad-band (850, 900, 1800, 1900 MHz)
Wireless data Wi-Fi (802.11b/g) / EDGE / Bluetooth 2.0+EDR
Camera 2.0 megapixels
Battery
Up to 5 hours Talk / Video / Browsing
Dimensions 4.5 x 2.4 x 0.46 inches / 115 x 61 x 11.6mm
Weight 4.8 ounces / 135 grams

Et quelques videos des pubs pour le i-phone!

juin 11, 2007

Linker and mkbundle

Classé dans : Mono, new technology — duff @ 12:44

Linker is a beautiful tool build by JB based on Cecil lib.

It inspect assembly to get what external call is used and reduce all assembly to have the smaller one.

The best friend application of linker is mkbundle which can ship all assembly/exe in one single exe/assembly. MkBundle add a launcher to run it without mono or dotnet runtime. So really great!!

With this 2 applications you can make a single exe without need of framework install.

The final peanuts is the compilation ahead of time. It precompile the code. The issue with that is that it become plateform dependant. But no need of just in time compilation because all is precompiled. So you go a lot faster with it.

So all this things is not really news but is great to make a fast and simple exe.

We have use it in monoTorrent with success ( no AOT to be cross plateform).

But, JB work on it and have add some features. Hope he will realease soon the Linker 2.0

I see in last post mscorlib.dll is reduced for moma. So, we have 1 features of 2.0.

Linker use cecil which is a static analyse of assembly. So, if you call something dynamicly, Linker will not ship it and it will never worked. But JB always find solution. He used xml to warn linker about dynamic reference. To help developer you can use a great profiler which is able to generate an xml which contain all dynamic call for Linker.

It is a bit complicated but it work. Best is done a little script which call mono with this profiler and call the linker assembly with the xml generated when it found dynamic reference.

Imagine how it can be powerfull to use all this stuff in a Nant file. With all this external stuff nant become more and more useful to customize our build with great tool as Linker, Gendarme, Nunit, NCover, Cruisecontrol

Publié sur WordPress.