Articles de 'apple'
After testing GIT, and without hesitation, I decided to abandon SVN/Subversion. I won’t write here one more article comparing them but I wrote (and update regularly) a wiki page explaining how to install it on Debian and give access via HTTP, SSH and HTML.
http://wiki.gonzofamily.com/a/Install_GIT_as_public_repository_on_Debian
I also noted how I transfered my existing local XCode repositories to this server, but I will improve this doc soon:
http://wiki.gonzofamily.com/a/GIT_and_XCode
[Lire la suite →]
Tags: apple · dev · en · IT · network · Server
On iOS, you want to know your local IP (for example, when an application opens a webpage on the wifi interface) but the iOS SDK provides no simple way to get the IP Address for the wifi connection.
I found an interesting Method in Objective-C which retrieve the IPv4 address of the wifi connexion as a NSString on Zach Waugh’s blog.
Sadly it doesn’t work with IPv6. So I modified it and here is the code:
http://wiki.gonzofamily.com/a/Retrieve_local_IPv4/IPv6_on_Wifi/Cellular
[Lire la suite →]
Tags: apple · dev · en · IT · phone
On Linux we use to see the Processes associated to a listening network port with the following command
netstat -p
On Windows it’s
netstat -o
Sadly on Mac OS X this option doesn’t exist. The equivalent will be
sudo lsof -P
So we can imagine that we need to know which program dare listening on port 123
sudo lsof -Pn | grep 123
You will see something like that:
ntpd 21 root 20u IPv4 0x0899ace4 0t0 UDP *:123
ntpd 21 root 21u IPv6 0x0899ac08 0t0 UDP *:123
ntpd 21 root 22u IPv6 0x0899baa4 0t0 UDP [::1]:123
ntpd 21 root 23u IPv6 0x0899b8ec 0t0 UDP [fe80:1::1]:123
ntpd 21 root 24u IPv4 0x0899b810 0t0 UDP 127.0.0.1:123
ntpd 21 root 25u IPv6 0x098b5658 0t0 UDP [fe80:4::cabc:c8ff:fe90:6472]:123
ntpd 21 root 27u IPv6 0x098b5b80 0t0 UDP [2002:3ba7:d4b1::cabc:c8ff:fe90:6472]:123
ntpd 21 root 28u IPv4 0x15463370 0t0 UDP 10.0.130.101:123
ntpd 21 root 30u IPv6 0x15464b80 0t0 UDP [2002:3ba7:d4b1::c3e:e29a:8de6:68cc]:123
So it was the NTP Daemon with the process ID 21…. petit coquin !
(Cf this page of my Wiki: http://wiki.gonzofamily.com/a/Port_listening_on_Mac,_Windows_or_Linux)
[Lire la suite →]
Tags: apple · en · IT · network · Server
IPv6 makes it easy to track you. Let me explain.
IPv6 is composed of a Prefix and a suffix:
IPv6 address: 2001:0DB8:1fc3:481:b357:83ff:fecb:4c30
Prefix: 2001:0DB8:1fc3:481:
Suffix: b357:83ff:fecb:4c30
The prefix changes according to your internet access (at home, work, friend’s…) but the Suffix is deduced from your MAC address and will be always the same for one computer.
So even if your IPv6 Adresse changes, the end of it is unique and identifies your device for sure.
The counter mesure is called IPv6 Privacy Address.
When you enable this policy on your computer, a second IPv6 is randomly affected during autoconfiguration, called Temporary IPv6 address. Even if you cannot change the Prefix, the Suffix changes each time.
It means: you can still contact your computer with the previous IPv6 address, but in the other way (when the computer connect to the internet) it will have a different random address. It has got 2 addresses.
Windows Vista/Seven: it’s enabled by default, you certainly saw “Temporary IPv6 Address” in your ipconfig
Mac OS X 10.6: you have to enable it
How to enable IPv6 Privacy Address on Mac?
you must create the file /etc/sysctl.conf with the following content:
net.inet6.ip6.use_tempaddr=1
net.inet6.ip6.prefer_tempaddr=1
Next restart you’ll get a second IPv6 address and it will be prefered for every internet access.

But I use to protect my servers via the IP address!
Many SSH/FTP/HTTPS servers use IP Addresses to filter access. You would like to keep always the same IP.
I think that every client software should be able to choose which IPv6 address it want to use (since we have 2 IPv6 in Privacy Mode), I guess it will become common very soon. For example in ssh you can add the following line in .ssh/config :
BindAddress 2001:0DB8:1fc3:481:b357:83ff:fecb:4c30
But I think, most of the time, a limited access can be based on the prefix of your IPv6 address. Allowing all your local network to access.
[Lire la suite →]
Tags: apple · en · IT · network · windows
Being a user of Linux, I got used to change the port of SSH on my Mac with the following line:
sudo vi /etc/sshd_config
Then I could change the number and uncomment the following line:
#Port 22
Sadly I noticed that it makes my IPv6 SSH connection unavailable on the new port (neither on the previous port 22).
The real clean way of changing a Mac OS X Daemon is in the plist files
So now I just changed the port in the ssh.plist file and my SSH Daemon runs on IPv4 and IPv6, on the new port.
sudo vi /System/Library/LaunchDaemons/ssh.plist
And modify as following if you want the port to become 22222:
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>22222</string>
<key>Bonjour</key>
<array>
<string>22222</string>
<string>sftp-ssh</string>
</array>
</dict>
</dict>
You can add 2 lines to make SSH available only via IPv4:
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>22222</string>
<key>SockFamily</key>
<string>IPv4</string>
<key>Bonjour</key>
<array>
<string>22222</string>
<string>sftp-ssh</string>
</array>
</dict>
</dict>
[Lire la suite →]
Tags: apple · en · IT · network
After only 2 weeks in China I can give you some keys to avoid the waste of time I got. See the following apps:
Only one guide for 44 languages, it gives you translation of hundreds useful words and sentence from and to the 44 languages, very well made, easy to use:
Lingopal 44
Only one subway guide for 33 cities around the world:
Metro Maximus
700 offline cities maps to save Location and to be geolocalised via GPS:
700 City Maps (this apps is free, but each offline map must be bought, otherwise you just access an online map like google maps)
Currency exchange rates, works offline :
Currency
How could we survive before iPhones and iPads ??
[Lire la suite →]
Tags: apple · en · IT · phone
I wanted to use the 3G connection of my iPad in China. After “visiting” the 3 big companies in Shanghai, I can say they don’t sell data subscription for less than one year and unlimited does not exist.
I also have bought (180 yuan) a SIM card from China Mobile. I noticed that I can go on the internet. I noticed the APN was “cmnet”.
Then I tried successfully to use the China Mobile SIM card you can buy everywhere for less then 10€.
I will have to refund it once empty, but I’ll comment that post then. I think I will have to plug the SIM card back in a real mobile phone.
Of course I had to cut the SIM card to the micro SIM size.
I was connected to China Mobile and just added APN Settings :
APN name : cmnet
Login : (empty)
Password : (empty)
[Lire la suite →]
Tags: apple · en · IT · phone
Nous souhaitons activer le contrôle d’écran à distance sur un Mac OS X grace à la ligne de commande
sur Leopard :
$ echo -n enabled > /Library/Preferences/com.apple.ScreenSharing.launchd
sur Snow Leopard Mac OS 10.6 :
$ echo -n enabled > /private/etc/ScreenSharing.launchd
sur Lion Mac OS 10.7 :
$ sudo /bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
Pour le désactiver :
sur Leopard
$ rm /Library/Preferences/com.apple.ScreenSharing.launchd
sur Snow Leopard 10.6 :
$ rm /private/etc/ScreenSharing.launchd
sur Lion 10.7 :
$ sudo /bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.screensharing.plist
[Lire la suite →]
Tags: apple · fr · IT · network
iPhoto est bien sympa mais il a des limites, à commencer par le fait qu’il n’exporte pas dans des dossiers. Si on utilise les outils d’exportation on se retrouve avec toutes les photos dans un seul dossier !
grace aux commentaires sur cette page j’ai utilisé le script python suivant qui a fonctionné sur ma configuration :
- Mac OS 10.6.3 (Snow Leopard), avec le python intégré
- iPhoto 8.1.2
Je l’ai enregistré dans un fichier nommé “export-iphoto.py” dans le dossier “documents” de l’utilisateur “chris”, puis en lançant le terminal pour l’executer (en réalité je crois qu’on peut se contenter de double cliquer dessus, mais j’aime bien le mode ligne de commande
) :
cd /Users/chris/Documents
python export-iphoto.py
Voici le contenu du fichier export-iphoto où il faut bien prendre soint de changer ces 2 lignes
albumDataXml="/Users/YOURUSERNAME/Pictures/iPhoto Library/AlbumData.xml"
targetDir="/Volumes/share/pictures"
export-iphoto.py :
from xml.dom.minidom import parse, parseString, Node
import os, time, stat, shutil, sys
def findChildElementsByName(parent, name):
result = []
for child in parent.childNodes:
if child.nodeName == name:
result.append(child)
return result
def getElementText(element):
if element is None: return None
if len(element.childNodes) == 0: return None
else: return element.childNodes[0].nodeValue
def getValueElementForKey(parent, keyName):
for key in findChildElementsByName(parent, "key"):
if getElementText(key) == keyName:
sib = key.nextSibling
while(sib is not None and sib.nodeType != Node.ELEMENT_NODE):
sib = sib.nextSibling
return sib
albumDataXml="/Users/chris/Pictures/iPhoto Library/AlbumData.xml"
targetDir="/Volumes/FAT/pictures"
copyImg=True #set to false to run with out copying files or creating directories
print "Parsing AlbumData.xml"
albumDataDom = parse(albumDataXml)
topElement = albumDataDom.documentElement
topMostDict = topElement.getElementsByTagName('dict')[0]
listOfRollsArray = getValueElementForKey(topMostDict, "List of Rolls")
masterImageListDict = getValueElementForKey(topMostDict, "Master Image List")
#walk through all the rolls (events)
for rollDict in findChildElementsByName(listOfRollsArray, 'dict'):
rollName = getElementText(getValueElementForKey(rollDict, "RollName"))
print "\n\nProcessing Roll: %s" % (rollName)
#walk through all the images in this roll/event
imageIdArray = getValueElementForKey(rollDict, "KeyList")
for imageIdElement in findChildElementsByName(imageIdArray, 'string'):
imageId = getElementText(imageIdElement)
imageDict = getValueElementForKey(masterImageListDict, imageId)
modifiedFilePath = getElementText(getValueElementForKey(imageDict, "ImagePath"))
originalFilePath = getElementText(getValueElementForKey(imageDict, "OriginalPath"))
sourceImageFilePath = modifiedFilePath
modifiedStat = os.stat(sourceImageFilePath)
basename = os.path.basename(sourceImageFilePath)
year = str(time.gmtime(modifiedStat[stat.ST_CTIME])[0])
targetFileDir = targetDir + "/" + year + "/" + rollName
if not os.path.exists(targetFileDir):
print "Directory did not exist - Creating: %s" % targetFileDir
if copyImg:
os.makedirs(targetFileDir)
targetFilePath = targetFileDir + "/" + basename
iPhotoFileIsNewer = False
if os.path.exists(targetFilePath):
targetStat = os.stat(targetFilePath)
#print "modified: %d %d" % (modifiedStat[stat.ST_MTIME], modifiedStat[stat.ST_SIZE])
#print "target : %d %d" % (targetStat[stat.ST_MTIME], targetStat[stat.ST_SIZE])
#why oh why is modified time not getting copied over exactly the same?
if abs(targetStat[stat.ST_MTIME] - modifiedStat[stat.ST_MTIME]) > 10 or targetStat[stat.ST_SIZE] != modifiedStat[stat.ST_SIZE]:
iPhotoFileIsNewer = True
else:
iPhotoFileIsNewer = True
if iPhotoFileIsNewer:
msg = "copy from:%s to:%s" % (sourceImageFilePath, targetFilePath)
if copyImg:
print msg
shutil.copy2(sourceImageFilePath, targetFilePath)
else:
print "test - %s" % (msg)
else:
sys.stdout.write(".")
sys.stdout.flush()
albumDataDom.unlink()
[Lire la suite →]
Tags: apple · fr · IT
Sur Leopard et Snow Leopard, les polices systèmes sont restaurées dès qu’on essai de les supprimer.
Ainsi il est sacrément embattant de remplacer les polices Helvetica et Helvetica Neue qui ont pourtant le défaut majeur de ne pas intégrer les accents Français lorsqu’on exporte au format PDF à partir d’Adobe InDesigne, Photoshop, Illustrator…
J’ai trouvé sur la doc fournie par Extensis Universal Type Client (version réseau de Suitecase) une procédure permettant de les supprimer afin de pouvoir enfin les gérer via notre logiciel de gestion des polices :
- Ouvrir une session où l’utilisateur est Administrateur sur le Mac concerné
- Ouvrir le livre des polices
- Choisir “Livre des polices” > “Préférences“
- Désactiver “M’avertir si les polices système changent“
- Copier le dossier suivant vers un endroit où il sera en sécurité :
/System/Bibliothèque/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ATS.Framework/Versions/A/Resources/ProtectedFonts
note : ne jamais supprimer votre copie de sauvegarde du dossier “ProtectedFonts“, pour le cas où vous auriez besoin de ces polices dans le futur
- Ouvrir le dossier ProtectedFonts original et y supprimer Helvetica et HelveticaNeue
- Entrer un login administrateur lorsqu’il le demande
- Ouvrir /System/Bibliothèque/Fonts et y supprimer Helvetica et HelveticaNeue
- Ouvrir votre gestionnaire de police (Extensis dans notre cas) et activer EN PERMANENCE vos versions d’Helvetica et Helvetica Neue
- Redémarrer votre ordinateur

Explications : le contenu du dossier ProtectedFonts de Leopard et Snow Leopard assure que les polices qui s’y trouvent ne soient jamais supprimé du dossier /System/Library/Fonts . En effet il les restaure aussi vite qu’on essai de les supprimer. Ayant rencontré plusieurs Mac inutilisable après l’effacement de polices du système avant la version 10.5, je suis très content qu’une telle sécurité empêche les graphistes de faire du ménage eux-même.
Malheureusement, il vaudra tout de même qu’une police Helvetica et Helvetica Neue soit toujours disponible (grâce au gestionnaire de police utilisé), sinon le fonctionnement du système n’est pas assuré
[Lire la suite →]
Tags: apple · fr · IT