How to disable location or telephony on android box : use the system properties

If you have the sources of your box and you want to disable permanently some services you can use system properties.

first look at there, you’ll see how services are started :

frameworks/base/services/java/com/android/server/SystemServer.java

then you’ll see that most of the services have a boolean related to a system property, for instance location :

 boolean disableLocation = SystemProperties.getBoolean("config.disable_location", false);

and deeper in the file, you’ll see that this boolean is used to disable the service :

 if (!disableLocation) {
               try {
                   Slog.i(TAG, "Location Manager");
                   location = new LocationManagerService(context);
                   ServiceManager.addService(Context.LOCATION_SERVICE, location);

so basically you just have to find your system property file in your device tree, and force the value to true. Use a « find » to get it.

On rockchip device it is easy : the file name is system.prop. This file is used to generate the build.prop in the out folder.

Another way to force system properties is to use the Android.mk and force value with this specific token:

 
 PRODUCT_PROPERTY_OVERRIDES += \
    config.disable_location = true

Enjoy!

Enregistrer la sortie audio sur debian

Installation

Installer pulseaudio et sox,

Lancer pulseaudio :

 pulseaudio start

Récupérer la liste des entrée/sortie disponibles

 pactl list

Enregistrement

Enregistrer l’entrée monitor qui est une copie de la sortie audio dans un fichier wav 44kHz, 16 bit (entier signé) sur 2 canaux

 parec -d alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor |sox -t raw -r 44k -b 16 -e signed-integer -c 2 - music.wav

Pour cibler le maximum de qualité en sortie, on peut passer sur du 64bit a virgule flotante:

 
 parec -d alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor |sox -t raw -r 44k -b 64 -e float -c 2 - music.wav

Enregister le flux audio et vidéo de son bureau

!!! Pré-requis

* installer pulseaudio
* installer’ libav

!!! How to

Enregistrer le son et la video dans un fichier mkv :

avconv -f x11grab -video_size 1600×900 -i :0.0 -f alsa -i pulse -c:v’ libx264 -rc-lookahead 1 -threads 4 test.mkv

{{ adapter a la taille de l’ecran et le nombre de threads }}

Pour plus d’info sur libav : [Libav|https://ibav.org/documentation/avconv.html#libx264|en]

Lancer pavucontrol pour dirigier le flux audio sur avconv. La sortie monitor » permet d’avoir une copie du flux audio de sortie dans une entrée d’enregistrement.

!!! Annexe

Vous pouvez tenter aussi recordmydesktop avec pulseaudio

recordmydesktop –device pulse

La qualité video est meilleure’

How to remove an IP from Microsoft Blacklist

Some information related to Microsoft blacklisting:

https://technet.microsoft.com/en-us/library/dn458545%28v=exchg.150%29.aspx

https://mail.live.com/mail/services.aspx

A form to declare valid IP from your domain:

https://support.microsoft.com/en-us/getsupport?oaspworkflow=start_1.0.0.0&wfname=capsub&productkey=edfsmsbl3&locale=en-us&ccsid=635786776026032458

Look at your logs

Look at the message in your mail log. You should see the email address of a contact. You can also directly send an email to delist@messaging.microsoft.com

Check with a tool

A good tool to check if you are blacklisted: http://mxtoolbox.com/blacklists.aspx

Check you DNS zone file

Once blacklisted, make sure you are correctly setup on your side and check your DNS zone file: – SPF record – PTR

Send an email to gmail.com or yahoo and check the email header, it contains details regarding SPAM detection and SPF check.

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.