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
Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

yaoi prophet posted:

Perl. The reason and binds weaker than assignment is so you can do something like

code:
$result = foo() or die "what the gently caress?\n"
# which is equivalent to
($result = foo()) or (die "what the gently caress?\n")
(which will evaluate foo(), store it in $result, and then fatally exit if that value is false-y) and they decided to make 'and' have similar precedence.

It's notable that the 'and' and 'or' operators were put into the language for this purpose; '&&' and '||' have the roughly the precedence they have in C.

Adbot
ADBOT LOVES YOU

Freakus
Oct 21, 2000
I don't know if it's a horror, but I really hate the trend in webapps of putting everything in a given layer in a single directory.

I know it's easy, but do you really need to add that 75th model to the same model directory as those 74 other models? Do all those 74 models really belong together? Maybe it would be easier to understand your application if you had some separation in your features rather than a giant directory full of files.

Steve French
Sep 8, 2003

yaoi prophet posted:

Perl. The reason and binds weaker than assignment is so you can do something like

code:
$result = foo() or die "what the gently caress?\n"
# which is equivalent to
($result = foo()) or (die "what the gently caress?\n")
(which will evaluate foo(), store it in $result, and then fatally exit if that value is false-y) and they decided to make 'and' have similar precedence.

Ruby also has this (presumably PHP and Ruby both inherited it from Perl); the idea is basically that &&/|| are for boolean logic operations, and and/or are for control flow.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

The Gripper posted:

I submitted this to our internal bugtracker as part of a repro for a toolchain bug, only remembered I'd named everything in the stupidest possible way after I'd hit submit.
C++ code:
extern "C" {
	__declspec(dllexport) void dongs(int x) { printf("hi"); }	
}

class Penis {
	private:
		std::string dongs;
		int craps;
...
	Penis* r = new Penis("arse", 1);
This was under 20 minutes ago.

Eventually, everyone does something like that once, to some degree of severity or another. I haven't yet, but I have done the "DELETE FROM foo" ...5 seconds later... "gently caress, that was production / gently caress, I didn't include a where clause and that was production"

A friend and former boss of mine once accidentally dropped a production database.

Enos Shenk
Nov 3, 2011


Something else I found floating around my webspace. This screenshot a couple years ago when Sony was getting hacked every day. Someone linked me to a CAPTCHA they were using for one of their sites. It looked a little funny so I hit view source.



Welp.

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?

xtal
Jan 9, 2011

by Fluffdaddy
e: removed

xtal fucked around with this message at 03:27 on Feb 28, 2013

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Steve French posted:

Ruby also has this (presumably PHP and Ruby both inherited it from Perl); the idea is basically that &&/|| are for boolean logic operations, and and/or are for control flow.

Ok, that makes slightly more sense. I haven't really used any Perl derivatives, so the usage of those operators used for control flow didn't click. I thought they saw Python using 'and'/'or'/etc and just decided to tack them on at the end of the list, because PHP.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
I liked the Mise Institute's old validation question for tagging articles. It always asked the same thing, "What is 2 + 3?" (bottom of the page)

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

Steve French posted:

Ruby also has this (presumably PHP and Ruby both inherited it from Perl); the idea is basically that &&/|| are for boolean logic operations, and and/or are for control flow.

What's the advantage of these over an "if" clause?

nielsm
Jun 1, 2009



HappyHippo posted:

What's the advantage of these over an "if" clause?

The entire point of Perl is to allow the most trivial things to be written in as many entirely different ways as possible.

raminasi
Jan 25, 2005

a last drink with no ice

HappyHippo posted:

What's the advantage of these over an "if" clause?

It's extremely concise and readable once you know the idiom?

FamDav
Mar 29, 2008

HappyHippo posted:

What's the advantage of these over an "if" clause?

well, it's convenience becomes more apparent when you have to chain multiple "if success then" statements together. I can effectively say something like:

code:
(foo.initModuleA and foo.initModuleB and foo.initModuleC and foo.computeResult) or (throw foo.Error)
without nesting a whole lot of ifs

Steve French
Sep 8, 2003

I find that stylistically in ruby it makes more sense sometimes to do "A and B" instead of "B if A" or "if A; B; end", in situations where A is a significant operation.

For example if A was to perform a database operation, or call some computationally expensive method, I'd probably use and. If A were some simple boolean logic, I'd be more inclined to use if.

het
Nov 14, 2002

A dark black past
is my most valued
possession

Steve French posted:

I find that stylistically in ruby it makes more sense sometimes to do "A and B" instead of "B if A" or "if A; B; end", in situations where A is a significant operation.
In terms of convention (in Perl at least) it probably partially originates with shell scripting, where using && and || for conditional execution of successive commands is not uncommon.

Steve French
Sep 8, 2003

het posted:

In terms of convention (in Perl at least) it probably partially originates with shell scripting, where using && and || for conditional execution of successive commands is not uncommon.

Yeah that too for sure (earlier examples of "or die" also); I was just giving an example of when I find myself using and instead of if.

zootm
Aug 8, 2006

We used to be better friends.

Ithaqua posted:

A friend and former boss of mine once accidentally dropped a production database.
I did this not long after starting my current job. In hindsight having about 12 windows open to devo and 1 open to prod basically amounts to "database roulette."

Happily the site hadn't launched and everything was recalculable.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.
I once physically dropped the production database. On the floor.

McGlockenshire
Dec 16, 2005

GOLLOCKS!

nielsm posted:

The entire point of Perl is to allow the most trivial things to be written in as many entirely different ways as possible.

For example, Perl lets you write the conditionals on the right.

foo() if bar();

Perl also has a built in negative conditional.

foo() unless baz();

As another example, Perl lets you define quote operators on the fly.

print q~This is a 'single-quoted' string. ~ . qq~And this is a "double-quoted" string with $interpolation.~

This means that you can do freaky incorrect things just to screw with people, like

die qq#How'd you do that? "$bad" should never be "$good". Stop that.\n# unless $bad eq $good;

qntm
Jun 17, 2009

zootm posted:

I did this not long after starting my current job. In hindsight having about 12 windows open to devo and 1 open to prod basically amounts to "database roulette."

Happily the site hadn't launched and everything was recalculable.

Some people set up their terminals so that terminals pointing at a production machine have unmissable bright red backgrounds or red text or something.

Destroyenator
Dec 27, 2004

Don't ask me lady, I live in beer

qntm posted:

Some people set up their terminals so that terminals pointing at a production machine have unmissable bright red backgrounds or red text or something.
I was actually talking to someone about this as a why-don't-they-do-this feature for SSMS a couple of weeks ago. I've worked on web projects that have had different CSS stylings for local vs uat vs live and it's such a useful feature.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

qntm posted:

Some people set up their terminals so that terminals pointing at a production machine have unmissable bright red backgrounds or red text or something.

I've done the partially red prompt for root, hadn't seen this though.

PhonyMcRingRing
Jun 6, 2002

Destroyenator posted:

I was actually talking to someone about this as a why-don't-they-do-this feature for SSMS a couple of weeks ago. I've worked on web projects that have had different CSS stylings for local vs uat vs live and it's such a useful feature.

You may wanna take a look at this http://www.ssmstoolspack.com/
There's an option to do just that, though it only changes the background color in the connection bar of a query window. Saved my rear end a few times, though. I also prefer to open up a new instant of SSMS if I need to deal with production databases, just so there's no confusion between having multiple connections open.

Munkeymon
Aug 14, 2003

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



I have this:
code:
BEGIN SELECT 'BE CAREFUL DAMIT' AS [YOU MORON]; RETURN END; -- Keep it from running the whole file by accident
At the top of all of my .sql files while I work on them and removed the run button from the menu because I've clicked it accidentally when trying to run a syntax check on a query. Only downside is that I now expect that highlighting code and hitting Ctrl+E to run it in any editor I use.

Zombywuf
Mar 29, 2008

Munkeymon posted:

I have this:
code:
BEGIN SELECT 'BE CAREFUL DAMIT' AS [YOU MORON]; RETURN END; -- Keep it from running the whole file by accident
At the top of all of my .sql files while I work on them and removed the run button from the menu because I've clicked it accidentally when trying to run a syntax check on a query. Only downside is that I now expect that highlighting code and hitting Ctrl+E to run it in any editor I use.

I used to do something like that because I expected C-e to go to the end of the line.

ChickenOfTomorrow
Nov 11, 2012

god damn it, you've got to be kind

I only connect to our prod server through RDC in an 800x600 window. I find the irritation of being trapped in a tiny window and unable to maximize it helps me remember not to do anything stupid.

..btt
Mar 26, 2008

Ithaqua posted:

Eventually, everyone does something like that once, to some degree of severity or another. I haven't yet, but I have done the "DELETE FROM foo" ...5 seconds later... "gently caress, that was production / gently caress, I didn't include a where clause and that was production"

A friend and former boss of mine once accidentally dropped a production database.

Once, on a production system I was working with, one of the app support guys ran something like:

code:
UPDATE Users SET Password = 'something'
To rectify this mistake, they sent out an email to all users of the system saying "We accidentally reset everybody's password to 'something', you should log in and change yours asap" :downs:

mobby_6kl
Aug 9, 2009

by Fluffdaddy

..btt posted:

Once, on a production system I was working with, one of the app support guys ran something like:

code:
UPDATE Users SET Password = 'something'
To rectify this mistake, they sent out an email to all users of the system saying "We accidentally reset everybody's password to 'something', you should log in and change yours asap" :downs:

That's a nicely layered horror you've got there buddy!

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

..btt posted:

Once, on a production system I was working with, one of the app support guys ran something like:

code:
UPDATE Users SET Password = 'something'
To rectify this mistake, they sent out an email to all users of the system saying "We accidentally reset everybody's password to 'something', you should log in and change yours asap" :downs:

Is one of the layers to this horror that the passwords are stored in plain text?

..btt
Mar 26, 2008
While I am currently working on a system that did store passwords in plain text (we're totally replacing auth, thank god), the above snippet was just for brevity.

Qwertycoatl
Dec 31, 2008

When I'm writing a delete statement, I start off by writing "WHERE butts='Yes' AND farts=4" then go back and fill in the DELETE FROM once I'm happy with how the rest of it looks.

armorer
Aug 6, 2012

I like metal.
I start off by writing "SELECT * FROM", run the query several times until I know it hits only the stuff I want to delete, and then change it to a DELETE FROM.

Bunny Cuddlin
Dec 12, 2004
I have a Kinect sensor attached to my computer and I wrote an app that sits between my PC and the database server and it only allows me to run destructive commands if I do a little voodoo dance and say a magic word can we get off this please

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

Bunny Cuddlin posted:

I have a Kinect sensor attached to my computer and I wrote an app that sits between my PC and the database server and it only allows me to run destructive commands if I do a little voodoo dance and say a magic word can we get off this please

https://www.youtube.com/watch?v=Mx-Y8KFFHpE

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe
code:
app.use(express.basicAuth('username', 'password')) if process.env.NODE_ENV
The if is always true.

Sang-
Nov 2, 2007

Internet Janitor posted:

It is unfortunate that such gag languages are almost always sugar for essentially ALGOL semantics. Couldn't brogrammers brogram in a functional or declarative style? Is a little creativity so much to ask for in my extended jokes?

edit: presumably a brolang would never feature something like s-expressions. Despite an enticing name, you cannot say "homoiconicity" without "homo".

Wheany posted:

BroseF, the F is for "functional"

Brolog, obviously.

zootm
Aug 8, 2006

We used to be better friends.

qntm posted:

Some people set up their terminals so that terminals pointing at a production machine have unmissable bright red backgrounds or red text or something.
I actually did exactly that afterwards, though I've since list the config I was using. I'm sure I'm more careful now. I mean, I must be, right?

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Wikipedia helpfully explains how to calculate the date of Easter Sunday in MS Excel using what appears to be the most convoluted method possible:

=DATE(A1,INT((MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30)+MOD((32+(2*MOD(INT(A1/100),4))+(2*INT(MOD(A1,100)/4))-(MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30))-(MOD(MOD(A1,100),4))),7)-(7*INT(((MOD(+A1,19))+(11*MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30))+(22*MOD((32+(2*MOD(INT(A1/100),4))+(2*INT(MOD(A1,100)/4))-(MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30))-(MOD(MOD(A1,100),4))),7)))/451))+114)/31),MOD((MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30)+MOD((32+(2*MOD(INT(A1/100),4))+(2*INT(MOD(A1,100)/4))-(MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30))-(MOD(MOD(A1,100),4))),7)-(7*INT(((MOD(+A1,19))+(11*MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30))+(22*MOD((32+(2*MOD(INT(A1/100),4))+(2*INT(MOD(A1,100)/4))-(MOD((19*(MOD(+A1,19))+(INT(A1/100))-(INT(INT(A1/100)/4))-(INT((INT(A1/100)-(INT((INT(A1/100)+8)/25))+1)/3))+15),30))-(MOD(MOD(A1,100),4))),7)))/451))+114),31)+1)

It also provides this method:
=ROUND(DATE(A1,4,1)/7+MOD(19*MOD(A1,19)-7,30)*14%,0)*7-6
I wonder which one I should use

Zombywuf
Mar 29, 2008

Oh man, it's just been pointed out to me I was using sequential integers for session ids.

Adbot
ADBOT LOVES YOU

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Zombywuf posted:

Oh man, it's just been pointed out to me I was using sequential integers for session ids.

So was I until this last update, happens to the best of us

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