Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Corona Code Exchange
Started by jTouch Jan 22 2014 04:48 AM

25 replies to this topic
[TOPIC CONTROLS]
Page 1 of 2 1 2
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jTouch

[GLOBAL: userInfoPane.html]
jTouch
  • Pro
  • Pip
  • 3 posts
  • Newbie

No idea if this is the right place for a suggestion. I wish there would be a RSS feed for the new Corona Code Exchange.

 

Or even better one for updated entries and one for completely new entries in Code Exchange and one combined RSS feed?!

 

How would this be? 

 

Greetings J



[TOPIC: post.html]
#2

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Pro
  • PipPipPipPipPipPip
  • 1,921 posts
  • Jedi


[TOPIC: post.html]
#3

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 8,556 posts
  • Jedi

That's a good idea.  I'lll suggest it, but it will  have more impact if there is a feature request for it at http://feedback.coronalabs.com with all your +1's

 

Rob



[TOPIC: post.html]
#4

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Pro
  • PipPipPipPipPipPip
  • 794 posts
  • Jedi

Auto posted to the forum would be nice too.

[TOPIC: post.html]
#5

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Pro
  • PipPipPipPipPipPip
  • 1,921 posts
  • Jedi

yes the code exchange has needed some attention for a while. there's a lot of good stuff in there. perhaps a better link location to it also making it easier to find for new users. and since the API has changed a lot recently maybe split it into pre gpx2.0 and gpx2.0 compatible

[TOPIC: post.html]
#6

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 8,556 posts
  • Jedi

For Graphics 1 vs. Graphics 2, I would suggest using tags to identify them.



[TOPIC: post.html]
#7

dmccuskey

[GLOBAL: userInfoPane.html]
dmccuskey
  • Pro
  • PipPipPipPipPipPip
  • 127 posts
  • Jedi

there are RSS feeds available for the code exchange, though i'm not sure exactly what types of info it will contain (e.g., new items, updates, etc).

main level is at: http://code.coronalabs.com/code
look for orange wifi-looking circled icon near top.

also, if i visit *any* URL for a tag or group, my RSS reader will show me choices to subscribe to that feed – note that the actual RSS URL is embedded in the HEAD of the HTML page, not available as an icon on the page itself.


+1 for separate feeds for New and Updated contributions.

[TOPIC: post.html]
#8

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 910 posts
  • Jedi

What happened to all the codes in code exchange? For instance I could found all the great modules from Glitch Games. I kind of miss the old code exchange! The only bad was it was not possible to find stuff. With the new exchange we can now search but most of the old are gone? Am I missing something? Thanks. Mo

[TOPIC: post.html]
#9

DavidRangel

[GLOBAL: userInfoPane.html]
DavidRangel
  • Corona Staff
  • 728 posts
  • Jedi

Guys, just FYI, the Code Exchange has an RSS feed now:

http://code.coronalabs.com/code/feed

 

Also, the old code exchange is still there (but you cannot add new submissions to it):

http://developer.coronalabs.com/code



[TOPIC: post.html]
#10

jstrahan

[GLOBAL: userInfoPane.html]
jstrahan
  • Pro
  • PipPipPipPipPipPip
  • 1,921 posts
  • Jedi


[TOPIC: post.html]
#11

LairdGames

[GLOBAL: userInfoPane.html]
LairdGames
  • Pro
  • PipPipPipPipPipPip
  • 910 posts
  • Jedi

Thanks guys! I feel much better :) 

 

Mo



[TOPIC: post.html]
#12

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Pro
  • PipPipPipPipPipPip
  • 142 posts
  • Jedi

Hi guys,

 

I've got the RSS reader and it's working well except for some when I hit some unusual characters. I assume it's an encoding thing, but I really have no knowledge in that area. It's reading the characters up from the RSS and putting them in a table, but when I try to output them to the device I just get nothing on screen. If I copy & paste those same characters into my code and output it's fine, but I'm assuming the cut & paste is somehow resolving things that the xml.rss code isn't handling.

 

This is the source of the feed http://www.f1wm.pl/rss_f1.php would appreciate any help...

 

Thanks,

Nathan.



[TOPIC: post.html]
#13

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 8,556 posts
  • Jedi

Just a quick look, there are a bunch of UTF-8 characters which have to be encoded correctly for XML.  If you look in the xml.lua file you will see a big if statement where some characters are converted to their ASCII equivs.  This is at best a Hack way of handling it.  If you're not in control of the feed and can't get the fields wrapped in C-DATA tags, then you will have to make the XML processor handle the UTF-8 characters in a safe way.

 

Rob



[TOPIC: post.html]
#14

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Pro
  • PipPipPipPipPipPip
  • 142 posts
  • Jedi

OK thanks Rob.



[TOPIC: post.html]
#15

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Pro
  • PipPipPipPipPipPip
  • 142 posts
  • Jedi

I'm new to the whole character set issue, so I'm wondering how one would go about fixing this problem? A big lookup table? The fact that I can cut & paste the same characters into my code and display them has me baffled - is this doing some sort of auto-conversion?

 

Nathan. 



[TOPIC: post.html]
#16

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 8,556 posts
  • Jedi

I would do some research on how RSS is supposed to handle UTF8 characters.  It should only be a problem if the feed isn't wrapping text in CDATA tags which protect about it.  Unfortunately you can't always control the RSS feed and make sure it's valid.



[TOPIC: post.html]
#17

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Pro
  • PipPipPipPipPipPip
  • 142 posts
  • Jedi

I don't understand how CDATA would help - it just makes the reader ignore the content right?



[TOPIC: post.html]
#18

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 8,556 posts
  • Jedi

What CDATA tags do is hide non XML data from an XML parser.  It's still in the feed.  Now if an RSS reader ignores it, that's on them.  It's still valid data for that field and they should be able to take it and show it.   Maybe this article will help:

 

http://themetaq.com/articles/feeding-frenzy-part-iii

 

Rob



[TOPIC: post.html]
#19

Satheesh

[GLOBAL: userInfoPane.html]
Satheesh
  • Starter
  • PipPipPipPipPipPip
  • 670 posts
  • Jedi

How about porting old codes into the new codebase?



[TOPIC: post.html]
#20

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Corona Staff
  • 8,556 posts
  • Jedi

Hi Satheesh.   We ported a few of the popular, graphics 2.0 compatible projects to get things started.  The things had to be in github already, etc.  We encourage the authors to port over any thing they wish and we are keeping the old code exchange up, so you can still get to the old files.

 

This is a way for us to spring-clean so-to-speak. 



[TOPIC: post.html]
#21

Satheesh

[GLOBAL: userInfoPane.html]
Satheesh
  • Starter
  • PipPipPipPipPipPip
  • 670 posts
  • Jedi

Oh ok. Makes sense. 



[TOPIC: post.html]
#22

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Pro
  • PipPipPipPipPipPip
  • 142 posts
  • Jedi

I'm still working on this issue and experimenting with the CDATA tag, but as I dig deeper I'm not convinced it's a parser issue - I think it's more about how I'm handling the data after I've consumed the rss feed.

 

It appears to be more about how Corona handles special characters in strings. For example I have  myString = "dönüyor" - when I ask Corona how long the string is #myString = 9 - no doubt because of the two special characters. That's fine and I can output the string just fine. The problem arises when I want to shorten the string for display purposes if I get a substring that ends in the "middle" of one of the special characters all I get back is an empty string...

 

e.g. myString:sub(1,8) when output to screen is "dönüyo" which is fine, but myString:sub(1,2) outputs to "" when I'm expecting "dö", but that's only achievable with myString:sub(1,3). Is there any way to test a character to see if it's "special" so I can extend my string length in this special case?

 

Thanks,

Nathan.



[TOPIC: post.html]
#23

jonjonsson

[GLOBAL: userInfoPane.html]
jonjonsson
  • Pro
  • PipPipPipPipPipPip
  • 794 posts
  • Jedi


[TOPIC: post.html]
#24

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Pro
  • PipPipPipPipPipPip
  • 142 posts
  • Jedi

Awesome - thanks. Couldn't get the whole thing to work for me, but used parts to be able to analyse my strings for special characters.

 

Not working for my Polish feed that I referenced earlier, but it is working for other languages - will get to the Polish soon!



[TOPIC: post.html]
#25

beernathan

[GLOBAL: userInfoPane.html]
beernathan
  • Pro
  • PipPipPipPipPipPip
  • 142 posts
  • Jedi

Using the double byte code I've managed to detect special characters in Turkish & Japanese, but I'm still struggling with my Polish feed - I can't get the contents of the feed to be displayed. I'm starting to wonder if this is a Corona issue.

 

Here's an example of a title in the RSS feed: "Zespoły zaakceptowały propozycje zmian w formacie kwalifikacji?" (one of the examples from this feed http://www.f1wm.pl/rss_f1.php)

 

When the RSS code reads it in and I output it to the console (in Glider) I get "Zespo�y zaakceptowa�y propozycje zmian w formacie kwalifikacji" (note the weird diamond characters)

 

I tried wrapping the content in CDATA as per Rob's suggestion

<![CDATA[Zespoły zaakceptowały propozycje zmian w formacie kwalifikacji?]]>

Console still shows exactly the same output : "Zespo�y zaakceptowa�y propozycje zmian w formacie kwalifikacji"

 

This makes me think that the CDATA tags aren't making a difference - in both cases the XML parser is successfully delivering the content. The issue is that when I try to set the contents of a text object to this string I get nothing on screen.

 

The characters that are delivered by the parser aren't "double byte" either. I tried pumping out the string through native.showAlert and I got the following error - the plot thickens:

 

Corona Simulator Generic error

NSInternalInconsistencyException: Invalid parameter not satisfying: aString != nil
(
    0   CoreFoundation                      0x00007fff96c64b06 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff94c9b3f0 objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff96c64948 +[NSException raise:format:arguments:] + 104
    3   Foundation                          0x00007fff951eb4c2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
    4   AppKit                              0x00007fff957ac125 -[NSCell _objectValue:forString:errorDescription:] + 159
    5   AppKit                              0x00007fff957ac07f -[NSCell _objectValue:forString:] + 20
    6   AppKit                              0x00007fff957abffb -[NSCell setStringValue:] + 39
    7   AppKit                              0x00007fff9584032c -[NSControl setStringValue:] + 138
    8   AppKit                              0x00007fff95a0ab71 -[NSAlert setInformativeText:] + 33
    9   Corona SimuNSInternalInconsistencyException
 
Any ideas about what is actually going on here?
 
Thanks,
Nathan.



[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]