|
Melonhead posted:What the hell is a Unicode keyboard? I am imagining a keyboard with over 100,000 buttons here. Additional characters: \ _ ¨ ¯ × ÷ ← ↑ → ↓ ∆ ∇ ∘ ∣ ∧ ∨ ∩ ∪ ∼ ≠ ≤ ≥ ≬ ⊂ ⊃ ⌈ ⌊ ⊤ ⊥ ⋆ ⌶ ⌷ ⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇ ⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏ ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗ ⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧ ⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯ ⍰ ⍱ ⍲ ⍳ ⍴ ⍵ ⍶ ⍷ ⍸ ⍹ ⍺ ⎕ ○ Let's stick to ASCII.
|
# ? May 17, 2008 01:01 |
|
|
# ? Apr 29, 2024 10:03 |
|
Milde posted:Anything but ASCII in source code is infuriating as hell though. Back in like 2002 when I was still following Perl 6 development, they had decided that several operators would be Unicode characters. ...I wonder if they ever changed their minds.
|
# ? May 17, 2008 01:29 |
|
biznatchio posted:Back in like 2002 when I was still following Perl 6 development, they had decided that several operators would be Unicode characters. Python 3.0 will be allowing non-ASCII characters in identifiers, which I think is crazy enough. I don't know if it has proven itself not to be that much of a detriment in C#, but it irks me out thinking about not being able to easily edit someone else's code because it has characters that I can't type. It could just be that I have a bias with English being my native language, but I do write in other languages that use characters that aren't on my keyboard (I use my compose key for that) and I can't imagine ever wanting special characters in my source code either way - I'd just as rather type out escape codes for them. I do like writing translation files in UTF-8 though. But honestly I wouldn't be surprised at Perl doing something like that.
|
# ? May 17, 2008 02:02 |
|
Scaevolus posted:I bet he means an APL keyboard. And I have to learn APL. Wish me luck.
|
# ? May 17, 2008 06:15 |
|
TRex EaterofCars posted:As for the rest of that, I can't wait for Unicode keyboards. Using proper symbols would be a godsend, not some ==== bullshit. I know you can do Unicode in C# but typing in the codes is a pain in the dick.
|
# ? May 17, 2008 12:16 |
|
My Internet Programming module (which was bollocks ) had an assignment of implementing a traditional game that you'd usually find in a Sunday newspaper or something. A friend of mine implemented a stamp game with rules something like: - There are 12 stamps in a 4x3 grid - You have to select combinations of 4 stamps, but they need to be connected to each other. For example 1,2,3,7 is a combination. So it seems pretty simple right (probably the simplest out of the selection); a method to check whether the 4 selected stamps were connected and if it had been found before? Wrong... She manually entered every combination of 4 into its own ArrayList even though we hadn't been givin the combinations. To make it worse every time she called sequenceCheck() (basically every time a button was pressed) she instantiated 65 seperate ArrayLists with the combinations in them rather than just having them set up in the constructor or something. The garbage collector must have been having a panic attack. It ended up being something like 2,500 lines even though it should have been 200 or so.
|
# ? May 17, 2008 12:43 |
|
Scaevolus posted:I bet he means an APL keyboard. Look at all those beautiful, succinct glyphs... just waiting to be used
|
# ? May 17, 2008 17:36 |
|
TRex EaterofCars posted:Look at all those beautiful, succinct glyphs... just waiting to be used Trying to find a bug when someone typed [233D] instead of [2330] is going to be fun.
|
# ? May 17, 2008 17:47 |
|
This snippet comes from the clusterfuck known as GPUFFTW:code:
|
# ? May 25, 2008 08:04 |
|
Milde posted:A keyboard with a compose key? Maybe four or five different compose keys? Might as well have a bigass knob that goes from 0-255. If you want to call a variable א, just set the knob to 05 and you're good to go!
|
# ? May 25, 2008 08:18 |
|
Found very late in a project, just before it was to be released.code:
Another bit from an ex-programmer: code:
|
# ? May 26, 2008 00:18 |
|
Evis posted:
Sorry if I'm being a bit groggy here, but what's wrong with a switch in a for statement?
|
# ? May 26, 2008 03:35 |
|
MORE CURLY FRIES posted:Sorry if I'm being a bit groggy here, but what's wrong with a switch in a for statement? Just write them sequentially instead since all that code does is call case 0 and then case 1, but in an obfuscated manner.
|
# ? May 26, 2008 03:37 |
|
MORE CURLY FRIES posted:Sorry if I'm being a bit groggy here, but what's wrong with a switch in a for statement?
|
# ? May 26, 2008 10:30 |
|
Sadly, this is almost too common to be worth mentioning. But look:code:
code:
code:
Vanadium posted:Why did you instantiate the enum then? Oops, forgot "typedef". JoeNotCharles fucked around with this message at 22:12 on May 29, 2008 |
# ? May 29, 2008 21:13 |
|
Why did you instantiate the enum then?
|
# ? May 29, 2008 21:49 |
|
JoeNotCharles posted:
This reminds me of my very early Java days before I was entirely clear on the concept of static members
|
# ? May 29, 2008 22:07 |
|
Scaevolus posted:I bet he means an APL keyboard. No way. I want intersection/union glyphs. I've been typing .contains and .concat for 12 goddamn years like some kind of loving caveman. It's 2008, let's start acting like it people.
|
# ? May 29, 2008 22:50 |
|
rotor posted:No way. I want intersection/union glyphs. I've been typing .contains and .concat for 12 goddamn years like some kind of loving caveman. It's 2008, let's start acting like it people. Agreed. We don't need a full whacko APL keyboard, but it would be pretty nice to at least have characters for basic set operations (intersect, union, subset, superset), and a single glyph for -> on normal keyboards. I'd even be happy with settling for a bigraph for subset-or-equal and superset-or-equal.
|
# ? May 29, 2008 22:59 |
|
Smackbilly posted:Agreed. We don't need a full whacko APL keyboard, but it would be pretty nice to at least have characters for basic set operations (intersect, union, subset, superset), and a single glyph for -> on normal keyboards. I'd even be happy with settling for a bigraph for subset-or-equal and superset-or-equal. I'm also excited about Fortress, though it seems way more trouble than it's worth. take boat fucked around with this message at 23:38 on May 29, 2008 |
# ? May 29, 2008 23:35 |
|
Smackbilly posted:Agreed. We don't need a full whacko APL keyboard, but it would be pretty nice to at least have characters for basic set operations (intersect, union, subset, superset), and a single glyph for -> on normal keyboards. I'd even be happy with settling for a bigraph for subset-or-equal and superset-or-equal. Python would like a word with you.
|
# ? May 30, 2008 14:58 |
|
deimos posted:Python would like a word with you. I'd like a word with python.
|
# ? May 30, 2008 15:55 |
|
TRex EaterofCars posted:I'd like a word with python. My python has a word: huge.
|
# ? May 30, 2008 17:06 |
|
StickGuy posted:This snippet comes from the clusterfuck known as GPUFFTW:
|
# ? May 30, 2008 18:52 |
|
schnarf posted:If this is in the FFT where I think it is, then this isn't uncommon. It's probably being used for doing an inverse FFT if necessary. This is because the inverse FFT is almost exactly the same as the forward FFT, you just flip the sign of the imaginary part, I believe. Except: cos(-sign*2*pi/(4.0)) = 0 sin(-sign*2*pi/(4.0)) = -sign when sign = -1,1
|
# ? May 30, 2008 22:27 |
|
More horrors from the endless chest of horrors that is Progress 4GL (this is a rant): Error handling in Progress 4GL: I have been tasked with designing a system for creating automated QA tests for our application. Unit tests are not possible, so I have created a "workflow"-based testing system which records user-interface events (which are sent from a thin client to the server) and plays them back later. These scripts are recorded as new 4GL procedure files (it's is an interpreted language), which the QA team can modify to directly query the database in the middle of the script for various purposes. In the right hands, it might actually work. As part of this, I need to detect errors in the program and store them in a log file. Now, capturing problems with the user-interface (missing fields or messages) is easy - however, Progress's own internal error systems are rear end. Here's the breakdown: Progress procedures are either "internal" or "external". An external procedure is a physical ".p" file in the file system, which contains a sequence of progress commands. An internal procedures is a declared Procedure within an external procedure (internal procedures cannot be nested). The syntax looks like this: code:
code:
Now, lets look at the following code: code:
1.) log the error to the log file ("Mismatched Parameters") 2.) The "RUN my-procedure" statement raises the ERROR condition inside of "error.p". 3.) error.p sees the ERROR condition. 4.) error.p rolls back its database transaction, and returns to test.p Without raising the ERROR condition in test.p. 5.) test.p continues on, with no indication that error.p experienced an error. That's right: ERROR conditions do not propagate up the stack by default. If any statement returns an "ERROR" condition, by default the containing block simply rolls back its transaction and returns normally. This is horrible. If, for some crazy reason, you would need to reliably propagate errors to the top of the call stack, here are your two options: code:
Note that the above code does NOT suppress errors that occur within "my-procedure" - it only occurs if the "RUN" statement actually fails to execute, or if "my-procedure" explicitly calls RETURN ERROR. Therefore, you must repeat this process for every single statement in the program. Here is the other method I came up with, which could possibly take less to implement: code:
If you want an indication of WHAT error actually occured, instead of always using RETURN ERROR, you could also give every procedure in the system a "success" output parameter. This is, of course, a practical and excellent solution. So there you go, Progress provides two excellent error-handling options: #1.) Check for errors explictly throughout your program #2.) Ignore errors within the program entirely and manually check your log file later to see if anything bad happened. Guess which one our system is using? -_-
|
# ? May 31, 2008 21:16 |
|
Gumbercules posted:Note that the above code does NOT suppress errors that occur within "my-procedure" - it only occurs if the "RUN" statement actually fails to execute, or if "my-procedure" explicitly calls RETURN ERROR. Therefore, you must repeat this process for every single statement in the program. Sounds like this would be pretty easy to automate, though - just run your code through a filter that adds the error check after every statement.
|
# ? May 31, 2008 21:24 |
|
JoeNotCharles posted:Sounds like this would be pretty easy to automate, though - just run your code through a filter that adds the error check after every statement. Despite difficulties parsing this language and automating something like that, the real problem is simply that the code would become slow and unreadable at that point. Not that it isn't unreadable already. Gumbercules fucked around with this message at 02:46 on Jun 1, 2008 |
# ? Jun 1, 2008 00:36 |
|
Not a specific piece of code per se, but a sadly not-uncommon practice I've seen.developer assigned to take my place on old project posted:The query returns 70 rows – when I put a DISTINCT on the query it brings back 35 – that removes the dupes...is there more to this issue?? Sadly, people think the only way to eliminate rows that give you duplicate data is to use DISTINCT. Surely we couldn't have messed up some other constraint, right? Like a JOIN or WHERE or GROUP BY or HAVING or anything else, right? Just slap a DISTINCT on there!
|
# ? Jun 2, 2008 19:02 |
|
We should just rename DISTINCT to FIX.
|
# ? Jun 2, 2008 19:33 |
|
The javascript embedded in http://www.rockband.com resizes your browser. I thought we got past this years ago
|
# ? Jun 3, 2008 00:45 |
|
Chain Chomp posted:The javascript embedded in http://www.rockband.com resizes your browser. I thought we got past this years ago Even worse, when you're watching shows on http://www.southparkstudios.com full screen* it will resize your browser for commercials and then resize it back again for full screen, but never maximized even if it started that way. *not really full screen, just the biggest it can fit in your browser window
|
# ? Jun 3, 2008 14:48 |
Is there a reason someone would writecode:
code:
|
|
# ? Jun 3, 2008 15:05 |
|
Jo posted:Is there a reason someone would write I'd guess the latter involves a division which is a rather lengthy operation, whereas the former is just bit juggling. Isn't (num & 1)==0 even simpler? I'm not sure the former is doing the right thing at all.
|
# ? Jun 3, 2008 15:18 |
|
Jo posted:Is there a reason someone would write http://aggregate.org/MAGIC/#Is%20Power%20of%202 The second one is testing for an even number, so the tests are not the same.
|
# ? Jun 3, 2008 15:33 |
|
heeen posted:I'd guess the latter involves a division which is a rather lengthy operation, whereas the former is just bit juggling. (num & 1)==0 is correct. What he posted in his example is incorrect. code:
|
# ? Jun 3, 2008 15:36 |
|
Chain Chomp posted:The javascript embedded in http://www.rockband.com resizes your browser. I thought we got past this years ago Is there a good reason to enable JavaScript's ability to resize windows? Firefox lets you disable it (under "Advanced" next to "Enable JavaScript" in the Content tab of your preferences)
|
# ? Jun 4, 2008 01:37 |
|
GtkRadiant is a monstrous clusterfuck of code. Individual snippets don't really do it justice since it's basically one overthought design decision after another. It's some bloated new APIs layered on top of the Q3Radiant code which is an upgrade to QERadiant which was an upgrade to QE4. I'm not sure what the Windows Me source code looked like, but I think I have an idea now. "Hey guys, how should we relay console output from the tools to the editor feedback window? Using the native piping stuff sounds like a good idea, right?" "NO, WE MUST MAKE THE EDITOR SPAWN A SERVER AND HAVE THE MAP COMPILER CONNECT TO IT AND SEND THEM OVER TCP!" "Well that sounds slightly bloated, might be useful for remote compilation. So it'll just send raw strings?" "NO YOU FOOL, WE SHALL SEND THEM PACKAGED IN XML!" "You mean we're going to stuff strings into XML tags to send them via TCP, which is the only thing the map compiler will be sending over TCP, and parse them out of the XML string when it's received." "YES!!" "OK. So what about plug-ins? The current API is pretty good, let's just add a few functions to that and--" "NO! WE WILL CREATE AN ELABORATE AND CONFUSING API DERIVED FROM COM+! AND IT MUST USE XML!" ".... anything else?" "YES! WE WILL CHANGE RANDOM CONTROLS AND FEATURES TO WORK LIKE MAYA! AND CONVERT THE MAP FORMAT TO XML!" A little closer to the goal though: q3map2 has some nice features, except it's bloated and whoever wrote the lighting code really needs to learn how to split their functions up better. https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk/tools/quake3/q3map2/light_ydnar.c https://zerowing.idsoftware.com/svn/radiant/GtkRadiant/trunk/tools/quake3/q3map2/lightmaps_ydnar.c IlluminateRawLightmap: 666 lines of code StoreSurfaceLightmaps: 1024 lines of code OneEightHundred fucked around with this message at 06:05 on Jun 4, 2008 |
# ? Jun 4, 2008 05:56 |
|
Holy poo poo, ydnar. There is a name I have not seen in years. http://www.ydnar.com/ http://www.shaderlab.com/ Marathon fans (all seven of you) in the room may recognize the name. Mikey-San fucked around with this message at 06:39 on Jun 4, 2008 |
# ? Jun 4, 2008 06:35 |
|
|
# ? Apr 29, 2024 10:03 |
|
ashgromnies posted:(num & 1)==0 is correct. if( ((num-1) & (num)) == 0 ) is not a test for evenness, it's checking for if num is a power of two. It is however slightly incorrect in that zero is incorrectly considered to be a power of two, I think this can be used to fix that: if(!(num & (num - 1)) && num )
|
# ? Jun 4, 2008 07:09 |