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
Funking Giblet
Jun 28, 2004

Jiglightful!

substitute posted:

Everyone go view source on this poo poo. It's hilarious.

There's a hidden form field with a value that is over 100,000 columns.

What's worse is that it's the ViewState.
That has to be processed on the backend for every request. Who's betting the keywords metadata is also stored there...

Adbot
ADBOT LOVES YOU

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."

Bastard posted:

Open DevTools, click on the gear icon, enable the "Disable cache (while DevTools is open)" option.

:tipshat: I'm a moron.

Chenghiz posted:

Work in an incognito tab. If you're working with offline web apps this is also nice for having a fresh cache for testing and development.

Is this still valid if the site requires sign in?

Bastard
Jul 13, 2001

We are each responsible for our own destiny.

supermikhail posted:

:tipshat: I'm a moron.

Not really, I've met quite a few developers who didn't know that option existed. Most just use the elements, network and console tabs for basic debugging usage, while DevTools offers so much more. :)

cheese eats mouse
Jul 6, 2007

A real Portlander now

substitute posted:

Everyone go view source on this poo poo. It's hilarious.

There's a hidden form field with a value that is over 100,000 columns.

This is an incoming client of ours.

hehhehehe :barf:

Munkeymon
Aug 14, 2003

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



supermikhail posted:

Chrome after a while stops reloading JavaScript and gets it from the cache which is annoying when I'm editing it (supposedly it's not just JavaScript, but this is what's annoying). How do you work this thing? (Right now I "Clear Browsing Data").

When dev tools is open, you can right-click on the reload button and select Empty Cache and Hard Reload

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."

Munkeymon posted:

When dev tools is open, you can right-click on the reload button and select Empty Cache and Hard Reload

:psyboom:

Thank you!

kedo
Nov 27, 2007

Hard reloads also have easy keyboard shortcuts in Chrome: Cmd + Shift + R on Mac, Ctrl + F5 on Windows.

Use shortcuts for everything if you're a real man. :colbert:

Xarb
Nov 26, 2000

Not happy.
Personally I like Devtools > Settings (cog icon) > General > Disable cache (while DevTools is open)

kedo
Nov 27, 2007

In case you haven't seen it yet, this is worth a read: http://stilldrinking.org/programming-sucks A painfully, hilariously accurate portrait of our industry.

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."
:ohdear: I don't think I'll be able to sleep tonight.

Munkeymon
Aug 14, 2003

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




Yeah, they do a good job hiding useful features. Did you know you can make the dev tools dock to the right of the content instead of below it? They hide that option pretty well, too.

kedo posted:

Hard reloads also have easy keyboard shortcuts in Chrome: Cmd + Shift + R on Mac, Ctrl + F5 on Windows.

Use shortcuts for everything if you're a real man. :colbert:

Empty Cache and Hard Reload doesn't have a shortcut :(

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.
As a side project, I've decided to migrate my resume out of Apple Pages and into html - the idea being that I can version control it properly, etc. I'd like the CSS to roughly look like a paper resume at desktop device size, be appropriately responsive on mobile, and competently 'print to PDF' such that the resulting PDF looks like it came out of a word processor and not a web browser.

I know this is vague, but can anyone give me any pointers on getting started? The markup and responsive stuff will be easy enough, but I'm not sure how to tackle that third requirement.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Lexicon posted:

As a side project, I've decided to migrate my resume out of Apple Pages and into html - the idea being that I can version control it properly, etc. I'd like the CSS to roughly look like a paper resume at desktop device size, be appropriately responsive on mobile, and competently 'print to PDF' such that the resulting PDF looks like it came out of a word processor and not a web browser.

I know this is vague, but can anyone give me any pointers on getting started? The markup and responsive stuff will be easy enough, but I'm not sure how to tackle that third requirement.

Make sure you have a 2nd stylesheet for media="print" and set sane pinter type sizes and hide stuff that doesn't make sense to print. Body copy at or near 11pt (note the points, not pixels for printers), headlines around 14-18pt, etc. Type should be larger on screen because it's read at about an outstretched arms length away, while print is read at "bent arm" length, so it's smaller. (An aside: this is why people use who 11/ 12 px type on the web should all be tarred and feathered.)

This is my print.css form my resume:
CSS code:
body { font-family:  palatino, georgia, serif;
   font-size: 12pt; width: 40em;  line-height: 1.4em;}
#header {display: none;}
#footer, #leftColumnWrapper { display:none;}
a {text-decoration: none;}
li { line-height: 1.4em; margin-bottom: 0.25em; 
    list-style-type: square; }
h1, h2 { font-family: helvetica; font-size: 14pt; color: #666;  }
h1 { font-size: 16pt;}
You can also try forcing page-breaks, but my experience is that it didn't work out so well. However, that was years ago, so things may be better now. Here's an article on the subject: http://css-tricks.com/almanac/properties/p/page-break/

Chenghiz
Feb 14, 2007

WHITE WHALE
HOLY GRAIL

Lexicon posted:

As a side project, I've decided to migrate my resume out of Apple Pages and into html - the idea being that I can version control it properly, etc. I'd like the CSS to roughly look like a paper resume at desktop device size, be appropriately responsive on mobile, and competently 'print to PDF' such that the resulting PDF looks like it came out of a word processor and not a web browser.

I know this is vague, but can anyone give me any pointers on getting started? The markup and responsive stuff will be easy enough, but I'm not sure how to tackle that third requirement.

I'm not really sure what you mean by 'looks like it came out of a word processor' but you can specify different css files for print than for screen, so you can optimize your layout specifically for a sheet of paper easily enough.

e;fb

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.

Lumpy posted:

Make sure you have a 2nd stylesheet for media="print" and set sane pinter type sizes and hide stuff that doesn't make sense to print. Body copy at or near 11pt (note the points, not pixels for printers), headlines around 14-18pt, etc. Type should be larger on screen because it's read at about an outstretched arms length away, while print is read at "bent arm" length, so it's smaller. (An aside: this is why people use who 11/ 12 px type on the web should all be tarred and feathered.)

This is my print.css form my resume:
CSS code:
body { font-family:  palatino, georgia, serif;
   font-size: 12pt; width: 40em;  line-height: 1.4em;}
#header {display: none;}
#footer, #leftColumnWrapper { display:none;}
a {text-decoration: none;}
li { line-height: 1.4em; margin-bottom: 0.25em; 
    list-style-type: square; }
h1, h2 { font-family: helvetica; font-size: 14pt; color: #666;  }
h1 { font-size: 16pt;}
You can also try forcing page-breaks, but my experience is that it didn't work out so well. However, that was years ago, so things may be better now. Here's an article on the subject: http://css-tricks.com/almanac/properties/p/page-break/

Thanks, that's helpful - will give that a shot!

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.
There's a data science article about rap lyrics flying around Twitter right now: http://rappers.mdaniels.com.s3-website-us-east-1.amazonaws.com/

To my surprise, the font used is Source Sans Pro - one that I've typically not liked when I've used it myself. However, it looks beautiful on this page. I just tried to replicate it myself with the same obvious CSS rules and Google font reference - and lo and behold - it's back to looking like crap again:



Why is my version (bottom) so hideous compared to the top?

Fayez Butts
Aug 24, 2006

It didn't work in your version. That's Helvetica Light.

lufty
Jan 26, 2014
noob here

HTML code:
<!DOCTYPE html>
<html>
<head>
<title>Exam Entry</title>
</head>

<body>
<h1>Exam Entry Form</h1>
<form name="ExamEntry" method="post" action="success.html">
<table width="50%" border="0">
	<tr>
		<td id="name">Name</td>
		<td><input type="text" name="name" /></td>
	</td>
	
	<tr>
		<td id="subject">Subject</td>
		<td><input type="text" name="subject" /></td>
	</tr>
	
	<tr>
		<td id="examinationnumber">Examination Number</td>
		<td><input type="text" name="examinationnumber" /></td>
	</tr>
	
	<tr>
		<td><input type="submit" name="Submit" value="Submit" onclick="returnvalidationForm();"/></td>
		<td><input type="reset" name="Reset" value="Reset"/></td>
	</tr>
</table>
</form>

<script language="javascript" type="text/javascript">

function validateForm()
{
	var result = true;
	var msg="";
	
	if (document.ExamEntry.name.value=="")
	{
		msg+="You must enter your name\n";
		document.ExamEntry.name.focus();
		document.getElementById('name').style.color="red";
		result=false;
	}
	
	if (document.ExamEntry.subject.value=="")
	{
		msg+="You must enter the subject\n";
		document.ExamEntry.subject.focus();
		document.getElementById('subject').style.color="red";
		result=false:
	}
	
	if (document.ExamEntry.name.value=="")
	{
		msg+="You need to enter an examination number \n";
		document.ExamEntry.examinationnumber.focus();
		document.getElementById('name').style.color=”red”;
		result = false;
	}
	
	if(msg=="")
	{
	return result;
	}
	
	{
	alert(msg)
	return result;
	}
}

</script>
</body>
why does the JavaScript fail to validate the Name, Subject and Examination Number forms?

Mister Chief
Jun 6, 2011

Make a jsfiddle.

kedo
Nov 27, 2007

Because your function name is different than what you're calling.

HTML code:
<td><input type="submit" name="Submit" value="Submit" onclick="returnvalidationForm();"/></td>

function validateForm()

lufty
Jan 26, 2014

Mister Chief posted:

Make a jsfiddle.

Thanks, it seems quite handy.
So I used jsfiddle to tidy it up, but the JScript still fails to check the forms?

After corrections:
HTML code:
<!DOCTYPE html>
<title>Exam Entry</title>

<body>
<h1>Exam Entry Form</h1>
<form name="ExamEntry" method="post" action="success.html">
<table width="50%" border="0">
	<tr>
		<td id="name">Name</td>
		<td><input type="text" name="name" /></td>
	</tr>
	
	<tr>
		<td id="subject">Subject</td>
		<td><input type="text" name="subject" /></td>
	</tr>
	
	<tr>
		<td id="examinationnumber">Examination Number</td>
		<td><input type="text" name="examinationnumber" /></td>
	</tr>
	
	<tr>
		<td><input type="submit" name="Submit" value="Submit" onclick="returnvalidationForm();"/></td>
		<td><input type="reset" name="Reset" value="Reset"/></td>
	</tr>
</table>
</form>

<script language="javascript" type="text/javascript">

function validateForm()
{
	var result = true;
	var msg="";
	
	if (document.ExamEntry.name.value==="")
	{
		msg+="You must enter your name\n";
		document.ExamEntry.name.focus();
		document.getElementById('name').style.color="red";
		result=false;
	}
	
	if (document.ExamEntry.subject.value==="")
	{
		msg+="You must enter the subject\n";
		document.ExamEntry.subject.focus();
		document.getElementById('subject').style.color="red";
        result=false;
    }
	
	if (document.ExamEntry.name.value==="")
	{
		msg+="You need to enter an examination number \n";
		document.ExamEntry.examinationnumber.focus();
		document.getElementById('name').style.color="red";
		result = false;
	}
	
	if(msg==="")
	{
	return result;
	}
	
	{
	alert(msg);
	return result;
	}
}
    
</script>

Mister Chief
Jun 6, 2011

kedo posted:

Because your function name is different than what you're calling.

HTML code:
<td><input type="submit" name="Submit" value="Submit" onclick="returnvalidationForm();"/></td>

function validateForm()

lufty
Jan 26, 2014

Sorry, just realised.....
ugh i'm stupid

is this correct?
HTML code:
onclick=return "validationForm()"

EAT THE EGGS RICOLA
May 29, 2008

lufty posted:

Thanks, it seems quite handy.
So I used jsfiddle to tidy it up, but the JScript still fails to check the forms?


... put it on jsfiddle, save it, and post a link so that we can look at it there.

lufty
Jan 26, 2014

EAT THE EGGS RICOLA posted:

... put it on jsfiddle, save it, and post a link so that we can look at it there.

http://jsfiddle.net/X8q9L/

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Exhibit A: validateForm()
Exhibit B: validationForm()

These things need to be the same.


Also, never, ever, ever, ever, ever put a RESET button on your form. People only click on those by mistake, and then will hate you and your site when the form empties out instead of submitting.

http://jsfiddle.net/Us486/1/


Once you fix that, you'll find out that the form submits no matter what. Look into the form's onsubmit handler, as that's what you need to use to prevent it from submitting based on client side validation.

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.

Fayez Butts posted:

It didn't work in your version. That's Helvetica Light.

Christ, I'm an idiot. I was editing the wrong layout file, and so the font never made it into the page - it was falling back to Helvetica as you correctly noticed. :doh:

So now I'm closer, but it still look wrong.

I'm guessing it comes down to inherited properties that differ, but even this same element CSS leads to a pretty different outcome:

code:
p {
  font-weight: 300;
  line-height: 28px;
  font-size: 22px;
  font-family: 'Source Sans Pro';
  color: #333;
}


Any ideas?


(ps: mad respect to any design folks who work magic with type. I knew this already of course, but this silly example just reaffirms it - it's incredibly hard to get right)

kedo
Nov 27, 2007

Try playing around with antialiasing styles. For example:

CSS code:
font-smoothing: antialiased;
vs.

CSS code:
font-smoothing: subpixel-antialiased;
will make a huge difference. Your first screenshot is subpixel-antialiased. If you zoom in you'll see colored pixels on the sides of the letters. The second is grayscale antialiased.

This is what I tend to use for all my projects because I find that subpixel-antialiasing makes fonts weightier than they should be:

CSS code:
*, *:after, *:before {
	-webkit-font-smoothing:antialiased;
	-moz-font-smoothing:antialiased;
	-moz-osx-font-smoothing: grayscale;
	-o-font-smoothing:antialiased;
	font-smoothing:antialiased;
}
However if you want them to be thicker, add the "subpixel-" in there in front of all of 'em except the -moz-osx one. Firefox's default antialiasing on OS X is super-thick and looks like poo poo.

kedo fucked around with this message at 15:29 on May 5, 2014

lufty
Jan 26, 2014

Lumpy posted:

Exhibit A: validateForm()
Exhibit B: validationForm()

These things need to be the same.


Also, never, ever, ever, ever, ever put a RESET button on your form. People only click on those by mistake, and then will hate you and your site when the form empties out instead of submitting.

http://jsfiddle.net/Us486/1/


Once you fix that, you'll find out that the form submits no matter what. Look into the form's onsubmit handler, as that's what you need to use to prevent it from submitting based on client side validation.

Why doesn't it recognise the fact that I've called the validateForm() function to check what is submitted?

edit:

solved it, looked through w3schools for examples of form validation, much thanks.

changed
HTML code:
<input type="submit" name="Submit" value="Submit" onclick="validateForm()"/>
to
HTML code:
<button type="button" onclick="validateForm()">Submit</button>

lufty fucked around with this message at 15:56 on May 5, 2014

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

lufty posted:

Why doesn't it recognise the fact that I've called the validateForm() function to check what is submitted?

If I understand you correctly: because you don't replace the default event handler, you just add another one in. So on 'onclick' it processes your custom code, but it never blocks the original code (the 'process the form' code).

You can add an 'event' parameter to the function definition and then first thing inside it hit 'event.preventDefault()'.

And then if everything is okay you call the 'submit' on the form at the end of the javascript function.

Reality
Sep 26, 2010

lufty posted:

Why doesn't it recognise the fact that I've called the validateForm() function to check what is submitted?

code:
<input type="submit" name="Submit" value="Submit" onclick="return validateForm()"/>
You forgot a "return" in your onclick

lufty
Jan 26, 2014

Sulla-Marius 88 posted:

If I understand you correctly: because you don't replace the default event handler, you just add another one in. So on 'onclick' it processes your custom code, but it never blocks the original code (the 'process the form' code).

You can add an 'event' parameter to the function definition and then first thing inside it hit 'event.preventDefault()'.

And then if everything is okay you call the 'submit' on the form at the end of the javascript function.

Reality posted:

code:
<input type="submit" name="Submit" value="Submit" onclick="return validateForm()"/>
You forgot a "return" in your onclick

solved, thanks anyway

edit:

wait now i can't submit anything

edit2:

after making a few changes i'm really close to giving up

http://jsfiddle.net/D9tG7/1/

lufty fucked around with this message at 16:50 on May 5, 2014

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

lufty posted:

solved, thanks anyway

edit:

wait now i can't submit anything

Because button is just a button, it has no tie to that form.

here:

http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml

e: Also w3schools is the worst website ever, from memory. For HTML/low-level javaascript stuff it might not be too bad because that's simple enough, but for PHP or anything else it's absolutely terrible, so be wary what you take from it.

Sulla Faex fucked around with this message at 16:49 on May 5, 2014

kedo
Nov 27, 2007

Sulla-Marius 88 posted:

e: Also w3schools is the worst website ever, from memory. For HTML/low-level javaascript stuff it might not be too bad because that's simple enough, but for PHP or anything else it's absolutely terrible, so be wary what you take from it.

Indeed. http://www.w3fools.com/

e: Sadly this page used to be way longer as it detailed dozens of places where w3schools was providing incorrect information, but it appears they removed it. Still, w3schools is pretty terrible.

kedo fucked around with this message at 17:01 on May 5, 2014

Suspicious Dish
Sep 24, 2011

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

kedo posted:

Indeed. http://www.w3fools.com/

e: Sadly this page used to be way longer as it detailed dozens of places where w3schools was providing incorrect information, but it appears they removed it. Still, w3schools is pretty terrible.

w3schools changed most of the quotes to equally bad information, and they got tired of maintaining it and answering emails about "oh hey is this correct now?"

Gmaz
Apr 3, 2011

New DLC for Aoe2 is out: Dynasties of India
https://developer.mozilla.org/en-US/

MDN is a much better place for documentation

supermikhail
Nov 17, 2012


"It's video games, Scully."
Video games?"
"He enlists the help of strangers to make his perfect video game. When he gets bored of an idea, he murders them and moves on to the next, learning nothing in the process."
"Hmm... interesting."

kedo posted:

Indeed. http://www.w3fools.com/

e: Sadly this page used to be way longer as it detailed dozens of places where w3schools was providing incorrect information, but it appears they removed it. Still, w3schools is pretty terrible.

Thank you, sir/madam. I haven't, in fact, noticed any bad information on w3schools myself, partly from being a newbie, partly because I use the site only when I need some really basic info or the handy web color picker. But I feel nice finally being pointed at good alternatives.

ruden
Dec 2, 2006
This thread might not be the most appropriate for my question, so apologies in advance if it isn't.

I've done a lot of software development but not much web development, and I'm working on a project on the side. It would involve an app and a partner website of pages generated by content from the app. What is the current architecture thinking for such a construction? I have been prototyping it out with Python Flask, with the intent to expose some API end points for the apps. Reading about Angular and other JavaScript frameworks seems to indicate the current designs revolve around basically having your input/output exposed as an API and using Angular to pull in content, rather than have the server render a page for way request. Basically having your server just serve as the model in MVC and instead of containing business logic, just collect or expose your data.

I see the reasoning behind this, as presumably spending more time on an API that is used for both the app sides of things and the web page cuts down on development costs, as well as making requests smaller and more efficient.

Am I on the right track with this? Does anyone have a good "web page/app backend design" tutorial/blog post to go through?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

ruden posted:

Reading about Angular and other JavaScript frameworks seems to indicate the current designs revolve around basically having your input/output exposed as an API and using Angular to pull in content, rather than have the server render a page for way request.

This is a reasonable and modern way to do it. Another reason for this is that your web page feels more responsive, native, and interactive to your end users.

Angular is great, but you might want to spend a bit of time comparing some alternatives. Right now I'm really liking React.

Adbot
ADBOT LOVES YOU

Lexicon
Jul 29, 2003

I had a beer with Stephen Harper once and now I like him.

kedo posted:

Try playing around with antialiasing styles. For example:

CSS code:
font-smoothing: antialiased;
vs.

CSS code:
font-smoothing: subpixel-antialiased;
will make a huge difference. Your first screenshot is subpixel-antialiased. If you zoom in you'll see colored pixels on the sides of the letters. The second is grayscale antialiased.

This is what I tend to use for all my projects because I find that subpixel-antialiasing makes fonts weightier than they should be:

CSS code:
*, *:after, *:before {
	-webkit-font-smoothing:antialiased;
	-moz-font-smoothing:antialiased;
	-moz-osx-font-smoothing: grayscale;
	-o-font-smoothing:antialiased;
	font-smoothing:antialiased;
}
However if you want them to be thicker, add the "subpixel-" in there in front of all of 'em except the -moz-osx one. Firefox's default antialiasing on OS X is super-thick and looks like poo poo.

Thank you so much! You've just opened up a Wonka-like world of wonder for me :)

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