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
bobthecheese
Jun 7, 2006
Although I've never met Martha Stewart, I'll probably never birth her child.
Oh look, More PHP stupidity!

What would you reasonable expect this language function to do?

php:
<?
echo get_current_user();
?>
I would assume that it would be reasonable to assume that it returns the currently executing user, wouldn't you?

PHP Manual posted:

Returns the name of the owner of the current PHP script.

Wait, what? So no matter who's running the script, the 'current user' is whoever owns the script?

So how do you get the user who's currently executing the script?

php:
<?
echo shell_exec('whoami');
?>
loving elegant.

Adbot
ADBOT LOVES YOU

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Kim Jong III posted:

I mean, keeping gcc off your production server is always a good idea -- it'll stop the script-kiddies and most attackers, and not having X on your servers is of course right. But no manpages would be silly.

The reasoning is that the computer operator (not administrator) should just be running down a step-by-step process provided by the system's vendor; no manual should be necessary.

TasteMyHouse
Dec 21, 2006

NotShadowStar posted:

These might use 'info', the hosed up documentation system that only GNU poo poo uses and it's based off of emacs so if you don't know how to use emacs then gently caress you.

welp, you're right. I'd never used a system that used info instead of man and no one told me about it so I've just been googling everything.

I'll probably stick to that.

NotShadowStar
Sep 20, 2000

Fren posted:

Not sure why this is :pseudo:, Emacs is one of the most rigorously documented open source applications ever written. You can instantly discover the intent of any key command, variable, function, or any other symbol in the runtime with a single key chord. Most installations will also include the entire Emacs manual, a primer and complete reference to Emacs Lisp, and access to all other Info pages in the system, with another key chord.

Alternately, if you don't know anything at all about emacs (me) and get redirected from 'man' to 'info', you have to open a web browser and google to figure out how to quit the goddamn thing.

pseudorandom name
May 6, 2007

q was too unobvious?

I despair at the youth of today.


edit: also, try pinfo if you can't stand info

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Avoid the info browser by converting to flat text.

NotShadowStar
Sep 20, 2000

pseudorandom name posted:

q was too unobvious?

I despair at the youth of today.


edit: also, try pinfo if you can't stand info

I missed the '?' at the bottom, I just saw emacs and was completely lost. Also pissed because it didn't respect EDITOR, as GNU poo poo tends to do.

Hammerite
Mar 9, 2007

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

pseudorandom name posted:

q was too unobvious?

I despair at the youth of today.


edit: also, try pinfo if you can't stand info

When I was trying to get a handle on Git I found myself having to close it and re-open several times because I failed to supply a commit message and found myself staring at Vim. I was unfamiliar with nerdy text editors with a command line and didn't know what the gently caress. Now I just added instructions to myself in the default commit-message file, that tell me how to add a line and then quit, in case I forget.

ToxicFrog
Apr 26, 2008


Hammerite posted:

When I was trying to get a handle on Git I found myself having to close it and re-open several times because I failed to supply a commit message and found myself staring at Vim. I was unfamiliar with nerdy text editors with a command line and didn't know what the gently caress. Now I just added instructions to myself in the default commit-message file, that tell me how to add a line and then quit, in case I forget.

git config --global core.editor nano or similar might be a better long-term fix.

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

ToxicFrog posted:

git config --global core.editor nano or similar might be a better long-term fix.

or just export EDITOR=nano

TasteMyHouse
Dec 21, 2006
y'all don't know vim? I'm outta here
:q!

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope
I can deal with vi, if I have to write a simple commit message, but I'd rather not.

Nano FTW.

e: let me just copy this text from my integration request to the commit message. Oh no, I forgot to press 'I' and now stuff keeps happening :gonk:

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

TasteMyHouse posted:

y'all don't know vim? I'm outta here
:q!

cya later vimlords

code:
if [[ -x `which aquamacs` ]]; then
  alias am="emacsclient -n"
  EDITOR="emacsclient -a 'mate -w'"
elif [[ -x `which mate` && $(not_run_from_ssh) = 1 ]]; then
	EDITOR="mate -w"
	alias e="mate"
	# Useful functions for bundle development
	function reload_textmate(){
		osascript -e 'tell app "TextMate" to reload bundles'
	}
	function bundle () {
		cd "$HOME/Library/Application Support/TextMate/Bundles/$1.tmbundle"
	}
elif [[ -x `which nano` ]]; then
	EDITOR=nano
elif [[ -x `which pico` ]]; then
	EDITOR=pico
elif [[ -x `which gvim` ]]; then
	EDITOR=gvim
elif [[ -x `which vim` ]]; then
	EDITOR=vim
else
	EDITOR=vi
fi
I need to clean that textmate crap out.

NotShadowStar
Sep 20, 2000
I still keep textmate around because I haven't found a way of making static html in vim that doesn't hurt.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Duke Nukem Forever and TextMate 2 in the same year c'monnnnnn

tef
May 30, 2004

-> some l-system crap ->
http://www.phzbox.com/moka/index.html

this is a pretty loving terrible attempt to write ruby in python.


I think my favourite bit is how the methods do different things to mutable/immutable data structures.

dancavallaro
Sep 10, 2006
My title sucks

tef posted:

http://www.phzbox.com/moka/index.html

this is a pretty loving terrible attempt to write ruby in python.


I think my favourite bit is how the methods do different things to mutable/immutable data structures.

Saw your scathing comment on HN ;-)

tef
May 30, 2004

-> some l-system crap ->

dancavallaro posted:

Saw your scathing comment on HN ;-)

there is more than one.

http://news.ycombinator.com/item?id=3256248

He really has made no attempt to learn python beyond being able to summon jquery
and doesn't understand that re-inventing the wheel does not make code readable.


Every single idea goes against the zen of python


He is a bad person,

I do not like him.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
But I already know jquery and I don't know python why can't I just have jquery in python so I can get my work done and not learn anything no I don't know anyone who knows python, why do you ask?

P.S. I don't really get jquery either.

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

pokeyman posted:

But I already know jquery and I don't know python why can't I just have jquery in python so I can get my work done and not learn anything no I don't know anyone who knows python, why do you ask?

P.S. I don't really get jquery either.

Is that like "I don't know PHP so I'll make PHP in Javascript"?

Coffee Mugshot
Jun 26, 2010

by Lowtax

OriginalPseudonym posted:

Is that like "I don't know PHP so I'll make PHP in Javascript"?

No, it's like "I don't know javascript, so I'll make javascript in PHP": http://code.google.com/p/phpquery/

NotShadowStar
Sep 20, 2000

Rainbow Pony Deluxe posted:

No, it's like "I don't know javascript, so I'll make javascript in PHP": http://code.google.com/p/phpquery/

:aaaaa:

Seriously though simplexml is like one of the few php libraries that doesn't piss me off greatly if I have to deal with it so ffffffff

Mandor
May 19, 2004

Behold, the database model of some piece of crap VB.NET steam factory I ended up having to "maintain".



So much for normalization... I printed it out on an 18 square feet poster to get a "clear picture".
Didn't help :suicide:

Luminous
May 19, 2004

Girls
Games
Gains

Mandor posted:

Behold, the database model of some piece of crap VB.NET steam factory I ended up having to "maintain".



So much for normalization... I printed it out on an 18 square feet poster to get a "clear picture".
Didn't help :suicide:

Examples of the lack of normalization? I mean, it's pretty monstrous, but you can't really gauge how well it's designed based on that alone. And something so large seems like there could be some interesting (read: hilarious) design problems.

Johnny Cache Hit
Oct 17, 2011

Mandor posted:

Behold, the database model of some piece of crap VB.NET steam factory I ended up having to "maintain".

Oh, horrible SQL? I've got some to share.

The last code base I worked on had about ~300 tables per database. ~50-75 tables of those tables were named "F"+ four letters. These tables were someone's idea of how you would represent relational data that describes devices found in mechanical rooms -- for example, FELEC was the electrical table that told you the amperage of stuff, FEMTR was a motor, FEGEN were generators, etc.

One generator would have an entry in the electrical table that referenced its amperage, connections, etc., an entry in the motor table that talked about its efficiency & RPM & fuel source, and an entry in the generator table that indicated the output wattage of the generator, and whatever else. Any ultra generic info, such as building, floor, name, etc., was stored in the Device table.

Naturally, to get the full story about one generator, you've got to find the object ID, which was a string because :v:, then ask all the right tables for their information -- Device, FELEC, FEMTR, FEGEN. Some of these relational chains ran 5-6 tables deep, depending on how barking mad the "mechanical experts" felt when setting everything up.

So, how do you know which set of tables to look at? Giant switch() in the code?

Nah -- if you are looking for a generator, you know you have a FEGEN -- well, you don't, and I didn't, but the guy that has been there for eight years and made the thing knew you wanted a FEGEN and not a FERLY or a FEDSB.

This means you go to yet another table called SQLSelects and get the value for the FEGEN key. This gave you a big ol' chunk of SQL that was CONCAT()ed with the appropriate data and EXEC()d inside a stored procedure.

:smithicide:

