« first day (3654 days earlier)      last day (1302 days later) » 

7:05 AM
@AndrasDeak Not sure. I guess the main criteria is that the page appear identical to the eye.
 
 
4 hours later…
11:03 AM
8K wouhouh 2K more and I'll finally be able to control the whole site
EVILISH Laught in the background
 
11:17 AM
@FaheemMitha if you're not sure about the specifications it will be a doozy to solve :)
 
 
2 hours later…
1:04 PM
@AndrasDeak It's not important.
I am filling a form. I found some duplicate pages, for no reason.
I thought I could maybe check if there were others. But if I can't, no big.
 
1:22 PM
@FaheemMitha Is it a computer-generated pdf or something scanned? In the former case you might see that the given pages are almost the same on the pdf code level. I'd first run pdfseparate and then diff/vimdiff the two pages. And compare the size of that diff to the difference in two really different pages.
but if the duplicate pages are not consecutive it will be hard to find all the dupes
 
 
3 hours later…
4:22 PM
@AndrasDeak It's a form from a brokerage. Probably created using some word processing program.
> Corel PDF Engine Version 3.0.0.576
 
4:59 PM
then it's worth looking at the raw source
 
 
1 hour later…
6:06 PM
@AndrasDeak Eek. Is that even possible?
I mean, would one understand anything from it?
 
6:28 PM
@FaheemMitha A general "one" might not, but people who are familiar with pdfs might. I also can't read postscript. A lot of a pdf's contents are more or less readable code, interleaved with binary data. At least based on my very limited and uneducated experience.
Just open the pdf with vim (or some inferior text editor), and see what you see. Some pdfs are almost all binary garbage, but most pdfs are meaningful inside.
@FaheemMitha also aliens
actually, I just checked a mid-term I wrote with latex, and the pdf is almost entirely binary :(
so my plan might not work, because I suspect these binary blobs can easily become very different
 
@AndrasDeak Don't PDFs use compression too?
 
6:43 PM
yeah, that's already applied to the binary streams
 
@AndrasDeak Do you use TeX a lot? Or just an average amount?
 
average to little, probably
I write reports, papers, mid-terms, beamer presentations and posters in it
 
@AndrasDeak That sounds like a fair amount.
What about filling out random PDFs? And correspondence? And accounting?
 
it's a lot of tasks, but I don't do any of them most of the time :)
@FaheemMitha nope.
OK, running gzip deflate on streams in the pdf source lead to minified human-readable code
 
@AndrasDeak The ones generated by TeX?
 
6:50 PM
Yup, and probably others too. Depends on the filter being used for the stream; the ones in my latex-born pdfs are \Filter \FlateDecode
I checked a random pdf that must have been made with MS Office, and it also uses FlateDecode for its streams
 
@AndrasDeak Does that also produce human-readable code?
 
I can check, but it probably will
yes
>>> import zlib
>>> with open('path/to/file.pdf', 'rb') as f:
...     dat = f.read()
...
>>> almost_from = dat.index(b'stream')
>>> to = dat.index(b'endstream')
>>> print(zlib.decompress(dat[almost_from+7:to]).decode('utf8'))  # +8 if it's a windows-born file with carriage returns
this ^ will decompress the first stream in your pdf, whatever that is (hopefully it uses FlateDecode so this will work)
I have literally 0 knowledge about the pdf specification so this is pure guesswork
 
@AndrasDeak A stream is a chunk of the PDF which is standalone?
 
