• Blog
  • À propos
  • Mes dessins
  • Contact

Programmation

PhiLho tech web log

Mon blog technique, artistique, d’humeur... Continuer »

Sorting strings by respecting natural order for numbers - 6 October 2012

A function that is useful is a comparator of strings (for sorting purpose, in general) that respect the natural order of numbers.

So when we have a list of strings, like file names, for examples, with numbers in them, it is better to respect the numerical order when strings are equal.

A common case is numbered names: a trivial, lexicographical order would be:
foo-1
foo-10
foo-11
foo-2
...
foo-9

where one expects:
foo-1
foo-2
...
foo-9
foo-10
foo-11

I show here how to do such comparator.


Continue reading "Sorting strings by respecting natural order for numbers"

Philippe Lhostein Java   Saturday 6 October 2012 à 19:27
2 Comments Link to entry

Is this string a number? - 6 December 2010

A blog post (Double Parsing Regexp) caught my attention. The base problem is to check if a string is a valid number, without necessarily needing the real value. Or, perhaps, to skip the conversion if we are sure it will fail, as Double.valueOf throws an exception in this case, and the try/catch mechanism is known to be slow.

The numbers given were intriguing, and I wondered if the given regular expression could be optimized. Somehow, it was a great opportunity to use Caliper a library to do correctly micro-benchmarks.


Continue reading "Is this string a number?"

Philippe Lhostein Java   Monday 6 December 2010 à 07:21
Add Comment Link to entry

Building and running Scala programs with Gradle - 1 November 2010

I recently started to learn Scala, an interesting language in the (very strongly) statically typed category. So far, I only compiled single files with little or no dependency, so the command line was good enough. Now, I start to try small sample files with a rather complex classpath (using Piccolo2D and Pivot), so I searched something more sophisticated.

The main constraint was to be able to compile and run Scala programs, using my local copy of Scala compiler, and the local libraries where I gather them. I soon discovered it is now a quite unusual setup...


Continue reading "Building and running Scala programs with Gradle"

Philippe Lhostein Scala   Monday 1 November 2010 à 17:54
Add Comment Link to entry

Premiers pas avec Scala - 7 September 2010

Je me suis enfin mis à Scala ! (depuis deux semaines à peu près)

Ça faisait un moment que je voulais m'y mettre. J'ai atteint un niveau décent en Java, et je voulais explorer un langage un peu plus souple, n'ayant jamais apprécié les classes anonymes, surcharges de méthodes pour gérer les paramètres optionnels et autres lourdeurs de Java. Sans parler des incohérences hérités du C.

J'ai balancé un moment entre Groovy et Scala (Clojure : pas fana de Lisp, même si j'ai appris Scheme pour faire des scripts dans Gimp ; JRuby : ressemble trop à Perl ! Jython : pourquoi pas, mais plus tard). J'ai fini par basculer vers Scala !


Continue reading "Premiers pas avec Scala"

Philippe Lhostein Scala   Tuesday 7 September 2010 à 16:49
Add Comment Link to entry

JavaFX: 3000 Chars for a Crystal Clock - 30 September 2009

Recently (beginning of this month), Josh Marinacci proposed on the JFXStudio site a Challenge: Small is the New Big. The goal is to write a short but spectacular JavaFX program on a given theme. The theme was revealed shortly after: Time.


Continue reading "JavaFX: 3000 Chars for a Crystal Clock"

Philippe Lhostein JavaFX   Wednesday 30 September 2009 à 23:30
11 Comments Link to entry

Une loupe en JavaFX - 30 August 2009

Dans le forum JavaFX de Sun, quelqu'un a demandé How to implement magnify glass effect? (Comment implémenter un effet de loupe ?). J'ai trouvé le challenge intéressant, et après quelques fausses pistes et périodes où j'ai fait autre chose, j'ai fini par atteindre un stade utilisable.


Continue reading "Une loupe en JavaFX"

Philippe Lhostein JavaFX   Sunday 30 August 2009 à 15:15
Add Comment Link to entry

