Friday, February 19, 2016

Prevent websites from hiding UI elements in Firefox browser window

This is freaking annoying
I find it very annoying when websites disable the menu bar, back and forward buttons, navigation bar, or bookmarks in windows. Banking websites and Paypal both have pop-up windows that 'castrate' my browser.

The JavaScript / HTML code that does this is quite straightforward; this is a comma-separated properties list of string tokens that define the new window behaviour: ("url","title",

It took some digging, but Firefox allows you to disable modification of the attributes of windows with a little bit of about:config magic. Simply search for disable_window_open_feature as shown below, and double-click on the attributes that you don't want websites to be able to enable or disable. My preferences are to manually set the following properties to true:

  • dom.disable_window_open_feature.menubar
  • dom.disable_window_open_feature.minimizable
  • dom.disable_window_open_feature.personalbar
  • dom.disable_window_open_feature.scrollbars
  • dom.disable_window_open_feature.titlebar
  • dom.disable_window_open_feature.toolbar

Saturday, February 6, 2016

LibreOffice: Interpreting CSV money "$XX.XX" as numeric value

For as long as I can remember using LibreOffice, I found that CSV files did not seem to be interpreted in a way such that monetary values preceded by a dollars sign (e.g. $12.34) would be interpreted as a numeric value. For example, when highlighting multiple numeric values, LibreOffice very conveniently shows the sum of the values in the lower-right area of the window.

The fix is simple. Check the box "Detect special numbers" as shown in the image below:

After this fix, LibreOffice very nicely formats any negative numbers in red ink.

Hurray! Now I'm all ready to analyse my 2015 expenditures!

Monday, February 1, 2016

Chase Ultimate Rewards sale item: Kohl's card 10% off

As part of my quest to hunt for cash back credit card bargains:

As of Feb 1, 2016, I had about $100 of Chase Ultimate Rewards built up, and noticed the Kohl's cards are currently 10% off.

Wednesday, November 18, 2015

Microsoft Windows 10 (build 1511 / 10586, November 2015) update likely fails if you "forcefully removed" applications in Windows 10

Months after I had followed directions posted on Super User to remove arguably useless parts of Windows 10 (including Cortana), it seemed that Windows Update didn't work very well on this particular Windows 10 update. Executing the Get-WindowsUpdateLog command in PowerShell rendered a log file on my desktop that didn't contain anything useful.

I suppose that the answer to this problem is to use the Windows Media Creation Tool to perform the update, but without diagnostic logs to demonstrate where the failure was, I am reluctant to spend time attempting this.

Saturday, October 24, 2015

One minute tutorial: Getting started with a fresh NodeMCU ESP8266 (direct from eBay)

The NodeMCU / ESP8266 is a ridiculously cheap ($2) micro-controller that can talk to an 802.11N wireless network. This device is the herald of the "Internet of Things."

If you buy one on eBay, chances are it will NOT be flashed with NodeMCU firmware (it speaks Lua). This understandably confused the crap out of me. So, this serves as a guide to those running Manjaro (Arch) Linux:

  1. Download NodeMCU firmware
    "integer" versions will NOT understand floating point arithmetic, but save on system resources.
  2. Install minicom
    pacman -Ss minicom
  3. Install esptool from the AUR:
    yaourt esptool-git
  4. Make sure your Linux box recognizes the device
    tail -f /var/log/messages.log
  5. Plug in the NodeMCU device. You should see:
    kernel: usb whatever: ch341-uart converter now attached to ttyUSBX

    ch341-uart converter detected

    If this didn't happen, you cannot proceed and must troubleshoot.
  6. Flash the firmware. Make sure you have permission to read and write to the device in the command below. When in doubt, run as root: --port /dev/ttyUSBX write_flash 0x00000 nodemcu_whatever.bin
    X corresponds to the device from the log file above, and
    nodemcu_whatever.bin corresponds to the firmware file in step 1.
  7. Unplug the USB cable after the flash command from the previous step is completed, and plug it back in.
  8. Fire up minicom, and talk to the board at 9600 baud:
    minicom -D /dev/ttyUSBX -b 9600
  9. Press the "enter" key a few times. In response, you should see:
  10. Try "hello world":
    > print ("hello world")
    hello world

  11. Now you can configure wireless:
    > wifi.setmode(wifi.STATION)

    > wifi.sta.config("SSID", "PASSWORD")

    > ip, nm, gw=wifi.sta.getip()

    > print (ip, nm, gw)
    this   is   amazing
  12. Do some interesting things!

Wednesday, October 7, 2015

How to tell the difference between crocodiles and alligators

Such things are important when you have young children, so I authored a rhyme (with help of a friend on Facebook):
Crocs always show both rows of teeth
And swim in salty sea.
When gators smile, you see a "U,"
With crocs, you see a "V"

With dotted snout in muddy swamp,
the Gator lies happily.
Crocs, with spots from head to toe,
Live life... estuarily.

Friday, October 2, 2015

Extracting structured data (in a table) from HTML5 using BeautifulSoup / Python

I recently ripped a CD that was unknown to my CDDB server. I found a web page that contained a track list, but found it very cumbersome to copy and paste the information due to the formatting of the web page.

Consequently, I opened up the page using the Firefox DOM inspector, and noticed that each title was associated with HTML class 'title'. Surely, the data element of interest could be extracted using some higher-level language!

I elected to do some research and discovered that I could solve this problem, easily, using Python 2.7 and BeautifulSoup.

After some research (having never used BeautifulSoup before), this is the unbelievably simple script that I came up with:

from requests import get
from bs4 import BeautifulSoup
url = ''
htmlString = get(url).text
html = BeautifulSoup(htmlString, 'html5lib')
tags = html.find_all('div', {'class':'title'})
text = [t.get_text() for t in tags]
print str(len(text)) + ' items matched:\n'
# join(j.split()) is a quick hack to remove excess whitespace
for i,j in enumerate(text): print ' '.join(j.split())

WOW! Clearly, this is a useful library.