Saving Windows Command Prompt & Powershell command history to a file for later useage
15th May 2013It's remarkable what ideas Linux gives that you wouldn't encounter that clearly in the world of Windows. One of these is output and command line history, so a script can be created. In the Windows world, this would be called a batch file. Linux usefully has the history command, and it does the needful for taking a snapshot like so:
history > ~/commands.sh
All the commands stored in a terminal's command history get stored in the commands.sh in the user's home area. The command for doing the same thing from the Windows command line is not as obvious because it uses the doskey
command that is intended for command line macro writing and execution. Usefully, it has a history option that tells it to output all the commands issued in a command line session. Unless, you create a file with them in there, there appears to be no way to store all those commands across sessions, unlike UNIX and Linux. Therefore, a command like the following is a partial solution that is more permanent than using the F7 key on your keyboard:
doskey /history > c:\commands.bat
Windows PowerShell has something similar too, and it even has aliases of history
and even h
. All PowerShell scripts have file extensions of ps1
and the example below follows that scheme:
get-history > c:\commands.ps1
However, I believe that even PowerShell doesn't carry over command history between sessions, though Microsoft is working on adding this useful functionality. While they could co-opt Cygwin of course, that doesn't seem to be their way of going about things.
A little look at Debian 7.0
12th May 2013Having a virtual machine with Debian 6 on there, I was interested to hear that Debian 7.0 is out. In another VM, I decided to give it a go. Installing it on there using the Net Install CD image took a little while but proved fairly standard with my choice of the GUI-based option. GNOME was the desktop environment with which I went and all started up without any real fuss after the installation was complete; it even disconnected the CD image from the VM before rebooting, a common failing in many Linux operating installations that lands into the installation cycle again unless you kill the virtual machine.
Though the GNOME desktop looked familiar, a certain amount of conservatism reigned too, since the version was 3.4.2. That was no bad thing, since raiding the GNOME Extension site for a set of mature extensions was made easier. In fact, a certain number of these were included in the standard installation anyway and the omission of a power off entry on the user menu was corrected as a matter of course without needing any intervention from this user. Adding to what already was there made for a more friendly desktop experience in a short period of time.
Debian's variant of Firefox, IceWeasel, is version 10 so a bit of tweaking is needed to get the latest version. LibreOffice is there now too, and it's version 3.5 rather than 4. Shotwell too is the older 0.12 and not the 0.14 that is found in the likes of Ubuntu 13.04. As it happens, GIMP is about the only software with a current version and that is 2.8; a slower release cycle may be the cause of that, though. All in all, the general sense is that older versions of current software are being included for the sake of stability and that is sensible too, so I am not complaining very much about this at all.
The reason for not complaining is that the very reason for having a virtual machine with Debian 6 on there is to have Zinio and Dropbox available too. Adobe's curtailment of support for Linux means that any application needing Adobe Air may not work on a more current Linux distribution. That affects Zinio, so I'll be retaining a Debian 6 instance for a while yet, unless a bout of testing reveals that a move to the newer version is possible. As for Dropbox, I am sure that I can recall why I moved it onto Debian, but it's working well on there so I am in no hurry to move it over either. There are times when slower software development cycles are better...
Piggybacking an Android Wi-Fi device off your Windows PC's internet connection
16th March 2013One of the disadvantages of my Google/Asus Nexus 7 is that it needs a Wi-Fi connection to use. Most of the time, this is not a problem since I also have a Huawei mobile Wi-Fi hub from T-Mobile and this seems to work just about anywhere in the U.K. Away from the U.K. though, it won't work because roaming is not switched on for it and that may be no bad thing with the fees that could introduce. While my HTC Desire S could deputise, I need to watch costs with that too.
There's also the factor of download caps, and those apply both to the Huawei and to the HTC. Recently, I added Anquet's Outdoor Map Navigator (OMN) to my Nexus 7 through the Google Play Store for a fee of £7 and that allows access to any walking maps that I have bought from Anquet. However, those are large downloads, so the caps start to come into play. Frugality would help, but I began to look at other possibilities that make use of a laptop's Wi-Fi functionality.
Looking on the web, I found two options for this that work on Windows 7 (8 should be OK too): Connectify Hotspot and Virtual Router Manager. The first of these is commercial software, yet there is a Lite edition for those wanting to try it out; that it is not a time limited demo is not something that I can confirm though that did not seem to be the case since it looked as if only features were missing from it that you'd get if you paid for the Pro variant. The second option is an open source one that is free of charge apart from an invitation to donate to the project.
Though online tutorials show the usage of either of these to be straightforward, my experiences were not all that positive at the outset. In fact, there was something that I needed to do, which is how this post has come to exist at all. That happened even after the restart that Connectify Hotspot needed as part of its installation; it runs as a system service, which is why the restart was needed. In fact, it was Virtual Router Manager that told me what the issue was, and it needed no reboot. Neither did it cause network disconnection of a laptop like the Connectify offering did on me and that was the cause of its ejection from that system; limitations in favour of its paid addition aside, it may have the snazzier interface, but I'll take effective simplicity any day.
Using Virtual Router Manager turns out to be simple enough. It needs a network name (also known as an SSID), a password to restrict who accesses the network and the internet connection to be shared. In my case, the was Local Area Connection on the dropdown list. With all the required information entered, I was ready to start the router using the Start Network Router button. The text on this button changes to Stop Network Router when the hub is operational, or at least it should have done for me on the first time that I ran it. What I got instead was the following message:
The group or resource is not in the correct state to perform the requested operation.
While the above may not say all that much, it becomes more than ample information if you enter it into the likes of Google. Behind the scenes, Virtual Router Manager uses native Windows functionality to create a Wi-Fi hub from a PC, and it appears to be the Microsoft Virtual Wi-Fi Miniport Adapter from what I have seen. When I tried setting up an ad hoc Wi-Fi network from a laptop to the Nexus 7 using Windows' own network set up capability via its Control Panel, it didn't do what I needed, so there might be something that third party software can do. So, the interesting thing about the solution to my Virtual Router Manager problem was that it needed me to delve into the innards of Windows a little.
Firstly, there's running Command Prompt (All Programs > Accessories) from the Start Menu with Administrator privileges. It helps here if the account with which you log into Windows is in the Administrator group, since all you have to do then is right-click on the Start Menu entry and choose Run as administrator entry in the pop-up context menu. With a command line window now open, you then need to issue the following command:
netsh wlan set hostednetwork mode=allow ssid=[network name] key=[password] keyUsage=persistent
When that had done its thing, Virtual Router Manager worked without a hitch though it did turn itself after a while and that may be no bad thing from the security standpoint. On the Android side, it was a matter of going in Settings > Wi-Fi and choosing the new network that was created on the laptop. This sort of thing may apply to other types of tablet (Dare I mention iPads?) so you could connect anything to the hub without needing to do any more on the Windows side.
For those wanting to know what's going on behind the scenes on Windows, there's a useful tutorial on Instructables that shows what third party software is saving you from having to do. Even if I never go down the more DIY route, I probably have saved myself having to buy a mobile Wi-Fi hub for any trips to Éire. For now, the Irish 3G dongle that I already have should be enough.
Getting an Epson Pefection 4490 Photo scanner going with Ubuntu GNOME Remix 12.10
7th March 2013My Epson Perfection 4490 Photo scanner has been in my possession for a while now, and it is impossible to justify any replacement given that it both works well and digital photography has taken over from its film predecessor for me. Every time I go installing an operating system afresh, I need to reinstate it again; last year's installation of Ubuntu GNOME Remix 12.04 only saw me do the deed recently. When I did so, it was brought back to me that I'd never gone and documented on here how this was done. Given that I sometimes use this place as a repository of stuff to which I need to refer again in the future, it seemed remiss of me, so here it is for you all.
Though I had XSane and SimpleScan already installed on the system, Sane wasn't on there. Hence, I went and added it and a few other extras using the following command:
sudo apt-get install sane sane-utils libsane-extras
Then, it was onto the Epson website for their Perfection 4490 Photo Linux drivers, since Sane's support for this scanner seemingly remains incomplete even though it pre-dates my move to Linux in 2007. Three files were needed, and the following commands install them (depending on when you do this, the file names may be different, so just change them to whatever they are for you):
sudo dpkg -i iscan-data_1.22.0-1_all.deb
sudo dpkg -i iscan_2.29.1-5~usb0.1.ltdl7_i386.deb
sudo dpkg -i iscan-plugin-gt-x750_2.1.2-1_i386.deb
With those in place, there was one other task that needed doing so that scanning could be done without resorting to running scanning software using sudo privileges. To free up the access to a normal user account, I needed a HAL device information file. These normally are in, but /usr/share/hal/fdi/
they change every time an installation, so any modifications that you may make will be lost. Therefore, there is no point modifying either /usr/share/hal/fdi/preprobe/10osvendor/20-libsane.fdi
or /usr/share/hal/fdi/preprobe/10osvendor/20-libsane-extras.fdi
where scanner information usually is to be found.
The first task in creating an FDI file was to issue the lsusb
command and look for a line corresponding to my scanner. This is the one that I got:
Bus 001 Device 004: ID 04b8:0119 Seiko Epson Corp. Perfection 4490 Photo
From this, I gleaned the manufacturer ID and model ID as 04b8 and 0119, respectively. These are needed later on. Next I needed to create the hal/fdi/preprobe/
folder structure under /etc since it was there. Then, I created epson4490photo.fdi
in the bottom folder of the tree (/etc/hal/fdi/preprobe/epson4490photo.fdi
) as follows:
cd /etc/hal/fdi/preprobe/ && sudo touch epson4490photo.fdi
Then, I edited the new file using the following command:
gksu gedit epson4490photo.fdi &
With the file open, I added in the following text:
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="info.subsystem" string="usb">
<!-- Epson Perfection 4490 Photo -->
<match key="usb.vendor_id" int="0x04b8">
<match key="usb.product_id" int="0x0119">
<append key="info.capabilities" type="strlist">scanner</append>
<merge key="scanner.access_method" type="string">proprietary</merge>
</match>
</match>
</match>
</device>
</deviceinfo>
Since it's all in XML, the place to look is immediately beneath the scanner name comment. The int
attributes of the two match elements immediately following the comment line are populated using the information from the lsusb
command output, with 0x
prefixing both the manufacturer and model identifiers. The element with a key attribute of usb.vendor_id
is the former, and that with a key attribute of usb.product_id
is the latter. With epson4490photo.fdi
saved, I rebooted the machine to restart HAL and all was as I wanted it to be, apart maybe from XSane making complaints that seemed not to be of any actual consequence. With Epson's Image Scan! and Simple Scan on the PC, there's no need to be bothered with those messages. Choice is good when you have it, especially when you have expended some effort to get that far.
Using a variant of Debian's Iceweasel that keeps pace with Firefox
5th February 2013Left to its own devices, Debian will leave you with an ever ageing re-branded version of Firefox that was installed at the same time as the rest of the operating system. From what I have found, the main cause of this was that Mozilla's wanting to retain control of its branding and trademarks in a manner not in keeping with Debian's Free Software rules. This didn't affect just Firefox but also Thunderbird, Sunbird and Seamonkey with Debian's equivalents for these being IceDove, IceOwl and IceApe, respectively.
While you can download a tarball of Firefox from the web and use that, it'd be nice to get a variant that updated through Debian's normal apt-get channels. In fact, IceWeasel does get updated whenever there is a new release of Firefox, even if these updates never find their way into the usual repositories. While I have been known to take advantage of the more frozen state of Debian compared with other Linux distributions, I don't mind getting IceWeasel updated so it isn't a security worry.
The first step in so doing is to add the following lines to /etc/apt/sources.list
using root access (using one of sudo
, gksu
or su
to assume root privileges) since the file normally cannot be edited by normal users:
deb http://backports.debian.org/debian-backports squeeze-backports main
deb http://mozilla.debian.net/ squeeze-backports iceweasel-release
With the file updated and saved, the next step is to update the repositories on your machine using the following command:
sudo apt-get update
With the above complete, it is time to overwrite the existing IceWeasel installation with the latest one using an apt-get command that specifies the squeeze-backports repository as its source using the -t
switch. While IceWeasel is installed from the iceweasel-release
squeeze-backports repository, there are dependencies that need to be satisfied and these come from the main squeeze-backports one. The actual command used is below:
sudo apt-get install -t squeeze-backports iceweasel
While that was all that I needed to do to get IceWeasel 18.0.1 in place, some may need the pkg-mozilla-archive-keyring
package installed too. For those needing extra information beyond what's here, there's always the Debian Mozilla team.
Installing the Cinnamon Desktop Environment on Sabayon Linux
26th January 2013During the week, I did an update on my Sabayon system and GNOME 3.6 came on board without too much of a bother. There was no system meltdown or need for an operating system re-installation. However, there was one matter that rankled: adding and updating extensions from extensions. gnome.org was impossible. The process would create a new folder in ~/.local/share/gnome-shell/extensions/ but not fill it with anything at all. Populating from another Ubuntu GNOME Remix 12.10 machine didn't seem to achieve the needful, and I am left wondering if it is down to the version of GNOME Shell being 3.6.2. However, even adding an entry for the current version of GNOME Shell to metadata.json for one plugin didn't appear to do what I wanted, so resolving this issue needs further enquiry.
Meanwhile, I added the Cinnamon desktop environment using the following command and will be using that from now on. If the GNOME Shell extension issue ever gets sorted, I may move back, but there is no rush. GNOME 3.8 sounds like it's bringing an interesting option that makes use of the approach Linux Mint took for version 12 of that distribution, and I can await that, especially if it avoids the need for adding extensions on a personal basis like now.
sudo equo update && sudo equo install cinnamon
With the installation completed by the above command, it was a matter of logging out and choosing the Cinnamon entry (there is a 2D version too) from the session dropdown menu on the login screen to get it going. Then, it was a matter of tweaking Cinnamon to my heart’s content. Getting a two panel layout required logging out and in again as well as choosing the appropriate setting in the Cinnamon Panel options tab. Next, I decided to check on what themes are available at cinnamon.linuxmint.org before settling on Cinnamint 1.6. It all feels very comfortable, apart from not having an automatically growing list of workspaces that are a default offering in GNOME Shell. That goes against the design principles of Cinnamon though, so only hopes of someone making an extension that does that are left.
Adding Quicktime movie support to Firefox running on Linux
24th January 2013For whatever reason, my installation of Ubuntu GNOME Remix 12.10, didn't have QuickTime support added to Firefox by default. To make a website work near enough as it was intended, this needed to be remedied. The solution was to issue a command to install the missing software:
sudo apt-get install mplayer gnome-mplayer gecko-mediaplayer
Mplayer is the main component here but running the above command adds all the required supporting packages too, so that a Firefox restart was all that needed to get things going.
Three gone...
11th January 2013As of today, Jessops no longer continues to trade. It is but a third specialist purveyor of photographic equipment to go this way. Jacobs, another Leicester headquartered competitor, met the same fate as did the Wildings chain in the northwest of England. These were smaller operations than Jessops who may have overreached itself during the boom years and certainly had their share of financial troubles in recent times, the latest of which putting an end from the operation.
Many are pondering what is happening, and the temptation is to blame the rise of the e-commerce and the economic situation for all of this. In addition, I have seen poor service blamed. However, where are we going to go now after this? Has photography become such a specialised market that you need a diversified business to stick with it? After all, independent retailers have been taking a hammering too and some have gone out of business, like the chains that I have mentioned here.
It does raise the question as to where folk engaging in a photographic purchase are going to go for advice now; is the web sufficiently beginner-friendly? There seemingly will be fewer bricks and mortar shops out there for anyone, so coming across one-to-one advice as once would have been the case is looking harder than it once was. Photographic magazines will help, and the web has a big role to play too. It certainly informed some of my previous purchases, but I have been that little bit more serious about my photography for a while now.
It might be that photography is becoming more specialist again after a period when the advent of digital cameras caused an explosion in interest. Cameras on mobile phones are becoming ever more capable and cannibalising the compact camera market for those only interested in point and shoot machinery. Maybe that is where things are going in that mass market photography doesn't offer the future that it once might have done given the speed of technological advance. The future and present undoubtedly are about as interesting as they have become utterly uncertain.
Thinking over the last ten years or so, there has been a lot of change and that seems set to continue, even if I am left wondering if photography has shot its bolt by now. My first SLR came from a Stockport branch of Jessops and was a film camera, a Canon EOS SLR. It certainly got me going and was exchanged for a Canon EOS 30 from Ffordes, an internet transaction during which the phone system around Manchester and Cheshire went on the blink. That outage may have exposed a frailty of our networked world, but there has been no fire to melt cables in a tunnel since then. Further items from Jessops came via the same channel, such as a Manfrotto 055 tripod and my Pentax K10D. A Canon-fit 28-135 mm Sigma came from Jessops' then Manchester Deansgate store and another Canon-fit Sigma lens, a 70-300 mm telephoto affair, came from another branch of the chain, although not the Macclesfield branch since that had yet to be established and there's no photographic store left in the town now after the Jessops and Wildings closures.
Those purchases have become history, just like the photographic retail chain from which they were sourced. These days, I am more than comfortable with making dealings over the web, but that concern about those starting out that I expressed earlier now remains. Seeing how that would work is set to become interesting. Might it limit the take-up of photography on a more serious basis? That is a question that could get a very interesting answer as we continue into ever more uncertain times.
Sorting a kernel upgrade error in Linux Mint 13
30th November 2012Linux Mint 14 may be out now, but I'll be sticking with its predecessor for now. Being a user of GNOME Shell instead of Cinnamon or Mate, I'll wait for extensions to get updated for 3.6 before making a move away from 3.4 where the ones that I use happily work. Given that Linux Mint 13 is set to get support until 2017, it's not as if there is any rush either. Adding the back-ported packages repository to my list of software sources means that I will not miss out on the latest versions of MDM, Cinnamon and Mate anyway. With Ubuntu set to stick to GNOME 3.6 until after 13.04 is released, adding the GNOME 3 Team PPA will be needed if 3.8 arrives with interesting goodies; there are interesting noises that suggest the approach taken in Linux Mint 12 may be used to give more of a GNOME 2 desktop experience. Options abound and there are developments in the pipeline that I hope to explore too.
However, there is one issue that I have had to fix which stymies upgrades within the 3.2 kernel branch. A configuration file (/etc/grub.d/10_linux
) points to /usr/share/grub/grub-mkconfig_lib
instead of /usr/lib/grub/grub-mkconfig_lib
so I have been amending it every time I needed to do a kernel update. However, it just reverts to the previous state, so I thought of another solution: creating a symbolic link in the incorrect location that points to the correct one so that updates complete without manual intervention every time. The command that does the needful is below:
sudo ln -s /usr/lib/grub/grub-mkconfig_lib /usr/share/grub/grub-mkconfig_lib
Of course, figuring out what causes the reversion would be good too, but the symbolic link fix works so well that there's little point in exploring it further. Of course, if anyone can add how you'd do that, I'd welcome this advice too. New knowledge is always good.
Presenting more than one plot on a page using SAS ODS PDF
12th November 2012If you had asked me about getting two or more graphs on a page using SAS/GRAPH procedures, I might have suggested PROC GREPLAY
as the means to achieve it. However, I recently came across another way to do the same thing by using ODS. It helped that the graphs were being produced using the PDF destination because I doubt that what follows will work with the RTF one.
For this three plots on a page example, I first set the orientation to landscape so that the plots can be arranged side by side in a single row:
options orientation=landscape;
Next, the PDF destination was opened with page breaks turned off for the required output file using the STARTPAGE
option:
ods pdf file="c:\test.pdf" startpage=off;
The listing destination was turned off as well since it is not needed:
ods listing close;
With that complete, a page or region break gets inserted. While this could have been repeated before every procedure to get it popped into the next region on the page, that is the default behaviour for any extra procedural step, so it wasn't needed.
ods pdf startpage=now;
Then, the ODS LAYOUT feature is started so that the layout can be defined on the page:
ods layout start;
For the first plot and the one at the left of the triptych, a region was defined absolutely (grid layouts are available, but I didn't make use of them here) using ODS REGION. Since all plots were to be of the same size, the width was defined as being a third of the page and the bottom left-hand corner of the region defined to be the same as that of the plot area on the page. Titles and footnotes usefully lie outside this region in the way that SAS arranges things, so there is no further messing. With the region defined, it's a matter of running the required SAS/GRAPH procedure. In my case, this was GPLOT
, but I am certain that others would work as well. The height was defined as the full possible plot height. This could have a use if I wanted more than one row of graphs on a page, with a trellis plot being an example of that sort of arrangement.
ods region x=0pct y=0pct width=33pct height=100pct;
<< SAS/GRAPH Procedure >>
For the middle plot, the starting position is moved a third of the way along the page, while the section area has the same dimensions as before. Using percentages in these definitions does make their usage easier.
ods region x=33pct y=0pct width=33pct height=100pct;
<< SAS/GRAPH Procedure >>
Lastly, the right-hand plot has a starting position two-thirds of the width of the page and the other dimensions are as per the other panels:
ods region x=66pct y=0pct width=33pct height=100pct;
<< SAS/GRAPH Procedure >>
With the last graph created, it is time to close ODS LAYOUT and the PDF destination. Then, the listing destination is reopened again.
ods layout end;
ods pdf close;
ods listing;
Update 2012-12-08: Since writing the above, I have learned that ODS LAYOUT and ODS REGION have yet to become production features of SAS with 9.3 as the latest version. However, I have encountered an alternative that uses the STARTPAGE=NEVER
ODS PDF option to turn off page breaks and GOPTIONS
statements to control the regions occupied by plots. It's Sample 48569 on the SAS website. Having a production equivalent is better, since pre-production features are best avoided in production code. If I had realised the status, I would have used PROC GREPLAY
to achieve what I needed to do.