Dec 4, 2014

A guide to create a TileMap for HaxeFlixel

When you create a TileMap in HaxeFlixel, it asks you to provide a map and some tile's graphics.
The beauty of this tool is to automatically set the layout for blocks and decide which is facing which.
So in addition to the map that can be a csv file or a black and white image converted with FlxStringUtil.imageToCSV(), you have to provide a strip containing all the tiles for every situations.

But you need to respect a precise order for FlxTilemap to understand it.
I did this visual aid to save some time. It tells which side is connected. I hope it will help others:


The tile strip comes from here: https://github.com/HaxeFlixel/flixel-demos/tree/master/Flixel%20Features/Tilemap

As you can see, the order follow some kind of pattern but I still can't wrap my head around it ...


Sep 3, 2014

Faut-il boycotter JeuxVideo.com ?

Depuis quelques temps déjà, le forum de JeuxVideo.com fait l’objet de sévères critiquent pour son contenu un peu douteux et quelques fois honteux.
Bien connues des internautes avertis, les sections “15-18” et “18-25” renferment le meilleur comme le pire. Le pire aimant flirter avec la limite légale. Et puis parfois … la limite est franchie.
C’est ce qu’a souligné dans cet article une chroniqueuse du Nouvel Obs qui a pu constater qu’en parlant d’internet et de sexisme, on obtient assez vite un mélange instable.


Alors que le débat fait rage et que ça tire dans tous les sens, prenons cinq minutes pour analyser ce qui se passe.

Le messager

Même si l’article est un peu expéditif et beaucoup trop orienté, les faits présentés sont indéniables. Ce qui est bien dommage d’ailleurs puisque tous les détracteurs commencent en général par taper sur le messager et non sur le message. Une technique récurrente ces derniers temps dans le journalisme télé de la part des politiques entre autre qui n’hésitent pas à se fendre d’un “... mais faites votre travail de journaliste !”. Sous-entendu : “vous ne me posez pas les questions auxquelles j’ai envie de répondre”.
Ce qui réduit de plus en plus les journalistes à de simple porte-micros.

Je trouve le titre de l’article bien choisi parce qu’il résume à merveille la situation. Même si une partie du forum ressemble à n’importe quelle autre, une autre partie non négligeable véhicule des idées qui tombent sous le coup de la loi et personne ne fait rien (il parait qu’il y a des modérateurs).

La pensée de groupe

La principale réponse que l’on peut entendre de la part des supporters, c’est qu’il faut connaître le forum pour pouvoir critiquer. Que c’est une communauté et que si on en fait pas partie, on ne peut pas “comprendre”.
Je ne m’étalerai pas sur la pensée de groupe car je l’ai déjà fait dans un article précédent :
Mais il s’agit d’un cas d’école où chacun s’encourage à commettre la plus grosse débilité.

L’acteur principal

On sait qu’avec les moyens de communication extrêmement rapides, si il y a un problème et pas de réponses de l’intéressé, c’est un manquement énorme. Surtout de la part d’un magazine qui ne doit pas manquer de plumes pour rédiger un petit communiqué au moins pour faire patienter.
Et c’est ici le gros problème de JVcom : une passivité à toute épreuve. Les seules réponses obtenues dans le passé sont de l’ordre de : “On connaît le problème, c’est compliqué, on y réfléchit”. Ce qui peut être interprété comme une démission étant donné que les revenus générés par le trafic du forum ne doivent pas être négligeables et qu’on ne change pas une équipe qui gagne !
Bref, on attend avec impatience que JVcom se fende d’une réponse et se prenne les pieds dans le tapis.

Les modérateurs

En nommant des modérateurs parmi les volontaires tout en regardant tout ça évoluer de loin et les stats de fréquentation de près, on peut vite perdre le contrôle et commettre l’irréparable.

Une réponse apportée par un modérateur :

15/07 : Le sujet a été supprimé. Il comportait plus de 6 pages hier encore. Principalement du soutien et des encouragements. Je n’ai pas de screenshots mais je vous fais part de mon analyse malgré tout.

Arrêtons-nous un instant sur cette phrase : “Si la bêtise se porte bien sur la toile française, elle semble avoir atteint un point de non-retour dans le milieu du militantisme et donc du journalisme”.
La bêtise sur la toile française ? Les internautes vous remercient mais je crois qu’on se passera de vos analyses (la paille, la poutre). Et confondre le militantisme et le journalisme ? Vraiment ?

Déjà considérée comme une réponse ouverte et intelligente par certains, on voit encore une victime de l’effet de groupe. Et un appel à témoignage magnifique pour que chaque membre du groupe puisse renforcer cette pensée. On trouve quand même de petites fissures : “[parlant de Bla-Bla] Je suis désolé, mais 75% des sujets sont carrément affligeants.”.

D’un point de vue plus personnel, j’ai fréquenté le forum de Hardware.fr pendant de nombreuses années. La modération a toujours été impeccable. Il y a des règles claires et elles sont respectées à la lettre. Même dans les zones de discussion libre, les débats peuvent s'enflammer mais on sait qu’il n’y aura pas de débordements non-contrôlés.

La liberté d’expression

Derrière le drapeau de la liberté d’expression, on peut cacher à peu près toutes les idéologies nauséabondes. On trouve aussi l’excuse du troll qui permet de créer une zone très floue et surtout de faire avaler des couleuvres. Prétextant qu’il s’agit d’humour et de provocation, les partisans de discours orduriers n’hésitent pas à (tenter de) faire taire l’opposition par tous les moyens licites ou illicites à leur disposition : spam, harcèlement, diffusion des informations personnelles …

De même, utiliser des mots choquants ne rentre pas dans le cadre de la liberté d’expression. Le proverbe : "La liberté des uns s'arrête là où commence celle des autres" qu’on retrouve dans la Déclaration de Droits de l’Homme, rappelle qu’un mot choquant ou trollesque pour certains est blessant pour d’autres. L’utilisation à outrance des mots “pd” et “fag” montre que l’on est plus dans la liberté d’expression mais dans la liberté d’offenser.
Les retrouver en titre de topic ?

Certains prétendent que ce n’est pas pire que le bon vieux café du commerce. C’est vrai, sauf que ce n’est pas transposable. On ne peut pas parler dans un forum comme au café du commerce puisqu’on passe d’un cercle relativement privé à un espace public d’une part. Et que c’est toujours le passage à l’acte qui est pointé du doigt et non pas le medium d’autre part.

Conclusion

JVcom serait-il comme Dr Frankenstein réalisant qu’il a enfanté d’un monstre et qu’il a beaucoup de mal à s’en débarrasser aujourd’hui ? Car certains membres désirent clairement transformer cette communauté en un 4chan francophone.
On ne peut pas laisser ce genre de discours envahir Internet, d’abord parce que la loi doit être respectée et ensuite parce qu’il est du devoir de chacun d’œuvrer pour une société meilleure où chacun peut se sentir en paix quels que soient sa couleur, son genre, son orientation sexuelle …
Insulter des féministes (exemple au hasard) et les harceler dès qu’elles se défendent ne fait partie d’aucune liberté, d’aucun style d’humour.
Faudra-t-il faire pression sur JVcom pour obtenir une réaction officielle ?


May 5, 2014

Spec Ops : The Line - Why you should visit Dubai before it's too late

I recently played a game called "Spec Ops : The Line". I heard nice comments about the story line and it is not that usual so I was intrigued.

Story

Where did I park?

Dubaï has been totaled by a giant apocalyptic sand storm. So the US has sent troops (many troops) to organize a rescue mission ... aaaand lost contact ...
They decide to send 3 guys from the Delta Force to scout around. And that's you!
I quickly found the HUGE reference to "Apocalypse Now". It could have been called "Apocalypse Now: the game" actually. It's a travel into human madness : the deeper you go, the more horrific it gets. And you also realize that you're gonna have to eliminate the Colonel of the rescue mission who is an old buddy. And you also have a rock soundtrack all along.

