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
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!
Wednesday, 14 September 2011
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(); }
Subscribe to:
Posts (Atom)