yes, in a sense, as far as I understand (I really don't)
I found a page that mentioned the pdf standard a bit, let me find it again
it was resources.infosecinstitute.com/pdf-file-format-basic-structure (it took me long to load, I stopped it mid loading and I looked at a broken half-loaded page)
I only used it to figure out that running zlib on the stream should probably Just Work
 
@AndrasDeak I don't know anything about PDF either.
 
7:02 PM
my point is that if you were really motivated you could probably take the pdf source, decompress it, and than look for similarities there. My working theory being that small changes in the uncompressed source would become large differences in the compressed stream
I don't know if any of my assumptions are correct
 
@AndrasDeak Yes, the compression can blow up small differences.
Not that I know anything about that either. But one obviously wants to compare uncompressed sources.
 
It would probably be easy to write a small python script that prints the pdf source with streams deflated/decoded (which would not be valid pdf anymore, of course)
 
@AndrasDeak Does decompressing mean it's not valid PDF any more?
I wonder how PDFTeX handles PDF writing. I have no idea.
But it seems to work pretty well.
 
this is how streams are embedded:
 
I use TeX to write on PDFs. In fact, I'm doing that right now.
 
7:09 PM
6 0 obj
<<
/Length 2928
/Filter /FlateDecode
>>
stream
[byte soup redacted]
endstream
endobj
 
Not particularly fun, but all the other electronic options I've tried have been worse.
 
it's not evident how much should be replaced and how to preserve the validity of the pdf format
 
And of course it has all of TeX's advantages. Using some random program to do so, woudln't.
@AndrasDeak I suppose one would have to read the standard. Which is presumably stable.
 
yes
there are new versions but a given version should be fixed
 
PDFTeX was written quite a while ago, and I'm not aware of any major overhauling.
 
7:11 PM
@FaheemMitha how? Do you \includegraphics them and overlay your text?
 
@AndrasDeak Basically. Though I use pdfpages. Which uses \includegraphics, I think.
It's a bit laborious, but using some random program one does not control also has major issues. With TeX I can also use version control, which is a big plus.
 
Yeah, sounds like a lot of trouble
But admirable ;)
 
@AndrasDeak Yes, it's a fair amount of work, unfortunately.
 
are you using TikZ?
 
But they love their forms in this country. And they're often quite complicated. I've got kind of used to it now, but it's still slow. If you try to do it, make sure to superimpose a grid on the page. Because you'll have to position everything manually.
@AndrasDeak It's just TikZ, but yes.
Sometimes it helps to be using the world's most powerful typesetting software.
 
7:16 PM
Do you use a grid to help locate fields? That should save a lot of trouble
 
So there's that.
@AndrasDeak Just for positioning. Not sure what you mean by fields.
 
Oh that's just what you said
 
These aren't PDF fillable forms, usually. Those you can just type into directly.
No real work involved.
 
Sorry, I'm single-handed on mobile, so slow to type
@FaheemMitha I know, I just meant fields in the semantic sensr
 
I think it's theoretically possible to convert a random PDF into a fillable form, but it seems unlikely to be an automatic task.
@AndrasDeak Ok.
 
7:18 PM
Fillable pdfs are also not "p"dfs, so there's that too
 
I suspect there is a vanishingly small proportion of the population that does it this way.
@AndrasDeak They aren't?
 
@FaheemMitha yeah :)
@FaheemMitha no. Try filling one with a linux pdf viewer and letting an MS person open the result...
 
I once handed in a printed out filled form to a girl at a bank. She asked me if I used something to type it in with. I said "yes".
 
@FaheemMitha it's probably just you and Richard M. Stallman ;)
 
@AndrasDeak I haven't tried that. Should be a fun exercise.
@AndrasDeak Somehow I can't picture him filling in PDFs by hand. He probably gets someone else to do it.
He used to have a secretary. Probably still does.
 
7:20 PM
He uses his katanas to etch into the paper
 
@AndrasDeak That's just an urban legend. :-)
I think someone did make him a gift of one, once.
Can't imagine what he'd so with a sword.
 
oblig xkcd xkcd.com/225
Probable source ^
 
@AndrasDeak Yes, I know.
Personally, I quite like "For a GNU Dawn! For freedom!"
 
@FaheemMitha I read "gif" instead of "gift"... must be one of those days, sorry
 
@AndrasDeak TikZ and friends are actually quite handy for diagrams.
 
7:24 PM
I know, I use it all the time for my beamer slides
 
May 24 at 11:37, by Andras Deak
my ugliest child :D http://i.stack.imgur.com/twsdj.png
 
@AndrasDeak Looks good. PDEs?
 
Nah, just thermodynamics
 
@AndrasDeak Ok. I thought you did applied math/PDE stuff, but I must be confusing you with someone else.
 
7:28 PM
Technically I do but that's buried in software
Which is to say I don't
 
BTW, wrt to the PDF filling, it probably won't surprise you to learn that the positioning is the most time-consuming part.
 
Yup
 
For some reason, the hardest part is keeping the x and y coordinates straight.
I'm constantly getting them confused. Perhaps I should go back to primary school and have a teacher whack my knuckles with a ruler.
 
might just work ;)
just overlay an xy coordinate system...
 
@AndrasDeak I already do.
 
