Blog

Showing posts with label macos. Show all posts
Showing posts with label macos. Show all posts

Friday, April 08, 2011

Bookmarklets break MobileMe sync

Bookmarks weren't syncing between my iOS devices and my desktop machines, but I managed to find a solid description of the bug and a good workaround. In short, do not add bookmarklets on your devices. Instead, add them on the Mac and let them sync across. The message I was getting on the Mac side was "You need to replace your Bookmark Information on MobileMe" with two buttons: Fix Later and Replace.

The problem ostensibly lies with improper URL encoding of bookmarklets on the iOS side, which results in "corrupt" data in the cloud. The devices don't know or complain about this, but Mac OS does.

What I did was to delete all but my most useful bookmarklets on my Mac, then sync just the bookmarks. Everything works again!

Thanks to this discussion, the fix was pretty simple.

Note the dates on those postings. Sigh. I am so sick of MobileMe sync bugs!

Saturday, February 26, 2011

It's my turn to blog about ringtones on an iPhone

This has been done to death, but so much info is out of date, so I am writing it all down here in one spot.

I had some old MIDI files that I had created using TuneToys that I had used on my old LG VX4400 phone (the one that embarrassed my daughter, it was so old) and I wanted to continue using them on my shiny new iPhone. These are the steps I followed.

  1. Drop the MIDI file on iTunes. It will get imported.
  2. Select it, right-click and select "Create Apple Lossless Version". This makes a .m4a version in your library.
  3. Drag the new .m4a version onto your Desktop (or somewhere)
  4. Change its extension to .m4r
  5. Delete the .m4a version from iTunes. While you're at it, delete the MIDI version too.
  6. Drag the .m4r version into iTunes. It will show up under Ringtones.
  7. Sync.

iTunes will kvetch if the sample is more than 30s long (which is prolly some legal thing – now I have to limit my own use of my own composition because of some RIAA lawyers?) so trim it. 

Friday, January 28, 2011

MySQL Install broken on Snow Leopard

This happens a lot. The Mac install breaks with new releases. The symptom is that MySQL does not start from the pref pane. Look in the system logs and you'll see
1/28/11 12:57:09 AM [0x0-0x27f27f].com.apple.systempreferences[42393] /usr/local/mysql/support-files/mysql.server: line 256: my_print_defaults: command not found

Mysteriously, my_print_defaults was not installed. I recovered a copy from my backup of the previous install and put it in /usr/local/mysql/bin. (The MySQL installer wipes out your previous install - charming.)

Next, you have to modify mysql.server. I opened it and provided a value for basedir on line 46:
basedir="/usr/local/mysql"

Sunday, August 15, 2010

Mac RGB color picker

If you're working on a web site or web app, you need to specify colors in RBG. The built-in MacOS color pickers are not much use. RCWebColorPicker is a drop-in bundle that provides a simple RGB color picker, like this:


Screenshot of RCWebColorPicker  

Interestingly, I have this picker available to me, but I have not installed it! How can this be?!

It seems that the venerable GraphicConverter incorporates this picker, and Snow Leopard obligingly picks it up, system wide. Impressive as it is unexpected.

References:

Waxing rhapsodic about Safari Extensions

They're so shiny! Safari 5.0.1 has Extensions!

For years I have eschewed Firefox as my primary browser, not because of anything it said, or because it has bad breath, or because it voted for Bush. I have preferred Safari for two reasons: It's better integrated into the OS (keychain is the most important) and it's faster.

But for all those years, I've been envious of Firefox's plugins. Sure, some intrepid folks have found ways to extend Safari, but my guess is that it was hard — surely, if it was easy, more people would have done it, right?

There was also the issue of maintenance. Plugins like PithHelmet used the SIMBL framework, which was intended to be benign from Safari's standpoint, but which got severely broken every time a new version of Safari was released. I would have to go days or weeks without my favorite plugins while the poor author sweated over making it work with the newer Safari.

It seems those days are behind us. Within hours of installing my Safari 5.0.1 update, I am using a little group of Extensions and loving 'em. Sure, they have their little shortcomings, but don't we all? The fact is, I can use them with some small degree of confidence that they won't fall apart every time a Safari update is released, because they're using an Official API.

Because they're so shiny, I am publishing a list of Extensions I'm using:

Delicious Safari
Only lets you add a link to del.icio.us, but better than nothing
ScribeFire
Very nice in-browser blog editor
Add to Amazon Wish List
Add "any" item from any page to your wish list
WOT
Sweet interface to Web of Trust
Stumbler
Stumble and rate pages on Stumbleupon
AdBlock
My replacement for PithHelmet

References:

Tuesday, April 06, 2010

Timesheets and Invoicing

I hate billing. As a result, I tend to put it off. Bad idea.

My old timetracking and invoicing process involved a little app I wrote for PalmOS that I use for punching in and out. At sync time, the database is backed up to my Mac. A desktop app reads the backup and turns it into a CSV file that gets imported into...

Sheesh. How did I put up with that for so long?!

I started looking around at some desktop timetracking apps, but the market seemed so crowded that picking the winner became a burden. So I looked at online options.

After kicking the tires of few of them, I settled on FreshBooks. It's early days, and some of the warts are already evident, but I foresee effortless billing in my future!

I punch in and out using a Dashboard widget. FreshBooks can be told to send out invoices automatically each month. Theres a public API which means I can back up my data.

So let's see how that all unfolds, and I'll report back.

Thursday, January 21, 2010

Remote monitoring of Tomcat

Got memory leaks? Dogged by OutOfMemoryErrors?

JDK 1.5 and later come with jconsole.

First you have to tell Tomcat how to publish it's inner workings for jconsole. This process differs by platform and also depends on how you installed Tomcat.

The typical MacOS X install consists of downloading the zip and expanding it somewhere. The "somewhere" is your CATALINA_HOME. If that's how you installed Tomcat, go to $CATALINA_HOME/bin and create a file called setenv.sh. Into it put this line:

export CATALINA_OPTS="-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=8086 -Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false"

On RHEL, Tomcat is typically installed via rpm – I use yum. In that case, you need to add the CATALINA_OPTS to /etc/sysconfig/tomcat6 Leave out the "export" since this file is not a shell script.

Now reboot Tomcat and you're good to go.

Connecting is trivial. Start jconsole. On MacOS X, simply type jconsole at the command line and it opens. For other other platforms, let me know and I will add it.

When jconsole comes up, it will have discovered any local tomcats so simply connect. For a remote tomcat, connect using port 8086 as specified above, and leave user name and password empty.

That's it!

Saturday, January 02, 2010

Automating your MacPorts upgrades

Porticus is a very nice tool for maintaining your MacPorts. I find it easier than the command line port utility. But mostly, I use it for routinely updating (uh, sorry — “upgrading”) my ports. What if that could be automated?

Here's how.

Create /etc/daily.local with this content

#!/bin/sh
#
# /etc/daily.local
#
# I got this from http://hacks.oreilly.com/pub/h/336

# General parameters
PATH=/bin:/usr/bin:/sbin:/usr/sbin
. /etc/hostconfig

# Update MacPorts, if present
if [ -f /opt/local/bin/port ]; then
    /opt/local/bin/port selfupdate >> macports.log 2>&1 && /opt/local/bin/port upgrade installed >> macports.log 2>&1
fi


This adds the MacPorts update to your daily maintenance regimen. Typically, the Mac's periodic scripts are run at around 3:00 AM and they take care of all kids of things like updating your locate database. The /etc/daily.local file is executed if present.

Naturally, if you would rather do your MacPorts update weekly or monthly, then use /etc/weekly.local or /etc/monthly.local instead.

Create /etc/newsyslog.d/macports.conf with this content

# logfilename          [owner:group]    mode count size when  flags [/pid_file] [sig_num]
/var/log/macports.log                   640  7     *    @T00  J

This additional config file for newsyslog says to rotate the macports.log file created by our daily.local. For more info, use man newsyslog

And so on…

Obviously, you can use this trick for other things you'd like to run periodically. For example, you can update Fink be putting this into your daily.local:


