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
Tei
Feb 19, 2011
Probation
Can't post for 4 days!
Edge user agent.

"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"

Hello,

I am Mozilla, I am also AppleWebKit, I am based on KHTML (that is a browser like Gecko), I am Google Chrome, I am Apple Safari. I am also Edge.

Trust me here.

Adbot
ADBOT LOVES YOU

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Tei posted:

Edge user agent.

"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"

Hello,

I am Mozilla, I am also AppleWebKit, I am based on KHTML (that is a browser like Gecko), I am Google Chrome, I am Apple Safari. I am also Edge.

Trust me here.

They should have just used "*" to future proof it.

NewForumSoftware
Oct 8, 2016

by Lowtax
I wonder when the last reasonable user-agent existed in a consumer browser

The Fool
Oct 16, 2003


NewForumSoftware posted:

I wonder when the last reasonable user-agent existed in a consumer browser

NCSA Mosiac: CSA_Mosaic/2.0 (Windows 3.1)
Netscape 1.0: Mozilla/1.0 (Win3.1)

Everything after that was bad.

A brief history: http://webaim.org/blog/user-agent-string-history/

NewForumSoftware
Oct 8, 2016

by Lowtax
as usual internet explorer hosed that poo poo up asap

Munkeymon
Aug 14, 2003

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



Tei posted:

Edge user agent.

"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"

Hello,

I am Mozilla, I am also AppleWebKit, I am based on KHTML (that is a browser like Gecko), I am Google Chrome, I am Apple Safari. I am also Edge.

Trust me here.

It's just a cross-comparability list, but without any sane delimiter. Not the worst thing ever except for the systems out there that you know have basically white lists of user agent strings.

Tei
Feb 19, 2011
Probation
Can't post for 4 days!
Maybe the JQuery team where in the right to disable browser inspection, and push people to feature detection.

Like if feature detection where not another place with eldritch horrors from a exterior dimension ready to devour the sanity of developers.

spiritual bypass
Feb 19, 2008

Grimey Drawer
I think they were right overall, but I've also encountered browser-specific bugs that weren't detectable by feature inspection. Identifying trouble user agents is the only way around in that case. Or you could do the reasonable thing and say gently caress everyone who chooses to use a broken browser.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop
Quickie Q for pointers in the right documentation direction:

I've got a Django website running and I'm migrating from server-side templates to AJAX endpoints and more API-driven content.

How do I test the APIs? I can unit test the python code, but I'd like to put regression tests that point at the staging webserver. Not Selenium, the UI is under heavy development and it's someone else's responsibility anyway.

I'm probably just googling the wrong type of testing. I see lots of "use jsfiddler to test your API" but that's not automated.

Thermopyle
Jul 1, 2003

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

Just use the request module to make requests to your api.

Assuming your testing with python of course, but whatever language you're using can make requests and then you make assertions on the responses.

Data Graham
Dec 28, 2009

📈📊🍪😋



That's one of the biggest reasons for moving to API-driven content, imo. Nobody wants to parse HTML snippets, but json is life json is love.

FAGGY CLAUSE
Apr 9, 2011

by FactsAreUseless
So I've been picking up Django pretty well. Basically I have a set of data assumptions / levers / filters I'm letting users modify or insert. The next piece is I need to start creating a lot of time series data with these inputs. Since I've already done the calculations in a jupyter notebook with pandas, I was thinking of just reusing that code, and then looping through each row and inserting using Django's ORM, rather than try to save data directly to the database with pandas. Is this the best way to approach something like this? It's not going to be an astronomical amount of data or anything. I guess the alternative would be to not insert the created data into the database, but do all the calculations in JS or something in the browser.

Dominoes
Sep 20, 2007

Example code? I'm having trouble following.

Whether you use server-side or client-side code depends on what you're doing; if it needs to be fast and responsive, you may need client side. Otherwise, server-side sounds better for your use: You can code in a nicer language, with Pandas and your existing code.

Dominoes fucked around with this message at 19:36 on May 13, 2017

FAGGY CLAUSE
Apr 9, 2011

by FactsAreUseless
Most of them are simple inputs. Say for example a monthly cost, representing a lease, or perhaps the cost of implementing a piece of technology, or whatever, and the impacted dates. There's some organizational stuff, but most of it's no more complicated than that. Then I'm just visually organizing these different assumptions in a tree, which I've completed. So hidden to the user I'll probably create approximately 150 time series on a monthly basis over 10 years. Then just create some reports and dashboards with that.

Was just wondering if there was something I hadn't thought of, or making this more complicated. I don't think I could easily do this in just django's ORM. Maybe that's my best bet (django pandas) and just bulk create or bulk insert after I've created my data.

Thermopyle
Jul 1, 2003

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

FAGGY CLAUSE posted:

So I've been picking up Django pretty well. Basically I have a set of data assumptions / levers / filters I'm letting users modify or insert. The next piece is I need to start creating a lot of time series data with these inputs. Since I've already done the calculations in a jupyter notebook with pandas, I was thinking of just reusing that code, and then looping through each row and inserting using Django's ORM, rather than try to save data directly to the database with pandas. Is this the best way to approach something like this? It's not going to be an astronomical amount of data or anything. I guess the alternative would be to not insert the created data into the database, but do all the calculations in JS or something in the browser.

FWIW, there's a Django thread.

It's really hard to answer your question no matter which thread you ask in as it's just too general.

Dominoes
Sep 20, 2007

Tangental: Found This page on storing DataFrames in a SQL-based DB. Can't tell how it works from the page; implies a tie-in with SQLAlchemy.

How would you go about storing a data frame? Have a DB row for each row, with a Postgres JSONfield containing a list of values for each col? And separate entries defining the indexes and column datatypes, names etc?

It looks like there may be ways to integrate HDF5 into a website DB. The relational SQL DBs most websites use don't feel appropriate for dataframes and n-dimensional arrays.

Dominoes fucked around with this message at 21:37 on May 13, 2017

Thermopyle
Jul 1, 2003

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

There's nothing stopping you from querying whatever kind of database or service you want from your views and I think that's pretty common. Some types of data just aren't appropriate for RDBS.

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun

Dominoes posted:

Tangental: Found This page on storing DataFrames in a SQL-based DB. Can't tell how it works from the page; implies a tie-in with SQLAlchemy.

How would you go about storing a data frame? Have a DB row for each row, with a Postgres JSONfield containing a list of values for each col? And separate entries defining the indexes and column datatypes, names etc?

It looks like there may be ways to integrate HDF5 into a website DB. The relational SQL DBs most websites use don't feel appropriate for dataframes and n-dimensional arrays.
I usually pick whatever's a good database for my data (I've used Elasticsearch and Cassandra, but DynamoDB or Postgres are good choices too), construct the desired data model, and use that to feed Pandas. So I write queries to get data into Pandas, from whatever database I'm using, do my data operations, and then send the result to a view (the .to_json() method is really good here, as is the to_dict() method).

One protip: caching here is your friend, Pandas can be extremely memory intensive and can bring once-mighty servers to their knees. Don't use Memcache, the 1MB max value size is restrictive.

I love Postgres but it's not necessarily the best tool for every job, though if your needs tend towards time series data take a look at this, since it's a really cool solution I want to play with.

EDIT: If you're restricted to Postgres, I'd probably work out how you build your dataframe from multiple 2-dimensional tables, create tables for them, and then write queries to get whatever you need from them, and build the dataframe from that. If you want to store a dataframe whose contents only need to be updated occasionally (i.e., not in real-time), find the best way to store your various data sets and then use a cron job or something to rebuild the dataframe at your specified interval and cache it. Hell, you can pickle it, ship it to your server, and bypass any database if that fits your needs. But I would focus not on storing your dataframe as-is, and more on how to store the data you construct it from, and how to reconstruct it efficiently from a database.

Ghost of Reagan Past fucked around with this message at 00:47 on May 14, 2017

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

Thermopyle posted:

Just use the request module to make requests to your api.

Assuming your testing with python of course, but whatever language you're using can make requests and then you make assertions on the responses.

Ok, so everyone's open-coding the tests, that works too. I figured with how important APIs are there'd have been some sort of testing framework for them by now.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

100 degrees Calcium posted:

I spoke with the senior developer. I let her know that after some consideration and research, I think I can save time by doing some mock ups now and iterating them with the users. She's skeptical that the users can respond to anything short of a fully functioning application, but agrees that wireframing each slice before I start, while considering future workflow, would be beneficial for preventing gently caress-ups. It's not really much of a blessing since there was nothing preventing me from wireframing each task beforehand already.

That being said, I'm glad my attention was brought to this. I have a bit of surplus work time today to work on application planning, so I'm trying to wireframe as much of the workflow as I can, starting with the item that will be due next. I'm using Visio to put something together and it's already apparent to me how much better and quicker the resulting work will be than if I had simply attempted to brainstorm it in code. It also gives me a lot more confidence to have a plan for how the application workflow, previously only defined in user stories, will actually operate visually. The junior developer, and the rest of the web development world, was totally right; it's way better to brainstorm this stuff in a lo-fi way.

God, thinking about how much better it could be if I had time to perform some user iteration kind of galls me now, though.

I just wanted to say you're doing the best you can in what seems to be an under-resourced project. You're right that mockups etc are important but that stuff is usually handled by some kind of UX designer, so it's not crazy that you would have not fully appreciated the usefulness - it's just not your area. That said, as you seem to be well aware, in small teams the dev frequently has to wear many hats. You're doing just fine, is what I'm trying to say.

Dr. Poz
Sep 8, 2003

Dr. Poz just diagnosed you with a serious case of being a pussy. Now get back out there and hit them till you can't remember your kid's name.

Pillbug
Having a cross browser layout issue and I've boiled it down this far but can't quite figure it out. Works fine in Chrome but not Firefox. It's a flexbox container with two panels. The container should stretch to fill its parent and the panels should stretch to fill the container. The panels will contain content that will cause them to become scrollable. In Firefox, the title doesn't seem to be factored into the calculation for the containers height though, causing it to be pushed down and the entire page to overflow.

Ideally, Firefox would render the same as Chrome. What am I missing?

code:
<html>
	<head>
		<style>
			html, body {
				margin: 0;
				padding: 0;
			}
						
			#main {
				display: flex;
				flex-flow: column;
				flex: 1 0 auto;
				height: 100%;
			}
			
			#container {
				display: flex;
				flex: 1 1 auto;
				height: 100%;
			}
			
			.panel {
				flex: 1 1 auto;
				overflow: auto;
			}
		</style>
	</head>
	<body>
		<div id="main">
			<h3>title</h3>
			<div id="container">
				<div class="panel">
					panel#1
					<ul id="list0">
					</ul>
				</div>
				<div class="panel">
					panel#2
					<ul id="list1">
					</ul>
				</div>
			</div>
		</div>
		
		<script>
			function createNode() {
				let li = document.createElement('li');
				li.appendChild(document.createTextNode('#'));				
				return li;
			}
			
			for (let listNum = 0; listNum < 2; listNum++) {
				for (let i = 0; i < 150; i++) {
					const list = document.getElementById('list' + listNum);
					list.appendChild(createNode());
				}
			}
			

		</script>
	</body>
</html>

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dr. Poz posted:

Having a cross browser layout issue and I've boiled it down this far but can't quite figure it out. Works fine in Chrome but not Firefox. It's a flexbox container with two panels. The container should stretch to fill its parent and the panels should stretch to fill the container. The panels will contain content that will cause them to become scrollable. In Firefox, the title doesn't seem to be factored into the calculation for the containers height though, causing it to be pushed down and the entire page to overflow.

Ideally, Firefox would render the same as Chrome. What am I missing?


Phone post, so no code, but it's probably padding adding to the heights of all your elements plus the two 100% heights stacking so your inner thing wants to be as high as the document so the title would make it taller.

You probably want to use box sizing to include padding in your calculations for height, and then more importantly, not use 100% height. Make the body 100vh tall then make #conainter flex 1 so it fills all space not taken by the header.

I'll do up,an example tomorrow at work if nobody beats me to it by then.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Dr. Poz posted:

Having a cross browser layout issue and I've boiled it down this far but can't quite figure it out. Works fine in Chrome but not Firefox. It's a flexbox container with two panels. The container should stretch to fill its parent and the panels should stretch to fill the container. The panels will contain content that will cause them to become scrollable. In Firefox, the title doesn't seem to be factored into the calculation for the containers height though, causing it to be pushed down and the entire page to overflow.

Ideally, Firefox would render the same as Chrome. What am I missing?

code:
<html>
	<head>
		<style>
			html, body {
				margin: 0;
				padding: 0;
			}
						
			#main {
				display: flex;
				flex-flow: column;
				flex: 1 0 auto;
				height: 100%;
			}
			
			#container {
				display: flex;
				flex: 1 1 auto;
				height: 100%;
			}
			
			.panel {
				flex: 1 1 auto;
				overflow: auto;
			}
		</style>
	</head>
	<body>
		<div id="main">
			<h3>title</h3>
			<div id="container">
				<div class="panel">
					panel#1
					<ul id="list0">
					</ul>
				</div>
				<div class="panel">
					panel#2
					<ul id="list1">
					</ul>
				</div>
			</div>
		</div>
		
		<script>
			function createNode() {
				let li = document.createElement('li');
				li.appendChild(document.createTextNode('#'));				
				return li;
			}
			
			for (let listNum = 0; listNum < 2; listNum++) {
				for (let i = 0; i < 150; i++) {
					const list = document.getElementById('list' + listNum);
					list.appendChild(createNode());
				}
			}
			

		</script>
	</body>
</html>

I tried pasting this into JSFiddle (using Chrome) and both columns just stretch vertically to suit the content. Am I missing something? I noticed that I could replicate the behaviour you're after by changing #main to have a height of "100vh", is that what you want?

putin is a cunt fucked around with this message at 02:17 on May 15, 2017

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

a hot gujju bhabhi posted:

I tried pasting this into JSFiddle (using Chrome) and both columns just stretch vertically to suit the content. Am I missing something?

The part where he said it worked fine in Chrome but not FireFox?

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Lumpy posted:

The part where he said it worked fine in Chrome but not FireFox?

I saw that part, that's why I'm confused that after trying it in Chrome it didn't work fine at all, smart rear end.

(I think it's a JSFiddle thing).

Dr. Poz
Sep 8, 2003

Dr. Poz just diagnosed you with a serious case of being a pussy. Now get back out there and hit them till you can't remember your kid's name.

Pillbug
I originally set it up in a codepen but it didn't render correctly in the preview, so it's something to do with the way they handle it. I had to run it in the browsers to properly replicate.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION
Adding overflow-y: hidden; to #container solved it for me in Chrome and Firefox.

(I'm not going to pretend I fully understand why).

putin is a cunt fucked around with this message at 02:33 on May 15, 2017

Dr. Poz
Sep 8, 2003

Dr. Poz just diagnosed you with a serious case of being a pussy. Now get back out there and hit them till you can't remember your kid's name.

Pillbug

a hot gujju bhabhi posted:

Adding overflow-y: hidden; to #container solved it for me in Chrome and Firefox.

(I'm not going to pretend I fully understand why).

Neither will I but I'll take it! I tinkered around trying to implement Lumpys suggestions but couldn't get any play. Thanks a hot gujju bhabhi and Lumpy.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

Dr. Poz posted:

Neither will I but I'll take it! I tinkered around trying to implement Lumpys suggestions but couldn't get any play. Thanks a hot gujju bhabhi and Lumpy.

No problem! By the way I think Lumpy's suggestion to make #main 100vh high instead of 100% is on point. So probably do that also.

Dr. Poz
Sep 8, 2003

Dr. Poz just diagnosed you with a serious case of being a pussy. Now get back out there and hit them till you can't remember your kid's name.

Pillbug
I actually do have body height: 100vh in my real project. And I'd still really like to see whatever solution you had in mind Lumpy.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dr. Poz posted:

I actually do have body height: 100vh in my real project. And I'd still really like to see whatever solution you had in mind Lumpy.


https://jsfiddle.net/veddermatic/hzt5jL1o/1/


Works in my FF and Chrome. Basically what you came upon: you have to get the "content holder" to determine it's height, which it won't do my default as a flexbox in FireFox. I slap an overflow hidden on the content wrapper to do so. It's one of those "technically it's not a bug since it follows the spec but it would be nice" things.

Thermopyle
Jul 1, 2003

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

I'm not a designer or really even much of a design-implementer-sorta-guy (just not something I enjoy). Because of this I use Bootstrap for MVP's until we decide its worth it to bring on someone who does have some skills in this area.

I'm just kind of tired of Bootstrap. Anyone have anything else they like to use? Particularly interested in feedback from people who have used multiple CSS frameworks...

Giga Gaia
May 2, 2006

360 kickflip to... Meteo?!

Thermopyle posted:

I'm not a designer or really even much of a design-implementer-sorta-guy (just not something I enjoy). Because of this I use Bootstrap for MVP's until we decide its worth it to bring on someone who does have some skills in this area.

I'm just kind of tired of Bootstrap. Anyone have anything else they like to use? Particularly interested in feedback from people who have used multiple CSS frameworks...

Material Design Lite is kind of fun. I've enjoyed it more than Bootstrap or Foundation (older versions).

https://getmdl.io/

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself

Thermopyle posted:

I'm not a designer or really even much of a design-implementer-sorta-guy (just not something I enjoy). Because of this I use Bootstrap for MVP's until we decide its worth it to bring on someone who does have some skills in this area.

I'm just kind of tired of Bootstrap. Anyone have anything else they like to use? Particularly interested in feedback from people who have used multiple CSS frameworks...

I've looked at this a little, but it seems awesome

http://materializecss.com/

Kekekela
Oct 28, 2004

Thermopyle posted:

I'm not a designer or really even much of a design-implementer-sorta-guy (just not something I enjoy). Because of this I use Bootstrap for MVP's until we decide its worth it to bring on someone who does have some skills in this area.

I'm just kind of tired of Bootstrap. Anyone have anything else they like to use? Particularly interested in feedback from people who have used multiple CSS frameworks...

I use skeleton sometimes but I'm kind of in the same boat of wanting something new, and the css/making-things-look-nice part of the job is the part that I hate and am bad at.

I actually just started a toy project using skeleton because my five minutes of googling didn't turn up anything more compelling to met than that or bootstrap.

The Fool
Oct 16, 2003


https://semantic-ui.com/ is a thing that I plan on trying in my next personal project.

Thermopyle
Jul 1, 2003

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

The Fool posted:

https://semantic-ui.com/ is a thing that I plan on trying in my next personal project.

Oh, I like the looks of this one.

porksmash
Sep 30, 2008
If I've got a REST API with nested resources, but don't want to include the actual child resource objects, would it be better to provide a list of IDs or a list of resource URLs to retrieve the child resource objects? I'm leaning towards URLs as it will be easy to denormalize data client-side by deconstructing the URL - strip out the base API URL and you're left with <object_type>/<id>. The client doesn't need to know what endpoint corresponds to what list of random numbers. I don't see any downsides actually, but I frequently overlook things until I run into them later.

Example payloads of 'People':
code:
{
    'name': John,
    'children': [4, 9, 12],
    'spouse': 3
}
- or -

code:
{
    'name': John,
    'children': [
        'https://the/api/url/people/4',
        'https://the/api/url/people/9',
        'https://the/api/url/people/12'
    ]
    'spouse': 'https://the/api/url/people/3',
}

ROFLburger
Jan 12, 2006

I think the former is almost alway preferable. To memory, I can't think of an instance where I'd ever preferred addresses

Adbot
ADBOT LOVES YOU

100 degrees Calcium
Jan 23, 2011



a hot gujju bhabhi posted:

I just wanted to say you're doing the best you can in what seems to be an under-resourced project. You're right that mockups etc are important but that stuff is usually handled by some kind of UX designer, so it's not crazy that you would have not fully appreciated the usefulness - it's just not your area. That said, as you seem to be well aware, in small teams the dev frequently has to wear many hats. You're doing just fine, is what I'm trying to say.

Yo, I appreciate this. I guess I let it out that I was feeling like I was majorly cocking this up way early, but yeah at this point I'm just trying to stay as dynamic and forward-thinking as I can. I've already made some moderately expensive mistakes, but I've been given another developer as a resource and he and I working pretty closely to handle each problem as expertly as we can.

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