Archive for the ‘Computers’ Category

Avatar Icon for WP Comments

Monday, August 19th, 2019

Something that I learned today:

If you put an avatar picture on your website, then WP will grab it to put next to the comments you leave on your site and on other WP websites. Specifically, it seems to be working with the file "avatar.png". Although, Diana Coman says it should be "avatar.ico", but I tried that and it did not work on this site. It is possible that different versions of WP look for different files, in which case it would not hurt to have a ".ico" and a ".png" file both in the root directory of your website.

Tada! Avatar for comments.

Tada! Avatar for comments.

Windows 10: Clear Clipboard

Monday, June 24th, 2019

During my workflow I sometimes have to copy a series of images from a remotely accessed computer (running Windows 7) to a file on my main computer (running Windows 10). I have noticed an intermittent problem where I go to copy a second image and when I paste I still get the first image, as if the clipboard was never replaced. This can be quite frustrating if the images are similar enough that I don't notice the problem until later, and I have to go back and re-process data to generate the image that did not copy correctly.

I don't know if this is a problem with Windows 10, or something about trying to get Windows 10 and 7 to work together, or something in the remote desktop access software. The way I have found to get around this is to clear out the clipboard on my host computer, and then copying works again.

To add a shortcut to the Windows 10 desktop that clears the clipboard, use the following procedure:

  1. Right click on the desktop and choose "New > Shortcut".

  2. A pop-up asks for the location of the item, enter the text:
    C:\Windows\System32\cmd.exe /c echo off | clip
    Then click "Next".

  3. Give it a name, like "Clear Clipboard", then click "Finish".
  4. Optional - Change the icon: Right click on the shortcut and select "Properties". Click on the "Change Icon ..." button. Click on "Browse", select an icon file (look in C:\Windows\system32\SHELL32.dll for a large selection).
  5. Optional - Give it a keyboard shortcut: In the "Properties" window, click on the "Shortcut key" box and type a letter, the shortcut will become Control + Alt + the letter.

Vpatch for Text Selection Fix

Monday, June 3rd, 2019

As I previously noted, I had to make a small change to get the javascript text selection thing to work on this website. The change I made seems to be addressing a symptom, rather than the underlying problem, since when I look at the source code it should work as written. But anyway, I made a vpatch for the MP-WP tree, so if anybody else sees the same problem they can use this fix.

mp-wp_fix-textselectionjs.vpatch (text version)
mp-wp_fix-textselectionjs.vpatch.peterl.sig (text version)

Getting Selection-Magic to Work

Wednesday, May 29th, 2019

Included in this set-up of WP is a javascript thing that allows the selection of regions of the text, which is convenient when you want to reference a certain passage in a blog post. I had noticed that the functionality was not actually working on my web page, so I dug into the problem. I learned a bit about javascript and a bit about Wordpress. Here are the things I had to change to get it to work:

In the single-post file, which is where the javascript thing is active, there were actually two <span>tags with the same ID, so I got rid of one of them. The big problem with the code was that this <span> tag ID must match the ID called for in the selection-magic script, and for some reason the script was not being updated to match the ID on the page. I reasoned that there is no reason that the ID should be unique for each page (it was being assigned a "shash-#" to match the post ID), it just has to be unique within the page. So I switched it to a static ID string, "sm-area", which solved the problem.

In trying to figure out why this was not working, I compared my script to the one on a page with a working version, and noticed that they included the word "selection-" in the generated address, so I added that too. I also did some minor edits to the javascript.

Next Step: I will review the standard files, and if appropriate, make a vpatch to include these changes into the tree as found on

Using the .htaccess File to Allow Two Computers Access

Wednesday, May 15th, 2019

In order to control access to parts of a website one can use a .htaccess file to restrict the IP addresses which are allowed to view files in a folder. I have two computers which I generally use to access the admin functions of my website, so I wanted to set up the .htaccess file so that either computer could log into the WP-Admin functionality. After looking through various online suggestions, I figured I should be able to do something like this to allow either IP address:

Order Deny,Allow
Deny from All
Allow from xx.xx.xx.xx
Allow from yy.yy.yy.yy

But when I put this in my .htaccess file, when I tried to load the website I just got an error saying that Apache was misconfigured. If you see anything wrong with the code above, I would love to hear why it does not work, since every site I looked at seemed to suggest this should work for what I am trying to do.

The setting that I have been using, and has been working, is like this:

Require IP xx.xx.xx.xx

But when I use this, each time I switch computers I have to ssh into the host and manually alter three different .htaccess files to use the correct IP address before I can log into WP-Admin, which is annoyingly tedious. So I did some more digging and came up with some more technical documentation, where I found the option to use this form:

Require IP xx.xx.xx.xx
Require IP yy.yy.yy.yy

Which lets either computer access the folder.

Hello from a Linux Computer

Monday, May 13th, 2019

Back in 2007 I got my first Macbook. I have been using Macs ever since, except for at work where I generally have been issued a Windows machine, the exception being the computer running the NMR, which has been a Linux system everywhere I have been.

Recently I decided that it would be better to have a Linux computer. I have heard good things about Gentoo, so I thought I would try to start there. I happen to have an old macbook pro sitting around that nobody is using, so I decided to try installing a new operating system there. Apparently macs can be finicky about the particular settings used. I spent the last week trying to follow the Gentoo installation guide, but the system never booted up.

Being rather frustrated at this point, I thought I would start with something easier. So I created a Ubuntu minimal installation disk. After fighting with the Gentoo install for the past week, the Ubuntu install was a breeze. There were just a couple simple questions to answer, and the install program did the rest. Now I have a working Linux system.

I imagine that it will take me some time to get all the settings just the way I want them, but I at least have something to work with. Right away I noticed there is no Curl, so I had to install that.

Macro for Chemical Notation in MS Word

Monday, April 29th, 2019

If you ever find yourself entering chemicals formulas1 into a Microsoft Word document you will quickly realize that it is much harder than it needs to be. Either you switch back and forth between the keyboard and the mouse to click "subscript", or use the keyboard shortcut Ctrl-(=), or enter the formula and then go back and select all the numbers (using Ctrl-mouse) and then set them to subscript all at once - all of these are too much work, especially if you have a large number of formulas to enter. It is much better to use the following macro to make formatting a chemical formula just take a couple keystrokes. (Direction for installing into Microsoft Word are below.)

Sub ChemNotation()
' Chemnotation Macro
Set myrange = Selection.Words(1)

If (Len(myrange) < 2) Then
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
Set myrange = Selection.Words(1)
End If

For i = 1 To Len(myrange)
Char = Mid$(myrange, i, 1)
If (IsNumeric(Char)) Then
myrange.Characters(i).Font.Subscript = True
myrange.Characters(i).Font.Subscript = False
End If
Next i

Selection.MoveRight Unit:=wdCharacter, Count:=1
With Selection.Font
.Subscript = False
End With

End Sub


  • Open Microsoft Word

  • Go to the "View" tab in the ribbon
  • Click on the "Macros" button ("view macros", or click Alt-F8)
  • Type the name "ChemNotation" in the Macro name box, then click "Create"
  • Copy and paste the text above into the editing field
  • Open File->Options->Quick Access Toolbar (or right click on the ribbon and select "customize Quick Access Toolbar")
  • Use the drop down box "Choose commands from" to select "Macros", add the macro to the toolbar
  • Select the macro and click "Modify", change the name and icon as desired
  • To use the macro: type in the formula, then either with the cursor at the end of the formula or after selecting the formula, click alt, then click the number on the icon in the toolbar ((I have found that in normal writing I can type the formula and hit Alt, shortcut-number (3 on my quick access bar), but if I am working in a table cell then it only works if I have selected the formula beforehand.
  1. Things like H2O, CO2, or C14H28O2. []

Show My IP Page

Monday, April 22nd, 2019

From time to time I have found it useful to have a way to view my IP address. In the past I would go to Google, and type "what is my IP" in the search box. I have chosen to rely less on Google, and so I have added a simple page to this website that shows that information. The page is located at, I am also putting a link section in the sidebar, and I am including this link there.

Brand New Blog

Tuesday, April 16th, 2019

Hi everybody, this is the home of my new blog!

I am going to start by re-posting some of my older writings, and I hope to have new things to say as time goes on.

I have not yet come up with a catchy name for the blog, so I will just use my name for now. If you have any good suggestions, I would love to hear them.

This blog is hosted by Pizarro the premiere hoster of the free world. In other words, hey look at me - I am off Google!

Hello world!

Tuesday, April 16th, 2019

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!