Saturday 13 January 2018

Asus MB169B+ USB Monitor

Now I'm doing everything on my laptop (coding, reading, betting) in the evenings, I started to miss the screen real-estate I enjoy at work (4 monitors!), so I started looking into a laptop-friendly way of extending my desktop without peppering the lounge with extra monitors.  I came across this product, and I've been using it for a few weeks now. 

It's a standard Full HD 15.6" non-touchscreen display, but it's really thin, fairly light and best of all, it takes all it's power and display signal through a single USB port, so you don't need extra plugs or power bricks around.  The display is bright, clear and there's no real lag if you're just using it for 2D windows applications and web browsing.  I haven't tried it for 3D gaming but you're probably better off with a full-blown HDMI monitor if that's your use-case.

It comes with a faux-leather slip case, and you're supposed to be able to prop up the display in the stand, however I haven't found it to be the most stable solution (the monitor is prone to falling backwards).  This is the only downside and I've ordered a tablet stand to try to prop it up a bit better, but a plate holder/stand would probably do the same job.

You can Buy the MB169B+ here

"Invalid Username or password" when mapping a network drive for a Windows service

Another recent issue I've come across required such a bizarre fix I thought I'd document it here in case it helps anyone else.

We had a Windows service running as Local System account on Windows Server 2016, and a mapped drive using Azure File Service over SMB.  So our server was on a separate Active Directory domain to the storage (the Azure storage is effectively on a domain called AZURE).

When we tried to access files on this share using a named drive letter, we would always get an error back saying Invalid username or password.  So after reading StackOverflow and other sites, we tried several different tactics:

1) Try to map the drive using a Windows Scheduled Task running as SYSTEM user, to run a batch file with a net use command in.

2) Try to map the drive using an administrative command prompt and the SysInternals PsExec tool (psexec -s -i cmd.exe)

3) Try to save the credentials for the network location in Windows Credential Manager

But whatever we tried, either the logged in windows user could see it, but the system user couldn't, or vice versa, but nothing would allow the service to see the drive.  We couldn't use the UNC path without mapping it because you can't embed credentials (username and password) in a UNC path.

After much more reading, it turns out that:

a) Each user has it's own record of mapped drives and credentials (which we knew anyway).
b) In some cases, such as Windows Services, different logon sessions for the same user have different mapped drives.
c) All Windows services running as the same user share the same session.

It was (c) that allowed us to finally find a (slightly Frankenstein-esque) solution.

If you create a new windows service (using C# and TopShelf for example) which shells out (System.Diagnostics.Process.Start) to run the net use command, and install this service to run as the SYSTEM user (TopShelf defaults to this), then it magically works, now your existing service can see your mapped drive!

P.S. If you get into a situation where you can't un-map a drive, you need to log back in as the user who mapped it in order to delete it (net use * /d)

P.P.S. If you're in a situation where you're able to change the user a service runs as (we weren't), then this whole thing might be a lot easier.  I think it's the special SYSTEM login that complicates things.

Friday 12 January 2018

IIS w3wp hangs indefinitely with low cpu

Recently I investigated an issue with an old application (think asp / unmanaged code / cgi) which had been working for years on IIS 7 but when it was migrated to IIS 8.5 on a newer Windows server we started to see a gradual decrease in stability. The website would just stop responding to new requests and the existing request would never time out. As it got worse over a couple of weeks it would not recover even when recycling the app pool or killing the w3wp.exe process. After trying several different things with no success we eventually found a huge number of .TMP temp files in c:\windows\temp had built up (hundreds of thousands). I believe these files were possible remnants of ODBC connections that were never cleared up properly by the runtime.

Clearing these files cleared the issue immediately and the application has been completely stable since. Hopefully this article will help you and you won't spend as long googling as I did!

Wednesday 10 January 2018

Matched betting with OddsMonkey

Late last year I got introduced to a new concept, that of matched betting.  Initially I was disbelieving but after watching a friend make hundreds of pounds in quick succession, I had to give it a go myself.

How it works

Matched betting or bonus arbitrage is the process of taking advantage of a difference in odds between a bookmaker and a betting exchange, or where a bookmaker will offer risk free bets or bonus money for betting on an event or outcome.  There are actually dozens of these offers every single day across the 100+ UK bookmakers.

A basic example is the odds of tossing a coin, they should be 2/1, so you've got a 50% chance of winning if you choose (for example) heads.  Matched betting works because often a bookmaker (trying to get more business) will offer enhanced or boosted odds, so they might offer odds of 3/1 on heads.  The actual odds haven't changed however, so if you place a bet at 3/1, and place the opposite bet (a lay) against heads at 2/1, you can make make a profit no matter what the outcome is.

So what is a betting exchange?

A betting exchange is a special type of bookmaker which allows you to not only 'back' an outcome (e.g. Arsenal to win) but 'lay' or bet against an outcome (e.g. Arsenal not to win, which seems more likely these days).  Whereas a bookmaker makes money by offering odds on an event that add up to more than 100% (their 'overround'), a betting exchange makes money by charging a small commission on each winning bet (between 2-5%).

Expected value and casino offers

In addition to sports betting, a big part of matched betting is casino offers, e.g. "deposit £10 play with £20".  These offers often require you to wager your winnings a certain number of times, for example a £5 bonus might have 20x wagering requirements, so you'd have to spin/bet £100 to release the bonus.  Some offers are +EV, others are not.  EV or expected value is a measure of long term outcomes, i.e. if you did the same offer 100 or 1000 times, you would expect on average for this amount to be won.  If the wagering requirement is too high, the offer becomes -EV and you would expect on average to lose money completing the offer, so we ignore those.

What is Oddsmonkey?

To put it simply, OddsMonkey is a website that explains all of this better than I can, has a daily list of all the available offers, and exactly how best to complete them.  It has dozens of guides and calculators, and a rich and active community of helpful people all doing the same thing.  Their customer support is outstanding, even at 10pm at night.  It's only £15 per month, which you can make back in a single day without breaking a sweat.

Expected earnings

During the first month it's very easy to make money just by signing up to several of the bookmakers and taking advantage of their new customer offers, you should easily be able to make over £750 in the first month.  In subsequent months, you can make as much as you're willing to put into it, there's a great deal of offers and techniques available that can bring in anything from £500 to several thousand each month.


The only downside is that the more bookmakers you sign up for, the more text messages, app notifications and emails you'll get every day.  However on the flip side, if you didn't get the notifications you can risk missing out on a decent offer.  In the long term, you are likely to get restricted by several of the bookmakers - matched betting isn't illegal, but bookmakers like making money, and if you consistently make money, then they don't.

If you're interested, you can sign up here.

Saturday 6 January 2018

Starting small scale investing

Entering 2018 I'm looking to grow my income, after the obvious-but-shocking realisation that with UK inflation consistently above 2%, and my savings interest rate consistently below 0.5%, my savings are doing a great job of actually losing me money every month.   One way I'm trying to rectify this is to put some of my money into investments.  After searching around for a way to start small, and not have to put in thousands, or tens of thousands of pounds, I found a site called eToro.  Excitedly I signed up, only to be disappointed to find on first impression it's much like any other investment site or fund, in that there's (large) minimum amounts to invest in stocks or shares, etc.

However one interesting thing they allow you to do is piggyback on other people's trades.  In doing so you can get involved for only 100USD.  It's not pennies, but it's not thousands or pounds either.  Safe in the knowledge I've got an emergency fund in an instant-access savings account, I've decided to have a dabble.  Thanks to the ability to invest in crypto-currencies as well as stocks and currency pairs, investment returns seem to be well over the 0.5% I'm getting at the bank.  In copying other people you can spread your risk, and rely on the fact that the people you're copying almost certainly know more about it than you do.  This is not investment advise, your money is at risk, etc, etc.

If you're interested, you can sign up here, and maybe follow me.

Discovery Planet

I'm excited to have recently become involved in a local community project in Ramsgate called Discovery Planet.  It's a social enterprise focused on science education for kids (and adults), and it's something that my daughter has enjoyed attending for the past year or two.  After chatting with the founders at recent events I suggested I might be able to help by updating their website and managing their digital presence.  I'm currently working on the website and I hope to have it ready within the month (Jan 2018).

When I met with Nikki and Xanthe it became clear that the project is a labour of love, and is not run for profit - the grants that they are able to secure don't stretch far.  So as part of taking over the website I've set up a Patreon link. For anyone who can afford to do so, any financial support goes a long way towards making these events possible.

The next event is due to be announced shortly, and will revolve around DNA.  You can keep up to date on the Facebook page.  I hope to see you there!