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.


-JS- posted:

Not sure what's going on without seeing code - but it seems to be possible after a bit of hacking on the example given by Google - https://jsfiddle.net/5psoshgn/1/

I'm not sure what changed here compared to the typical code. I understand that whether or not a polygon makes a hole depends on the clockwise direction of the polygon's points, but that looks like those polygons are still in opposite directions...I'm a little confused.

For background, this is for a programming exercise where I'm given a CSV of polygons and their associated points, and asked to expose them so that a pre-made Google Maps API can draw them. I'm beginning to think that I should be looking at this on the data side, i.e. making sure that any new polygon I add isn't already in another polygon's area. That might be easier.

EDIT: Except that won't work in the case of overlapping polygons, in which case it should just get the union of those polygons. gently caress.

Pollyanna fucked around with this message at 18:08 on Feb 9, 2018

Adbot
ADBOT LOVES YOU

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
It sounds like the crux of the exercise is the polygon mapping behaviour. You may need to union your own polygons, before drawing them into maps? It does seem possible that as someone else mentioned clockwise/counter-clockwise might be the trick.

Nolgthorn fucked around with this message at 18:38 on Feb 9, 2018

Pollyanna
Mar 5, 2005

Milk's on them.


Yeah, that's more or less what I'm thinking, but...I have no idea how to do that. I'll have to figure that out...

Pollyanna fucked around with this message at 18:44 on Feb 9, 2018

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
It's Javascript heavy but you need a list of all polygons and then output one polygon. It's an interesting challenge but it's possible that we're making the solution out to be more complex than it is supposed to be. This solution won't help at all if the problem is related to your 2d polygon being face-down.

These guys are talking about polygon merging here.

https://stackoverflow.com/questions/2667748/how-do-i-combine-complex-polygons

Pollyanna
Mar 5, 2005

Milk's on them.


Nolgthorn posted:

It's Javascript heavy but you need a list of all polygons and then output one polygon. It's an interesting challenge but it's possible that we're making the solution out to be more complex than it is supposed to be. This solution won't help at all if the problem is related to your 2d polygon being face-down.

These guys are talking about polygon merging here.

https://stackoverflow.com/questions/2667748/how-do-i-combine-complex-polygons

The pre-written code assumes that there is a list of polygons, rather than just one big one. It's also entirely possible that I'm not expected to completely figure this out, but I'd rather assume the opposite so that I don't do poorly where I could have at least tried. That answer's a good one, I'll check it out - thanks!

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I had challenges for jobs where it ended up being exceedingly complex and I thought while writing it "maybe they just want to see how far I get" so I'd sit down and write a bit about what I was thinking and where I got stuck. I never got those jobs.

Pollyanna
Mar 5, 2005

Milk's on them.


Programming exercises that are entirely about "did they get it right yes/no" usually hint towards terrible jobs.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
you guys ever have issues with HTML inputs on mobile browsers where the input jumps while typing?

For exmaple, you can see the cursor at the bottom of this form, even though I'm typing in this first field. I can't for the life of me figure out what's going wrong

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Pollyanna posted:

Programming exercises that are entirely about "did they get it right yes/no" usually hint towards terrible jobs.

So those are the only ones you've done? :downsrim:

huhu
Feb 24, 2006

Grump posted:

you guys ever have issues with HTML inputs on mobile browsers where the input jumps while typing?

For exmaple, you can see the cursor at the bottom of this form, even though I'm typing in this first field. I can't for the life of me figure out what's going wrong



Is this a modal on iOS by chance? My coworker ran into this issue and something about modals and inputs don't play well together.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
Yeah it is. And after some digging, this looks like it’s a pretty huge issue.

What did your coworker do to solve it, out of curiosity? Because all the proposed solutions I’m seeing aren’t anything I’d like to do

Pollyanna
Mar 5, 2005

Milk's on them.


iOS Safari? We had a lot of problems with it on my last project. It has a lot of weird behavior compared to desktop Safari.

Capri Sun Tzu
Oct 24, 2017

by Reene

Grump posted:

Yeah it is. And after some digging, this looks like it’s a pretty huge issue.

What did your coworker do to solve it, out of curiosity? Because all the proposed solutions I’m seeing aren’t anything I’d like to do
Mobile safari is difficult to work with when you're doing anything that depends on the viewport with the onscreen keyboard activated. I've also had issues with modals and inputs on iOS Safari and we resolved them by not using a modal. Honestly modals aren't a good look on a mobile device anyway, but post a solution if you do figure one out!

Alpha Mayo
Jan 15, 2007
hi how are you?
there was this racist piece of shit in your av so I fixed it
you're welcome
pay it forward~
I am so confused where to start.

The last time I did web programming was for fun when I was like 12 years old. I learned HTML, XHTML, XML, MySQL and PHP.

PHP back then was actually what the name says it is, "Hypertext Pre-Processor". Code was integrated into HTML files scripturally. Kind of like Server Side Includes on steroids. It gained popularity because it wasn't Perl. PHP was easy to use (too easy actually), and they kind of pressured turning it into something it wasn't, Object Oriented.

PHP has obviously come a long way since PHP3, and now you have all the MVC frameworks to use to go with it.

I spent some time with the last few years learning a couple frameworks, I think it was CodeIgnitor I spent the most time with. But honestly I've basically forgotten everything about it.

But now I want to get away from PHP. I want something with strict typing (by default), code that is pleasing to the eye to look at (sorry Perl). People recommended Python and this is where I'm stuck. I'm not really grasping how it works in the real world.

Reading tutorials on just the installation of it, they recommend python3, virtualenv and PIP3 (which I assume is kind of like Composer to PHP?), then installing Django (which is what I want to learn) and Gunicorn to talk to the WSGY.

Like say I have a Linux server running NGINX. Where does NGINX fit in with Gunicorn, aren't they both HTTP servers? Is Gunicorn just meant for development? I also don't really understand what the WSGY model is or how it works.

I am looking for a recommendation on a good book or web tutorials on Python/Django, that assumes you know how to read/write code, and understand HTML, but entirely new to modern server-side web development.

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.

Alpha Mayo posted:

Like say I have a Linux server running NGINX. Where does NGINX fit in with Gunicorn, aren't they both HTTP servers? Is Gunicorn just meant for development?

Yeah, they are both HTTP servers, but NGINX is mainly used as a load balancer/reverse proxy (99.99% of use cases? Something like that). So you have your app backed with a server (Gunicorn in this case), then you have NGINX running in front of it. Incoming requests hit NGINX which forwards them onto your app server: nothing hits your app server directly. You don't need to worry about it whilst developing, and tbqh you don't shouldn't need to worry about at all where you're at; it's a very useful thing for applications going into production, but not for what you want to do at the minute (i.e. get back into learning to develop), ignore it for the minute.


edit: and I'd go through the Django guides on the website, starting here: https://docs.djangoproject.com/en/2.0/intro/ (also has a few recommendations for people new to Python as well)

RobertKerans fucked around with this message at 12:12 on Feb 12, 2018

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

RobertKerans posted:

Yeah, they are both HTTP servers, but NGINX is mainly used as a load balancer/reverse proxy (99.99% of use cases? Something like that). So you have your app backed with a server (Gunicorn in this case), then you have NGINX running in front of it. Incoming requests hit NGINX which forwards them onto your app server: nothing hits your app server directly. You don't need to worry about it whilst developing, and tbqh you don't shouldn't need to worry about at all where you're at; it's a very useful thing for applications going into production, but not for what you want to do at the minute (i.e. get back into learning to develop), ignore it for the minute.


edit: and I'd go through the Django guides on the website, starting here: https://docs.djangoproject.com/en/2.0/intro/ (also has a few recommendations for people new to Python as well)

People generally use nginx to serve all their static assets as well. Only request that need to get processed by your Django app get proxied. (Unless you are using S3 for static stuff or some other CDN solution, obviously)

RobertKerans
Aug 25, 2006

There is a heppy lend
Fur, fur aw-a-a-ay.
Ah, haha, I forgot the only thing I ever personally have to deal with directly beyond "use this preconfigured NGINX stuff" :ughh:. Still, not really something you need to worry about at all when you're at very first steps stage

RobertKerans fucked around with this message at 12:58 on Feb 12, 2018

Alpha Mayo
Jan 15, 2007
hi how are you?
there was this racist piece of shit in your av so I fixed it
you're welcome
pay it forward~
Thanks, this also helped a lot with explaining it too. One thing I like about Digital Ocean is that have a lot of guides/tutorials for people new to this.

So NGINX sounds like it would be on the front-end (user-facing) server, then behind the scenes it can forward the work to multiple Gunicorn instances running on different servers (droplets)? Is the load-balancing automagical, just have cloned Gunican/wsgy.py on each server (or more likely, wsgy.py on one storage volume that multiple droplets access)?

I know these are questions about Deployment, but I'd still like to get to that stage even if it is with a Hello World app.

Alpha Mayo fucked around with this message at 14:18 on Feb 12, 2018

mobby_6kl
Aug 9, 2009

by Fluffdaddy
I'm trying to automatically download a flat file report form an internal LoB web application. The owners aren't providing an official API, but how hard can it be, right? Unfortunately it's got frameworks out the rear end so I'd rather not reverse engineer everything because it looks like a pain in the rear end.

Is there a standard solution that would let me automatically log in with just user/pass thankfully, make a few choices and download the file to a defined location? This would be a temporary solution (lol we all know how that goes right) so the simplest one wins.

Capri Sun Tzu
Oct 24, 2017

by Reene

mobby_6kl posted:

I'm trying to automatically download a flat file report form an internal LoB web application. The owners aren't providing an official API, but how hard can it be, right? Unfortunately it's got frameworks out the rear end so I'd rather not reverse engineer everything because it looks like a pain in the rear end.

Is there a standard solution that would let me automatically log in with just user/pass thankfully, make a few choices and download the file to a defined location? This would be a temporary solution (lol we all know how that goes right) so the simplest one wins.
What you're describing has the potential to be a huge security risk.

teen phone cutie
Jun 18, 2012

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

Capri Sun Tzu posted:

Mobile safari is difficult to work with when you're doing anything that depends on the viewport with the onscreen keyboard activated. I've also had issues with modals and inputs on iOS Safari and we resolved them by not using a modal. Honestly modals aren't a good look on a mobile device anyway, but post a solution if you do figure one out!

code:
html {
	-webkit-overflow-scrolling: touch !important;
	overflow: auto !important;
	height: 100% !important;
}
found this solution online. It seems to work okay. I'd like not to pollute the global scope for this app, since it's going to be installed on mutiple client eCommerce stores, but :shrug:

I wish not using a modal was an option at this point.

Tei
Feb 19, 2011

mobby_6kl posted:

I'm trying to automatically download a flat file report form an internal LoB web application. The owners aren't providing an official API, but how hard can it be, right? Unfortunately it's got frameworks out the rear end so I'd rather not reverse engineer everything because it looks like a pain in the rear end.

Is there a standard solution that would let me automatically log in with just user/pass thankfully, make a few choices and download the file to a defined location? This would be a temporary solution (lol we all know how that goes right) so the simplest one wins.

I never done something like this, but sounds like something you can use headless chrome

https://github.com/GoogleChrome/puppeteer

https://try-puppeteer.appspot.com/

if theres a security risk, maybe you can put the result files in a password protected folder, using http basic auth.

huhu
Feb 24, 2006

Grump posted:

Yeah it is. And after some digging, this looks like it’s a pretty huge issue.

What did your coworker do to solve it, out of curiosity? Because all the proposed solutions I’m seeing aren’t anything I’d like to do

Not the most helpful solution... We stopped using a third party modal and my luck that fixed it so I didn't have to do anymore research.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Yesterday I was developing something and I added a `setTimeout` to my code. Compilation started warning about how `timers` was not defined and when running it in my browser it didn't work. It took quite a bit of frustration before discovering that Visual Studio Code had automatically placed `import timers from 'timers';` at the top of my file. I have no idea why.

Anyone have any clue, is that a new feature? How and what is `timers` and why is it related to `setTimeout` it looks like a node thing? I couldn't find any setting I could turn off.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

Nolgthorn posted:

Yesterday I was developing something and I added a `setTimeout` to my code. Compilation started warning about how `timers` was not defined and when running it in my browser it didn't work. It took quite a bit of frustration before discovering that Visual Studio Code had automatically placed `import timers from 'timers';` at the top of my file. I have no idea why.

Anyone have any clue, is that a new feature? How and what is `timers` and why is it related to `setTimeout` it looks like a node thing? I couldn't find any setting I could turn off.

That's some fancy Node integration, which is not appropriate to do when doing web development.

mobby_6kl
Aug 9, 2009

by Fluffdaddy

Capri Sun Tzu posted:

What you're describing has the potential to be a huge security risk.
What exactly could be the problem, other than perhaps hardcoding the password somewhere? This script wouldn't be doing anything someone isn't already doing manually. The thing doesn't even use https and doesn't contain any personal or secret data. This would just run on a schedule on a server somewhere and feed the downloaded file into into an ETL process.


Tei posted:

I never done something like this, but sounds like something you can use headless chrome

https://github.com/GoogleChrome/puppeteer

https://try-puppeteer.appspot.com/

if theres a security risk, maybe you can put the result files in a password protected folder, using http basic auth.
Thanks, this looks like it could work.

Chenghiz
Feb 14, 2007

WHITE WHALE
HOLY GRAIL

Nolgthorn posted:

Yesterday I was developing something and I added a `setTimeout` to my code. Compilation started warning about how `timers` was not defined and when running it in my browser it didn't work. It took quite a bit of frustration before discovering that Visual Studio Code had automatically placed `import timers from 'timers';` at the top of my file. I have no idea why.

Anyone have any clue, is that a new feature? How and what is `timers` and why is it related to `setTimeout` it looks like a node thing? I couldn't find any setting I could turn off.

Yeah VS Code does this thing where it looks through type definitions for the thing you're typing and imports it automatically if you tab-complete to that particular intellisense suggestion. I think the setting that controls it is `typescript.autoImportSuggestions.enabled`

huhu
Feb 24, 2006
I've been writing CSS for like 5 years now and it's still just kind of all a jumbled mess. Are there any good mailing lists or tutorials on subjects such as new CSS features, best practices, etc?

kedo
Nov 27, 2007

http://getbem.com/introduction/

BEM will change your life.

e: Regarding mailing lists, these are pretty good and touch on CSS issues with some frequency
https://wdrl.info/
https://web-design-weekly.com/
http://sass.news/

kedo fucked around with this message at 18:27 on Feb 13, 2018

Alpha Mayo
Jan 15, 2007
hi how are you?
there was this racist piece of shit in your av so I fixed it
you're welcome
pay it forward~
I was doing it wrong. Flask is much easier to start learning python with than Django.

Thermopyle
Jul 1, 2003

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

Neither is a good idea to learn Python with.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
I tried to learn Python, once for a job challenge and another that I wanted to develop an application for raspberry pi. I was struck by how the language doesn't let you break up lines. Gimme my brackets back.

Capri Sun Tzu
Oct 24, 2017

by Reene

Nolgthorn posted:

I tried to learn Python, once for a job challenge and another that I wanted to develop an application for raspberry pi. I was struck by how the language doesn't let you break up lines. Gimme my brackets back.
Semantic whitespace isn't my favorite thing either but I do like Stylus for my CSS preprocessing.

Alpha Mayo
Jan 15, 2007
hi how are you?
there was this racist piece of shit in your av so I fixed it
you're welcome
pay it forward~
Maybe I should just crawl back to php. I miss the good old days when register_globals was true by default.

Tei
Feb 19, 2011

Alpha Mayo posted:

Maybe I should just crawl back to php. I miss the good old days when register_globals was true by default.


Is weird that people *pay* programmers. Programming should be something that society consider vandalism. Software have a negative worth value, and is trough testing and long tedious hours fixing bugs that software ever is worth more than zero.

There's really too much code written and that's bad.

PHP fault is that is very easy to write a lot of software and ~stuff~, making the world a worse place in the process.

In 400 years people will look back at this era of programming like the dark ages. PHP is kind of like Gengis Khan this way.

Tei fucked around with this message at 17:25 on Feb 14, 2018

Alpha Mayo
Jan 15, 2007
hi how are you?
there was this racist piece of shit in your av so I fixed it
you're welcome
pay it forward~
PHP brought us facebook

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Tei posted:

Is weird that people *pay* programmers. Programming should be something by the society consider a negative. Software have a negative worth value, and is trough testing and long tedious hours fixing bugs that software ever is worth more than zero.

There's really too much code written and that's bad.

PHP fault is that is very easy to write a lot of software and ~stuff~, making the world a worse place in the process.

In 400 years people will look back at this era of programming like the dark ages. PHP is kind of like Gengis Khan this way.

I like to imagine that little mouse running around on a keyboard and these posts are the result.

Tei
Feb 19, 2011

Alpha Mayo posted:

PHP brought us facebook

And Mediawiki based discussion threads and phpBB style forums.

The other day I checked the phpBB source code. Because of course, phpBB still exists.

Is not something that can be repaired. If you look at the source code of phpBB, to change it to something reasonable would take more effort than to decode all human DNA and turn humanity inmortal and without flaws.

Lumpy posted:

I like to imagine that little mouse running around on a keyboard and these posts are the result.

I post like two kids in a trench coat. Fully believe is the best way to live.

Tei fucked around with this message at 17:37 on Feb 14, 2018

Capri Sun Tzu
Oct 24, 2017

by Reene
PHP has it's uses. If I want to bust out a quick proxy to avoid CORS, I'll PHP one in 30 seconds.

Adbot
ADBOT LOVES YOU

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
PHP/Perl CGI all these things are still very popular although not for any actual programming.

right?

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