Showing posts from 2014

Setup local wordpress multisite

As I do maintain multiple wordpress site that share common source code, the easiest for me was to install a wordpress multisite locally.

Assuming you managed to install lamp and wordpress, these are the additional step needed before enabling multisite

Activate the apache Mod_Rewrite module:

$ sudo a2enmod rewrite

Allow .htaccess changes in the virtual file. Open your default virtual host file (assumed).

$ sudo gedit /etc/apache2/sites-enabled/000-default

In the Directory section, change AllowOverride to All:

<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
AllowOverride All
                Order allow,deny
                allow from all

Install bower on Ubuntu 14.10

Summary of the command line to use$ sudo apt-get install npm nodejs $ sudo npm install bower -g $ ln -s /usr/bin/nodejs /usr/bin/node Explanation You need both nodejs and npm
$ sudo apt-get install npm nodejs Then you can install bower
$ sudo npm install bower -g Quick check
$ bower --version You might get /usr/bin/env: node: No such file or directory which you solve using $ ln -s /usr/bin/nodejs /usr/bin/node Quick check again
$ bower --version 1.3.12 Yeah!

Solving gcloud invalid choid: 'preview' or invalid choice: 'app'

After trying to run google cloud hello world for dart on Ubuntu and after installing gcloud sdk and using the following command

$ gcloud preview app run app.yaml
I was getting:

ERROR: (gcloud) Invalid choice: 'preview'.
Solution is to run:

$ gcloud components update preview
Then I was getting

ERROR: (gcloud.preview) Invalid choice: 'app'.

Solution is to run:

$ gcloud components update app
As it turned out, I could have simply done this in one command
$ gcloud components update preview app

Setup KVM and Open GL emulation on Ubuntu 14.04 for Android 5.0 emulator

I wanted to speed up my Android Emulator on my i5 desktop PC to try Android 5.0 Lollipop
I created a x86 AVD running Android 5.0 (I could not manage to use a x86_64 image as it was either slow or crashing)
KVMIntel processor seems to be required for now

First check if KVM can be used

$ sudo apt-get install cpu-checker $ kvm-ok INFO: /dev/kvm exists KVM acceleration can be used otherwise check your BIOS to enable KVM

I then simply append -qemu -enable-kvm to the command line (it has to be the last option) I use to start my emulator
Open GLMake sure use Host GPU is checked in the your AVD or append -gpu on to your emulator command line

To solve the following issue:

Could not load OpenGLES emulation library: cannot open shared object file: No such file or directory
Here the solution is to add the tools/lib directory to LD_LIBRARY_PATH
My final command line, assuming ANDROID_SDK point to you android sdk installation (in my case: /opt/apps/android-studio/sdk)LD_LIBRARY_P…

Setup oracle java 7 on Ubuntu 14.04

I wanted to try oracle jdk vs openjdk performance for the DartEditor I chose

jdk-7u71-linux-x64.tar.gz that I extracted to

Then comes the configuration:

# One time setup # local var $ LOCAL_JAVA_TOP=/opt/apps/jdk1.7.0_71 # setup sudo update-alternatives --install /usr/bin/java java $LOCAL_JAVA_TOP/bin/java 110 sudo update-alternatives --install /usr/bin/javac javac $LOCAL_JAVA_TOP/bin/javac 110 Then to change configuration:

# To change configuration between openjdk / oracle sudo update-alternatives --config java sudo update-alternatives --config javac
At first, Oracle looks slightly slower in a simple test where I started exited the editor with a complex project. However the overall experience looks slightly be completed after some days of usage...

Add trash support to external mounted drive

In finishing my "migration to a new machine" process, since I kept my old ssd drive. However the trash on this drive was not working and deleting a file was always giving:

are you sure you want to permanently delete “xxx”?

I had 2 issues:
my user could not write on the root of the drivemy user could not write in the existing trash The simplest was to own the drive

$ sudo chown xxx:xxx /media/xxxx
As I  have other user accessing the drive, I also has to change the permission

$ sudo chmod 0775 /media/xxxx

Simple ssh without password

I have to ssh into a server where the source and destination .ssh folder was empty (but ssh was installed)

Here are the steps needed (using rsa)

locally generate and get the content of the key (line starting with ssh-rsa...)

$ ssh-keygen -t rsa $ cat ~/.ssh/ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDb...rGSQxR8t xxx@xxxxxx

