I should have known that.

Recently, I upgraded my laptop to run macOS Sierra. Along with the OS updates, I also used brew to update python3. I was not paying attention and ended up upgrading PostgreSQL to the newest version, 9.6.2. I was unhappy that I was not paying attention, but I was glad that upgrades to PostgreSQL and MongoDB were also done with the upgrade to Python 3.

I use brew to start and stop PostgreSQL as needed, so I started it to check to see how it ran after the update. ‘psql’ gave me a version number, but I could not get it started to show me the schemas or tables from previous work. I also saw the following error message:

psql: could not connect to server: no such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/tmp/.s.PGSQL.5432”?

Very strange error message, so I started doing Google searches to see what could be wrong. There some dead ends involving checking for a PID file and checking permissions in /usr/local/var/postgres. Eventually, I ran into what looks like the answer in two related locations: a blog post describing upgrades to PostgreSQL and another one describing the upgrade process using brew. Apparently, I had two versions of PostgreSQL on my machine.

> brew info postgresql

confirmed it. Both pages described what I have to do, so I’ll do it. I should have known I needed to do this. Now I know.

Advertisements

Windows 7 updates, resolved

I’ve had some trouble with Windows 7 before. (tl;dr: I installed W7 on a VirtualBox VM. After several different mistakes, it finally installed, but no updates are downloading.) After some review and investigation, it looks like Windows update is working finally. I learned quite a bit.

For starters, it turns out that I had Windows 7 Service Pack 1 installed right from the DVD. That saved some problems, but I feel foolish for not knowing that.

I kept trying google searches to figure out what was going on with the Windows update problems. Eventually, after several months, I stumbled across a pinned reddit post that explains what to do. It makes sense and I compare it to other search results. Those other pages independently confirm what I need to do: download and install a series of software update rollup files and install them piece by piece. If I do it correctly, it will work.

I quickly have trouble with an ActiveX control. For some reason, I’m asked to install an add-on named “Microsoft Update Catalog”, even though I already have it. It’s already enabled, but not appearing in the list of running add-ons in IE 11. Fine, I switch to Chrome and continue downloading what I need.

Downloading the msu files takes time. I even set up a snapshot at one point to make sure I could roll back when one update’s notes described several errors with fixes requiring updates to registry files. I worked my way through April 2015, March / July / August / September / October and November 2016 updates and I’m ready to let Windows check by itself. It works! 29 additional updates had to be downloaded and installed. I did not have to find them. Finally!

Next steps:

  • Clone the Windows VM
  • Authenticate the Windows installation in the cloned VM (I’ve had to do this once already on a VM that I eventually kicked out the airlock.)
  • Install SQL Server 2014 available from Visual Studio Dev Essentials
    • Can I say how impressed I am with the Microsoft developer tools? I’ve always been an Apple guy, but I have not been excited about Xcode and Swift 3. The Microsoft stuff is new to me, so it looks exciting.
  • Study and practice for the MCSA exams in SQL Server 2012/2014

Interesting GitHub question

I have most of my private repositories hosted on BitBucket.org. They provide free space for private repos. GitHub requires a paid plan to host private repos. I have lots of private repos. However, it seems that everyone wants to see coding samples. GitHub no longer requires a paid plan to host public (open source) repositories, so why not take a fresh look?

I don’t want to show off all my mistakes in the public GitHub account, so I’m keeping the private BitBucket account. How do I push additional BitBucket snapshots that are sort-of cleaned up to the public GitHub account?

Step 1: Set up a public GitHub repository
That’s easy. I already have a GitHub account that I used when I was taken the Berkeley Coursera class. The account was private while I was taking the class, but became public when the class ended. Setting up a new repo in GitHub is easy and they provide help pages if you have questions.

Step 2: Figure out how to push the local repos
I already use GitHub Desktop (for Mac) to clone tutorials. In the end, I decided not to use it to clone and push the BitBucket repos to GitHub because I was concerned the alias to BitBucket would be overwritten.

Step 2a: Use the command line interface to create another alias
GitHub (and BitBucket) will automatically create a remote alias when creating a remote repository and use it to push snapshots up to that repository. I’m already using that alias (origin) and was concerned that GitHub Desktop would overwrite the alias to github if I reset it using GitHub Desktop. However, I can use the CLI to create a new alias.

> git remote add github git@github.com:rachavez/tournament-score-keeper.git

When I check the aliases using “git remote -v”, I see another set of aliases pointing to a different server.

So, while I’m stuck with dead end and intermediate steps, commits go to BitBucket. Once I figure everything out and arrive at a good stopping point, the commits all get pushed as a block to GitHub.

> git push github master

I can live with it. Even better, I noticed in SourceTree (Atlassian/BitBucket’s Mac desktop app) that the new alias appears in the remotes list. Potentially, I could update SourceTree settings to go back and forth between both repositories. Interesting.

Adventures with react and webpack

I decided it would be useful to relearn front-end web design/development. The big thing now is Javascript and various frameworks associated with it. I did not pick Angular, partly because of the schism between Angular 1.0 and Angular 2.0. “Schism” is a little harsh, but I don’t like how you have to pick a side to work with Angular and the people on the other side won’t help. It reminds me of the Python 2/3 split, but that’s slowly being healed.

Anyway, instead of Angular, I decided that Ember was the way to go. However, when I looked around, I did not see many Ember projects taking place. That’s my usual luck: given a choice in tech, I’ll pick the unpopular one.

I also started volunteering in an open source “collective”(?) for the presidential elections. I told them I had LAMP experience. They are interested in mobile experience. The first project I joined wanted React people. I did not know React, but I saw that it was popular, so I decided to learn it.

So, I’m learning React and React router, which seems necessary for SPAs. I decided to implement what I’ve learned in a little project for testing purposes. I have a group of friends that play board games. They like to get together over long weekends and play lots of games. Based on the game results, someone is declared that weekend’s winner and gets … a tournament cup. My thought was to build a React application that could track the tournament scoring.

So, I read a couple of React tutorials and I set up a new site following their model. My code almost matches theirs, but I can’t get it to load. I see that webpack can collect and load the files, so I include that. I (finally) get webpack working, after fixing many typos. Now I want to get a sample page working with bootstrap 3.

That turns out even more difficult. Fortunately, the collective had figured what to do, so I followed their config file and eventually made my file links to bootstrap work. Lots of additional stuff is required to get bootstrap to work properly.

  • babel: expected, since I’m using Javascript and webpack
  • style-loader and css-loader: What? Umm, OK. It works for the custom CSS file, but won’t load the bootstrap file properly
  • file-loader for the bootstrap glyphicons: Umm, OK.
  • url-loader for the woff2 and woff files: What are those?

It all works again, but wow, what a mess.

Adventures with Windows, part 2

As I mentioned earlier, I had trouble loading the free update to Windows 10. I now have a 5 GB file in my Windows 7 instance, but it never finished installing. It was stuck on 99% complete install for hours. I grew frustrated and decided to punt on the install.

Some websites mentioned that the Windows 10 update needed a fully patched and updates Windows 7 system in order to finish installing. It’s possible that may be true. It’s definitely true that I needed to patch Windows 7 as soon as possible. After installing an antivirus program (Avira) along with FireFox and Chrome, I decided to run the Windows update.

That did not go well either. I selected Windows Update from the Windows Control Panel and the “Other Programs” list on various occasions. I never got the impression that anything was happening. From other websites, I knew that the initial Windows update should take roughly 90-120 minutes. I would run Windows update 3 hours with  no indication that anything was happening.

I decided to try to install Windows updates directly from the browser. My browser was immediately updated to IE 11. Immediately is relative. It still took roughly 90 minutes to download and install 14 updates for IE 11 only. Once it was done, I went back to update.microsoft.com to see if that would list files to download. I was told to set the update back to Windows Update. I did not know any better, so now going to update.microsoft.com bounces me over to Windows Update again.

I may try downloading Windows 7 SP1 by itself. Maybe that will take care of some of the missing updates. It’s possible my home download speed is too slow to download any information quickly enough. It would be nice to go somewhere with a big pipe and not a lot of traffic. Where could that be?

Cleaning up Mercurial & Git repos

Recently, I cloned a repo that I created on my laptop and pushed to Bitbucket back down to my desktop. At that point, I discovered that I had included all the vendor files for the project within the repository. That’s a no-no. It’s a waste of space, mainly because the dependent libraries can be downloaded by running composer once the new clone is created. So, I decided to remove the vendor files from the repository without dropping them from the file directory.

I thought I had solved the problem by updating Mercurial’s .hgignore file, which is used by Mercurial to mark which files and folders to not track. Unfortunately, the vendor files had been included in the initial repository creation. Going forward, .hgignore would ignore new files and folders in the vendor directory, but I still needed to forget the files already listed. It turns out that ‘hg forget file_name’ would do the trick.

I wanted to be sure it worked, so I created a ‘tests’ folder and touched a file inside that folder. Sure enough, the file appeared in Mercurial’s commit list. I ran a commit, then tried

> hg forget a.php

This removed the file from the committed list, but the file still appeared in the staging area, which did not make sense. When I updated .hgignore to not track the ‘tests’ directory, the new file disappeared from the staging area. That’s what I wanted.

I now had all the files in the vendor directory for forget. I moved to the vendor directory and entered the following command to forget the .json files:

> hg forget -I **.json .

That removed the .json files from the commit list. I did the same for .js, .map, .txt, .conf, .tpl, .yml, .css and .html files. Oddly, only one .php file was forgotten in this manner in the vendor directory. I wonder what might happen if I try ‘ > hg forget -I vendor/** .’ ? (I may try that if I have to clone this repo again.)

Git

It takes less command line work to forget files in git. This command did it all:

> git rm -r –cached vendor

where rm (folder remove) -r (recursively) –cached (from index only) vendor (the folder name). That’s much easier.

Adventures with Windows 10: part 1

Microsoft announced that free upgrades to Windows 10 would end on July 29, 2016. I bought a full copy of Windows 7 to load onto a VirtualBox Virtual Machine several years ago, but never got around to installing it. I realized that this week would be a good time to get that project started and finished.

A while back, I created a ISO file of the Windows 7 installer DVD. I know that my current laptop does not have an optical drive, but the older one (the one with the failing trackpad) does. I suspect I bought the installer when I had the older laptop, but I also knew that I would need an ISO, if not for a new laptop, then for the desktop, which also does not come with an optical drive. (Weird.)

I created a new VirtualBox Virtual Machine to handle Windows 7. I remember I created a virtual optical drive in the virtual machine settings and attached the ISO to that virtual drive. Everything looks ready. Let’s start. Immediately, I get a message saying “Failed. No bootable medium found.”

I aborted and checked the settings again. There was a google search that suggested I hit the F12 key during boot up. That may have solved some issues, if I had tried it. I knew I needed an external optical drive any way, in case I sell or destroy the old laptop, so I drive down to the local Apple store and buy an overpriced optical drive.

I come back home and attach it to the new laptop. I can see the Windows 7 optical disk in the finder. I misunderstand how to load it in the Virtual Machine settings and end up starting the installer from the ISO. I know because if the installer were using the disk, I should have heard spinning sounds from the optical drive, which I did not.

It looks like Windows 7 is installing this time. I know it’s supposed to reboot to finish installation. What slips from my mind is that the second time, it’s supposed to reboot from the hard drive, not the ISO / optical drive. I keep interrupting the boot process by manually booting from the optical drive. It turns out that I installed several copies of Windows 7 into the virtual hard drive until I ran out of space.

I can see this is not working, so I start over with a fresh Virtual Machine. I decide not to add a virtual hard drive after realizing that the link to an optical drive already existed. When I start the blank windows machine this time, I was asked to pick a bootable drive. I was given the option of the drive with the Windows installer or the ISO (?). I pick the drive and go through the installation again, along with my extra second installation from the optical drive after reboot.

I read a bit online. (Google is your friend.) At this point, I realize that I need to let the reboot work without interference from me. I wipe out the Windows partitions created by the Windows installer and start over.

Finally, the Windows 7 installer works. I have a running Windows 7 instance running in VirtualBox. Next steps:

  • upgrade to Windows 10 for free – nope, 99% freeze. See next post.
  • load an anti-virus application – I’ve done research on free AV
  • load all other windows updates – nope
  • install Firefox and Chrome – eventually

All of that is for another time.