I had to migrate my personal blog about my 2-year old daughter from MobileMe servers to a WordPress account. I wanted to keep all the comments, as well as my posts and other content. So I wrote a perl script to do the job. It is far from beeing perfect, but it works for me. You will have to change some settings in the script to get it to work for you.
Features:
Keep comments
Keep images (mostly)
Sets e-mail adresses for comments by name
Sets tags by text strings found in title or body
Note: The script will only work as long as Apple's servers are active (through June 30, 2012).
Tips:
1. Import to WordPress first without images.
2. Import the same file again with images.
3. If you can, adjust running time for scripts on your hosting service.
[kirkmc adds: I have no way of testing it, never having created a site with iWeb. Look carefully at the script and check for what variables you need to set. Obviously, there is no risk, as you'll simply be converting from your iWeb site to WordPress, but make sure you keep backups of everything anyway. It would be good if someone could post in the comments whether it works for them or not.
Save the script as a .pl file before running it.]
When you want to join a WPA-PSK/WPA2-PSK wireless network, your Mac will always refuse to do so. Here's how you can do it.
In System Preferences, click on the Network icon, then on Wi-fi in the list of networks. Click on the "Advanced..." button at the bottom-right of the window. On the Wi-Fi tab, click on the plus (+) button, then add the following:
Network Name: Your Wi-Fi network's SSID Name
Security: Any (Personal)
Password: Your Wi-Fi password
Then click on OK. (You may need to enter your administrator's password to apply the changes.)
Now your Mac will automatically connect to your WPA-PSK/WPA2-PSK network.
[kirkmc adds: I haven't tested this. What I understand here is that you cannot connect to this type of network via the standard dialog, and you must simply add it manually to your list of networks.]
There are days when I cannot connect to iChat's servers - well, actually to the AIM servers that iChat uses. The fix is simple yet odd. I use SSL with iChat, and all it takes to get the connection is to turn it off. Go to iChat > Preferences > Accounts, click on your account, then click on the Server Settings tab. You must be offline to make changes here. If you have Use SSL checked, uncheck it, then connect. Disconnect, then reconnect it, if you still want to use SSL. I don't know why this works, but it does.
Often times, for whatever reason, the Internet connection on my Mac will lock up. Only restarting the Airport or Ethernet interfaces seem to resolve the issue in a timely manner. (This is different from a router crash which requires a manual restart of the router - in my case an Airport Extreme.) I have developed some interconnected scripts that will automatically accomplish this task for me when attached to launchctl. This is important for me because I often have to access files over the internet and if the connection has locked up there is no way for me to access them without manual intervention.
The first script gets the active network interface. This is called by the second script which determines whether to run a matched script for either the Ethernet or AirPort interfaces. These third and fourth scripts restart either the Ethernet or AirPort connection respectively. These last two scripts can also be configured to send you an e-mail if this happens by altering the 'tobenotified" string to reflect your e-mail address in each of them. Be sure to maintain the single quotes. Or, if you do not wish to receive e-mail, comment these parts out.
Name the first script "active_interface.sh", and the second "check_internet_master.sh". This second script is what controls the rest. Attach it to lauchctl to do this automatically and never worry about a lost connection. The third and fourth scripts should be called "check_internet.sh" and "check_internet2.sh". Of course you can always name these whatever you want, but be sure to put the path to them in the scripts. Make sure to chmod all the files executable; and, unless the scripts are altered, they should also be run from the same folder.
In order for ifconfig to run with out intervention, the script needs to be run as root. Alternatively, you could make an exception for ifconfig in your /etc/sudoers file by adding the line (if you run as admin - else put %users):
%admin ALL= NOPASSWD: /sbin/ifconfig
I don't think this is too much of a security issue.
With this setup, I find I am nearly impervious to lost connections.
I'm not certain how far back this goes, but pressing the Escape key in Safari 5.1.5 pauses animated GIFs on a web page. I have an older Mac with Safari 3.2.1 and this functionality is not present there. It would be great if there were a single command to stop these GIFs completely, but this is better than nothing.
It's possible other browsers have a similar capability, but this appears to be a Safari-specifc shortcut. Testing with iCab 4.8, a browser which uses the built-in WebKit frameworks, does not respond to the same command.
[kirkmc adds: Indeed, this does work. In Firefox, this stops the animation entirely, unlike Safari, where it only pauses the animation. In Chrome and Opera, it has no effect.]
I have been using plain text files (.txt) for storing my notes since the arrival of Notational Velocity a while ago. When I saw that Mountain Lion will have a dedicated Notes app, I decided it would be great to switch over to Mail's notes system in preparation for the new OS.
I couldn't find a suitable method for rapidly importing my text notes into apple mail, so I combined a script found on MacRumors with some python, which can then be packaged into a Service using Automator ("Service receives selected files and folders").
import sys
import os
print sys.argv
for filename in sys.argv[1:]:
print filename
text = open(filename,'r').readlines()
title = os.path.splitext(os.path.basename(filename))[0]
text = title +'\n'+' '.join(text)
# Store file contents in clipboard
outf = os.popen("pbcopy", "w")
outf.write(text)
outf.close()
cmd = """osascript< < END
tell application "Mail"
activate
end tell
tell application "System Events"
tell process "Mail"
click the menu item "New Note" of the menu "File" of menu bar 1
click the menu item "Paste" of the menu "Edit" of menu bar 1
end tell
end tell
END"""
os.system(cmd)
[kirkmc adds: I haven't tested this. But I do agree that it will be practical to use Apple's Notes app on Mountain Lion. However, I'm not prepared to use Mail for notes; I don't like the display options.]
iOS Reminders can give you alerts when you arrive at a location, but those locations must be in your Contacts list.
I want to be reminded before I get to a location, for example, when I get to the exit off the Interstate. If I turn left, I head home, but my bank and the grocery store are the other way. It won't work to set a reminder "when arriving at the bank," because I'll never get there. I need to set a reminder "when arriving at Exit 15."
The trick is to use the Maps location. Tap and Hold the location you want to use for your reminder.This will create a "Dropped Pin." Tap on the > button to display details about that location Then tap on "Add to Contacts," "Create New Contact," and give it a name, like "Exit 15." This is kind of silly, as it isn't a person, and it isn't a business. It has no email, or phone, or even a real address.
Now go back to the Reminders Application. I can use "Exit 15" as the location for "Stop at the Grocery Store," and get a reminder, which lets me know that I need to turn right.
The only problem with this approach is that if I happen to be lucky enough to get a green light at the end of the exit ramp, I'm not at the location long enough for the Reminder to trigger.
[kirkmc adds: Interesting idea, but the bit about needing to stop seems to make it unpredictable. I don't have time today to go out and drive around to test this, but I think that if you are going to depend on a reminder that will only remind you if you get a red light, then this might not be ideal. If anyone wants to test this, please post your results in the comments.]
Mac malware has been in the news, with the Flashback malware taking advantage of a Java vulnerability to infect several hundred thousand Macs. Macworld ran a detailed article by Rich Mogull giving the history of this malware, and discussing how it works and what you can do. But it's clear that this target represents a new level of malware on the Mac, being "the first widespread drive-by malware to attack Macs," and, as Mogull says, "it does represent a major advance."
Sometimes applications have a nasty habit of claiming a lot of memory and never releasing it back to the system. Over time, this can cause affect performance. Most of the time, this can simply be fixed by quitting and restarting the offending program, but I wanted to find a more elegant solution.
After searching the Internet, I found few scripts that I could tweak to achieve what I wanted. Heres what I came up with. The first script is a python script I found at StackExchange by user drfrogsplat that gets information about system memory. The second is a bash script I wrote that runs the purge command if you have over a certain amount of inactive memory, in my case 500MB (probably overkill). Note that I think you need developer tools installed to use the purge command. There's probably an easier way to do this with vm_stat directly but I'm not good enough at awk/grep/sed to it figure out.
The bash script can be attached to a launchd plist to run automatically at certain intervals or whenever you want. I seems to work pretty well for me.
#!/usr/bin/python
import subprocess
import re
# Get process info
ps = subprocess.Popen(['ps', '-caxm', '-orss,comm'], stdout=subprocess.PIPE).communicate()[0]
vm = subprocess.Popen(['vm_stat'], stdout=subprocess.PIPE).communicate()[0]
# Iterate processes
processLines = ps.split('\n')
sep = re.compile('[\s]+')
rssTotal = 0 # kB
for row in range(1,len(processLines)):
rowText = processLines[row].strip()
rowElements = sep.split(rowText)
try:
rss = float(rowElements[0]) * 1024
except:
rss = 0 # ignore...
rssTotal += rss
# Process vm_stat
vmLines = vm.split('\n')
sep = re.compile(':[\s]+')
vmStats = {}
for row in range(1,len(vmLines)-2):
rowText = vmLines[row].strip()
rowElements = sep.split(rowText)
vmStats[(rowElements[0])] = int(rowElements[1].strip('\.')) * 4096
print 'Wired Memory:\t\t%d MB' % ( vmStats["Pages wired down"]/1024/1024 )
print 'Active Memory:\t\t%d MB' % ( vmStats["Pages active"]/1024/1024 )
print 'Inactive Memory:\t%d MB' % ( vmStats["Pages inactive"]/1024/1024 )
print 'Free Memory:\t\t%d MB' % ( vmStats["Pages free"]/1024/1024 )
print 'Real Mem Total (ps):\t%.3f MB' % ( rssTotal/1024/1024 )
==============================================================
==============================================================
#!/bin/bash
MM=`/Path/to/python/script.py | awk '/Inactive/ {print $3}'`
echo "Testing status of inactive free memory..."
if [ "$MM" -gt "500" ]; then
echo "You have too much inactive free memory." $MM"MB Releasing now..."
purge
exit 0
else
echo "Memory ammount" $MM"MB does not meet purge threshold."
exit 0
fi
[kirkmc adds: I'm guessing that this will be controversial. There seem to be dozens of apps on the Mac App Store that free up memory, and I'm not convinced that this is necessary. The only time I would see this as being essential is if that inactive memory is leading to more paging. Lately, I've been amazed at how little paging my Mac mini does; with 8 GB RAM, it rarely uses more than one swap file, and this with an uptime of several days.
I think that, in most cases, if you encounter an issue with memory, it's just as simple to use the purge command in Terminal. And, yes, I do see certain applications and processes taking up a lot of memory, notably iTunes and WebProcess. But note that the purge command doesn't free up all inactive memory anyway.
And, can someone confirm that Xcode is needed to have the purge command? Mine is in /usr/bin, and I don't think Xcode installs anything there, at least any more, now that it gets put in /Applications.]
If you press Command+I while in the OS X Installer, a small window displays, showing the contents of the package about to be installed.
[kirkmc adds: This is great; I don't know why we haven't had this submitted before. I tried this with a number of installer packages. In most cases, the window shows the contents of the .pkg from the very first window. However, when checking on the Mac OS X 10.7.3 Combo Updater, clicking the disclosure triangle next to the name of the update in the file list window displayed "The file listing isn't yet available," but the file list then showed up a few seconds later. Note that all you can do is view the file list; you can't copy it.]