Shop OBEX P1 Docs P2 Docs Learn Events
A Propeller-WebTool Framework for Compiled Languages? - Page 18 — Parallax Forums

A Propeller-WebTool Framework for Compiled Languages?

11516182021

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-26 17:59
    msrobots wrote: »
    I do not have a MAC, so I am not sure.

    But this should work.

    unzip Editorxx.zip to some folder
    create a folder /Library/ in the root of the same drive
    copy all files from the Library folder of the proptool to your folder..

    close all instances of chrome and start chrome as described here: http://www.chrome-allow-file-access-from-file.com/
    This will allow chrome to access local files and therefore also it own webworker... You can then start the Editor from a local file system instead of a webserver.

    Then the editor should be able to load needed files from the Library.

    OR - if you do not need the PropTool library files - just Upload ALL files you need to compile and have them open in a Editor tab.

    Menu File -> Upload local File(s). Then select all files needed and click OK to upload and open all at one click

    The buttons and menu entries for the S6B are just usable if you have a compiled file open as active tab. (Green window)

    Enjoy!

    Mike
    Thanks for the advice but I didn't take any of it. :-(

    What I did instead was remember that the Mac comes with Apache already installed. I just setup my personal web directory and put your files there. After I renamed editor16.htm to index.html I was able to run the editor locally. Now I should be able to connect from my laptop to my ActivityBoard using my router without having to worry if it can connect to the internet.

    Thanks,
    David
  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-26 18:22
    I'm going to show off my massive Spin programming skills now. Here is my test program:
    con
      pin1 = 26
      pin2 = 27
    
    pub main
      outa[pin1] := 1
      dira[pin1] := 1
      outa[pin2] := 0
      dira[pin2] := 1
      repeat
        outa[pin1] ^= 1
        outa[pin2] ^= 1
        waitcnt(clkfreq/2 + cnt)
    

    I know it should have clock definitions but I can never remember those off the top of my head and I think the default is RCFAST so I would think this program would work without the clock statements but it seems to load but not blink the LEDs on the ActivityBoard. What dumb mistake have I made this time? :-)
  • msrobotsmsrobots Posts: 3,709
    edited 2014-03-26 21:00
    be sureTry this
    con
      pin1 = 26
      pin2 = 27
    
    pub main
      outa[pin1] := 1
      dira[pin1] := 1
      outa[pin2] := 0
      dira[pin2] := 1
      repeat
        outa[pin1] [COLOR=#008000] := not ina[pin1] [/COLOR] 
        outa[pin2] [COLOR=#008000] := not ina[pin2] [/COLOR]
        waitcnt(clkfreq/2 + cnt)
    

    No Prop here at work ...

    Enjoy!

    Mike

    EDIT

    did you hit both buttons? - I know its stupid, but by now you need to save to eeprom and then start from eeprom. @Jazzed stumbled also over that...

    I will change that soon.

    Enjoy!

    Mike
  • Cluso99Cluso99 Posts: 18,069
    edited 2014-03-28 04:22
    Just tried the editor on my Android Xoom. Quite slow (probably expected).
    The buttons are noot thick enough (y dimension) so the text is half offthe buttons.
    Itried to save a test file but it failed (using the put/save button). Tried clusotst.spin and also clusostest and neitherf worked.
    Tab didnt work but when I spacdd the first line in,the next line commenced at the indented position like it should.

    Perhaps it is because I dont have clearance to save to your server?

    Oh, there is a tiny input rectangle partially over the input text.

    Certainly anicestart :)
  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-29 18:36
    I just pushed a minor update to my HTTP Wi-Fi loader. This fixes a bug where the response to the /load/ HTTP request didn't get completely transmitted before the Propeller was restarted with the user's program.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-30 09:27
    msrobots wrote: »
    I have a new version of the Editor.

    No PASM2 yet. But - hopefully - support for S6B.

    I attach it now and will install the attached Editor16.zip on my server.

    just wait for next post.

    This JavaScript stuff is FUN. Thanks @Heater...

    Enjoy!

    Mike
    I've been looking through the code that does the HTTP downloads and I was wondering why you have a 500ms delay between HTTP requests? Since you always wait for an HTTP response before sending the next HTTP request I don't see any reason for a delay between requests at least from the point of view of the HTTP server. Is there another reason why you added the delay?
  • msrobotsmsrobots Posts: 3,709
    edited 2014-03-30 12:05
    @David,

    I just put that delay there because you said you need a delay for the S6B. If it works without - remove it. It is a ugly way to wait anyways...

    I have a small update ready removing one of the buttons and combining send and load. Will update soon.


    Enjoy!

    Mike
  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-30 12:59
    msrobots wrote: »
    @David,

    I just put that delay there because you said you need a delay for the S6B. If it works without - remove it. It is a ugly way to wait anyways...

    I have a small update ready removing one of the buttons and combining send and load. Will update soon.


    Enjoy!

    Mike
    I needed a delay when I was sending everything as one big XPOST but not now that we wait for a response for every PUT request. Sorry I wasn't clear. It seems to work without the delay.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-30 13:09
    I just figured out why my small blink demo wasn't working and pushed a fix. The Xbee loader now seems to be able to load tiny and large programs successfully. I need to try higher baud rates next.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-03-30 13:45
    Steve suggested that more people might be interested in trying the Digi Xbee Wi-Fi HTTP download support if I posted Spin binary files that could easily be loaded into a Propeller. I've attached a zip file to this message. You should first load and run the xbee-config.binary file and use it to setup your Xbee S6B module with the appropriate SSID and password. You should then be able to load xbee-server.binary to run the HTTP server that works with msrobots' web IDE. These binaries correspond to the source code that is on github as of today. Let me know if you have any problems.

    Also, this version requires the Xbee to be connected as follows:

    Xbee-DO -> P9
    Xbee-DI -> P8
    Xbee-RTS -> P7

    These were moved from the previous pins because those pins conflicted with other ActivityBoard resources.

    Thanks,
    David

    xbee-binaries.zip

    Edit: Updated the attachment to move the xbee-config pins to P7-P9 to match xbee-server.
  • msrobotsmsrobots Posts: 3,709
    edited 2014-03-31 12:40
    OK. here we go.

    Editor17.htm attached.

    This one now just use one button to send and load a binary using the S6B. I also removed the delay.

    I also added highlighting for PASM2 and some bling.

    here a link for testing http://parallax.msrobots.net/Editor17.htm

    Enjoy!

    Mike
  • jazzedjazzed Posts: 11,803
    edited 2014-03-31 17:06
    The Send S6B command works. Could you make the IP address change in the dialog persistent per browser window?

    I tried this editor on my Android phone and my wife's iPad. The iPad was a little less frustrating because the screen is bigger.

    A mobile version is needed :-)

    The current editor page is horribly busy and lots of things nice for debug, but having it all displayed at once is not practical. Any chance you could separate the editor from the main page for example?

    I was able to enter some blink code on my phone, compile it, and download it using Send to S6B. It was quite tedious, but worked.
  • msrobotsmsrobots Posts: 3,709
    edited 2014-03-31 18:07
    @Jazzed
    The Send S6B command works. Could you make the IP address change in the dialog persistent per browser window?
    GREAT! - will remember ip change on next update.
    The current editor page is horribly busy and lots of things nice for debug, but having it all displayed at once is not practical. Any chance you could separate the editor from the main page for example?

    There is a Fullscreen command in the menu.
    Be aware F11 does full screen browser also.
    So if focus in the editor F11 will do fullscreen editor (and back)
    if focus is outside of editor F11 does fullscreen browser (and back) ...

    The current tab will then display full screen (esc to exit)

    Also all frames are sizable.
    Also all borders are sizable. There are no frames...

    I have some experiment here with Drag and Drop. But I am not able yet to integrate this with the editor.

    When using the PropTool you can simply drag a Tab outside the main PropTool Window and it is opened in a own window. Cool.

    I would like to do that in the editor also, but am still to stupid to figure out how. lets call that WIP.

    As to your comment in the P2 Thread.

    I am almost with you there.

    The Activity board solution will be the cheapest WIFI connection. But WIFI is not always the required or best solution.

    RPI is done. SimpleIDE and SpinIDE are working there. You took care of that.

    The Spinneret as PropPlug solution is expensive but quite interesting for industrial control where you simply can forget WIFI.
    No OS to worry about. All in one Propeller. DHCP, NETBIOS. Just Plug in and talk to it in a browser. No installation.
    You have a file system. You have a real time clock. And there is a scripting language you can use to create Active Server Pages on the Spinneret.
    This one is very powerful and you MAY even can use PropGCC to create them.
    Spinneret-msrobots supports loading cog binary images from sd and executing them to get the response. Think of CGI with PASM.
    The PASM code gets loaded in a new cog and has a mailbox to communicate with the (spin) server to access url parameter, the file system and other nice stuff.
    It then does its job and quits itself after sending the response over the mailbox.

    I like the spinneret because it is small. All of this will run on the Parallax Spinneret2.0 also I just need to get one. So PLEASE Parallax keep the old one in stock.

    Enjoy!

    Mike
  • Heater.Heater. Posts: 21,230
    edited 2014-04-04 04:58
    I just put msbobots Editor17 Spin IDE up here: http://the.linuxd.org:3000/editor17/editor17.html

    I did a quick hack so that load and save work. Anything you save there will end up in a directory on the server shared with everyone else. Leave me a message!

    As a test you can load "WebServer_W5100_RTC.spin". When you hit the compile button it will fetch al dependent sub objects from the online library.

    If you download "server.js" you will get the javascript source of the server running all this. It's very short and simple.

    Checkout the retro home page http://the.linuxd.org:3000/ from which these experiments can be reached.
  • Mike GreenMike Green Posts: 23,101
    edited 2014-04-06 20:59
    I tried Editor17 using an iPad Air and the latest Safari using both Heater's copy and msrobot's posted copy. The file selection window on the left doesn't seem to scroll and, on the iPad, an external Bluetooth keyboard is ignored.

    David, where on github are the xbee utilities?
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-06 23:23
    Mike!

    No clue about the keyboard. Can you use the build In on-screen one ? Or can't you use the editor at all?

    Can you select and open a file?

    Can you compile?

    I have none of the I-thingies so I need second hand experience...

    Enjoy!

    Mike

    [edit] Ha that fits. My first post to Mike Green is my Post #555....[/edit]
  • Heater.Heater. Posts: 21,230
    edited 2014-04-07 01:35
    msrobots,

    Seems if we want to make the editor a Chrome app in order to access a serial port we have some work to do:

    1) All the JS has to be separated out of the HTML into it's own file(s). As we see in a Chrome app tutorial.
    <!--
         - JavaScript and HTML must be in separate files: see our Content Security
         - Policy documentation[1] for details and explanation.
         -
         - [1]: http://developer.chrome.com/extensions/contentSecurityPolicy.html
        -->
       <script src="popup.js"></script>
    

    2) We need to add a little something to kick off the JS when the document is loaded. As in this example:
    // Run our kitten generation script as soon as the document's DOM is ready.
    document.addEventListener('DOMContentLoaded', function () {
      kittenGenerator.requestKittens();
    });
    
    Now. I know you like to have everything in one huge file. However this should not be an issue. If the HTML and JS and libraries (CodeMirror) are all pulled out into their own files (as they should be) then a simple step of concatenating everything together when you want the single file version is a dodlle.
  • Heater.Heater. Posts: 21,230
    edited 2014-04-07 01:45
    msrobots,

    I just check the Chrome app security poilcy page; https://developer.chrome.com/extensions/contentSecurityPolicy


    It all seems quite reasonable, good practice even. Quite straight forward but might take a lot of fiddling work with the current editor17 code.
  • Heater.Heater. Posts: 21,230
    edited 2014-04-07 03:53
    Just managed to get the chrome app to run the editor17 javascript by tweaking the manifest: You have to add :
      "sandbox": {
          "pages": ["editor17.html"]
      }
    

    But the it complains about the security of other things. Especially it won't run the web worker!
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-07 12:45
    @Heater.,

    I see you are making progress.
    Now. I know you like to have everything in one huge file. However this should not be an issue. If the HTML and JS and libraries (CodeMirror) are all pulled out into their own files (as they should be) then a simple step of concatenating everything together when you want the single file version is a doodle.

    I guess you are right. I am just careful. So I know my Spinneret is not choking on the editor. The Spinneret (W5100) has just 4 sockets available. One of them is constantly used for NetBIOS. So you are able to find it by Name without knowing its IP. Very handy if you have more then one and using DHCP.

    The upcoming Spinneret 2.0 has 8 sockets. This may ease the pain on that. I am already supporting E-Tag handling for static files on the Spinneret, so once loaded by the browser things are running faster anyway on the next load.

    But since I can just deliver one file at a time, the other sockets are accepting connections, but do not deliver a result until the previous request finished. And browser tend to time out, redo the request and BOOM we have a nice Racing condition and the browser times out.

    Needing another socket constantly blocked by a serial Terminal will just put more strain on this situation. So that one big file is not my personal preference, but more a constrain of the Propeller as webserver.

    And being used to COBOL files I have no problems with large source codes. If you can't navigate 25.000+ lines of source you may not be able to program COBOL. It is the most verbose language you can think of.

    Funny thing by the way. Visual Studio - my Bread and Butter providing Development Environment writing C# code is - unquestioned by anybody having used it for a while - one of the smartest and fastest IDE under Windows.

    But Editor17.htm can edit and highlight JavaScript faster as Visual Studio as soon as we reach OpenSpin.js size like files. And it supports Code Folding and a function list for JS. Visual Studio does not...
    (you know I am eating my own bread and edit Editorxx inside of Editorxx...)

    By the way. I found some CodeMirror Demo supporting something called LINT. I just played with it a while ago. Since it was using include files not in the CodeMirror folder I skipped it at that time. But it seem to give you hints about common code mistakes/best practice? Never heard of. Linux related? The demo seems to support JavaScript (and C/C++?) but as I understand this might work with other languages too.

    Do you know about LINT and can you extend my understanding of it?

    Enjoy!

    Mike
  • Mike GreenMike Green Posts: 23,101
    edited 2014-04-07 16:58
    I tried Editor17 again today ... no change to the iPad or keyboard. Now the file window scrolls using touch. The keyboard is recognized only when editing a new program. You should be able to use the cursor keys with a (presumably) read-only program. Is there a way to use a read-only program as the initial content of a read/write tab other than cut and paste?
  • Heater.Heater. Posts: 21,230
    edited 2014-04-07 20:59
    msrobots,

    I can see the need for minimizing connections. It's a shame Spinneret does not use persistent connections, that way only one socket would be used by the browser to fetch everything.
    http://en.wikipedia.org/wiki/HTTP_persistent_connection

    I never had the pleasure of programming in COBOL. After many decades hanging around the commputer industry I finally actually met a COBOL programmer in person last year. I'd almost concluded they were mythical beasts.

    Still. 25000 lines of code is getting a bit unmanageable and you have some interesting CodeMirror stuff in there that at least I would like to see broken out and maintaied separately. Ideally the Spin highlighting and such would be donated back to the CodeMirror developers.

    Re Lint:

    Back in the day C compilers were not so fussy and a bit short on warnings when you were doing silly things. Your program would compile only to crash and burn at run time.

    Somebody came up with the idea of making a program that would check your C source for common mistakes and messy programming that making it much more likely to work. That program was called "lint". Named after those bits of fluff that roll up and cling to your woolly sweaters and other clothing. The program was de-linting your code like you de-lint your coat.

    lint is not used so much for C any more as most of what it does is built into compilers and they can issue more warnings.

    Enter JavaScript: JS is a totally brilliant language but it does have some rather major flaws. Syntactical and semantic things that can be very confusing and very prone to error. Here are two examples:

    Comparisons:
    24 == "24"       // Yields true because of automatic type conversion from number to string, potentially a bug.
    
    
    24 === "24"      // Yields false, 99% of the time this is what you want.
    
    Semicolons, What does this do:
    function getSomeObject () {
            return {};
    }                                  // Returns the empty object {}
    
    function getSomeObject () {
            return
              {};
    }                                  // Returns  undefined !
    
    There are hundreds of other such "gotchas" that can have you at least scratching your head for ages wondering why your code does not work.

    Douglas Crockford created lint for javascript to help with all this, jslint.

    jlint will find many such issues in your code. It will also drive you mad about it demands on code formatting style. But given the second example above that is a very good thing.

    Always use jslint. Or a clone called jshint that is a bit less fussy about white space. I prefer jslint and use it in the sublime editor where it sticks red markers on all the lines it does not like as I edit.

    Always put "use strict"; at the top of your code.

    Do check out the videos on all this by Douglas Crockford and have a look at his book "JavaScript: The Good Parts".

    Here is a good start:

    http://www.youtube.com/watch?v=taaEzHI9xyY
  • jazzedjazzed Posts: 11,803
    edited 2014-04-07 21:04
    Actually Lint is still very common. It is part of the big fat static analysis tool kit that huge companies use to try and protect themselves from evil things like potential buffer overruns with sprintf, etc....
  • Heater.Heater. Posts: 21,230
    edited 2014-04-07 21:16
    Good point Jazzed. I guess lint for C/C++ grew up.
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-07 23:19
    Mike,

    I do not know why everybody tries to use the Editor with handheld devices. It is not at all build for that, yet.

    I would be very happy if you just try it from your everyday computer with a reasonable sized screen, a real keyboard and a mouse.

    You may be able to use it from some xx-pad. but it is not build for that, yet.

    This is just a proof of concept to run a complete PropTool in a webbrowser..

    Who wants to edit source from a device without keyboard and a big screen?

    confused.

    Mike
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-07 23:39
    So You did it again.

    Who is Crockford?. Video 8? Nice.

    See you in about 10 hours...

    Thanks,

    Mike
  • Heater.Heater. Posts: 21,230
    edited 2014-04-08 00:29
    msrobots,

    Douglas Crockford is "The JavaScript Guy".

    Douglas is one of the first guys who ever started to use JS in the browser for applications. He discovered that the stupid little scripting language did actually have some very advanced, elegant, expressive and powerful features that people had overlooked for years. That is after you stripped off all the crappy and miss-designed language features. Hence the book "JavaScript The Good Parts" and hence JSLint. He invented the JSON data form at we all use today. He was a technical boss at Yahoo. He is on the JavaScript ECMA standards committee. And he made all those brilliant videos about JS and programming you are about to watch.
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-08 11:05
    This guy is cool. His videos are really nice to watch.

    Thank you

    Mike
  • Heater.Heater. Posts: 21,230
    edited 2014-04-08 11:43
    Oh shoot. No progress out of you for about a week then. There are a lot of Crockford videos and they are all really good. I've had to watch all through twice already.
  • jazzedjazzed Posts: 11,803
    edited 2014-04-08 11:55
    msrobots wrote: »
    I do not know why everybody tries to use the Editor with handheld devices. It is not at all build for that, yet.
    Because Parallax wants a mobile solution. If you're going to do all the work, then you gotta do that too.
Sign In or Register to comment.