Passwords made easy: use a pass phrase

Strong, hard to crack passwords are actually easy.

Use a pass phrase.
3 or 4 words.
They can be in lower case.
Remember the spaces between the words.

For example: “black eggs sometimes yellow”.

Forget password complexity rules (watch https://www.youtube.com/watch?v=6L5G2MBzflo at around the 7 minute mark).

Easy to remember words, separated by spaces, all lower case.
25+ characters in the phrase is damn hard to crack, even if they are dictionary words. The bad guys still need to get the words in the right order.

Git: Reset a local branch to last remote commit, remove unstages files, and fix file permissions

I use the Codeanywhere online IDE for my WordPress development. Sometimes I screw up something I’m testing (usually when I try to manipulate the filesystem with PHP) and need to reset my local branch to the last clean commit I sent to remote.

(Note that I said “remote”. I don’t trust local commits. I continually push to remote to have a safe restore point, especially if I need to do a full delete of my local branch. Yes, it has happened more than once.)

Occasionally I find folder permissions screw up as well and I need to reset via the bash command line.

The following commands are what I always come back to.

Note: The “$” in the command below represent the command-line prompt. The actual commands follow it.

 

Reset a local branch to the the last remote commit of the branch

$ git reset --hard HEAD

 

Clean up any uncommitted folders/files that the reset didn’t remove

$ git clean -f -d

 

Set full permission recursively on a folder and all files/sub-folders

Change directory (cd) to the parent folder of the folder you want to set permission on.

$ sudo chmod -R 777 vylesk-module-z1

 

Recursively delete a folder and all files/sub-folders

Change directory (cd) to the parent folder of the folder you want to delete.

$ rm -rf vylesk-module-z1

Note: The “f” means you are not prompted to delete each file/folder.

Bash: Remove file and folder with Windows style directory names and backslashes

The Problem

While working with zip files in WordPress (I’m setting up my own update server and package update process), I manually created a zip file in using 7zip in Windows (my primary operating system) and extracted it via PHP in a Codeanywhere Ubuntu workspace.

The problem was the zip file was created containing Windows paths, so I ended up file with a file name “vylesk-test-plugin\vylesk-test-plugin.txt” and directory name “D:\Temp\php\vylesk-test-plugin\vylesk-test-plugin.1.1\vylesk-test-plugin\“.
Notice the backslashes and “D:” drive path.

Removing the file and directory was a problem.

Attempting to perform a simple rm and rm -rf resulted in:

rm: cannot remove './vylesk-test-plugin\vylesk-test-plugin.txt': Permission denied
rm: cannot remove '_temp/vylesk-test-plugin.1.1/D:\Temp\php\vylesk-test-plugin\vylesk-test-plugin.1.1\vylesk-test-plugin\': Permission denied

I tried changing file permissions using chmod and that also resulted in:

chmod: changing permissions of 'vylesk-test-plugin.1.1/D:\Temp\php\vylesk-test-plugin\vylesk-test-plugin.1.1\vylesk-test-plugin\': Operation not permitted
chmod: changing permissions of 'vylesk-test-plugin.1.1/vylesk-test-plugin\vylesk-test-plugin.txt': Operation not permitted

 

The Solution

The solution turned out to be very simple. I just needed to prefix the command with sudo.

So I ended up with:

sudo rm vylesk-test-plugin\\vylesk-test-plugin.txt
sudo rm -rf 'D:\Temp\php\vylesk-test-plugin\vylesk-test-plugin.1.1\vylesk-test-plugin\'

The file and directory then deleted successfully (and I didn’t need an su password, which I don’t know anywhere because it’s in a virtual environment I don’t control).

Note 2 other elements of the commands:

  • In the first ‘rm’ line the “\\” (double-backslash), because backslashes need to be escaped.
  • In the second line I surrounded the directory path with single quotes, an alternative to the double-backslash.

Slow NBN or Fiber Internet? Check your modem/router and your WiFi band.

If you have Australia’s infamous NBN or other high speed internet service, but you find your service to be slow, then two things to check:

1. A poor quality modem/router can affect your speed. You may be getting 90Mbps into the router, but a bad router or too many connected devices will reduce the speed coming out of it into your phone/tablet/computer.

Here’s an example from my own experience.
I’ve been a customer of TPG’s FTTB (Fiber to the Building) network twice. The service consistently gives me speeds over 50Mbps and often nudges around 90Mbps.
When I initially setup the service (both times) TPG have be their own branded Huawei router.
In our first home it worked OK for a while and seemed to give good speeds (at least, compared to the ADSL2+ I previously had). We had 3 computers, 2 phones and an occasional tablet connected to it. After a while the Internet stopped and I suspect I literally burnt out the device. And devices would continually disconnect because we had too many connecting at the same time.

So I spent $300 (AUD) on a Netgear Nighthawk D7000 and saw immediate improvement.
We started nudging the theoretical max speeds, even over WiFi, with all devices connected. I could run 4 computers, 2 phones and a tablet at the same time, all over WiFi, with 2 computers streaming high quality video services and we never saw an interruption.

The same thing happened in our second home. We received a new modem, which I plugged in initially and tested. I was only getting ADSL2+ type speeds (about 12Mbps). I switched back to the Nighthawk and wham!, straight back to consistent 60-90Mbps over WiFi.

I’ve been running the Nigthawk and same number of connected devices (all on WiFi) for about 4 years now.
Occasionally I have to reboot the router. Very occasionally TPG has a service interruption. Apart from that, we regularly stream video services (free-to-air TV via web/YoutTube/Netflix/Amazon Prime) at the same time, over WiFi, during peak night time periods, and I never see a problem except in the service provider (usually the Australian free-to-air TV streaming sites).

2. It seems 2.4GHz vs 5GHz WiFi can affect your speed. That’s according to this article I found. The article starts:

A study of 43 devices conducted by Enex for the Australian Communications and Media Authority (ACMA) has “unexpectedly” shown 5GHz Wi-Fi outperforming 2.4GHz in long-range testing, negating a major reason to continue using the slower 2.4GHz band.

If your modem/router allows both bands, switch your connection up to the 5GHz band if you haven’t already. If you only have 1 WiFi choice then chances are you’re stuck with 2.4GHz.

[End of article]


In case you are interested

We need to remember “The Internet” isn’t just a solid pipe running from a website into your phone or computer.
There are many segments, devices and relays data must travel through to get from a website to your screen, each of which has it’s own limitations and factors that affect speeds.

Here’s just a few off the top of my head:

  • The server (computer) running the website or service:
    • CPU, memory and bus/network speeds affect the processing and speed of data.
    • Heat, both in and around the the server, affects the speed. In fact, heat can have a big affect on all electronics and computers.
    • Sometimes the server is under extreme load. Or the service is out.
    • Sometimes the data is “cached” (a copy is made) closer to you so time to get it to you is less. Sometimes the data comes from the other side of the world.
  • The transmission lines between the server and your Internet Service Provider. This can include:
    • Going up to space (to satellites) and back again.
    • Through undersea cables and crossing half the world.
    • Crossing through and being processed by tens of other servers as it moves across the world.
    • Some of these links around the world can be down, to the data has to be re-routed through other links.
    • Sometimes there is interference in the signal and quality is reduced.
    • Sometimes the Internet is “under attack” (being clogged up) by Denial of Service attacks that also affect your data.
    • Always there are many different segments that data must travel through.
  • In your Internet Service Provider.
    • They have filters and computers the data must travel through, checking for content restrictions and who knows what else.
  • From your Internet Service Provider to local phone exchange.
    • The quality of the transmission line (cables) will affect the speed.
  • From your local phone exchange to your home.
    • If you’re in Australia, the data could be travelling through anything from long-distance WiFi, to old copper cables or new fiber networks.
    • The distance from your exchange can affect speed because on older networks speed reduces the further away from the exchange you are.
    • In some networks (like old copper phone lines) the data also has to travel through curb-side switches before betting to your house.
  • In your home or building.
    • Phone line or fiber cabling inside your home will affect speed.
    • Physical lines can degrade or be damaged over time.
  • Into and through your modem.
    • Your modem will have different speed capabilities.
    • It will also have internal software and services that need to process your data.
  • From your modem to your device.
    • The quality and health of your cable from the modem to computer can affect speed.
    • If using WiFi, where you place the router and what the signal has to travel through (e.g. walls) to get to your device will affect speed.
  • Inside your device.
    • Your device will have different network components that have different speed and quality ratings.

And that process happens in both directions.
To get the data from a website your computer first sends a request to the site, going through all those same steps in the opposite direction.

Every step of the way, your data is being switched, processed, sped up or slowed down.
In the fraction of the second between a your device requesting data from a website or service and it being displayed to you, that data is been touched by hundreds or thousands of pieces of equipment and software.

(Note: In the above list refer to “data” as a singular – i.e. “data has”. I know this is wrong. I did it on purpose for the great good of reading.)

Cannot login to Nighthawk modem router admin page

I have a NETGEAR D7000 Nighthawk modem router and you can login to the admin screen via the IP 192.168.0.1 or URL http://www.routerlogin.net/.

The problem is, when I try to login on Chrome I get an error page “This page isn’t working – www.routerlogin.net sent an invalid response” with “ERR_INVALID_HTTP_RESPONSE”:

The fix is easy:

Use the FireFox browser.

There must be something in the page that Chrome doesn’t like, bit FireFox is happy to load the page.

Predictable Links to Multiple GSuite/GMail Accounts

I run multiple personal and business domains with Google mail accounts.

I want to create links (both synced in Chrome bookmark bar and in a web page) to each mail account that I know will always take me to the account I want, even when accessing from different devices (I have a minimum of 2 primary laptop devices I login from regularly).

There is a URL schema Google uses to generated each logged-in account – e.g. https://mail.google.com/mail/u/0/#inbox (then increment the number for each inbox) – but if don’t login to each account in the exact same order on each device, then they get out of sync.

 

Today I found a solution.

To access the desired mailbox via a predictable URL, use the following template: https://mail.google.com/mail/u/?authuser=user@gmail.com.

Change the user@gmail.com to the actual email address.

This also works for emails in custom GSuite domains (e.g. my jsnelders.com domain), because underneath all @gmail.com and GSuite domain emails redirect back to the same number based URL template I originally mentioned.

I also figured out the URL to link to a specific Google Calendar is: https://calendar.google.com/calendar/?authuser=user@gmail.com.

Again, the URL will cause a redirect.

 

I’ve only tried these with accounts I’m already logged into. I’m not sure what happens on a new system where you haven’t logged in yet, but I expect they should still work just fine.

 

Resources

I originally performed a search for “link url to multiple gmail account” which lead to to answers at:

 

Update (same day): I somehow logged myself out of all Google accounts in Chrome while trying to re-establish a sync between computers. So mail account links I setup started going to the same Gmail account (the account I setup for the sync). But after logging back into each of my GMail/GSuite accounts all the links worked fine again, so I reckon that’s a validation the permalinks work.

Uninstall/remove Spotify on Windows 10

This is mainly a post for my own reference.

I had trouble uninstalling the Windows 10 Spotify application from an old system.

Going into Control Panel\Programs\Programs and Features and trying to uninstall simply wouldn’t do anything.

A quick search lead me to https://community.spotify.com/t5/Desktop-Windows/How-to-permanently-uninstall-Spotify-on-Windows-10/td-p/1697157 which had the answer.

Here are the steps you need to take:

  1. Open Windows Task Manager and kill the “Spotify Web Connector” process (It will be something like SpotifyWebConnector.exe or SpotifyWebHelper.exe – sorry, I forgot to note the exact name before writing this post, but it will be obvious in the process list).
  2. Disable your network/internet access (turn off/disconnect your wireless or pull out your network cable).

Now you should be able to uninstall Spotify. Just be patient give it a few seconds when you first try – there’s going to be a bit of a delay before the confirmation dialog comes up.

Don’t forget reconnect your internet access.

Microsoft All-in-One Media Keyboard: How to Print Screen

I have a backup “Microsoft All-in-One Media Keyboard” I need to use when my primary Ergonomic Wireless Desktop keyboard decides to die (possibly “concussion” induced at 11pm when technology decides to become my Nemesis).

The only problem is it does not come with a Print Screen button.

But thanks to some wonderful soul on the Interwebs we have an answer:

Print full screen: Fn + Windows Key + Space
Print current window: Fn + Alt + Space

Source: Microsoft Answers

Install XML RPC for PHP 7.2 on Ubuntu Linux

Background

One of the components in a web application solution we’re developing uses xmlrpc_encode_request() in PHP.

It was executing fine in most of our systems systems – development and multiple test servers – but while trying to run it for the first time in my development environment I received the following error:

Fatal error: Uncaught Error: Call to undefined function xmlrpc_encode_request()

So off to Google I go and, find a few answers, have a couple of mis-starts, then finally get it working.

 

Solution

The solution was very simple.

  1. Install the xmlrpc extension.
    sudo apt-get install php-xmlrpc
  2. Restart Apache web server
    sudo service apache2 restart

As a sanity check, create a PHP file (e.g. info.php) and add the following:

<?php
echo 'XMLRPC is ', extension_loaded('xmlrpc') ? 'loaded' : 'not loaded';
?>

When you run the file it you should see “XMLRPC is loaded” if all is good.

If you’re still having trouble, try updating your php.ini file to include:

extension=xmlrpc.so;

and/or

extension=php_xmlrpc.so;

Unfortunately, if you still have trouble then I apologise and suggest hitting Google/Bing/DuckDuckGo/StackOverflow again and playing around with search terms that meet your specific Linux/OS/PHP versions.

 

More Background

I started with a search for “Fatal error: Uncaught Error: Call to undefined function xmlrpc_encode_request” then “lamp Fatal error: Uncaught Error: Call to undefined function xmlrpc_encode_request”, and had these results:

But they were aimed at PHP 5.x (by the way, if you’re still on PHP 5.x then update! It’s no longer supported and you’re now a security risk).

Then I refined my search to “apt-get php 7.2 xmlrpc” and had:

And I found the helpful suggestion for the info PHP file (you could also just run phpinfo(); in a file) at:

Application window disappearing off edge of monitor (Windows 10)

In the last week I’ve had 2 instances of opening an application/program opening in Windows 10 and disappearing off the edge of one of my monitors.

My workstation is a HP OMEN gaming laptop with 2 attached monitors in a horizontal row. Unplugging monitors did not cause the hidden window to reappear.

 

The solution is reasonably simple.

1. Hold down the shift key and right-click on the application icon in the Windows task bar.

2. A context menu will appear. Select the “Move” option.

3. Immediately hold down the left mouse button. This will have the affect of selecting the title bar of the application and activating the ability to move that application’s window.

4. Still holding down your left mouse button (the primary button), move your mouse left and/or right and you should soon see your missing program window appear on the monitor.

(In both instances my application disappeared of the right side of my right-hand monitor. This may vary for different people.)