Madness

Sauron?

Quickly, you sanity is gonna be challenged by the weird things you discover. And your two pals questioning your authority is not helping (you know, like in the movie...). As you go through the game, the 3 of you start wondering why you are killing those poor bastards. And the main reason is that they are SHOOTING AT YOU! (omg) And because you don't know why they do that, it becomes more stressful. Suddenly, you find yourself killing hundreds of guys, and for me, that's the biggest problem of the game. The A.I. is not great so you often kill guys who haven't fired once. I was in "normal" difficulty and found myself several times stuck in tricky situations. But, I'm no PGM and I could empty a room with 4 head shots in a row. "Rainbow Six: Vegas" is one of my favorite game and has similarities to this one (for the gameplay, not the story) so I used it as a reference. I would have loved fewer but stronger enemies. And also, when you are a sniper, taking cover IS mandatory. Vegas is from 2006 and enemies knew how to hide, take cover and be sneaky.
Anyway, you wipe those guys and wonder. And because there is only one end, the choices you have to make have no impact on the story, only on your conscience.

Lesson

Am I a party pooper?

The underlying question of this game is: Is a military intervention a good idea?
By choosing the US army and a Middle-East country, you quickly think about how things happened in Kabul or Baghdad. Sometimes you have to make decisions while you don't have all the info in hand and it leads to terrible results. And when you are a foreign force, it's even more difficult.
In this game, you kill civilians just because they were in your line of fire, you destroy the water supply to win a fight, you try to stop an ugly situation but the retaliations create much more casualties among friends and civilians...
"With great power, comes great responsibilities". And in this case, you still try to blame someone else but the blame is on you. Even when you think that you're doing this for the sake of humanity.

Gameplay

Let's scavenge for some Champagne and Caviar!

I liked the survival aspect. And the fact that you are limited in ammo is great for that. For time to time, you find yourself with zero bullets and you have to pick up any weapon on the floor to stay alive. But speaking of survival, why oh why did they follow this stupid trend where you don't have to care about your health. When you take a bullet, you just have to wait a few seconds and you feel better! I know that it can't be realistic or every bullet would be a one way ticket to the nearest hospital. But I liked my med packs. At least, you could pretend you stopped the bleeding.
A lot has been said about the controls not responding. It didn't really bother me even if it's obviously not very smooth.
The soundtrack is really great, it's not every day that you hear Mogwai in a game.
Interactions with the environment are limited and not really well included. It's sad because there were lots of potential and the few nice ideas are not enough. It's like "Now stop: you need to break this glass to drown the enemies in sand".

Conclusion

Zip-line bare handed... because you are Delta Force for Christ sake!!!

This game is a bit short and you don't really have options. Like in "Apocalypse Now" where they sail back up the river and can't really leave the boat, you just have to walk straight forward. But because it's a video game, a little bit more of interactions would have been great.
The landscape is incredible and graphics are amazing. The not-really-clear story adds to the total mess of the situation and leaves you wondering. And it's a good thing for a video game.

Follow me: @tmalicet


Apr 17, 2014

The art of misleading: when wrong information is better than no information

From xkcd.com
I stumbled upon two charts in twitter recently and found a funny link between them.

The first is obvious. And Business Insider did a nice comment on it with a corrected version.
It sounds like Michael Scott's negotiation technique to speak indistinctly to make your interlocutor uncomfortable. You just take people's reading habit and use it against them.

The second is an attempt to respond to the eternal question, no, not the meaning of life but: "What is the best programming language?"
And when thousands of people try to make stats and graphs about it to show the trends and comfort developers in their choices, the conclusion is always the same. There is different languages for different means.
The sad part here? You often miss good information because someone decided to make numbers tell a story. More than report facts.
This one does not show anything mostly because it's in %. But also because it doesn't show new memberships nor the total of new repositories for each year (and its increase).
When looking at this, you could assume that, for some reason, Java and JS devs found Github more appealing over the years and decided to join and commit. Which led other languages' share to decrease. Why not?

A lot more is said here, when someone tried to pull some data from Github archives and realized it could be completely false for a hundred reasons. Comments are really instructive! Commentators state that some languages are not well detected by Github... Perl for instance. *Looking at the graph* Awwww

This post is more a rant about twitter than anything. I like twitter because some time it makes me laugh. But I don't rely on it for information. I have my RSS feeds for that.
And when I see that everything needs to be done in a instant (read, comment, retweet ... go back to step one) it's obvious that bad information can be spread all over the world very quickly.
We don't take the time to look closer.

Mar 10, 2014

How to add a new snippet for Zed?

Following this introduction to Zed, I encountered a problem to create a snippet. It's actually an open issue.
So I wanted to share it here.

I also wanted to share a few things I added to my user.json file. It's also a good idea to back it up as you could use it in any chrome browser you could find.
    "preferences": {
        "theme": "monokai",
        "scrollSpeed": 4,
        "gotoExclude": ["/tags", "*.png", "*.gif", "*.jpg", "*.mp4"]
    }
In the exclude part,  I added a few extensions that I encounter while working on web projects. It saves some time when you look for a file with the Ctrl-E command.
I also added the ctp extension (from CakePHP) to be managed with the PHP mode.

Here is an example if you want to use Zed snippets system with PHP :
    "modes": {      
        "php": {
            "name": "PHP",
            "highlighter": "ace/mode/php",
            "extensions": ["php", "php4", "ctp"],
            "commands": {
                "Tools:Complete:Snippet": {
                    "scriptUrl": "/default/command/snippet_completer.js",
                    "snippets": {
                        "class": "class=\"${1}\"",
                        "foreach": "foreach (${1} as ${2}) {\n\t${3}\n}",
                        "if": "if (${1}) {\n\t${2}\n}",
                        "php": "<?php ${1} ?>"
                    }
                }
            },
            "handlers": {
                "complete": ["Tools:Complete:Builtin","Tools:Complete:Snippet"]
            }
        }
    }
If you want to add your own, just duplicate the lines under snippets.

Feb 18, 2014

Deploy to your FTP through BitBucket ... and soon Github

Update - August 2016
FTPbucket is a PHP script that enables you to sync your BitBucket or GitHub repository with any web-server. It works with Git and Mercurial.

This post is outdated. Please go directly to Github to find the latest informations.

FTPbucket is a PHP script that enables you to sync your BitBucket repository with any FTP account.

I was looking for an easy solution to use Git on a webproject with a server with no Git installed (hehe). After checking several solutions, I could not find a free one that could fits my needs.

So :

Installation

  • Get the code here
  • Edit the config file and rename it to 'config.php'
  • Copy the deploy folder on your FTP server
  • On Bitbucket>Admin>Hooks, setup a POST hook pointing to http://myserver/deploy/deploy.php
  • You can Push now!

Limitations

  1. The script only copies the files you are pushing. It means that if you start with this tool when you already have files in your BitBucket repo, they won't be copied on the server. I'm looking for solutions on a full deploy. Which brings me the second point.
  2. I tried to push a 160Mo repo with more than 26 000 files and the POST hook didn't like it. The limit is ~1000 files/push I think. It's an unsolved issue: https://bitbucket.org/site/master/issue/7439/git-post-commit-hook-payloads-has-empty
SOLUTION : When you create a new repo on BB and need to push a lot of files, just do it. Right after, you set up the POST hook and manually copy the repo and FTPbucket files on your FTP.

More

It should work with Mercurial too but it's not tested yet.

I'm sure a lot of improvements can be made to my code so don't hesitate to fork and improve it! I would be glad to hear about your tests and issues too.

ToDo

I would like to have a simple GUI to manage logs and configs
I need to implement a way to call for action, when the file copy is done. A post-commit hook.
Add support for SSH, Github and more ...

Feb 12, 2014

