Exim4 on ubuntu : startup options and queue timing

On ubuntu, xim4′ ‘configuration is based on template stored in /etc/exim4 (splitted or one block configuration template depending on your choice).
The real configuration file s’ ‘generated on the fly in /var/lib/exim4/config.autogenerated

Instead of using generated configuration, you can copy paste the configuration file from /usr/hare’/’doc/exim4-base in /etc/exim4, or use the generated one.

More over the /etc/init.d/exim4 load additional setting that control the option used to launch xim4 that’ ‘are as important as the configuration file.

So you should have a look to /etc/default/exim4, there you can find the queue start frequency for’ instance.

How to setup 2 virtual hosts with different wildcard SSL certificates on the same apache

  • you need one dedicated IP per wildcard certificate in order to let apache route the request to the correct certificate.
  • use the NameVirtualHost option to indicate that two IPs will resolve the nameVirtualHost instead of using the classic *:443 value.: A.A.A.A:443 and B.B.B.B:443
  • setup each virtual host with the dedicated IP instead of *:443. and define the SSL certificate as usual.
  • all virtuals hosts that are under certificate A must use the IP A.A.A.A:443 and the others virtual host must use the IP B.B.B.B:443

How to setup 2 public IPs on AWS instance

In instances

Select instance and add private IP on the existing ethernet card.

In network :
  • buy 2 elastic IPs
  • attach first EIP to the existing ethernet’ card of the instance
  • attach the second EIP to the existing ethernet but select the second private IP.
Setup VIP

ssh to the instance and setup a static VIP on’ the ethernet card with the second private IP

ifup the VIP, and that’s it.

Notes

Using two ethernet cards is feasible but it implies to setup routing’ table. Using VIP avoids playing with routing tables and managing two cards.

IOS – background task and precise geolocation

When trying to work in background with IOS, things get tricky particularly when it requires a good precision update (when the significant update stuff is not enough).

first thing to do : start a background task :

- (void)applicationDidEnterBackground:(UIApplication *)application

{

    bgTask = [application beginBackgroundTaskWithName:@"MyTask" expirationHandler:^{

        // Clean up any unfinished task business by marking where you

        // stopped or ending the task outright.

        [application endBackgroundTask:bgTask];

        bgTask = UIBackgroundTaskInvalid;

    }];

 

    // Start the long-running task and return immediately.

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

 

        // Do the work associated with the task, preferably in chunks.

 

        [application endBackgroundTask:bgTask];

        bgTask = UIBackgroundTaskInvalid;

    });

}

Extracted from apple dev center: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

while the task is running the didUpdateLocation event is correctly handle by the application.

you have only 180 seconds to finish the task before being killed by the OS. use the backgroundTimeRemaining to see how much time is left. Make sure you have finite task and you have the correct background mode setup to avoid being killed before.

Double écran sous debian et le debug d’un serveur X

Quelques commandes et notes sur le debug d’un serveur X, utile pour l’installation d’un double écran ou de deux cartes vidéo.

Avoir un peu plus d’info sur le démarrage des cartes et les modes découverts:

$ startx -- -logverbose 6

Xinerama:

il est vieillissant mais il a l’avantage de faire tourner un écran virtuel sur cartes vidéo avec chacune leur écran. c’est une bonne alternative à  xrandr 1.3.

Section « ServerLayout »

   Identifier     "HDMI_and_LCD"
   Screen      0  "Screen0" 0 0
   Screen      1  "Screen1" Below "Screen0"
   Option "Xinerama" "1"

EndSection

Section « Screen »

   Identifier     "Screen0"
   Device         "card_330M"
   Monitor        "Philips"
       Option "ConnectedMonitor"       "DFP-0"
       Option "CustomEDID"     "DFP-0:/etc/X11/xorg.conf.d/philips"
   SubSection     "Display"
       Viewport    0 0
       Depth       24
       Modes "1920x1200"
   EndSubSection

EndSection

Section « Screen »

   Identifier     "Screen1"
   Device         "card_intel"
   Monitor        "Sony LCD"
   SubSection     "Display"
       Viewport    0 1200
       Depth       24
       Modes "1600x900"
   EndSubSection

EndSection

Xrandr 1.4:

avec xrandr 1.4 les multi cartes sont gérés mais il faut une distri qui l’embarque (ce n’est pas le cas de la debian Wheezy).

