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
Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Gazpacho posted:

Just found this test case in my project, recently added by a dev who had given notice and is gone now.
Java code:
public void testThingy() throws Exception

Does it at least test the thingy?

Adbot
ADBOT LOVES YOU

ManoliIsFat
Oct 4, 2002

IDK, he wrote a failing test first-thing, seems very TDD to me. (e: joking, obvi)

ManoliIsFat fucked around with this message at 20:38 on Mar 4, 2014

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
"Thingy" isn't something I substituted, that's from the actual test case name. As to whether it tests the thingy, whatever it may be, your guess is as good as mine.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



ohgodwhat posted:

Ah, but what about X tunneling over SSH to Windows, where you then have to copy and paste text into gedit if you wanted to transfer something to the server? Oh and then you need to transfer binary files this way because SCP and its ilk are a security risk?

You still didn't have to use any Cirtix software so it's a marginally less lovely experience.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
http://www.php.net/manual/en/function.debug-backtrace.php#110066 hi

Bobbin Threadbear
May 6, 2007

diyism indeed

Authentic You
Mar 4, 2007

Listen now this is your
captain calling:
Your captain is dead.
So a couple pages back I posted some code from a plugin app that output a .doc file by way of utilizing an implementation of a PHP Word file generator library on a random other website (that was evidently not under the dev's control despite him insisting it was, seeing as how he never did manage to correct the 404 when the script he was relying on was deleted/moved/renamed). Anyways, the problem has been solved in the new update:

PHP code:
<?php 

if(array_key_exists( 'HTTP_REFERER', $_SERVER ) ) 
	$ruri= $_SERVER['HTTP_REFERER'];
else
	$ruri = '';
if ($doctext!="")
{

}
?>
Now it doesn't make .docs at all. :v:

The best part is that the guy running the show is either unaware that his thing no longer produces .docs, or he's chosen to just not tell anyone. Either way it's pretty bad. :(

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
One of our apps is going to be collecting seriously confidential data and as such requires a very long and very arduous audit process. To make the process smoother, we're testing the app right now to make sure that the code the subcontractor delivered is up to snuff.

The first red flag that this was going to be an awful experience was when we found that the deliverable had the index.php file and the application folder both in the project root.

Turns out that no one bothered to secure routes against requests to the folder structure so by going to site.com/application/config/db.ini you can get the database credentials.

Thanks lovely dev shop!

Scaevolus
Apr 16, 2007

Blinkz0rz posted:

One of our apps is going to be collecting seriously confidential data and as such requires a very long and very arduous audit process.
I experienced a payroll company with a world-readable W-2 directory filled with thousands of PDFs.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Scaevolus posted:

I experienced a payroll company with a world-readable W-2 directory filled with thousands of PDFs.

This site involves collecting data on prison rape incidents.

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog
Here's the thing making me cry:

Client's Developer: How do I test your new component that's not merged into production yet? When I go to the production site your component has some issues. Can you provide an ETA for the fix?
Me: It's not merged into production yet, so you'll need to test on a build that includes the component.
Client's Developer: I tested on our dev site and there's a whole bunch of issues. What's the ETA for when this will be fixed?
Me: You need to test on a site that actually has pages upon which to test.
Client's Developer: I pulled some pages over to our dev site and there's still some issues. Per my previous request, can we get an ETA for when this issue will be fixed?
:sigh:

There's still at least 3 issues with the most recent "testing" set up. It takes 100% of my willpower to contain the mocking, which leaves me with no energy to provide an ETA.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Blinkz0rz posted:

This site involves collecting data on prison rape incidents.

Welp, gonna have to say you win "whose site's private info is worse to leak" here :stare:

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Volmarias posted:

Welp, gonna have to say you win "whose site's private info is worse to leak" here :stare:

Australia had a hell of a leak recently. Full details of 10,000 or so refugees on a public facing site. Imagine their fear of persecution just got a lot higher if intelligence agencies of the country they fled got a hold of the information.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Volmarias posted:

Welp, gonna have to say you win "whose site's private info is worse to leak" here :stare:

I mean, the good news is we caught it before it went into production, but Jesus Christ, what kind of idiot subcontractor does something like this?

Although it should have been pretty clear when they delivered a product built on Zend 1...

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
More fun with PHP, as per here.

code:
<?php

$a = md5('240610708');
$b = md5('QNKCDZO');

echo "$a\n";
echo "$b\n";
echo "\n";

var_dump($a == $b);
Output:
code:
0e462097431906509019562988736854
0e830400451993494058024219903391

bool(true)

..btt
Mar 26, 2008
Presumably because they are coerced to int 0 before the comparison?

Westie
May 30, 2013



Baboon Simulator

..btt posted:

Presumably because they are coerced to int 0 before the comparison?

...and that's why strcmp exists!

nielsm
Jun 1, 2009



..btt posted:

Presumably because they are coerced to int 0 before the comparison?

And only because the == operator is used, if you use === the comparison fails as you'd expect.

PHP still assumes the programmer is stupid. "Sure that's a string, but it looks like a number! Here I'll make it a number for you."

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Blinkz0rz posted:

I mean, the good news is we caught it before it went into production, but Jesus Christ, what kind of idiot subcontractor does something like this?

Although it should have been pretty clear when they delivered a product built on Zend 1...

I hope you had a competent security contractor review everything in addition to yourself.

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

Volmarias posted:

I hope you had a competent security contractor review everything in addition to yourself.

His review starts next Monday, thank god.

canis minor
May 4, 2011

code:
var content_height = $(".innerContainer").height();
var content_height = (content_height/2);
$(".innerContainer").css("margin-top", "-" + content_height + "px");
Let's put JS everywhere.

EntranceJew
Nov 5, 2009

eithedog posted:

code:
var content_height = $(".innerContainer").height();
var content_height = (content_height/2);
$(".innerContainer").css("margin-top", "-" + content_height + "px");
Let's put JS everywhere.

I'm going to guess that the page isn't on a timer and everything falls to its knees when you resize it.

canis minor
May 4, 2011

EntranceJew posted:

I'm going to guess that the page isn't on a timer and everything falls to its knees when you resize it.

Yup - that's the thing that's most inherently wrong here. How many more wrong things can you spot?

Optimus Prime Ribs
Jul 25, 2007

eithedog posted:

code:
var content_height = $(".innerContainer").height();
var content_height = (content_height/2);

I didn't even know that it's possible to declare a variable twice like that, but I just tried it out in a console and it worked. :shrug:

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
A week of my own time and a week of the team lead's time has made it clear that we can't figure out how to properly have one $.ajax call trigger another in all cases. What we were doing was POSTing up a picture then a view model of form data. It worked but not if we had to go back to the page for validation reasons.

The workaround is to just do one big ajax of a huge view model, which includes a base64 encoded jpg picture now.

The real fun in this is that our idiom for validation is "send back the whole view model as json if it works out correct" and "send the view back and reload the page with that new view, which includes red text for yo fill this in right before you click save again." While the former worked with one ajax calling another, the latter didn't; it did all kinds of undefined behavior that ~NOBODY UNDERSTANDS~. When I asked senior devs before doing this I thought that base64 encoding a picture and throwing it into a view model was an anti pattern - is it? Bleh.

Management just wants us to keep pushing out new things, so the clear problem we have with JS events going on right now is just left to smolder and fester. We have a tab control system we've made ourselves using jQuery and knockout, that also sort of has 'state' in a sense in it, which is probably to blame, but no time to commit to finding out what's up yet. I am now at least going back to clean some stuff up, though - we have had so much bike shedding for so long our project's CSS is all but a Polish Plait, so I get to rip poo poo up and show people how less works. We also managed to get the team lead and management to put a stop to the constant bike shedding.

I'm just in a permanent state of WTF right now.

necrotic
Aug 2, 2005
I owe my brother big time for this!

Optimus Prime Ribs posted:

I didn't even know that it's possible to declare a variable twice like that, but I just tried it out in a console and it worked. :shrug:

I would've thought 'use strict' would have something to say about it, but it does not. Can't say I'm surprised about that as default behavior with scoping of JS.

substitute
Aug 30, 2003

you for my mum
Coding horrors: well, at least I'm not being raped in prison

Adahn the nameless
Jul 12, 2006

2banks1swap.avi posted:

A week of my own time and a week of the team lead's time has made it clear that we can't figure out how to properly have one $.ajax call trigger another in all cases. What we were doing was POSTing up a picture then a view model of form data. It worked but not if we had to go back to the page for validation reasons.

The workaround is to just do one big ajax of a huge view model, which includes a base64 encoded jpg picture now.

The real fun in this is that our idiom for validation is "send back the whole view model as json if it works out correct" and "send the view back and reload the page with that new view, which includes red text for yo fill this in right before you click save again." While the former worked with one ajax calling another, the latter didn't; it did all kinds of undefined behavior that ~NOBODY UNDERSTANDS~. When I asked senior devs before doing this I thought that base64 encoding a picture and throwing it into a view model was an anti pattern - is it? Bleh.

Management just wants us to keep pushing out new things, so the clear problem we have with JS events going on right now is just left to smolder and fester. We have a tab control system we've made ourselves using jQuery and knockout, that also sort of has 'state' in a sense in it, which is probably to blame, but no time to commit to finding out what's up yet. I am now at least going back to clean some stuff up, though - we have had so much bike shedding for so long our project's CSS is all but a Polish Plait, so I get to rip poo poo up and show people how less works. We also managed to get the team lead and management to put a stop to the constant bike shedding.

I'm just in a permanent state of WTF right now.

There's a good chance I'm not understanding your ajax problem fully, but couldn't you just chain promises?

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

necrotic posted:

I would've thought 'use strict' would have something to say about it, but it does not. Can't say I'm surprised about that as default behavior with scoping of JS.
It's well-established from experience with old C++ compilers that developers don't want their toolset to bark at them for declaring a loop variable named "i" twice in the same function.

necrotic
Aug 2, 2005
I owe my brother big time for this!

Gazpacho posted:

It's well-established from experience with old C++ compilers that developers don't want their toolset to bark at them for declaring a loop variable named "i" twice in the same function.

Yeah, but this is JavaScript.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

necrotic posted:

Yeah, but this is JavaScript.

So what's the huge problem with being able to declare a variable twice exactly? Isn't that what you would expect in JS?

Westie
May 30, 2013



Baboon Simulator

down with slavery posted:

So what's the huge problem with being able to declare a variable twice exactly? Isn't that what you would expect in JS?

JavaScript code:
for(var i in poo poo)
That's pretty much imprinted into any JS dev's brain.

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Westie posted:

JavaScript code:
for(var i in poo poo)
That's pretty much imprinted into any JS dev's brain.

I don't get what you're trying to point out here... unless you're saying that Crockford doesn't do it that way?

canis minor
May 4, 2011

You don't think of initialization of variables in loops and you just keep doing it over and over, as:

code:
for (var i in foo)
{ do stuff }

...

for (var i in bar)
{ do other stuff }
You won't write the second loop without `var`. Unless you're pretty pedantic, idk. While such way of writing doesn't seem incorrect, writing:

code:
var i=0;
var i=1;
just screams wrong wrong wrong.

edit: vvv dunno what you're trying to say there mate - yes, it stems to that, but why would you want to initialize the same variable twice? (I like to think that author of my initial horror wanted to be double sure that the variable was initialized).

and a false edit:

Have you kind folks talked about Wordpress yet? For example, if I want to get all the posts of specific type and echo their id I have to do this:

code:
$query = new WP_Query($args);
if( $query->have_posts() )
  while ($query->have_posts()) { 
      $query->the_post(); 
      the_id(); 
  }

canis minor fucked around with this message at 13:27 on Mar 6, 2014

Fullets
Feb 5, 2009

eithedog posted:

You won't write the second loop without `var`. Unless you're pretty pedantic, idk. While such way of writing doesn't seem incorrect, writing:

code:
var i=0;
var i=1;
just screams wrong wrong wrong.

Without saying that this is a good thing, doesn't the idiot splendour of var hoisting turn it into:

code:
var i;
i = 0;
i = 1;

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

eithedog posted:

just screams wrong wrong wrong.

Why? Why should the interpreter prevent you from setting the value of the variable twice?

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Fullets posted:

Without saying that this is a good thing, doesn't the idiot splendour of var hoisting turn it into:

code:
var i;
i = 0;
i = 1;

No, you don't understand. It just looks wrong. Ok? IT IS WRONG GOSH

canis minor
May 4, 2011

down with slavery posted:

Why? Why should the interpreter prevent you from setting the value of the variable twice?

Um... I didn't say that. You can do whatever you want with your variables, but it doesn't mean that certain things won't be awkward or unnecessary.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

eithedog posted:

Um... I didn't say that. You can do whatever you want with your variables, but it doesn't mean that certain things won't be awkward or unnecessary.

You said that it "just screams wrong wrong wrong". I'm asking why.

Because of the way variable scoping works in Javascript, there is a benefit (slash it is necessary) of being able to type var to redefine variables.

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
JavaScript code:
function() {
    for (var i in foo)
        print(i);

    for (var i in bar)
        print(i);
}
This code will not do what you think it does. This is exactly equivalent to:

JavaScript code:
function() {
    var i;
    for (i in foo)
        print(i);

    for (i in bar)
        print(i);
}

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