Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Applications (.net 2.0? etc.) - Cross-Platform Test Fest Time! - Page 2 — Parallax Forums

Propeller Applications (.net 2.0? etc.) - Cross-Platform Test Fest Time!

24

Comments

  • heaterheater Posts: 3,370
    edited 2009-09-19 08:29
    TestFest_PurBasic on Debian Lenny just works ! Great !

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Cats92Cats92 Posts: 149
    edited 2009-09-19 09:12
    Hello, Heater reminds me problems I met installing JAVA.
    As a beginner I like PROCESSING (working with Linux, Mac or Windows) writing programs on my PC.
    It seems to use Java , but installation and use are much easier. It is easy to create graphics and there are lots of libraries for serial communication, graphics, Opencv,sounds.
    cats92
  • simonlsimonl Posts: 866
    edited 2009-09-19 11:48
    @jazzed: GREAT TOPIC!

    I'm only using Windows, so I guess it's no surprise that both tests (yours and Andy's) just loaded and ran super quick.

    I really like the load-/run-it simplicity of these two tests (which was the icing on the cake with BradC's IDE - great work Brad), and if I really HAD to make a choice I guess I'd go with Java - but ONLY because it wouldn't get blocked by my work's firewall :GRIN:

    That said; looks like PureBASIC might be the simplest cross-platform (?) - Andy: any chance of producing the MAC version - I might be able to get that tested?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
  • heaterheater Posts: 3,370
    edited 2009-09-19 12:49
    simonl: I did not see any load and run simplicity of the Java test. Sill that's the point of the test.
    It may be interesting to see what people can come up with.

    Very hard to beat BradC's BST.

    This test would be a tad more realistic if the examples had to include a serial connection. Not a Prop loader, but enough to talk to it when it's up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • jazzedjazzed Posts: 11,803
    edited 2009-09-19 14:06
    heater said...
    This test would be a tad more realistic if the examples had to include a serial connection. Not a Prop loader, but enough to talk to it when it's up.
    Yes, and now you have a working JVM for that test. devil.gifsmilewinkgrin.gif

    It's nice to know what it takes for your system. Sorry it was such a bother.

    I remember trying Debian Linux around 1998. It was a horrible experience ... here a crash, there a crash .... We did use Debian for an embedded code-base at Cisco recently which seemed fairly painless. Redhat was better. Then later Fedora was released ... very impressive workstation release !!! I used Suse Linux for several years at home with no problems. Ubuntu is on an old PC I use for some entertainment and besides the weekly 40MB updates and lack of real super user authority, I've been quite happy with it.

    @heater, will you provide the Qt examples? It is new to me. The application is already in the examples, but I'm not sure how to deploy all 3 with libraries.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve

    Propeller Tools
  • heaterheater Posts: 3,370
    edited 2009-09-19 14:25
    I can do a Qt example. Just now I'm getting giddy on solder fumes building up my TriBlade, so it make take a little while.

    Sneaky how you got Sun's Java installed here [noparse]:)[/noparse]

    Eight years ago we were running WEB shops on Debian. Didn't give us any trouble by then.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2009-09-19 14:49
    On IE8 clicking the program opens it as a zip file. Downloading the program IE8 changes the name to JavaSum.zip. Renameing the file JavaSum.jar and then double clicking it runs the program.

    John Abshier
  • jazzedjazzed Posts: 11,803
    edited 2009-09-19 15:08
    @John,
    Oh my PITA. Sounds like my Google Chrome experience. Glad you got it working.

    BTW: Thanks to all of you who have participated so far !!!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve

    Propeller Tools
  • HannoHanno Posts: 1,130
    edited 2009-09-19 21:02
    Instead of adding two numbers, I would like to submit the contents of the "client kit for viewport"- available here: mydancebot.com/viewport/clients.php The link also includes a video showing the kit in action...
    All examples connect to the ViewPort server to read and write data from a program running on the Propeller.
    Here are examples in Python, VB.net, C#, Excel and Matlab.

    Python:
    import win32ui,dde,sys,time
    ddeClient = dde.CreateServer()
    ddeClient.Create("")
    vp = dde.CreateConversation(ddeClient)
    vp.ConnectTo("vp", "system")
    
    #compile, load, and connect to a spin file
    vp.Exec("load("+sys.path[noparse][[/noparse]0]+"\sample.spin)")
    print "Spin file is sharing these:"+vp.Request("list")
    #request and poke a variable
    print "Variable m's value is:"+vp.Request("m")
    vp.Poke("m","1234")
    time.sleep(.1)
    print "After a poke, its value is:"+vp.Request("m")
    raw_input("Press Enter to exit")
    
    



    Excel
    =vp|get!n 'when typed into an excel cell, continuously gets the value of spin variable "n"
    
    



    Excel Macros
        'Start DDE connection to ViewPort
            channel = DDEInitiate("vp", "system")
        'Connect ViewPort to Propeller
     '       DDEExecute channel, "load(a.spin)"
        'Connect ViewPort to Propeller
            DDEExecute channel, "connect"
        'Set cell to list of names of Propeller variables
            ActiveSheet.Cells(18, 2).Value = DDERequest(channel, "list")
        'Set cell to detail of variable "n"
            ActiveSheet.Cells(19, 2).Value = DDERequest(channel, "detail(n)")
        'Read variable into cell once
            ActiveSheet.Cells(20, 2).Value = DDERequest(channel, "n")
        'Poke a value to variable m- only done once!
            DDEPoke channel, "m", Sheets("Sheet1").Range("B21")
        'Link m variable to cell
            DDEExecute channel, "link(m,excel|excel client.xls!r22c2)]"
        'Continually update cell with value of "n" variable from Propeller
            ActiveSheet.Cells(24, 2).Value = "=vp|get!n"
            ActiveWorkbook.SetLinkOnData "vp|get!n", "gotData"
        'Start a trigger that fires when "n" rises above 250.  Then, return n,m
            ActiveSheet.Cells(25, 2).Value = "=vp|rise!n_2000_n_m"
            ActiveWorkbook.SetLinkOnData "vp|rise!n_2000_n_m", "gotTrigger"
            a = 0: b = 0
            ActiveSheet.Cells(28, 2).Value = b
    
    




    C#
    namespace csharp_client
    {
        public partial class Form1 : Form
        {
            vpClient.Main vp;
            private delegate void doUIThread(string s);
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                vp = new vpClient.Main();
                vp.connect();
                int array1int = vp.requestInts("array1")[noparse][[/noparse]0];
                string array1str = vp.requestString("array1");
                vp.advise += new Main.adviseEventHandler(vp_advise);
                vp.startAdvise("array1", 12);
            }
            private void vp_advise(byte[noparse][[/noparse]] s, int format)
            {
                int v0,vn, n;
                
                v0= BitConverter.ToInt32(s, 0);
                string result;
                result = string.Format("{0}", v0);
                for (n = 1; n < 10; n++)
                {
                    vn = BitConverter.ToInt32(s, n*4);
                    result+= string.Format("{0}{1}",Environment.NewLine , vn);    
                    if (vn!=v0) {                    
                        throw new Exception("Mismatch!");
                    }
                }
    
                this.Invoke(new doUIThread(this.setTextbox), result);
            }
            private void setTextbox(string s)
            {
                textBox1.Text = s;
            }
        }
    
    }
    
    



    VB.NET
    Public Class Form1
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim vp As vpClient.Main = New vpClient.Main()
            vp.connect()
            TextBox1.Text = vp.requestString("m")
        End Sub
    End Class
    
    


    Matlab
    NET.addAssembly('C:\propeller\dde\dotNetDll\vpClient.dll') %Open the Propeller Viewport DLL
    
    vpObj=vpClient.Main(); %create the viewport .Net object
    vpMsg=vpObj.connect;  %connect to the VP server, vpMsg holds any messages
    vpMsg=char(vpMsg); %We always need to convert from .Net datatypes to Matlab types
    if strcmp(vpMsg,'Connected to server')
        vpMsg=vpObj.requestString('list'); %get a list of variables in Viewport memory
        disp(char(vpMsg));
        
        x=vpObj.request('marray',12); %get the data from Viewport
        x=double(x); %convert from .Net object to Matlab array of doubles
    
        %plot our results
        figure, subplot(2,1,1)
        plot(x);
        title('Sample vs t')
        xlabel('Index (t)')
        ylabel('Sample Value')
    
        subplot(2,1,2)
        plot(abs(fft(x)));
        title('Magnitude of FFT vs Freq');
        xlabel('Freq');
        ylabel('Abs(fft(x))');
    else 
        disp('Error: Cannot connect to Viewport');
    end
    
    vpMsg=vpObj.disconnect; %disconnect Viewport connection
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Download a free trial of ViewPort- the premier visual debugger for the Propeller
    Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-09-19 21:34
    Ariba's entry using purebasic reminded me of another basic that is gaining some popularity on Linux: gambas ... wonder if it's on Windzers yet...

    anyone working on the PyQt version ? [noparse]:)[/noparse])


    - H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (CounterRotatingProps) : 9/19/2009 9:40:53 PM GMT
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-09-19 21:37
    Wow Hanno!

    I'll try some of those today or tomorrow. Nice work.

    thanks
    - Howard

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • jazzedjazzed Posts: 11,803
    edited 2009-09-19 22:05
    @CRP,
    I was hoping you were working on a Python-ish variation.

    @Hanno [noparse][[/noparse]... much deleted ...] oh never mind.

    Does anyone here run Excel on Linux?

    I do wish people would be more attracted to .net since that would make application development and deployment easier.
    As it stands though, clearly this thread and its contributions so far prove there many options for cross platform and .net is just one.
    Even I am considering Pascal again (ugh) because of BradC's work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve

    Propeller Tools Post Edited (jazzed) : 9/19/2009 10:26:21 PM GMT
  • HannoHanno Posts: 1,130
    edited 2009-09-19 23:05
    Hi Again,
    Ok, I reread the instructions and here's my official entry [noparse]:)[/noparse]

    The attached python program includes info to help windows people install python on their pc.
    Load the spin program to the Propeller with ViewPort v4.2 and start the connection

    The python program will prompt you for two numbers. It'll send them to the Propeller where they're added together. The python script then displays the returned value.

    Required Feedback per the "rules": The "purebasic" app has a bug. Try typing in 3 digit numbers. Like 100+150...200??? Or even 12+120... =112??? Very odd, I couldn't figure out the pattern...
    Hanno
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-09-19 23:07
    > Does anyone here run Excel on Linux?

    *GACK* - that seems like putting ketchup on ice cream :-O
    ... just kidding, of course.

    RE .Net - I actually don't mind it on Winderz (If you have a fast enough internet connection, just let windows update pull it in [noparse][[/noparse]but turn off install of Internet Exploder 8 !])

    > Pascal again (ugh)
    LOL - back to the future, eh?

    > Python-ish
    OK as soon as I'm finished googling "how to repair a scr*wed up Ryobi 2-stroke yard trimmer," I'll look into it.
    [noparse][[/noparse]EDIT --- Oh, Hanno just beat me to it!]

    - H
    _______________________________________________
    If you hear me cursing in my yard, you know it's Ryobi !

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-09-19 23:09
    Oh, wait Hanno - it has to be a GUI, not command line. Guess you could say that VP is providing the GUI, but I think Steve would also like a stand alone Py GUI. - H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (CounterRotatingProps) : 9/19/2009 11:15:04 PM GMT
  • AribaAriba Posts: 2,690
    edited 2009-09-20 03:02
    simonl said...

    That said; looks like PureBASIC might be the simplest cross-platform (?) - Andy: any chance of producing the MAC version - I might be able to get that tested?

    simonl

    A MAC version needs to be compiled on a MAC with the PureBasic version for MAC, and I just not own a MAC.
    But you can try to compile it by yourself. Download the Demo version of PureBasic for MAC (Link in my last post), and use the attached source. (Load TestFest.pb and press F5 {if it is the same as in Win and Linux}).
    Hanno said...

    Required Feedback per the "rules": The "purebasic" app has a bug. Try typing in 3 digit numbers. Like 100+150...200??? Or even 12+120... =112??? Very odd, I couldn't figure out the pattern...

    Hanno

    I've set the value limits for the Input Widgets to 0..100, you see that if you change the value with the Up/Down arrows. That would be easy to change, but the range was not specified, so I just choosed a number.

    Andy

    Post Edited (Ariba) : 9/20/2009 3:48:41 AM GMT
  • BradCBradC Posts: 2,601
    edited 2009-09-20 03:52
    /me re-reads the thread title..

    I thought this thread was testing material for cross-platform GUI interfaces?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
  • heaterheater Posts: 3,370
    edited 2009-09-20 05:00
    Jazzed: "I do wish people would be more attracted to .net since that would make application development and deployment easier."

    As we have already established this is only true in the tiny Windows world. Yes "tiny". Not as in number of users but as in number of different supported operating systems, CPU and platform architectures. Is that not the point of the "test fest".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • heaterheater Posts: 3,370
    edited 2009-09-20 05:06
    Hanno: In addnumber.py - "import win32ui,...."

    This is cross platform in which way ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • HannoHanno Posts: 1,130
    edited 2009-09-20 06:24
    Ariba- thanks for the clarification- although I still don't understand why it gives the interesting results [noparse]:)[/noparse] Heater- you're right, my python code is windows only- even more so since it relies on ViewPort for the connection to the Prop. And yes, it's also console only- not gui. So, I fail the cross-platform gui test fest and ability to parse this thread- I'll blame my kids for my lack of sleep- sorry about that! I still think my code is an interesting example of how to combine Propeller programming with PC programs- but I'll take that to a new thread.
    Hanno

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Download a free trial of ViewPort- the premier visual debugger for the Propeller
    Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
  • heaterheater Posts: 3,370
    edited 2009-09-20 06:35
    Hanno, an interesting concept indeed. How about arranging the Windows ViewPort Propeller Server to accept network connections from clients. Then who cares what platform the clients are on or what language they use. One step in the cross platform direction. And wow, I can connect to my Propeller hardware set up from anywhere and hack on it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-09-21 15:21
    Hanno,

    at the risk of hijacking Steve's thread here a second... heater's made a great suggestion - it would be very useful and cool to have a little web server in viewport. That little server could be an admin page that lets you define IP connections both ways as well as port numbers to listen/send on. You're probably aware that there's tons of sample code in multiple prog. languages for making simple web servers and IP port stuff.

    That would expand the power of Viewport to new levels indeed.

    @Steve - working on a PyQt4 sample now... turns out I have to upgrade and set up some dev stuff, so it's a little more work on my side than I thought. Not sure yet how much/if that affects what a user will have to install.

    - H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (CounterRotatingProps) : 9/21/2009 3:37:07 PM GMT
  • dMajodMajo Posts: 855
    edited 2009-09-21 15:58
    I don't know other platforms (except Win), but because Hanno is using DDE this already works on network for Win platforms. It's enough the DDE over network service is enabled. If DDE is supported on other platforms too, than it should work also there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates)
  • heaterheater Posts: 3,370
    edited 2009-09-21 16:20
    And DDE is what ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • dMajodMajo Posts: 855
    edited 2009-09-21 17:01
    Dynamic Data Exchange: the way Hanno is communicating eg. by Excel to viewport

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates)
  • heaterheater Posts: 3,370
    edited 2009-09-21 17:07
    Yes, yes. But my point was, badly expressed I must say, what is it?

    Where can I read the DDE specification, so as to be able to write some code to talk with it?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • jazzedjazzed Posts: 11,803
    edited 2009-09-21 17:19
    Well, DDE is a Windows thang [noparse]:)[/noparse] I guess Wine supports that since it predates Windows 2000.

    I've decided to look seriously at wxWidgets mainly because of the license exception which in part states:

    Snip for focus. Full license exception is on the wxWidgets web site.
    ...
    
      EXCEPTION NOTICE
    
      1. As a special exception, the copyright holders of this library give
      permission for additional uses of the text contained in this release of
      the library as licenced under the wxWindows Library Licence, applying
      either version 3.1 of the Licence, or (at your option) any later version of
      the Licence as published by the copyright holders of version
      3.1 of the Licence document.
    
      2. The exception is that you may use, copy, link, modify and distribute
      under your own terms, binary object code versions of works based
      on the Library.
    
    ...
    
    



    As I understand it (please correct me if I'm wrong):

    In LGPL terms, for wxWidgets "works based on the library" means that I can just distribute an executable
    program which contains the wx library. The difference is: including the Qt LGPL library in my executable
    means I have to give away my IP where the wxWidgets license means I do not.

    If I want to use Qt and keep my IP, it would mean requiring the user to have a library separate from my
    executable ... which I could provide. Problem is as I read it, I can not restrict the user from using their
    own library which may or may not work with my program. Of course it is possible that a user could fix a
    library bug though I'm not sure how important that is to most users.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve

    Propeller Tools
  • dMajodMajo Posts: 855
    edited 2009-09-21 17:41
    http://social.msdn.microsoft.com/Search/en-US/?Refinement=117&Query=dde

    Heater, basically there is DDE servers and DDE clients. Each application that is made to be a DDE server have it's own (data) variables that can be accessed. That application must provide some documentation so that you can know how to code the client side. As you can see from hanno's examples he is using some methods which syntax can be slightly different from one language(application) to other but when the client side is sending some commands (eg. load a.spin) or requesting a variable value that commands/variable names must be known by the client and thus provided by the server application documentation.

    At the end is easier to make than to describe


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates)
  • HannoHanno Posts: 1,130
    edited 2009-09-21 18:43
    Hi Guys,
    I feel bad about polluting this thread- Jazzed had a great idea with his cross-platform test fest- let's let it continue here. I'll soon make another attempt to post a cross-platform gui app- that doesn't even use ViewPort!

    Here's a nice ViewPort/DDE thread- please comment about DDE/ViewPort there...
    http://forums.parallax.com/showthread.php?p=820111
    Hanno

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Download a free trial of ViewPort- the premier visual debugger for the Propeller
    Includes full debugger, simulated instruments, fuzzy logic, and OpenCV for computer vision. Now a Parallax Product!
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-09-21 20:55
    Steve (jazzed) said:
    If I want to use Qt and keep my IP, it would mean requiring the user to have a library separate from my
    executable ... which I could provide. Problem is as I read it, I can not restrict the user from using their
    own library which may or may not work with my program. Of course it is possible that a user could fix a
    library bug though I'm not sure how important that is to most users.
    Legalities aside ...

    If I were dumb enough to try my own version of rundll32.exe, I'd be getting what I asked for.· But if that "separate library" were in the one directory where your GUI/app lives, wouldn't that isolate it and work?··That's pretty common in Win. ... not sure about the other OS'es though.

    wxWigets are nice too, yet·QT4 seems·better, more robust.··

    But if the LGPL hamstrings you, what else can you do? Ah, it's the old third party library issue again...

    *crud*



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sign In or Register to comment.