Projets

Quelques lignes de codes et le monde s’ouvre nos mains.

_ _ _ _ _____ _ ___ _ _| |_ _ _ _| |_ _ _ _ _ _ _ _ _ _ _____ _____ _____ _____ _____ _____ _____ _| |_ _ _ _| |_ _ _ _ _ _ _ _ _ _ _ _ | | | ___ _ _ _ | |_ ___ | _||_| _ _ | __|| | ___ ___ _ _ ___ |_|| __| ___ | |_ ___ ___ |_||_| ___ _ _ ___ | ||_| _| | | |_ _ _ | |_ ___ ___ ___ ___ _ _ ___ ___ ___ ___ |_| ___ | | || __| ___ | _ || __|| || || || __| ___ | |_ ___ ___ |_|| __| ___ ___ ___ _ _ ___ |_| |_| ___ | |_ _ _ ___ _| || | ___ ___ |_| ___ ___ | |_ ___ | || | ___ | |_ |_| ___ ___ | || . || | | | | _|| . | | _|| ||_'_| | __|| || .'|| . || | || . | _ | __|| || . ||_ -|| . | _ | || || | || .'|| || || . | | . || | || _|| -_| |_ -|| -_|| . || | || -_|| || _|| -_| | || | | | ||__ ||___|| ||__ || --||- -||- -|| __|| || . ||_ -|| . | _ | __|| _|| .'|| . || | || . | _ | || | | . || | || || . || || -_|| _| | || ||_ -|| _|| .'|| || || .'|| _|| || . || | |__|__||___||_____| |_| |___| |_| |_||_,_| |_ _||_||__,||_ ||___||___|| ||_ _||_|_||___||___|| _|| ||_||_|_| \_/ |__,||_||_||___| |___||_ ||_| |___| |___||___||_ ||___||___||_|_||___||___| |_||_|_| |_____||_____| |__|__||_____||_____||_____||_____||_ _||_|_||___||___|| _|| ||_ _||_| |__,||_ ||___||___|| | |_||_|_| |___||___||_|_||___||_||___||_| |_||_|_||___||_| |__,||_||_||__,||_| |_||___||_|_| |_| |_| |_| |_| |_| |_| |___| |_| |_| |_| |_| |_| |_| |_|

Samedi, octobre 1st, 2011

When trying to push to Heroku I came accross this nasty bug :

   /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/specification.rb:519:in `normalize_yaml_input': invalid byte sequence in US-ASCII (ArgumentError)
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/specification.rb:479:in `from_yaml'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:183:in `load_gemspec'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:51:in `block in initialize'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:32:in `initialize'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `new'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `open'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/package.rb:58:in `open'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/format.rb:63:in `from_io'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/format.rb:51:in `block in from_file_by_path'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/open-uri.rb:35:in `open'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/open-uri.rb:35:in `open'
    from /usr/ruby1.9.2/lib/ruby/1.9.1/rubygems/format.rb:50:in `from_file_by_path'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/source.rb:72:in `fetch'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:45:in `block in run'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `block in each'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/bin/bundle:13:in `<top (required)>'
    from /usr/ruby1.9.2/bin/bundle:19:in `load'
    from /usr/ruby1.9.2/bin/bundle:19:in `<main>'

Basically it is saying that one of the Gemspec of one of my gems in containing UTF8 characters and so the slug compilation can’t go forward. Even by adding LANG = « en_US.UTF-8″ to the heroku config vars.

What did the trick was to add these two lines to the Gemfile :

LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

I didn’t know that a Gemfile could contain ruby code and get evaluated, there you go.

_____ _ _ _ _ _ _ _ _ _ _ _ _ _ | __| ___ ___ |_| ___ | ||_| ___ ___ ___ | |_ | | ___ _ _ _ |_|| |_ | |_ ___ ___ |_|| | ___ ___ ___ ___ | | _ _ _ ___ ___ | | _| | _ _ ___ ___ |__ || -_|| _|| || .'|| || ||- _|| -_|| .'|| . || || -_| | | | || || _|| | | _|| .'|| || ||_ -| _ | _|| -_|| .'|| | | | | || . || _|| || . | | | ||_ -|| -_| _ |_____||___||_| |_||__,||_||_||___||___||__,||___||_||___| |_____||_||_| |_|_| |_| |__,||_||_||___|| | |_| |___||__,||_| |_____||___||_| |_||___| |___||___||___||_| |_|

Dimanche, septembre 11th, 2011

I’ve been using the serialize extension from greg moreno for a few weeks now. But I’ve always been thrown of by the way the initialization of values is done.

Let’s say I create a User model with a :settings hash, containing :notify_mail => true as a default value. All the new created users are going to have the notify_mail value set. Now if I had another attr say :invites_count => 10. All users created afterwards are going to inherit from the two attributes, but what about all the previously created users ? They are still stuck with the only one attribute.

Since I didn’t want to have to refresh all the values for everyone every time I added another attribute to the :settings Hash, I modified the AttributeSerializer to make the setter return the default value if nothing is set.

Here is the gist :

_____ _ _ _ _____ _ _ _____ _ _____ _____ _ _ _ _____ _ _ _ | _ | ___ _| | ___ ___ |_| _| | | __| ___ |_| _| || | ||_| ___ _ _ _ | | _ _ ___ ___ ___ ___ | _ | _| | ___ ___ | |_ ___ ___ ___ ___ _| | | | _____ ___ ___ ___ _ _ |_| ___ _ _ _ ___ |_| ___ |_| ___ ___ | || || . || _|| . || || . | | | || _|| || . || | || || -_|| | | | _ | --|| | || _||_ -|| . || _|| || . || .'|| . || _|| -_|| _| | .'|| || . | |- -|| || .'|| . || -_|| | || || -_|| | | | |_ -|| ||- _|| || || . | _ |__|__||_|_||___||_| |___||_||___| |_____||_| |_||___| \___/ |_||___||_____|| | |_____||___||_| |___||___||_| |__|__||___||__,|| _||_| |___||_| |__,||_|_||___| |_____||_|_|_||__,||_ ||___| \_/ |_||___||_____| |___||_||___||_||_|_||_ ||_| |_| |_| |___| |___|

Dimanche, mai 8th, 2011

Alright, a geeky post for today, and in English so it might be useful to someone, maybe.

I had a problem with my GridView content jumping around, and here is how I fixed it :

public class PhotosGridAdapter extends CursorAdapter {

	public PhotosGridAdapter(Context context, Cursor c) {
		super(context, c);
	}

	@Override
	public void bindView(View view, Context context, Cursor cursor) {

		ImageView photo = (ImageView) view;
        String url_medium = cursor.getString(cursor.getColumnIndex(KarmaDbAdapter.PHOTO_URL_MEDIUM));
        ImageCache.download(url_medium, photo);

	}

	@Override
	public View newView(Context context, Cursor cursor, ViewGroup parent) {
		ImageView v = new ImageView(context);
		v.setLayoutParams(new GridView.LayoutParams(100, 100));
		v.setScaleType(ImageView.ScaleType.FIT_CENTER);
		bindView(v, context, cursor);
		return v;
	}
}

Basically you need to set the layout params in the newView, and not in the bindView, otherwise the previous content get shrank down.

There you go, I’m going back to my nexus.

____ _ _ _ | \ _ _ ___ ___ _____ |_| ___ | | ___ _ _ ___ _ _ | |_ | | || | || || .'|| || || _| | || .'|| | || . || | || _| |____/ |_ ||_|_||__,||_|_|_||_||___| |_||__,||_ ||___||___||_| |___| |___|

Samedi, janvier 1st, 2011

Un petit essai de layout différent pour mon blog : http://a.rnaud.net/projects/dynamic/

Interface avec un scrolling au clavier, sorte de damier qui s’étend à l’infini, compatible avec Chrome seulement (pour le scale des divs et les animations automatiques). Le design est vraiment vraiment minimaliste, un petit PoC pour me détendre.

__ _ _ _ __| | ___ _| | ___ ___ ___ ___ _____ ___ ___ | ||_| _ _ ___ ___ ___ | | || -_| | . || . || || || -_| | || -_||_ -| | || || | || _|| -_||_ -| |_____||___| |___||___||_|_||_|_||___| |_|_|_||___||___| |_||_| \_/ |_| |___||___|

Jeudi, mai 27th, 2010

J’essaye de faire un peu de vide. Je me suis dis que vous voudriez peut être en récupérer quelques-uns, avant que j’aille donner le reste pour 2cts chez Gilbert ou chez Emmaüs.

Il y a du Céline, du Houellebecq, du Asimov, du Vian, et du Lévy (oui désolé). Quelques BD aussi, mais souvent des versions « 1 plein, 1 BD ». Une soixantaine de trucs quoi, je dois avoir d’autres choses mais je dois vérifier que c’est bien à moi avant de les refourger. Peut être une MAJ de la liste ce week end.

Vous pouvez télécharger la liste, ensuite vous pourrez passer le week-end prochain quand vous voulez pour récupérer jusqu’à 5 ouvrages (il faut bien que tout le monde en profite un petit peu).

Ah et un point important, premier arrivé premier servi, je ne fais pas de commandes ;) Portes ouvertes Samedi de la semaine prochaine (5 juin )à Paris dans le 11ème.

PS : Oui, si on ne se connait pas ça marche aussi
PS2 : Je garde Paroles de Prévert, histoire de.

__ __ _____ _ _ _ |__|__| __ _ _ _ _ _____ _ _ ___ _ _ _ ___ _ _ | __| ___ ___ | |_ | |_ ___ ___ | |_ ___ | | | | ___ ___ ___ | | ___ _ _ | ||_| ___ | |_ ___ | __| ___ ___ | |_ |_|| _| _ _ _| | ___ _ _ ___ ___ ___ ___ _| ||_| ___ ___ | _| ___ _ _ ___ ___ |_|| |_ ___ ___ |__ || . || . || _|| || -_|| _|| _||- _| | | | | |__ | -_||_ -| | . || || .'|| | || || ||_ -|| _||_ -| |__ || . || . || _|| || _|| | | | . || -_| | | || . ||_ -| | _|| .'|| . || || . ||_ -| | _|| .'|| | || . || _|| || _|| -_||_ -| |_____|| _||___||_| |_|_||___||_| |_| |___| |_____| |_____||___||___| | _||_||__,||_ ||_||_||___||_| |___| |_____|| _||___||_| |_||_| |_ | |___||___| \_/ |___||___| |_| |__,||___||_||___||___| |_| |__,| \_/ |___||_| |_||_| |___||___| |_| |_| |___| |_| |___|

Jeudi, mai 27th, 2010

Deuxième soir, deuxième PoC.

Spothertz est donc un petit service assez simple, vous cliquez sur votre radio favorite, et vous voyez apparaitre les 10 dernières chansons jouées sur la radio. Encore une fois, c’est pas fait pour être un service complet, juste de quoi m’amuser tout seul.

http://a.rnaud.net/projects/spothertz/

__ __ _____ _ _ _ _ _____ |__|__| _ _ _ _ _ | _ || | ___ ___ ___ ___ _| | ___ ___ | ||_| ___ ___ | || | _____ ___ ___ | |_ |_| ___ | |_ | |_ ___ _____ ___ ___ _| | | __|| || -_|| .'||_ -|| -_| | . || .'|| _|| || || || . | _ |- -|| | || | | || . || _| | || | | _|| || -_| | || . || . || . | |__| |_||___||__,||___||___| |___||__,||_| |_||_||_|_||_ || | |_____||_____||_|_|_| |_|_||___||_| |_||_|_| |_| |_|_||___| |_|_|_||___||___||___| |___||_|

Mercredi, mai 26th, 2010

Pour moi Moodie c’est un des messieurs dans le caméléon, le geek qui fait toujours des bêtises.

Mood c’est surtout un mot anglais qui signifie humeur. Donc j’ai créé une petit webapp. Un petit qui rien. Vous choissiez votre humeur et hop, ça vous donne une playlist Spotify. C’est vraiment basique comme truc, ça marche sous Chrome et Firefox, j’ai pas testé IE.

Essayez Moodie