A magnifiying glass in JavaFX - 30 August 2009

In the Sun JavaFX forum, somebody asked How to implement magnify glass effect? I was interested by the challenge, and after some dead end trials and on/off periods of coding, I reached a usable state.


Continue reading "A magnifiying glass in JavaFX"

Philippe Lhostein JavaFX   Sunday 30 August 2009 à 12:33
Add Comment Link to entry

Internationalisation des sketchs Processing (et des programmes Java) - 28 August 2009

Suite à une question dans le forum de Processing (Localization [ i18n ] - go there if you can't read French, most of the info here is there), je me suis penché de plus près sur le système d'internationalisation de Java.

L'internationalisation (i18n en abrégé : 18 lettres entre i et n...) de logiciels est un point important pour une utilisation aisée dans tous les pays. Cela comprend non seulement la traduction des textes, mais aussi la prise en compte des particularités de chaque pays (localisation, ou l10n), comme les séparateurs de décimales et de milliers, l'écriture des dates, la gestion des pluriels, etc.

Je me suis aperçu que pour Processing, il fallait contourner certains obstacles pour parvenir au résultat. Je livre ici mon expérience, dont une partie est utilisable directement dans Java.


Continue reading "Internationalisation des sketchs Processing (et des programmes Java)"

Philippe Lhostein Processing   Friday 28 August 2009 à 23:55
Add Comment Link to entry

Attention au système de déduction de type de JavaFX ! - 20 June 2009

Certains raccourcis de codage offerts par JavaFX, qui sont sympas quand ils sont pris séparément, peuvent constituer une combinaison mortelle quand ils sont utilisés ensemble...


Continue reading "Attention au système de déduction de type de JavaFX !"

Philippe Lhostein JavaFX   Saturday 20 June 2009 à 11:33
Add Comment Link to entry

Beware of JavaFX's type inference! - 20 June 2009

Some programming shortcuts offered by JavaFX, nice when taken separately, can be a deadly combination when used together...


Continue reading "Beware of JavaFX's type inference!"

Philippe Lhostein JavaFX   Saturday 20 June 2009 à 09:39
2 Comments Link to entry

Déformations par déplacement des pixels en JavaFX - 3 April 2009

Encore une applet JavaFX pour répondre dans les forums Sun: Effect FloatMap (see this thread if you don't read French!). J'aime bien ces questions me permettant d'explorer quelques coins méconnus (par moi) de l'API.

Ici, il s'agissait d'une question sur FloatMap, m'amenant à m'intéresser à DisplacementMap.


Continue reading "Déformations par déplacement des pixels en JavaFX"

Philippe Lhostein JavaFX   Friday 3 April 2009 à 23:28
Add Comment Link to entry
« previous page   (Page 1 of 2, totaling 14 entries)   next page »

Catégories

  • XML Agacements typographiques & irritations sémantiques (5)
  • XML Programmation
  • XML Lua
  • XML C/C++
  • XML Java (2)
  • XML AutoHotkey
  • XML Expressions régulières
  • XML Processing (2)
  • XML JavaFX (8)
  • XML Scala (2)
  • XML Logiciels
  • XML SciTE
  • XML Arts (2)
  • XML BD
  • XML Animation
  • XML Illustration
  • XML Musique
  • XML Général (2)
  • XML Web (1)
  • XML JavaScript
  • XML PHP
  • XML (X)HTML, CSS
  • XML Humour, humeur et autres opinions (2)
  • XML Technique (1)


All categories

Calendar

« May '13 »  
Mo Tu We Th Fr Sa Su
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Archives

  • May 2013 (0)
  • April 2013 (0)
  • March 2013 (0)
  • Recent...
  • Older...

Syndiquer ce Blog

  • XML RSS 1.0 feed
  • XML RSS 2.0 feed
  • ATOM/XML ATOM 1.0 feed
  • XML RSS 2.0 Comments
  • Add to Google

© PhiLho / PhiLhoSoft | Site principal      Design par PhiLho (basé sur un template de ceejay/Carl Galloway) | Motorisé par SerendipityAdmin