[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: 333
Thread images: 39

File: uudg.png (810KB, 821x550px) Image search: [Google]
uudg.png
810KB, 821x550px
/wdg/ - Web Development General

Previous Thread: >>57720734

>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
[Gist] backendDevelopmentBookmarks.md

>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 recommend trying out Vue.js
I've used it in a couple of projects now and it's easy to get into, yet powerful and lightweight.
>>
>>57768063

What is its purpose, how does it work, and what is it?
>>
With PHP/SQL, opening a page connects php script to mysql, does what it does then quits the connection.

Is this desired behaviour?
>>
>>57768362
just another meme js library
>>
>>57768502


Yes it is.

What are you trying to accomplish?
>>
>>57768967

Was just wondering if frequent opening and closing of the connection can be avoided.
>>
>>57768991

Don't worry about it, the process has been thoroughly optimized.

Still, you can actually keep a connection open, but unless you have a reason to do so (other than performance) you're probably better off sticking to default behavior.
>>
>>57769025

http://php.net/manual/en/features.persistent-connections.php
>>
>>57768362
It's a frontend framework, like angular, react, etc.

>>57768991
Are you using PDO? (and using it properly?)
http://php.net/manual/en/pdo.connections.php

You can reuse the same connection over the lifetime of the script by using the same PDO instance, which speeds things up if you need to hit the db multiple times in a script. Some languages can make use of a persistant connection pool, but it's not really much better to do it that way in PHP because of the way it works.
>>
I've uploaded my first HTML to my web host through FileZilla to the public_html folder. However I have no idea how to set it up so that the file is what shows up when I go to my site. Where do I need to put it?
>>
>>57769025
>>57769142

Yeah it's the same PDO instance. I'll rtfm and see what works how.
>>
>>57769249

The server looks for index.(html/php/else).
>>
>>57769249

If you aren't running a scripting language in the background (PHP, for example) just make sure your server is configured to serve static html pages and request them with:

webserverurl/htmlfile.html
>>
>>57768063
is vue.js really nice though or is it just whats hot right now? I thought react had next - what happened? wave hopping js frameworks? we dont do that in harlem
>>
OP forgot to mention hyper.io as a cheap hosting alternative.
>>
>>57769379
react is a bigger ecosystem with more custom renderers

vue is like lightweight react easier to get into but still uses a virtual DOM and provides reactive and composable view components
>>
Do I really need to install a database server and scripting language on my computer and deploy stuff from there to my web host? Can't I just manipulate databases and write scripts and stuff on my web host account?
>>
>>57769456

reproducible environments are a major key
>>
            return preg_match('/set/', $this->conf->queries[$queryname]) == 0 // not a "set" query
?
$query->fetchAll(PDO::FETCH_ASSOC)
:'Done.';


When the query name contains "set", meaning it's an input/update query that doesn't need to be fetched, the function should avoid fetching.

Yet it doesn't avoid fetching. Why is that so?

Does PDO fetch method run independent of control flow?
>>
Trying to add an image to my site. I've uploaded it to the public_html folder but have no idea how to specify it in the html code. Thought it would be public_html/image.jpg but this doesn't work
>>
>>57769542
PHP Fatal error:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in *.php:15\nStack trace:\n#0 *.php(15): PDOStatement->fetchAll(2)\n#1
>>
>>57769552

Try just 'image.jpg'. The server reads locations in reference to current script location.

public_html is just the name of your base working directory.
>>
>>57769279
If you're having some performance problems, that probably isn't the bottleneck unless you're just doing a gargantuan amount of queries, and if that's the case you just need to refactor some stuff.

>>57769379
Personally I haven't used it much, but from what I've seen it actually is pretty comfy. One thing most people seem to like about it is that it just werks without some huge toolchain unlike react.

>>57769456
Cowboy coding aka developing and testing on a production server is usually a recipe for disaster. You technically can do it, but if you fuck something up and manage to crash or 100% a shared server, your hosting provider will get pissed.
>>
Has anyone here tried mobx?

I don't really understand it. It seems like magic.How does it know whether to call your computed properties / autorun functions?

After all, you never specify the properties that are observed, you just use them and it seems to know when to actually call the function.

It obviously can't find out what observed values are required because then the autorun functions would cause their side effects, but there's not really any reflection in JS for this kind of stuff, is there?

I want to learn a JS framework, but I just don't know which. React + Redux is a nightmare, React + MobX is Magic, Polymer becomes 2 way databinding madness way too quickly and Angular 2 is huge and slow.
And nobody seem to use Vue with Vuex, so I don't know about that.
>>
>>57769607

Not having problems just wonder if a persistent connection is better.
>>
>>57767395
How do I stack two images on top of each other and center the smaller one in the center of the bigger one?
>>
>>57769651
Do you know which image is the smaller one?
>>
>>57769560
>>57769542
hmm

            print '<pre>'. $queryname . ' is a set query: ' . print_r(preg_match('/set/', $this->conf->queries[$queryname]), true) . '</pre>';


results in

getIdentity is a set query: 0
setIdentity is a set query: 0


Guess I need to hone my regexp skills.
>>
>>57769685

testing it, though:

    $queries = ['setIdentity', 'getIdentity'];

foreach ($queries as $queryname)
{
print '<pre>'.$queryname.' is a set query: ' . print_r(preg_match('/set/', $queryname), true) . '</pre>';
}


results in

setIdentity is a set query: 1
getIdentity is a set query: 0
>>
>>57769670
Yes I know the exact size of both of the images.
>>
>>57769718
are you QUERYING my gender IDENTITY
TRIGGERED
>>
>>57769760

I ain't querying shit right now as you can see.

For some reason the exact same thing results in two different results.

There must be a typo or something in there.
>>
>>57769542
>>57769560
>>57769685
>>57769718
>>57769760
>>57769779

GOOD GOD am I an idiot. The first example checks "set" against the array value of $queries[$queryname] and not the actual query name.
>>
File: 2016-11-30_11-27-57.png (279KB, 397x336px) Image search: [Google]
2016-11-30_11-27-57.png
279KB, 397x336px
>>57769651
>>57769729

Never mind I did it
>>
>>57769542

so don't fetch anything.
>>
>>57769852

I'm not anymore lel.
>>
Stupid question but
WHY THE HECK doesn't anything work exactly like <center>.
align: center;
align-text: center;
align-items: center;
margin: 0 auto;
width: XXXpx;

STILL NO CENTERING WTF
>>
>>57769883

post your fiddle and we'll take a look.
>>
>>57769883

#something
{
display:block;
margin:0 auto;
}

>>
>>57769883
Well there are things that work even better like Flexbox and Grid, but thanks to the IEturds those features are literally never ever going to be usable.
>>
>>57769883

you probably have CSS somewhere else that's messing things up

https://jsfiddle.net/3zj5je8w/
>>
>>57769949

if by all those IEturds you mean 10% of browser users, sure.

you don't really need to use flexbox or grid anyway for something as simple as centering stuff.
>>
>>57770074
The alternatives are usually pretty shitty. Display: table and display:table-cell fuck up a ton of other things and so do position:absolute and transforms.
>>
What about NearlyFreeSpeech, is it a good idea to use this for a portfolio and blog website?
>>
>>57770100

position:absolute and transforming for centering something would be dumb as hell.

margin and text-align is all you need most of the time.
>>
Just got done developing my final project after having minimal web experience.
Used Java, play framework, ebeans, mysql, and bootstrap.
Crazy times, and documentation for play is ass. Absolutely garbage. But at least I know how to make a knock off 4chan site with logins.
>>
>>57770119
Yes, when centering horizontally, that is enough.
But then there's vertical centering of elements whose height you don't know.
>>
>>57770111

i don't see why not, tons of hosting out there....just make sure it supports whatever technologies you're going to use. nobody is going to care about your hosting service when they're looking at your app.
>>
>>57770148
Thank you, sir/madam/misc.
>>
Any UK-based web hosts that don't suck?
>>
>>57770249
Nope.

http://www.theregister.co.uk/2016/11/30/investigatory_powers_act_backdoors/
>>
>>57770133

display: table and display: table-cell won't mess with other stuff if you parent/child your elements correctly. All it does is pretend your divs are table and td elements.

https://jsfiddle.net/yh7x7nk1/

this shouldn't mess with anything else on your web page, unless you give it the same class of course.
>>
I'm building a fullstack application, where a React frontend interacts with an Express API server. I want to test cross-origin requests (e.g. the react client hits an express post route which will fetch api data from some remote api somewhere).

However, you can't do that with the file protocol that localhost serves content with. How do I get this stuff running on http? Will I just have to upload to a hosting service like Heroku and incrementally test it like that? Seems like a major pain in the ass.
>>
>>57770363

forget to add in a row... throw in another div and display: table-row it, then the div you are going to display: table-cell would go inside that
>>
>>57770392
Post some code. You should be able to do http requests just fine on localhost.
>>
>>57770476
Chrome throws this error if I try to contact my locally hosted Express server from the React client it serves up.
bundle.js:28243 XMLHttpRequest cannot load localhost:3000/yelpFetch/yes. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
>>
I'm trying to build an RSS feed for my site using php. Can anyone tell me why no rss reader is showing anything with my feed?

http://collinoswalt.com/feed/

in PHP I have
header('Content-Type: text/xml; charset=utf-8');
>>
>>57770502
As far as your browser is concerned, it shouldn't be a cross-origin request if you're proxying it through your express server.
>>
>>57770419

I made a simpler example... if you apply and "imitate" your divs like a table, you have more control over them like vertical alignment, etc. The tricky part is nesting your divs correctly, but if you know tables there shouldn't be any problems.

https://jsfiddle.net/hhxLhxha/
>>
>>57770567
I was sending the AJAX request to 'localhost:3000/thepostroute' rather than just '/thepostroute'.

wew lad

thanks for making me walk through it again
>>
>>57770641

ok last one I promise. CSS is funz.

https://jsfiddle.net/hhxLhxha/1/
>>
other than job opportunities, what are the advantages of PHP over node.js?
>>
>>57771607
Well, like Perl, pretty much every shitass dirt cheap shared server has PHP support. If you want to run a node app, you need a VPS can be a bit more expensive and involved to set up.
>>
Should I consider using free hosting from hostinger.co.uk or onesite.co?
>>
if i add a confirm pop up window in js after i submit a form that runs some php, the php code will be stopped UNTIL the user selected "ok", right? Or does it run anyway? i'm trying to make sure the user really wants to delete a row in a table....
>>
My shitty little site has a problem.

Everything looks really good on my monitor. But whenever i connect to the site with a different resolution everything breaks.

i've got an image and a video player that i want to make a certain percent of the screen. But i've tried shit that i've found online like "width: 80%" but it doesnt really work.

Could someone tell me what i'm doing wrong?

etc.
I have a background image thats stretched. an image that's centered, and a video player in the middle of that image.
>>
>>57772160
No, PHP execution happens on the server, not the client. It happens as soon as the server receives the request. If you want to ask the user to confirm, you need to do it before you send the http request.
>>
>>57772216
Post screenshots and css
>>
File: uKBdeFQ.jpg (115KB, 1068x1823px) Image search: [Google]
uKBdeFQ.jpg
115KB, 1068x1823px
>>57772238
This is what the page looks like right now in super stretched portait. I'm designing it for 16:9 but shit is outside the screen so i took the picture in portrait.

I want the gray box to be in the middle of the screen and be the backdrop for the video and the button.

it's more or less the first site i've made so pls dont laugh at my shitty code.


http://pastebin.com/hmJNaQV6
>>
What's a good and fun project to build when you're just starting out?
>>
>>57772160
You should make js ask the user onsubmit, then if they select no return false. Stops the form submitting. Otherwise returm true and it goes ahead.
>>
>>57772216

just bootstrap it or something, i haven't even looked at your code but im guessing its shit m8
>>
>>57772791

thats what i was thinking but since js is client how would it stop the server side php? i think >>57772219 is right
>>
>>57772852
>how would it stop the server side php?

It doesn't. You send the HTTP request only when the user confirms.
>>
the more i practice and study the more i realize how far behind i am
it feels like an endless chase to catch up in web dev
>>
>>57773078

that sounds like to me the php would go inside the js condition that decides if the user confirms or not. But with php i do a condition first to see if the submitButton in the form is set. So i'm still confused.
>>
>>57772507
Just two things I quickly noticed:
• Avoid using inline style sheets (<style> tags, rather place this in its own file). It promotes reusability of the same styling throughout other pages.

• The <body> background attribute is not supported in HTML5. Use CSS instead.
>>
>>57773169
Same and I feel that way already just for web design.
>>
>>57773180
>make form
>have a button (anchor will work) with onclick="somejs()" that doesn't send the request
>have somejs function that prompts for confirmation
>when confirmed, submit the form


<script>
function ask()
{

if(prompt('wanna send the request?'))
{
document.querySelector('#myForm').submit();
}

}
</script>

<form method="post" id="myform">
<button onclick="javascript:ask();" type="button">Send</button>
</form>



or just


<form method="post">

<button onclick="javascript:prompt('wanna send')?this.parentNode.submit():null" type="button">Send</button>

</form>



not sure either will work out of the box, haven't done this in a while
>>
>>57773284
Also the <centre> tags aren't supported on HTML5 either. You can achieve the same effect by using the margin: auto, margin: 0 auto properties (if the position isn't set to absolute)
>>
>tfw have 700+ screenshots of various websites in my inspiration folder
>tfw chop shit I like and photoshop everything in to see how it would look like
>part of the photoshop file is a screenshot of already coded website, and other parts are just layers with various designs from other sources

I swear to god I have the weirdest fucking web design process.

>inb4
I design before I code, but when I decide to switch things I'm stuck with the already coded thing. It's not that bad because making tweaks is easy.
>>
>>57773319
You can change the <button> to <input type="submit"/> and instead hook the form on submit event
>>
I'm having some problems with my FF newtab page and autofocus features.

Right now, whenever I open up a new tab with "NewTabOverride" addon, it opens my startpage correctly, however I find that my address bar has focus instead of my search bar. If I refresh the page, it autofocuses correctly after it loads.

I cannot for the life of me figure this out. What did I miss /wdg/?
>>
>>57773364
I did something similar for my last website. It turned out very well. Good luck!
>>
>>57773169
>>57773309

do you know exactly what you wanna do?

>web dev
>web design

These terms are really vague. Do you want to do web graphics? front end dev? back end dev? all of it? web dev is chopped up into 3 parts in my opinion.

>graphics, user experience, look/feel (photoshop, illustrator, wireframes)
>front end development (html/css/js)
>back end development (sql/php/node/asp.net)

I'm a big believer in starting with data. Know how to CRUD. Know how to work with data. Have data to use. Either find it or create it. Know what your app is going to do. Plan out the functionality. Then work on the visuals and experience. If you have the "blank screen" problem you're trying to cross the bridge too soon, my friend.
>>
>>57773437
yes i want to do web apps, esp SPAs
full stack

