Close

Raspberry Pi - Development - IDE; Speed, Security, Complexity and Price.

A project log for Not Just Another Coffee Table

Custom coffee table with a DCC train track, automation, LEDs and a web interface

jack-flynnJack Flynn 10/02/2018 at 09:440 Comments

Fast, Easy, Secure, Cheap. We'd like all 4 but in all engineering disciplines we quickly learn that with the real world there comes trade offs. I wanted an nice IDE interface for developing code on the raspberry pi while it was running in a headless configuration; no screen attached. Looking online there were a number of IDE options that ranged from eclipse; running on my PC with it's various complex setup methods and paid-for plugins, to VIM; an old school text editor that could be run directly on the Pi via a terminal interface. I wasn't a fan of either of these options. 

I wanted something that would let me edit files in a clean windows environment that didn't take 2 hours to setup and could come crashing down at any moment. I was willing to compromise on security in return for a free solution as my Pi won't be exposed to the outside world.

Luckily I came across... 

Raspberry Pi File Sharing

The samba file sharing method creates a local directory on the raspberry pi that I can access over my home network with any of my PCs and create, edit or delete files directly. I followed the setup using this guide

So now I can access my directories, html, python scripts and anything else within the directory of the Pi from any of my local PCs with an added login step for security. I even mapped the IP address of the Pi to a shared drive in windows to make it even easier to access;

Not everyone would be comfortable exposing the file system on the Pi for development. While I have it setup to require a log-in before accessing files, I'm sure there's a number of reasons not to do professional development this way. For my criteria this fits nicely and it was quick and easy to setup. It also means when I take the Pi home from the office I don't have a complex IDE setup process to repeat on my home PC. 

The other critical disadvantage of this method to be aware of is the "EOL" (End of Line) characters in files. Text files created under Windows and Linux add hidden characters to the end of each line of the file. Linux doesn't like the Windows method so if you create a new text file in windows, save it as "py" python file, transfer it to the Pi and then try to run it you'll throw an error complaining about EOL. There's a bash command you can run on the file with the terminal on the Pi but it would be nice if our IDE could take care of that for us. 

IDE Choice

So now I can manage files on the Pi, I need something that suits my development requirements for the project. The Pi is running as a central web-server that talks to both the Sprog and the Teensy hardware interfaces. This means I'll be working with Python, HTML, Javascript and potentially others such as bash or shell scripts. While diving around these files I want something that's lightweight, fast and  is a bit more advanced than just notepad. Almost like a notepad advanced. Like a notepad + features. Like Notepad++.

Notepad++ is lightweight, easy to use, supports all the languages I need with colour coding, and can also take care of the End-Of-Line issue when saving files from Windows to the Pi. 

 

Drawbacks

While I'm happy with the setup I'm using there's still a number of drawbacks compared to a more "professional" or commercial setup. There's no debugger in Notepad++ so every time I want to run or test a file I need to either refresh my browser for HTML or for Python I need to open a terminal to the Pi and run the script manually. While this may seem tedious it's actually an easy flow to follow and running python scripts through the terminal results in some half decent error messages when the inevitable mistake is made;

(I'm missing the ":" at the end of my while True statement)

So for now, this works for me. Your millage may vary..

Discussions