7:33 PM
I mean a doodle with two axes
 
@AndrasDeak Doodle?
 
@FaheemMitha then back to school with you :D
@FaheemMitha a sketch
 
@AndrasDeak It's just a coordinate system. Horizontal and vertical lines.
In green, to stand out from the actual text.
 
I meant two axes with arrows and the labels "x", "y"
 
Hah, just did it again just now. The other common thing is forgetting the minus signs.
@AndrasDeak I have a grid. With lines separated by 0.2. I wonder if I should try 0.1.
But that might be too dense. As it is, it sometimes obscures the text.
 
7:37 PM
@FaheemMitha I know you do, we've covered that. The grid won't remind you which is which
 
@AndrasDeak I should be able to remember which is which. I'm not 2 years old.
 
@FaheemMitha you could have one big tikzpicture with a node with includegraphics inside. If you use node [above right] your coordinates would probably all be positive
 
@AndrasDeak Interesting suggestion. What would that code look like?
 
@FaheemMitha the other option is whack whack :P
 
I just use the standard TeX coordinates. Which has the origin in weird places.
Well, top left. Apparently that's built in.
Perhaps I could impose a separate coordinate system. I hadn't thought of that.
 
7:40 PM
@FaheemMitha \begin{tikzpicture} \draw node[above right] {\includegraphics[page=1]{path/to/file.pdf}}; \end{tikzpicture}
 
I wonder if it would be worth the trouble.
@AndrasDeak Where would the text go?
 
The rest of your code would go in that tikzpicture
 
Does \draw node[above right] impose a local coordinate system?
 
\draw (0,0) grid (20, 20); % or whatever
\draw (2,3) node[right] {Faheem};
@FaheemMitha the tikzpicture does. The draw without coordinates assumes (0, 0)
And [above right] should push your page to the top right so that the origin is in the bottom left
\draw (0, 0) node ... works too and is explicit
 
I probably am not following, but I would expect there would be a one time coordinate origin setting command.
Is that how it would work here?
 
7:45 PM
It's implicitly set in the tikzpicture
 
@AndrasDeak I don't see how.
 
I can put together a MWE when I'm back on laptop
 
@AndrasDeak Ok. Thank you.
You're on a mobile now?
 
remind me if I forget
@FaheemMitha yeah
 
@AndrasDeak Impressive typing.
@AndrasDeak Ok.
 
7:47 PM
@FaheemMitha Thanks :) Also lots of edits :D
 
@AndrasDeak Not that visible.
 
@AndrasDeak BTW, are you following the US election at all?
 
I try not to
 
I am. Not fun, particularly. I wonder how much I should care. But dreadful as US pols are, I still hope Trump doesn't win.
 
7:51 PM
Got to go for a while. I'll try to remember the tikz thing.
 
@AndrasDeak Ok. Thanks.
 
Tim
8:32 PM
I I was wondering if I am wrong?
-1
Q: Is `#define INT_MIN 0x80000000` okay?

TimIn Computer Systems: a Programmer's Perspective: Writing TMin in C In Figure 2.19 and in Problem 2.21, we carefully wrote the value of TMin32 as -2,147,483,647-1. Why not simply write it as either -2,147,483,648 or 0x80000000? Looking at the C header file limits.h, we see that they use a similar ...

is it a duplicate?
 
9:06 PM
@Tim Arguably the title question could just be answered with "no", but the need for it to be a signed int value is covered pretty well in the duplicate, yes
1 > 0x80000000 is false, which would be somewhat problematic
 
Tim
9:37 PM
@MichaelHomer How do you tell if an integer integral is signed or unsigned? Isn't it that an integer literal without any suffix by default is a signed integer? So 0X80000000 is signed? It is in the range of signed, because it is the smallest integer in the signed range
 
 
1 hour later…
10:40 PM
@Tim §6.4.4.1 seems to be the relevant part of the specification
 
Tim
11:24 PM
@MichaelHomer p55 says "The type of an integer constant is the first of the corresponding list in which its value can be represented." In the table on p56, with "no suffix" and "hexadecimal or octal bases", the type for 0X80000000 is "int", and 0X80000000 is treated as a signed literal because it fits the signed int range as its smallest integer.
 
11:47 PM
If you say so
Demonstrably false in practice of course
 

« first day (3654 days earlier)      last day (1302 days later) »