Tuesday, December 25, 2012

Livebox2, episode 2

De retour chez mes parents qui ont changé leur Livebox d'Orange, et encore des problèmes de connectivité...


Malheureusement, le mode telnet n'étant plus disponible, les scripts de monitoring que j'avais écrit précédement ne fonctionnent plus...

J'ai jeté un oeil et l'interface de la livebox expose ses donnéees en REST au format JSON. Il serait dont possible de faire un programme qui récupère les données de manière automatique. Ici une preuve de faisabilité en 2 lignes de curl. Aussi sur le gist, une copie du javascript qui tourne sur la boite pour les curieux.

Je devrais pouvoir facilement mettre a jour mon script initial, mais au final celui ci est difficile d'utilisation sur d'autres plateformes.

Je me demande si je ne devrais pas faire un programme plus générique, capable de faire du monitoring des différentes Box ADSL. J'hésite entre une solution nodejs+highcharts ou une solution ruby... Suite au prochain épisode.

Mise à jour: ce projet python ligne de commande permet d automatiser le site speedtest.net en ligne de commande. Pratique.

[...]
Hosted by MEDIACTIVE (Toulouse): 1034.339ms
Testing download speed........................................
Download: 0.69 Mbit/s
Testing upload speed..................................................
Upload speed: 0.37 Mbit/s

Lexmark S305 on Ubuntu 11.04 and 12.04 - fixing the packages

My parent's S305 Lexmark printer was sitting unused in the 1.5 years since it had been purchased.

Yes it was compatible with Linux claimed the box, but the installation scripts we had were not working with our Ubuntu 11.04 computer.

Thanks to an update in Lexmark packages, I finally might have something that works.

A year ago, the printer was malfunctionning. Oh yes, you could download the packages from Lexmark's site (lexmark-inkjet-legacy-wJRE-1.0-1.i386.deb.sh), but first you had to edit the installer, and even then the printer was not working on our Ubuntu 1104 computer. The lexmark programs were either crashing, being unresponsive, or going 100%CPU. In the best case, half of the page was printed.

I gave it a last try today, before returning it to the shop (we re patient here).

I found out that Lexmark had new packages, downloaded them (lexmark-inkjet-legacy-1.0-1.i386.deb  lexmark-printer-utility-1.0-2.i386.deb  lexmark-scan-legacy-1.1-1.i386.deb), and installed them (dpkg -i lexmark*.deb)

Alas, the printer utility installer is broken:
Installing %%JARVIS_VENDOR_PREFIX%%hcp backend ...
cp: impossible d'évaluer «/usr/local/lexmark/printer_utility/bin/%%JARVIS_VENDOR_PREFIX%%hcp»: Aucun fichier ou dossier de ce type

You can fix the installer using this script. To install it, run this from the directory where you have downloaded the debs.

wget https://gist.github.com/raw/4374626/e946d2a3ad2e24657ddd32a84f31927970773745/fix_lexmark.sh
chmod +x fix_lexmark.sh
./fix_lexmark.sh
dpkg -i build/lexmark-printer-utility_1.0-1_i386.deb

You will notice that the new package is one revision below the original, that's because the DEBIAN/control in lexmark-printer-utility_1.0-2_i386.deb was invalid I guess...

Now from the first time the printers installs and prints without crashing. Unfortunately my black ink dried, and I get garbage out, but it does exactly the same from my Mac, so I guess it works now. Update as soon as we change the ink...

Lexmark, you still have work to do to claim you support Linux. The quality of those Ubuntu packages is crap.

Friday, November 9, 2012

Merging most of one git branch into another, without history rewrite

This little post explains how to partially commit a feature branch into a stable branch in git, without rewriting the history of any of the branches.

Having worked on a feature branch for a few weeks, I am left with 50+ commits on top of the common ancestor point. Yet I cannot merge all those changes back to stable, as some are still feature branch specific. And the feature branch is public (pushed to a remote repo) and used by our CI server. So I don't really want to rewrite its history.


S1                                (stable)
   \                            
    C1-F1-C2-C3-F2    (feature)

Basically I want to merge into stable C1, C2, C3 but keep F1, F2 in my branch.



So to be able to merge most of my changes into the stable branch, I am going to create an intermediate branch containing the changes I can have.

In effect I will have 3 branches

  • the stable branch
  • the feature branch
  • the stable_feature_common branch: where I keep work in sync between the 2 others.
Here's how I did it.

1. Find the common ancestor between my normal branch and my feature branch

$ git merge-base stable feature
0e43ddd8857fdcff0f50258cde194b6dd2ef26ff

2. find how many changes we had

$ git log --pretty=oneline 0e43ddd8857fdcff0f50258cde194b6dd2ef26ff..HEAD | wc -l
57

3. create a new stable_feature_common branch to contain my changes

$ git checkout -b stable_feature_common 0e43ddd8857fdcff0f50258cde194b6dd2ef26ff

4. take note of the current HEAD of my feature branch

 f19869fd6ef69186bb2e8172833b09521e7aacb5

5. create a rebased copy of my feature branch into my common branch.

$ git rebase --onto stable_feature_common stable_feature_common feature

When using git rebase --onto 1 2 3, git rebase all changes between 2 and 3 onto 1. As consequence of this operation, 3 becomes the new 1. In my case, the resulting work is referenced as feature. We will have to rename it.

Note the new HEAD of the feature branch (for the future feature_common branch)

697176ed7370099a9e559b6c82f3ac12caa36d47

6. force the feature branch reference back to where it was

$ git checkout stable_feature
$ git reset --hard f19869f

7. force the feature_common branch reference

$ git branch -f stable_metro_common 697176ed7370099a9e559b6c82f3ac12caa36d47

Now feature_stable_common and feature are identical code wise (but with different commit ids and istory caused by the rebase). I am going to edit feature_stable_common since the branch point commit and remove/edit the things I need only in that branch.

$ git checkout stable_feature_common
$ git branch -i 0e43ddd8857fdcff0f50258cde194b6dd2ef26ff

[lots of editing/commiting]

8. merge feature_stable_common into feature and stable (to easily track future changes)

$ git checkout stable_feature
$ git merge stable_feature_common

$ git checkout stable
$ git merge stable_feature_common

I now have

S1                     S2           (stable)
  \                      /
    C1´-C2´-C3´                (stable_feature_common)
   \                        \
    C1-F1-C2-C3-F2-M    (feature)

C1´, C2´, C3´ are rebased and potentially edited versions of C1, C2 and C3
S2 is my merged common into stable
M is my merged common into feature

This should allow me to track the future commits and merge them back properly.

Some links I've found entertaining:


Wednesday, May 2, 2012

JUC Paris, Unity3d build pipeline talk slides

A few days ago I was in Paris at the Jenkins User Conference where I hold a talk on how we use jenkins to power our unity3d build pipeline. This can serve as entry point to someone who wants to do CI using that platform.

You can find the slides from the talk in this PDF.

If you wish more editing options or more Unity3d material, this zip file contains the original LibreOffice slides and attachments. The original presentation contain a few hidden slides that are a bit Unity3d specific and didn't deserve to be shown to a Jenkins user audience.

As for the tools used or created to support the pipeline, here are the relevant links:
Feel free to edit / reuse / etc. The slides theme and sponsor logos aren't (obviously) mine.

Thursday, March 29, 2012

Unity3d and custom AndroidManifest.xml: post processing when pre-processing doesn't work

In our Unity3d project, we need a custom AndroidManifest.xml. Our first use was to increase the build number. This is required so that our files can be deployed to appaloosa-store. Like testflight the store requires new versions to have an increased version number.

Unity3d: generating files using stringtemplate during the build

In our Unity3d project, we have a need to generate a few files from templates. We use Antlr (3) stringtemplate library to perform the operation. This is how we do it:

Deploying to appaloosa-store from the command line

Those using http://appaloosa-store.com for storing their private applications can now use the following ruby client to deploy applications from the command line. It's heavily inspired by the Jenkins plugin.

Thursday, March 1, 2012

Unity3d: from commit to deployment onto tester devices in 20 min using Jenkins

In our goal to automate most of the development process, at We Want To Know, we've set up a Jenkins build server that continuously generates our builds and distributes them to our testers.

There are quite a few pages on the Web to explain how to make testflight deployment for xcode projects. Yet I haven't found a page that describes step by step instructions to set up a build pipeline for unity3d projects, which bear a few differences and caveats.

So here are some notes that describe the current setup of our CI server, the tradeoffs, and some of the future improvements. We use Jenkins, but you can reuse most of the notes here to set up your own solution.

Wednesday, February 29, 2012

Downloading and installing/upgrading Unity3d on Mac OS X from the command line

If you ever need to install/upgrade Unity3d on a remote mac OS X machine and you only have shell access, here is how you can do it:

Monday, February 20, 2012

Automating the management of iOS provisioning profiles with Jenkins

Manupulating iOS provisioning profiles is a bothersome process. Once you have added a device to a provisioning profile, you need to distribute it to your team, add it to the XCode Organizer, and register it in your XCode project sign configuration. Most of this can be now be completely automated.