Uninstalling VirtualBox Guest Additions on a Linux Guest OS
8th April 2012Within the last few days, I updated my Linux Mint Debian Edition virtual machine installation to Update 4. Between not following the instructions so closely and problems with the update server, a re-installation preceded the update itself. When all was done, no desktop environment appeared, and issuing the startx command revealed that it was one of the VirtualBox drivers that was the cause of the problem. With my being unable to see any files on the VirtualBox virtual CD, something else needed doing and the executing following command (replacing [VboxAddonsFolder] with VBoxGuestAdditions-4.1.12 in my case, but it is different for each VirtualBox version) resolved the situation:
/opt/[VboxAddonsFolder]/uninstall.sh
When it was complete, a scrambled desktop began to appear, so a reboot was to set things to rights. Then, I could set to looking at what Update 4 had brought to Linux Mint Debian Edition.
Calculating geometric means using SAS
19th March 2012Recently, I needed to calculate geometric means after a break of a number of years and ended racking a weary brain until it was brought back to me. In order that I am not in the same situation again, I am recording it here and sharing it is always good too.
The first step is to take the natural log (to base e or the approximated irrational value of the mathematical constant, 2.718281828) of the actual values in the data. Since you cannot have a log of zero, the solution is either to exclude those values or substitute a small value that will not affect the overall result, as is done in the data step below. In SAS, the log function uses the number e as its base, so you need to use the log10 equivalent when base 10 logs are needed.
data temp;
set temp;
if result=0 then _result=0.000001;
else _result=result;
ln_result=log(_result);
run;
Next, the mean of the log values is determined, and you can use any method of doing that so long as it gives the correct values. PROC MEANS is used here but PROC SUMMARY (identical to MEANS except it defaults to data set creation while that generates output by default; for that reason, we need to use the NOPRINT option here), PROC UNIVARIATE or even the MEAN function in PROC SQL.
proc means data=temp noprint;
output out=mean mean=mean;
var ln_result;
run;
With the mean of the log values obtained, we have to take the exponential of the obtained value(s) using the EXP function. This returns values of the same magnitude as in the original data, using the formula emean.
data gmean;
set mean;
gmean=exp(mean);
run;
Creating placeholder graphics in SAS using PROC GSLIDE for when no data are available
18th March 2012Recently, I found myself with a plot to produce, but there were no data to be presented, so a placeholder output was needed. For a listing or a table, this is a matter of detecting if there are observations to be listed or summarised and then issuing a placeholder listing using PROC REPORT if there are no data available. Using SAS/GRAPH, something similar can be achieved using one of its curiosities.
In the case of SAS/GRAPH, PROC GSLIDE looks like the tool to user for the same purpose. The procedure does get covered as part of a SAS Institute SAS/GRAPH training course, but they tend to gloss over it. After all, there is little reason to go creating presentations in SAS when PowerPoint and its kind offer far more functionality. However, it would make an interesting tale to tell how GSLIDE became part of SAS/GRAPH in the first place. Its existence makes me wonder if it pre-exists the main slideshow production tools that we use today.
The code that uses PROC GSLIDE to create a placeholder graphic is as follows (detection of the number of observations in a SAS dataset is another entry on here):
proc gslide;
note height=10;
note j=center "No data are available";
run;
quit;
PROC GSLIDE is one of those run group procedures in SAS so a QUIT statement is needed to close it. The NOTE statements specify the text to be added to the graphic. The first of these creates a blank line of the required height for placing the main text in the middle of the graphic. It is the second one that adds the centred text that tells users of the generated output what has happened.
Creating waterfall plots in SAS using PROC GCHART
17th March 2012Recently, I needed to create a waterfall plot couldn't use PROC SGPLOT since it was incompatible with publishing macros that use PROC GREPLAY on the platform that I was using; SGPLOT doesn't generate plots in SAS catalogues but directly creates graphics files instead. Therefore, I decided that PROC GCHART needed to be given a go, and it delivered what was needed.
The first step is to get the data into the required sort order:
proc sort data=temp;
by descending result;
run;
Then, it is time to add an ID variable for use in the plot's X-axis (or midpoint axis in PROC GCHART) using an implied value retention to ensure that every record in the dataset had a unique identifier:
data temp;
set temp;
id+1;
run;
After that, axes have to be set up as needed. For instance, the X-axis (the axis2 statement below) needs to be just a line with no labels or tick marks on there and the Y-axis was fully set up with these, turning the label from vertical to horizontal as needed with the ANGLE option controlling the overall angle of the word(s) and the ROTATE option dealing with the letters, and a range declaration using the ORDER option.
axis1 label=none major=none minor=none value=none;
axis2 label=(rotate=0 angle=90 "Result") order=(-50 to 80 by 10);
With the axis statements declared, the GCHART procedure can be defined. Of this, the VBAR statement is the engine of the plot creation, with the ID variable used for the midpoint axis and the result variable used as the summary variable for the Y-axis. The DISCRETE keyword is needed to produce a bar for every value of the ID variable, or GCHART will bundle them by default. Next, references for the above axis statements (MAXIS option for midpoint axis and AXIS option for Y-axis) are added, and the plot definition is complete. One thing that has to be remembered is that GCHART uses run group processing, so a QUIT statement is needed at the end to close it at execution time. This feature has its uses and appears in other procedures too, though SAS procedures generally are concluded by a RUN statement.
proc gchart data=temp;
vbar id / sumvar=result discrete axis=axis2 maxis=axis1;
run;
quit;
Do we need dongles anymore?
12th March 2012Recent exposure to both the HTC Wildfire S and the HTC Desire S has me wondering if we need mobile broadband dongles any more. The reason for my asking this is that both Android devices can act as mobile Wi-Fi hubs, and they work very well as these too. Even the dedicated T-Mobile mobile Wi-Fi hub that I picked up in the closing months of 2011 now looks a little obsolete, though it retains a cost advantage in its favour.
In the case of both HTC phones, it thankfully is possible to use high security encryption and a pass key too. However, it is best to change the default key before any activation of Wi-Fi signal, if only to ensure that you don't end up with a very nasty bill. The Wi-Fi Hotspot App has all the settings that you need and up to five connections can be supported at a time, just like that T-Mobile hub that I mentioned earlier.
That replaced a defunct dongle from the same company; the USB connection appeared to have failed and was ailing for a while. Now, it might be that the more transparent use of an actual mobile phone might be usurping that as well, especially when I have been wondering why it has been doing so well with internet connectivity while using it on the move. This voyage into the world of what smartphones and similar devices can do is throwing up its share of surprises as I go along.
Smoother use of more than one SAS DMS session at a time
11th March 2012Unless you have access to SAS Enterprise Guide, being able to work on one project at a time can be a little inconvenient. It is possible to open up more than one Display Manager System (DMS, the traditional SAS programming interface) session at a time only to get a pop-up window for SAS documentation for the second and subsequent sessions. You don't get your settings shared across them, either, while also losing any changes to session options after shutdown.
The cause of both of the above is the locking of the SASUSER directory files by the first SAS session. However, it is possible to set up a number of directories and set the -sasuser option to point at different ones for different sessions.
On Windows, the command in the SAS shortcut becomes:
C:\Program Files\SAS\SAS 9.1\sas.exe -sasuser "c:\sasuser\session 1\"
On UNIX or Linux, it would look similar to this:
sas -sasuser "~/sasuser/session1/"
Since the "session1" in the folder paths above can be replaced with whatever you need, you can have as many as you want too. It might not seem much of a need but synchronising the SASUSER folders every now and again can give you a more consistent set of settings across each session, all without intrusive pop up boxes or extra messages in the log too.
Changing to web fonts
12th February 2012While you can add Windows fonts to Linux installations, I have found that their display can be flaky to say the least. Linux Mint and Ubuntu display them as sharp as I'd like, but I have struggled to get the same sort of results from Arch Linux, while I am not so sure about Fedora or openSUSE either.
This led me to explore web fonts for my websites, with Google Web Fonts meeting my needs through options like Open Sans and Arimo. There have been others with which I have dallied, such as Droid Sans, but these are the ones on which I have settled for now. Both are in use on this website now, and I added calls for them to the web page headers using the following code (lines are wrapping due to space constraints):
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Arimo:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
With those lines in place, it then is a matter of updating font-family and font declarations in CSS style sheets with "Open Sans" or "Arimo" as needed, while keeping alternatives defined in case the Google font service goes down for whatever reason. A look at a development release of the WordPress Twenty Twelve theme caused me to come across Open Sans and I like it for its clean lines and Arimo, which was found by looking through the growing Google Web Fonts catalogue, is not far behind. Looking through that catalogue now causes for me a round of indecision since there is so much choice. For that reason, I think it's better to be open to the recommendations of others.
Command line setting of Windows file attributes
11th February 2012Aside from permissions that can be set using the cacls command, Windows files have properties like read only, archive and hidden. Of course, these are not the same or as robust as access permissions, but they may have a use in stopping accidental updates to files when you don't have access to use of the cacls command. While you could set these attributes using the properties page of any file, executing the attrib command on the Windows command is more convenient. Here are some possible usage options:
Set the read-only flag on a file:
attrib +r test.txt
Remove the read-only flag from a file (found a use for this one recently):
attrib -r test.txt
Set the archive flag on a file:
attrib +a test.txt
Remove the archive flag from a file:
attrib -a test.txt
Set the hidden only flag on a file:
attrib +h test.txt
Remove the hidden flag from a file:
attrib -h test.txt
Using the /s option and wildcards processes a number of files at a time and /d applies the command to directories. They could come in handy when removing read only attributes (also called bits in places) from files copied from read only optical media, such as CD's and DVD's.
A new phone
4th February 2012After a few years with a straightforward Nokia 1661 and a PAYG Blackberry 8520, I decided to go and upgrade from the former to an HTC Wildfire S. So far, the new phone has been good to me with only a few drawbacks. Other than working out how to insert a SIM card, the phone has been easy to use with just a few nuances to learn, such as finger pinch zooming and dealing with an onscreen keyboard as opposed to a real one.
The touchscreen and 3G connectivity are major upgrades from my Blackberry, making web browsing much faster, especially on the larger screen. Checking Google Reader and emails on the go is quicker, with the screen responding well most of the time. It does get dirty, so using a screen protector or regularly cleaning with a lens cloth is advisable. As it happens, I'm still adjusting to the onscreen keyboard, which remains the one area where the Blackberry remains superior. Rotating the phone sideways helps by enlarging the keys, reducing typing errors even for my average-sized fingers. Switching between alphabetic, numeric, and punctuation keyboards still takes some getting used to.

Otherwise, the user interface is bright and pleasing to the eye, with the typical presentation of both a clock and current weather on there. Handily, the screen is locked easily too with a press of the button at the top right of the phone. That will put a stop to inadvertent phone calls, emailing, web browsing and other things, so it is to be commended. To unlock the screen, all that's needed is to swipe the lock bar to the bottom. Any alerts are viewed similarly with holding down your finger on the top bar presenting an extension that can be pulled all the way down to see what's there.
The Android Marketplace icon on the home screen lets me easily add apps with automatic updates, though this requires monitoring data usage on your phone plan. The WordPress app works better than on my Blackberry, but UberSocial's retweeting function is worse on Android. It displays all account feeds on one screen and requires swiping for actions like replying or retweeting, which I find awkward. I might try an alternative app. I've downloaded several others, including CrossCountry Trains' app (which is good, despite failing to find Macclesfield-Edale Sunday trains) and LinkedIn (which works well). You can move apps to the microSD card to save internal storage space, though I don't plan to install many.
The Wildfire performs well at its core function: making and receiving calls. It imported contacts from my SIM card, though Bluetooth transfer from an old phone is also possible. Call sound quality is clear and loud. The side rocker button adjusts speaker volume during calls and ringtone volume otherwise. By default, the phone vibrates and rings simultaneously for incoming calls, which I may change later. The same applies to notification sounds for text messages, emails, and tweets.
Battery life is this phone's main weakness. It needs charging every night, unlike my previous phones. The bright, responsive screen likely causes this drain. Many users report similar issues online, with some experiencing even worse battery performance. While there are tips for extending battery life, they involve disabling key features like 3G or data connectivity, which defeats the purpose of having a smartphone. Thus, I'm considering buying a spare battery, as I did for my Pentax DSLR. Some users recommend higher-capacity replacement batteries, though this seems riskier.
All in all, first impressions of the HTC Wildfire are good ones. Over time, I should find out more about the ins and outs of the gadget. After all, it is a mini-computer with its own operating system and other software. Since I continue to learn more and more about PC's every day, the same should be the case here too.
Widely differing approaches
28th January 2012The computer on which I am writing these words is running Linux Mint with the Cinnamon desktop environment, a fork of GNOME Shell. This looks as if it will be the default face of GNOME 3 in the next version of Linux Mint, with the MGSE dressing up of GNOME Shell looking more and more like an interim measure until something more consistent was available. While some complained that what was delivered in version 12 of the distribution was a sort of greatest hits selection, I reckon that bets were being hedged by the project team.
Impressions of what's coming
By default, you get a single panel at the bottom of your screen with everything you need in there. However, it is possible to change the layout so that the panel is at the top or there are two panels, one at the top and the other at the bottom. So far, there is no means of configuring which panel applet goes where, as was the case in Linux Mint 11 and its predecessors. However, the default placements are very sensible, so I have no cause for complaint at this point.
Just because you cannot place applets doesn't mean that there is no configurability, though. Since Cinnamon is extensible, you can change the way that time is displayed in the clock, as well as enabling additional applets. It also is possible to control visual effects, such as the way new application windows pop up on a screen.
GNOME 3 is there underneath all of this, though there's no sign of the application dashboard of GNOME Shell. The continually expanding number of slots in the workspace launcher is one sign, as is the enabling of a hotspot at the top right hand corner by default. This brings up an overview screen showing what application windows are open in a workspace. The new Mint menu even gets the ability to search through installed applications, together with the ability to browse through what's available.
In summary, Cinnamon already looks good, though a little polish and extra configuration options wouldn't go amiss. An example of the former is the placement of desktop numbers in the workspace switcher, and I already have discussed the latter. It does appear that the Linux Mint approach to desktop environments is taking shape with a far more conventional feel than the likes of Unity or GNOME Shell. Just as Cinnamon has become available in openSUSE, I can see it gracing LMDE too whenever Debian gets to moving over to GNOME 3 as must be inevitable now unless they take another approach such as MATE.
In comparison with a revolution
While Linux Mint are choosing convention and streamlining GNOME to their own designs, it appears that Ubuntu's Unity is getting ever more experimental as the time when Ubuntu simply evolved from one release to the next becomes an increasingly more distant memory. The latest development is the announcement that application menus could get replaced by a heads-up display (HUD) instead. That would be yet another change made by what increasingly looks like a top-down leadership, reminiscent of what exists at Apple. While it is good to have innovation, you have to ask where users fit in all of this when Linux Mint already has gained from what has been done so far and may gain more again. Still, seeing what happens to Ubuntu sounds like an interesting pastime, though I'm not sure that I'd be depending on the default spin of this distro as my sole operating system right now. Also, changing the interface every few months wouldn't work in a corporate environment at all, so you have to wonder where Mark Shuttleworth is driving all this, though Microsoft is engaging in a bit of experimentation of its own. We are living in interesting times for the computer desktop, so it's just as well that there are safe havens like Linux Mint, too. Watching from afar sounds safer.