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
floWenoL
Oct 23, 2002

In today's edition on how not to launch a product:

http://nikcub.appspot.com/posts/yahoo-axis-chrome-extension-leaks-private-certificate-file

Adbot
ADBOT LOVES YOU

Opinion Haver
Apr 9, 2007

dis astranagant posted:

Like whoever invented unify and surrender algorithms.

What're these?

tractor fanatic
Sep 9, 2005

Pillbug
Maybe it's this? http://c2.com/cgi/wiki?SlowSort

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell


Every single time I release something into the wild I'm biting my nails wondering if I made some horrific fuckup like this.

w00tz0r
Aug 10, 2006

I'm just so god damn happy.
code:
class Base
{
    ...
};

class Derived : public Base
{
    ...
private:
    Base _base;
};

class Wrapper
{
public:
    operator Base&() { return _derived; }
private:
    Derived _derived;
};

Wrapper wrapper;
std::vector<Base*> bases;
bases.push_back(&static_cast<Base&>(wrapper));
I'm starting to understand why some people violently hate operator overloading.

Zombywuf
Mar 29, 2008

w00tz0r posted:

code:
class Base
{
    ...
};

class Derived : public Base
{
    ...
private:
    Base _base;
};

class Wrapper
{
public:
    operator Base&() { return _derived; }
private:
    Derived _derived;
};

Wrapper wrapper;
std::vector<Base*> bases;
bases.push_back(&static_cast<Base&>(wrapper));
I'm starting to understand why some people violently hate operator overloading.

idgi

What does the fact that the Derived has a Base as a private member have to do with operator overloading?

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
Open Access for the EDA industry is a family of C++ classes (I'd call it an API but that's way too generous) that has every class, big and small, overload all of its operators. And that's just one of its wonderful traits. Using it and getting really familiar with the documentation was actually an opportunity for me to study this fantastic psychological footprint of the minds of EE professionals as pressed into the world of software libraries. Despite the (laughably ambiguous) name, Open Access is about as closed source and black box-y as it gets outside of SaaS. I don't know if it comes from working in the IP Cold War universe of circuits and semiconductors, or just the hardware mindset that every conceivably possible use case must be rigidly defined, measured, and controlled right down to the last mosfet because you can't exactly make a git pull request to the mass designers after the fact. Either way it truly is OOP, and "Let's openly standardize X for this industry!", as understood by people who live and breathe in that world.

Bhaal fucked around with this message at 00:44 on May 25, 2012

That Turkey Story
Mar 30, 2003

Zombywuf posted:

idgi

What does the fact that the Derived has a Base as a private member have to do with operator overloading?

Agreedo.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
why choose between composition and inheritance when you can just do both

Optimus Prime Ribs
Jul 25, 2007

Zombywuf posted:

idgi

What does the fact that the Derived has a Base as a private member have to do with operator overloading?

Maybe I'm missing something, but:

code:
...
operator Base&() { return _derived; }
...
bases.push_back(&static_cast<Base&>(wrapper));

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp
Not even Peter Norton can undo deletion this strong.

code:
if (($report{$var{'unit1'}}{'unit_dn'} eq 'DN') && ($report{$var{'unit2'}}{'unit_dn'} eq 'DN'))
{
	delete ($report{$var{'unit2'}}{'unit_dn'}); 
}
else 
{
	delete ($report{$var{'unit2'}}{'unit_dn'}); 
}

Zombywuf
Mar 29, 2008

Oh sweet Satan in hell, what have I done?
Python code:
                m = None
                if name == "text":
                    metadata_id = db.get_metadata_id(self.task_id, self.frontier, "tags")
                    if metadata_id:
                        m = metadata_id, True
                elif name == "tags":
                    metadata_id = db.get_metadata_id(self.task_id, self.frontier, "text")
                    if metadata_id:
                        m = metadata_id, True
                if not m:
                    m = db.found_metadata(self.worker, self.task_id, self.frontier,
                                          name, mime_type)
                if m:
                    metadata_id, upload = m
                    if upload:
                        return UploadMetadata(frontier=self.frontier,
                                              metadata_id=metadata_id,
                                              name=name)
                    else:
                        return FoundMetadata(frontier=self.frontier,
                                             metadata_id=metadata_id)

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

Jonny 290 posted:

Not even Peter Norton can undo deletion this strong.

code:
if (($report{$var{'unit1'}}{'unit_dn'} eq 'DN') && ($report{$var{'unit2'}}{'unit_dn'} eq 'DN'))
{
	delete ($report{$var{'unit2'}}{'unit_dn'}); 
}
else 
{
	delete ($report{$var{'unit2'}}{'unit_dn'}); 
}

There is non-PHP syntax highlighting now.

Perl code:
if (($report{$var{'unit1'}}{'unit_dn'} eq 'DN') && ($report{$var{'unit2'}}{'unit_dn'} eq 'DN'))
{
	delete ($report{$var{'unit2'}}{'unit_dn'}); 
}
else 
{
	delete ($report{$var{'unit2'}}{'unit_dn'}); 
}

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
More internal code from VDSI. All these guys are are copy/paste programmers.

I love the three different platform detection mechanisms, and junk like this.

Yes, the file name really is "functions.js". There are a total of twenty or thirty different JS files.

revmoo
May 25, 2006

#basta
Not a coding horror per se but I lost a debate with a colleague today of whether to either change our app's docroot dir from the default vendor-supplied name www to wwwroot, or to change the dir in httpd.conf. I lost.

This is on 5-6 actual sites that run a lot of dynamic content, so this small change actually has a ripple affect that requires changing a LOT of config files and db settings. His argument was that he didn't want to trouble IT..after we'd already sat down together and had a meeting to decide this. So after I spent half a day redoing about six git repos and breaking each child-site into their own repos (stupid), and sent a note to IT with instructions. (setup httpd this way, do a git clone in this dir) made it pretty childproof all in all. He comes back to me and says "hay I already made this dirs for you my work is done." complely ignoring the prior meeting we'd had. So My colleague really pushed for this and used his weight to get his way and basically mandated we have to use wwwroot.

I then managed to trick him into agreeing to do the work to change over the sites. That was this morning. He's been at it all day, made 11 pushes to 6 different repos and done all sorts of work on the development server to try and coax it into working. I'm sitting back and having a beer right now while he struggles to get it working on the Friday before Memorial Day.

Oh and then a client that had fired me a while back called me this morning and needed me to rescue their domain because their new web agency let it expire and nobody noticed. It's been a solid, solid day.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
I would've been tempted to just symlink wwwroot to www.

w00tz0r
Aug 10, 2006

I'm just so god damn happy.

Optimus Prime Ribs posted:

Maybe I'm missing something, but:

code:
...
operator Base&() { return _derived; }
...
bases.push_back(&static_cast<Base&>(wrapper));

That would be it, yep. I missed the operator Base& several times while trying to figure out why the program even compiled.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
http://jsonplus.com/
and the code


why

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
There's also https://github.com/aseemk/json5

Optimus Prime Ribs
Jul 25, 2007

I think I found out why our servers are running so poorly intermittently:

PHP code:
<?
session_start();

if( $_SESSION['apps-sn-event-login-session'] != "" && $_SESSION['apps-sn-event'] != "" ){
    $log_file_name =  date("Y-m-d") . ".log";
    $log_file = "../../../logs/" . $log_file_name;

    $log_text =  date("Y-m-d"). " " . date("H:i:s") . " " . $_SESSION['apps-sn-event'] . " " . $_SESSION['apps-sn-event-login-session'] . "\n";

    $fp = fopen($log_file, "a+");
    fwrite($fp, $log_text);
    fclose($fp);
}
?>
<html>
      <head>
            <title></title>
            <meta http-equiv="refresh" content="60" >
      </head>
      <body>
      </body>
</html>
For some of our events there are several hundred people viewing a page that has that inside of an iframe. Here's a copy of the log from last week: http://pastebin.com/trUv2tMZ
There is one of those for every day going back to January 10th, 2011.

Who the hell thought this was a good idea?

McGlockenshire
Dec 16, 2005

GOLLOCKS!
It's like some sort of ghetto analytics, only without anything to analyze.

ymgve
Jan 2, 2004


:dukedog:
Offensive Clock
The log you pasted only has 2-4 hits every minute. If your server is having poor performance, it's not because of that piece of code.

Optimus Prime Ribs
Jul 25, 2007

The log I linked to wasn't from one of our live events; pretty sure that was just us testing.

Here's one that is from a live event: http://pastebin.com/MGGwdg0L
The full/complete log file is 40,000 lines at 2.3MB of that.

edit: For the record I'm sure there are a myriad of other problems that are causing our servers to run poorly.

Impotence
Nov 8, 2010
Lipstick Apathy

Does http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/topic/xi50/convertingbetweenjsonandjsonx07.htm#wq18 count?

Opinion Haver
Apr 9, 2007


I want to edit that README so it's just a link to yaml.

tef
May 30, 2004

-> some l-system crap ->

give it time, someone will make json with schemas and namespaces :3:

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
To me, this feature request exemplifies everything that is wrong with JSON5:

quote:

Support octal and/or hex numbers?
Seems like it would be useful, but octal numbers in particular might throw people off. I'm wondering if there's a good reason JSON doesn't support it. Not sure.

"Hey, I don't see any use for this feature but maybe we ought to put it in!"

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

yaoi prophet posted:

I want to edit that README so it's just a link to yaml.

Yeah wow, that example is valid YAML if you change the comments to use #.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
I hope the comment system doesn't get abused to embed language-specific directives, like it did for YAML (and originally for JSON, which is why Crockford took it out) :(

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

tef posted:

give it time, someone will make json with schemas and namespaces :3:

This is my favorite thing: http://publib.boulder.ibm.com/infocenter/wsdatap/v3r8m1/index.jsp?topic=%2Fxi50%2Fconvertingbetweenjsonandjsonx05.htm

pseudorandom name
May 6, 2007

JSONx makes a whole lot more sense when you remember that standard SQL has XML types and functions.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

tef posted:

give it time, someone will make json with schemas and namespaces :3:

http://tools.ietf.org/html/draft-zyp-json-schema-03

Deus Rex
Mar 5, 2005

XML code:
<div id="less" class="more">
I guess sometimes less is more :v:

Deus Rex
Mar 5, 2005

sorry to double-post, but have to vent:

three times now, I've worked with another web developer who uses SASS or SCSS. Awesome, I think, and then I find that they eschew mixins (even the guy who uses Compass :what:), variables, functions, extend, imports, or any of the other awesome useful features of SASS just for one thing: so they can write style sheets that are hopelessly coupled to markup:

CSS code:
/* one-line reset CSS */
html {
    body {
        #container {
            #header {
                h1 {
                    font-size: 48px;
                    font-weight: bold;
                    font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
                }
            }
            #content {
                h1 {
                    font-size: 36px;
                    font-weight: bold;
                    font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
                }
                #promo {
                    h2 {
                        font-size: 32px;
                        font-weight: bold;
                        font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
                        a {
                            color: yellow;
                        }
                    }
                }
            }
        }
    }
}
i want to cry :( why do so many front-end devs write horror code :(

xf86enodev
Mar 27, 2010

dis catte!

Deus Rex posted:


i want to cry :( why do so many front-end devs write horror code :(

It looks like they just want their CSS to look like the PHP they write.

Beef
Jul 26, 2004
Most horrors here are web related. Is that because the majority of the coding is for the web these days, or just the vast majority of the horror coders?

that awful man
Feb 18, 2007

YOSPOS, bitch

Internet Janitor posted:

To me, this feature request exemplifies everything that is wrong with JSON5:


"Hey, I don't see any use for this feature but maybe we ought to put it in!"



:suicide:

Zombywuf
Mar 29, 2008

tef posted:

give it time, someone will make json with schemas and namespaces :3:

And macros.

XML code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE explode [
<!ELEMENT explode ANY>
<!ENTITY boom "BOOM &boom; &boom;">
]>
<explode>&boom;</explode>
Technically this is not well formed, better hope you have a good parser where they planned for this.

tef
May 30, 2004

-> some l-system crap ->

(I know of these being added :ssh:)

json is pretty much the "gently caress it, we'll do it live" of serialisation formats

Adbot
ADBOT LOVES YOU

Golbez
Oct 9, 2002

1 2 3!
If you want to take a shot at me get in line, line
1 2 3!
Baby, I've had all my shots and I'm fine

Beef posted:

Most horrors here are web related. Is that because the majority of the coding is for the web these days, or just the vast majority of the horror coders?

I think it's two things. One, the barrier to entry for web coding is a lot lower, due to ubiquity and ease. A yokel might not need to code a word processing application, or have the ability to, but give him a PHP book and a few lines of code and suddenly he's got a marginally useful webpage full of SQL injections.

Two, with Javascript, the code is exposed to us, so we can mock code written by others instead of just code we happen upon from coworkers.


I'm an idiot, so what is bad about this? That he didn't know why he was adding it?

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