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
hayden.
Sep 11, 2007

here's a goat on a pig or something
edit: nevermind, I think I just need to suck it up and learn linux better

hayden. fucked around with this message at 05:46 on Mar 1, 2015

Adbot
ADBOT LOVES YOU

an skeleton
Apr 23, 2012

scowls @ u
I'm trying to write a plugin for WordPress that extracts data from a Google Spreadsheet when you visit a page. I am assuming I use the Google Sheets API... but am unsure about how to do HTTP requests within a plugin. I'm not sure if I should be using http://codex.wordpress.org/HTTP_API or somehow adding a dependency to my plugin for Guzzle or another PHP HTTP Module. Can anyone point me in the right direction?

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
I'm not a wordpress expert, but the point behind the wordpress HTTP API seems to be to wrap as many common HTTP transport methods as possible under one handy API that the core can use. Seeing as your framework is Wordpress, you might as well go with the mantra "if its good enough for wordpress, it's good enough for me!".

That said, if you get yourself in a situation like this and you don't know if the thing you're doing is going to be entirely correct, and there's like totally a bunch of ways you could do this one particular thing, and you know you could butcher it into working initially but you're paralysed by the idea of doing it wrong in the first place.. Well, firewall all that opinionated poo poo behind a little interface, and then you can swap out whatever you make with something else, if you discover a better approach.
php:
<?
/**
 * Unopinionated transport interface. This is what everything should expect to interact with
 */
interface MyPluginTransportInterface 
{
    /**
     * @param string $url
     * @returns string
     */
    public function loadResource($url);
}

/**
 * Implementation of transport interface
 * This is what you instantiate, and does the legwork
 * Discover you don't like how it does loadResource? 
 * Just make a new class, use the same interface, instantiate that instead. Job done.
 */
class MyPluginTransport implements MyPluginTransportInterface 
{
    public function loadResource($url) 
    {
        // Opinionated transport method
        return wp_remote_retrieve_body( wp_remote_get($url) );
    }
}

// So code looks a bit like this
$transport = new MyPluginTransport();
if (!$transport instanceof MyPluginTransportInterface) {
    throw new \LogicException('whoops, transport class must implement the Transport Interface, you idiot coder.')
}
$spreadsheet = $transport->loadResource($my_resource_url);
?>

an skeleton
Apr 23, 2012

scowls @ u
Thanks a lot! My question is, why is it good to define the interface there (as opposed to simply defining loadResource without it)? Is it simply a matter of good structure or what?

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
Pretty much. The idea is that if you're writing something that's interchangeable, you have a common interface which you implement on all your classes.

Typically you wouldn't define it in the same file - the idea if that if you completely torpedo MyPluginTransport, you'll still have the interface definition, which is what all of your code is expecting to encounter.
When you're type-hinting classes and arguments, you'd always have your functions expect MyPluginTransportInterface and never the implementation (MyPluginTransport).

Similar to how you can have a class extend an abstract, and you might be forced to implement the abstract functions in the abstract class, interfaces let you have many interfaces implemented on the same class, and force you to implement the relevant methods.

An easier example to understand could be a node-based system:
code:
NodeInterface
	getName
	getForm
	
ExecutableNodeInterface
	execute

TaskNode implements NodeInterface, ExecutableNodeInterface
	getName
	getForm
	execute

CommentNode implements NodeInterface
	getName
	getForm
In the above, every node class implements NodeInterface, and all my code would expect classes with an instanceof NodeInterface.
But also not everything implements ExecutableNodeInterface because a CommentNode isn't actually executable. It omits this interface, and an instanceof ExecutableNodeInterface would fail, and we can skip executing that node.

That's more about defining behaviors, but you can see how it's useful for defining a "common" aspect without actually making you put the logic in.

Opulent Ceremony
Feb 22, 2012
I'm looking for guidance on a stack to use for some web development my wife is going to be doing. Her experience in programming is limited, but she picks things up quick and I'll be able to help her as well. Her org doesn't really have any recommendations for her and is fine with what we pick.

We need something that is all FOSS, web app, server, and relational db (all will be internally hosted), and ideally as easy to pick up for a beginner as possible. Just need to be able to put data into a db and read from it with a web browser. Does not want to use Access. Ideally, some SQL-generating ORM and a convenient way to manage db schema migrations. I'm leaning towards Django or Rails with whatever standard db they use based on the little I've read, but I don't really have much experience with either and whether they offer the tools I would like.

Any input is appreciated, thanks.

hayden.
Sep 11, 2007