# Update Fink, if present
if [ -f /sw/bin/fink ]; then
    /sw/bin/fink selfupdate >> fink.log 2>&1 && /sw/bin/fink update-all && /sw/bin/fink cleanup >> fink.log 2>&1
fi


Wednesday, December 09, 2009

Selenium won't launch Firefox under Snow Leopard

The latest FireFox (3.5.*) includes a version of sqlite that drives Selenium nuts. The basic problem is that Selenium is allowing FireFox's (whacko) version of sqlite to take precedence over the OS-supplied one.

The error message you'll see in the Selenium server log files looks like this:

dyld: Library not loaded: /usr/lib/libsqlite3.dylib
Referenced from: /System/Library/Frameworks/Security.framework/
Versions/A/Security
Reason: Incompatible library version: Security requires version
9.0.0 or later, but libsqlite3.dylib provides version 1.0.0

The fix is to disavow Selenium of that silly notion, which entails setting the DYLD_LIBRARY_PATH correctly. This is all explicated in the Selenium bug report.

The problem has already been fixed in the Selenium trunk, so the solution is to build your own Selenium. It's quite trivial, so here goes:

First, grab the patch, then execute these commands:

svn co http://svn.openqa.org/svn/selenium-rc/trunk .
patch -p0 < snow-leopard.patch
mvn install
cd $WHEREEVER_YOU_KEEP_SELENIUM
cp selenium-server.jar selenium-server.jar.bak
cp selenium-server/target/selenium-server-1.0.2-SNAPSHOT-standalone.jar selenium-server.jar

That takes care of the prob.

Saturday, June 13, 2009

Mumble or Skype?

We use Skype a lot at Industrial Logic. But we also use VNC, and if the person running the VNC server has a low upstream bandwidth, the voice quality is unusable. We thought we might give Mumble/Murmur a try.

As it happens, I have done a bunch of research on VoIP technologies and speech codecs, so when I saw that Mumble uses Speex, I knew that it is on the right footing.

Two thing need to happen in order to get to the point where we can do some tests. The first is to set up the server. The Windows download of mumble includes murmur, and there are RPMs and static builds of murmur for Linux-based systems. As it happens, MacPorts has a murmur install, so on MacOS it's a simple matter of

port install murmur

Configuring the server — something I have yet to try — appears to be documented, but the proof is in the pudding.

Just for giggles, I fired up mumble in an attempt to connect to a public server. It seems that much of the goodness of mumble comes from it being configured correctly. In particular, it needs to be trained so that the background noise-filtering works correctly.

I have not reached on conclusion on whether mumble can replace skype for my bandwidth-challenged brethren. If I get 'round to installing murmur, we can give it a try.

Notes on making a simple auth app using Wicket

Follow the instructions here and add the junk to your pom. You'll need to add a repositories element in which to put you repository. I put mine near the end, after the build

Run mvn install

I prefer JUnit 4 to 3.8, so I removed the generated "variable" ref from my class path and added Eclipse's built-in library for JUnit 4.

To keep things consistent, I modified the pom to refer to JUnit 4.. Maybe I should have let the Eclipse build reference the Maven repo rather than Eclipse for its JUnit. Hmm.

Added "variable" ref for both swarm and wasp (sheesh - why two? This is so confusing) and changed my application to extend SwarmWebApplication as described in the swarm getting started doc.

Of course, Eclipse helped me out with the stubs of the overrides of the abstract methods, so on to filling them in.

So, starting with a bare-bones app, start adding security. Hmm. Not working.

OK, so start with the kitchen-sink security demo app and begin deleting unneeded code. Hard, because I don't have a project and have to rely on reconstructing one from the war.

Aaargh! Give up on swarm. The guy's dead anyway, so who's maintaining it?

So auth-roles is the next.

Generate a project using mvn. Modify the pom to include auth-roles:
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-auth-roles</artifactId>
<version>1.4-rc4</version>
</dependency>

Then use mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true to make the eclipse project. Import into eclipse.

Copy gibblies from the "wicket-auth-roles-example" available on Sourceforge. (It's in maven too if you know how to get it. I don't.) It has a weird structure, not like the autogenerated one with the embedded Jelly, so that's why we have to copy/paste.

A couple little syntax errors: Stuff that's presumably changed in more recent releases. An overridden constructor needs to be deleted, since the thing it overrides no longer exists. Stuff like that.

And the source needs to be reformatted. What's with all this C#-like source formatting anyway? Sheesh, this is Java, guys.

PHP Again

Since my last post about PHP dev, Eclipse PDT seems to have matured a bit. So I am having a go at installing it.

First, I uninstalled PHPEclipse and the xdebug plugins, and installed PDT. The instructions, mysteriously, are quite complex. Find them here.

I had a very frustrating time getting dependencies to resolve properly, until I found a hint somewhere that suggested that my Eclipse install was "messed up." So I downloaded a fresh Eclipse for J2EE and finally got PDT 2.0 installed.

This came at the cost of all the gaziilion other plugins I had installed, like the Google App Engine support, Ruby and Python support and so on. Feh. I'll live.

I disliked all the UI clutter introduced by the xdebug plugin so, contrary to Paul Scott's advice, I am giving zend debugger a whirl.

It seems that PDT comes with the "client" end of the Zend debugger, so all we need is the server. These instructions purport to guide one through that.

Make a phpinfo.php file containing only and execute it to see what php thinks about itself and its world.

Follow the instructions in the readme that comes with the download. First, I copied ZendDebugger.so into /usr/local/lib. Then I made /etc/php.ini by copying the default found in the same directory. This is what I added:

[Zend]
zend_extension=/usr/local/lib/ZendDebugger.so
zend_debugger.allow_hosts=127.0.0.1, 192.168.1.0/16
zend_debugger.expose_remotely=always

I was also told to copy dummy.php into your Apache docroot, but I don't know why. I put mine in /Library/WebServer/Documents/

To confirm that it's installed, we use our phpinfo.php and search for "debugger". There will be a reference next to the copyright as well as an entire section of zend debugger-related info.

We need the client end of the debugger which is not provided by Eclipse for licensing reasons. Get it here. (The referring page is here.) Hmmm. It seems you can get it from an Eclipse update site as well.

Leopard comes without pear so we have to install it:

cd /usr/local
curl http://pear.php.net/go-pear > go-pear.php
sudo php -q go-pear.php

Note that the go-pear script is very fragile and pretty badly written. It is easily confused. Make sure you are in the directory you want it to install into (/usr/local in our case), or it will get things horribly wrong. When it's done, it will have fixed your php include_path too. Use pear config-show to see how it's been set up.

Now, to install PHPUnit, all we need do is

sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit
It turns out that PDT does not support running PHPUnit directly, so I created an "external" run configuration in Eclipse to make it happen. [how? Maybe I'll fill in the details some time. Not now. It's my blog and I will write what I like.] I can finally test-drive some code! Next, deploy it. Zend Framework likes to assume it's at the root of your docroot, so people typically create a virtual host to make that happen. I found that Zend Framework apps really want to see Zend on the include_path so we add it in php.ini. But first we put a copy of the framework in a central spot. I chose /usr/local. So the whole download lives in /usr/local/ZendFramework-1.8.1. We'll want a symlink to isolate us from version lockin, so inside /usr/local, I did a
ln -s ZendFramework-1.8.1 ZendFramework
Now my include_path looks like this:
include_path=".:/usr/local/PEAR:/usr/local/ZendFramework/library"
Then, in things like the quickstart app, I just went into the library directory and did
ln -s /usr/local/ZendFramework/library/Zend
Finally, in the quickstart, I did the requisite
php scripts/load.sqlite.php --withdata
as dictated in the quickstart readme, and the db was created. Still following the instructions in the quickstart readme, I created the virtual host. I put it into /etc/apache2/extra/httpd-vhosts.conf and uncommented the include in httpd.conf. I added the line in /etc/host but here's the thing: Add ::1 as well as 127.0.0.1 since, being a futurtistic Mac, it uses IPv6. Apache had trouble with permissions when my docroot was in my home directory, so my virtual host's docroot ended up being /Library/WebServer/ZendFrameworkQuickstart-20090430 If you have permissions issues (you will), look in the apache log and chmod everything in sight. Finally, the app worked! Next, I tried making an app from scratch using the zh.sh script that comes with the framework. It's a bit like the RoR script(s) and is used to generate a new app, a new controller, a new view, etc. I made a do-nothing app and voila! it worked!
zf.sh create controller auth 
zf.sh create action login auth
zf.sh create action logout auth --view-included=0
Still, the virtual host stuff has to be set up or nothing else will work. That's very troubling, as I can't imagine many ISPs being open to that level of messing with their Apache instance. More on that particular nightmare another time.

Sunday, April 05, 2009

Installing MySQL gem on Leopard

Ordinarily, installing a gem on Mac OS X is as simple as

sudo gem install foo.

However, a little extra magic is required to install the mysql gem:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

I found this reference to back me up.

Thursday, November 27, 2008

Ecto

So it's a holiday, and what better way to spend it than fiddling with an app on a Mac?

I looked around – once again – for a better blog posting client than ecto. The only contender is blogo. It's very nice, but it lacks some of the power features of ecto like a twitter plugin (I still don't have that working..), the ability to ping a bunch of servers, and, most important, custom HTML tags for doing stuff like posting code. Sure, you can hand-edit the HTML, but that gets very old very quickly.

So back to ecto. Time to pimp it up and get all the gibblies to work together. The UI has always frustrated me. Nothing is where I expect it to be. But at least this version (3.0b55) is reasonably stable.

Now, having got it the way I want it, I need to set it up again on my desktop machine. What a pain! I copied the .plist file from ~/Library/Preferences to the other Mac, but some things are still not there, like the list of servers to ping. With a little digging and some help from sudo fs_usage -filesys |fgrep -i ecto I see that all that stuff lives in ~Library/Application Support/ecto3/accounts.plist Bingo!

Saturday, October 11, 2008

PHP and FMP

Get FM_API_for_PHP_Standalone from within the FM server download. Use the trial if necessary.

Expand it and copy it into /usr/local/php/fmp. Make the parent directories as needed

Copy /etc/php.ini.default to/etc/php.ini

Edit php.ini. Uncomment and modify include_path = ".:/usr/local/php/includes"

I set up eclipse by copying the features and plugins after downloading from http://www.eclipse.org/pdt/downloads/ I couldn't get the update site to work (mysterious errors.) Finally, after messing with it for ages, I concluded that Eclipse PDT doesn't work with Ganymede. I now use PHPEclipse.

For debugging, we need xdebug. Oopsie. Must install pear to get pecl to get xdebug.

So,

curl http://pear.php.net/go-pear > go-pear.php
sudo php -q go-pear.php

Let the script update php.ini. And don't forget to update PATH like the script told you to.

Then it's

sudo pecl install xdebug

And do NOT do what it says (You should add "extension=xdebug.so" to php.ini")

Instead, add this:

[xdebug]
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so

Then confirm that it's working by doing php -mxdebug will show up both under [PHP Modules] and [Zend Modules]

Get phpUnit installed. See Sebastian Bergmann's site: http://www.phpunit.de/manual/3.4/en/installation.html

sudo pear channel-discover pear.phpunit.de
sudo pear install phpunit/PHPUnit

Sunday, May 11, 2008

AFP and Bonjour on DS-107+

Here are some notes I took when getting a Synology DS-107+ to play nicely on an all-Mac network. I installed an AFP server and mDNS daemon, also known as Bonjour or Zeroconf.

The first pitfall: Use firefox - bugs prevent proper privileges and path installation if you use Safari.

Instal EnableSSH. See Synology's instructions

Check "Hide this share in My Network Places". This prevents them from being published as samba shares. They're still accessible via samba, and AFS only publishes to people who have access anyway.

Install ipkg by following the instructions on Maarten Damen's site

If you're a Unix geek, you'll recognize ipkg as being a package manager something along the lines of Debian's apt or the Mac port, fink.

We'll install avahi next. It's the Bonjour bit. The ipkg install is in the "unstable" tree so we need to tell ipkg about it by adding

src http://ipkg.nslu2-linux.org/feeds/optware/syno-x07/cross/unstable

to /opt/etc/ipkg.conf

Then avahi will install by simply running

ipkg install avahi

We need to give avahi the wherewithal to boot and be useful. I found that the slackware distro has the closest to what I wanted.

Copy the init script from

/avahi-0.6.22/initscript/slackware/avahi-daemon.in to /opt/etc/init.d

Also change the @sbindir@ to /opt/sbin

This is easiest if you mount /opt via smb (the share is published by ipkg bootstrap)

Start all the daemons by running

/opt/etc/rc.optware

In /opt/etc/avahi/services

delete sftp-ssh.service and replace with afpd.service:

(see http://gentoo-wiki.com/HOWTO_Share_Directories_via_AFP)

Hacked the S20dbus script in /opt/etc/init.d to NOT check for pid file. I think the pid is not properly cleaned up on shutdown so dbus fails to boot. This causes it to run, which allows avahi to run too.

Thursday, April 17, 2008

Macworld | Mac OS X Hints | Add more power to 10.5's screen sharing


[From Macworld | Mac OS X Hints | Add more power to 10.5's screen sharing]

I live by VNC, since we are a distributed XP team. So I was thrilled when I found this MacWorld article on tweaking the build-in VNC client on Leopard.

Now if only it would get over some of its temperamentality so I can use it reliably over an SSH tunnel or to a non-Mac machine.

Friday, March 14, 2008

Leopard: Connect As... does nothing

In Finder, Connect As says "Connecting" but does nothing. That's because NetAuthAgent is dead or wedged. See this thread: http://discussions.apple.com/message.jspa?messageID=5785124#5785124

The only cure I can find is to log out/in again.

Getting Postfix running on Leopard

1) Enable the service by changing the "disabled" flag in /System/Library/LaunchDaemons/org.postfix.master.plist I just use Lingon for this.

2) Edit /etc/postfix/main.cf and uncomment and edit this line:

myhostname = host.domain.tld
Also uncomment this line:
myorigin = $mydomain
That's it!

Monday, June 07, 2004

Python plus OSA, vs. AppleScript

I have mentioned a few times that I have been using Python to talk in an AppleScript-like manner to Mac apps, via the appscript module. It is really exceedingly cool. It provides very tight control over when one does the “get” (i.e. the AppleEvent that actually hits up the app for some data) allowing one to manipulate references instead. This has the great benefit of a dramatic performance improvement over the brute-force approach one might use with AppleScript.

Correspondingly, of course, there is the fact that I have learned a great deal about how AppleScript works, and, should it be necessary, I'll be able to write much cleaner and more efficient AppleScript.

“More efficient?”

Well, yes.

And no, I am not violating the “don't optimize prematurely” maxim of XP, because AppleScript is universally, painfully slow. I pretty much know that anything I do in AppleScript is going to take forever at run time, so any optimizing rubrics I come across of are worth remembering.

And while we're talking about OSA... I have not had much occasion to use JavaScript OSA. I bet it's as nice to deal with as Python from the perspective of scripting scriptable apps. Of course, JavaScript is implemented as a “component,” meaning that it must be executed in an OSA-aware script editor (or via the osascript command) but there is no interactive interpreter available as there is for Python. Not exactly convenient.

The main reason I wanted to use Python (other than the fact that it's a nifty language and I know it quite well) was that I wanted to interact with a MySQL db. Easy in Python. From a purely OSA language like AppleScript or the JavaScript component, I'd have to have a scriptable app act as go-between. How would I do that? And can you imaging how slow that'd be?!

One more thing to try, however, might be to use the old MRJ technology to make a scriptable Java app. Then the Java app can use Hibernate to get at the db. Since the goal of this whole exercise is to integrate with a Java web app with Hibernate backend, the code reuse is obvious, and having to maintain two persistent layers is no longer an issue.

Twitter Updates

Facebook

Blog Archive