[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/wdg/ - Web Development General
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 26
File: 1431344258923.png (747 KB, 824x553) Image search: [Google]
1431344258923.png
747 KB, 824x553
Death to PHP!

Previous thread: >>54367422

> Discord
https://discord.gg/0qLTzz5potDFXfdT

>IRC Channel
#/g/wdg @ irc.rizon.net
Web client: https://www.rizon.net/chat

>Learning material
https://www.codecademy.com/
https://www.bento.io/
https://programming-motherfucker.com/
https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md
https://www.theodinproject.com/
http://www.freecodecamp.com/
http://www.codewars.com/
>Crockford on Javascript
https://www.youtube.com/playlist?list=PL7664379246A246CB

>Frontend development
https://github.com/dypsilon/frontend-dev-bookmarks

>Backend development
https://en.wikipedia.org/wiki/Comparison_of_web_application_frameworks

>Useful tools
https://pastebin.com/q5nB1Npt/
https://libraries.io/ - Discover new open source libraries, modules and frameworks and keep track of ones you depend upon.
https://developer.mozilla.org/en-US/docs/Web - Guides for HTML, CSS, JS, Web APIs & more.
http://www.programmableweb.com/ - List of public APIs

>NEET guide to web dev employment
https://pastebin.com/4YeJAUbT/

> How to get started
http://www.youtube.com/watch?v=pB0WvcxTbCA
Good videos on the channel too
https://www.youtube.com/channel/UCVTlvUkGslCV_h-nSAId8Sw

>cheap vps hosting in most western locations
https://lowendbox.com
https://www.digitalocean.com/
https://www.linode.com/
https://www.heroku.com/
https://www.leaseweb.com
>>
first for PHP
>>
Second for Meteor and Ionic
>>
Third for dragon dildos
>>
>>54391008
I'm writing a personal project with Hack/HHVM and it's not too bad. It's nice to have something similar to structs.

But I still like go more than Hack.
>>
>>54391054
>go
It is not the C++ killer it was supposed to be, but damn it's so easy to maintain idiomatic Go code.
>>
How do I make callback properties with es6 classes? I've only used typescript before.
class Test {
public SomeEvent: (data) => void;

constructor() {
setTimeout(() => {
this.SomeEvent('event!');
}, 1000);
}
}

let test = new Test();
test.SomeEvent = (data) => {
alert(data);
};


es6 classes only seems to have getter properties or functions?
>>
>>54391172
Same way you do in TS, but without the type annotations.
class Test {    
constructor() {
setTimeout(() =>
this.SomeEvent('event!'),
1000);
}
}

let test = new Test();
test.SomeEvent = data =>
alert(data);
>>
>>54391242
okay I see, thanks.
feels kind of weird using/setting a property without defining it first.
>>
>>54391172
Class is a lie in js!
Learn classless oop!
>>
Is there a web-centric programming language other than PHP?

meaning the language was built from the ground up for web.
>>
I got drunk and learned grunt last night. I don't really remember much of it, but now I have a project set up with live reload, a few other neat plugins, and detailed notes full of wildly inappropriate metaphors.

Drunk me is an okay guy.
>>
>>54391395
JavaScript
>>
>>54391443
It can't do back-end stuff out of the box though.
>>
>>54391459
NodeJS, senpai
>>
>>54391468
that's not out of the box
>>
>>54391468
>Current roman year
>single-threaded
>>
>>54391489
It literally is though.
>>
function obj(){
}

var copy = [];

for( i=0; i < 5; i++ ){
var copy[i] = new obj();
}


Why can't I create objects in a loop and then access them by copy[i]?
>>
>>54391431
Thoughts on CodeKit?
>>
>>54391608
because obj is a function and not an object? o.O
>>
>>54391267
In all honesty, use TS, whenever you can. Some of the shit from earlier versions is stupid and redundant, but once they decided to become a superset of ES6/7, it became the best way to date of writing maintainable and robust JS code.
>>
>>54391608
you calling the function within itself?
>>
>>54391351
It's just syntactic sugar. Do you enjoy writing
Foo.prototype.bar  = () => ...
all the time?
>>
>>54391669
>>54391650
Obj() is an object constructor with several values. I want to create five different objects in a loop so as to get copy1, copy2, copy3, etc.
>>
Why is doctrine the most awesome bloatware ever made?
>>
>>54391575
Let me rephrase, a language that's built from the ground up to handle the fornt and back end without the need for any add-ons or modification.

whilst node.js is out of the box, because it is based on js, the back-end leaves something to be desired.
>>
>>54391766
k
>>
>>54391749
How do you like Symfony so far?
>>
>>54391631
Never used it. Looks like a nice way to get off the ground quickly without having to learn a bunch of boring setup stuff though.
>>
>>54391843
I haven't done much until now, but since 90% of web jobs in Switzerland require symfony I decided to give it a go.

It's very clean, logic, and nice to use. I did the error of using the latest stable instead of the lts, so many components don't work yet if I don't use their unstable branches. For example, I can't make the SonataAdminBundle work.

so far so good, actually.
Coming from Java btw, haven't done much web development n my life.
>>
File: 1451731306915.jpg (122 KB, 600x600) Image search: [Google]
1451731306915.jpg
122 KB, 600x600
Sup nerds

I like CoffeeCup, but I'm poor. I want something similiar to it but 100% free as in gratis. Care to reccommend?

Pic unrelated
>>
Is there a nodemon equivalent for Python?
>>
>>54391868
I actually went from grunt to gulp to codekit. I've worked on relatively small projects lately and hated having 20+ node_modules folders.
>>
>>54391608
Re-declare the "copy" variable in a different way? I'm way too sleepy to know what language syntax that is, but usually it needs to be able to accept arrays.
>>
>>54392060
Oh fuck nevermind, didn't know nodemon works for both Python and Node. Was pleasantly surprised.
>>
>>54391608

function obj(){
}

var copy = [];

for(var i=0; i < 5; i++ ){
copy.push(new obj());
}
>>
>>54392130
So, is codekit faster to use than a gulpfile.js? Is it worth the 32 bucks? Is it as annoying as the webpage?
>>
DQL is so fucking awesome
>>
>>54392398
>fapping with other men
>>
>>54392354
I haven't noticed any big drawbacks in performance. If by speed you mean setting up your project and actually start coding, then it is much faster. There is a new and less annoying version coming soon I think.
>>
File: 1461096677933.gif (308 KB, 495x371) Image search: [Google]
1461096677933.gif
308 KB, 495x371
>>54393069
Well in the time you answered I downloaded it and found it's a really nice program. I can do the same stuff I do with gulp or grunt but also have a nice livereload and an url I can look in the mobile device. So thanks for the tip!
Maybe for more complex stuff gulp is still necessary but my workflow is really simple atm.
>>
Why the fuck is Node such a pain in the ass.

I've got this in my scripts in package.json:
"build": "node ./node_modules/browserify/bin/cmd.js -t [ babelify ] src/app.js -o build/app.js",


When I run "npm build", it results in empty build/app.js file, but when I run that line manually from the command line, it outputs the correct code in app.js, what gives?
>>
>Take a look at PHP RFCs for the first time
>Callable Typehinting, Pipe operator, named arguments, typed properties, traits implementing interfaces, nullables, reflectable attributes, generics, short lambda syntax...
>Holy shit, if those got implemented, the language would actually be pretty sweet!
>Eventually find out that those are basically all just bad copies from hack, which already has all of those
>Also find out that those require a 2/3+1 majority by the morons who call themselves "PHP Core dev" to be accepted
>Those morons already declined some, like short lambdas and C# style properties because it "could be confusing (To PHP developers)
>Those RFCs being implemented: Never ever

You know, I'm actually thinking about giving hack a try. It has the features I want, the performance I want and you don't have to wait for it to recompile after every change, like Java. Unlike PHP's devs, Facebook's dev team actually seems to know what makes a good language.
Does it already have proper IDEs, frameworks and community support?
>>
>>54391608
You could make copy an object instead of an array.
If you want to use an array, you will need to call push instead of setting the index.
>>
>>54391948
What is this SonataAdminBundle good for? I have used Symfony for almost a Year now, but I never used that.
>>
>>54393840
it's a pre-made admin backend for basic CRUD stuff. It's great.
>>
>>54394109
But what does it do? Automatically create list / details / edit / delete views for all your entities? That would indeed be quite cool.

I just launched a demo container on their site. Do they also allow clients to create their own pages by just clicking them together? Because that is EXACTLY what I need for an application that I'm currently working on. That is, if you can still give some specific rules for this websites and the forms it contains, if those forms are very specific and complex (you never know how bad form handling can get until you need to handle user-generated fields of any type, seriously).
>>
>>54393800
>>Those morons already declined some, like short lambdas and C# style properties because it "could be confusing (To PHP developers)

Well they probably aren't wrong....
>>
>>54394169
>But what does it do? Automatically create list / details / edit / delete views for all your entities? That would indeed be quite cool.
exactly this. And it's very customizable. Still, it has every needed default convention for most use cases.
>>
>>54394180
I know. I mean, just look at PHP developers, holy shit. They actually think that their barebones OOP that is just a terrible clone of Java's is "complex" and "fleshed out".
>>
>>54393797
>Why the fuck is Node such a pain in the ass
Flask is comfy as fuck brah, switch to Python.
>>
>>54394195
I see. That's pretty cool then. Would save me a lot of time making those over and over again. Symfony's generatorBundle does a poor job once your entities get at least a tiny bit complex.

How well does this admin bundle handle entities that are "children" of other entities? For example, in my application, nearly all entities relate to one parent entity, which appears in the URL basically all the time. So for example, whenever I need to generate a URL to it, I don't just say generate('cockshit' ['id' => $id]); but generate('cockshit' ['parentIdentifier' => $parent->getIdentifier(), 'id' => $id]);

Symfony and its generators by itself don't handle this that well.
>>
>>54394245
Oh, I'm using Flask extensively because I do backend stuff (although I'm not that much into web development) but I'm working on an "application" based on Electron that's from webdev standpoint could be called purely front-end, that's why I'm using node for development (so I can manage dependencies and build it for the "browser"). Still it's weird that the command fails through package.json script (with no error in stdout/stderr) but works fine when I execute it manually.
>>
>>54394245
>It came out of an April Fool's joke but proved popular enough to make into a serious application in its own right

Jesus Christ, PHP is literally so awful that people have made april fools jokes that are better at handling web requests.
>>
So I learned Laravel pretty good, but then discovered that there are literally no jobs, so now I'm learning rails. They're pretty similar so I'm thinking I should be able to pick it up quickly and hopefully get a job within the month.
>>
>>54394294
Requesting sauce on the "better at handling web requests" part
>>
>>54394281
>>54393797

I figured it out, apparently I need to use "npm run build" instead of "npm build", which is weird because "npm start" executes the script for "start", but "npm build" won't execute the build script, whatever.
>>
>>54391749
>all that convoluted and bloated code to scrape porn websites

lmfao.
>>
>>54394799
This. Just fucking write a single file Perl script in half an hour
>>
My boss is an idiot and got his password to one of our shitty WordPress marketing sites phished or stolen. He made me log all log in attempts failed or otherwise and this is what I threw together. I almost never do anything flat file related with PHP so I just wanna make sure this isn't too shitty. Opinions?

function log_login($user, $username, $password) {
global $logpath;

if(!empty($username)) {
$logstr = date("m-d-Y G:i:s", time()) . ": $username" . '@' . $_SERVER['REMOTE_ADDR'];
$userobjclass = get_class($user);
$pwd = 'N/A';

if(!empty($_POST['pwd']))
$pwd = $_POST['pwd'];

if($userobjclass !== 'WP_User')
$logstr .= " (Failed w/ '$pwd')";

$logstr = htmlentities($logstr);

file_put_contents($logpath, "$logstr\n", FILE_APPEND);
return $user;
}
}
>>
>>54394906
And here's a shitty little page to view the log so he can have peace of mind and let me do my non-WordPress shit in peace

global $logpath;

$logcleared = 0;
$logstr = "<em>The login log is currently empty.</em>";

if(!(empty($_POST['trusp_clearlog'])) && ($_POST['trusp_clearlog'] === '1')) {
if(file_exists($logpath))
unlink($logpath);

$logcleared = 1;
}
else {
if(file_exists($logpath))
$logstr = file_get_contents($logpath);
}
?>

<div class="wrap">
<?php if($logcleared === 1): ?>

<div id="message" class="updated notice notice-success">
<p>Log cleared.</p>
</div>

<?php endif ?>

<form method="post">
<input type="hidden" name="trusp_clearlog" value="1">

<h2>Login Logs</h2>
<?php submit_button("Clear Log") ?>
<pre><?= $logstr ?></pre>
<?php submit_button("Clear Log") ?>
</form>
</div>
>>
>>54394799
Well, he is a PHP developer.

Without a thick fat layer of abstraction like Symfony with Doctrine DBAL & ORM, this language can't do anything except creating serious vulnerabilities for your server, your company and your customers.
>>
>>54394953
I'm glad I took the time to learn a little more about SQL than SELECT * FROM whatever -> filter everything client side. Our biggest application's code base has all raw SQL and one of our interview questions is asking what some of the more simple queries do. Almost everyone gets thrown off the second they see PDO and don't even bother to look at the actual query. Everyone else gets stuck on JOINs and sub queries. I'm going to have this job forever because literally all PHP devs are idiots
>>
>>54394996
Yeah, me too. I didn't actually mean to insult you (even though I did, sorry for that), I just have terrible experience with fellow PHP developers and PHP as a language.

SQL injections are a serious issue. Why? Because they are so hard to avoid?
No. It's because PHP developers are fucking retards who simply have no idea WHATSOEVER. If you ever do string concatenation in a query and your alarm bells don't ring, then please quit your job, damn it...

Most people don't understand how easily injections are prevented via prepared statements. My boss doesn't believe me. He wants me to use a web application firewall for all my software because he believes that SQL injections could happen.
How? I never do fucking string concatenation in my queries. I also use a templating language that auto-escapes every variable (which basically every proper templating language [Thus, not PHP] does by default) and explicitly requires me to say "Yes, please, please give me the raw output from this variable" if I'm 100% sure that is clean.

Literally everything and everyone close to PHP is retarded. Those that are not are trying to get away from it.
>>
File: 1458939287502.gif (822 KB, 600x366) Image search: [Google]
1458939287502.gif
822 KB, 600x366
>>54394906
>Wordpress

I'm so sorry anon
>>
>tfw Django job
lads this is the most fun I've had programming in 2 decades
>>
>>54395087
I'm not a developer (but I am a information security guy)

every joe knows to do paremeritized queries in SQL, in every language, PHP especially
>>
where do I start learning django provided I have almost no experience with python?
>>
>>54395122
what programming experience do you have? In any case, you'll be learning both at the same time, but it's very batteries-included so it won't be too tough to get things together
>>
>>54395164
just basic python & php
>>
>>54395106
Yeah we still have a bunch of things left over from when our old "CTO" was still bossing me around. I want to transition all of our marketing shit to one of those static site generators, but I'm not sure how I'd implement some of our SEO tricks that do too much good to be lost in the transition. Its not that bad though. I had to go through hell last year replacing a bunch of shitty Pajeet tier plugins and themes with my own shit and since then its been pretty smooth. Every once in a while I need to actually write something new, and end up holding myself back from punching my monitor since WordPress's developer documentation is pure shit. Anything and everything you're looking for is a major version or two out of date or simply missing altogether
>>
>>54395174
you're set. Start with the tutorials and make a blog using generic views
>>
>>54395182
is there any particular tutorial you would recommend? what worries me the most is my code is usually pretty disgusting looking I'd like to learn how to make it nice and clean along the way instead of just mashing shit together
>>
>>54395087
I'm not a PHP developer primarily and I'm not the guy who posted that porn site scraper so don't worry about it. I work with Perl primarily because I'm a rare breed of autist. I just happen to be better at PHP than everyone else we've interviewed, so I'm stuck maintaining our old PHP shit
>>
>>54395120
What wonderful planet do you live on and how do I get there?
>>
>>54395181
SEO is just literally reading google and bing and modifying your <head> tags to have the proper data. And sitemaps.


And dude, all the competent new publications ar eswitching to build-based and static content now. It significantly lowers the cost of upkeep (db and app server gone ; only web server needed).
>>
>>54395192
The official ones, and as long as your code is readable and makes sense, you shouldn't worry. Try not to abuse clever tricks (note that map, reduce, filter are important tricks) and it'll flow smoothly
>>
>>54395210
Canada
>>
>>54395217
Its not really up to me what we do SEO wise. My adderall addicted boss is a self proclaimed SEO "ninja" and while he lets me do whatever the fuck I want otherwise, anything marketing related has to be approved by him first. So I'm stuck spinning content and targeting location based results
>>
>>54395264
I'm sorry...

