Saturday 31 December 2016

Digital Publishing on Windows - The EPUB Book Format

The EPUB format is an XML based e-book format. The current version is as of 31 December 2016 is 3.01 and is copyrighted by the International Digital Publishing Forum or IDPF, a standards organization for digital publishing. A relevant conference discussing EPUB is Digital Book World.

Sunday 27 November 2016

Make a Multi Column Word Document

Start with a regular Word doc.

Select All -> Layout -> Columns, and specify the number of columns you want.

Monday 14 November 2016

Update Table of Contents Programmatically in Word

Assuming your document has only one Table of Contents, the following code will update it.

Sub UpdateTableOfContents()
 
    ActiveDocument.TablesOfContents(1).Update

End Sub

You can also assign a keyboard shortcut to this code using File->Options->Customize Ribbon->Keyboard Shortcuts (Customize).

Assign a Keyboard Shortcut to a Macro in Word

Sequence of steps to assign a Keyboard Shortcut to a Macro in Word -

1. File
2. Options
3. Customize Ribbon
4. Keyboard Shortcuts: Customize...
5. Select Macros (under Categories)
6. Select Macro (under Macros)
7. Type in Keystrokes for Shortcut

As you type the candidate keystroke, Word will tell you if it is already used and what it is used for.

Use Word's "Tell Me" Feature

If you are stuck on how to do something in Word, one option is to use the "Tell Me" feature.

Hit Alt-Q

Type your query

Saturday 5 November 2016

What are Geofences?

A geo-fence is very simply a virtual perimeter around a real-world geographic area. They can be used to trigger alerts on location-aware devices.

Tuesday 18 October 2016

Geospatial File Formats for GIS Systems

There are a number of file formats used for GIS systems that are relevant to Windows programmers as well as developers on other platforms. Some popular ones are:

1. Shapefile - this is a popular geospatial vector data format developed by ESRI as an open specification. It uses points, lines and polygons to describe e.g. wells, rivers and lakes. You can associate properties to each object like temperature or name. It is a file format used by ESRI's former flagship product, ArcView (now known as Arc GIS).

2. GML (Geography Markup Language) - an XML grammar developed by the OGC or Open Geospatial Consortium. (File extension: GML or XML). More information on the OGC website.

Saturday 15 October 2016

Python for .NET versus IronPython

Python for .NET allows your Python program to talk with the CLR. IronPython is an implementation of Python in .NET and currently supports Python 2.7. Documentation on IronPython usage can be found here.

Monday 10 October 2016

Where is Python 3.5 Installed on Windows?

Python 3.5 is installed in the user's local "AppData" space.

C:\Users\[User Name]\AppData\Local\Programs\Python\Python35

U_ALP is the "short code" for the path.  ALP = AppData\Local\Programs.

Sunday 2 October 2016

Mastering Powerpoint's Processes and Timelines

To draw processes and timelines in Powerpoint (suppose you are trying to visualise a short history of something or other), Insert -> SmartArt -> Process (third option down) is your pathway to victory. (SmartArt is sandwiched between Shapes and Chart).




Saturday 30 July 2016

Insert a Tick Mark in Word

If you use Word for making checklists, you may find it handy to use a tick mark to indicate completion of certain tasks.

This is easy -

Insert -> Symbol -> Select Wingdings and Scroll Down and Select the Tick Mark.

You may need to increase the font size to make the tick mark more discernible.

Insert Page Break in Word

Very simple operation. Just press Control-Enter.

Save As in Microsoft Word

Very often you will want to do a Save As in Microsoft Word.

Sample scenarios:

1. Opening a new document & needing to save it for the first time
2. Save an existing document in a new file format

In both cases you need the Save As feature.

This is easy, it's just:

1. F12
2. Windows Key + F12 if your F12 is overwritten

Scenario 2 happens with certain laptop manufacturers who override the function keys with features like controlling brightness or switching Flight Mode on and off.

Tuesday 26 July 2016

WinBods Intro to "High-Perf Telco-Tech" (HPTT) a.k.a. Getting to Know the Data Link Layer - Global Style

Introduction - Two Types of DLLs To Think About

