« first day (3069 days earlier)      last day (1877 days later) » 
00:00 - 17:0017:00 - 00:00

5:00 PM
@AndrasDeak You don't know kangaroo and crocodile? Or didn't recognise my abbreviation?
 
The latter :D And never had any to be fair
The dog loves roo meat
 
In Australia, beets are generally called beetroot, and are mostly known as a sliced pickled vegetable that comes out of tins. Beetroot slices are a popular addition to salads and hamburgers. I prefer the unpickled form, baked with potatoes, and served with a little sour cream. I also like raw beetroot in a juice with carrot, ginger, parsley, and a dash of lemon.
 
user521945
I'm looking for online literature related to my problem. I'm reading text files that occasionally refer to other files, similar to c-style includes. The problem is that each recursive call to the file reading function is relative to the last and I'm not sure of a reliable way to do this. I'm using the os and re packages for various parts of this project.
 
user521945
More specifically, the directory I'm operating in is relative to the last.
 
@PM2Ring I never had 'em baked...or at least if I had I wasn't aware.
 
5:04 PM
@JackStout Does it have to be recursive?
 
@toonarmycaptain The baking caramelizes the sugars, which makes them rather yummy. ;)
 
@WayneWerner my own philosophy of Done is: if you never finish anything, that's fine. Learning experiences don't have a natural terminal point because knowledge extends forever in every direction. Your program doesn't need to change the world; if it changes you, you're winning.
 
user521945
@AndrasDeak @andras The contents of the referred file are dumped directly into the referring file at the point the reference was made. I could do it with a loop and stack, I suppose.
 
and, can you perhaps keep and "reuse" something once you encounter a file again? @JackStout
 
@Kevin crippling self-doubt can also count as change...
 
5:07 PM
@PM2Ring I only really remember being served them on burgers, so probably the pickled variety? Then again, my palate has matured considerably since I last tried them. My family in the states don't do beetroot with burgers, or pineapple for that matter :(
 
user521945
@ParitoshSingh I'll be tracking previous references in order to avoid duplicates and to throw an error upon finding circular references.
 
@JackStout oh, I thought you were just traversing a directory tree
 
@AndrasDeak "What doesn't kill you makes you stronger" proven wrong by every professional athlete that ever had a career-ending injury
 
to me, it sounds like basically converting a code module with imports into a single "giant" file.
or something along those lines.
 
user521945
@AndrasDeak It has some similarity to Python's import in that it has no reason to make the same reference twice, but is not as complex.
 
5:09 PM
@toonarmycaptain Yep, that'd be your standard Golden Circle tinned beetroot, which is pickled. My mum used to make her own pickled beetroot, which has a more subtle flavour.
 
user521945
@ParitoshSingh Right.
 
@ParitoshSingh Don't be Tenjin. Just… just don't.
 
@JackStout Yep. You need some kind of stack. Either a manual one, or use recursion.
 
hahaha! hey, its not me :P
 
(Look around in there for _create_module calls…)
 
user521945
5:12 PM
My problem is that when one file says include ../other_dir/other_file.x, the next iteration of the function needs to operate within that directory, which is relative to the current one.
 
What's the end goal here, if i may ask?
 
@JackStout sorry, I suspect I wouldn't be able to help even if you'd explain what you're doing in more detail
 
@JackStout If you're doing this in Python 3, it's probably a good idea to use pathlib
4
 
user521945
I can join the current working directory to a relative file path, but that would include /../ in the path each time. Is there a quick way to shorten these sorts of paths?
 
user521945
@PM2Ring Looking into pathlib.
 
5:15 PM
@JackStout Please see: Path.resolve()
 
user521945
@amcgregor This looks perfect. Thank you.
 
@JackStout I'm not so sure. It doesn't mention "normalized" or "absolutized" vs. os.path.abspath() which does.
 
user521945
You know how you don't know what question you're asking until you're rambling?
 
Worth a try, though.
 
user521945
Don't think I've ever used pathlib.
 
5:18 PM
its kinda new. its cool
 
@JackStout Yes; often just trying to formulate the problem as a question can restructure enough to give your brain angles to grapple.
Heh, pathlib has had variants in existence since when I started with Python 2.3… not the one I remember, but path.py would be one example of a much older approach.
 
