It was such a clear night tonight I thought I would try and get some nice shots of the moon.
Turned out to be more difficult than I thought. The first lot just came out as bright white circles. After a little reading it seems that bright sunny day settings are best.
So started at ISO 100 F11 1/125, which were okay. But I think the best shot I got was this one at F16 1/80
Note that this was on a fairly cheap Tamron 70-300mm zoom lens. So nothing fancy.
Enjoy ...
Surgeons Net Blog
Surgeons Net is an educational resource for surgeons. It's here that I'll make announcements about that website, but also write about any interesting developments in Surgery or useful snippets of information about IT. May also use it for a general rant about the NHS!
Saturday, 3 March 2012
Saturday, 4 February 2012
I saw this on a ward the other day. With the current state of funding in the NHS, maybe we will be seeing more of these!
Stop persistent networking interface assignment in cloned virtualbox
When a Ubuntu virtualbox is cloned the new box network interfaces will not come up as Ubuntu has added some MAC matching rules. To fix this on the machine that will be cloned, do this:
Add:
# ignore VirtualBox virtual interfaces
ENV{MATCHADDR}=="08:00:27:*", GOTO="persistent_net_generator_end"
to /lib/udev/rules.d/75-persistent-net-generator.rules
and delete the file
/etc/udev/rules.d/70-persistent-net.rules
Add:
# ignore VirtualBox virtual interfaces
ENV{MATCHADDR}=="08:00:27:*", GOTO="persistent_net_generator_end"
to /lib/udev/rules.d/75-persistent-net-generator.rules
and delete the file
/etc/udev/rules.d/70-persistent-net.rules
Wednesday, 14 September 2011
Tilda in Virtualbox Linux guest for OSX host
As much as I love my Mac, there are some really annoying things. One of which is the keyboard. Why Apple think a delete key is unnecessary only they know!
Anyway, I run a Linux guest using VirtualBox on my Mac and regardless of which keyboard layout you choose the tilda key is not accessible. The solution is to create a .xmodmaprc file in your home directory
In that file add:
!map tilda and grave
keycode 94 = grave asciitilda
Use the file by typing
xmodmap ~/.xmodmaprc
To make it stick you need to logout, login. A dialog will pop up asking if you want to load the xmodmaprc file. Move the file across and click okay
Anyway, I run a Linux guest using VirtualBox on my Mac and regardless of which keyboard layout you choose the tilda key is not accessible. The solution is to create a .xmodmaprc file in your home directory
In that file add:
!map tilda and grave
keycode 94 = grave asciitilda
Use the file by typing
xmodmap ~/.xmodmaprc
To make it stick you need to logout, login. A dialog will pop up asking if you want to load the xmodmaprc file. Move the file across and click okay
Wednesday, 17 August 2011
Migrating a windows VM ware box to VirtualBox
Maybe I'm just blind but I couldn't find VM player for mac. Only a 30 day trial for VM fusion. Any way I got given a VMWare machine image that I needed to use and VirtualBox is my preferred desktop virtualisation solution.
Migrating a Windows machine is a PITA because of the way windows does it's thing but VMWARE don't help either, because it is nearly impossible to remove VMware tools.
Probably the best guide I found to migrating a windows box is http://www.kleinfelter.com/node/135. It also tackles how to get rid of VMWare tools. But unfortunately the you can't seem to get rid of the network drivers. So the article suggests switching to one of the Intel drivers. But of course you don't have network connectivity from the VM to download. So my little addition to this article is how to create your own ISO image with the drivers to load up into the VirtualBox VM.
hdiutil makehybrid -iso -joliet -o [filename].iso [filename].cdr
Voila you have an ISO you can attach to your virtualbox machine and install the Intel network drivers
Migrating a Windows machine is a PITA because of the way windows does it's thing but VMWARE don't help either, because it is nearly impossible to remove VMware tools.
Probably the best guide I found to migrating a windows box is http://www.kleinfelter.com/node/135. It also tackles how to get rid of VMWare tools. But unfortunately the you can't seem to get rid of the network drivers. So the article suggests switching to one of the Intel drivers. But of course you don't have network connectivity from the VM to download. So my little addition to this article is how to create your own ISO image with the drivers to load up into the VirtualBox VM.
Download the Intel network drivers from the Intel site- Goto Applications -> Utilities -> Disk Utility
- Click New Image
- Select Partitions CD/DVD
- and 100MB is more than enough space
- Select a name for your CD "file"
- This file will be mounted and can be found in Finder.
- Copy the network driver download to it and eject
hdiutil makehybrid -iso -joliet -o [filename].iso [filename].cdr
Voila you have an ISO you can attach to your virtualbox machine and install the Intel network drivers
Monday, 9 May 2011
Reconnect Mac OSX bluetooth mouse with just the keyboard
You might ask why you want to do this. Well it seems to be a common problem that the mac magic mouse keeps disconnecting at crucial moments and what ever you do it doesn't automatically re-connect. I wish apple would make the process of mouse disconnects "magical".
Anyway, if this does happen to you and you don't fancy a reboot follow these steps.
Type Command and space to bring up spotlight
Type mouse
In the list a item under the heading "System Preferences" called mouse should appear
Use the down key to get to it and hit Enter
The searching for mouse dialog should appear.
At this point turn the bluetooth mouse off and on. I think this puts the mouse in discovery mode
When found just hit Enter again
Volia - you should have a connected mouse
Anyway, if this does happen to you and you don't fancy a reboot follow these steps.
Type Command and space to bring up spotlight
Type mouse
In the list a item under the heading "System Preferences" called mouse should appear
Use the down key to get to it and hit Enter
The searching for mouse dialog should appear.
At this point turn the bluetooth mouse off and on. I think this puts the mouse in discovery mode
When found just hit Enter again
Volia - you should have a connected mouse
Sunday, 6 February 2011
Screencast capture on OSX using VLC
A nice post on howto use VLC to cpature the screen on OSX. I assume this will work on linux too.
Just in case it disapears, the import bit is:
Just in case it disapears, the import bit is:
- Open VLC as you would do normally
- Window -> Errors and Warnings (this will warn you if encoding failed)
- File -> Open Capture Device -> Screen
- Try to limit the area You are recording by specifying Subscreen parameters – I didn’t have any luck with recording full screen
- Tick: “Streaming/Saving”
- Click on “Settings…”
- Select “File”, click on Browse, select dir where you want to save the file and give it some name
- Encapsulation Method: MPEG 4
- Transcoding options: tick “Video” and select mp4, Bitrate 512
- Untick “Audio” (just to test if it works without it)
- Click “OK”
- we are back to previous screen, click “Open”
Sunday, 23 January 2011
Detecting Application Idle in Qt 4
The Patient Management System we are writing required a timeout for logins after a certain period had elapsed. So we needed to detect application idle. A couple of examples exist on the the web, but seemed incomplete and not thread safe. I also wanted a singleton class model so that I could have notifications of idle in any of my QObjects. So here is my implementation. Comments and improvements will be appreciated.
Header File:
#ifndef IDLETIMER_H
#define IDLETIMER_H
#include <qobject>
#include <qmutex>
#include <qevent>
#include <qtimer>
class IdleTimer : public QObject
{
Q_OBJECT
public:
// Singleton class stuff
static IdleTimer* instance(QObject *parent=0, int seconds=0) {
static QMutex mutex;
if (!m_Instance) {
mutex.lock();
m_Instance = new IdleTimer(parent, seconds);
mutex.unlock();
}
return m_Instance;
}
static void drop() {
qDebug("IdleTimer dropped ...");
static QMutex mutex;
mutex.lock();
m_timer->stop();
if(m_timer) delete m_timer;
if (m_Instance)
delete m_Instance;
m_Instance = 0;
mutex.unlock();
}
void start(int seconds = 0);
void stop();
private:
explicit IdleTimer(QObject *parent, int seconds);
explicit IdleTimer() {}
~IdleTimer() {}
IdleTimer(const IdleTimer &); // hide copy constructor
IdleTimer& operator=(const IdleTimer &); // hide assign op
static IdleTimer *m_Instance;
static QTimer *m_timer;
static QMutex m_timeoutMutex;
static int m_timeout;
signals:
void idle();
private slots:
void idleTimeout();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
};
#endif // IDLETIMER_H
And the implementation
/*!
* Small class for detecting idle in the applcation
*/
#include "IdleTimer.h"
// Static initialisers
IdleTimer *IdleTimer::m_Instance = 0;
QTimer *IdleTimer::m_timer = new QTimer();
int IdleTimer::m_timeout = 0;
QMutex IdleTimer::m_timeoutMutex;
/*!
* Class constructor
*/
IdleTimer::IdleTimer(QObject *parent, int seconds) :
QObject(parent)
{
m_timeoutMutex.lock();
if (seconds)
m_timeout = seconds;
Q_ASSERT(parent);
Q_ASSERT_X(m_timeout, "IdleTimer Constructor", "The timeout must be specified in the first call to instance.");
parent->installEventFilter(this);
m_timer->singleShot(m_timeout*1000, this, SLOT(idleTimeout()));
m_timeoutMutex.unlock();
}
/*!
* Either reset the timeout to a different value to restart the timer
*/
void IdleTimer::start(int seconds/*=0*/) {
m_timeoutMutex.lock();
if(seconds)
m_timeout = seconds;
Q_ASSERT_X(m_timeout, "IdleTimer reset", "A timeout must be specified either in this call or in the first call to instance.");
m_timer->start(m_timeout*1000);
m_timeoutMutex.unlock();
}
void IdleTimer::stop() {
m_timeoutMutex.lock();
m_timer->stop();
m_timeoutMutex.unlock();
}
/*!
* The vent filter
*/
bool IdleTimer::eventFilter(QObject *obj, QEvent *ev)
{
if(ev->type() == QEvent::KeyPress ||
ev->type() == QEvent::MouseMove)
// now reset your timer, for example
IdleTimer::m_timer->start();
// Must return to allow further processing
return QObject::eventFilter(obj, ev);
}
/*slot*/
void IdleTimer::idleTimeout() {
qDebug("Application has been idle, emitting idle signal ...");
emit idle();
}
Friday, 24 December 2010
SpiderOak Backup
I have been using SpiderOak for my offline back up solution for some time now. The main advantage I have found is that you don't need a separate folder like in Dropbox and the synchronisation feature works really well. So I currently have three computers all sync'ing wonderfully with each other. Anyway, there is now a referral programme and so I thought I would take advantage. If you use this link you get the standard 2GB + another 1GB free for life.
Download SpiderOak Backup and get extra 1GB free
Download SpiderOak Backup and get extra 1GB free
Wednesday, 21 April 2010
Mounting virtualbox shares in a linux (Ubuntu) guest
Mounting VirtualBox shares in a Linux guest is not as straight forward as for a Windows guest. I have only tried this on a Ubuntu guest but I see no reason why it wouldn't work in other flavours.
Some pre-requisites:
Some pre-requisites:
- Make sure the VirtualBox guest additions have been installed. There are plenty of guides about this
- When you create your shared directories DO NOT accept the default name. Use a prefix. For example HostDocuments for the host Documents folders instead of Documents.
The reason for this is if you use the default name a protocol error will be reported when you mount the shared dir. I don't know why but this small work around fixes the issue - Make sure the vboxvfs module is loaded by adding vboxvfs to the end of /etc/modules
sudo sh -c 'echo "vboxvfs" | cat >>/etc/modules'
Now we need to allow mounting of vbox shares by normal users.
sudo select-editorand make sure nano is selected. This is a much nicer editor than vi- Now edit the sudoer file using
sudo visudo.
Add the line:%plugdev ALL=(ALL)NOPASSWD:/sbin/mount.vboxsf
It may be that the group plugdev is a Ubuntu only group. Choose a group that all users belong to. Or create a 'users' group and add the users to it
- Create a mounting script in /usr/local/bin.
sudo nano /usr/local/bin/mountVboxShares
Paste the following code, but replace the variables at the top and add sections as appropriate.
#!/bin/bash
PROJECTDIR="$HOME"/Projects
PROJECTSHARE="HostProjects"
DOCSDIR="$HOME"/Documents
DOCSSHARE="HostDocuments"
if [ ! -d "$PROJECTDIR" ]; then
mkdir "$PROJECTDIR"
fi
/usr/bin/sudo mount.vboxsf -o uid=`id -r -u`,gid=`id -r -u` "$PROJECTSHARE" "$PROJECTDIR"
if [ ! -d "$DOCSDIR" ]; then
mkdir "$DOCSDIR"
fi
/usr/bin/sudo mount.vboxsf -o uid=`id -r -u`,gid=`id -r -u` "$DOCSSHARE" "$DOCSDIR"
- Allow everyone to execute this script
sudo chmod 755 /usr/local/bin/mountVboxShares
- Finally add the mount script to the end of the system wide profile script
sudo sh -c 'echo "/usr/local/bin/mountVboxShares" | cat >>/etc/profile'
Subscribe to:
Posts (Atom)

