## Keyboard Playing Dock Icons

Some months ago, I began using RocketDock. It seemed (and proved) a good way to keep all important applications at hand without having tons of shortcuts in the taskbar or having to display the desktop each time. Yet something bothered me: the icons.

# The problem

On a desktop, I’ve always been disturbed to see icons so different from one another. On an application dock, icons are so close to one another that the differences can only be highlighted.

It already gives you an edge by allowing you to customize the icons. As a consequence, if, like me, you use Eclipse as a $\TeX$ editor, you can set your own icon to it (below, I used the icon for $\TeX$ mimetype from the Crystal Clear icon set).

And here you come with a dock which looks like that:

What about getting icons from the internet? Some icon sets are quite neat. Right, but I have not found yet one which covers all my needs.

# The solution

So what did I do? I merely began my own icon set. I defined some ground rules about what the icons should look like, and went on. I am no designer, though, but am quite satisfied with what I got yet. Don’t you prefer it that way?

## Philosophy

I wanted icons which somehow all belonged to the same family, so here I came. A rounded-corner square, filled. A logo cut in it. Shadow on a white background. And color. There you go!

The KP Dock Icons icon set is to focus on docks. But I mainly use docks at work, so the icons will include the tools I use most there: Eclipse, FileZilla, …

Still, my icon set could be of some use to other developers or IT professionals. Yet, by restricting only to my applications, I would be a bit too restrictive. So, adding some generic icons is a great idea.

And here the project was born.

## Licensing

The icons are licensed under the CC BY 3.0, which means that I basically let you do anything with it but would appreciate a mention of my contribution somewhere the end-user could see (a comment in the HTML source code of a web page would do if you use it on a website).

But don’t worry, I won’t get mad if you forget me. If you like the icons, feel free to use them.

## Hosting

### Getting the icons

Edited: The icons are now available on PNG Factory.

I opened a board on Trello (nice to-do application; you have to register to comment, but you can connect with your Google account). This board lists all icons which are to be made, and offers you the possibility to request for an icon I might have forgot.

If you do though, keep in mind that the set was primarily designed for my own use and, above all, a professional or developer’s use. I will extend later, but this might remain quite restrictive. Time will tell.

The board is accessible here.

### Contributing

As I have said, I have not decided yet how these will be hosted. Yet, I’d like to find an open source platform so that other designers may contribute if they want to (I will write a how-to file for designing one’s own icons). If you have suggestions, do not hesitate to share via the comments.

## Removing entries from a Map in Java

Today, I ran through some code iterating over a Java map to remove outdated values. I found the way it was done utterly disgusting. Yet, thinking it through, I would probably have done it the same way a couple of years ago.

As a consequence, I thought it would be a good idea to share the solution I now use.
Continue reading Removing entries from a Map in Java

## Forcing latest rendering engine in Internet Explorer

Internet Explorer and compatibility modes… I already posted about that topic earlier.

Yet, I recently began trying out Bootstrap (as you may have noticed if you keep an eye on Keyboard Playing’s homepage, or if you tried to have a look at the About or cyChop page which appear in the top menu) and discovered a new <meta /> tag in it. This was the right way to do it…

# Replacing something dirty with something clean

Last time, I wrote (inspired from a French blog post) that to force IE, a sufficient way was to force a version number higher than any IE existing yet:

This works. Yet, there is a cleaner way to do this:

There are two interesting things:

• IE=edge will force Internet Explorer to use the latest rendering engine available;
• chrome=1 tells that if Google Chrome Frame is installed, it should be used to render the page.

## Of the place of the tag in page [Update 2013-12-04]

When running a page through IE with the compatibility mode active, you can meet this warning:

This simply means IE already began rendering your HTML and cannot change the mode it chose. To prevent this, just remember: <meta/> tags should always be at the top of the <head/> section. No other tag before all <meta/> have been written.

# Still getting better

Don’t want to add this header to all your pages? If you use a .htaccess file (or even better, if you have access to your Apache configuration file), you can set your server to send this instruction along with the HTTP headers (as I have done on Keyboard Playing, and should extend to the blog soon). It will then automatically apply to all the pages of your website.

Here is the code you would need to apply:

There, you’re all set!

(edit: a reader highlighted the fact that, as of IE11, IE has no longer ‘MSIE’ in its user agent, but is using ‘Trident’ instead)

## Unit-testing a REST-client Spring bean

I guess a bit of context is required here: I had to implement a Spring bean which should be able to call a distant REST service, with high availability constraints. One of them was that even if distant service was down, the bean should return a result and not an Exception.

Of course, I wanted to ensure my bean behaved the right way, no matter what future evolutions would bring. Unit-testing then. Since it is a Spring bean, using Spring test. But then an awful question: how do I simulate a call to a distant servlet in a Sprint test context?

# The REST-client bean

Something very basic, using Apache’s httpclient to retrieve a stream. See the example:

Here the Maven dependency for httpclient:

And finally the bean initialization in the Spring application context:

# From the real thing to the unit-tests

Of course, since the URL is set in the Spring context, it easy to map to another one in the test context. Yet, I must have something listening to the test URL.

Something inside my test context, since I do not want to depend onto another server. Using Spring remoting? Start an embedded Jetty? Those seemed possible, but uselessly complicated.

For the first time, I asked for Stackoverflow’s help, and it came to me with the hints I needed to google out the pieces I was missing.

# Unit-testing using a light embedded application server

