Tweaks for SSDs on Windows

  • Update firmware
  • Check TRIM is enabled
  • AHCI mode
  • Disable hibernation (powercfg -h off)
  • Install Intel Remote Storage Tools
  • Disable page file?
  • Turn off auto defrag (automatically disabled in Windows 7+?)
  • Turn off superfetch (optional, automatically disabled in Windows 7+?)
  • Set up backups
Posted in Uncategorized | Comments Off

MongoDB London 2013

Some very rough notes from MongoDB London 2013:

Session 1 – Performance

Keep indexes in memory

Data in memory if you can

Slow queries can be configured to appear in logs

Use SSDs

Growing documents is bad

Do an ‘explain’ on queries

Padding factor

DB locks when writing

Sharding to scale writes

Optionally read from slaves but they may not have the written data yet

Write concern level configurable

Can set importance level of writes based on the node that has acknowledged the write

You can define your own _id structure to help querying

Use short field names – use an abstraction layer

Covered indexes

Dropping collections is faster than removing

mongostat

Run your own benchmark – benchrun

serverdensity.com/mdb

@davidmytton

Document per day,  pre allocated then use inc operator

Session 2 – Backups

bsondump converts bson to json

Use journalling

Disk backups faster

TTL indexes and capped collections

Replication

An uneven number of nodes is advised

There’s a mesh of hearbeats between the nodes

An arbiter node only exists for voting – it stores no data

You can have hiddden nodes, for “backup” purposes only

You can give a node a slaveDelay so the replication is delayed

Servers can be tagged e,g, { datacenter: new york }

There are 5 read preference modes

You can test all this on a single machine

Failure points:

  • Power
  • Network
  • Data Center (5 nodes safest, 2 (primary) +2 (primary)+1 (backup DC)
  • Multi-node failure can occur e.g. 2 out of 3 fail

When there’s only one node, the whole cluster becomes read-only

You can disabled indexing if you want to, e.g. on a backup node that isn’t ever queried

OpenStreetMap data contains lots of Points Of Interest, e.g. pubs

MongoDB can be used with Hadoop

There’s a mongo-storm project

Posted in Uncategorized | Comments Off

Defining a redirect/rewrite in the Web.config

For my own reference:

Posted in Uncategorized | Comments Off

Parsing MongoDB log files with logstash on Windows

Note: work in progress

This site helps with the date/time formats used:

This is a useful site for debugging grok expressions:

Posted in Uncategorized | Comments Off

Parsing IIS log files with logstash on Windows

Note: work in progress

I found a couple of example configurations for IIS logging, but they both rely on NXLog and contain deprecated configuration settings:

This is a useful site for debugging grok expressions:

Posted in Uncategorized | Comments Off

Finding all NuGet packages across multiple solutions

This PowerShell script will look for a file called nuget.config in the current directory, then use it to enumerate through all packages.config files across all solutions underneath the current directory and list the packages that are in use.

https://gist.github.com/tjrobinson/6138411

Posted in Uncategorized | Comments Off

Deleting files that Windows can’t delete

I recently downloaded some files from Salesforce Chatter which ended in “….”

If Windows won’t let you delete them (it says they don’t exist), SysInternals sdelete will:

C:\tools\SysinternalsSuite\sdelete.exe /s “\\?\C:\Users\TRobinson\Desktop\Over the next few weeks….”

Posted in Uncategorized | Comments Off

Beware of non-breaking spaces in your HOSTS file

I recently had some problems with HOSTS file entries that were being ignored. When viewed in most text editors it looked correct, but what looked like harmless whitespace was actually a non-breaking space (Decimal 160 or Hex A0). Although you can use tabs or spaces to separate the IP address from the hostname in HOSTS file, it treats non-breaking spaces as part of the hostname and therefore doesn’t work as expected.

Posted in Uncategorized | Comments Off

Dashlane Easter Egg – Konami Code reveals Conway’s Game of Life

I’ve been a Dashlane user for a while now, having found out about it through a friend and respected colleague who started working for them in the Paris office.

What you may not know is that Dashlane have invited a number of people to be on their “Board of Users” and to give feedback on new product developments. A few days ago one of the QA Engineers set us all a challenge – to find a hidden “cheat code” in the PC version of the application.

Well, I found it! (and I think I was the first)

It turns out that if you open the application, then go to the Help > About screen you’ll initially see this:

about-before

Now comes the fun part, you need to type the Konami Code:

↑ ↑ ↓ ↓ ← → ← → A

As soon as you finish that, you’ll see this screen and the Easter Egg will have been activated:

about-after

Initially I though, hmm, interesting, is it some kind of icon editor? You can start drawing on the grid, like this:

about-start

But as soon as you click the Dashlane logo then the grid turns into Conway’s Game of Life:

about-running

The guys at Dashlane have been kind enough to offer to send me some goodies but the main prize is this signed Dashlane drawing from the team at Dashlane in Paris:

Dashlane Konami Code Scan

Thanks all!

Posted in Software, Technology | Comments Off

Powershell: -contains vs. -match and -like

I recently discovered a problem where the Where-Object –contains operator wasn’t doing what I thought it was, i.e. the equivalent of String.Contains() in C#. For example:

(Get-Item .\MyDirectory) | where { $_.Attributes -contains “Directory” }

Is not the same as:

(Get-Item .\MyDirectory) | where { $_.Attributes -match “Directory” }

The former fails if the directory has more than one attribute. The reason for this is:

-contains is designed to work on arrays, not strings (referred to as a containment operator)
-match looks for a match inside a string and supports regexes
-like looks for a match inside a string and supports wildcards

So if the directory only has one attribute then –contains sees it as an array with a single entry “Directory” and returns true.
But if the directory has multiple attributes then –contains still sees it as an array with a single entry but the value of that entry is “Directory,NotIndexed” so returns false.

http://www.techotopia.com/index.php/Windows_PowerShell_1.0_Comparison_and_Containment_Operators

Posted in Uncategorized | Comments Off