here's a goat on a pig or something
I like recommending PHP to beginners who just want simple stuff because it's the simplest option in my opinion. Make a text file, call it index.php, and just slap this in there:

code:
<div class="someHTML">
<?php
$query= mysql_query("SELECT * from sometable");

$row = mysql_fetch_assoc($query);

$textValue = $row['someColumn'];

echo $textValue; //prints to browser whatever the field value is
?>
</div>
Aside from a couple more lines to connect to the database before this, that's all there is to it for PHP. No other steps needed. If you want to loop through multiple rows that return from the query it's just one more line.

MySQL database is probably the most popular and works well. It's not 'trendy' and there are faster options but for what she needs it's fine.This is also commonly pared with Linux(Debian or Ubuntu) and Apache. All together this is referred to as a LAMP stack and probably the most common stack in use.

hayden. fucked around with this message at 03:09 on Mar 2, 2015

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
/\/\/\/\/\/\ Assuming you're on windows, you'll need something like XAMPP to run the server.

Unfortunately, I have to be that guy and say please don't for the love of god ever use mysql_query. It's finally deprecated as of 5.5.0 and it's going to be removed after that. Just stop it.

Second to that, I have to say please don't for the love of god make an application without a framework.
We've all been there, we've all re-invented the wheel with absolutely no knowledge because "frameworks are hard" and smashing functions together is easier. Then we've discovered that our code is a higgldy-piggldy mess, makes no sense to even yourself, is chock full of bugs, and makes you want to do stabbings. Additionally f it turns out the thing you made needs someone else to work on it, you can just palm your framework-based application off to a developer who really knows their poo poo, and they can hit the ground running, as opposed to punching themselves in the face repeatedly for accepting the job of figuring out how your procedural dogpile hasn't yet spontaneously caught fire.

As perhaps an alternative, take a look at this ground-up tutorial for Laravel, which will get you some CRUD (Create, Read, Update, Delete):
https://www.flynsarmy.com/2015/02/creating-a-basic-todo-application-in-laravel-5-part-1/

The starter instructions are for linux/mac, so consider setting up a virtual server rather than using xampp. Some of the command-line stuff is a lot harder to get working under windows.
Here's an article on that: http://www.sitepoint.com/build-virtual-machines-easily-puphpet/
And you will need these:
https://msysgit.github.io/
https://www.virtualbox.org/wiki/Downloads
https://www.vagrantup.com/downloads.html

You'll probably want an IDE to make your life easier, so there's this (get HTML & PHP):
https://netbeans.org/downloads/

Then read the tutorial on Laravel.

To be absolutely clear, someone else might know a language or package that will do a lot more a lot quicker, but I personally don't know any.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

hayden. posted:

I like recommending PHP to beginners who just want simple stuff because it's the simplest option in my opinion. Make a text file, call it index.php, and just slap this in there:

code:
<div class="someHTML">
<?php
$query= mysql_query("SELECT * from sometable");

$row = mysql_fetch_assoc($query);

$textValue = $row['someColumn'];

echo $textValue; //prints to browser whatever the field value is
?>
</div>
Aside from a couple more lines to connect to the database before this, that's all there is to it for PHP. No other steps needed. If you want to loop through multiple rows that return from the query it's just one more line.

MySQL database is probably the most popular and works well. It's not 'trendy' and there are faster options but for what she needs it's fine.This is also commonly pared with Linux(Debian or Ubuntu) and Apache. All together this is referred to as a LAMP stack and probably the most common stack in use.

Please just use PDO, really no reason not to. Just as simple to start, and you won't have people coming back with these functions that have been deprecated for 2+ years

DrSunshine
Mar 23, 2009

Did I just say that out loud~~?!!!
So I'm coding up a website for a webcomic that I'm doing with a friend, and I want to make it so that when you click on the links in the dropdown menu, it changes the content in the box labeled "current page" to whatever chapter you clicked on. So, instead of going into an archive and clicking on "next" and so on, you'd just load the content right there on the main page, with all the pages displayed as one column that you'd scroll down to read.



Problem is, I'm a complete newb when it comes to web coding. I have no idea what I should do! I'm teaching myself as I go along. What sort of approach should I start with? Would I use Javascript for this?

hayden.
Sep 11, 2007

here's a goat on a pig or something
Yeah my mistake on using mysql_query as the example, brain fart. Thanks.

I think frameworks are ideal but it's a whole lot to take in for someone who barely understands programming. Using objects, understanding MVC, and actually sticking to the best practices of the framework are going to be really difficult.

hayden. fucked around with this message at 16:22 on Mar 2, 2015

