Friday, 28 January 2011

Skype 5 for OSX is out

Well they released an official version of it yesterday... I guess I'm getting used to it - the do seem to have made the final version a bit smaller so I suppose it's ok. The group video stuff sounds good and it all seems to work well so far...

Anyway it's good to see they're actually working on Skype for OSX - it's been a while since 2.8 was out. I guess you could give it try....!

Tuesday, 18 January 2011

Shrinking Linux virtual disks on OSX VMWare fusion

So your virtual disk is taking up tonnes of space - despite the fact it's not that big when you check its size in the Virtual machine. It's annoying that VMWare images don't do better auto shrinking...

Anyway I tried to run the vmware-tools which I installed (after a bit of jiggery-pokery) and it comes up with a 'Shrink' tab but no disks appear in the list to shrink?! Any suggestion as to how to get disks to show up there are welcome but I couldn't find much on the web about it...

So instead I looked about and the best way is to take the following steps:
  1. Start your VM OS up and optionally remove any cruft. At least run:
    sudo apt-get autoclean
  2. To prepare for the shrinking process run:
    sudo cat /dev/zero > zero;sync;sleep 1;sudo rm zero
    This fills all remaining space on your virtual disk with a file full of zeros so the space can be reclaimed in the shrinking step.
    Note: Your hard disk WILL NOT fill up as the vmdk images do actually optimise the storage of files containing zeros
  3. Shutdown VM OS and delete any snapshots available then Quit VMWare Fusion
  4. To start the shrinking process in OSX run (Replacing path_to_your/disk with something like '/Users/username/Documents/Virtual Machines/Ubuntu/Ubuntu.vmdk'):
    cd '/Applications/VMware Fusion.app/Contents/Library'
    ./vmware-vdiskmanager -d path_to_your/disc.vmdk
    ./vmware-vdiskmanager -k path_to_your/disc.vmdk
    
    The first command defragments the disk, whilst the second actually does the shrinking.
    (Note: The directory for 'cd' for 3.X of VMware Fusion was:
    /Library/Application Support/VMware Fusion/) 
[27jan12: Updated for VMware Fusion 4.X]

Thursday, 13 January 2011

New Apps not showing up in Apple+Tab

So I was using my Mac (probably with way too much stuff running) and started a new App and then hid it (Apple+H) and then tried to Apple+Tab (Cmd-Tab) back to it but it didn't appear in the list of App Icons. The same happened when i started another Application.... I could always use Expose but I like Tab switcher...

So then I wondered which process controls the Tab switcher... It turns out that the Dock process not only runs the Dock bar at the bottom but also powers the Tab Switcher. So by just killing the Dock process it will then relaunch (by launchd) and sort it self out (provided you're not totally out of memory/disk space or something). You can do this from a Terminal window, using the following command:
killall Dock 

Monday, 10 January 2011

Counting lines of source code...

It seems easy at firstly sight (wc anyone?) then there's all the awkward stuff like comments, blank lines, coding style, header files, and stuff....

Anyway I came across a nice tool: sloccount which works on Linux, OSX and probably others, which does a good job of estimating "Source Code Line Count (SLOC)". Plus it also spits out coding time estimates based on some heuristics. There are other tools out there of course but this one just seems good.

Thursday, 6 January 2011

Fixing vmxnet for vmwaretools-7.9.9 on Linux-2.6.32+

I just tried to load up vmwaretools on Ubuntu 10.04 Karmic (Kernel linux-2.6.32 - for later kernels see below) and things went ok till it tried to compile vmxnet.c - things have changed and VMware haven't kept up... So I fixed it - see attached patch below. I took a short cut to get the modified file into the vmware-install.pl build process: It copies the src files to a directory in /tmp/vmware-configX/ (where X is a number) - You'll need to run the vmware-install.pl script and then suspend (hit Ctrl-Z) it once it has got to the very first step of compiling vmxnet (ie before it starts the actual compilation) - then copy in the patched file and put the installer into the foreground (type '%'). I guess it's possible to copy it to a tar file somewhere but I didn't bother locating the correct one.

--- vmxnet.c 2011-01-05 17:46:30.820624430 +0000
+++ vmxnet.c.orig 2010-11-20 02:24:48.000000000 +0000
@@ -162,31 +162,6 @@
#define VMXNET_LOG(msg...)
#endif // VMXNET_DEBUG

-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43)
-/*
- *-----------------------------------------------------------------------------
- *
- * vmxnet_tx_timeout --
- *
- * Network device tx_timeout routine. Called by Linux when the tx
- * queue has been stopped for more than dev->watchdog_timeo jiffies.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Tries to restart the transmit queue.
- *
- *-----------------------------------------------------------------------------
- */
-static void
-vmxnet_tx_timeout(struct net_device *dev)
-{
- netif_wake_queue(dev);
-}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43) */
-
-
/* Data structure used when determining what hardware the driver supports. */

static const struct pci_device_id vmxnet_chips[] =
@@ -210,26 +185,6 @@
.probe = vmxnet_probe_device,
.remove = vmxnet_remove_device,
};
-static struct net_device_ops
-vmxnet_netdev_ops = {
- .ndo_open = vmxnet_open,
- .ndo_start_xmit = vmxnet_start_tx,
- .ndo_stop = vmxnet_close,
- .ndo_get_stats = vmxnet_get_stats,
- .ndo_set_multicast_list = vmxnet_set_multicast_list,
-#ifdef HAVE_CHANGE_MTU
- .ndo_change_mtu = vmxnet_change_mtu,
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43)
- .ndo_tx_timeout = vmxnet_tx_timeout,
-#endif
-#ifdef VMW_HAVE_POLL_CONTROLLER
- .ndo_poll_controller = vmxnet_netpoll,
-#endif
- /* Do this after ether_setup(), which sets the default value. */
- .ndo_set_mac_address = vmxnet_set_mac_address,
-};
-

#ifdef HAVE_CHANGE_MTU
static int
@@ -373,6 +328,8 @@
.set_tso = vmxnet_set_tso,
#endif
};
+
+
#else /* !defined(SET_ETHTOOL_OPS) */


@@ -649,6 +606,30 @@
}


+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43)
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * vmxnet_tx_timeout --
+ *
+ * Network device tx_timeout routine. Called by Linux when the tx
+ * queue has been stopped for more than dev->watchdog_timeo jiffies.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * Tries to restart the transmit queue.
+ *
+ *-----------------------------------------------------------------------------
+ */
+static void
+vmxnet_tx_timeout(struct net_device *dev)
+{
+ netif_wake_queue(dev);
+}
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43) */
+

/*
*-----------------------------------------------------------------------------
@@ -1072,9 +1053,25 @@
#endif

dev->irq = irq_line;
+
+ dev->open = &vmxnet_open;
+ dev->hard_start_xmit = &vmxnet_start_tx;
+ dev->stop = &vmxnet_close;
+ dev->get_stats = &vmxnet_get_stats;
+ dev->set_multicast_list = &vmxnet_set_multicast_list;
+#ifdef HAVE_CHANGE_MTU
+ dev->change_mtu = &vmxnet_change_mtu;
+#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43)
+ dev->tx_timeout = &vmxnet_tx_timeout;
dev->watchdog_timeo = VMXNET_WATCHDOG_TIMEOUT;
+#endif
+#ifdef VMW_HAVE_POLL_CONTROLLER
+ dev->poll_controller = vmxnet_netpoll;
+#endif

- dev->netdev_ops = &vmxnet_netdev_ops;
+ /* Do this after ether_setup(), which sets the default value. */
+ dev->set_mac_address = &vmxnet_set_mac_address;

#ifdef SET_ETHTOOL_OPS
SET_ETHTOOL_OPS(dev, &vmxnet_ethtool_ops);


If you're running linux-2.6.35 (Ubuntu 10.10 Maverick) then you'll also need to apply the following patch (once you've applied the above one):

--- vmxnet.c 2011-01-06 14:44:41.000000000 +0000
+++ vmxnet.c.linux2.6.32 2011-01-06 14:44:41.000000000 +0000
@@ -2405,10 +2405,9 @@
{
struct Vmxnet_Private *lp = netdev_priv(dev);
volatile u16 *mcast_table = (u16 *)lp->dd->LADRF;
- struct netdev_hw_addr_list *mc_list = &dev->mc;
- struct netdev_hw_addr *ha;
+ struct dev_mc_list *dmi = dev->mc_list;
char *addrs;
- int j, bit, byte;
+ int i, j, bit, byte;
u32 crc, poly = CRC_POLYNOMIAL_LE;

/* clear the multicast filter */
@@ -2416,9 +2415,9 @@
lp->dd->LADRF[1] = 0;

/* Add addresses */
-
- netdev_hw_addr_list_for_each(ha, mc_list) {
- addrs = ha->addr;
+ for (i = 0; i < dev->mc_count; i++){
+ addrs = dmi->dmi_addr;
+ dmi = dmi->next;

/* multicast address? */
if (!(*addrs & 1))
@@ -2441,7 +2440,7 @@
crc = crc >> 26;
mcast_table [crc >> 4] |= 1 << (crc & 0xf); } - return mc_list->count;
+ return i;
}

/*

Saturday, 18 December 2010

Skype 5 beta OSX sucks

If you're tempted by the idea of the new Skype 5 Beta for OSX - then forget it (well maybe apart from if you're interested in Group Calling). The new UI is a bad joke - Skype seems have lost its way. It is a huge ugly GUI that won't go away and very confused functionality. Fire the new GUI team leader!

I'm back to 2.8 as long as I can then if there's no change I'll be seeking a new Voip agent - Empathy Cocoa port anyone? Blink is a nice SIP client or Sip-communicator is pretty reasonable these days and it's cross platform.

However one should not forget that there are some new features...The main one being Group video calling, plus there extended search, and a new control bar which isn't so bad.

[updated 20jan11: A bit more upbeat - whilst the GUI sucks there are some good feature additions]

Sunday, 28 November 2010

Time Machine backup...not

The other day I went to my Time Machine backup to try get a slightly older copy of a file that I'd been working on recently. But there was only a fairly ancient copy sitting there - and I KNEW I'd updated it since that date?!  My Time Machine backups seemed to be backing up just fine but only it wasn't..... Real handy?!

I Googled it and found a bunch of people had run into the same issue.

There are a bunch of files and directories that are normally excluded from backups - which are contained within the following plist files (You can see them just using a text editor or Quickview or edit them using e.g. Property List Editor) - check the 'ExcludeByPath' keys:
/Library/Preferences/com.apple.TimeMachine.plist
/System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist

Note: That in the com.apple.TimeMachine.plist there are a bunch of items that get added by certain Applications; Xcode adds the directories named 'build' (and maybe others) to the list exclusions, and Google's Chrome adds it's 'cache' directories to the exclusion list. There's probably others out there as it is achieved using a standard API call.

You can also find, using mdfind the OSX's command line version of Spotlight, all files or directories that have had the appropriate metadata attribute set (using xattr command) for backup exclusion:
sudo mdfind "com_apple_backup_excludeItem = 'com.apple.backupd'"
Out of interest you can list the metadata attributes on any file/dir:
mdls /path/to/that_curious_file
However in my case none of the above applied and it seems that under Sow Leopard there's some 'bug' that stops TM working properly if you haven't rebooted in a while (which I hadn't). So a simple reboot fixed it?! Not reassuring though.

There's a good list of things to check here and there.

Thursday, 11 November 2010

Too many package managers

On every system someone seems to invent a new package management system which means you've gotta learn the nearly the same thing over and over again. Tedious... Here's some notes to myself about how you can do basic stuff in a few I use (OSX/MacPorts[port], Ubuntu/Debian[aptitude,apt], RedHat/RPM[rpm,yum]).

Install Package
OSX% port install ThatPeskyPackage
ubuntu% aptitude install ThatPeskyPackage
ubuntu% apt-get install ThatPeskyPackage
ubuntu% dpkg -i ThatPeskyPackage.deb
RedHat% yum install ThatPeskyPackage
RedHat% rpm -i ThatPeskyPackage.rpm

Remove Package
OSX% port uninstall ThatPeskyPackage [version]
ubuntu% aptitude remove ThatPeskyPackage
ubuntu% apt-get remove ThatPeskyPackage
RedHat% yum erase ThatPeskyPackage
RedHat% rpm -e ThatPeskyPackage.rpm

Package Info
OSX% port info ThatPeskyPackage
ubuntu% aptitude install ThatPeskyPackage
ubuntu% apt-get install ThatPeskyPackage
RedHat% yum info ThatPeskyPackage
RedHat% rpm -qi ThatPeskyPackage

Package Content: What files did it install?
OSX% port contents ThatPeskyPackage
ubuntu% dpkg -L ThatPeskyPackage
RedHat% rpm -ql ThatPeskyPackage

What package does this file belong to?
OSX% port provides /usr/some/place/weird/whatisthis
ubuntu% dpkg -S /usr/some/place/weird/whatisthis
RedHat% rpm -qf /usr/some/place/weird/whatisthis

Which packages have I got installed?
OSX% port installed
ubuntu% dpkg --get-selections
RedHat% rpm -qa
RedHat% yum list