Tuesday, January 28, 2014

Deploy Audio Content fo Garageband in Mavericks

Well, the basic deployment is easy.

Download the app from the app store and deploy it using images, software distribution, whatever you like. Just make sure you have enough licenses.
Which ist no longer that big of a problem since GarageBand comes free with new Macs….

The problem however is, that Garageband 10.x wants to download additional stuff when GarageBand ist started the first time.

This is an issue and annoying because
a) it is 1.4 GB and is not using the local software update or caching server
b) non-administrators are not able to install this package.

When started GarageBand begins to downloads this:

http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_GarageBandCoreContent.pkg

That means, if you download this package, you can deploy it right along with GarageBand.

Enjoy.

Update:

With Garageband 10.0.2 there seems to be some additional content available.

It downloads this plist: http://audiocontentdownload.apple.com/lp10_ms3_content_2013/garageband1002_en.plist?app=GarageBand&ver=10.0.2&country=CH&language=de&o If you examine this plist, you can find out, which packages are installed. Garageband downloads and installs these packages:

MAContent10_GarageBandCoreContent.pkg
MAContent10_GarageBandPremiumContent.pkg
MAContent10_GB_StereoDrumKitsSongWriter.pkg
MAContent10_GB_StereoDrumKitsAlternative.pkg
MAContent10_GB_StereoDrumKitsRock.pkg
MAContent10_GB_StereoDrumKitsRnB.pkg
MGBContentCompatibility.pkg


To get them, download these packages:

http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_GarageBandCoreContent.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_GarageBandPremiumContent.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_GB_StereoDrumKitsSongWriter.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_GB_StereoDrumKitsAlternative.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_GB_StereoDrumKitsRock.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MAContent10_GB_StereoDrumKitsRnB.pkg
http://audiocontentdownload.apple.com/lp10_ms3_content_2013/MGBContentCompatibility.pkg

Tuesday, January 21, 2014

How to split a PDF with spread pages to single pages

I recently bought a book that is not available as eBook.

As I wanted to take the book with me on my iPad I thought that I would digitize it and convert it to an eBook.

Ok. Sounds easy.
It is not.

First it it is not that easy to scan a complete book with around 330 pages.
But ok. That was doable. I used a Canon Multifunction Copier 'iR-ADV C5030'.

I scanned around 100 pages and sent the PDF as Email.

Now comes the interesting part.

I used Adobe Acrobat Pro version 10.1.9 do join the PDF.
No now I had a complete document of the book.

But wat, there's more.
The thing is that when scanning this way, I get a PDF that contains both the even and the odd page of a book on a singe page within the PDF.
This is not what I want.

So here's the trick:

The scan was quite precise. So I used the function 'Recognize Text > In this File'.
This not in order to get the text. What this function also does is rotate the scans so that the text is horizontal.
The next step was this: Save the PDF and make a copy of it. Open the copy and crop the pages so that only the even pages are left. Make another copy and crop it so that only the odd page numbers are left.
So OK. Now we have tow PDF files. One contains all pages with even page numbers, the other one contains all the pages with odd page numbers.
Fine. But now I need to merge these two files. Having used AppleScript a lot, I quickly came up with a script that does just that:


property pages_even : "scans_even.pdf"
property pages_odd : "scans_odd.pdf"

tell application "Adobe Acrobat Pro"
activate

set c to number of pages in document pages_odd
repeat with i from 1 to c
set b to (i * 2 - 1) as integer
-- display dialog "inserting page " & i & " after " & b
insert pages document pages_even after b from document pages_odd starting with i number of pages 1
end repeat
end tell


This takes every page of the odd pages and inserts it in the right place in the even document.
This way I end up having a PDF that contains single pages instead of spread pages.

Wednesday, September 12, 2012

Secure Remote SSH Connection with no passwords OSX 10.7

So why does my method to set up passwordless SSH remote login no longer work with 10.8 Mountain Lion?

It used to be so easy:

  • Generate the key:
    ssh-keygen -b 1024 -t rsa -f id_rsa -P "" 
  • Copy the key to a new file:
    cp id_rsa.pub authorized_keys2
  • Create the .ssh folder on the target machine
    mkdir .ssh; chmod 0700 .ssh
  • Copy my key to the target machine:
    scp authorized_keys2 root@target:/private/var/root/.ssh


This no longer works on 10.8 Mountain Lion.
Why?

Well the solution is very simple:
The name of the file has changed.

The name of the file on the target machine containing the public key has changed.
'authorized_keys2' no longer works.

