Talk:Base64 encode data: Difference between revisions

Promotions? Not yet…
(→‎task requirements: comment on the tast requirements, showing the output. -- ~~~~)
(Promotions? Not yet…)
 
(14 intermediate revisions by 5 users not shown)
Line 1:
==Changes prior to promoting to full task==
We should use some different, shorter test data. Right now, there are two problems:
# the output is really too long to include on the page, and
# there's no guarantee that the icon will stay the same.
Using a short piece of sample text would make it much more practical to include the output with the solution, so allowing everyone to trivially check their implementation. Once that's sorted out, there's no reason we shouldn't promote to a full task as there are plenty of implementations. –[[User:Dkf|Donal Fellows]] ([[User talk:Dkf|talk]]) 15:58, 11 May 2014 (UTC)
 
==task requirements==
 
Line 10 ⟶ 16:
:But these would require a change on the task requirements, I guess I didn't thought that well, before.. creating this draft. [[User:Rainb|Rainb]] ([[User talk:Rainb|talk]]) 04:37, 28 August 2013 (UTC)
 
:: That's why the task is first made a draft. --- to iron out the requirements and make the task clearer.   Currently, the requirement is to use/convert the   ''favicon.ico''   (file),   but not to show the result.   How is anyone to know the currect result ''is'' if nobody comparecompares/verifies outputsthe OUTPUTs? &nbsp:; I would like to see if the programming examples can correctly handle the various padding variations   ('''=''' and '''==''' and no equal signs).   Unfortunately, the file to be used doesn't have any   '''='''   padding in the output.   So far, nobody has shown the 4,850 bytes of output ... until now. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 05:12, 28 August 2013 (UTC)
'''output''' from the REXX example using an eighty-byte wide screen:
<pre>
Line 77 ⟶ 83:
</pre>
<br> -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 05:12, 28 August 2013 (UTC)
 
-----
 
:::You're completely right, I thought this image was small enough, apparently it wasn't small enough, so.. how do you upload images to this wiki? [[User:Rainb|Rainb]] ([[User talk:Rainb|talk]]) 12:18, 28 August 2013 (UTC)
 
:::: I had the exact same problem a few years back. &nbsp; One had to use the &nbsp; '''Upload file''' &nbsp; link at the bottom of the (left) sidebar, but I can't find it now. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 21:30, 28 August 2013 (UTC)
 
:::::Image uploads are disabled. Security problems (and spammers). Not sure when we will be able to bring them back. --[[User:Mwn3d|Mwn3d]] ([[User talk:Mwn3d|talk]]) 13:54, 29 August 2013 (UTC)
 
:::Also I just remembered that some languages may have issues with requesting binary HTTP, perhaps we should omit the image from the task..? [[User:Rainb|Rainb]] ([[User talk:Rainb|talk]]) 12:27, 28 August 2013 (UTC)
 
:::: Yes, I think omit using (web) images as input to Rosetta Code programs should be dropped. &nbsp; For me, it's a bit of bother as my language-of-choice doesn't grab files from the web, so I have to download them first. -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 21:08, 28 August 2013 (UTC)
 
::::: Don't make downloading the file a requirement of the task itself; it's just a source of binary data, not an HTTP client task (we've got another task for that). But it is reasonable to have a defined input to work with so that outputs can be compared. (Note that whitespace differences in the output are going to have to be allowable; the base64 spec ''specifically'' allows them.) –[[User:Dkf|Donal Fellows]] ([[User talk:Dkf|talk]]) 10:31, 29 August 2013 (UTC)
 
:: There's not much logical difference between a string and an image at this level; you're really encoding a byte sequence (and logically you have to start by encoding both the string and the image as bytes before you can apply the encoding at all, even if that's typically trivial for ASCII strings). I'll rename the task though, probably to “Base64 encoding” so as to better reflect what the task actually asks for. I encourage writing a matching decoding task; we can put in cross links between the two too. –[[User:Dkf|Donal Fellows]] ([[User talk:Dkf|talk]]) 10:36, 29 August 2013 (UTC)
 
::: But the thing is that the current task requires downloading of a file from the Web, which is conceptually separate from base-64. And downloading from the Web may be a very complicated task or it may not be supported by standard libraries in some languages, so I don't think it should be included. --[[User:Spoon!|Spoon!]] ([[User talk:Spoon!|talk]]) 20:36, 29 August 2013 (UTC)
 
The Base64 for the image file seems to have changed (at least it's different than what's above. Can anyone verify this? --[[User:Spoon!|Spoon!]] ([[User talk:Spoon!|talk]]) 00:13, 9 September 2013 (UTC)
 
== Trouble downloading icon programmatically ==
 
In the Python on my computer, if I do
<pre>urllib2.urlopen('http://rosettacode.org/favicon.ico')</pre>
, it gives a 403 error. And if I do
<pre>print urllib.urlopen('http://rosettacode.org/favicon.ico').read()</pre>
, I get HTML that, among other things, says
<pre>
The owner of this website (rosettacode.org) has banned your access based on your browser's signature (a6d6708c9990293-ua48).
</pre>
--[[User:Spoon!|Spoon!]] ([[User talk:Spoon!|talk]]) 23:47, 31 August 2013 (UTC)
:I don't know much python but this gets the file
<lang Python>import socket
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect((socket.gethostbyname("rosettacode.org"),80))
s.send(bytes("GET /favicon.ico HTTP/1.1\r\nHost:rosettacode.org\r\n\r\n","ASCII"))
data = s.recv(1024)
s.close()
print(data)</lang> [[User:Rainb|Rainb]] ([[User talk:Rainb|talk]]) 02:19, 1 September 2013 (UTC)
Anonymous user