Dynamic Link Libraries are not the only DLLs that a WinBod needs to know about. Equally important, is the Data Link Layer "DLL" of the OSI Reference Model.

Lesson One in HPTT - Building VPNs by Wrapping Packets and Sticking a Path Label on Them So they Know Exactly Where to Go - another way of describing "Multiprotocol Label Switching"

Multiprotocol label switching is also known as MPLS and is a term used in high performance telecoms.

Specifically, it is a technique to direct data from one network node to the next.

Its main selling point is it does away with long network addresses and instead uses short path labels.

The labels identify paths between distant nodes rather than mere endpoints.

Its "multiprotocol" nature stems from the fact that MPLS can encapsulate packets containing data conformant to "any protocol you please".  It can be used to build VPNs.

The point is to eliminate dependence on a specific data link layer technology such as Asynchronous Transfer Mode, Ethernet, Frame Relay or Synchronous Optical NETworking (SONET). To understand the data link layer read up on the OSI Reference Model.

What you Ought to Have Known Before Reading this Piece - What Asynchronous Transfer Mode is All About, and in Particular, how it differs from TCP/IP

Transfers data in cells or packets of a fixed size. ATM creates a fixed channel or route for packets to pass through unlike TCP/IP where various packets can take various routes. ATM services generally offer different types of bit rate. UBR, or unspecified bit rate, does not guarantee any throughput levels.

Sunday 3 July 2016

.NET Basics - What does void mean in C#? Is it the same meaning as in C++ or Java?

The void keyword means pretty much the same thing in C# as it means in Java or C++.  But there are few things to be aware of.

  • void used as a method return type means that the method does not return a value. (Implementation-wise it is an alias for System.Void in mscorlib - which has no members except what it inherits from System.Object)
  • void is also used to declare a pointer to an unknown type, when used in an unsafe context

Friday 17 June 2016

The X Factor - File Changes introduced in Microsoft Office 2007 and Preserved Henceforth

MS Office 2007 introduced new file extensions - XLSX for Excel, PPTX for Powerpoint and DOCX for Word. These are generally smaller in size than their pre-Office 2007 equivalents. These use Office XML. So, for example, a PPTX file would an XML-based Powerpoint presentation. Note that these file formats disallow macros. The corresponding macro-enabled versions all have the X replaced with an M - hence we have XLSM for a macro-enabled Excel workbook, PPTM for a macro-enabled Powerpoint presentation and DOCM for a macro-enable Word document. In theory, these XML formats allow the files to be consumed by a variety of applications, not just Word, Excel or Powerpoint and allow batch processing software to be built, for example processing automatically hundreds of Word documents.

Sunday 5 June 2016

Where are the Heading 2, Heading 3 et. cetera styles in Word and why are they not showing up?

To make these show up, you need to click on the bottom right of the Styles tab. This brings up a floating menu.

At the bottom of the floating menu are three icons representing: New Style, Style Inspector and Manage Styles. Click on Manage Styles.

Click on the second tab (Recommend). Select what you would like to see and click Show. This will make the style show up when viewing recommended styles.

Tuesday 31 May 2016

The Cascade Windows Trick

To get windows which are off-screen back to your main screen, right click on the Windows Toolbar and select "Cascade Windows".

Monday 23 May 2016

Basics of MEF

MEF allows C# applications to scale.. specifically it allows application "extensibility". Hence the name, Managed Extensibility Framework.

Data Lineage

The modern day Windows maven cannot be solely excellent at all the latest characteristics of the Dot Net platform but needs a broader understanding of wider computing issues.

One such issue is data lineage, a subcategory of the field of data governance. Data lineage relates to understanding the flow of data from source to destination, including any transformations that occur along the way.

Sunday 22 May 2016

The MEF as an Integral Part of .NET 4 and an Important Part of .NET 4.5

The Managed Extensibility Framework (MEF) was introduced in .NET 4. It is supported by the MEF "composition engine". Its main namespace is System.ComponentModel.Composition.

Roll your own MD5 implementation - here's how!

Roll your own MD5 implementation - here's how!

If you wish to implement an MD5 algorithm (commonly used to verify data integrity) in C# the "right way" to go about it is to inherit from class MD5.