I was recommended to use javax.xml.ws.Endpoint with a JAX-RS annotated-class. The second part was what I aimed at from the beginning, using Jersey. However, Endpointquickly proved designed for use with SOAP services, not REST.

I kept searching for something similar and found an example of how to use Jersey classes with a Grizzly embedded server. It is acutally dead simple.

## Write a fake REST service

There are a-many tutorials about Jersey, I will let you find the one fit for you if need be.

Here is my fake service, yet. As I wanted to test the behaviour of my bean with several HTTP error status codes (401 if my request is incorrect, 404 if the distant service is down, 500 if I break it down, …), I decided that the passed parameter would be parsed to cause this status code if beginning with 10, 20, 30, 40 or 50. If it is any use to you, you are welcome to copy it (though it is quite basic, but quite enough for my unit-tests).

## Publish to a server

How difficult can it be to write a server? Very little, actually, if you know which server to call. I chose Grizzly. See below.

As for publication to the server, the highlighted line does most of the work.

## Start the server in the Spring context

Basically, all you have to do is to is set the bean with a URL and call the start() method. Translated for your context, it looks like the following:

## Almost done!

Now, when your Spring test context starts, a Grizzly server is started and listens on http://127.0.0.1:8088

Plus, a webservice is deployed onto it. The Path annotation tells us it will be made available at http://127.0.0.1:8088/hello

OK, so we just have to initialize our to-be-tested REST-client bean with the correct URL for the service:

You’re good to go and test all the cases you want to!

## Which dependencies should I use?

Right, I almost forgot I myself had some troubles figuring out which dependencies to use…

You might want to declare some repositories too:

Well, for SOAP, you can apply quite alike-looking practices, using javax.xml.ws.Endpoint instead of a Grizzly server, and the J2EE JAX-WS annotations instead of Jersey.

## A computer stuffed into a keyboard…

Computers aren’t easy to move around. Keyboards are. What about having a keyboard which actually is a computer? It exists…

As you would have guessed now that you have seen the name, this project was made using a Raspberry Pi and stuffing it into a keyboard.

Now you can go anywhere with it. All you need is a monitor, and you’re good to go!

For more information, you should go to the original post on preamp.org [German]!

## Capacitive inputs revisited…

You already know that I am a huge fan of keyboards, with some ideas of my own… I already spoke of capacitive keyboards also.

Well, Synaptics announced new inputs.

Basically an enhanced trackpad. The main novelty is a variable pressure detection, but it also features a multi-finger detection feature. The pressure is measured for each finger, not as a resultant.

The physical buttons could be removed and replaced with a hard press, thus resulting in thinner pads. So, slimmer laptops, or bigger batteries, … Drawback: we lose the physical sensation of clicking.

As far as I’m concerned, not a problem: I do not use the physical button of a trackpad anymore. With some settings, I have the tap for left-click, tap in pre-defined corner for right-click, move along the edges for scrolling, … Trackpads are great! I only miss not having multi-touch…

Anyway, Synaptics’s video:

[vimeo http://vimeo.com/47329850]

# The ThinTouch

I first thought this was a curiosity: ThinTouch is a capacitive keyboard with physical keys. What could be the use?

I already said that I do not believe in flat-surfaced keyboards. Though it might be great to turn a screen into a keyboard with any layout you might need, using it seems impractical to me when you have to use it a lot. I like to feel the keys.

Plus you cannot lay your fingers on the keyboard without activating the keys.

ThinTouch proposes a remedy to these problems. But why, then, use capacitive keys?

First, the keyboard is thinner thus. Combined with the ForcePad, this could be great news for future ultrabooks.

Add to it the pressure-sensitiveness. You could use it to have a upper- or lower-cased character based on the force you apply on the key. Or any other application you might imagine for it.

The video:

[vimeo http://vimeo.com/47458591]

I am growing impatient to see those integrated into new laptops. And to have the occasion to lay my hand on one of these.

[Source: Clubic]

## Use attributes and interfaces on Java enums

Most Java developers know of Java enums. Most developers also know that each field of an enum can define its own methods. But even most of those who know that are not aware they can define a contract each field of the enum must implement.

It might seem a useless piece of information. Yet, in my own case, it was really useful to me… Continue reading Use attributes and interfaces on Java enums

## Centering a dynamic-width block on a web page with CSS

I was trying in designing a new home page for Keyboard Playing that implied CSS centering. And I succeeded. It even passes the W3C validation services (for now that is; it may change next time I tinker with it).

Yet, my layout put me in some difficulty until I found a way to do it. Basically, I wanted a keyboard (did not even think of a link with the name) of buttons leading to various links, but this keyboard had to be centered in page. And I wanted this centering to be dynamic.

I found a way. I am not proud of it since, though the W3C validator acknowledges it, IE7 does not. Well, it is not beautiful but can be used anyway.

So, read this post if you want some advice… Continue reading Centering a dynamic-width block on a web page with CSS

## How to make a portable LaTeX editor

$\LaTeX$ (or more generally $\TeX$) is a wonderful tool when it comes to writing reports. I already wrote about how to use Eclipse with a few plugins to have a portable $\LaTeX$ editor.

There was a limitation however: though I hinted that some compilers exist in a portable version, I used TeXlipse with an installed MiKTeX. Now, a friend of mine required an editor to fine-tune something I prepared, and I did not wish to force a full installation.

So, here is how I prepared a portable $\TeX$ editor on a USB stick in half an hour (most of which was spent downloading), which shall work on any Windows machine. Continue reading How to make a portable LaTeX editor