Sharing Permalinks?

48 views
Skip to first unread message

Jorge Garcia

unread,
Nov 20, 2019, 8:48:22 AM11/20/19
to sage-cell
Dear Sirs:

I have shared code with my students from http://sagecell.sagemath.org for years without any issue using permalinks (for example, see sidebars on my blog http://shadowfaxrant.blogspot.com). 
Suddenly, last week, permalink is no longer an option. When I click share and go to click permalink, I cannot. 
There used to be a link called permalink to click. the word permalink is still there, but it's not a link anymore. 
Did something change on your side? I'm having IT check our setup on our side, but they claim there have been no changes.

Sincerely,
A. Jorge Garcia
Applied Math, Computer Science and Physics
Baldwin High School and Nassau Community College

Andrey Novoseltsev

unread,
Nov 20, 2019, 12:49:40 PM11/20/19
to sage-cell
I have just checked and it worked fine for me. Has it stopped working for you completely? On all devices and with any code?

Does anyone else experience problems?

Thank you!
Andrey

Jorge Garcia

unread,
Nov 20, 2019, 2:13:41 PM11/20/19
to sage-cell
It stopped on every computer in my school. I'll try at home.

Thanx,
AJG

kcrisman

unread,
Nov 20, 2019, 9:02:27 PM11/20/19
to sage-cell


On Wednesday, November 20, 2019 at 12:49:40 PM UTC-5, Andrey Novoseltsev wrote:
I have just checked and it worked fine for me. Has it stopped working for you completely? On all devices and with any code?

Does anyone else experience problems?


Just as a data point, I have found them to still be quite robust :) 

Jorge Garcia

unread,
Nov 20, 2019, 10:38:25 PM11/20/19
to sage-cell
I just tried making a permalink from the following code snippets at home, but no joy either! Is there something about this code that cannot be converted to a permalink? Take a look:

#CSH304 More About Pythonic Functions! MrG
show('#1) concatenate 2 strings')
def concat(s1,s2):
    return s1+' '+s2
show('concat("al","garcia")=',concat("al","garcia"))
show('')
show('#2) draw a house!')
def printHouse():
    print(" /\\\n/__\\\n|  |\n|__|")
    #print(" /\\")
    #print("/__\\")
    #print("|  |")
    #print("|__|")
printHouse()
show('')
show('#3) pad your strings!')
def rightJustify(s,w):
    'pad s with correct number of spaces in front'
    return ' '*(w-len(s))+s
show('#3) rightJustify("bob",7)=',rightJustify("bob",7))
show('')
show("#4a) what's wrong with this output?")
def print10Stars():
    print 10*'*'
show('#4a) print10Stars()=',print10Stars())
show('')
show('#4b) how to get rid of None?')
def make10Stars():
    return 10*'*'
show('#4b make10Stars()=',make10Stars())
show('')
show('#5) predict the output')
def printTriangle(n,ch):
    while n>0:
        show(n*ch)
        n-=1
    return 1
show("#5) printTriangle(2,'*')=",printTriangle(2,'*'))
show("#5) printTriangle(3,'#')=",printTriangle(3,'#'))
show("printTriangle(2,'*')+printTriangle(3,'#')=",printTriangle(2,'*')+printTriangle(3,'#'))
show('')
show('#6) predict the output')
def sum1ToN(n):
    if n>0:
        return n*(n+1)//2
show('sum1ToN(6)=',sum1ToN(6))
show('sum1ToN(0)=',sum1ToN(0))
show('sum1ToN(-3)=',sum1ToN(-3))
show('')
show('#8) what is the output?')
#show('#8) len(0)=',len(0))
show("#8) len('0')=",len('0'))
show("#8) len('''0''')=",len('''0'''))
show("#8) len('''''')=",len(''''''))
show('#8) len([0])=',len([0]))
show('#8) len([])=',len([]))
#show('#8) len((0))=',len((0)))
show('#8) len(range(0)=',len(range(0)))

Jorge Garcia

unread,
Nov 20, 2019, 10:39:50 PM11/20/19
to sage-cell
However, I was able to make a permalink for this just now at home:

#CSH305 All About Arguments MrG
show('#1) what does // do?')
def findDiv(x,y):
    return x//y
show('#1) findDiv(3,2)=',findDiv(3,2))
show('#1) findDiv(-7,3)=',findDiv(-7,3))
show('')
def findMod(x,y):
    return x%y
show('#1) findMod(3,2)=',findMod(3,2))
show('#1) findMod(-7,3)=',findMod(-7,3))
show('')
show('#2) what does / do?')
def findDiv(x,y):
    return x/y
show('#2) findDiv(3,2)=',findDiv(3,2))
show('#2) findDiv(-7,3)=',findDiv(-7,3))
show('')
show('#3) find the arithmetic mean')
def findMean(a,b):
    return (a+b)/2
show('#3) findMean(5,10)=',findMean(5,10))
show('#3) findMean(5,10)=',findMean(5,10).n())
show('#3) findMean(5,10)=',n(findMean(5,10)))
show('')
show('#4) what does this code do?')
a=1
b=2
def swap(x,y):
    temp=x; x=y; y=temp
    return [x,y]
show('swap(a,b)=',swap(a,b))
show('a=',a)
show('b=',b)

Jorge Garcia

unread,
Nov 20, 2019, 10:41:45 PM11/20/19
to sage-cell
Please see the sagecell links for Computer Science Honors near the top right sidebar of my blog,

I got those to work, but can't make new ones?