hayden.
Sep 11, 2007

here's a goat on a pig or something

quote:

Problem is, I'm a complete newb when it comes to web coding. I have no idea what I should do! I'm teaching myself as I go along. What sort of approach should I start with? Would I use Javascript for this?
The simplest way, if you stick to really strict naming standards for the images, is using JavaScript to just update the image URL of the comic to be whatever it should be based off a data-chapter tag on each of the links.

hayden. fucked around with this message at 16:36 on Mar 2, 2015

DrSunshine
Mar 23, 2009

Did I just say that out loud~~?!!!

hayden. posted:

The simplest way, if you stick to really strict naming standards for the images, is using JavaScript to just update the image URL of the comic to be whatever it should be based off a data-chapter tag on each of the links.

I'm going for something like this yeah! I fiddled around and poked around on the net for something like what I want to do, and came up with something like this:

java script:

code:
function toggleChapter(){
	var img = document.createElement('img');
	img.src = './chapter1/01.png';
	document.getElementById('docDisplay').appendChild(img);
}
CSS:
code:
#docDisplay {
}
HTML:

code:
<li><a href="#" onclick="toggleChapter();">Chapter 1: I Am... Aricelle?</a></li> 

....

<div id = "docDisplay"/>
Is it possible to put variables in for things like "01".png? I could imagine some kind of loop that counts up for every N images, and then outputs them with something like "img.src='.chapter1/[N].png' " ... is that allowed?

o.m. 94
Nov 23, 2009

There's better ways to do this, but your current solution is probably workable for now.

Each link calls toggleChapter(), right? So pass in a unique argument for each link: toggleChapter("01"), etc.

You can then use this string to decide which image to load.

DrSunshine
Mar 23, 2009

Did I just say that out loud~~?!!!

o.m. 94 posted:

There's better ways to do this, but your current solution is probably workable for now.

Each link calls toggleChapter(), right? So pass in a unique argument for each link: toggleChapter("01"), etc.

You can then use this string to decide which image to load.

Yeah, when you click on the chapter, it's supposed to bring up all the images in the chapter.

My current idea for it is:

code:
function toggleChapter(){
	var x;
	var y;
	var img = document.createElement('img');
	for (n=0;n<y;n++){
		img.src = "./chapter[x]/[y].png";
		document.getElementById('docDisplay').appendChild(img)+"<br>";
	}
}
But that's not correct syntax.

EDIT: Wait, I think I've got it! Just wrap the individual sections with quotation marks and link them with +'s, I think?

DrSunshine fucked around with this message at 18:26 on Mar 2, 2015

DrSunshine
Mar 23, 2009

Did I just say that out loud~~?!!!
So, now I've got this:

code:
function toggleChapter(n,m){
	for (var i;i<m;i++) {
	  document.getElementById('docDisplay').innerHTML = '<img src="./chapter' + n + '/' + i + '.png">' +'<br/>';
	}
}
... and I've tested it without the for loop and putting in some basic things instead of the variables, but when I try to put it in the for loop with the variables, it doesn't display the images the way I want it to. I'm a little stumped here. What am I doing wrong or not getting?

EDIT: Found it! I was dumb and didn't set var i = 1. :downs:

DrSunshine fucked around with this message at 15:26 on Mar 3, 2015

Data Graham
Dec 28, 2009

📈📊🍪😋



Hey guys, I need to make a big post full of webdev tech/philosophy questions in order for you all to either confirm or explode my prejudices. This will range from tech stack choice to scalability/high-av clustering and database questions and will probably involve a fair amount of me being snarky about the person whose opinions I'm trying to seek ammunition against.

Don't worry, I've been in the field for decades and will probably not be asking anything too basic.

Do I post here or make a dedicated thread? I'd like to think the subject would eventually be serviceable as a general "what platform and architecture do I use if I'm serious about performance" kind of thing, but maybe that fits into this thread anyway, I'm not sure. I'm new to the thread so I don't know how fast it moves.

Data Graham
Dec 28, 2009

📈📊🍪😋



DrSunshine posted:

So, now I've got this:

code:
function toggleChapter(n,m){
	for (var i;i<m;i++) {
	  document.getElementById('docDisplay').innerHTML = '<img src="./chapter' + n + '/' + i + '.png">' +'<br/>';
	}
}
... and I've tested it without the for loop and putting in some basic things instead of the variables, but when I try to put it in the for loop with the variables, it doesn't display the images the way I want it to. I'm a little stumped here. What am I doing wrong or not getting?

What you're doing in this loop is overwriting the content of "docDisplay" with a new <img> every time you go through the loop. I'm pretty sure that's not what you want to do. You want to append m images in a list into that div, right?

The simplest fix is to use "+=" instead of "=", to concatenate the strings together. But you'll also need to put in a
code:
document.getElementById('docDisplay').innerHTML = '';
before the for loop, to clear out the div before you start looping.

Also, just a semantics note: you've called the function "toggleChapter", but you're not toggling; toggle means "on/off". I'd call it "selectChapter" or "switchChapter". Seems like a small thing, but you want to use the clearest language possible for maintainability (always be thinking about the next guy who has to come along and figure out your code without your help).

hayden.
Sep 11, 2007

here's a goat on a pig or something
.

hayden. fucked around with this message at 02:44 on Mar 5, 2015

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice
I started writing a series of articles on wireframing / prototyping in the browser with React: http://simblestudios.com/blog/design/wireframes-with-react-part1.html

Hopefully it's useful, and I'd love feedback!

DrSunshine
Mar 23, 2009

Did I just say that out loud~~?!!!

Data Graham posted:

What you're doing in this loop is overwriting the content of "docDisplay" with a new <img> every time you go through the loop. I'm pretty sure that's not what you want to do. You want to append m images in a list into that div, right?

The simplest fix is to use "+=" instead of "=", to concatenate the strings together. But you'll also need to put in a
code:
document.getElementById('docDisplay').innerHTML = '';
before the for loop, to clear out the div before you start looping.

Also, just a semantics note: you've called the function "toggleChapter", but you're not toggling; toggle means "on/off". I'd call it "selectChapter" or "switchChapter". Seems like a small thing, but you want to use the clearest language possible for maintainability (always be thinking about the next guy who has to come along and figure out your code without your help).

Wow! Thanks a lot. I'd already figured out the part about +=, but I was currently stuck on clearing the div. I was busy building a second function to remove and recreate the div, but that's so inefficient! Thank you so much for that! Also I definitely agree on your point about making the function's name clearer, so I changed that too. Great suggestion.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Lumpy posted:

I started writing a series of articles on wireframing / prototyping in the browser with React: http://simblestudios.com/blog/design/wireframes-with-react-part1.html

Hopefully it's useful, and I'd love feedback!

This is most dope. The designer I collab with will probably find it handy. At the moment for an app we're working on he builds in Jade and then I take it to React from there, but he's looking to learn more React so this might help him find a workflow that fits better with our end result. I certainly appreciate the focus on quick and dirty prototyping, as well managed and maintained code is not really the designer's prime responsibility.

yoyomama
Dec 28, 2008

Lumpy posted:

I started writing a series of articles on wireframing / prototyping in the browser with React: http://simblestudios.com/blog/design/wireframes-with-react-part1.html

Hopefully it's useful, and I'd love feedback!

I just started looking over this, but it's super helpful. Especially for a beginner, the steps are really easy for me to understand and follow. I'd be happy to give you more feedback once I read through more and use it to start working on my own prototype.

Data Graham
Dec 28, 2009

📈📊🍪😋



All right, I'm just gonna post this here, since this thread doesn't seem to be too wrong a place for it.

I'd like to know What Framework/Architecture Is Best, from a standpoint of:

- free/open-source
- high-availability (i.e. able to sustain spikes in load from getting googlebombed all of a sudden)
- maintainable
- clusterable (multiple web servers, multiple DB servers)
- speed to market

Of course these are questions that occupy lots of people's thoughts and probably tons of articles on the web, but the weird thing is that I haven't been able to find many. Most StackOverflow type discussions along these lines seem to say things like "Well, just use what works and fits your budget, everything is pretty much the same performance-wise per unit hardware investment". I don't hear much along the lines of "X is way better than Y, what kind of loving idiot are you for even considering Y". That's what I'm after, because I'm sure people are passionate about these things. But if they're anything like me, they're working their day jobs in whatever environment the job dictates, even if it isn't anywhere near their first choice.

Some background: I've been doing webdev since 1995. I spent the majority of the first ten years of my career doing Perl/CGI stuff on Apache, and since then I've built in ColdFusion, JSP, and most recently Python/Django. I generally use MySQL, but I have enough exposure to PostgreSQL to know the relative advantages and gotchas. Front-end-wise I use jQuery/jQueryUI and AngularJS. Lately I've been digging into Node.js and NoSQL stuff like Firebase and MongoDB, and to me it seems obvious that that's where the momentum of the market is headed. The trick is in knowing what those things are useful for, and in what cases people might be trying to make them work on tasks they're not as well suited for as the more traditional kinds of stuff just because they're "cool" and good resume fodder.