you couldn't pay me to work with PHP

Ruby maybe,

PHP is just pajeet tier
>>
>>54395304
Everything is pajeet tier to you morons.
>>
File: GKjG6b2.png (176 KB, 574x718) Image search: [Google]
GKjG6b2.png
176 KB, 574x718
>>54395327
Say what you want, but Pajeet still has a very clear definition. Sure, maybe it'll join the ranks of autism one day but for now its still a very targeted insult
>>
I asked this in /dpt/ but they told me to come here.

So, here it is:

/g/, I'm wondering if you can help me out a sec.
This is beyond my level of code as I'm new, but I want to create something (for GreaseMonkey) that will automatically close a certain type of website.

For example, say I'm buying shit on Amazon. I want it to automatically close when it's something like:

https://www.amazon.co.uk/gp/digital/fiona/thank-you [and everything that follows in the URL from that]
https://www.amazon.co.uk/gp/digital/fiona/clarification/purchased [and everything that follows in the URL from that]

What should I be looking at doing, or is there something like this already?

I seem to be spending a lot of time closing tabs for things after they've finished, but I can't just right click and 'close all', because not everything has finished.

Help?
>>
>>54395304
Again, I don't work with PHP primarily. I just maintain old shit that's left over from when our old "CTO" was still in charge. There were a few months of hell where I had to replace all of our Pajeet-tier plugins and themes, but since then its been smooth sailing since I'm not a retard and can write shit that doesn't break with every WordPress update
>>
>>54395327
Java + Spring and PHP without Laravel about sums it up
>>
>>54395327
Pajeet tier is just a meme for "poo" tier

anyone can commit a pajeet tier, believe me
>>
QUESTION

How long to learn rails if i know php + frameworks?
>>
>>54395217
So instead of a DB you have all your data in a shit ton of files? How's that going to help anyone?
>>
is there any prettier way to get a bunch of element references instead of putting them all into variables once?
maybe something where I don't have to give everything an id/class?

I want to avoid having to do this every time.
const buttonOk = document.getElementById('button-ok');
const buttonCancel = document.getElementById('button-cancel');
const buttonClose = document.getElementById('button-close');


it adds up.
>>
>>54395671
You don't have to run a database server. I don't see how that isn't an advantage
>>
>>54395371
REEEEEEEEEEEEEEEEEEEEEEEE
>>
>>54395416
Now if only Laravel wasn't as slow as a snail stapled to a cardboard box, that bleeds network errors under the slightest load.
>>
>>54395811
Then just use SQLite or LevelDB.
>>
>>54395671
If you have a lot of records, running a local db for builds aint bad.

Ideally your builder should know when to regenerate the entire index or not (based on changes)
>>
>>54395373
Write a userscript that runs on all amazon pages and calls window.close(), when need be.
>>
>>54395989
And roll my own CMS around it? Use something less popular and likely less supported than Wordpress? No thanks, I'd rather just use a static site generator.

By the way, I'm already using WordPress. Keep track of the convo
>>
>>54395955
Or you could just use another language with another framework. I only claimed Laravel was one of the few ways to write non-Pajeet code in PHP.
>>
>>54395373
Seems pretty straightforward. What are you having difficulty with?

indexOf("clarification/purchased"); window.close();
>>
>>54395371
I don't mean to discriminate, but is PHP the only language taught in India or something? It's kike they all default to it.
>>
>>54396330
They also teach Java.
>>
>>54396330
>kike
Shit, I mean like*

>>54396395
Wouldn't be surprised if they teach Perl too desu.
>>
>>54395371
lol, that's pretty funny.
>>
>>54396428
>>kike
>Shit, I mean like*
suuure you do.
>>
>>54395327
For retarded /g/ NEETs, popular == pajeet
>>
File: 1434188138370.jpg (18 KB, 500x281) Image search: [Google]
1434188138370.jpg
18 KB, 500x281
>>54391008
So /wdg/, where were you when React got blown the fuck away?

https://www.youtube.com/watch?v=J5Bvy4KhIs0
>>
File: 1432259490310.jpg (68 KB, 700x700) Image search: [Google]
1432259490310.jpg
68 KB, 700x700
>been studying web development for a few months now
>started with basics, html, css, javascript, jquery
>started learning ASP.NET
>mfw trying to learn about MVC, EF7, and all the other shit in the microsoft stack
>mfw realizing i have no idea what im doing
>give up on ASP.NET, start checking out some other frameworks
>decide on node because I think I have a decent grasp of javascript at this point
>mfw watching all these videos and reading all these docs and feel like im still not learning anything
>mfw trying to relearn html for templating engines
>mfw trying to relearn javascript for node, express, angular, react
>mfw realizing I don't have a solid enough understanding of the basics of TCP/IP, DNS, CRUD, [insert network acronym here]
>mfw trying to learn all these new things and forgetting how to do simple things like manipulate the dom
>mfw can't decide on a framework to learn, so I end up learning nothing in depth
>mfw rewatching the same videos on node, express, angular while retaining nothing
>mfw tumbling through the abyss
>>
>>54396482
homie you're late, angular made react irrelevant years ago
>>
I'm trying to learn prepared statements with OO mysqli connections.

What is %s?

I went from $conn->query to preparing my statements, but can I just execute and have everything work normally?
>>
>>54396528
build something and deploy it you dumb fuck

look up every single thing and copy/paste code if you have to

do this for 5 projects over the next 2 months and you will understand the full scope
>>
>>54396553
http://www.tutorialspoint.com/sql/sql-wildcards.htm
>>
>>54396528
>impossible number of frameworks to learn
>tutorials that explain fuck all
Web development has been this way since like 1995.

Have fun. :-)
>>
>>54395087
>HURR HE USES PHP, HE CAN'T WRITE QUERIES
>>
>>54396528
> bawww why can I have years of experience in a few months? I'd better give up.

Please, stop being retarded.
>>
File: 1462202612168.jpg (85 KB, 451x425) Image search: [Google]
1462202612168.jpg
85 KB, 451x425
>>54391749
Reminds me of Java.
>>
>>54396698
                                                                                               INNER JOIN
>>
Jinja2, Mako or Django?
>>
>>54396624
I get that, what I don't get is it's use here

if ($stmt = $mysqli->prepare("SELECT District FROM City WHERE Name=?")) {

/* bind parameters for markers */
$stmt->bind_param("s", $city);

/* execute query */
$stmt->execute();

/* bind result variables */
$stmt->bind_result($district);

/* fetch value */
$stmt->fetch();

printf("%s is in district %s\n", $city, $district);

/* close statement */
$stmt->close();
}


I can't prepare a query and then just $conn->query($stmt); like usual?

I have to execute and bind results then access with %s? The fuck is this, this can't be right. No way prepared statements are this different.

Here's what I have

$sql = $conn->prepare("SELECT lati, longi FROM geocode WHERE city=? AND state=? LIMIT 1");
$sql2 = $conn->prepare("SELECT state, city, lati, longi FROM geocode WHERE state=?");
$sql->bind_param("ss", $city, $state);
$sql2->bind_param("s", $state);
$result1 = $conn->query($sql);
$result2 = $conn->query($sql2);

$pulled_lat1;
$pulled_lat2;
$pulled_long1;
$pulled_long2;

if ($result1->num_rows >0) {

//Getting cordinates of original city/state
while($row = $result1->fetch_assoc()) {
$pulled_lat1 = $row["lati"];
$pulled_long1 = $row["longi"];
}


Notice I need to fetch_assoc for my while loop.
>>
>>54396528
>TCP/IP,
>DNS

>for webdev

Nigger please.
>>
>>54396755
Django
>>
A question to anyone who started out in a small town

How did you actually land a job? I've been programming for about a year or two now, and when searching for any kind of tech jobs, there is nothing.

I live in a pretty labor/retail based town, and there are rarely any tech jobs, at least that is allowing new developers.
>>
>>54396865
isn't Jinja2 faster?
>>
>>54396886
Not sure, every project we have at work uses Jinja2, but I've not run any benchmarks. I only say Django because I haven't run into any templating issues or instances where I need something more than it provides. But if you've done your research and jinja2 is more appealing, go for it
>>
>>54396528
start off small. make a website with just basic html (tables). the next step is learning to deal work with divs and basic css. you can learn javascript after that. once you've learned js you can start working withg jquery and angular.

after that you're gonna write your own blog from scratch. learn a backend language and a database. work with forms so you can register an account, login and post blog entries. you can work on this blog while learning your backend language and working with a database.

after that you can learn a framework for your chosen backend language.

get used to looking shit up on the internet.

if you're a neet living with their parents with a lot of time to spare you should be able to call yourself a somewhat competent web after 1-3 years.

alternatively - javascript is really just there to add some bonus shit to your websites. you don't need it at all for a functional website.
>>
Hey guys, what am I doing wrong here?


$sql = $conn->prepare("SELECT lati, longi FROM geocode WHERE city=? AND state=? LIMIT 1");
$sql2 = $conn->prepare("SELECT state, city, lati, longi FROM geocode WHERE state=?");
$sql->bind_param("ss", $city, $state);
$sql2->bind_param("s", $state);
$sql->execute();
$sql2->execute();

$sql->bind_result($lati, $longi);
$sql2->bind_result($state, $city, $lati, $longi);

if ($sql->num_rows >0) {
//this doesn't work

while($row = $sql->fetch_assoc()) {
//this doesn't work
}
>>
https://realpython.com/

could someone upload a copy of this? is it even worth it?
>>
>>54396960
I dont know havent used php in a while, try var_dumping all your variables and see if they make sense
>>
>>54396960
sqli is so fucking autistic
use PDO
>>
>>54397114
Any idea what's wrong though? I use PDO for other stuff. Want to get the hang of OO mysqli
>>
I'm trying to teach myself rails, and am just running out of ideas to make. I don't want to make a Twitter or Instagram clone. I love fixing bugs at work, but thinking of something from scratch is difficult. Had a great idea, thought about it for a couple hours, concluded the idea was stupid and nobody would ever use it.
>>
Maybe this is a noob question, but what's the best way to enforce time limits between submitting content or to keep people from voting multiple times on your website?

How does 4chan identify posters? Is it a user-agent + IP combo?

Sessions are easy to lose when user clears cookies, multiple users can share a single IP and user-agents can be easily switched.

Is temporary IP blocking (if I block known proxy IPs) the best way to do this?
>>
>>54397219
That's what I do.

I limit posts based on IP. I store every IP ever connected with a banned boolean column and a last_post timestamp column.
>>
>>54397219
I believe 4chan stores ban data through
- 4chan pass account
- IP
- cookies
Or at least that's my experience through previous attempts at ban-evading
>>
>>54396770
You can pass a array with the values in $conn->query();
>>
>>54396960
Someone has to know why this doesn't work.
>>
>>54397249
>>54397274
Thanks, guise.
>>
>>54392011
cmon guise
>>
>>54396770
>I get that, what I don't get is it's use here
I don't know either since I usually use echo instead of printf.

I don't fully understand what you're asking in the second bit, but
$sql = $conn->prepare("SELECT lati, longi FROM geocode WHERE city=? AND state=? LIMIT 1");
$sql->execute();
$result = $sql->fetchAll();

With the code above everything that gets returned by the query is stored in $result. You then have to loop through it with a while loop to get the result.
>>
>>54396879
Move out of redneckville.
>>
File: Selection_453.png (191 KB, 948x488) Image search: [Google]
Selection_453.png
191 KB, 948x488
my girlfriend is learning javascript since a week now. Now she's trying to fizzbuzz and will therefore soon be better than 99% of this thread.
>>
>>54397563
>chink
>>
Well codeviking sent me a mail, i failed the last part

i had to remove duplicate numbers in an array, i didn't know how to use splice properly kill me, i'm not fit to be a programmer
>>
>>54397563
>chink
>>
>>54397563
>my girlfriend
Lads, look at this fancy motherfucker.
>>
>>54397563
>Needs help with fizzbuzz
Tut mir leid, sie ist retardiert
>>
>>54397629
Viking school, sorry i forgot codeviking was the website.

I feel so sad fampais i might start to apply for Mcdonalds
>>
>>54396428
>Perl
Nobody teaches Perl. Its something that comes to you when your virginity reaches critical mass. Trust me, Perl is my favorite language.

Java is India's second favorite language.
>>
>>54397563
I literally had to fizzbuzz an exam, my my she's a special one
>>
>>54396537
Didn't react come after Angular? Isn't react slowly making Angular irrelevant outside of enterprise shit that just found out that SPAs are a thing?
>>
>>54397511
Still not working.

This is very odd.

I can't even echo the results.

also I always use print_r
>>
>>54397024
Probably not. I learned Python in a day messing around with Google's gdata libraries
>>
>>54391008

we're switching our frontend from angular 1 to angular 2

adv?
>>
>>54397793
Quit job
>>
Anons help. How do I differentiate between different Celery jobs client-side? A user can start multiple different jobs, each has its own ID. How can I make it so the user know which ID belongs to which type of job?
A possible solution is prefixing the ID's with some kind of identifier for each job?
>>
>>54397673
What you do is you get a regular shit-tier job and you work to make yourself better so you can get a real web dev job.

That's what I'm doing.
>>
Web dev is less interesting than coding dishwashers

When coding dishwashers, you work with an embedded system with limited resources and you need to know university mathematics such as fuzzy logic, control theory and differential equations to control the washing procedure.

Meanwhile when you code a webpage you just do some HTML and CSS, call some libraries and connect to your MemeSQL database.
>>
>>54397915
Math is gay.
>>
How the fuck do I write modular javascript code? Everything is dumped in one big js file now.
>>
>>54398090
webpack, use it's code splitting functionality
>>
>>54398133
What the FUCK. I thought webpack was a meme??
>>
If anyone has Python setup can you run these and tell me if it works.

pip install flask-mysql

pip install python-MySQLdb


I cant install either no matter what I try. I've tried multiple documentations, watched tutorials and they seem to have no problem installing them. This is what I hate about programming, even when you follow the docs sometimes shit just doesnt work.
>>
>>54398190
It is anon
>>
>tfw my favorite library hasn't been updated in months
It's dead isn't it
>>
>>54398209
what's the error that you're getting?
>>
>>54391678
don`t use `this` nether...
classless means: use functions to generate objects....
>>
File: pip.png (41 KB, 645x600) Image search: [Google]
pip.png
41 KB, 645x600
>>54398304
It is a long list of errors so I copied the last part. Is the part in the yellow what I should be trying to fix?
This is after I run
pip install flask-mysql
>>
File: 1443402079755.png (875 KB, 968x745) Image search: [Google]
1443402079755.png
875 KB, 968x745
>>54398403
>windows
>>
>>54398426
Shut up you libre fag
>>
Should I start learning web dev with Ruby, PHP or Python (or maybe Java)?
>>
Hello web masters, is there a sage who can help me?

I'm completely new to blogging and I'm looking for a way to promote it, right now I have no idea and linked in is my las resource, please help me. Any tips apreciate it, I'm a programmer and my blog will be a test to see if I can host a website and will work.

I really need help, don't want to abandon this idea
>>
>>54397963
T. Rajesh
>>
>>54398535
Just Google SEO man.
1. Write good content
2. Get links (that aren't nofollow) from websites that are popular and reliable
3. Find a way to talk to people about your website. So do actual marketing.
And then it might still take months of activity until Google really picks your site up.
>>
>>54398452
Superior Gentoo master-rice representing, am I rite? Yeah boi
>>
Why does every client contact me with "I need a simple site" when the site is anything but simple?

>What's your budget for the fully-fledged tournament website using Twitch API to post streams of staff, tourney brackets and team signups/information as well as blog?
Oh I was thinking 300 dollars
>>
>>54398929
I just need a one page website though. A search engine like Google.
>>
>>54399016
How do you tell them no?

I always ask for their budget to see if I can get more (they always low-ball)

If it's < 400 I offer to make a landing page with their logo and an email with a year of hosting (free host, lel)

400-1000 = WordPress
>>
>>54399101
Make an estimation of the hours you would make + some extra. Then you have a starting point to negotiate from. Will it be a smaller site or a higher budget? If you like to give them a discount you just increase the price.
>>
>>54392895
it's not gay if the balls don't touch

<spoiler>the balls touch!</spoiler>
>>
>>54398452
If you're doing web dev on Windows you'd better be using IIS and ASP.NET. Anything else isn't worth the hassle. Its never going to run as well as it would under OS X and Linux. Nothing to do with free software, just different tools for different jobs
>>
I'm a webdev noob (embedded programmer) making a piss easy web app in node, it's pretty much all done abut for authing everyone talks about using passport with ten other things, all I need is local auth in a postgres db, do I do it myself or use passport?
>>
Fuck prepared statements.

There is no god damn reason it should change so much shit. For instance, I can't fucking num_rows anymore. I have to countRow(), not only does that for somereason take 10x longer than num_row, but nothing works after that anyways.

I can't fetch_assoc my results in a while loop, but can before the while loop and I can actually write a while loop to post parts of the defined row unless it's in the rowCount() conditional where it needs to be greater than 0. Funny how it says 1, but won't do shit.

They need to rewrite all of this, it's all fucking stupid, mysql, mysqli, pdo. Everything fucks up when preparing statements for no god damn reason. My non-prepared statements work flawless, then you prepare and nothing works! Amazing!
>>
>>54399101
wait people will actually give you money to do this?
>>
>>54395371
This is a classic example of developers who don't understand their infrastructure.
>>
>>54400274
Actually different tools for the same jobs.
>>
>>54401252
If they don't have money for what they want then you offer alternatives. Just like any other sales job.
>>
>>54397503
WELL THANK YOU FOR NOTHING ASSHOLES
>>
>>54400274
Please tell me how setting up Python on Windows will yield different results from doing the same on Windows.
>>
>>54402027
same on Linux*
>>
>>54402027
In addition to the amount of time you'll spend trying to get it working in the first place, you'll need to waste additional time find work arounds half of the modules/whatever they're called in Python when they don't work as expected. The same can be said for anything that isn't ASP.NET. This isn't really news
>>
>>54400748
Pajeet detected
>>
>>54402047
I have Bash on Windows and it still has its fair share of issues. Building and deploying on Linux or OS X feels more native as it is currently. Additionally, I often use other *nix tools even for smaller tasks that automate some processes.

Like the other anon said, some modules don't even work in the first place. Some just don't install, and MS has a really fucked up way of handling permissions.

Linux, or even OS X if you're looking for something as comfy as Windows, just werks. I personally would use Linux because you can configure your environment even more to suit your personal development preferences
>>
How come when I do this:
import { Home, MainMenu, NewProject } from './components'


All of those come out as undefined, but if I do:
import obj from './components'

let Home = obj.Home;
let MainMenu = obj.MainMenu;
let NewProject = obj.NewProject;


They're all fine?

Component's index is:
import Home from './Home';
import MainMenu from './MainMenu';
import NewProject from './NewProject';

export default
{
Home,
MainMenu,
NewProject
};

>>
>>54402374
you are exporting it incorrectly

export default means that it's the thing that gets exported by default when you don't specify what you want to import

you are exporting an object when you should be exporting 3 different things

read up on the syntax
>>
Looking for a new language / framework

I already know
>PHP+ framework (Phalcon, laravel)
>node.js
>C# MVC5 (this is fucking painful since I hate type sensitive languages for web)
>>
>>54402958
Python/Django is ridiculously fun. Add angular and you're set m8
>>
>>54402491
Okay, thank you, getting rid of the default keyword fixed the issue, that's weird though, I based it off a boilerplate project where they've done that with the default.
>>
>>54402982
Thanks
>>
>>54402982
Not him but, is Angular really that awesome? It kinda looks like it, but I'm really suspicious of the ton of front end frameworks that are praised by the masses.
I really want to change my link based page to a single app though.
>>
>>54396960
Execute
>>
Why the fuck are rails and django so complicated compared to flask and express.js? I'm only two pages into a django tutorial and I don't know what any of the things I'm typing in do
>>
>>54404093
They do a lot more. Huge frameworks like that aren't really in style these days anyways so don't bother
>>
>>54404172
>Huge frameworks like that aren't really in style these days anyways so don't bother
>>
File: salt_cavern.png (871 KB, 1108x960) Image search: [Google]
salt_cavern.png
871 KB, 1108x960
Pic related is a website that I'm making. To me it looks kinda dated and ugly. What are some design tweaks that I can make to make my site look more modern. anything will help thanks.
>>
>>54404696
dont use drop shadows change the colours to anything but tan. change the font to a sans serif and replace the picture of the lake with something else or just removie it
>>
what IDE do you use for python?
PyCharms takes AGES to load it's kinda irritating
>>
>>54404762
something like this?
>>
>>54404860
yes exactly
>>
File: salt_cavern.png (399 KB, 1106x961) Image search: [Google]
salt_cavern.png
399 KB, 1106x961
>>54404860
forgot img...
>>
>>54404865
man web 2.0 is really boring looking :/ how can i tastefully add images to websites without tacky-ing it up?
>>
>>54391766
Java applets. Build once, run everywhere!
>>
>>54404093
Because they have a lot more functionality. Django comes with an ORM, a template language (that it maintains rather than Flask's packaging Jinja), internationalization framework, a considerably larger routing system than Flask, a dev server (as opposed to packaging werkzeug), a lot of logic around generic views, and a whole slew of utilities for dealing with things like time, dynamic copy, and markup decoupling.

Django was designed by working professionals largely for working professionals, it comes with good implementations of things you'll implement a hundred times over a career but if you've never implemented them once before it's hard to appreciate the fact that Django gives them to you.
>>
Why do so many autismos on /g/ hate AngularJS?
>>
>>54404870
Bigger font
Simpler like 2 color color scheme
Just write it in Helvetica or open sans
Write the text in white with no outline around it
The banner on the top needs to not have any space above it
Try to think of balance maybe giving the image an even space around it would help
>>
>>54405272
you mean like this. its so plane and boring.
>>
File: salt_cavern.png (304 KB, 1106x965) Image search: [Google]
salt_cavern.png
304 KB, 1106x965
>>54405345
>>
I work with php, maintaining an old codeigniter project, and making new small sites/web apps using slim 2 micro-framework, twig templates, with standard jquery and ajax stuffs.

What's the modern js stuff I should learn to go with slim? Angular or react or something???
>>
OP has too many links. I know PHP and Ruby on rails but my javascript knowledge is fucking shit because I have no class on it on college for some retarded reason, they assume we'll study it on our own.

Anyway, what's the best website to learn it, solidly?
>>
Can someone please post some pseudocode on how to implement the following:

>get list of links and output the html for them
>highlight the link if it's for the current page, or an ancestor
>if link is highlighted (i.e. link is for the current page or an ancestor), get children, and highlight if needed

I'm especially having trouble with the part where I need to write a loop so that everytime an ancestor (or the current page) is found, the child pages need to be outputted and then highlighted if needed.
>>
>>54398344
I like to use functional, when I can, but some problems require OOP. Particularly stateful problems like models with attached views with attached elements.
>>
>>54405665
http://eloquentjavascript.net/
>>
>>54405157
It's slow.
>>
File: file.png (5 KB, 329x177) Image search: [Google]
file.png
5 KB, 329x177
>>54405755
Okay, I'm looking at this and I can't take it seriously
>>
>>54395181
>WordPress's developer documentation is pure shit
you're shit
it's been around so long, the documentation is pretty solid. you're probably just shit at reading or comprehension
>>
>>54405817
In that case try picking up your browser and rubbing it against your dick until you absorb the knowledge through your pores
>>
>>54405851
I tried but that only got the botnet on my dick
>>
How do people get their wordpress websites hacked? Are you pajeets using literally everything premade?
>>
>>54405945
people don't update to fix security holes and someone someone abuses them.
>>
>>54395743
You can create a function that takes the button as argument like 'ok' and find it by string concatenation or simply pass whole string like 'button-ok'
>>
How good is https://www.bento.io/
>>
File: 1347154172309144.jpg (21 KB, 440x368) Image search: [Google]
1347154172309144.jpg
21 KB, 440x368
>>54405721
pls
>>
I don't know how to give quotes.

What they want is basically a custom minimalist themed WordPress website with new, staff, forums and a page using a video API I don't know how to use yet.
>>
Estimate how many hours it'll take to do, double that, multiply it by your hourly rate, then add anything you'll have to buy like hosting or whatever.
>>
>>54406932
replying to >>54406797
>>
Reminder that Webassembly will kill Javascript
>>
Is it possible to just use wordpress for a single page?

Like if they want a site with a certain theme that you can handmake, but then they want a blog section.

Could I use WordPress so they could login and make posts to the News page without having the website WordPress?
>>
>>54400748
PDO is your best line of defense against SQL injection. Learn how to use the functions properly and you won't have a reason to complain.
>>
>>54406995

Pajeet

Pajeet, pls
>>
>>54406995
>Could I use WordPress so they could login and make posts to the News page without having the website WordPress?
You want Wordpress functionality without the front end being Wordpress? Yeah, it's possible. You don't have to use the themes that are there already, you can completely custom make your own but you'll need to know what functions to use and where to put them.
>>
>>54406932
It came out to 1800

That feels like a lot, but I guess it's right.
>>
>>54407191
Sounds about right. You may even want to round it up to 2k in case they want to haggle.
>>
>tfw the only web dev jobs in your area are php shit
>>
>>54407292
Sounds like a good opportunity to learn PHP shit.
>>
Can anyone explain the "right" way to handle authentication? I'm leaning towards JSON Web Tokens right now, but I'm still not 100% sure how they're safe. Unless I'm making sure requests are coming from the same IP, which no one does these days, it seems as though if anyone got their hands on the token they could authenticate as whatever user owns said token
>>
>>54407481
Basically the client token has to get highjacked for the authentication to be compromised. Same thing as a session.

For regular stuff it isnt an issue since you can just have email resets for passwords. For other things, SSL and log out if IP changes.
>>
>>54407230
Oh well, I'll throw it out there. I'm pretty sure this is a college kid anyways.
>>
>>54407536
SSL is a given, but I'd like for users to stay logged in from different devices, locations, etc.

How annoying would it be if you needed to login to Facebook every time your phone or tablet connected to a different network?
>>
>>54407292
Could be worse.
>tfw the only web dev jobs in your area are java EE shit
>>
>>54391395
>Is there a web-centric programming language other than PHP?
>meaning the language was built from the ground up for web.
There is, Go. You really dont need to mess with layers of framework APIs if your language comes with all the modules built in for web programming.

check out this video at the 3 minute mark where it describes how TJ Holowaychuk, one of the main node maintiners left node for Go:
https://www.youtube.com/watch?v=Vlie-srOU8c

Here is what TJ has to say about his work with Go:
https://www.quora.com/Why-TJ-Holowaychuk-hasnt-the-same-impact-in-Go-programming-language-ecosystem-as-he-had-in-Node-js
>>
>>54405363
time 2 be honest anon
you're just not very good at this.
work on your back end game.
>>
>>54407655
Set it to not expire.
>>
Are Facebook bots limited to customer support only? I have a few clever ideas about them, but I'm not sure whether they'd be approved.
>>
File: Beaugust-loading-spinners.jpg (26 KB, 600x308) Image search: [Google]
Beaugust-loading-spinners.jpg
26 KB, 600x308
I want to make my own spinner loading icon for my site that running on laravel.
Something like a snake going in a circle, except in a diamond shape.
What should I use to implement this? CSS, JS, JQuery, A GIF IMAGE?
>>
>>54409769
css animations or a webm if you need more advanced stuff.
>>
What should I use if I want to make multiplayer Quiz where players will be answering in the same time for the same questions?
>>
>>54409769
Either a gif or css animation would probably be best. JS animations tend to get clunky sometimes.

There's a leddit dedicated to loading icons if you need any ideas:
https://www.reddit.com/r/loadingicon
>>
>>54408898
I am a back end dev but today a guy called and said that he had a opening in the front end I just had to whisper of a dream. :/
Thread replies: 255
Thread images: 26

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.