News for the ‘osx’ Category

what the sparkle doc’s won’t tell you

Sparkle is the updates framework for cocoa that “just works” , yea ok it does , however the documentation for it is a bit lacking on some very important aspects that i discovered over time :

1 – the preferences for your application must have SUAutomaticallyUpdate TRUE for autoupdates to happen , just setting SUEnableAutomaticChecks TRUE in the app’s Info.plist is not enough ,

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

[defaults setBool:YES forKey:@"SUAutomaticallyUpdate"];

[defaults synchronize];

OR

SUUpdater *updater = [SUUpdater updaterForBundle:[NSBundle mainBundle]];

[updater setAutomaticallyChecksForUpdates:YES];

OR

create a checkbox in the preferences of your app to toggle it on , unless you do that you have to use one of the methods above directly in code.

2 – since 1.0 sparkle implemented sparkle:shortVersionString to match CFBundleShortVersionString , the problem however is that it is only used when it also sees a different version in sparkle:version , for example if your app has

CFBundleVersion 1
CFBundleShortVersionString 1.1

and the appcast has
sparkle:version=”1″
sparkle:shortVersionString=”1.2″
sparkle will say you have the latest version , it only uses shortVersionString if  version differs from CFBundleVersion

3 – some times you might also want to force a update , either when the user clicks a Update Now button or when the application launches

SUUpdater *updater = [SUUpdater updaterForBundle:[NSBundle mainBundle]];

[updater checkForUpdates:nil];

OR

[updater setAutomaticallyDownloadsUpdates:NO];

[updater checkForUpdatesInBackground];


Both check for a update , however the first way also notifies the user if the current version is the latest one , so should only be triggered from a user action.

The second can be ran transparently on startup as it will not alert the user unless there is a new update , remember to set automaticallydownloadupdates off , or else the updates will only get downloaded and never installed (bug in Sparkle 1.5 b6)

EDIT: the bug has been confirmed for 1.5 b6 by Andy Matuschak , it is fixed in the github sources however http://github.com/andymatuschak/Sparkle/

Posted: December 13th, 2009
Categories: osx, software
Tags: , ,
Comments: No Comments.

apple “magic” mouse testing

Personally i think a gesture enabled mouse is a great move , and am looking forward to seeing it implemented in more mice , besides the mighty mouse i have been using a Logitech Air mouse which has a touch scroll with momentum which i miss dearly when using the mighty mouse , i am sure the same will be true about gestures.

But for now i want to touch on some issues with the magic mouse , when it was announced i was hoping a old issue with te apple mouses might have been addressed , that is the inability to hold down both buttons , the mouse registers a left click when a user clicks with both the right and the left fingers pressing.

While the swipe functionality alleviates this a bit there are still a number of 3d applications , games , and browsers that need the old “poorman’s swipe” a left swipe being similar to pressing and holding the right button then pressing the left and vice-versa , but this way of clicking can not be entirely replaced by the swipe feature as you can not swipe and drag for example.

What i do hope is that software developers will start to be aware of gesture enabled mice and of mice lacking 2button hold functionality , or even better mice manufacturers start making mice that implement both features , in any event here is a osx application i wrote for the purpose of testing mouse functionality.clicktest

Title: ClickTest.app
Caption: (universal binary , requires OSX 1.5+)
File: ClickTest.app.zip
Size: 61 kB
Posted: October 22nd, 2009
Categories: osx, software
Tags: , , , ,
Comments: 1 Comment.

midnight commander for snow leopard

midnight commander snow leopard

Wether you like to have a file manager running as root , need a file manager that can really dig into the guts of the os or are just nostalgic for the good ole 2 pane commanders , either way you got to have mc handy on your brand new 64 bit osx.

There are a number of ways to install it , you can go all out downloading the source and dependences and compile , or take a easy road by means of the macports or fink  packages , however there you might find this way the easiest .

Attached to this post is a zip file with the compiled sources, download and extract it to the root directory of /mc , then open a terminal with 5 tabs , type “cd” in each then drag each of the folders to a different tab , press enter in each , then type “sudo make install” in each tab , in this order : gettext > pkgconfig > glib > slang > mc.

That’s all there is to it, delete /mc, now type mc to get your native 64bit mc fix.mcsl

Title: mc
Caption: archive
File: mc.zip
Size: 53 MB
Posted: September 30th, 2009
Categories: osx, software
Tags: ,
Comments: No Comments.

having fun on the network

Itunes has a shared library feature but does not show you who and what is it sharing to.So lets start terminal and type :

lsof |grep iTunes |grep TCP

You can also find out what they are listening to by doing

lsof | grep mp3

Now how about for a little fun , say your colleague is listening from a windows machine

nmblookup -A 192.168.0.23

gives you their netbios name , next on use that name with :

echo “Ejoying songname John ?” | smbclient -M THENAMEHERE

shows a dialog like this smack middle in their windows screen
alert
Note that you can send messages like this to any computer you see in finder’s SHARED sidebar , just don’t abuse it , it will stop being funny.
Posted: April 9th, 2009
Categories: osx
Tags: , , , , , ,
Comments: No Comments.

setting up osx as web server

By default OSX comes with the industry standard apache web server , only OSX server comes with a mysql server however and none are configured my default for php.

Fortunately enabling both php and installing mysql is trivial on OSX compared even to linux
1 – enable php in apache (basically edit the config file uncommenting php module)
HOWTO :
type in terminal

sudo pico /etc/apache2/httpd.conf

press the down arrow untill you see this line

#LoadModule php5_module libexec/apache2/libphp5.so

delete the “#” at the start of the line by pressing right arrow and delete
press ctrl+x
press y
press enter
(you need to use console to edit this file because osx has no way to access that file in a open file window from any program)
2- install mysql
HOWTO:
go and download the package for your architecture and osx version , install it and the pref pane
open System Preferences and click MySQL > Start MySQL Server
open terminal and type :

/usr/local/mysql/bin/mysqladmin -u root password “MYPASS”

/usr/local/mysql/bin/mysqladmin -u root -h MYHOSTNAME password “MYPASS”

change MYPASS to what you want your mysql password to be and MYHOSTNAME to the machine’s hostname (it is shown in terminal along with your user name like this [myuser@myhostname:~])
3 – done , you are the owner of a AMP (apache/mysql/php) server , now you can harness the huge amount of free web software running on this ,
as a test that everything worked fine you can install phpMyAdmin as you will probably need it anyway , go to http://www.phpmyadmin.net and extract it to /Library/WebServer/Documents/phpmyadmin
open /Library/WebServer/Documents/phpmyadmin/config.default.inc.php in a text editor
find

$cfg['Servers'][$i]['host'] = ‘localhost’;

and replace localhost with your hostname

save the file as /Library/WebServer/Documents/phpmyadmin/config.inc.php
done , open http://myhostname/phpmyadmin and login with user: root , password:what you set before
Posted: March 17th, 2009
Categories: osx
Tags: , , , ,
Comments: No Comments.

First Google Chrome for OSX binaries

chromium
Here it is , the first precompiled version of google’s Chrome browser for OSX , whether you want to test your pages in it , or just take a firsthand look of the development so far on the mac version be aware that this is a very early revision and very unstable , for example it just crashes when loading nytimes.com , most websites i visited work fine however.

You can download it from here (or Chromium.app and TestShell.app individually), inside are two apps , Chromium.app and TestShell.app , they are the Release builds of revision 9854 for Leopard (10.5) of Google’s open source code behind Chrome , which is actually called Chromium.

TestShell.app is just the core rendering view , Chromium.app is the whole app so far but websites do not always load in it and rendering can be garbled , just use TestShell to test pages.

I am not affiliated with Google or Apple and i do not take any responsibility nor imply any functionality of these builds i am making available , have fun.

Posted: February 16th, 2009
Categories: osx
Tags: , , , ,
Comments: No Comments.

deleting junk and cache

For every folder you open in Finder it saves a .DS_Store file in that folder with the window settings , here is a easy way to get rid of them (texts in bold are shell commands to be put into Terminal ) the command recursively traverses all the directories , you can replace all the path with / for a system wide cleanup

find /Volumes/myvolume/mydir -name “.DS_Store” -print0 | xargs -0 rm -v