If you change the name to 'authorized_keys' it will.

That's all folks.

Tuesday, September 4, 2012

OS X Lion Mail redirection

As you might already have found out:
Workgroup Manager since 10.7 Lion no longer has an options to set any options for mail.
But they are still there. Even in 'Mountain Lion', 10.8.

Today I had to redirect a mail account of a user who left us to his successor.

In order to do so, you need the 'Directory Utility'. Is is located here
'/System/Library/CoreServices/Directory Utility.app'.

After starting the utility you have to go to LDAP and select the user. Then authenticate by clicking on the lock button using you OD admins account.

 Now here's the trick.

The parameters regarding mail are located in the xml structure named 'MailAttribute'.

The two attributes that need to be changed are:


  • kAutoForwardValue: from empty to the target email address
  • kMailAccountState: from 'Enabled' to 'Forward' 


That's all there is to it.
This may also be accomplished via command line using 'dscl'.

I found the infos I needed here.

Thursday, October 20, 2011

OS X Lion & Mail Quotas

Since OS X Lion no longer offer a GUI to change the Mail Quota size of a user, I had to find out a new way.
I know that for individual users it is possible to do this using the Directory Utility.

But that's not what I want if I have to change dozens of users.

So I figured out a way to do this using dscl:

This is how you read the current value of the Mail Quota:

MailQuota=`dscl /LDAPv3/my.server.com -readpl /Users/$theUser MailAttribute kUserDiskQuota`

And this way you may set a new value:

dscl -u diradmin -P $diradminpass /LDAPv3/my.server.com -createpl /Users/$theUser MailAttribute kUserDiskQuota $newvalueInMB

Unfortunately this value does not get updated on the mail server immediately.
In order to get the mail server to update the quotas, you have to do this:
Delete or rename /var/db/.mailusersettings.plist

Then manually recreate the file '/var/db/.mailusersettings.plist':

serveradmin stop mail
rm  /var/db/.mailusersettings.plist
touch /var/db/.mailusersettings.plist
chown _postfix:mail /var/db/.mailusersettings.plist

chmod g+w /var/db/.mailusersettings.plist 
serveradmin start mail

Restarting the mail service updates the per user mail quota defined in OD.

What might also help is to try this:

doveadm quota recalc -u username

Thursday, January 14, 2010

SMS Server Tools on Mac OS X with Swisscom Unlimited USB Modem E180V

We set up a server to monitor our servers, services and network devices.

Monitoring on Mac OS X


What we started off with is

- a Mac Mini with Mac OS X 10.6 Snow Leopard Client
- Lithium 5 Monitoring Software www.lithium5.com

What I wanted to do is also monitor our internet connection.
For that case we ping www.google.com.
If that service is unavailable, we expect the internet connection to have failed.

The problem now is:
If the internet connection is down, then we cannot alert via email or push notification because we have to assume that there is no connection to the internet.

The idea now is, that in this case, we alert via SMS.

The Device


So I went to our local phone provider and bought a USB HSPA/UMTS/EDGE/GPRS modem.
Thy type I chose is called 'Unlimited USB Modem E180V' which in fact is a Huawei E180V.

As we do not plan to use the Modem to surf the web, we decided to get a prepaid card along with it.
This means we can recharge it by using the credit card.

What's next?

We installed the modem an downloaded and installed the current software to go along with it from the providers web page.
It works.
But: In order for the modem to work, one has to log in and start the application of the provider, in out case:
/Applications/Unlimited Connection Manager.app

Now that is not what I wanted.
The problem is that without having started the app, the modem will not appear as a device in /dev
Which means that the device is not operable. Hmm.
But I do not want a user to have to log in and start the app on this machine.

So here's what did the trick:
I looked at the installer package that came with the modem using Suspicious Package.
It does not install anything other than the application.
So it has to be something inside the application bundle that has to be initiated to make the modem available to the system.
After poking around a bit, I found this folder:
/Applications/Unlimited Connection Manager.app/Contents/Drivers
It contains a kext ba the name of 'HuaweiDataCardDriver.kext'.

So what do I do:
We load the kext:
kextload "/Applications/Unlimited Connection Manager.app/Contents/Drivers/HuaweiDataCardDriver.kext"

And what happens:
We now see the device in /dev:

crw-rw-rw- 1 root wheel 11, 7 Jan 13 15:17 cu.HUAWEIMobile-Diag
crw-rw-rw- 1 root wheel 11, 9 Jan 14 12:35 cu.HUAWEIMobile-Modem
crw-rw-rw- 1 root wheel 11, 5 Jan 13 15:17 cu.HUAWEIMobile-Pcui
crw-rw-rw- 1 root wheel 11, 6 Jan 13 15:17 tty.HUAWEIMobile-Diag
crw-rw-rw- 1 root wheel 11, 8 Jan 13 15:17 tty.HUAWEIMobile-Modem
crw-rw-rw- 1 root wheel 11, 4 Jan 13 15:17 tty.HUAWEIMobile-Pcui


So basically we are now ready to send SMS.
Theoretically.

Sending SMS


When trying to find information on how to send SMS notifications via shell script, found out that there is one big problem.
While sending an SMS the device is blocked so that sending is no longer possible until the first SMS has been sent.
So one would need some kind of queue.

As it turns out, there's an app for that.
The solution is SMS Server Tools 3.

«The SMS Server Tools 3 is a SMS Gateway software which can send and receive short messages through GSM modems and mobile phones.»

And it is open source too!!!
So I downloaded it and compiled it using the apple developer tools.

Now, all we have to do is add the correct device to the config file of the smsd.

device = /dev/cu.HUAWEIMobile-Modem

And we need to start the smsd.

The Script


So we created a script that loads the extension, unmount the volumes provided by the UMTS modem and start the SMS service.

The script looks like this:

#!/bin/sh

# Script that loads the extension, unmount the volumes provided by the UMTS modem and start the SMS service
# Created by kurt hofmann © 2010

diskutil unmount /Volumes/NO\ NAME
diskutil unmount /Volumes/Unlimited\ Connection\ Manager

kextload /Applications/Unlimited\ Connection\ Manager.app/Contents/Drivers/HuaweiDataCardDriver.kext

/usr/local/bin/smsd


This script is then started by a launchd job on startup.

SMS can now be sent using this command from the command line:
sendsms thenumber 'the message'
thenumber is an international phone number without the leading zeros.

Receiving SMS


Now that sending SMS works I wanted to know what it needs to receive SMS.
Then when I send an SMS it might be that someone replies to that message, so it might be useful to receive them.
SMS Server Tools 3 provides a solution for that.

There is an eventhandler that gets called whenever it receives or sent a message or when it was not able to send a message.
So I created a script that sends me an incoming SMS as an email.

The script is here /usr/local/bin/sms2email

It looks like this:

#!/bin/sh
# This is an example how to use an eventhandler with smsd.
# $1 is the type of the event wich can be SENT, RECEIVED, FAILED or REPORT.
# $2 is the filename of the sms.
# $3 is the message id. Only used for SENT messages with status report.

#The next line changes the file attributes so that everybody can read
#received SM
#if [ "$1" = "RECEIVED" ]; then
# chmod a+r $2
#fi

email_receiver="email@provider.com"


#This sends all received SM to an eMail receiver:
if [ "$1" = "RECEIVED" ]; then
/usr/bin/mail -s "Incoming SMS" $email_receiver <$2
fi


Now all we have to do is to is put a reference to the script into the smsd.conf file.

When trying this, I found that there was a problem trying to read the SMS from the device.
So I had to add an additional init string to put the modem in the right mode.

The smsd.conf file


So this is what my config file looks now:

# Example smsd.conf. Read the manual for a description

devices = GSM1
logfile = /var/log/smsd.log
loglevel = 6
smart_logging = yes
eventhandler = /usr/local/bin/sms2email

[GSM1]
init = AT+CPMS="MT","MT","MT"
check_memory_method = 2
device = /dev/cu.HUAWEIMobile-Modem
incoming = yes
#pin = 1111


Conclusion


Now this works perfectly for my needs.
I now have a server that can send SMS per cli and it can even receive SMS and forward them as email.
Cool.

If you have any questions just let me know.

Thursday, August 20, 2009

Troubleshooting: MCX in Leopard

Troubleshooting: MCX
•  Launch Terminal
•  Run the mcxquery command
– mcxquery –user
– mcxquery –group
– mcxquery –computer

Troubleshooting: MCX
•  Login as the user.
•  Launch System Profiler from /
Applications/Utilities
•  On the left, under Software, select
Managed Preferences.
•  On the right the details of the
preferences being applied to the
Computer.

Troubleshooting: MCX
•  sudo dscl . –delete /Computers
•  sudo rm –rf /Library/Managed\
Preferences

Hint found here:
Keep Control of Your School’s Leopard by Amanda Kunes.