Saturday 6 December 2014

The Ergonomics of Version Numbers - What Version of Excel am I Running?


The Perennial Navigational Challenge to Operate Microsoft Office

Finding out what version of Excel you are using is not always straightforward as the user interface changes rapidly with each release. Once upon a time, Ferdinand Magellan had to circumnavigate the world, now people must collectively circumnavigate new versions of software applications, and Office, in particular, provides particular challenges.

The Traditional Idiom for Version Numbers for Windows Applications

Traditionally, version information was always stored in the Help->About screen. How Style Guidelines have changed!

The Office 2010 "Backstage View" and Corresponding Shortcut (From Help to the File Menu)

Office 2010 introduces the "Backstage View". Here you will find your Excel version by clicking: File->Help (Alt-F-H). In 2010, you'll see the Product Version (say 2010) in the top-right and the actual Excel version in the bottom right (e.g. Version: 14) and Copyright Notice.

The  Excel 2013 Methodology

Try the same keyboard shortcut above in Excel 2013 and you will be asked to share your worksheet - Ha!  Instead you must to File -> Account -> About.

Understanding Large Codebases via Control Flow Diagrams and other Tools

Imagine a large software system, possibly poorly programmed without any documentation or comments. To understand the system well, we need to get a handle on its architecture. The first step could be to evaluate a reference copy, and clean it up. The next step may well be to make some basic documentation.

Tools to understand software:

Control flow diagrams
Data flow diagrams

Control flow diagrams were developed in the nineteen fifties and are used, not just in software, but also in modelling business processes e.g modelling a quality control process.

A rectangle with rounded edges represents a Start or End symbol.
A square or rectangular box represents a Process.
A rectangular box with one vertical bar either side represents a Subprocess.
Decisions/Conditionals are represented by diamond.

Sunday 30 November 2014

What are RAR files?

RAR file format is the native file format of the WinRAR archiver. A RAR file is like a folder of compressed files. The format was developed by Russian software engineer Eugene Roshal. He also developed the WinRAR software package.

Wednesday 19 November 2014

What is Contained in .NET for Windows Store Apps?

When crafting a C# application for the Windows Store, you will see a reference to ,NET for Windows Store apps automagically added to your Project References. A quick dip in the Object Browser will show the new namespaces that proudly make up the new prefab units for Windows Store. Sample namespaces are shown below:

Microsoft.Advertising.Mobile
Microsoft.Devices.Sensors
Microsoft.Phone
Microsoft.Phone.Maps
Microsoft.Phone.Reactive
Microsoft.Xna.Framework
System.Numerics
System.Runtime.Numerics
System.Net.Http.Rtc

Understanding SPCs

An SPC is a software publisher certificate, stored in a pfx file. The pfx stores private and public keys and can be used for signing releases. The pfx suffix stands for Personal Information Exchange. Some CAs (certificate authorities) store private keys in a .pvk file in which case a conversion to .pfx can be performed using the Pvk2Pfx tool. It also works on .spc files (not to be confused with spectroscopic data files!). 

Tuesday 18 November 2014

Why is there no const keyword for methods in C# like there is for C++?

The key difficulty is verifiability at compile-time. An implementation using the [Pure] attribute has been discussed meaning the function has no side-effects; or a "getter" can be used which is effectively the same thing.

What's the Story Behind System.Numerics?

System.Numerics was introduced in .NET 4 and supports BigInteger (arbitrarily large signed integers) and Complex classes. Both are implemented as public structs.

Friday 14 November 2014

How to Create a Protected Method in a Sealed Class in C#?

Can't be done and in fact doesn't make sense; given that a sealed class cannot be inherited. Similarly, it makes no sense to create an abstract method in a sealed class. Sealed classes can inherit from other classes though.

File History in Windows 8

Windows attempt at a versioning file system.

Hacking the Path Variable in Windows 8

Hit the Windows key - then type Control Panel.
In Control Panel search, type Path.
(The edit the path, making sure you click OK when you exit the Screen).

Deciphering Interactive Services Detection

Interactive Services Detection is the software that comes up with the cryptic message: "A program running on this computer is trying to display a message". It is actually a Windows service named UI0Detect.

