Maven best practices

Hi everybody !

As a daily Java developer, I’m really fond of Maven. It helps me a lot for everything in my work, from managing the dependencies of my projects, to building, testing, releasing them. Maven is a completely open tool and you can do approximately everything you want to do. But it can also become a drawback as soon as you don’t follow a few rules regarding your usage of such a tool. I just read a few slides which are really interesting about this, so let me share them with you:

A complete PHP contact form

Hi everybody !

As you may know, I’m not really a web developer. I sometimes develop a few web applications, but most of the time I use Java frameworks. A few weeks ago, I had to develop some kind of contact form for a website using classical web technologies: PHP, HTML, CSS and JavaScript.

Before coding anything, I had a quick look on the internet in order to find some interesting resources, but sadly I couldn’t find any complete solution. There were HTML+CSS templates, but without the contact management, or PHP source code without any HTML+CSS pretty template, or even some kind of crappy PHP source code without any security concerns.

That’s why I decided to build my own solution, based on a few resources I found. First, I started from Stéphanie Walter‘s wonderful CSS3+HTML5 contact form without any images. I don’t like to use images everywhere on a website, and I like clean and light design, so her solution was exactly the kind of form I was searching for:

If you want to understand how to implement this kind of form, have a look to her great tutorial !

Then, I added a few PHP source code, in order to manage the mails sent from the form, with a few basic security management: escaping special characters, checking for injections in the mail field, and validating that every filed has been properly provided. At this point, I had a completely working solution, but I was not completely confident about the security. I thought about adding some kind of Captcha mechanism on the form, but Captcha are too boring, and clearly ugly.

As I didn’t want to add such a crappy thing on my beautiful form, I searched on the internet about another solution for securing contact forms without using Captcha, and I found this really interesting article from the jQuery documentation !

So I put everything together, and here is the result: https://github.com/aneveux/contact-form !

A complete PHP, HTML5, CSS3, jQuery contact form, which allows to send mails with a quite correct level of security. If you have any comments/suggestions, feel free to fork my repository and make a pullrequest, or you can also create an issue with your remarks, or even leave a comment right here :)

I hope it’ll help some of you !

Playing a wav sound in Java

Hi everybody,

A few days ago, I wanted to add some audio notifications in an application, so I searched on the Internet for a way to do this, and I found quite a lot of different pieces of source code for doing such a thing. First of all, I found an easy way to play sounds in Java, using java.applet.* classes. Using this kind of API is really easy, but I was not really happy about using applet.* classes. I read some other websites, and found another set of classes to use: javax.sound.sampled.*.

Once again, I found some examples with these classes, but the source code was still too complicated. So I had a look at the APIs and wrote my own source code, trying to keep it as readable as possible. I decided to play the sound in a particular thread, so as to ease the use of the player. So here is my code:

As you can see, you just have to create a new SoundPlayer object, and give it an AudioInputStream. Then, just start the thread and it’s ok. If you want to wait for the sound to be played before doing anything else, just call the join() method on the Thread. Here is an example on how to use it:

Using this piece of source code, it’s now really easy to play wav sounds using Java.

If you have another easier alternative, feel free to share it ;)

Achievements notifications in Java

Hi everybody,

I recently discovered a small java library which aims at dealing with achievements notifitications. I don’t know if you already heard of this, but achievements are something more and more popular for developers. Coming from the world of video games, achievements are some kind of goals to reach in order to prove your skills. There’s a lot of achievements examples: badges in Pokemon, but also achievements on XBox 360, and so on.

Nowadays, more and more gaming concepts are included in our work environment, in order to increase our productivity. A lot of things can be done regarding this: medals for developers according to their code quality, achievements while writing code, etc. Actually, that’s exactly what Microsoft done while including an achievement mechanism in their last release of Visual Studio: http://channel9.msdn.com/achievements/visualstudio. This mechanism allows developers to reach some kind of goals while writing their code, and as they can share their achievements with friends, a sort of competition can start between developers in order to find the one who does the best code. So the developers’ productivity is increased, and they play while they work.

Actually, you can also find this kind of mechanism on popular websites such as stackoverflow: http://stackoverflow.com/badges.

As I’d like to implement the same kind of mechanism as the one provided by Visual Studio in Eclipse, I searched on the Internet for some existing work, especially regarding the graphical part: achievements notifications, and I found a really interesting library wrote by @paulocereda. JAchievement is an open source project, which allows to display in a very easy way some notifications:

There are a lot of options you can use in order to customize the appearance of your notifications, and everything is completly documented on JAchievement website: http://jachievement.sourceforge.net/.

You can also browse the source code, available on github: https://github.com/cereda/jachievement.

If you’re familiar to Maven, and if you want to use JAchievement with Maven, you can have a look at this forked repository: https://github.com/aneveux/jachievement (which is mine, by the way), which let you add the correct dependency with only a few lines of XML in your pom.xml file:

Feel free to try this really nice library, and don’t hesitate to tell @paulocereda how nice his work is :) He’s a really sympathic guy who deserves to be known :)

What’s in my dock ?

Hi everybody,

Today, I thought of a small article so as to present you some mac applications from my dock. I use quite a lot of different apps, so I think this article will only present a small part of them, but as I always liked to discover new tools, I guess this article could be interesting.

  • Dropbox: Following my dock entries (and not especially my preferences), here is one of the most used application on my mac. As I frequently need to share files from my workstation to my personal computer, Dropbox is a really useful alternative. Moreover, it also comes with an iphone application, which allows me to consult some files from my smartphone.
  • jCodeCollector: This small application was created by an independent developer. It allows to store efficiently code snippets and retrieve them using various ways: tags, categories, search bar… With a basic but ergonomic user interface, jCodeCollector is a must have application for every developer :)
  • Evernote: I always need to remember a lot of things. From ideas to simple remarks, but also some websites to visit later, or some pictures to check. With Evernote, I can easily store everything I need to remember in a platform I can access from various locations: my macbook, but also my windows computer at work, or my iPhone.
  • iTerm 2: I was quite happy with the native Terminal application from Mac OS, once it’s custom with some configuration files (have a look at the various dotfiles projects from github, like https://github.com/mathiasbynens/dotfiles), but I missed so much a feature allowing me to split the terminal screen that I choose to switch to iTerm2. With a lot of additional features (and not only splitting the the screen), iTerm2 is actually the best terminal application I ever used.
  • Github: I’m a real fan of github. I work on a few open source projets on this platform, and I also use it to store some personal projects. Moreover, I always use it to find some examples or a few inspiration when working on a particular topic. As soon as github released an official github application, I installed it, and I still use it frequently.
  • XMind: Mind maps are really useful when dealing with brainstormings and organizing ideas. Being a big fan of Eclipse based products, I was really impressed by XMind (an Eclipse RCP application). This mind map application is cross platform (so it works both on my windows workstation, and my personal macbook), but it also comes with an ergonomic user interface which allows to design easily complex maps.

Here it is ! I still have a lot of applications to talk about, but I’ll present them in some other articles so as to let you try the presented applications easily. I’ll try to write a new article quickly about mac applications, so stay tuned :)

Programming fonts

Hi everybody !

I read quite a lot of articles for a few weeks about ergonomics IDE. As a developer, I spend several hours on front of my computer every day, mostly for development purpose ; that’s why I think it’s really important to take some time in order to choose the best combination of colors and fonts in our IDE.

In this article, I won’t talk about colors schemes, but I’d like to talk a little about programming fonts. Did you know that there are quite a lot of fonts designed especially for development purpose ? For sure, choosing a font for working is completely a personal choice, so I’d just like to give you a few basic advices for selecting your font !

Keep in mind that for the best readability, a font should be:

  • Easy to read: You should be able to disting easily all the characters, even the punctuation ones.
  • Monospaced: Regarding the previous advice, we should focus on Monospaced fonts because their characters can be easily identified.
  • Proportional: because it takes less screen space, and can be a little bit easier to read.

Note that all the characters should be completely different: for example, have a look at the ‘O’ and ’0′ (uppercase ‘o’ and zero), or also at the ‘l’ and ’1′ (lowercase ‘L’ and one).

Instead of writing again something that has already been correctly done, I suggest you have a look at this really interesting article: 42 of the best monospaced programming fonts. This article is quite long, but it presents a various set of fonts you can use for development.

And here is my font selection:

  • Monaco: This font provided with Mac OS X is really useful. I use it on my laptop, and for most of my development tools.
  • Proggy: You’ll find different versions of the proggy font on their website. This font allows a readable code even with small characters.
  • Dina: My favorite one with Monaco. I used it for a few years while developing in Java. I still use it in Eclipse on my PC at work.

Here it is, there are a lot of things to say about this subject, and I hope this small article will invite you to think about your IDE’s ergonomics. As usual, if you have any advice to share on this topic, feel free to comment this post !

Quick look at HTML5 and CSS3

Hi everybody !

I know that talking about HTML5 and CSS3 right now is not really up-to-date, but as I don’t work often on web development topics, I didn’t had too much time to have a look at these two subjects… For a few weeks now, I’m working on a few websites for friends ; so I decided to use some recent technologies, and learned the new features brought by HTML5 and CSS3. Strangely, I didn’t find easily a website which present the specific aspects of these technologies in a detailed way.

So I looked on slideshare so as to find some interesting slides about this subject, and here are 3 presentations I found really interesting:

Getting Started with CSS3
View more presentations from Livefront

I hope you’ll find those slides interesting, and I’d like to thank their authors for this good job !

If you have in mind some useful references around these topics, feel free to share your links ;)

What’s behind this blog ?

Hi everybody, and welcome to my brand new blog !

In this first contribution, I thought it would be nice to share with you some elements of this blog ! I guess most of you already noticed that I was using wordpress (a quick look at the favicon is enough to understand this), but as you may know, there are quite a lot of things we can do to make a blog more efficient than a default wordpress installation.

Design

Choosing a template for a blog is definitely the hardest thing to do… WordPress proposes a lot of templates through its catalog, but it can be difficult to find something both pretty and easy to customize. When I created my blog, I wanted something light, without a lot of images and so on.

First, I made some researches about templates using bootstrap framework. I’m really fond of this framework from some people working for twitter, so I thought about using it for my own blog. I found a few interesting projects: wp-bootstrap, 320press, and last but not least: roots. I tested all of these themes, but there was always something missing regarding what I wanted to do. For sure, I could enrich them with everything I need, but I wasn’t satisfied enough with them (choosing a template is something really subjective, so I guess some of you would prefer these templates to the one I choosed, that’s why I thought it should be interesting to present you the different projects I had a look on).

Finally, and thanks to Christophe Ribeiro, a friend of mine, I discovered Reverie, a wordpress template which relies on Foundation (bootstrap’s concurrent). This time, quite a lot of things looked interesting to me. This template is based on a really interesting framework, which allows to develop easily powerful web interfaces ; it manages efficiently responsive design, and multi-devices display. Moreover, the project’s documentation is really good. On top of that, both Reverie and Foundation are open source and available on github !

Once again, there were a few things I wanted to change, but the source code is really easy to understand, and I could apply my modifications really fast. In order to stay synchronized with the evolutions of the template, I forked their github repository, and contributed my modifications to my fork.

That’s all regarding the design part. I was searching for something beautiful and useful out of the box, in which I could contribute easily some modifications, and Reverie is the best answer I found regarding to my needs.

Plugins

I try not to use too much plugins so as to avoid too long loading times, but there are some extensions I find really interesting around wordpress ecosystem. Here are all the plugins I’m currently using:

  • Akismet: If you already had a blog, I guess you heard about this one. This powerful tool allows to protect you from spam comments and trackbacks efficiently. It’s really easy to use, and help you keeping your blog clean.
  • All in One SEO Pack: One of the best plugins when you talk about SEO and optimization of your blog for search engines. There are two versions of this tool: the first one is free, while the other one (the PRO version) costs around 70$. Personally, I use the free version because I don’t expect to have millions of visitors everyday, so I don’t want to spend money in blogging tools.
  • Disqus comment system: The default wordpress comment system isn’t so bad, but Disqus provides really interesting features while dealing with user comments. From authentication using several providers (OpenId, Facebook, Twitter…) to RSS feeds for the comments, Disqus provides a new way to manage your blog’s comments.
  • Feedburner FeedSmith extend: I’m fond of RSS feeds and suscribe regularly to a lot of things, but wordpress doesn’t provide anything to get some statistics around your blog’s feed. That’s why I registered my blog to feedburner, so as to be able to collect some statistics about my suscribers. Then, Feedburner FeedSmith plugin allows to detect all was to access my original feeds, and redirect to my feedburner feeds, so I can have some information about my feeds’ usage.
  • JetPack: This is a set of plugins provided by wordpress. It contains quite a lot of different things, from social sharing to statistics on your visits. It also provides a URL shortener (wp.me), and a few interesting features, such as an enhanced gravatar integration.
  • Simple Gist Embed: As soon as I want to share a piece of source code, I create a gist. This kind of snippet, managed by github, can be embedded in a post so as to present source code with some syntaxic coloration. This plugin allows to include easily a gist snippet in a wordpress post directly from the wysiwyg editor.
  • Tweetable: I tested a lot of twitter integration plugins, including the one included in JetPack, but I faced some troubles with most of them. This plugin is the last I tested, and integrates more features than any other one of the previoux plugins I installed. It allows to tweet automatically each created post, but it also provides a way to tweet directly from wordpress. Finally, the twitter widget provided is really simple, but it does exactly what I was searching for.

Here it is ! I guess there are still a lot of useful plugins I could test to enrich my blogging experience, so if you have any recommendation to share, feel free to comment this post, I’d be really happy to hear about some suggestions from someone here.

So, I hope you found this first post interesting. Feel free to ask any questions about it, or to make some suggestions around this topic, comments are here for that purpose !

See you !