Codea 1.5 (Beta 8)

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.

.@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…

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.

.@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.

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).

Hem! I’ve Never seen the forum so quiet… I guess everybody’s preparing Christmas…

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

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!

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. :slight_smile:

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?

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.

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.

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.

.@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…).

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

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.

Only global storage for me too. Ipad1.

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.

@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)