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
wwb
Aug 17, 2004

csammis posted:

This would be perfectly fine if he had ever heard of the "break" keyword :sigh:

True that. Why all the hate for "single point of return"? I don't follow it 100%, but it can definitely make sense in some scenarios.

My favorite WTF come from our HTML types who don't get simple concepts like "don't repeat yourself", "non-destructive testing" and "find and replace is not a valid maintenance technique."

Adbot
ADBOT LOVES YOU

wwb
Aug 17, 2004

HatfulOfHollow posted:

If anyone I work with ever wrote a cron job or maintenance script in php I would brain them.

Not before I chopped their thumbs off.

wwb
Aug 17, 2004

A A 2 3 5 8 K posted:

MySQL was already becoming marginalized from being owned by Sun, then Oracle acquired Sun last year without calling a lot of attention to the MySQL situation.

Except that the homo who wrote MySql decided to try and get the EU to stop the deal because his database is a special snowflake that deserves to live.

We should loving nuke sweden.

wwb
Aug 17, 2004

Small horrors are the best.

Requirement: Validator should ensure that object has no child objects and no related objects.

Thank ye gods I was walking through the junior developer's office as we don't have much in the way of formal code reviews. Mainly because I think my people can handle poo poo like this. But apparently this guy missed the day on operators. He wrote this:

code:
if (entity.Children.Count > 1) { // invalidate for save }
if (entity.Relations.Count > 1) { // invalidate for save }
Now, I've miskeyed stuff. Lots of stuff. And I'll even try and believe you might have been using the keypad to type numbers so you even missed. But you went and did it twice. Then you argued with me that it was correct.

Good help is hard to find.

wwb
Aug 17, 2004

quote:

Also, PHP (as far as I know) can't be used to write CGI pages; it depends on an Apache/nginx/whatever module that runs the scripts themselves. I suppose you could write a CGI page using the PHP interpreter, but that's even worse than just plain ol' php

The CGI-style is the default implementation on alot of platforms. Was so common they invented fast cgi to handle it.

PHP: a retarded tool for retarded people from a retarded age.

wwb
Aug 17, 2004

tumblr is a place for hipsters too wordy for twitter and not smart enough to write full blog posts.

quote:

I would kill for a stand-alone library that takes arbitrarily hosed up HTML as input and gives you its best guess at the DOM, rather than the current choice between "only support XHTML/XML" and "shoot yourself".

http://htmlagilitypack.codeplex.com/

Tell me where to send the bullets.

wwb
Aug 17, 2004

I know we build lots of apps which, at least initially, are configured via compiled code. But the configuration bits are written to be externalized when we need to fob that bit off to folks who don't do C#. It is a very trivial thing to load an object hierarchy from structured data if you build the hierarchy to be data in the first place. On the flip side, you have a very configurable, testable extensible system.

The blackberry platform is a coding horror from what I understand. Unfortunately we've got them deployed to 85% of our work force, so any mobile app we use either has to work well on a BB (good luck short of things hand-crafted by RIMM themselves) or I get to spend lots of time explaining why it won't work on your lovely blackberry.

wwb
Aug 17, 2004

Can we just start a dedicated PHP horrors thread?

wwb
Aug 17, 2004

Oh, that is definitely true of the .NET ecosphere. You just have microsoft finding creative ways to take a very slick, well thought out MVC stack and load it full of drag-n-drop fluff so converted VB6 developers can write web apps without the foggiest clue about http, html, css or javascript.

On PHP -- frankly the only selling point at this time is backwards compatibilty. You don't run php, you run wordpress or drupal that happens to run despite PHP.

In all fairness, back in the dark days in the early part of this decade, PHP was a decent choice. Your other options c. 2002:

a) ASP 3.0. Actually more of a WTF than php. Had cool features like "you should probably just reboot the server daily to make sure your poo poo runs. And sometimes that doesn't work" and "if you want to do basic web poo poo, like upload a photo, you'd better be prepared to shell out $$$$ for VisualInterDev, $$$$ for components and $$$$ for a dedicated server to run it."

b) ASP.NET 1.0. I'm not sure if anyone remembers how horrible early versions of ASP.NET or visual studio were. If you were doing anything seriously webby, you typically had to disable significant portions of the IDE. Moreover, no one really had their head around ASP.NET webforms as it was such a paradagim shift.

c) ColdFusion : perhaps the best of the breed back then from a technical level. Of course, writing logic in xml-style code is a WTF. And you were looking at $1200 to play ball, on top of OS licensing and such.

d) Java/JSP : probably the best choice for big apps. Though this was back when java was slow, java devs were rare and expensive and the frameworks were very young.

e) Perl cgi script. Remember lots of the basic web friendly CPAN poo poo didn't exist so you were probably parsing your own HTTP headers to get at the equivalent of $_GET[]. The most famous perl app of this era -- movable type -- actually was more of a compiler than a web app; it just generated your blog pages.

f) C++ cgi/module/ISAPI extension: if you really needed power, this is where you had to go back then. Now go find a graphic designer who could work with a C++ developer.

g) PHP: what, you mean you've something that automatically grabs poo poo out of URLs, kinda just works and I can splice it into my HTML rather than generating HTML in the back-end? And it's free?

Decision was kind of easy back then . . .

wwb fucked around with this message at 00:35 on Mar 4, 2011

wwb
Aug 17, 2004

^^^Ugh. Though is that a case of them using PHP as a scripting language to merge the DBs -- which could be somewhat defensible -- or is it a case of them building the new combined wfc + wachovia web stack on some horror of a PHP script.

@Scaramouche : bloggers is the easy part. Scary part is the insane penetration of drupal into just about everything content oriented on the web now. Dear god why.

wwb
Aug 17, 2004

^^^^bingo. Granted this is becoming much more blurry these days -- just about anyone is turning on some social networking hoo-ha.

wwb
Aug 17, 2004

In the current clean-up job for a website built by about a half-dozen different contractors over 5 years with murky requirements, I have 518 direct references to ConfigurationManager.AppSettings[]. The more fun parts is when they quit adding new app settings and started making derived settings based on unrelated settings. Need to find the public site root? Well, use the public site site map path.

wwb
Aug 17, 2004

I'll agree that the W3C is horrible. XML is great in the right places (like cross-platform data transfer) and HTML has changed the world.

But the w3c can suck a fat dick.

wwb
Aug 17, 2004

What exactly are "fewer edge cases?"

I'd rather have schema-bound XML than json for most data transfer tasks. Though I will say I loves me some JSON and typically choose json over xml when given the choice.

wwb
Aug 17, 2004

^^^Oh, I agree that anyone using XSLT should probably be shot. I cut my teeth in the days of "we are going to expose XML data everywhere and render all websites across all platforms using XSLT." Which sucked. But the whole world seems to be caught up in "OMG, XML Sucks balls" mentality which is vastly overstating the case. It is a tool, and at times a great tool and the right tool for the job. Just like JSON or YAML can be in the right scenarios. And sometimes CSV is actually the right choice too.

wwb
Aug 17, 2004

Xml is enterprise. Json works. Discuss.

Bigger scary part: who the gently caress needs an XML security appliance?

wwb
Aug 17, 2004

Relational to key value has disturbingly been done many times. We can start with FOR_XML_AUTO.

Oh, and who the gently caress submitted that xjson poo poo to reddit.

wwb
Aug 17, 2004

Melted_Igloo posted:

Embedded system code is the most horrible code you will see
Sometimes variables are named after the registers in memory

It is poorly documented, the only thing you have to work with is only the technical manual of the system that some hardware guy wrote 3 years before the software was made

The code is litterred with #DEFINE and #IFDEF, so it works on different platforms
(literally an embedded system might have 3 kinds of chipsets it needs to work with)

Compilers might be terribly written for the chip, they take 5 hours to compile, even running a simple test takes 10 minutes just to start..

I could go on but you get the idea

That's it, I'll never hate on the "old" .NET 2.0 apps I see occasionally.

wwb
Aug 17, 2004

Day 2 of 3 of iOS boot camp. My first 2 days with objective-C. I can get past lots of the weird assed syntax. But why the gently caress do you #define boolean true and false as YES and NO?

wwb
Aug 17, 2004

Wrong thread? Didn't think so and I didn't think it was appropriate making GBS threads up the Apple Dev megathread.

Yes, the reading angle makes sense, but just about every other language I can think of defines boolean "true" using the keyword TRUE and boolean "false" using the keyword FALSE. Kind of like all the other little apple differences. I should say it is a pretty slick language and environment once you get past the funkiness.

wwb
Aug 17, 2004

Please tell me chopped off that guy's thumbs. I keep a cigar cutter handy for that purpose.

wwb
Aug 17, 2004

quote:

Here's the report boss, it comes with data in something that isn't Excel. What's that? I'm fired?

Last time I checked, most bosses don't want to wade through 65k++ lines of a spreadsheet, they want the relevent parts of that.

Now, our "stats" guy only uses excel. And he is trying to make sense of these huge assed government data sets. No, excel can't handle 20+ GB of relational data.

wwb
Aug 17, 2004

Debugging someone [long gone's] code:

code:
// should not be empty
if (entries.Count()> 1)
I wonder why I drink sometimes . . .

wwb
Aug 17, 2004

Ithaqua posted:

code:
if (someObject != null)
{    
     if (someObject != null) 
     {
       //code
     }
}
Someone wanted to be really really really really sure that it wasn't null.

That would make sense if there was a lock statement in there between the ifs. Guess that was too cool for school.

wwb
Aug 17, 2004

PDP-1 posted:

I've worked with about 100 PhD types over my career and am an ABD myself. Based on that sample I think there's about three basic groups . . .

Not anywhere near academia here, but your three basic groups are not solely confined to PHD-bearers. I'd argue it covers the technical world at large.

wwb
Aug 17, 2004

Is CSS perfect, no? But like any other design medium you need to start working with it rather than against it.

Unfortunately most designers don't like using calculators to figure out how to manipulate box models. And it took a decade for tools and browsers to catch up.

wwb
Aug 17, 2004

Well, C is what most ORMs do when batching commands.

I'll also add it is possible to nest transactions. I myself tend to send multiple commands over a single connection, rudimentary tests indicate that is as fast as building one massive command and alot easier to code/manage. Hell, opening/closing per command doesn't hurt that much as long as you aren't writing to JET; connection pooling is awesome.

wwb
Aug 17, 2004

adaz posted:

This is like the 4th time I've run into a Try/Catch/finally block that has nothing in the catch. Why jesus why, it's like someone got upset that On error Resume Next doesn't exist :suicide:



That isn't horribly bad code there -- they are cleaning up using the finally block. VB.NET didn't have using(){} until the VS2010 version AFAIK so it makes sense.

wwb
Aug 17, 2004

Yeah, somehow looked past that. Catch definitely shouldn't be there . . .

wwb
Aug 17, 2004

I can think of lots of neat set-based operations that are horribly ugly or expensive in an ORM. I can think of lots of lightweight apps that do just fine without the ceremony of an ORM. I can think of lots of apps I made worse by adding an ORM. Choose the right tool for the job -- and sometimes the right tool is raw sql.

If I was to make any brash-assed blanket statement about data access in 2012, it would be that your default answer for data storage should not be relational. Document databases make so much more sense for most apps and generally dodge the whole issue of needing or not needing an ORM in the first place.

@Frozen-Solid -- sql in clauses are kinda sucky to deal with. Presuming you don't have a realistic danger of hitting the length limits, the best way I've seen to deal with them is to generate the SQL statement in on the client, take a collection as a parameter and loop through that to create parameter names and bind the parameters to the command.

EDIT:
Holy poo poo. Speaking of coding horrors, lets see Joel's way of creating a in query, from Frozen-Solid's SO link:

Joel Splosky posted:

select * from Tags
where '|ruby|rails|scruffy|rubyonrails|'
like '%|' + Name + '|%'

What the christ. I should suck at computer so I can go sell a bug tracker.

Please use the 2nd answer. Works great :)


wwb fucked around with this message at 02:22 on Dec 10, 2011

wwb
Aug 17, 2004

gently caress time zones and gently caress daylight savings. No reason at all for that hokey poo poo in the modern world. Universal UTC for life.

wwb
Aug 17, 2004

First, let's all remember that the concept of time beyond sunrise, noon and sunset is a relatively new concept in human thought. It dates from the 19th century where railroads forced the world to agree on the clock across administrative boundaries.

Moreover I think there are a few problems here. The one I'm squarely aimed at is removing the concept of local time and settling on a universal standard. So it is 1700 hours everywhere rather than it being 5:00 somewhere. Obvious side-effect of this is going to a 24 hour clock. But much of the world already is on a 24 hour clock already so I don't think that is that big a challenge.

Formats and such typically matter most in electronic data interchange, that is really a moot point for most of the world. We can use the same constructs to express time, except I would be posting this at 2016 rather than 3:16 in the afternoon.

wwb
Aug 17, 2004

2 interviews this week for a mid-level position. Neither candidate could effectively answer the first bits of the "can you actually code" phone screen questions. These questions are:

quote:

1) In C#, how do you figure out if a collection such as a IList<T> or array is empty?
2) Given a collection of Person objects with a FirstName, LastName and CompanyName property please write a method that:
a) Writes the first and last names of each person to the console
b) Take (a) and modify it so it capitalizes the name when the comapny name is a specified value

I'm getting a bit worried.

wwb
Aug 17, 2004

Both resumes had several years of professional experience.

quote:

I don't know the company or the specific job posting, but I'm guessing if someone said "There's a count() or a size() method on the list, I can't remember the exact name, but I'd use that" then it'd be ok. But I dunno.

Exactly. What I'm looking for is someone who can say without thinking "Yeah, I'd check to see if the list has zero items in it." Bonus points for differentiating between techniques or checking for null first.

The split in this thread on this question is interesting, and I've seen a bit of the same in the interviews -- some folks get stuck on "crap, what is the syntax" and don't get to the logical part of what you are looking for. I'm kind of struggling with this myself having never been horribly trained and brought up in normal programming but rather in solving problems with computers sometimes using code so I think that way. Which is a really long winded way of saying I'm open for suggestion as to a better way to ask the question.

@Ithaqua: The capitalization in 2b is a bit of a red herring, really looking to see that someone can handle concepts of "loop through collection and do something conditional with it". Picked captialization because it was easy, I figured everyone knew .ToUpper(). Was originally designed to be a MVC3 / Razor question but nobody has been comfortable enough over there.

quote:

I prefer to save the "can you actually code" questions until they come in for the in-person, and then have them do it with an IDE. Coding over the phone sucks. Your first question, although you'd expect that anyone with a reasonable level of proficiency would be able to answer, it doesn't show anything other than that they've read some code before. Your second question is better because it makes them solve a simple problem.

Yeah, we got a whole (small) project for them to do with an IDE, but I don't want to waste their or my time setting things up if they can't handle very, very basic things anyone who has coded anything in any semblance of a modern language should be able to handle.

wwb
Aug 17, 2004

I found appmodel.m today. It took a long while to find appmodel.m; but when I did, I understood. You see, appmdel.m is where I found the entire logic for the application. In terms of that whole branching logic thing. About 57/58kb of non-xcode generated, non third-party source code weight. Thank god the app is pretty. And it technically does work.

But for the live of christ can some one walk these graphic designers cum iOS devs through sepa-loving-rations of concerns.

wwb
Aug 17, 2004

GrumpyDoctor posted:

I took an electronic arts class in college in which in which I did my final project in Max/MSP and I blew my instructor's mind by actually skeleton-ing out the program before diving in and stringing connections around willy-nilly the way musicians using Max always do.

The funny part is our audio engineer types love this sort of drag and drop things approach. They get scared by seeing actual code.

wwb
Aug 17, 2004

I could have actually not got as involved in this project at this point. But my spidey sense tingled after the first dev meet and greet so I stuck with it.

Today I finally [after weeks of wrangling] get into the meat of the source code. There is lots of material. But I'll just leave you all with this:

code:
        if (Request.QueryString["UserName"] != null && Request.QueryString["UserName"].ToString().Length > 0)
        {
            UserName = Request.QueryString["UserName"].ToString();
        }
        if (Request.QueryString["Password"] != null && Request.QueryString["Password"].ToString().Length > 0)
        {
            Password = Request.QueryString["Password"].ToString();
        }
        if (UserName == "" & Password == "")
        {
            lblResponse.Text = "Invalid";
            return;
        }
Response.Clear();

        ObjAdminUser = new clsAdminUser();
        dsUser = ObjAdminUser.GetResults("select * from Users where UserName = '" + UserName + "'");
        if (dsUser.Tables[0].Rows.Count > 0 && dsUser != null)
        {
            Response.Write ("Username already exists!");
        }
        else
        {
            UserID = Save_Value();
            if (UserID == 1)
            {
                Response.Write("Success");
                Session["FirstName"] = FirstName;
                Session["LastInitial"] = LastName;
                Session["UserName"] = UserName;
                Session["UserID"] = UserID;
            }
            else
                Response.Write("Failure");
        }
I'm not sure how far I want to follow this rabbit hole.

wwb
Aug 17, 2004

Yeah. Kid writing it swore up and down that he only made it that way for testing. I pointed out that 45 seconds or so with jquery let one make a browser-based post that could test the service properly.

I should also point out that Request.QueryString is a NameValueCollection, which means it returns strings. So the Request.QueryString["FirstName"].ToString() either calls .ToString() on a string or crashes because said value isn't part of the querystring.

It is always quality fun pulling PHP devs into .NET problems.

wwb
Aug 17, 2004

senrath posted:

Technically, it's not only requiring the username to authenticate. That's code to create a new account, from what I can tell. I mean, it's still bad, but not quite that bad.

Yeah, I'm still trying to wrap my head around the authentication side, though it also works over HTTP get requests. They are also just stuffing raw user IDs in a cookie with zero obfusciation or other defense. Want to be a different user? Just edit your cookie . . . .

Adbot
ADBOT LOVES YOU

wwb
Aug 17, 2004

gently caress me, how does one make sure this piece of poo poo isn't enabled.

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