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
Space Kablooey
May 6, 2009


My condolences on your liver. :yotj:

Adbot
ADBOT LOVES YOU

Sulla Faex
May 14, 2010

No man ever did me so much good, or enemy so much harm, but I repaid him with ENDLESS SHITPOSTING

HardDisk posted:

My condolences on your liver. :yotj:

I work in Italy so the peroni is about 1.20 euro for 660mL from the place downstairs.

Speaking of which, a co-worker just asked me if I "astral project" while I sleep. Apparently he does, and it's fun. His English is worse than my Italian so I say "oh, you mean lucid dreaming. Quando si accorge che e' un sogno mentre dorme."

"Yes. When the soul leaves the body."

And now he's listening to chinese meditation music. So I guess he did mean astral projection after all.

What was that about my liver??

QuarkJets
Sep 8, 2008

Sulla-Marius 88 posted:

I really should but for a month or two now the client has made us move development onto the testing server (while still asking for new features they forgot to think of before, and serious re-writes of old features), which is behind a vpn that can only be access externally through citrix. So every time I wanted to modify a file I'd have to find the file on my local machine and copy paste the code from citrix, modify, save, then copy paste back out through citrix, and I just know I'd gently caress up and forget to do it after a little bit.

I basically just went "gently caress it, I'll turn up, do the best I can, go home and not think about it" a while back when I realised the true extent of how poo poo the situation is. The clients are all manner of hosed as well and I'm hoping that if I just keep turning up and doing stuff, one day it will be done and I won't have to see this project ever again.

I don't know what citrix is, but wouldn't git even make that process easier? You could push/pull across the VPN and not mess with copy-pasting of individual lines, or if that wasn't feasible for some reason then you could at least easily figure out which files have changed and in what way.

Basically I'm saying to set up a private repo and a repo for the project but not tell anyone; it'll be transparent to the people who aren't using it.

Munkeymon
Aug 14, 2003

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



QuarkJets posted:

I don't know what citrix is

Lucky bastard. Have you used Parallels to run a Windows program on a Mac or tunneled an X session over ssh? It's like that but on a different machine you don't control and it's Enterprise Grade Software so you can be assured it's terrible (or was back when I had to use it).

Sulla Faex
May 14, 2010

No man ever did me so much good, or enemy so much harm, but I repaid him with ENDLESS SHITPOSTING

QuarkJets posted:

I don't know what citrix is, but wouldn't git even make that process easier? You could push/pull across the VPN and not mess with copy-pasting of individual lines, or if that wasn't feasible for some reason then you could at least easily figure out which files have changed and in what way.

Basically I'm saying to set up a private repo and a repo for the project but not tell anyone; it'll be transparent to the people who aren't using it.

citrix is like a web browser rdp that god designed to punish the wicked, which inevitably means it staff and programmers, but the server is behind a locked firewall so you cant do poo poo except citrix. Cant even ftp or rdp out if youre on the network itself with an account created specifically for devs

E: actually i was there a few weeks ago and to propagate changes to the dev server i would have to zip files and email them to the guy next to me who would extract, overwrite, and test, because he had brought his WiFi dongle. Really made me rethink how bad unemployment could really be..

Sulla Faex fucked around with this message at 21:20 on Feb 26, 2014

dorkanoid
Dec 21, 2004

HardDisk posted:

If you want to get fancy, BitBucket's private repos are free for 5 users.

I'm not sure I would send "company code" to a third party without any kind of permission or general blessing :raise:

JawnV6
Jul 4, 2004

So hot ...
Just when you thought you were ISO compliant...

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance

Sulla-Marius 88 posted:

I really should but for a month or two now the client has made us move development onto the testing server (while still asking for new features they forgot to think of before, and serious re-writes of old features), which is behind a vpn that can only be access externally through citrix. So every time I wanted to modify a file I'd have to find the file on my local machine and copy paste the code from citrix, modify, save, then copy paste back out through citrix, and I just know I'd gently caress up and forget to do it after a little bit.

I basically just went "gently caress it, I'll turn up, do the best I can, go home and not think about it" a while back when I realised the true extent of how poo poo the situation is. The clients are all manner of hosed as well and I'm hoping that if I just keep turning up and doing stuff, one day it will be done and I won't have to see this project ever again.

Man and I thought our "process" stank. Thanks for the perspective.

fritz
Jul 26, 2003

dorkanoid posted:

I'm not sure I would send "company code" to a third party without any kind of permission or general blessing :raise:

Yeah, that seems like it's just asking for trouble.

Space Kablooey
May 6, 2009


dorkanoid posted:

I'm not sure I would send "company code" to a third party without any kind of permission or general blessing :raise:

Fair enough. He can still set up a local repo for himself, and not waste hours on reverting things.


By the way, Sulla, how does your company handle (or doesn't) multiple developers on the same project?

Sulla Faex
May 14, 2010

No man ever did me so much good, or enemy so much harm, but I repaid him with ENDLESS SHITPOSTING

HardDisk posted:

Fair enough. He can still set up a local repo for himself, and not waste hours on reverting things.

Oh I should clarify, I didn't have to revert it, because he was adding some styling and some extra little feature that we needed (literally a checkbox that shows whether something has been completed or not) so I had to go through and fix what he broke while adding it. But he is just such a hack-and-slash, copy-and-paste-and-hit-until-it-works kind of guy that he just totally mangled everything. For example, copy and paste poo poo like
code:
<div id='summarydiv' style='width:50%'>
into a foreach loop. He doesn't know what he's doing with anything else, and just modifies stuff and adds stuff and comments out and moves it around and refreshes the page each time until he hits bingo, the css designer's "i'm showing some boxes or some words and numbers that seem similar to what you're expecting, let's head home and call it job well done". So he broke a bunch of my stuff and it looked like it was my fault. It turns out they were trying to access it in a manner contrary to how they're supposed to so it never would have worked anyway, but through coincidence the thing had been broken anyway. Ha he heh ha heheh hhhhhhehhhh.

HardDisk posted:

By the way, Sulla, how does your company handle (or doesn't) multiple developers on the same project?

Each guy works on a different thing and when there is a conflict you work together or just say "hey don't work on this for a bit". And if someone has to do something with my code, I hope for the best and come back in a week and fix whatever they broke. If I have to work on someone else's code I just fix what will actually directly cause fatal errors and duplicate DB entries and whatever, and just try really hard not to notice the rest, and let them sort it out later, otherwise it'll look like I'm super incompetent and taking ages to add/modify a simple feature on a functionality that's already "working".

Fuck them
Jan 21, 2011

and their bullshit
:yotj:
So someone just repeatedly implemented entire methods which amount to "serialize this business object" instead of making a generic function. We have XML Columns peppered throughout various tables in the database we use. Why would you make multiple functions which do the exact same thing, just make a XML object based on the properties in the model you pass into it, instead of a generic of some sort?

I just obviated dozens of methods that were identical by making a base class and popping in a generic function.

JawnV6
Jul 4, 2004

So hot ...
Next week you'll be writing a simple dedicated function instead of some generic monstrosity that's handling a range of inputs that will never, ever, ever, be generated in the real world.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
There is a post on the intranet here from a guy complaining about the IT department and laptop fixes. Apparently he lost his curly bracket keys and IT just gives him another broken laptop shell when he complains. He just gave up and writes all his Perl without using associative arrays, procedures, conditionals, and loops.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:

JawnV6 posted:

Next week you'll be writing a simple dedicated function instead of some generic monstrosity that's handling a range of inputs that will never, ever, ever, be generated in the real world.

code:
Function XMLSerializer(Of T)(ByVal Model As T) As String

        Dim xmlSer As XmlSerializer
        Dim xmlDoc As XDocument
        Dim xmlWri As XmlWriter
        Dim xEl As XElement

        xmlSer = New XmlSerializer(Model.GetType)
        xmlDoc = New XDocument
        xmlWri = xmlDoc.CreateWriter

        xmlSer.Serialize(xmlWri, Model)

        xmlWri.Close()

        xEl = xmlDoc.Root

        Return xEl.ToString()

    End Function
Literally a monster.

Marta Velasquez
Mar 9, 2013

Good thing I was feeling suicidal this morning...
Fallen Rib

Rocko Bonaparte posted:

He just gave up and writes all his Perl without using associative arrays, procedures, conditionals, and loops.

There's a module to make perl understand trigraphs.

code:
  use Filter::Trigraph;

  my $x = shift??!??!"testing";
  if($ENV??<BIGVOWELS??>)??<
    ??= uppercase all vowels in $x
    $x=??-s/(??(aeiou??))/??/u$1/g;
  ??>else??<
    ??= uppercase all non-vowels in $x
    $x=??-s/(??(??'aeiou??))/??/u$1/g;
  ??>
  $??!=1;
  print "$x??/n";
I'm sure he'll love that.

JawnV6
Jul 4, 2004

So hot ...

2banks1swap.avi posted:

Literally a monster.

I wasn't referring to this exact function. I'm saying that you've identified an engineering tradeoff. This week you've seen one extreme in one code base. Next week you might see the other extreme in a different code base. I'm sure you'll talk about it in the same smug as poo poo tone.

Fuck them
Jan 21, 2011

and their bullshit
:yotj:

JawnV6 posted:

I wasn't referring to this exact function. I'm saying that you've identified an engineering tradeoff. This week you've seen one extreme in one code base. Next week you might see the other extreme in a different code base. I'm sure you'll talk about it in the same smug as poo poo tone.

code:
    Private Function SerializeType(foo As Type) As String



        Dim xmlSer As XmlSerializer

        Dim xmlDoc As XDocument

        Dim xmlWri As XmlWriter



        xmlSer = New XmlSerializer(foo .GetType)

        xmlDoc = New XDocument

        xmlWri = xmlDoc.CreateWriter



        xmlSer.Serialize(xmlWri, foo )



        xmlWri.Close()



        Dim xEl As XElement

        xEl = xmlDoc.Root



        Return xEl.ToString()



    End Function
How is repeating this over and over for dozens of types even remotely a good idea or a trade off of anything?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

2banks1swap.avi posted:

code:
Function XMLSerializer(Of T)(ByVal Model As T) As String

        Dim xmlSer As XmlSerializer
        Dim xmlDoc As XDocument
        Dim xmlWri As XmlWriter
        Dim xEl As XElement

        xmlSer = New XmlSerializer(Model.GetType)
        xmlDoc = New XDocument
        xmlWri = xmlDoc.CreateWriter

        xmlSer.Serialize(xmlWri, Model)

        xmlWri.Close()

        xEl = xmlDoc.Root

        Return xEl.ToString()

    End Function
Literally a monster.

You should have that XMLWriter in a using block. :smug:

Plorkyeran
Mar 22, 2007

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

2banks1swap.avi posted:

How is repeating this over and over for dozens of types even remotely a good idea or a trade off of anything?
What if you want to make one of the types work subtly different in confusing ways?

Fuck them
Jan 21, 2011

and their bullshit
:yotj:

Plorkyeran posted:

What if you want to make one of the types work subtly different in confusing ways?

That's different but not the case here. It's just individual xml objects for xml columns in a db.

Edit: It's literally just a bag of properties kind of class. Nothing too funny going on here. If I'm really coming across like a cock I need to change my tone but it was seriously just "WTF" to me reading over the dev's code.

Ithaqua posted:

You should have that XMLWriter in a using block. :smug:

:eng99:

Fuck them fucked around with this message at 20:55 on Feb 27, 2014

QuarkJets
Sep 8, 2008

Munkeymon posted:

Lucky bastard. Have you used Parallels to run a Windows program on a Mac or tunneled an X session over ssh? It's like that but on a different machine you don't control and it's Enterprise Grade Software so you can be assured it's terrible (or was back when I had to use it).

That sounds terrible, why do people use it? Is this basically just the all-too-common case of managers buying some poo poo and loving everyone in the process?

Dren
Jan 5, 2001

Pillbug
Please put enums in namespaces. Especially if they include a really common name like "ERROR".

shrughes
Oct 11, 2008

(call/cc call/cc)

Dren posted:

Please put enums in namespaces. Especially if they include a really common name like "ERROR".

In what language?

ninjeff
Jan 19, 2004

2banks1swap.avi posted:

code:
Function XMLSerializer(Of T)(ByVal Model As T) As String

        Dim xmlSer As XmlSerializer
        Dim xmlDoc As XDocument
        Dim xmlWri As XmlWriter
        Dim xEl As XElement

        xmlSer = New XmlSerializer(Model.GetType)
        xmlDoc = New XDocument
        xmlWri = xmlDoc.CreateWriter

        xmlSer.Serialize(xmlWri, Model)

        xmlWri.Close()

        xEl = xmlDoc.Root

        Return xEl.ToString()

    End Function
Literally a monster.

Why did you make a type parameter for this method? You didn't use it anywhere.

qntm
Jun 17, 2009
JavaScript code:
var selectHeader = this._defaultLayout[0];
selectHeader.name = "newName";
this._defaultLayout.splice(0, 1, selectHeader);
:raise:

Dren
Jan 5, 2001

Pillbug

shrughes posted:

In what language?

C++

shrughes
Oct 11, 2008

(call/cc call/cc)

Just use scoped enums.

Dren
Jan 5, 2001

Pillbug

shrughes posted:

Just use scoped enums.

That's great, didn't know about those. Just have to see if anyone disagrees with turning on -std=c++0x on this old version of gcc to get support for scoped enums.

qntm
Jun 17, 2009
JavaScript code:
var items = "{\"items\": [";
var insertComma = false;
this.cells.forEach(function(object) {
  if(!object.hidden) {
    switch(object.field) {
      case "messageKey":
        break;
      default:
        if(insertComma) {
          items = items + ",";
        }
        items = items + "{\"name\": \"" + object.name + "\",\"value\": \"" + object.field + "\"}";
        insertComma = true;
    }
  }
});
items = items + "]}";
var comboItems = eval("(" + items + ")");

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

qntm posted:

JavaScript code:
var items = "{\"items\": [";
var insertComma = false;
this.cells.forEach(function(object) {
  if(!object.hidden) {
    switch(object.field) {
      case "messageKey":
        break;
      default:
        if(insertComma) {
          items = items + ",";
        }
        items = items + "{\"name\": \"" + object.name + "\",\"value\": \"" + object.field + "\"}";
        insertComma = true;
    }
  }
});
items = items + "]}";
var comboItems = eval("(" + items + ")");

"Ok, he could use join to refactor that insertComma bit, but it's not too bad, let me just read this last line here and...." :stonk:

..btt
Mar 26, 2008
What are you talking about? Even before the eval he is using string concatenation to build a JSON object. In JavaScript.

Westie
May 30, 2013



Baboon Simulator

Reminds me of something I encountered on one of my projects at work - or rather, on a client's former site.

This calculation was used for calculating dues:

JavaScript code:
var total = eval(var1) + eval(var2) + eval(val3) - eval(val4);
I can't remember the exact values, but all eval(varX) were numbers, from a form input.

And yes, inputting one value as window.alert("hello.jpg") did produce a modal, and tell the folks that they need to pay £NaN!

Strong Sauce
Jul 2, 2003

You know I am not really your father.





I refuse to pay Lnan. That guy is kind of a jerk :colbert:

qntm
Jun 17, 2009

..btt posted:

What are you talking about? Even before the eval he is using string concatenation to build a JSON object. In JavaScript.

But that final line is the best part. All along, you assume that this is a misguided attempt to build a JSON string for an XHR or something. And then it turns out that no, this programmer just forgot about object literals.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

qntm posted:

But that final line is the best part. All along, you assume that this is a misguided attempt to build a JSON string for an XHR or something. And then it turns out that no, this programmer just forgot about object literals.

Yeah, exactly. I thought this was "old" return a JSON string before JSON.stringify was a thing code. Then the shocking truth was revealed!

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
I haven't done anything serious with C++ for about 6 years or so, and I'm just getting back into it to work on a cocos2d game in my spare time. While I'd kept up reading about all the changes in C++11, I'm only now getting to use the new features in "real" code.

Initializer lists are amazing to set up complex structures with very little code. I've got a method where I return a vector of vectors of strings (appropriately typedef'd, I swear it's legit) and all I had to do was:

code:
return {{x}};
Am I the horror? :ohdear:

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

qntm posted:

But that final line is the best part. All along, you assume that this is a misguided attempt to build a JSON string for an XHR or something. And then it turns out that no, this programmer just forgot about object literals.

I'm guessing its a misguided attempt at object cloning.

zeekner
Jul 14, 2007

So CSON is a thing, a coffescript variant of JSON.

Of course, it turns out the parser is really just an eval(), because why would you expect anything better. https://github.com/bevry/cson/issues/32

The worst part is this project is over two years old.

Adbot
ADBOT LOVES YOU

ohgodwhat
Aug 6, 2005

Munkeymon posted:

Lucky bastard. Have you used Parallels to run a Windows program on a Mac or tunneled an X session over ssh? It's like that but on a different machine you don't control and it's Enterprise Grade Software so you can be assured it's terrible (or was back when I had to use it).

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?

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