tag:blogger.com,1999:blog-81311356333784020042024-03-14T02:43:49.278+00:00Richbeales.net's blogMy thoughts, out loud.http://www.blogger.com/profile/03643184665586334973noreply@blogger.comBlogger62125tag:blogger.com,1999:blog-8131135633378402004.post-63307439325694294382020-12-07T11:57:00.002+00:002020-12-07T11:57:59.771+00:00Dead Smartthings (Samjin) button<p> As I'm in the process of switching from Samsung SmartThings to <a href="https://www.home-assistant.io" target="_blank">Home-Assistant</a> for my home automation, I've been re-pairing various Zigbee and Zwave devices.</p><p> One of those devices, a Samjin button, branded as SmartThings wouldn't come back to life after I removed the back cover (it was too tight against the wall to reach the reset switch). I recall having two buttons in a pack of 5 that also did the same thing. Those two seems to be dead-on-arrival, but I knew this button had been working fine. After much fiddling, I managed to coax it back to life by holding the CR2450 battery in with one finger. Whenever i put it back onto its battery cover however, dead.</p><p>No amount of bending the battery contacts made any difference. So, I put a tiny square of folded tissue paper behind the battery (between it and the rear cover where the magnets are. Hey presto - immediately works. Slightly snug to twist the battery cover on, but I now think I know what was 'wrong' with those original two buttons which went back to Amazon... <br /></p>.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-58019398532915238322018-05-01T20:17:00.003+01:002018-05-01T20:17:59.702+01:00How do I follow a post on Facebook? <div dir="ltr">
I have seen lots of posts on Facebook recently with comments along the lines of "Following this", or even just a stream of comments with just the letter "F".</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
The purpose of these comments seems to be so that the commenter can be alerted to any further comments and discussion on this post.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
So, if you weren't already aware of the <i>right</i> way to do it, it's simple. Click on the menu for the post. This is usually displayed as 3 horizontal dots at the top right of the post.</div>
<div dir="ltr">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
Then it's as simple as clicking on "Turn on notifications for this post". Same effect, much cleaner.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-sSzBrmOD2eBO9MAxkZZZ1-MT6EPUt5ugQEny8vdKtlBVuX0-Xsnap86IBcZEGI0a3G1ZxKjeilXRdF3Kgd-aXSyx5_mR-CmpvhxvN6_QuXkiPPF_1JRWKAkIAeUNeW0srA4kL5rwr3-Z/s1600/CaptureFBFollow.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="366" data-original-width="263" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-sSzBrmOD2eBO9MAxkZZZ1-MT6EPUt5ugQEny8vdKtlBVuX0-Xsnap86IBcZEGI0a3G1ZxKjeilXRdF3Kgd-aXSyx5_mR-CmpvhxvN6_QuXkiPPF_1JRWKAkIAeUNeW0srA4kL5rwr3-Z/s320/CaptureFBFollow.JPG" width="229" /></a></div>
<div dir="ltr">
<br /></div>
.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-19699300052776913152018-03-22T20:27:00.001+00:002018-03-22T20:29:29.588+00:00Ford B-Max owner review - 2 years onI bought my B-Max from a Ford dealer in Kent just over 2 years ago and I've now done 38000 miles in it. I thought I'd share why I bought it, and hope my insights are useful to others.<br />
<br />
<h3>
Size:</h3>
The car had to be a certain length to fit with the other car on the driveway, so anything too long was immediately out of the question. There's not a huge amount of cars in that bracket that can fit a family of 4, but the extra 6 inches of length and headroom over the fiesta makes a big difference in rear legroom. It means there's enough room for my 18 year old daughter to sit comfortably.<br />
<br />
The boot is just about big enough for two suitcases, as there is a board that comes out, to give a level loading surface, or a slightly deeper boot space. It's packed full for a week-long family of 4 holiday but it's just about enough. We wouldn't survive if my youngest still needed the baby paraphernalia.<br />
<h3>
Spec: </h3>
I bought the Titanium edition, as a key requirement for me was that I wanted cruise control. I commute for 2 hours every day, and you end up with a sore foot otherwise! The Sony stereo is really good quality and I can plug a 128GB <a href="http://amzn.to/2G3vwHg" target="_blank">USB stick </a> and have all my MP3s in the car, with voice control to select the artist or album. There's also a second cigarette lighter plug in the centre console which is ideal for powering chargers for the kids in the back seat.<br />
<h3>
Engine:</h3>
This was one of the most important decisions for me - I wanted an automatic transmission, but that was only offered on the much older 1.6L engine, and the EcoBoost 1.0L engine was more important too me, both for fuel economy and the fact it has start-stop engine technology.<br />
<br />
I went for the 120bhp Ecoboost engine option to give the car a little bit more oomph (the standard engine is 100bhp), and I'm happy to say that unlike my old 1.2L Honda Jazz, I can keep it in 5th gear and still accelerate up hills!<br />
<br />
I use the Android app Fuelio to track my fill-ups, and I'm getting an average of 44.3 mpg.<br />
<br />
<h3>
Servicing:</h3>
I bought a service plan from the dealer for £24 per month, but as I've done more mileage than the salesman put down for, I've exhausted it after 2 years (rather than 3). It was nice to have while it lasted. The only thing that's gone wrong with the car is a brake-light bulb which was spotted and replaced at service. The garage also send you a YouTube video of your car being inspected, which is a nice touch.<br />
<br />
<h3>
What next?</h3>
I'm on a 36 month PCP, and ideally when I get my next car it will be electric or at least hybrid-electric, which sadly with the current range rules out a lot of Ford models. There won't be a new B-Max and the closest two cars - the Fiesta Active and the Ecosport - are both SUV-style, which doesn't really float my boat. I'm keeping a keen eye on the new Nissan Leaf.<br />
<br />
<br />.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-16514442949119178842018-03-11T14:02:00.000+00:002018-03-11T14:02:15.364+00:00Top 3 things to do in Tromso, NorwayA few weeks ago I was lucky enough to visit Tromso in Norway to see the northern lights for my wedding anniversary with my wonderful wife. Rather than sticking everything on TripAdvisor I've documented it here:<br />
<h3>
Flights</h3>
We flew to Tromso from London with Norwegian Airlines. The outbound flight was via Oslo but the return was direct back to London Gatwick. We went Friday morning to Monday evening. We were quite impressed by the transfer in Oslo - as you go through passport control a picture of your suitcase pops up and asks you if this is your luggage. There was also facial recognition for passport control rather than a long queue for a border guard.<br />
<h3>
Hotel</h3>
<div>
The hotel we stayed at was <a href="https://www.google.co.uk/maps/place/Skansen+Hotel+Tromso/@69.6515726,18.9587875,16.02z/data=!4m13!1m7!3m6!1s0x45c4c4526c3b71fd:0x23dca858e6ebed3!2zVHJvbXPDuCwgTm9yd2F5!3b1!8m2!3d69.6492047!4d18.9553239!3m4!1s0x0:0xe63732a18d2ca88!8m2!3d69.6533851!4d18.9605154?hl=en" target="_blank">Skansen</a> hotel. It was fairly basic but nice enough. The staff were incredibly friendly and helpful. It's only a minute's walk into town too. There's a basic breakfast buffet included but no dinner restaurant.</div>
<h3>
Tromso</h3>
Tromso is quite a small city, the airport is a few miles outside, through a network of tunnels, the taxi cost around £15. We went in February and the high street was covered in a couple of inches of ice, but the pavements either side were clear. Where the pavements weren't clear there was a layer of gravel. This is a different approach to the UK, rather than salt to melt the ice the gravel just makes the ice grippier. There's a few shops, and a huge number of hair salons, the reasons for which we couldn't fathom. There's only one shop in the city which has an off-licence, so once we'd found it we bought a bottle of wine for the hotel room. The wine, along with everything else was quite pricey due to Norway's strong economy, and our rubbish one.<br />
<br />
There's a really nice harbour, lots of restaurants and gift shops.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRdo-GLmts4aExySUQMxZIdnPXEvKSrEAiGrPuwvppq3l9_X14mK7wl-9gkL9YTatU-6FokrJeYpbgfdKNUL_mm6Bt06kBbhm8F2jsEvCzrh6NhS5Hs5EHN57Ty4HBHgXeN9HOmb06eZs1/s1600/20180217_090744.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRdo-GLmts4aExySUQMxZIdnPXEvKSrEAiGrPuwvppq3l9_X14mK7wl-9gkL9YTatU-6FokrJeYpbgfdKNUL_mm6Bt06kBbhm8F2jsEvCzrh6NhS5Hs5EHN57Ty4HBHgXeN9HOmb06eZs1/s320/20180217_090744.jpg" width="320" /></a></div>
<br />
<h3>
Restaurants</h3>
We ate out at two really nice restaurants, at different ends of the scale - a pizzeria called <a href="https://www.google.co.uk/maps/place/Peppes+Pizza/@69.6505919,18.9573605,17.42z/data=!4m13!1m7!3m6!1s0x45c4c4526c3b71fd:0x23dca858e6ebed3!2zVHJvbXPDuCwgTm9yd2F5!3b1!8m2!3d69.6492047!4d18.9553239!3m4!1s0x45c4c453143d37c7:0xa20cfb16c23adc48!8m2!3d69.6509565!4d18.9590858?hl=en" target="_blank">Peppe's</a> and a restaurant called <a href="https://www.google.co.uk/maps/place/Kitchen+%26+Table+Troms%C3%B8/@69.6470459,18.9553697,17z/data=!3m1!4b1!4m5!3m4!1s0x45c4c5ac98728583:0xea537c61161e062!8m2!3d69.6470459!4d18.9570061?hl=en" target="_blank">Kitchen and Table</a>.<br />
<br />
We ordered a large pizza between the 2 of us at Peppe's and we're glad we did as I've never felt full after a single slice before, there's no way we could have eaten one each as I was originally considering. It was really nice with a draught beer.<br />
<br />
Kitchen and Table was a different proposition - fine dining, and prices to match, but the food was delicious and strongly recommended. Not a huge choice but everything we had was well presented and very tasty.<br />
<br />
<br />
<br />
With that out the way, here's the top 3 things we did, and would recommend anyone do in Tromso, Norway:<br />
<h3>
3. Polaria</h3>
<div>
<a href="https://www.google.co.uk/maps/place/Polaria/@69.6434299,18.9474214,17z/data=!4m12!1m6!3m5!1s0x45c4c5ac98728583:0xea537c61161e062!2sKitchen+%26+Table+Troms%C3%B8!8m2!3d69.6470459!4d18.9570061!3m4!1s0x0:0xc7ec699ee0c7ce7f!8m2!3d69.643664!4d18.9498442?hl=en" target="_blank">Polaria</a> is an aquarium and education centre a few minutes walk from the centre of Tromso, there's a gift shop, cafe, cinema screen and various bits to see and do.</div>
<div>
<br /></div>
<div>
The cinema screen is a very wide wrap-around display which shows nature and conservation videos on a regular schedule. The main attraction though is the aquarium - there's a walk through glass tunnel where you can observe the two species of seal they have, and a couple of times a day is a really good show with the seals, in which you genuinely believe the seals are enjoying themselves rather than just being about entertainment for the audience. Allow around 3 hours. </div>
<div>
<br /></div>
<div>
<h3>
2. Husky sledding</h3>
We found this prior to the trip on <a href="https://www.tripadvisor.com/AttractionProductDetail-g190475-d11454547-Lapland_Husky_Sled_Safari_from_Tromso-Tromso_Troms_Northern_Norway.html" target="_blank">TripAdvisor</a> and booked through them for the Monday morning starting at 8:30am. Everyone meets in the Clarion hotel near the harbour and a coach takes you to the huskies, which was about a 30 minute journey. Each couple gets a sled and 6 dogs and you're taught everything you need to know to stop/start/control the sleds. It was a great experience and the dogs are lovely. I took a few short videos on my phone as you can only bear to have your hands out of the gloves for around 20 seconds at a time.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgumX2H6AmfQuCN3GxN_IH7jBJVjXTXjMv0x9mOI3FFXF1ipnjvFpo5Yb1LJs40bg0JTKXfvNGKtdYpADrg3JihRvQ3ZQV2C3VfPo3vY9QIWku3K2hKaODd4JSiZIa1NsUtaHvKxzGs8U9p/s1600/20180219_102857.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgumX2H6AmfQuCN3GxN_IH7jBJVjXTXjMv0x9mOI3FFXF1ipnjvFpo5Yb1LJs40bg0JTKXfvNGKtdYpADrg3JihRvQ3ZQV2C3VfPo3vY9QIWku3K2hKaODd4JSiZIa1NsUtaHvKxzGs8U9p/s320/20180219_102857.jpg" width="240" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjizTqofOQH7mZn6z9Ymldu5AGHI6Wav34eW2zcWbX6Bm3bI1GzrrthUW5LyIarZuwQQSuB1x_q7Lc91JauBm8x59JDyF70jvj4ss_VvIBs7oJm3yq5IbpWyVWjUcxxz0_V_gkqX-GwQoxc/s1600/20180219_105106.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1200" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjizTqofOQH7mZn6z9Ymldu5AGHI6Wav34eW2zcWbX6Bm3bI1GzrrthUW5LyIarZuwQQSuB1x_q7Lc91JauBm8x59JDyF70jvj4ss_VvIBs7oJm3yq5IbpWyVWjUcxxz0_V_gkqX-GwQoxc/s320/20180219_105106.jpg" width="240" /></a></div>
<br /></div>
<div>
<br /></div>
<h3>
1. Aurora tour</h3>
<div>
Again we found the tour on TripAdvisor prior to arrival. A minibus picked us up at 7:30pm along with 5 others and we set of in search of the darkest place we could find. Once away from the lights of the city, the sky was magnificent, and we didn't have to wait long.<br />
We were very lucky to have two good 'shows' on the night, one about an hour into the trip and one just before midnight. There had been a solar 'storm' about 5 days before and I think we caught the tail end of it. Within 2 hours of getting out of the minibus we were all desperate for the provided snow-suits and warm snacks despite already wearing every item of clothing we had. I alternated between marshmallows over the fire, and nipping to my camera to take more photos.<br />
<h4>
Photographing the lights</h4>
</div>
I took my Canon EOS 650D SLR with the Canon 17-85mm lens and a Manfrotto tripod. I used a 20-30 second exposure with the lens wide open most of the time (lowest F-stop), focussed manually at infinity. I set the ISO to 400-800 and recorded the images in JPG+RAW so I could post-process them afterwards.<br />
<br />
An article I read warned about dew building up on the lens, but I didn't have any such problems, and the battery survived the cold temperatures fine. Here's a couple of photos taken straight from the back of my SLR screen. If you're interested in seeing the full-size processed images let me know!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeASYpjCiBy4K6US7aeBJgo7lxWNImukPiCYCGBmgcCgXbud4M3k7u6OXPBK5eoQBg8z8sY_nyeJIH9Np88fMX8eG9AEcGZLmrcz1jjQD8tKwS9hW6QwNzi3PjdTnWljDnR5IAyLwdEIHW/s1600/20180218_083422.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeASYpjCiBy4K6US7aeBJgo7lxWNImukPiCYCGBmgcCgXbud4M3k7u6OXPBK5eoQBg8z8sY_nyeJIH9Np88fMX8eG9AEcGZLmrcz1jjQD8tKwS9hW6QwNzi3PjdTnWljDnR5IAyLwdEIHW/s320/20180218_083422.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheyo41f0tk5IghSQtViTde1cfpX39Ks3CE4z7V9wPawgjlMHPhOF_xVcSBKKNhbLeC-xx02AsPKOCnSURJWR_16iNEoQPwKaA0uD9-i-nyoClVUqr2M6oAFDDrWu3q6KZheA0rGiS1f5vN/s1600/20180218_083514.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1200" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheyo41f0tk5IghSQtViTde1cfpX39Ks3CE4z7V9wPawgjlMHPhOF_xVcSBKKNhbLeC-xx02AsPKOCnSURJWR_16iNEoQPwKaA0uD9-i-nyoClVUqr2M6oAFDDrWu3q6KZheA0rGiS1f5vN/s320/20180218_083514.jpg" width="320" /></a></div>
<br />
A few people didn't have their own cameras, but the guide took many of his own pictures and shared them with us afterwards, including ones with us in them, by 'painting' us in with a torch flash to get the exposure correct.<br />
<br />
We were really lucky to be able to see the aurora and we've just had it blown up on a large canvas to put in our hallway.<br />
<br />
I would not hesitate to recommend Tromso, there's no guarantee you'll see the lights but it's a brilliant experience - just wrap up warm!.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-75833595528198015002018-01-13T10:49:00.002+00:002018-03-22T20:29:50.101+00:00Asus MB169B+ USB MonitorNow 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. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH5xw3IFVMd-fcfPb85WFnnaxEG4MEdtkutZWKGBnvpk-GP2CZV0KBqneSNzDK0lRuIcDHFmUwXnV4uZyPPFp38-tPhC2s76CrHXT17j73yvy8JF0g2MAjk_OT3ZDqIKzOJHbSJGXOKVwu/s1600/P_setting_fff_1_90_end_500.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="500" data-original-width="500" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH5xw3IFVMd-fcfPb85WFnnaxEG4MEdtkutZWKGBnvpk-GP2CZV0KBqneSNzDK0lRuIcDHFmUwXnV4uZyPPFp38-tPhC2s76CrHXT17j73yvy8JF0g2MAjk_OT3ZDqIKzOJHbSJGXOKVwu/s320/P_setting_fff_1_90_end_500.png" width="320" /></a></div>
<br />
<br />
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.<br />
<br />
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.<br />
<br />
You can <a href="http://amzn.to/2CUNrCi" target="_blank">Buy the MB169B+ here</a><br />
<br />.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-38030891305461970272018-01-13T10:40:00.000+00:002018-03-22T20:10:18.941+00:00"Invalid Username or password" when mapping a network drive for a Windows serviceAnother recent issue I've come across required such a bizarre fix I thought I'd document it here in case it helps anyone else.<br />
<br />
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).<br />
<br />
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:<br />
<br />
1) Try to map the drive using a Windows Scheduled Task running as SYSTEM user, to run a batch file with a <b>net use</b> command in.<br />
<br />
2) Try to map the drive using an administrative command prompt and the SysInternals PsExec tool (psexec -s -i cmd.exe)<br />
<br />
3) Try to save the credentials for the network location in Windows Credential Manager<br />
<br />
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.<br />
<br />
After much more reading, it turns out that:<br />
<br />
a) Each user has it's own record of mapped drives and credentials (which we knew anyway).<br />
b) In some cases, such as Windows Services, different logon sessions for the same user have different mapped drives.<br />
c) All Windows services running as the same user share the same session.<br />
<br />
It was (c) that allowed us to finally find a (slightly Frankenstein-esque) solution.<br />
<br />
If you create a new windows service (using C# and <a href="http://docs.topshelf-project.com/en/latest/overview/commandline.html" target="_blank">TopShelf</a> for example) which shells out (System.Diagnostics.Process.Start) to run the <b>net use</b> 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!<br />
<br />
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 (<b>net use * /d</b>)<br />
<br />
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..http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-54624336088268912542018-01-12T07:50:00.001+00:002018-01-12T20:02:49.677+00:00IIS w3wp hangs indefinitely with low cpu<p dir="ltr">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. </p>
<p dir="ltr">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! </p>
.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-62769294213662714462018-01-10T20:25:00.001+00:002018-03-22T20:29:50.090+00:00Matched betting with OddsMonkeyLate 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.<br />
<br />
<h3>
How it works</h3>
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.<br />
<br />
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.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd5TPBNsZK8t2idadOfiZyBm97Pa5bW3p5fxoQCP3g0Kc-lWipHOwUoXmoZJt8oIOYf9sJJveh_mRIAkWjlgsb50EQbd9cQrR7chGfxGBxl3ZokSurrt0rkRKGiCB7S6joKdWSQ1TPIrst/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="614" data-original-width="623" height="315" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd5TPBNsZK8t2idadOfiZyBm97Pa5bW3p5fxoQCP3g0Kc-lWipHOwUoXmoZJt8oIOYf9sJJveh_mRIAkWjlgsb50EQbd9cQrR7chGfxGBxl3ZokSurrt0rkRKGiCB7S6joKdWSQ1TPIrst/s320/Capture.PNG" width="320" /></a></div>
<br />
<br />
<h3>
So what is a betting exchange?</h3>
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%).<br />
<br />
<h3>
Expected value and casino offers</h3>
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.<br />
<h3>
What is Oddsmonkey?</h3>
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.<br />
<h3>
<br />Expected earnings</h3>
<h3>
<span style="font-weight: normal;"><span style="font-size: small;">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.</span></span><br />
<br />
Downsides</h3>
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.<br />
<br />
If you're interested, you can <a href="https://www.oddsmonkey.com/affiliates/affiliate.php?id=56143" target="_blank">sign up here</a>.<br />
<br />.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-70727011955828262692018-01-06T22:59:00.000+00:002018-01-06T22:59:52.758+00:00Starting small scale investingEntering 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.<br />
<br />
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.<br />
<br />
If you're interested, you can <a href="http://etoro.tw/2COvO43" target="_blank">sign up here</a>, and maybe follow me..http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-59483787193870120342018-01-06T22:23:00.001+00:002018-01-06T22:23:42.020+00:00Discovery PlanetI'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).<br />
<br />
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 <a href="https://www.patreon.com/discoveryplanet" target="_blank">Patreon</a> link. For anyone who can afford to do so, any financial support goes a long way towards making these events possible.<br />
<br />
<br />
The next event is due to be announced shortly, and will revolve around <a href="https://en.wikipedia.org/wiki/DNA" target="_blank">DNA</a>. You can keep up to date on <a href="https://www.facebook.com/DiscoveryPlanetRamsgate/" target="_blank">the Facebook page</a>. I hope to see you there!.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-58598956247105447872015-10-31T10:43:00.000+00:002018-03-22T20:29:50.078+00:00Milight Smart LED bulb review<div dir="ltr">
I've just bought a Milight bridge, 9W RGBW bulb and 2.4Ghz remote. All from Amazon Uk (from sellers Datawize, BatteryLogic). From researching online it seems there's at least 5 different names for these bulbs (milight, easybulb, led logic, limitlessled, etc). The seller of the bridge/hub/controller/box/thingy assures me it's version 4 (there have been 5 versions) but I can't see how to tell without taking it apart. </div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
I downloaded the android app 'Milight 2.0' by 'Sunny' which seems to be the official app. The instructions actually refer to 'Mi.light' app, which seems to look and work exactly the same (i.e. not very well). I managed to use the app to find the bridge by connecting to it's own Wifi network. You can then go into configuration and "AP configure" which allows you to join it to your own Wifi network. The inbuilt wifi then seems to turn itself off.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
Now at this point I repeated the above steps several times, because I couldn't (or rather the app couldn't) see it after it had been configured. You can re-set the thing by holding in the hidden reset button with a pin until the lights flash rapidly.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
I also at this point went into my router settings and made sure DHCP would always give it the same IP address (based on its MAC address).</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
After a few attempts I went back to the Play store and found the Wifi RGB Led controller app by Cold-Core which actually recognized the bridge and allowed me to pair it with the bulb (to do this, turn on the bulb at the switch and press "on" on one of the zones (1-4) within 3 seconds - the bulb will then flash 3 times for success. The pairing process is identical for the plastic remote control.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
Now that all worked I configured the openhab binding by following this page <a href="https://github.com/openhab/openhab/wiki/Milight-Binding">https://github.com/openhab/openhab/wiki/Milight-Binding</a> - substituting my newly assigned static IP address and putting port 8899 and using channel number 6 rather than 1 to reflect how the new bulbs/bridges work. I can now turn bulbs on/off and change colour both remotely and automatically (e.g. when home is unoccupied, or when i stumble downstairs in the middle of the night).</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
With that all working, overall I'm impressed - for a fraction of the price of Hue/Lifx they seem to do the job. The only downside I can see is they don't report status, so sending messages is "fire-and-forget". I haven't had any problems so far however.</div>
<div dir="ltr">
<br /></div>
<div dir="ltr">
There's some detail on development and versioning of the APIs, bridges etc on <a href="http://www.limitlessled.com/dev/">www.limitlessled.com/dev/</a></div>
.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-62598613447122349452015-06-21T09:15:00.000+01:002015-06-21T09:15:01.521+01:00Quainton Village SocietyJust a quick one to say I'm now hosting another website for the folks in Quainton - check it out at <a href="http://www.quaintonvillagesociety.org/" target="_blank">Quainton Village Society</a>.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-63444458621730039072014-12-10T19:21:00.001+00:002014-12-10T19:22:09.152+00:00Getting the Dell Laser printer C1760nw working on 64 bit DebianI've just taken delivery of a Dell C1760nw from Amazon for just over £100 to replace the knackered inkjet which went before it. As expected, getting the drivers working wasn't plain sailing, so for everyone else's benefit, here's what worked for me:<br />
<br />
1) Download the 32 bit deb from here: <a href="http://www.support.xerox.com/support/phaser-6000/downloads/engb.html?operatingSystem=linux&fileLanguage=en_GB">http://www.support.xerox.com/support/phaser-6000/downloads/engb.html?operatingSystem=linux&fileLanguage=en_GB</a><br />
2) Open a terminal as root<br />
3) dpkg --add-architecture i386<br />
4) apt-get update<br />
5) apt-get install libcupsimage2:i386<br />
6) dpkg -i xerox-phaser-6000-6010_1.0-1_i386.deb<br />
<div>
7) /etc/init.d/cups restart</div>
<div>
8) Navigate to http://localhost:631</div>
<div>
9) Add a printer (<span style="background-color: white; font-family: 'lucida grande', geneva, helvetica, arial, sans-serif;">Xerox Phaser 6000B v1.0)</span></div>
<div>
<span style="background-color: white; font-family: 'lucida grande', geneva, helvetica, arial, sans-serif;">10) Print test page</span></div>
<div>
<span style="background-color: white; font-family: 'lucida grande', geneva, helvetica, arial, sans-serif;">11) Celebrate.</span></div>
<div>
<span style="background-color: white; font-family: 'lucida grande', geneva, helvetica, arial, sans-serif;"><br /></span></div>
.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-11038900595080292302014-10-30T17:02:00.002+00:002014-11-02T10:56:08.035+00:00My Z wave and Openhab configurationOver the last few weeks I've dived into Z Wave home automation with both feet, and now have several things working well (after much fiddling). For those of you thinking of doing the same, or having issues with anything, you might want to look over <a href="https://github.com/richbeales/openhab-cfg">my github repository</a> which contains my openhab configuration files.<br />
<br />
I'm using <a href="http://www.openhab.org/">OpenHAB</a> and I've been nothing but impressed with it, fully open source, and the <a href="http://groups.google.com/forum/#!forum/openhab">google group</a> is insanely helpful (Thanks <a href="https://github.com/cdjackson/HABmin/">Chris</a>!)<br />
<br />
I'm currently using:<br />
An ASUS eeePC 901 running Debian Jessie<br />
An Aeon Labs Z-Stick S2 USB Zwave stick<br />
2 x Aeon Labs 4 in 1 multisensors<br />
2 x Vision Security door/window sensors<br />
3 x TKB Home wall plugs<br />
1 x Horstmann ASR-ZW + HRT4-ZW boiler control / thermostat combo<br />
<br />
I'm currently implementing the "wasp in a box" presence detection to control heating temperatures to attempt to save money, and busy thinking of more use cases for it.<br />
<br />
I'll commit to the repo whenever anything changes, and hopefully keep you updated here if I remember..http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-87159213708800124542014-06-27T19:47:00.001+01:002014-11-02T10:56:08.040+00:00First Adventure with Z-Wave Home AutomationAs we're (hoping to) soon be moving house, I wanted to look into home automation, starting with a set of Philips Hue lightbulbs on my wishlist, but reading led to yet more reading and I've ended up with the beginnings of a Z-Wave network.<div>
<br /></div>
<div>
I've purchased an Aeon Labs USB stick to stick in the side of my old unused netbook, and am dabbling with <a href="https://code.google.com/p/python-openzwave/">python-openzwave</a>. My first task was just to get the sensors (Aeon labs MultiSensor) recognised, and then start building some logic to monitor the temperature and turn on a fan if it rises above a threshold.</div>
<div>
</div>
<div>
I've put some code up on github called <a href="https://github.com/richbeales/flask-openzwave">flask-openzwave</a> which I hope to grow as I learn more about Open ZWave.</div>
<div>
<br /></div>
<div>
Maybe foolishly, I decided this would be more fun than just buying a box (essentially another linux computer) pre-build with pre-made software. The only thing I'll miss is a nice Android app, but this can be mitigated by some keyfobs and a REST-like web interface. My wife will love it (maybe)...</div>
<div>
<br /></div>
<div>
<br /></div>
.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-87952259355595227312014-04-29T19:50:00.000+01:002014-04-29T19:50:04.387+01:00Your machine slowly runs out of disk space after using Assembly Binding Log Viewer<span style="font-family: inherit;">I came into the office this morning to find my laptop complaining that disk space on drive C: was critically low - which was odd as my 240GB SSD should be less than half full.</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">After running <a href="http://www.uderzo.it/main_products/space_sniffer/download.html">SpaceSniffer</a> it was taking ages in C:\Windows\system32, further digging through the graph pointed me to <span style="line-height: 19.9999942779541px;"><b>C:\windows\system32\config\systemprofile\appdata\local\content.ie5</b> which had around 300,000 files in it. All of them were .htm files, so I (tentatively) opened a file up in Vim (so it wouldn't run any scripts, etc). It was then I realised what they were - all of them - were "</span><span style="line-height: 17.549999237060547px;"><i>Assembly Binder Log Entry</i>" </span><span style="line-height: 17.549999237060547px;">files.</span></span><br />
<span style="line-height: 17.549999237060547px;"><span style="font-family: inherit;"><br /></span></span>
<span style="font-family: inherit;"><span style="line-height: 17.549999237060547px;">I then remembered several weeks ago trying to debug a .NET assembly binding issue, and I'd turned on "Log all binds to disk" in </span><a href="http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx" style="line-height: 17.549999237060547px;">Fuslogvw.exe</a><span style="line-height: 17.549999237060547px;">, fixed my problem but didn't really "click" that it needed turning off afterwards. I naively assumed it would only be logging for the duration I had fuslogvw open. Wrong!</span></span><br />
<span style="font-family: inherit;"><span style="line-height: 17.549999237060547px;"><br /></span></span>
<span style="font-family: inherit;"><span style="line-height: 17.549999237060547px;">Clearing out the Temp htm files from the above location (by running explorer.exe as an administrator and granting myself permissions) only freed up around 500MB however, I was still missing around 100GB(!). </span></span><br />
<span style="font-family: inherit;"><span style="line-height: 17.549999237060547px;"><br /></span></span>
<span style="font-family: inherit;"><span style="line-height: 17.549999237060547px;">Running spacesniffer again gave me a new location to investigate: </span><span style="line-height: 19.9999942779541px;"><b>C:\windows\syswow64\config\systemprofile\appdata\local\content.ie5</b> - which makes sense as it's a 64 bit machine running mainly 32 bit binaries. However, no matter how many times I tried, I couldn't grant myself access, there were simply too many files and it kept timing out.</span></span><br />
<span style="line-height: 19.9999942779541px;"><span style="font-family: inherit;"><br /></span></span>
<span style="line-height: 19.9999942779541px;"><span style="font-family: inherit;">In the end I followed the <a href="https://superuser.com/questions/598601/what-is-system32-config-systemprofile">process listed here</a> to use psexec to open a command prompt as the relevant user, and set off a <b>del *.htm</b> command which took a good 6 hours to complete, but at least I've got my disk space back, and I won't be making that mistake again in a hurry.</span></span><br />
<span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;"><br /></span>
<br />
<br />
<br />.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-55532267478473309752013-11-17T20:20:00.002+00:002013-11-17T20:20:59.813+00:00Controlling lights from the web using Raspberry Pi and ArduinoI've just got back from a weekend with my parents, where I had lots of fun attempting to get an Arduino Uno to control a cheap set of remote control mains sockets. My dad has a set of 3 of these (<a href="http://www.maplin.co.uk/remote-controlled-mains-socket-set-531547">http://www.maplin.co.uk/remote-controlled-mains-socket-set-531547</a>) and has them plugged into desk and pedestal lamps in the living room. Since my last two christmas/birthday presents to him were a Raspberry Pi Model B, and a book about home automation using Arduino, he'd picked up an Arduino starter kit from Amazon, and had bought a second remote control and taken it to pieces, all we needed was some solder and some code.<br />
<br />
First step, solder 3 wires onto the remote control extracted from the plastic housing, as per <a href="http://blog.sui.li/2011/04/12/163/">http://blog.sui.li/2011/04/12/163/</a>, and connect it up to the Arduino's 5V, ground and digital out pins (I chose pin 11).<br />
<br />
Next, import the library from <a href="https://code.google.com/p/rc-switch/">https://code.google.com/p/rc-switch/</a>, then write a quick app to set switch one on and off. Once we'd proved this works, we worked through a quick example using a photodetector, then decided it'd be fun to get this working over the web. Since we didn't have any network connectivity, we roped in the Raspberry Pi to serve a very basic website, and use the Pi's GPIO to signal to the Arduino to turn on the lights. I hope you'll forgive the gross insecurity of the web server, but it's quick and does the job - here's the code:<br />
<h3>
Python Code: </h3>
<blockquote class="tr_bq">
<span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">#! /usr/bin/python</span></blockquote>
<blockquote class="tr_bq">
<br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">import sys</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">import RPi.GPIO as GPIO</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">import BaseHTTPServer</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">from SimpleHTTPServer import SimpleHTTPRequestHandler</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">class LightsHandler(</span><wbr style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"></wbr><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">SimpleHTTPRequestHandler):</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> def do_GET(self):</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> print "handling " + self.path</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> if ("lightson" in self.path):</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> self.lights_on()</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> elif ("lightsoff" in self.path):</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> self.lights_off()</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> self.send_response(200,'OK')</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> def lights_on(self):</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> print "on"</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> GPIO.output(18, True)</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> def lights_off(self):</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> print "off"</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> GPIO.output(18, False)</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">HandlerClass = LightsHandler</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">ServerClass=BaseHTTPServer.</span><wbr style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"></wbr><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">HTTPServer</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">Protocol="HTTP/1.0"</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">server_address= ("", 8080)</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">HandlerClass.protocol_version = Protocol</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">httpd = ServerClass(server_address, HandlerClass)</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">sa = httpd.socket.getsockname()</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">print "serving"</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">GPIO.setmode(GPIO.BOARD)</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">GPIO.setup(18, GPIO.OUT)</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">httpd.serve_forever()</span></blockquote>
<br />
<h3>
Arduino Code:</h3>
<br />
<span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">#include <rcswitch .h=""></rcswitch></span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">RCSwitch mySwitch = RCSwitch();</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">int d_raspPiInputPin = 10; </span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">int d_transmitterPin = 11;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">int onboardLedPin = 13;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">int lightsOn = 0;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">int delayTimeout = 1000;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">int delayCommand = 500;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">int valueFromPi = 0;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">void setup()</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">{</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.enableTransmit(d_</span><wbr style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"></wbr><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">transmitterPin);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> pinMode(onboardLedPin, OUTPUT);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> pinMode(d_raspPiInputPin, INPUT);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> Serial.begin(9600); </span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">}</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">void loop()</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">{</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> valueFromPi = digitalRead(d_raspPiInputPin);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> if(valueFromPi == HIGH){</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> allLightsOn();</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> }</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> else {</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> allLightsOff();</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> }</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayTimeout);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">}</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">void allLightsOn() </span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">{</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> if (lightsOn == 0) {</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOn(1, 1);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOn(1, 2);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOn(1, 3);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOn(1, 4);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> lightsOn = 1;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> }</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> digitalWrite(onboardLedPin, HIGH);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">}</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">void allLightsOff() </span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">{</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> if (lightsOn == 1) {</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOff(1, 1);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOff(1, 2);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOff(1, 3);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> mySwitch.switchOff(1, 4);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> delay(delayCommand);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> lightsOn = 0;</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> }</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;"> digitalWrite(onboardLedPin, LOW);</span><br style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;" /><blockquote class="tr_bq">
<span style="background-color: white; color: #222222; font-family: 'Times New Roman', Times, serif; font-size: 13px;">}</span> </blockquote>
<br />
<br />
And a photo of the Arduino all wired up:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisGmaCSmawdkW-7rAW_L-GA_sdOkUjSfS23O-bJt87LTKERI7e02zEmBm3odkAZVdGZ1UR3HhNe2O5AsnboK-bhs_BboOOyzASBRlkl-NzKWFZyf5RgxqFvgBCNVw0BQRdqUK-yjMJYNOt/s1600/IMAG0878.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisGmaCSmawdkW-7rAW_L-GA_sdOkUjSfS23O-bJt87LTKERI7e02zEmBm3odkAZVdGZ1UR3HhNe2O5AsnboK-bhs_BboOOyzASBRlkl-NzKWFZyf5RgxqFvgBCNVw0BQRdqUK-yjMJYNOt/s400/IMAG0878.jpg" width="225" /></a></div>
<br />
Notes:<br />
<br />
<ol>
<li>Don't forget to connect the grounds of the Pi and the Uno together</li>
<li>We used GPIO 18 on the Pi as a digital output connected to pin 10 on the Uno</li>
<li>Be careful if you're using the Pi for digital input as it'll only take 3.3 Volts</li>
<li>We used the onboard LED on the Uno to check that we were sending the right signals to the transmitter</li>
<li>We needed a short delay between sending commands to the transmitter, otherwise we'd only get some rather than all the lights to respond.</li>
<li>You'll need to run the python script under sudo to be able to write to the GPIO</li>
</ol>
.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-6497908920168686912013-11-11T20:22:00.001+00:002013-11-11T20:22:02.863+00:00BBC's websites killing Press and threatening local democracy, says Theresa May - TelegraphI'm all for competition and freedom of expression, but on the other hand, I've already paid for the BBC (whether I like it or not - but on the whole I like it), so if I can get good content and news that I've already paid for, she's right I'm not going pay someone else for the same thing:<br />
<br />
<a href="http://www.telegraph.co.uk/culture/tvandradio/bbc/10441188/BBCs-websites-killing-Press-and-threatening-local-democracy-says-Theresa-May.html">BBC's websites killing Press and threatening local democracy, says Theresa May - Telegraph</a>: <br />
<br />
<a href="https://chrome.google.com/webstore/detail/pengoopmcjnbflcjbmoeodbmoflcgjlk" style="font-size: 13px;">'via Blog this'</a>.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-14658708855523549692013-11-11T19:47:00.001+00:002013-11-11T19:47:18.817+00:00Tetris & The Power Of CSSI found this link today, it's an excellent read, and explains succinctly what I've been wanting to do with my photo library for ages.<br />
<br />
<a href="http://www.heydonworks.com/article/tetris-the-power-of-css">Tetris & The Power Of CSS</a><br />
<a href="https://chrome.google.com/webstore/detail/pengoopmcjnbflcjbmoeodbmoflcgjlk" style="font-size: 13px;">'via Blog this'</a><br />
<br />
Another good one, which I haven't got round to implementing yet is this:<br />
<br />
<a href="http://www.crispymtn.com/stories/the-algorithm-for-a-perfectly-balanced-photo-gallery">The algorithm for a perfectly balanced photo gallery</a><br />
<br />
<br />.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-2299706014748606422013-10-25T21:33:00.001+01:002013-10-25T21:33:13.264+01:00Get your year's worth of free EverNote Premium<a href="http://blog.evernote.com/blog/2013/10/25/evernote-partners-with-uk-mobile-carrier-o2/">Evernote Partners with UK Mobile Carrier O2 Evernote Blog</a>: <br />
<br />
<a href="https://chrome.google.com/webstore/detail/pengoopmcjnbflcjbmoeodbmoflcgjlk" style="font-size: 13px;">'via Blog this'</a>.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-56492734342405682462013-10-19T12:42:00.002+01:002013-10-19T12:42:39.043+01:00Fixing slow performance on mod_wsgiI've just spent a couple of hours investigating why one of my sites has been responding so slowly, to the point where the <a href="http://www.montastic.com/" target="_blank">monitoring software</a> would report that the site was down - after a bit of reading and racking my memory I realised that in the past I had limited the number of threads and processes WSGI could use to serve the site.<br />
<br />
I'm using <a href="http://flask.pocoo.org/docs/" target="_blank">Flask</a> and <a href="https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives" target="_blank">mod_wsgi</a> on <a href="http://webfaction.com/" target="_blank">Webfaction</a> and so my config was under:<br />
<blockquote class="tr_bq">
~/webapps/[app_name]/apache/conf/httpd.conf</blockquote>
In my effort to save memory, back when WebFaction only offered 256MB of RAM, I'd gone through my sites and set the threads and processes to "2" for the wsgi process:<br />
<blockquote class="tr_bq">
WSGIDaemonProcess app_name processes=2 python-path=... threads=2</blockquote>
I'd also set MaxSpareThreads 2 (down from the default 3) and ThreadsPerChild 2.<br />
<br />
After checking performance with <a href="http://www.serverstatus.co.uk/en/quicktest.php" target="_blank">serverstatus</a> and checking memory usage with <a href="http://wiki.webfaction.com/attachment/wiki/MiscellaneousFiles/memory_usage.py" target="_blank">this script</a>, I settled on<br />
<blockquote class="tr_bq">
MaxSpareThreads 3<br />
MinSpareThreads 1<br />
ServerLimit 1<br />
ThreadsPerChild 16<br />
WSGIDaemonProcess ... processes=8 threads=16</blockquote>
Which took my response time down from around 15 seconds (which even with 2 threads and processes seems slow) to around 2 seconds from cold and well under a second when warm (the second check after restarting apache). Much better!<br />
<br />
Memory usage seems to be around 22MB per process, but with <a href="https://blog.webfaction.com/2013/10/memory-doubled/" target="_blank">512MB of RAM to play with</a>, there's plenty of headroom..http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-51010690911297081942013-10-17T22:02:00.001+01:002013-10-17T22:02:35.588+01:00Moving to Bootstrap v3 and a CDNI've just spent the evening changing jQuery and Twitter Bootstrap from locally hosted assets to be pulled down from Google's Content Delivery Network.<br />
<br />
This is something I should have done much earlier, but I never did - my brain would say "what if the CDN goes down - that would make my site look bad". I've only just realised how ridiculous that sounds; if Google's network goes down, the internet's got bigger problems than my site looking odd.<br />
<br />
So, after a bit of research, I chose <a href="https://developers.google.com/speed/libraries/devguide" target="_blank">Google's CDN</a> over JQuery's own as users are more likely to have the Google version in their cache. Sadly Google don't yet have Bootstrap available, so be sure to <a href="https://code.google.com/p/google-ajax-apis/issues/detail?id=637" target="_blank">star this bug</a> to make it happen, so I chose <a href="http://www.bootstrapcdn.com/" target="_blank">bootstrapcdn.com</a> to host my bootstrap CSS and Javascript.<br />
<br />
That was all very easy and straightforward, and the latest version of JQuery worked absolutely fine... Bootstrap however has been upgraded to v3, which the CDN gives you by default, so rather than finding out how to get the v2 branch, I thought I "may as well" upgrade. Turns out, they've changed quite a lot of things.<br />
<br />
2 hours later, and with a massive thanks to the <a href="http://upgrade-bootstrap.bootply.com/" target="_blank">Bootstrap 3 upgrade service</a> everything looks and works more-or-less how it did before I started, and my sites should be a fraction quicker too.<br />
<br />
If you're not convinced, check out this article for <a href="http://encosia.com/3-reasons-why-you-should-let-google-host-jquery-for-you/" target="_blank">3 good reasons to move to a CDN</a><br />
<br />
<br />.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-14701155854246329382013-08-30T18:34:00.001+01:002013-08-30T18:34:15.292+01:00The Scale of the Universe - An Interactive Flash Animation<a href="http://scaleoftheuniverse.com/">The Scale of the Universe - An Interactive Flash Animation</a>: <br />
<br />
<a href="https://chrome.google.com/webstore/detail/pengoopmcjnbflcjbmoeodbmoflcgjlk" style="font-size: 13px;">'via Blog this'</a>.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-9736451403885026422013-08-17T07:44:00.003+01:002013-08-17T07:44:40.014+01:00Hiring a gardenerAfter 7 years in our house, and roughly 6.99 years spent ignoring our garden, we finally decided to get a gardener in. Within the first 3 hour session he'd already uncovered 3 fence panels in the back garden which we'd never seen before (they'd been covered in crawling plants growing over from next door). I'm now looking forward to seeing how our garden should look, without putting any actual effort in.<br />
<br />
So, if you're in the Thanet area of Kent, and looking for a well priced, competent gardener, check out <a href="http://www.albiongardening.co.uk/" target="_blank">Albion Gardening</a>.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0tag:blogger.com,1999:blog-8131135633378402004.post-75237086164679901452013-05-17T08:03:00.001+01:002013-05-17T08:04:02.734+01:00The Pass Lane Driving School redesign<p dir=ltr>I've just pushed a major redesign of my wife's driving school website live. The old site was done 3 years ago and was looking a bit tired. So if you're looking for <a href="http://www.thepasslane.co.uk">Driving lessons in Ramsgate, Margate or Broadstairs</a>, check it out and let me know what you think! </p>
.http://www.blogger.com/profile/03643184665586334973noreply@blogger.com0Ramsgate, Ramsgate51.335545 1.419895