preload
Apr 20

Save this for myself later on.. Nice tip!

Terminal tip: easy email attachments: “

Filed under:

If you’re looking to automate the sending of emails with attachments quickly and easily (and aren’t too concerned with having some glamorous stationery), Terminal is once again your friend. It’s possible with Mail.app and AppleScript, but there are a few pitfalls and, for most purposes, a simple shell command will do the trick:

(echo 'This is the message body';uuencode Desktop/yourDoc.doc yourDoc.doc)|mail -s 'Test attachment' someone@adomain.com

The magical command in this one is uuencode, which is used to encode and decode binary files and can be used on just about any file type. The two arguments in the command above define the name and location of the source file and the name the file should have when it’s received. The parenthetical statement at the beginning combines the results of the echo and uuencode commands which are then piped (|) to the mail command. The mail command, having received the body text and attachment, is told to append a subject (-s ‘Subject’) and send it to the address specified. If you wanted to send a longer text file – with line breaks, perhaps – as the body, you could save the text in an external file and replace the echo statement with cat myfile.txt.

By adding a little complexity you could make a shell script that takes arguments, making the automation a little more flexible. But TUAW reader Adam was wondering how to send a photo he’d taken automatically using AppleScript (triggered by a Mail Rule). So here’s an AppleScript implementation that doesn’t require opening Terminal or dealing with Mail.app scripting:

set msgBody to 'This is the body of the message'
set msgSubj to 'Message subject'
set mailDest to 'someone@adomain.com'
do shell script '(echo '' & msgBody & ''; uuencode /Users/you/Desktop/pictosend.jpg pictosend.jpg) | mail -s '' & msgSubj & '' ' & mailDest

Make sure you remove any line breaks from that last line. This obviously requires a predetermined image name, but that could be made a variable as well and used as part of a larger script. We hope this helps, Adam!

(Via The Unofficial Apple Weblog (TUAW).)

Tagged with:
Apr 09
timemachine_hero20071016.png

Last week at around 2pm Friday afternoon I was working away having a IM conversation with a client and I heard a ‘click… click click’ from my MacBook Pro, then, the computer stopped responding. I knew what was going to happen in the next second or two.. and it did. My hard drive died. After one and half years of turning away almost 24 hours a day it gave out. All my data gone, years and years of emails gone, every piece of work, every contact, every line code ever written gone, every picture every taken in my life, gone.

The only reason why I was not totally freaking was that last month I had bought a external drive and enabled Time Machine backups. What was a little scary was that only solution, there where no other backups any where. I had put my entire faith in Apple’s Time Machine and I was about to find out if it was a good idea or not.

timemachine_icon20071016.pngSo my plan was to go buy a 500GB external hard drive and partition it into two parts. One half to make a backup of my Time Machine data (just in case) and the other half to install Mac OS X, then restore from my Time Machine data in order to use it to boot from so I am able to work while I wait for my replacement drive.

After about 8 hours or so (I was out so I can’t be sure) of restoring from my Time Machine share over ethernet I went to boot from my external drive for the first time and… it was perfect. Time Machine has done a perfect job of capturing all the data and then restoring it. All my mail, photos, documents development environments were all perfect and working. I’m a pretty hard core Apple fan-boy (I have the T-Shirts, I do the Windows trash talking, and most importantly I live a Windows free life) but I was just glowing at this point. I had put my entire faith in Apple’s Time Machine and it was a good idea.

But, as the title reads, Time Machine is not perfect… This next part will not effect 95% of Apple users as they don’t use Terminal or make changes to the OS… After a few days I noticed that some things were missing. I started keeping a list:

timemachine_hdicon20071016.png

  • Printers – my printers were not backed up. I had to add them again.
  • /etc/bashrc – the file was not backed up but the contents of the dir was. Weird.
  • /System/Library/StartupItems – The contents of that dir was not backed up. I noticed this because my Cisco vpn client failed. I ran the installer again and it installs a dir there: /CiscoVPN/CiscoVPN.
  • Security System Preferences – It was not returned to the same state. Usually have everything checked except for the ‘Log out after n minutes of inactivity’.
  • Time Machine System Preferences – It was ‘off’ when I restarted my machine. It was turned on when the machine crashed, on restore you have to manually turn it on again.

Personally, I think, for the consumer not commercial, Apple is way ahead if it’s time. If you look at it technically it was amazing what just happened… with a few clicks on some big buttons… I had my machine back in a perfect state.

Tagged with:
Feb 28

If you need to compare every file between two revisions/tags in cvs use:

cvs -q rdiff -s -r b5130_0202 -r b5130_0203 project1 [project2] [project_n]

I was doing it by check out both branches and using Araxis Merge do diff the directories. I really the tool, but nothing like keeping it server side and getting CVS to do the work for you. :)

Tagged with:
Feb 18

So here is a weird one. In the house we have a Panasonic KX-TG5623 5.8 GHz cordless phone and a Uniden PowerMax 5.8 GHz cordless phone.

I don’t run on wifi too much but my wife does. She started to notice that the wifi signal would drop off from time to time… Then she noticed that every time the phone would ring the signal would drop. It would come back up right away; you could take the call and be on wifi, but that initial ring would cause the drop off.

To fix the issue, I launched the Airport Utility, click on Airport icon in the top, and then the Wireless tab. I changed the channel to 5 and it seems to be good for both phones.

Updated: Someone else near by is using channel 5 so I was seeing the problem described on this tuaw.com article, Mysterious Airport dropouts solved?.

Feb 14

I downloaded Eclipse Version: 3.3.1.1 Build id: M20071023-1652 and built the client’s project. Everything was fine… It was fast, stable, and there were no configuration differences between the three supportive platforms. One day I hit the shortcut key for Open Resource (Apple/Command + Shift + R ), typed in a file name, hit enter and boom… first crash. Now, every time I want to use that feature Eclipse crashes on my session. The dialog box opens, I can type a file name and hit enter but before the file opens it crashes.

Looking at the crash log in ~/Library/Logs/CrashReporter/ and they are all very similar to this:


Process: eclipse [6516]
Path: /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
Identifier: org.eclipse.eclipse
Version: 3.3 (3.3)
Code Type: X86 (Native)
Parent Process: launchd [156]


Date/Time: 2008-02-15 14:27:50.676 -0800
OS Version: Mac OS X 10.5.2 (9C31)
Report Version: 6


Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000000000002ac
Crashed Thread: 0

Wondering if anyone else has seen this or knows of a fix.

Background:
The Eclipse IDE was working perfect for me on Mac OS X… Actually I always used it on Linux only because the Mac OS X version always a little weaker (from a stability perspective) and my PowerBooks were a little slower than my PCs. Now I have a 17″ 2.33GHz MacBook Pro with 2gb of ram.. and I figured I would give it shot as Eclipse has come a long way…

Tagged with:
Jan 25

I noticed that sometimes Time Machine won’t schedule the Next Backup. All I see is ‘Next Backup: –’. Coincidently I had to plug my machine in… and then I noticed that Leopard won’t schedule your next backup unless the machine is plugged into a power source. See below video here ( sorry for the small video size, just want to keep downloading time low ).

Jan 18

The problem:
My wife is in the Broadcast Journalism program at BCIT and often has to make telephone interviews for her assignments. Technically speaking, this has always been a really sloppy process. She has to hold the phone up to the recording device, which introduces lots of ‘noise’ to the recording and often her voice is louder than the interviewee. This causes her to have to import the audio into GarageBand and edit the audio levels.

The Solution :) :
The other day it dawned on me. The iPhone has a line out!

Required Hard and Soft ware:
1) iPhone or any Phone with a line out
2) In our case we use a MacBook or MacBook Pro but any computer with a line in will do.
3) QuickTime Pro or any software with audio recording capabilities will do.

I plugged a line from the iPhone’s headphone jack into the line in on her MacBook (pictures show my MacBook Pro):
IMG_1149.JPG

IMG_1152.JPG

IMG_1156.JPG

Switched the input to ‘Line In’ in ‘System Preferences’ -> ‘Sound’:

SoundSystemPref.png

Start up QuickTime Pro and selected ‘File’ -> ‘New Audio Recording’:

SoundFileMenu.png

A QuickTime Audio Recording window will come up. Increase the volume to about half. This will allow you to hear the interviewee over the speakers of the computer ( you can also plug in headphone if you don’t want it broadcast ) and press big red button whenever you want to start recording:

QuickTImeAudio.png

Once you stop you will find a Audio.mov file on your desktop:

AudioIcon.png

Let me know if you have any questions or another method…

Tagged with:
Jan 15

Back in pre-leopard days Apple talked about the the ability using Time Machine to back up your files to a remote disk using the Airport Extreme and a external hard drive plugged into the router. So I went out and bought a Apple AirPort extreme, I got a 500gb MyBook external hard drive from Costco and waited for Leopard. I thought, ‘finally, I can back up my computer and my wife’s without plugging it in.’ Set it and forget, that is what I like.

Leopard came out and…. the feature was taken away. No remote sync… But me, being a optimistic guy, I thought for sure it would be re-introducded as a update… Companies often take out features to meet a release date.
Today, Apple introduced the Time Capsule… which is basically the Airport Extreme with a 500gb or 1TB hard disk in it. Ummm, excuse me apple, but I already bought all that crap because you said it would work!

I know technology is going to change and I know Apple likes to change form factors ( iPods are a good example ) that is not what gets me. What I am getting at is if they won’t allow me to remote backup with my Airport Extreme and external hard drive because now they have a Time Capsule.
They told me this feature was going to be there, so, not on good faith, but actual information provided by the vendor I went out and spent my money.

I am not going to buy the Time Capsule as we know the OS has the ability to do what they promised. I can’t say I’ll be surprised if it does not work ( Apple is in-fact a business after all) but I will be upset if they don’t “unlock” the Airport Express to back up remotely with a disk for those of us that did take there word on the matter.

Update:http://www.roughlydrafted.com/2007/11/08/why-leopards-time-machine-doesnt-support-airport-disks/

Update: MacRumors have posted what seems to be the simplest solution to getting it working. http://forums.macrumors.com/showpost.php?p=4446263&postcount=126. My data is really important to me so I am not willing to risk it.

Tagged with:
Dec 27

I had a problem where I was adding names to my iChat buddy list, the name would show up and then it would disappear, could not see the person at all. I do have Chax installed so my Growl notifications would tell that the person was sighing off and on but the iChat Buddy list would give no feedback.

To fix the issue I first went and checked AIM Express to verify that iChat did in fact add that person to my buddy list ( and it did ). Then, I quit iChat, erased all four files in ~/Library/Preferences/:

com.apple.iChat.
com.apple.iChat.SubNet.plist
com.apple.iChat.AIM.plist
com.apple.iChatAgent.plist

Restarted iChat and entered my login and …. it is worked just fine now.

Note: One thing that I did notice is that even though I had added my friend correctly ( who was using Adium ), I still could not ping him. He had to add me first then ping me. This is not the case with iChat users.

Tagged with:
Dec 04

Oh my god. Thank God that is over. For months I have been wanting to get Samba working with Mac OS X. I could never figure it out and figured that Tiger’s smb compatibility was flawed. But today I finally sat down and worked it out. Here is what I did and I am including a sample working smb.conf file.

First. I upgraded my Fedora Core 4′s samba to 3.0.23a. That version seems to work with my Leopards installed version of 3.0.25b. By the way, to get your smb version from Mac OS X run smbd –version. To find your linux’s box samba version try this:

[root@hp cups]# rpm -aq | grep samba
samba-3.0.23a-1.fc4.1
samba-common-3.0.23a-1.fc4.1
system-config-samba-1.2.31-1
samba-client-3.0.23a-1.fc4.1
[root@hp cups]#

Then I edited the file with the help of this page:
http://ubuntuforums.org/showthread.php?t=597112
See below for smb.conf file

Then I logged onto the Linux box and confirmed that I could print locally to my printer. I started cups and configured it. This part just worked so I can’t go into too much detail but I did make one change. I opened /etc/cups/cups.conf and had an allow line for my computers ip in the printer deceleration section. In my case this was needed or else the computer wanting to print got a ‘Forbidden’ in the queue. It looks like this:

<Location /printers/hp>
Encryption IfRequested
Satisfy All
Order allow
Allow From 192.168.1.4
Allow From 192.168.1.3
</Location>

Then I add the printer as a IPP printer in Mac OS X:

Picture 2.png

And it all worked! My biggest hurdle was the smb.conf file…. no matter what I tried I could not get it working. Hopefully this sample working file will give you a good start.

Sample working smb.conf file:

smb.conf

You can also see:
http://n8agrin.com/2007/10/31/configuring-leopard-to-print-to-password-protected-samba-printers/

Tagged with: