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
beuges
Jul 4, 2005
fluffy bunny butterfly broomstick

Wardende posted:

That's fine because it means that a hacker would have to physically be at the machine which hosts the database to hack it.

or exploits a remote-access vulnerability in some other application on the same server which gives it local access, and then it can just connect to the database without needing a password.

Adbot
ADBOT LOVES YOU

Wardende
Apr 27, 2013

beuges posted:

or exploits a remote-access vulnerability in some other application on the same server which gives it local access, and then it can just connect to the database without needing a password.

Or downloads the database onto their local machine :ssh:

QuarkJets
Sep 8, 2008

Wardende posted:

Or downloads the database onto their local machine :ssh:

Nah don't worry guys, it's cool, we'll just put up some signs around the office saying "DO NOT STEAL OUR DATABASE" and we'll be covered

Volmarias
Dec 31, 2002

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

QuarkJets posted:

Nah don't worry guys, it's cool, we'll just put up some signs around the office saying "DO NOT STEAL OUR DATABASE" and we'll be covered

What if someone uses whiteout on the "NOT" and then claims that you asked them to steal it?

Check and mate :smugdog:

Impotence
Nov 8, 2010
Lipstick Apathy
Not really bad code per se, but who the gently caress indents like this????
code:

    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
                    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
                                   <link rel="shortcut icon" href="ico/favicon.png">

dc3k
Feb 18, 2003

what.

Biowarfare posted:

Not really bad code per se, but who the gently caress indents like this????

That is really strange...generally I would do it like this, as I imagine most would:

code:
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"   href="ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed"                 href="ico/apple-touch-icon-57-precomposed.png">
<link rel="shortcut icon"                                href="ico/favicon.png">

senrath
Nov 4, 2009

Look Professor, a destruct switch!


Biowarfare posted:

Not really bad code per se, but who the gently caress indents like this????
code:

    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
                    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
                                   <link rel="shortcut icon" href="ico/favicon.png">


Looks like a variant of Eastern Polish Christmas Tree notation.

Jewel
May 2, 2009

senrath posted:

Looks like a variant of Eastern Polish Christmas Tree notation.

Yeah that's exactly what I thought. But there's no periods or assignment or anything so they did this. I'd take a guess their coding in other languages would probably look like Eastern Polish Christmas Tree at times, hopefully not all the time, but I can't tell if they've only done it on like-elements or not :ohdear:

Foiltha
Jun 12, 2008

Biowarfare posted:

Not really bad code per se, but who the gently caress indents like this????
code:

    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png">
                    <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png">
                                   <link rel="shortcut icon" href="ico/favicon.png">


The Bootstrap examples are formatted like that for some reason. That has probably lead to that style getting popular because people are copy-pasting the examples as base templates :v:

qntm
Jun 17, 2009
code:
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"   href="ico/apple-touch-icon-72-precomposed.png" >
<link rel="apple-touch-icon-precomposed"                 href="ico/apple-touch-icon-57-precomposed.png" >
<link rel="shortcut icon"                                href="ico/favicon.png"                         >

Dicky B
Mar 23, 2004

qntm posted:

code:
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"   href="ico/apple-touch-icon-72-precomposed.png" >
<link rel="apple-touch-icon-precomposed"                 href="ico/apple-touch-icon-57-precomposed.png" >
<link rel="shortcut icon"                                href="ico/favicon.png"                         >
I do this when defining lookup tables in C and I know it's pointless and annoying to maintain for anybody who doesn't have some kind of editor plugin but I can't help myself :( I suppose there are worse habits.

dc3k
Feb 18, 2003

what.

Dicky B posted:

I know it's pointless and annoying to maintain for anybody who doesn't have some kind of editor plugin

How?

Dicky B
Mar 23, 2004

code:
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"   href="ico/apple-touch-icon-72-precomposed.png" >
<link rel="apple-touch-icon-precomposed"                 href="ico/apple-touch-icon-57-precomposed.png" >
<link rel="shortcut icon"                                href="ico/favicon.png"                         >
<link rel="some new, longer thing"                       href="ico/now-you-have-to-go-back-and-edit-all-the-other-rows.png">
edit: Just to clarify I was responding to qntm who was demonstrating the practice of making all the end brackets line up.

