Posts filed under 'osx'

Scraping Source in Safari

Here is an applescript solution for grabbing the html code from a page online. This is particularly handy if you are trying to grab the code from a page that you need to login to. I am sure there is a much better solution out there, but this one seems to work for me ok.

CODE:
  1. -- Define the page to save the document and the url
  2. set the pageFile to "/Users/yourUserNameHere/Desktop/safariSource.html"
  3. set the pageUrl to "http://www.plasticstare.com/"
  4.  
  5. -- define the applescript to run
  6.  
  7. tell application "Safari"
  8.    activate
  9.    make new document at end of documents
  10.    set URL of document 1 to pageUrl
  11. end tell
  12.  
  13. set web_page_is_loaded to false
  14. --check if page has loaded
  15. repeat
  16.    delay 0.5
  17.    tell application "System Events" to tell application process "Safari"
  18.       if (name of static text 1 of group 1 of window 1 as text) begins with "Contacting" or (name of static text 1 of group 1 of window 1 as text) begins with "Loading" then
  19.          -- do nothing
  20.       else
  21.          exit repeat
  22.       end if
  23.    end tell
  24. end repeat
  25.  
  26. tell application "Safari"
  27.    set siteSource to the source of document 1 as text
  28.    set theFile to open for access (pageFile) as POSIX file with write permission
  29.    set eof of theFile to 0
  30.    write siteSource to theFile
  31.    close access theFile
  32. end tell

Add comment Sun, 2008 Mar 30, 6:19pm

Get Out of Jail Free Card

Yes, I am now one of those people I said scare me in an earlier post, having recently acquired a 16gb iPhone. I have to say, out of the box, it has been a pretty interesting experience, as the device very nearly fulfills what I pretty much have wanted for a long time in a mobile network connected device. I hesitate to gush; there are still some unsettling aspects of it such as the slow Edge network speed and the occasional crash. In fact, the when it crashes it is really annoying because the OS continues to run, but several applications will just refuse to work. Granted, I don't want an iPhone blue screen or that crazy OSX multilingual black shroud crash, but the first time it happens is very unsettling.

I also had a difficult time getting my contacts and calendars to sync. If you are viewing this post with that same problem, I was able to remedy the problem by opening iSync, going to the iSync preferences, and under Advanced - click the "Reset Sync History" button.

The best part about the iPhone is its ability to connect to the internet via any available WiFi hotspot. I navigated all around SF last weekend using the maps functionality and 511.org and hopped around multiple hotspots in the city. Using Muni in this city has never been easier. I have to say, this more than makes up for the lack of speed on the Edge network (at least in a place like SF). AND, I say this with moderate excitement -- BART WiFi is available in some BART stations. I don't know if it is available in all stations, and I don't know why I would ever pull a laptop out of my bag at a station, but its pretty great if you have a WiFi enabled phone.

Of course, the first thing I had to do, mostly out of principal and secondly out of burning curiosity, was to jailbreak the phone. I kept reading posts about "bricking" one's phone that made me a bit timid, but I am 90% sure now that unless you do some serious mischief on your phone, everything is fixable with a restore.  I ended up using ZiPhone 2.6b for my jailbreak operation, which was super smooth. Note: I used only the "Jailbreak" option, the one that says "Best choice for 'official' carriers;"  that is all I know, and I can't help you past there. It did work for me, however, and worked very well. The next thing that was required was to install the community sources in the Installer application loaded onto the phone, which gives you access to the "official" list of 3rd party apps for the iPhone and iPhone Lonely Edition (iPod Touch).

I have to say though, with all the booing that enthusiasts did regarding the iPhone not yet enabling 3rd party apps other than web apps, the web app functionalities are rather nice.  More on that later, but just to say, my favorite web apps so far for Home bookmarking are the most simple, such as google, AA.com (kudos to American Airlines for getting that one right),  and although I don't use it, Twitter has a nice simple interface. Most of the third party native apps are still in their infancy and not terribly impressive. There are a couple that are pretty nice though.

BossPrefs and PocketTouch I think rank as my number 2 best third party apps. PocketTouch aptly allows for simple iPod functions for volume and next/previous functionality using swipe gestures on the touchscreen. It also features a silly but kind of cool function that allows you to play a random track by shaking the phone. (so the next time you see someone on the train shaking their hand in their pocket, don't be so quick to judge...) BossPrefs is great. It does what it is supposed to do, namely that it allows you to turn off and on various network services on your phone, including OpenSsh, if you have that installed.

My number 1 pick so far, however, is MobileScrobbler. If you participate in the whole LastFm thing, you already know what LastFm is and I don't need to explain it; if you don't check it out -- you may or may not like it, but anyway... MobileScrobbler is one of the the most mature apps I have seen so far, and allows you to stream radio via WiFi. Very nice. It probably kills your battery life, but hey...what are you going to do...

Add comment Sun, 2008 Mar 30, 5:36pm

Data Anomolies

I've been poking around lately working on getting some design ideas together and investigating some technical possibilities, as well as backing up some old data. Erasing some of that old data resulted in the crazy progress bar pictured above. I've also discovered a really frustrating problem while investigating pulling Flickr streams.

It seems that you can do a few nice little searches that aren't well publicized, so that you can, for instance, get an RSS stream featuring the union of two different Flickr tags in your stream (in other words, an OR search). The feed URL looks something like this (for the tags blue and green):

feed://api.flickr.com/services/feeds/photos_public.gne?id=74517463@N00&tags=blue,green&tagmode=any&lang=en-us&format=rss_200

Replace the "tagmode" parameter with all, and you get an AND style search (only photos featuring all the specified tags). The problem is that the RSS feed provided by Flickr only allows you to grab 20 photos. If you perform the same search, you get a large amount of paged data, if there is more than one page. So, basically, this means that if you want to see ALL the photos of your children in your own home-grown chumby, OSX, or other widget, you are sadly stuck at seeing only 20.

"What about using something like Pipes?", you say. Well, I checked out using Yahoo pipes to create a custom RSS feed. Unfortunately, from what I can tell, you are really limited to what you can get via the Flickr API. You can get more than 20 photos in 1 person's photostream this way using the flickr.people.getPublicPhotos method, but that method does not provide the capability of filtering by tag.

I'd just about given up (well I still have for now) until I realized that you can do just this in the media bar in Flock, so there must be a way to do it that I am missing. In Flock, you can view your photostream and *fliter* by tags, and even use AND and OR for multiple tags. Not sure how they are doing this, because you can see way more than 20. I sent them an email to see what they are doing today. Anyone else have any idea?

Add comment Fri, 2008 Jan 04, 10:51pm

iTunes Emancipation Proclamation?

Forgot my glasses today, but from what I can make out, it seems that iTunes has just now introduced DRM free iTunes Plus, which is a great start to something that folks have been pushing for for a while now. Now, its not FLAC or even the 320 kbps files that you can get on Bleep.com, but its pretty great since iTunes has such a large market share. (You compression geeks out there can comment on 256kbps AAC vs. 320kbps VBR mp3 (i.e. iTunes plus vs. Bleep.com) - in fact, please do.) In addition, it appears that you can actually upgrade eligible songs to DRM free (for a cost, but hey, still...). Unfortunately, it looks like this ony applies for now to EMI label songs, but hopefully this will be a good push in the right direction for other labels as well.

Add comment Fri, 2007 Jun 01, 10:34am

Random notes: OSX Functionality, VMware Fusion Beta 3 and Netflix

Just a couple of random notes. The first I've been meaning to throw out there for a while. Some couple of months ago, my Mac-Book Pro started developing some sort of computer Alzheimer's disease. If anyone else has seen this, let me know. The symptoms are as such: 1. I can no longer do things like choose Force Quit (or any of the right-click menu items) for items in the dock. The right-click menu pops up, and I can choose an item, but it doesn't execute unless I have already chosen it or if I left click icon in the dock first. 2. Expose won't do Application display - show all windows and show desktop works, but the show all application windows functionality simply performs the show all windows functionality. 3. Sleeping -- well, this has never really worked properly, but the sleep issue is quite a nuisance (not sleeping or not waking from sleep -- I've actually created an alias 'zleep' for the Terminal that allows me to put it to sleep without having to click the apple menu). There are a couple more that I can't remember at the moment - may have to come back and re-edit this post when I think of them.

On a totally different note. VMware just released the Beta 3 Fusion player for Mac. This incorporates some improvements on the last release. My latest use for the player is for the "play now" option that is now supported at Netflix. At the moment, Netflix only supports windows XP SP2 and Vista, so I fired up Fusion to take a swag at watching films on my Mac from Netflix. I have to say, I was pretty impressed, the sound and video performed just fine. The only glitch was viewing the film with Fusion in full-screen mode and the Netflix player in full-screen mode. For some reason the Netflix player cut off the bottom part of the video (right at, say the second line of typical sub-titles and below). Switching Fusion to *not* full-screen and watching the video that way worked fine. I think maybe it has something to do with the way that Fusion is communicating screen size to the guest OS, but not sure. Other than that the performance was pretty solid.

Add comment Mon, 2007 Apr 09, 9:55am

Delicious vs. Google Bookmarks

For those of you already familiar with both, you can read no further. I've been trying out both of these entities lately. Delicious works rather well, and integrates fairly well with the Firefox add-on. It takes a little bit of getting used to, if you have not used Delicious religiously; for me, it was a bit odd, having finally not too long ago organized my bookmarks and having carried them over from machine to machine. However, now that I have it integrated with Quicksilver, all of my bookmarks are available again via a couple of keystrokes.

I found out about Google bookmarks through the Firefox add-ons by doing a search for bookmarks. I installed both, and then proceeded to search Google for the bookmarks page, which didn't show up on the Google applications page. Apparently the Google bookmarks are someone's lost cause, and I'm not sure why they even exist. The interface is very sub-par given Google's normal standards, as is the functionality. They don't amount to much more than a bookmarks backup. In addition to the sad state of its functionality, the add-on for firefox does something peculiar that I never did figure out totally -- if there are any bookmarks for sites that require certificates, an alert pops up for every bookmark for such a site. Needless to say, that add-on is now gone from my system. I don't know if this would be something to keep an eye on or not...

Add comment Fri, 2007 Jan 26, 6:55pm

Quicksilver + Delicious

So, having become a devotee of sorts of the OSX application Quicksilver, I've been looking for a few different ways to integrate it into my work flow a little better. I've been itching for an excuse to try to train myself to use the Delicious service for retaining bookmarks, but one of the big stumbling blocks, maybe out of my own haste really, to not using it was the fact that it wasn't automagically cataloging my delicious bookmarks. Well, there is a nice little write-jup on LifeClever that explains the very easy way of doing this, which I had just not bothered to dig in and find. It also has a few little links for some other Delicious integrations schemes as well.

Add comment Tue, 2007 Jan 23, 5:28pm

OSX Terminal Hack - .DS_Store files

This only prevents .DS_Store files from being written on network shares, but nonetheless, quite handy. In the terminal, enter the following:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Add comment Tue, 2006 Nov 07, 9:33am

Squidman for local proxy plus Adium

So my work these days is a bit more locked down than in previous engagements, which makes for some interesting problems. Actually, its not too bad, but unfortunately, some applications don't play well with location proxy settings. Even Firefox 2.0 doesn't seem to pick up the proxy settings from your system network prefs, so changing proxies is more than just changing your location in the apple menu in OSX. That shouldn't be the case, but oh well.

One solution I've been playing around with today is Squidman, which is a simple OSX application that lets you run squid on your mac (there are other ways, but this was easiest). Basically, the idea here is that you can set up squid to run a local proxy, by default on localhost at port 3128. Then, create a new network settings configuration, and point your proxy connections to localhost:3128. This ostensibly allows you to leave your proxy settings the same everywhere you go, and if you need to hook into a new proxy server, just change it in the Squidman parent proxy preference.

I have yet to have luck with Transmit, unfortunately, which is by far my favorite FTP app for macs. I also had some trouble with my instant messenger accounts that I use through Adium. However, the trick for Adium is not too bad. First of all (though a bit tedious), change all your accounts in Adium to use a proxy and set it to the systemwide HTTP settings in the drop down menu. Then, in Squidman, go to the "Template" section of the preferences. Find the line in the prefs that starts with "acl SSL_ports port " and change the entire line to "acl SSL_ports port 443 563 1863 8443 5050 5190 5222". 5190 handles the AIM connection and ICQ, 1863 handles the MSN connection, 5222 handles gmail talk, and 5050 handles yahoo chat. Since Squidman is meant moreso for simple http proxy enabling, so I guess they decided to leave off the instant messenger ports by default.

Add comment Mon, 2006 Nov 06, 10:05pm

NuFile - One Click in the Right Direction

As uninspired as I may be about Windows, one of the things I have always liked about that operating system is the option to right-click in a directory and create a new text file. Today I discovered NuFile, an extension for OSX that pretty much does just this. NuFile, once installed, provides an extra contextual menu on right click that allows you to create a number of different types of files, from text to powerpoint to a stub java class. However, there are 2 drawbacks regarding Nufile.

The first and least consequential is the extra features; for the way that I work, there is really no need for such a wide variety of file types. If I want to create some of the default file types, I'll open the application that creates them. One benefit - the system prefs for NuFile allow you to add file types -- so, for a someone who develops a considerable amount of Flash work, it could possibly be nice for just creating a stub empty swf file for projects not requiring the Flash IDE (although there are other more project integrated ways of doing this).

The second drawback is the most important. Unlike Windows, Nufile creates a new file with a specific name, such as "NewTextDocument.txt" and allows you the option of having it open automatically. The best part of its Windows counterpart is that the name remains selected and allows you to type the new name right there, rather than having to select and rename the file. It's that simplicity that I would appreciate more. That being said, I don't know how long it will last on my system, but I thought that it was a pretty nice little addition for some and worth mentioning.

Add comment Sat, 2006 Sep 16, 12:18am

Previous Posts


Site Decryption

info = { PlaIns: "the section of the PlasticStare site, the digital external brain-repository of Ryan Todd, whose brain otherwise occupies space in San Francisco, CA", ryota: "mungified version of ryan's name", haikuBio: "robotic from birth. hears sounds - listens to music. makes pixels act." }

Calendar

July 2008
S M T W T F S
« Jun    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Posts by Month

Posts by Category