Archive | Computing RSS for this section

ReactOS on VirtualBox: No need for step-by-step instructions

This is so simple there’s no need for step-by-step instructions, but I kept notes so I might as well post them.

ReactOS 4.5 on VirtualBox 4.3.x on Debian 8.x. Not on VB5.1 because the older versions are what the Debian repo provides.

(1) Installed VirtualBox;

$ apt-get install virtualbox dkms 

Host is 32 bit Debian 8.4 Netbook with 1 GB RAM and 250 GB HD. Low spec! (Atom N550)

(2) http://www.reactos.org/download and downloaded both disk images; starting with iso rather than LiveCD. Apparently should be able to use guest additions from Win 32 bit, 2003-era. Unzipped the images.

(3) Ran VB; selected ‘New’.

(a) Put in details — Name, Windows, 32 bit 2003.



(b) 512 MB RAM (default in this case)

(c) 20 GB HD.

(d) VDI format is fine.

(e) Dynamic is fine.

(4) System. Enabled PAE/NX.

(5) Storage — put the Reactos ISO in the virtual drive.

(6) Boot.

(7) Let install run:

(a) Chose language

(b) Pressed enter a bunch of times. I chose to do a full format not a ‘quick’ one.

(c) Waited… … … … … …

(d) Chose default to put OS in C:\ReactOS

(e) Chose default bootloader installation.

(8) Removed cd rom image from virtual drive. (Devices menu).

(9) Rebooted.

(a) Watched as it interrogated the hardware and installed some devices.

(b) Clicked through setup. Admin password.

(10) Rebooted again.

(11) It wanted to install a driver but could not. Oh well.

(12) Devices menu of VB — inserted guest addtions.

(a) Opened explorer in guest and double clicked on additions x86 exe file in the cdrom directory.

(b) Default install.

(c) Rebooted.

(13) Shared folders…

(a) Created a folder on Linux host. Made sure users had read/write permissions.

(b) In VB manager, added that folder in Share Folders menu. Did not click auto mount.

(c) Booted VM.

(d) Double-clicked ‘My netowrk places’ on the ReactOS desktop and there it was, called \\VBOXSVR\vbshare.

(e) In a terminal, needed to assign the folder a drive letter.

(f) Opened command prompt on guest and typed

C:\ net use x: \\VBOXSVR\vbshare

(g) Typed x:

(h) Typed X:\ notepad textfile.txt.

(i) Typed some crap. yep, it’s there.

(j) Looked for the file on host system. Modified it.

(k) Saw modifications in guest and host. OK, that works.

(l) I’m not going to bother automating it, I’ll just put a readme on the ReactoS desktop.

(14) Done, as far as I can see. Looks pretty good.

Having said that, all the applications I wanted to be able to run can run on wine.

Still, seems to work.

Wine.

CAPS LOCK disable on Windows without admin rights

Lots of sites tell you how to disable/remap CapsLock. But what if you don’t have administrator rights? Most of them tell you to pry off the key. Well, instead, I went to:

https://dropline.net/2009/05/mapping-caps-lock-to-control-without-admin-access/

Here is an extract, which I put here just in case the original site vanishes, as sites sometimes do:

There’s a duplicate of the keyboard mapping registry key under HKEY_CURRENT_USER, which non-administrators can modify, and it appears to behave exactly like the key under HKEY_LOCAL_MACHINE.  So, for anyone in a similar position, here’s the registry key to modify:

HKEY_CURRENT_USER→Keyboard Layout→Scancode Map =
hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00

You can download a registry update file here.  Save it to your computer, double-click it to update your registry, then reboot and enjoy your vastly-improved keyboard.

Here is a screengrab of the .reg file:

capslock

Worked a treat on Windows 7, but it did not work on Windows 10.

Hmm…Code for conversion of CapsLock to Shift is:

00,00,00,00,00,00,00,00,02,00,00,00,2a,00,3a,00,00,00,00,00

(http://johnhaller.com/useful-stuff/disable-caps-lock)

Codes explained here:

https://www.experts-exchange.com/articles/2155/Keyboard-Remapping-CAPSLOCK-to-Ctrl-and-Beyond.html

But why it does not work in Windows 10 I don’t know. I did try it on a work desktop machine (that’s why I don’t have admin rights, ‘cos it’s a work machine), so perhaps it downloads registry files on logging in? Does that make any sense?

Right now I don’t care enough to find out, but I’ll look into it at some point in the future.

 

So there.

Another Font for a Very Specific Purpose

I have been reading stuff on my HP200LX palmtop using VR, the Vertical Reader.  It basically turns the LX into a pretty useful book reader — ASCII only.  You have a single column of text, rather like a newspaper column. It’s most excellent. It comes with search, bookmark and various customisation facilities.

However, I found the fonts that came with it just a bit too small. I decided to make one of my own, which is at an old post here, but it went too far the other way and is too wide. So I decided to take that font and narrow it a bit — make a condensed version, in the correct parlance. Thus:

The two fonts are shown below. The comments about the design philosophy in the earlier post remain valid; but the new one is I think just as readable and gets quite a bit more text on the screen.

‘djgtry2.vfn’

Using the font 'djgthin.vfn'.

Using the font ‘djgthin.vfn’.

The new font is available at DSPACE, along with the earlier one. The file to download is DJGTHIN.VFN.zip.

For what it is worth.

Impressions of wine

Wine is a mighty thing. Wine is a project to allow Linux (and Mac OS) users to run Windows programs.  It does not emulate a Windows machine, the way, for example, DOSBox emulates the hardware that DOS runs on or that VirtualBox (VB) does on a much larger and more complex scale.  It is more like an interpreter. The website calls it a ‘compatibility layer’. What that means for us non-experts, is it takes Windows’ instructions to the hardware and translates them into Unix equivalents, then passes them on. This is a less flexible approach than simulating hardware (it is specific for Windows, for example, where a VM can run any number of operating systems) but it is much faster and allows excellent seamless integration with the Linux environment.

I have used Wine on and off for years, but I am not a regular user. I use VB to run a Windows 7 VM on my main workstation, because I have to work with people who use Microsoft Office and various add-ins like MathType, and at the time when I set the VM up it was probably the best solution.

I’m not so sure now.

I have an old CD of MS Office 97. I recall trying to install it under Wine a few years back, and it was not highly satisfactory. Word threw some funny errors, and I could not type into Excel. But that was a few years back, and I use Debian on my desktop, which is not renowned for using the latest versions of packages.

So I thought I’d try it again.

I have a Netbook running current Debian, which is a lot newer than the ‘old stable’ I have on my workstation. I have a USB CD drive, so I gave it a lash.

Brilliant.

Plugged in the CD drive. It appeared in the file manager. [Caja — I use MATE, which I think is a great example of a FOSS project. Dissatisfaction with where the Gnome desktop was going (when it switched from Gnome 2 to Gnome 3) prompted people to get together to continue to refine Gnome 2. The result is a desktop environment which is very congenial for us slightly older users who first saw a GUI in the 1990s and reacted violently when Microsoft introduced the ribbon, for example. Now users can choose between Gnome and MATE, and everyone has more options.] I then opened a terminal and went to the CDROM subdirectory (in this case, at /media/cdrom) and ran:

/media/cdrom $ wine autorun.exe

or whatever the installation program was called. Wine opened it like a native Linux application, installed the program (the psuedo-Windows hard drive is hidden away in .wine/drive_c of the user’s home directory).

It appeared in the ‘Other’ menu under the MATE Applications menu. So did a bunch of other stuff; it seemed to generate menu entries for all sorts of Windows executables that I did not want to use.

But that’s OK. Installed and ran Mozo, the MATE menu editor, and turned off all the entries I didn’t want, and moved Word and Excel to the Office category, and bingo I have Word and Excel (97, admittedly) running like native applications, almost no effort required.

Found an old zip file of Rietica1.7.7 (32 bit) on my hard drive; that installed perfectly as well. The Rietica website only hosts the new 64 bit version; I’ve not tried that.

 

Don’t know if I’ll even use Word and Excel, but the jump in the quality of the experience compared to Wine a few years ago shows how it’s a vibrant, massively useful project. A great solution.

 

Older tech.

Add LibreCaslon (to name one) and Computer Modern (to name two) to Word

Not much really.

Now, if you do not have admin rights it is more interesting:

  • Right click.
  • Swear.
  • Go to https://portableapps.com/download
  • When asked, select ‘Local — install for current user’ or similar.
  • Finish installing.
  • Use the Explorer to go to: C:\Users\username\PortableApps\PortableApps.com\Data (‘username’ is the login name of the user installing the software).
  • Create a ‘Fonts’ folder in there.
  • Put the OTF files into this folder.
  • Start the Portable Apps Platform (if no shortcut/menu entry is available, go to C:\Users\username\PortableApps\PortableApps.com and run PortableAppsPlatform.exe). If it was started during installation, stop it and restart it.
  • Open Word, say, and LibreCaslon now appears in the fonts menu.
  • Close the Portable Apps Platform and it will not be accessible, though Word might still list it.
  • Add any other fonts you like this way, but they’ll only be available while the Portable Apps Platform is running, and you’ll need to stop it and restart it to make them appear. On the other hand, installation/removal is really simple; to uninstall, turn off the platform and remove from the Fonts folder!

Lots of other great applications (LibreOffice, gnumeric, GIMP, all that) are available through the Portable Apps Platform.

lc_list

Oh, Computer Modern is at https://www.fontsquirrel.com/fonts/computer-modern and https://www.ctan.org/tex-archive/fonts/cm-unicode/fonts/otf.

 

Meh.

Non-breaking en rule (en dash) in Microsoft Word… not really.

Say you’ve got a number range. The proper way to format that is with an en rule (en dash), so it looks something like ‘4­–5’ whereas a hyphen would look like ‘4-5’. Now, you probably don’t want the number range to break across lines. That’s fine with a hyphen, since Ctrl-Shift-Hyphen gives a non-breaking hyphen (in Word). But you don’t want a hyphen you want an en rule. One option is to put in a non-breaking hyphen then make it twice as wide.

  • Highlight the non-breaking hyphen (and the hyphen alone, not any trailing/leading characters or spaces).
  • Right click on the hyphen and select the ‘Font…’ menu, then ‘Advanced’ (rule #1 in Microsoft products: Just about anything worth doing is considered ‘Advanced’).
  • Change the number in the ‘Scale’ box to be about 200%.
  • Exit from the menus.
  • Type an en rule in your document, alongside the stretched hyphen. (Ctrl-Keypad Minus.)
  • Compare.
  • Swear.
  • Use it anyway since it’s the most reasonable alternative. You may want to adjust the height; but will this highly manual fix work if font is then changed? No.
  • Watch while Word mysteriously moves the instruction to widen the characters to random places in the document so you end up with double width text in unexpected places.
  • Swear.
  • Learn LaTeX where all you need to type is \mbox{4–5}.
Dialog box in Microsoft Word for changing character size, position and spacing.

Stretch out the hyphen (or anything else) using the ‘Scale’ box. Gives fixed selections but can type in other values. Something between 175% and 225% usually works. Note: Can also be used to adjust the position if need be.

I have tried putting text in boxes, but the baseline is not maintained – it sits high. Character positions can be adjusted down, but then Word boxes clip the contents. Perhaps there is a better solution? I tried making it an equation, or using a minus character, but neither was really satisfactory. I’d like to hear about a better answer because, sadly, using LaTeX is not always viable.

Non-bresaking en rule in Word; results of stretching a hyphen.

Non-breaking en rule in Word; results of stretching a hyphen.

My Word.

Cygwin without Windows administrator access

This is really simple, but useful. Especially since I have a work-provided computer and the IT people don’t give us members of the proletariat administrator access. ‘Cos, you know, we’re unreliable and might do something crazy. Now, I could get back at them by wasting their time getting them to do every little thing for me. (‘Ticket #12456: I’d like a different screensaver picture, please.’) But that’s petty and not good for my reputation. So it’s useful to look at installing things without admin rights. MikTeX works that way, and so does cygwin. Even if they will install cygwin for me (they would, I’m pretty sure), I don’t want to have to put in a job request every time I want to install a cygwin package. Fortunately, it’s no big deal. It’s designed that way.

(A) Went to cygwin.com and downloaded setup*.exe

(* is just x86 or x86_64, depending on your bits)

(B) Created C:\Users\username\installs\cygwin and put it in there

Opened a command window (cmd.exe). In the command windows, typed:

H:\> C:
C:\> cd C:\Users\username\installs\cygwin
C:\Users\username\installs\cygwin> setup-x86_64.exe --no-admin

Then clicked through in the usual way. This installed cygwin to C:\cygwin64

For future use, I created a batch file, cygwin_update.bat

and all that is in it is:

C:\Users\username\installs\cygwin>setup-x86_64.exe --no-admin

and I put it in my path. Now, also simple to make a Windows shortcut

  1. Right click on setup-x86_64.exe, select ‘Make shortcut’

  2. Right click on setup-x86_64.exe - Shortcut, select ‘Properties’

  3. Look in the ‘Target’ box. It should say something like:

    1. C:\Users\username\installs\cygwin\setup-x86_64.exe

  4. Just add the flag to the end of this

    1. C:\Users\darren\installs\cygwin\setup-x86_64.exe --no-admin

  5. Rename the shortcut to something more useful, like ‘Cygwin Setup

  6. To update or install new packages, double click the shortcut.

The batch file and the short cut.

That’s it.

A fool’s guide to installing a new hard drive in my Linux box.

(1) First I bought a new drive. Nothing fancy, Seagate 2 TB 3.5″ HD. I want extra data space, not a boot disk. I just want to mount it as a multimedia repository. Audacity generates a lot of GB.

(2) Second, I found an empty bay in my tower case and slotted the drive in and fastened it in with all four screws.

Sideways pointless picture of the inside the my PC case.

Sideways pointless picture of the inside the my PC case.

(3) Ran a SATA cable from the drive to an empty plug on the motherboard, and connected power to the new drive.

(4) Disconnected all external storage and booted up, and noticed that the drive showed up in the boot output. (Disconnected external storage to make identifying the correct disk easier when creating partitions.)

(5) I know that my existing HD is sda. Ran gparted. (Applications -> System -> Administration -> Gnome partition editor in the Debian menu structure).

(6) Waited while gparted found the partitions on all the attached disks.

(7) Identified new disk as sdb. Good.

(8) Created partition table: I chose gpt, but msdos works usually too. Device -> Create Partition Table -> select type.

<tt>gparted</tt>. A screen shot too fill up space.

gparted. A screen shot to fill up space.

(9) Right click on its entry in the partition editor window. Selected ‘New’ and added details as preferred. I like ext4, used the whole disk, and gave it a label different from any other disks. It had to be Primary since it is the only partition on the disk.

(10) Clicked ‘Add’, then ‘Apply’. Closed the dialogue when successfully completed. The partition editor took a few seconds and found the new partition.

(11) Okay. Now, to get it to mount on boot. The modern way uses a sort of ‘universal ID’ for the drive — UUID are four letters that come to mind. I just used the fact that the partition is called sdb1.

(12) Created a mount point in my file tree.

Whatever.

Whatever.

$ cd
$ mkdir Music

I was not acting as root at this point — because this is my desktop machine and my data. I am treating it as part of /home/myusername, not creating a drive for everyone to see.

(13) Then edited /etc/fstab. This has to be done as root

$ sudo vim /etc/fstab

This is the added text in /etc/fstab.

#New 2TB GB drive as ~/Music
/dev/sdb1 /home/myusername/Music ext4 rw,user,exec,auto,errors=remount-ro 0 2

(14) Then gave the machine a reboot and saw what happened…

(15) Use the ‘disk free space’ command to see if I can see the new disk.

$ df -h

Here is the output for the new disk…

Filesystem Size Used Avail Use% Mounted on

/dev/sdb1 1.8T 196M 1.7T 1% /home/myusername/Music

OK!

(16) Need to do a test… Can I write to it? Test:

$ touch /home/myusername/Music/testfile

No! Because when mounted Music is owned by root, not by me.

(17) So…

$ sudo chown myusername /home/myusername/Music/ 

$ touch /home/myusername/Music/testfile

Success… (Note, this may not be the cleverest way to do all this, it only works.)

(18) Now reboot and see if I can still write to it…

(19) Yep. OK, now put the sides back on the tower and copy the back-up to the new data space… Yep, that works.

And awayyyy…….

Old g95 (for the make use of)

I needed to compile a Windows g95 binary for someone. I have Win 7 in a VM on VirtualBox. I had the g95 install tree from a (quite old) back-up of a previous computer, but not a proper install.

The install tree looks like this:

C:\util>dir /s g95
 Volume in drive C has no label.
 Volume Serial Number is 8440-3CD9

 Directory of C:\util\g95

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM              bin
23/08/2012  09:42 AM              doc
23/08/2012  09:42 AM              lib
23/08/2012  09:42 AM            55,782 uninstall-g95.exe
               1 File(s)         55,782 bytes

 Directory of C:\util\g95\bin

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
26/03/2008  11:49 AM           553,984 ar.exe
26/03/2008  11:49 AM           827,904 as.exe
17/06/2009  09:44 PM           123,046 g95.exe
26/03/2008  11:49 AM           782,848 ld.exe
28/12/2007  12:23 AM            15,964 mingwm10.dll
26/03/2008  11:49 AM           554,496 ranlib.exe
26/03/2008  11:49 AM           685,568 strip.exe
               7 File(s)      3,543,810 bytes

 Directory of C:\util\g95\doc

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
16/10/2004  09:36 PM            17,015 bg.gif
27/11/2004  03:51 AM            18,007 COPYING.txt
08/12/2005  06:19 AM            22,431 docs.html
23/11/2004  12:00 PM           107,122 g95.bmp
02/01/2007  01:59 AM           170,619 G95Manual.pdf
31/05/2008  06:59 AM            11,858 Readme.html
31/05/2008  07:00 AM             6,687 README.txt
               7 File(s)        353,739 bytes

 Directory of C:\util\g95\lib

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
28/12/2007  12:23 AM             2,192 crt1.o
28/12/2007  12:23 AM             2,288 crt2.o
28/12/2007  12:23 AM             1,239 dllcrt2.o
23/08/2012  09:42 AM              gcc-lib
22/10/2006  01:27 AM           408,608 libadvapi32.a
30/10/2005  11:13 AM           253,890 libgdi32.a
22/10/2006  01:27 AM           594,018 libkernel32.a
28/12/2007  12:23 AM               458 libm.a
28/12/2007  12:23 AM             7,514 libmingw32.a
28/12/2007  12:23 AM           267,880 libmingwex.a
28/12/2007  12:23 AM            82,558 libmoldname.a
28/12/2007  12:23 AM           503,692 libmsvcrt.a
22/10/2006  01:27 AM           128,262 libshell32.a
22/10/2006  01:27 AM           435,754 libuser32.a
30/10/2005  11:13 AM            82,086 libws2_32.a
              14 File(s)      2,770,439 bytes

 Directory of C:\util\g95\lib\gcc-lib

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM              i686-pc-mingw32
               0 File(s)              0 bytes

 Directory of C:\util\g95\lib\gcc-lib\i686-pc-mingw32

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM              4.0.4
               0 File(s)              0 bytes

 Directory of C:\util\g95\lib\gcc-lib\i686-pc-mingw32\4.0.4

23/08/2012  09:42 AM              .
23/08/2012  09:42 AM              ..
23/08/2012  09:42 AM             1,022 cc1.lnk
17/06/2009  09:44 PM         5,242,021 f951.exe
17/06/2009  09:44 PM           859,168 libf95.a
17/06/2009  09:44 PM            61,284 libgcc.a
               4 File(s)      6,163,495 bytes

     Total Files Listed:
              33 File(s)     12,887,265 bytes
              20 Dir(s)  42,207,707,136 bytes free

Now, all that is required to make this work is to set some environment variables. (Start → Control Panel → System → Advanced System Settings → Environment Variables).

First, I had to put some directories in the path, so I edit the PATH variable. It works if I have the path to the g95.exe binary and also to the f951.exe file. That is:

PATH=C:\util\g95\bin;c:\util\winvi;c:\util\g95\lib\gcc-lib\i686-pc-mingw32\4.0.4;[[INSERT REST OF PATH HERE]]

I’ve put [[INSERT REST OF PATH HERE]] at the back, but I’ve actually got the g95-related paths at the back (you want the most commonly used bits of the path at the front, not that it matters with modern fast coomputers). Then, I want to create a new variable called LIBRARY_PATH:

LIBRARY_PATH=c:\util\g95\bin;c:\util\g95\lib\gcc-lib\i686-pc-mingw32\4.0.4;c:\util\g95\lib

Now, I don’t know if I need all three directories in the LIBRARY_PATH, but it works so I am not complaining.

So to compile my tiny little program I can now type:

X:\Downloads\Brill_dir>g95 -o Brill.exe brillouin.f90

And it works. Is it statically linked? Well, on Linux, dynamically linked, compiled with GFortran, it’s about 68 kB. This binary is about 360 kB, so I sure hope it is statically linked!

Caveats: I have not tried anything fancier than this absolutely basic compile. It works. Compiling with the -static flag makes no difference to the size of the binary.

FWIW

Three finger salute killed a monitor

OK, weird stuff.

I have to use Windows (7) as well as RHEL at work. So I am used to hitting Ctrl-Alt-Del on the Windows lock screen to get the password dialogue to unlock the computer. Accidentally did it on RHEL 6

(details:

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)

$ uname -r
2.6.32-642.6.1.el6.x86_64

)

and now the monitor has stopped working! Very weird. I get a few seconds of vision when I turn the monitor on, or when I unplug it and plug it in again, but then it goes black again. I was running the monitor on a VGA cable. The DVI output is working fine, when I test with a second monitor, but does not work on the one that I was using on the VGA cable, and neither does VGA output. It’s like the monitor is going to sleep in only a few seconds. What’s more, even the monitor menu only flashes up and vanishes. It’s like the monitor itself has been screwed up. Like the three-finger salute rewrote the monitor firmware…?

The sort of monitor that was damaged. I don't know if the problem is model-specific.

The sort of monitor that was damaged. I don’t know if the problem is model-specific.

Even the ‘check signal cable’ message on the screwed up monitor only flashes up for a second… seems like three finger salute on the Linux unlock screen has somehow fried my monitor! (Samsung SyncMaster 950B). Very odd.

Plugged faulty monitor into Windows 7 box and rebooted Windows. Absolutely nothing.

So, yes, the monitor has been screwed up by using Ctrl-Alt-Del on RHEL 6.

Hmm.