/wdg/ - Web Development General

/wdg/ - Web Development General

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

>IRC Channel
#Sup Forumswdg @ irc.rizon.net
Web client: rizon.net/chat

>Learning material
codecademy.com/
bento.io/
programming-motherfucker.com/
github.com/vhf/free-programming-books/blob/master/free-programming-books.md
theodinproject.com/
freecodecamp.com/
w3schools.com/
developer.mozilla.org/
codewars.com/

>Useful Youtube channels
derekbanas
thenewboston
learncodeacademy
funfunfunction
computerphile
codingrainbow

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

>Backend development
en.m.wikipedia.org/wiki/Comparison_of_web_application_frameworks
[Gist] backendDevelopmentBookmarks.md

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

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

>How to get started
pastebin.com/pDT82mQS

>cheap vps hosting in most western locations
lowendbox.com
digitalocean.com/
linode.com/
heroku.com/
leaseweb.com

Other urls found in this thread:

github.com/collinoswalt/Flakes.js
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
twitter.com/SFWRedditGifs

What should i build in php?
Suggest me something

I'm trying to write text in an existing input box automatically when the page loads, the input has no "value" tag.
I tried this but doesn't work, am I going at it in a wrong way? (can't post the text here because it says it's spam).

(cont)
>"(nameFill)"
I just noticed I forgot to remove that (it's from a previous test), it should be "()" though I tried and still doesn't work.

You don't need the .input. Console. Log this shit user

A website where users can submit a wish list (including descriptions and links to products), and people invited to the wishlist can check off purchased items without letting the user know.

Shamelessly plugging myself here, you can use this script I wrote for snowflakes:

github.com/collinoswalt/Flakes.js

You can demo it here:

collinoswalt.com/list.html

(the snowman thing isn't included)

I'm installing Apache and plan to use it for local testing. In the config file can I just set ServerName to localhost?

>10 contributions in the last year

You can close off php and switch to HTML mode by typing '?>' and go back in to PHP by typing '' is just short for ''

I asked in the last thread just before it died but couldn't see the replies.


I'm doing a web development boot camp right now and also learning about SEO as SEO and digital marketing are an easier field to get into. I heard web development guys don't know shit about SEO. is this true? Most SEO guys build sites using a CMS like WordPress.

But wouldn't it be best to all of you in web development to also learn some SEO to optimize your sites traffic, search engine ranking and also if you code and design your website with a SEO mindset your site would be better, no?

i'm not quite the php guru yet but this looks absolutely horrendous

>

SEO is not really coding.

You can optimize your site's traffic by doing annoying bullshit like slide shows, "click here to view more", and all that shit that everyone fucking hates in a website.

Most SEO is done by keeping the site updated. That means running a blog, being active on social media, etc. You don't need a developer for that.

SEO nowadays doesn't really get you shit unless your website is heavily information based.

Using HTML5 tags, meta tags, no pop-up ads and HTTPS will boost your pagerank and get you as much SEO as you need.

You can also do If you started the loop with ':' instead of '{'. Many prefer that for the readability.

so i have to add in each td then? this is really no different than what i have no, except less echo's. This IS nicer to look at....not arguing that, but either way i'm still gonna have a shit load of td's....oh well...

lots tr's too...it's a huge table

The is only going to be required once in the foreach loop since I'm assuming that each record requires one row.
The HTML output though will be the total amount of rows that were pulled from the database

>I heard web development guys don't know shit about SEO. is this true?

Sounds like whoever told you that is bitter because they're too stupid to write code and need to feel relevant or something. Most web developers do actually know about SEO because of-fucking-course they do.

right. That's how i have it now. I'm just echoing it instead of like what you did. I'll try not to echo as much next time...thanks

i know about SEO but i absolutely despise doing it

Was the person speaking a pajeet? Everyone I know that is concerned about SEO are pajeets for some reason

Can anyone recommend some resources to learn what and how to create REST API?

is it better to leave a form action blank or not even put the action attribute? btw if youre thinking why i dont have a whatever.php file as the action, it's because i dont wanna change to a different URL/page after submit

You can leave it blank if you plan to submit the form with AJAX. That being said if a user has JS disabled or is using Lynx, your form won't work. So I recommend having *something* there to fall back on.

Just google REST API

ya im using PHP....it's been my shoulder to lean on when things get crazy

github is boring so I don't use it much

AFAIK slideshows are BAD for SEOs, and I see them less and less.

i got a VPS
$uname -r 2.6.32-042stab116.2

thats a fuckold kernel if im not mistaken, how do i update the kernel. i only have a cli.

i'm confused on this...

$name = $_POST['name'];
$email = $_POST['account'];

foreach( $name as $key => $n ) {
print "The name is ".$n." and email is ".$email[$key].", thank you\n";
}


why shouldn't you do $name[$key] to get the name? why the => $n part?

$('.sidebar-controls ul li a').css('color', '#fff');
$('.sidebar-controls ul li a:nth-child(1)').css('color', 'red');


Why does this make all the links red, instead of just that one?

If you want a placeholder you can just use the 'placeholder' attribute on the input tag.

Are there multiple links in each of the list items?

Depends on the distro but usually it's relatively simple to do with the package manager. Just google upgrade kernel

Try this

$('.sidebar-controls ul li a').css('color', '#fff');
$('.sidebar-controls ul li a:first').css('color', 'red');


Also would help posting the HTML

Otherwise if you have 1 'a' link in every list item element it's going to go red. You can fix this by:

$('.sidebar-controls ul li a').css('color', '#fff');
$('.sidebar-controls ul li:first a').css('color', 'red');

Also would help posting the HTML

Ah, thanks guys, this is it. I knew I had this problem before, should have give nth-child to item instead of , facepalm.

Here's the code, but doesn't matter now. Yeah, I have separate links and I change their css in the functions they call.

If you're doing page navigation with PHP why not just put styling for the colours in the stylesheet for every of those links.

You can then style an '.active' class that has the colour red. Then in each list item element you can check if the page is loaded and echo out the class 'active' if it is.

Yeah, I would have done that for the navigation, but these are tabs on the sidebar, so URL doesn't give me any information. But it's easy to know which one is selected based on the function they call, so I figured out I could just change the colors there. Don't know if there is a better solution, though.

ok i think i understand

$n just prints each name in the $name array, but the $email[$key] is confusing me now. I know what an associative array is...but these are indexed arrays. Is this foreach loop trying to imitate an associative array...? cot dam this is confusing.

Gonna have to ask again, problem isn't solved yet and it's driving me crazy.
Why does this mongodb query only update the entry with plupdate and not with update2?
collection.update(query, {$set: plupdate, $set: update2}
When I change the order and have update2 first it uses that key/value pair to update the field (and ignores plupdate), so I figure the problem has to be here and nowhere else in the code.

You don't need a foreach loop unless it's an array.
$_POST is an array that the server receives when a user submits a form with the method of "POST"

$name = $_POST['name'] indexes the name key that was sent to the server. This may have not necessarily happened (the user may send anything they like to the server and it's your job to validate these inputs on the back end)

If you print out the variable $name you should get whatever the user sent you

print "Your Name is $name";
print "Your email is $email";

That foreach loop that you made may have probably looped for the amount of characters in the name

Also remember if you're using double quotations you can insert variables in to them without needing to close/concatenate the strings


I'm assuming by your variable naming

that was just an example i found online. My real code is as follows, but it didn't echo out anything.

if (isset($_POST['submitBtn'])) {
$checkBoxValues = $_POST['checkbox'];
echo $checkBoxValues;
}


$checkBoxValues should be an array... i gave multiple html checkboxes a name of "checkbox[]". When a user selects some checkboxes, the values of those checkboxes should be put into the array

The isset should check if the POST checkbox is set, not the submit button.

There's also a PHP function print_r($var) that prints out the contents of an array so you can see what exactly you're getting.

It may also help showing us what your HTML code is. The check boxes on the client side should be named 'checkbox[]'

You may want to use print _r($_POST) to see what you are receiving

i found another part i messed up on...the submit button wasn't properly named. But shouldn't i check if the subit button is set? the input checkboxes are in the form a long with the submit button...its a delete button. User selects which rows they want deleted from the table via checkboxes and hit the delete button to delete them.

ok i got this code to show me whats in the array after the submit button is clicked

$checkBoxValues = $_POST['checkbox'];
print_r($checkBoxValues);


it looks like it's an associative array. I thought it was going to be an indexed array

>But shouldn't i check if the submit button is set

It just depends on your implementation.

One implementation can have both buttons going to different URLs (this is typically used in conjuction with javascript)

For example:
submit button goes to add_record.php
delete button goes to delete_record.php

If you have a form like the following:





Add Record
Delete Record

You can add a check on the update.php page if the $_POST['update'] key is set else check the $_POST['delete'] key is set and make a decision based on the action.

Meant to also change the method="get" to method="post"

And if you're handling row deletions, you may want to set the checkbox value to the record ID

for example:

Nigga, if u do that. please use:

//things

Yeah I did note that in the previous thread, and also following his comment
>You can also do If you started the loop with ':' instead of '{'. Many prefer that for the readability.

ok nevermind it's not an associative array. It's an index array like i thought the entire time. I think i got it now.

i have 2 nested if isset conditions that first checks if the button was submitted, then the second one checks if the checkbox array is empty, which would mean the user hasn't selected any checkboxes yet

Is there anyway, using html5/js/css, that i can make it so a specific image will appear on screen for a short period of time only after the user inputs a specific sequence of keys while they're on my page?
Much like the konami code on some sites.

how do i connect to the localhost on my laptop from another laptop, or an iphone? i have a laptop running lamp that i want to be able to have my teammate connect to from his apple laptop. my database doesn't work on his mamp for whatever reason, and we spent 2 days trying to get it running on his mac but it just doesn't work. so we're going to try to have him connect to my laptop as a server for the demo we have to do coming up.

right now i'm just trying to access my laptop's localhost from my iphone. i'm entering the IP address into the iphone's safari bar and it doesn't work, says server stopped responding like if i sent in any fail website

This is my third semester doing Web programming is bad that I'm still using the books for reference? Alot of this is difficult to remember out the of my head.

Something like this perhaps

HTML:

JS:
var combination = "";

var secretKey = "12345";
var iterator = 0;

document.addEventListener("keydown", function(evt) {
var charCode = evt.keyCode || evt.which;

characterPressed += String.fromCharCode(keynum);

if (secretKey.charAt(iterator) != characterPressed) {
combination = "";
iterator = 0;
return;
}

iterator++;

if (combination == secretKey) {
document.querySelector("#image-display").classList.add("popup");
}

})


CSS:
.popup {
opacity: 1;
animation: fade 1s linear;
}

@keyframes fade {
0%,100% { opacity: 0 }
50% { opacity: 1 }
}

so I'm considered a pajeet just because I can code a simple CRUD and do SEO for WP ? Smh.

Just replace characterPressed with combination. hadn't tried this out but with some tweaking it should work fine

for some reason, the IP address i was told was mine when i went googled it and google told me i had wasn't the right one. i had to type ifconfig and enter one i found in there. why would it tell me a completely different ip address? it wasn't even close

It's because ifconfig shows you your LAN (Local network) IP address, not your WAN (external) IP address.
Your external IP address is used by many devices on your LAN to connect to the internet

jquery only seems to make things more difficult

so they have to be on the same local network to connect? i can access my laptop1's localhost from my laptop2 on my home network where they're both on the wifi. should this work at my school's wifi between me and my teammate then, if we're both on the same school wifi network?

They can be on a remote network to connect but that requires you to open your router's settings, allow port forwarding of port 80 (HTTP) from the router to the PC on the local network (192.168.x.x or 10.x.x.x).

This is so when people access your public IP with port 80, the router knows to direct this request to your PC so that your PC can respond to the request.

Also it may require a bit more additional configuration of your web server to allow it to work on remote networks. A lot of the time typical WAMP/WEMP/MAMP software stacks disable external network access.

i don't think i'd be able to change anything with the router settings. is it possible the school wifi would have some setting that would prevent him from even being able to enter my LAN ip address and connect to my machine? maybe i entered the wrong IP address, but i'm pretty sure i tried multiple on his machine and it didn't work like it's working now i'm at home

You need to configure port forwarding on the router that is connected to the server. If your home PC is running the server then you'll need to configure your home router.

It would only allow port 80 access to your PC from remote users on the internet. The worst they can do is exploit some server side script you added on the server to delete or move files.

Alternatively you could just connect through remote desktop

Anyone deal with recruiters a lot?

Are my suspicions correct that if you don't have a degree or prior professional experience then they toss you out?

Not a single recruiter has clicked the link to my "sample" website that is used more than their recruitment website.

What is this retarded shit? I'm about to just send emails to everyone at web dev companies with links to what I can do.

it won't be at home, it'll be at our university. we have to demo our project

right now i'm having an error, i changed the URL in my code from localhost/android_connect/get_all_entries.php (works on my main laptop) and now i'm testing it on my secondary laptop. i changed the url to my laptop1's LAN ip address, and it works in the address bar on firefox. but java tells me

java.net.MalformedURLException: no protocol: my.ip.add.ress/android_connect/get_all_entries.php
at java.net.URL etc etc


will it not let me have the url be an ip address? how do i fix this?

>no protocol
Sounds like you may need to put "server.ip.address" in your code

needed http:// at the front. it's working now which is awesome. to pre-empt the possibility of the school wifi having blockers in place that wont let us do this, would i be able to do this with a cable when neither of us are connected to wifi? like, an ethernet cable between our laptops?

yeah that was it. lol

>Are my suspicions correct that if you don't have a degree or prior professional experience then they toss you out?
Recruiters are interested in anyone that will make them money. It's just that there is an over-supply and under-demand for junior devs in general.

>Not a single recruiter has clicked the link to my "sample" website that is used more than their recruitment website.
Recruiters are glorified keyword matching algorithms that can use a phone. They aren't going to put in any actual work if they don't have to.

>I'm about to just send emails to everyone at web dev companies with links to what I can do.
That's probably going to be more annoying to them than helpful. What you should do is figure out which one or two people at each company you should actually be talking to and focus on them. Ask around, go to meetups, etc. Make friends with other developers. Personal recomendations >>>>>>>>> cold calls/emails for getting the job you want.

Must be openvz
It's different compared to KVM hosts, usually with OVZ you are running a layer on top of the host OS meanwhile KVM is full virtualization so you can run any OS you want

In the long run OVZ is better but for more resource constrained VPS' seems that OVZ is the better solution as it uses less resources.

Can be prone to overselling though, guess that's a heavy point why KVM is generally more expensive.

You need to know basic SEO if you are planning to monetize *anything* on the internets. Most traffic nowadays comes from search engines.
I'm involved in a heavy SEO optimization project and there's a lot of stuff that can be very complicated to grasp when you are trying to squeeze even the smallest advantage you can get.

Is Ruby/on Rails still a reasonable language to invest time in?

How do you just serve a static HTML file with Go, using gorilla mux to point to some handler? also using negroni.

Just go the JS route, you already need JS for the front end and just use express for the backend (if you want it to be more simple and get up and running faster, use firebase)

Non-web programmer here. I want to create a small website where I can type up a post and then click submit and it will create a new page and add links to some other pages. I just tried following some ruby on rails thing and all these gems and node js runtime requirements and coffee script and bash scripts and tables made me want to die, I don't understand any of this, what do?

For putting projects up on github, if they use API keys is it standard to just edit them out before you upload or something?

I'm storing mine in config files which are on the gitignore list and have a general empty/default example.config next to it.
So I don't accidentally push secrets to the public and everyone else just have to rename the example.config file after configuring.

>halfway through project
>get bored
>think of new project and start on that
how to stop this mentality

Should I create 5 copies of the same page for the sake of changing one section with some divs?
is this the way to go?

no.
use a templating engine/generator or anything that lets you use a master page for the layout.

What should i build in php, suggest me something

I already use bulma and I'm creating a landing page for a business

it has 5 different categories of pricing tables which should be accessed via a tab system

I'm thinking of just showing and hiding them inside the html but that's a lot of repeated html and js

Pic related, see comments

Why is the 'value' keyword not needed in normal object declarations but is needed in the object.create method?

I understand everything else going on here, just dont understand the format of the second argument to object.create().

Opinions on JS templating engines?

I'm setting up a backbone app and I'm not sure what kind of templates to use.

I've used mustache/handlebars a couple of times and liked them. But while mustache is pretty rigid, handlebars offers so many possibilities at the cost of having to maintain a shitload of helpers.

So I'm leaning towards saying fuck it and just using ejs straight away.

the 2nd parameter for object create wants properties, which have multiple other settings besides a value.
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

Interesting, this language gets messier and messier the more time I spend with it.

I've a inside 2 (div> div> p

just use a class instead.

class SuperHero {
constructor(name) {
this.name = name;
}

sayHello() {
console.log(`Hello, my name is ${this.name}`);
}
}

var superman = new SuperHero('Superman');
superman.sayHello();

div > div > p { }

How do you use the HTML datetime inputs (week, month, datetime-local etc.) consistently even in browsers that don't support it?

All the polyfills I've seem so far look awful and I can't really expect my users to input dates in the yyyy-MM-ddThh:mm:ssZ format that the standard demands. Using a shitty JS based date dialog on all browser just because Firefox doesn't support those inputs feels wrong too.

I check if the date input type is supported before adding a custom date picker.

I'll try that, thanks!

What datepicker are you using? Also have you found anything for month or week inputs?

pikaday.
for months I'm just using two dropdowns, one for the month and another one for the year.
haven't had a case where I needed weeks yet.

If you created 50 pages of website content, mostly in the form of guides.

Is it better for SEO to upload 30 pages and then slowly add the rest?
Or is it better to add all content right away?

Just do it, faggot

Are emojis cancer?

It's best to have fresh content every week or so.

What is wrong with all of you? This is the nicest way