Like all operating systems there are some caches on osx that you might sometimes want to get rid off , to do so :
rm -rfv ~/Library/Caches/
removes all caches for the logged in user
sudo rm -rfv /System/Library/Caches/ /Library/Caches/
removes some system wide caches
sudo rm -rfv /private/var/folders/
removes Leopard specific cache folders
The osx kernel is a modular one meaning extensions are loaded into it as needed , to speed things up especially at boot caches are made that from time to time you might want to clear
sudo rm /System/Library/Extensions.kextcache /System/Library/Extensions.mkext /System/Library/Extensions/Caches/com.apple.kext.info
Posted: November 1st, 2008
Categories: osx
Tags: , , ,
Comments: No Comments.

dual boot , one itunes library

Since i started dual booting either Tiger or Leopard one thing that really annoyed me was that i had to deal with 2 itunes libraries , not being able to have the same thing in itunes no matter what i boot into.

Well there is a very elegant and easy fix for that that i am going to detail in this post and it only requires you to have a extra partition besides the ones that you are booting from.
So let’s get to it (texts in bold are shell commands and should be entered via Terminal):
1 – move your itunes library to a partition you do not boot from (i put mine on the Storage partition)
mv ~/music/iTunes /Volumes/IStorage/
2 – boot into each of the os’es and delete ~/music/iTunes if existing and make a symbolic link to the new location in its place
ln -s /Volumes/IStorage/Itunes/ ~/music/iTunes
This works beautifully and it works at some extent for things like Photo Booth too , also tho it might work i do not advise to make the links with Finder , just stick to console.
Posted: July 13th, 2008
Categories: osx
Tags: , , , , ,
Comments: No Comments.

avi movies in front row and itunes

Everyone has those divx movies , you can play them in quicktime given you have the proper codecs like Perian , but the pesky itunes will not add the files to its library.
What we need to do is basically change metadata of files by adding type “MooV” to them , the simplest way to do it is download this applescript droplet i wrote and just drag the files you want fixed on its icon.
A more involved way to do it that needs devtools (found on the install dvd) installed is by entering the bold text below in Terminal , after you modified the path and extension to suit your needs.
find /path/toyour/movies/directory -name “*.avi” -print0 | xargs -0 /developer/tools/SetFile -t “MooV”
Now that you can play those files with itunes how about having them show and play in Front Row from the confort of your remote ??!! , without even adding them to the itunes library , it is just a matter of making symbolic links in your ~/Movies folder to the directories containing your movies , you can use the shell or just alt+cmd drag them to ~/Movies to make the links.
Posted: May 8th, 2008
Categories: osx
Tags: , , , ,
Comments: 2 Comments.

osx and movies

OSX is nice , and not because it has no shortcomings , but because you can fix them as opposed to windows.This has a lot to do with the power of osx that stems from it having applescript and a posix compliant shell.

Here is how to change metadata of files so you can play divx movies with itunes for example , with terminal and devtools

find /path/toyour/movies/directory -name “*.avi” -print0 | xargs -0 /developer/tools/SetFile -t “MooV”

, with applescript http://forums.ilounge.com/showthread.php?t=214705

Now that you can play those files with itunes how about having them show and play in Front Row from the confort of your remote , without even adding them to the itunes library , it is just a matter of making symbolic links in your ~/Movies folder to the directories containing your movies , you can use the shell or just alt+cmd drag them to ~/Movies to make the links.

If yo do not know by now you can download movies from youtube just by selecting the file in Safari > Activity > Copy > Paste into downloads window.

How about playing every movie format there is including the flash movies you just downloaded from youtube in anything you like , quicktime , itunes , frontrow etc , well then just download http://perian.org/ and never care about formats of movies ever again.

To top it off i have a script for those times when you do want to know what are your movie files encoded with , this is a extremely fast shell script , with basic info , you can get it packaged as a osx app to drag folders to or directly as a cross-platform script.

vlad_videntify

Title: vlad_videntify.dmg
File: vlad_videntify.dmg.zip
Size: 26 kB
Title: vlad_videntify.sh
File: vlad_videntify.sh.zip
Size: 4 kB
Posted: May 8th, 2008
Categories: osx, software
Tags: , , , , ,
Comments: No Comments.