>iPads are creepy

>

Well, not really, but I still cannot understand the hype about it since Apple obviously just took the iPod Touch and removed the best feature it had: being portable enough to fit in my pockets.

Posted in Uncategorized | Leave a comment

>Thoughts about cross-platform GUI

>

I have tried developpinf for many platforms, using many toolkits (gtk, qt, wxwidgets, tk, cocoa, winforms, …). Some of them are simple; others are complex. Some are poorly documented ; others don’t even require documentation. But once you leave the developper (dark) side, what you get is an app that may not be compatible with your OS of choice due to its dependencies, but in case it is compatible, it may have a weird look and feelthat appears not to fit. It might be the appearance, the keybindings, windows management issues, etc.
As an example, let’s consider xchat, the IRC client. It does work the same under linux and OSX, but running it on a mac doesn’t make it share the rest of the environment paradigms. Then you run Colloquy and get the feeling you would expect of a mac app. Adium vs Pidgin is a great example of this adaptation. Both of them have the same base but each are adapted to the platform. Even though adium works great, I don’t wish to see it on ubuntu as it is and the same applies to pidgin on mac.
Does that mean every app has to be rewritten for every OS? Well, I hope not!
Then I saw transmission (the bittorrent app). I thought it had a good feeling on my OS of choice. Then I saw the web interface and thought it had a good look&feel too. And though it shared a strangely similar look to the cocoa interface, It didn’t felt out of place on linux or windows. Maybe it’s me who expects less of web interfaces, but I believed it may be the key to this UI battle. So I started this small project I called httplayer and did my first interactive web app: an interface to xmms2.
It was fun to do, and made me appreciate JQuery, as I realized that ajax is just a buzzword and not much else and that the javascript is doing all that is dynamic.
Posted in Uncategorized | Leave a comment

>exception("out of test assertion")

>ah! exceptions. Both familiar and frustrating. They tell something wrong happened and quickly pull us out of our code flow, sometimes leaving the application running; sometimes not. For this we have tests, lots of tests. But let’s raise a crazy idea: what if we replaced all of those exceptions with assertions? What a weird thought! But assertions are for tests I hear you say. Well, maybe not. If we think for a second, we use assertions in tests to flag conditions that should but are not respected. And as they don’t break the flow of execution, they can be chained, highlighting many errors that our code may have. Also they have the benefit of not impacting performance of our release code, as they (often) get optimized out.

Well, that sounds good. Are we up to replace all of our exceptions? Still not sure. What does the exception offer? First, they survive release building, unlike assertions. And they often are objects which can be dealt with. They can be thrown, caught, edited, rethrown, stacked, printed. We may manage them here at the source or later in the code.
So, do I assert or raise exceptions? It depends. The rule I’ve come with is: if it is a condition that may happen, is not the programmer’s fault and may interest the user, then exception it is. If it is a precondition that should not happen, a programming mistake, then asserting should suffice. Here are few mandatory examples:
  • Network errors are exceptions; they should be handled, are certain to occur in some situations and are nobody’s fault
  • Division by zero, if coming from user input are exceptions; unless you put constraint on user input, you need to assume they will make errors and which should be handled
  • Argument type of dynamic languages should be asserted, as it is a programmer’s mistake to pass a wrong argument type to a function
  • Unimplemented methods of child classes are false assertions, not exceptions; they are debugging messages and won’t make any sense to the user
Asserting complements the documentation, as do tests. That doesn’t mean you shouldn’t document or test but rather that the clarity of your code can only be better if you put those docstrings to assertions to inform the developer he may not have checked everything.
Posted in Uncategorized | Leave a comment

>Colorful syntax

>After having used VisualStudio+VisualAssist for some time I’ve got used to the fancy coloring (yes, I do feel ashamed). So when going back to vim+eclim to code in Java, the code feels like it lacks color. Few minutes and a vimscript later, everything is as it should be.

augroup Java
“more verbose coloring
au FileType java highlight typeHl guifg=#00ffff
au FileType java syntax match typeHl “\<\u\+\U\a*\>“
au FileType java highlight methodHl guifg=#ff6666
au FileType java syntax match methodHl “\.\@<=\U\a*(\@="

au FileType java syntax cluster javaTop add=typeHl
au FileType java syntax cluster javaTop add=methodHl
augroup END

So what what it does is create an autocommand when a java file is opened and sets java highlight for types (which starts with an Uppercase) and methods (starting with a . and ending with a (). The hardest was to figure out why the code enclosed in parentheses was not highlighted. A call to :highlight revealed an interesting line

javaParenT xxx matchgroup=javaParen start=/(/ end=/)/ transparent contains=@javaTop,javaParenT1

The way parentheses validation works is by highlighting all parentheses and clears the highlight of enclosed ‘)’. In fact, it clears the highlight of everything which is enclosed, except javaTop. So, the last two lines of the autogroup is to add our syntax groups to the javaTop cluster.

Posted in Uncategorized | Leave a comment

>Drawing stuff

>Ok, I’ve got this really cool Wacom tablet as a gift and I’ve been playing for a while with it. Lately, I was trying to draw manga style characters so I thought of making this tutorial about manga, Inkscape and Blender. I see you coming: Why Blender? Because if you’re as dissatisfied with your character poses and proportions as I am, you’ll see Blender as a blessing. So let’s start shall we?

First fire inkscape and get those Layers and Fill&Stroke dialogs (under layer and object menus) either on the side of your screen or on your second monitor. Add a layer and draw a stick representation of your character’s pose.
Not bad for a quick sketch, but not what I would call satisfying. I could work on the proportions or use the easy way. If you’re satisfied with your sketch skip ahead, else start blender (available from http://www.blender.org/).

Here, I’ll assume you have already played a bit with blender. It can be quite complex to use and I’ll stick to the main steps. So start by adding an armature (spacebar->add->armature). Select it, go into edit mode (tab) and add bones (spacebar) so you have half a skeleton. Select two bones (shift+right Click) and make them parent (ctrl-p) with offsets when needed. Select one side, duplicate it and mirror it. You should get a skeleton similar to this.
Go back to object mode (Tab) and switch the view to pose (using the combobox). Now rotate those bones to work on your character’s pose. I find it easier to do so by dragging bones with the Inverse Kinematics (Auto IK button at the bottom).
After you’re satisfied with the pose rotate the viewport to the right angle and export the view with file->Screenshot Subwindow. That’s it, you’ve got your perfect pose, with perfect perspective and perfect proportions (assuming your skeleton was perfect). Now go back to Inskscape and import your image in a background layer. On a sketch layer, sketch your character over the skeleton.
Now get rid of the back layer with the capture and add a clothing layer. Draw the shape of clothing and hair. Then add another layer and make it translucent while you work on it. On this layer I draw color filled shapes of each portion of the characters. This could have been done instead of the last step. However, I don’t alway add color with the exact same shape as the clothing sketch. So you should have something similar to this. Notice that small details like eyes and objects are kept until the end to be overlayed on top of the rest.
Then I add two layers on top of the colors, one for darkening and the other for lighting. When darkening, I mainly use gray. However, you’ll notice that light colors like the skin tend to get too much gray, so sometimes I add a slight tint to the shading color, like grayish brown. The same goes for the lighting layer.
Then goes the part the part that makes manga characters what they are: outlines. This really depends on the style you want. I get interesting results by exporting the outline of my character, reimporting it and using the “Trace Bitmap” feature of inkscape, which makes a large trace with varying width. Feel free to try it. However since the coloring of this one doesn’t fit the outline, I’ll retrace it by hand. The line width I chose for internal lines is such that at 100% zoom the lines are so thin they appear to be colored. Although this is my preference,
use what feels best on your character.
When this is done, select all objects from all layers and copy them. Add another layer under all and paste (ctrl-alt-v). Then while everything is still selected, merge (ctrl++). Remove the filling color of what’s selected and set stroke paint to black. Voila! your character is now outlined. I like to set the outline of a character darker than the interior lines to make it stand from the background. Add eyes, items details and a nice decor and you’re done

Posted in art tutorial manga inkscape blender | Leave a comment

>pidgin + gentoo

>A friend of mine thought of it while compiling, but I did it before him. At least, I think. Maybe not, but it doesn’t matter since I took time to create a clean implementation and package it. It’s my first try with pidgin plugins and I should say that I’m satisfied with the result.

To cut it short I made a pidgin plugin to update gentoo user status with the package they are currently emerging.
It’s called pidgin-gentoo and that’s all it does. You can get it from the project page and show to every contact you have you’re still compiling openoffice…

Posted in compilation, emerge, gentoo, pidgin, plugin | Leave a comment

>About copying

>To those who prefer window’s to X11
, let me tell you my experience with this:

I thought <C-c> was a great thing
T’ill 2k lines of code I tried copying.
Then, my swap file reached new heights;
Also the application did die,
Leaving me a bit more sadistic
For all I needed was middle-click.

— geek poetry by simpoir
This (tries to) show how this simple thing so many people are complaining about, which is the need to have the source app open under X11 to paste (I don’t care about Klipper, or whatever tool you may be using to contradict this) may sometimes be wanted.

Posted in design, poetry | Leave a comment