web analytics

Mick

Creating a Static Web-site from a WordPress Blog

by Mick 0 Comments

I have an old WordPress Blog that I created circa 2005, which is no longer updated. In order to remove the need to (constantly) update the version of WordPress, themes, plugins etc. and to create a version suitable for archival purposes, I decided to convert the blog to a Static web-site.

It was difficult to find a suitable WordPress plugin to do the job so I deciced to look for alternative approaches. One way of doing this is to use a software application such as HHTrack, a free (GPL, libre/free software) and easy-to-use offline browser utility, that will create a copy of
a web-site on your local computer.

https://www.httrack.com

It allows you to download a World Wide Web site from the Internet to a local directory, building recursively all directories, getting HTML, images, and other files from the server to your computer. HTTrack arranges the original site’s relative link-structure. Simply open a page of the “mirrored” website in your browser, and you can browse the site from link to link, as if you were viewing it online. HTTrack can also update an existing mirrored site, and resume interrupted downloads. HTTrack is fully configurable, and has an integrated help system.

The existing blog consists of just under 600 posts/pages and has approx 150MB of media files.

Before starting, I backed up the WordPress directory and related MYSQL database on the server.

An initial run of HTTrack successfully created a version of the blog as a static web-site that seemed to work OK and highlighted a number of issues and limitations.

  • Comments do not transfer – This is not a big issue for me, although it should be possible to come up with a suitable work-around for handling these if necessary.

The first thing I did was to check the WordPress plugins being used, removing those that were not relevant for a static website. I also wrote a small plugin to remove/disable the current Responsive Images feature in WordPress.

It was interesting to note a variety of different techniques used for embdedding YouTube videos in the blog pages – this was caused by differing techniques evolving over the time that the blog was written (10 years+) and I decided to ensure they were consistent through the site using the embed code provided from the YouTube site.

I also decided to migrate the blog from HTTP to HTTPS as part of the exercise. The WordPress theme being used has some hard-coded urls using HTTP so I edited these to use HTTPS.

I then ran the HTTrack utility to create a local copy of the blog, in fact I ran the utility a number of times checking and tweaking details in the blog between each run. The utility provides a helpful log of warning/error messages that occur during the run

Final steps included mass-file editing of the local files to convert HTTP references to HTTPS and other clean-up operations on the final files.

I also created a zipped up copy of the original blog files and MYSQL database, which have now been archived, in case I ever need to return to the original blog.

1 item not addressed during this process was how to handle referenced URLs which have expired. An expired URL is one which is no longer valid because the original destination has changed or disappeared completely. I have a few ideas how to handle this phenomenon if I can ever find the time to explore it further.

Other Links

http://redirectdetective.com/creating-redirects.html

Internet Shortcuts to HTML file – Python

by Mick 0 Comments

I had problems with the DOS batch file version of this utility so decided to replace it with a more robust version written in Python.

import os
import time
import datetime

# Converting all url files in directory and sub-directories to a single html file

tim = datetime.datetime.now()
tim1 = tim.strftime("%d-%m-%Y")
day = tim.strftime("%d")
mth = tim.strftime("%m")
year = tim.strftime("%Y")

tim2 = tim.strftime("%H:%M:%S")
nameOutput = "Links"+day+mth+year+".html"
nameList = "Links"+day+mth+year+"_list.txt"
print 'Generating list ' + nameOutput +' at '+tim2+' on '+tim1

dir_path = os.getcwd()
listFile = open(nameList, 'w')

with open(nameOutput, 'w') as outputFile:
  outputFile.write( '<h1>List Generated at '+tim2+' on ' + tim1 +'</h1>')

  for dirName, subDirs, files in os.walk(dir_path):
    outputFile.write( '<h3>'+dirName+'</h3>\n' )
    outputFile.write( '<ol>\n' )
    for name in files:
      if name.endswith(".url"):
        with open(dirName+'\\'+name) as fh:
          base, ext = os.path.splitext(name)
          for line in fh:
            if line.startswith("URL="):
              href = line.split("URL=",1)[1].rstrip('\n')
              #href.rstrip('\n')
              outputFile.write( '<li><a href="'+href+'" target="_blank">'+base+'</a></li>\n' )
              listFile.write( href+'\n' )
              break
    outputFile.write( '</ol>\n' )

listFile.close()

When invoked, this version will go through the directory and all sub-directories to generate an html file of all the URLs it finds. It will also create a list of the URLs in a separate file.

eMail Archiving and Outlook

by Mick 0 Comments

