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
Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
I haven't had any issues with EBS volumes, what are you alluding to?

Adbot
ADBOT LOVES YOU

dexter
Jun 24, 2003

Hard NOP Life posted:

I haven't had any issues with EBS volumes, what are you alluding to?

This is a joke, right?

https://status.heroku.com/incidents/151 and http://storagemojo.com/2011/04/29/amazons-ebs-outage/
http://blog.reddit.com/2011/03/why-reddit-was-down-for-6-of-last-24.html
http://gigaom.com/cloud/did-amazons-web-services-go-down/
http://venturebeat.com/2012/06/29/amazon-outage-netflix-instagram-pinterest/

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
I've had a bunch of EBS volumes fail on me personally. I still love EC2, you just have to remember you're still on a machine somewhere and it can still fail, so have snapshots and hot/warm spares ready for important services. Or even better, geodiversify your poo poo.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

This was fascinating, thank you for that. I had heard about the EC2 outage, but I didn't know it had been caused by EBS.

dexter
Jun 24, 2003

Hard NOP Life posted:

This was fascinating, thank you for that. I had heard about the EC2 outage, but I didn't know it had been caused by EBS.

Yeah, EBS is notoriously unreliable and Amazon keeps tight wraps on the underlying technology (just like everything else being EC2.) As long as you design your systems around the fact that stuff will fail and replicate your data/serve traffic from multiple regions you should be safe on AWS.

Zombywuf
Mar 29, 2008

dexter posted:

Yeah, EBS is notoriously unreliable and Amazon keeps tight wraps on the underlying technology (just like everything else being EC2.) As long as you design your systems around the fact that stuff will fail and replicate your data/serve traffic from multiple regions you should be safe on AWS.

That is: so long as you buy lots and lots of server time from Amazon you'll be fine.

dexter
Jun 24, 2003

Zombywuf posted:

That is: so long as you buy lots and lots of server time from Amazon you'll be fine.

It just means that you need to plan to have n+1 geographic redundancy or a hot DR site just as if you were renting/leasing/buying physical servers.

Zombywuf
Mar 29, 2008

dexter posted:

It just means that you need to plan to have n+1 geographic redundancy or a hot DR site just as if you were renting/leasing/buying physical servers.

When you own your own SAN a backup plan is much much easier. It's also easier to recover from failure if you machines don't wipe themselves on reboot.

epswing
Nov 4, 2003

Soiled Meat
Sigh

Bunny Cuddlin
Dec 12, 2004

Even worse than the 16 character limit, think about what "enter the first 16" implies

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer
Found this in production today.
code:
public static int GetTemplateId(int templateId)
        {
            switch (templateId)
            {
                case 3:
                    return 11;
                case 13:
                    return 14;
                case 26:
                    return 29;
                case 27:
                    return 30;
                case 28:
                    return 31;
                case 66:
                    return 67;

                case 5:
                    return 16;
                case 17:
                    return 18;
                case 32:
                    return 35;
                case 33:
                    return 36;
                case 34:
                    return 37;
                case 68:
                    return 69;
                default:
                    return 0;

            }
        }
They even follow the order and extra line break in the two enums they map :psyduck:

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Adobe just released a new ActionScript compiler that has some support for inlining. Among other things, it cannot inline methods that have a try statement. This is their example code for that situation:
ActionScript code:
        // not inlineable as decorated with inline metadata and final, but
        // contains try stmt
        [Inline]
        final public function f1(p:int):int
        {
            try
            {
                return p + _m;
            }
            finally
            {
                return 0;
            }
        }
what an excellent example of try statement use

the littlest prince
Sep 23, 2006


Aleksei Vasiliev posted:

Adobe just released a new ActionScript compiler that has some support for inlining. Among other things, it cannot inline methods that have a try statement. This is their example code for that situation:
ActionScript code:
        // not inlineable as decorated with inline metadata and final, but
        // contains try stmt
        [Inline]
        final public function f1(p:int):int
        {
            try
            {
                return p + _m;
            }
            finally
            {
                return 0;
            }
        }
what an excellent example of try statement use

Kind of a lovely example, but as an example of what not to do, it works on multiple levels!

Does that even compile?

Frozen Peach
Aug 25, 2004

garbage man from a garbage can

Gigantic Slut Man posted:

Even worse than the 16 character limit, think about what "enter the first 16" implies

It's probably not as bad as my gut reaction, but my gut says it's pretty bad. I'd hope that it takes the first 16 characters and hashes those. They're just being honest about the back end only accepting 16 character passwords now.

Granted if they ARE hashing passwords, why would there need to be a limit at all? :tinfoil:

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

Gigantic Slut Man posted:

Even worse than the 16 character limit, think about what "enter the first 16" implies

Well, it depends: did they just change this rule? It's possible that they've just been hashing the first 16 characters all along.

Still not as bad as my bank. Those stupid motherfuckers require a six-character password of letters and numbers, so it can be integrated with their phone banking system (using the same password). The person responsible for that choice needs a sound beating, I should think.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Gigantic Slut Man posted:

Even worse than the 16 character limit, think about what "enter the first 16" implies
They were previously silently truncating the password to 16 characters when setting passwords, which everyone involved had forgotten about until they added a new login system which didn't truncate and so didn't work with people with longer passwords.

The notification hopefully means that they're working on removing the limit without breaking old accounts.

baquerd
Jul 2, 2007

by FactsAreUseless

the littlest prince posted:

Does that even compile?

Yeah, it always returns zero though.

Suspicious Dish
Sep 24, 2011

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

Aleksei Vasiliev posted:

Adobe just released a new ActionScript compiler that has some support for inlining. Among other things, it cannot inline methods that have a try statement. This is their example code for that situation:
ActionScript code:
        // not inlineable as decorated with inline metadata and final, but
        // contains try stmt
        [Inline]
        final public function f1(p:int):int
        {
            try
            {
                return p + _m;
            }
            finally
            {
                return 0;
            }
        }
what an excellent example of try statement use

To be fair, those really awkward examples are what a compiler writer deals with all day.

Bunny Cuddlin
Dec 12, 2004
Yes, I realize they were silently truncating before. Still a horror.

Edit: Also, my alma mater moved their alumni email to MS hosted Outlook and I had to make a new password there. Had to be exactly 16 characters. I'm not sure if that's a school limitation or an MS one but it seems really dumb.

Bunny Cuddlin fucked around with this message at 01:30 on Aug 30, 2012

shrughes
Oct 11, 2008

(call/cc call/cc)
For most bullshit web apps it's probably more secure to have 4 character passwords and then freeze the account after 3 attempts -- that way if you lose the database you don't reveal your users' email passwords.

Johnny Cache Hit
Oct 17, 2011

shrughes posted:

For most bullshit web apps it's probably more secure to have 4 character passwords and then freeze the account after 3 attempts -- that way if you lose the database you don't reveal your users' email passwords.

You could then save some database space by making the password a FK to a password table. (1, 1234), (2,abcd)... I think that should do it. :v:

nielsm
Jun 1, 2009



I was once asked to look at why user registration for a custom web community was acting strange. Well, it was an ASP Classic thing, using an Access database, but most importantly: User names were not unique. You could have two users with the same name as long as they had different passwords. Actually, trying to recall this, I don't even think that was checked during user creation... Of course, as a result, some people had multiple almost-identical accounts. (Naturally the passwords were stored in plain text.)

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


nielsm posted:

I was once asked to look at why user registration for a custom web community was acting strange. Well, it was an ASP Classic thing, using an Access database, but most importantly: User names were not unique. You could have two users with the same name as long as they had different passwords. Actually, trying to recall this, I don't even think that was checked during user creation... Of course, as a result, some people had multiple almost-identical accounts.

Hot new ERP service NetSuite also does this. Isnt it magical? :allears:

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

nielsm posted:

I was once asked to look at why user registration for a custom web community was acting strange. Well, it was an ASP Classic thing, using an Access database, but most importantly: User names were not unique. You could have two users with the same name as long as they had different passwords. Actually, trying to recall this, I don't even think that was checked during user creation... Of course, as a result, some people had multiple almost-identical accounts. (Naturally the passwords were stored in plain text.)

Weird; I had to update a customer login system based on .Net classic that had the same problem. I found it right away though;

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Aleksei Vasiliev posted:

what an excellent example of try statement use
This is what compiler bug reports usually look like: Long enough to manifest the bug and no longer. The usefulness of the code isn't a consideration.

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
It bears repeating, forever.

PHP code:
var_dump((bool)"0.00"); // true
var_dump((bool)0);      // false
var_dump(0 == "0.00");  // true
:sigh:

Chopper
Feb 13, 2006

Golbez posted:

It bears repeating, forever.

PHP code:
var_dump((bool)"0.00"); // true
var_dump((bool)0);      // false
var_dump(0 == "0.00");  // true
:sigh:
The boolean of a string is true in PHP. The boolean of any non-zero integer is true. The boolean of 0 is false.

When you compare an int and a string to see if they are equal (==) PHP attempts to convert the string to a number.
If you did var_dump(0 === "0.00") you would get false. === is identical (ie. equality with type checking)

I can see why this sucks, but these idiosyncrasies can be avoided with the use of === instead of ==.

Doctor w-rw-rw-
Jun 24, 2008
Java code:
finishUp(AD_SUCCESS); // The ad didn't succeed.
This was absolutely necessary as a workaround, but I hate myself (context not included, can't really include it, sorry).

w00tz0r
Aug 10, 2006

I'm just so god damn happy.
I hope there's a better comment than that explaining why. That's the sort of stuff I'd find in my last job's code base that would leave me staring at the screen for ages.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
At least the sentence is complete. I've torn my hair out so many times over comments in legacy code with an unspecified "it" or "this".

FamDav
Mar 29, 2008

Gazpacho posted:

At least the sentence is complete. I've torn my hair out so many times over comments in legacy code with an unspecified "it" or "this".

Every time I write comments, I always have to check my pronouns to make sure it's blatantly obvious what any pronoun means. Pronouns are worthless in code though, fwiw.

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

Chopper posted:

The boolean of a string is true in PHP. The boolean of any non-zero integer is true. The boolean of 0 is false.

When you compare an int and a string to see if they are equal (==) PHP attempts to convert the string to a number.
If you did var_dump(0 === "0.00") you would get false. === is identical (ie. equality with type checking)

I can see why this sucks, but these idiosyncrasies can be avoided with the use of === instead of ==.

I ran into this when dealing with output from a mysql query, where everything is returned as a string. And since this was a decimal field in the table, zero was "0.00", which isn't boolean false but is equal to zero, and the array_filter() was keeping it in.

I understand how it works, that doesn't mean i have to like that php is intransitive. The only times in my code where I use == are when dealing with something that may have come from a query or a web form, which (at least with the mysql library) are always strings.

Bunny Cuddlin
Dec 12, 2004

Chopper posted:

I can see why this sucks, but these idiosyncrasies can be avoided with the use of === instead of ==.

In a car with a stuck accelerator you can effectively control the speed with the clutch but that doesn't mean you shouldn't get out of the car and stop driving it at the first opportunity.

twig1919
Nov 1, 2011
I am an inconsiderate moron whose only method of discourse is idiotic personal attacks.

Gigantic Slut Man posted:

In a car with a stuck accelerator you can effectively control the speed with the clutch but that doesn't mean you shouldn't get out of the car and stop driving it at the first opportunity.

The sensible thing to do would be to drive it straight through the dealers front door and scream at them to fix it.

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
I haven't used mysqli in years and have never used PDO, but I'm hoping they return things from the database in a native type rather than casting everything to string? If that's the case then it's my own fault for using mysql (not by design, inherited a system and upgrading to mysqli has not been in the priority list). If it's not the case then my complaint stands, I *hate* having to use == when dealing with queries and form input, it's either that or casting all over the place. ... Which really I should probably be doing in the first place, at least with form input.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
While I understand that there are many design horrors in PHP, and to a lesser extent Javascript, this hand-wringing over implicit conversion reminds me of the arguments when I was learning BASIC against using = for assignment (as well as comparison), because some poor stupid programmer might flip out over a statement like X = X + 1.

Similarly Dijkstra argued that no language should have lazy logical and/or operators because they do not have exact mathematical precedents and therefore programmers can never possibly understand them.

Gazpacho fucked around with this message at 03:55 on Sep 2, 2012

Look Around You
Jan 19, 2009

Gazpacho posted:

While I understand that there are many design horrors in PHP, and to a lesser extent Javascript, this hand-wringing over implicit conversion reminds me of the arguments when I was learning BASIC against using = for assignment (as well as comparison), because some poor stupid programmer might flip out over a statement like X = X + 1.

Similarly Dijkstra argued that no language should have lazy logical and/or operators because they do not have exact mathematical precedents and therefore programmers can never possibly understand them.

Implicit conversion isn't always bad if it follows a consistent set of rules and behaves fairly intuitively. For example, in C, any pointer type can be implicitly converted into a void *, and nobody has a problem with this. For a more related example, Perl does fairly aggressive coercion too, but it includes a separate set of comparison operators for strings than it does for numbers, so you don't need to worry about any weird type coercion rules when you're trying to compare something string-wise vs numerically.

Deus Rex
Mar 5, 2005

Golbez posted:

I ran into this when dealing with output from a mysql query, where everything is returned as a string. And since this was a decimal field in the table, zero was "0.00", which isn't boolean false but is equal to zero, and the array_filter() was keeping it in.

I understand how it works, that doesn't mean i have to like that php is intransitive. The only times in my code where I use == are when dealing with something that may have come from a query or a web form, which (at least with the mysql library) are always strings.

FWIW you can pass a callback to array_filter which uses strict comparison. Having said that, this kind of poo poo (PHP builtins using == and not === by default) bites me all the god drat time.

qntm
Jun 17, 2009

Gazpacho posted:

While I understand that there are many design horrors in PHP, and to a lesser extent Javascript, this hand-wringing over implicit conversion reminds me of the arguments when I was learning BASIC against using = for assignment (as well as comparison), because some poor stupid programmer might flip out over a statement like X = X + 1.

Similarly Dijkstra argued that no language should have lazy logical and/or operators because they do not have exact mathematical precedents and therefore programmers can never possibly understand them.

I always liked X + 1 -> X as an assignment syntax.

Adbot
ADBOT LOVES YOU

geonetix
Mar 6, 2011


qntm posted:

I always liked X + 1 -> X as an assignment syntax.

You can already do it that way by using the "go-to" operator:

code:
for (int i = 10; i --> 0;;) { }
But all silliness aside, simply learn that PHP does coercive comparisons and work around it when dealing with them. Not saying it's nice, clean, helpful or anything. But this really is one of the basic things that you'll run into every day working with PHP.

geonetix fucked around with this message at 11:26 on Sep 2, 2012

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