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
Volmarias
Dec 31, 2002

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

The Gripper posted:

They do, but then you have to deal with there being no authoritative repository and all the bullshit that comes with that (mostly just verifying that the copy you choose to start from is pristine).


Isn't that part of the reason for signing commits, though? Being able to authenticate them? And doesn't git work on the idea that a commit includes all of its history (recursively)? The Gerrit server can sign a commit before pushing it, meaning that you can at least trust from that commit and back if you trust the signature.

Edit: it looks like they weren't totally up the creek even if that last mirror failed:

quote:

Also, one thing I forgot to mention in the original post: we actually had tarballs of all repositories. We create them every few days, but they are not perfect backups. They’re detailed further in the update post.

Volmarias fucked around with this message at 12:51 on Mar 25, 2013

Adbot
ADBOT LOVES YOU

evensevenone
May 12, 2001
Glass is a solid.
Yeah, the update post is pretty interesting. Apparently normal filesystem backups wouldn't have worked, because you don't know whether the repo is in mid-commit and thus in an invalid state (and they often are, because contributors often upload large commits over slow connections).

What they needed to do was just have a server doing git clone, without the --mirror option, and backing that up. But that's really only because the --mirror option was broken and would mirror corrupted repos without checking them.

That's actually a little crazy too, so I guess the real issue is they outgrew git by a significant margin.

Munkeymon
Aug 14, 2003

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



O Tempora! O Mores! posted:

At my work, one of the projects I'm on is a J2EE web application where a large portion of the dev team outsourced through an Indian consulting firm. Insofar as I can tell, the servlets they pump out work fine, but I keep running across weird code in the JSPs that makes me think they don't understand how Javascript works:
code:
<% boolean someBool = true; %>
<script type="text/javascript">
	// someVar is defined elsewhere in the document
	if (someVar) {
		<% someBool = true; %>
	} else {
		<% someBool = false; %> 
	}
</script>
:cripes:

They probably don't. One of the higher-ups at the company I'm at now has shown me in the last couple years that you can do a lot (of damage) without knowing much at all about how anything you're copy+pasting in actually works.

QuarkJets
Sep 8, 2008

The Gripper posted:

They do, but then you have to deal with there being no authoritative repository and all the bullshit that comes with that (mostly just verifying that the copy you choose to start from is pristine).

In KDE's case everything would be recoverable no matter how broken things were (as you said, each developer has a copy), the horror is mostly that a project that large considered Git a key part of their backup plan.

I don't understand, why is git bad for large projects?

Glimm
Jul 27, 2005

Time is only gonna pass you by

QuarkJets posted:

I don't understand, why is git bad for large projects?

It isn't that git is bad for large projects, it is that git as a backup plan is a bad idea.

Zombywuf
Mar 29, 2008

Glimm posted:

It isn't that git is bad for large projects, it is that git as a backup plan is a bad idea.

Git is fine as a last resort backup plan, for the bit after "both our datacenters burn to the ground" on your disaster plan.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal
I've been thinking of throwing away a bunch of code I've been working on for a project. It's basically a prototype that is becoming too convoluted to debug in a language that has lovely debugging (Javascript/Node.JS). Anyway I came upon this article:

http://www.joelonsoftware.com/articles/fog0000000069.html

And was pretty much dieing at this:

quote:

Third, the code may be doggone ugly. One project I worked on actually had a data type called a FuckedString. Another project had started out using the convention of starting member variables with an underscore, but later switched to the more standard "m_". So half the functions started with "_" and half with "m_", which looked ugly. Frankly, this is the kind of thing you solve in five minutes with a macro in Emacs, not by starting from scratch.

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
The question of doing a rewrite is always going to be a contextual one. I would certainly lean towards "don't rewrite it" when it comes to professional projects because those costs are tough to defend and you'll need way more justification than OCD / perfectionism / "It's not The Right Way". Though sometimes it happens. We've got a client-facing data integration system that is stone aged and OMG terribly implemented, but it's operational (essentially a client drops a CSV onto our server & we run a process that consumes it and kicks off appropriate post-processing on a per row basis). I just today had to email back a client asking them to change one of the columns from single character codes to numeric values, the mapping of which is so simple it can be expressed in an email and a non-technical person would fully understand. The old and busted system can't accept character codes on that column and is such a rat's next of fragile code (1500 line functions) that it's too dangerous to operations to try and make any change because it's so difficult to predict what other problems that could create that are working right now due to half a dozen staples-and-duct-tape solutions that were tacked on. We're just going to re-write it and salvage maybe 5% of the code because every fiber of that system is terrible. But it only really adds up because the system we need isn't all that complex, whereas the system we have is a monstrosity that sucks many hours out of each week and would be a larger project to fix properly compared to creating that functionality (by people who know what they're doing) in parallel and working on a smooth transition over to the new system. These cases usually only come up when an old technical debt goes toxic and spirals out of control and (to overuse the analogy) you opt to pay it off in full to stop the bleeding.

And from the last page, the cargo cult talk reminded me of the following quote, which was making its way around twitter a little while ago:

quote:

Ruby is a DSL for turning cargo culting into podcasts

EDIT: vvvv Yeah, that was the source I have too. I was cleaning out RT tags but probably should have left the origin.

Bhaal fucked around with this message at 23:18 on Mar 25, 2013

No Safe Word
Feb 26, 2005

Bhaal posted:

Ruby is a DSL for turning cargo culting into podcasts

My god. I'm using this, and if I can't find the source after a little googling, I'll just use it as is.

e: https://twitter.com/blowmage/status/290879911059652608

No Safe Word fucked around with this message at 23:05 on Mar 25, 2013

bucketmouse
Aug 16, 2004

we con-trol the ho-ri-zon-tal
we con-trol the verrr-ti-cal
Crosspost from the ouya thread in games:

SoupyTwist posted:

http://forums.ouya.tv/discussion/1040/in-app-purchase-testing-change

Do they not have a separate development and production environment? :stare:

edit: Oh my

pre:
        JSONObject purchaseRequest = new JSONObject();
        purchaseRequest.put("uuid", uniqueId);
        purchaseRequest.put("identifier", product.getIdentifier());
        // This value is only needed for testing, not setting it results in a live purchase
        purchaseRequest.put("testing", "true"); 

This system launches tomorrow.

Suspicious Dish
Sep 24, 2011

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

quote:

The problem with that solution (which is still live now btw) is that we cannot currently differentiate between game versions when a purchase is made. Therefore, once you have one version published, if you are developing another version, all purchases will be non-test, even if you have the test flag enabled.

Holy gently caress.

Optimus Prime Ribs
Jul 25, 2007

It seems like there's not a single person working on the Ouya who actually knows what they're doing.

kitten smoothie
Dec 29, 2001

Optimus Prime Ribs posted:

It seems like there's not a single person working on the Ouya who actually knows what they're doing.

I love the comment on that post from one of the Ouya guys, that basically reads "we're too busy prematurely 'unveiling' this console to process a refund on your credit card due to our goof, why don't you wait a few weeks to get money back that we shouldn't have taken from you."

No Safe Word
Feb 26, 2005

I know the "Rails is omakase" stuff was almost twenty pages ago but I wanted somewhere to put this and so here it is

https://www.youtube.com/watch?v=E99FnoYqoII

(I have mixed feelings about Giles Bowkett himself but it's still kind of funny)

pigdog
Apr 23, 2004

by Smythe

bucketmouse posted:

code:
        JSONObject purchaseRequest = new JSONObject();
        purchaseRequest.put("uuid", uniqueId);
        purchaseRequest.put("identifier", product.getIdentifier());
        // This value is only needed for testing, not setting it results in a live purchase
        purchaseRequest.put("testing", "true"); 
Obviously it's necessary to have a development environment or two, but putting extra operations into live APIs purely for testing is not a bad idea at all.

I mean, the lack of testing environment is a horror, but the code as such isn't.

Don Mega
Nov 26, 2005

No Safe Word posted:

I know the "Rails is omakase" stuff was almost twenty pages ago but I wanted somewhere to put this and so here it is

https://www.youtube.com/watch?v=E99FnoYqoII

(I have mixed feelings about Giles Bowkett himself but it's still kind of funny)
Skimming Giles Bowkett's blog, he sounds a little "off his rocker". Fasting for over a week at time?

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

pigdog posted:

Obviously it's necessary to have a development environment or two, but putting extra operations into live APIs purely for testing is not a bad idea at all.

I mean, the lack of testing environment is a horror, but the code as such isn't.
The issue is that once any version of the app is published the testing flag has no effect, and the docs don't tell you this.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Aleksei Vasiliev posted:

The issue is that once any version of the app is published the testing flag has no effect, and the docs don't tell you this.
Yeah, inconsistent behaviour ahoy, with a dose of our mistake but we don't have the time to fix it properly right now.

quote:

Live and learn ^_^ ! This solution sounds perfect.
Does it means that our purchases so far (in our own game) will not get a refund ? I made a few tests with a valid credit card yesterday and they are still pending when I login to see my credit card account.

quote:

JonAbramsJonAbrams Posts: 22Member, Administrator, Team OUYA
March 26
Unfortunately that's the case in general. We're really swamped right now with "unveiling" the console but if you get back in touch with us (or me) in a few weeks we can make it happen.

bewilderment
Nov 22, 2007
man what



So in my shiny grad job, I've been trained in the latest version of the product which while awkward makes overall sense beyond the choice of programming language. It mostly works and is easy to navigate.

Then we started taking a look at the previous version. :stare:
The program/subroutine naming scheme is two or three initials of the general purpose, then three or four digits. Related subroutines might have a name after them like TEST or MAIN. My training manual has lines saying 'use CB025 to generate these files' and 'LES1200 is the most used program in this section'.

Bhaal
Jul 13, 2001
I ain't going down alone
Dr. Infant, MD
I'm sure if I ask there will be a reason. There should be a federal relief fund for anyone who has poo poo like this in the codebase they inherit.

php:
<?
echo htmlspecialchars_decode(htmlspecialchars_decode(htmlspecialchars_decode(( $post['message']) )));
?>

1337JiveTurkey
Feb 17, 2005

bewilderment posted:

So in my shiny grad job, I've been trained in the latest version of the product which while awkward makes overall sense beyond the choice of programming language. It mostly works and is easy to navigate.

Then we started taking a look at the previous version. :stare:
The program/subroutine naming scheme is two or three initials of the general purpose, then three or four digits. Related subroutines might have a name after them like TEST or MAIN. My training manual has lines saying 'use CB025 to generate these files' and 'LES1200 is the most used program in this section'.

For some reason that naming convention reminds me of this.

Vanadium
Jan 8, 2005

Edit: this might have been the wrong thread

Vanadium fucked around with this message at 01:52 on Mar 28, 2013

LP0 ON FIRE
Jan 25, 2006

beep boop
Edit: Integer. Never mind

UxP
Aug 27, 2007
I've inherited a large Ruby project. Naturally the lightweight admin side is a full blown Rails app, and the huge rear end client side is a mess of 3 different Rack apps, which might or might not be using Sinatra depending on a million different parameters in a Model/Presenter pattern. It's a textbook rewrite candidate that would take at minimum one year if a full team was working on just it and the entire business shut down until it was finished, but its just two of us, neither having enough knowledge about it's inner depths to even begin to map it's true complexity. Anyways, I came across this gem in a 1500 line class this afternoon:

Ruby code:
class PageElementPresenter < BasePresenter

  WANTED_ATTRS = [:foo, :bar, :etc]

  def self.factory(env)
    begin
      new_from_env(env)
    rescue
      new(env)
    end
  end

  def initialize(env={})
    # actual code
  end

  private
  def self.new_from_env(env={})
    env.each do |opt|
      raise SomeError unless WANTED_ATTRS.include?(opt)
    end
    new(env)
  end

end
Basically, PageElementPresenter.factory gets called somewhere around 5 to 25 times per page load, and a good 80% of them end up in the rescue block. I've been scratching my head trying to figure out a reason why the initial developer did it this way. I'd check git history, except 'rm -rf .git && git init . && git add . && git commit -m "Clean up repo"' seems to have occurred on June 1st, 2011. This project is 6 years old.

Hughlander
May 11, 2005

UxP posted:

I'd check git history, except 'rm -rf .git && git init . && git add . && git commit -m "Clean up repo"' seems to have occurred on June 1st, 2011. This project is 6 years old.

I'm completely at a lost as to why someone would do that. What happened next? git push --force origin master? Go track down someone's old laptop, merge/rebase the current repo onto an old copy and force push to restore the history! :)

Volmarias
Dec 31, 2002

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

Hughlander posted:

I'm completely at a lost as to why someone would do that. What happened next? git push --force origin master? Go track down someone's old laptop, merge/rebase the current repo onto an old copy and force push to restore the history! :)

I think someone was trying to reduce the repo size. Git keeps the full history locally, you see, so this is more efficient!

Of course there's repack and prune and compression mechanisms but don't worry your pretty head about that.

Bunny Cuddlin
Dec 12, 2004
I thought it was just a weird quirk because it appears across a lot of our files but i finally realized a few days ago that a former coworker did for (int ii = 0; ii < x; ii++) because he was prefixing the variable name 'i' with the hungarian prefix 'i' for integer.

No Safe Word
Feb 26, 2005

Bunny Cuddlin posted:

I thought it was just a weird quirk because it appears across a lot of our files but i finally realized a few days ago that a former coworker did for (int ii = 0; ii < x; ii++) because he was prefixing the variable name 'i' with the hungarian prefix 'i' for integer.

That's dedication to your convention at least

evensevenone
May 12, 2001
Glass is a solid.
You should ask him to refactor to systems Hungarian so the i stands for iterator and not integer. Or perhaps iii.

Posting Principle
Dec 10, 2011

by Ralp

Bunny Cuddlin posted:

I thought it was just a weird quirk because it appears across a lot of our files but i finally realized a few days ago that a former coworker did for (int ii = 0; ii < x; ii++) because he was prefixing the variable name 'i' with the hungarian prefix 'i' for integer.

I thought people used ii and jj for loops because it was easier to search for.

Bunny Cuddlin
Dec 12, 2004

Jerry SanDisky posted:

I thought people used ii and jj for loops because it was easier to search for.

Maybe some people do, but guess what the inner loop variables in his code are called.

Posting Principle
Dec 10, 2011

by Ralp

Bunny Cuddlin posted:

Maybe some people do, but guess what the inner loop variables in his code are called.

:gonk:

fritz
Jul 26, 2003

Jerry SanDisky posted:

I thought people used ii and jj for loops because it was easier to search for.

You use ii and jj because you've already used i, j, k, and maybe l, and it's classier than i1,i2,i3,i4,i5.

1337JiveTurkey
Feb 17, 2005

i, ii, iii, iv, v, vi

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
In matlab you use ii because i is sqrt(-1) and "maybe we start elsewhere in the alphabet?" was laughed out of the meeting,

evensevenone
May 12, 2001
Glass is a solid.
in matlab
code:
>> i

ans =

        0 + 1.0000i

>> i=1

i =

     1

>> i

i =

     1

>> 
But if you really want to piss someone off, name a variable 'quit'.

b0lt
Apr 29, 2005

evensevenone posted:

in matlab

But if you really want to piss someone off, name a variable 'quit'.

Python code:
False = True
if False:
    print "what"
output: what

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

Lisp code:
(define define '())

Jewel
May 2, 2009

b0lt posted:

Python code:
False = True
if False:
    print "what"
output: what

I like:

Python code:
def getStatus():
    return True
 
False, True = True, False
 
print getStatus()
output: False

Adbot
ADBOT LOVES YOU

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

b0lt posted:

Python code:
False = True
if False:
    print "what"
output: what

code:
>>> False = True
  File "<stdin>", line 1
SyntaxError: assignment to keyword
>>>
?

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