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
Clavius
Oct 21, 2007

Howdy!


:barf:

Adbot
ADBOT LOVES YOU

Beef
Jul 26, 2004
The real horror here is that whole web thingy.

qntm
Jun 17, 2009

Clavius posted:



:barf:

I bet they were doing this with tables before, until they heard somewhere that tables were bad, so they moved to DIVs

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
In order to get rounded corners just right I've had to resort to autogenerating html like that. It sucks but them's the breaks on an internet that allows IE.

NotShadowStar
Sep 20, 2000

Suspicious Dish posted:

(The bet was related to Prototype's use of regex to validate JSON and then parse it using eval(), which is a horror in and of itself. I bet money that there was no excuse -- the JSON spec was easy enough to hand-write a recursive-descent parser for in an hour. I won.)

Oh sam :allears:

Vanadium
Jan 8, 2005

Isn't being able to eval it pretty much what json was designed for?

Plorkyeran
Mar 22, 2007

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

Vanadium posted:

Isn't being able to eval it pretty much what json was designed for?
it was perhaps an original goal but people figured out pretty quickly that running arbitrary code from third parties is a really bad idea and validating that the code is safe to run is more work than just writing a parser

NotShadowStar
Sep 20, 2000
It's trivial to write a parser though, and would likely be faster than eval()

*unsubstantiated claim

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

NotShadowStar posted:

Oh sam :allears:

Tom, actually:
https://github.com/sstephenson/prototype/commit/9ff57b042d30b527ff1c96feec863042b28926a8#diff-1

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

NotShadowStar posted:

It's trivial to write a parser though, and would likely be faster than eval()

*unsubstantiated claim

Faster than an eval implemented in Javascript, yes. Faster than a native-code eval implementation?

Of course all modern browsers have native JSON decoding too, so there's really no excuse for using eval at all.

PalmTreeFun
Apr 25, 2010

*toot*

qntm posted:

I bet they were doing this with tables before, until they heard somewhere that tables were bad, so they moved to DIVs

I don't really know much about web design. Are tables actually bad or not?

baquerd
Jul 2, 2007

by FactsAreUseless

PalmTreeFun posted:

I don't really know much about web design. Are tables actually bad or not?

Tables are pretty good at displaying tabular data and for organization of very basic pages. When used excessively for layout they get really ugly really fast.

NotShadowStar
Sep 20, 2000

PalmTreeFun posted:

I don't really know much about web design. Are tables actually bad or not?

Tables were used as layout before CSS was good enough to take over the job and tables were an approximation on what print designers are used to. Then came this long dark era where everything was ugly as poo poo because CSS doesn't give you the tools that someone doing design would expect, like columns and baselines and letter spacing all that fun stuff. In the last few years you saw the web starting to look a whole lot nicer because the old print designers learned CSS and started applying the decades old techniques on how to make things look pretty to CSS. Baselines almost impossibly hard to keep straight though, and letter spacing is pretty much non-functional still.

Powerful Two-Hander
Mar 10, 2004

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


Thanks to this thread I correctly guessed the cause of an intermittent connection failure in a system - it was an intermittent problem where it would lose connection to the database and boot users out and as soon as it was mentioned I said "Heh, I bet it'll turn out that it's not got anything handling connection failures". It took the developer on it a couple of days to get down to the problem but sure enough, buried in the code was a wonderful CATCH returns NULL.

Nice one whoever put that it. You can't acquire a connection so what should you do? gently caress it just carry on regardless.

Clavius
Oct 21, 2007

Howdy!

TRex EaterofCars posted:

In order to get rounded corners just right I've had to resort to autogenerating html like that. It sucks but them's the breaks on an internet that allows IE.

Yeah don't do this. It's much better to just let IE have the square corners and use border-radius. It's extremely easy to bring round an ACM or client to this way of thinking when you tell them it will take X amount of extra hours to implement and quantify that extra cost to them. There's also the billion other arguments such as clean code, scalability, future planning, accessibility, load time, maintenance time blah blah blah blah, but the easiest one to sell the average person you actually have to sell this to is just to quantify the money they lose by implementing a meaningless piece of flair that adds nothing to the functionality of a product in a ten year old peripheral.

e: and if that fails and you absolutely must have the corners in ie, use a js framework or something to patch up the lack of functionality, don't make the real browsers suffer with terrible coding practice. CSS3PIE was pretty rad the last time I went out of my way to make the design identical down to ie6.

Clavius fucked around with this message at 00:30 on Dec 8, 2011

Fiend
Dec 2, 2001

qntm posted:

I bet they were doing this with tables before, until they heard somewhere that tables were bad, so they moved to DIVs

code:
div.table {display:table;}
div.table-cell { display: table-cell;}
div.table-row {display:table-row;}
Now all I need is some jQuery functionality to apply the colspan and rowspan attributes then I can finish my find/replace script!

w00tz0r
Aug 10, 2006

I'm just so god damn happy.
Proving once again that one of the hardest problems in computer science is naming things:

code:
class Implementation
{
    // 40 pure virtual functions
};

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Clavius posted:

Yeah don't do this. It's much better to just let IE have the square corners and use border-radius.

Don't you know that if everything doesn't have drop shadows and rounded corners in all browsers, your site won't work at all / visitors will immediately leave / nobody will understand the 'vision' / be unable to read the content that's nowhere near the rounded corners / become outraged?

evensevenone
May 12, 2001
Glass is a solid.
I really liked the period of time where the harder/uglier it was to do something in CSS the more likely common it was because 98% of the CSS tutorials on the web were three-column layouts and rounded corners.

Hughlander
May 11, 2005

w00tz0r posted:

Proving once again that one of the hardest problems in computer science is naming things:

code:
class Implementation
{
    // 40 pure virtual functions
};

I came across this yesterday:

code:
class ISomething : public CSomething
{
     void DoSomething() { Function(); Function2(); }
};
I pretty much shouted, "INTERFACES DO NOT WORK THAT WAY."

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Obviously they're short for "Implementation" and "Contract".

Suspicious Dish
Sep 24, 2011

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

evensevenone posted:

I really liked the period of time where the harder/uglier it was to do something in CSS the more likely common it was because 98% of the CSS tutorials on the web were three-column layouts and rounded corners.

I still think CSS is terrible for layout. There's 1000 different ways to "center something", and they all have their own drawbacks. It's amazing to me that there's a whole society of people who have been brainwashed into believing that position: absolute; top: 50%; left: 50%; margin-top: -300px; margin-left: -400px; is better than <center>.

I'm all for separation of content and markup, but what I feel CSS needs is horizontal-position: center; vertical-position: center;, which the browser would do all the correct math to center the element relative to the parent. I've heard there's a float: center; in CSS3, and there's that new fancy flex box stuff, so I guess there's things to look forward to.

NotShadowStar
Sep 20, 2000

Suspicious Dish posted:

I still think CSS is terrible for layout. There's 1000 different ways to "center something", and they all have their own drawbacks. It's amazing to me that there's a whole society of people who have been brainwashed into believing that position: absolute; top: 50%; left: 50%; margin-top: -300px; margin-left: -400px; is better than <center>.

I'm all for separation of content and markup, but what I feel CSS needs is horizontal-position: center; vertical-position: center;, which the browser would do all the correct math to center the element relative to the parent. I've heard there's a float: center; in CSS3, and there's that new fancy flex box stuff, so I guess there's things to look forward to.

code:
margin-left: auto; margin-right; auto;
The reason there isn't a center position attribute is exactly why the above only works if you have the parent have a specified width. Otherwise, what are you centering on? The container? Well how big is that? It's a slippery slope with so many failure cases.

w00tz0r
Aug 10, 2006

I'm just so god damn happy.
I'm diving into one of our old programs to port it over to from VC6 to VS2008, so I'm looking forward to regularly screaming at my monitor again.

At least I convinced them to let me install redmine as opposed to working off a to-do list .txt file on my lead's desktop.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Clavius posted:

Yeah don't do this. It's much better to just let IE have the square corners and use border-radius. It's extremely easy to bring round an ACM or client to this way of thinking when you tell them it will take X amount of extra hours to implement and quantify that extra cost to them. There's also the billion other arguments such as clean code, scalability, future planning, accessibility, load time, maintenance time blah blah blah blah, but the easiest one to sell the average person you actually have to sell this to is just to quantify the money they lose by implementing a meaningless piece of flair that adds nothing to the functionality of a product in a ten year old peripheral.

e: and if that fails and you absolutely must have the corners in ie, use a js framework or something to patch up the lack of functionality, don't make the real browsers suffer with terrible coding practice. CSS3PIE was pretty rad the last time I went out of my way to make the design identical down to ie6.

Lecture me all you want, specs are specs and customer is rich, I'm not going to rile him up over more money for me. I'll give him the "this will take X hours" and if he says "ok" then I do it.

Tunga
May 7, 2004

Grimey Drawer
Well I can't possible imagine why ticking and unticking the box to control <feature> isn't working, afterall the backend code looks mighty fine to me:
code:
bool isFeatureOn = false;
if (isFeatureOn)
{
  <do stuff>
}
else
{
  <do nothing>
}
:suicide:

Suspicious Dish
Sep 24, 2011

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

NotShadowStar posted:

code:
margin-left: auto; margin-right; auto;
The reason there isn't a center position attribute is exactly why the above only works if you have the parent have a specified width. Otherwise, what are you centering on? The container? Well how big is that? It's a slippery slope with so many failure cases.

Only works with a specified width, and now you need a wrapper <div> to add a margin.

NotShadowStar
Sep 20, 2000

Suspicious Dish posted:

Only works with a specified width, and now you need a wrapper <div> to add a margin.

Uh, yes, there's reasons for that.
Quiz time: How do you automatically center something that isn't text in something like InDesign?
A: You can't, because of the same problems I talked about. You center something by hand in InDesign, Interface Builder, whatever the name of the Microsoft thing builder is. The thing you're trying to center has to have a fixed size, what you're centering it to has to have a fixed size, and the margins are calculated automatically.

mjau
Aug 8, 2008
Can you center vertically with that? "margin-top: auto; margin-bottom: auto;" doesn't seem to do anything.

Optimus Prime Ribs
Jul 25, 2007

mjau posted:

Can you center vertically with that? "margin-top: auto; margin-bottom: auto;" doesn't seem to do anything.

The margin:0px auto trick only works for horizontal centering, and in my experience vertical centering can be a bitch.

The best way I've found to do it, where the containing element's height is not known, is: display:table-cell; vertical-align:middle;.
I feel dirty every time I use that though. :(

Clavius
Oct 21, 2007

Howdy!

TRex EaterofCars posted:

Lecture me all you want, specs are specs and customer is rich, I'm not going to rile him up over more money for me. I'll give him the "this will take X hours" and if he says "ok" then I do it.

Like I said, there are much better ways to pander to terrible browsers than nesting divs horribly. Rounded corners is especially easy using what I posted there.

Vertical centering in CSS is loving awful. Mostly I just design to not have to center vertically because more often than not a fixed height is terrible practice for when blind people want bigger font sizes and stuff like that. It's much better to let the heights of elements be dictated by a base from the font size using em's. Sometimes it's not possible but ideally...

Generally though CSS2 isn't set up for layout and we use a series of nasty hacks because it's a bit less horrible than tables. CSS3 has some real real nice layout controls going, but it's one of those things we can't just apply the progressive enhancement argument to like rounded corners and shadows and stuff. The old browsers will totally gently caress it up rather than degrade it gracefully.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Clavius posted:

Like I said, there are much better ways to pander to terrible browsers than nesting divs horribly. Rounded corners is especially easy using what I posted there.


I will use that in the future, thanks.

NotShadowStar
Sep 20, 2000

Clavius posted:

Vertical centering in CSS is loving awful.

This is mostly because for some reason even CSS3 doesn't have any abilities for baseline grids, so you have to do it yourself. If you were vertically centering some element in InDesign you'd put an equal number of baselines top and bottom. With CSS you have to do the same calculations by hand. It comes out the same in the end if you do it right, it's just more work and more chances to get it wrong.

PalmTreeFun
Apr 25, 2010

*toot*
For a script designed to make web design easier, CSS sure doesn't seem to do a lot to make web design easier.

Sinestro
Oct 31, 2010

The perfect day needs the perfect set of wheels.

PalmTreeFun posted:

For a script designed to make web design easier, CSS sure doesn't seem to do a lot to make web design easier.

CSS makes the trivial easy, and the complex achievable. :downsrim:

EDIT: That was sarcastic.

Sinestro fucked around with this message at 21:34 on Dec 8, 2011

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.

raminasi
Jan 25, 2005

a last drink with no ice
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Spatial_searching_ref/Class_Kd_tree.html

Look at the const-ness of the operations. I find some of them...questionable.

Medieval Medic
Sep 8, 2011
This thread always give me a few laughs, so I feel like giving back. This is one of the horrors I ended up with today after completing my project that I have to give my professor tomorow. Granted, it wouldn't be this terrible if my two project partners hadn't dropped out of the class 1/4 of the way through, and left me to do this completely alone.

code:
List<int> idList = new List<int>();
            if (ValidId(t.IdTramite))
            {
                using (SqlConnection sqlCxn = new SqlConnection(cxnString))
                {
                    SqlCommand sqlCmd = new SqlCommand();
                    sqlCmd.Connection = sqlCxn;
                    sqlCmd.CommandType = CommandType.Text;
                    sqlCmd.CommandText = "INSERT INTO Tramite(IdTramite, Descripcion) Values(" + t.IdTramite + ",'" + t.Descripcion + "')";
                    sqlCxn.Open();
                    salida = sqlCmd.ExecuteNonQuery();
                    sqlCxn.Close();

                    int counter = 0;

                    foreach (string paso in t.Pasos)
                    {
                        sqlCxn.Open();
                        sqlCmd.CommandText = "INSERT INTO Paso(Paso, IdTramite) Values('" + paso + "'," + t.IdTramite + ")";
                        salida = sqlCmd.ExecuteNonQuery();
                        sqlCxn.Close();
                        counter++;
                    }
                    sqlCxn.Open();
                    sqlCmd.CommandText = "SELECT TOP(5) IdPaso FROM Paso ORDER BY IdPaso DESC";
                    SqlDataReader reader = sqlCmd.ExecuteReader();
                    while (reader.Read())
                    {
                        idList.Add(reader.GetInt32(0));
                    }
                    sqlCxn.Close();
                    int i = 0;
                    while (counter > 0)
                    {
                        POIDatos.Insert(t.PeopleOfInterest.ElementAt(i), idList[counter - 1]);
                        i++;
                        counter--;
                    }
To sort this one issue it took me like 4 days, and in the end I just brute forced it, that is the result.

Johnny Cache Hit
Oct 17, 2011

Medieval Medic posted:

code:
sqlCmd.CommandText = "INSERT INTO Tramite(IdTramite, Descripcion) Values(" + t.IdTramite + ",'" + t.Descripcion + "')";

Just don't do that when you're getting paid to write code :shobon:

Adbot
ADBOT LOVES YOU

A MIRACLE
Sep 17, 2007

All right. It's Saturday night; I have no date, a two-liter bottle of Shasta and my all-Rush mix-tape... Let's rock.

Kim Jong III posted:

Just don't do that when you're getting paid to write code :shobon:

or this

code:
foreach
{
  sqlConnection.open();
  //  ...
  sqlConnection.close();
}

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