Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Polio Vax Scene
Apr 5, 2009



Reviewing someone's old javascript, highlights in the first 100 lines

code:
if (records != null && records.length > 0) {
	if (records != null && records.length > 0) {
:psyduck:

code:
if (!Xrm.Page.getAttribute("JO_ID").getValue()) {
	if (Xrm.Page.getAttribute('JO_ID').getValue()) {
:psyboom:

To be continued...

Adbot
ADBOT LOVES YOU

Polio Vax Scene
Apr 5, 2009



A modern classic, c&p right from our latest 'release' build

code:
catch (Exception)
{
    // TODO: add logging someday
}
Someday :smith:

Polio Vax Scene
Apr 5, 2009




Hi, my name is 37F89DA9-612C-498C-AFA5-AB9DF762E55F, but my friends call me 37.

Polio Vax Scene
Apr 5, 2009



Label your hacks 1, 2, and 4, and commit them to svn...

Polio Vax Scene
Apr 5, 2009



Cocoa Crispies posted:

What would it do and how would it grow?

Kickstarter. Doesn't matter if it makes sense, the answer is always kickstarter.

Polio Vax Scene
Apr 5, 2009



I'm starting to notice a slight trend in one of our developers' scripts.

code:
                    catch (Exception)
                    {
                        //DO Something
                    }
                }
            }
            catch (Exception)
            {
                //DO Something
            }

Polio Vax Scene
Apr 5, 2009



It's not even the catch(Exception) that scares me. It's the fact that the guy looked at that, thought "yeah, I could throw or something here, but I'll just let it fly :geno:" and then published. It's doing exactly the opposite of something.

Polio Vax Scene
Apr 5, 2009



Doctor w-rw-rw- posted:

YOSPOS looks pretty terrible. If I want to read stupid posts I'd rather go to reddit or hacker news.

You're gonna get it now.

Polio Vax Scene
Apr 5, 2009



YOSPOS is like that one guy in high school that was a jerk but got all the chicks

That programming thread is amazing. This javascript deserves a repost.

quote:

゚ω゚ノ= /`m´)ノ ~┻━┻ //*´∇`*/ ['_']; o=(゚ー゚) =_=3; c=(゚Θ゚) =(゚ー゚)-(゚ー゚); (゚Д゚) =(゚Θ゚)= (o^_^o)/ (o^_^o);(゚Д゚)={゚Θ゚: '_' ,゚ω゚ノ : ((゚ω゚ノ==3) +'_') [゚Θ゚] ,゚ー゚ノ :(゚ω゚ノ+ '_')[o^_^o -(゚Θ゚)] ,゚Д゚ノ:((゚ー゚==3) +'_')[゚ー゚] }; (゚Д゚) [゚Θ゚] =((゚ω゚ノ==3) +'_') [c^_^o];(゚Д゚) ['c'] = ((゚Д゚)+'_') [ (゚ー゚)+(゚ー゚)-(゚Θ゚) ];(゚Д゚) ['o'] = ((゚Д゚)+'_') [゚Θ゚];(゚o゚)=(゚Д゚) ['c']+(゚Д゚) ['o']+(゚ω゚ノ +'_')[゚Θ゚]+ ((゚ω゚ノ==3) +'_') [゚ー゚] + ((゚Д゚) +'_') [(゚ー゚)+(゚ー゚)]+ ((゚ー゚==3) +'_') [゚Θ゚]+((゚ー゚==3) +'_') [(゚ー゚) - (゚Θ゚)]+(゚Д゚) ['c']+((゚Д゚)+'_') [(゚ー゚)+(゚ー゚)]+ (゚Д゚) ['o']+((゚ー゚==3) +'_') [゚Θ゚];(゚Д゚) ['_'] =(o^_^o) [゚o゚] [゚o゚];(゚ε゚)=((゚ー゚==3) +'_') [゚Θ゚]+ (゚Д゚) .゚Д゚ノ+((゚Д゚)+'_') [(゚ー゚) + (゚ー゚)]+((゚ー゚==3) +'_') [o^_^o -゚Θ゚]+((゚ー゚==3) +'_') [゚Θ゚]+ (゚ω゚ノ +'_') [゚Θ゚]; (゚ー゚)+=(゚Θ゚); (゚Д゚)[゚ε゚]='\\'; (゚Д゚).゚Θ゚ノ=(゚Д゚+ ゚ー゚)[o^_^o -(゚Θ゚)];(o゚ー゚o)=(゚ω゚ノ +'_')[c^_^o];(゚Д゚) [゚o゚]='\"';(゚Д゚) ['_'] ( (゚Д゚) ['_'] (゚ε゚+(゚Д゚)[゚o゚]+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((゚ー゚) + (゚Θ゚))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚ー゚)+ ((゚ー゚) + (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) +(o^_^o))+ (゚ー゚)+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (o^_^o)+ (゚Θ゚)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (c^_^o)+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ (゚Θ゚)+ ((゚ー゚) + (o^_^o))+ (゚Д゚)[゚ε゚]+(゚Θ゚)+ ((o^_^o) - (゚Θ゚))+ (o^_^o)+ (゚Д゚)[゚ε゚]+(゚ー゚)+ ((o^_^o) - (゚Θ゚))+ (゚Д゚)[゚ε゚]+((゚ー゚) + (゚Θ゚))+ (゚Θ゚)+ (゚Д゚)[゚o゚]) (゚Θ゚)) ('_');

vv Sorry but the smilies broke it, I had no choice...you shouldn't have said anything, I browse with images turned off!

Polio Vax Scene fucked around with this message at 23:16 on Dec 5, 2012

Polio Vax Scene
Apr 5, 2009



Holy christ on a cracker

code:

		json = new Object();
		json.bc = new Object();
		json.bc.password = "XXX";
		json.bc.userId = "000XXX";
		json.bc.BackgroundSearchPackage = new Object();
		json.bc.BackgroundSearchPackage.ReferenceId = new Object();
		json.bc.BackgroundSearchPackage.ReferenceId.IdValue = new Object();
		json.bc.BackgroundSearchPackage.ReferenceId.IdValue._ = "204";
		json.bc.BackgroundSearchPackage.PersonalData = new Object();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName = new Array();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0] = new Object();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].GivenName = new Object();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].GivenName._ = "Test";
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].MiddleName = new Object();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].MiddleName._ = "Test";
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].FamilyName = new Array();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].FamilyName[0] = new Object();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].FamilyName[0].primary = "true";
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].FamilyName[0]._ = "Last";
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].FamilyName[1] = new Object();
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].FamilyName[1].primary = "false"
		json.bc.BackgroundSearchPackage.PersonalData.PersonName[0].FamilyName[1]._ = "Lastname";

