19 September 2017

Enable Yum Repositories on CentOS

NB: This may break your install if they've been disabled for a reason e.g. on a bespoke Linux

If the yum repos containing the packages you need are disabled by default:
  1. Find the version of CentOS:
    cat /etc/issue
  2. List the installed repos:
    yum repolist all
  3. Enable the repository in the config file e.g.:
    1. Copy original:
      cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.orig
    2. Edit file:
      vi /etc/yum.repos.d/CentOS-Base.repo
    3. Initiate INSERT mode: i
    4. Make necessary changes in the first repo:
      Uncomment (remove #) from baseurl=http
      Replace centos/$releasever with the version e.g. centos/7.2.1511
      enabled=1
  4. Update the repositories:
    yum update
    1. Install yum-utils:
      yum install yum-utils

    05 September 2017

    Favicons

    Favourite Icons aka Favicons

    Using Gimp

    Create the Original High Res PNG

    You can use whatever size you like but remember it's going to be reduced to a poultry 16px.
    • Create or download from ClipArt e.g. Clipart Library
    • Ensure you have transparency (alpha channel, represented by grey check squares)

    Save as Gif

    • Resize the image to the highest size you need e.g. 64, 48, 32, 16 px square.
    • Export as Gif e.g. favicon-64.gif, favicon-48.gif etc

    Layer the Files

    NB: If the colours are messed up in the new layers, change the image mode to RGB (Image, Mode, RGB)
    • Open the highest res gif e.g. favicon-64.gif
    • "Open as Layers" the other files (48, 32, 16)

    Export as Favicon

    • Export As and choose Microsoft Icon
    • Optionally compress them further at this stage

    30 April 2017

    Node.js Install Secific from NPM or Git

    Whilst carrying out an upgrade of an Angular2 to v4 andfollowing  instructions on the Angular blog "Updating to 4.0.0" I ran the npm install command to update Angular2 to 4:
    npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest --save

    However you get the error:
    npm WARN @angular/core@4.1.0 requires a peer of zone.js@^0.8.4 but none was installed.

    Trouble is the latest version of zone.js on Git was v0.8.9 when we need 0.8.4

    Install Specific Version From NPM

    You can install a specific version from npm:
    npm install <package>@<version>
    npm install zone@0.8.4 --save

    Install Specific Version from Git

    To install the specific tag from Git directly run:
    npm install git+https://github.com/angular/zone.js.git#v0.8.4 --save

    Note the format: git+; then the github normal clone url; a hash; a v; the tag name; and --save to set it in project.json

    12 April 2017

    Windows: Clear Disk Space

    Left to its own devices, Windows will happily fill up whatever drive you put it on. Latest versions are better, but still leave unnecessary bloat around e.g. Windows Updates. Cleaning up these files is particularly important when you are running virtuals.

    Where Is Space Being Used

    Use a program like TreeSize Free to find where your space is used up.

    Clean Up Disk

    Use "Disk Cleanup" program included in Windows to clear space on drive C. 
    NB You'll need to run it twice: once as normal used, then select 'Clean up System Files' to run it again and review the options.

    Clean Up WinSxS

    Windows keeps removable files in C:\Windows\WinSxs which is often quite large.
    Using a command prompt as admin:
    Dism.exe /online /Cleanup-Image /StartComponentCleanup

    13 March 2017

    Mac: Dual Boot With Windows 10

    NB: This procedure has the potential to render your machine useless. Make sure you have external backups of your data and OSX install media before you begin.

    Run Disk Utils Disk First Aid

    You need to do this to check for errors. If there are any you'll have to fix them first.
    In my case that meant:

    • Running at boot time via restart with Cmd R held down. 
    • Restoring from my Airport Extreme Time machine backup
    • Re-installing MAC OSX from the local backup as I'd excluded Applications from the TM backup.
    Boring but still, after all that my machine was back up.

    Install Windows

    • Open Bootcamp and run through the procedure to 
      • Download and create a bootable Windows USB drive
      • Introduce a new Windows partition
    • Once that's done, you can boot from the USB (Power on with Alt/Option key held down)
    • Install Windows, delete the Bootcamp partition and create new partitions using Windows' Setup (create's two: Drive 0 Partition 4 and Drive 0 Unallocated Space). See the note below.
    A note on partitions: After installing Windows I found the install failed with a message about being unable to write to the Boot partition. Some people online suggest doing the procedure twice: Bootcamp partition, install, fail to write, 2x PRAM reset, destroy the partition using Bootcamp, re partition. I can't be sure as I had to repeat the process anyway.

    Enable Virtualisation in Windows

    If you need HyperV then you might find you don't get it on the Windows side:
    To avoid: "Could not set boot device property: 0xe00002bc":
    Back in OSX:
    • Download and extract rEFind
    • Edit the config: sudo vi refind/refind.conf-sample
      • Un-comment enable_and_lock_vmx and set to true
      • You might want to reduce the timeout
    • Install it: sudo ./refind-install
    Re-enable SIP.

    12 March 2017

    Mac: Create Bootable SD from ISO

    Using Ubuntu as an example: https://www.ubuntu.com/download downloaded to Downloads folder.

    Download Ubuntu and Create img file


    Create Bootable SD from img file

    • Disk Utility: Erase the SD Card (not sub partition) select:
        Name: (Optional) e.g. UBUNTU
        Format: MS-DOS (FAT)
        Scheme: GUID Partition Map
    • Unmount any partitions, but leave the drive itself mounted
    • Terminal: cd to location of downloaded img
      cd Downloads (ls to check)
    • List disks:
      sudo diskutil list
    • Note identifier of SD card found by disk size e.g. disk3s2
    • Unmount:
      sudo umount disk3 && sudo umount disk3s1 && sudo umount disk3s2
    • Copy image across:
      sudo dd bs=4m if=ubuntu-16.04.2-desktop-amd64.img of=/dev/disk3
    • WAIT: It could take around 20 minutes with little indication it's happening.
    Now try your boot: Reboot and hold down Alt/Option key to select the boot disk.



    28 February 2017

    Firefox Responsive UI

    When designing and building websites we need to consider multiple screen resolutions and platforms e.g. iPhone Safari browser, or Pixel C Android tablet in landscape mode.

    Resolution Design Mode
    Firefox has an excellent Resolution Mode that allows you to select a variety of resolutions. You can also import more:

    1. In Firefox go to about:config and accept the risk
    2. Right click and select New, String, 'devtools.responsiveUI.presets'
    3. Enter the new values e.g. Thanks to Geoffrey Liu for this version
    4. Close any RDM tabs and re-open them to see the new options
    User Agent
    When changing the resolution we may need to also change the User Agent. Firefox has a plugin for that: written by Chris Pederick User Agent Switcher: download, install and add the list of user agents.
    You can check your UserAgent at UserAgentString.com