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
Thermopyle
Jul 1, 2003

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

fletcher posted:

I want to write some automated tests for a REST API, what's a good tool/library to use to do that? Rest of the project is in Python, if there's something out there to keep it in the same ecosystem.

I would just use Django's TestCase and client if you're using Django (just guessing since you post in the Django thread).

There might be something else purpose-built, I have no idea, but it seems like a pretty simple thing to just do with TestCase.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

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

pipebomb posted:

Yeah, he does magazine, newspaper stuff. I used the h1 = headline and so on analogy. He absolutely freaked that I sent links explaining what some elements were.

Some people are loving idiots and you've got to

1) Get a new job.
2) Murder.
3) Deal with it. :(

Thermopyle
Jul 1, 2003

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

Harik posted:

I was playing with a data-driven site in django and nearly barfed at the tutorial:

HTML code:
<ul>
{% for choice in poll.choice_set.all %}
        <li>{{ choice.choice_text }}</li>
{% endfor %}
</ul>
After how neat the data modeling was, and how nicely it works in the admin view automatically, they smack you with a template language that arc-welds logic to presentation. That's basically PHP from 20 years ago. Is this really the best that we can do in 2014?

That's not logic.

Thermopyle
Jul 1, 2003

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

Doc Hawkins posted:

Even worse, it's a law of Demeter violation! :supaburn:

Maybe. I mean, you could have a template engine whose only tag is:

code:
{{ PAGE }}

Thermopyle
Jul 1, 2003

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

I'm looking for ideas/inspiration for a modern-looking way for adding a related object in a CRUD-style app.

For example, say I have a form for adding a Job to the users database. A Job can have associated Vendors and the form allows the user to select an existing Vendor or add a new one. What's a nice way of doing this?

My current dumb version has a section of the form that has a list of currently added vendors, a section for selecting an existing vendor, and a link that pops up a modal with a form for adding a new vendor.

Any other ideas, or can you point me to any sites doing this in an interesting way?

Thermopyle
Jul 1, 2003

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

Kobayashi posted:

Are you talking about the UI?

Yes.

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.

Thermopyle
Jul 1, 2003

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

fuf posted:

How come? :(

I finally settled on something after trying like a million loving combinations of different frameworks. Please don't make me change again.


What are some reasons people give for this? I don't wanna keep using Node if it's really so terrible, but a JS backend is a pretty big bonus for me because it's the only language I know other than php. Also I really rely on stuff like grunt now.

I have no experience on the matter, but MongoDB gets brought up in the Coding Horrors thread semi-frequently. Before you jump in to using it because it's the hot cool thing, I'd investigate why that is.

I'd also push you to learn a different language for the backend. Not because I have an opinion on Node, but because learning a new language once you know one isn't that big of a deal...especially if you choose something like Python which is very similar to Javascript...and running a server knowing just JS seems like a bad idea.

Heck, you might learn something like Python and still end up using Node, but picking Node because you just know JS doesn't seem too smart when the hurdles to learning another language aren't terribly significant and will open up your options significantly.

Thermopyle
Jul 1, 2003

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

fuf posted:

What I really want to know is if Node is actually significantly slower, less reliable, or less secure or something, because that would be a good reason to change.

I have little experience with Node, but I do not know of any problems with it in those areas.

fuf posted:

You mean like managing a server? I've been doing that for a while with just bash. :shobon:
What else might I need?

(not trying to be defensive or anything, these are genuine questions! :))

I don't know what I really meant by that!

I guess what I really was doing was using the "only-knows-one-language-and-it-is-js" fact as a proxy for "has thoroughly evaluated the available options".

Thermopyle
Jul 1, 2003

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

Lord Windy posted:

I'm really new to all this (not programming in general though) and was wondering, what do these frameworks offer?

I was looking up Django, Node and others on Wikipedia but I couldn't quite work out what they did. So I installed the latest version of OpenBSD that comes with Nginx installed by default, put on MySQL and the latest version of PHP 5.4. Is that all a framework is basically, just using different languages?

So, you've got a programming language, a database, and a Web server.

You're now about 1 million steps away from actually working on your app because you've got to write code to map your data onto the database, manage Web browser sessions, create user registration systems, cache views, develop a system to get data from database to HTML, a thousand other things, and a hundred sub parts of each.

Or you could use a framework.

Thermopyle
Jul 1, 2003

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

This conversation made me want to point out that a good IDE can jump straight to the CSS defining a class or id or whatever from the HTML, so that helps with finding poo poo too. In JetBrains products like PyCharm or WebStorm you can Ctrl click or press Ctrl-B to jump to the declaration in the CSS. I assume other IDE's can do that to.

Thermopyle
Jul 1, 2003

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

Pollyanna posted:

What I want most in a framework is offering functionality like responsive sizing and components, and having a sane layout whether it be grid, long, or whatever. For it to be a good framework, all that needs to be separate from how it looks - I want the framework to help me organize and functionalize what is presented and how it behaves, without laying down any rules about what everything looks like.

I think that's everyone's beef with Bootstrap. Bootstrap has a particular look to it, when it shouldn't have a look at all - just offer the CSS necessary for functionality and defining what a component is, and it's golden. More frameworks need to focus specifically on the toolkit aspect of front-end, because if we don't we get hero units and blue buttons loving everywhere.

Bootstrap comes with a look. You can change it however you want.

People use the default look because it's easy, but the alternative of no styling at all is a lot of work for developers who will either do a bad job or not bother making whatever product.

I mean, I get sick of seeing default bootstrap styling, but I like it better than the alternative.

Thermopyle
Jul 1, 2003

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

At a high level here's how your site would work:

1. You have a scraper of some sort scraping prices from websites and depositing that information in a database.
2. You have a framework of some sort which handles user authentication, mapping database information into HTML templates, abstracting the database, and a hundred other things.
3. You have a web server which the framework communicates with.

Using Django in the next few sentences as that's what I've been using a lot lately...

For step 1 you write python scripts which download websites and parse data from them. These scripts use Django's ORM to easily deposit the information into your database.

For step 2 you write views and templates which hook up your models of the data to HTML the webserver (step 3) can send to the clients.

Honestly, you're probably not going to get a good handle on this until you jump in and just do something. The official Django tutorial is good.

Thermopyle
Jul 1, 2003

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

zfleeman posted:

This is probably a dumb question, but why use <section>s in html5 over divs?

section is a semantic tag used to indicate that the included content is related to each other. div has no semantic meaning at all.

As far as the why goes...well, I guess it's because it makes more sense. I assume it will help search engines either now or in the future.

Thermopyle
Jul 1, 2003

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

fuf posted:

Are any of those cool project management sites / software geared towards one-man operations?

I'd love to consolidate my calendar, todos, documentation and maybe git repos into one place but I've never found something that felt quite right.

Github works well.

Thermopyle
Jul 1, 2003

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

I'm designing an API right now that presents some objects like so:

JavaScript code:
{
	"id": 1,
	"name": "Fake Acres",
	"address1": "123 Fake Street",
	"address2": "",
	"city": "Faketown",
	"zip": "12345",
	"things_here": [
		"http://blahblah.com/things/1/",
		"http://blahblah.com/things/2/",
		"http://blahblah.com/things/3/",
		...
	]
}
Many times a consumer of the API will probably just care about a specific attribute of the things listed in things_here and would probably prefer output like:

JavaScript code:
{
	"id": 1,
	"name": "Fake Acres",
	"address1": "123 Fake Street",
	"address2": "",
	"city": "Faketown",
	"zip": "12345",
	"things_here": [
		"red truck",
		"yellow screwdriver",
		"white seagull",
		...
	]
}
My question is, how should I allow the consumer to request this optional output? I can do URLs like:

1. http://blahblah.com/place/1/special_output/
2. http://blahblah.com/place/1?special_output=true

or what?

If it's just personal preference I think I'll go with #1 as I prefer the cleaner look of urls without query parameters, but if there's a standard for REST API's (that I can't seem to find right now), I'll stick to the standard.

Thermopyle
Jul 1, 2003

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

Munkeymon posted:

I'm not aware of standards around this - I just see "X is optional" and think immediately of the query, not the path. You've gone one farther and said "X is optional and just modifies the output". /place/id?xml=true is a clearer logical parallel that I think makes the the case a bit better.

This is a good point and you've convinced me.

Thermopyle
Jul 1, 2003

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

Sedro posted:

...good points...

This ends up being a ton of work and you're over-engineering unless the API is your main product. There are server and client side technologies which can pick up some of the work but they won't agree on a convention.

I get a lot of that for nearly-free as I'm using django-rest-framework, so that's something.

Thermopyle
Jul 1, 2003

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

Munkeymon posted:

Yeah, you're technically right, but doing that from a browser is kind of annoying and could behave in unexpected ways, and that's the perspective I'm coming from/assuming. The server could easily just check both to be a more friendly API, I guess.

Yeah, the real issue from my viewpoint is that so many sites do the format selection via a query parameter that consumers kind of expect it. A lot of sites support both the HTTP header and a query parameter.

Thermopyle
Jul 1, 2003

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

Pollyanna posted:

Is there a better way to format address information than like this?



Or should I dump the extraneous information and just have an email link and a Github link?

Umm, it depends on why and where you want your information.

Thermopyle
Jul 1, 2003

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

I need to whip up a dashboard style site with Boostrap 3 (like these, but I don't care where it comes from). For right now I'm just looking for a pre-built theme. Anyone have any they've used an particularly liked?

Thermopyle
Jul 1, 2003

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

kedo posted:

Looking for opinions.

After quitting my full time job to start freelancing full time I find myself with a lot of open time. I have several projects that are proposed and will probably be kicking off in a month or two, but in the mean time I've run out of productive things to do. Thus, I'd like to tackle a new language or framework or CMS but am having a hard time picking one to dive into.

My expertise is primarily on the front end (which I've been doing for about 13 years), and I have a super solid grasp on HTML, CSS, JS and know enough PHP to be dangerous. I've been working with WordPress so long that I can do pretty much anything a client might want with it, but I worry that I'm pigeonholing myself. Learning a new language altogether is intriguing to me because someday I'd like to handle a bit more of the backend side of projects than I do now. Being able to develop native apps is also an exciting idea. However I have no real training in programming and am having a hard time figuring out what I want to jump into.

I'm looking at Ruby and Python right now because they seem a lot more useful in the long run than something like PHP. Any thoughts? Someone point me in a good direction.

Django.

Thermopyle
Jul 1, 2003

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

Heskie posted:

:crossarms: might have to go look into Django some more then.

I'm not sure if others would agree with me, but it's probably worth reading through introductory Python texts before you try to jump right in to Django.

Learn Python the Hard Way and Think Python are both widely recommended.

Also, the Django thread.

Thermopyle
Jul 1, 2003

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

My Rhythmic Crotch posted:

I've gone from Python back to Java for back-end stuff at work. It's much higher performance and there is excellent support for json, databases, etc. The downside is that most Java web frameworks are very heavy, in the sense that they seem to include every piece of the stack for you and make it difficult to deviate from that. I'm sticking with the Spark "micro framework" and while it's definitely not perfect, I really like how minimal it is.

The other benefit to learning Java would be that you should be able to transition to Android development pretty easily - though I've yet to give that a shot myself.

While I think this might be generally true, I'm not sure that it matters for 95% of back-ends. I mean, if you enjoy Java, then it's a fine thing to write a web backend in...I've certainly done so. However, I seriously doubt most people should be choosing any of the popular backend languages based upon performance. They all have enough performance for the vast majority of needs.

Thermopyle
Jul 1, 2003

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

prom candy posted:

Why all the Django recommendations and no recommendations for Rails? I always thought Django was fairly unpopular compared to Rails, am I so out of touch?

You're out of touch.

Thermopyle
Jul 1, 2003

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

fuf posted:

I might be wrong but I do feel like there's a little bit of favouritism towards django on these forums for whatever reason (myself included).

I think this might be true. I am sure that Django isn't "fairly unpopular" compared to Rails.

Thermopyle
Jul 1, 2003

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

Loezi posted:

What do you guys think about Spring (or Spring Boot) for Java?

Also, do you have any good resources for learning Django as someone who's already comfortable with MVC, routing etc. from other languages?

Just work through the official tutorial. It's short enough so you don't get irritated reading stuff you already know, but detailed enough you learn how Django works.

Thermopyle
Jul 1, 2003

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

Every time people start talking about gulp/grunt/whatever, it just starts getting me irritated about how ridiculous the whole web deployment system is.

Thermopyle
Jul 1, 2003

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

nexus6 posted:

Do you mean with or without gulp/grunt/whatever? I don't use anything like that through a combination of ignorance about them and stubborn/unchanging business processes at work.

I mean that there is even a need for gulp/grunt/whatever.

Thermopyle
Jul 1, 2003

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

Ahz posted:

Would I care about some of these tools like grunt/gulp for deployment when I'm using an IDE like Pycharm for a Django project? For example, Pycharm has built-in watchers that compile my LESS files for me on every change.

What else do I need? (not sarcastic)

I haven't gotten to deployment yet, but I would like to get started the right way when I do.

No, you can do all of it through PyCharm.

Though, if you're doing Python stuff, you should use Heroku or the like for your deployment anyway! :colbert:

Thermopyle
Jul 1, 2003

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

Maluco Marinero posted:

The problem with an IDE doing all that stuff is that there is certain elements required to actually do work on your project, that are tied to the IDE and not into the project files.

PyCharm/WebStorm can do the exact things grunt/gulp/whatever does. Unless your point is that you should have your grunt/gulp/whatever config as part of your repo. You can do that with PyCharm as well.

In fact, you can configure PyCharm to integrate with grunt and run your tasks and stuff.

Thermopyle
Jul 1, 2003

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

Maluco Marinero posted:

If you can guarantee that every person in your shop and all your potential contractor resources use PyCharm/WebStorm, go for it. If not, they should not be tied to the project like that. My point is that you should be able to onboard developers with a fairly minimum set of dependencies, IDE is not always a good dependency to have compared to say a base like Node/Vagrant, because they are both freely available with installers on all platforms.

Oh yeah, I agree with this. I was just saying that the way your original post was worded it sounded like you might be saying you couldn't share your build configuration with PyCharm/WebStorm.

Thermopyle
Jul 1, 2003

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

What do you call those pages whose sole point is to get your email address to tell you when the real site rolls out?

I've got a site that will be rolling out within a few months and I'd like to throw up some Google ads for relevant searches and get people to sign up for an email saying "yeah, that site you were interested in is now live!".

I'm trying to search around for examples for inspiration, but I'm having a hard time finding them as I don't know what they're called.

Alternatively, if they're not really a thing with a name...anyone have some good examples?

Thermopyle
Jul 1, 2003

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

Uziel posted:

Transactional landing page. I don't have a good example unfortunately but I know exactly what you mean.

Oh that's great. Lots of good google results for that term. Thanks!

Thermopyle
Jul 1, 2003

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

Blinkz0rz posted:

Also fix your dependencies to a single version and then test against any updates.

Don't ever let anyone else (e.g. a CDN) determine what version of a dependency you're using.

I'm not sure if you're saying this, but this reads like you could be saying this so...you can use a CDN and fix against a specific version.

Thermopyle
Jul 1, 2003

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

Whalley posted:

This isn't really a question or anything, but I've just started learning Angular.js and holy poo poo I've got half a dozen projects that would have been so easy to complete had I learned this earlier. Angular.js is so fuckin' nice.


prom candy posted:

I'm finding the same thing with Ember. Two-way data binding is so much nicer than loving around with events.

You guys are going to be ecstatic when you try React.

(or maybe not, but it's pretty fuckin' sweet)

Thermopyle
Jul 1, 2003

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

prom candy posted:

What's the deal with React? What's it good at that Ember and Angular are bad at?

Being fast. The way it makes you think about your apps. It's conceptually small, so easy to understand. Documentation.

Thermopyle
Jul 1, 2003

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

React is so simple you should just go do the tutorial and read the docs.

It certainly won't do everything a heavier framework does out of the box.

Remember that you build and think about apps differently with React and if you need to, you can use it with other libraries.

Thermopyle
Jul 1, 2003

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

Pollyanna posted:

As far as I can tell, React does not specialize in proving an MVC framework. It seems like it focuses on alleviating the complexity of creating a View for your data, whatever that data happens to be. React is actually so divorced from the traditional MVC setup that I wouldn't call it MVC at all; it displays data, but does not work with data. I feel like you may need something to accompany it, like Backbone or somesuch to fulfill the M-C part.

That's what React is, so yes.

However, for many MVC-library-using projects, the common MVC frameworks are overkill.

Adbot
ADBOT LOVES YOU

Thermopyle
Jul 1, 2003

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

fuf posted:

I guess I should just run a virtual linux machine?

This is what I do, and it works perfect. I developed straight on Windows for years, but a couple years ago I decided to move to my current setup with Ubuntu in VMWare on two of my three monitors.

There's always some little issue on Windows with all these tools and libraries.
There's some ancillary benefits as well.

I really like being able to just suspend the VM when I'm done working without worrying about stopping ongoing tasks saving files, etc.

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