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

/wdg/ - Web Development General

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 329
Thread images: 27

File: 1456449140972.png (868KB, 822x552px) Image search: [Google]
1456449140972.png
868KB, 822x552px
/wdg/ - Web Development General


Previous Thread: >>57197188

> Discord
https://discord.gg/wdg
OR
https://discord.gg/0qLTzz5potDFXfdT
(they're the same)

>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/
https://www.freecodecamp.com/
http://www.w3schools.com/
https://developer.mozilla.org/
http://www.codewars.com/


>Useful Youtube channels
derekbanas
thenewboston
learncodeacademy
funfunfunction
computerphile
codingrainbow

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

>Backend development
https://en.m.wikipedia.org/wiki/Comparison_of_web_application_frameworks
https://gist.github.com/dypsilon/5819528/

>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://pastebin.com/pDT82mQS

>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
>>
I discovered I have a rare talent. I am the only one in this Universe capable of making these threads.
>>
>>57273835
first for discord is a literal dataminer
>>
In jQuery getJSON, how can I tell if it receives an empty array?

I completely broke my app trying to figure this out.
>>
I need help.

$.getJSON("gitshit.php", data, function (result) {

//Can I access "data" in here somehow?
}
>>
>>57273957
Realized I was able to move something before the getjson and I no longer needed it.

I always figure this shit out right after I post.

BACKEND AND FRONTEND DEV COMPLETE, BOYS

ONWARD TO CSS
>>
>>57273850
in the success function you get a msg parameter. Depending on what is returned you could do something like msg.length > 0 or msg.data.length > 0. All depends on how your object is.
>>
>>57273850
>>57274440

I would also check if it's actually an array with Array.isArray(data) plus checking the length. Unless you absolutely know it'll be an array, length will also check the length of a string.
>>
Hey /wdg/, those of you that are professional web devs, what made you decide that it was what you wanted to do for your career?

Been thinking about moving to full-time and looking for other peoples' thoughts. Did you start independent/freelance (mainly what I've done up until now on the side)? Straight to a company?
>>
>>57274465
I used .length

I return an array even if it's an empty set.

My data array had an 'id' in it that I needed.

I realized I could just use the 'id' in that array before getjson.

Basically I was an idiot.
>>
>>57274508
>what made you decide that it was what you wanted to do for your career?

Good question. I have been making website since I was 10, so it should have been obvious, but it took forever to realize that this is what I should be doing.

I started to take it seriously when, in 2012, I started launching my projects after leaving my job and they were getting 10s of thousands of views a month which was heart-stopping for me at the time.

I launched when I was younger too, but at 18 I thought all of my ideas were awesome so I wasted all of my time launching shit because I was chasing dollar signs that weren't there.
>>
>>57274654
I know a lot of those feelings, for sure.

I feel like, in the past, I've been afraid of making it my full-time because I didn't want it to lose any glamor or anything, but I've come around to the idea that you just have to hopefully like your job, not love it and web dev gives you a stupid amount of freedom to try to work on something related to any type of area that you're interested in.
>>
>>57274508
I like making things or getting things to work. And I like sitting at a computer all day.

If programming wasn't a thing, I don't know what I'd be doing. I'm too autistic to even flip burgers.
>>
>>57275160
>I like sitting at a computer all day
I can understand why other people don't like it, but I always knew that I would never have that problem. It's what I do even when I'm not working, anyways, lol.
>>
>>57274508
In college I cold applied for a tech co op at a university one summer since I always liked computers. After that I started working freelance with a pretty successful web developer in my city and continued to do gigs with him after graduation since I needed a job. A couple months in he got picked up for a full time position by a well known client of ours but they didn't have a position for someone inexperienced like me.

After that I got a job at an agency building crappy PHP sites. I got interested in front end tech early. 7-8 months in I went full time remote with them and stayed in that position for a year while I lived abroad.

I came back home after getting hired for a full time position by aforementioned well known client (suck it). Stayed with them for 1.5 years but got recuited by a big tech company and couldn't say no to the offer and a chance to leave home again.

Solving hard problems is fun. I don't know what else I'd do.
>>
I'm really going to be taking a 1 week gig at 13/hour contract (so like 10 an hour after taxes) just to add professional experience to my resume.

This must be what it feels like to suck dick to pay your way through college.
>>
File: laff.png (156KB, 1048x1148px) Image search: [Google]
laff.png
156KB, 1048x1148px
Craigslist resumes -> "Web developer"
is probably the most funny shit I've ever seen.
>>
File: laff2.png (42KB, 1063x557px) Image search: [Google]
laff2.png
42KB, 1063x557px
Here's another.

>Hey guys! I make websites! Here's my SquareSpace!
>>
http://stackoverflow.com/questions/40267645/django-trouble-with-grouping-in-table-and-rowspan can anyone help?
>>
>>57273835

How do I implement user authentication, authorization and permissions on a Node+Koajs+Postgres stack?
>>
>>57273835
>>Learning material
If the end goal is being employable, which one of these websites should I preferably look into?
>>
>>57275666

lmao that fucking header
>>
>>57275666
I dont get it, I thought SEO was autogenerated nowdays.
>>
>>57279297
Not done well.
>>
>>57279350
Google does most of the work for you though as long as you give it a sensible robots.txt and humans.txt
>>
>>57279382
Not only do many clients not understand those things, but when everyone gets them that means that that is the baseline so it doesn't really matter. It takes more to do well.
>>
Anyone here has successfully used React + Nodejs? any tips or tools to make my life easier?
>>
>>57279487

more like marketing code for google .
>>
>>57279621
Google owns you, you better get used to it.
>>
>>57275666
really make my photons bounce
>>
What's the first thing you should start with when getting into web dev? Front end development with HTML/CSS/JavaScript?
>>
>>57279806
>http://pastebin.com/pDT82mQS
yes, that exactly. Then start looking for some backend stuff, maybe a big framework like ASP.NET or java spring, but you'll figure that out in time
>>
>>57279898
> asp.net
> sprint

Sure, if you want to smell Hajeeds curry BO for the rest of your life.

I would advise you learn nodejs + react/angular
if you want to work with human beings.
>>
>>57274654
> I started launching my projects after leaving my job and they were getting 10s of thousands of views a month
Care to share some of these projects?
>>
File: 1469473621356.png (577KB, 480x476px) Image search: [Google]
1469473621356.png
577KB, 480x476px
>>57279928
>nodejs

Shit was literally dead before it even caught on. Hell, the entire concept was flawed. Its self proclaimed reason for existing is so frontend devs who know JS can use that for writing backends without learning real languages. Since JS is set to be deprecated with the upcoming release of web assembly, why they hell would you want to keep that abomination alive for backend development?

inb4 b-b-but what about all the old time web devs who're just going to keep using JS anyways
>>
>>57280018
> web assembly
> JS dying anytime soon

0/10
>>
>>57280018
NO anon node was created for its revolutionary non-blocking async and web scalability.

Javascript is just a language that fits well with the paradigm. Front-end devs do not wanna touch that shit.
>>
>>57280045
5 years from now the only time you'll hear about javascript is from the bitching of people in charge of maintaining old shit built on it
>>
>>57280076
by your logic web assembly would be the new javascript.
>>
>>57280095
Web assembly is byte code you moron, you don't write it. The entire point is that you can write a compiler for any existing language that will shit out web assembly. Desktop apps and web apps will effectively become indistinguishable.
>>
>>57279588
- Make a rough draft of your API documentation before you start writing any code.

- Do the backend first.

- Left-pad syndrome and non-invented-here syndrome are equally retarded. Use your best judgment regarding 3rd party modules.

- A few unit tests early on can save you some headaches later on.
>>
>>57280240
> A few unit tests early on can save you some headaches later on.

unit tests is something i've always wanted to try but have always failed to discipline myself to use them.
>>
File: watch-me-naynay.jpg (5KB, 153x179px) Image search: [Google]
watch-me-naynay.jpg
5KB, 153x179px
>>57274508
I was a computer autist since my childhood
>>
>>57280341
>Das Ischias
>Das Ischias

I read that comic years ago in German and could never forget it for this line.
>>
>>57280285
Full blown TDD/BDD + CI is great, but if that's too much of a plunge, even a few well-placed tests can save you hours of debugging.

The worth will become apparent the first time you run into some weird bug and just run
npm test
to pinpoint exactly where the problem is by which tests failed instead of having to go line-by-line and diagnose things yourself.
>>
>>57280443
I see, I know what TDD is but what is CI? i see it all over the place.
>>
What's /wdg/ database of choice for general purposes?
>>
File: 1327079595963.jpg (52KB, 467x413px) Image search: [Google]
1327079595963.jpg
52KB, 467x413px
>tfw just got my first web dev role out of uni
im nervous yet hype
>>
>>57280520
mongodb
>>
>>57280552
> went to uni to end up as a web dev
>>
File: tfwwebdev.png (754KB, 1280x800px) Image search: [Google]
tfwwebdev.png
754KB, 1280x800px
>>57280581

not the one you quoted but I'm lovin' it
>>
>>57280475
Continuous integration. Basically, the idea that your code doesn't get merged into master if it fails tests. Usually when someone is talking about CI, they're referring to a service like Jenkins, that spins up an instance of your app and tests it before allowing a PR, for example.

>>57280520
Most data maps well to a relational format, so any SQL database is usually a safe bet. Postgres is pretty good. SQLite is dirt-simple if it only needs to talk to one user at a time. Mongo is fine if you don't mind losing data once in a while...
>>
>>57280638
so its just tests for your github? don't you already test your code locally?
>>
Do I have something to win by using Linux as a web dev?

I'm growing tired of the botnet.
>>
>>57280707
yes, if youre willing to take time to work on your environment and increase your productivity, then go with linux 100%

if you want to conform to windows practices then go with windows.
>>
>>57280707
In my opinion Linux is better as a dev environment when you're not using .NET. Often vastly better depending on programming language.
>>
>>57280726

I don't want to conform to windows practices anymore, thats why I'm considering linux, I still have to learn how it works 'tho, but I've been doing my homework regarding this. I also heard that you can host websites more easily, is this correct?

Now that things are picking up steam, increasing productivity is exactly what I have in mind.

>>57280739

Well, not much of a programmer yet, but things are looking up. Not a single interest on .NET stuff, at least not yet. Not so many great jobs on the field asking for .NET.
>>
>>57280785
> Now that things are picking up steam, increasing productivity is exactly what I have in mind.

like I said, you're going to have to tune up your environment for developing in linux.

This is a major hurdle for many novices, which is why switch over to mac os as its easier than linux.

The payoff for using linux for dev is worth it though.
>>
If I have to take a screenshot of a website for like a portfolio or something. How do you do that? If the page is too long I don't really trust HR retards to know that they can hold the alt button to zoom in on an image. They might just see it as a useless image. What is the proper way to take a screenshot of a project you worked on but don't have access to the code?

I know this sounds like a stupid question but I'm a stupid person so there's that.
>>
>>57280821

Oh, yeah. Got it.
I'd gladly switch to Mac os (and I've considered it) but the thing is, I live on a joke of a country and hardware costs are way to high, high like paying 10K USD for a notebook high.