i have made a ton of them and can do alot of cool work but i still feel far behind
>>
File: 1281443970442.png (53KB, 365x188px)
1281443970442.png
53KB, 365x188px
Why does everyone keep saying web apps?
>>
>>57772507
Wew

Okay first of all, get rid of the <center> tags and align=center attributes. All that shit is depreciated, you're supposed to do it in css now. And it's bad practice to use style attributes, especially when you already have an inline stylesheet on the page. Keep things organized and DRY. Usually you'd want to put the css in its own file anyway.

Now that that's out of the way, if you want the player inside the gray box div, you need to, ...you know, put it inside the div. Not under it.
So, roughly speaking, this is what your code should look like:

<style>

. . .

#playerContainer {
background: /* read the docs for this css property. set the background image here instead of in an <img> tag and use a color as a fallback */
/* this is also where you position the playerContainer div on the screen. Use the margin property if you want it to be responsive */
}
#player {
/* player positioning code goes here */
}

</style>

. . .

<div id="playerContainer">
<div id="player">
<script>
// player code, etc
</div>
</div>

<!-- button or whatever goes here if you want it outside the divs -->

>>
>>57773507
Because it's shorter than saying 'web applications'?
>>
File: app.jpg (37KB, 600x450px) Image search: [Google]
app.jpg
37KB, 600x450px
>>57773507
>>
>>57773481

You sound further than i thought. If you can CRUD and you're building SPA's already, look into the latest front end frameworks like React or something. Are you employed? What do you mean when you say you still feel far behind? If this is a situation where you feel this way because you're using older technologies, then I think you're stressing too much. I know programmers still using Pearl, Cobol, etc. They exist. It's not a big deal if you want to use something newer, in fact it's probably a good thing. However if you mean you're not at the level to be employed and have a career, then I would recommend diving into data first like I said in my previous post. Big data especially.
>>
>>57770551
bumping for help?
>>
>>57773616
neet.
i'm far behind because i dont know techs like react/angular/python, or even basic algorithms. i am technically employable because i can do work but i feel like im far behind the average junior level employee. maybe your data approach is a good idea.

yes i can crud and build api's from scratch
>>
>>57773764

what are you using to build your SPA's now? can you fizz buzz? if you're technically employable then i don't see a reason why you're not learning on the job. Could be a disaster, could go great. I was let go from a previous job because I didn't know ASP.NET CORE and I honestly did not want to learn it. New job is going great. Average junior level web dev is around your level, i'd say. Junior software engineer...now that's a different story.
>>
>>57773946
js/node/mysql...i do everything in js including any animations

>asp.net
like 7/10 jobs require that around here, it's horrifying
>>
>>57773977

yeah they actually forced all the programmers there to start using it. There was only 3 of us, but the fact that i've never used asp.net anything, the CORE stuff was over my head and I already hate M$. Plus the commute was terrible.
>>
>>57773745
Working fine for me m8
>>
In the market for a new laptop.
So what laptop do you guys use?
>>
>>57774207
>>57763829
>>
>>57773437
Honestly, I don't feel like doing this for a living anymore. For myself, I find that I really enjoy designing things, but at the same time I don't think of design highly.

I'm finishing bachelors in digital media so I did both, worked a few months as a frontend dev, but the position was stupid because I was actually more of a designer and coder, and did some frontend on side.

Have experience with PHP, JS, databases, Python, Rails and frontend frameworks like Angular, React and Vue, but I find coding and programming a pain in the ass. Even the satisfaction I get from making some shit is not worth it.

So I guess if I had to stuck with web industry, I'd rather do design, but after my current project I'm not sure anymore. Shit is exhausting as fuck, and nobody will care that much in the end anyway.
>>
>>57774270
get into UI / UX?
>>
>>57774143
....great fucking screenshot.
>>
>>57774488
That's one of the options, yeah. But I hear UX is one of the most boring jobs ever.
>>
>>57773745
>>57770551
https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fcollinoswalt.com%2Ffeed%2F
>>
>>57774646
how new?
>>
>>57773409
bump
>>
>>57774646
as is tradition
>>
File: YogaFap130.jpg (97KB, 540x675px)
YogaFap130.jpg
97KB, 540x675px
I put this site together in under 24 hours. Thoughts?

http://www.yogafap.com
>>
>>57776458
>http://www.yogafap.com
lol
>>
File: 1480474151691[1].jpg (19KB, 480x405px) Image search: [Google]
1480474151691[1].jpg
19KB, 480x405px
>>57776458
I think you need some type of system to ensure uploads match the site's intended purpose.

>pic related from your front page
>>
File: 1476292054863[1].jpg (29KB, 480x480px) Image search: [Google]
1476292054863[1].jpg
29KB, 480x480px
>>57776458
>>57776552

kek
>>
>>57776552
i have a sql flag for each image called "approved". all the images that were there before are all 1's so i can just change up the quuery
>>
File: Capture.png (1023KB, 802x846px) Image search: [Google]
Capture.png
1023KB, 802x846px
>>57776581
>>57776552
klmfao
>>
File: wasm3.png (72KB, 837x556px) Image search: [Google]
wasm3.png
72KB, 837x556px
Is pic going to be the hot new meme soon?
>>
File: error.png (75KB, 1367x569px) Image search: [Google]
error.png
75KB, 1367x569px
Taking some webdev courses at my community college and im doing this tutorial for ASP web forms.

https://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/ui_and_navigation

I finished up to part 4 but when I run it at the end of that section I get this error. Dont think there could be much wrong with the code considering its a step by step copy paste tutorial.

According to the tutorial when I run the program the initializer should be creating the database in the App_Data folder but its not

Could any kind anon help?
>>
Made a quick script to show some snowflakes on your page in canvas:

https://github.com/collinoswalt/Flakes.js

demo:

http://collinoswalt.com/list.html
>>
>>57779958
>http://
I ain't clicking that shit nigga
>>
File: ScreenHunter_21 Nov. 26 14.41.jpg (43KB, 473x451px) Image search: [Google]
ScreenHunter_21 Nov. 26 14.41.jpg
43KB, 473x451px
>>57767395
So I'm old as fuck and fell out of the loop and apparantly front-end developer doesn't straight up mean building out a website anymore.

Which of these 40 million JS libraries am I meant to learn? All the design jobs seem to be going to pakis.
>>
I'm using a PDO object in PHP to make mysql queries. Whats the best way to tell if a query returned no rows?
>>
>>57780076
All of them faggot.
>>
>>57780076
javascript, jquery, react, angular are the names I heard the most without knowing much about angular or react
>>
>>57780035
>being this paranoid

Do you disable all JavaScript by default so that you can open all your html in lynx first, inspect the script tags, and then enable javascript if it's absolutely GNU(c) certified(tm) Free as in Libre (r)?
>>
>>57780085
Isnt there a $db->num_rows() == 0 function? Never worked with PDO
>>
>>57780212
He has a point though. All HTTP traffic can be intercepted and monitored because it's not encrypted. With HTTPS you do have a bit more security (as long as the CA hasn't been compromised or you're being targeted)

Last thing someone wants is to see Sea Pee on a website like that.
>>
>>57780085

$q = $mysql->prepare('SELECT dicks FROM butts');
$q->execute();
$dicksCount = $q->rowCount();
>>
>>57780330
Nobody is interested in your traffic. You're not important enough for the NSA
>>
I want to display a random webm from a folder.

What do i do?
>>
>>57781270
<video src="folder\title.webm">

add autoplay and loop optionally
>>
File: American Quake.jpg (32KB, 538x344px)
American Quake.jpg
32KB, 538x344px
>>57781522
Thank you, but i want to display a random webm from that folder.
>>
>>57781568
use javascript
>>
>>57781568
javascript
var videoStorage = [ 
'folder\title1.webm',
'folder\title2.webm'',
'folder\title3.webm'',
'folder\title4.webm''
],
video = document.querySelector('video'),
activeVideoUrl = videoStorage[Math.round(Math.random() * (videoStorage.length - 1))];

this should do the trick, but i haven't tested it
>>
>>57781734
eugh, fugged up this part
    'folder\title1.webm',
'folder\title2.webm',
'folder\title3.webm',
'folder\title4.webm'
>>
File: Quake Sketch.jpg (136KB, 513x768px) Image search: [Google]
Quake Sketch.jpg
136KB, 513x768px
>>57781734
Thanks a lot!

i'm very very new at this, and havent really used javascript yet.

I read somewhere that i make an 'index.js' file in the same folder, and paste your code inside it. i then put <script src="index.js"></script> in the head. is that right?

my webm player looks like this atm.
                     <video width="700" heigth="400" autoplay loop onloadstart="this.volume=0.4">
<source src="gifwebm/freespeech.webm" type="video/webm">
</video>


How exactly do i turn my current src="file" into the random script variable?
>>
>>57781796
bump
>>
Why in the almighty fuck would anyone pay $20k for a bootcamp, when they can just learn all this shit on their own, BETTER?
>>
So I got hit by a sustained 15Gbps DDOS attack
My vps is setting up a DDOS protected ip for an extra $5 a month.
Anyone have any experience on what the next step if this fails, is?
I want to avoid cloudflare (privacy concerns) but open to ideas
>>
>>57781796
If its a small project, you can get away with directly injecting javascript into the html using <script> tags. Else learn how 2 unobtrusive javascript.
>>
File: id Software Lakehouse.jpg (288KB, 1280x861px) Image search: [Google]
id Software Lakehouse.jpg
288KB, 1280x861px
>>57782414
but how do i call the script to get a random video in return?

and how do i take the returned random video and put it in as a video source?

<video id="video" width="700" heigth="400" autoplay loop onloadstart="this.volume=0.4">
<source src="gifwebm/90s.webm" type="video/webm">
</video>

<script>
var videoStorage = [
'gifwebm\01.webm', # i dont know if '\' is a typo so i wrote half with '/'
'gifwebm\Stalker.webm',
'gifwebm/avemaria.webm',
'gifwebm/kitten.webm'
],
video = document.querySelector('video'),
activeVideoUrl = videoStorage[Math.round(Math.random() * (videoStorage.length - 1))];
</script>


this is obviously wrong
>>
>>57782505
use '/'
'\' is typically used to escape spaces from file names on windows
so if your file name is "funny cat.web" the path would be 'gifwebm/funny\ cat.webm'
>>
File: Capture.png (10KB, 627x161px) Image search: [Google]
Capture.png
10KB, 627x161px
i'm trying to echo some simple html from php but I dont want to escape all of the quotation marks because thats shit. what do?
>>
>>57782414
Don't listen to this pleb. You shouldn't embed JS in your HTML.

You will need to first tell your html page where to find your JS file. You do this in your head with the script tag

<script type="text/javascript" src="example.js"></script>
>>
Okay here's an onslaught of retarded questions

>I've been doing frontend development for some time now (html and css)
>Then I went on to backend development (python and flask)
>Now im making my way back to frontend to learn javascript

I don't know where to get started though and I'm confused by a few things.

I want to go into frontend web development, what exactly do I need to learn?

I know I need to know javascript, but I'm not sure what specifically. I've heard about different versions, and ES6, and ES2015 - I'm just confused as to where to start and I can't afford to waste time learning something not critical.

Also, what route should I take? I'm guessing javascript -> jquery -> react -> angular

Is there anything else I would need for frontend web development?

Also, how the fuck are sites structured? If I was making an ecommerce site for example, would I just make an api and then have javascript call to it and populate the information on the page using the data? Where would I host the api, if I have a separate /api/ directory, wouldn't that be unsafe?

Also, has anyone here gotten a job in frontend developerment without a cs degree (i'm a polisci specialist) and if so how has the work been? Is it harder than you thought? What are some skills you absolutely need to know? What do you do day to day?
>>
File: Screenshot_1.png (19KB, 400x336px) Image search: [Google]
Screenshot_1.png
19KB, 400x336px
>>57776458

>kek
>>
>>57767395
Is it better to have another sub-page (page2.html,etc.) or can I build everything on the index site and just hide/show the content + nice transition? I think it would look and feel better but I'm worried that it's too heavy to load or doesn't work with some browser
>>
>>57782640

Use HEREDOC
>>
>>57782640
Don't echo html. Get out of php mode before your html and surround put the variables in the html inside expression blocks.
>>
File: output_EN0RP0.gif (624KB, 600x450px) Image search: [Google]
output_EN0RP0.gif
624KB, 600x450px
I implemented this functionality and now I'm not sure anymore if it is a meme or not.
>>
>>57784729
i think it's good especially for long articles
>>
any more fun css/js stuff like

particle.js
animation.css
hover.css
>>
>>57784729
it feels both good and a meme
>>
Can not for the life of me figure out how to find an entry by it's _id in mongodb.
 collection.find({"_id": ObjectId("583ffaf8a63c652bac9a9eee")}) 

returns nothing. If I adjust the query to find the entry using another key value pair it finds it and obviously also returns that particular _id.
>>
>>57784729
I would prefer if there was also a top of page button next to the context menu, sometimes you want to go to the top of the page for something that isnt in the header.

This depends on the website in question though
>>
does everyone just ask questions in /wsg/ threads?
>>
I'm trying to replace a td element in a table with a greasemonkey script

 (function() {
'use strict';
var tr = nth-child(5);
var td = nth-child(3);
var newTd = document.createElement('N/A');
td.parentNode.replaceChild(newTd, td);
})();


I know that the first element is 0 so it isn't a problem with the cell location.
It isn't replacing shit
>>
>>57785091
Is that a rhetorical question?
>>
Best software to make websites on? I'm talking webshops and forums etc, not pleb homepages.
>>
Imagine this scenario:

> user comes to a blog/news site/streaming site
>starts browsing
>while he scrolls and looks for interesting content he just clicks a button next to thumbnails which adds articles in something similar to "save for later" box
>when he went through all the new content he clicks somewhere to start reading everything
>sidebar on the left shows up with a list of the content he selected
>he reads through all of the articles which are constantly loaded with AJAX, while sidebar shows what articles come next (similar to Forbes)

Retarded or genius?
>>
Any cheat sheets to get 5 webpages up and running for a project? Doesn't need to be anything fancy, just beyond box-level stuff. Also, what's a colour scheme that works well with anything?
>>
>>57785042
Solved. Problem was using find() instead of findOne()
>>
>>57785889
Just use Bootstrap, create some simple shit, fill in content and (re)style it properly.
>>
Can anyone tell me the reason for contact forms?

For my website I need to take Name, Number, Message, and Possibly an image or 2. I feel like a lot of our users (Tend to be slightly older) would rather just use their own email client they are familiar with, especially when uploading pictures.

Are there other reasons? I know about spam but our current website has the address on it and its really not that big of an issue.
>>
Guys how do I get greasemonkey/tampermonkey to match a webpage which uses a sessionID? (url changes every login).
>>
>>57786129
contact me using [email protected]
or press here to use the shitty fucking nigger contact template I downloaded from the internet
>>
>>57785889

you dont need a cheat sheet for a simple 5 page website, anon
>>
>daily reminder if you don't know what Date.now() represents, you're not a real web dev
>>
>>57786736
>daily reminder if you use javascript you're not a real web dev
>>
>>57786736
The duration your mum has been chocking on my dick. I swear I can't get her off it.
>>
>>57786834

>daily reminder if you're not using async js you're not a real web dev
>>
File: 6152a8c9a7d7540.jpg (67KB, 600x450px) Image search: [Google]
6152a8c9a7d7540.jpg
67KB, 600x450px
what will cost more:

- renting a cheap ass server
- installing ubuntu server on pic related (2GHz CPU, 2GB RAM, ~200 GB HDD) and "draining" my own electricity and bandwidth

i just want to learn php, including on how to install it by myself. i will also want to connect it over the internet.
>>
>>57786895
Its much better to just rent a vps or something. Did the whole home server meme at some point, but you end up just sshing to it anyways and you can never use it for a public facing website because your net would go down instantly the second someone wants to fuck your site since you have zero load balancing and then your ISP complains you're causing outages and threatens to blacklist you
>>
>>57786895

i would guess a cheap hosting service. 99% of them support php already and are dirt cheap.... But if you wanna set up your own server then do it
>>
>>57786937
>>57786956
you just convinced me to try both. nice job
>>
>>57786956
>hosting service
>paying 20x the price for an awful experience so someone else can run the 3 commands it takes to install php and apache/nginx
>>
>>57786895
>just want to learn php
First, poo in it.
Second, lrn2virtualization.

>>57786937
Pajeet wants to learn, not build some enterprise application.
>>
>>57786895

Neither.

Just download XAMPP and run the Apache server, then use SQLite to manage your DB, then play with php code in your site files. Super quick and easy. Download a random DB file to mess around with.
>>
>>57787065
>>/v/
Its much easier to setup and use Apache/nginx on ubuntu or a similar server OS and gives you 100% customizability on everything related to that webserver such as what php version you want/need, mysql, mariadb, pma, etc.

People who use XAMPP are autistic niglets without a future. Much much quicker to install apache2, even on windows 10 through bash
>>
>>57787157

jesus christ man the guy just wants to learn some beginning php, I almost only recommended w3schools
>>
Do I have to do any extra work to get a sitemap that's generated on WordPress's init hook to end up in my nginx cache? I think I might have to, considering there's no way it would no to refresh the cache without me telling it to somehow. Anyone have any experience with this?
>>
>>57786494
tampermonkey isnt web shit in my book this is just a stupid question but here goes...

you can use @match and the wildcard character *

for example:
// @match *://mail.google.com/*
>>
>>57786129
thats funny one of my clients just emailed me for the 5th time trying to figure out why nobody uses the contact form

his phone is ringing off the hook btw... i gotta start charging more
>>
>>57782895
you dont sound patient enough to learn the background to understand the answer to your question about JAM stack
>>
File: 1478409446022.jpg (48KB, 396x385px)
1478409446022.jpg
48KB, 396x385px
alright lads I want to learn node.js. Is there a good book for it I can get? What is the fastest way to learn it?
>>
how do i confirm a delete query a user runs via html button?
>>
>>57790038
If you know Javascript, then you're basically done. Just install Express or Koa and you're good to go.
>>
>>57780356
$q = $handler->prepare("SELECT dicks FROM hughanus WHERE row = :mightnotexist");

$q->execute([':mightnotexist'=>'urnan']);
if ($q->rowCount())
echo 'Row exists!';
else
echo 'Row doesn\'t exist!';


exde
>>
>>57786895
Get some heroku box or something, doubt you'll get near the free-tier limits.
>>
>>57790168
If you're calling an API from an AJAX call, just return some JSON to say it worked, and on the AJAX success just run
p = JSON.parse(data)
and do whatever you need with that.
>>
>>57790038
Google nodebeginner pdf
>>
>>57790366

i mean a confirm prompt or alert to ask the user if they really want to run the delete query. I was thinking to have the "ok" button run the query, then a cancel button to exit and not run the query. Easier said than done though
>>
>>57790684
Well you could just setup a dialog that gets triggered when you click the button, label it with a special class like
del-btn
, setup some jQuery that is loaded on every page, then when a
del-btn
is clicked, it loads a dialog asking the user if they really wanna delete that, then watch for the event of them clicking "OK." :)

Then of course do all your code.
>>
>>57790324
I barely know javascript so I guess I should start there then. What's the fastest way to learn javascript and are there any good books for it?
>>
>>57781734
i tried running this script in the terminal and got 'ReferenceError: "document" is not defined'

is this because i'm trying to run the script by itself or is the script broken?
>>
>>57791066
Document is for a browser
>>
>>57790795
The fastest way to learn it is to do it. And not do it like coding exercises; that will help, but without a context, you won't understand what you're doing. If you already have a project ready, try adding client-side stuff to it like validation, ajax calls, etc.

You can start off with books--I don't have one in particular, but I find w3schools is adequate.
>>
>>57790795

REVERSE ENGINEERING
E
V
E
R
S
E
>>
if i know php how hard would it be to learn node? js on server side scares me
>>
>>57791511
It's not hard. You'll have the usual quirks of javascript like callback hell, but it's manageable.
>>
>>57791511
If you only know PHP it's gonna be a bit of a chore to start understanding how sockets and etc work, if you've ever made an entire PHP site then after that made a PHP site and used lots of jQuery as well, it's a really awkward feeling :P

Node is awesome tho! You gotta come out of your PHP shell :-)
>>
File: O8YcnJO.png (15KB, 579x238px) Image search: [Google]
O8YcnJO.png
15KB, 579x238px
>>57791322
got it, ty

>>57781734
var videoStorage = [ 
'folder\title1.webm',
'folder\title2.webm'',
'folder\title3.webm'',
'folder\title4.webm''
],


is it possible to have a document file with the file names written in the same format and have "var videostorage" load from the file instead?
>>
>>57791558

i made a CRUD app with php/pdo/sql. DB wasn't very big but a lot of tables. Threw in some js and jquery to do dynamic front end events.

a-am i ready for node?
>>
>>57791675
Yea, just make sure you understand that the backend is the backend, and your frontend is still the frontend, backend can't touch things like fragments, etc...

You might wanna move from jQuery when working with node, you'll wanna use its simple GET / POST requests but you can do some quick googling and there's a better package called request, just be ready to google :')

I suggest starting here for Node, will make you excited for what you can actually do:

http://socket.io/get-started/chat/
>>
>>57791841
NodeJS is good for fucking around, never production.

Your code will rely on 3rd party libraries, each developed by some guy that will abandon it in a year.
>>
>>57791905

yea i've never seen a big production company use it. Seems like the only ones who use it are solo programmers looking to try new stuff, or a start up trying to seem edgier than everyone. The node js wiki says LinkedIn uses node...don't know how or where since LinkedIn is one of the slowest and bloated web apps I can think of. Good lord I hate that site, especially mobile. Still, though, I want to learn node solely for the non-blocking type stuff. Learning anything faster and more instant will keep me entertained. Doubt I'll use it at work though
>>
>>57785595
you just described how rss feeds work
>>
>>57791905
>>57791990
I hear this meme for the first time. Wtf? What do you recommend then? PHP or Django again?
>>
>>57792025

sounds like a site using a shit ton of news sites API's
>>
>>57792025
No, they gather content to you, but here the user reads it immediately after he chooses his reading list. Like when you go to a shop and pick up all that you want and then get to the checkout.

So, you don't have to read, then find something interesting to read next or go back, then read again, then find something again... It's like when you go to a wikipedia and first you middle click all the links you are going to read about, and then you go through all the open tabs one by one... So you don't break the flow.

Kek, I don't even know anymore, it seems... useful I guess? Does this even make sense?
>>
>>57792136
So like the firefox pocket feature?
Just basically downloading articles for offline reading?
>>
>>57792202
No, you read it ON the website. You go through the frontpage with all the fresh articles - you click on thumbnails to "read later" - on the sidebar a list has been created from those articles - when you through everything you want to read you click on the list and you start reading one by one (articles are loaded by ajax, so infinite scroll) until you go through all of them.

Basically, the list then would look like here:

http://www.forbes.com/sites/jasonbloomberg/2016/12/01/ca-technologies-announces-intent-to-acquire-enterprise-automation-leader-automic/#74a59627ba89

See on the left, it actually literally says "reading list", imagine these are the articles you chose. See how the list moves when you pass the current article.

Like, I'm using this right now on 4chan catalogs. I don't want to go back to find that thread I wanted to read, so I first go through the catalog and open everything I want to read in new tabs.

Does this still make any sense?
>>
File: 1445699819997.png (313KB, 980x955px) Image search: [Google]
1445699819997.png
313KB, 980x955px
Automatic localization and redirection based on geography and/or IP needs to stop. Does anybody want to start a campaign against this basic human right violation?

We can make a 1 page bootstrap themed campaign to spread the word about the evils of ip redirection, on top there could be photo of black, asian, latino and kinda-white-but-you-cant-really-be-sure people (mostly women too) so you know our message is inclusive to people of all races, genders and cultures.

A couple talk points

A website shouldn't decide your preferences based on your current location. If the website primary language is English, the page should render in such language, with an optional feature to change the language if so the user desires, but never automatically.

Some websites go even further against the individual will of the user and assign languages to a parent culture, basically insulting the user by erroneously assuming that they MUST be part of that culture. For example, the Portuguese language next to the Brazilian flag, the Spanish language next to the Mexican flag and the English language next to the American flag. This of course excludes websites that are exclusive to those countries (such as newspapers, local businesses, etc).

We can start with the logo.
>>
>>57792289
It sounds okay as long as you can just right click once and it'll be added without any additional popups, otherwise I will just middle click to open it in a tab.
I assume by clicking once it will be added to the reading list and some sort of fade out to indicate it was selected and if clicked again it will be removed from the list?
Now we'll get into how this is bad. What if a normie clicks it and wants to read it right away? They are trained to think that if you click something you are redirected to that article right away
>>
>>57792407
sounds great!
setting up the rizon irc channel as we speak
>>
>>57792035

idk man. I see more A$P.NET and PHP jobs than Node jobs....if you're trying to get a job... Node is the same as php just non-blocking
>>
>>57792447
Awesome.
A Discord channel might also be of use as well as a subreddit.

I'll check with HR.
>>
Proud to say my portfolio site is almost complete. Just making it responsive and mobile friendly atm.

Once it's done, what should I fill it with? My goal is to get hired as a web developer, so should I just pump out a few more nice looking websites or what?

Just looking for some direction on what my next project should be that would appeal to employers.
>>
>>57792500
>should I fill it with?
images of cheesy pizza
>>
>>57792430
There would be a button "Read later" and the article would show up in the sidebar on the left, so just an element would be added, no popups.

But yeah, I was just thinking about that, even I feel the need to read right away, but I still open it in new tab so I don't lose my position in the catalog when I go back.

Idk anymore, it would be just an additional function you can or don't have to use. I could make a prototype fast because I found some plugin which adds posts to favorites and displays them, so I'd just need to make some small additional coding. Don't know if it's worth it and really that useful, though...
>>
>>57778917
I hope so. I can't stand JS.
>>
>>57784729
I liked it. I agree with this guy:>>57785090
>>
File: header4.jpg (14KB, 440x300px) Image search: [Google]
header4.jpg
14KB, 440x300px
>>57792500
Stock photos
>>
>>57767395
what do SEO people do?
>>
>>57792947

one of the most boring aspects of web dev, basically finding ways/better ways to get shown in higher spots through search engines. Over time search engines change so your site/company/whatever needs to change accordingly. I don't even call it web dev...it's more content managing...*yawn*
>>
>>57792994
A chick at my old work did that. She was responsible for the YouTube page, blog, Twitter, facebook, etc. Just basically update them and keep them active so that the company scored higher in search engines. She made I think 45k/yr.
>>
lets say you have a hypothetical synchronous service, what's the best approach make an asynchronous middleware? what are some good examples of asynchronous code?
>>
>>57793195
Callbacks, promises, threading, and clustering/multiprocessing

Depends on how complex the system is
>>
>>57793167

"social media managers" and "content managers" are pretty standard jobs nowadays, yeah.
>>
>>57793195

whats the service?
>>
>>57788990

your such a cunt just help him he's clearly confused
>>
>>57793319
Don't know yet, just fishing for general techniques.
>>
>tfw spent months designing my site
>tfw look at some wordpress templates and realize how much I still suck

http://stepfox.net/examiner/
http://boombox.px-lab.com/

I'm going to fucking murder myself.
>>
>>57793670
The point is to learn how to make it yourself so that if you need to do something custom, you know how.
>>
Someone shoot me. I've just inherited the most insane project ever.

originally developed 6 years ago, all jquery. I'm talking 3-4 files, 40,000 lines each. All javascript+jquery madness. HTML is parsed strings.

Shit was passed to a new team and given to a junior who shoehorned in angularjs - fuck me if i know how it works in this state (I've used it when its done "properly"). This developer has left.

The curse has been given to me, there is jquery .extend() everywhere, angular in random places, ASP.NET base with WCF backend.

should I just kill my self?
>>
>>57793939
god, just rewrite it at that point...or kys
>>
File: 5K24jjX.gif (2MB, 500x337px) Image search: [Google]
5K24jjX.gif
2MB, 500x337px
>>57793972
I'm pushing for a re-write but its hard going. At this rate I'll end up dipping.
>>
Can left navigation work in this day and age? I'm breaking my head over this for a long fucking time.
>>
File: 1414480047436.jpg (54KB, 463x581px) Image search: [Google]
1414480047436.jpg
54KB, 463x581px
Real newb here.

This makes fills an array with entries in a txt file.
  $.get("textFile.txt", function(data) {
var items = data.split(',');
});


I want to use something like this inside my own function, but since the array is defined inside a function i'm not really sure how to get access to it.
>>
>>57794488

declare it outside the function?

var items = null;
$.get("textFile.txt", function(data) {
items = data.split(',');
});
>>
>>57794545
will 'items' get the desired value by just doing that, or do i have to call the function for it to get the value?

if it doesnt, how do i call the fuction to give items its value?
>>
>>57794582

the function attached to $.get will assign the desired values to 'items' *after* it is finished executing - I would look up "scope" or "Scoping" in programming (specifically javascript, as it can be a bit fucky) for more specifics.
>>
File: c2lVPsj.png (21KB, 450x193px) Image search: [Google]
c2lVPsj.png
21KB, 450x193px
>>57794601
What i would want to do is just do all that shit outside the function. i already have a function that wants to use that array, so to do everything inside one function would be easier for me.
>>
>>57794669

Yeah I hear you, you need to load the data though which needs to happen somewhere, get is one way, another is via ajax, which you can force not to be synchronous, give this a shot"

var items = null;
$.ajax({
async: false,
type: 'GET',
url: 'gifwebm/filenames.txt',
success: function(data){
items = data.split(',');
}
})

console.log(items) // will output array
>>
File: prpE0Mt.jpg (387KB, 1195x1593px) Image search: [Google]
prpE0Mt.jpg
387KB, 1195x1593px
I'm planning to learn one of latest meme js frameworks, what should I go for? Angular 2, React, Vue, or maybe other? Vue seems pretty comfy.
>>
>>57794807
Vue is the hip new top meme right now.
>>
File: 23946.jpg (382KB, 2648x2124px) Image search: [Google]
23946.jpg
382KB, 2648x2124px
>>57794795
You're the fucking man!

Thanks alot!
>>
>>57794795
>async false

Are we 2003? That shit will be deprecated soon.
>>
>>57783047
haha thats how the template was
>>
>>57779571
never worked with ASP but do you have their SQL server running in the background at all?
>>
>>57794866
hey other anon here, if that doesnt work try putting your entire script in the .get function, or atleast whatever you want to do with the items variable
>>
would searching/joining two tables of size n be quicker than searching 1 table of size 2n
>>
I have an idea for a site in which users can submit pieces of text, These user submitted pieces of text can be displayed on the screen pulled at random from a database. Users can give text a thumbs up or thumbs down,and the more thumbs up, the more likely a piece of text will be randomly picked (Up to a 300% chance), and the more thumbs down, the more unlikely a piece of text will be random picked(down to 0%)

What would I need to lean to accomplish this?
>>
>>57797106
Basic PHP and mysql should be adequate enough
>>
>>57797455
phpoopoo?
>>
Hello, does anyone here knows how to set let's encrypt on nginx with the djanog. I am stucked, fags.
>>
>>57797783
There's a handy guide on digitalocean for that. Just search for nginx letsencrypt and it should be the top result on Google
>>
>>57782640
DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML! DON'T OUTPUT HTML!

Serve JSON and let the client build shit.
>>
>>57798103
>muh js frameworks

that just makes a bad SEO page and additional requirements on the client :^)
>>
>>57793670
>my website doesn't look nearly a quarter as good as one designed and developed by professional developers

hmm...
>>
>>57794807
React. Vue is for shitskin PHP devs, and Angular 2 is kill.
>>
>>57798141
>needing a framework to map over an array and attach nodes to DOM
>>
>>57798165
You don't but typically that's what's implied whenever you're talking about managing the view/controller
>>
File: 1450395173261.gif (412KB, 200x200px)
1450395173261.gif
412KB, 200x200px
>>57798141
>muh bad SEO

This is actually not true. The additional network request is worth it in case you have other services which may want to speak to the API. If you're just building some hum-bum little project go ahead and couple your presentation and data layers. But if you're working with a team keep that shit separate senpai-a-lam
>>
what would you people recommend for some free php host?
>>
>>57798061
Did it, what a hassle.
>>
>>57798390
Worked perfectly fine for me. I wrote my own guide based on that tutorial to make it easier for my colleagues to try it out. May just throw a PDF here if I have time.
>>
File: Geochop.png (5KB, 240x240px) Image search: [Google]
Geochop.png
5KB, 240x240px
Trying to code a select all checkbox in jquery, how can i change the rest of the boxes to be selected within a .on change handler
var all = $('#all');
var checkbox = $('#checkbox');

all.on('change', function(e){
//change checkbox to be checked
});
>>
why do the meme sites like fcc and odin only use meme languages like ruby and node how do i learn php without being spoon fed
>>
>>57798532
make a class and check them
>>
File: GeoChamp.png (8KB, 240x240px) Image search: [Google]
GeoChamp.png
8KB, 240x240px
>>57798552
.checked isnt working for me, i cant figure out how to check them is my problem, you're being a little bit vague
    var game = $('.checkbox');

all.on('change', function(e){
checkbox.checked;
});
>>
>>57798633
I think .checked is Boolean and can also be set. Try .checked = true;
Also what is 'checkbox' variable referring to?
>>
>>57798697
This is my code unmodified

//html 

<label><input type="checkbox" name="game" value="smb" class="game">Super Mario Bros.</label>

<label><input type="checkbox" name="game" value="smb2" class="game">Super Mario Bros. II</label>

<label><input type="checkbox" name="game" value="smb3" class="game">Super Mario Bros. III</label>

<label><input type="checkbox" value="all" id="all">All</label>

//Javascript

(function() {
var all = $('#all');
var game = $('.game');

all.on('change', function(e){
game.checked = true;
});
}());
>>
>>57798732
game.prop('checked', true);
>>
File: Spr_1b_074.png (861B, 56x56px) Image search: [Google]
Spr_1b_074.png
861B, 56x56px
>>57798777
bless thy trips, thanks for the help pal
>>
>>57798732
And then after when you only want them checked if 'all' is checked.

game.prop('checked', all.is(':checked'));
>>
>>57798806
thanks again, i was going to attempt to figure that part on my own
but you just saved me probably a lot of time
>>
>>57798828
There's a different way to get the checked value that is probably a lot more efficient if you want something to figure out.
>>
How the fuck do people come up with basic projects for portfolios for starter stuff without them seeming just like tutorial ripoffs or something
>>
>>57799690
customizing tutorials. I learned from video tutorials in making WP Themes and now I can make custom themes with custom widgets. I still haven't gone to full potential on plugin and theme development.
>>
Anyone here use Atom? Post you are favourite themes and packages
>>
>>57798103
>Forcing people to enable JS to view your shitty site
>>
>>57767395
Does anyone have some resources I can read about using WebAssembly in conjunction with WebGL?
>>
>>57798158
Angular 2 is actually pretty cozy. At least, it's way better than ng1. It just hasn't had a chance to catch on yet, and also the use case is more towards huge, industrial-grade apps with teams of people, which NEETs tend not to be involved with for obvious reasons.

>>57798302
Heroku / OpenShift / AWS (trial)
>>
>>57798537
Ruby is definitely not a meme. Rails has been around for like a decade and is one of the easiest ways to generate a backend.
Node is popular because it's easy and because it's JS so students can lean backend stuff without having to learn another language.

>how do i learn php without being spoon fed
Depends on your definition of spoon fed. You can always just start reading the docs.