$ cd ~/.ssh $ touch authorized_keys $ chmod 600 authorized_keys and then to append the content of the public key to the list of authorized key

$ vi authorized_keys
In one command:

$ cat .ssh/ | ssh user@host 'cat >> .ssh/authorized_keys'

Playing with linux permissions

I have a shared folder, that I synchronize with unison (ssh) that I want to allow for read-write for 2 users, that unfortunately were not created in the same group

I choose the following solution so that I don't have to bother which user logs in using ssh: both user will be able to read/write files from each other

First I add each user to the other's group

sudo usermod -a -G other_group the_user
Then I add the proper permission (switching to the shared folder first)

sudo chmod -R u+rw,g+rw,o+r .
et voilĂ 

It turns out that the executable bit was set for all files. I decided to remove id

sudo find . -type f -exec chmod -x {} \;

Simple Samba setup on Lubuntu

I have a simple lubuntu server where I setup a ssh server. While it is sufficient to access a driver/folder from another linux machine using sftp, it is a pain from Windows & Mac, so unfortunately, samba is still needed here.

For simplicity I needed only one samba user that I could map to a single user on my lubuntu machine

Following the various tutorial I ended up doing this with simple commands

Install samba
$ sudo apt-get install samba Add myuser to the samba
$ sudo smbpasswd -a myuser Export the drive I needed (no guest user)
$ sudo vi /etc/samba/smb.conf to add the following export (no real option needed here)
[files] path = /media/music/files writeable = yes save and Restart samba
$ sudo service smbd restart

Epson AcuLaser 1750 on Ubuntu 64bits

There is no linux driver however the Xerox Phaser 6000 is compatible and the driver can be found here:

One issue is that the driver is 64 bits only so to make it work I had to install a 32 bits compatibility layer

$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 libcupsimage2:i386

Instruction are similar to what is posted here for the Xerox 6010

In my various attemps, I had to remove the driver, restart cups, install the 32bits layers and THEN reinstall the driver, then the printer. In the printers applet, the model of the printer is 'Xerox Phaser 6000B'

Making WebMIDI outputs work on Ubuntu with Timidity or fluidsynth

In my first experimentation with WebMIDI, I could never get any simple MIDI output on Ubuntu 14.04. I wanted at least to make it work with timidity.

I assume that you have enable WebMIDI in Chrome/Chromium/Dartium


I assume timidity is already running otherwise you can start it using

timidity -iAD

If you rather use fluidsynth you can start it with a command similar to

fluidsynth -a alsa -m alsa_seq -l -i /usr/share/soundfonts/fluidr3/FluidR3GM.SF2

the list of outputs using the WebMIDI API was empty although I had the following

$ aconnect -lo

client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 128: 'TiMidity' [type=user]
    0 'TiMidity port 0 '
    1 'TiMidity port 1 '
    2 'TiMidity port 2 '
    3 'TiMidity port 3 '
client 129: 'FLUID Synth (32737)' [type=user]

    0 'Synth input port (32737:0)'

The solution I found was to load snd-virmidi

$ sudo modprobe snd-virmidi

I the…

Cracking sound in Audacity in Ubuntu 13.10

While audio was playing fine in audacious and other music player in my Ubuntu 13.10, it was playing very fast and cracking in audacity. A solution that worked for me was to disable udev in the pulseaudio configuration

The one line solution was to change /etc/pulse/

sudo gedit /etc/pulse/

### Automatically load driver modules depending on the hardware available .ifexists load-module module-udev-detect .else ### Use the static hardware detection module (for systems that lack udev support) load-module module-detect .endif
### Automatically load driver modules depending on the hardware available .ifexists module-udev-detect.so_HACK_NO_UDEV load-module module-udev-detect .else ### Use the static hardware detection module (for systems that lack udev support) load-module module-detect .endif
The next thing was to quit Audacity, kill pulse audio

pulseaudio --kill
then restart Audacity.

Allow using Google API in Web applications from localhost

While most scenarios in Google Drive API doc and samples tells to run the sample app on a server, it is actually possible to run from localhost as long as the javascript origin is properly added:

Make sure you have created a new client id for web applications such as:

Client ID for web applicationClient ID123456789.apps.googleusercontent.comEmail address123456789@developer.gserviceaccount.comClient secretXxxxxXXXxxxxxxRedirect URIsnoneJavascript Originshttp:// For example for dart applications: