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.)


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.

As usual, too many projects at once …

I wanted to learn node.js and a related framework to learn how to make single page applications (SPA). I’m not convinced they will replace traditional call-and-response websites with separate pages for actions, mainly because connection speeds can only get faster and page lag time will decrease, minimizing one good reason for the AJAX calls. However, I should know how to build an SPA. I did not want to get involved with Angular and its A/A2 schism because I have the uncanny ability to pick the losing side. I decided to wait on Angular and try Ember.

I installed node, ember and the related libraries. I went through the tutorial in the Ember website. I was doing fine until I hit the last section concerning handlebar helpers. I could not get it to work as expected. Usually, my problem has to do with typos, but I could not find one this time. I moved on to the next section on autocompleting components, but the tutorial site stopped working. I decided to search for other tutorials.

While searching, I realized that I needed some idea to develop into an SPA. I decided to try something like chess ratings only for other games. There’s a local game group that plays lots of games, so getting sample data would not be hard.

i started creating a page flow diagram with index cards. I also modeled some database tables (also with index cards). I keep running into the same stumbling block: authentication and authorization. Since everything lives on the client in an SPA, I’m not sure I should save session data to the client. An expiring token seems to be the way to go, but I have not found something simple to connect ember to some engine that creates those tokens, besides OAuth2 through Facebook / Google. That would be useful to learn, but it could be too much to learn all at once.

Authentication and authorization make me wonder if I should even consider creating an SPA. I know that SPAs slow down when hitting CPUs. I’m wondering how much they will slow down with constant data access caused by database calls. Hmm…

OR who cares about authentication for login. All that matters is authentication / authorization for use of the data inputs / outputs -> does that imply code to review authentication on the server, before writing to server?

So many more things to think about …