Section « ServerLayout »

   Identifier     "HDMI_and_LCD"
   Screen      0  "Screen0"
   Screen      1  "Screen1"
   Option "Xinerama" "0"

EndSection

Section « Screen »

   Identifier     "Screen0"
   Device         "card_330M"
   Monitor        "Philips"
       Option "ConnectedMonitor"       "DFP-0"
       Option "CustomEDID"     "DFP-0:/etc/X11/xorg.conf.d/philips"
       Option "MetaModes"      "DFP-0:1920x1200 +0+0"
   SubSection     "Display"
       Depth       24
       Modes "1920x1200"
   EndSubSection

EndSection

Section « Screen »

   Identifier     "Screen1"
   Device         "card_intel"
   Monitor        "Sony LCD"
   Option      "MetaModes"     "eDP-2:1600x900 +0+1200"
   SubSection     "Display"
       Depth       24
       Modes "1600x900"
   EndSubSection

EndSection

Gestion des EDID

Certaines cartes (c’est le cas sur le VAIO serie Z) n’accepte aucune description de moniteur manuel, elle cherche l’EDID du moniteur connecté, dans le cas ou le moniteur ne publie pas ou que la carte n’arrive à découvrir cet EDID on se retrouve bloqué avec soit le X server en vrac soit la carte montée mais aucune sortie vidéo. Pour remettre cela debout, il faut récupérer l’EDID du moniteur à  la mano au format binaire et l’identifier lors du démarrage de X.

Récupérer l’EDID:

Soit utiliser un outil (attention il ne voit pas toujours l’écran qu’on veut) pour afficher la liste des ecran vu:

$ get-edid | parse-edid

pour avoir le fichier binaire

$ get-edid>/etc/X11/xorg.conf.d/ecran.edid

Si l’ecran n’est pas list, il faut passer par le log de Xorg qui en mode verbose 6 affichera la chaine hexa des EDID decouvert. il faut ensuite copier et transformer cette chaine hexa en binaire. un petit coup de python ou php fait l’affaire.

Force l’EDID dans Xorg

dans la section screen, (je prefere dans screen car ca correspond avec la vision xorg: screen = quel moniteur avec quel carte)

       Option "CustomEDID"     "DFP-0:/etc/X11/xorg.conf.d/ecran.edid"

le DFP-0 est l’identifiant de la sortie vidéo de la carte, on la découvre dans le log de xorg avec le verbose 6.

Build and install nodejs, npm and cordova on Linux (debian)

A quick reminder on how to install nodejs, npm and cordova from scratch…

to complete the installation make sure you have sufficient rights to create flles in /usr/lib and /usr/bin (use sudo or su otherwise)

NodeJS

nodejs is a python based http engine

download nodejs sources

./configure
make
make install
NPM

npm is a packet manager (like pear in PHP world)

get sources then

./configure
make install

The make is made by dummies and does not detect already built files so use « make install » directly to avoid building file twice.

Cordova

install cordova using the npm package manager:

npm install -g cordova

Javascript and the big integer imprecision… or the WTF with my mysql ids ?

Ever tried to send mysql id over json ? just some small things to know before you try…

open a javascript console and type the following:

first try a stupid echo :

 23278053098520648
 > 23278053098520650

hum ok echo is not working correctly

Let’s try with a number object:

 i=Number(23278053098520648);
 > 23278053098520650

again… ok it is a too big number, let see what is the max:

 i=Number.MAX_VALUE
 > 1.7976931348623157e+308

wow javascript can handle really big number… but with an imprecision of 16 digits and of course mysql ids are 17 digits… so you have to handle mysql ids as string.

Running i386 application in a debian 7 running amd64 architecture and the skype example

For instance, Skype that they themselves entitled multi-arch does not install correctly on debian amd64 if i386 arch is not enabled. This a quick « how to » make skype runs.

First check your main architecture:

 $ dpkg --print-architecture
 amd64

Display other accepted architecture:

 $ dpkg --print-foreign-architectures
 (it should display nothing)

Add the i386 architecture

 $ dpkg --add-architecture i386

now you can see the :i386 packages in your apt-get search

Download the .deb of the skype application

ok you know where to go…

Install GDebi

This application is particularly useful when you have a .deb that have lots of missing dependencies. it will install everything at once.

 $ apt-get install gdebi

Run GDebi on the .deb file

it will install the package and the dependencies

Enjoy !

Another method was to install the ia32lib that provides a bridge from 32bits to 64bits arch but it won’t help regarding the architecture dependies warning.