I mean, it didnt come into the picture for us mortals and normal users till python 3.4 :P
 
Ah, here it is. Python 2.2+.
 
now thats cheating. I could extrapolate "inherited" or similar logics and attribute the entire python language to an abacus :P
 
foo_txt = Path("bar") / "foo.txt" — looks pretty modern to me, despite dating back to 2.3.
@ParitoshSingh An RPN calculator is a more directly applicable equivalent, since Python is a stack-based language operating, essentially, via RPN. ;)
 
5:24 PM
Rounds Per Ni
 
haha. i'll take your word for it, i am not too familiar with computer internals, first time hearing about RPNs
hmm, interesting. reverse polish notation?
 
PUSH 27; PUSH 42; MULTIPLY — the stack now contains 1134. (Writing an extensible RPN calculator is a fun little coding challenge, many ways to approach and tackle the problem, from simple parsers like mine, all the way up to writing a parser-generator scripting language.)
 
@ParitoshSingh Exactly. It's awesome.
I did write a basic RPN calculator in my early days of Python, but I cheated & used shlex. I may have also used eval in an early version...
May 28 '15 at 14:11, by PM 2Ring
Here ya go: SImple RPN calculator in Python. Sorry about the eval, but I wrote that code when I was first learning Python, and I've never bothered updating it.
 
@PM2Ring That is pretty nifty! also, gasps in horror oh god an eval!!! aah!
So, essentially, the idea is to work off of last two values for every operation done?
or well, i guess thats basically what a stack is isnt it
 
@ParitoshSingh Mostly
Operators can take any number of operands, but in a basic calculator all the operators take either 2 or 1 operand.
 
5:40 PM
@JackStout your include project sounded interesting so I decided to write up a prototype: gist.github.com/kms70847/e99643dd989cbadab38e80821dbc639b. I don't necessarily endorse it as the best possible implementation, but maybe it will give you some ideas.
 
In a RPN language like PostScript you have a few operators that take larger numbers of operands. Some can even take an arbitrary number, but they need some way of determining how many operands to pop off the stack, either by supplying an argcount as the last item before the operator, or by having a special Mark value that gets pushed to the stack before the actual args.
 
user521945
@Kevin Looks good. You're doing a couple things differently than I'd considered, so thanks for that.
 
@ParitoshSingh 1, 2, or more. Each operation, in my case, defines the number of "arguments" that need to be popped off. 6 rand → a random number between 1 and 6 (one argument). 2 20 roll → two arguments, roll two 20-sided dice. pi → zero arguments, it just calculates at the current precision and loads the "constant". sum → consume the entire stack, pushing the sum back on, see also: avg.
 
Possible improvements that could be done:
- calling `abspath` on `filename` before checking it against `done`, which may cause circular imports to be caught one cycle earlier
- preprocessing stage to assess the size of the complete file to prevent "Billion Laugh" attacks
- allowing #includes to occur in the middle of a line
- writing results to a single common buffer and only calling .join once per program execution
 
almost-lunchtime cabbage
 
5:47 PM
cbg!
 
user521945
- I'm not concerned with optimizing out cycles, since my source files are so short. I simply have a lot of them.
- I'll register absolute paths for everything so I can be sure of what I've seen.
- There's an imposed limit on line length and one command per line. (No semicolon chaining.)
 
I now understand why languages with literal #include macros recommend that files end with a newline. I tried writing an implementation that gracefully handled files not ending with a newline and it was considerably messier
 
Files ending with a newline followed by EOF is a general UNIX pattern. E.g. one ought to be able to safely cat two files together without blending of the first line of the second with the last line of the first.
Additionally, it simplifies diff calculations for append-only type usage. (Same reason I leave trailing commas on my list/dict constants; wrapped across lines, I do not want to modify the prior last line just to append a new one.)
 
Incidentally I'm still moderately annoyed that JSON does not allow trailing commas
 
I'm moderately annoyed that the JSON syntax is not streamable. (Needs to hit closing marker for a given structure to "finalize" / "commit" that structure.) ;^P
Over a network, give me Pascal strings or give me death!
:dies:
 
5:58 PM
I still think it's theoretically possible to write a JsonWalker that iterates over a string of tokens and visits each parsed value as they become complete. If it sees "[1, 2", that's enough information to say "here is a list, and it contains 1 and 2..."
 
im just annoyed json parsers do a really crappy job telling me what i did wrong
 
Similar to template engines in Python almost universally monolithically processing and returning a single, rendered string, there does seem to be a deficiency in the market for streaming tools. :'(
 
oh, you used single quotes instead of double quotes? no, EXPECTED : GOT A ,
and im just here thinking..what?
 
user521945
@Kevin Yes, JSON is wrong and should feel ashamed.
 
I am confused that JsonWalker doesn't exist in the stdlib and (as far as I can tell from five seconds of googling) doesn't exist anywhere else either. Is there no demand for such a thing? Maybe I misunderstand what people mean when they pine for streamable json.
 
6:01 PM
gotta admit though, i shudder to think of a life without jsons as a standard for communication
 
@Kevin Given JSON is a valid subset of YAML, and YAML does support multi-record streaming (--- separation markers), you can get the worst of both worlds. Streaming, and JSON, via YAML.
 
i personally have come into touch with programming at a time json is just taken for granted.
 
I have used languages with no native support for JSON or any other serialization protocol and it is a hellish twilight existence
 
@ParitoshSingh Indeed, "taken for granted" is the line of the day, right here. Too few people are aware, or bother to stop and think, over the data they're stuffing into a serialization. E.g. transferring invoice details (or other financial information) via JSON? LOLNO. Not even close! (Enjoy your off-by-one-penny rounding errors! Accounting is gonna love you!)
 
floats delenda est
 
user6564029
6:12 PM
jesus, someone actually uses KOI-8 for emails? why?!
 
They could be… eastern European? Cyrillic encodings have it rough. Other than the dead zone, КОИ-8 isn't… too terrible?
(And, looking for a positive, at least that dead zone makes encoding identification much easier.)
 
user6564029
6:27 PM
it just boggles me that people still use these weird one-script-supported-only encodings when Unicode-aware software is easily available.
 
stuff here probably defaults to latin2 due to ő
which made me familiar with the look of mojibake at an early age
 
yeah, mind boggling... like... ascii
 
user6564029
mojibake! I've been wracking my brain for the word.
 
Martijn has carved a whole niche on SO around mojibake ;) stackoverflow.com/search?q=user%3A100297+mojibake&mixed=0
 
user6564029
@AndrasDeak hmm, this kinda looks like O-umlaut, but I don't think it is. what's this letter?
 
6:30 PM
Hungarian ő ;)
it's even called \H{o} in LaTeX
there's like one other language that uses it, as far as I know
it sounds like ö (think German) but longer
same for ü/ű
wiktionary says it's just Hungarian
so the thing is, Hungarian fits into latin1 except for ő and ű
so the same way that people often get away with ascii until something non-English comes up, people often get away with latin1 until these two come up
 
