This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#6201 2012-11-18 11:36:47

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

You need to add a built-in URL shortener to Snap! to compress those crazy URLs.

That's a great idea.  So, you think http://bit.ly/snap-project/xxxxxx or something like that?

I tried reading about the bit.ly API, though, and it's really complicated, because you need an account with them, and our server has to jump through hoops to get your account ID to put in the shortening request.  Unless I'm misunderstanding the documentation.

Edit:  ... and then they send us your bit.ly password!  I sure hope Google's API isn't like that.

Edit 2:  Oh pooh.  You're not allowed to use bit.ly if you're under 13.  I think that means we can't rely on it.

Edit 3:  Ah, but tinyurl.com seems usable without all that hair.

Last edited by bharvey (2012-11-18 12:01:49)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6202 2012-11-18 18:41:34

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Might want to investigate Yourls. Looks reasonably simple to implement.

Offline

 

#6203 2012-11-18 19:03:29

Sidharth
Scratcher
Registered: 2007-12-14
Posts: 100+

Re: BYOB 3 - Discussion Thread

May I suggest goo.gl? Their API is located at http://googlecode.blogspot.com/2011/01/ … s-api.html

(yes, I've been lurking here for some time now)


http://www.danasoft.com/citysign.jpg

Offline

 

#6204 2012-11-18 19:05:13

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

Yourls

Alas,

yourls wrote:

Maximum length of long URLs to be shortened is 2000 characters

I don't think that's enough for a Snap! project with a lot of media.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6205 2012-11-18 22:15:41

alloplastic
New Scratcher
Registered: 2012-08-30
Posts: 12

Re: BYOB 3 - Discussion Thread

bharvey wrote:

alloplastic wrote:

deprecated blocks like "object" and "the script."

The OOP features that were added in BYOB 3.1 aren't in Snap! yet and probably won't be until 4.1, so hold off on converting OOP projects.

Okay, thanks for the clarification. It's good to have the decision of when to migrate made for me -- and to know that there will likely be a painless migration path.  :-)

I'll be ready to take the leap, and I'll second all of the requests for easy ways to store & share projects in Snap.  Also, it would be great if students could somehow create standalone executables, and/or start screens instead of the green flag, so that they could have the dream of creating "real" software.

Offline

 

#6206 2012-11-19 05:32:51

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Hardmath123 wrote:

You need to add a built-in URL shortener to Snap! to compress those crazy URLs.

That's a great idea.  So, you think http://bit.ly/snap-project/xxxxxx or something like that?

I tried reading about the bit.ly API, though, and it's really complicated, because you need an account with them, and our server has to jump through hoops to get your account ID to put in the shortening request.  Unless I'm misunderstanding the documentation.

Edit:  ... and then they send us your bit.ly password!  I sure hope Google's API isn't like that.

Edit 2:  Oh pooh.  You're not allowed to use bit.ly if you're under 13.  I think that means we can't rely on it.

Edit 3:  Ah, but tinyurl.com seems usable without all that hair.

Well ideally you would write your own code on your own server, which would make things really simple, like just appending #Username<dash>Projectname to view a project whose code (XML) is hosted on a server. You can use XHRs to get the contents.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#6207 2012-11-19 07:12:54

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

bharvey wrote:

Hardmath123 wrote:

You need to add a built-in URL shortener to Snap! to compress those crazy URLs.

That's a great idea.  So, you think http://bit.ly/snap-project/xxxxxx or something like that?

I tried reading about the bit.ly API, though, and it's really complicated, because you need an account with them, and our server has to jump through hoops to get your account ID to put in the shortening request.  Unless I'm misunderstanding the documentation.

Edit:  ... and then they send us your bit.ly password!  I sure hope Google's API isn't like that.

Edit 2:  Oh pooh.  You're not allowed to use bit.ly if you're under 13.  I think that means we can't rely on it.

Edit 3:  Ah, but tinyurl.com seems usable without all that hair.

Well ideally you would write your own code on your own server, which would make things really simple, like just appending #Username<dash>Projectname to view a project whose code (XML) is hosted on a server. You can use XHRs to get the contents.

+1, you can let the owner update the project

Offline

 

#6208 2012-11-19 17:00:35

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Hardmath123 wrote:

like just appending #Username<dash>Projectname to view a project whose code (XML) is hosted on a server.

Sure, but that isn't the problem I'm trying to solve.  Once a project is in the cloud, it has a reasonably short URL no matter what.  I want a client-side "shorten URL" option in the File menu that takes the super-long URL that's in the browser's URL bar after a (local) save and shortens it.

In fact, you know, it just occurs to me, that would give us 90% of the capability of a cloud server, with tinyurl doing the heavy lifting instead of us!  big_smile

One of you js programmers with too much time on his/her hands want to implement this and send Jens the code?

The right thing would then be to keep in localstore a collection of the user's shortened URLs for ease of later loading.

And maybe instead of cluttering the File menu, the right thing to do is have the Save option give a dialog like

Code:

Save to...
   () localstore 
   () new browser window as XML
   () tinyurl shortener
   () Snap! server    {once that's running}

project name [_______________]   {preloaded if not first save}

[ ] remember this choice ("Save as..." to change)

Checking the checkbox would set a preference cookie (for the radio button choice, not the project name).

Things in {braces} above are comments.

Tinyurl supports custom URLS, so it could be tinyurl.com/Snap!-XXX where XXX is the project name.

EDIT:  Never mind, I tried turning my tree project into a tinyurl on their web site and got "URI too long."   sad

Last edited by bharvey (2012-11-19 17:42:02)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6209 2012-11-19 18:24:45

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: BYOB 3 - Discussion Thread

I don't think URL shortening is going to be an efficient option. I can barely copy and paste projects in that form as it is. Localstorage, a Snap! server, and XML should be sufficient.

Offline

 

#6210 2012-11-19 19:03:26

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

shadow_7283 wrote:

I don't think URL shortening is going to be an efficient option. I can barely copy and paste projects in that form as it is. Localstorage, a Snap! server, and XML should be sufficient.

Sure, once the server is running.  I'm hoping for a short term solution.  And also, URL shortening is a no-login-needed option.

Almost all the URL shorteners boggle at Snap! projects, though, either because of length or because they forbid XML to avoid XSS malware.  However, urlgator.com seems to work.  Unfortunately, they redirect you by way of their own page (I'm guessing it has advertising on it, but I never see advertising  smile ).  But give this a try:

http://urlgator.com/snaptree


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6211 2012-11-19 19:05:05

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

shadow_7283 wrote:

I don't think URL shortening is going to be an efficient option. I can barely copy and paste projects in that form as it is. Localstorage, a Snap! server, and XML should be sufficient.

Sure, once the server is running.  I'm hoping for a short term solution.  And also, URL shortening is a no-login-needed option.

Almost all the URL shorteners boggle at Snap! projects, though, either because of length or because they forbid XML to avoid XSS malware.  However, urlgator.com seems to work.  Unfortunately, they redirect you by way of their own page (I'm guessing it has advertising on it, but I never see advertising  smile ).  But give this a try:

http://urlgator.com/snaptree

Yeah, ads.

Are you sure you can't just encodeURIComponent(…) the URL fragment first? Shorteners with no length limit shouldn't have a problem with that.

EDIT: Oh my…I just got stuck in an infinite Snap! do-you-want-to-leave-this-page loop that almost made me force-quit Chrome.

Last edited by nXIII (2012-11-19 19:07:22)


nXIII

Offline

 

#6212 2012-11-19 20:51:59

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

nXIII wrote:

Are you sure you can't just encodeURIComponent(…) the URL fragment first? Shorteners with no length limit shouldn't have a problem with that.

No, I'm not sure; I'm just copy-and-pasting by hand.  Feel free to do a better experiment.  (But, lots of sites turn the <brokets> into % codes when I paste, fwiw.)

EDIT: Oh my…I just got stuck in an infinite Snap! do-you-want-to-leave-this-page loop that almost made me force-quit Chrome.

Reproducible?

Last edited by bharvey (2012-11-19 20:53:58)


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6213 2012-11-19 21:03:33

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

EDIT: Oh my…I just got stuck in an infinite Snap! do-you-want-to-leave-this-page loop that almost made me force-quit Chrome.

Reproducible?

It's never happened before, so probably not. I have been having some other problems with Snap! permanently freezing the tab, though. I'll try restarting Chrome when I have fewer tabs open  tongue


nXIII

Offline

 

#6214 2012-11-20 08:44:11

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@bharvey
Your link :
http://urlgator.com/snaptree
works for me. It gives a nice tree.
I've saved it.

Offline

 

#6215 2012-11-20 08:49:50

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@bharvey
I'm currently using Chrome.
Setting level to 9 is a long process, but a nice tree.
I shall try to warp your project.

Offline

 

#6216 2012-11-20 08:56:07

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@bharvey
When I look inside the "tree" block name all "item of ..." refer to a void list.
Anything wrong ?

Offline

 

#6217 2012-11-20 09:02:57

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

@bharvey -tree project

Impossible to save the project when the tree is still drawn into the graphic window.
Possible when the window is cleared !

Offline

 

#6218 2012-11-20 19:35:26

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Another working URL shortener: shrinkr.me.  Example:

http://shnk.me/69585

... but for some reason it only works in Firefox.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6219 2012-11-20 19:42:57

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Another working URL shortener: shrinkr.me.  Example:

http://shnk.me/69585

... but for some reason it only works in Firefox.

It's because it's only partially urlencoding the URL and Snap's decoder check gets confused and tries to decode the whole thing, so Chrome &c. throw an "URI malformed" exception.

Last edited by nXIII (2012-11-20 19:43:51)


nXIII

Offline

 

#6220 2012-11-20 21:21:12

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

xly wrote:

When I look inside the "tree" block name all "item of ..." refer to a void list.
Anything wrong?

No, that's how it's supposed to be.  Those ITEM blocks you're looking at are inside a FOR EACH ITEM OF (BRANCHES) block, and BRANCHES is a list of lists.  So each sublist is plugged in everywhere there's an empty input slot in the script inside the FOR EACH.

Hmm, maybe Dan is right that the FOR EACH block should have an (ITEM) upvar instead of the text word ITEM; the resulting code might be more intuitive.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6221 2012-11-20 21:26:19

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

xly wrote:

Impossible to save the project when the tree is still drawn into the graphic window.

Works for me.  This is in Chrome?  On Windows?  And you just loaded from that urlgator URL and did a save?


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

#6222 2012-11-21 02:54:01

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

Hmm, maybe Dan is right that the FOR EACH block should have an (ITEM) upvar instead of the text word ITEM; the resulting code might be more intuitive.

Just when you finally convinced me about blank inputs as implicit parameters...  big_smile


Jens Mönig

Offline

 

#6223 2012-11-21 03:18:46

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

bharvey wrote:

xly wrote:

Impossible to save the project when the tree is still drawn into the graphic window.

Works for me.  This is in Chrome?  On Windows?  And you just loaded from that urlgator URL and did a save?

Windows +Chrome.
This "save" bug is not specific to the server use. I've the same bug with my own applications when the window graphic is "overcrowded" (probably too many pixels)

Offline

 

#6224 2012-11-21 03:21:37

xly
Scratcher
Registered: 2010-04-17
Posts: 100+

Re: BYOB 3 - Discussion Thread

(continue)
I wonder if this would not be an issue linked to Chrome bufferization  ?

Offline

 

#6225 2012-11-21 12:28:29

bharvey
Scratcher
Registered: 2008-08-10
Posts: 1000+

Re: BYOB 3 - Discussion Thread

Jens wrote:

Just when you finally convinced me about blank inputs as implicit parameters...  big_smile

Dan's argument is FOR EACH - specific.  Blank slots work much better in higher order reporters.


http://cs.berkeley.edu/~bh/sig5.png

Offline

 

Board footer