Computers

Don’t Run Two Instances of TextWrangler at Once [Solved]

Update:Barebones support got back to me and explained why this wasn’t working, this method broke their codesigning. But they had a solution: Simply go to File > New > FTP/SFTP Browser. Thanks Barebones!


Edit: Darn, I’m getting this error when trying to open remote documents: (MacOS Error code: -25293)

When I’m working on two projects at once, or want to grab a remote file from FTP when I already have one FTP site open, it would be nice to run two instances of TextWrangler at once, since it only supports having one FTP site open at a time.

I figured out how:

-Go to Applications/ and right click on TextWrangler and select Duplicate.
-Rename Textwrangler copy to Textwrangler2
-Right click on Textwrangler and choose “Show Package Contents”
-Open info.plist inside the Contents folder
-Change the data from

	<key>CFBundleIdentifier</key>
	<string>com.barebones.textwrangler</string>



to

	<key>CFBundleIdentifier<</key>
	<string>com.barebones.textwrangler2</string>



Now you can open both TextWrangler apps.


Optionally, grab this snazzy textwrangler alternative icon from this page:
http://sethlilly.deviantart.com/art/TextWrangler-Replacement-Icon-180898652
Right click and choose "copy image". Then get info on TextWrangler2, click on the small icon in the top right, and hit command-V to paste. That way it's easy to tell the two instances apart in the Dock and switching between applications.

MySql Avg() doesn’t work with enums or sets

I had a very simple votes table with a rating column which was defined as a SET(‘1′,’2′,’3′,’4′,’5’). This was meant to be easy to rate items from 1 to 5 stars.
Then I had the following values:

item_id rating
1 3
1 4
1 4
1 5

When I ran SELECT AVG(‘rating’) FROM votes WHERE item_id = 1, I would mysteriously get ‘9’ instead of ‘4’.

It turned out that ENUM and SETs return the index of the ratings, in powers of 2 for some reason, instead of the rating values themselves. So SELECT item_id, rating, CONV(rating, UNSIGNED) produced this:
item_id rating CONV(rating, unsigned)
1 3 4
1 4 8
1 4 8
1 5 16

So the average of the indexes of the set would be 9.

Instead I had to convert the set to a string, then convert the string to an unsigned INT to get the results I wanted:
SELECT rating, AVG( CONVERT( CONVERT( rating, CHAR ) , UNSIGNED ) ) FROM votes WHERE item_id = 1;

How to update Jailbroken iPhone to 4.3.3 [solved]

After having some problems with my home button, I tried taking my iPhone to the Apple store, who told me it would cost $200 to replace the hardware button on my iPhone. They also mentioned there were some home button issues with 4.3.1, the version of my iPhone OS, and to try updating. (They also said they had to mention the jailbreak could be my problem and to remove it).

I went home, determined to either fix the home button myself (they cost $5 online) or try a software update. I tried updating to 4.3.3 first, the latest untethered jailbreak. This is trickier now that 4.3.5 is out.

First, I ran AptBackup, a package you can find in Cydia to save all of your jailbroken apps for restoring later. (Edit: AptBackup deleted all my AppStore apps, people recommend PkgBackup instead.) I also saved my SHSH blobs in Cydia (important) when it prompted me, so that I could upgrade or downgrade my iOS freely.

I downloaded iOS 4.3.3 from here and tried option-updating or option-restoring in Itunes, but it gave me the error “The device isn’t eligible for the requested build.” I learned this is because Apple stopped signing iOS 4.3.3 in an effort to prevent jailbreaking.

I followed Saurik’s old guide, adding the line “74.208.10.249 gs.apple.com” to my /etc/hosts file to have Saurik’s Cydia server spoof apple’s verification servers. This bypasses the “eligible” error in iTunes, but as described, at the end of the restore I got the error message The iPhone “iPhone” could not be restored. An unknown error occured (1015)” Saurik writes that you should restore twice, but that you will get this message both times and get stuck in recovery mode, and then you should jailbreak.

Then, I tried using the latest version of RedSn0w to jailbreak. RedSn0w requires you to enter DFU mode by turning off the phone, but in recovery mode the phone turns on automatically when it’s plugged into USB. Regardless, I was able to enter DFU mode by holding down power for 2 seconds, pressing the power and home button for 10 seconds, and then releasing the power button and holding home for 10 seconds. Then, the phone hung on the “Installing Activation Bundles” screen and then rebooted and was stuck on the recovery screen.

I tried the application “fixrecovery43” but it didn’t work. (I got the error: libusb:error [darwin_transfer_status] transfer error: timed out)

What did work for me was installing TinyUmbrella and clicking the “Exit Recovery” option. TinyUmbrella crashed a few times on me, I think because of conflicts with Apple’s httpd server. I had to disable websharing and type “sudo killall httpd” in Terminal first. Then I clicked TinyUmbrella’s “Start TSS Server” and then it ran better. Open up /Applications/Utilities/Console.app for more details on what’s happening if you’re having trouble with TinyUmbrella. Evidentially you can use their TSS servers to restore the phone via iTunes as well but it didn’t work for me (I got a “could not connect to apple servers” error in iTunes).

Note: TinyUmbrella edits your hosts file and deletes everything except the gs.apple.com line. If you have other lines in your hosts file I suggest backing it up.

First I tried DFU mode, but the “fix restore” button didn’t work (the phone got stuck on a greenpois0n screen with the message “unable to find gbdevlist” and “unable to find fs_mount”). What worked for me was leaving the iPhone in recovery mode (iPhone screen on, usb cable icon pointing to iTunes icon), and then it shows up in the list of devices in recovery mode. Then I simply clicked on “exit recovery” and my phone booted normally into 4.3.3. Whew!

Finally, I reinstalled AptBackup and clicked “restore”, which restored all of my Cydia apps, but deleted all of my appstore apps. None of the suggested online fixes (installing an appstore app, resyncing with iTunes, turning on and off restrictions) worked. People online recommend PkgBackup instead of AptBackup, note to self. Anyway I restored my apps and settings from backup again using my old backup in iTunes and all is good. So far so good with the home button. If your iPhone 4 home button is still on the fritz, there are some good voodoo tricks in the comments here.

Create an encrypted folder with OS X Disk Utility [Solved]

I run several servers on my mac, and worry about getting hacked or accidentally sharing sensitive files. In addition, I worry about sensitive files when I take the computer in for tech support, or when others use my computer. Documents such as my tax files contain my social security number.

I don’t have to worry any longer (until AES is cracked, anyway), because it is easy to create an encrypted disk image on OS X. I followed the instructions here:

http://blog.smalldog.com/article/1814/use-disk-utility-to-encrypt-files/

I chose a 2.5 GB image, which automatically suggested a CD/DVD type partition. I’m not sure what partition type to use but don’t think it matters. These were the settings I used:

This will create a .sparseimage file. Sparse images are nice because they don’t actually take up their entire hard drive space until they’re filled with contents.

Note that after you drag the files in, you still have to delete the originals. Then when you eject the encrypted image, they are protected. When you double click on the image again, it will ask you for your password. Don’t forget this password, because it is impossible to recover!

I used spotlight to search my computer for files containing my passwords or social security number. If they were necessary, I dragged them in here, otherwise I deleted them.

Cyberduck pauses when dragging files to upload [solved]

I’m on a speed-up-my-computer kick today.
I’ve generally used Cyberduck as my main FTP client, but switched to Transmit and FireFTP when it became too sluggish. It has been sluggish for several years now, though I still use it for advanced operations such as right-click file permissions (with the Info menu).
I finally did enough googling to solve its sluggishness: In the transfers window, select all and click Remove. Unless you need a detailed history of everything you’ve downloaded, this window is fairly useless and is the cause of Cyberduck’s sluggishness.
I found this solution via this thread.

Firefox is sluggish and streaming video is choppy [solved]

I got a brand new 2010 8-core mac pro with 12 GB ram, and was horribly disappointed to find that streaming video on Hulu and Netflix still stuttered. Why is Apple’s second fastest machine worse than my iPhone at playing Netflix video? Flash is an infamous hog on mac, but Firefox in general was slow when hovering over links and clicking on things. Netflix uses silverlight too, so it’s bizarre that it would also stutter.
Running Netflix and Hulu in Safari worked fine, but I missed features in Firefox. So in Firefox I went into Tools > Add-ons, disabled everything and restarted. Everything was zippy again. Then I slowly enabled add-ons one at a time.
The culprit seems to be Firebug and the enormous cache it keeps. For now, I have disabled Firebug, and only enable it when developing.

Windows 7 – “setup was unable to create a new system partition or locate an existing system partition” [solved]

When trying to install Windows 7 to dualboot with Snow Leopard on an existing partition on a Dell Mini 10v, I kept getting this error:

“Setup was unable to create a new system partition or locate an existing system partition.”

No matter how many times I deleted, created, and reformatted the partition using Windows’ installer or OS X’s disk utility, Windows 7 said it could not install to Partition 0.

I also got the error “Windows cannot install to a GPT partition”, and when I tried converting it to MBR in Diskpart, the error “Cannot convert partition”.

The solution was really, really, really stupid:

In my BIOS, I had my boot order set as USB drive before hard drive so I could boot from it. Apparently, that confused the installer. I set the hard drive as the first boot device, and then selected to boot from USB by hitting F12 when the POST screen appeared.

Windows is almost 30 years old, and it still has these types of problems? Really, Microsoft?

Override USB or Firewire Volume Level in OS X with Soundflowerbed [solved]

Update2: Lion has this functionality built-in. hurray!

Edit: While the sound controls work, I’ve been having major issues with soundflower, from audio disappearing to getting stuck and looping on a sample. Looks like soundflower still needs a bit of development. :(

This has been driving me nuts for years.

I have an external firewire audio interface, a MOTU 896, that has served me well for 7 years. It powers my studio monitors, has multi inputs and delivers superior sound compared to my internal computer speakers.

The only problem with it is that OS X’s volume controls don’t work with it. The volume keys don’t work on the keyboard, the apple remote volume doesn’t work, and you can’t control the volume with AirMouse on the iPhone. In system preferences, you get the message “The selected device has no output controls”, and you get an annoying disabled speaker when you try and use the volume controls.

Thanks to this post and the wonderful folks at Cycling 74, there is a free solution. You can install soundflower, which allows you to route all of your audio to a soundflower device. Once you’ve installed soundflower, you can run Soundflowerbed from your applications menu, which makes a finder menu appear that allows you to choose which device to route audio to. Choose your external device, and you’re done!

Finally, you can leave the volume knob on your external device in one setting, and control the volume from across the room with a remote! Glorious!

Soundflower is also a great app for interapplication multichannel audio routing, similar to rewire or jack.

Firefox 3.6 won’t open on primary monitor [solved]

Firefox 3.6 has been driving me nuts by always opening on my secondary monitor, no matter if I drag windows over, restart, delete user preferences, etc. Every time I hit command N, the new window opens on my secondary monitor.

This is a known bug with Firefox 3.6.

The work around for now on OS X anyway is to drag a firefox window to your primary monitor, hit the green plus button to maximize the window, and then hit the green plus button again to restore it. Now windows should remain on the primary monitor.

Get Growl Notifications on VNC connections, SSH attempts, and HTTP logs [solved]

Use this script to monitor VNC connections with Vine Server:
nice -n 100 tail -n 0 -f /Users/jordan/Library/Logs/VineServer.log | php -r 'while ($m = fgets(STDIN)) shell_exec("growlnotify -p 0 Vine Server -m ". escapeshellarg($m));'

Change “jordan” to your username (home directory), or the whole path of the log if you’re monitoring something else. “Vine Server” is the alert title, which could be anything (“Hello World”).

Save this as a file such as vncnotify.sh. Run
chmod 755 vncnotify.sh
and then you can run the command by typing ./vinenotify.sh.

Duplicate this file and name it vinenotify.command.
Finally, in System Preferences > Accounts > Start up items, add vinenotify.command, and make it hidden, and it will run when you log in.

Things I’m still working on: preventing a string of notifications when you launch VNC; hiding the terminal window when you log in; and grepping for only connect/disconnect/login failures.
Thanks to drewish.com for the growl tail code.

« Prev - Next »