TIA,
AJG


Andrey Novoseltsev

unread,
Nov 20, 2019, 11:33:17 PM11/20/19
to sage-cell
Thank you for providing an example on non-working code, I confirm that it is not working for me as well. The problem seems to be with JSON parsing inside the browser, no request is sent to the permalink server. I will try to figure out what is going on tomorrow or this weekend.

Best,
Andrey

Jorge Garcia

unread,
Nov 21, 2019, 5:37:09 AM11/21/19
to Andrey Novoseltsev, sage-cell
Thank you. I'm surprised that this code should cause any issues. I've made many permalinks in the past with much more involved code without any problem. 

Thanks for your help and for maintaining sage cell. My students and I have benefited greatly over the years due to your masterful work!

Regards,
AJG

--
You received this message because you are subscribed to the Google Groups "sage-cell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-cell+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cell/4419462f-b138-4c0e-8c09-25563dee4477%40googlegroups.com.

Jorge Garcia

unread,
Nov 22, 2019, 8:58:04 AM11/22/19
to sage-cell
OK, I fixed it. Apparently I was overriding a reserved word in question #1 when I wrote a function called concat(). All I had to do to fix the permalink issue was to rename that function concatIt()! 
Sorry for the NOOB issue, I should have known that was a reserved word. I guess that's what I get for teaching an intro programming course in python.
What confused me was that the code executed fine, so I thought permalink would work automagically.
Here's the new code:

#CSH304 More About Pythonic Functions! MrG
show('#1) concatenate 2 strings')
def concatIt(s1,s2):
    return s1+' '+s2
show('concatIt("al","garcia")=',concatIt("al","garcia"))
show('')

show('#2) draw a house!')
def printHouse():
    print(" /\\\n/__\\\n|  |\n|__|")
    #print(" /\\")
    #print("/__\\")
    #print("|  |")
    #print("|__|")
printHouse()
show('')

show('#3) pad your strings!')
def rightJustify(s,w):
    'pad s with correct number of spaces in front'
    return ' '*(w-len(s))+s
show(rightJustify("bob",7))
show(rightJustify("bobbie",7))
show(rightJustify("Baldwin",7))
show(rightJustify("High",7))
show('')

show("#4a) what's wrong with this output?")
def print10Stars():
    print 10*'*'
show('print10Stars()=',print10Stars())
show('')
show('#4b) how to get rid of None?')
def make10Stars():
    return 10*'*'
show('make10Stars()=',make10Stars())
show('')

show('#5) predict the output')
def printTriangle(n,ch):
    while n>0:
        show(n*ch)
        n-=1
        return 1
show("printTriangle(2,'*')=",printTriangle(2,'*'))
show("printTriangle(3,'#')=",printTriangle(3,'#'))
show("printTriangle(2,'*')+printTriangle(3,'#')=",printTriangle(2,'*')+printTriangle(3,'#'))
show('')

show('#6) predict the output')
def sum1ToN(n):
    if n>0:
        return n*(n+1)//2
show('sum1ToN(6)=',sum1ToN(6))
show('sum1ToN(0)=',sum1ToN(0))
show('sum1ToN(-3)=',sum1ToN(-3))
show('')

show('#8) what is the output?')
#show('len(0)=',len(0))
show("len('0')=",len('0'))
show("len('''0''')=",len('''0'''))
show("len('''''')=",len(''''''))
show('len([0])=',len([0]))
show('len([])=',len([]))
#show('len((0))=',len((0)))
show('len(range(0)=',len(range(0)))

Thanx,
AJG

Andrey Novoseltsev

unread,
Nov 24, 2019, 11:36:12 PM11/24/19
to sage-cell
Dear Jorge,

You are wrong about you being wrong!

Thank you so much for tracing the issue to concat usage. From a permalink point of view your code is just a string - there are no keywords whatsoever. For some reason, however, a string with contact function call inside of it is blocked by Cloudflare. I've sent a request to adjust this, hopefully it will be resolved soon but I imagine it cannot be "resolved completely" as in some other code in the future may trigger blocking.

Andrey

Jorge Garcia

unread,
Nov 24, 2019, 11:38:55 PM11/24/19
to Andrey Novoseltsev, sage-cell
Hi Andrey,
Thanx for the clarification! Still, it's an odd error.
Regards,
Al


--
Regards,
A. Jorge García
Baldwin HS & Nassau CC
http://shadowfaxrant.blogspot.com
http://www.youtube.com/calcpage2009
Computing Independent Study Facilitator
Continental Mathematics League Advisor
PAEMST NYS Mathematics Secondary Nominee
Baldwin High Chess Club & Chess Team Founder
National Computer Science Honor Society Advisor
Teacher & Professor Applied Math, Physics & CompSci

kcrisman

unread,
Nov 25, 2019, 9:22:08 PM11/25/19
to sage-cell


On Friday, November 22, 2019 at 8:58:04 AM UTC-5, Jorge Garcia wrote:
OK, I fixed it. Apparently I was overriding a reserved word in question #1 when I wrote a function called concat(). All I had to do to fix the permalink issue was to rename that function concatIt()! 
Sorry for the NOOB issue, I should have known that was a reserved word.

Wow, that is actually pretty obscure.  Well done. 

Jorge Garcia

unread,
Nov 25, 2019, 9:40:51 PM11/25/19
to kcrisman, sage-cell
Thank you. Taking bow.

Regards,
Al

--
You received this message because you are subscribed to the Google Groups "sage-cell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-cell+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages