Andreas Prang

Unix & Coding Tutorials







I created a small example project for accessing Objective-C from Swift and Swift from Objective-C. It’s compatible starting with iOS 7.

It’s located on github:

April 10th, 2014

Google Drive – Crash

No Comments, Mac, by AndreasPrang.

“Actually” () Google Drive is crashing all the time if you try to sync more than ~3000 files. This is because of a memory leak in the app and an other interesting point! Google Drive is an 32 Bit application.

There actually is just one way to sync Google Drive. Restart Google Drive every ~20 Minutes when you got an error message like:

NSMallocException – Attempt to allocate xxxx bytes for NS/CFData filed.
Google Drive Crash NSMallocException










With this script you automatically can restart Google Drive every 20 Minuted for the initial synchronization:


while true;
killall Google\ Drive
open /Applications/Google\
sleep 1200

If you want to set up ThinClients for connecting to a Windows Terminal Server on boot, the easiest way is to use a Tiny Core Linux and customise it. The whole setup takes 5 Minutes :-)

Dezember 15th, 2013

Mac OSX – perfect Terminal Settings

No Comments, Mac, by AndreasPrang.

TerminalSeveral years I used the Terminals as it is. Some months ago I started configuring the Terminal settings and now it’s perfect.
To get the settings enabled for your terminal just download and install the free font and my terminal settings:



  1. SourceCodePro
  2. Settings.terminal
  3. To get the perfect font colors follow my article from 2010: ls –color unter Mac OSX / BSD Unix


  • Perfect font …
    • to get the differences between chars like l and I or O and 0
    • not to fat or thin
    • monospaced
  • Terminal windows in the background are translucent
  • Cursor is high visible
  • special window title
  • background color is a very eye friendly light grey (very close to white)


perfect Terminal

glassfishDie Installation von GlassFish 4.0 schlägt auf Linux-Systemen welche nicht in englisch installiert sind fehlt. Die folgenden Schritte funktionieren:


# uninstall openJDK
   0   yum remove java-1.6.0-openjdk      

# download Oracle JDK
# install Oracle JAVA
   0   yum reinstall '/tmp/jdk-7u45-linux-x64.rpm' 
   1   java
   2   java -version
   3   alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_45/jre/bin/java 20000
   4   alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_45/bin/jar 20000
   5   alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_45/bin/javac 20000
   6   alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_45/jre/bin/javaws 20000
   7   java -version
   8   ls -lA /etc/alternatives/
   9   alternatives --set java /usr/java/jdk1.7.0_45/jre/bin/java
   10  alternatives --set javaws /usr/java/jdk1.7.0_45/jre/bin/javaws
   11  alternatives --set javac /usr/java/jdk1.7.0_45/bin/javac
   12  alternatives --set jar /usr/java/jdk1.7.0_45/bin/jar
   13  update-alternatives --install "/usr/bin/jar" "jar" "/usr/java/jdk1.7.0_45/bin/jar" 1
   14  java -version
   15  export JAVA_HOME=/usr/java/jdk1.7.0_45/bin/java

# install GlassFisht 4.0
   0   wget
   1   unzip -d /opt/oracle/
       # Full edition:
   2a wget
       # Webedition:
   2b wget
       # Avoid error: Fehler beim Rendern von SWIXML Frame=content area Verursacht durch: Invalid SwiXML Descriptor.
   3   LANG=EN sh ./
   4   Follow this perfect instructions:

To get the last time Windows Users logged in to a Windows Domain Server just type this into Windows Power Shell:

$([ADSI]"WinNT://$env:COMPUTERNAME").Children | where {$_.SchemaClassName -eq 'user'} | ft name,lastlogin

Mit diesem kleine Code sniped kann die aktuelle Version des genutzten iPhone / iPod / iPad bestimmt werden.

#import <sys/utsname.h>

struct utsname u;

NSString *name =  [NSString stringWithCString:u.machine encoding:NSUTF8StringEncoding];

NSArray *oldDevices = @[@"iPhone1,1", @"iPhone1,2", @"iPhone2,1", @"iPhone3,1", @"iPhone3,2", @"iPhone3,3", @"iPod1,1", @"iPod2,1", @"iPod2,2", @"iPod3,1"];

if ([oldDevices containsObject:name])
    // Workaround for old devices


SSH_Communications_Security_logo.svgTo increment your servers security one position might by to disable ssh login with password and use certificated login instead. But if you are not familiar withe the given tools, creating the requested certificates and how to install them on the server and your client the following script will help you. Just run it on your Mac or *nix system.  More

vmware_logo3If you want to Backup your virtual machine every night and need to keep more than one version the following batch / script is what you’re looking for.




$isAndroid 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"Android");
$isiPad 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],'iPad');
$isiPhone 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$isiPod 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iswebOS 			= (bool) stripos($_SERVER['HTTP_USER_AGENT'],"webOS");
$isBlackBerry 		= (bool) stristr($_SERVER['HTTP_USER_AGENT'],'blackberry');
$isWindowsMobile 	= (bool) stristr($_SERVER['HTTP_USER_AGENT'],"Windows Mobile");
$isMobile 	= ($isAndroid || $isiPad || $isiPhone || $isiPod || $iswebOS || $isBlackBerry || $isWindowsMobile)