Shane Duffy

If you need to clear the DNS resolver cache on a Mac OSX computer here are some handy command line tips.

Over the years with different versions of Mac OSX yosemite, leopard, mountain lion Apple has changed the command that you will need to use.

OSX 10.10 Yosemite

sudo discoveryutil udnsflushcaches

OSX 10.9 Mavericks

dscacheutil -flushcache; sudo killall -HUP mDNSResponder
OSX 10.7 - 10.8 Lion & Mountain Lion
sudo killall -HUP mDNSResponder

OSX 10.5 - 10.6 Leopard & Snow Leopard
sudo dscacheutil -flushcache

Any one who is using windows its stayed the same over the years

Windows
ipconfig /flushdns


 

After getting a CurrentCost energy monitor a week ago I decided it was time to get some useful data out of it. I have 3 phase power so I wanted a tool which would create graphs for each of the phases along with combined total data. The solution to my problems would have to be custom coded and I also wanted an application which could be used cross platform as I regularly use both Windows and OSX.

My choice was to use Adobe Flex as it can provide some nice looking graphs and I have been meaning to do more work using the Flex in flash player or using Adobe Air technology to create a desktop application.

CurrentCost Application

CurrentCost Application

Im creating an application which I can give back to the community which have been developing applications already for the CurrentCost meter. So I decided to use a very simple architecture for this first demo application which uses a simple client server model.

This is a quick follow up post to my earlier one about creating timemachine backups on a network share.

A good tip/trick for anyone who has setup backups to a network share is to disable spotlight from indexing this volume as it slows down the backup process a lot. This can easily be disabled by going to the spotlight panel in system preferences.

To avoid this slow down, as soon as the share is mounted for the backup process go to Spotlight’s Privacy panel in System Preferences. Use the ‘+’ button at the bottom, select your backup share, and Spotlight will then ignore it. If Spotlight has already started indexing it, it should immediately stop and the backup will speed up.

spotlight

Having got a CC128 currentcost energy monitoring device recently and have been playing with it writing some nice new software but the main aim was to cut down on the power usage which comes from leaving devices plugged in and not used around the house.

The currentcost device needs to be plugged into power which limits where you can go with it and its makes it a bit unfriendly to go around the house finding devices which are using power.While doing some research for writing my application I noticed this picture with a battery pack powering the currentcost unit.

For any one who wants one this is all you need.

  1. Battery pack
  2. DC Power Plug 2.8mm
  3. PP3 Clip + Cable

Very simple to put together and you will end up with something which looks like this and can be used to power your currentcost while you move around the house finding devices which are using power.

Current Cost Battery Pack

Current Cost Battery Pack

Sorry for the bad photo used the phone as I was too lazy to get the camera out.

I decided to get some logging data from the CurrentCost (cc128) model which I have but I was having issues with getting data from the /dev/ttyUSB0 port at which it was attached using the pl2303 drivers for usb to serial.

A simple cat of /dev/ttyUSB0 lead to just gibberish been output on the terminal. Poking around at the system I found that the cable im using has the pl2303x chip set which can have driver issues with some older kernel modules. There are patchs for the older kernal modules which stop this device been picked up as the older incompatible pl2303 (see here).  The real cause of my problems was the serial port settings which I was able to resolve by using minicom to set the right settings for the port.

The cc128 uses 57600 bps 8N1

You can use the minicom application to set this and then using cat /dev/ttyUSB0 will work fine for you.

Ill add another update later once I start logging the data. Plan is to be able to log all data to mysql DB, create a RRD file at the same time for some simple graphs and also allow a real time feed of the application in the form of an AJAX web client I think.

Update: Just found the link to the full xml spec of the CurrentCost cc128 v11 that I have thanks to the CurrentCost founder MartinDix

On a note for anyone who needs to factory reset there CurrentCost energy monitor you can just hold down any 2 of the buttons when powering up the device and it will reset everything to factory defaults.

For a while now I have been looking at different products which can provide an insight into electrical energy usage with a realtime display and preferably a link to a computer to provide logging, graphing and analysis. Just when I though I would be building my own with some current induction clamps I came across www.currentcost.co.uk which provides a energy monitoring device which can be plugged into a computer using usb port (Serial over USB connection).

CurrentCost cc128 Energy Monitor

CurrentCost cc128 Energy Monitor

I ordered the device after emailing the company and discussing my needs and figuring out what I would need to monitor a 3 phase power connection which I have at the house. The currentcost setup is really simple it is a basic induction loop in the form of a cable clamp which is placed around the power cables in your meter box and connected to a transmitter box. The receiver is a nice display which can store historical data and show current energy usage and give a guide cost of the usage.

I think this device is a very cool idea as it also the basic user to get an idea of whats wasting electricty even when they are asleep at night and for the more advanced user it also provides access to data every 6 seconds and monitoring of up to 10 individual devices through the base station. The device allows you to see how much a device uses by showing your the changed usage when you switch something on like your dishwasher.

I have only been using the device for a few hours now and im really liking it already, Spotting lots of devices which are left on all the time wasting power and costing extra for no reason. I can see loads of usage for this and will be creating a few applications for this device.

At some stage most of us have needed to work on our websites and move things around, For most people would do this live on the website and this does not make for a great experience for your customers and clients who end up visiting broken and half finished pages. Or even worse the search engine crawlers that come along and find sample text on your pages.

One of the neat tricks of a .htaccess file is been able to enable a maintenance page for all your visitors to your website but still been able to access the website yourself for testing and development.

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^86\.43\.107\.123
RewriteCond %{REMOTE_HOST} !^86\.43\.107\.201
RewriteCond %{REQUEST_URI} !/maintenance\.html$
RewriteRule .* /maintenance.html [R=302,L]

The above when placed in a .htaccess file will redirect all clients who are not coming from 86.43.107.123
or 86.43.107.201 to the maintenance.html webpage

Simple yet very handy to have!

Subscribe to this blog now!

Top Clicks

  • None
August 2015
M T W T F S S
« Feb    
 12
3456789
10111213141516
17181920212223
24252627282930
31  
Follow

Get every new post delivered to your Inbox.