Whirliwig’s Weblog

Just another WordPress.com weblog

Archive for May 2008

Suspending MM10 (again)

without comments

If you end up using pm-utils for power management (make sure you DO NOT install acpi-functions), drop a file called ’sharpmm10′ (or any name you like) into /etc/pm/config.d, which reads as follows:

ADD_PARAMETERS="--quirk-dpms-suspend --quirk-dpms-on"
SUSPEND_MODULES="ath_rate_sample ath_hal ath_pci"

gnome-power-manager kicks of pm-utils.

I hate power management in linux.

Written by whirliwig

May 25, 2008 at 12:26 pm

Posted in Life

Hardy Heron and MM10 SLOWWWWW

without comments

Well, I’ve two MM10s, one with Hardy Heron and one with Debian lenny.

Hardy Heron is much slower.

I think that’s because of encrypted LVM, but I can’t be sure.

Anyhow, I’m not convinced I get much extra with Hardy Heron, now that I’ve pretty much hacked a working Debian together.

Hardy Heron STILL didn’t give me suspend and hibernate out of the box.

I got that working under Debian.

But now I’ve broken it again :-(

Written by whirliwig

May 12, 2008 at 10:40 pm

Posted in Life

safe-upgrade ‘ing lenny on MM10

without comments

After aptitude safe-upgrade , I’m downgraded to a previous version of NetworkManager, and network-applet-gnome. These don’t work on the MM10 with madwifi.

Luckily, disconnected as I was, I still had the snapshot sources for the two packages in /var/tmp

I re-configured, rebuilt, ran make install

The lenny NetworkManager stuff installs into /usr/local/sbin, but my version went into /usr/sbin, because I used the following configure line:

./configure --enable-maintainer-mode --prefix=/usr --sysconfdir=/etc --localstatedir=/var

So, to clean up:

cd /usr/local/sbin
mv NetworkManager NetworkManager.dontuse
mv NetworkManagerDispatcher NetworkManagerDispatcher.dontuse
ln -s /usr/sbin/NetworkManager /usr/sbin/NetworkManagerDispatcher .

Finally, ran restart:

/etc/init.d/NetworkManager restart

and off it goes, connecting. And here I am again! Byeeeeee.

Written by whirliwig

May 12, 2008 at 10:37 pm

Posted in MM10

Patterns Facilitated by Java: IOC

without comments

Bin thinkin bout Inversion of Control:

InversionOfControl

BEFORE: “Containerless” — (not IOC), “Main” code kicked off, initialises objects, invokes first methods, off you go! Other objects create new objects, and create relationships between themselves…

Configuration is read by objects, and is ‘passive’ (used-by).

AFTER: IOC: Configuration is used by ‘application environment’ to ‘plumb’ a system together, instantiating objects and creating dependencies between them, invoking methods as described in the configuration.

In a sense, Configuration is ‘active’, and drives the system.

Of course, a text file is not active itself, but the ‘container’ or ‘application server’ uses it.

The configuration is declarative, not procedural

That is, instead of everything starting by normal imperative programming instructions, creating objects, and invoking methods in sequence, a 4GL (e.g.written in an XML language) describes what the system looks like and the dependencies between object creation, destruction and method invokation the application server sets it up, and ‘works it’ as described, ensuring all dependencies between components are resolved in the correct order.

Here’s an IOC:

  • I want a system which has a KeyboardListener, a DisplayDriver, a GUI and a StartupAndShutdownController
  • Start up the StartupAndShutdownController as soon as possible. Use ‘Start’ method.
  • Register KeyboardListener to be notified by StartupAndShutdownController when Startup has begun by invoking it’s ‘StartListening’ event.
  • Start up the DisplayDriver, and as soon as possible. Use ‘Start’ method.
  • Register GUI to be notified by DisplayDriver’s ReadyForUse event, and KeyboardListener’s KeyPressed events
  • When GUI starts, …

Oh, for goodness sake, why didn’t I choose an easier example! Ahem. The rest is left as an exercise.

Note, however, that the description is a bullet-list, rather than a numbered list. The dependencies are described, and the order of clauses does not matter.

For an application server to go from configuration files/data to an instantiated set of objects, the application server needs to be able to create objects based on an external description, that the compiler does not know about at compile time, and may change without re-compilation (for example, depending on a class name stored in a text file)

Here is the point Java naturally overtakes C++: it is dynamic enough to act like an interpreted (as opposed to compiled) language when in needs to be, and has class loaders which can take a string at run-time, and create an instantiation of the relevant class name.

C++ Programmers can already see ways around this, but also know it may be tricky to make this ultimately flexible, and will sigh with jealousy at the ease of Java in this respect.

Help is at hand though!

Why bother?

To add IOC to the systems-programming mix is an art.

It doesn’t solve anything in itself.

It is another spin on Component Based Development (CBD)… ever heard of vendors trying to flog graphical systems for assembling systems from ‘business components’, for use by business-people? Well, that will not happen for many reasons, some of them psychological, some of them practical (basically, it takes all kinds to make a world).

However, CBD can bring the technologists, ops-people and business-people to almost a common language, and can partition a solution implementation into bits the business want to know about, and bits they’d prefer not to know about…and that is at a much higher declarative level than a non-IOC world.

However, selecting which bits to ‘componentise’, and what configuration and methods to expose to an IOC world is an art, and requires business input.

Written by whirliwig

May 10, 2008 at 7:03 pm

Posted in Java for Sceptics

SpotlightFS on Leopard

without comments

Luckily, SpotlightFS continues to be developed. I went straight to the MacFuse Google Code page, and it just mentioned an unsupported Tiger version.

To install, I did:

0) Ensured I had MacPorts

1) Install:

port install spotlightfs

Failed for me, because I had the Tiger version hanging around still, so I de-installed it:

/Library/Filesystems/fusefs.fs/Support/uninstall-macfuse-core.sh

Then the next attempt running port install spotlightfs failed because of a ‘header not found error’. I did a port search fuse, and apart form the wonderfully named ‘libconfuse’, there was also a ‘libfuse’…assuming something wasn’t working with Darwin Ports’ dependency checking, I installed everything in this order:

port install libfuse
port install fusefs
port install libfuse
port install spotlightfs

Yes, I did libfuse twice…but just in case that’s significant, I offer it up anyway…didn’t seem to harm anything.

Can package systems resolve two-way dependencies?

E.g., say Pkg1 depends on the headers of Pkg2 to build, but Pkg2 depends on the libraries of Pkg1 to build… The correct answer is:

  1. Install Pkg1 source
  2. Install Pkg2 source (although at this point, it could happen before Pkg1)
  3. Build Pkg1
  4. Build Pkg2

I know sometimes you get the ‘devel’ package separate from the ‘run’ package, and that would mean it’s possible to do the above manually, but do package systems like DarwinPorts do it automatically?

Written by whirliwig

May 3, 2008 at 3:44 pm

Posted in Geek, Macintosh