__ __ _____ _ _ _____ _ _ __ _ _ _ _ _ |__|__| _____ _ _ _ _ _ _ __ _ _ _____ _ _ | __ | ___ _____ ___ _ _ ___ ___ | || | | __| ___ ___ ___ | |_ ___ ___ | |_ | | |_|| |_ ___ | |_ _ _ | |_ | |_ ___ ___ ___ | | | __ | ___ | |_ |_| ___ ___ ___ | |_ ___ _ _ ___ | | ___ ___ | |_ ___ _ _ | |_ ___ ___ ___ | | |_|| |_ ___ | __| ___ ___ ___ | |_ ___ ___ | |_ | -|| -_|| || . || | || -_| | .'|| || | | __|| .'|| _|| -_|| . || . || . || '_| | |__ | || '_|| -_| | . || | || _|| _|| . || ||_ -| | | | | -|| -_|| _|| || _|| -_|| _| | _|| . || | ||_ -| | || -_||_ -| | . || . || | || _|| . || ||_ -| | |__ | || '_|| -_| | __|| .'|| _|| -_|| . || . || . || '_| |__|__||___||_|_|_||___| \_/ |___| |__,||_||_| |__| |__,||___||___||___||___||___||_,_| |_____||_||_,_||___| |___||___||_| |_| |___||_|_||___| |_____| |__|__||___||_| |_||_| |___||_| |_| |___||___||___| |_||___||___| |___||___||___||_| |___||_|_||___| |_____||_||_,_||___| |__| |__,||___||___||___||___||___||_,_|

Mercredi, mai 5th, 2010

Well I was bored with all the fuss and the clear lack of privacy that the implementation of the Like button all over the web is bringing, so I just wrote this small userscript to remove all Facebook Like buttons from any webpage. If you are using Chrome, the script will install as an extension, if you’re using Firefox you need to use Greasemonkey.

—–
J’étais fatigué de tout le buzz autour des boutons Like de Facebook et de leur claire intrusion dans ma vie privée, alors voici un petit userscript pour les retirer de toutes les pages. Si vous êtes sous Chrome le script s’installera directement comme une extension, sous Firefox vous devez installer le script via Greasemonkey.

Remove All Facebook buttons / Retirer tous les boutons Like Facebook

_____ _ _ _ _ _____ _____ _____ ___ _____ _ _ _ _____ ___ _ _ _____ _ _ | _ | | |_ |_| ___ | |_ ___ ___ _| | | || __|| __||_ | |_ _| ___ ___ ___ ___ |_|| |_ |_| ___ ___ ___ |_ _| ___ ___ ___ ___ | _| ___ ___ _____ ___ | |_ |_| ___ ___ ___ | __| ___ ___ | | ___ ___ | |_ ___ | | | . || || . | _ | || -_|| .'|| . | _ | --||__ ||__ ||_ | | | | _|| .'|| ||_ -|| || _|| || . || ||_ -| _ | | | _|| .'|| ||_ -|| _|| . || _|| || .'|| _|| || . || ||_ -| _ |__ || _|| .'|| || -_| _ | -_|| _|| _| _ _ |__|__| |___||_||_ || | |_|_||___||__,||___|| | |_____||_____||_____||___| |_| |_| |__,||_|_||___||_||_| |_||___||_|_||___|| | |_| |_| |__,||_|_||___||_| |___||_| |_|_|_||__,||_| |_||___||_|_||___|| | |_____||___||__,||_||___|| | |___||_| |___||_||_| |___||_| |_| |_| |_| |_|

Mercredi, avril 28th, 2010

Just to have a last bit of fun with CSS3 effects, I wanted to try a bit of animation on a simple shape, so here it is. You can find all the bird and the guy in this folder. Again, no support for IE, so an ugly « display: none; » for all of you. If you want to see the animation, try with Chrome, or Safari, on any Webkit browser. Have fun :)

_____ _ _____ _ _ _____ _____ _____ _____ _____ _____ _ |_ _| _ _ _ ___ ___ | |_ | __ ||_| ___ _| | | _ || __|| || || | | _ | ___ | |_ | | | | | || -_|| -_|| _| | __ -|| || _|| . | | ||__ || --||- -||- -| | || _|| _| |_| |_____||___||___||_| |_____||_||_| |___| |__|__||_____||_____||_____||_____| |__|__||_| |_|

Mardi, avril 27th, 2010

En me basant sur ce Twitter bird en Helvetica, j’ai décidé de refaire le même en HTML, CSS3 et Arial pour eviter les soucis de cross browser :)
Je vous laisse récupérer le code CSS pour ceux que ça intéresse.
Je pense que j’en ferai d’autres bientôt, et que je règlerai le soucis avec IE (Firefox, Safari, Chrome et Opera only pour le moment :)
EDIT : En fait c’est beaucoup de boulot pour IE, mais si vous y tenez absolument, allez rajouter ce plugin qui apporte une support fictif via JS pour les CSS Transform.