by Artmalté
Thursday, September 12, 2013
Thursday, August 1, 2013
Fun with NativeBoost
Thanks to Igor and RMoD team, I could learn NativeBoost and create bindings for Xlib.
X11 NativeBoost fun from Laurent Laffont on Vimeo.
Inspect Pharo changes file
Here's a little trick from Igor to format .changes files on a console:
tail -f -n 50 my_images.changes |tr "\r" "\n"
Wednesday, April 18, 2012
Pharo 1.4 with Tiling Window Manager and more
With the release of Pharo 1.4 I've created my new custom image with TWM, Nautilus, Autotest and ProfStef. Here's the download link
Saturday, February 11, 2012
FOSDEM 2012
This was my first FOSDEM and with no hesitation that's the most fun event I've ever participated. The Hackerspace Bytenight was amazing, listening 8-bit remixed music from 90's video games, drinking good Belgian beers and talking with fun people.
I found a place to sleep for four days through CouchSurfing (I've also discovered BeWelcome recently), it seems the best way to enter Brussel's life.
On sunday John Thornton and I gave a talk on Amber Smalltalk - you can view slides online. Johnny arrived from the USA only five minutes before the talk, he's definitely an agile developer ;) We had some fun presenting Amber and the room was almost filled. We wanted to show real working code, integration with Javascript and Nodejs goodies. It's nice to use dynamic slides with Amber.
Marcus explained Pharo's vision before our talk. Huge work has been done, huge work ongoing. I'm looking forward to the Pharo Consortium.
After talking with several people we went back to the Smalltalk devroom. I discovered the Spoon project by Craig Latta. It's a minimal Smalltalk that can be remotely browsed from Squeak.
Then took place an introduction to Smalltalk workshop. Experienced Smalltalkers paired with newcomers to test and add new features to a Seaside application. The idea is nice and allows to listen to people feelings while discovering a new tool.
I finally put real faces on people only known on mailing-lists. Sad we did not managed to have more discussion. One day is short and so much to see...
Thank you Stephan. So nice things can emerge from a single tweet :)
I found a place to sleep for four days through CouchSurfing (I've also discovered BeWelcome recently), it seems the best way to enter Brussel's life.
On sunday John Thornton and I gave a talk on Amber Smalltalk - you can view slides online. Johnny arrived from the USA only five minutes before the talk, he's definitely an agile developer ;) We had some fun presenting Amber and the room was almost filled. We wanted to show real working code, integration with Javascript and Nodejs goodies. It's nice to use dynamic slides with Amber.
| Photo by Damien Pollet |
Marcus explained Pharo's vision before our talk. Huge work has been done, huge work ongoing. I'm looking forward to the Pharo Consortium.
After talking with several people we went back to the Smalltalk devroom. I discovered the Spoon project by Craig Latta. It's a minimal Smalltalk that can be remotely browsed from Squeak.
Then took place an introduction to Smalltalk workshop. Experienced Smalltalkers paired with newcomers to test and add new features to a Seaside application. The idea is nice and allows to listen to people feelings while discovering a new tool.
I finally put real faces on people only known on mailing-lists. Sad we did not managed to have more discussion. One day is short and so much to see...
Thank you Stephan. So nice things can emerge from a single tweet :)
| Photo by Adriaan van Os |
Friday, October 7, 2011
Emacs and J2EE on OSX notes
Here's how I've managed to setup Emacs for J2EE / Tomcat / Maven application development on OSX.
As the build will invoke emacs in batch mode, be sure that Emacs 23.3 is in your path (instead of using the one packaged with OSX).
What works on my machine:
Now open a .java file within Emacs.
Try malabar-jump-to-thing on one of your class and it should open the corresponding file.
Open a test file and try malabar-run-test. It should run maven test for this file. If all tests OK but finished with "BUILD FAILURE", then see next section
Install Emacs
I use Emacs 23.3 from Emacs for OSX.Malabar mode
Malabar mode offers easy code navigation, Maven, JUnit and Groovy integration. Download release 1.4 and extract in a directory to build it.As the build will invoke emacs in batch mode, be sure that Emacs 23.3 is in your path (instead of using the one packaged with OSX).
What works on my machine:
unzip espenhw-malabar-mode-malabar-1.4.0-0-g35e1e5e.zip
cd espenhw-malabar-mode-1daaee4
export PATH=/Applications/Emacs.app/Contents/MacOS:$PATH
mvn package -DskipTests=true
Now in target directory there's a malabar-1.4.0-dist.zip. Unzip it where you put all your emacs librairies:
cd ~/.emacs.d/
unzip /path/to/malabar/target/malabar-1.4.0-dist.zip
Configure Emacs for Malabar
Open your .emacs and add:(add-to-list 'load-path (expand-file-name "~/.emacs.d/malabar-1.4.0/lisp/"))
(require 'cedet)
(require 'malabar-mode)
(setq malabar-groovy-lib-dir "/path/to/malabar/lib")
(add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode))
(semantic-mode 1)
(require 'malabar-mode)
(setq malabar-groovy-lib-dir "~/.emacs.d/malabar-1.4.0/lib"
malabar-load-source-from-sibling-projects t
malabar-extra-source-locations
'( "/absolute/path/to/project1/src"
"/absolute/path/to/project2/src" ) ) ;; you need to setup this
(add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode))
(add-hook 'malabar-mode-hook
(lambda ()
(add-hook 'after-save-hook 'malabar-compile-file-silently
nil t)))
Now open a .java file within Emacs.
Try malabar-jump-to-thing on one of your class and it should open the corresponding file.
Open a test file and try malabar-run-test. It should run maven test for this file. If all tests OK but finished with "BUILD FAILURE", then see next section
Java troubleshooting
Malabar should use java from jdk, not jde. I've tried setting JAVA_HOME and configure malabar without success. So quick dirty hack is:
cd /usr/bin
mv java java.jre
ln -s /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
Ressources
Entreprise Java Development With EmacsDebugging Tomcat
Install JDIBug. In jdibug-expr.el, change the line (and to forget to byte-recompile or remove .elc):(require 'semantic-java)
(require 'semantic/java)
Configure emacs:
(add-to-list 'load-path "~/.emacs.d/jdibug-0.5")
(setq jdibug-connect-hosts (quote ("localhost:8000"))
jdibug-use-jde-source-paths nil
jdibug-source-paths
(list
"/path/to/project1/src"
"/path/to/project2/src" ))
(require 'jdibug)
Start Tomcat like with debugger enabled:
./bin/catalina.sh jpda start
Then try jdibug-connect to attach Emacs to tomcat.
Tuesday, July 12, 2011
TWM: Docking Windows
Using Pharo 1.4 and latest TWM packages, you can now group windows as tabs.
Use:
Use:
(ConfigurationOfTilingWindowManager project
version: #bleedingEdge) loadTuesday, June 28, 2011
My Pharo image
Backup of my preferences:
Gofer it
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfPhexample';
package: 'ConfigurationOfAutotest';
squeaksource: 'TilingWindowManager';
package: 'ConfigurationOfTilingWindowManager';
load.
(Smalltalk at:#ConfigurationOfTilingWindowManager) perform: #loadDevelopment.
(Smalltalk at:#ConfigurationOfPhexample) load.
((Smalltalk at:#ConfigurationOfAutotest) project version: #development) load: 'OB'.
(Smalltalk at:#TWMUITheme) beCurrent.
TaskbarMorph showTaskbar: false.
TasklistMorph keepOpen: true.
(Smalltalk at:#TWMBar) perform: #showTWMBar: with: true.
(Smalltalk at: #AutotestDashboard) perform: #showAutotestDashboard: with: true.
Saturday, June 11, 2011
Albaaaaaator, Albaaaaaaator, capitaine au coeur d'or ......
Le papa d'Albator / Captain Harlock, Lieji Matsumoto, était à Annecy pour le festival d'animation.... on a la dédicace !!!
Nostalgie ....
Tuesday, June 7, 2011
Multiple Worlds for TWM
With the help of my local developper group, I've integrated Sean DeNigris work and now Tiling Window Manager supports Multiple Worlds.
Here's a screencast that shows the progress. (My English seems a little less catastrophic than the previous screencast :)
Note: The tests failing on the screencast (Pharo 1.2) are green on Pharo 1.3.
Load TWM with:
And ConfigurationOfKeyMapping 1.7 (TWM do not work with 1.8 actually) with:
Here's a screencast that shows the progress. (My English seems a little less catastrophic than the previous screencast :)
Note: The tests failing on the screencast (Pharo 1.2) are green on Pharo 1.3.
Load TWM with:
Gofer it
squeaksource: 'TilingWindowManager';
package: 'TWM';
load.
And ConfigurationOfKeyMapping 1.7 (TWM do not work with 1.8 actually) with:
Gofer it
squeaksource: 'ShortWays';
package: 'ConfigurationOfKeymapping';
load.
(ConfigurationOfKeymapping project version: '1.7') load.
Saturday, May 28, 2011
Tiling Window Manager
I love Emacs because of editing speed and fast buffer switching among a lot neat features.
This week I've tried to make Pharo a little better on window management. This video shows the progress (thanks Gastón and Patrick for help and ideas).
Next step: KeyMapping integration + history à la Emacs winner-mode.
Sorry for my soooooooo awful english (tired ....).
Update 05/31/2011: you can load last version with colored theme with:
Tested on PharoCore 1.2 and Pharo 1.3.
Now this has support for world snapshot, that means you can arrange the windows and take a snapshot of the layout. Then you can restore these layouts later. (icons camera, <, > and trash). I'm not entirely satisfied with this, thanks for feedback.
In Pharo 1.3 there's initial integration with KeyMapping. To load:
Then in settings browser > Keymappings > Tiling Window Managers you have all actions of the dock mapped.
You can choose a Layout Strategy in settings.
Actually there's Horizontal (default) and Vertical (last used windows fills all remaining space) strategies.
To add your own just subclass TWMLayoutStrategy and implement #tileWindows:
To load TWM:
I also think the UI theme Patrick has cleaned fits better with TilingWM:
This week I've tried to make Pharo a little better on window management. This video shows the progress (thanks Gastón and Patrick for help and ideas).
Next step: KeyMapping integration + history à la Emacs winner-mode.
Sorry for my soooooooo awful english (tired ....).
Update 05/31/2011: you can load last version with colored theme with:
Gofer it
squeaksource: 'TilingWindowManager';
package: 'TWM';
load.
(Smalltalk at: #StandardUITheme) beCurrent.
(Smalltalk at: #TWMBar) showTWMBar:true.
Tested on PharoCore 1.2 and Pharo 1.3.
Now this has support for world snapshot, that means you can arrange the windows and take a snapshot of the layout. Then you can restore these layouts later. (icons camera, <, > and trash). I'm not entirely satisfied with this, thanks for feedback.
In Pharo 1.3 there's initial integration with KeyMapping. To load:
Gofer it
squeaksource: 'ShortWays';
package: 'ConfigurationOfKeymapping';
load.
(Smalltalk at: #ConfigurationOfKeymapping project version: '1.7') load.
Then in settings browser > Keymappings > Tiling Window Managers you have all actions of the dock mapped.
You can choose a Layout Strategy in settings.
Actually there's Horizontal (default) and Vertical (last used windows fills all remaining space) strategies.
To add your own just subclass TWMLayoutStrategy and implement #tileWindows:
To load TWM:
Gofer it
squeaksource: 'TilingWindowManager';
package: 'TWM';
load.
I also think the UI theme Patrick has cleaned fits better with TilingWM:
Gofer it
squeaksource: 'PBASandbox';
package: 'PBSandbox';
load.
StandardUITheme beCurrent.
Thursday, April 14, 2011
Pomodoro scripts
Sous OSX j'utilise ce logiciel comme chronomètre qui a l'avantage de pouvoir exécuter des scripts lorsque le Pomodoro démarre, s'arrête, ....
Au travail on utilise beaucoup la messagerie instantanée. J'utilise Adium comme client.
Besoins:
Solution:
Dans Adium créer un statut indisponible avec comme titre'Pomodoro en cours'
Dans les préférences de Pomodoro, onglet script, configurez comme ceci:
Start:
Reset et End:
Every 2 mins:
Tout le long du Pomodoro votre statut sera mis à jour:
Et dès que quelqu'un ose vous contacter, réponse automatique !
Au travail on utilise beaucoup la messagerie instantanée. J'utilise Adium comme client.
Besoins:
- je ne veux pas être dérangé pendant mon Pomodoro (passer mon état à indisponible)
- je veux que mes collaborateurs sachent quand se termine mon Pomodoro pour me contacter
Solution:
Dans Adium créer un statut indisponible avec comme titre'Pomodoro en cours'
Dans les préférences de Pomodoro, onglet script, configurez comme ceci:
Start:
tell application "Adium" to set the status of every account whose status type is available to the first status whose title is "Pomodoro en cours"Reset et End:
tell application "Adium" to set the status of every account whose status type is away to the first status whose title is "Disponible"Every 2 mins:
tell application "Adium" to set status message of every account to "Pomodoro en cours, fin dans $time mn"Tout le long du Pomodoro votre statut sera mis à jour:
Et dès que quelqu'un ose vous contacter, réponse automatique !
Wednesday, April 13, 2011
Petite Horloge revisited
Another Pharo Smalltalk snippet with temp classes (I like this :)
Don't forget the setFormat: or the VM will crash.Some explanations.
(Class new
superclass: StringMorph;
setFormat: StringMorph format;
compile: 'step self contents: Time now printString';
new)
openInWindowLabeled: 'Petite Horloge'.Don't forget the setFormat: or the VM will crash.Some explanations.
Polymorph counter example
I've discovered that I can write this in Pharo:
Coooooooooooooool ;)
"This creates a class and one instance on the fly"
counter := Class new
superclass: Object;
addInstVarNamed: 'counter';
compile: 'initialize
counter := 0';
compile: 'counterString
^ counter asString';
compile: 'increment
counter := counter + 1.
self changed:#counterString';
compile: 'decrement
counter := counter - 1.
self changed:#counterString';
new.
(UITheme builder newColumn: {
UITheme builder newLabelFor: counter getLabel: #counterString getEnabled: nil.
UITheme builder newRow: {
UITheme builder newButtonFor: counter action: #increment label: '+' help: nil.
UITheme builder newButtonFor: counter action: #decrement label: '-' help: nil.
}
}) openInWindowLabeled: 'Counter example'.Coooooooooooooool ;)
Saturday, March 19, 2011
Multiple worlds for Pharo
Sean DeNigris submitted a changeset to get multiple worlds in Pharo.
I've played a little with it to get a world switcher. If you want it, first file in the changeset file (download it the drag the file on an opened image).
Then the following code add three worlds named 2,3,4 and create a dock in each world.
I've played a little with it to get a world switcher. If you want it, first file in the changeset file (download it the drag the file on an opened image).
Then the following code add three worlds named 2,3,4 and create a dock in each world.
|wm|
wm := WorldManager instance.
#('2' '3' '4') do: [:aString| wm createOrSwitchToWorldNamed: aString].
wm worlds keysAndValuesDo: [:aWorldName :aWorld| |dock|
dock := DockingBarMorph new
adhereToTop;
openInWorld: aWorld.
wm worlds keysAndValuesDo: [:aWorldName2 :aWorld2|
dock addMorph: (SimpleButtonMorph new
label: aWorldName2;
target: [wm createOrSwitchToWorldNamed: aWorldName2];
actionSelector: #value) ].
dock addMorph: (StringMorph contents: aWorldName).
].
Monday, February 28, 2011
Work on Mocketry
Mocketry is a Mocketry is Smalltalk mock object framework.
To load it in Pharo:
I've done the first part of the Picasa screencast in a TDD way using Mocketry to prevent external HTTP requests.
As the requests are done using
In PicasaSearch:
See that mocketry extends BlockClosure to create mocks:
and set up expectations:
See HelpSystem book loaded with Mocketry for several examples.
Comments and better code propositions are welcome.
To load it in Pharo:
Gofer it
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfMocketry';
load.
(Smalltalk at:#ConfigurationOfMocketry) project latestVersion load.
I've done the first part of the Picasa screencast in a TDD way using Mocketry to prevent external HTTP requests.
Gofer it
squeaksource: 'LaurentLSandbox';
package: 'Picasa';
load.
As the requests are done using
HTTPSocket class>>httpGet:, one way is to give a mock to PicasaSearch so we can check (and stub) the HTTP request: PicasaSearchTwoRoughSeaTest>>setUp
[:mockHTTPSocketClass|
[photos := PicasaSearch new
httpSocketClass: mockHTTPSocketClass;
addKeyword: 'rough';
addKeyword: 'sea';
maxResult: 2;
photos.]
should strictly satisfy: [
(mockHTTPSocketClass httpGet:
'http://picasaweb.google.com/data/feed/api/all?q=rough+sea&max-results=2')
willReturn: self fixtureXMLResponseForTwoRoughSea]
] runScenario.
#fixtureXMLResponseForTwoRoughSea will return an XML string and test methods will check that it is correctly parsed.In PicasaSearch:
httpGetDocument
|url|
url := String streamContents: [:aStream|
aStream
nextPutAll: 'http://picasaweb.google.com/data/feed/api/all?q=';
nextPutAll: ('+' join: self keywords);
nextPutAll: '&max-results=';
nextPutAll: self maxResult asString.
].
^ (self httpSocketClass httpGet: url).See that mocketry extends BlockClosure to create mocks:
[:myFirstMock :mySecondMock|
"do stuff with mocks"
] runScenario
and set up expectations:
[:myFirstMock :mySecondMock|
[ "do stuff with mocks" ]
should strictly satisfy:
[ "what is expected on mocks" ]
] runScenario
See HelpSystem book loaded with Mocketry for several examples.
Comments and better code propositions are welcome.
Monday, February 21, 2011
XML Browser with Pharo
I've written a little tool to help me browse xml. If you want to try it:
See
Gofer new
squeaksource: 'LaurentLSandbox';
package: 'XML-GUI';
load.
((Smalltalk at:#XMLBrowser) labelled: 'Picasa search')
browseAtUrl:
'http://picasaweb.google.com/data/feed/api/all?q=lighthouse&max-results=10'.
See
XMLBrowser comment for examples.
Friday, February 18, 2011
FizzBuzz Kata: minimal solution
Trying to find a minimal solution for the FizzBuzz Kata in Smalltalk:
Update: Little variant from Alexandre:
fb := [:counter| |rules|
rules := {15->'FizzBuzz'. 5->'Buzz'. 3->'Fizz'. 1->counter}.
rightRule := rules detect: [:aRule| counter \\ aRule key == 0].
rightRule value].
self assert: (fb value: 7) == 7.
self assert: (fb value: 3) == 'Fizz'.
self assert: (fb value: 5) == 'Buzz'.
self assert: (fb value: 15) == 'FizzBuzz'.
1 to: 100 do: [:counter |
Transcript
show: (fb value: counter) asString;
cr]Update: Little variant from Alexandre:
rightRule := rules detect: [:aRule| counter isDivisibleBy: aRule key]
Tuesday, February 8, 2011
Smalltalk tiny exercise for TDD newbies
Done in course:
Create the category Exercise in the Browser. All classes you create will be placed in this category.
Implement the class Operation (using Test-Driven Development) which should work like this:
Add the message
Create the category Exercise in the Browser. All classes you create will be placed in this category.
Implement the class Operation (using Test-Driven Development) which should work like this:
Should return 0.a := Operation new. a result.
Should return 5.b := Operation new. b add: 2. b add: 3. b result.
Should return 3.Operation new add: 2; add: 4; divideBy: 2; result.
Add the message
Operation>>#multiplyBy by yourself.
Sunday, February 6, 2011
new funny ProfStef lesson
Update to last ProfStef (on Pharo 1.2 only):
Gofer it
squeaksource: 'MetacelloRepository';
package: 'ConfigurationOfProfStef';
load.
ConfigurationOfProfStef project latestVersion load.
ProfStef
go;
tutorial: SmalltalkSyntaxTutorial lesson: #instanciation.
Subscribe to:
Posts (Atom)





