Tuesday, September 9, 2014

Nexus 5 not showing up on Windows 8.1

Connecting my Nexus 5 using USB appeared to have stopped working. In Device Manager I could see some ACER ADB devices. I uninstalled the drivers from device manager. Connected phone again, another ACER ADB was showing.

To solve, I selected the ACER ADB device in Device Manager, right click and choose

Properties => Driver => Update Driver => Browse My Computer for Driver Software => Let me pick from list => MTP

Then your Nexus 5 should show up.

Friday, August 29, 2014

IIS SSL Issues

Suddenly I couldn't browse to https://localhost/test.html

I could browse to http, but not https.

In event viewer => windows logs => system I was seeing
"A fatal error occurred when attempting to access the SSL client credential private key..."

To solve, I did this:

Fire up MMC.exe and add the local computer account certificates snap in.
Navigate to Certificates/Personal/Certificates.
Find the web server cerficate. Right click => all tasks => manage private keys.
Grant full control to everyone.


Saturday, September 1, 2012

.NET Simple Recursive ConfigurationElementCollections

I've seen plenty of quite complicated examples of how to load recursive configuration element collections from app.config. Here's a really simple example.

I have the app.config below. You'll see that a person can have children. Each child is also a person and so each child can have children, and so on.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
      <section name="myPeople" type="NestedCustomConfig.PeopleConfigSection, NestedCustomConfig" />
  </configSections>

  <myPeople>
    <people>
      <add name="Frank" />
      <add name="Stanley">
        <children>
          <add name="Pauline">
            <children>
              <add name="Augustus"/>
              <add name="Zebedee" />
            </children>
          </add>
        </children>
      </add>
    </people>
  </myPeople>
  
</configuration>
To load this, I have the following classes:


using System.Configuration;

namespace NestedCustomConfig
{
    public class PersonConfigurationElement : ConfigurationElement
    {
        [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
        public string Name
        {
            get { return (string) base["name"]; }
            set { base["name"] = value; }
        }

        [ConfigurationProperty("children", IsDefaultCollection = false, IsRequired = false)]
        public People Children
        {
            get { return (People) base["children"]; }
            set { base["children"] = value; }
        }
    }

    public class People : ConfigurationElementCollection
    {
        protected override ConfigurationElement CreateNewElement()
        {
            return new PersonConfigurationElement();
        }

        protected override object GetElementKey(ConfigurationElement element)
        {
            return ((PersonConfigurationElement)element).Name;
        }
    }

    public class PeopleConfigSection : ConfigurationSection
    {
        [ConfigurationProperty("people", IsDefaultCollection = false)]
        public People People
        {
            get
            {
                return (People)base["people"];
            }
        }
    }
}
I created a Console App for the example and have the following in Program.cs:
using System.Configuration;

namespace NestedCustomConfig
{
    class Program
    {
        static void Main()
        {
            var peopleSection = ConfigurationManager.GetSection("myPeople");
        }
    }
}
Good luck.

Saturday, June 2, 2012

Swiss Mortgage Example

In case you fancy buying a 1,000,000 CHF residential property in beautiful Switzerland:

Purchase price: 1,000,000
20% Deposit: 200,000
First mortgage 66% of purchase price: 660,000 - renegotiate every 10 (max) years
Second mortgage 14% of purchase price: 140,000 - must be paid off in (max) 24 years

5% * First Mortgage amount has to be less than 30% of your gross income

Simple!

Thursday, May 17, 2012

Old laptop running hot after Windows 7 upgrade

So, I finally upgraded my aging Windows XP laptop to Windows 7. The Windows 7 Upgrade Advisor assured me my pc had enough resources to handle the (not so) new OS. The install went fine, but I noticed that the machine was getting very hot. Installing Speedfan allowed me to monitor the temp, which was over 90C at times.

A quick look at the Performance tab of the Task Manager (while watching an excellent talk on Reactive Extensions) showed me the CPU was maxing out. Next stop was the processes tab, showing processes from all users and ordering by CPU usage. Pretty close to the top was wmpnetwk.exe.

This is Windows Media Player Network Sharing Service, which, according to the its description in Services, "Shares Windows Media Player libraries to other networked players and media devices using Universal Plug and Play".

I decided I didn't need this, especially at the expense of running my CPU at over 90C (I already have a device for those kind of temperatures: a kettle). So, I went to Services, selected "Windows Media Player Network Sharing Service", right-clicked and chose properties from the context menu, set Start Up Type to disabled and stopped the service.

Since then, the temp has reduced to between 40 and 50C. Still fairly high maybe (need to clean the cooling system probably), but manageable.

Tuesday, August 11, 2009

TOAD - file extensions and highlighting.

It’s been bugging me for a while that *.vew files were opening in TOAD without keywords being highlighted as they were in *.vw files.

This can be fixed by adding the *.vew file-extension here:

View=> Toad Options=>Editor=>Behaviour

There is a “languages” frame in the middle at the bottom of the page. Select “PL/SQL” from the drop-down box and click on the button with three dots in it.

In the “General” tab on the form that opens, you can add file extensions, so add VEW, SPS, SPB and anything else you want formatted.

Hope this is of use.

Friday, June 12, 2009

NUnit Tip

When installing NUnit, choose the "complete" installation option, otherwise the tests for NUnit itself aren't installed...and your brain will fill with porridge.