ecoder – online programming editor


I have been looking around for a reasonable online (ie available over the internet from any location) editor for programming purposes.  There appears to be a dearth of available offerings (as at August 2010), and there certainly does not seem to be any online Interactive Development Environment (IDE) products out there (and by making this statement, I am hoping that people will disabuse me of this notion and apprise me of numerous excellent offerings!).

One of the online programming editor products I found was “ecoder” (http://ecoder.gmeditor.com/) – the “demo” site made it look OK – simple yet effective.  So, I downloaded it and had a try.

It is a PHP and Javascript play.  Download the zip file to a directory on your server, unzip it and follow the installation instructions.

I made the changes to code.php in the root directory as instructed:

  1. Created a directory to store my documents in – outside the www directory of the server (probably a good security idea to do so, based on experiences with other such products) and indicated that directory in the $code[‘root’] variable
  2. Changed $code[‘domain_cookie’] to my domain name (ie without the www. in front of it)
  3. Set $code[‘name’] to my own ecoder title name – even though the instructions indicated that this variable currently did not really do anything – what the heck, might as well
  4. Did not do anything with the security settings.  I could not figure out exactly what was required with respect to these security instructions.  After posting something on the forum for ecoder (in sourceforge.net) re security, the answer virtually reflected the instructions – set up your own security script, call that immediately when going to the ecoder main page (index.php), then if the operator has logged in correctly, go back to ecoder with a variable set indicating it has passed security.  What variable (name, etc)?  Does the security module have to be in PHP?  Where to put the code (in index.php or code.php)?  Having no idea of the structure of the ecoder application and not being a PHP guru (and not having a security module lying around), I decided to ignore these security instructions for the moment.
  5. I wanted to be able to edit Python and Java programs, so I modified the $_SESSION[‘tree_file_types’] variable to include py and java extensions
  6. I then set the error log path to be a directory under my repo directory (why not?) and set my error email address properly.

Now, by simply going to the address of the website folder I had loaded ecoder into, believe it or not, it actually worked.  The editor came up and I could see the home page with the dummy text in it – and I could edit it.  Well done to the author of ecoder – not too shabby in terms of getting something running in less than half an hour.

So, onto doing something with the product.

I uploaded a python program I had written.  Upload seemed to go OK.  The program made it into the left hand file listing panel – BUT, there was no way that I could edit the file I had just uploaded.  Repeated clicking on it did nothing (it’s amazing isn’t it, that when something won’t work, you keep clicking and clicking on the same area, in the hope that by the hundredth click, something miraculous might happen and it will suddenly work when it had not worked for the last 99 attempts.  I am sure that it has happened for someone in the past, but never for me – yet I keep repeating the same monkey behaviour every time).

So, upload had some problems.  I then tried to create a new program with the py extension from scratch.  Clicking “new file” gave me the dialog box to enter the filename and the drop down list with all the right extensions in it – with “py” at the top (just as I had specified in the code.php program).  Except, that when I sent to save the new file, an error occurred – the type of file was not allowed, the extension was wrong.

Next I managed to create a file with the txt extension (a plain text file) and edit it.  All OK.

Which bought me back to thinking about security.  I still couldn’t be bothered with the instructions in the code, so I went for the raw basic .htaccess and .htpassws solution.  Real basic stuff, but enough to work OK (provided I loaded the variables for Auth in .htaccess properly – made a mistake in the URL referencing the .htpasswd file and got errors – but managed to fix that relatively quickly) and got myself some raw security over the site.  Maybe one day I will go and create a nice login script – maybe a generic one for any system I have.  I am sure someone has written something out there for that as well.

But then, back to the Python editing.  Tried the py extension again (remember – Monkey see, Monkey click).  Still no luck.

Not to be defeated, I thought I would look through the code (I know PHP well enough to be able to read what was going on).  Took a little longer than I expected.

I eventually found that in “code/save/add.php” line 50, the system checks that there is a file which exists called “template.ext” where “template” is the actual string “template” and “ext” is the extension of the file to be created. Thus creating such a template file allows the file to now be created. It places the newly created file in the tree display on the left, but it now can not be selected and edited.

Uh – the whole structure of the thing now not looking so good – in that there seem to be dependencies all over the place in terms of simply specifying that one wants to edit with a different extension to a file (and no documentation at all).

But, being a determined little soul (I was going to write “sole” – with reference to the soles of one’s shoes, or feet – meaning that I now felt trodden upon and thoroughly down-trodden, but that would be an inaccuracy – I was pressing ahead!), I went searching for where the next error lay.

In the code for “type.php” (in the code/tree folder), every single extension appears the be hard-coded into this code, with specific other fields specified for a particular type of extension.   Copying the “php” lines at the bottom of this file and making it “py” finally allowed the code to work for a new type of extension.

I tried to create another file – lo and behold it not only saved, but placed the file in the left hand panel with the ability to click on the filename and edit it in the right hand panel.  Everything now seemed to be in a working state – at least working enough for me to be happy that I had an online programming editor that at least allowed some editing from my own site.

Mind you, at the end of the process, the conclusion I came to was that  it maybe a good idea to refactor some code to allow this new extension specification to all happen within the code.php file (or better still, have the complete code.php set of variables read in from a YAML file, for instance), to set the required controls.  These are the types of situations that one should probably consider building into one’s code from the beginning – have absolutely everything specified as sets of variables in configuration or control files using a standardised format, right from the beginning of the exercise.  A little more work coding wise, especially if the system is being built as one goes along, but worth the effort at the end of the day.  It would be nice to actually have a series of standard libraries to assist one in that area (I am sure they are our there – and I will need to try to find them and see how good they are).

The original author of ecoder responded to say that not much work had been done on the product for a while and that maybe it would get looked at over winter (I presume the Northern Winter, since we are in winter right now where I am – but our part of the world doesn’t count as real) – with a hint that someone may like to look at it and make some changes themselves.  Not really wanting to code in PHP (currently, Python and Groovy are the languages of choice), I might think about this a little longer.  And do some more research – now looking into the Mozilla Labs Bespin product to see whether that is what I want/need/can use.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Comments are closed.

%d bloggers like this: