Msqur Update

Well, the holidays are long over and I haven’t updated msqur.com in a while. I’m adding some configuration management to it, so nothing visible will happen for a while. What’s planned, however, is .ini file parsing so that .msq files can be parsed according to the INI file version they use. That is, I will parse the INI file for the schema to a .msq file instead of hardcoding it. This way showing a .msq from a new code version is just a .ini file upload away.

INI file parsing shouldn’t take long. PHP has exactly what I need (literally: parse_ini_file()), but I’ll have to bake my own slightly modified version since the MS format isn’t standard–if there even is a standard for INI files.

msqur.com – MSQ file sharing site

Well, I’ve only been working on it a little so far, but I suppose it’s good enough to post about at this point.

The site is msqur.com, and it’s for Megasquirt ECU users to share their tunes (from the TunerStudio MS software). You can upload (multiple) .msq files, assign some engine information to them at upload, and share them with other people for troubleshooting or tuning help. The goal is to make something easier than attaching a file to a forum post that others have to download and fire up the full tuning software suite to just view it.

msqur screenshot

Currently, as of this posting, it just shows you the VE, Spark and AFR tables from MS2 or MS2-Extra only. It might with with other firmwares but I have no expanded it yet. You can also enable or disable the table coloring, and normalize the VE table, converting any VE table to 5-250 VE for ease of comparison. I hope to expand it to view all data available from the MSQ file in a familiar format.

I only get to work a bit each week on it, since I’ve got a few other projects going. But it shouldn’t take too long to get this site to 90%. It’s also a nice break from the C code for the DRD project. So, I’ll post every now and then about any updates to it, so check the msqur tag for the latest info.

Raspberry Pi – Cross-compiling

Now that you have the hardware built and tested (although that’s not necessary), you can either use the code I’ve written–which is specific to the hardware and environment I have, or compile your own version. If you want to compile your own there are two options:

  1. Compile on the Pi itself
  2. Compile on an ARM virtual machine
  3. Cross-compile on a faster machine

The trade off? Compiling on the Pi is slow (very slow). The virtual machine is a marked improvement for compiling speed, but is complicated to setup. Cross-compiling is about the same difficulty as setting up a virtual machine but a bit faster and less “bulky”. So it depends. The virtual machine is nice if you have a lot of libraries you want to use, since you’ll have to compile all of them to be available for linking. If any of them have poor autoconfig support, it might be a pain to fix if you weren’t already on the target machine. But, since I just needed one or two popular libraries, I decided to setup cross-compiling from my host (x86_64) machine.

The last time I setup cross-compiling it was on Gentoo, and it wasn’t pleasant. However, after a little bit of research it looks like the crosstool-ng project is pretty popular and useful. I only had to patch one tiny thing.

Here’s the overall process:

  1. Install crosstool-ng
  2. Configure a cross toolchain with it
  3. Try and build the toolchain
  4. Use the toolchain to build your Pi code

Continue reading

Carduino 2.0 – Intel Galileo Setup

Out of the box the Galileo is setup to run sketches uploaded from volatile memory, which is really lame. I didn’t spend much time with it using the stock SPI kernel. So, an SD card is pretty much required to do any serious development with this board. This is not a bad thing (although you aren’t running in real-time anymore), since having a full OS to use has lots of advantages. Plus, this way I can automate the build process in a way I’m more familiar with. Continue reading

Carduino 2.0

Over a year ago I got an Arduino Uno and a CAN-BUS Shield to try and make some kind of datalogger for my car. I was also interested in using the OpenXC library with it (which might need a port if there isn’t one already, since it uses the Digilent chipKIT Max32 development board). While OpenXC allows interfacing with Android stuff for phones, I’m more interested in a self-contained datalogging type deal. Connecting a phone to review/control things would be a plus, but not required. Mainly, it would record to an SD card for later manipulation on any platform.

The problem with the Uno was that it has limited flash storage space, 32KB total. Lots of strings (for LCD output) in my source combined with some poorly written C++ CAN-BUS/SD/GPS libraries that SK PANG provide with the CAN-BUS shield, and the compiled output is just too large. The libraries are a hodge-podge of various OSS projects. I intend to rewrite them in C. You can run the binaries off the SD Card, but that’s not what I wanted the SD Card for.

Carduino 2.0

So, I just got a Arduino Galileo, which is way overkill. It was either get a Arduino Mega, which has enough flash but is otherwise relatively the same (and likely going to be obsolete soon), or get the Galileo. Instead of Atmega powered, it has a real Intel x86 SoC and runs Linux! No more AVR cross-compiling. And since it is Arduino Uno “shield compatible”, I don’t have to worry about the shield not working (I think! I’m assuming the shield follows the Uno spec.).

8MB Flash, 400MHz clock speed and a whole other bunch of superior specs I don’t remember. Now, the embedded Linux kernel is on that 8MB, and takes most of it up. So at first it looked like I was in the same boat. However, it has a built-in SD card slot that you can load up another, larger, image onto. Now I have two SD Card slots, one on board and one on the CAN-BUS shield. One for the OS, one for logging data. Perfect.

First I have to get familiar with the Galileo and setup the environment. After that I can start developing. So this will be split up into at least two other parts.

Updating WordPress on nearlyfreespeech.net hosts

Update Dec. 13, 2014:

These scripts are out of date. NFS has the WP-CLI installed allowing for much, much easier upgrades, backups, etc. See the repository for information.

Originally posted on Sept. 10th, 2014:

If you use NearlyFreeSpeech.net as your web host, you may have found it difficult to automate WordPress updates. I’ve made a script that does this for you. It also calls my backup and permissions fixing scripts, which I include here as well.

Beware of some notes and assumptions though:

  • Assumes WordPress is installed in /home/public/ (not a subdir of it)
  • Scripts are assumed to be in /home/private/
  • Does not check or recover from errors

Continue reading

Custom Speed app update

I update Custom Speed to 1.1. Changes include:

  • An actual theme (consistent colors)
  • More units
  • New icon

2.0 will include an actual settings page that will allow the units to be selected from an easier control, a setting for keeping the display on, and other minor UI improvements. There’s no ETA currently for 2.0.

Exporting Drupal Pages/Posts to WordPress

I’ve decided to consolidate some of my web presence. My car’s website will be merged into this one. Going from WordPress to Drupal is easy, but the other way is not. I found a couple links for SQL scripts to import lots of posts automatically, but these were and are easily outdated by Drupal and to a lesser extent WordPress.

It was easier just to create my own SQL JOIN statement and export the resulting list. Since I have so few posts (images are hosted elsewhere), it won’t be difficult to import each of them manually. With a little more SQL work, you could import the resulting list into WordPress.

At the time of writing, my WordPress is version 3.8, and Drupal is a bit older at version 7.14. Below is the SQL I used to gather complete posts from Drupal:

SELECT nid, type, created, title, body_value
FROM field_data_body
INNER JOIN node ON field_data_body.entity_id = node.nid

And that’s all I needed.

Python script to write a word using the word

That’s the best title I can come up with. The idea is to do this:

    THISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHIS
    THISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHIS
    THIS            THIS    THIS    THIS            THIS            THIS
    THIS            THIS    THIS    THIS            THIS            THIS
    THISTHIS    THISTHIS    THIS    THISTHIS    THISTHIS    THISTHISTHIS
    THISTHIS    THISTHIS    THIS    THISTHIS    THISTHIS    THISTHISTHIS
    THISTHIS    THISTHIS            THISTHIS    THISTHIS            THIS
    THISTHIS    THISTHIS            THISTHIS    THISTHIS            THIS
    THISTHIS    THISTHIS    THIS    THISTHIS    THISTHIS            THIS
    THISTHIS    THISTHIS    THIS    THISTHIS    THISTHISTHISTHIS    THIS
    THISTHIS    THISTHIS    THIS    THISTHIS    THISTHISTHISTHIS    THIS
    THISTHIS    THISTHIS    THIS    THIS            THIS            THIS
    THISTHIS    THISTHIS    THIS    THIS            THIS            THIS
    THISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHIS
    THISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHISTHIS

With any number of alphanumeric characters. The idea comes from a reddit user posting something similar, and then my mind wandered. Continue reading