Bunny Cuddlin
Dec 12, 2004
aaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
hey guys, my indentation style can beat up your indentation style

nuvan
Mar 29, 2008

And the gentle call of the feral 3am "Everything is going so well you can't help but panic."

Dicky B posted:

code:
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"   href="ico/apple-touch-icon-72-precomposed.png" >
<link rel="apple-touch-icon-precomposed"                 href="ico/apple-touch-icon-57-precomposed.png" >
<link rel="shortcut icon"                                href="ico/favicon.png"                         >
<link rel="some new, longer thing"                       href="ico/now-you-have-to-go-back-and-edit-all-the-other-rows.png">
edit: Just to clarify I was responding to qntm who was demonstrating the practice of making all the end brackets line up.

Stuff like this is where editors that have multi-cursor support come in handy (eg Sublime Text 2)

Sebbe
Feb 29, 2004

Dicky B posted:

code:
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"   href="ico/apple-touch-icon-72-precomposed.png" >
<link rel="apple-touch-icon-precomposed"                 href="ico/apple-touch-icon-57-precomposed.png" >
<link rel="shortcut icon"                                href="ico/favicon.png"                         >
<link rel="some new, longer thing"                       href="ico/now-you-have-to-go-back-and-edit-all-the-other-rows.png">
edit: Just to clarify I was responding to qntm who was demonstrating the practice of making all the end brackets line up.

Visual block mode will handle fixing that in a pinch :cool:

Amarkov
Jun 21, 2010
So I learned last year how to access private member fields with Java's reflection library. Funny little trick, but I'm never going to use it right?

Well, this application dispatches events to an asynchronous scheduler with private access. I need to write unit tests to check that these events actually complete. And thus I end up with

code:
Field f = OurSession.class.getDeclaredField("scheduler");
f.setAccessible(true);
OurScheduler scheduler = (OurScheduler) f.get(session);

Volmarias
Dec 31, 2002

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

Amarkov posted:

So I learned last year how to access private member fields with Java's reflection library. Funny little trick, but I'm never going to use it right?

Well, this application dispatches events to an asynchronous scheduler with private access. I need to write unit tests to check that these events actually complete. And thus I end up with

code:
Field f = OurSession.class.getDeclaredField("scheduler");
f.setAccessible(true);
OurScheduler scheduler = (OurScheduler) f.get(session);

If you have access to the source, try making the private inner class package private, and/or write a subclass to expose that variable for testing.

emoji
Jun 4, 2004
I think this counts (use 80 columns):


s=$(echo H4sIAG9C7lEAA61XbZLrKAz8v6cx5sPiOIDx/Y+w3ZKJIZN5eVu1UU1mnJh2q9USjNvcHb766rZv4UOU ozGiuK2V3+5LqbbsavO1Nl7HLnvsPsz3RClAeOJoxP+MVxujHynxHh9KOzfZSyIL47ViWYxv5+iHryn1 I7t+GJ7shlcaEFvsZPYTi1G2TwxTItbAo46GpwyxbEUrSXx2gt+8Iu83hWt2DKJZzlDxxqOKRJ3xpPSN If5zxtkZP8ZAddvI1/CMi6L52s58unOXW0HqMefMqhrKg0oNBx7fLc+y0SXi+an42Okafg8P9Rlv5qbZ VvUGletaE0Uyx1EvXpNxSYc+8T3fGc2yPRpU329+vNpmpeho+5So9pR3PMv5rnAwtxJV37Eu9njlrYJ2 vPgOtwv9vT5pzndkbeqJ57OR4yUZNQi11ojKHb7V0LfzoqeYh7mQHfC470EjS6yK53VeFZ1K3POiO3Ad swSPZ5WeapBSI/O2qvtwtOG+p8LGL3ZFA2a8qKJkIoJfy7t2TyG7sOeXL9c+NkRjJ7nAp+SDDCOukiHi GvZA4lhJbujQI2+mX5RPHZeSKQbHZsWj5oVeETDBt0W1kJTOK0V3pJNcnwlA3deJN7S4+UVMsMh+E68z B/VAN0bkHVhnqLnFa63pmHXDVTfeDr0S7zeWRNYcYg1WmxFUmE8aFeVfc9Z39RMdwXrc64B9K11WPMyE YpN4dOkaD8Na51X1pTeq8ob3eGPl9qYhakqWN95L5RTXfKnYcNq6+/jiC100zbkXSymcssMJmnMiGrOd +7424wgHb2eyyT4Y6my7uBbrPCfy82S6hx5kV8ANS7cqWuIMWzPWrqxpY69wxlApXEfjyXdMLp1ZI2Pj 5wPmrxjLmV/hPnKy+4nXAhHpoVrxE9iP1m2yI3edxfYkTjn+xnxHJzh5TYwINOBxt2AXEpETS7WDhpJt 2tu+/dTCWMHDQFNGlXNN/7JomnHWyd7JSzvRczKaRp9OFdwr8E3jenc49L3umk3xddZUvmK89NNos/+3 4O6IZznyMSzpCEkBaFl33J27EE8LfIb70Qk/EMuMJ3ixKNDTWRXHnFPGf4HHk899rwCR/WGnoYNsdc4Z Nw0++c/csDaOCgDxcPaSURPFgPtMg6/ZhsHuWb9ca5VSEH35X898xo4/4Leu/xHgxxNC49nrm3ZU6xue Mv6CZLkihf3uroeNuJf6I3f3B8ct7BRPEc3PztxDzAf3u0cG3n3iSTxTWEb32bmNSvwtlsXgxy4gHt1j +6Tuf/8JyxRUN08nEGi6P/j/R/C/jE/7/vf4519mHHRY0QwAAA==|sed 's/ //g'|base64 -$(if [ `uname` == "Darwin" ];then echo D;else echo d;fi)|gunzip);tput rev;for i in $(seq 0 2 $((${#s}-1)));do tput setaf $(printf '%d' 0x${s:i:2});echo -n '  ';done;echo;tput sgr0

emoji fucked around with this message at 09:54 on Jul 23, 2013

Workaday Wizard
Oct 23, 2009

by Pragmatica

kraftwerk singles posted:

I think this counts (use 80 columns):

...

Someone run this and post screenshot.

I'm guessing it's goatse.

ephphatha
Dec 18, 2009




Shinku ABOOKEN posted:

Someone run this and post screenshot.

I'm guessing it's goatse.

You guessed well (kinda).
Version 1:nws:
Version 2

Edit: colours are slightly off cause my terminal is transparent

ephphatha fucked around with this message at 10:40 on Jul 23, 2013

emoji
Jun 4, 2004
Thanks for running my bullshit code.

This elegant piece will display any image from a file or url in the terminal without the terminal size restriction, but it requires ImageMagick. More info here. Someone else has already put a wrapper around it that continuously gets a flickr stream given some tags, which is cool if you're really into stupid crap like me. The code may make you cry.


convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash

geonetix
Mar 6, 2011


Just ran into something that's always pretty sad (it's coldfusion, but the comments make it worse):

code:
// If the thread is still running.
if (redactedThread.status == 'RUNNING') {
	// Trace a message.
	trace(text="Waiting for redacted");
}
Every single line of code in this file has a comment. It wasn't there some revisions ago. Somebody actually spent time adding it.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

geonetix posted:

Every single line of code in this file has a comment. It wasn't there some revisions ago. Somebody actually spent time adding it.

I'm sure someone was just doing a thorough refactoring, and forgot to remove the comments after cleaning up the code.

And now I'm glad I'm not saying that out loud or you'd hear me cracking up halfway through.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Foiltha posted:

This is magnificent.

https://github.com/Mikkeren/FizzBuzzEnterpriseEdition/commit/8a53efdf66a294ca715e7ea105c6c99c6e4afbde

quote:

<= is a lot of responsibility on one line, better separate it into < and ==.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

geonetix posted:

Just ran into something that's always pretty sad (it's coldfusion, but the comments make it worse):

code:
// If the thread is still running.
if (redactedThread.status == 'RUNNING') {
	// Trace a message.
	trace(text="Waiting for redacted");
}
Every single line of code in this file has a comment. It wasn't there some revisions ago. Somebody actually spent time adding it.

pokeyman posted:

I'm sure someone was just doing a thorough refactoring, and forgot to remove the comments after cleaning up the code.

And now I'm glad I'm not saying that out loud or you'd hear me cracking up halfway through.

Of course those comments are completely useless. Yes, I can see that you're checking whether the thread is still running. That is obvious.

The question the comments should be answering is "Why", not "What"

e: preemptive
"The thread might still be running, so we have to check"
"Trace a message so that people debugging know what is going on"
:smug:

Wheany fucked around with this message at 14:13 on Jul 24, 2013

Che Delilas
Nov 23, 2009
FREE TIBET WEED

geonetix posted:

Just ran into something that's always pretty sad (it's coldfusion, but the comments make it worse):

code:
// If the thread is still running.
if (redactedThread.status == 'RUNNING') {
	// Trace a message.
	trace(text="Waiting for redacted");
}
Every single line of code in this file has a comment. It wasn't there some revisions ago. Somebody actually spent time adding it.

This is okay as long as they put in a meta-comment block at the top of each file explaining why they commented the lines they commented and now I have to go rinse the vomit out of my mouth.

Bunny Cuddlin
Dec 12, 2004
C# code:
			catch (Exception)
			{
				throw;
			}
1800 line file with every function body wrapped in a try block with this same catch block

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Bunny Cuddlin posted:

C# code:
			catch (Exception)
			{
				throw;
			}
1800 line file with every function body wrapped in a try block with this same catch block

At least they're not throwing ex.

No Safe Word
Feb 26, 2005

Ithaqua posted:

At least they're not throwing ex.

throw new Exception(ex);

nielsm
Jun 1, 2009



Bunny Cuddlin posted:

C# code:
			catch (Exception)
			{
				throw;
			}
1800 line file with every function body wrapped in a try block with this same catch block

I dunno, maybe it lets them set a breakpoint on the throw line to look at the exceptions in the debugger before they hit something else.

Zhentar
Sep 28, 2003

Brilliant Master Genius
If only debuggers had a feature that let you break when the exception was thrown. If only...

raminasi
Jan 25, 2005

a last drink with no ice

Zhentar posted:

If only debuggers had a feature that let you break when the exception was thrown. If only...

If only this feature always worked :(

Zhentar
Sep 28, 2003

Brilliant Master Genius
I usually have to keep it turned off because of .NET framework things that like to throw exceptions :(

No Safe Word
Feb 26, 2005

Zhentar posted:

I usually have to keep it turned off because of .NET framework things that like to throw exceptions :(

You can selectively enable/disable exceptions to trap. Just don't ever trap SqlClientException and expect to be able to step over EF calls because they sure as poo poo like to use exceptions as control flow :downs: So, perfectly okay poo poo will have tons of exceptions raised that you'll just have to continually "continue" past.

IMlemon
Dec 29, 2008

geonetix posted:

Just ran into something that's always pretty sad (it's coldfusion, but the comments make it worse):

code:
// If the thread is still running.
if (redactedThread.status == 'RUNNING') {
	// Trace a message.
	trace(text="Waiting for redacted");
}
Every single line of code in this file has a comment. It wasn't there some revisions ago. Somebody actually spent time adding it.

Here's a :airquote: coding convention :airquote: from my current project.

Java code:
/**
* Implements interface SomeInterface 
*/
public class SomeClass implements SomeInterface {
   horrors go here
}
Great job guys, nevermind that your code is a pile of poo poo, just make sure you add comments everywhere! :negative:

IMlemon fucked around with this message at 22:38 on Jul 24, 2013

qntm
Jun 17, 2009
Later, SomeClass will be refactored to implement SomeOtherInterface instead. The comment won't be updated, of course.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

I'm not going to post code because it would just be a nested series of statements, but I've inherited a farrago of snakes on a .NET project. This guy is basically bubbling ALL errors in web.config and doing a custom handler for them. Which is good right? Not when the error catch is to redirect everything to Error.aspx. No matter what it is. Broken image? Error.aspx. Http versus Https mixup? Error.aspx. CSS or javascript file not load for whatever reason? Error.aspx. Oh what if there's an error on Error.aspx? Error.aspx. Forever.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

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


Am I the only one who had to look this up?

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