How to Build a Robotics Digital-Hackerspace

Some HTML

Why the Hell?

Wow, it’s been awhile since I’ve actually written anything in Drupal based text editor.  Feels like home.

Honestly, I’m not going to go into the “Why” of building this site.  Maybe I’ll do that later.  Let’s just say, there was an impetus to recreate the home we were forced to leave.

How the Blink?

Spinning Up a Server:

The first thing was deciding on a server.  I didn’t have much (um, any) experiencing in spinning up a server.  But after a bit of reading, checking the bank account, and finding what would work for Drupal site, I chose Linode

Definitely happy so far.  Their business model seems to be no frills Linux servers which are fast to spin up–if you know what you are doing.  Of course, I didn’t.  Still, they had a lot of fairly up to date walkthroughs.

Here are the walkthroughs I used (in order) to spin up this server:

  1. Getting Started
  2. Securing your Server
  3. Hosting a Website
  4. Installing Drupal 7

This almost all the information needed to create this site’s based.  A couple of caveats:

sudo apt-get install php5 php-pear sudo apt-get install php5-mysql

Needs to be replaced with:

sudo apt-get install php php-pear sudo apt-get install php-mysql

This will install the latest version of PHP, for me, that was PHP7.

Also, the install directory is different for PHP7.  This is important, since the php.ini file needs to be edited.  In 7 it may be found:

/etc/php/7.0/cli

The last thing to do was relocate the Drupal 7 files to the directory where Apache can serve them up.

cd /var/www/html sudo wget https://ftp.drupal.org/files/projects/drupal-7.50.zip

If all the script-blogs are followed correctly, then when entering the web IP of the site in the browser you should see the following:

Design Goals:

Goals.  It’s good to have them.  Thinking through what I’d like out of a new robot-home here are some of the concepts which seemed critical and important:

  1. An open place for anyone to express ideas, with minimum viable censorship.
  2. Responsive.  Not just mobile friendly, but optimized for quick viewing of information.
  3. Shoutbox.  Gots to have one.
  4. WYSIWYG and rich content editors:
    • Iframes
    • Image boxes
    • Image storage system
    • Code-highlighting including our favorite languages (and Ada for Mr. Bdk6)
  5. The primary features of our old home:
    • Collect
    • Chill-out Zone
    • Forums
    • Shoutbox, oh wait, already stated that.
  6. New features requested by members:
    • Content rating
    • Member points
    • Wiki
    • Anything we could dream of

Theme:

There are three layers to the theme: 

  1. AdaptiveThemes was selected as the main
  2. Corolla over it
  3. FooTheme went over it.

In the /var/www/html/sites/all/themes/corolla/ directory there is a file called corolla.info inside a referenced was added for css/corolla_overrides.css.

Then, in the /var/www/html/sites/all/themes/corolla/css directory the corolla_override.css file was made which includes several hackish css snippets:

    /* The title was originally set to -5px (weird) */
    #site-name a {
      letter-spacing: 0px;
    }

    .wrap-code {
      overflow-x: scroll;
    }

    /* These hide some uncessary shoutbox labels. */
    .shoutbox-interval-msg {
      visibility: hidden;
      display: none;
    }
    #edit-nick{
      visibility: hidden;
      display:none;
    }

Regarding the color scheme.  The palettee can be edited in the Footheme “Color” section.  This requires th Color (Drupal Core) module be enabled.  The palettee was selected by using Pictaculous taking an image of Russian revolutionary art.  This was meant to capture the feeling palette selected by an artist with a better understanding of color-emotion connections.

Fonts
Logo selection

Modules:

Admin Tools:

“Admin Tools is an addon module for the Admin module, which provides a sidebar navigation for selected roles. The Admin Tools module adds functionality and quick access for clearing caches, running cron and updates much like Admin Menu.”

hate cache errors.  Mother-blinking cache!

Administration Menu:

Admin tools sped up development a lot.  It basically simplifies the admin menu so 4th level items are exposed to one click.

Blog (core)

Allows the Drupal site act like a good old blog–for us, this allows multi-authoring content and management.

Block (core)

Allows a block design of the UI.

Chaos Tools

This is a dependency for other modules (a lot of others).

CKEditor

The CKEditor is the core of the Drupal blogging package.  It is the editor used to create this post.  However, it put up the most fight when trying to install.  Actually, that’s not fair.  It wasn’t the CKEditor it was the code highlighting which was such a pain.  The code highlighting allows this:

    for(int i = 0; i < marioTouchesRobots; i++){
        aHackerSpiritDies();
    }

I’m going to list out the steps used to setup the CKEditor used for this article, but then discuss some of the pitfalls, which ended up costing a lot of development time.

Steps to Setup CKEditor with CodeSnippets and HighlightingJS:

  1. Download the CKEditor - WYSIWYG HTML editor module.
  2. Enable the CKEditor module.
  3. Go to Configuration–>CKEditor–>Edit CKEditor Global Profile
  4. Set the “Path to CKEditor” to //cdn.ckeditor.com/4.5.4/full-all. This will use the content delivery network to serve up the CKEditor JavaScript.  It also lets you access a lot of plugins without having to manage them.  The other option is to pull a copy on the local server–it’s a lot more hassle managing.
  5. Go to Configuration–>CKEditor–>Profile X–>Edit (note, X = Text Editing profiles users will be able to select when blogging.  These can be managed under content Content Authoring –> Text Formats).
  6. Go to Basic Setup.  Here, add all the Text Formats this particular CKEditor profile should affect.

  1. Under Security make sure “Always run security filters for CKEditor” is Enabled (should default).
  2. Under Editor Appearance go straight to the check-box title “Plugin for inserting Code Snippets” and enable it.
  3. Also, enable what other CKEditor Plugins needed.  Note, there are more plugins then this, but these are the ones provided through the Content Delivery Network.
  4. Scroll to the end and hit Save.  Now, go back to Configuration–>CKEditor–>Profile X–>Edit.  Go straight to Editor Appearance.  There should be a new button available
  5. Add the Code Snippet button to the “Current Toolbar”
  6. This should enable the CKEditor and provide the Code Snippet button.
  7. Download the highlight js Drupal module.  This should be installed in the modules directory
  8. Navigate to var/www/html/sites/all/libraries folder and make a directory called ‘highlightjs’, switch to it.
  9. The highlight js module is dependent on the actual highlightjs css libaries though.  Download a package in the /var/www/html/sites/all/libraries/highlightjs folder.
  10. Unzip highlightjs here.
  11. Issue the command ‘sudo mv higlight.pack.js highlightjs’.  This is required or the highlight module can’t find the libraries.
  12. And the command ‘sudo chmod 666 highlightjs’.
  13. Go to the modules dashboard and enable Highlight JS Syntax.  DO NOT enable Highlight JS Filtetr.
  14. Open the modules /var/www/html/sites/all/modules/ckeditor$
  15. Type sudo nano ckeditor.config.js
  16. Add each HighlightJS language you would like to show in the dropdown box in the CKEditor.  The part on the left of the colon is should match the HighlighJS language code.  The part between the ‘ ‘s will be what is displayed in the CKEditor dropdown.  When adding supported languages, here’s a good reference – Supported HighlightJS languages (but it doesn’t include custom languages, like Arduino).  Don’t forget to save when done.
        config.codeSnippet_languages = {
            php: 'PHP',
            python: 'Python',
            arduino: 'Arduino',
            c: 'C'
        };

There is an issue with the HighlightJS module where the text escapes the divs.  It took a long time to find the culprit.  Apparently, the HighlightJS modules causes this whenever it renders HTML produced by CKEditor.  

  1. Go to /var/www/html/sites/all/modules/highlightjs
  2. Type sudo nano highlight_js.css
  3. Enter the following style and save:
    .field-items {
        width: 100%;
    }

And that should be it.  A couple words of warning.  Make sure you don’t enable the HighlightJS Filter.  This will essentially double encode the HTML entities inside the block.  This causes >, <, and & to show as ">, &lt, &" respectively.  This simple little issue took a lot of development time to solve--given the manual was lacking.

Color Comment Contextual Links Dashboard Database Logging Entity API Field Field SQL Storage Field UI File Filter Five Star Forum Help Highlighter JS Filter Highlighter JS Syntax Highlighter Image IMCE Libraries List Menu Module Filter Node (core) Number Options Overlay Path Poll RDF Search Shoutbox Shoutbox Patch Statistics Statistics Counter SysLog System (core) Taxnomy Text (core) Update Manager User Userpoints Userpoints Service Views Views Content Panes Views UI Voting API

Lumi

Update 3/29/2016

I’ve begun re-writing the entire program as a Windows App. Not really my choice. It seems the BluetoothLE API Microsoft has thrown together (for-real-doh, it’s super bad) is most easily adopted under the Windows Universal App toolchain.

Anyway, here’s the resting space of the new projects

Lumi

Lumi for Desktop

Where I come from they having a saying: “Video or it didn’t happen.” I’ve always liked that saying. It means we have to put our work where our typing is. Here is a video of the uploader I wrote to interface with the TinySafeBoot AVR two-wire (UART) bootloader.

It was written with the idea a serial connection could be directly opened from the computer using Bluetooth 4.0. Or, if we get super fancy, using WiFi. On the receiving end, connected to the AVR, would be an HM-10 or an ESP8266 respectively. This would allow direct wireless uploading of Arduino sketches (or Atmel studio hex files) to the targeted Arduino (or AVR, if you will).

It has a couple of kinks, but I’m fairly pleased with it.

For a little more information on the projects:

http://ladvien.github.io/robots/tsb/

The whole projects is named after my friend Lumi who passed away last year. Amazing man with good taste in photography subjects. :)

Source Code:

https://github.com/Ladvien/Lumi_TinySafeBoot_Uploader