Timeline for Build a Faulty XKCD Browser
Current License: CC BY-SA 3.0
21 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 1, 2017 at 18:07 | comment | added | Olivier Grégoire | By the way, there is no official Java Json library (there's a Java EE spec, and Jackson is its reference implementation). The library I mentioned is the library done by the guys who made the Json spec (so it's "official" by Json.org, not by Java). You're free to use whatever library you want. I personally use Gson as well, but the byte-count is unreasonable for golfing. | |
Jun 30, 2017 at 20:34 | comment | added | Linnea Gräf | But still you've done very well... I should also get my brain working (or go to bed, I've slept too few yesterday) | |
Jun 30, 2017 at 20:33 | history | edited | Linnea Gräf | CC BY-SA 3.0 |
added 322 characters in body; deleted 1 character in body
|
Jun 30, 2017 at 20:30 | comment | added | Olivier Grégoire | It's your call: I won't post it as mine. My goal on this website is to make my brain work, not to gain rep. | |
Jun 30, 2017 at 20:29 | comment | added | Linnea Gräf | I think that is your own solution and not mine anymore. if you still want me to include it I'll do that :) | |
Jun 30, 2017 at 20:27 | comment | added | Olivier Grégoire |
Then be creative! i->i==859?new Long(""):new org.json.JSONObject(new org.json.JSONTokener(new java.net.URL("http://xkcd.com/"+i+"/info.0.json").openStream())).get("alt") for 150 bytes.
|
|
Jun 30, 2017 at 19:58 | history | edited | Linnea Gräf | CC BY-SA 3.0 |
deleted 327 characters in body
|
Jun 30, 2017 at 19:45 | comment | added | Linnea Gräf |
"However, the program must throw an error when given the numbers 859 or 404 ." ~Second paragraph of ##Challenge
|
|
Jun 30, 2017 at 19:41 | comment | added | Olivier Grégoire | It is not required to fail on 859! It says that we may not throw errors on numbers other than 404 and 859! Meaning, we may but aren't forced to throw errors on those numbers. | |
Jun 30, 2017 at 19:14 | comment | added | Linnea Gräf |
I think that one doesn't fail on #859 .. But wait! There is a java json default library? I always used gson ...
|
|
Jun 30, 2017 at 19:11 | comment | added | Olivier Grégoire |
If you use the basic, official JSON library (need to change the title to "Java + JSON.org"), you can get it down to 131 bytes: i->new org.json.JSONObject(new org.json.JSONTokener(new java.net.URL("http://xkcd.com/"+i+"/info.0.json").openStream())).get("alt")
|
|
Jun 30, 2017 at 18:58 | history | edited | Linnea Gräf | CC BY-SA 3.0 |
added 34 characters in body
|
Jun 30, 2017 at 18:54 | comment | added | Linnea Gräf |
I just noticed you can create your own Function class that allows you to throw Exception.. Today's not my day.
|
|
Jun 30, 2017 at 18:52 | comment | added | Linnea Gräf |
Oh! I thought Scanner#useDelimiter returns void... Better read the docs next time ;)
|
|
Jun 30, 2017 at 18:49 | comment | added | Olivier Grégoire |
i->new java.util.Scanner(new java.net.URL("http://xkcd.com/"+i+"/info.0.json").openStream()).useDelimiter("\\a").next().replaceFirst(".*\"alt\": \"","").replaceFirst("\".*","") (176 bytes, careful to the SO's comment cutter characters) And I just barely golfed anything here.
|
|
Jun 30, 2017 at 18:44 | comment | added | Linnea Gräf | Added. Just under 2^8. At least the size of my programm fits in one byte :) | |
Jun 30, 2017 at 18:43 | history | edited | Linnea Gräf | CC BY-SA 3.0 |
added 64 characters in body
|
Jun 30, 2017 at 18:39 | comment | added | Olivier Grégoire | Your imports are missing!. Also, there's nearly zero attempt to golf this answer... | |
S Jun 30, 2017 at 16:44 | history | edited | Linnea Gräf | CC BY-SA 3.0 |
added 884 characters in body; deleted 1 character in body
|
Jun 30, 2017 at 16:37 | review | Suggested edits | |||
S Jun 30, 2017 at 16:44 | |||||
Jun 30, 2017 at 16:30 | history | answered | Linnea Gräf | CC BY-SA 3.0 |