Flamingo for Contact Form 7 Admin Menu

The default admin menu entry for Flamingo is confusing. Let’s make it better.

Address book is shown by default

What we want is the messages

// Rename flamingo
add_action( 'init', function () {
	remove_action( 'admin_menu', 'flamingo_admin_menu', 8 );
} );

add_action( 'admin_menu', 'credit_report_admin_menu', 8 );

function credit_report_admin_menu() {
	$inbound_admin = add_menu_page(
		__( 'Flamingo Inbound Messages', 'flamingo' ),
		__( 'Email Messages', 'flamingo' ),
		'flamingo_edit_inbound_messages',
		'flamingo_inbound',
		'flamingo_inbound_admin_page',
		'dashicons-feedback',
		26
	);
	add_action( 'load-' . $inbound_admin, 'flamingo_load_inbound_admin' );

	$contact_admin = add_submenu_page(
		'flamingo_inbound',
		__( 'Flamingo Address Book', 'flamingo' ),
		__( 'Address Book', 'flamingo' ),
		'flamingo_edit_contacts',
		'flamingo_contacts',
		'flamingo_contact_admin_page'
	);
	add_action( 'load-' . $contact_admin, 'flamingo_load_contact_admin' );
}

Keeping tabs on your Electricity Usage using Smappee

I bought a Smappee a year ago and it has been a great help in finding appliances that needed some attention.

This is not a paid review. I’m a customer and I’ve made a Chrome extension called SmappeeGraph to keep a eye on power usage. You can get it here.

 

Appliance learning has been a bit fuzzy. I’m missing a way to diagnose based on phase data. It can’t detect multiple stoves of the same type even if they are on different phases (I’m not sure there really is a way to do it though). And it tends to group always on appliances into a single appliance that was driving me wild for a while until I figured that was the case.

Data history is limited to what is stored on the service. You only get 5min granularity for the last day, 1 day granularity for the last 6 months and 1 month for the last few years. The UI for looking at that data is terrible.

The mobile app works fine, it does have notifications for appliances, but they are flaky. The added smart switch does not suite me, as it’s just the one and limited to the area where the Smappee meter is – but it might come in handy for certain applications.

Reliability was not a issue at all, it has been constantly working for the last year without any mayor issue. If it loses power it takes a couple of minutes to sync back to the mobile app.

Support was great, I messed up my order and they worked with me to fix it within minutes.

Solar meter is available, I haven’t had the opportunity  to test it out.

Hackability. I have the home version that is compared to their commercial offering quite limited. They have a web-based configuration utility that can be used to reset the memory, make it re-learn the appliances and look at second-to-second data for each phase. Here is a example how that can be used in a chrome extension. The smart plugs can also potentially be used in the same manner.

 

Facebook Accessibility alt-text on desktop clients

Facebook has had the accesibility feature of describing the photos on your stream (automatic alternate text) avaliable for some time on their mobile applications.

https://www.facebook.com/accessibility/videos/1082033931840331

This should be coming to various platforms soon but if you cant wait, and want to catch a glimps on computer vision advancements within Facebook, here is a userscript for you:

https://greasyfork.org/en/scripts/22304-facebook-image-alt-text-display

 

Leaflet for small spaces

Leaflet is a great lightweight JavaScript module for showing all kinds of maps – but not really small ones.

The next version 0.8 (currently dev) helps with that.

The next snippet creates a CRS called Metric, while similar to the Simple CRS, this one has a scale of exactly 1 meter and is not bounded by degrees of latitude/longitude.

Additionally, the next snippet is a patch to the Scale Control, that goes away with the Earth CRC and uses our custom one to display a perfect meter scale (and imperial, bah).

Update 15.7.2015:

https://github.com/Leaflet/Leaflet/commit/daac1ca559670b16c7f19e8758978d1b335ad57f

An example custom map is here.

Import and update a CSV file into MySQL the right way

Making a script to check, update and add a set of records to MySQL can be quite daunting. And even when done, the script will be slow. Luckily, there is a way to do this with a simple and fast SQL command.

LOAD DATA LOCAL INFILE '/location/on/drive' -- the location of the CSV
REPLACE INTO TABLE mytable -- table to 'replace' in to
CHARACTER SET charset_name -- the character set the CSV is in
FIELDS TERMINATED BY ';' -- character between fields
OPTIONALLY ENCLOSED BY '"' -- character to enclose fields
ESCAPED BY '"' -- excape character
LINES TERMINATED BY 'n' -- end of line character
IGNORE 1 LINES; -- ignore n lines, useful if first line is a header
(id, name, location, @phonenumber) -- fields, use @ to name a field that does not corespond to a existing column 
SET contact=CONCAT('Phone number: ',@phonenumber) -- maybe use the new name to set a column value

The keyword LOCAL is used to specify, that the given file is relative to the client, from which the script was run, otherwise, the path relative to the server would be used.

REPLACE replaces the lines, that have a matching unique field. IGNORE ignores them.

Resources:

Website Redesign

There comes a time, in the life of any webpage, that a redesign is in order. Partly because my old blog RawDev.net was in need of a clean up and I really didn’t want to push that brand any more.

This site will (hopefully) always be WordPress bleeding edge, starting with WordPress 3.5 and it’s default theme Twenty Twelve – to be released December 5th.

Just a bit of visual touches and voilà!