French fits into ISO-8859-1 (Latin1) except for two characters, too. (Can't remember which off the top of my head.)
And don't get me started on being in an officially bilingual country where government representatives and systems can't successfully reproduce Zoë on my ID.
 
I was quite rustled the other day when I visited a particular message board and everything rendered correctly except quote marks, which looked like Å
Let's see if I can find it... harddrop.com/forums/index.php?showtopic=3640. "All of the other game modes can be considered �for fun�."
 
Love the name for that 1/2 symbol: VULGAR FRACTION ONE HALF.
Even ftfy can't figure out what happened, there. Wau.
 
stackoverflow.com/questions/1488866/… suggests that � is unicode-related in some way. Unsurprising.
 
user6564029
UTF-8 bytes for this are c3af c2bf c2bd. Don't know if it has any relation to the original byte sequence.
 
6:43 PM
Indeed. Forcing UTF-8 interpretation at least results in a single replacement character per quote, rather than a mash of other characters, but still not right. (And still unprocessable by ftfy.)
 
A commenter suggests that "smart quotes" may be to blame, which fits the context they appear in on harddrop
 
My first instinct with stuff like that is to blame the notorious Windows codepage 1252, as I've often mentioned.
Jun 5 '18 at 21:29, by PM 2Ring
From https://en.m.wikipedia.org/wiki/ISO/IEC_8859-1 It is very common (on the Internet) to mislabel Windows-1252 text with the charset label ISO-8859-1. Most modern web browsers and e-mail clients treat the media type charset ISO-8859-1 as Windows-1252 to accommodate such mislabeling.
@Kevin Yeah, that's a smart quotes mojibake, IIRC. I'm on my phone, so it's not easy to check.
 
I initially discounted smart quotes as a possibility since both the start and end quote baked to the same character sequence "�". I would expect left and right quotation marks to bake to different sequences.
But I suppose there's no reason to expect mojibake to map bijectively
 
"Smart quotes", if manually entered, rarely are. E.g. the repeating pattern can be explained by a user “inappropriately“ using only the left-side quote mark, like I just did, there.
 
It (probably) is bijective, but remember Unicode supports a bunch of invisible "characters", like zero width joiners.
 
6:52 PM
And three or four different ways to combine parts into a single glyph.
 
That's why I undiscounted the possibility :-)
 
If the BOM character appears in the middle of a data stream, Unicode says it should be interpreted as a "zero-width non-breaking space" (inhibits line-breaking between word-glyphs). In Unicode 3.2, this usage is deprecated in favor of the "Word Joiner" character, U+2060.[1] This allows U+FEFF to be only used as a BOM.
Of course, a Byte Order Mark should only appear at the very start of the document. And it's a bit silly to use it in an 8 bit encoding like UTF-8. But try telling Microsoft that.
 
user6564029
this is one weird way to use BOM... interesting
 
I literally have code in my inbound feed processes like this:
if not content.startswith('<'):
    content = content[content.find('<'):]
With the comment immediately above that: # Skip Microsoft-supplied and irrelevant 8-bit BOM.
Silly RSS feeds.
 
I sympathize with the desire for an unambiguous marker in the text that says "this document is Unicode, in such & such encoding", but the official definition of UTF-8 has no such thing because that would break compatibility that UTF-8 has with (7 bit) ASCII and Latin1.
 
7:05 PM
Alas, unambiguous markers are doomed because you can't get everyone in the world to agree to use them
Even opt-in systems like "if the file starts with XYZ, it's a .xyz file. If it starts with something else, it's not a .xyz file" won't work if there are text files out in the wild that just happen to start with XYZ but have no affiliation with .xyz files
 
And although Microsoft are members of the Unicode consortium they don't have a good track record of adhering to standards that they didn't create. They prefer their customers to think the Microsoft way is the true standard and that other versions are defective. ;)
 
The PNG header has always impressed me. It has built-in "canaries" for 8-bit (vs. 7-bit) safety, as well as a byte order marker that identifies which order is in use, allowing trivial and automatic adaption.
<3 PNG
 
But maybe being able to correctly recognize 99.9999999% of files is enough, which is what you'll get if you make your header longer than three characters and impossible to type with a regular keyboard
 
@amcgregor I'm told some apple thingies inject smart quotes automatically
 
@amcgregor Indeed! OTOH, when I tried to read the libpng docs I wasn't able to make it all the through. There's a lot of stuff in there! But that was a couple of decades ago, maybe I should give it another try...
 
7:14 PM
Heh, I was so enamoured with PNG back in the day I adapted it into a video framing format (VidC marker… that brings back memories!) and multi-resolution texture format (integrated mipmaps… like interlacing, but more suited to use under software 3D engines).
 
FWIW, Mark Adler, one of the creators of zlib, gzip, and PNG, is an SO member. He's also contributed a lot to the Space Exploration SE; he was the Spirit Cruise Mission Manager for the Mars Exploration Rover mission. en.wikipedia.org/wiki/Mark_Adler
 
Heh. Adler. I remember not-fondly cursing his name when I was growing up, trying to grok LZ77 and other compression schemes.
 
Apr 30 '16 at 8:30, by PM 2Ring
I just noticed this PCG question in the HNQ sidebar: Compute the Adler-32 checksum... and look who's posted a Mathematica answer: Mark Adler himself! :)
 
Yup, that's kinda insane and awesome.
 
Jun 17 '16 at 14:20, by PM 2Ring
There are other reasons that the length at the end of the gzip file would not represent the length of the uncompressed data. (Concatenated gzip streams, padding at the end of the gzip file.) It should not be used for this purpose. It's only there as an integrity check on the data. — Mark Adler 12 mins ago
 
7:32 PM
Back when I was a lowly intern, I mentioned to my boss that I couldn't make sense of a term in the CIEDE2000 color difference formula. I was on a website that at the time was the top google hit for "color difference formula". {Boss} looked at my screen and said "hey, I know that guy. The next time I invite him to lunch you can ask him about it."
So like a week later I was in the same room as the guy whose formulas comprised 90% of the logic of my code.
 
90% dam. What a testimony to the rigor of his methods.
 
I don't think he invented the formula or anything, so perhaps it's not as exciting as getting Mark Adler to explain the Adler-32 checksum. But I still got some five-star troubleshooting.
 
@Kevin That could be a little daunting. :)
 
Nice guy. He liked my color space visualizer program even though it had about as much interactivity as a jpeg.
 
Adler-32 isn't a super-fantastic checksum, but it works, and it's fast to calculate. And has a tiny footprint, which was pretty important back in the day, and still is in embedded systems. But don't try to use it as a hash for hashtables.
 
7:46 PM
I think Eric Lippert has answered a question or two about the parts of the .NET framework that he himself wrote
 
One of the reasons I'm a fan of simple checksums. ISBN's mod 11 approach is… really neat.
 
@PM2Ring what would you use instead of Adler-32
 
Let's see... I'm trying to find an answer of his that explicitly uses "I" when talking about design decisions. stackoverflow.com/questions/8928403/… uses "we", that's close.
 
I wonder if you could use chimerical colours to kind of display colours of a colour space outside the gamut of the display device... en.wikipedia.org/wiki/Impossible_color
@Rick Adler-32 is ok for its intended purpose. If you want a more robust checksum, the easiest way is to use more bits. Ultimately, it depends on what your goals are.
 
7:58 PM
@smci 1) Is that an issue? I think it's a good thing, because who needs python 2.4-only answers? 2) I guess I'll edit that
Restricting the question to python 2.4 compatible answers is a waste IMO
The OP got their answer, we don't have to respect their silly requirements anymore
 
Now that I have the End User Preview of Roslyn, I can confirm that it's fixed there. (It's still present in the native C# 5 compiler though.) — Jon Skeet Apr 11 '14 at 9:59
 
cbg
 
Eric Lippert commented on by Skeet. Wow.
cbg @3141
Is that a clever way of saying Py 4?
man, one of the best commands in my life since working on a multitude of branches is git push origin HEAD
 
@Rick One measure of checksum and hash functions is the avalanche effect. I wrote a little bit about that stuff in here several months ago: chat.stackoverflow.com/transcript/6?m=43508803#43508803
 
@WayneWerner "Pyfor." "What's Pyfor?" "Everything!" :cackles:
 
8:10 PM
@PM2Ring can't you use Adler method in conjunction with a linked list or array and split the problem in many smaller ones
 
Having a spot of bother with a hand rolled neural network. Would X*np.dot(2*(A1-Y)*prime(A1),w1.T)*prime(A)*1/784 be the correct derivative for the first layer weights where X is the input, A1 is the output, Y is the correct output, A is the first layer output and prime is the sigmoid derivative. Thanks for the help.
 
Pyfor is about a henweigh
 
@3141 1/784 suggests that nobody here will be able to answer without seeing your layer weights or something
 
TIL what happens when you do a Google search on tau pi
 
@PM2Ring speed of light in furlongs per fortnight — the calculator functionality was, interestingly, a "20% time" project. (That is, a developer side-project.)
 
wim
8:19 PM
@towc more or less correct. classes were hacked into Python relatively late in the language's development, and it kinda shows.
 
@Rick You could, but there are better ways to create a hash with more than 32 bits. And that sort of splitting probably cuts into the speed, which is Adler-32's main advantage. If you don't mind slower speed & want to catch more file errors, then a cryptographic hash like one of the SHA family can even catch malicious tampering of the data, not just random transmission errors.
@amcgregor I love Google Calculator's ability to handle units, and its various built-in constants. It's very handy when answering Physics & Astronomy questions. It even handles stuff like: (radius of sun)^2 /( 4*(1 light-year)^2)
 
poor man's wolfram alpha ;)
 
I just never noticed before that it can do multiplication of built-in constants without an explicit multiplication sign.
 
ah, I see
 
Yeah, it certainly can't do everything that wolfram alpha does. But it loads a lot faster. :)
 
8:26 PM
yup
 
Wolfram Alpha has the… difference… in that it actually understands the data. It's not just abstract units assigned to scalars with no meaning. It's gob-smackingly awesome, and even more so that they offer public querying access.
 
it's just a gateway drug to Mathematica
 
Haaaaah. Never thought of it that way, but yes. Yes it is.
 
8:48 PM
Sorry for the long wait @AndrasDeak. I'm using MNIST with an input size of 784(28x28) pixels. This is a network with 1 hidden layer of 64 nodes. This derivative alters the weights 64 at a time, so altering all the weights connecting one pixel to the hidden layer. This code is actually slightly "cleaned up", here it is as part of the loop:
Thanks
 
I won't be able to help you but it was obvious that code including a magic number like 1/784 won't be readily identifyable as correct or incorrect by people other than you
presumably you have a formula the derivative you which you want to compute, at which point verifying the derivative should be very easy
I also don't know what prime is
 
prime is the sigmoid deriavative. The formula appears to be correct, but the network behaves strangely. If I train it on a 1, then it immediately recognises the next image as a 1, even if it isn't.
 
wim
@AndrasDeak it's the time of early manhood or womanhood
 
@wim in case of the latter, amazon prime?
 
> The compound exploded in solution, it exploded on any attempts to touch or move the solid, and (most interestingly) it exploded when they were trying to get an infrared spectrum of it.
from an earlier link. Wow that's just impressive
 
8:59 PM
Measurement is interaction.
 
Indeed! See: Heisenburg
 
Original link?
 
scp-wiki.net/... :P
 
Haha, I've spent way too long on that site.
 
I've never understood the appeal
 
9:05 PM
I never liked creepypasta and scp seems to have a huge overlap with that
 
Just found my exact problem on some forum, the only answer was someone asking the OP to email them.
 
typical denvercoder
 
Exactly what I thought of..
 
wim
9:35 PM
tail of crap here
 
6 hours ago, by PM 2Ring
@WayneWerner Compounds with lots of nitrogen can also be interesting https://blogs.sciencemag.org/pipeline/archives/2013/01/09/things_i_wont_work_wit‌​h_azidoazide_azides_more_or_less
 
@wim the question solicits bad answers.
 
How so?
 
I mean, it's not an incorrect observation, but that doesn't make the question bad in and of itself
 
9:41 PM
@AndrasDeak because he is using a dictionary like an array
 
Anyone feel like giving an answer that doesn't totally suck on that page? How is that not a dupe of a better question/answer?
 
@Rick that doesn't mean that they are asking for crap answers
@AlexanderReynolds the first two answers together seem OK: the second explains how it's bad (needs 3.7 update), the first one how to do the bad
 
@wim All gone
 
A "good" answer here would be one suggesting how to use OrderedDict to maintain assertion order or to use sorted with the proper function to order their keys, both of which now having an order can be used to linearly index. IMO.
 
9:49 PM
so check out my last link, does exactly that, with a new-dict update
 
Well, there's some examples of "an answer that doesn't totally suck" then :D
 
@AndrasDeak There are some pretty poor answers there. Eg how did stackoverflow.com/a/27047467/4014959 get 4 upvotes?
 
yup
but I'd rather we didn't downvote them to oblivion here. Don't want to look like a voting mob.
 
True
 
@AndrasDeak dictionaries have a specific performance metric with how they organize access data. He is complaining about the size of the dictionary becoming too big, or the number of operations he is performing. he is doing a number search. That means is using it in a way inconsistent with it's designed. The selected answer just masks the problem with a quid pro quo.
 
10:04 PM
what's your point?
 
@AndrasDeak just an observation X)
 
ah, OK
 
wim
10:27 PM
thank you, voting mob 👌
 
10:38 PM
recbg
 
cbg
 
11:08 PM
I've created a monster; a terrible abomination, a blight upon the world. I have uncovered the Secret of Zig. (Forgot I had made this… it's about five years old!)
 
00:00 - 17:0017:00 - 00:00

« first day (3069 days earlier)      last day (1877 days later) »