I think I will take the hard route and try to master Linux, I feel like it's gonna be worth it.
>>
>>57280867
> calls HR stupid
> call himself stupid

>> /sqt/
>>
>>57280148

meaning you still have to know A language

with the amount of people who know and still are learning JavaScript, I pretty much doubt it's gonna be dead within 5 years
>>
>>57280956
Exactly JS is being standardized as we speak,
ES6 is great and ES7 will be even better.
>>
>>57280930
Are you implying that HR isn't fucking retarded?
>>
File: 1477098842222.jpg (29KB, 500x332px) Image search: [Google]
1477098842222.jpg
29KB, 500x332px
Guys! I'm making an e-shop.

Now, the owner (my mom...bless her 17 year old store) already has a merchant account with a bank - meaning I should lead the payment gate throught them (no PayPal)

The question is ... how do I go about this?

Should I contact tech support in the bank and ask for a module they have and embed it in the site? Do I use something like stripe.js?

How is this usually done? We're not on a big budget here btw

captcha: storefront
>>
>>57281031
no, they are.
but so are you.

>>> /sqt/
>>
>>57281065

oh, also I'm using node, mongo, bootstrap - express + handlebars
>>
>>57281082
lol
very hip
>>
>>57281082
whats your moms site??
i might pay her a visit
>>
>>57281068
KyS worthless shitposter.
>>
How to count repetitve occurences in django and then use this number as rowspan in table?
>>
>>57281096

still on local host
it's in Slovakia anyway, doubt you'll understand the old one - it was made by some IT student in Uni is here

http://skvelenakupy.sk/

dude is so butthurt it's getting replaced, he doesn't even want to give me serverside acces or his old shitty database ... fuck 'em

the way it is now, people pay when recieving the stuff - I want to make a checkout module that accepts payments On Site
>>
>>57281065
Use Stripe
>>
>>57280670
It's just a service that runs tests and reports the results. Travis is another popular thing that does something similar. You can hook it up in lots of different ways to suit lots of different needs.

In particular, it's good for open-source stuff because if some noob tries to commit some shitty code that breaks everything, the CI software can automatically tell them to fuck off and come back when the tests pass without someone having to manually do a code review.

You might also notice the little badges on github README's that show things like test coverage, whether or not the build is passing, etc. That's something else CI tools typically do.

>>57281065
>>57281082
>meaning I should lead the payment gate throught them (no PayPal)
Why wouldn't you be able to use PayPal?

>Should I contact tech support in the bank and ask for a module they have and embed it in the site?
You can certainly try, but I doubt they have anything like that and even if they do, it's probably shit.

>Do I use something like stripe.js?
Yes

Unless you really know what you're doing, I would highly recommend using something like Stripe and/or PayPal, and even a pre-made ecommerce platform like Shopify or WooCommerce. When money and customer data is involved, you really don't want to fuck around.

> We're not on a big budget here btw
Everything I mentioned is free or very cheap to get started with.
>>
>>57281264
>PayPal
not that guy, but he would eventually need to put the money into his bank account to actually use it (I doubt the use of PayPal is very widespread in Slovakia), so why not just avoid it from the get-go? Just cut out the fucking middleman, you don't need him taking a slice of your pie for nothing.

On the other hand, like you said, PayPal might be safer than straight to the bank, I really don't know anything about safety.
>>
>>57278103
please respond
>>
>>57281521
follow your heart :^)
>>
>>57281264
>>57281416

thanks guys, much appreciated

PayPal really isn't that widespread there, aside as a website module you can put debit card ifo into...
>>
>>57281531

this guy!

bump for interweb feelz
>>
>>57281560
fuck man, check out Paypal's fees, looks expensive as fuck. From my understanding, you pay 3.9% of the transaction amount, plus a fixed fee of €0.35. That's a shit-ton of money, man. Try to work without PayPal, I'd say.
>>
>>57281798

the thing is, she allready has a bank Merchant account, so I think I'm going with just the gateway.

Question is, what gate to use?
>>
im streaming a ruby talk on gender and i'd appreciate if you guys could come and give me feedback and maybe even learn something

https://www.twitch
.tv/programming
>>
>>57281953

a ruby talk on Gender? wtf?
>>
>>57282023
twitch programming channel is nothing but muh gender and muh race shit.
>>
>>57282035

ugh, sounds like something I should avoid

I wonder what would happen if I made a >male only< or >whites only< programmer platform..?
>>
>>57282079
It would be about programming and not century old politics.
>>
>>57282149