The reason why I'm making this post is that I saw a banner ad at the bottom of SA for apisnetworks.com, with goon opinions embedded in it like "oh yes, they still use MsSQL and PHP and PostgreSQL, if you really have to use them". So I want to tap into those goon opinions and find out what they're founded on. Because it's surprisingly hard to get people talking with much frankness on the subject, or at least to find places where they already have. I want to stumble upon a nice slick web stack comparison page like caniuse.com that lays it out in grim detail what each one is built for and what each one supports and which ones are laughably obsolete to anyone with half a brain, but if such a thing exists, I haven't run across it.

So: my personal predilection these days (for a traditional website/webapp, as opposed to a real-time thing like a chat or a pure API) is to use Django, because I really love the design philosophy behind it, and it's genuinely a joy to work with. Sure it has warts, but I can't say enough about how joyous an experience it is to be able to get all that ugly SQL out of my HTML structure, and more than that, even out of my view code! But I know that an ORM comes at a performance cost, and I can't imagine that a system that follows all foreign-key relationships to create a massive query across all related tables every time you do an object call is very efficient. What I want to know is, what kind of penalty am I paying, versus using a more low-level framework like, say, JSP?

The complicating factor for me is that I have a business partner who has some very strong opinions on the matter—and I don't know whether I can trust them. He has credentials; he was part of an emmy-winning team that built some kind of super-high-availability thing in JSP that broadcast millions of data streams to embedded TV receivers over some kind of proprietary packet stream, and he's very firm and loud about what kinds of technologies he will allow on his network. Newer ones that I try to bring up are often shouted down as idiocy. So what I'm trying to do here is gather some better ammo to use in those situations.


Here are what his opinions on the current lineup of things seem to be:

- PHP: garbage. He knows this because he watches logs constantly and knows that 80% of traffic is script kiddies targeting known vulnerable PHP admin URLs.

- Perl: Gets the job done, and okay for low-profile stuff. If you're doing it through CGI, of course you're incurring a lot of startup overhead, but if you know how to configure Apache you're going to be okay. Really though you should be stepping up to something better.

- JSP: apparently the only thing that can handle the kind of intense load that major real sites sustain, the Amazons of the world. It's what you use if you're going to code something properly.

- ColdFusion: the only other acceptable solution for high-performance deployment. Rapid prototyping and bulletproof back-end! Built for clustering! And it's run by Adobe who has all kinds of programming expertise and imaging libraries built into it.

- Ruby: garbage for nerds.

- Python/Django: garbage written by "scripting people" who don't understand proper programming.

- NoSQL databases and real-time databases: fad bullshit that should not be necessary if you know how to configure your database properly. (I've pointed out that Cassandra comes from Twitter and Facebook keeps developing new key-value stores and poo poo, but he says that's because they're idiots who wouldn't spring for Oracle or DB2 when they were small.)

- AJAX: nice to have, but takes too long to develop and doesn't really get you anything.

- Full-page POSTS of form data: it works, dammit! And it's way more understandable and maintainable for someone who doesn't know how AJAX stuff works. (I can appreciate this; it can be a lot more of a pain in the rear end to track down what a button does when it triggers a JS call which makes an AJAX request through jQuery and updates some part of a page that you can't examine through raw source, as opposed to just posting a page to itself and looking at the embedded code at the top. But jesus shitballs what an ugly code path and user experience)

- Apache alternatives like Nginx: pointless if you know how to configure Apache properly.

- Linux (and anything GNU): won't touch it with a ten-foot pole.

- FreeBSD: the one and only way to go, server-side. For the ZFS if nothing else. (Full disclosure: I'm as big a FreeBSD guy, I've written reference books on it, but dammit, let's face reality here, bash is simply way more usable than tcsh these days.)


He flatly refuses to use Django for anything high-profile because to him it's an insecure mess of indirections and not any kind of front-end for a filesystem, the way a traditional webserver like Apache would be. (story time: I was designing an infrastructural site to be deployed on two different systems, one Django and one ColdFusion. It took me about 2/3 of a day to put together the Django one, including the UI and back-end views for all the modules, DNS, email, FTP, and so on, plus setting up the entire installation from scratch; and then it took a few more hours to port it all over to CF. In the rush to get it out I didn't set up my Django URLs completely, so /infra/dns and /infra/email and /infra/ftp all worked, but /infra didn't point to anything; from this he concluded that Django a) took a lot longer to build anything in, and b) was an unnavigable pile of poo poo. I tried explaining that it is designed on a whitelist principle, that you're supposed to be building just a few dynamic pages and API endpoints and leave the static content to live in its own directory, and you're not trying to create some kind of discoverable URL hierarchy like in the old days; he would hear none of it and now Django is framework-non-grata. He won't even let me say the word "framework" anymore without going off on a rant. Honestly I think he hates Django purely because he despises Django Unchained for being too fruity-liberal.)


But that's all perhaps beside the point. What I want to find out about is: JSP.

I want to know, from anyone who has experience with it, what exactly the deal with JSP is. Is it (as it seems to me) a dead language for web development? Have all of its purported advantages been matched or exceeded by other platforms? How does it compare with stuff like Django and Ruby in terms of scalability and performance? If JSP is indeed still the top dog, are there any tools or tricks to make it not be so godawful to work with?

I have been running a community art site (think DA but more specialized) for the better part of 20 years. It started out as a bunch of Perl SSIs in Apache, and later accreted into a horrible mass of Perl CGIs that print out HTML generated by inline SQL and Perl logic. (MVC? Who shot who in the what now?) A few years ago I rewrote the entire thing in JSP/JSTL, and while it's better now, it still has all the SQL embedded in individual pages rather than the logic being sequestered out of the templates into views like in Django, and (what's worse) the syntax of the entire thing is just massively tedious. You're alternating between this needlessly convoluted JSTL tag language ("<c:choose>" "<c:when>" whaaaat) and a scriptlet-style flavor of Java, and I'm sorry, but Java in general makes me loving suicidal. You're importing all these dotted-domain libraries that you have no idea whether they're installed or not and have no way of finding out, and everything fails silently, aaaaa gently caress I'm getting incoherent. Anyway—that, plus you find yourself latched into commercial JavaBean components that you have to buy from companies in China or India and haven't been maintained in years, and meanwhile the JDK keeps deprecating poo poo and not replacing it with anything, and all the JSP-based frameworks like Torque and Hibernate seem to live on wikis written in broken English that haven't been maintained since 2006. It's maddening. So long story short (too late), I'm about to roll out the JSP rewrite of my site, but I would so dearly love to rewrite it again in Django, if just so I could enjoy the correctness of the database columns and the model interfaces and get all my loving data-manipulation code out of the templates and return responses in JSON instead of GOD loving FORSAKEN XML JESUS CHRIST. But I don't know if I have the wherewithal—energy or knowledge—to be able to convince him that this is the right way to build something that will sustain the kind of traffic that he recommended JSP for.

(He also hates Django because you have to put privileged information like your database keys into the config files; apparently in JSP and ColdFusion the way that would be handled would be that the keys would be compiled into a binary or entered into a GUI, and no local shell users or people writing scripts for their ~user dirs would ever have even the possibility of getting access to it. I came up with a way around this by embedding the keys into my Apache httpd.conf and making that root-only, and then passing the keys into wsgi.py via SetEnv calls in Apache; but he still thinks that's a horrorshow. But I don't know what I'm missing—in Tomcat you have to embed the keys into your context.xml the same way :confused: Unless you're compiling the whole shitball into a WAR and deploying it automatically—oh god I don't even)


So. Anyway. Does anyone have the kind of experience to give me some advice on where I should be looking here? Is Django the right kind of path to be on these days? I don't want to keep at it if I'm on the wrong track; every time I bring up some new technology like MongoDB or Node or suggest that things like that banner ad used the word "still" in relation to MySQL because such technologies are becoming rapidly outdated, I get yelled at either for a) paying attention to fads or b) implying that he is ignorant of the state of modern technology. But I do still believe that I know something of what I'm talking about, and it's making my head throb trying to write to 2008 standards when I'm almost sure there is no downside to using a more high-level thing that takes advantage of everything the world has learned in the intervening years.


Sorry this is so rambling, but thanks for bearing with me. I figure goons are as good a resource as any and all the more likely to cut to the chase.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Data Graham posted:

He flatly refuses to use Django for anything high-profile ...

Ask him if he's ever heard of Pinterest.


Edit for content: JSP is fine. Django is fine. PHP can actually be fine. MySQL is fine. PostGRES is fine(er). It's more about being aware of the limitations of your choices and being prepared to deal with them once you start scaling than the actual choices themselves in my opinion. "The new hotness" can be a poorer choice, since less people have banged their heads against its limitations yet. Except Cold Fusion. Never use Cold Fusion. Ever. I still have nightmares.

Also, you can put your sensitive stuff in server environment variables when using Django (or anything else, really.)

Lumpy fucked around with this message at 18:16 on Mar 3, 2015

revmoo
May 25, 2006

#basta

quote:

ColdFusion: the only other acceptable solution for high-performance deployment.

This guy's a loving moron and I'm guessing his role in the "emmy-winning software product" was that he ran to pickup coffee for the developers.

Thermopyle
Jul 1, 2003

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

Data Graham posted:

wall of text

Pretty much everything can be fine if used properly. Except for Cold Fusion.

I'm not sure anyone can tell you anything useful without you asking questions that are less wide-ranging.

I can tell you that all of those bullet points are just bullshit. Almost every point is the equivalent of Ford vs Chevy arguments. This is not a person you want to be working with.

Munkeymon
Aug 14, 2003

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



I'm having a real hard time believing that a community art site smaller than DA could have enough traffic that you'd have serious performance problems with your server front-end framework. Maybe JSP is slow as balls?

https://web.nvd.nist.gov/view/vuln/search-results?query=coldfusion&search_type=all&cves=on

Also anyone* getting super anal about server performance to the point they're sacrificing development time and developer sanity might as well be heating their business by burning stacks of cash.

E: * with fewer than about ~10k simultaneous users

Munkeymon fucked around with this message at 18:35 on Mar 3, 2015

kedo
Nov 27, 2007

Data Graham posted:

- Ruby: garbage for nerds.

- Python/Django: garbage written by "scripting people" who don't understand proper programming.

- AJAX: nice to have, but takes too long to develop and doesn't really get you anything.

This guy knows what he's talking about. You should definitely listen to him.

He may be opinionated but he sounds clueless, and those three bullets are hilarious examples of it. I'm not sure what good ammunition to give you except to tell him to go read a book or something. He's obviously so far out of the loop it would be pointless to argue with him. All of these languages and frameworks are tools, and the fact that he completely discards the majority of them as useless is like someone trying to convince you that hammers are worthless because they've only ever used a screwdriver.

revmoo
May 25, 2006

#basta
I know the type. Very opinionated due to the fact that they only know one way of doing things and they have a defense mechanism against anything that might expose their weaknesses.

I wouldn't work with him, up to and including finding a new job.

MonkeyMaker
May 22, 2006

What's your poison, sir?
Yeah, if anything proves that Python (and/or Django) can't handle large scale public sites it's Pinterest, Reddit, The Onion, Instagram, PBS, National Geographic, Smithsonian Magazine, YouTube (originally)...

Data Graham
Dec 28, 2009

📈📊🍪😋



Clearly I have an axe to grind, otherwise I wouldn't have written what I did; I'm under no illusions that I'm presenting an unbiased view of things. :v:

But you get where I'm coming from. I guess what I need more than anything is confidence to keep doing my own thing, because I'm never going to be able to convince him that anything is better than What He Knows Works. Hence why I'm looking more for emotional anecdotal things I can tell him about JSP or ColdFusion that might actually stick.

Like, well, this. Maybe you'll find this one amusing.

He refuses to use auto_increment primary key columns. Especially for high-traffic tables. Reason? You can get concurrency issues. When you're clustering, you can insert two rows and have them both get the same auto-assigned ID value.

What do we use instead? a "vars" table.

code:
select recordid from vars -> r

r++

update vars set recordid=r

use r for your record
Now... I have gone for years just using this godawful technique in the projects he cares about directly, and using auto_increment for everything else. I mean, we all know, don't we, that you can 100% completely trust the DB-generated inserted ID to be unique, right? That the reason it exists is so you don't have to do something like maintaining a "vars" table? But I bring it up and I get a lecture about how he has been maintaining high-traffic systems for fifteen years god dammit and this is the way they do it at IBM and maybe one day when I have the experience he does then I can lecture him about high availabilty and otherwise I can just shut up.

I put together a head-to-head test, just for my own edification. Simple little script which repeatedly hits one of two pages on the server, both of which insert a random text string into the DB, then read it out by the generated ID and compare the value with what was inserted. In one case, it uses the DB-generated auto_increment insert ID; in the other, it uses the "vars" table method. I found that out of 300 iterations, the generated-ID auto_increment method had zero discrepancies in the string comparisons; and the "vars" method had about 120.

I showed him this, first asking him what I was doing wrong, what complicating factor I was missing, what my fundamental misunderstandings might be; then ran the test. And immediately he started shouting that I was artificially creating an environment where the system was being engineered to fail; that I was using a development environment (in production, ColdFusion uses separate threads for concurrent sessions and therefore no contention can occur); that nothing would ever hit it that fast; that I was wasting his time when I should be working on something useful.