mobby_6kl
Aug 9, 2009

by Fluffdaddy
Oh gently caress, that's pretty bad. I think I do have a few candidates for this thread, even SQL-related!

One guy hardcoded the name of the SQL server to which his app connects to fetch some data. That's bad enough, but whatever, who didn't do this at some point? The data were moved to another machine a day before his vacation was starting, so obviously the program stopped working, screwing with maybe 20 people in the team who rely on it in some form. He didn't fix it that or the next day, and despite showing up at work every single afternoon of his vacation(nobody made him do that), he still didn't fix it by the end of whatever week this happened.

Shortly after this I said gently caress it, and just changed the connection string in his binary with a hex editor. So, why didn't he simply change the hardcoded string? The current development version doesn't compile, or if it did, doesn't work properly even in the way that the deployed version does. Did I mention that the current development code is the only version of the source that he has? Yeah. :suicide:


I haven't seen the actual code in question, but I have a pretty strong suspicion here. Another guy (who was hired because I admitted that I'm not an expert in SQL) was whining about something not working in his stored procedure that was supposed to parse text to date. I was going to suggest something, until it dawned on me that all the dates he's supposed to be working with are already actual dates in the DB, so he must've been converting it to a string and then trying to parse it back with substrings or something :ohdear:

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Kim Jong III posted:

Oh, horrible SQL? I've got some to share.

The last code base I worked on had about ~300 tables per database. ~50-75 tables of those tables were named "F"+ four letters. These tables were someone's idea of how you would represent relational data that describes devices found in mechanical rooms -- for example, FELEC was the electrical table that told you the amperage of stuff, FEMTR was a motor, FEGEN were generators, etc.

Sounds like somebody wanted table inheritance or a document database.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

A previous job had a dbo.products table that listed all of their products obviously. This table was central to essentially all front office and back office operations. it was 310 columns wide.

Powerful Two-Hander
Mar 10, 2004

Mods please change my name to "Tooter Skeleton" TIA.


Scaramouche posted:

A previous job had a dbo.products table that listed all of their products obviously. This table was central to essentially all front office and back office operations. it was 310 columns wide.

Heh, we had one that was 25 columns wide, 2.5 million rows and all of it self referencing with a one to many relationship between parent and child rows.

And no indexes.

The application took about 10 minutes to load its interface (which was VB) because it was set to check that a record with ID=0 didn't exist before displaying the new entry screen so it table scanned the poo poo out of everything. Tucked away in the documentation was the line "if we need to increase system capacity, we could buy a 36kbps modem to replace the 12kbps one".

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Powerful Two-Hander posted:

Heh, we had one that was 25 columns wide, 2.5 million rows and all of it self referencing with a one to many relationship between parent and child rows.

And no indexes.

The application took about 10 minutes to load its interface (which was VB) because it was set to check that a record with ID=0 didn't exist before displaying the new entry screen so it table scanned the poo poo out of everything. Tucked away in the documentation was the line "if we need to increase system capacity, we could buy a 36kbps modem to replace the 12kbps one".

Well this is just begging the question.

How badly would it break if something with ID=0 did exist?

Contra Duck
Nov 4, 2004

#1 DAD
Screw that, I want to know if you ever bought that 36kbps modem.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


I don't know why I follow the DailyWTF, since most of the time I don't like it, but today's did get a laugh out of me. The idea is that searches for typical english characters also match their accented counterparts.

code:
SELECT *
  FROM Persons
 WHERE /* HACK! Being SQL, there's no concept of 
          RegEx, so we have to this horrible hack  */
       Replace(Replace(Replace(Replace(
       Replace(Replace(Replace(Replace(
       Replace(Replace(Replace(Replace(
       Replace(Replace(Replace(Replace(name, ' ',''),
         'É','E'),'È','E'),'Ê','E'),'Ë','E'),
	 'À','A'),'Â','A'),'Ä','A'),
	 'Ï','I'),'Î','I'),
	 'Ç','C'),
	 'Ô','O'),'Ö','O'),
	 'Ü','U'),'Ù','U'),'Û','U') 
       LIKE @name AND 
       /* HACK AGAIN! Oh yeah, no cod reuse.
          Why are we doing this in SQL!? */
       Replace(Replace(Replace(Replace(
       Replace(Replace(Replace(Replace(
       Replace(Replace(Replace(Replace(
       Replace(Replace(Replace(Replace(surname, ' ',''),
       'É','E'),'È','E'),'Ê','E'),'Ë','E'),
       'À','A'),'Â','A'),'Ä','A'),
       'Ï','I'),'Î','I'),
       'Ç','C'),
       'Ô','O'),'Ö','O'),
       'Ü','U'),'Ù','U'),'Û','U') 
       LIKE @surname 
 ORDER BY name, surname

tef
May 30, 2004

-> some l-system crap ->
full table scans always make the best queries

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

tef posted:

full table scans always make the best queries
Your database has tables? Mine just has non-enumerable "buckets" so you have to scan every key in the database to find ones in a single bucket.

Apok
Jul 22, 2005
I have a title now!

Luminous posted:

Examples of the lack of normalization? I mean, it's pretty monstrous, but you can't really gauge how well it's designed based on that alone. And something so large seems like there could be some interesting (read: hilarious) design problems.

I'd think it has to do with the gigantic tables scattered throughout. If you broke things down to third normal form, you'd have a bunch of smaller tables.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

mobby_6kl posted:

Did I mention that the current development code is the only version of the source that he has? Yeah. :suicide:

Oh god. Let's talk source control horrors! My soon-to-be-former job has a beautiful TFS installation that they're totally mismanaging.

Branching? gently caress branching, everyone just checks directly into the trunk. Don't worry, they label for dev deployments and release deployments!

Continuous integration? Nope! Do a "get latest" against source control and you're probably going to get something that doesn't build. Have fun getting applications working again after someone makes a breaking change to a shared component! A 10 minute change now requires a day and a half of refactoring, retesting, and praying.

I laid out a sane system with development branches, integration branches, and release branches. They don't like it, it's "more work" than having a bunch of broken applications that don't build and every release requiring figuring out what changesets are part of it and what changesets aren't.

Did I mention that my new job is at least partly going to entail teaching people how to properly do continuous integration and manage source control via TFS? Yeah. Even knowing that, they don't care to listen to me.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Some of you might get a kick out of this. http://stackoverflow.com/questions/8220399/is-this-a-php-bug

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Ithaqua posted:

Do a "get latest" against source control and you're probably going to get something that doesn't build.

I honestly do not get this.

I mean, how do you check in code that doesn't work? I don't mean buggy code, I mean "your code does not even compile" broken. Do these people ... just do a commit without even trying to run their code first or something?

Ursine Catastrophe
Nov 9, 2009

It's a lovely morning in the void and you are a horrible lady-in-waiting.



don't ask how i know

Dinosaur Gum

Ithaqua posted:

Oh god. Let's talk source control horrors! My soon-to-be-former job has a beautiful TFS installation that they're totally mismanaging.

Branching? gently caress branching, everyone just checks directly into the trunk. Don't worry, they label for dev deployments and release deployments!

Continuous integration? Nope! Do a "get latest" against source control and you're probably going to get something that doesn't build. Have fun getting applications working again after someone makes a breaking change to a shared component! A 10 minute change now requires a day and a half of refactoring, retesting, and praying.


This, but with Sourcesafe. Also we have "branches", where a "branch" is someone taking their current Engine/Trunk folder, copying it into the Engine/Branches folder, naming it something, and checking the entire thing in.

:psyduck:


Jabor posted:

I honestly do not get this.

I mean, how do you check in code that doesn't work? I don't mean buggy code, I mean "your code does not even compile" broken. Do these people ... just do a commit without even trying to run their code first or something?

We have CCTray. Real conversation:
:v: : Hey, so I saw that the build broke because of your checkin...
:) : Oh, whoops.
:v: : So can you fix it?
:) : Nope, you're welcome to though.

Hammerite posted:

Some of you might get a kick out of this. http://stackoverflow.com/questions/8220399/is-this-a-php-bug

Five dollars says that there's PHP scripts that rely on the fact that an iterator doesn't get nulled out outside of it's block. :v:

Ursine Catastrophe fucked around with this message at 09:25 on Nov 22, 2011

Adbot
ADBOT LOVES YOU

dwazegek
Feb 11, 2005

WE CAN USE THIS :byodood:

Jabor posted:

I honestly do not get this.

I mean, how do you check in code that doesn't work? I don't mean buggy code, I mean "your code does not even compile" broken. Do these people ... just do a commit without even trying to run their code first or something?

Something like that.

A colleague of mine always works on about 5 projects at a time. He'll start on one project, work on that for a while until he gets side-tracked into another project and then just leave the first project half finished for days/weeks/months.

This means that he'll leave files checked out for months at a time. So, when he finally does check it in, there's a good chance that the files have already been altered by someone else. Auto-merging the changes works surprisingly often, but sometimes it results in code that doesn't compile. Since his code compiled before, and the merge tool didn't throw up any warnings, there's no need to check the code again, right? :suicide:

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