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
canis minor
May 4, 2011

Every day give me something to laugh (and cry) about - from top of my head:

code:
<select><option><a href="#>foo</a></option></select>
code:
<label><p><h3>bar</h3></p></label>
code:
<form><form><input type='submit' /></form><input type='submit' /></form>
(this, coming from people whose job is to translate designs to html files)

Also, something like this used to happen continuously:

code:
<input name='save' value='Save'/>
changed to
code:
<input name='save' value=''/>
(changed because the button should have a background-image on it, instead of text)

until I've went through my predecessors code changing all if ($_POST['save']) to if (isset($_POST['save'])).

canis minor fucked around with this message at 14:48 on Feb 25, 2014

Adbot
ADBOT LOVES YOU

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.

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?

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

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.

canis minor
May 4, 2011

down with slavery posted:

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.

It is wrong, because it is unnecessary in this instance. If it was within different scopes, it would be arguable, but here there's no question about it.

Suspicious Dish posted:

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);
}

I assume it's again for me - yes, that's what it will do. The point I'm making is that you'll write it the first way round, and not the second, even though it introduces the same quirky re-initialization of variable, or if you wish:

code:
var i;
for (i in foo)
   print(i);

var i;
for (i in bar)
   print(i);
Again - why would you write it like this? You'll write however `for (var i in foo)` (or, at least I do that), re-initializing the same variable i in every for. Maybe the 'wrong wrong wrong' part is something that bugs me and is wrong for me.

I apologize for taking the spotlight :ohdear:

canis minor fucked around with this message at 16:09 on Mar 6, 2014

canis minor
May 4, 2011

Funking Giblet posted:

It's actually what we're doing.

"We can't support IE6 & IE7 anymore as we will not put an XP machine on our network in any way shape or form, read this
https://www.microsoft.com/en-us/windows/enterprise/endofsupport.aspx"

Hopefully it works.

There's always this: http://www.my-debugbar.com/wiki/IETester/HomePage

:downs:

vvv CSS results may vary and not reflect actual IEx version

canis minor fucked around with this message at 14:52 on Mar 11, 2014

canis minor
May 4, 2011

Use YAML instead!

canis minor
May 4, 2011


I feel stupider and I just scrolled past the code, glimpsing at bits and pieces.

canis minor
May 4, 2011

Dicky B posted:

C++ code:
#ifdef WIN32
	Sleep(5000);						
#elif defined(__linux__)
	sleep(5000);			
#endif

Um, isn't C++ case sensitive? (been too long since I've seen C++)

canis minor
May 4, 2011

Dessert Rose posted:

That'd be the reason for the ifdef. See if you can find the actual problem with the code!

Ah yes - a little googling and then actually reading a couple of answers above clears the matter.

canis minor
May 4, 2011

Sulla-Marius 88 posted:

Content: The guy next to me is checking out pictures of kitchens and couches and bathrooms instead of fixing the bugs he's made. So I've had to come back from starting the next project and take a look at a bug. In one of the pages I found, at the very end of the file, two separate DB calls that then get var_dumped. The var_dump has been commented out because obviously you can't show development stuff on a production site! But they've left the database calls. This isn't the first time I've seen this. They just... the... they don't understand that if you put code in, it does something. They still think that if it doesn't show up on the page, or if what shows up on the page seems reasonable, then there's no problem whatsoever and job well done, let's call it a day and go home.

Funny you say that. In here people tend to comment stuff out, but unfortunately commenting might happen on multiple levels. First, there's PHP level (/* */), then there's template level ({* *}), then, there's HTML level (<!-- -->). Guess what do I deal with?

Additionally - people comment stuff out when functionality changes (bear in mind that we're running on SVN, so it's possible to look back what it changed from, etc). Yup - keeping the old code that was used to pull out all the users, when now this screen displays all the companies is a great idea. Oh, and the JS code that was here before, let's comment it out as well! Oh, and let's do it a couple of times - because you know, if we'll want to get back to the old code it's easy to spot which code should be commented and which one shouldn't.

Edit: actually, the comparisons you're making are remarkably apt. Right now I'm implementing templates (changing static HTML into something that works) and every tab interface only has designed parts that are visible. As: for three tabs that are to display different types of content, in entirely different manner, only the tab that's visible contains the markup. Seriously, what is the thought process here as if not "only things that are visible matter".

canis minor fucked around with this message at 16:29 on Apr 9, 2014

canis minor
May 4, 2011

AlsoD posted:

code:
bool VertInfluencedByActiveBone(
  FParticleEmitterInstance* Owner,
  USkeletalMeshComponent* InSkelMeshComponent,
  int32 InVertexIndex,
  int32* OutBoneIndex = NULL);

void UParticleModuleLocationSkelVertSurface::Spawn(....)
{
  ....
  int32 BoneIndex1, BoneIndex2, BoneIndex3;
  BoneIndex1 = BoneIndex2 = BoneIndex3 = INDEX_NONE;

  if(!VertInfluencedByActiveBone(
        Owner, SourceComponent, VertIndex[0], &BoneIndex1) &&
     !VertInfluencedByActiveBone(
        Owner, SourceComponent, VertIndex[1], &BoneIndex2) && 
     !VertInfluencedByActiveBone(
        Owner, SourceComponent, VertIndex[2]) &TBoneIndex3)
  {
  ....
}
(from here)

Look carefully at the ampersand on the last line.

This one is nasty, but entire article deserves a read. It surely would give you warnings though, no?

canis minor
May 4, 2011

necrotic posted:

One of the tools the article author used did:

Yes, but that's the app they're advertising on the cited site. I wondered if VS wouldn't pick up on it (I truly don't know - had only experience with gcc, and am pretty sure such casts are picked up)

canis minor
May 4, 2011

code:
function aaa() {
    return {
        test: 1
    }
}; typeof aaa();
> object

code:
function aaa() {
    return
    {
        test: 1
    }
}; typeof aaa();
> undefined

:ohdear:

canis minor
May 4, 2011

baby puzzle posted:

Beware all functions, classes, and libraries that have "Smart" in their name.

I think somebody started their adventure with Smarty.

canis minor
May 4, 2011

pokeyman posted:

How do you read that thread and come away with the conclusion that the Ruby community sucks?

Also do you mean the core team or people who write gems? The latter tends to seem more objectionable than the former from my backseat position.

I'd certainly be irritated if I'd go "Here's the cure for AIDS motherfuckers!", to which I'd get the reply: "You used a bad word, you arrogant poopoohead! You are now wrong!" - and that's what I currently get from this discussion, not being in Ruby community myself: be polite, or we won't accept your code (also we want to be japanese). From what I see, at least two of them are *leaders* of the language.

On the other hand, he's pretty arrogant and inward-looking, and clearly (:byodame:) right (some of my academics were like that), so I hope that some of these people are just screwing with him.

I guess people sometimes are too protective of their code and Ruby guys seem to accept this in this case (well, this Japanese guy that created this clearly cannot be wrong, and we don't want to anger him, because he will leave the project, oh no!).

Come on Felipe, create your own Ruby, with booze, and hookers!

canis minor
May 4, 2011

FamDav posted:

its not the cure for AIDS though; its a patch to change how a bit of datetime works that is not breaking much of anything. people rarely want to work with the dude who creates so much negativity all of the time unless there is literally no other way to do so. I like when he said something like "Yeah I'm an rear end in a top hat and it gets results" and sure it does, but he will literally never move beyond his current level of work that way.

also, who do you think is more important to ruby: the drive by pull requester who spews poo poo the moment things aren't going their way or the dude who has written significant portions of what is generally a pretty tricky subject for your project?

From what I've read through it 1) does not parse git time, 2) produces contrary to expected behavior comparing to the same call from glibc (?)

I'd think that it's the people responsible for project, not a person - as such if the code in some part doesn't adhere to standard and the main maintainer opposes the change without really a reason... well, then it would get me thinking if it's indeed communal project and what really is the point of making changes if they can be arbitrarily revoked. As I said - everyone makes mistakes, so while there shouldn't be a need for diplomacy, they're ending with a situation that original author is being a dick, community adheres to that and makes them look hm... don't know, inviting isn't certainly the word I'd ever use. To resolve the commit situation I'd still expect a peer review, not an arbitrarily decision; bear in mind that it comes from my idealistic point of view where everyone is happily riding on fluffy clouds, as I don't partake in any open source group project (different matter when it comes to work, but that's not here nor there).

As for negativity - from what I've read he started throwing fucks around when he's gotten a response in Japanese to "not come back again" (I don't know about his behavior in other git projects / commits, I'm barely observing what's happening in that thread, and I don't really know if I care enough to go read through it; well, I barely care about this). Probably I'd act similarly.

