Renewing a DHCP lease via the Network System Preference Pane has the advantage of not dropping the connection, unlike switching the interface to BOOTP and back to DHCP. This command mimics that behavior.
It seems that the button creates a key in SystemConfiguration that notifies it to refresh the configuration. We can create that key using the following command (changing en0 for the relevant interface):
This is an update to this hint, Automatically add links from Emails, Twitter or Google Reader to Reading List . I found the solution posted there to be insufficient. The script only allows URLs to be on their own full line, whereas my solution scans the entire message for links everywhere. As long as they are separated by a space the script should find them. WebKit users can even set their own browser.
I hope this helps replace some "read later services" by Reading List.
Save the script below to ~/Library/Application Scripts/com.apple.mail/ and assign it to a new Mail rule.
An easier way to send yourself links is by adding +reading to your mail address. If your normal address is myaddress@gmail.com, it would become: myaddress+reading@gmail.com.
The beauty of this is that you can add this address to your Contacts and give it a nice name like “Add to Reading List”. The previous hint required editing e-mail subject lines in a predefined way. Apps like Reeder are able to send to a default mail address. With this, set the +reading address to be your default address, share via e-mail, tap Send, and it's done.
Set up a new rule with the following options:
Rule: “any recipient contains ‘+reading’”
Actions:
“mark as read”
“execute AppleScript” (this script)
“delete message"
“stop evaluating rules”
Here’s the script (you can also get it on GitHub):
(*
Add to Reading List
Script for Apple Mail to find http and https links in emails and add them to Safari's Reading List automatically.
Best practice: setup with "any recipient contains '+reading'".
Actions "mark as read", "execute AppleScript", "delete message", "stop evaluating rules"
Created by Andreas Zeitler on 2012-10-07
*)
using terms from application "Mail"
set theURLs to {}
on perform mail action with messages theMessages
try
set theMessageCount to count of theMessages
repeat with theMessageIndex from 1 to theMessageCount
set theMessageContent to content of (item theMessageIndex of theMessages)
-- find URLs in messages
set cmd to "echo \"" & theMessageContent & "\" | egrep -o -e 'http[s]?://\\S+' | sed 's/[<>]//'"
set theURLs to do shell script cmd
-- make URLs a list
set theURLs to paragraphs of theURLs
-- add URLs to reading list
my addToReadingList(theURLs)
end repeat
end try
end perform mail action with messages
end using terms from
on addToReadingList(theURLs)
-- set your preferred browser. Use "Safari" or "WebKit"
set myBrowser to “Safari”
using terms from application "Safari"
tell application myBrowser
repeat with theUrl in theURLs
add reading list item theUrl as string
end repeat
end tell
end using terms from
end addToReadingList
All those many different WordPress plugins to back up my blog looked too daunting to me, so I decided to create my own simple Mac-native solution using AppleScript. This AppleScript does the following:
Simulates a double-click on the alias to my web server (where my WordPress blog lives) to mount it as a WebDAV volume (just like iDisk)
Runs the handy Unix backup command rsync to copy the remote contents locally
Unmounts my web server
I then set up a daily iCal event to run the script at 4 a.m. Since I already have CrashPlan backing up my hard drive, that takes care of archiving periodic versions of the backup, just in case.
Here's the script:
set filepath to "Macintosh HD:Users:USERNAME:Library:Favorites:www.example.com"
tell application "Finder" to open filepath
delay 30
do shell script "rsync -av /Volumes/www.example.com/blog/ '/Volumes/Backup/wordpress-backup'"
tell application "Finder" to eject "www.example.com"
Set you own user name, domain and backup destination in the script.
It's also worth pointing out that while there are many WordPress backup plug-ins available, it is also a good idea to use one. The backup in this hint only backs up files, not the actual WordPress database. I use the WP-DBManager plug-in for automatic backups of my database, that are sent to me by e-mail.]
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.]
Using a saved Internet location on your desktop, you can quickly check a web page without opening a browser window.
This is a handy way to keep an eye on websites without having to manage browser windows or tabs. Simply drag the URL address from the the top of your browser window (I use Safari) onto your desktop. A 'web internet location' file is created. Now just use Quick Look (hit spacebar) to see a live view of the web page. You can even click a link, which then opens in your default browser.
Take it to the next level: Create a folder with all your favorite internet location files. Put the folder in your dock. Now when you hover over the file in grid or fan view, you can tap space bar to see the web page, and use the arrow keys to navigate around (list view doesn't Quick Look, for some reason, and only opens into a browser). I don't have Flash installed on my system, but I'm curious to know if YouTube and other Flash sites will run within Quick Look. Hope some people find this handy.
[crarko adds: 10.7 only. It looks like Quick Look uses Webkit to render the page, so you in effect are using a browser, just not a separate application. Flash did load when I tried this, in fact it seems to have bypassed ClickToPlugin (a Safari extension) in order to do so.]
This is a useful hint if you have a Mac and an iPad (or iPod touch), and you want to share a hotel wireless Internet connection with both devices.
In the System Preferences Bluetooth pane, pair your Mac with your iPad (they don't need to be connected yet, just paired). Then, select the iPad in the list of Bluetooth devices, and click the Advanced button. Check the 'Share my Internet connection with other Bluetooth devices' option. This should switch you to the Network preferences pane and prompt you to create a new Bluetooth PAN device.
Now go to the Sharing preferences pane and select Internet Sharing from the services list. Under 'Share your connection from,' select Airport, and under 'to computers using,' select Bluetooth PAN. Then check the checkbox next to Internet Sharing in the services list to enable Internet sharing.
From the iPad's Settings app in the General pane, tap Bluetooth, and connect to your Mac. In the top left corner, in place of the Wifi signal strength indicator, you should see a pair of interconnected rings indicating that you are connected to your Mac.
When you bring up a new page in Mobile Safari, you might be prompted by the hotel's ISP to select billing options on the iPad; just tap Cancel, and you should be able to browse normally.
[crarko adds: I tested this, and it does work as described. I've used it before with mixed success; sometimes I've had a hard time getting the Bluetooth connection between the MacBook and the iPad to stay up.]
I regularly listen to the Internet broadcast of a local radio station. To get it, I have to go their website, and then click on a button to open the online broadcast. It is in a Windows Media Player format. QuickTime Player opens and starts streaming.
Here is how I got to access it by just double-clicking an icon on the Desktop.
The 'obvious' way would be to drag the URL to the Desktop and create a .webloc file. But there were two problems with that.
The URL starts with mms:// and if one tries to open it directly from inside QuickTime Player, it does not recognize it. It does, however, open and play the stream if I use http:// instead.
However, the corresponding .webloc opens in Safari (or whatever other default browser is set), and doing Get Info and setting it to open with QuickTime Player has no effect.
Enter AppleScript. I created a very small script (you need to put in your correct URL):
tell Application "QuickTime Player"
open URL "http://the.url.for.the.stream"
end tell
I saved this script as an application to my Desktop. Now I just have to double-click and QuickTime Player starts playing the stream.
[crarko adds: I haven't tested this one. I'm pretty sure you still need to have the Windows Media Components for QuickTime, aka Flip4Mac, installed to play Windows Media formats.]
If your iPad is slow or stutters when viewing video over the internet (e.g. from YouTube), and changing your network's DNS settings, or rebooting the iPad, or changes to the Airport Extreme (or other access point) frequency/band/channel/power/multicast etc. does not fix the issue, here is a possible fix.
Check to see if your Airport Extreme Base Station has DHCP/NAT turned on. If so, instead set your AEBS to Bridge Mode (this will probably work on Airport Express too). This assumes you have a cable modem or other router/switch that you can use instead for DHCP/NAT. No more slow/stuttering video.
[crarko adds: I restart my Airport Extreme every few weeks just to flush the memory and have not experienced any trouble paying video. I do use it for DHCP/NAT on my network.
What I have noticed is that after prolonged use, my Apple TV (2nd generation) does have stuttering and will sometimes just lose it's connection to, say, Netflix. I have to reboot the Apple TV to clear that up, so I don't think it's an issue with the Airport.]
I use Yahoo mail and Firefox. I found that I was wasting lots of time navigating through my files to attached a document to an email, especially if I wanted to attach multiple documents that were stored in different folders. Normally, I send off a file after having just worked on it, so I decided to use Smart Folders and Saved Searches in the Select Files dialog box in Firefox.
Here are the steps:
In a New Mail message in Yahoo click the Attach button.
In the Select Files dialog, start typing a term in the search field and the Save button will appear in the dialog. For some reason, the Save button doesn’t appear when the dialog is opened.
Click the Plus button next to Save.
Select Last Modified in the first pop up and then Today in the second.
Click Save.
Name the Search. I call it 'Today.'
Now, the Today Smart Search will appear under Saved Searches in the Select Files dialog -- no need to type the name of the file in the search field. Just click the saved search and all your recently modified files are together.