public (abstract) class MD5: HashAlgorithm  [From mscorlib and in System.Security.Cryptography]

public (abstract) class HashAlgorithm: IDisposable, ICryptoTransform

Brainchild of Yale Mathematician Ron Rivest!

The MD5 ("message digest") algorithm was designed in 1991 by Ronald Rivest (whose academic journey began with a Bachelors in Mathematics from Yale) as the successor to MD4, although execution speed is slower. It is described in RFC1321. It produces a 128 bit digest or "fingerprint" of the input data. That "fingerprint" can then be used to validate the integrity of downloaded data files.

The Avalanche Effect

A concept that comes up in discussions of MD5 and other related algorithms is the notion of the avalanche effect. This is a scenario where an input bit is allowed to impact two or more output bits. Berlin-born cryptographer Horst Feistel, whose research led to the formation of the Data Encryption Standard, or DES, in the 1970s, and gave his name to the Feistel cipher, coined the term.

The Idea of a One Way Hash Function or Cryptographic Checksum

To understand MD5 as a cryptographic checksum or one-way hash function, we should understand the basics of hash functions.  A hash function converts a variable length input into a fixed length output (the former is known as the "pre-image" and the latter the "hash value"). The application is verification - to validate if a given "pre-image" is "likely" to be the same as the real "pre-image" the user is trying to validate.  The key to a cryptographic hash, or one-way hash, is that it is difficult to create a "pre-image" that hashes to a particular value. In short, it is hard to spoof the true "pre-image".

GIMP for Windows

The Current Stable Version and Other Logistics

Current stable version as of 22 May 2016 is 2.8.16. The GIMP installer for Windows is around 100MB. GIMP has its own wiki. On Windows GIMP installs to C:\Program Files and subdirectory GIMP 2 by default. GIMP supports the writing of plugins in Python. Wilber the dog is the GIMP mascot.

Compelling Reasons to use GIMP

Among the many interesting and useful features of GIMP is the ability to re-save JPEG images at user-controllable levels of quality.

Sunday 8 May 2016

Opening VBA Editor in Excel 2010 Onwards

File -> Options -> Customize Ribbon -> Check Developer

By default the Developer tab is not visible in Excel!

Saturday 16 April 2016

Windows Scan

Scanning is one of the most fundamental tools in managing administration and paperwork. Getting familiar with scanning software in Windows is thus a vital tool to effective administration.

The Scan app for Windows is a Windows 8 application preserved usefully in Windows 10. However, learning to use the application it is not super-intuitive, including finding out where you Scan is.

For example, suppose you have clicked Scan and the picture is upside-down. All you want to do is Rotate it and save it in a directory of your choice.

Right clicking on the scanned image yields no results.

On the left hand panel, you will see some basic information about the Scan and Scanner specifically the manufacturer of the scanner, and the file type of the scan, say PNG.

Click on "Show more" and you get more information on the scan such as Colour mode, Resolution in dots per inch (say 200), and Save location.

Click on Save location to select a sensible location for your scan.  You can choose a generic location such as This PC -> Pictures -> Scans.

Now, if you don't see any other options, you may need to rescan.  This should pop up a new window with the Scan, and an array of buttons above it. These buttons are:
  • Three point plug symbol - amazingly, this means "Share"
  • A frame symbol, inside another frame symbol - this means "Slideshow"
  • A pencil set at forty-five degrees - this means "Edit"
  • A circular arrow - this means "Rotate" (and the shortcut is "Control R")
  • A dustbin - which means "Delete"
  • Three dots - that brings a dropdown of other options, including File Info, which shows File size. There are also features you may not want to use with Scans such as "Set As" to "Set as lock screen" and "Set as background"

Rotate a Scanned Image in Windows 10

To rotate a scanned image in Windows 10, there is no need to use a paint package. Simply right click on the file in Windows Explorer and do a "Rotate right" or "Rotate left".

A Fresh Approach to Paint with Fresh Paint

Fresh Paint was introduced with Windows 8 and continued in Windows 10. It evolved from a Microsoft Research project called Project Gustav with feedback from the Museum of Modern Art.

Windows 10 Keyboard Shortcuts

The shortcuts here rely on the "Windows Key" or "Windows logo key" (which we will abbreviate to "WIK") which was first introduced in the curve-shaped Microsoft Natural keyboard in 1994.

In some cases, the shortcuts also have a "non Windows key" alternative.

Windows Key on its own (henceforth abbreviated to WIK) - will pop by the operating system's Start Menu if it has one. Without this key, Control-Escape performs the same function.  The Start Menu in Windows 10 shows your most frequently used applications.

There are lots of cool Windows shortcuts to learn. Here are just a few interesting ones.
  • WIK-TAB (Windows Key-Tab) - provides a more attractive alternative to Alt-Tab.
  • WIK-I (Windows Key-I)  - quickly gets you into Settings.  This starts off with Display settings which are best not to touch unless you are troubleshooting a specific problem.

Thursday 31 March 2016

Network Speed Test on Windows 10

If you want to test your network speed on Windows 10, Network Speed Test from the Windows Store is a great little app! Both download and upload speeds are measured. Are you a 2 Mbps maestro or a Gigabit superhero. Find out now.

Sunday 13 March 2016

Microsoft Edge - The Heir Apparent to Internet Explorer

Microsoft Edge is the default browser for Windows 10, replacing Internet Explorer 11. The browser has an inbuilt PDF reader, Adobe Flash player and low level JavaScript.

Saturday 12 March 2016

Table Properties in Word - Mastering Table Sizing (aka "Percentage Sizing")

You have just added a column to the right of your table....and the table has expanded beyond the margin.  What do you do?

Right click the table and choose Table Properties.

Click the Table tab:

1. Ensure text wrapping is set to "None"
2. Set Preferred Width to be measured in Percent (as opposed to cm).
3. Select 100%.

All done.

Wednesday 9 March 2016

The Internet Society - Keeping the Internet Free and Open

The Internet Society is an organisation dedicated to ensuring that the Internet stays open and transparent. 

Simple SSH for Windows Wizards - PowerShell Support is Nigh!

Secure Shell (SSH) sometimes known as Secure Socket Shell is something that comes from the UNIX world but is occasionally needed by Windows wizards as well.

A basic level knowledge of SSH is therefore cannot be avoided.

SSH in the UNIX world refers to the command-line tool and protocol to access a remote computer. It is used widely in network administration.

The connection is encrypted at both ends with a digital certificate, passwords too are encrypted.

Microsoft have announced they will bring SSH to PowerShell.

Also interesting is Posh-SSH.

Partitioning a Database

Partitioning means breaking up a database into sections - to make it more performant, easier to manage or for load balancing.

Partitioning Criteria

RDBMs' support a range of partitioning criteria. They take a partitioning key and assign a partition based on certain criteria. Example criteria are:
  • Hash partitioning - membership of a partition is determined by the value of a hash function. This function might return numbers between 0 to 4, for example, if there are 5 partitions.
  • Range partitioning - selects partition if partitioning key lies within a given range. For example, if you have a list of countries, you may split on a country with the letter M, say Malawi, Malta or the Maldives.
  • List partitioning - the partition is assigned a list of values. If the row satisfies the criteria (e.g. Country column is contained in List A) then it goes into, say, partition A.
  • Composite partitioning - hybrid of the above approaches.
Means of Partitioning

"Horizontal partitioning" or "horizontal sharding" involves putting different rows into different tables. A view with a union may be used to create a unified view.

"Vertical partitioning" involves taking normalisation to the next level. It involves creating tables with fewer columns and using additional tables to store the extra columns - a bit like normalisation, except vertical partitioning can be effected even when the tables are normalised. Infrequently used columns might be stored on a different device. This type of partitioning is also known as "row splitting" - the row is split by the columns.

Saturday 27 February 2016

MSVS 2015 - Cordova 4.0, EF7 and C++17 Lookahead

The Big Picture

Visual Studio 2015 RTM (Release to Manufacturing) was released on 20 July 2015.  The first thing to note is the new .NET Framework 4.6.

Update 2 CTP (Community Technology Preview) was released on 20 February 2016 (it is an unsupported pre-release version of Visual Studio not recommended for production usage).

.NET 4.6; EF7 Preview

.NET 4.6 includes better WPF support for touch (removing a delay in processing touch events) and HDPI (high dots per inch). There are also improvements to garbage collection and cryptography (i.e. ECSDA X509 certificates), more details here.

There is also a preview of Entity Framework 7 (which allows Windows phone applications to use Entity Framework) and an update of Entity Framework 6.

Welcome Cordova 4.0

RTM also introduced Apache Cordova (4.0) support in Visual Studio. Apache Cordova is an open-source mobile development framework (which is free and open source under the Apache License Version 2.0).  Update 1 also introduced new samples, updates and bug fixes.

C++14 and C++17 Look-ahead (Resumables for x64)

But is there anything new in the C++ space? Indeed, there is enhanced support for C++ 11 and initial support for some C++ 14 features. For one thing, return type deduction has been implemented. Resumable functions, expected in C++ 17, has also been implemented for x64 targets. For interest, Stroustrop's thoughts on C++ 17 are here.

Wednesday 10 February 2016

Query Active Directory in Excel

Excel 2016 comes with something called "Get and Transform" which allows you to query Active Directory stores. This is known as "Power Query" in other versions of Excel. Data discovery - made simple (or fairly simple).

Get-WmiObject

This is a cmdlet that makes calls into Windows Management Instrumentation, or WMI, objects. The alias gwmi can also be used.

What version of PowerShell am I running?

The simple cmdlet

Get-Host

will get you the version information.

Sunday 7 February 2016

Hiding a Page at the End of a Document in Microsoft Word

Display pilcrows as described in a previous post (Control-Shift-8). Select the pilcrow and change the Font properties to Hidden. The page will disappear. Hit Control-Shift-8 again to make the pilcrows disappear.

Where is the Pilcrow in Microsoft Word?

The pilcrow is also known as the "strange paragraph symbol". It can be found in the Paragraph section of the Home tab. Read more about it on Shady Characters.  The keyboard shortcut to display and make pilcrows disappear is Control-Shift-8.

Saturday 6 February 2016

Mozilla's XUL - the XAML of the Firefox world

XUL stands for XML User Interface Language and is a markup language similar to XAML that is (developed by Mozilla) and used in Firefox. The Gecko layout engine (written in C++) interprets and displays XUL and can be range of operating systems, including Microsoft Windows, OS X and OpenVMS. The original technology for Gecko came from a company in San Diego called DigitalStyle and is released under the MPL.

Saturday 23 January 2016

The Length of a Number stored as String in Excel

It's always LEN(X)-1, where X is the cell reference. We need to subtract 1 for the preceding apostrophe!

The Annoying Numbers Stored As Text Error in Excel

Typically in Excel, if we design a worksheet with a number stored as text, then we have made a conscious decision to do so. Consequently it is very annoying to see this error every time we see a number stored as text.

A valid use case would be a product or part number, which may be preceded by zeros, or a telephone number with the same convention. Alternatively we may be considering permutations of ones and zeros in which case preceding zeros are valid informational content.

To get rid of these errors:

File
Options
Formulas
Error Checking Rules - Deselect "Numbers formatted as text or preceded by apostrophe"

Job done.


Sunday 17 January 2016

General Knowledge on Networking

Any Windows programming bod should have an up to date, working knowledge of common networking commands.  Here are a few of the basic ones.

nslookup - queries the Domain Name System for domain name and IP address mapping for a DNS record

whois - protocol to get ownership information for a given domain. Communication is done using TCP and whois servers listen on TCP port 43. The protocol is all in ASCII.

Visual Studio Community 2015

Visual Studio Community 2015 comes with a host of interesting feature including lots of third-party tools. These include:

1. PowerShell Tools for Visual Studio
2. Android SDK
3. Joyent Node.js
4. Python tools for Visual Studio (November 2015, PTVS)
5. CLang with Microsoft Codegen (to make it easier to develop cross platform code that works on Windows and other OSs)
6. C#/.NET (Xamarin)

Note: it also comes with a Windows 10 SDK.