Hm - I'd probably try to go back to original author to discuss this, if the given solution is indeed worthwhile. If the author would still give me response "no", without real explanation hm... I guess then I'd make everyone unhappy and decide on creating a switch that makes this function ugly and corrects its behavior. Nobody wins! (but yes, I'd have to side with the original maintainer)

canis minor fucked around with this message at 19:22 on May 4, 2014

canis minor
May 4, 2011

revmoo posted:

You know, I don't actually think you are, you just don't understand what I'm saying. Let's adjust your comment to reflect what I said:

"any tool that's good enough is the right tool if it allows a company to accomplish what it needs in the timeframe required to be successful in the marketplace"

Um... that's not correct either. Let's say that I've written some code in PHP; the site was delivered on time and did what it was meant to do in given scale. By this definition then PHP is good enough and my code is good enough. But then a million of users registered, started populating the site and suddenly my code and PHP isn't good enough any more, because the site stops down to a crawl.

Now - even though the project fails atm, it doesn't mean that PHP wasn't the proper tool to do the job. It might boil down to my code. It might be that PHP shouldn't be used, as for example Python would do given task better (with better performance). Then client comes back and says to add this functionality, and this and this. Some of these things might be easy to implement, some of them might be impossible - again it might stem to my code and to how the language is used.

I think the gist is - "well, instead of researching what should be the most proper thing to use here and then training people to use it (and even then - how to ascertain what is the most proper tool to use?), people went with something familiar that still produced good results". As such in my example I don't really need knowledge of PHP to write in node.js (and I wouldn't need to learn the language) if I know JS. It might just be the matter of scalability and how extendable given thing is (as I'd say this is the most obvious thing that jumps to my mind atm). Taking it to the ground of databases: I don't really need to buy Oracle DB if MySQL is good enough for me.

canis minor fucked around with this message at 18:03 on May 15, 2014

canis minor
May 4, 2011

Today I found out about this:

code:
<?php

class A {
    public function rear end()
    {
        var_dump('hi', $this, get_class($this), get_class());
    }
}

class B {
    public function bss()
    {
        A::rear end();
    }
}

$b = new B();
$b->bss();

?>

quote:

string 'hi' (length=2)
object(B)[1]
string 'B' (length=1)
string 'A' (length=1)

PHP you so crazy.

canis minor
May 4, 2011

KaneTW posted:

What did you expect?

At least a notice of trying to call non-static method inside a scope of class that has nothing to do with the original class. On the other hand you can use this as a substitute for multiple inheritance (as - simulate it), I guess. I didn't expect though that you can do something like this at all, and get away with it.

get_class($this) - cool that I get the class of the object that the method is called upon, get_class() is bizarre though and is the origin of this "train of thought" code.

canis minor
May 4, 2011

contrapants posted:

C++ code:
char temp [4096+1];
int imageExist = 0;

// ... snip ...

FILE * fp = popen ( "/bin/ls /file/we/are/looking/for > /dev/null; echo $?", "re" );
if ( fgets ( temp, 2, fp ) != NULL )
{
    if ( temp[0] == '0' )
    {
        imageExist = 1;
    }
}
pclose ( fp );
temp is not used anywhere else.

A paranoid version of fopen.

canis minor
May 4, 2011

ExcessBLarg! posted:

Except it doesn't actually open the file. It's more like a Rube Goldberg version of access(2) and has the same TOCTTOU vulnerability, if that's relevant.

Edit: Looks like OpenSSL coding style.

I was more about - "why wouldn't you use fopen to check for existence of the file", but I got mixed in my thoughts, sorry.

I think I'll actually save this as an example how strangely people can make their life harder.

EDIT: or stat for that matter. why not stat...

canis minor fucked around with this message at 00:28 on May 22, 2014

canis minor
May 4, 2011

My dad still asks me which button should he press to start the computer - the big one, or the small one. He also asks about how to turn the computer off.
Strangely enough he doesn't have any problems with using the browser.

I, on the other hand, felt uneasy using macs. "So, you don't close your applications? Like, at all?".

On the subject of coding horrors:

code:
<p>
 <div>
  <section>
   <section>
    <article>
     <div>
      <p>
whyyyyyyyyyyyyyy

canis minor
May 4, 2011

IT BEGINS posted:

I see it more as calling someone stupid for refusing to take the time to learn to dance ... in a world where half the planet communicates via dancing.

-----

php:
<?
function initClaimInfo($trno, $myuserID=""){
    global $userid;
    global $s_carriercode, $s_custcode, $s_shipperid, $s_credate, $s_checknum;
    global $s_trackingno, $s_phone, $s_weight, $s_declaredvalue, $s_freightcharge;
    global $s_reference, $s_ref_desc, $_REQUEST;
    global $statuslist, $s_status, $s_id, $s_expdeldate;
    global $s_ackdate, $s_paiddate, $s_remark, $s_carrierclaimid, $s_reason;
    global $s_userid, $s_paidamount, $s_barcode, $s_delstatus;
    global $s_c_description, $s_c_sku, $s_c_units, $s_c_weightperunit, $s_c_totalweight;
    global $s_c_costperunit, $s_c_totalcost, $s_c_createdby, $s_c_dcr, $cntlines, $liveCount;

    $s_trackingno = $trno;
    $s_userid = $myuserID ? : $userid;
    $s_carriercode=""; $s_custcode=""; $s_shipperid=""; $s_credate=""; $s_checknum="";
    $s_phone=""; $s_weight=""; $s_declaredvalue=""; $s_freightcharge="";
    $s_ref_desc="";
    $statuslist=""; $s_status=""; $s_id=""; $s_expdeldate="";
    $s_ackdate=""; $s_paiddate=""; $s_remark=""; $s_carrierclaimid=""; $s_reason="";
    $s_paidamount=""; $s_barcode=""; $s_delstatus="";
    for ($rc=1; $rc <= 5; $rc++) {
        $s_reference[$rc]="";
        $s_ref_desc[$rc]="";
    }   
}
?>
I don't even know anymore.

Get out of there, get out as quickly as you can.

edit: I'm noticing more and more shittiness of this thing :allears:


HFX posted:

Requirement:

The value to be calculated is: 1 divided by 3 multiplied by A added to 2 divided by 3 multiplied by B. At the end round this value to nearest hundredths.

How it got implemented:

double value = round(0.33 * A + 0.66 * B)

I'll bite - what's wrong with this?

edit: ah... hundredths. Oh dear.

canis minor fucked around with this message at 17:17 on Jun 13, 2014

canis minor
May 4, 2011

HFX posted:

That isn't what is also wrong with it. The person writing the requirement most likely wanted [did want] the values to remain at max precision until the end. 0.33 != 1.0/3.0.

Hmm - it all depends upon the data you're dealing with; but yes, you've got a point there.

canis minor
May 4, 2011

gently caress them posted:

So my govt job has some horrors.

No documentation, lots of asp classic .NET 2.0 poo poo, no idea what is in what database, and source control isn't "necessary" so I have to email the senior dev for everything since he's never even at work most of the time.

He has to work from home to dodge meetings since the higher ups know and like him now. Being that this is a courthouse, if a judge or THE judge wants something, judge gets it.

The thing that kills me the most is the completely hosed un-normalized database a product from a vendor creates, and the fact that we can't really edit it. Senior Dev is also enough of a goon and did stuff like figure out their bad, hand rolled hash implementation for their 'security' which wasn't salted.

My gut says we need a drat project manager to just stop new work for a while, document EVERYTHING, put poo poo in a source control, and make it so you don't have to email the single point of failure about what is where and what does what, since without any access to the source you're basically twiddling your thumbs.

All of the management here is never-was-a-dev. The Senior Dev who is salaried and technically an appointed official (pay reasons) is basically calling the shots, keeping source on his machine, and doled out work to a prior chain of temp contractors who came, left, and just added to the mess of no source control and no documentation. I love seeing commented out blocks without, yanno, comments or even dates.

Welp. At least it's a great, great, great job if you want to look busy but actually fiddle fart all goddamned day.

My old place was eerily similar (not government though). The bad, first day signs were the presence of DB tables like "god", or "fuck_you", combined with editing the source straight through FTP and loading scripts that went through every PHP file in the system and included them. Oh, good old times.

edit: on the other hand, it was the job where porn was streaming on the screen above my head, so it had its perks (web hosting company).

vvv That's why I've quit as well. That + impending insanity of dealing with that code.

canis minor fucked around with this message at 16:47 on Jun 27, 2014

canis minor
May 4, 2011

fritz posted:

That sounds like a workplace horror.

Depends how you look at it :getin:

But to be serious it was indeed awkward and you'd question why it was running at all (bear in mind this was in not a biggish room, with 5 guys and a girl crammed in). The official reason was "we're testing the streaming services of a provider we're about to implement", and after a week, I think, it was switched off; it was also running on mute. It did weird some people out, when they'd actually see it, but I found hilarious that there was a screen running porn and us staring intently at our screens, at the code we were writing, paying it no attention as if it was most normal thing in the world. I guess my boss was a teenager and/or was not getting any at home...

canis minor
May 4, 2011

code:
<form class="form-core form-horizontal form_search offset-bottom-1">
...
</form>
<form class="form_centre">
    <a href="#" class="go-home center-map">Centre map <i class="icon orange-arrow"></i></a>
</form>
:bang:

edit: .orange-arrow isn't orange.

canis minor fucked around with this message at 17:53 on Jul 1, 2014

canis minor
May 4, 2011


https://github.com/search?q=heigth&type=Code&ref=searchresults

https://github.com/search?q=widht&type=Code&ref=searchresults

https://github.com/search?q=pading&type=Code&ref=searchresults

https://github.com/search?q=aling&type=Code&ref=searchresults

https://github.com/search?q=visilibity&type=Code&ref=searchresults

https://github.com/search?q=stlye&type=Code&ref=searchresults

https://github.com/search?q=becouse&ref=searchresults&type=Code

https://github.com/search?q=curent&type=Code&ref=searchresults

https://github.com/search?q=namepsace&type=Code&ref=searchresults

https://github.com/search?q=htlm&type=Code&ref=searchresults

ok, i'm done...

canis minor
May 4, 2011

fidel sarcastro posted:

That quote isn't so unreasonable, isn't one of the major problems with Node that it's easy to write fast but hard to maintain code?

Um... This is the result - seeing that most people do any JS dev without any sort of OO in mind.

(Apologies if your objects / libs are nicely structured instead of being a bunch of closures within closures within closures )

canis minor
May 4, 2011

gh... disregard me.. misread

canis minor
May 4, 2011

Mogomra posted:

This is in the index.php file of the MVC we are currently using for all of our PHP poo poo at work.

This is the same approach I had in my previous job. Thankfully I was not that much responsible for php.

canis minor
May 4, 2011


Don't know why people would want to do that seeing that you can have multiline strings simply by using \
code:
window.alert('butts\
butts\
butts');
I guess not having to deal with ' and " is a plus, though why wouldn't you then use templates. I guess it's more of - "huh, this is weird".

canis minor
May 4, 2011

Internet Janitor posted:

eithedog: The readme does address this. A line continuation using \ will not insert newlines automatically when you continue the string on another line. You'd need \n\.

Oh, sorry, didn't read the comments, I've read the code you posted. Are there any situations when manipulating HTML actually needs \n?

It works because the functions source actually contains the comments and you can access the functions code, per:

code:
(function a(){/* hi */ window.alert((a+"").match(/\/\*.*\*\//g))})()
You can run it in console to find out.

canis minor fucked around with this message at 19:24 on Jul 12, 2014

canis minor
May 4, 2011

Lumpy posted:

They're already doing all that work to add the derp class to the body. You want the to do more? You monster.

Our designers have access to code and indeed do change it.

The results are... interesting.

canis minor
May 4, 2011

fritz posted:

I found a line in some academic C code just now that has 5 "="s, two arithmetic operators, and a [].

a += b[0] == c + d == f

What do I win?

canis minor
May 4, 2011

All this talk about regexes and validation reminds me of me having an issue registering on kotaku or some other shitsite some time ago, where phone number was required, and me giving a correct one would still trigger off their javascript validation. In the end I've removed the bound events through console, but then, after submitting my data I've gotten 503 error, I could not log in and trying to use reset password triggered another 503. I guess somebody forgot about server side validation...

canis minor
May 4, 2011

FoiledAgain posted:

My brother was born in a city which has since changed its name, in a territory which has since changed its name. He sometimes runs into the problem of a system asking for his birthplace, then rejecting it as an actual location.

City: Munster, Country: Germany (unless there's Munster in Germany as well)?

Adbot
ADBOT LOVES YOU

canis minor
May 4, 2011


So indeed there is: http://de.wikipedia.org/wiki/Munster_(%C3%96rtze). I guess that's where counties and post codes should come in as well, though I imagine that wasn't the case here.

For longest time my place of birth on Facebook was spelled with Lą, because even though Google Maps was finding correct place, the whatever service that FB was using to transcribe characters failed to put in correct letters. It was correct for other place in Poland - Łódź though, so, idk (probably my home city being smaller than the other one could have had something to do with it)

canis minor fucked around with this message at 20:08 on Jul 21, 2014

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