touché
>>
I am a full stack dev that works on angular2(heroku, I don't do node programming), asp.net api and mssql.

Where can I improve?
>>
Any Laravel artisan here?

Having a problem with a while loop inside a controller method that spews out data via ajax call.

        if($request->ajax()){
$opponents = User::inRandomOrder()->limit(2)->get();
if(Session::has('opponents')){
$old = Session::get('opponents');
while(($old[0]->id == $opponents[0]->id && $old[1]->id == $opponents[1]->id) || ($old[1]->id == $opponents[0]->id && $old[0]->id == $opponents[1]->id)){
$opponents = User::inRandomOrder()->limit(2)->get();
}
}

Session::put('opponents', $opponents);

return $opponents;
}


Basically it's supposed to keep getting new users till they're not the same as the previous ones but it doesn't...
>>
>>57282252
post some of your projects
>>
>>57282252
stop being a vague piece of shit 2bh
have your own useful projects
stop being a vague piece of shit 2bh

i think that's about it :)
>>
API-question.

I have an url like this:
http://api.site.com/files/id

which takes you to a specific file.

Now I want to provide a HTML representation of this which allows the user to create a file. Where should this be? Following REST, it should simply be posted at
http://api.site.com/files/


But with HTML, we need a place to set up the file before posting. Right now I'm thinking of setting up a HTML-only page at
http://api.site.com/files/create.html


which has a post form. This will be true for all data sets with the possibility to create.

Are there better ways?
>>
>>57282447
Clearly something goes wrong in one of the steps or conditional checks. Debug it by checking if the data is correct after each step.
>>
What's the benefit of a full blown database over just keeping everything in memory and backing it up to a file now and then?
>>
>>57282570
The more data you have the less efficient it gets.
>>
>>57282570
Oh and keeping data in memory doesn't work when you have more than 1 server because they can't share memory but they can share a db.
>>
>>57282577
Well, I don't have any data
>>
>>57279297
There is no way to "generate" SEO, it relies heavily on semantics, and constantly evolves.

There are the structural parts and the obvious elements like breadcrumbs and such, but the important part is the content, creating content with proper wording ponderation to fit the wanted semantic spheres still needs a human touch, you can assist it with a few algorithms to weed out some crap though.
>>
>>57282570
storing frequently accessed data in memory so there is no overhead of having to look it up in the database again

are you talking about using an in-memory data store like redis?
>>
>>57282447
>>57282542
Seems like the loop is actually ok but from time to time it breaks and error.log spews out
production.ERROR: RuntimeException: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. in muhpath\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php:43


I obviously have my key set up in .env..
>>
>>57282819
going to sound stupid but have you tried to debug the loop with breakpoints to see what values your identifiers contain
>>
>>57282513
Sounds fine to me, anon
>>
>>57282849
A few times desu. Data seems fine. Went with Session::flash to check for the nth time if the loop is fine - it is but it still breaks after a while and spews out that cipher error. Spent 2 hours trying to fix this. Will just reload the page on ajax error and come back to it later.
>>
>>57283149
>paste the error in google
>first link gives like 5 potential solutions
>>
>>57283244
Yes, all related to people not setting up their keys properly.
Nothing about that exception popping up when everything works fine..
>>
File: 05f19b86f1[1].png (51KB, 1581x842px) Image search: [Google]
05f19b86f1[1].png
51KB, 1581x842px
I'm a web dev total newbie, currently I'm using cpanel.

I want to rip off someone else website, I apparently downloaded it with HTTracker, then I used CoreFTP to connect, but when I do I get only pic related, where are all my files like www directory or the public.html?


Is there any other way to copy a website anyways?
>>
>>57283377
You can't copy PHP files or backend files from the website, only the HTML and JS parts.

what you're doing right now is the equivalent of doing Ctrl + S on the website.
>>
File: 1421296363457.gif (498KB, 400x192px) Image search: [Google]
1421296363457.gif
498KB, 400x192px
>>57283434
Thanks, didnt know that.

How do I copy the design of the page and how to I put it into my public.html?
>>
>>57283493
Give it back, Tyrone
>>
>>57283493
>How do I copy the design of the page

You dont
>>
>>57283493
>>57283377
*giggles*
>>
File: 1472942694115.png (427KB, 571x540px) Image search: [Google]
1472942694115.png
427KB, 571x540px
>>57283499
>>57283533
it's understandable, but I made an entire webpage based on one but hostgator fucked me over and just deactivated my account forever without warning and all my progress was lost.

I just want to rip the design so I can edit it and make it my own
>>
I literally can't tell if I'm genuinely horrible at technical interviews or if I just feel like I'm doing badly. Either way I couldn't answer how to edit the registries in windows, I forgot how to insert into a SQL database causing a long pause becuase I didn't realize he expected me to look it up, and I had to look up how to print bash all bash variables

Granted, there were a number of other questions, but dear god, a guy in another company stuck his neck out to get me this interview
>>
>>57284496
>regedit.exe
>insert ____ into ____
anon I'm a garbage ass programmer and i know these things, just do some review of materials before your next interview
>>
>>57284496
>>57284562
Actually I think it's insert into _____ (___,___)
As I said, I am garbage
>>
>>57283493
That's the secret.
If you could, there'd be exact copies of reddit, google, facebook, and every popular website out there.
That'd also be a security vulnerability because people could read the source code for everything
>>
>>57281164
Anyone?
>>
>>57284748
What the fuck is a repetitive occurrence? Occurrence of what?
>>
>>57284827
occurence of object in database, lets say i have 3X and 5Y, i want to get all of the objects (8 objects) and count it separately so i would get queryset 3, X, 5, Y
>>
>>57284584
To be fair, most popular sites started out as shitty clones of existing things, and wouldn't be where they are today if said things didn't self-destruct for one reason or another.

And leddit is open source, btw
>>
>>57273835

can someone add this in the future OPs as the official /wdg/ theme?

http://vocaroo.com/i/s1mZ1M4uKR0n
>>
I want to host a React app on Heroku that uses React Router for the routing. To do so, I assume I'll need to create a basic Express server to serve the index.html with the React scripting embedded within it.

Everything significant is happening within the client, the server will only exist to serve the index.html file to get the ball rolling. To do this, can I just use a generic app.use() statement to serve the file, or will I need to have an app.get() statement? If it's the latter, what's the syntax for an app.get() statement that matches any route - a wildcard, for lack of a better term?
>>
>>57285984
Source?
>>
>>57286146

i'll tell you after you add it
>>
>>57286254
I don't make these threads
>>
>>57286146
>>57286254
Nevermind found it
>>
>>57286129
If you're just serving up static files, why are you using express & heroku at all? Just put it on gh-pages or something and host it for free.
>>
>>57279297

SEO is a meme magic.

The amount of horrible nonsense you see in places like /r/webhosting because someone says "it's good for SEO" is just all forms of cringe.
>>
File: 1405152500185.jpg (62KB, 548x556px) Image search: [Google]
1405152500185.jpg
62KB, 548x556px
>>57284584
>That'd also be a security vulnerability because people could read the source code for everything
>>
>>57286351
I've heard that gh-pages kind of shits the bed if you try to throw react-router stuff on it
>>
>>57286470
He's not wrong.
>>
File: 1414134498640.jpg (23KB, 290x293px) Image search: [Google]
1414134498640.jpg
23KB, 290x293px
>See ad about front-end developer job
>Apply
>Actually get in
>Aw yiss
>"Ok you are full-stack developer now and your first job is to build this service"
>There is only two people in this company, boss and me
>Start to figure out how to proceed with this project
>End up using Laravel to make it
>Haven't used PHP for years
>I have no idea what I'm doing
>The pay is shit
>mfw

I would rate 10/10
>>
>>57286493
As far as gh is concerned, it's just serving some static files. There can be some issues if you hardcode urls while serving out of a project repo, since the base url is /{project-name}/, instead of just /, but that will happen no matter what you're using. It should work fine if you remember to set the correct base url though.

>>57286496
Yes he is. Obscurity != security.
>>
Guy wants giant project at 13 hour.

Wants it completed in a week.

I project it will take 4 weeks minimum.

Tell him I accept the cheap as fuck Indian rate but can only work part-time because I have a job.

He cuts contact.
>>
File: IzF32.jpg (68KB, 335x555px) Image search: [Google]
IzF32.jpg
68KB, 335x555px
>>57287069
He probably fired the whole dev team and now expects you to replace them.

>There is only two people in this company, boss and me
>>
I don't know shit about this, but I need some help.

In an Apache config file, what does this rewrite rule mean?


RewriteRule (.)* http://www.mysite.com/$1


What is it trying to do? It was breaking a site that I am trying to build. The moment I commented that thing out suddenly everything started working again.
>>
>>57289147

Also, mysite.com is obviously just an example domain.
>>
>>57289170
>Also, mysite.com is obviously just an example domain

I'm not helping you just because you wrote this.
>>
>>57289172

I'm reading about apache rewrite rules.

(.)* is saying all file types right?

Is it saying "redirect all files to this URL" ?
>>
>>57289147
how long have you had that domain!
>>
>>57289591
I'm upset that I didn't buy websites like eat.com yum.com and anything 3 letter back in the 90s...

Sit there and hold that shit until 2050 when there isn't a single fucking domain left and the only people that can make websites are those with millions to spend on domains.
>>
>>57282447
>>57282542
>>57282819
>>57282849
Fucking solved. It had to do with the fact that I was using $.ajax instead of $.post. I also changed the behavior on an error for the better. It now logs it and spews out new data to the view, making it look like nothing wrong happened even if the user is trying something funny.

Nice learning experience given it was my first Laravel project
>>
I'm moving my .htaccess rules from Apache to nginx. Is something like this right?

Request: https://server.com/explore/action/all -> /explore/index.php?cat=action&page=all
Request https://server.com/explore/adventure -> /explore/index.php?cat=adventure

        location /explore {
rewrite ^/explore\/(.*)\/(.*)$ /explore/index.php?cat=$1&page=$2;
rewrite ^/explore\/(.*)$ /explore/index.php?cat=$1;
}


I'm sure there as to be a better way of doing this.
>>
>>57290850
Been working on this for the past hour, is this fine or is there something inherently wrong with this?

https://server.com/admin/ -> https://server.com/?page=
https://server.com/admin/settings/general -> https://server.com/?page=settings&nav=general

        location /admin/ {
try_files $uri @admin_page;
}
location @admin_page {
rewrite ^/admin/(.*)/(.*)$ /admin/index.php?page=$1&nav=$2;
rewrite ^/admin/(.*)$ /admin/index.php?page=$1;
}
>>
>>57288779
He's an idiot for thinking he's going to get anything but shit for that

You're a fool for thinking any timeframe times 13/hour is acceptable.

I'd say bullet dodged on the whole
>>
>>57286129
>that uses React Router for the routing
Frontend "routing" is effectively just showing/hiding different view components based on user interaction. It isn't really the same thing as backend routing, it just looks like it to the user.

To answer your question, you'd make a directory for express to serve static files from as per the docs: http://expressjs.com/en/starter/static-files.html and then just put all your files in there. By default, express will serve them as if they were sitting in the root directory.

As was mentioned, heroku and express just to serve up static files is massive overkill, though. You only need them if your app needs a backend.
>>
/wdg/, I know this is /g/, but it web dev a passion of yours or just a job? If it's just a job, what motivates you?

I see a lot of people trash on web dev, and then there are the fly-by entrepreneur types. So is it really that bad?
>>
>>57293464
Both, work is only a passion when the projects are fun, otherwise it's just work.

Kinda stuck in some big personal projects at the moment so don't have much time to play around.
>>
>>57292006
I'm trying to get something added to my resume.

I get thrown out 100% of the time because I have no prior professional experience. I have no degree so I need it.

>>57293464
I loved it ever since I started it and, these days, it's the only thing I enjoy in life. I'm happy to do this for the rest of my life.
>>
Is using basic javascript to do stuff on my web page outdated? Am I supposed to use React, or maybe something else? I'll use whatever is best.

Does React cause conflicts with a templating engine? Like if I have a template with html elements with some backend code inside, I can't create those same html elements as a component in React can I? (since they won't have backend code when defined using javascript).
>>
>web backend
so fun, can write it all day
>web frontend
just kill me now

what do?
I need a simple and responsive interface solution that won't break my brain.
>>
>>57294329
You know it's possible to just work with one of them, right? (or are you just talking about your personal projects? Just find template stuff then.) Harder to be freelance with only back from what I gather, though.
>>
>>57294271
It's probably best to use vanilla with various libraries in your case. It is possible to use React, but it kinda defeats the point to do templating as well.
>>
File: image.png (2KB, 174x174px) Image search: [Google]
image.png
2KB, 174x174px
What is the general consensus on web dev with the .NET framework?

Assuming there's at least one experienced .netter in here.
>>
>>57294329
CSS makes me want to jump off a building. Trying to get that shit standard across browsers and devices is such bullshit.

My team all does full stack at work and when I'm put onto UI I want to cry.
>>
>>57294843
I love C# to bits, writing APIs and services and using LINQ is beautiful. I think once Core settles and they stop changing everything with every release .NET will get more popular.
>>
>>57294870
Making CSS cross-browser isn't really a problem anymore, 99.9% of the shit should work and look the same in all modern browsers (including IE11).
>>
>>57280785
>I also heard that you can host websites more easily, is this correct?

Yes Anon. In fact, most of the web servers in the world run on Debian, and Ubuntu (major linox distro) is based on it, so you won't be lost and it will be easy for you to deploy websites, if you are willing to learn command line's basics.
>>
I have some projects hosted on GitHub pages that make AJAX calls to APIs hosted on other websites.

The issue is that GitHub pages is https, while the API is hosted on an http connection.

As a result, the browser throws an error saying that it 'blocked loading mixed active content'. What's the best way to solve this issue? Will I have to host my project remotely and just link to the project from my GitHub pages site (e.g. host on heroku, link to app via github pages)?
>>
>>57295133
Try using https in the API url anyway. The host may have https set up, but didn't automatically redirect to it.

If that doesn't work, try leaving it out entirely.

If *that* doesn't work, make your heroku proxy and bitch at the API owner to use https
>>
>>57285192
This.