Wednesday 5 November 2014

The Two Sets of APIs to Build Windows Runtime Apps

These APIs are Windows Runtime and WinJS.  The latter enables you to build HTML/JavaScript applications with equivalent functionality to XAML (specifically the Windows.UI.Xaml namespace equivalent functionality).

WinJS.Application provides application level functionality such as activation, storage and application events. When you create a new Windows JavaScript application, you'll see this namespace referenced in the default.js under the js folder of your solution.

Windows 10

Windows 10, the next version of Windows, can be previewed via the Windows Insider Program.

Starting Visual Studio Express on Windows 8

Go to Search and type in VS. This will find Visual Studio Express.

Saturday 18 October 2014

VPN Tunnelling and what Microsoft uses (PPTP)

Virtual Private Networks (VPNs) offer a cost effective alternative to other mechanisms to connect geographically distance offices such as leased lines (sometimes called "private circuit"), which involves paying a monthly lease to a provider in exchange for a permanent connection between two locations. A problem can be lack of guaranteed bandwidth which you get with a leased line.

The first form of VPNs were software defined networks (SDNs) developed by AT&T in the 1980s.

Today's technology relies on tunnelling protocols, the main ones being:
  • IP Security (IPSec) which is an open standard that deals with authentication and security of transmission over the public network.
  • PPTP or Point to Point Tunnelling Protocol, developed by an industry consortium including Microsoft and 3Com is used by Windows.
  • Layer 2 Tunnel Protocol (L2TP) was developed by Cisco to replace IPSec
Tunnelling offers the safety and security required to make VPNs a viable proposition. It behaves like an envelope for letters - the data packet in the payload of another packet which follows another protocol. This technique also allows routing of non IP packets.

The tunneled packet header contacts a bunch of information relating to the protocol of the enclosed packet, the initiator and potentially a checksum to ensure data was not corrupted during transmission.

Monday 13 October 2014

Pdf Files in Windows 8 and when not to use Windows Reader

Pdf files are opened automatically by Windows 8 Reader which has built in PDF support. This is neat for casual reading. The catch - not all features of PDFs are supported. Worse still, if you resave the file in Reader, you are likely to lose functionality. You may therefore need to install Adobe Reader and set the default PDF application on your files to link to Adobe.

Sunday 12 October 2014

Visual Studio Online

Visual Studio Online allows you to create projects online and is free for up to five users. It allows you to use Version Control, specifically git or Team Foundation. Additionally, it offers process templates including Scrum and Agile.

What's New in IE11

IE11 includes the so-called "F12 Developer Tools". It includes the DOM Explorer which includes expand and contract functionality on HTML nodes. It also includes a Debugger and Profiler.

Windows 8 Shortcuts (Including Command Prompt)

In what follows, WB stands for "Windows Button".

WB-C   -> Open Charms (Frequently used Windows Functions)
WB-E   -> Open File Manager
WB-R   -> Open Run (then type cmd to open Command Prompt)

Alt-F4 -> same as before (close current window)

Cntrl-Shift-Escape -> Task Manager

Saturday 11 October 2014

The Windows Client/Server Runtime Subsystem (CSRSS)

csrss.exe is a component of Windows NT family operating systems that runs the user mode (all code outside of the kernel) of the Win32 subsystem.

Image Path Name in Task Manager

We can check the Image Path Name in Task Manager.  Click on View then Select Column. It can be useful to see if common exe files are running from their expected locations. For example, rundll32.exe should run from C:\Windows\system32 or C:\WINNT\system32.

Sunday 31 August 2014

Xbox One versus Xbox 360 - 853 > 500

The Xbox 360 has a 500Mhz ATI graphics card (custom built) with 10MB embedded DRAM.

The Xbox one pushes the clock speed of the GPU up to 853Mhz built by AMD (the GPU was launched in November 2013, named Durango).

Note that ATI was acquired by AMD in 2006.

GPU clock speed refers to the speed of the cores of the GPU. Faster the GPU cores, the faster the rendering.

The X in Xbox

This refers to the DirectX API. The latest incarnation is DirectX 12 which boasts "console level efficiency". 3DMark ("The Gamer's Benchmark) is a benchmark used to justify the claim.

Building Apps for Windows Store and Windows Phone

All you need is here. A recommended configuration is Windows 8.1 with Microsoft Visual Studio Express 2013.

Programming at the API Boundary in Windows 8: C++ Component Extensions

The WinRT - What CX is All About

C++/CX (Component Extensions) borrows from C++/CLI but targets the Windows Runtime (WinRT) and native code instead of the CLR and managed code.

It is not Managed C++, though it looks a bit like it.  Neither is it perfectly obedient, standard C++. It is C++ with a bit of "Microsoft spice" added to the fray.

Can thou givest an example of "Microsoft Spice" added to the fray?

Among the so-called "component extensions" is support for partial classes, mainly for auto-merging generated code with developer code. Partial classes are not part of the C++ standard (at least, not as part of C++11).

The entry point - notion of the "ref class"

To use "component extensions" you must declare your class as a "ref class" e.g. public ref class SuperClass. To make it partial, you can whack a partial on the front: partial ref class SuperClass.

C++/CX also supports runtime generics (versus compile-time generics in the STL). However, support for compile time generics remains in place.

Microsoft's Typed Superset of Javascript

TypeScript is Microsoft's open source superset of Javascript. It adds ".NET thinking" into the development of Javascript programs, introducing types but then compiles (more accurately "transcompiles") the program into plain Javascript.

The TypeScript Language Specification is available on github and presented as an md file (written in the Markdown language). It is made available under an OWF agreement.

Thursday 28 August 2014

Math in C#

If you want to do math in C#, and specifically linear algebra math, you have a number of options.

Use the in-built multidimensional array construct, create your own linear algebra library or use an existing one.

Math.Net.Numerics (currently on version 3.2.0) is a good option. It has full documentation here. The guys at Microsoft Research (at least some of them) use it too. You may also want to read Christoph Ruegg's (aka cdr) blog where he covers Math.Net releases.

If you thought you could ignore nuget

Think again. Do you know what the PM prompt is?

The History of ClickOnce

ClickOnce is Microsoft's answer to Java WebStart and was introduced in .NET version 2.0, supporting both Win Forms and WPF applications. It was initially supported only in Internet Explorer, and later a Firefox addin was developed.

Thursday 14 August 2014

WLAN Connection Issues

Facing WLAN connection issues? Can't see any wireless networks? WLAN Autoconfig service can be shut down. Then go to Network and Sharing Center. Then start WLAN Autoconfig again. Wait and see results.

Tuesday 12 August 2014

Grammars for C# Hackers; It All Starts with NTPS (Understand it, Don't Memorise It)

This post is part of a series labelled "compsci" which seeks to expound complex computer science topics in an easy way for implementers interested in the theoretical foundations of computing. These will include grammars, essential for understanding compilers, discrete math and other topics.

This post focuses on the Chomskian hierarchy of grammars and how they apply to computer science. Chomsky is a genius who spent most of his career at MIT (which suited his "idiosyncratic interests") and has written over one hundred books. He has contributed considerably to the study of generative grammars.

The most basic is known as Type 0, or phrase structure grammars (PSGs). These grammars can be encapsulated by the quadruple NTPS i.e. the set of terminals and non-terminals, start symbol (which is one of the non terminals) and productions.

There are specific derivation rules to expand nonterminals for PSGs, however these are quite general. When restrictions are put on the production rules, you get type 1, type 2 and type 3 grammars.

Type 1 grammars are also known as context sensitive grammars and they generate context sensitive languages (CSLs).

Type 2 grammars (which generate Type 2 languages) are known as context-sensitive grammars.

Chomsky has mentioned in talks the study of "universal grammar", the study of specifying general properties of languages that can be learned in the normal way by humans. UG can be thought of as a part of cognitive science.

LINQ - An Attempt at Tackling Impedance Mismatch

Origins of the Term Impedance Mismatch

Impedance mismatch is a term borrowed from the process of impedance matching in electronics. Electrical impedance measures the opposition that a circuit presents to a current when a voltage is applied.

Object-Relational Impedance Mismatch

The object-relational impedance mismatch describes the style differences required to code queries to relational database systems from OO languages.

For starters, SQL queries violate the rule of encapsulation.

LINQ tackles this by making relational queries part of the C# language. As a bonus, it also allows you to do similar queries on .NET objects.

LINQ is regarded as a Fundamental Part of C# (One of the default namespaces of System.Dll)

Proof of this is given by the "using System.Linq;" module import message that is inserted by default, by Visual Studio, at the start of your C# program (other default includes include System, System.Text and System.Collections.Generic).

Sunday 13 July 2014

MP3 versus M4A versus WAV versus AAC format

Motivation for M4A Format - What is Wrong with MP3?

Mpeg 3 audio (better known as MP3) is a lossy audio compression format, succeeded by M4A (higher quality with lower bit rates and file size).  The bit rate is the number of bits conveyed per unit time, and is (generally) measured in bits per second (generally higher bit rates allow for higher quality).

If WAV has higher quality, why not use it?

WAV files (pronouned WAVE) have high quality but no compression, so this format is not widely used for music collections. It was developed by Microsoft and IBM in 1991.

Alternative File Extensions for M4A

.MP4 is sometimes used as an alternative file extension to .M4A.

Advanced Audio Coding (AAC)

Audio standard for lossy digital audio compression.

Sunday 11 May 2014

Switch to Slimline Margins in Word

Choose "Page Layout" in the Ribbon, Margins and then select "Narrow". This will reduce the 2.5cm default margin to 1.27cm.

Change from Portrait to Landscape in Word

Choose "Page Layout" in the Ribbon and then click Orientation.

How do I resize the Canvas in MSPaint?

You do Image->Attributes. Alternatively, the shortcut to get to this dialog is Cntrl-E.

By default, width and height is displayed in pixels.

Say the height is 421 pixels. To double it, type in 842.

Saturday 10 May 2014

A Computer without Applications

Is like a television set without broadcasting - Michael Mahoney, 2002 (Paraphrased).

Essence of the "new" Keyword - Name Three Things It Does

What does the new keyword in C# actually do?

It calculates the TOTAL number of bytes the object needs (including its instance members) and then allocates the relevant amount of memory.

There are some additional bookkeeping items though.

For one thing, the type object pointer is initialised. This is a pointer to the object's description needed to perform virtual function invocation (i.e. to allow dynamic binding). The description is obtained using GetType which is nonvirtual to prevent object type spoofing.

The second thing is the sync block index, which is an index into a table of synchronisation blocks.

Then the instance constructor is called, passing in arguments specified in the new statement. Most compilers will then call the base class constructors all the way to System.Object.

Monday 7 April 2014

The Secret of Setting a Password for an MS Word Document

Invoking Save As (ALT-F-A)

First step is to invoke Save As on the Document.  To initiate this, click on the "Microsoft Office Button". (Note: Another way to get at this feature is ALT-F-A).

Invoke General Options (Note: NOT Save Options)

This is in the bottom right of the Dialog, next to the Save button.  You will then be prompted for a password.

Note: we are interested in General Options, and NOT Save Options (e.g. save as DotX or DocX format).

Sunday 6 April 2014

Run Windows XP Forever!

This is one of the boasts of VMWare Player! (Free for Personal Use).
  • You will need the CD for Windows XP
  • The VM Ware Authorization Service must be running (Check Administrative Tools->Services)
  • You need to be connected to the Internet (VMWare will need to pull in VMWare tools for Windows 2000 and later)

Storage Technology for the Windows Hacker

Programmers have to be hardware geniuses too these days.

If your inner hardware genius needs refreshing here are some of the common terms you will come across when dealing with storage solutions. If you are in charge of hypervisor environments or cloud administration you will certainly need to know these terms as a prerequisite to any technical chats you may have with hardware vendors.

SCSI - SMALL COMPUTER System Interface (sku-zee) - the hard part to remember is the SMALL COMPUTER part of the acronym!

It is basically a set of standards to physically connect peripherals with computers. It's important to know this since many new standards are derived from SCSI.

SCSI was actually derived from another standard known as SASI where SA was "Shugart Associates", a floppy disk drive manufacturer from the 1970s).

SASI was developed around 1978 to provide a communication interface between the low level interface of a hard disk drive and a computer.

The original SCSI standard was published by ANSI in 1986.SCSI-2 was published in 1990.

Virtualization Mumbo Jumbo

Virtualization has its roots with IBM's SIMMON system in the 1960s but the mumbo-jumbo attached to it is definitely a 21st Century phenomenon.

Running a Desktop on a Virtual Machine on Windows

There are a number of options to run a desktop on your local device using a virtual machine. There are a number of good benefits to doing so, but here we focus more on the "how-to". Some examples of products:
  • Citrix FlexCast
  • VMWare workstation
  • Microsoft Hyper-V
Magazines such as Network World have run stories on who has the better platform, including "deep dive" studies. The companies themselves also run "technical blogs" that document experience of using the technology and also play an "evangelical" role in big-upping their respective platforms.

Note: running a desktop on a virtual machine is definitely not the same thing as virtual desktops, a concept very common on Linux environments and making inroads into the Windows world as well!!

What is the Hibernation File Cleaner in Vista?

When doing a Disk Cleanup in Vista you may see a chunk of memory (say 3GB) allocated to a "Hibernation File Cleaner". What on earth is this?

This is the "hibernation file" or hiberfil.sys. If you delete it, it will likely return.  The purpose of the file is to save your desktop state when the computer goes into hibernation mode and the power goes off. Without it, what you were working on will be gone.

Control Panel -> Power Options will give you a console to control what the computer does in certain scenarios. For example, for a laptop, closing the lid may result in sleep whereas hitting the power on button will turn the machine off.

Saturday 5 April 2014

Cleaning up Files

Windows tends to fill your system up with useless files.

These include System Error memory dump files, temporary Internet files, temporary files (filling up the Windows temp directory) and Downloaded Program Files.

Several gigabytes of space can be wasted. To deal with this problem, go to Start Menu -> Accessories -> System Tools -> Disk Cleanup.

Another useful tool to analyze where your maximum disk usage is is WinDirStat, based on Stefan Hundhammer's KDE program KDirStat, and is available under GPL v2.

Thursday 13 March 2014

Saturday 22 February 2014

Color Theory for Coders

Color Theory is key for coders working on graphical user interfaces.

A theory of color puts colors into a logical ordering.

The most basic such is the Primary Colors, Red, Yellow, and Blue, in painting no mixing of colors can create these, they are atomic structures. You can imagine them on a three-part color wheel.

Then you have the Secondary Colors, green, orange and purple, formed by mixing the primary colors.

You can show this on a pie chart of six slices. All this might seem trivial, but even Isaac Newton thought about color wheels in 1666 and he discovered gravity and the laws of motion.

Wednesday 19 February 2014

.NET Transparency Model ("Security Silo" Model) Overrules CAS as of Dot Net 4

Transparency separates code running as part of an application from code running as part of infrastructure. Transaparent code can only "do things" within the bounds of a permission set, and can't do funky things with infrastructure (running critical code etc.). This follows the principle of least privilege.

Unity 3 for .NET 4 and Above

Unity was released in April 2013. The best way to get it is via the msdn location. Downloading the "Application Block" will give you all the DLLs which you probably want to stick into an appropriate lib directory. Unity 3 is now security-transparent. Note: this is a different concept from security policy, which has become obsolete in .Net 4.0.

Friday 17 January 2014

The Programmer's Guide to Application Programming in Florida (Eastern versus Central Standard Time)

This has been in .NET since version 3.5, and is an enhancement over the TimeZone class.

An interesting feature is that it contains cached data, such as data on the local time zone, and any other cached time zone, which can be cleared via ClearCachedData.

An example usage of the TimeZoneInfo class.

var cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");

(Side note: "Central Standard Time" precedes GMT by six hours. It is used in Northwestern Florida, Minnesota, Illinois and most of Kansas, though the Eastern part of Florida, Miami, Tampa, Orlando and the Florida Keys are all in the "Eastern" time zone, or "EST", or "Eastern Standard Time").

The time zone info object can be used to convert times in one time zone to another time zone, using the static method TimeZoneInfo.ConvertTime.