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
Pollyanna
Mar 5, 2005

Milk's on them.


I have a GET method for my page that takes a comma separated list of stock symbols. I want to make an input form that a user can type symbols into and tacks on a comma separated list to the URL, e.g. ?symbols=AAPL,GOOG. Using just one text field for input means that the user has to type "AAPL,GOOG,IBM,GM" etc. which looks really ugly. I had thought of simply providing a whole bunch of text input fields to use, but that's too cumbersome and probably wouldn't work anyway. What sort of form should I use? Is there a way to do this in JQuery UI? I'm using Flask, for the record.

Adbot
ADBOT LOVES YOU

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Pollyanna posted:

I have a GET method for my page that takes a comma separated list of stock symbols. I want to make an input form that a user can type symbols into and tacks on a comma separated list to the URL, e.g. ?symbols=AAPL,GOOG. Using just one text field for input means that the user has to type "AAPL,GOOG,IBM,GM" etc. which looks really ugly. I had thought of simply providing a whole bunch of text input fields to use, but that's too cumbersome and probably wouldn't work anyway. What sort of form should I use? Is there a way to do this in JQuery UI? I'm using Flask, for the record.

Check out the "multi-value select boxes" in the Select2 jQuery plugin

Pollyanna
Mar 5, 2005

Milk's on them.


fletcher posted:

Check out the "multi-value select boxes" in the Select2 jQuery plugin

That wouldn't work, since the symbols are user-provided instead of being selected from a list.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Pollyanna posted:

That wouldn't work, since the symbols are user-provided instead of being selected from a list.

It can do remote data sets, and the list of valid values is known!

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
For things like this, I like having an autocomplete box that adds your selection to a list when you choose it. That list has an 'X' button on each item to remove it from the list. Go check out StackOverflow's method of adding tags to a post.

EDIT: I got bored, here's a barebones example of what I mean http://jsfiddle.net/DP7tN/1/

EDIT2: Doh, should have clicked the Select2 link. Yeah, basically that.

Bognar fucked around with this message at 05:56 on Jan 9, 2014

Pollyanna
Mar 5, 2005

Milk's on them.


Ohhh...yeah that works! Finding a list of symbols is a bit of a pain, though (since JS does not to my knowledge do regex/text parsing or anything).

Pollyanna fucked around with this message at 07:25 on Jan 9, 2014

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Pollyanna posted:

Ohhh...yeah that works! Finding a list of symbols is a bit of a pain, though (since JS does not to my knowledge do regex/text parsing or anything).

You can do regex and text parsing in JS. Check out the Auto Tokenization feature in the select2 demos. It only knows about red, green, and blue...but try adding some other colors! Once somebody looks up an unknown but valid ticker symbol, add it to your list of known symbols.

epswing
Nov 4, 2003

Soiled Meat
nm..

epswing fucked around with this message at 20:46 on Jan 9, 2014

EAT THE EGGS RICOLA
May 29, 2008

Pollyanna posted:

Ohhh...yeah that works! Finding a list of symbols is a bit of a pain, though (since JS does not to my knowledge do regex/text parsing or anything).

ftp://ftp.nasdaqtrader.com/SymbolDirectory/nasdaqlisted.txt
ftp://ftp.nasdaqtrader.com/SymbolDirectory/otherlisted.txt

Javascript does regular expressions, but you don't need one. Just split the string on | and use the first element.

jackpot
Aug 31, 2004

First cousin to the Black Rabbit himself. Such was Woundwort's monument...and perhaps it would not have displeased him.<

substitute posted:

sperglord warning

...the page isn't responsive past 768px. If you're on a "mobile" device (based on User Agent it seems), you're forwarded to mobile.nytimes.com/<the-article>.
God, that's amateur. What's funny is the page that talks about the redesign is really nice looking - it's just clear they didn't let that team work on the rest the actual site. Or like was said, they're the same guys but they gave them a horrible timeline or something.

pipes!
Jul 10, 2001
Nap Ghost

jackpot posted:

God, that's amateur. What's funny is the page that talks about the redesign is really nice looking - it's just clear they didn't let that team work on the rest the actual site. Or like was said, they're the same guys but they gave them a horrible timeline or something.

That's actually another good point, something I ran into: What do you do if your stuff is handed off to a development team who aren't executing designs with what you would consider best practice? I mean, they're nice, fast, and competent, but it's a lot of little things that are clearly the result of sticking to what works to get it out fast. Specifically, I've encountered stuff like the aforementioned lack of relative padded elements, spritesheets instead of SVG/icon fonts, etc.

I figure you can get about two, "Oh hey, I noticed" in before you look like a total rear end and sour any future working relationship.

glompix
Jan 19, 2004

propane grill-pilled

pipes! posted:

I figure you can get about two, "Oh hey, I noticed" in before you look like a total rear end and sour any future working relationship.

Okay that's the second time I've seen this comment in the last page of posts. What are the pitfalls of absolute padding? When has it bitten you? Why only padding and not margin, border, width, and other size elements?

I remember there being a big push towards away pixel-based measurements overall many years ago, but when I talked to CSS people at conferences lately concern seems to have waned. I've just been using pixels again lately since it seems to work just fine for my projects, but it'd be good to know when that's bad.

Kobayashi
Aug 13, 2004

by Nyc_Tattoo

pipes! posted:

That's actually another good point, something I ran into: What do you do if your stuff is handed off to a development team who aren't executing designs with what you would consider best practice? I mean, they're nice, fast, and competent, but it's a lot of little things that are clearly the result of sticking to what works to get it out fast. Specifically, I've encountered stuff like the aforementioned lack of relative padded elements, spritesheets instead of SVG/icon fonts, etc.

I figure you can get about two, "Oh hey, I noticed" in before you look like a total rear end and sour any future working relationship.

Speaking as a designer who's worked for such organizations, the answer is "nothing." I spent the first few years of my career trying to get large, dysfunctional organizations to do it the right way. The only thing that saved my sanity was leaving for companies that cared.

pipes!
Jul 10, 2001
Nap Ghost

glompix posted:

Okay that's the second time I've seen this comment in the last page of posts. What are the pitfalls of absolute padding? When has it bitten you? Why only padding and not margin, border, width, and other size elements?

I remember there being a big push towards away pixel-based measurements overall many years ago, but when I talked to CSS people at conferences lately concern seems to have waned. I've just been using pixels again lately since it seems to work just fine for my projects, but it'd be good to know when that's bad.

I find it to be a lot better of an approach for responsive sites and a SASS-based workflow (especially if you base everything on a handfull of core measurements), and it's also far, far better from an accessibility standpoint if the user resizes the screen. Try hitting CMD+ three or four times on this page versus this page.

e: Ooh, it looks like NYT pages are scaling nicely now.


Kobayashi posted:

Speaking as a designer who's worked for such organizations, the answer is "nothing." I spent the first few years of my career trying to get large, dysfunctional organizations to do it the right way. The only thing that saved my sanity was leaving for companies that cared.

Crap.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
What's wrong with just using icons? Spritesheets are a terrible hack to deal with the fact that HTTP has poo poo support for parallel downloads, which is fixed by SPDY/HTTP2. Spritesheets use more memory and are more expensive to decode.

kedo
Nov 27, 2007

e: Wait, I think you might be agreeing with me, rereading your post? Well, here are my thoughts on icon fonts anyways because I already typed it.

Nothing. But icon fonts are so much easier to use because when you're like, "Hmm, I wonder what that icon would look like in blue instead of black..."

CSS code:
.the-thing {
 color: blue;
}
And you have a blue icon, as opposed to opening Photoshop, changing colors, updating your sprite sheet, etc. That's not even to mention CSS3 stuff.

e: Also not to mention the fact that your icons can take the place of words which solves for screen readers and whatnot. Honestly you don't have to use icon fonts, but if you have a monotone icon set and you're not, you're handicapping yourself and creating more work.

kedo fucked around with this message at 02:09 on Jan 10, 2014

Pollyanna
Mar 5, 2005

Milk's on them.


Wait, what are icons in this context? I only know of the ones on my desktop. Is that another way of saying symbols (e.g. Wingdings)?

Ghostlight
Sep 25, 2009

maybe for one second you can pause; try to step into another person's perspective, and understand that a watermelon is cursing me



Yes. The icons you're thinking of are just graphical symbols being used on your desktop to navigate to programs in much the same way you might use Wingdings arrow characters on a webpage to navigate pages - which is why the overlap in terminology.

Essentially it's just a stock or even custom font that you serve up with the webpage and then pull symbols out of it rather than individually link to an image of that symbol or use CSS to position an image of every symbol so that only one is visible.

cbirdsong
Sep 8, 2004

Commodore of the Apocalypso
Lipstick Apathy
I've generally enjoyed using Font Awesome, which covers a lot of bases: http://fortawesome.github.io/Font-Awesome/

This is a pretty good icon font generator, if you have vector files to build a custom one with: http://icomoon.io/app/

Mister Chief
Jun 6, 2011

What do you guys think of this scanline effect? I want to use it on my hero graphics but wanted to check with some people who know more about design to see if they think it looks like poo poo.

Link to image.

EDIT: timg makes it look like poo poo so click to view the full sized image.

Mister Chief fucked around with this message at 04:08 on Jan 10, 2014

Heskie
Aug 10, 2002

pipes! posted:

I find it to be a lot better of an approach for responsive sites and a SASS-based workflow (especially if you base everything on a handfull of core measurements), and it's also far, far better from an accessibility standpoint if the user resizes the screen. Try hitting CMD+ three or four times on this page versus this page.

They both scale the same for me? :shrug:

I just use whichever the design dictates. For example, a recent project's designer insisted the page wrapper should always be 50px from the edge of the window even while scaling.

I think as long as the design scales and works as intended at any width then there's no problem. I don't think pixels should be shunned entirely as they serve their own purpose.

e: vvv and that

Heskie fucked around with this message at 14:30 on Jan 10, 2014

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

pipes! posted:

I find it to be a lot better of an approach for responsive sites and a SASS-based workflow (especially if you base everything on a handfull of core measurements), and it's also far, far better from an accessibility standpoint if the user resizes the screen. Try hitting CMD+ three or four times on this page versus this page.

e: Ooh, it looks like NYT pages are scaling nicely now.


Crap.

All (modern, including IE8 I think) browsers scale up *everything*, not just type like they used to, so using px no longer breaks things. Using px for most "measurement" things again now is perfectly fine.

kedo
Nov 27, 2007

Whoa, my mind is getting blown over here.

Do Chrome and Sublime somehow share their Find function? Example: I'm searching for "name": "Foo" in Sublime to find an entry in a database, and searching for Foo in Chrome to make sure it's showing up on a page. But when I change one, it changes the other.

What is going on... :psyduck: Are my keystrokes getting passed to both applications somehow?

e: Should mention I'm on OS X.

kedo fucked around with this message at 21:20 on Jan 10, 2014

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

kedo posted:

Whoa, my mind is getting blown over here.

Do Chrome and Sublime somehow share their Find function? Example: I'm searching for "name": "Foo" in Sublime to find an entry in a database, and searching for Foo in Chrome to make sure it's showing up on a page. But when I change one, it changes the other.

What is going on... :psyduck: Are my keystrokes getting passed to both applications somehow?

Never seen anything like that, tried it on my machine and I was not able to repro.

Windows 7 64-bit, Sublime Text 2.0.2 Build 2221, Chrome 32.0.1700.72

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

kedo posted:

Whoa, my mind is getting blown over here.

Do Chrome and Sublime somehow share their Find function? Example: I'm searching for "name": "Foo" in Sublime to find an entry in a database, and searching for Foo in Chrome to make sure it's showing up on a page. But when I change one, it changes the other.

What is going on... :psyduck: Are my keystrokes getting passed to both applications somehow?

e: Should mention I'm on OS X.

OS X does that for apps that hook into the "native" search stuff (Cmd-E / Cmd-F / Cmd-G) I believe, so there's cross-app searching going on in quite a few. I can select text in one app, hit Cmd-E, then hit Ctrl-G in others to find it. It's pretty awesome.

Suspicious Dish
Sep 24, 2011

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

Mister Chief posted:

What do you guys think of this scanline effect? I want to use it on my hero graphics but wanted to check with some people who know more about design to see if they think it looks like poo poo.

Link to image.

EDIT: timg makes it look like poo poo so click to view the full sized image.

Uh, it's an effect. Can you show us how it looks in context with the rest of the site? It's an effect that can look really bad or really good depending on how the rest of the environment around it looks.

Mister Chief
Jun 6, 2011

Yeah, I'll flesh the site out a little more then post a follow up.

Pollyanna
Mar 5, 2005

Milk's on them.


I've got a form for submitting search terms on my web page. Should I use GET or POST to submit the search terms?

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Pollyanna posted:

I've got a form for submitting search terms on my web page. Should I use GET or POST to submit the search terms?

For this you would use a GET (just like Google does). In general, POST is for things that are going to modify data and GET is for things that are just retrieving data.

Pollyanna
Mar 5, 2005

Milk's on them.


fletcher posted:

For this you would use a GET (just like Google does). In general, POST is for things that are going to modify data and GET is for things that are just retrieving data.

That's what I figured. But the URL looks bit funky (/stocks?symbol=IBM%2CGOOG%2CAAPL). Not a big deal to me, but is that discouraged?

obstipator
Nov 8, 2009

by FactsAreUseless
It's fine like that. No one will care. It's just so people can link the same search to other people.

glompix
Jan 19, 2004

propane grill-pilled

Pollyanna posted:

That's what I figured. But the URL looks bit funky (/stocks?symbol=IBM%2CGOOG%2CAAPL). Not a big deal to me, but is that discouraged?

You could always use a URL rewriter or routing module or something to make urls that look like /stocks/IBM-GOOG-AAPL if you wanted instead of using a query string. Dashes don't normally get escaped so it'd appear nice.

Pollyanna
Mar 5, 2005

Milk's on them.


I think Flask has URL rewriting functionality, although I thought I was already using it...

In the meantime, something really weird is happening with my application. On my machine, when I start it up locally, symbol lookup works perfectly well, but once it's uploaded to Heroku it breaks. It manages to find data for the symbol, builds the plots and everything...and then somehow gets caught in the except IOError block, which is intended to check if the symbol actually exists (which it already has decided it does). Again, this doesn't occur on my end.

Heroku logs:

code:
2014-01-12T01:15:03.523599+00:00 app[web.1]: testing for length of symbol array...
2014-01-12T01:15:03.523599+00:00 app[web.1]: building plots...
2014-01-12T01:15:03.523599+00:00 app[web.1]: building data...
2014-01-12T01:15:03.906400+00:00 app[web.1]: generating data...
2014-01-12T01:15:03.907480+00:00 app[web.1]: building RSI plot...
2014-01-12T01:15:03.912245+00:00 app[web.1]: building main plot...
2014-01-12T01:15:03.917500+00:00 app[web.1]: building MACD plot...
2014-01-12T01:15:03.920634+00:00 app[web.1]: building grid...
2014-01-12T01:15:04.059954+00:00 app[web.1]: symbol AAPL not found
2014-01-12T01:15:04.060210+00:00 app[web.1]: rendering template...
2014-01-12T01:15:04.286963+00:00 heroku[router]: at=info method=GET path=/static/css/continuum.css host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=1ms service=4ms status=304 bytes=0
2014-01-12T01:15:04.291105+00:00 heroku[router]: at=info method=GET path=/static/css/main.css host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=1ms service=4ms status=304 bytes=0
2014-01-12T01:15:04.317026+00:00 heroku[router]: at=info method=GET path=/static/css/bootstrap-bokeh-2.0.4.css host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=3ms service=6ms status=304 bytes=0
2014-01-12T01:15:04.371741+00:00 heroku[router]: at=info method=GET path=/static/css/unsemantic.css host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=2ms service=8ms status=304 bytes=0
2014-01-12T01:15:04.063374+00:00 heroku[router]: at=info method=GET path=/stocks?symbol=AAPL host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=1ms service=544ms status=200 bytes=1593
2014-01-12T01:15:04.361605+00:00 heroku[router]: at=info method=GET path=/static/css/normalize.css host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=1ms service=4ms status=304 bytes=0
2014-01-12T01:15:04.300987+00:00 heroku[router]: at=info method=GET path=/static/js/bokeh.js host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=1ms service=5ms status=304 bytes=0
2014-01-12T01:15:04.290875+00:00 heroku[router]: at=info method=GET path=/static/css/bokeh.css host=rpazyaquian.herokuapp.com fwd="69.180.75.108" dyno=web.1 connect=1ms service=8ms status=304 bytes=0
The same request in Flask executes correctly:

code:
testing for length of symbol array...
building plots...
building data...
generating data...
building RSI plot...
building main plot...
building MACD plot...
building grid...
AAPL SMA signal says:
WAIT
AAPL Bollinger breakout signal says:
WAIT
AAPL RSI signal says:
WAIT
rendering template...
127.0.0.1 - - [11/Jan/2014 20:21:11] "GET /stocks?symbol=AAPL HTTP/1.1" 200 -
127.0.0.1 - - [11/Jan/2014 20:21:11] "GET /static/js/temp/020b6dc1-534e-43e2-bc02-ce48cbaeb062.embed.js HTTP/1.1" 200 -
Any idea what in the world could cause this?

edit: I just realized that sometimes the instructions are out of order:

code:
2014-01-12T16:28:49.984697+00:00 app[web.1]: testing for length of symbol array...
2014-01-12T16:28:49.984697+00:00 app[web.1]: building plots...
2014-01-12T16:28:49.984697+00:00 app[web.1]: building data...
2014-01-12T16:28:50.806213+00:00 app[web.1]: building RSI plot...
2014-01-12T16:28:50.804333+00:00 app[web.1]: generating data...
2014-01-12T16:28:50.812338+00:00 app[web.1]: building main plot...
2014-01-12T16:28:50.821330+00:00 app[web.1]: building MACD plot...
2014-01-12T16:28:50.826345+00:00 app[web.1]: building grid...
2014-01-12T16:28:50.826657+00:00 app[web.1]: building snippet...
2014-01-12T16:28:50.971948+00:00 app[web.1]: rendering template...
2014-01-12T16:28:50.971948+00:00 app[web.1]: symbol AAPL not found
Now I'm even more confused. :(

Pollyanna fucked around with this message at 17:30 on Jan 12, 2014

DreadCthulhu
Sep 17, 2008

What the fuck is up, Denny's?!
Can anyone confirm for me that there's no reliable way of making a last minute ajax request in window.onunload? I've yet to be able to pull this off in Chrome, even with async: false. It works in window.onbeforeunload, except I don't want to make that request if the user decides NOT no navigate away, and as far as I can tell browsers don't notify you of the user's choice in that alert box outside of window.onunload being called. SO seems to vaguely confirm this as well, but you never know.

Ethereal
Mar 8, 2003

DreadCthulhu posted:

Can anyone confirm for me that there's no reliable way of making a last minute ajax request in window.onunload? I've yet to be able to pull this off in Chrome, even with async: false. It works in window.onbeforeunload, except I don't want to make that request if the user decides NOT no navigate away, and as far as I can tell browsers don't notify you of the user's choice in that alert box outside of window.onunload being called. SO seems to vaguely confirm this as well, but you never know.

What are you trying to send? I'm not sure why it doesn't work with async: false. Could you use a 1x1 tracking pixel instead?

Suspicious Dish
Sep 24, 2011

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

DreadCthulhu posted:

Can anyone confirm for me that there's no reliable way of making a last minute ajax request in window.onunload? I've yet to be able to pull this off in Chrome, even with async: false. It works in window.onbeforeunload, except I don't want to make that request if the user decides NOT no navigate away, and as far as I can tell browsers don't notify you of the user's choice in that alert box outside of window.onunload being called. SO seems to vaguely confirm this as well, but you never know.

The user is trying to kill your website. You have no guarantees of any code being ran.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

kedo posted:

Whoa, my mind is getting blown over here.

Do Chrome and Sublime somehow share their Find function? Example: I'm searching for "name": "Foo" in Sublime to find an entry in a database, and searching for Foo in Chrome to make sure it's showing up on a page. But when I change one, it changes the other.

What is going on... :psyduck: Are my keystrokes getting passed to both applications somehow?

e: Should mention I'm on OS X.

To expand on Lumpy's reply, OS X has the concept of "pasteboards". When you copy something, it goes on the system's general pasteboard, which other apps can see. When you paste, the app you're in grabs the contents of the general pasteboard. Thus you can copy and paste between apps.

There is also a system-wide find pasteboard that, you guessed it, contains the string you're searching for. Well-made apps will use the system's find pasteboard for their own search function. Sometimes it's mind-blowingly cool, other times I really do want to maintain two different ongoing searches goddammit.

Oh My Science
Dec 29, 2008
It's my first time dealing with a subdomain like this:

this.is.a.subdomain.mainsite.com

Are there any negative consequences to setting something up like this?

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb

Oh My Science posted:

It's my first time dealing with a subdomain like this:

this.is.a.subdomain.mainsite.com

Are there any negative consequences to setting something up like this?

If you use a wildcard SSL cert I think it will only match *.mainsite.com, not whatever.*.mainsite.com

edit: whoops had subdomain.com instead of mainsite.com

fletcher fucked around with this message at 00:28 on Jan 14, 2014

Adbot
ADBOT LOVES YOU

EAT THE EGGS RICOLA
May 29, 2008

fletcher posted:

If you use a wildcard SSL cert I think it will only match *.mainsite.com, not whatever.*.subdomain.com

You're right

quote:

Matching is performed using the matching rules specified by
[RFC2459]. If more than one identity of a given type is present in
the certificate (e.g., more than one dNSName name, a match in any one
of the set is considered acceptable.) Names may contain the wildcard
character * which is considered to match any single domain name
component or component fragment. E.g., *.a.com matches foo.a.com but
not bar.foo.a.com. f*.com matches foo.com but not bar.com.

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