• Blog
  • À propos
  • Mes dessins
  • Contact

PhiLho tech web log

Programmer, écrire, dessiner, rêver...

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

Gimp 2.6: Copy transparency from one layer/image to another - 3 May 2011

I had to make a rollover image: a copy of an image with slightly different colors.
Editing with Gimp 2.6, I just copied the image and altered the colors, but then I adjusted the transparency of the original image (smoother transition from opaque to transparent) and I wanted to copy the transparency information to the rollover image. For some reason, I didn't want to redo the color change again.


Continue reading "Gimp 2.6: Copy transparency from one layer/image to another"

Philippe Lhostein Arts   Tuesday 3 May 2011 à 20:32
1 Comment 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

Google Chrome : premières impressions - 21 January 2010

Test de Google Chrome 3.0.195.38 le 12 janvier 2010.

Ça faisait un moment que je voulais l'essayer, au moins en tant que webmaster, vu qu'il faut tester les pages sur un maximum de navigateurs. J'ai attendu qu'il se stabilise, puis j'ai un peu oublié.
Leur publicité (pour un produit gratuit !) sur les murs du RER parisien et en couverture d'un journal gratuit (entre autres) a servi de rappel (donc... c'est efficace). Je soupçonne Google d'avoir demandé aux sites qu'il mentionne dans ses publicités d'aider à financer la campagne...

Premier contact : désagréable !
J'ai détesté la procédure d'installation... Je peux comprendre la volonté de simplifier la vie de la plupart des utilisateurs, mais cela ne devrait pas exclure un paramétrage fin par ceux qui savent ce qu'ils font...


Continue reading "Google Chrome : premières impressions"

Philippe Lhoste  Thursday 21 January 2010 à 15:00
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
« previous page   (Page 1 of 3, totaling 29 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