>>57800922
I use it with the default "One Dark" theme and the only plugins I use are atom-beautify, docblockr, and a language-specific linter/autocomplete (disable the ones you aren't using unless you want atom to take a fucking month to start up)

>>57801496
WebAssembly isn't even really a thing yet. It's just specs and demos at this point. Come back in a year or two.
>>
>>57801622
>tfw openshift upgrade is not available for your country
I just want that free bronze tier so bad
>>
Wordpress has a fucking horrible documentation.

Why does showing all the posts before the current one have to be so complicated? I'm hacking everything from stackoverflow together like a pajeet. When I google those functions there is no info about them on Wordpress' site, wtf?
>>
>>57801715
>Come back in a year or two
Guess I was getting a bit overhyped after seeing that angrybots webassembly demo. Still thanks for the reply
>>
>use redis as main database
>have to do relational logic and searches by myself
>website loads in an instant
no ragrets
>>
>>57801803
I mean, you COULD technically make something like angry bots, but at this point it would be a huge hassle because there's virtually no documentation, tons of bugs, and the spec is going to to change frequently. Basically, if you want to make a game, you're better off just doing it with JS or something like Unity. (Actually Unity supposedly plans on adding wasm support at some point)
>>
>>57801826
>redis as main database
what the fuck? so you dont give a fuck when something gets lost?
>>
>>57801921
not supposedly, I currently work in a company that uses Unity for webgames. It already uses the shim, asm.js, for the web builds, it no longer uses the unity webplayer.

Thing is, my job in the company is to port their oldest flash games to plain javascript, so I don't have much unity experience, but lots of experience with javascript.

But still, thanks for the responses, guess I'll start learning WebGL and refresh my C++ knowledge for when WebAssembly gets a full release
>>
>>57798145
I know, but since I need to do it for uni I have no idea how good it has to be. I'm spending so much time on it my head hurts literally every day.

Especially these days, when there are tons of new functionalities and design patterns on news sites and I'm trying to implement almost everything. Not to mention that UI/UX books became half deprecated and I'm stuck with analyzing what is going on on the web and reading blogs.
>>
Gonna end myself if I ever have to use mongodb again.
 collection.update(query, {$set: plupdate, $set: update} 

Why does this only update the first field (with plupdate), but not both?
>>
>daily reminder if you don't know the meaning of the number Date.Now() returns, you're not a real web dev
>>
How do you guys know what to do on the backend? I can't make a back-end to save my fucking life.
>>
>>57803521

do you even have any data...?
>>
File: 9945f2e.webm (2MB, 1550x730px) Image search: [Google]
9945f2e.webm
2MB, 1550x730px
the shit I have to go through to make my sites support a platform I barely use other than to check messenger and receive phone calls.
>>
>>57803829
wow that's so much work. that must have taken you at least 30 minutes
>>
>>57803842
yeah its only like 40 lines but its still gross as shit
>>
Can someone help me out here? I have a backend with an API and a Vue frontend that uses webpack. It's based on this: https://github.com/vuejs/vue-loader

When I develop locally, I'm making requests to localhost:1337/api/foo and it works. My Problem is getting it into production. I run npm run build to build my files and upload the dist folder to my server. The problem is, that the minified code still uses localhost for requests. Is there a way to tell it to change the request URL to my production API when building? Something like a global variable in webpack? It would also be possible to just change the port in the request URL, because it's on the same server.

I can get it to work when I download the minified files and replace everything manually but that seems really inefficient.
>>
>echoing html inside of php
>''"'"" "" ''' " everywhere

Fucking disgusting. I hate myself.
>>
>>57804063

what else are you going to do?
>>
>>57803829
I don't get it. You just made a site responsive?
>>
When I make an AJAX call to append some html to a div, what do I do with the old HTML content when I append something else to a div with another AJAX call? Just delete it?
>>
>>57804201

if you want. Remove it, replace it, whatever you want.....
>>
>>57804089
and I hate myself for it. it goes against my inner self to make a site work on mobile and mac airs
>>
php question, i'm generating an html table with data from a DB table. I have a check box next to each row. User can select multiple rows or just one. I have a delete button but it doesn't do anything yet. How would i go about removing these rows? i know how to front end but deleting this selected records in the DB i'm confused
>>
>>57804457
Oh, it's just the autism then. :D If the site is unresponsive I'm staying away from it forever, you just can't do that shit in this day and age.
>>
>>57804470
make a post form and a delete function that queries mysql to "DELETE FROM database WHERE something=someidentifier"
>>
>>57804510

i'm not using mysql, just sqlite via command line

i realize that my query will have DELETE and WHERE but how do i let the server know to delete a unique row through a checkbox?
>>
>>57776458
Bretty gud, but if I could use up an entire 24 hour period, I would make sure it's polished as fuck. Which I understand, you have not.
>>
>>57804502
I mean its more about making compromises and having to do more than absolutely minimum in order to make sure 10% of your users have a more than barely functional experience. Makes me sick
>>
File: final.jpg (570KB, 2048x1365px) Image search: [Google]
final.jpg
570KB, 2048x1365px
can i get a simple startage with many links,a search bar and a photo in the middle or margins,as minimalistic as it can be,i`m throwing my render in shape piece of shit artwork
>>
File: 6903580.jpg (189KB, 1673x716px)
6903580.jpg
189KB, 1673x716px
>>57776458
I see your 24 hour yogafapping site and bring you this site that I made in 24 minutes and is fully automated when it comes to grabbing content

https://randomporn.site
>>
CSS is the most annoying shit ever.
>>
>>57804637
Are you aware that percentage of mobile users is at least 50%? It depends on many factors, but often it is more like 80% mobile : 20% desktop.
>>
>>57804576
If you're familiar with forms its pretty self explanatory.

Not that familiar with sqlite but as long as you have a sql connection you should be able to just query something like previously stated only using for example (get example) manage_content.php?id=1 and then replace WHERE id=something with id='.$_GET['id'].'

Probably be better off googling in though
http://lmgtfy.com/?q=deleting+row+sql+php
>>
>>57804692
24 minutes? No way. I need to see the code, how did you do it so fast?
>>
>>57804761
Yeah it is horrible.
>>
File: 40cd2d8.jpg (31KB, 422x242px) Image search: [Google]
40cd2d8.jpg
31KB, 422x242px
>>57804761
depends on day and if the site is promoted on a certain website or not but this is pretty much the daily trend for me right now on this specific site
>>
>>57804890
Yeah, it depends on the user base too. I have analytics for one news portal I'm working on and it's 50:50, but during the working hours, mobile usually spikes
>>
>>57804797
Using PHP, GET and opendir. Then I run a script download threads with specific keywords from /gif/ and upload them to the various directories. various keywords go to /straight/ and others go to /hentai/ /creep/ etc. Then it just echoes them into a video JS player, and then pagination is done as you'd expect with basic math and the "limit"/.

Customized ads are done with if else statements based on ?cat

Less than 100 lines of PHP
>>
>>57804991
Cool, thanks for explaining it!
>>
File: blinkblink.gif (6KB, 74x82px) Image search: [Google]
blinkblink.gif
6KB, 74x82px
Need to move 100GB of data to a temporary server that uses 3TB/week for like the next month. Anyone know any affordable solutions?

Kinda urgent
>>
I want to build a simple messaging web app. PHP/SQL makes sense for this, right? What security concerns should I be aware of?
>>
>>57805775
>PHP/SQL makes sense for this, right?
Yes, or pretty much anything else.

>What security concerns should I be aware of?
SQL injections, XSS attacks, malicious file uploads, insecure ssh/firewall configuration. Those are some of the most common things.

If you have a user account system, that's another can of worms because you have to deal with protecting passwords and other sensitive info, securely handling password resets, protecting against phishing, etc.
>>
post ugly but working code you wrote today, /wdg/

echo "<td>" . "<input type='checkbox' name='checkbox[]' class='checkBox' value='" . $row['pkgPackageReference4'] . "' />" . "</td>";
>>
>>57806302
<td>
<input type='checkbox' name='checkbox[]' class='checkbox' value = '<?= $row['pkgPackageReference4'] ?>' />
</td>


May want to start looking at interaction with the DB in an object oriented manner
>>
>>57804764

i figured out. I didn't know you could give html check boxes a value.... so when i loop through each row now, i grab the unique id for each row, and make it the value for each checkbox in that row. Then i run muh queries when the button is submitted
>>
>>57806461

it's in a foreach loop though....can i still do it like this?
>>
>>57806548
<php foreach($assoc as $key => $value): ?>
<td>
<input type='checkbox' name='checkbox[]' class='checkbox' value = '<?= $value->property1 ?>' />
</td>
<php endforeach; ?>


That or you can put '{' after the foreach instead of the ':' and replace 'endforeach' with '}'
>>
>>57806686

im using PDO and have foreach ($result as $row){

stuff here

}
>>
>>57806686
Also replace the '<php' with <?php'. Typing on a phone.
>>
>>57806760

forgot to mention im displaying a lot more td's than just one
Thread posts: 333
Thread images: 39


[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]

If you need a post removed click on it's [Report] button and follow the instruction.
If you like this website please support us by donating with Bitcoin at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties. Posts and uploaded images are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that website. If you need information about a Poster - contact 4chan. This project is not affiliated in any way with 4chan.