Monday, November 30, 2015

HP ProBook 4730s - enabling vt-x

I'm working on a new DevOps system that relies upon Chef, Vagrant and VirtualBox.  To duplicate the system I needed to run Ubuntu Trusty 64 bit edition in the virtual box.  Vagrant setup failed with timeouts.  When I ran the 64 bit VM Vagrant made through the VirtualBox client it said I did not have VT-x visualization on my machine.

I have a HP ProBook 4730s.

As you can see it uses i5-2430M CPUs.  Checking at http://ark.intel.com/products/53450/Intel-Core-i5-2430M-Processor-3M-Cache-up-to-3_00-GHz , shows that :
So, why won't VirtualBox work?  The answer lays in the HP bios.  To enable:

Restart notebook.
Press F10
Choose system features
Device features
Virtualisation
check.
Save
Reboot.

VirtualBox still refuses to run ubuntu 64.  Some googling reveals you have to enable the bios to change the setting, rather than just view.  WTF?

Restart notebook
Press F10
Choose security
Some stupid setting
save
reboot

Now it works.

Connecting to vagrant using NppFTP and Notepad++

Notepad++ comes with a great plugin to enable editing remote files or files on virtual boxes.  It can be a bit of a mystery to setup.  I'll explain what I do to allow editing on a Vagrant box on your Windows PC.


  1. start vagrant using vagrant up
  2. start notepad++
  3. open the NppFTP plugin from the plugins menu.
  4. click on the setup gear and choose 'profile settings'
  5. click on the add new profile button
  6. give it a good name and click OK
  7. click on the connection tag
  8. enter the ssh port number your vagrant box is using, it'll be 2222 or a variant of that.
  9. enter these parameters:  
  10.    hostname: 127.0.0.1
  11.    connection type: SFTP
  12.    username: vagrant
  13.    uncheck 'ask for password'
  14. click on the Authentication tab
  15. check 'Try private key file authentication'
  16. click the '...' next to the 'Private key file' edit box.
  17. navigate in the file dialog to your Vagrant box location
  18. select this file: '.vagrant\machines\default\virtualbox\private_key'
  19. uncheck 'ask every time'
  20. click close

That should setup the connection.  Try it out by using the  icon.  Click on the  icon to see the log of NppFTP connection attempts.


Tuesday, October 22, 2013

Use curl to get picture from Kogan ip camera

curl  http://10.0.0.90:90/snapshot.cgi -u admin: > x2.jpg

Thursday, May 9, 2013

Paleo twaddle


Menu:

2 Poached eggs
Baby spinach
Bacon
Mushrooms
Tomato
Avocado.
+
Regular coffee.

How much of this is really part of a Paleo diet?  From wikipedia: "The Paleolithic..., is a prehistoric period of human history distinguished by the development of the most primitive stone tools discovered... and covers roughly 99% of human technological prehistory. It extends from the earliest known use of stone tools, probably by hominins such asaustralopithecines, 2.6 million years ago, to the end of the Pleistocene around 10,000 BP"

So; 10,000 years ago what parts of these menu items would a paleo eater have to eat?

Poached eggs?  Nope, chickens were domesticated in southeast asia only a few thousand BCE.  And chickens are native to southeast Asia, so no way they could have been eaten on the African savanna.

Spinach?  Dunno.  Seems to have been from Persia, so maybe.

Bacon?  Same situation as chickens.  Another southeast asian native.

Mushrooms? Very probably.

Tomato?  A native plant of south America, so no, not available.

Avocado.  Ummm. The avocado (Persea americana) is a tree native to Central Mexico. FAIL.

Coffee; it was only harvested in Ethiopian highlands in the last few thousand years.

Yumm, a big plate of mushrooms is what you need to keep authentic paleo.

Saturday, March 2, 2013

dojox charting tooltip function



Want to have a custom tool tip on your dojox chart?  The easiest thing to do is to use a custom function when creating the Tooltip object.

First: Add the require for the tool tip.

dojo.require( 'dojox.charting.action2d.Tooltip' );

Second: define the function to be used when a tooltip is required.


new dojox.charting.action2d.Tooltip(chart1, "default", {
text : function(o) {
return ( o.run.name +'<br>' + o.y ); 
} );

As you can see the tool tip function is passed the o object.  This object describes the chart, series and plots you'll need to make a nice tool tip.  What you need is the o.run.name, which is the name of the series and o.y, which is the value of the data point on the y axis.  Combined with <br> you'll get a two line tool tip.

Well, this is a three liner, but it looks much the same.  That's because I used a more complicated tool tip function that uses the label function to add the x axis label to the tool tip. 

Sunday, February 3, 2013

ArcGIS quakes example unexpected token < error

I have been playing with one of the example ArcGIS samples from the 'Building Web Applications Using the ArcGIS API for JavaScript' and kept getting an annoying error:


esri.request failed: SyntaxError: Unexpected token < quakes.js:164

  1.  

Which stops the quakes layer loading.

The esri.request method requires a web server running hosting the example and a proxy page to call the quakes XML service:


function requestQuakes(){
esri.config.defaults.io.proxyUrl = "proxy.php"; //relative - if proxy.php is in the same application as the web page

var requestHandle = esri.request({
 url: "http://earthquake.usgs.gov/earthquakes/feed/geojson/1.0/week",
 load: requestSucceeded,
 error: requestFailed
}, {
 useProxy: true // changed from True
});
}



When I run it under the EasyPHP server that error came up. 

I chased the error down to the proxy.php script echoing out error messages due to uninitialized variables and missing keys from arrays.  Once I had eliminated those errors the page loaded correctly.  It seems the error messages were getting returned with the usgs earthquakes JSON and messing up the dojo JSON parser.

The new proxy.php

Tuesday, October 23, 2012

Simple x y dojo chart example

This is a very simple x, y, chart using Dojo and sourcing the js and css from Google.  Copy the next part and save as a html file.


<!DOCTYPE html>
<html >
<head>
<script 
type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/dojo/1.8.0/dojo/dojo.js" 
dojoConfig = "{parseOnLoad: true}"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.8/dijit/themes/claro/claro.css"/>

<script type="text/javascript" >
dojo.require( "dojox.charting.Chart" );
dojo.require( "dojox.charting.axis2d.Default" );
dojo.require( "dojox.charting.plot2d.Lines" );

  dojo.ready(function(){
    var chart1 = new dojox.charting.Chart("simplechart",{title: "Basic XY chart" });
    chart1.addPlot("default", {type: dojox.charting.plot2d.Lines});
    chart1.addAxis("x", {title: "X axis", titleOrientation: "away"});
    chart1.addAxis("y", {vertical: true, title: "Y axis"});
    chart1.addSeries("Series 1", [1, 2, 2, 3, 4, 5, 5, 7]);
    chart1.render();
  });
</script>
</head>
<body class="claro">
    <div id="simplechart" style="float:left; width: 350px; height: 350px; margin: 5px auto 0px auto;"></div>
</body>
</html>