(Glad I'm not on r9k, i can finally post 'THIS.' "
>>
>>57294966
Yet Edge still has problems with doing basic shit like font rendering. Just about everything site looks dodgy in Edge compared to other browsers.
>>
>>57289147
It redirects every request to http://www.mysite.com/{url typed}
>>
>>57295313
Thanks for the advice. I tried out the first two options, but neither worked. I'll give crossorigin.me a shot, and see if that will work.
>>
>>
vs
>>57296704
>>
>>57296734
there were additional sites that built on that concept that made it look a LOT better. I cant remember what their names were tho

>>57295323
edge is shit
but safari is the shittiest right now, jfc just kill it apple
>>
>>57296777
falls prey to what the original warned of, yet claims to be objectively better. the original just struck someone's nerve so he made a response website
>>
>>57296805
no not that one, the font looks different than what i remember
there were like 3 versions
>>
>>57274508
>did programming as a hobby
>only actually sought money doing shitty jobs.
>didn't occur to me that I could get a web dev job without a degree
>saw some of the results that "professionals" get
>realised nobody cares about the degree
>spent a few months filling in the gaps in my knowledge
>created a resume full of buzzwords to impress the non-technical recruiters
>applied to some jobs
>got job
>>
>>57273835
I want learn more about Website architecture
>>
File: mvc.png (80KB, 1024x512px) Image search: [Google]
mvc.png
80KB, 1024x512px
>>57296971
Here you go.
>>
>>57296981
DELET
>>
Anywhere I can get a online test Oracle db? I really don't want to install that massive pigfat shit in my poor computer

Syntax is different, mysql or postgres won't cut it
>>
>>57297457
VirtualBox
>>
>>57274508
Trying it at the moment as freelance but I find the hardest part is selling sites.
I do have a slight chance a member of family could stick me in with their employer.
>>57296874
>web dev job without a degree
Currently self-educated with languages, but I'll need something to show on a portfolio.
>>
>>57294843
C# is excellent language, .NET CORE outperforms all mainstream languages except perhaps Go.
>>
>>57296981
:(
>>
>>57297786
>.NET CORE outperforms all mainstream languages

source?
>>
>>57297457

Apex online you dumb fuck
>>
bump.js
>>
Working on a porn site that automatically scans for porn threads on /b/ by keywords (such as "loli thread" and "s/fur/" or whatever) and then uploads them into various categories for the public to view forever. I'm kind of stuck on name though. Need to to be something that appeals to normies as well. Any suggestions?
>>
can someone explian to my why this code :

function merge(o, p) {
for(prop in p) { // For all props in p.
if (o.hasOwnProperty[prop]) continue; // Except those already in o.
o[prop] = p[prop]; // Add the property to o.
}
return o;
}
merge({t:4,a:66},{a:2,b:7});

outputs//=>Object {t: 4, a: 2, b: 7}
instead of //=>Object {t: 4, a: 66, b: 7}
>>
>>57300294
This actually gave me an idea. I want to make a website that lets you select boards and search for porn on those boards. It then returns links to all of the threads that it found.

Where could I host this for free?
>>
What JS framework deal would you recommend I learn to make a basic single page application (assuming the backend was written in something else already)? I don't like JS but I'd like to at least try learning one of them.
>>
>>57287277
So you're saying if I could read all the backend files, like password hash generation, database management shit, and all that, I still wouldn't be able to easily hack into your website?
>>
>>57285192
I dont browse leddit :^)
>>
>>57300445
Why not
Object.assign({}, o, p);
?
>>
>>57300950
Or even
Object.assign(o, p)
if you want them in the 'o' variable.
>>
>>57300969
but they both game me the same value i understand why the extend function gives me {t: 4, a: 2, b: 7} but i thought the merge function was suppose to give me {t: 4, a: 66, b: 7} since its suppose to leave the property a alone if o has an own property of a
>>
>>57300969
Example 6-2 defines utility functions that use for/in loops to manipulate object properties
in helpful ways. The extend() function, in particular, is one that is commonly
included in JavaScript utility libraries.2
Example 6-2. Object utility functions that enumerate properties
/*
* Copy the enumerable properties of p to o, and return o.
* If o and p have a property by the same name, o's property is overwritten.
* This function does not handle getters and setters or copy attributes.
*/
function extend(o, p) {
for(prop in p) { // For all props in p.
o[prop] = p[prop]; // Add the property to o.
}
return o;
}
/*
* Copy the enumerable properties of p to o, and return o.
* If o and p have a property by the same name, o's property is left alone.
* This function does not handle getters and setters or copy attributes.
*/
function merge(o, p) {
for(prop in p) { // For all props in p.
if (o.hasOwnProperty[prop]) continue; // Except those already in o.
o[prop] = p[prop]; // Add the property to o.
}
return o;
}
>>
>>57301194
o.hasOwnProperty(prop)
>>
>>57300520
Guy you replied to here. If you provided me the files, I'd be willing to host it for free on my server. You'd have to manually send me the files if you wanted to update it though.
>>
>>57301212
thanks!! man that worked i don't why i didn't try that before i was just trying to follow exactly what the book told me
>>
>>57300445
if a property in o has the same property as a property in p, the property in p will be taken.
>>
>>57301325
Your book is probably shit. And this produces the same output as your merge function.
Object.assign({}, p, o);
>>
>>57300872
If I'm following security best practices, you still wouldn't be able to get in. Just knowing what tools I'm using won't help you unless I seriously fucked up somewhere or you've got a zero-day in your pocket or something, but in that case I'm fucked anyway if you're determined enough.
>>
Opinions on Elixir/Phoenix?
>>
>>57302527
no
>>
>>57302744
add an option for a small thumbnail view, when i go looking for porn i want at least 16 videos buffering so i can jump between the ones i like and quickly close out shit.

also make sure you have a thumbnail sequence on mouse over that shows parts of the video, i want to know what's in the video before opening it.
>>
>>57302530
why?
>>
An antique store is asking me for a landing page.

I told them months ago that I could do such a thing pro bono, because I need portfolio examples, I currently have none.

I have done very basic HTML in notepad and a bit of SEO, but that was like 10 year ago.

How much time commitment am I looking at to get this landing page off the ground? I am not worried about the design aspect since I am competent enough with graphic design..

Anyway, I guess I am asking for the basic pipeline to launch a minimalist, responsive landing page for an antique store.

Should I just use wordpress? A bit confused about hosting and purchasing a domain. How much should I tell them to expect to pay for the domain?

I honestly just feel guilty because I flaked on them and they are asking me months later if I am still interested, would be helping out a small business to do this simple site.
>>
>>57303069
Might as well do it in Wordpress, use ACF or something and make it all editable.
>>
>>57303069
>>57303125
As for hosting, find some managed hosting by a know company and it'll be the easiest.
>>
>>57303125

Yeah, I'd basically be handing it over to them and hoping they understand how to us the wordpress cms.

Do people actually charge money for wordpress sites?
>>
>>57303153

such as?

Sorry if I seem retarded, I just don't really know waht the order of operations per se would be for buying the domain name/getting site hosted
>>
>>57303069
>get a bootstrap theme and add their content
>wordpress & digital ocean
>???
>profit
>>
>>57297715
>Currently self-educated with languages, but I'll need something to show on a portfolio.
Make some tutorial-tier stuff and throw it on Github.
>>
>>57303160
>Do people actually charge money for wordpress sites?
Yeah, I do Wordpress among others for $70/h

>>57303177
Not murrican, don't know what you guys have
>>
so what are the new how front end frameworks?

right now I'm using choo/nodejs ism stuff.
for css I've moved to bulma, seems much better than bootstrap so far.
>>
>>57303495
>bulma
>in late 2016
lmao basic flexbox shit
anyways everyone's using react, vue, grunt, gulp, browserify (or webpack), materialize (or material ui), semantic UI, and obviously you should be using typescript!
>>
Please no bully
I'm doing my first Rails project, it's a group assignment for my uni. So we created the project and the default DB is sqlite3, but we need to use postgres, so how do we change that shit? I tried following a few tutorials but we fucked up every time
>>
Animate.css or jquery animations?

Cordova app for mobile. Animating UI.
Not sure which is smoother and best.
>>
So I'm working through freecodecamp and I've gotten to the weather app. I have an API I want to use but I've got no idea where to start on HOW to use an API or how to parse the data it throws at me. I look at some sample code and read some stack overflow posts but it honestly looks like some of the most disgusting code of my life. Is this seriously what javascript truly is in the real world?

My thought process is call api > insert data into array > .sort() array > remove shit I don't need then display it on the screen. The biggest issue I'm having is how I interact with my HTML elements or more specifically how to format what I push to certain elements. Any tips?
>>
>>57304284
>Is this seriously what javascript truly is in the real world?

not just javascript mayne. code in the real world in general is a mess, doesn't matter what language you're dealing with. real world code is gluing a bunch of shit together. which is a big gluey mess even if you're good at gluing.

>My thought process is call api > insert data into array > .sort() array > remove shit I don't need then display it on the screen.

without having any idea of what you're doing or the complexity of it... sounds like it could be a perfectly fine approach.

The biggest issue I'm having is how I interact with my HTML elements or more specifically how to format what I push to certain elements. Any tips?

link us to API docs and tell us specifically what you're trying to do and it would be easier to help. or paste your code into pastebin or whatever.

gl homey!
>>
Setting up my own web server, and each time I run a PHP script, it appears to var_dump($_SESSION)

My php.ini auto_append_file and prepend_file values are "none" so I'm not sure why this is still occuring. Have you guys run into something similar?
>>
>>57304365

I'm using simpleweather and to get a grasp on it all I'm messing around with their boilerplate code they give you to work with the API. My main issue is how to allow people to select between Fahrenheit (and have it live update if they choose either/or) or if I want to have a custom location in it I call the API upon entering a valid location?

$(document).ready(function() {
$.simpleWeather({
location: 'Fargo, ND',
woeid: '',
unit: 'f',
success: function(weather) {
html = '<h2><i class="icon-'+weather.code+'"></i> '+weather.temp+'&deg;'+weather.units.temp+'</h2>';
html += '<ul><li>'+weather.city+', '+weather.region+'</li>';
html += '<li class="currently">'+weather.currently+'</li>';
html += '<li>'+weather.wind.direction+' '+weather.wind.speed+' '+weather.units.speed+'</li></ul>';

$("#weather").html(html);
},
error: function(error) {
$("#weather").html('<p>'+error+'</p>');
}
});
});
>>
What's a good, modern library for communicating between client and server?
I've tried socket.io. Anyone have suggestions?
Looked @ gundb a bit, but turned off by not being able to delete data.
>>
File: Screenshot_20161030-023612.png (594KB, 1033x1837px) Image search: [Google]
Screenshot_20161030-023612.png
594KB, 1033x1837px
>>57273835
Welp, I was working on revising my little RouteMapper WebApp. ( I'm going to be a trucker soon, so I made an app to help me log the routes I drive )

I think I'm about to call it quits for the day. I've spent enough time on it.

This is basically a re-write of my previous RouteMapper App, except this time:

- We got the Network IO down a bit by implementing 3-pieces sample-synchronization system that ensures only new samples are ever sent to the server. No more redundant payloads.

- Each initialized marker also has a timeout function that changes its color after 2 seconds. Ensuring that as you're going down the road, very old samples will be blue markers, while very recent samples will be red markers

- Use of the reverse-GeoCoding API for converting the InitialPosition Coordinates and FinalPosition Coordinates into formatted street addresses. (makes it easier to find the routes on the index page)

And a few other things I can't remember.

I'd say this wasn't too bad, for about 14 hours of work.
Though I need to seriously work on my UI Design skills. I can write logic and add features all night long, but making the app LOOK good is where I struggle.
>>
>>57305588
>>
>>57305594
>>
>>57305588

this is the last pic
>>
>>57300445
Format your fucking code if you're going to post it here and maybe you'd see this
if(o.hasOwnProperty[prop]){...}

You mean
if(o.hasOwnProperty(prop.toString())){...}
>>
>>57304284
Check this out
http://reactivex.io/learnrx/
>work your way up to problem 16

And then this to reference
https://egghead.io/lessons/javascript-chaining-the-array-map-and-filter-methods
>>
I need your help /g

Long story short - I need to "learn" Angular 1 by next Friday.

This guy seems more professional but his course is fucking expensive:

https://ultimateangular.com/courses/

This guy is cheaper but he's got good reviews too so idk:

https://www.udemy.com/angularjs-from-zero-to-hero/

If anyone could have at curriculums of both and give me their opinion, I'd be very grateful, thanks.
>>
>>57279297
Basically. Its not hard. I got a job updating a company website and they asked me if I could do SEO.

I just googled SEO basics/gudielines and within a few weeks we are in the top 3 for our city.
>>
If you guys did a picture board like this from the scratch, what stack would you use?

(I know there are premade frameworks for board out there, that's not the point..)
>>
>>57306085

You're shit out of look, there's no way to learn Angular in that amount of time. It's too late. Die.
>>
>>57295527
Thanks for introducing me to crossorigin.me.
Now my shitty app doesn't require a server and can be run just like that.
>>
>>57304573
Start by separating out your business logic and presentation. Have your ajax function dump the data into a variable instead of rendering it directly, and call a separate render function with the variable. That way if you modify the data clientside, you can just re-render it without having to do another request. You could also have a timeout to hit the API every 5 minutes or something to auto-update.

As for the temp, after you get the data, you could just convert it into whatever other units you might want and store those as well. Then if the user presses a button to change the units, just re-render with the other value.

>>57305576
socket.io isn't the only websockets implementation, fampai. Your only options are ws for realtime or good ol' fashoned http though.

>>57305588
>I'm going to be a trucker soon
You can write code but you're going into trucking?

>very old samples will be blue markers, while very recent samples will be red
Slight nitpick, I would reverse that, or better yet gradually gray them out as they get older.

>Though I need to seriously work on my UI Design skills. I can write logic and add features all night long, but making the app LOOK good is where I struggle.
desu the app doesn't look terrible for a prototype. One thing that does make it look a bit amateur is the default bootstrap theme. You might benefit from sitting down and figuring out some branding stuff. Colors, fonts, that kind of thing.

>>57306085
>I need to "learn" Angular 1 by next Friday

lol ur fucked m8
>>
>>57306671
>>57307096

Thanks guys, you were both very helpful.

Anyway, I'll take my chances since I don't have a choice, anyone who'd like to give opinions other than lol ur fuked?
>>
>>57305588
Why be a trucker when you can make apps?

You just like driving?
>>
>>57307312
Angular is ez, if you have a week and you're not stupid you should be able to fake it.

Just don't fuck around and actually try to learn it, go through their tutorials and learn how to build Directives, controllers, filters etc
>>
>>57307312

You're welcome.

Why not just using google or youtube and typing "angular1 tutorial"? It's not like you're looking fo rsome secret knowledge or something.

Also you didn't say anything about your background. Do you know A2 and want to learn A1 because of legacy code? Is this your first website? Are you an experienced guy who already knows serveral SPA frameworks?

>guys I want to learn everything in no time, what do?

Just kys..

There's no shortcut, if you have trouble than sit down, learn as fast as you can and pray that you make it in time. Just do coding examples, try to make shit work.

Literally the same aswer as for "I have 1 year to learn xyz, what do?"..
>>
>>57306085
>Long story short - I need to "learn" Angular 1 by next Friday.
Lmao

Let me guess, you took the "throw it on your resume even if you just wrote a hello world" advice?
>>
>>57306630
JS to a PHP API.

React would also work really well for an imageboard.
>>
>>57307349

Thank you.

>>57307358

I asked about an opinion on two specific courses not about what you think of my approach.

>>57307361

No, I didn't even apply for shit, some recruiter contacted me, said theyre looking for a webdev and I refused telling him I don't have any professional experience, he then said they are looking for a junior who's willing to learn and he asked if the company can call me.

They called me, we chatted for 30+ minutes and I have put very big emphasis on what I know and even more on what I do NOT know including angular.

Then they gave me a task to reproduce in Angular, and somehow I managed to do it with a help from documentation and a guy who's a software engineer and they liked it, they said that even though its not perfect they wanted to see how am I going to tackle something I've never used before.

However, I want to be able to answer some questions, assuming I would get any Angular-related on an interview which is next Friday.

That enough ? No more butthurt ?
>>
That's it. I'm making a free speech Twitter clone the second after I launch this project tomorrow.

I'm fed the fuck up.
>>
>>57307440

So what's wrong with using Google or Youtube then?

Just RTFM, it's no rocket science.
>>
>>57307481
No one is going to use it. Normies don't give a fuck about free speech, they just want to read what celebrities have to say.
>>
>>57307911
Yes, and I know one.

It's not called freespeechtwitterclone.com by the way. It's just a bullet point.
>>
>>57294843
C# is a great language, ASP.NET Core is pretty solid but the tooling is not really there yet. A potential drawback is you have to get into the .NET way of thinking. If you like Ruby, .NET will eat you alive. If you like JavaScript but wish it had type safety, tuples, interfaces, LINQ (which is gods work), and a bunch of other stuff then .NET is a good choice.
>>
File: IMG_2602.jpg (69KB, 498x341px) Image search: [Google]
IMG_2602.jpg
69KB, 498x341px
So I'm learning Javascript out of a book and I've found that most people use JQuery. A lot of times when I try to google how to do something in Javascript I end up finding the solutions in JQuery.

Should I start learning JQuery now? I hate to put down a book halfway through and start something else but I am working on my friends website and am trying to do something that I can't figure out how to do in Vanilla JS, but looks pretty easy to do in JQuery.

I'm not a master of Javascript, but I know basics (variables, loops, functions basic DOM stuff)
>>
>>57308603
Crawl before walking.
>>
>>57308603
Just post questions here.
>>
>>57308603
I'd recommend learning es6 too, it's good to know libraries but only once you know the basics very well.
>>
>>57308603
We don’t use the “J” word in 2016 anymore.
https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f
>>
>>57275666
"The founder of Photon Bounce has passion for art, colors, technology and identity branding, DB brings some vibrancy and ultra-slickness to the apps and websites being built by the team."

You have slayed my sides anon holy fuck hhaahahahah
>>
>>57275793
http://chasecampbell.squarespace.com/resume

This guy was once a "lead graphic artist". Jesus christ.
>>
>>57308760
Go look in your town. Search 'Resumes' for 'web developer'.

It's a hoot.
>>
>>57308846
http://www.one2onedoggrooming.co.uk/

I found the guy who made this.

A fucking static website, where every page has an obnoxious fucking "loading" animation. It should load in like 50ms, you don't need that.
>>
>>57275666
damn. that makes me feel better about myself
>>
>>57282447
You should be able to clean this code up a bit.

You SQL query would be something like
SELECT * FROM users WHERE user.id != old_user_1_id AND user.id != old_user_2_id
. I have no idea how Laravel does the random, that's up to you.

Basically, leave data logic (what to select) at the ORM as much as possible, cause MySQL knows way better than you how to do that. It'll speed up your application and make your code look more clean and make more sense.

If my comment makes no sense, give me a reply and I'll explain it more thoroughly.
>>
>>57282513
In my opinion, the REST API which speaks with applications, not users, should run on a different namespace, be it
/api/v1/
or an entire different subdomain.

So then you would have
http://site.com/files/create.html
and
POST http://api.site.com/files/
to create a file in a browser and in an application, respectively.
>>
>>57301702
Yes, but a shitton of websites nowadays still store DB credentials and other sensitive stuff in
config.php
or equivalents.

Heck, a lot of self-hosted applications have the option to store data in files in the server (on shared hosts) and I'd bet a lot of them are insecure.

Giving access to any server-side program source code on any website is a bad idea. Period.
>>
>>57309242
>a lot of self-hosted applications have the option to store data in files in the server
What does this mean? You mean a user of the app uploads a file, the file will be saved on the server instead of on a separate specialized server?
>>
>>57309196
Ah, thanks, fampai.

Don't know why I didn't think of that before.
It's like this now
if(Session::has('opponents')){
$old = Session::get('opponents');
$old_ids = [$old[0]->id, $old[1]->id];
$new = User::where('id', '!=', $old_ids)->inRandomOrder()->limit(2)->get();
}
>>
>>57309280
Yes, but there are also apps that store their user database on the server, accessible to the world. Shitty PHP apps tend to do this a lot.

>>57309341
Nice! See how this is more readable? Any colleague / friend / forker could now look at your code and immediately say "Oh, we're looking for 2 random users which aren't our old opponents".

Especially when using Laravel the idea is that you write ORM like prose, not like code.
>>
>>57308615
OK. I found a solution to my problem using vanilla Javascript and CSS (basically making the navbar change back to it's original form when the user makes the window larger after hitting the mobile menu button) but it basically means writing two almost identical classes.

>>57308652
That hit real close to home. I'm still learning the vanilla stuff right now but holy shit, where do I start after that?

>>57308933
>>57308783
Thank you for giving me confidence with these. I might be a weekend warrior with a wagecuck job and very little tech skills, let alone knowledge of the current WebDev landscape, but at least I can make a better looking website than these fucks.
>>
>>57309416
Yeah, thanks again. Hopefully the people who were supposed to look at it still haven't done that. Improved the thing in many ways since I sent them an email about it.

Last time they got an app from me they seemed to value further updates and improvements. This thing was mostly about how quick can I learn Laravel and use it so it will probably be the case this time as well. Gotta love these month-long interview processes. All in all at least I learned a bunch of stuff.
>>
>>57309242
>Yes, but a shitton of websites nowadays still store DB credentials and other sensitive stuff in config.php or similar.
And they're usually .gitignored with a config.example.php. Another popular option is to set it all in environment variables.

Open source means 'Here are the blueprints for a car I made. Please copy them to use yourself and maybe modify the design so everyone benefits from the improvements.' It doesn't mean handing someone the fucking keys to *your* car. And it doesn't mean letting someone else modify *your* car while you're using it.

>Heck, a lot of self-hosted applications have the option to store data in files in the server (on shared hosts)
1. Encryption is a thing
2. Those files are probably either generated by the application or uploaded by a user, as >>57309280 said. If user-uploaded files are executable, the server is fucked, open source or not.

>and I'd bet a lot of them are insecure.
Possibly, but that's true open source or not. Sweeping the security flaws under the rug doesn't make them disappear, it just makes them slightly less obvious.

>Giving access to any server-side program source code on any website is a bad idea. Period.
Plenty of devs disagree with you judging by the many thousands of server-side programs whose source code is freely available. Nearly every server in the world is running Linux (or some *nix), which is open source. You're probably reading this in an open source browser, too. Shit on open source if you want, but it's obviously pretty ubiquitous.

>>57309416
>there are also apps that store their user database on the server
Not necessarily anything wrong with this.

>accessible to the world
This is not okay. If your DB is directly accessible over WAN with no authentication, you're an idiot and deserve everything you get.
>>
>>57310222
You're clearly not seeing my point. The question was whether it was okay to make every server's /var/www/ world-readable. That's never okay, period.
>>
>>57309642
>but at least I can make a better looking website than these fucks
And thats all that really matters. You think guys like that spend time on web dev forums trying to improve or do you think they copy stackoverflow solutions?

I call them paste devs.
>>
>>57308933
yeah that is really obnoxious.. super annoying too. If anything that should hurt the client due to
A) long loading times
B) slow responsiveness
C) jarring animations
>>
Has anyone here experience with React and Vue?

Some people claim that they are more productive in Vue, is that the case for you?
I've only built webapps in React so far and I'm kind of sick of passing props 3+ components deep, so I'm thinking about doing a side project in Vue when I have time
>>
>>57310672
It's probably one of those clients that wanted Flash, so the devs like "Alright, I'll add a loading bar"
>>
I'm wanting to make a small server where people can create accounts, log in, select a game to join then play a simple game.
Now I understand how to build the game logic. But the whole other web part is a mystery to me.

I know I'll need to use some framework for this. Is Django + mysql enough to handle this? I'm trying to get an idea of what all I'd need to work on. I know c/c++, java, and python. Just never done much web work.
>>
>>57311021
...redux...
>>
>>57311021
I have 0 experience with both. The Vue introduction page made it look better but I don't know shit. According to this survey (who knows how they selected who to survey) Vue matches the satisfaction rating of React.
http://stateofjs.com/2016/frontend/
>>
>>57311115
You don't know how to make a user login system and you want to do this as your first project?

Good luck, man.
>>
>>57311130
You still have to pass props to smaller component with redux, as you normally map the state / actions to your containers which pass them to their "dumb" components. The annoying part is e.g. a delete Button with an onDelete function, which is passed on like container -> some list component -> list item component -> button

Though this got a lot better with MobX, where you can directy inject some props, but it doesn't feel as clean (if your store changes you must change lots of components)

>>57311155
Thanks for the link, I guess I'll just try Vuejs out.
>>
for my project i want to draw around 3000 particles on the screen and most will be constantly moving

will js work for this?
lots of calculations happening too
probly really cpu expensive
>>
>>57311161
No, I know how to do that. I'm just trying to understand all the moving parts before I get too deep. Like, I know java should I use serverlets? Well, I also her node.js and/or django is good.
Not sure what to choose.
>>
I've been fucking around with Cordova for a while and I've come with a basic workflow for how I want to do this.

1. User opens the app and enters their username/password.
2. I use JS to capture the information they entered, use AJAX to send it to a remote PHP file
3. Use the info and check it against the values in the database
4. If the data is valid, set cookies (with short lifespans - maybe 10 mins max) and allow the user to access the app.
5. Serve data to the app using an API that can only be accessed with valid credentials.
6. When they logout or close the app I destroy the cookies

Does this sound right? I'm a bit worried about security with the cookies. I'm not 100% sure how to secure an API as well.
>>
>>57273835
WORDPRESS

>2 months ago made a website with woocomerece for a client (first time using wp)
>The main page is standard MEAN stack stuff
>He wanted exclusively the store with the products to be in WP with woocomerese
>OK
>He just called, wants me to make him Blog page
>OK
>login etc. made the page, set up the menus etc.
>nothing happens "Nothing found" its not 404 page tho.

I think I deleted the default blog page long time ago, and cant restore it. Anyone with more WP experience can help me or give me ideas what I am missing ?
>>
>>57311315
generate a api token that is valid for 10 mins only perhaps
>>
>>57311315
>Cordova
*vomits profusely*
>>
>>57311315
Yes.

I use Cordova too and this is how you do it. You can store tokens in local storage and you can also set PHP sessions.

My apps usually don't have logins though.
>>
>>57311220
I think threejs runs on the graphics card or some shit like that, allowing good performance.
http://codepen.io/zadvorsky/pen/PNXbGo/

>>57311282
I worked with servlets (JSF) and had a very bad experience. Now I'm learning Flask, it's so simple yet does almost everything I could do with java in an easier and cleaner way (and for what it can't do there are extensions that do it).
Since you mentioned Django, yeah Django and an SQL db is fine. Haven't used Django myself but I know it's solid. The framework you choose depends more on your preference.
>>
>>57311399
Okay, that's nice to hear. Plus I do like python a lot more than java. I've worked through the tutorial on flask but can't remember most of it.
Might have to go check it out again. Thanks.
>>
>>57311338
Cool, was thinking about having a database field to store token data. Didn't think about that necessarily, I thought cookies alone would have been sufficient.

>>57311369
Didn't think about using PHP sessions to be honest. That sounds a bit more secure since nothing would have to be stored on the device. I'll use tokens for now though since I'm only testing things out.

I'll update in a few hours when I'm done. Thanks for the help guys.
>>
>>57311220
WebGl.
>>
Whats the disadvantages of Python for webdev, compared to backend js and php ?

I mean, I just started using it (Django and Flask and so on) and its great, so simple, clean and easy to manipulate.

Not a single flaw so far. Everything I need to do is out there just need to be set. The docs are really easy to read too.
>>
>>57311330
Not really much of a wordpress guy, but I'm pretty sure the "Nothing found" is what it does when it can't find any posts. Try to make one and see if it shows up.
>>
So I'm hosting CORS proxy (https://github.com/Rob--W/cors-anywhere/) on Heroku (first time touching both Heroku and node.js) and I've a question.
Is there any way to limit the path of the requests? I would like for people to only be able to forward requests to a certain website. From what I've seen I can only limit the origin. Any hope of limiting the destination?
>>
>>57311834
There is none. Just not enough people are enlightened.
>>
>>57311965
there is not an option ot make one... its like I deleted the blog-post.php or something, even tho its there, I think somehow the theme is overriding it or something like that.
>>
>>57311470

If you use PHP sessions, scaling becomes an issue because you can't share state between multiple instances of your app without some extra work. Obviously not an issue for a portfolio project, but it's something to consider if it starts getting some traffic. Also it's not RESTful.

Personally, I'd go with JWT. It's more secure (but compatible with) regular cookies and doesn't require the server to maintain any state, so you can just add more containers if you get too much traffic.

>>57311978
easiest way would probably be to make an express middleware that checks if the URL matches against a whitelist.
>>
has anyone here used electron? if so any advice?

wanted to make an overlay similar to that of AGDQ's for a local tourney series
>>
>>57312314
Yeah but someone can still just grab my Heroku address and use it however he'd like. I guess I will just monitor the logs and blacklist anyone abusive.
>>
>>57311834
Yes. You can ride a unicycle to work but most people prefer some sort of bus or car.
>>
>>57273835

Hi /wdg/,

I wanted to learn python, and was also interested in web-crawling, so I got the idea for a website which finds the most replied to posts in the 4chan archives, excluding OPs. My motivation was partly to find the best porn. I was able to put together a script that did the job, and it was fun and I learned some stuff as well. Quit proud of my achivemnt, especially that I managed to incorporate lazy loading! Next, if I find the time, I would like to add a permanent archive of the most replied to posts ever made. What do you guys think? My site is 4chanposts.com
>>
>>57312314
>If you use PHP sessions, scaling becomes an issue because you can't share state between multiple instances of your app without some extra work.
If you use a load balancer, you can set up a thing to send the same user to the same server for every request while the session is active.

AWS has this, it's called sticky sessions. On AWS you just click a checkbox to activate it and set the session duration. Without AWS you'd have to do it yourself I guess idk.
>>
File: 1476571113531.jpg (66KB, 1280x848px) Image search: [Google]
1476571113531.jpg
66KB, 1280x848px
Wtf do I search in google or anywhere in the docs how to make the "likes" functionality in express js? Is there a better language/framework for this?
>>
>>57312847
What's a "likes" functionality?
>>
>>57312506
There are instructions to set up an origin whitelist/blacklist near the bottom of the readme, I was talking about checking the destination URL with the middleware thing.

>>57312757
Neat, didn't know about that. I would have probably just stored the session in Redis or something.

>>57312847
What do you mean by "likes" functionality?
>>
>>57312958
Again, that's just for the origin. I'm providing this as a "download the files and use the app locally without a server" kind of thing and that's why I'd like to control where the request is sent to, not from where.
>>
>>57312935
>>57312958
You click a button next to a photo or post and it updates the count number in the database once per user and you can revert it back to zero clicking it again, plainly speaking facebook likes
>>
>>57312578
yet its the unicycle that is hard to ride, so is js backend and php
>>
>>57313067
Yes, that's what I'm talking about. In the express server, you need to write a function that compares the requested destination URL against a whitelist (which you provide as a file, env var like the app does, or just hardcode) If it's in the whitelist (or not in the blacklist, if you do it that way), you're good, just call next() and let the request continue as normal. If it's not an allowed domain, end the request with a 403 error or something.

>>57313131
What you've got there is a simple many-to-many relationship. Many users can like a photo and a user can like many photos.

You would do it pretty much the same in any language, but the implementation would differ depending on whether the database is SQL or NoSQL.

Basically, you'd store a list of users that have liked that photo. If they click the like button and they're not on the list, add them. If they are, take them off.
>>
>>57313511
Ah. I see. Time to dive into express middleware then. Cheers, anon.
>>
>>57313642
Actually, looking at that package, it uses the vanilla node http module instead of express and doesn't expose the server's internals. It might be more complicated than that.
>>
>>57312314
You can set persistent sessions with most load balancers. If someone has a session active you keep them on the server where their session is realized.
>>
How does 4chan have trouble paying the bills?

All my sites pay for themselves eith ad revenue and I have less ads than 4chan.
Also 4chan pass and ad services and they save a fuckton by having their own servers.
I think they are full of shit.
>>
I've been programming for a few years with C/C++, Java, and Python, and want to get into web dev, but I'm a little confused.

Say a client asks you to make a website for their pizza business, do you write everything from scratch? Like the entire CSS and HTML? Or do you just use pre made templates and edit them as you need?
>>
>>57313816
websites are expensive, contrary to popular belief where people are like HURDURR THE SERVERS ONLY COST $5 PER MONTH XDDD

I don't think Hiro is being 100% upfront, but even low estimates put it at a monthly cost I really don't believe 4chan is pulling in.
>>
>>57313861
Depends how much they're paying and how much time I have. When people lowball me especially, I'll typically just use some premade shit and slap it all together to still get the money.
But if they're willing to cooperate, yeah I do it from """"scratch"""" (frameworks and the like included).

I've only ever written my own site from full scratch though, html, css, and vanilla js.
>>
I need to fill up a site fast. What's a good markov generator?
>>
>>57307096
>You can write code but you're going into trucking?

>>57307345
>Why be a trucker when you can make apps?
>You just like driving?

A few reasons.

A) I've tried to work a few IT / WebDev type jobs. The simple reality is just that I'm not currently good enough. My skill falls short. I have enough skill to amuse myself, but not enough to meet the demands of my former employers. Maybe I'll try again in the field, after a few more years of practice.

B) The few IT / WebDev jobs I've tried so far have had terrible pay. Trucking can actually pay pretty decent. I can make $500 to $700 per week while training, and $1,000 / week at the end of my training. If I go on to get "Hazmat" and "Tanker" endorsements, I can eventually land a job transporting petroleum products, and can make $120,000 / year while only needing to work 4 out of every 7 days.

C) I do like driving quite a lot. Not sure if I really want to drive 11 hours a day... but whatever. I should also get about 3 hours of free time everyday, which will most-likely be spent in the sleeper, working on my WebApps.

And I may not even be a trucker for very long. Maybe just a year or two, while I save up some money and refine my skills.
Then I might try to get back into IT again.

>>57307096
>You might benefit from sitting down and figuring out some branding stuff. Colors, fonts, that kind of thing.
This is literally my weakest skill. Granted, if I can see someone else's design, I can usually write the CSS to make it happen pretty quickly/easily.
But envisioning my own designs in my head... I just can never seem to come up with anything.

>Slight nitpick, I would reverse that, or better yet gradually gray them out as they get older
I'll probably do something like that. But that's kind of low priority. I still need to finish up all the functionality of the app, then I'll work on the smaller details.

When it is done, I might post about it again.
>>
>>57314025
I made this one, you can have it read from file if you uncomment the commented out part of main, and comment out the rest.
import random

class Shitposter:


def __init__(self, k, n):
self.chain = {}
self.state = ''
self.output = ''
self.text = ''
self.order = k;
self.n = n;


def generate_text(self, input):
self.text = input

# Generate chain
for i in range(len(self.text)):
self.state = self.text[i:(self.order+i)]
if len(self.state) < self.order:
self.state += self.text[0:self.order-len(self.state)]
self.chain[self.state] = self._find_all_letters(self.text, self.state, self.order)

# Generate output
temp = ''
self.state = self.text[0:self.order]
self.output += self.state
for k in range(self.n-self.order):
if self.state in self.chain:
if self.chain[self.state]:
temp = self.chain[self.state][random.randint(0, len(self.chain[self.state])-1)]
self.output += temp
self.state = self.output[-(self.order):]
return self.output


def _find_all_letters(self, text, state, order):
letters = []
start = 0
while True:
start = text.find(state, start)
if start == -1:
return letters
if start + order < len(text) and text[start + order] not in letters:
letters.append(text[start + order])
start += 1
else:
return letters


def main():
# Reads from file in working directory
#with open('mtest.txt', encoding="utf8") as file:
# text = file.read()
#m = Shitposter(4, 200)
#print(m.generate_text(text))

text = input('> ')
m = Shitposter(4, 200)
print(m.generate_text(text))

if __name__ == '__main__':
main()
>>
>>57313816
Probably a combination of a few things:
- 4chan uses a fuckton of disk space and is growing all the time with new users and new boards
- The main ad provider for the past several years recently pulled their ads because:
- most chanfags use an ad blocker and don't have 4chan whitelisted (myself and probably most of you included)
- It was a passion project for moot, so he didn't care about money as long as it broke even, but hiroshimoot probably wants it to actually make money

>>57313861
For small business sites, something like wordpress is usually preferred because the client can make edits to their little restaurant menus or whatever themselves without needing to hire a dev every time they want to make a minor change. As an added bonus, it's just easy enough to use that clients decide they can play webdev and end up fucking everything up, which is always good for repeat business.

>>57314025
Just use some lorem ipsum, nigga
>>
>>57314115
He is making money.

Open this site on mobile recently?
>>
>>57314115
This is what I'm not understanding about web dev, it seems way too simple. Why would somebody pay me to set up a word press when they can do it them selves in a day?
>>
>>57314176
Because setting up a wordpress isn't like setting up a wordpress.com site. It's a different process. Yes, for some people you can get away with just using a basic wordpress theme and zero changes, but for GOOD paying clients, that's just not the case.

Also a lot of people just aren't technically capable. Some might think they are, but they really have no idea without some intense step by step guide telling them exactly what to do.
>>
>>57314233
Thanks for helpful information, but what do you mean by this?

>Because setting up a wordpress isn't like setting up a wordpress.com site
>>
>>57314057
>A few reasons.
Fair enough. Job security might start getting a little iffy within 5-10 years or so though, what with self-driving cars and all.

>This is literally my weakest skill
Same here, and with most devs I've talked to as well. Someone should write a 'design for programmers' book or something. I'd pay good money for something like that.

>>57314174
>Open this site on mobile recently?
Nope, I use Mimi on mobile.

>>57314176
- They're usually too busy and just want someone else to do it for them
- "I'm not good with computers, just make it work"
- Wordpress is "easy" compared to rolling your own CMS, but it still gives you a lot of rope to hang yourself with if you don't know what you're doing
- If they do it and something fucks up, they have to figure out how to fix it. If you do it and something fucks up, they can just call you up and have you fix it.
- Making a custom theme can actually get pretty complicated.

>>57314368
Not that anon, but wordpress.com is managed hosting for wordpress sites with reduced functionality (but piss easy to set up). If you want to self host, you have to install it on your own server, install and set up any plugins, install and set up the theme, etc.
>>
How to make good loking websites? I am new to front end and I am very shitty at arts and design. My website looks like some 9 old year kid made it
>>
>>57314749
Bootstrap
>>
File: 1468557101618.jpg (78KB, 664x502px) Image search: [Google]
1468557101618.jpg
78KB, 664x502px
I need the best bang-for-buck hosting service for a wordpress news website hitting about 100.000 visits per month right now. It's on a 10GB VPS currently and it's just not good enough.

pls help
>>
>>57315110
100000 visits a month is only 3333 visits a day. There are 86400 seconds in a day. On average you have 1 request every 26 seconds. How can a 10GB VPS not serve that? My phone could handle that if I set it up. What did you fuck up so bad that it doesnt work?
>wordpress
You probabily got your server hacked or something. You server is probably being used to ddos other websites and mine cryptos. Don't use wordpress.
>>
>>57315435
current hosting will kick me out in a sec if my vps was acting strange. They do that. No idea why it's so slow, but the admin and the content creators are novices so that's prolly the reason. Not using worpress is sadly not an option. What hosting service can you reccommend? I need it to be noob-proof, like hostinger.
>>
>>57315503
If you don't know how to properly manage a vps, you shouldn't. You want something where you have no control over the servers. ie PaaS
Look into services like heroku or openshift. They allow you to just have your website in a git repository and never touch the server. I don't know what hostinger offers but why not just use them if you like what they have?
>>
>>57315577
will look into those, thank you.
>>
How do I go about building a portfolio?
I am a designer/web developer
>>
>>57315783
You make some stuff and you put it on the internet :^)
>>
>>57315829
not that guy but if nobody hires me how can i have a portfolio? Should I make a few websites that nobody asked for and use that in my portfolio?
>>
>>57315972
Make your own projects.
>>
>>57315110

>>57315577
PaaS can get expensive quick and isn't a massive convenience boost for wordpress. WPEngine is another popular option, they do managed WP hosting. Before doing anything like that, I would go over the WP files with a fine tooth comb and make sure nothing is fishy.

In particular: look for signs of hacking & buttcoin mining, look for any shitty plugins that are hogging resources, make sure caching is working, make sure you're using PHP 7. Also, just see if maybe the server has a rogue processes running or the swap is messed up or something.

As >>57315435 said, 100k/month isn't a massive amount. Something must be wrong with your server.

>>57314749
1. Read some design books. Maybe take a mooc course on design.
2. Find some sites you think look good and think about how and how the different design elements fit together and why they work the way they do
3. The easiest way to improve shitty design is almost always a grid system + moar whitespace

>>57315783
1. Make a thing
2. Put it on github or codepen or dribbble or whatever
3. Repeat 1 and 2 until you have several things you're reasonably proud of
4. Show the things off on a website or something
>>
>>57315979
Also, if you discover something amiss on the server:

Before you change anything, BACK IT THE FUCK UP and make the change on a testing server, and make sure it still runs.
Thread posts: 329
Thread images: 27


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.