I have a number of email archives, in total about 5GB, stored as .pst files from Microsoft Outlook and going back to around 1998.

Without a copy of Outlook, the files have been pretty useless, just taking up space, but now I have an Office 365 subscription I can view and access them again.

A couple of points to note:

Using Outlook with your Microsoft account

My Microsoft ID account has 2 step verification enabled so that when I have installed Outlook on my laptop connecting to my Microsoft account requires me to generate an app password to use rather than my normal account password. This is because the app can’t prompt you to enter a security code when you try to sign in.

If you try to use your normal password you just get repeated requests to enter your password.

  1. Go to the Security basics page and sign in to your Microsoft account.(https://account.microsoft.com/security)
  2. Select more security options.
  3. Under App passwords, select Create a new app password. A new app password is generated and appears on your screen.
  4. Enter this app password where you would enter your normal password.

Outlook blocked access to attachments

Some of the emails in the .pst files had attachments which Outlook refused to display due to security concerns.

I came across a method for enabling access to these attachments by making a change to the Windows Registry (Windows 7)

Only modify the Registry if you know what you are doing!! Serious problems might occur if you modify the registry incorrectly. Before you modify it, back up the registry for restoration in case problems occur.

Add a new string value Level1Remove to the registry key

HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Security

where the value(s) are the file extensions separate by ; eg: .exe; .url

To block specific file types add a new string value Level1Add instead.


On a separate issue, also came across an article on enabling the “Group Policy Editor” (gpedit.msc) in Windows 7 Home Edition – although the original article does include the following disclaimer.

DISCLAIMER: This tutorial has been shared for the sake of knowledge sharing. Patching system files or using 3rd party software might be dangerous for your computer. We do not recommend it and we’ll not be responsible if it harms your system.

https://www.askvg.com/how-to-enable-group-policy-editor-gpedit-msc-in-windows-7-home-premium-home-basic-and-starter-editions/

Internet Shortcuts to HTML file

by Mick 0 Comments

While trawling around the web, I often save shortcuts to websites that I’ve visited .

Each shortcut is saved as a special filetype with the suffix .url and is recognised by Windows as an Internet Shortcut. The name of the file is a description of the link (usually) taken from the contents of the webpage title html tag and the contents of the file include the actual url.

For example,

openEyes – Eye tracking for the masses.url

has the following contents

[InternetShortcut]
URL=http://thirtysixthspan.com/openEyes/

I came across a technique for combining one or more .url files into a single .html file originally described on the mozillaZine website (http://mozillazine.org) in the forum post

Convert links: desktop shortcut to bookmark?

This describes a method using a DOS batch/cmd file to automate the process (I’d forgotten how powerful DOS batch/cmd files can be). Here is my modified version, saved into a file called url2html.cmd:

@echo off
setlocal enabledelayedexpansion

cd /d "%~dp1"
set output="LINKS_%RANDOM%.html"
echo ^<ol^> >> %output%
for /f "tokens=* delims=" %%t in ('dir /b "%~dp1*.url"') do (
     set strLine2=%%t
   type "%%t" | find "URL=" > u2htemp
   set /p strLine1= < u2htemp
    echo ^<li^>^<a href="!strLine1:~4!"^>!strLine2:~0,-4!^</a^>^</li^> >> %output%
)
echo ^<^/ol^> >> %output%

del u2htemp

This code can be run as follows from a command line prompt:

C:\mutils\url2html.cmd "c:\urls\openEyes - Eye tracking for the masses.url" 

and will add all url files in the same directory of the specified url to a single html file.

It is set up in this way so that it can be easily invoked from Windows File Explorer from right clicking on a .url file and selecting the Send to option. This can be enabled as follows:

Open the Send to special folder ( e.g. by using WindowsKey-R and typing shell:SendTo ) and dragging a shortcut to your newly created .cmd file there. The command url2html will then be added to the Send to option.

There are some interesting points to note regarding some of the commands used in this script.

setlocal enabledelayedexpansion

I found a description of this, with an example, at EnableDelayedExpansion

Delayed Expansion will cause variables within a batch file to be expanded at execution time rather than at parse time, this option is turned on with the SETLOCAL EnableDelayedExpansion command.

Variable expansion means replacing a variable (e.g. %windir%) with its value C:\WINDOWS

By default expansion will happen just once, before each line is executed. The delayedexpansion is performed each time the line is executed, or for each loop in a FOR looping command. For simple commands this will make no noticable difference, but with loop commands like FOR, compound or bracketed expressions delayed expansion will allow you to always see the current value of the variable.

When delayed expansion is in effect, variables can be immediately read using !variable_name! you can still read and use %variable_name% but that will continue to show the initial value (expanded at the beginning of the line).

Another interesting concept is the handling/interpretation of arguments passed to the cmd file.

cd /d "%~dp1"

This is used to attach to the directory containing the url file passed as an argument when executing the cmd file.
The modifier %~dp1 expands the first argument – the url filename and extracts the drive letter and path.

Details can be found from Microsoft at
Using batch parameters

5.1 Surround Sound in VLC Player

by Mick 0 Comments

Using a Cambridge Soundworks Desktop Theater 5.1 DTT2200 sound systems with my PC (Windows 7).

Set up all speakers and check that they are all working at the system level

Instructions to set VLC media player to play through all speakers as follows:

Open VLC preferences (Tools…Preferences) and under the “Show settings” section, select All.

Under the Audio section expand the Output modules section and select DirectX (or Dolby Digital)

Pick the output device you’re using, which has been set up for 5.1 sound, and specify the Speaker configuration as 5.1

Save the preferences and restart the VLC player. Audio will be played using all the speakers.

References

VLC media player

VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols.

http://www.videolan.org

DTT2200

User guide available

DTT2200 User Guide (pdf)

(from http://files2.europe.creative.com/manualdn/Manuals/TSD/727/English.pdf )

3D Printing a Replacement Door Handle

How I created a new handle for my fridge/freezer by 3D printing a new one.

This handle is used to open the freezer door in a combined fridge/freezer. The current handle has been hanging on by a thread for a while and been through 2 repairs previously, but now it’s no longer viable.

3D Printing - the broken part

At first I thought it would be easy enough to get a replacement handle, so contacted the manufacturer of the fridge/freezer.

Good Morning,

Thank you for your email.

The part you require is discontinued without replacement.

Sorry for any inconvenience caused.

“For help with your home appliance trust ******** Customer Service. Service you can depend on.”

Inconvenient? Yes it’s a bit difficult to open the freezer when it doesn’t have a handle – but at least I can, just about, open the fridge without the handle.

DSCN3833

Seems a shame, though, to have to replace the whole fridge freezer for want of a handle.

It is possible to locate an equivalent handle (genuine part) but, unfortunately, only in white.

whitehandle

It looks like I need to make my own handle. Is it possible to use 3D Printing to print a new handle ?

Design

First thing to do is to create a 3D model of the handle.

I have used a number of different 3D CAD Modelling programs in the past but for this job I’ll be using Onshape a full-cloud, online 3D CAD system used from a web-browser.

It is straightforward to create a fairly close representation of the required handle and I completed work on the design/model in about an hour. I didn’t come across any particular difficulties with the modelling or any problems using Onshape during this process.

modelhandle

I also did a couple of quick renders using OneRender https://www.onerender.com , an online rendering application which works with Onshape.

11430-rendered-60447_gi

11430-rendered-60449_gi

Looks OK to me.

3D Printing

In order to generate a file suitable for 3D printing, simply export the model from Onshape in STL format. Then either use your own printer or, as in my case, upload the STL file to your favourite online 3D Printing service.

I haven’t used an online service in the past so I’m going to try i.materialise

It’s simple to register and upload your model.

Here it is

order

Not sure what the best material is to use for this application, but thought I’d try Polyamide which appears to have similar strength properties to ABS (but perhaps a bit more flexible). The manufacturing process for this material uses Laser Sintering.

Laser sintering is used to build your design with this material. The models are printed layer by layer by a laser that draws thin lines in the powder, which melts and bonds it together in order to form a thin layer of the model. After a layer is printed, a new layer of fresh powder is spread over the surface by a roller. The printer has a print chamber that is heated to just below the melting point of the powder; the laser beam adds the extra energy to melt the powder, forming a solid model. After a print job is finished, the result is a big block of heated powder with the printed models contained inside.

Also chose a polished and dyed black finish.

iMaterialise also provides an Analysis option which checks whether your model can be printed and highlights any potential problem areas.

Looks good to go

analysis

so submitted the order.

It’s probably taken less time creating the part and sending it off for printing than trying to find the exact equivalent original (genuine) part.

If my 3D printed model does not prove to be “fit for purpose”, at the very least it should establish whether the 3D model (design) is good enough.

The only problem now is having to wait 2 weeks before I can get my hands on the new 3D printed handle ….

…. 2 weeks later

I received the following parcel today, what could it be ?

DSCN3835

Nicely protected and here it is – looks promising.

DSCN3837

The new handle can be compared to the original. The actual modelling is a good match to the original design, but of course, the surface finish of the new one doesn’t (exactly) match the gloss finish of the original.

DSCN3845

5 minutes later it is fitted in place – and fits perfectly, of course. I would make a couple of minor (design) modifications if I was to do it again. The countersinks for the the screws are on the wrong side ! (my fault) but otherwise it seems OK. Also, I would do a stress analysis of the design before having it printed. (various simulation packages are available to use with Onshape via their App Store).

DSCN3850

Aesthetically speaking, it looks good and actually the matt finish is growing on me. (The wife hasn’t seen it yet though). I can always paint it with acrylic, or something similar, to get a glossier finish.

DSCN3847

Time will tell how it stands up to use. I’ve noted a bit of flexing of the handle when the door is opened and perhaps it should be a little bit more rigid/stronger (different material?) although I did notice some flexing in the original handle too.

All in all a successful exercise so far – the handle is about to enter Beta Testing.

While I can understand why manufacturers may be reluctant to make technical information (design details) available for their spare parts, is there any reason why they couldn’t offer a 3D printing service for the parts that they discontinue ? Even if they were to outsource the production to a 3rd party it seems to me like a valuable additional revenue stream and they would really be able to claim that they were offering a Service you can depend on

ACE embeddable code editor

by Mick 0 Comments

Ace is a code editor written in JavaScript which can be embedded in any web-page/JavaScript application. It is a community project with the source code hosted on GitHub and released under the BSD license.

Features include:

  • Syntax highlighting
  • Over 20 themes
  • Automatic indenting
  • Search and replace with regular expressions
  • Highlight matching parentheses
  • Line wrapping
  • Code folding
  • Cut, copy, and paste functionality
  • etc.

All the details are available at

https://ace.c9.io/

Apple Pencil

by Mick 0 Comments

pencil1

The Apple Pencil is an additional accessory which can (only) be used in conjunction with the forthcoming iPad Pro (scheduled to be available in November 2015).

It’s something I’ve been waiting for since the first iPad was released way back in 2010 and should provide that extra bit of precision in addition to the versatility of multi-touch.

pencil2

There are certain minimum requirements in a stylus which all seem to have been covered in the design of this “electronic pencil”

  • Latency – how fast the system responds when a line is being drawn
  • Pressure sensitivity – pressing harder to produce thicker lines

An additional feature is the ability to produce shading effects by varying the angle (tilting) the pencil tip when drawing.

https://youtu.be/iicnVez5U7M

(link: https://youtu.be/iicnVez5U7M)

The pencil has an in-built battery which should last for 12 hours following a full charge. In an emergency, 15 seconds of charge will provide 30 minutes of use. It is charged from the iPad Pro using a lightning connector.

Read more at http://www.apple.com/uk/apple-pencil/

If being a little churlish, I would have liked the top of the pen being available to be used as an “eraser” but hey, well done Apple, this new stylus looks to be a very useful addition especially if you work with a lot of drawings or CAD applications.

Text Editors

by Mick 0 Comments

Visual Studio Code provides developers with a new tool for developers that combines the simplicity and streamlined experience of a code editor with the best of what developers need for their core code-edit-debug cycle. Create and debug modern web and cloud applications with Visual Studio Code which is free and available on Linux, Mac OSX, and Windows.

Solar Impulse 2

by Mick 0 Comments

Solar_Impulse_2

Solar Impulse is a Swiss long-range, experimental, solar-powered aircraft project which has been running for a number of years and is used to promote the use of alternative renewable energy sources related to new technologies to allow decreased dependence on fossil fuels.

(https://youtu.be/Wf3qn2Tu6Ik )

http://www.futureisclean.org/

Solar Impulse 2 (SI2) has been built in an attempt to achieve the first round-the-world flight powered solely by energy from the sun.

SI2 is a single seater aircraft made from carbon fibre and has a wingspan of 72m, which is wider than a Boeing 747 jet. It has a compact cockpit space of only 3.8 cubic metres to accommodate a single pilot. The overall weight of the aircraft is 2300kg.

A total of 17,248 solar cells are built into the wings, fuselage and horizontal tailplane covering a total surface area of 269.5 m2. They collect up to 340kWh of solar energy per day to drive 4 electric motors and to charge the lithium polymer batteries. The batteries are used to allow SI2 to fly during the night.

The four engines, each generating a maximum power of 17.5hp, are mounted below the wings and each have a 2 blade propeller with a diameter of 4m. The entire system has an efficiency of 94%.

There are 4 batteries which have an energy density optimized to 260 Wh/kg and are insulated using high density foam. They are mounted in the four engine housings and weigh a total of 633kg which is slightly more than 25% of the overall aircraft weight.

SI2 flies at a speed between 20 and 77 kts. Energy usage is optimised by using a combination of solar energy with the potential energy created from the aircraft height.

During the day the pilot slowly ascends to a high altitude using solar energy to drive the aircraft and charge the batteries. As the sun sets, the pilot reduces the power to the engines and begins a gentle descent of around 0.4m/s to an altitude of between 1000-1500m where level flight is maintained at around 25kts. This cycle is repeated for each day and night of flight.

The driving force behind the project are also the 2 pilots.

Bertrand Piccard, a doctor, psychiatrist, explorer and aeronaut, who made the first non-stop round-the-world balloon flight, is the initiator and chairman.

André Borschberg, an engineer and graduate in management science, a fighter pilot and a professional airplane and helicopter pilot, is the co-founder and CEO.

SI2 set off from Abu Dhabi in March 2015 in a multi-leg attempt to fly around the world powered by the sun’s energy.

The flight started from Abu Dhabi, on March 9 2015. The route includes stop-overs in Oman, India, Myanmar and China. Crossing the Pacific Ocean with a stopover in Hawaii then flying across the U.S.A. and over the Atlantic Ocean, before heading back to Abu Dhabi.

Andre has just completed one of the most challenging legs of the round-the-world flight consisting of a journey which was to last 5 days and nights

SI2 left Nagoya (Japan) on June 28 2015 at 18:03 (UTC) and arrived in Hawaii on July 3 2015 at 15:55 (UTC). The total flight time was 4 days 21 hours and 53 minutes travelling 7212km at a maximum altitude of just over 23000ft and an average ground speed of 38 mph.

Full details about this leg of the journey can be found at

http://www.solarimpulse.com/leg-8-from-Nagoya-to-Hawaii

During maintenance and checks after landing in Hawaii it was discovered that the batteries had suffered irreversible damage caused by overheating. Repairs will take several months and the round-the-world trip has been postponed until spring 2016.

Latest news and updates can be found at

http://www.solarimpulse.com/

BBC micro:bit

microbit1

The BBC has announced the BBC micro:bit, a pocket-sized programmable computer which is to be given free to every child in year 7 (11-12 years old) across the UK. Its aim is to help children learn the basics of programming.

microbit

Technical specifications for the device will be available as open-source.

The device measures 4cm by 5cm and key features include:

  • Array of 25 red LEDs
  • Two programmable buttons
  • On-board motion detector or “accelerometer”
  • Built-in compass or “magnetometer” (includes an in-built magnet, and can sense certain types of metal)
  • Bluetooth Smart Technology
  • Five Input and Output (I/O) rings to connect the micro:bit to other devices such as the Raspberry Pi or other sensors

(Original Link: https://youtu.be/gJPRMPAbL3Q)

Software will include Blockly, Python and the Microsoft TouchDevelop platform.

https://developers.google.com/blockly/

https://www.python.org/

https://www.touchdevelop.com/

The BBC and partners have committed to provide up to one million micro:bits before the end of 2015. The micro:bit will also be made commercially available later in 2015

Product Partners include ARM, Barclays, element14, Freescale, Lancaster University, Microsoft, Nordic Semiconductor, Samsung, ScienceScope, technology Will Save Us and The Wellcome Trust.

Product Champions include, Bluetooth SIG, Bright Future, Cannybots, Cisco, Code Club, Coderdojo, Code Kingdoms, Creative Digital Solutions, CultureTECH, Institution of Engineering and Technology, Kitronik, London Connected Learning Centre, MyMiniFactory, Python Software Foundation, STEMNET, TeenTech and the Tinder Foundation.

Comprehensive details can be found at

http://www.bbc.co.uk/mediacentre/mediapacks/microbit

Holus

Holus is a tabletop holographic platform that converts digital content from a computer, tablet or smartphone into a 3D holographic experience, being developed by H+ Technology a company based in Vancouver, Canada.

FreeCAD

by Mick 0 Comments

FreeCAD is a free open-source parametric 3D CAD system and can be used by anyone to create 3D models. The current version of FreeCAD (0.15) was released on April 8, 2015 and runs on Microsoft Windows, Mac OS X and Debian based Linux systems. It has been developed since 2001 and uses Open CASCADE as it’s geometric modelling kernel.