--- Log opened Fri Jun 07 00:00:36 2019 |
00:25 | | Kindamoody|afk is now known as Kindamoody |
00:51 | | sshine [simon@Nightstar-e7dcnn.com] has quit [Ping timeout: 121 seconds] |
00:56 | | sshine [simon@Nightstar-e7dcnn.com] has joined #code |
00:58 | | Kindamoody is now known as Kindamoody[zZz] |
01:05 | | himi [sjjf@Nightstar-1drtbs.anu.edu.au] has joined #code |
01:05 | | mode/#code [+o himi] by ChanServ |
01:34 | | celmin|away is now known as celticminstrel |
01:35 | <@celticminstrel> | Speaking of dead PCs, I wonder if there's a way to get this iPhone to boot. |
01:35 | <@celticminstrel> | Just for like, five minutes so I can look through and see if there's anything important on it. |
01:37 | <@celticminstrel> | I don't think anything important was added since I last backed it up (which was probably like, a year ago or something), but... |
02:29 | | McMartin [mcmartin@Nightstar-ipm463.ca.comcast.net] has quit [[NS] Quit: leaving] |
03:16 | | catalyst [Jessikat@Nightstar-5dv16h.cable.virginm.net] has quit [Connection reset by peer] |
03:30 | < Kizor> | Welp, finally figured out what that program from '79 is doingt with statements like IF (W(X,Y) AND 2) <> 0 |
03:33 | < Kizor> | It converts each side of AND into binary and performs an AND operation on both, digit by digit |
03:34 | | McMartin [mcmartin@Nightstar-ipm463.ca.comcast.net] has joined #code |
03:34 | | mode/#code [+ao McMartin McMartin] by ChanServ |
03:35 | < Kizor> | So (5 AND 2) -> (101 AND 010) = 0 while (19 AND 2) -> (10011 AND 00010) = 10 -> 2 |
03:36 | < Kizor> | Is it, uh. Is it common knowledge that you can do that with logical operators? |
03:36 | <&McMartin> | Correct. |
03:36 | <&McMartin> | Uh |
03:36 | <&McMartin> | What universe are we restricting to here |
03:36 | <&McMartin> | Amongst people who are aware that you can control individual bits within a larger number, and care about this, it's pretty well known |
03:37 | <&McMartin> | This is the usual way the subject is taught and used, even at the machine code level. |
03:37 | <&McMartin> | It is significantly rarer to refine something as an integer a few bits wide and then extract or toggle based on names. |
03:37 | <&McMartin> | Old versions of C permit this, but it's been played down over the years and at this point none of its successor languages permit it. |
03:38 | < Kizor> | "based on names"? |
03:40 | <&McMartin> | So, suppose I have three values, one that's a single bit at 128, one that's the 64, 32, and 16 bits, and then one that's the rest. |
03:40 | <&McMartin> | With bit-logic operations, I can get at them with & 0x80, & 0x70, and & 0x0F |
03:40 | <&McMartin> | That would be in something like structure { x: byte } |
03:41 | <&McMartin> | One could imagine instead doing something like structure { x: 1, y: 3: z: 4 } |
03:41 | <&McMartin> | And then just talking about x/y/z directly and your langugae runtime would do the bitmasking and shifting and stuff. |
03:41 | <&McMartin> | C technically has syntax for sort of doing that, but using it is not really recommended anymore |
03:41 | <&McMartin> | And languages like Java don't have it but *do* have the and/or tricks |
03:42 | <&McMartin> | C, Java, and similar languages also have different syntax for "if this is true and this is true" vs "compute the bitwise AND of these two values" |
03:42 | <&McMartin> | The first is && and the second is &. |
03:42 | <&McMartin> | And that's followed for || vs | as well. |
03:43 | <&McMartin> | ^ (toggle bits, or XOR) doesn't have a logical equivalent, and then ! is logical NOT while ~ is bitwise NOT. |
03:44 | <&McMartin> | ... all of which is very longwinded and doesn't answer your question, so, very like me |
03:44 | <&McMartin> | So |
03:45 | <&McMartin> | "The general bitwise operations you describe should be part of any formal programmer training: however, most languages currently in use have different spellings for the logical vs. the bitwise operators." |
03:46 | < Kizor> | And suddenly I get why you were piling syntax on me. Thanks for the answer. |
03:47 | <&McMartin> | But yeah. It'd come up when you were teaching "here are all the symbols that mean math operations" |
03:48 | <&McMartin> | And as a rule, each of those operations turns into a single machine instruction, too, so this goes all the way down to the metal |
03:50 | <~Vornicus> | (there's a good reason for these being single machine instructions: they're all *very* simple to implement in transistors) |
03:51 | <&McMartin> | (In fact, there are a few extras that often exist only as machine instructions and don't make it into the higher level languages) |
03:52 | <&McMartin> | (Like rotating bits left and right) |
03:52 | <~Vornicus> | (yay roll) |
03:52 | <&McMartin> | (Turn 00000101 into 10000010) |
03:52 | <&McMartin> | (Or actually mess with the carry bit but man status flags are a story for another day) |
03:53 | <~Vornicus> | Shift is commonly seen though - shift moves bits to the left or right and fills in the space, usually with 0 but in certain cases it can fill with 1s instead |
03:53 | < Kizor> | Pop up, push down, byte byte byte, etc. |
03:53 | <&McMartin> | Usually spelled << and >>. Sometimes >>> is used for "always fill with 0" if >> might not. |
03:53 | <&McMartin> | We aren't touching stacks at all |
03:53 | < Kizor> | Good thing too. So does shift make it into higher level languages? |
03:53 | <~Vornicus> | Shift does |
03:53 | < Kizor> | Cool |
03:54 | <~Vornicus> | >> and << are in C, Java, and Python; >>> is in Java |
03:54 | <&McMartin> | And you can build rotation out of shift, so no real power is lost |
04:01 | <~Vornicus> | (>> will fill with 1s for values where the highest-order bit is already 1. This has the effect of keeping negative values negative when 2's complement is used) |
04:02 | < Kizor> | (Huh) |
04:02 | < Kizor> | (I actually understood that) |
04:02 | < Kizor> | (What a weird feeling) |
04:02 | < Kizor> | (Thanks tho) |
04:17 | <@celticminstrel> | [Jun 06@10:43:10pm] McMartin: ^ (toggle bits, or XOR) doesn't have a logical equivalent, and then ! is logical NOT while ~ is bitwise NOT. |
04:17 | <@celticminstrel> | Yes it does: != |
04:18 | <@celticminstrel> | (I wonder if compilers are smart enough to optimize rotation-built-from-shift down to native rotation on the machine...) |
04:19 | <&McMartin> | No~ |
04:19 | <@celticminstrel> | Aww~ |
04:19 | <&McMartin> | That's where most of my gains when racing compilers came from |
04:19 | <@celticminstrel> | XD |
04:19 | <&McMartin> | Though if you're using larger data types it can start pulling in intrinsics. |
04:19 | <&McMartin> | If you do >> on a 64-bit value on a 32-bit chip it will absolutely do rotations if needed |
04:20 | <&McMartin> | Or use the wacky instractions that touch extra registers |
04:20 | <&McMartin> | x86 has this instruction that instead of doing fills of 0 or 1 starts taking bits from another register |
04:20 | <&McMartin> | So you can use that for multiwidth shifts |
04:20 | <&McMartin> | Er |
04:20 | <&McMartin> | multiword |
04:21 | <@celticminstrel> | But yeah I generally think of != as the logical equivalent of ^ |
04:21 | <@celticminstrel> | (Which I wish was not the symbol for XOR incidentally, it should've been assigned to pow instead. :/ ) |
04:22 | <@celticminstrel> | (Could've used @ or $ or even ~ for XOR!) |
04:32 | | celticminstrel [celticminst@Nightstar-6an2qt.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
05:22 | | himi [sjjf@Nightstar-1drtbs.anu.edu.au] has quit [Connection closed] |
06:10 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed] |
06:17 | | Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has joined #code |
06:17 | | mode/#code [+qo Vorntastic Vorntastic] by ChanServ |
08:40 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code |
08:40 | | mode/#code [+o himi] by ChanServ |
11:49 | | Degi [Degi@Nightstar-r260t6.dyn.telefonica.de] has joined #code |
12:45 | <@TheWatcher> | For the love of Eris, why the fuck does *anyone* use mongodb?! |
12:51 | <~Vorntastic> | What does it do that makes it so painful |
12:54 | <@TheWatcher> | Damn near everything, from the point of view of someone who uses relational databases, but from the point of view of a sysadmin it has to be one of the most fragile pieces of shit to upgrade in the world |
12:55 | <@TheWatcher> | mariadb, mysql, postgres? Piss easy to upgrade. I swear fucking mongo seems to shit itself every single time. |
13:28 | | Kindamoody[zZz] is now known as Kindamoody |
13:34 | | celticminstrel [celticminst@Nightstar-6an2qt.dsl.bell.ca] has joined #code |
13:34 | | mode/#code [+o celticminstrel] by ChanServ |
13:36 | | mode/#code [+o sshine] by ChanServ |
13:36 | <@sshine> | our "check password" function doesn't have a MAX_LENGTH, but our "set password" validator does (1KB). my boss doesn't want me to move that code to the "check password", since maybe some people log in using >1KB passwords created before ~2 years ago. |
13:37 | <@celticminstrel> | XD |
13:37 | <@celticminstrel> | Do people really use passwords longer than 1KB |
13:38 | <@sshine> | we have no indication that anybody does. |
13:38 | <@sshine> | :D |
13:38 | <@sshine> | extremely defensive programming. |
13:38 | <@celticminstrel> | Right, of course, if your passwords are stored securely, you'll never know right? |
13:39 | <@sshine> | we could do an 'if (length $password > MAX_PASSWORD_LENGTH) { log("Yeah, someone does actually do this."); }' without compromising anybody. |
13:39 | <@sshine> | s/do/does/ |
13:39 | <@sshine> | but I suspect we'd have to wait long. |
13:39 | <@celticminstrel> | True, true. |
13:50 | <@TheWatcher> | But you shouldn't be storing the password anywhere at all. You should be storing a salted, hashed version that is always a guaranteed length |
13:54 | <~Vorntastic> | You'd put the logging before the hashing |
13:54 | <~Vorntastic> | But, uh |
13:55 | <~Vorntastic> | Since there's only like 32-128 bytes of entropy, a kilobyte password won't help much in the first place |
13:57 | <@TheWatcher> | And it shouldn't matter what size the password is when entered, as long as it doesn't exceed your post limit (which is hopefully megabytes, not kilobytes), as you're just feeding it into a hasher with the user's salt to compare with the stored hash |
14:06 | | celticminstrel is now known as celmin|away |
14:09 | | Degi [Degi@Nightstar-r260t6.dyn.telefonica.de] has quit [Connection reset by peer] |
14:41 | <@sshine> | overheard conversation between boss and colleage on how to deal with salesmen at the firm who try to oversell: "Sometimes it's OK to say that 'No, you can't get shoes with wheels.'" |
14:42 | <@sshine> | TheWatcher, the web framework has a 4KB limit, but we lowered it to 1KB to avoid DoS attacks. |
14:42 | <@sshine> | TheWatcher, I don't think 1KB is based on anything experimental. |
15:15 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
15:15 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
17:00 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code |
17:07 | | Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity] |
17:20 | <&jerith> | TheWatcher: MongoDB is for people who don't actually want to store data. |
17:56 | | Kimo|autojoin [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has joined #code |
17:56 | | mode/#code [+o Kimo|autojoin] by ChanServ |
17:56 | | Kindamoody [Kindamoody@Nightstar-eubaqc.tbcn.telia.com] has quit [Connection closed] |
17:57 | | Kimo|autojoin is now known as Kindamoody |
18:04 | <@TheWatcher> | And yet, some people seem to try |
18:07 | <&jerith> | Perhaps they like writing queries in JavaScript. |
18:11 | <@TheWatcher> | node.js apps using mongo, so yes! |
18:12 | <@TheWatcher> | (I seethe with hatred) |
18:25 | | catalyst [Jessikat@Nightstar-5dv16h.cable.virginm.net] has joined #code |
19:07 | <&McMartin> | MongoDB only pawn in game of life |
19:11 | <~Vornicus> | I have always vaguely wanted to run into a system I need to fix that's running Mongo just so I could say "oh shit it's Mongo" but the stupid joke only lasts four words and then I'd probably start swearing at it for real |
19:56 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed] |
22:49 | | Degi [Degi@Nightstar-r260t6.dyn.telefonica.de] has joined #code |
23:09 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds] |
--- Log closed Sat Jun 08 00:00:38 2019 |