In the background was a visible HTTPS URL.I wish I was a big game dev so I could do that. But make it be a 10 GB file encrypted with some reasonably light encryption. And have it be "Never Gonna Give You Up" or something looped 100x.
Best posts made by EvanED
-
RE: Star Citizen: 80$ Million Dollar Leaky Faucet
-
RE: Anyone posted the Lenovo malware news yet?
Isn't Lenovo the brand all the crazy-security-conscious Lunix users buy? Why did it take so long for this to be detected?
Yes, "Why didn't Linux users detect the certificates Lenovo installed in Windows?"Also, it doesn't sound like it was there for all that long. The article says Lenovo says that it was shipped only starting in October last year. I can't put a particularly tight upper bound on that, but I have one I bought about a year before that, and mine doesn't seem to have it installed.
It does make me want to vet all my computers' root certs though...
-
RE: The nerdy jokes thread (bonus original title mode!)
Race condition jokes.
(Shamelessly stolen from a coworker)
-
RE: The nerdy jokes thread (bonus original title mode!)
You know what never gets old?
-
RE: Warning: WTDWTF will be read-only soonish
One does not typically send private keys anywhere...
Au contrare, you need to back up your private keys in a number of locations because they're so important. In fact, I'm soon to be launching a dedicated website for this service. I'll be happy to give anyone a free month of service; in the interim, you can jut PM me your private keys. Be sure to tell me what they allow access to so that I can make sure they didn't get corrupted during transfer. -
Today's security vulnerability: let's exploit hardware bugs!
“Rowhammer” is a problem with some recent DRAM devices in which repeatedly accessing a row of memory can cause bit flips in adjacent rows. We tested a selection of laptops and found that a subset of them exhibited the problem. We built two working privilege escalation exploits that use this effect. One exploit uses rowhammer-induced bit flips to gain kernel privileges on x86-64 Linux when run as an unprivileged userland process. When run on a machine vulnerable to the rowhammer problem, the process was able to induce bit flips in page table entries (PTEs). It was able to use this to gain write access to its own page table, and hence gain read-write access to all of physical memory.
http://googleprojectzero.blogspot.com/2015/03/exploiting-dram-rowhammer-bug-to-gain.htmlThey anonymize the hardware they tested so you can't just look, but you can download a test program to see if you're vulnerable.
I wonder how many decades it will be until there is any chance of anything computery being even vaguely secure.
-
RE: Git troubleshooting flowchart
The fact such a thing is even necessary is slightly worrying.
Is needing such a thing better or worse than having one that is roughly, say,
:-) -
RE: 🙅 THE BAD IDEAS THREAD
It's weird how it dropped so suddenly and more or less gracefully.
http://youtu.be/Te_3gfOoh8c?t=50s
(Start at 0:50 if it doesn't.)Inside job. Definitely.
http://i.imgur.com/Ge1hS.jpg -
RE: Software problems that really ought to be solved by now
My big complaint in this category: line endings in text files.
Both CRLF and LF are around to stay. Why do so many tools not work with both?! (Mostly this is an indictment of a number of Unixy utilities; Notepad excluded, Windows programs in my experience almost always deal correctly with both.)
Edit: Also: not having to configure backspace/delete over SSH. (It usually works, but not always, which is pretty ridiculous.)
-
RE: JSONx is Sexy LIESx
I am aware of the JSON spec. My point is that undefined is a valid value in Javascript, it is a value value for an object in Javascript, and it is a valid value for an array in Javascript. That "Javascript Object Notation" lacks an ability to handle it by specification should tell you something about whoever wrote the spec.
A counterargument: in some ways, that's more an argument that the name is bad than that the spec is bad. JSON was made as a format for client<->server exchanges at a time when JavaScript on the server wouldn't have been a very realistic option; that means that it was meant as a format to be used in a cross-language situation. And maybe JS undefined doesn't map into JSON very nicely, but if undefined were present in JSON then that wouldn't map into non-JS users very nicely. So you're just moving the problem around.Edit: Actually I guess maybe this isn't as good of an argument as I initially put it. It's probably usually easier to avoid using
undefined
in situations where you are in other languages and don't want it than it is to compensate for not having it when you're in JS and do. -
RE: Windows 9 (And Pandora) appreciation thread
I think the real question is: when two gay people marry, do they get a UAC prompt?
-
RE: Plane not actually commandeered by wi-fi that was not actually hacked
9/11 "truther"
Obligatory: (http://www.geeksofdoom.com/2011/09/01/the-conspiracy-behind-the-destruction-of-saurons-tower-in-the-lord-of-the-rings) -
RE: 🙅 THE BAD IDEAS THREAD
Amazingly, this works:
What's even more amazing is I tried a ton of sites with a double www, and that's the only one that works of the ones I tried.
-
RE: Sad().stop() ; wtf().start()
Also possible:
> firstcall = false false > function sad() { if (firstcall) { firstcall = false; return true; }return { "stop": function() { throw new Error("Hammer time!"); }}; } undefined > sad() === true false > sad().stop() VM1834:2 Uncaught Error: Hammer time! at Object.stop (<anonymous>:2:104) at <anonymous>:2:7 at Object.InjectedScript._evaluateOn (<anonymous>:895:140) at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34) at Object.InjectedScript.evaluate (<anonymous>:694:21)
-
RE: The Official Status Thread
Status: wondering why i have a pair of 28" waist pants in my laundry. Not only have i not worn that size since.... freshman year highschool i think, but no one else in the house wears that size.... and we do laundry on premisis so i can't even use the laundrymat explanation.
There's an April 1st idea for next year: sneak some random piece of clothing into someone's laundry. T-shirt of a sports team that's a rival of the friend's favorite, something of the opposite gender if they are unattached, etc. -
RE: The quasi Official Stupid Ideas that have actually been done thread
Oh, this article is fun (emphasis mine)...
That guy has a whole series that are written in a similar style.In a comment to my post on putting out fires last week, one commenter mentioned the utility of the good old sand bucket, and wondered if there was anything that would go on to set the sand on fire. Thanks to a note from reader Robert L., I can report that there is indeed such a reagent: chlorine trifluoride.
There's also Things I'm Glad I Don't Do, which I'm less familiar with.
-
RE: 🐧 Lunix
If you're seriously telling me you can pipe a sound clip around to different CLI tools (without passing around the file it's in), I'll need to see an example of it. Because I don't believe you can do that "easily", and I highly doubt it can be done at all.
$ aplay file.wav
Playing WAVE 'file.wav' : Signed 32 bit Little Endian, Rate 11025 Hz, Stereo
$ cat file.wav | aplay
Playing WAVE 'stdin' : Signed 32 bit Little Endian, Rate 11025 Hz, StereoIn both cases, it played the noise.
Now, obviously that's not a very useful pipe, but it would be totally possible to write some filter program that would transform a file on standard input, write it on standard input, and then put it into that pipeline as
cat file.wav | transform | aplay
. And it would be easy to write it -- you'd read from standard input and write to standard output exactly the same way as if you had atransform -o output-file.wav input-file.wav
and were reading frominput-file.wav
and writing tooutput-file.wav
. There's literally almost nothing extra that you'd have to support in order to do this.What's more, even if
aplay
didn't support reading from stdin (which I wasn't sure it would, but it did) you could still do it:$ aplay <(cat file.wav) Playing WAVE '/proc/self/fd/11' : Signed 32 bit Little Endian, Rate 11025 Hz, Stereo
and again, if I had a transformer I could say
aplay <(cat file.wav | transform)
.And of course you could write a
generate-sine
program and saygenerate-sine 440 10sec | aplay
too if you wanted, and you would write the same thing ingenerate-sine
to standard output that you would to a file.(All of this would work on Windows too BTW if you have an analogue to
aplay
.) -
RE: Driving Anti-Patterns - Necro Edition
People who see a pedestrian at the intersection they are approaching and stop just after the third line - the first being the one they're supposed to stop at, the second and third being the crosswalk.
I wish it was explicitly legal to climb onto the hood of cars that do that and walk across them, provided you remain within the boundaries you'd get if you extended the crosswalk lines upward in space. -
GNU coreutils `sort -u`
sort -u
is impressively bad performancewise on large files with a large number of duplicate lines. (-u
is "unique".)In particular, it appears to not take advantage of the
-u
flag until output, so if you have a 25-million line file, it will read in all 25 million lines, sort all 25 million lines, and then output just the unique ones. At least that's what I infer from the performance.I have file that's about that size; 25.2 million lines, but only 44,565 that are unique. Let's see how
sort
does.$ time sort -u demo > /dev/null sort -u demo > /dev/null 173.57s user 10.67s system 545% cpu 33.804 total $ time sort demo > /dev/null sort demo > /dev/null 171.00s user 8.68s system 558% cpu 32.195 total $ time (sort demo | uniq > /dev/null) ( sort demo | uniq > /dev/null; ) 1.07s user 0.07s system 3% cpu 33.121 total
So
sort
andsort -u
takes about the same amount of time. Actually,-u
makes it take more, though maybe just jitter. I tossed in a comparison withsort | uniq
for the curious. That usually winds up faster for me actually. (Which means that the authors ofsort
went out of their way to make it less Unixy so that they could make it perform worse. Yay?)(Incidentally, and also interestingly,
cat demo | sort
is far slower thansort -u
. By watchinghtop
, it's easy to see why:sort
parallelizes the sort when you give it the file name but not otherwise.)I wonder if we can do better by not being stupid.
$ time (cat demo | python -c $'import sys\nfor line in sorted(set(sys.stdin)): sys.stdout.write(line)' > /dev/null) ( cat demo | python -c > /dev/null; ) 1.14s user 0.05s system 99% cpu 1.190 total
Yup.
27 times faster, in Python, with no attempt at all to do any parallelization. 54 times faster than the
cat demo | sort
version that doesn't parallelize the sort. 1/162 of the total CPU time of the parallelized version. -
RE: Vacation Deniers
Sheesh; didn't anyone play SimCity 2000? The first real fusion plant will be built around 2050.
Filed under: I have faith in Maxis's prediction
-
RE: The Official Status Thread
*sigh*
That brace on the first line is ending (/me takes breath) an
else
inside of anif
inside of anif
inside of awhile
inside of anelse
inside of anif
inside of anif
inside of anif
inside of afor
inside of anif
inside of a 315-line function.With -- you'll note -- inconsistent indentation amounts.Actually it's only the outermost indent, not very obvious in that picture, that's inconsistent. The random blank line was pulling an illusion on my eyes.(Given the rest of what I said, "315-line function" is actually not too bad...)
-
RE: The minor rants thread.
Jeff secretly wants people to see the "Are you sure you want to revive this topic" toaster?
That's what get's me about the suggestions.Discourse: Here, take a look at this thread... maybe it'll be interesting!
Me: OK, sure. Hey, I have something to say. Click reply.
Discourse: WHAT ARE YOU DOING THIS IS AN OLD THREAD -
RE: Driving Anti-Patterns - Necro Edition
Most places in the US have a "don't block the box" rule, meaning you wait at the light until you can complete the entire turn--you're not supposed to wait in the middle of the intersection.
I'm about 98% sure that's not what that means and that's wrong. Don't block the box means you can't enter the intersection if you won't be able to clear it after the light turns red. Sometimes there is some uncertainty as to whether you will be able to clear, but usually not; and in the usual case I am pretty sure it is legal to enter and wait in the intersection almost everywhere in the US. -
RE: The Official Status Thread
Cue Texans to come and tell us how they are more than 2% of: (land area, size of economy, amount of oil, amount of military, etc.)
Speaking of Texas... apparently someone at Gawker filed a FOIA request with Gov. Abbott for any emails relating to Jade Helm. (For non-Americans, this is an upcoming (going-on-now?) large military exercise being conducted in the southwestern US. Certain paranoid folks think it is a cover for an invasion of conservative states, or more generously, an attempt to pressure/intimidate them. Gov. Abbott a while back said he is ordering the Texas National Guard to oversee the operation to make sure that doesn't happen.)Most of the stuff returned from the request is really quite dull, but there was one gem:
They even scanned the foil as part of the FOIA request:
-
RE: Xauth utility
I'm pretty sure this thread has given me cancer.
- First we have the original WTF
- Then we have the assertion that the quit/exit distinction is meaningful and standard, when I can think of literally no other program that makes that same distinction
- Then we have blakeyrat's assertion that "'quit' implies you're stopping on purpose, finished using the program, 'exit' implies the program exits suddenly without saving"; apparently he never looked at the "Exit" menu item in, say, Visual Studio.
- Then we have the discussion of the API
exit
functions, as if that's particularly relevant to the terminology a program presents to the user. Apparently "file -> new" should be replaced by "creat".
-
RE: 🙅 THE BAD IDEAS THREAD
Probably a bad idea:
If you're going to drive around a more sportsy car than your typical sedan and SUV, drive aggressively, peel out from stoplights, and ignore the speed limit even more than most people, then I'm guessing a "RCKLESS" vanity license plate is unlikely to help you stay under the radar, convince police to just give you warnings, etc.
-
RE: TempleOS and HolyC (Again. I think there's already a thread. Oh well.)
Why do you need a flowchart in your code and not in some other file in the same folder? Does the compiler understand your flowchart?
For the same reason I put comments in// slashies
instead of in acomments.txt
next to the code. -
RE: Fusion Reactors!
As long as the first fusion power plants are being built sometime in the 2040-2060 era, I'll be happy. That's what SimCity told me would happen, and that's where I put my faith.
-
RE: Setting Fire To Sleeping Strawmen (now with extra Toniiiiiiiiiight, you're right, you're right, you're right)
I put way too much time into this post, especially because I anticipate it will convince pretty much no one... but it was interesting, so whatever.
18 years of no global warming, dude.
I wonder why you pick 18 years?
Could it be that 1998 (I'm assuming you actually meant 16 years1) was far outside of the long-term mean, and if you move the start point the warming trend reemerges? The majority of pairs of (start,end) points will show a warming trend.
Here's a monthly visualization I cooked up. Below4 you'll find the Python script I cooked it up with; it uses land and sea measurements from NOAA3, which is they data set they say should underapproximate warming. (Really it should moderate temperature changes in general.)
Each pixel in the lower left half represents a comparison of two monthly averages. For a pixel at row coordinate r and column coordinate c (i.e. matrix coordinates not plane coordinates), the pixel represents the how much warmer or cooler the rth month since Jan 1984 is compared to the cth month. Red means warmer, blue means cooler, black means no change. The intensity indicates the degree of change, in a linear scale relative to RGB intensity with 255 being the maximum absolute difference across the time frame. The scaling is done separately for each picture below.
So the bottom few rows represent how much warmer or cooler 2014 has been relative to other years, and the further right you look the more recent your basis of comparison is.
Here is the image:
Now at least to me this looks very red, but I think some of that is a perceptual illusion and maybe blue doesn't stand out as much as I'd like, but it takes too long to generate this image because of WTFness so I was lazy and just inverted the colors in Paint; I think this makes the cooler months much more visible. Now warmer is cyan and cooler is yellow:
Here is the last 20 years (starting Jan '94):
And the last 10 years (starting Jan '04), scaled up 300%:
Only the last of these graphs doesn't show a clear warming trend, and you have to get into the 2000s (about 10 years ago, not 16 or 18) before it doesn't. 1998 was a special year and you should stop citing it; it discredits your arguments.
Here's a graph I pulled from another source4:
Now, this agrees with the last 10 years of my graph; the last 10 years don't show a warming trend. But look at the broader picture of it: there are plenty of deviations that are in the 10-year-long ballpark: a big spike around WW2, decade-long zig-zags in the 70s and 80s, etc. You could even argue that the 90s were a little bit of a spike. But if you look beyond about a decade, the trend becomes clear. (More on predictions later.) So looking at the most recent 10-year period and saying "no warming!" is utterly unconvincing to me, especially as we continue setting temperature records. (Guess what there's a good chance will be the hottest year on record? Hey, it's 2014! Surprise! Not. Remember January's polar vortexes in the US? It was still the fourth warmest on record.)
1 Or your argument becomes even weaker, as 1996 was a pretty cool year, cooler than every year since. In fact, out of the 214 possible comparisons of the global average temperature from a month in 1996 to the same month in a later year, only 12-14 (depending on whether you use land2 or land/sea satellite3 measurements) are not warmer in the later year. That doesn't sound like "no global warming" to me.
2 http://data.giss.nasa.gov/gistemp/tabledata_v3/GLB.Ts.txt; see http://data.giss.nasa.gov/gistemp/ for methodolgy
3 http://data.giss.nasa.gov/gistemp/tabledata_v3/GLB.Ts+dSST.txt
4 http://data.giss.nasa.gov/gistemp/graphs_v3/Here is the Python script. I don't have PIL installed here so I just dump a bunch of ImageMagick commands to standard output, so grab those and run. Note that this takes a really long time. (Like 20 or 30 minutes or something for the 30-year pictures above.) In retrospect it was probably a mistake, especially because I wound up not being able to create the image in one big
convert
command because it had too many arguments.#!/usr/bin/env python2from __future__ import print_function from __future__ import division import os import sys import itertools import subprocess def read_data(filename): """string -> int list""" data = [] with open(filename, "r") as f: for line in f: fields = line.split() data.extend(int(field) # Year J F M .... D then more fields for field in fields[1:13] if field != "****") print("Read data for", len(data), "months", file=sys.stderr) return data def get_comparison_matrix(month_data): """int list -> int int list""" matrix = [] # This puts the final month/whatever as the row index for index, final_temp in enumerate(month_data): matrix.append([final_temp - initial_temp for initial_temp in month_data]) return matrix def standardize_matrix(matrix): # Note that we don't need abs here because if a-b appears in the # matrix at this point so does b-a abs_max = max(max(row) for row in matrix) print("The maximum absolute difference is", abs_max, "100ths of a degree C", file=sys.stderr) size = len(matrix) for final_time_point in xrange(size): for initial_time_point in xrange(size): if initial_time_point > final_time_point: matrix[final_time_point][initial_time_point] = 0 else: matrix[final_time_point][initial_time_point] /= abs_max def magickize(matrix, output_filename): size = len(matrix) commands = [["convert", "-size", "{dim}x{dim}".format(dim=size), "xc:white", output_filename]] for final_index, row in enumerate(matrix): for initial_index, value in enumerate(row): if initial_index > final_index: continue red_part = value * 100 if value > 0 else 0.0 blue_part = -value * 100 if value < 0 else 0.0 color = "rgb({}%, 0.0%, {}%)".format(int(red_part), int(blue_part)) commands.append(["convert", output_filename, "-fill", color, "-draw", "point {x},{y}".format(x=initial_index, y=final_index), output_filename, ]) return commands def main(): """Usage: dataize.py [--debug-matrix | --debug-magick] -o OUTPUT_FILE INPUT_FILE """ try: # A stack trace is graceful error handling, right? dummy1, dummy2, output_file, input_file = sys.argv dummy2 == "-o" or sys.exit(1) debug = None except ValueError: dummy1, debug, dummy2, output_file, input_file = sys.argv dummy2 == "-o" or sys.exit(1) data = read_data(input_file) matrix = get_comparison_matrix(data) if debug == "--debug-matrix": print("=== Raw matrix ===") for row in matrix: print(row) standardize_matrix(matrix) if debug == "--debug-matrix": print("=== Standardized matrix ===") for row in matrix: print(row) sys.exit(0) magick = magickize(matrix, output_file) if debug == "--debug-magick": for command in magick: print(" ".join("'%s'" % arg for arg in command)) sys.exit(0) print("Removing file if it exists", file=sys.stderr) try: os.remove(output_file) except OSError: pass print("Populating file", file=sys.stderr) for idx, command in enumerate(magick): if (idx+1) % 100 == 0: print("echo '[", idx+1, "/", len(magick), "]'", sep="") print(" ".join("'%s'" % arg for arg in command)) #subprocess.check_call(command) main()
On Prediction and Why to Act
OK, now the concessions: I am probably less convinced than the scientific consensus that GW is human-caused. That's concession 1.
Concession 2 is that I'm also not convinced that the predictions are going to be very accurate. I recently listened to the audiobook version of Nate Silvers The Signal and the Noise, and that reinforced that point of view; actual climatologists are often fairly skeptical of the models as well. There's a lot of uncertainty to it.
(That said, please don't say "we can't predict the weather a week from now how can we predict it in 50 years"; that is a painfully dumb argument. If I ask you to predict a coin flip, you'll be wrong about half the time. If I ask you to predict how many heads will come up in 500 flips, you'll be pretty accurate.)
Nevertheless, I still think it's important to act. Despite what conservatives and libertarians think (okay, not really :-)), I don't think that because I like sitting in my loft trying to find ways to make things difficult for corporations, and not just because I don't have a loft.
The reason I think we need to act is that, from my perspective, the potential costs of not doing something and being wrong in that decision are far, far higher than the costs of acting. For example, many glaciers are receding due to the temperature rises over the last century, and glacier meltwater is often used as a water source. If the GW predictions are right, this will cause water shortages for many people; it's entirely conceivable that this will cause significant humanitarian problems. Even if that scenario only has, say, a 10% chance of occurring, the cost will be so dramatic that it's worth spending significant resources in an attempt to prevent.
(For the record, and this is probably clear, I proudly consider myself a liberal on most issues, though not all; and on some issues that are important to me it's actually really not even clear what position, if any, can be said to be liberal or conservative. Things like drug policy and NSA-style privacy issues are unpopular with the mainstream of both parties now but have respectable support from both ends of the spectrum.)
-
RE: 🙅 THE BAD IDEAS THREAD
Not to mention
- Tested the pedestrian detection automated braking feature by driving it at someone.
Seriously, the only way I'd try that is if someone was in the driver's seat and I had previously tested on like a cardboard cutout or sometihng. And even then it'd be stupid.
-
RE: Measuring software for schools
This post is a couple days old, but I couldn't help:
@dkf said:Looks like they got off lightly. HF is where chemistry gets serious.
I trust anyone interested in this discussion of dangerous chemicals knows of "Things I Won't Work With"?I think this is my favorite entry:
In a comment to my post on putting out fires last week, one commenter mentioned the utility of the good old sand bucket, and wondered if there was anything that would go on to set the sand on fire. Thanks to a note from reader Robert L., I can report that there is indeed such a reagent: chlorine trifluoride. ... It is apparently about the most vigorous fluorinating agent known, and is much more difficult to handle than fluorine gas. That’s one of those statements you don’t get to hear very often, and it should be enough to make any sensible chemist turn around smartly and head down the hall in the other direction.
The compound also a stronger oxidizing agent than oxygen itself, which also puts it into rare territory. That means that it can potentially go on to “burn” things that you would normally consider already burnt to hell and gone, and a practical consequence of that is that it’ll start roaring reactions with things like bricks and asbestos tile.
...
There’s a report from the early 1950s (in this PDF) of a one-ton spill of the stuff. It burned its way through a foot of concrete floor and chewed up another meter of sand and gravel beneath, completing a day that I'm sure no one involved ever forgot. -
RE: C vs C++, from the author of ZeroMQ
Coming from the perspective of someone who mostly disagrees (I know of no program I would write in C instead of C++ unless there just isn't a moderately-reasonable C++ toolchain1), the second article only presents one side of the issue. In many cases, C++ abstractions not only have no overhead but can speed things up via the C-ish thing. For example, suppose you want to sort an array. C gives you
qsort
; C++ gives youstd::sort
. One of those is significantly faster than the other. (Hint: it's notqsort
.)1I would use different subsets of C++ in different situations, but never plain C.
-
RE: C vs C++, from the author of ZeroMQ
Wrong. GCC is able to inline some function pointer calls, eliminating indirection. And I believe Clang and MSVC can do it too.
Your statement is not wrong, but your conclusion is. GCC and others can inline calls through function pointers if they can determine what the target is, or speculatively optimize (including inlining) based on profiling information.But inlining the call to the comparison function requires that there be something to inline it into, and
qsort
is not available to the compiler or linker to do this, even with link-time optimization.If you don't believe me, then try it. Here it is with Ubuntu 14.04 and GCC 4.9 (not this isn't the default version of 14.04):
$ cat qsort.c #include <stdio.h> int compare(int* a, int * b) { return *b - *a; } int main() { static int elements[100] = {0}; qsort(elements, 100, sizeof(int), compare); return elements[0]; } $ gcc -flto -O3 qsort.c $ objdump --disassemble a.out | grep '<main>' -A10 0000000000400440 <main>: 400440: 48 83 ec 08 sub $0x8,%rsp 400444: b9 70 05 40 00 mov $0x400570,%ecx 400449: ba 04 00 00 00 mov $0x4,%edx 40044e: be 64 00 00 00 mov $0x64,%esi 400453: bf 80 10 60 00 mov $0x601080,%edi 400458: 31 c0 xor %eax,%eax 40045a: e8 b1 ff ff ff callq 400410 <qsort@plt> 40045f: 8b 05 1b 0c 20 00 mov 0x200c1b(%rip),%eax 400465: 48 83 c4 08 add $0x8,%rsp 400469: c3 retq
Note the call to
qsort@plt
at 0x40045A. The@plt
means it's doing a dynamic call, in this instance in toglibc
. (Guess what's not inlined in glibc's version?)If you're wondering if
-static
will change this, it doesn't:$ gcc -g -static -flto -O3 qsort.c $ gdb a.out --quiet Reading symbols from a.out...done. (gdb) b compare Breakpoint 1 at 0x4010a0: file qsort.c, line 5. (gdb) r Starting program: /<censored>/a.out Breakpoint 1, compare (a=0x6c0cc4 <elements+4>, b=0x6c0cc8 <elements+8>) at qsort.c:5 5 return *b - *a; (gdb) p $rip $1 = (void (*)()) 0x4010a0 <compare> (gdb) up #1 0x0000000000406fb1 in msort_with_tmp.part () (gdb) quit A debugging session is active. Inferior 1 [process 31349] will be killed. Quit anyway? (y or n) y $ objdump --disassemble a.out | grep '4010a0:' -B2 -A10 00000000004010a0 <compare>: 4010a0: 8b 06 mov (%rsi),%eax 4010a2: 2b 07 sub (%rdi),%eax 4010a4: c3 retq 4010a5: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) 4010ac: 00 00 00 4010af: 90 nop 00000000004010b0 <__libc_start_main>: 4010b0: 41 56 push %r14 4010b2: b8 00 00 00 00 mov $0x0,%eax 4010b7: 4d 89 c6 mov %r8,%r14 $ objdump --disassemble a.out | grep '406fb1' -B2 -A2 406fab: 4c 89 e7 mov %r12,%rdi 406fae: 41 ff d5 callq *%r13 406fb1: 85 c0 test %eax,%eax 406fb3: 7f cb jg 406f80 <msort_with_tmp.part.0+0x260> 406fb5: 41 8b 04 24 mov (%r12),%eax
See the
callq *%r13
at 0x406FAE? That's the indirect call tocompare
insideqsort
. -
RE: Windows 10 Tech Preview First Impressions
What I use multiple desktops for is so that I can have three or four things (including random web browsing) in flight at once, and easily change between them. I can be working on a couple editor windows on feature/bug #1, hit something I need to wait for (e.g. a long build or test run, or a code review to come back), then switch to feature/bug #2, switching to the same windows I have open and same positions as where I left off, without having to figure out which two of the 5 different editor windows and which console I was using last time I was working on it.
-
RE: 🐧 Lunix
Bash? Maybe ksh handles piping differently
The contents of the pipe are set by the program; the shell has nothing to do with it.find/xargs are just applications present in any *nix. And usually, when you find them together is a hack... Your doing it wrong™
And yet there are probably more examples of doing it wrong than there are of doing it right if you look around. And surprise surprise, not all filenames are produced byfind
or consumed byxargs
, and there sometimes isn't a way to do it right.or 30 years, using spaces in filenames has been a bad idea in *nix systems. That you don't know already to workaround those is another reason to stay away.
Ah yes, the "let's change our behavior to conform to a crappy system" viewpoint.And yet, nobody in the Linux world has any intention to develop a replacement for the shell.
I am, in fact, a nobody in the Linux world, but I am a heavy Linux user and buy into a lot of the Unix philosophy, though not all of it.I would love to write a replacement (i) shell and (ii) "terminal emulator" and (iii) set of replacement utilities (for some of coreutils and such). I have a pretty clear picture of what I want, and actually started working on (iii) a while back, but I have way more things that I would like to do than I actually have time and motivation to actually do.
-
RE: 🙅 THE BAD IDEAS THREAD
It was actually kind of funny, to say that one reason we fought fascism was so that an important document in fascism's most notorious incarnation could continue to be printed.
-
RE: Good bye Silverlight Road
My statement included Flash and Java Applets. What? Sad that another MS technology goes down the drain?
You said:
@Eldelshell said:On one part I'm happy to see the last remaining strains of proprietary crap on the browser burn in flames
But as @Gaska pointed out, Flash is far from anything close to dead. I run with something like Flash click-to-play, and I'd say it's almost a daily occurrence for me to have to enable it somewhere. And that's not counting the couple sites that I've whitelisted. I see more Flash sites on some days now than I have Silverlight sites ever. -
RE: Driving Anti-Patterns - Necro Edition
My turn signal pet peeve is people who deliberately do not use their turn signal because they are in a turn-only lane.
Because other cars always know the area well enough to know that you're in a turn only lane, and know that you know (and intend to respect) that you are in one. :eyeroll:
If someone doesn't use their signal as a rule, I view that as being a dipshit through laziness. Deliberately not using it in situations like that seems more like being a dipshit through malice... and even though it's not rational, the second feels worse at an emotional level. :-)
-
RE: Video game spotlight thread
SimCity
I picked up SimCity 2013 on the Origin sale a few days ago since they added offline mode a while back. I have such mixed feelings about it. Compared to SimCity 4, there is one major major advantage and one major major drawback, and I'm not sure which outweighs the other at this point. The advantage of 2013 is curved roads... which sounds like a gimmick, and maybe it is a little bit, but I am really loving the curved roads. You can make truly beautiful layouts now. The downside to curved roads, ironically enough, is 2013's major weakness, which is city size. I had heard complaints about this, but SimCity 4 had similar complaints and I didn't find that game to be all that bad, so I discounted them. I maybe shouldn't have. It is really really cramped; I find myself running out of space at like 30K residents or something, partially because of the aforementioned curved roads leading to somewhat inefficient space use. The space crunch is made worse by the lack of terraforming... if you've got a hill in the middle of your city, sucks to be you because that space won't be very usable. You can't even do minor controlled modifications to the terrain.
As much as I like them, every iteration of SimCity has had been dropped on its head a few times when it comes to some aspects, usually regarding traffic, and 2013 is no exception. (I think it keeps earlier versions' propensities for sims to take stupid, slightly-shorter, low-capacity routes instead of main throughfares even if the former are very congested.)
Some WTFs:
Train stations and ferry terminals come with their own attached roads for somewhat reasonable reasons; the building to the lower left is a train terminal. However, I can't connect the road to it with the main road to the upper right because they're too close and slightly off, or overlapping slightly (which shouldn't be possible) or something like that. That would have only been a minor WTF if I could delete a square of the road, but the dropped-on-its-head WTF is that you can't delete any of that road without destroying the placed building next to it. So that WTF train station placement cost me $15000, or something, at a time when that was a noticeable hit. Here's a cop car on the way to an emergency with lights an sirens (I caught the screenshot at a point in the cycle where the flashing lights were off) being blocked by a garbage truck as it stops at every house along that street, because as bad as real people are at yielding to emergency vehicles, sims are 100x worse. I'm not sure they _ever_ do. Don't ask me what is going on with that road. Fire truck A just finished putting out a fire at business B, which had spread to business C. Instead of, I dunno, walking next door or backing the truck up, the fire truck completely left the scene, drove to the end of the street (waiting in traffic, of course), turned around, drove past the fire to the _other_ end of the street, turned around again, then came back to the fire. This isn't a WTF, at least unless you don't like my city. :-) This is just me playing around with an explicit goal to try and make as few straight roads as I can; I thought I'd close on something I actually like about it.(You can see my very inefficient space use, though in my defense (1) this is far worse on that measure than my other "cities" and (2) a lot of that is an attempt to provide room for larger, higher-density buildings when I get around to providing for them, though I don't think I really have the road capacity and layout to support much on that line.)
-
RE: From the textbook that thought there was a java.io.OutputStreamReader
Meh. One crashes, one throws NULL pointer exceptions. Neither work due to a memory error. They just display different symptoms.
One throws NULL pointer exceptions in a deterministic, guaranteed manner. The other corrupts some random piece of data, runs for another five minutes, then gives you a wrong answer miles away from the source of the actual problem. -
RE: GNU coreutils `sort -u`
python might have some other reasons for yielding faster results
That's actually really interesting, and addingLC_ALL=C
helps a great deal.sort -u
takes 3.8 seconds andsort
takes 5.8 seconds, which argues against my earlier hypothesis.Python still wins though, by more than 3x.
(The numbers above are with
cat demo | sort
rather thansort demo
because they are actually faster.sort demo
takes 5.2 seconds, andsort -u demo
takes 6.2 seconds. So fun?)The question is, how else to grab unique values from a set. ... (which makes sense, but may be tough to implement) ...
Wut? I showed you how to do it in two lines including animport
! And it's demonstrably faster by several times, even after Python instead of C. And that's with next to zero effort on my part. Would a balanced tree be better? What about an array-based heap? Sorted array? How must faster could you get it ? Who knows!sort -u does exactly what sort | uniq does, assuming you don't have any special sorting comparison function. That's how it's defined.
That's... kind of my point. That's the WTF. One of the main reasons that the Unix approach of composing a bunch of small tools isn't always the right thing to do is because of performance. In this case, if I issuesort | uniq
thensort
can't know what the reader is going to do and has to sort. Butsort -u
has that knowledge. It can optimize! Why else put the-u
switch intosort
in the first place if I might as well just pipe it intouniq
? Because it saves three characters?And this ignores the fact that I would be mildly surprised if
uniq
was used (intentionally) without a sorted input (or other knowledge that if there are duplicates then they'll be adjacent), which means I'm not talking about an edge case but the common use case of uniquifying a file. -
RE: Do not compare Strings
People can't even agree what character(s) to use to end lines. Fancy things like field separators seem hopeless.
-
RE: More stupid Git errors THIS TIME IN FIRST-PERSON!
What conventions?
Git devs don't say "what conventions?"They pay very careful attention to the conventions, both used by other VCS tools and Git itself. Otherwise they wouldn't be able to disregard them!
-
RE: Sexiïst air conditioning
Do they also get Intel Pentium 4 HT Extreme Edition space heaters?
I did an internship at IBM literally a decade ago. There were three of us working on this project, and they put all three of us into this slightly larger room that used to house computer equipment. And because it used to have computer equipment, it was set up so that the room got a lot of cooling. Of course, once you remove the equipment it was incredibly cold. We would show up wearing jackets, and eventually they gave us a space heater. To run to compensate for the air conditioning. -
Evan complains about LibreOffice
Continuing the discussion from TRWTF is our corporate lodging provider:
(As an aside... God I hate OpenOffice. Anyone who says it matches MS Office obviously either hasn't used OpenOffice or hasn't used MSO.)
When making the semi-joking graph in the linked post, I ran across not one but two annoyances with LibreOffice Calc.The first is this wonderful bug:
I don't even know what is going on there. And it wasn't inherited from OpenOffice, or at least OpenOffice has fixed it and LibreOffice hasn't.
The second was I couldn't copy the graph as an image. I can't reproduce that now, so either they've fixed that in a pretty recent version or it doesn't work on Linux.
But instead of ranting about that I'll complain about Impress. Want to make a diagram with a right angle arrow like this?
Fine, Impress does that. But think that the arrow is too fat? Too bad, can't change it. Want to make it non-square?
<img src="/uploads/default/12737/25d3115bc3986cae.png" width="255 height="107">
Well, doesn't that look awful. (And no, that's not me messing with the width/height attributes to make it look screwy.)
For shits and giggles I installed Office 2002, which is the earliest version I have ready access to.
Let's see. Yep! PPT 2002 makes Impress latest look like crap:
(You can't copy an Excel graph as an image in that version though, sadly.)
And that's not even getting into the problems LO/OO have reading OOXML files.
I'm definitely not Blakeyrat in thinking that OSS is fundamentally flawed and all of it sucks and yadda yadda yadda, but man... I don't use office suites much, but every time I try to use Libre/OpenOffice it's just a stream of minor and not-so-minor frustrations.
-
RE: A prime example of why I tend to avoid *nix
Which kinda defeats the purpose of having a long-term-support, mammoth-shit-stable distribution in the first place. One easy make install turns any distro into Slackware.
The purpose of long-term stable distributions is so that you can keep running the same thing for a long time without changes, but still get security updates. If you want actual software upgrades, that's what the next version is for.