As an example, try going to this link:
(yeah, I know it's kind of long. I didn't want the permalink to depend
on the server, so all of the code is zipped and base64 encoded into the
URL).
Thanks,
Jason
hi, that's fantastic! have you thought about adding an optional url
shortener? your long url could look just like http://goo.gl/J4NcC for
example :-)
i think it's not allowed to let this replacement happen automatically,
but there is an api to make this rather painless
http://code.google.com/apis/urlshortener/
h
That's very cool! Huge possibilities there; you could include URLs in
emails, papers and random web pages. Very interesting.
> As an example, try going to this link:
>
> http://aleph.sagemath.org/?z=eJx1kEFuwyAQRfc-BYoSmXHGlmM7m0oj9R5VFVGbxKjEIEBtnNOXmjTNomUDM7z_NPAhHM_DKIPIIXtWU5BO9CEb5JEduaNd2RS98XwhAAN5rQbpeF3tsCmsqiYOAE8Zi8uSNVq4g9UmcIcshZDVyEKMjqp_n6T31ML2T7BejIBC21FQXe0habek1ST5C6-xhkh3aSLArvBqigd4_Ycs72j5y-I348OsJeVlmd-j1sTXc-7SNBTgJ8seWjdJ7J3eeqONo9zJIccl7NVVUrPHq3Hxj6hL6jGcNV-tHW38erV58EO696P55BYvZzVR2cZdXKjF-VbOqRTeyj4cnAjK0A6-AMdVgy8=
>
> (yeah, I know it's kind of long. I didn't want the permalink to
> depend on the server, so all of the code is zipped and base64
> encoded into the URL).
It looks like you ran something through HugeURL:
http://hugeurl.geeks.org/
Also, that's a nice @interact. I'll just bookmark that and save it for
later...
Dan
--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------
The itch I was scratching was that a colleague of mine was using links
to Wolfram Alpha in a multivariable calculus textbook that I am using
and revising, and I really wanted to put in corresponding links to Sage
interacts and Sage computations. Now I can.
Jason
The "shortened" permalink implementation doesn't work for me in Chrome, in that
if I do something and put my cursor over "(shortened)" the link in the
hint at the bottom
of the screen shoes the shortened URL, but when I click, that vanishes
and the link
at the top (in the address bar) is *not* shortened, and moreover the
shortened link
is displayed nowhere else on the page.
-- William
It did occur to me that it should be pretty easy to do something in
SageTeX so that you could make links. Hopefully something like this
would work:
\setsinglecellbaseurl{aleph.sagemath.org}
"You can view this computation at
\href{\makesinglecelllink{code here...}}{this link}."
(Not sure about } inside the code, but I'm just brainstorming here.) Or,
you could give labels to environments to somehow reuse the code:
\begin[cool-code]{sageblock}
some cool code
\end{sageblock}
and then later, use some macro with that label to automatically pull in
that code so you don't have to retype it, and can guarantee that what is
in the text corresponds to what is in the URL.
That's working as expected. You click on a tinyURL link, and it goes to
tinyURL, then forwards you on to the original, non-shortened URL, which
is basically all of your code zipped and base64-encoded in the URL. It
loads your code and waits for you to evaluate it.
Typically you'll copy the short url link and send that along. I suppose
we should explicitly display it to make it easy to copy.
Jason
"as expected" by you. That is definitely *not* "as expected" by my.
Tons of sites (like google maps) have options to obtain a shortened
URL for a permalink, and they always make the link clearly displayed
when you click on "short url".
> You click on a tinyURL link, and it goes to
> tinyURL, then forwards you on to the original, non-shortened URL, which is
> basically all of your code zipped and base64-encoded in the URL. It loads
> your code and waits for you to evaluate it.
>
> Typically you'll copy the short url link and send that along. I suppose we
> should explicitly display it to make it easy to copy.
That's definitely not a good solution either, IMHO.
Please go to http://maps.google.com, click on the link icon, and see
how it works there. That is an example of doing permalinks right.
I'm planning to demo this permalinks thing in my (rather huge) Sage
class today since I think it is so cool.
-- William
>
> Jason
>
>
--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
That's working as expected.
According to the discussion we had yesterday at the notebook sprint,
you are in fact definitely violating the terms of usage. You cannot
automatically create shortened URL's unless the user explicitly asks
for them.
William
>
> H
Thanks for pointing this out. I'll change it as soon as I can.
Jason
I've commented out the code that makes the short url. Like William
pointed out, there are definitely design issues to work out as well as
making sure we don't violate terms of usage.
Thanks,
Jason
Interesting idea, though there is an advantage to being able to say
"this is base-64 gzipped code" so that anyone can easily make/decode
such URLs. If the code is short enough (and, say, all ascii), it'd be
nice to forgo the obfuscation of the compression altogether.
- Robert
I agree -- my thoughts about doing such things in SageTeX depend on it
being super easy to make the URL. You just make sure it's encoded in
UTF-8, zip, and base64-encode.
What, really, would be the advantage of shorter URLs -- especially since
you have a tinyurl button? I'm not skeptical, just curious.
The server doesn't care if the zipped base64 data comes in the URL or in
form fields. SageTeX presumably would submit the data in a POST
request, which avoids problems with URLs that are too long.
The 'c' argument specifies raw code. If that field is empty, then it
looks in the 'z' argument for zipped base64 code.
Jason
Right now, if the url-escaped code is less than 50 characters, the raw
code is returned rather than the zipped/base64 version. Maybe that
threshold should be higher.
Jason
I love it when feature requests are already implemented :). Yeah, I
might bump it up to 100 characters or more.
- Robert
> I love it when feature requests are already implemented :). Yeah, I
> might bump it up to 100 characters or more.
It's now 100 characters.
Jason
Now I'm curious what the basis of your conclusion is. For example,
TinyURL's terms of use on their front page (http://tinyurl.com/#terms) is:
--
Terms of use:
TinyURL was created as a free service to make posting long URLs easier,
and may only be used for actual URLs. Using it for spamming or illegal
purposes is forbidden and any such use will result in the TinyURL being
disabled and you may be reported to all ISPs involved and to the proper
governmental agencies. This service is provided without warranty of any
kind.
--
I don't see anything in there about not automatically generating tiny
urls. I agree that it may not be very nice, of course. Was that the
basis for the conclusion?
Jason
I just heard several people in the room say it. I don't know what
they based their conclusion on.
-- William