If you want to get more serious/playfull, get Zed!


Zed is a code editor based on ACE.
The idea is to get a really strong IDE but with a minimalistic UI. And I really like that. I often work with PHPDesigner as I like the holding-your-hand way of doing things.
But sometimes, it's really too much. And it feels like there is an awful lot of wasted space in that kind of tools. The success of code editors based on ACE or with similar looks (Sublime Text) shows the need for such simplicity.


An open project with the 'Project Picker' in the front

I forgot the other good news, you don't need to install anything because it's a Chrome extension: Give it a try

The 'Cheatsheet' will display on many occasions and it's a good kick-starter. Or you can click on 'Manual' to get to it.

Example

As it can be a little bit disturbing at first, I will show you how to change the theme (syntax highlights).

  • Click on 'Configuration'
  • Press 'Ctrl-E' to open a file from this project
  • Type 'user.json' then press 'Enter'. The skeleton is there but it's empty
  • Now 'Ctrl-2' to split the screen in 2 (I like the Ctrl-1-2-3 commands to split the screen as it reminds me of RTS games when you make your teams)
  • On the new window, open 'preferences.json'
As the latest is Read-Only, you need to copy the things you want to change in the 'user.json' window. Like this :
To find the one that suits you, you can try them here.

Conclusion

On the GitHub repo, you can find a lot of files explaining ALL you need to know about Zed but it really needs a Wiki to centralize all that!

Anyway, it's really fun to code with it. It can be challenging to a beginner but it's also a cool way to learn.

Next step: I will try to work on a Dropbox folder and set up an automatic sync with a FTP account.

Jan 24, 2014

Setting up a git server like a Paas


I have this new server that I wanted to use like the services offered by Paas's. After some disappointments with OpenShift and Appfog, I am now using Heroku. And I really love like it! On Heroku, you just Push with Git and your site is up-to-date.

So, until I had to install my own Git server, I never made the difference between the bare repository and the working tree.

Just to make things clear, the bare repo does not contain files, it's just the information about who did what on which file. It's the center/server of your git network. More details here
All the files you have on your repo are a working tree. You can't push to a working tree.

But if you can easily find free server services (Assembla, Bitbucket), it's not a deploy option like in Heroku.
If you are working on a web project, you would like to check the result "live" without having to update it manually.

This is what I did :
1. I installed git on the server
(yum or apt-get or ...) install git-core
2. I created a git user
adduser git 
It will set the new user with no password or '!!'. It may cause problems, so to be sure you can unlock the user
passwd -u git
3. I had to register my SSH key (switching to 'git' user is really important)
su - git
cd
mkdir .ssh
ssh-keygen -q -t rsa -N 'pass' -f ~/.ssh/id_rsa
ssh-add
# on CentOS you may need to 'exec ssh-agent bash' to avoid the 'Could not open a connection to your authentication agent.'

cat .ssh/id_rsa.pub >> .ssh/authorized_keys 
4. I did the work tree in a web-browser-accessible folder (public_html, www ...) and put a test file to avoid any bug related to cloning an empty repo
git init deploy
cd deploy
touch test
git add .
git commit -m 'first'
5. Now the bare repo. You should put in your /home/git folder
git clone --bare /home/user/www/deploy deploy.git
6. To clone it on my PC, I append my own SSH public key to .ssh/authorized_keys ...
#On the server
cat /tmp/id_rsa.pub >> .ssh/authorized_keys
You can also copy the content of your id_rsa.pub and paste with
nano authorized_keys
7. ... and cloned the repo on my machine
git clone git@myserver:/home/git/test.git
If you change your code and Push it, it will work but you won't change the deploy folder

8. I had a hook to the bare repo to tell update the live version
cd /home/git/deploy.git/hooks
touch post-receive
nano post-receive
Paste
#!/bin/sh
GIT_WORK_TREE=/home/user/public_html/deploy/ git checkout -f
 Save and exit, then make it executable
chmod +x post-receive
9. Done! You can push and it will appear on the web folder