Thursday 29 October 2015

JRuby rails : adding a migration

So I can remember for next time

C:\jruby\bin\rails generate migration ProjectUrl url:string

then

jruby -S rake db:migrate

Monday 7 September 2015

Windows 10 and the iMac

As a follow-up to windows 8 running on an old iMac, Windows seamlessly upgraded to 10 and it's all running rather well. All be it a little slowly by modern computer standards.

Windows 10, No IPv4 settings?

You can't get to the IPv4 settings for a VPN now in Windows 10.
No idea why but here's a good write-up on it.

Split Tunneling VPN

Tuesday 1 September 2015

NAZE32, X4R, Cleanflight, smart.port and Taranis telemetry.

Having read the great write-up by Frank on how he got a X4R talking smart port to a NAZE32, I assumed I'd be up and running in no time. There were a couple of snags though.

I didn't want to take a soldering iron to my X4R and I wanted to not reverse the polarity, with a hack, because it would be good to hook up other smart port devices, like the battery voltage monitor, among others

So I built a bi directional inverter with a couple of transistors and 4 resistors.




After getting the serial com polarity fixed, there was another issue with the NAZE running Cleanflight.

The current build expects you to have either hacked the X4R or that you have an F3 board where you can reverse the polarity of the uart via the CLI.
I had neither so I did a build with a non bi-directional serial port.

In the configureSmartPortTelemetryPort function in smartport.c, the port is hard coded as SERIAL_BIDIR. The current code expects that the serial connection is sent over a single wire, but I couldn't figure out the circuit to do that. The NAZE doesn't have serial polarity inversion so, I simply changed the line to SERIAL_UNIDIR, and connected Tx and Rx wires to pins 3 and 4 on the NAZE, respectively.


 void configureSmartPortTelemetryPort(void)  
 {  
   portOptions_t portOptions;  
   if (!portConfig) {  
     return;  
   } 
   portOptions = SERIAL_UNIDIR; 
   if (telemetryConfig->telemetry_inversion) {  
     portOptions |= SERIAL_INVERTED;  
   }  
   smartPortSerialPort = openSerialPort(portConfig->identifier, FUNCTION_TELEMETRY_SMARTPORT, NULL, SMARTPORT_BAUD, SMARTPORT_UART_MODE, portOptions);  
   if (!smartPortSerialPort) {  
     return;  
   }  
   smartPortState = SPSTATE_INITIALIZED;  
   smartPortTelemetryEnabled = true;  
   smartPortLastRequestTime = millis();  
 }  

Et voila, Cleanflight telemetry on my Taranis.


Edit: Pic of connections

Tuesday 17 February 2015

Accessing Chrome's Cache

This is getting to be a bit of a theme on my blog.
Recovering files I've deleted or overwritten. Ooops

I've been working on some css all day and I've gone to merge some other work and guess what.
I overwrote the file with today's work.

Ooops

Windows 8 file history wasn't turned on and I had that sinking feeling in my stomach.
Since I'd been working in Chrome all day, surely it will have the css cached?

Well it turns out it's not like IE, in the good old days when each cached file was in plain sight in a cache folder. I could only find the HTML in C:\Users\%user%\AppData\Local\Google\Chrome\User Data\Default\Cache No sign of css or js.

But chrome has a page with cached files listed.

chrome://cache/

Ctrl-F found no files though.... Odd.

So I tried to find the file by entering the path directly.

chrome://view-http-cache/http://www.somedomain.com/templates/css/template.css

Bingo. Then you get some gobbledygook well the raw data from the web server. Kinda what you'd expect really.


From here you need to use this great website here where you can paste the data into the form and get the original file back.

Well there's 8 hours saved. Thanks Google.



Thursday 8 January 2015

Migrating a virtual hard disk to Hyper-V from VirtualBox

I've been using VirtualBox for a while for my testing environments and thought it would be a good test to see if they can be run on Hyper-V (well the truth is I couldn't be bothered to find the server 2012 install media and wanted a server on a PC without VBox.)

So a quick google reveals that VirtualBox has a utility to migrate the VDI files it uses.

VBoxManage.exe internalcommands converthd -srcformat VDI -dstformat VHD "original.vdi" "new.vhd"

Well blow me over with a feather if it didn't work first time, once I'd added a new machine in Hyper-V and pointed it at the VHD