Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

CodeaShowcase (update: v2.210)

Jmv38Jmv38 Mod
edited January 2015 in Code Sharing Posts: 3,295

Hello Fellow codea addicts!

Some questions:

  • are you tired of all the fuss when coping a project example from the forum: you need to create a new project, find a new name you havent already used, run it, then manage or delete this new entry in your 400 projects...

  • or when you have gist, now there is this great gist tool from Juce, but you still have to create a project again, and you better not forget, or you overwrite your gist tool!

  • and when you like the project, you dont remember what forum entry it was, and you so loose the instructions and who was the author. And if you put a star to it in the forum, it doesnt help, because the discussion title was an entirely different topic?

If you answer YES to one of these question, you might be interested by this program:
The opening page offers 3 buttons:

  • load and run a gist that url is in the pasteboard.
  • run code that is in the pasteboard.
  • run a project from my collection.

For this last choice you'll have to tap on the buttons that appear. This will load the project. Then for most projects you can:
- copy the code in the pasteboard, or
- run the code, or
- open the forum comment it came from.
Technically: i have made a function that i pass a forum comment adress, and it automatically extracts the code in this comment (if it is in blue format with ~ ~ ~, not if it is the fancy format). This is then very quick to store forum urls into this program, for later reference.

To get the code in the pasteboard, run this:


--# Main -- loader1 function setup() print("loading from the web") url = "http://jmv38.comze.com/CODEA_4/codeaShowcase1.txt" http.request(url,function(data) print("success") pasteboard.text = data print("paste in a new project now") end, function() print("loading failed") end ) end

video:

«1

Comments

  • @Jmv38 An absolutely amazing project. Exactly what I needed. =D> =D> =D>

    I think I am going to use this whenever I need to figure out what something on the forum does.

    How do you add projects to the 'empty' slots? Is it possible?

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    thanks.
    For the moment adding projects is not automatic. in screen3, ou have to turn this

        local b = rightButton(screen, b)
    

    into that

        local b = rightButton(screen, b, "Starter3: Sonar")
        function b:onTap() loadForum( "http://codea.io/talk/discussion/5225/starter-game-3/p1" ) end
    

    I will make it easier in a future version.

  • @Jmv38 It's already pretty easy, since you provided the commented out code.

  • Posts: 2,042

    Nice work! that game at the end looks familiar ;)

  • The user and all related content has been deleted.
  • Posts: 239

    Wow

  • Jmv38Jmv38 Mod
    Posts: 3,295

    Thanks you pals! Encouragements are a fuel to go ahead!

  • Posts: 1,185

    Hi @jmv38,

    Superb, ran it as is and looks like a great way to run libraries of code, not libs but finished apps. Just one small negative - when it was running it took over my internet access. Running pc in parallel was extremely slow. Not a problem for me but my better half was pulling her hair out. Any way of closing the link after the download?

    BriG

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    @BriG very strange. I just use the standard http.request in Codea. I had no idea it was doing anything in-between requests. Are you sure the problem was due to this project? If you can reproduce it, i'll ask Simeon to have a look on it.
    Thanks.
    [EDIT] it could be the in-app web browser not exiting correctly. Could you check if the problem also occurs when you dont tap 'view instruction link'? Maybe you must kill codea from the running tasks first. Thanks.
    ps: i would do it myself if i had any simple way to detect the problem. My better half not being around, and myself never using a pc, i feel powerless to do that.

  • @Jmv38 +1 I never use a PC either.

  • Where do I get the QPW?
    Where is the code or link??

  • Posts: 1,976

    @Sparrownor1 Welcome to the forums! The code is right at the top, with the blue background. Copy the text and paste it into a new project.

  • Posts: 1,185

    Hi @Jmv38,

    A little puzzled here in terms of what you are asking me to do - where is this 'view instruction link' to be found?

    Bri_G
    :-?

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    i meant "read forum instructions".
    Have you tried this button?
    it opens an in-app browser and i suspect it to be the cause of you priblem. Just a guess though.

  • Posts: 1,185

    Hi @Jmv38,

    Must have been some other issue as tried to reproduce and couldn't. Tried different conditions, including in app browser and it didn't slow down access to the internet from the pcs. A red herring by the look of it.

    Now goiing to see if I can set up my own system like you've set up with yours. Thanks again for the code.

    Bri_G

    ;)

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @Bri_G i am still actively working on the button library and on the project itself. The interfaces are evolving, without backward compatibility. I expect to settle down is a few weeks. Just to let you know, if you plan to use the code....

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    @Bri_G i confirm: next version will be much better in terms of data management (all links in a clear single table for instance), so i suggest you wait for next version before investing too much time with this version. But you decide.
    I have shared this early version because it is hard to wait for the 'perfect code' to publish it, without any fellow coders encouragements...

  • Posts: 1,185

    Hi @Jmv38,

    Thanks for the heads up, I've lots of irons in the fire at the moment so I'll watch and wait. Your current package is excellent so the finished product must be smething else.

    Thanks again.

    Bri_G
    ;)

  • thx @SkyTheCoder that was helpful thx

  • but for me it just says loading

  • Jmv38Jmv38 Mod
    Posts: 3,295

    here is version 2:

    This version has many new features, among which:
    - the links are saved in a 'links' tab easy to copy and share.
    - the loads of code needed to run this are hidden and saved in a local variable, and you can update it or delete it.
    - edit the links extensively from the project.
    - save locally the loaded code for offline use (those ones are colored violet).
    - you can add new screens easily.
    - many more great links in my collection.
    - in the settings select FlashRun to just run the projects, without the message windows.
    - and more...

    A couple videos to illustrate:


    --# libLoader -- libLoader local function run(data) resetMatrix() resetStyle() loadstring( data )() print("xfcCodeaShowcase") setup() end local function success(data,status,headers) -- pasteboard.text = data saveGlobalData("xfcCodeaShowcase",data) tween.delay(0.1,function() print("ready") run(data) end) end local function fail(data,status,headers) print("load failed") print(data) print(status) end function loadLibrary() local data = readGlobalData("xfcCodeaShowcase") if data == nil then url = "http://jmv38.comze.com/CODEA_4/xfcCodeaShowcase.txt" print("starting request") http.request(url,success,fail) else run(data) end end --# Main -- Main.lua --supportedOrientations(LANDSCAPE_ANY) function setup() if xfc then init() else print("loading xfcCodeaShowcase ...") loadLibrary() end end function draw() if Screen then Screen:draw() end end function touched(t) if Screen then Screen:touched(t) end end
  • @Jmv38 When you save a project for offline viewing, it stops being available the next time you run the QPV. Also, the pre-saved ones don't work until you save them manually.

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    @Saturn031000.
    1/ The saved projects are available only from QPV, not from codea main board. If you want to have them in codea, you must tap 'copy' then leave QPV, then paste it into a new codea project.
    2/ The pre-saved ones are not saved until you save them manually. It takes memory in your iPad, so you probably dont want them all, and i cant know the ones you want to save?
    So i thinks it works as expected on your side.
    Thanks.

    [edit] reading your post again: i think my answer does not correspond to your question in 1/. Are you sure you chose to save the project after you have loaded it? It doesnt save automatically.

  • @Jmv38 To clarify my first point, I meant that if you save a project for offline use, then return to the editor, then run the QPV again, it appears as not saved.

    Otherwise, great work (especially with the FlashRun setting)!

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    @Saturn031000 Concerning this problem can you list exactly your actions 1 by 1? It works fine on my side. Also which ipad and ios version do you have?

    [edit] i have reproduced it. I'll check what is going on.
    Thanks.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    I've nailed it! Dont use local save for the moment.

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    It should be fixed now!
    How to upgrade:
    - tap the settings.
    - tap 'force update'.
    - wait 10s (there is not good user feedback here, i should improve that).
    - exit, run again.
    now it should work. Let me know.

    The bug was that i was restarting each time from my original links, not from the links tab saved in your project.

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    version 2.1 (01) issued:
    - better management of updates: user information and auto restart.
    - current version visible in settings

  • @Jmv38 Brilliant!

    What about an option to reset the positions of the message boxes, etc.?

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @Satirn031000 what do you mean?

  • @Jmv38 When you get a message box, if you hit the lock button, you can resize and move the box. In the first version the positions would get saved every time the QPV was run. That doesn't seem to happen in v2.0/2.1, but if it did, then an option to reset the location and size of it is what I meant.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    I see. In the second version the positions are still saved if you move them, but because i have put everything into a separate library, the local data is overwriten by the library data (as it did for the links). So it will be ok now.

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295
    Update version 2.2.

    Now when you run a project, a stop button appears on bottom left. Tap it to return to previuos screen: the exploration is more fluid.
    To update tap 'force update' in the settings.
    [edit] doesnt work perfectly with 3d projects. the STOP botton is not visible, but still there, so you can tap it to exit.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    version 2.2 (01): technical changes vs 2.2 above to improve stability.

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    version 2.2 (02): technical changes to improve stability. Some projects failed because they change some codea native function (fontSize() redefined as a number for instance). Now i call the stop button with pcall and they dont fail any more.

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    Big update: 2.2(06).

    -- 2.206
    -- improved startup speed: screens are filled up on open only
    
    -- 2.205
    -- made 2 libraries : user and mine
    
    -- 2.204
    -- now loads CC links too (thanks to @Toffer)
    
    -- 2.203
    -- export your lib for sharing (new button in settings)
    

    There are also many more projects in my library now.

    To update:
    - you can copy the code below.
    - and make sure to tap settings / CLEAR local
    - restart.
    to get version 2.206 running.
    (force update does not seem to work correctly)


    --# libLoader -- libLoader local function run(data) resetMatrix() resetStyle() loadstring( data )() print("xfcCodeaShowcase") setup() end local function success(data,status,headers) -- pasteboard.text = data saveGlobalData("xfcCodeaShowcase",data) tween.delay(0.1,function() print("ready") run(data) end) end local function fail(data,status,headers) print("load failed") print(data) print(status) end function loadLibrary() local data = readGlobalData("xfcCodeaShowcase") if data == nil then url = "http://jmv38.comze.com/CODEA_4/xfcCodeaShowcase.txt" print("starting request") http.request(url,success,fail) else run(data) end end --# Main -- Main.lua --supportedOrientations(LANDSCAPE_ANY) function setup() if xfc then init() else print("loading xfcCodeaShowcase ...") loadLibrary() end end function draw() if Screen then Screen:draw() end end function touched(t) if Screen then Screen:touched(t) end end --# links -- links links = {} local function ins(t) table.insert(links,t) end ins { typ = "screen"} ins { typ = "title", txt = "<< tap to edit title" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "title", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "title", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "title", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" } ins { typ = "link", txt = "" }
  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295
    -- 2.208
    -- flash run works for links too
    -- corrected a bug when project does not redefine touched, my buttons were still there
    -- the force library update should work now
    
    

    to update tap / settings / CLEAR local lib /, then restart

  • edited August 2014 Posts: 282

    @Jmv38 The share feature is really useful. One suggestion, have a clear local save button.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @saturn031000 thanks.
    What do you mean exactly? ' have a clear local save button'

  • Posts: 2,042

    Errors when pasting no info, for example copy a blank title then hit paste it will cause error

    In-app browser would be preferable for opening links, or an option to choose between in app or not.

    Great project.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @jakattack thanks.
    1/ Errors when pasting no info, for example copy a blank title then hit paste it will cause error.

    i cant reproduce it. I cannot copy a blank title...? Which version do you have? (see in settings).

    2/In-app browser would be preferable for opening links, or an option to choose between in app or not.

    at first i put it in-app. But then there is a pb when closing the browser. (you know that one, you've reported it). With external, it is quite easy to come back to codea screen, still running. I found that better, so i have changed.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @Bri_G if you still want to use it, now it ok: the data format is good and stable.

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    to all: make sure you try: /setting / directly load and run the link.
    that is really cool because now you can explore all projects seamlessly.

  • edited August 2014 Posts: 2,042

    @Jmv38, weird you can't copy blank title, maybe I already had blank copied. Will explore.

    EDIT: I have 2.208, and it happens when I hit clear title, copy to pasteboard, paste from pasteboard in that order for title

  • Posts: 2,042

    Using the directly load, very nice, but can't edit blank spots

  • Jmv38Jmv38 Mod
    edited August 2014 Posts: 3,295

    @Jakattak.
    1/ blank: i will try that, although that's a bit of a perverse sequence (! ;) ).
    2/ in directly load mode, the blank spots do nothing, because there is nothing to run. That is the idea to have a 'no complex window mode'. To edit them, go back to normal mode.

  • @Jmv38 I really need to work on my communication skills. To clarify, you know how you can save a project for offline viewing and then 'Run from local SAVE'? Well, to delete a project for offline viewing, maybe have a 'Clear local SAVE' button.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @Saturn031000 that is an excellent idea and i fully agree.
    So much, actually, that it has been there from the beginning ;) : tap [edit] on the project, the last option before [clear] is [clear local save]. But you have to scroll the window to see it.
    lol.
    Thanks

  • edited August 2014 Posts: 282

    @Jmv38 Doesn't that just clear the xfcCodeaShowcase? I am talking about when you save projects for offline viewing. Using that button didn't clear them.


    EDIT: =)) I just saw it. Maybe make it more obvious?

  • Jmv38Jmv38 Mod
    Posts: 3,295

    Not so obvious to 1/have many options 2/ make them clearly visible.
    I though this action is not something you need to do quite often, this is why i have put it at yhe end.

Sign In or Register to comment.