|
Pseudo-code recreation of something I found yesterday.code:
|
# ? Sep 5, 2014 10:49 |
|
|
# ? Jun 8, 2024 05:49 |
|
"Use a loop? What for? I don't have any arrays!"
|
# ? Sep 5, 2014 12:38 |
That "throw an error using another error" thing is all to prevalent in our code here. No, no, I didn't want the stack trace, that's fine... But hey, at least he's disconnecting the users after they fail to connect!
|
|
# ? Sep 5, 2014 16:00 |
|
To give the benefit of the doubt, the disconnect_user() function might be doing some cleanup, but it annoys the poo poo out of me that they come after the connect_to_thing() functions.
|
# ? Sep 5, 2014 16:25 |
|
Snapchat A Titty posted:To give the benefit of the doubt, the disconnect_user() function might be doing some cleanup, but it annoys the poo poo out of me that they come after the connect_to_thing() functions. In this context it's purely because you have to connect as a user to disconnect other users. I can't decide which bit is worse here. I just really hate this guy's tendency to catch an exception and re-throw it. Or worse, leave it blank and let the thing fail silently!
|
# ? Sep 5, 2014 16:41 |
|
Had to fix some javascript code from our old VB.NET solution. It's a page made up of multiple iFrames, and the scrolling container for one of the iframes was not being reset correctly after some HTML was removed from it. We don't do this type of iFrame poo poo anymore, but until we can rewrite these pages into C# we're stuck. So while trying to figure out what was going on, I saw this. code:
I don't know what's with the hardcoded "10" pixels either. I'm guessing that's meant to compensate for the toolbar? Who knows . Also we had framework and an enum for the users browser. Yet here they just went the hardcoded approach. Thanks guys!
|
# ? Sep 5, 2014 17:16 |
|
I used to work in an area where a new team was started by grabbing a bunch of self-proclaimed "wizards" from a bunch of other teams. They were writing a massive, over-engineered, overly-complex system which would produce XML-but-not-really as its endpoint. I was supposed to do some of the initial design for how these XML files would be parsed and stored. When I asked for schemas, I was told "we don't have any and aren't going to make any, just look at some of the files on disk in the development environment and use them as examples". When I told them this was a totally inappropriate way for me to attempt to write a design and that it wasn't going to be accurate or reliable enough, they complained that I was "difficult to work with". Since this team was a bunch of wizards, I of course lost this fight. It was a great area to work in. I eventually churned out a garbage, gibberish design for the sake of having produced one, and left the area forever.
|
# ? Sep 8, 2014 17:01 |
|
Java code:
Java code:
Java code:
Java code:
|
# ? Sep 9, 2014 18:50 |
|
Zorro KingOfEngland posted:Comments are mine. One exception shows up in the log 6 times, in slightly different forms. I was trying to speed up a server of mobile phone (at the time, mostly WAP) applications in the early 2000s. I discovered, at one point, that through logging of this sort one single WAP request would generate around 10MB of debugging information...
|
# ? Sep 9, 2014 19:19 |
|
Excessive logging is a pain in the rear end. How about you write normal software and maybe a test or two instead of filling every single method with log calls? One particularly bad component I had to work with was actually logging every method start/end and parameters for each function. 80% of code in that thing was logging.
|
# ? Sep 9, 2014 20:08 |
|
IMlemon posted:Excessive logging is a pain in the rear end. How about you write normal software and maybe a test or two instead of filling every single method with log calls? One particularly bad component I had to work with was actually logging every method start/end and parameters for each function. 80% of code in that thing was logging.
|
# ? Sep 9, 2014 22:52 |
|
awesmoe posted:Did you know that if you have too much logging, you can turn it off with your logging config, but if you have too little logging, you can't turn it on? makes u think... But what if you have no logging config?
|
# ? Sep 9, 2014 23:12 |
|
Westie posted:But what if you have no logging config?
|
# ? Sep 10, 2014 00:16 |
|
awesmoe posted:cat logfile | grep -v spam1 | grep -v spamline2 |grep -v "line you think is spam but is actually vital" That made me laugh way more than it should have done.
|
# ? Sep 10, 2014 08:59 |
|
Walked into work this morning to see this email.like, my manager or something posted:I'm guessing there was a wholesale reload of the derpderpderp table recently. I had fixed/populated several derps and now all of that is gone. I'll fix it again, but we need to avoid wholesale replacement of production tables unless its agreed that a table can be replaced. Why yes, I did just update the table, from DEV, yesterday. ...Sorry...?
|
# ? Sep 10, 2014 14:10 |
|
IMlemon posted:Excessive logging is a pain in the rear end. How about you write normal software and maybe a test or two instead of filling every single method with log calls? One particularly bad component I had to work with was actually logging every method start/end and parameters for each function. 80% of code in that thing was logging. This is how we write software but mainly because a lot of times it's literally the only thing you get from a customer that's useful. The more information in the logs, the better. Sometimes I'll run into code where there's maybe 5 log lines in the file and it's loving worthless. Just keep the logging level turned down during peacetime and there's no problem.
|
# ? Sep 10, 2014 17:59 |
|
ijustam posted:This is how we write software but mainly because a lot of times it's literally the only thing you get from a customer that's useful. The more information in the logs, the better. Sometimes I'll run into code where there's maybe 5 log lines in the file and it's loving worthless. Just keep the logging level turned down during peacetime and there's no problem. To add fuel to this fire, logging can help you discover the multi threading bugs in a way that is hard to reproduce with unit tests. That said, it is good to setup good logging levels and not log everything. IMlemon posted:Excessive logging is a pain in the rear end. How about you write normal software and maybe a test or two instead of filling every single method with log calls? One particularly bad component I had to work with was actually logging every method start/end and parameters for each function. 80% of code in that thing was logging. There is nothing wrong with this. There are even methods for moving these log statements where they are separate from the business logic. Finally, for some platforms (embedded), logs like this can be one of the few ways to find bugs. HFX fucked around with this message at 18:23 on Sep 10, 2014 |
# ? Sep 10, 2014 18:20 |
|
Notch is a genius; he's manage to monetize coding horrors: http://games.slashdot.org/story/14/09/09/2334235/report-microsoft-to-buy-minecraft-studio-for-2bn That's like, at least $5 for each horror
|
# ? Sep 10, 2014 18:56 |
|
I did this for prestashopquote:UPDATE `product_lang` SET `link_rewrite` = REPLACE( TRIM( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( TRIM(LOWER(`name`)) , 'ą', 'a') , 'ć', 'c') , 'ę', 'e') , 'ł', 'l') , 'ń', 'n') , 'ó', 'o') , 'ś', 's') , 'ż', 'z') , 'ź', 'z') , '-', ' ') , '(', ' ') , ')', ' ') , ';', ' ') , ':', ' ') , ',', ' ') , '.', ' ') , '/', ' ') , '!', ' ') , '+', ' ') , '*', ' ') , '\'', ' ') , '"', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') , ' ', ' ') ) , ' ', '-');
|
# ? Sep 10, 2014 19:39 |
|
I think you just completely changed my opinion about the utility and readability of regular expressions.
|
# ? Sep 10, 2014 19:47 |
|
Too bad it's mysql.quote:Currently REPLACE function does not support regular expression so if you need to replace a text string by a pattern you need to use MySQL user defined function (UDF) from external library, check it out here MySQL UDF with Regex
|
# ? Sep 10, 2014 19:55 |
|
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near <line after the actual error> on line whatever. Pleb.
|
# ? Sep 10, 2014 21:14 |
|
Drastic Actions posted:Had to fix some javascript code from our old VB.NET solution. It's a page made up of multiple iFrames, and the scrolling container for one of the iframes was not being reset correctly after some HTML was removed from it. We don't do this type of iFrame poo poo anymore, but until we can rewrite these pages into C# we're stuck. This is my favorite if-else block in the entire world. I'm a pretty lovely programmer but man, I've at least never done poo poo like that. I mean, how does one not even see that the whole block will literally do the same exact thing?
|
# ? Sep 11, 2014 09:46 |
|
Well, it appears to be JavaScript, so I can certainly imagine them going "search and replace and gently caress it, ship it". Perhaps there was something else in there that they replaced but they never looked at the code? That seems to be how most people operate on horrible codebases - just do something and if it seems to work, go with it.
|
# ? Sep 11, 2014 10:40 |
|
I need to unsubscribe from the /r/javascript subreddit, it only makes me angry. http://node-os.com/
|
# ? Sep 11, 2014 17:28 |
|
Cheekio posted:I need to unsubscribe from the /r/javascript subreddit, it only makes me angry. https://github.com/NodeOS/NodeOS/issues/7
|
# ? Sep 11, 2014 18:51 |
|
Cheekio posted:I need to unsubscribe from the /r/javascript subreddit, it only makes me angry. The little gobshite's got no loving clue what it takes to make an operating system. He's layered /usr/bin/env and /etc/resolv.conf lower than the C library, which he just copies wholesale out of the host operating system, not even tracing the dependencies from the node.js binary he just built. Now, what he should've done is build a minimal libc like musl, and statically link against that. If you need env too, you can build the one out of busybox.
|
# ? Sep 11, 2014 20:29 |
|
pliable posted:This is my favorite if-else block in the entire world. I'm a pretty lovely programmer but man, I've at least never done poo poo like that. Maybe they copied and pasted the return iframe.contentWindow.document.body.scrollHeight; line but forgot to modify the pasted version. Maybe a codebase-wide find/replace operation made those two blocks identical when they weren't before. People overlook things. It happens.
|
# ? Sep 11, 2014 20:42 |
|
There was going to be a psyduck with his head exploding here, but at this point I've just given up.
|
# ? Sep 11, 2014 21:44 |
|
Edison was a dick posted:The little gobshite's got no loving clue what it takes to make an operating system.
|
# ? Sep 11, 2014 21:50 |
|
ultramiraculous posted:There was going to be a psyduck with his head exploding here, but at this point I've just given up. If they want sharding like that, they should probably make their OS image an initramfs, stick Ceph tools in there, authenticate with a Ceph server, and mount the filesystem from that. Soricidus posted:I am shocked, shocked, to discover that the guy who thinks it would be a good idea to base an OS on Javascript is not a highly-skilled engineer. I'm only paying attention to this, because the last time my boss heard of something like this I had to explain how it worked and why we shouldn't do it. Edison was a dick fucked around with this message at 21:59 on Sep 11, 2014 |
# ? Sep 11, 2014 21:55 |
|
If you're looking to make an OS that's primarily driven by JavaScript, and you don't start from either ChromeOS or FirefoxOS, I think you might be making a mistake (in addition to other, higher-level mistakes). "psyduck" would be a good project name for this thing, though.
|
# ? Sep 11, 2014 21:58 |
Yeah just remove everything between your commas there. Although I assume that's what your statement in parenthesis is referring to.
|
|
# ? Sep 11, 2014 22:29 |
|
Subjunctive posted:If you're looking to make an OS that's primarily driven by JavaScript, and you don't start from either ChromeOS or FirefoxOS, I think you might be making a mistake (in addition to other, higher-level mistakes). I get the appeal of writing your userland in your favourite language, and stripping out the bits of the operating system you're not going to use (such as your shell interpreter if you're only ever going to interact with the system via the web application, and you've managed to build an entire software stack that avoids calling system()). I've heard of projects successfully doing this with Lua. Hell, the MirageOS guys went the next step along and embed the applications in the kernel, completely ignoring any userland. But Node.js is completely unsuitable for system software, it's just happening because Node's trendy. I just hope it doesn't catch on, since we could end up with clueless idiots wading into the already pretty moronic init system debate.
|
# ? Sep 11, 2014 22:31 |
|
Edison was a dick posted:I just hope it doesn't catch on
|
# ? Sep 11, 2014 22:49 |
|
Fortunately there's a self-selection thing going on here. The folks experienced and competent enough to implement an operating system will recognize that it makes no sense to reinvent the wheel and will just contribute to Chrome OS, Firefox OS, Open webOS or whatever. The only folks who think this effort is a good idea will derail themselves long before they can make any actual progress. As a bonus, it keeps the trendy incompetents from noising up mailing lists of decent projects.
|
# ? Sep 12, 2014 00:19 |
|
Then all the experienced folks die off and we're left with a bevy of talent squandered on frontends like moths to a flame.
|
# ? Sep 12, 2014 01:15 |
|
Some bevies are really better off squandered.
|
# ? Sep 12, 2014 01:18 |
|
I wonder if you could build an OS in Inform 7.
|
# ? Sep 12, 2014 01:22 |
|
|
# ? Jun 8, 2024 05:49 |
|
Dr. Stab posted:I wonder if you could build an OS in Inform 7. Given the ratio of discussion to code on the Node-OS github I'd guess it would look more or less identical.
|
# ? Sep 12, 2014 01:30 |