I don't know, I can't be too objective about all this. I know full well how E/N this all sounds, and I don't want to dump my meta semi-technical difficulties into this place. But sometimes a guy needs to vent a little, you know? And if in the process I can accumulate some useful anecdotes and/or coping mechanisms, so much the better.

down with slavery
Dec 23, 2013
STOP QUOTING MY POSTS SO PEOPLE THAT AREN'T IDIOTS DON'T HAVE TO READ MY FUCKING TERRIBLE OPINIONS THANKS

Data Graham posted:

- AJAX: nice to have, but takes too long to develop and doesn't really get you anything.

- Linux (and anything GNU): won't touch it with a ten-foot pole.

even aside from his bad opinions on languages, these are just hilarious

Data Graham
Dec 28, 2009

📈📊🍪😋



MonkeyMaker posted:

Yeah, if anything proves that Python (and/or Django) can't handle large scale public sites it's Pinterest, Reddit, The Onion, Instagram, PBS, National Geographic, Smithsonian Magazine, YouTube (originally)...

I've tried feeding him this list before; he's not impressed. The Onion = frivolous humor site; Pinterest = crotcheting nannies; PBS et al = not even admissible; Disqus = "down all the time" and "big privacy problems".

I need some current, well-respectable sites to draw on if possible.



E: And yes, I'm happy to come up with more-specific questions or problems in the future. This is all more or less to establish context, in the event that I'm here for a while.

Data Graham fucked around with this message at 19:22 on Mar 3, 2015

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

Data Graham posted:

I need some current, well-respectable sites to draw on if possible.

No, what you need is a new job. It doesn't matter what evidence you bring to him, this co-worker is ultimately a "bad developer" and a terrible person wrapped into one. I'd polish the old resume and start looking. There's a ton of jobs out there and you shouldn't settle for putting up with this kind of environment

jkyuusai
Jun 26, 2008

homegrown man milk

Data Graham posted:

I've tried feeding him this list before; he's not impressed. The Onion = frivolous humor site; Pinterest = crotcheting nannies; PBS et al = not even admissible; Disqus = "down all the time" and "big privacy problems".

I need some current, well-respectable sites to draw on if possible.



E: And yes, I'm happy to come up with more-specific questions or problems in the future. This is all more or less to establish context, in the event that I'm here for a while.

You're getting down in the weeds to argue with a fool. You could randomly pick something to do instead of this and there's a 99% chance whatever it is would be a more productive use of your time. Even accounting for bias in how you're presenting him, it's clear this person is definitely not interested in learning anything at that point. Disengage and move on.

edit: Also, there's a modern frontend framework thread if you had specific questions about those.

jkyuusai fucked around with this message at 19:29 on Mar 3, 2015

Thermopyle
Jul 1, 2003

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

The amount of time you should continue to work with this guy is equal to the amount of time you can find a new job.

You will not be able to change his mind, and even if you did he's still a lovely person to work with.

Data Graham
Dec 28, 2009

📈📊🍪😋



Yeah, unfortunately this is my business partnership, not my day job. Trust me, I've changed day jobs enough times in pursuit of coding nirvana, and what I'm doing right now is as close to that as I've ever been. :allears:

The situation in question is where entrepreneurship leads you. There's no disengaging from this.

revmoo
May 25, 2006

#basta

Data Graham posted:

I showed him this, first asking him what I was doing wrong, what complicating factor I was missing, what my fundamental misunderstandings might be; then ran the test. And immediately he started shouting that I was artificially creating an environment where the system was being engineered to fail; that I was using a development environment (in production, ColdFusion uses separate threads for concurrent sessions and therefore no contention can occur); that nothing would ever hit it that fast; that I was wasting his time when I should be working on something useful.


It wouldn't even matter if CF was using concurrent threads or not, the database is going to know how to appropriately manage auto-increment values. Quote:

quote:

When accessing the auto-increment counter, InnoDB uses a special table-level AUTO-INC lock that it keeps to the end of the current SQL statement, not to the end of the transaction. The special lock release strategy was introduced to improve concurrency for inserts into a table containing an AUTO_INCREMENT column. Nevertheless, two transactions cannot have the AUTO-INC lock on the same table simultaneously

Adbot
ADBOT LOVES YOU

MonkeyMaker
May 22, 2006

What's your poison, sir?
Yeah, it's toxic. Get out or get him out.

Anyone interested in teaching .NET at Treehouse? We're hiring.

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