Archive for the ‘Mac OS X’ Category

Accessing Windows shares from OS X

Saturday, April 15th, 2006

I’ve been having a lot of trouble trying to get my OS X laptop talking to windows xp shares (file and printer) at home. It works just fine talking to xp at work and my samba share, but could not authorize to my windows machine. I finally tried using smbclient, and saw an error message that I was able to use to find relevant google hits.

 

> smbclient -U me //myhost/myshare
Password:
session setup failed: NT_STATUS_LOGON_TYPE_NOT_GRANTED

 

I found the solution on this guys blog - to summarize:

 

Open Control Panel -> Administrative Tools -> “Local Security Settings”

 

Security Options - Network Access: Sharing and Security for local accounts
was set to ‘Guest Only - local users authenticate as guest’. It needed to be changed to ‘Classic - local users authenticate as themselves.’

 

User Rights Assignment - Access this computer from the network
Needs to include the user you’re trying to login as.

 

OS X UI Freeze

Thursday, January 26th, 2006

I use Command-Tab a lot on my powerbook G4 17", and once every week or so, the act of doing a Command-Tab takes me into the appswitcher overlay, but I can't get back out of it. Keyboard does nothing, and the mouse moves around, but clicking has no effect. The machine is still responsive, and I can ssh in, but killing Finder just leaves a zombie. My only recourse is to reboot.

Anyone have a clue, or tips on how to troubleshoot/fix something like this? Are there any magic processes I can kill/restart that may fix this while still leaving me logged into my desktop?

Global environment variables in OSX

Monday, September 12th, 2005

Coming from the linux word, I'm used to being able to set global environment variables in my ~/.bash_pofile, and having all apps (including GUI ones) inherit them.

Unfortunately, this wasn't the case under OSX, and it took me a little digging to discover how to accomplish the same: add them to ~/.MacOSX/environment.plist, e.g.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.
com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CVS_RSH</key>
        <string>ssh</string>
</dict>
</plist>

Readline for python on OSX

Tuesday, August 30th, 2005

Was trying to use python interactively on the command line in OSX 10.4, and realized it didn’t have readline support (up arrow command history in interative python shell). Fortunately, google turned up the answer here. To summarize, running the following command in a terminal did the trick.

python `python -c import pimp; print pimp.file` -i readline

Debugging firefox (mozilla) extensions with venkman

Thursday, August 25th, 2005

In my quest to get OSX working the way I want, I discovered that a number of the firefox extensions that I use don’t actually work on OSX. So I figured this would be a good opportunity to learn a little about mozilla extensions by debugging what was wrong with them.

In my quest to get OSX working the way I want, I discovered that a number of the firefox extensions that I use don’t actually work on OSX. So I figured this would be a good opportunity to learn a little about mozilla extensions by debugging what was wrong with them.

First off, I recommend you create a separate dev profile so that you don’t screw up your real profile while mucking around with debugging. There are also some other config variables documented at the mozillazine wiki, which are useful if you want to do stuff like editing extension files directly without having to restart firefox to have your changes take effect. To create a dev profile, I fired up the profile editor by running the command

/Applications/Firefox.app/Contents/MacOS/firefox-bin -P

Once the dev profile is created, run it and install venkman and the offending extension(s). I’m using venkman 0.9.85 on firefox 1.0.6.

/Applications/Firefox.app/Contents/MacOS/firefox-bin -p dev

You should probably install just the extension you care about so that it can be debugged in isolation, unless of course, one extension is interfering with another and you need to figure out why.

Now you are set to debug your extension, but first configure venkman to be able to debug extension files by unchecking “Debug->Exclude Browser Files”. You may also want to tell venkman to automatically break in javascript that causes an Error or Exception by checking the menu items “Debug->Error/Throw Triggers->Stop for Errors/Exceptions”. Not all errors/exceptions are bugs, so this may cause more noise than its worth - especially if you have a bunch of extra extensions installed in your dev profile.

There are already a number of tutorials that teach one how to use venkman, so I won’t go into that here. You should now be able to set breakpoints in your code and step through it whilst exercising your extension. However, if you want to be able to debug the initial load/startup of your plugin, you need to do a couple more steps.

First, relaunch firefox telling it to run just venkman, without starting a browser:

/Applications/Firefox.app/Contents/MacOS/firefox-bin -p dev -venkman

At this point, since the browser window hasn’t loaded, none of its extensions have been initialized either, so you can set a future breakpoint on the load of the extension’s javascript file and be able to step through it while it is loading. In my case, I chose to debug the Single Window plugin because it seemed small and simple enough for me to get my feet wet. I also find it essential because new browser windows take a long time to start in my regular profile because of the extensions I have installed, with Google Toolbar being the biggest culprit.
/fbreak chrome://singlewindow/content/singlewindow.js 1

Now, its just a matter of telling venkman to start up a browser instance, which you can do with the open-dialog command, and then stepping through whatever code interests you.
/open-dialog chrome://browser/content/browser.xul

BTW, I submitted a fix for the Single Window extension to its author, and it should be in the next version > 1.4. If you can’t wait, it was just a matter of saving the value of window.Startup at the point right before it was changed rather than saving it at initial extension load at which point it seems to be null on OSX:

Line 67: window.Startup = singwin.Startup;
becomes:
orig_Startup = window.Startup;
window.Startup = singwin.Startup;