Howdy, Stranger!

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

Codea 1.5 (Beta 8)

SimeonSimeon Admin Mod
edited December 2012 in Beta Posts: 5,364

Hi Beta group

The other thread was huge.

I'm uploading a new build (8), so I've decided to make a new thread.

Build 8 is mostly bug fixes — I've attempted to fix the shader lab crash reported in the previous thread, as well as many other things (see the release notes).

There is also a new feature: vector art asset support. If you want to try this out you can use the included vector sprite packs, or use your own PDF files. PDF is natively supported by iOS, so this seemed a good choice for vector graphics.

A note on this: even though your source art is in a vector format, Codea must rasterise the data in order to get it into OpenGL. So every time you render a vector asset at a new, specific size, Codea will cache a texture for that size. These textures will be flushed when memory is low, but it can cause a performance hit for large vector graphics.

Rendering a vector graphic at a fixed size every frame should be fine, however.

There is also a (currently undocumented) addition to readImage to allow you to specify a width and height for vector assets. So the new API is:

local img

-- Load the vector asset at its original pixel width/height
img = readImage( "Documents:My Vector Asset" )

-- Load the vector asset at a specific width, height is computed by aspect ratio
img = readImage( "Documents:My Vector Asset", width )

-- Load the vector asset at a specific width and height, squashing if necessary
img = readImage( "Documents:My Vector Asset", width, height )
«1

Comments

  • BortelsBortels Mod
    Posts: 1,557

    Vector assets? You guys floor me - I would never have thought of it (unless in the context of SVG). This seems an excellent idea for non-resolution-dependant stuff. Me Like.

  • Posts: 2,161

    Whoop-dee-doo!

    PDFs will be awesome. I have an idea of a use for them ... but it needs developing so I'll hold off on saying more until I'm clearer.

    Just installed on my new iPad ... but haven't transferred the shaders yet. Going to do that now.

  • BortelsBortels Mod
    Posts: 1,557

    Scaling is noticeably slow. Not a big deal - just means you need to scale() rather than expect to be able to change the width/height in your loop.

    Pretty cool. More sprite packs!

  • SimeonSimeon Admin Mod
    Posts: 5,364

    .@Bortels the demo app exhibits very bad behaviour with regards to vector assets — the ideal case is: choose your largest desired size and use readImage() to get that into a static image that you then render as a sprite. The sprite size options will then be as fast as normal. Rendering vector assets with sprite() is fine if the size doesn't change much (or the sprite is fairly small).

  • Posts: 1,255

    Gravity and UserAcceleration are working again... sometimes. About 30% of the time, when I start a project, they run fine. 70% of the time the same project returns nothing but 0.

  • Posts: 2,161

    Okay, need to do a bit of thinking when using shaders on retina particularly when I'm using an image as an intermediate step. It looks as though I need to be sure to pass the real width to the shader instead of the apparent width - this means that I'd really like to know when I'm on a retina iPad or not. I remember some discussion about this - what was the conclusion?

  • Posts: 2,161

    Oh. My. Word.

    Game-Of-Life running at full resolution on a retina screen. Getting fps of about 29 (which is a few frames better than iPad2 at its full resolution) with amazingly crisp display. Looks absolutely amazing.

    (Never thought I'd be this amazed by some technology improvement, but retina really is something special.)

    Oh, and I've yet to get gravity working.

  • Posts: 2,161

    And now it works ... on an already running project where it wasn't working before. I "hot switchef" from Codea and when I went back gravity had been switched on.

  • Posts: 503

    Gravity doesn't seem to work for me. Will try it out more later on.

  • Posts: 2,161

    I've now successfully turned on gravity twice by doing that trick: double-click the "Home" button to switch to another app leaving the Codea program running and then double-click back again.

  • Posts: 489

    The Shader Editor is more stable in beta 1.5(8), but I find that it is still not stable and crashes out of Codea from time to time.

    I have been experimenting with noise in the light of this github respository.

    Lua:

    --
    -- Noise GLSL
    --
    -- Shader makes use of:
    -- Array and textureless GLSL 2D simplex noise function.
    -- Author : Ian McEwan, Ashima Arts.
    -- https://github.com/ashima/webgl-noise
    
    function setup()
        parameter.number("freq", 1, 10, 5)
        parameter.number("speed", 0, 1, 0.1)
        parameter.number("threshold", 0, 1, 0.5)
        origin = vec2()
        velDir = 0
        dVelDir = 0.1
        twoPi = 2 * math.pi
        m = mesh()
        m:addRect(WIDTH/2, HEIGHT/2, WIDTH, HEIGHT)
        m.shader = shader("Documents:Noise")
    end
    
    function draw()
        velDir = velDir + ((math.random() * 2 - 1) * dVelDir) % twoPi
        local vel = vec2(math.cos(velDir), math.sin(velDir)) * speed
        origin = origin + vel
        m.shader.origin = origin
        m.shader.freq = freq
        m.shader.threshold = threshold
        m:draw()
    end
    

    Vertex shader:

    //
    // Vertex shader: Noise
    //
    
    uniform mat4 modelViewProjection;
    attribute vec4 position;
    attribute vec2 texCoord;
    
    varying highp vec2 vTexCoord;
    
    void main() {
        vTexCoord = texCoord;
        gl_Position = modelViewProjection * position;
    }
    

    Fragment shader:

    //
    // Fragment shader: Noise
    //
    
    precision highp float;
    
    uniform vec2 origin;
    uniform float freq;
    uniform float threshold;
    
    varying highp vec2 vTexCoord;
    
    // ---------------------------------------------------------------
    // Array and textureless GLSL 2D simplex noise function.
    // Author : Ian McEwan, Ashima Arts.
    // https://github.com/ashima/webgl-noise
    // ---------------------------------------------------------------
    // Copyright (C) 2011 Ashima Arts. All rights reserved.
    // Permission is hereby granted, free of charge, to any person
    // obtaining a copy of this software and associated documentation
    // files (the "Software"), to deal in the Software without
    // restriction, including without limitation the rights to use,
    // copy, modify, merge, publish, distribute, sublicense, and/or
    // sell copies of the Software, and to permit persons to whom the
    // Software is furnished to do so, subject to the following
    // conditions:
    //
    // The above copyright notice and this permission notice shall be
    // included in all copies or substantial portions of the Software.
    //
    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
    // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
    // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    // OTHER DEALINGS IN THE SOFTWARE.
    
    vec3 mod289(vec3 x) {return x - floor(x / 289.0) * 289.0;}
    vec2 mod289(vec2 x) {return x - floor(x / 289.0) * 289.0;}
    vec3 permute(vec3 x) {return mod289(((x * 34.0) + 1.0) * x);}
    
    float snoise(vec2 v) {
        const vec4 C = vec4(0.211324865405187,  // (3.0-sqrt(3.0))/6.0
                            0.366025403784439,  // 0.5*(sqrt(3.0)-1.0)
                           -0.577350269189626,  // -1.0 + 2.0 * C.x
                            0.024390243902439); // 1.0 / 41.0
        vec2 i = floor(v + dot(v, C.yy));
        vec2 x0 = v - i + dot(i, C.xx);
        vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
        vec4 x12 = x0.xyxy + C.xxzz;
        x12.xy -= i1;
        i = mod289(i);
        vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))
             + i.x + vec3(0.0, i1.x, 1.0));
        vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),
            dot(x12.zw, x12.zw)), 0.0);
        m = m*m;
        m = m*m;
        vec3 x = 2.0 * fract(p * C.www) - 1.0;
        vec3 h = abs(x) - 0.5;
        vec3 ox = floor(x + 0.5);
        vec3 a0 = x - ox;
        m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);
        vec3 g;
        g.x = a0.x * x0.x + h.x * x0.y;
        g.yz = a0.yz * x12.xz + h.yz * x12.yw;
        return 130.0 * dot(m, g);
    }
    // ---------------------------------------------------------------
    
    void main() {
        vec2 p = vTexCoord * freq + origin;
        float n = (snoise(p) + 1.0) / 2.0;
        n = (n > threshold) ? (n - threshold) / (1.0 - threshold) : 0.0;
        gl_FragColor = vec4(n, n, n, 1.0);
    }
    
  • Posts: 489

    In beta 1.5(8), the Editor does not behave as I would expect it to when the backspace key is held down to delete long passages of code.

    For example:

    1. Create a new default project and move to the very end. Hold down the backspace key.

    2. After a while, the Editor moves from deleting single characters to speed deleting of chunks of characters at a time.

    3. However, when deleting chunks, the characters to the right of the cursor are still displayed (for a while) even though they have been deleted.

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    .@mpilgrem i've tried your code: works fine. I'am not sure we need real time shaders for such images, however? At least it is an example of code syntax for complex computations. @Simeon i hope there will be some way to copy/paste shaders simpler than current process, cause it' fairly boring to paste back an forth from the forum....

  • Posts: 489

    Hello @Jmv38. I am interested in procedural textures, which is why I am interested in noise in shaders.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    PROBLEM with parameters.watch(): i am trying to use the parameters in some class to ajust the parameters of the created object. Here is the example of a class method i call in init():

    function Modifier:start()
        -- cleanup the control panel
        parameter.clear()
        output.clear()
        self.title = "myTitle"
        parameter.watch(self.title)
        print(self.title)
    end
    

    In the setup of the main i create modif = Modifier(), that calls start().
    This prints correctly "myTitle" in the output, but in the parameter region:
    - it prints "myTitle".
    - and the error message "cannot evaluate expression".
    I see from the doc i should have wrote parameter.watch("self.title") but then it doesn't work at all.
    From this example (i've not tried all options), the parametrs functions seem to work with globally declared variable, but not with self.x variables. If it is true, and there is no simple workaround, then it makes the parameters function much less interesting: i dont' want to use global variables for a user interface that will change depending on the context.
    Can sby tell me if there is a syntax trick i don't know to make it work with self.x variables? Thanks in advance for your help.

  • edited December 2012 Posts: 489

    Hello @Jmv38. The Lua expression in string in parameter.watch(string) has to evaluate to something that exists when the expression is evaluated (outside of your Lua code). For example:

    Modifier = class()
    
    function Modifier:init(title)
        self.title = title
    end
        
    function setup()
        modif = Modifier("My title.")
        parameter.watch("modif.title")
    end
    
    function draw()
        background(0)
    end
    

    (Edit) or, more complex:

    Modifier = class()
    
    function Modifier:init(title)
        self.title = title
    end
        
    function setup()
        modifiers = {}
        modif1 = Modifier("My title one.")
        table.insert(modifiers, modif1)
        modif2 = Modifier("My title two.")
        table.insert(modifiers, modif2)
        parameter.integer("watchedModifier", 1, 2, 1)
        parameter.watch("modifiers[watchedModifier].title")
    end
    
    function draw()
        background(0)
    end
    
  • Posts: 489

    Hello @Simeon. Is it correct that where the Lua expression in string in parameter.watch(string) evaluates to more than one result, it is all but the last value that is discarded? I was expecting all but the first value to be discarded. For example:

    function setup()
        array = {"A", "B", "C", "D"}
        watch = "unpack(array)"
        parameter.watch(watch)
    end
    
    function draw()
        -- It is the "D" value that is watched
        background(0)
    end
    
  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    .@mpilgrem thank you! From your suggestions i implemented this:

        parameter.watch(self.name..".description")
    

    this way i dont have to create global variables, which i what i wanted first place? And i can call the watch from the object itself, so no need to expose those detail at higher level. The only thing i have to find is how an object can access it own name, i guess i'll found that on the web, must be in the metatable or sthg. Thanks.

  • Posts: 2,161

    Re PDF import. Can it be that we can use multi-page PDFs? Then a single PDF can be an entire sprite pack.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    After all, it doesn't seem that easy to get the variable name associated to 'self' in the running environment. I've found only complex and ugly solutions on the web. It is not that important, but if anyone has a clean solution to get the name of a variable from the variable itself, i'll be thankfull to know how he does it.

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    .@toadkick i've grabbed your code from: http://www.twolivesleft.com/Codea/Talk/discussion/comment/15424#Comment_15424 (automatic tab load from github) It works perfectly! Thanks for sharing. I've not been up to @fred version (too complex for me...). Do you have something new on this subject?
    [edit] from the ipad i can only do gist in github (if there is a way, to update the git repo i have not found it). For example: https://gist.github.com/4144835 But i dont know how to get this link in raw format as you do in your example. Do you know how i could do it?
    [edit] ok, i found the raw button. I got the following link: https://gist.github.com/raw/4144835/95963206fa95aa8e97144bfcfc68f0361f02aeec/gistfile1.txt i hope it is a stable link. I've notice that with dropbox those very long links have a limited lifetime...

  • Jmv38Jmv38 Mod
    Posts: 3,295

    crabitron in testflight i have this app, crabitron, that has appeared as available to install. But i have not received any mail notification from you @Simeon, so i am a bit suspicious. Does it come frm TLL? Since this have happened exactly when then forum got out of order, (BOINK), i am even more suspicious.

  • SimeonSimeon Admin Mod
    Posts: 5,364

    .@Jmv38 that's our new game — we also use TestFlight to distribute beta versions of it. You can install it if you're curious, it's safe.

  • Posts: 2,161

    I'm still seeing a bug with setContext clipping drawing functions to the screen size instead of the image size.


    displayMode(FULLSCREEN) function setup() local h,w = HEIGHT,WIDTH img = image(h,w) setContext(img) background(255, 0, 0, 255) fill(15, 60, 201, 255) rectMode(CORNER) rect(0,0,h,w) setContext() end function draw() background(54, 54, 54, 255) spriteMode(CORNER) sprite(img,0,0,400) end

    Run in landscape orientation. The result is a red rectangle with a blue square on top. If I change h and w to HEIGHT/2 and WIDTH/2 then the blue square becomes a blue rectangle covering the red one (modulo smoothing at the edges).

  • Jmv38Jmv38 Mod
    Posts: 3,295

    Hem! I've Never seen the forum so quiet... I guess everybody's preparing Christmas...

  • BortelsBortels Mod
    Posts: 1,557

    I was just reflecting the other day that it's been a while since I could actually read all of the threads - big growth!

  • Jmv38Jmv38 Mod
    Posts: 3,295

    Hello @Bortels. I would really like to be able to send data to my web site from Codea, and you already tried to help me to do this. Thanks a lot for that. But i dont know perl and i'am already not halfway in my LUA learning curve, so i don't feel the strength to start learning another langage again. I wonder if you would do some more for me: could you easily write a small autonomous script, in the appropriate language, that i could just upload to my web location and that would handle receiving some data (a file or a string) and saving it locally? With this tool i could continue learning codea and experiment on automatic program update from the ipad, and keep focused on that. I am not comfortable with asking that to you, but your seem so much experienced in these matters that i thought it might be very easy for you, so i dared asking you :"> . Of course if it is not that easy or you don't have the time, no problem, it's my business to do my things!

  • BortelsBortels Mod
    Posts: 1,557

    I've already done that - it's here:

    http://twolivesleft.com/Codea/Talk/discussion/comment/16486#Comment_16486

    It's not going to get much simpler than that without making assumptions about where you're running things that I can't make (like what OS, or what libraries are installed). The code there should run, unaltered, on OS X under the built-in apache server. You may need to enable CGI (I don't think it is by default), but that's straightforward - google for how to do it. It should also work on any unix variant - it might even work in windows - but you'd need to know how to start/configure your local webserver to serve that cgi.

    If that's still too far out - Webscript.io is an option, as is something new I'm looking at, firebase (at www.firebase.com).

    If you have pythonista, I could give you code - but you can't run that and Codea at the same time on the same ipad. :-)

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    Ok, thanks, but let's be really basic:
    How should i name the file you wrote? Where should i put it?
    An example, just to explain what i mean: i learned some time ago how to make a html page that turns into an offfline web app on the ipad. For this I has to put in the root directirory of my web site a file named .htaccess in which i had to write this:

    # Do not remove this line, otherwise mod_rewrite rules will stop working
    RewriteBase /
    AddType text/cache-manifest manifest
    ExpiresActive On
    ExpiresDefault "access"
    

    should i put your code in the .htaccess file? Or a file with another name? Should i run it, and if yes how? You see my questions arr really low level...
    Looking at my provider account info it says:
    Apache 2.2.19 (unix).
    Php 5.2.
    MySQL 5.1.
    Does that look good?
    EDIT: i've looked on the web for cgi and i found the following:
    I should create a directory with a .htaccess file where i write:

    Options +ExecCGI
    AddHandler cgi-script cgi pl
    

    then i should put there your file with the name bortels.cgi (haha).
    Then, if the config file of the server (which i have no access to) autorizes the above commands to run, then you file should execute if i call it from Codea with an httprequest command.
    Did i get it right? Uhh?

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    Hi @bortels. Here is what i've done:
    1/ i tried your links and it works fine: i can add text and read the result in Safari.
    2/ i created a /bortels directory in my web location, and put 2 files there: .htaccess and bortels.cgi with your script.
    3/ i hit in safari: http://jmv38.comze.com/bortels/?data=JMV38_first_try.
    4/ but this does not work: i get only this in safari:

    Index of /bortels
    
    Parent Directory
    bortels.cgi
    

    and no data.txt file has been created.
    Any suggestion for next step? (i am stuck here? I'am sure i do wrong something obvious for you, but what...?).

    [edit] are you sure i can run your script on the sever side, from the ipad? I've looked a little bit on the web, but in all the examples it seems to me they install apache on their PC to run some commands from there to give orders to their web site (maybe i got it wrong). I don't want to go to the PC, i'd like to do everything from the iPad.

    [edit] btw, i have Pythonista too, so if it can be used to blow the sh.. out of the tube, i mean to start things running, and then continue on Codea, that's would be fine too.

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    BUG this is not specific to this version, but it is still there: the sound functions do not always work. For instance with the Brickout example: it works if i restart codea, but otherwise not. Also the sounds, when they work, they slow down the ball when they are played. I remember from an older discussion that the slow down is only at the first use of a sound because the sound buffer has to be filled up and it takes time; and in brickout he sounds are random, so the change every time the sound is called... But that would be good to have in the brickout program an example of how to handle sounds so that they do not slow down the run.

  • Posts: 1,255

    I can't get sound to work at all in the latest release. Like gravity, it sometimes works if I close Codea and reopen it, but only for a short while.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    .@bortels i've looked at firebase.com: they provide exactly what i need! Even a sample page for making a leaderboard, which is one of the reasons i want to send data from a codea program. And, even if i am not that good in javacript, i think i have already experienced all the bricks needed to write the necessary html page to run the functionnality. So if i eventually fail doing it your way, i'll probably try to back up through firebase. But i would like first to really try your way, because it is simpler (fireball is third player to be introduced in the communication loop, and that means more complexity when something go wrong...).

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    EDITOR BUG syntaxtic coloring of vector methods does not work. For instance in:

    v0:dist(v1)
    

    dist is in black (instead of blue), while v0 is a vec2

  • Jmv38Jmv38 Mod
    Posts: 3,295

    DRAW BUG (if the error is not in my eyes...) i am working on some drawing tool, and i draw in an image. Here is the code https://gist.github.com/4364143 . Move your finger around to draw. You will see an offset between your draw and your finger. I draw into an image and then display the image as a sprite. The sprite is shifted y about (100,20). If i comment the 2 lines that manage the fps, there is no longer an offset. I think there should not be any offset even with those lines, because i reset the drawing with resetMatrix ans resetStyle. I think this is a bug, although it could be a mistake on my side... Ithought i should report it, because if it is really a bug, then it is really annoying, and you should know.

  • On an iPad2 with iOS 5.1 (if that matters, and I hope it's not my eating disorder these days that confuses my mind):


    Cursor movement and selection keys do not include the last character of a tab. (Not counting the annoyances of the last line, e.g. if I add "function f(t)" in the last line then the helpful autocomplete buttons keep me from tapping to the right of the parenthesis.)


    When browsing the help docs and hiding the keyboard (when search was active) the list frame scrolls a bit and the topmost entry is offscreen. You have to carefully scroll up to not enter search mode again.


    Only global storage works for me. saveLocalData() and saveProjectData() seem to have no effect. Or is it the companion read and list functions?


    Cannot get saveProjectTab() to work. Read and list works. Is it true that I can only create new tabs in existing projects? saveProjectTab() works to the extend that it complains if I name a non-existing project.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    Only global storage for me too. Ipad1.

  • Posts: 1,255

    Still have unpredictable behavior onlengy lines on the editor. The on-screen position of the cursor doesn't seem to match what's being edited, and you can't see what's really there until you introduce a carriage return.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    @mark this occurs to me too, but very rarely. I wrote the whole 'christmas gist' on 1.5(8) and it happened only once. Mabe linked to portarit? (i work lanscape)

  • Posts: 1,255

    @Jmv38 yep, I work in portrait, and that's where I'm seeing it. In my current project I'm encoding "levels" for a game in comma delimited strings, and if I let them spill past a line they become jumbled.

  • BortelsBortels Mod
    Posts: 1,557

    Sorry - was AFK for the holiday mostly.

    @jmv38 - what you're seeing is apache giving you a directory listing, rather than executing the cgi script. Try renaming it to "index.cgi", or calling it explictly (ie. your URL would end in /bortels.cgi).

    Otherwise, that should work. I literally cut and pasted the code from my working version.

    And - to explain further - the content of "bortels.cgi" is running on the server, not on your ipad. You want the resulting data file to reside on the webserver, so the code that writes it needs to live on that webserver.

    I like the firebase stuff - but it explicitly hands off part of your infrastructure to a third party, whose goals and priorities may (OR MAY NOT) coincide with yours. It's great for hobby and messing around; but I wouldn't trust anyone but myself (or someone I'm paying, and even then I'm iffy about it) with my data if money was riding on it. (disclaimer: I do server side code and support for home banking for a living, and my levels of distrust and requirements for uptime are through the roof... if you're just looking for a casual highscore server, and your reaction to data loss is "bummer" - and it should be for casual stuff - then things like firebase are probably more than enough)

  • Posts: 2,161

    Loading too many images into the GPU crashes Codea. The number is about 30 (full sized, iPad4), but obviously depends on other stuff loaded in. Thing is, I only need to display about 7 at a time but they aren't always the same seven so when loading new ones in the number can get high enough to crash the system if I'm not careful.

  • SimeonSimeon Admin Mod
    Posts: 5,364

    .@Andrew_Stacey do you maintain references to more than 30 at times? Codea will garbage collect when a low memory warning is received — so if you have images that have no references in your code, they will be deallocated. But if you are keeping references then there is nothing we can do to prevent the crash.

  • SimeonSimeon Admin Mod
    Posts: 5,364

    .@Mark @Jmv38 apologies on the editor issues. I'm experimenting with a re-write at the moment. In the mean time I will try to improve the current implementation — if you have some code that consistently recreates the buggy behaviour that would be great.

  • SimeonSimeon Admin Mod
    Posts: 5,364

    .@Codeslinger thanks for your bug report.

    Cursor movement and selection keys do not include the last character of a tab. (Not counting the annoyances of the last line, e.g. if I add "function f(t)" in the last line then the helpful autocomplete buttons keep me from tapping to the right of the parenthesis.)

    Can you explain this one a little more? When you say "last character of a tab" do you mean the last space in the four spaces inserted by the tab key?

    Good point about the autocomplete overlap. I'll look at making it auto-scroll the editor up when autocomplete pops up.

    When browsing the help docs and hiding the keyboard (when search was active) the list frame scrolls a bit and the topmost entry is offscreen. You have to carefully scroll up to not enter search mode again.

    So the steps to recreating this are:

    1. Show docs
    2. Go into search
    3. Hide keyboard

    Is that right? I'll give it a try

    Only global storage works for me. saveLocalData() and saveProjectData() seem to have no effect. Or is it the companion read and list functions?

    Sorry, I need to re-implement these. The Codea runtime (and other components) went through a fairly significant rewrite with this release. Some features haven't made it back in yet.

    Cannot get saveProjectTab() to work. Read and list works. Is it true that I can only create new tabs in existing projects? saveProjectTab() works to the extend that it complains if I name a non-existing project.

    I'll look into this one.

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    Hello @bortels. I tried:
    http://jmv38.comze.com/bortels/bortels.cgi?data=JMV38_first_try.
    This returns the listing of bortels.cgi. I also tried:
    http://jmv38.comze.com/bortels/bortels.cgi .
    Its he same. After running those i tried just the data again: result is directory listing, as before.
    Maybe i have not correctly activated cgi scripts? On the web they often say there are many many problems to solve before it work (this i why i don't like web programming and much much prefer Codea)

  • Jmv38Jmv38 Mod
    edited December 2012 Posts: 3,295

    @simeon. Thanks for being back among us (ok, let's say you can have 3 days off for christmas, ;-) ). With my new game (see christmas gist) Codea crashes when i play for a long time and switch levels. I have added collectgarbage() at some key location, but i don't know if it really helps. I hope it is an instability of 1.5(8), which seems to have some, and that it will be solved later. Or is it my code? I have the feeling my code is 'clean' (no memory leak), but who knows? Is there a LUA function that i could use to check memory increase?

  • Posts: 2,161

    .@Simeon I'm trying to minimise how many images I'm holding at any one time. The difficulty is that some of them need to be saved before they are discarded and saving several full-scale images is expensive. Plus it is possible that I want to reuse one straight away, so I have a cache that holds the images and gradually saves them back to disc. The difficulty is if I work too fast and fill up the cache before I can safely empty it.

    Is there a function that returns the amount of memory in the GPU? I read about gcinfo() (.@Jmv38 take note of that) but it doesn't seem to be affected by stuff loaded into the graphical memory. If I could read that, I could fine tune my program a bit more systematically than just counting crashes.

  • Posts: 503

    Mentioned in the previous thread that i had some problems with physics joints, but it was my own mistake so ignore that bug report. My joints were garbage collected, since I'd forgot to have any references to them.

  • BortelsBortels Mod
    Posts: 1,557

    If a cgi call returns the cgi content, it means the server is not interpreting the script as a cgi script (and calling it). For a ".cgi" file (as opposed to a script-alias directory like cgi-bin), things to look at (assuming apache):

    1) "Options ExecCGI" needs to be on for the context you're serving from - it looks like this on my box at home:

            <Directory /var/www/>                                                                                            
                    Options ExecCGI Indexes FollowSymLinks MultiViews                                                        
                    AllowOverride All                                                                                        
                    Order allow,deny                                                                                         
                    allow from all                                                                                           
            </Directory>                  
    

    2) You need to be sure you have a mime-type handler that recognizes .cgi - I have the following in my mime.conf:

    AddHandler cgi-script .cgi
    

    Where are you hosting, and/or what platform? There are many, many places this can get messed up, but any good hosting service should have docs on how to enable cgi scripts.

    But yes - unlike a nice prepackaged environment like Codea, this is sometimes a bit of a chore to make work.

Sign In or Register to comment.