❯ Guillaume Laforge

bash tip: find and grep through files

It happens once in a while that I want to find all files containing a certain string. I know command-line tools such as grep, cat, and find, but I never remember the right combination to achieve that task. So as to remember and reference it later, I write this small blog post to remind me how to do it:

find . -type f -exec grep YOURSTRING /dev/null {} \;

The find . part will search from the current directory (and all its subdirectories), - type f to search for files (not directories or links, etc), -exec to use the grep command to find through the files, with YOURSTRING as query string, /dev/null to throw away the errors you don’t care about, and {} is the current file to search into with grep.

Read more...

Incomplete string regex matching

Once in a while, I stumble upon the need of being able to tell whether a string could match a certain regular expression pattern, if it were given some more characters.

For example, a user is typing a time in an input field, following the pattern of 2 digits, a colon, and 2 other digits. He enters the first two digits and the colon, and we’re wondering if the time could be valid if he entered some more keystrokes.

Read more...

Speaking of Groovy 2.0 at 33rd Degree, in Poland

Tomorrow I’m flying to Krakow, in Poland, to speak about the upcoming Groovy 2.0 release, at the 33rd Degree conference. I’m looking forward to meeting some of you there!
Here’s my abstract for What’s new in Groovy 2.0?

After a quick look at the key features of Groovy 1.8, including more readable Domain-Specific Languages, concurrency capabilities with the GPars library, and built-in JSON support, we’ll dive right into the most important features of Groovy 2.0!
A lot of the Groovy users are using the language as a Java scripting language, or sometimes as a better Java. First of all, not all of them need the dynamic capabilities, nor do they need all the library improvements provided by Groovy. For the latter, Groovy becomes more modular with smaller core modules that you can compose. For the former, in addition to its usual dynamic features, Groovy 2.0 adds static type checking, allowing you to ensure the correctness of your code before it ships and quickly spot early errors at compile time.
Also, not everybody needs dynamic features at all times, and the natural extension to static type checking is static compilation. With static compilation, Groovy 2.0 generates fast and performant bytecode like Java, and shields key parts of your code base from possible interferences of dynamic features, making critical paths both faster and immune to monkey patching. But when you need fast and performant dynamic logic, Groovy 2.0 also features the integration of the “invoke dynamic” support coming up with JDK 7 and beyond.

Read more...

Mac trick: change Time Machine backup interval

If you think Time Machine is backing up your Mac too often, you can customize the interval between two automatic scheduled backups. I found that trick on MacYourself.

Open up a Terminal, and change the value, in seconds, of the interval (here 7200 seconds == 2 hours instead of the standard one hour):

sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 7200

Update: This doesn’t seem to work on Mac OS X Lion, although it worked in previous versions (like Leopard). Till we find a good workaround, Thomas, in the comments, suggested looking at this nice little utility: Time Machine Scheduler.

Read more...

Groovy news bits: API additions, contributing to the project, Eclipse plugin

With the recent release of Groovy 1.8.6, Groovy contributor Tim Yates, posted a few blog posts about some of the little useful enhancements that found their way in the release:

Tim also wrote a really great and detailed blog post explaining how to contribute to the Groovy project. Be sure to check it out if you’ve always wanted to contribute to the project. Tim shows how to get started, to propose a new feature or bug fix through JIRA, how to submit a pull request through GitHub, etc.

Read more...

Don't forget the GR8Conf Call for Papers

(http://gr8conf.org/), the Groovy ecosystem conference series, are coming to Denmark and to the USA in a few months. You’ll learn about the latest novelties about tons of great Groovy-based technologies, like Groovy, Grails, Gaelyk, Gradle, GPars, Griffon, Spock, CodeNarc and more. It’s the best place to engage with the community, get to know the developers of those projects, and present your success stories, and more.

If you’re willing to speak at the conference about all those topics, please head over to the GR8Conf Call for Papers. And hurry up, there’s less than one week left!

Read more...

Groovy 1.8.6 released

The Groovy development team is pleased to announce the release of Groovy 1.8.6.

Groovy 1.8.6 is a maintenance release essentially, with a few minor improvements and new features.

You can see the details in the JIRA release notes here:
http://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=10242&version=18245

You can download Groovy 1.8.6 in the Download section of the Groovy website:
http://groovy.codehaus.org/Download

Thanks a lot to all those who contributed to this release!

Next in line should be a new beta of Groovy 2.0 ;-)

Read more...

Static type checking and compilation in Groovy 2

Cédric Champeau, the Groovy core developer working on static type checking and static compilation for Groovy 2, recently gave a very interesting and instructive presentation on this topic at the Paris Groovy / Grails User Group, at the VMware offices.

You can have a look at his blog post about the presentation, including some additional comments regarding the method dispatch logic, some status update and directions.

And you should also have a look at Cédric’s analysis of the polls embedded in the presentation which asked a few questions about people’s preferences and expectations with regards to statuc type checking and compilation. Don’t hesitate to add your own input, as the poll is not closed and feedback is always welcome.

Read more...

GR8Conf Europe Call for Paper open

GR8Conf Europe 2012 will take place in Copenhagen, on June 6th-8th. It’s the best place to meet all the Groovy folks, from Groovy itself, and from the wealth of the Groovy Ecosystem (Grails, Gradle, GPars, Griffon, Spock, GContracts, CodeNarc, Gaelyk/Caelyf, etc). It’s also the best opportunity to stay up-to-date with the latest developments, and discover what’s cooking!

The Call for Paper is open. So don’t hesitate to submit your proposal.

Some useful links:

Read more...

Mon One Man Show au Paris JUG

Lors de l’enregistrement du 50ème épisode des Cast Codeurs au Paris JUG, j’ai eu le plaisir de faire un petit “one man show” comique (enfin j’ai essayé) sur notre métier d’informaticien, les tendances du moment, les news et autres scoops, etc.

Cette idée est partie d’une discussion avec Nicolas Martignole il y a 6 mois où l’on s’était dit que ce serait amusant de plaisanter un peu sur notre métier, les technos que l’on utilise, etc, et d’en faire une présentation humoristique. Et encouragé par les Cast Codeurs, je me suis lancé ce défi d’essayer de faire rire mon auditoire. A vous de juger si j’ai réussi ! Et je tiens à dire que les rires que vous entendrez sur l’enregistrement n’ont pas été rajoutés après coup ;-)

Read more...