My thumb became painful after so much programming. A little searching indicates it was a "sprain". The app I use most had me moving my left thumb over to the option key very regularly. It started to cramp up and hurt when I did so.
I saw Phil yesterday and that reminded me that some people change the caps lock key to be other things, since caps lock is so worthless. OS X actually supports this directly in the Keyboard preference pane†, so now my caps lock key is just another option key. My thumb feels better already.
It feels hopeful.
† You can change other "modifier" keys too: control, option, and command.
Showing posts with label technology. Show all posts
Showing posts with label technology. Show all posts
18 December 2009
27 November 2009
the secure, sleepy screen saver
Scrounging a lot of forums, I came up with a solution for an OS X screen saver that serves a lot of my needs. If you follow these instructions, you will ...
This hint comment offers some C code for sleeping the display immediately, which it seems is the only way to do it from the command line! There's the CTRL-SHIFT-Eject keystroke, but AppleScript cannot emulate the Eject keystroke. You can compile that code (change the function name to main) with
Now you have an executable that just sleeps the display.
Phil has got me thinking about security recently, so I want my laptop to prompt for a password when someone wakes the display from sleep/disturbs the screen saver. This is easy to setup for the screen saver, but not so much for waking display. The best alternative I can find is SleepWatcher, but that project seems a little too fragile for me to depend on it. It would let me execute a script when the display wakes, but I also don't want to write a script that emulates the password prompt.
So I'm using a screen saver because I want the password prompt aspect.
- have a screen saver that sleeps the display instead of drawing pretty pictures on it.
- be prompted for your password when you disturb the screen saver.
- be able to immediately start your screen saver via your keyboard if you want to safely walk away from your computer.
- be able to temporarily disable your screen saver while watching a movie etc.
The sleepy screen saver
I've always wanted my screen saver to just put the display to sleep, but that's not been an OS X option out of the box.This hint comment offers some C code for sleeping the display immediately, which it seems is the only way to do it from the command line! There's the CTRL-SHIFT-Eject keystroke, but AppleScript cannot emulate the Eject keystroke. You can compile that code (change the function name to main) with
gcc -framework CoreFoundation -framework IOKit
if you've installed the XCode tools.Now you have an executable that just sleeps the display.
Why use a screen saver at all?
A fine question. I could just set my display to sleep before my screen saver starts. There's a reason.Phil has got me thinking about security recently, so I want my laptop to prompt for a password when someone wakes the display from sleep/disturbs the screen saver. This is easy to setup for the screen saver, but not so much for waking display. The best alternative I can find is SleepWatcher, but that project seems a little too fragile for me to depend on it. It would let me execute a script when the display wakes, but I also don't want to write a script that emulates the password prompt.
So I'm using a screen saver because I want the password prompt aspect.
How to make the application a screen saver
There are tutorials for making screen savers, and XCode even has a project for them (under Standard Apple Plug-ins), but I don't know Objective-C and there's more function stubs to fill out than I'd like. So I'm going to cheat and use ScriptSaver instead. It only runs AppleScripts, so we use a simple little script to invoke our executable according to this note. I put my executable in /usr/local/bin and made a /usr/local/AppleScripts directory for my script. Check your PATHs and such.Final touches
- I made sure, in the Security preference pane, that a password is required to wake this computer from sleep or screen saver.
- I use Quicksilver, because I prefer the keyboard to the mouse. OS X lets you use a Hot Corner for invoking the screen saver, but that's hard to activate with the keyboard... so I added /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app to Quicksilver's catalog. That way I can invoke the screen saver just like any other program. (Phil pointed me to this hint; if you don't want to install Quicksilver.)
- Temporarily disabling the screen saver for movies and such is comparable to disabling sleep, but it's a bit more complicated (see HippoMan's post at 12-31-2008, 08:26 PM for the solution – also, applaud him for politely putting up with a lot of stupid responses in that thread).
22 November 2009
(begrudgingly) resolved
I took care of the freezing fullscreen issue by downgrading to Flash Player 9, which was a considerable bother to find online. I played some of Hulu's HD content, and it was gorgeous and not choppy. That's the first time I've rendered HD content – quite a relief that it works.
I don't know the difference between Flash Player 9 and 10. The HD content plays fine, so I don't think I have a reason to care. (It still bothers me on principle!)
I also took care of the fact that my computer goes to sleep when watching videos.
I don't know the difference between Flash Player 9 and 10. The HD content plays fine, so I don't think I have a reason to care. (It still bothers me on principle!)
I also took care of the fact that my computer goes to sleep when watching videos.
#!/bin/sh
trap 'pmset force -c sleep 90' 1 2 3 14 15
pmset force -c sleep 0
sleep 7200
pmset force -c sleep 90
I put a link to this file on my desktop. I just need to double-click it (thanks to its .command suffix) to disable the inactivity-based-sleep functionality for 2 hours. Break it down:- The
trap
means that if the script gets prematurely interrupted, it re-enables the sleeping. - The
pmset
bits disable and re-enable the sleeping behavior. - It re-enables automatic-sleepage (... eww) after a 7200s=2h delay via
sleep
.
21 November 2009
wierd and unwelcome
This Adobe bug is quite annoying. Does anyone else have this happen? If I use fullscreen mode on Flash player (YouTube or Hulu, e.g.) then the video freezes while everything else (like audio) continues. There's lots of forum posts out there where people discuss this, but the only fix is to disable hardware acceleration. That's a no-go for my meager Mini.
I use OS X's Screen Sharing to control the Mini from my laptop. When the video locks up, I can either connect via Screen Sharing or disconnect in order to fix it. This is a weird band-aid, but Screen Sharing is obviously related to video. It's annoying to do it every 5 minutes or so and to keep my laptop in my lap to watch video.
Some page I saw said it only happens when watching 480p content. And, for me, it only started happening when I started using 1080i. It didn't happen when I was using 720p.
This alternative suggestion did not work for me, which was sad. Took a while though, so my hopes got lifted and then squashed.
I use OS X's Screen Sharing to control the Mini from my laptop. When the video locks up, I can either connect via Screen Sharing or disconnect in order to fix it. This is a weird band-aid, but Screen Sharing is obviously related to video. It's annoying to do it every 5 minutes or so and to keep my laptop in my lap to watch video.
Some page I saw said it only happens when watching 480p content. And, for me, it only started happening when I started using 1080i. It didn't happen when I was using 720p.
This alternative suggestion did not work for me, which was sad. Took a while though, so my hopes got lifted and then squashed.
20 November 2009
weird but welcome
So my $450 craigslist Mac Mini was choppy when it was feeding 1080i video (such as 30 Rock on Hulu) to my $150 craigslist HDTV. I wasn't happy.
But, today, it worked.† Other than this Mac OS X update, I don't think anything else changed.
Yay? Yay...? Yay.
† I tried it again when playing around to try to figure out why the screen bounces when I set the mini to output 720p. Still don't know what's going on with that one.
But, today, it worked.† Other than this Mac OS X update, I don't think anything else changed.
Yay? Yay...? Yay.
† I tried it again when playing around to try to figure out why the screen bounces when I set the mini to output 720p. Still don't know what's going on with that one.
02 October 2009
welcome to the latest century
Here's how your web browser works.
HEY! HEY! Don't skip this unless you know this stuff already. It might demystify your monthly overage charges from your ISP, or help you yell in a more informed way at your roommates. It'll get back to this stuff in a few paragraphs, so hang in there.
When you type in a URL or click a link, your computer creates a little message (surely no more than a few kilobytes in the most extreme case). Your computer sends this message to your router (either through an Ethernet cable or across the wireless as a signal in the electromagnetic spectrum), which sends it to your modem (across the Ethernet cable) to your internet service provider (ISP) (across the DSL/phone/cable/satellite/etc.). All this time, the message's content hasn't really changed from that URL. Your ISP then sends this message to a name server, which is what knows how to map your URL to an IP address. When someone buys a domain name, they're in effect paying for these servers to include a mapping from their domain to the IP address of their webserver. Accordingly, the name server sends a new message containing the IP address for the original URL to your ISP which forwards it on back to your computer and finally your web browser.
Now the process starts over, this time using the HTTP protocol. Your web browser makes a new message (probably a GET request) and sends it to your router, modem, and then ISP. This time, the ISP sends it across the Internet backbone to the web server (identified by the IP address that the name server returned), which sends a HTTP response back to your web browser. Your web browser finally has the HTML (it's probably HTML but it can be other stuff) it needs to show you a web page. Other media in the web page, like images, are requested in a similar way before they can be shown as part of the page. Video, like YouTube for instance, are "streamed", which means that your computer is receiving later parts of the video (i.e. buffering) as it is showing you the parts it has already received.
(Wondering what HTTP messages look like?)
For all these things, the overall process is the same: your browser sends a message to a name server (via your router, modem, ISP) in order to translate a URL to an IP address, and then it starts communicating to that server (via your router, modem, ISP) to get the requested content (web page, image, video, etc.).
iTunes does a similar process (via your router, modem, ISP) when you search/preview/buy a song. Any program that uses the Internet basically does this same thing (via your router, modem, ISP).
Here's what makes this post relevant to your life. When your ISP gives you a bandwidth limit for the month, they actually give you two, one for upload (messages from your computer to your ISP) and one for download (messages from your ISP to your computer). When you click a link, there's at least two uploads and two downloads. Your browser uploads a request to translate a URL, your browser downloads the IP address, your browser uploads an HTTP request, and finally your browser downloads some HTML. Every time you upload something, your ISP counts how many bytes there was. If, in the billing cycle, that count exceeds your bandwidth limit†, then you've broke the rules. (I think for upload bandwidth limits, they just really slowdown your upload rate.) But people don't usually approach the upload limit. Your ISP also counts the bytes it sends to you: how much you've downloaded. Overages here you're usually charged for.
So now you know that everything you do on the Internet contributes to your ISP's upload and download counts, regardless of how you're interacting with it. Unless, you're at a coffee shop, for instance. Then it's the coffee shop's account with the ISP that your Internet communications are associated with. This is why coffee shops usually have slower Internet. Otherwise, they'd hit their download limit very quickly because everyone would download their big files (movies, natch) there.
† – Technically, managing my units here, it's your bandwidth limit times one month, since a bandwidth is an amount of data (like 2 gigabytes) per an amount of time (like one month).
HEY! HEY! Don't skip this unless you know this stuff already. It might demystify your monthly overage charges from your ISP, or help you yell in a more informed way at your roommates. It'll get back to this stuff in a few paragraphs, so hang in there.
When you type in a URL or click a link, your computer creates a little message (surely no more than a few kilobytes in the most extreme case). Your computer sends this message to your router (either through an Ethernet cable or across the wireless as a signal in the electromagnetic spectrum), which sends it to your modem (across the Ethernet cable) to your internet service provider (ISP) (across the DSL/phone/cable/satellite/etc.). All this time, the message's content hasn't really changed from that URL. Your ISP then sends this message to a name server, which is what knows how to map your URL to an IP address. When someone buys a domain name, they're in effect paying for these servers to include a mapping from their domain to the IP address of their webserver. Accordingly, the name server sends a new message containing the IP address for the original URL to your ISP which forwards it on back to your computer and finally your web browser.
Now the process starts over, this time using the HTTP protocol. Your web browser makes a new message (probably a GET request) and sends it to your router, modem, and then ISP. This time, the ISP sends it across the Internet backbone to the web server (identified by the IP address that the name server returned), which sends a HTTP response back to your web browser. Your web browser finally has the HTML (it's probably HTML but it can be other stuff) it needs to show you a web page. Other media in the web page, like images, are requested in a similar way before they can be shown as part of the page. Video, like YouTube for instance, are "streamed", which means that your computer is receiving later parts of the video (i.e. buffering) as it is showing you the parts it has already received.
(Wondering what HTTP messages look like?)
For all these things, the overall process is the same: your browser sends a message to a name server (via your router, modem, ISP) in order to translate a URL to an IP address, and then it starts communicating to that server (via your router, modem, ISP) to get the requested content (web page, image, video, etc.).
iTunes does a similar process (via your router, modem, ISP) when you search/preview/buy a song. Any program that uses the Internet basically does this same thing (via your router, modem, ISP).
Here's what makes this post relevant to your life. When your ISP gives you a bandwidth limit for the month, they actually give you two, one for upload (messages from your computer to your ISP) and one for download (messages from your ISP to your computer). When you click a link, there's at least two uploads and two downloads. Your browser uploads a request to translate a URL, your browser downloads the IP address, your browser uploads an HTTP request, and finally your browser downloads some HTML. Every time you upload something, your ISP counts how many bytes there was. If, in the billing cycle, that count exceeds your bandwidth limit†, then you've broke the rules. (I think for upload bandwidth limits, they just really slowdown your upload rate.) But people don't usually approach the upload limit. Your ISP also counts the bytes it sends to you: how much you've downloaded. Overages here you're usually charged for.
So now you know that everything you do on the Internet contributes to your ISP's upload and download counts, regardless of how you're interacting with it. Unless, you're at a coffee shop, for instance. Then it's the coffee shop's account with the ISP that your Internet communications are associated with. This is why coffee shops usually have slower Internet. Otherwise, they'd hit their download limit very quickly because everyone would download their big files (movies, natch) there.
† – Technically, managing my units here, it's your bandwidth limit times one month, since a bandwidth is an amount of data (like 2 gigabytes) per an amount of time (like one month).
Subscribe to:
Posts (Atom)