Polio Vax Scene
Apr 5, 2009



Use a negative number, jump out of the stack like a train off its rails

Polio Vax Scene
Apr 5, 2009



It's hard being a developer when you're colorblind.

Polio Vax Scene
Apr 5, 2009



Wheany posted:

Commented-out code gets deleted on sight.

But what if we need that code someday :ohdear:

Polio Vax Scene
Apr 5, 2009



Plorkyeran posted:

That's probably a deliberate style choice rather than ignorance. There's a certain group of people that think you should do that rather than negating the conditional because they think it's too easy to miss the !.

Not the same problem, but this reminded me of when I found a if (!(!(object))) once. :psyduck:

Polio Vax Scene
Apr 5, 2009



No Safe Word posted:

I'm going to go ahead and register freehow.com right now

fake edit: gently caress it's already something else

It's...a search engine...that removes spaces and puts in dashes instead :psyboom:

edit: nevermind apparently it doesn't do anything. It is a php page though, so it's still apropos.

Polio Vax Scene
Apr 5, 2009



I can see where the person was going with that if they didn't know about base().

Polio Vax Scene
Apr 5, 2009



Coding horrors: Grabbing my grandchildren's butts and holes

Polio Vax Scene
Apr 5, 2009



I think he is being sarcastic

Polio Vax Scene
Apr 5, 2009



Everybody posted:

Magical Future Dates

Apparently I'm part of this club too this morning. Someone here must have thought the world really would end on December 21st because there was no preparation for the 2013 fiscal year.

Polio Vax Scene
Apr 5, 2009



WHOIS John Galt posted:

I have never in my life needed to choose some magical date in the future that is never reached. Why would you ever need this? YOu can't be comparing it to other dates, right? Because otherwise you could just make some object that returned the right comparators for a date that's always later than any other date?

I'm not a SQL expert but I think it might be that it's faster to provide some fixed date that will 'never' qualify (or 'always' qualify) than to compute/allocate one on the fly.

Either that or the more likely answer: our predecessors were idiots.

Polio Vax Scene
Apr 5, 2009



Don't worry I'll remember to fix it when I'm cryogenically revived six thousand years from now

Polio Vax Scene
Apr 5, 2009



Ithaqua posted:

To me, a date of null means "it doesn't apply," and you can write your code to interpret that in whatever way makes sense for that particular application.

Whoever is fixing your code has to figure out what the hell your special-case program is going to do when there is a null now.

Polio Vax Scene
Apr 5, 2009



The best CAPTCHA. No algorithm would be able to decipher those "images".

It's like hiding the kids' presents inside the tree.

Actually maybe it sometimes does just stick plain letters out there to expose brute forcing programs or something?

Polio Vax Scene
Apr 5, 2009



Oh hey just found this
code:
...
where inv.ItemStatus like '%Active%'
...
Inactive means Active!? What a country!


Don Mega posted:

I found a table in my company's database that stores passwords as plain text and I doubt my co-workers will care. They weren't too interested in preventing sql injections either.

I have to support software that does this. Everyone's username, everyone's password, right there in a big rear end table. And I have access to them all, every single client. I could dump tens of thousands of name/pass combos with a few minutes of copy+paste. It's a Microsoft product

Polio Vax Scene
Apr 5, 2009



oh gently caress someone found the image in this post

Polio Vax Scene fucked around with this message at 16:54 on Feb 25, 2015

Polio Vax Scene
Apr 5, 2009



I like working with SharePoint :shobon: It's like helping a mentally disabled child eat breakfast

Polio Vax Scene
Apr 5, 2009



There are totally HR people here that are desperately searching for someone to throw money at, anyone who knows COBOL and can keep this loving ancient system running it alive because the original developer is long gone and nobody has the aptitude to learn it or make it in a better language.

e: whoops it is actually FORTRAN not COBOL apparently.

Polio Vax Scene
Apr 5, 2009



ikanreed posted:

Those are certainly not as bad as the entirely real a.ToString()!="false".

These are all over the place in my project. Whatever chucklefuck put these in absolutely loved them. I could tab over to visual studio right now and find one in ten seconds. And it's not just bools either, I'll see things like x.ToString()=="1". God help me I swear one time I found one that was x.ToString()=="null". THAT DOESNT EVEN WHAT :psyboom:

Polio Vax Scene
Apr 5, 2009



Dessert Rose posted:

Re: nullable values in C#:

code:
if (nullableBool.GetValueOrDefault(false)) { ...

Heh, you wish Microsoft was smart enough to pass me nullable bools (also sometimes it's nice to know when something is null vs false)

As a bonus to this discussion, here is something I literally alt tabbed and copy-pasted from code that has been live for a few years now.
code:
entity.Attributes["-removed-"].ToString().ToUpper() == "TRUE"

Polio Vax Scene
Apr 5, 2009



libcxx posted:

Programmers can unionize. Why that will never happen is a giant can of worms.

Because, as is now apparent, anyone can replace you - and even in a company as big as Toyota, where your job is as important as making sure cars dont loving drive off without input from their driver.

Polio Vax Scene
Apr 5, 2009



Obviously it's getting the 30th input field on the form. So uh...don't add/remove any before that.

Polio Vax Scene
Apr 5, 2009



I'm the coding horror today. At least, I was. I had a list of Room objects which had lists of other objects in them that I was serializing to/from a file.

Saving the list, before: Loop through the Room list, loop through each Room's object list, serialize each object, write to stream, add 'seperator' bytes, encrypt, write to file (named after the Room), end up with dozens or hundreds of files.

Saving the list, after: Serialize Room list, write to stream, encrypt, write to single file.

Loading the list, before: Loop through each file in directory, create a room named after each file, open file stream, continue reading stream until 'seperator' bytes are detected, decrypt bytes, deserialize object from byte section, add object to room, repeat until end of stream, switch to next file.

Loading the list, after: Open single file stream, decrypt, deserialize room list. :doh:

Polio Vax Scene
Apr 5, 2009



The API service I'm trying to communicate with is sending me ampersands inside of its xml. And not &, just plain old & by itself. :(

Polio Vax Scene
Apr 5, 2009



Just had to defend use of the below to someone in figuring out if a DateTime falls on a weekday
code:
(dateTime.DayOfWeek != DayOfWeek.Sunday &&
    dateTime.DayOfWeek != DayOfWeek.Saturday)
Verbatim: "What if in the future we add or remove days from the week though!?"


vvv oh gently caress me

Polio Vax Scene fucked around with this message at 00:33 on Dec 31, 2013

Polio Vax Scene
Apr 5, 2009



omeg posted:

https://www.youtube.com/watch?v=-5wpm-gesOY

Also please don't use that horrible "edit with reply to the future" thing.

Sadly I'm stuck with creating a library to manage appointments, schedules, and recurrences that are timezone compatible.

And "oh gently caress me" doesn't warrant a new post.

The true coding horror: the human race

Polio Vax Scene
Apr 5, 2009



pseudorandom name posted:

"gently caress it, lets just count from 1 January 1970!"

But when is that?

Polio Vax Scene
Apr 5, 2009



baquerd posted:

1388782132 seconds ago from this post.

Impossible - global timezone variance range is 25 hours. There is no one point in time that can be considered January 1, 1970 for every place on Earth.

Polio Vax Scene
Apr 5, 2009



A new low has been reached.

The newest API-of-the-month that I am working with has a method that requires a "location id" that represents a place somewhere in the world. This API stores all it's possible locations in a gigantic gently caress-off xml tree that goes Planet -> Continent -> Country -> County -> 'Place'. So Orlando, Florida would be Planet Earth -> North America -> USA -> Orange County -> Orlando and the location id would be something like 32805. Yes, Planet Earth is the first loving node in this tree, but that isn't even the best part. In order to actually find the location id you are searching for, instead of doing something sane like accepting county/place/etc as inputs, you provide a location id to search from, and the api returns everything on that branch to you. So Planet Earth is 1 and USA is 99. So if your location is in the USA, you provide 99 as the parent location and every location in the USA is given back in an xml, and you are expected to search through it. Not in the USA? Hope you know your location code or have twenty minutes to spare while you download the entire god drat database.

Polio Vax Scene
Apr 5, 2009



That's what typeof() is for. I actually like that the sorting is left to the developer, because you can't blame the language for doing it wrong/inserting crap data into your sort.

Adbot
ADBOT LOVES YOU

Polio Vax Scene
Apr 5, 2009



Today's ibuprofen brought to you buy a javascript library that automatically grabs config files based on the user's language (ex. "en-US.js") and a web application that doesn't allow you to upload files with a hyphen in the name for an unknown reason (ex. "en-US.js"). Put em together in one room and it's a crazy wacky sitcom coming this summer on fox!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply