[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: 312
Thread images: 36

File: 1496845010511.png (731KB, 824x553px) Image search: [Google]
1496845010511.png
731KB, 824x553px
Always archived during the nights - Edition

>Getting started
Get a good understanding of HTML, CSS and JavaScript.
MDN web docs offer a good intro (independent of your browser choice)
https://developer.mozilla.org/en-US/docs/Learn

>Free online courses
https://www.codecademy.com/
https://www.freecodecamp.com/
https://www.bento.io/

>Roadmap
https://github.com/kamranahmedse/developer-roadmap

>Resources
https://developer.mozilla.org/en-US/docs/Web - General documentation for HTML, CSS & JavaScript
https://stackoverflow.com/ - Developers asking questions and helping each other
https://caniuse.com/ - Check browser support for front-end web technologies

>Youtube channels
https://www.youtube.com/user/TechGuyWeb - Traversy Media
https://www.youtube.com/channel/UC8butISFwT-Wl7EV0hUK0BQ - freeCodeCamp
https://www.youtube.com/channel/UCO1cgjhGzsSYb1rsB4bFe4Q - funfunfunction
https://www.youtube.com/learncodeacademy - codecademy
https://www.youtube.com/derekbanas

>in-depth comparison of VPS hosts
https://www.webstack.de/blog/e/cloud-hosting-provider-comparison-2017/
>>
>>61847538
I want to either freelance or work a completely remote job.

What's the best thing to learn to achieve this? Right now I know basic JS and React, HTML & CSS, bit and bobs
>>
>>61847712

Freelancers rules:

(+)
1) You can pretty much chose what technology you want to use. The customer woun't care if it's Elixir/Phoenix or Wordpress. It's only about the outcome.

2) You can choose when to work and when not.

3) You have no boss, you can pretty much do what you want if the result is good.


(-)
1) You have to be a one man army. You have to do your own marketing (making your own web dev website, talking to people, aquiring customers), your own management (estimating costs, make a REALISTIC schedule, talk about expectiation, negotiate about costs and handle customer problems), your own support (if you are sick for a week you simply don't earn money and nobody is gonna do your work) and probably even your own designer/front end team.

2) Design really matters. It's not just about glueing some functionality together. You have to put a lot of effort into finding youtr what the customer really want and create a good UI and UX. You have to do all this requirement engineering shit: mood boards, wireframes, make a few different approaches until your customer is satisfied..

3) Nobody is gonna save your ass. There's nobody who can help you. If the customer is not satisfied nobody is gonna get into ugly negotiations for you. If you underestimate the problem and miscalculate the costs/time, nobody is gonna tell you that your planning is bullshit. And trust me, in the beginning you WILL make a lot of mistakes and work unpaid overtime. A lot. Estimating man hours in the IT is incredibly hard and requires a lot of experience.

4) You have to be your own motivator. It sounds great to not be expected to show up 9 o'clock at work, but in the end a website requires a certain amount of work, no matter how you look at it. This mean you can either kick yourself in the ass and be disciplined, or you will have to do death marches with little sleep when the deadlines gets closer.


(Conclusion)

Freelancing is fun, but hard. Don't underestimate it.
>>
>>61847712
Also highly interested in this. In fact, I would like to reiterate the entire post.


/r/ing some excellent/actionable freelance steps and primers
>>
>>61848825
>>61847712
If you don't at least have 5 impressive personal projects under your belt, you're a failure.
>>
How do you host images on client side? I know you can preview them.

I want to make an app where you upload 6-15 images. Can that be hosted on client side? If so, how?
>>
If I want to just host a blog somewhere what host do I use and where is a good place to get domains?

Using Django, if that influences things somehow.
>>
>>61849448
namecheap is good

> Using Django, if that influences things somehow
no relation at all
>>
Is there a way to make this work without repeating myself with two separate event listeners as I am doing?
inputEl.addEventListener('focus', function() {
document.getElementById('notes-input-info').style = 'visibility: visible';
inputEl.style = 'border: 1px solid #aaa';
})

inputEl.addEventListener('blur', function() {
document.getElementById('notes-input-info').style = 'visibility: hidden';
inputEl.style = 'border: 0px';
})
>>
>>61847882
>>61849049

I'm working on making my projects look impressive before embarking on this. I plan on having a good income from freelancing while working a normal job before just doing full-time freelance.

I have most trouble with marketing. I am completely and utterly shit at it. Say I have awesome service, everything is perfect except for my marketing. Where do I start? How do i get clients?
>>
How much money can reasonably be expected from fulltime freelancing work, aka a standard 40-hour workweek?

>>61849772
Start with a website that displays your projects all nice and fancy and in a "this is what I can do for you" professional manner. Then attend meetups. Beyond that idk, good luck anon.
>>
>>61847712
Get a dev job.

Start networking from there.
>>
Sup dudes, web dev newb here.

I'm making a local weather app for FreeCodeCamp. One of the user stories is to add a button to change from celsius to fahrenheit and vice versa. I can only get the button to fire once though. Here is my code, sorry I don't know how to use quotes yet;

// Function to change ˚C to ˚F via button //

function convertToF (number) {
return (number*1.8) + 32;
};

var body = document.body;

if (body.textContent.includes("Fahrenheit") || body.innerText.includes("Fahrenheit")) {
$(".temp-button").on("click", function() {
$("#temp").text(Math.round(convertToF(temperature)) + "˚F");
$(".temp-button").text("Celsius ˚C")
});
} else if (body.textContent.includes("Celsius") || body.innerText.includes("Celsius")) {
$(".temp-button").on("click", function() {
$("#temp").text(Math.round(temperature) + "˚C");
$(".temp-button").text("Fahrenheit ˚F")
});
}

I tried to set it so that when the word 'Fahrenheit' is read on the button, clicking the button will change it to celsius and vice versa. I'm guessing the problem might be that there's nothing to be read once the button has been clicked. The console isn't returning anything.

Link to codepen: https://codepen.io/jonnyd94/pen/eEdPje

Feel free to make any other constructive criticisms on my code. I'm pretty new and could do with an experienced eye or two.
>>
>>61849844

I am the same guy as the post above, so I'm not an expert but this thread is worth a read;

https://www.thefastlaneforum.com/community/threads/how-to-learn-code-start-a-web-company-15k-per-month-within-9-months.69971/

Salesmanship > ability is the message basically
>>
>>61849464
Ok, but what hosting?
>>
Got a sidejob to make a booking calendar system. Wondering if I should make it myself or use some shit
>>
>>61849772
>How do i get clients?
My first clients were local business. Quite literally walked into a shop and said "lets make some websites". I worked for them for food basically but it boosted my reputation. They told about me to their colleagues, etc.
>>
>>61851178
that code to assign the function to your button only runs once, when the page loads.
At that time the button says fahrenheit.
The "else" part never actually runs.

Better to keep track of the current temperature unit in a variable and show Celsius/Fahrenheit based on that.

let isCelcius = false

$(".temp-button").on("click", function() {
isCelcius = !isCelcius
$("#temp").text(isCelcius ? Math.round(convertToF(temperature)) + "˚F" : Math.round(temperature) + "°C");
$(".temp-button").text(isCelcius ? "Celsius ˚C" : "Fahrenheit ˚F")
});


https://codepen.io/anon/pen/qXXEKg?editors=1010
>>
File: 1446633564521.jpg (12KB, 320x320px) Image search: [Google]
1446633564521.jpg
12KB, 320x320px
Let's say I have 20 pages or less, how hard would it be for me to implement my own search engine for it. Opposed to paying a monthly fee for a premade one?
>>
>>61851580
whoops got the if/else a bit backwards there, but shows how it would work nonetheless

>>61851254
Digitalocean or Vultr
>>
>>61851554
just find an existing calendar / datapicker ui module
>>
>>61851731
I am also doing this, what module do you recommend ?
>>
>>61851616
it would be super ez
supposing you want to index web pages just run tf-idf for search queries on said pages and return top 5 or something
to improve perfs pre compute tf-idf results for each term in web pages, index results in memory
to get fuzzy results, index terms using phonetic algorithm instead, get phonetic representation of search term and find closest indexed terms using string distance calculation algorithm (levenstein), this way you can find results even tho user misspelled search query
>>
>>61851810
Dunno, haven't used one in forever
this one looks fine http://amsul.ca/pickadate.js/date/
only issue is it seems to require jquerry
>>
File: web-development-banner.jpg (28KB, 614x327px) Image search: [Google]
web-development-banner.jpg
28KB, 614x327px
Our official Discord server:

https://discord.gg/wdg

Yes, we even have our own custom link.
>>
>>61851826
i'm going to need an in depth guide for this.
>>
>>61852051
yo want to
1. process query terms
2. sort your pages for relevance against query terms
3. return most relevant pages

An easy metric for 2. is tf-idf.
So yuo could precompute tf-idf scores for terms present in your pages and keep them in memory. This way if user searches for a term you just lookup tf-idf scores and return documents with highest scores. You can then fancy everything up by not taking stop-words into account, stemming words or using phonetic stuff to account for spelling errors
>>
Should I grow a fancy beard?
>>
>>61851920
fucking christ kill yourself
>>
>>61849049
any example on that
i really need to know what level of skill i need to demonstrate
>>
would it be possible to completely hide my js source code if I use node?
>>
Is this the correct way to embed an N number of documents inside other documents in MongoDB/Mongoose?

somethingSchema = mongoose.Schema({
name: String,
description: String,
sections: [{
name: String,
arrayOfThings: [{
text: String,
type: String,
value: Number
}]
}]
});
>>
>>61853470
hide it from whom? Another person running your program in Node?
>>
>>61853611
I don't want to hide all the code, just the JSON data and the calculations of the algorithm. Can't you do these server-side?
>>
>>61849676
const inputEl = ...;
const notesInputInfo = document.getElementById('notes-input-info');

['focus', 'blur'].forEach(type => inputEl.addEventListener(type, notesToggle));

function notesToggle(e) {
notesInputInfo.style.visibility = e.type === 'focus' ? 'visible' : 'hidden';
inputEl.style.border = e.type === 'focus' ? '1px solid #aaa' : '0';
}


Or something.
>>
>>61852655

Seconding this.
>>
>>61847712
>>61847882
Freelancing fucking sucks. Get a comfy startup job.
>>
Currently in the process of starting my own small web services company, and im having difficulty deciding what to use for the website. Whats the best option for creating a site with basic payment gateway compatibility? Should I just purchase a WHMCS subscription to use with my WHM? Or are there free alternatives that I should use?

tl:dr alternatives to WHMCS
>>
>>61853918
Last time I used WHMCS (maybe 10 years ago?) it was pretty simple, I've been using Stripe for some time now and really enjoy it
>>
Does anyone know how to use shortid in mongo? The trash documentation is very lacking.
>>
>>61853943
Stripe looks alright, no monthly subscription fee is a good thing to have, even if it costs 2.9% per transaction. Do you have an example site you could show me using Stripe? Id like to know how much customization I can put into the front end.
>>
Learning CakePHP.

Why was this created?

This is some 2010 shit. Who has pages that need to load anymore?
>>
>>61853635
are you asking if if you can do calculations serverside? sending json to the client will let the client see the json. Just send the result of the calculation to the client
>>
>>61854097
With Stripe, you can use their checkout elements (not incredibly customizable, but very easy to integrate) or do it raw. Checkout is essentially just a button. WHMCS is definitely more turnkey if you're looking for easy of integration, I'd go with that. As for a site, mine is a SaaS application, but I'm weary of posting it here
>>
>>61853635
still not clear exactly.
since Node is server-side, what's there to hide from clients. They only see what you send them.
like >>61854198
said
>>
>>61854262
So for stripe, I would just create a site from scratch or with a CMS, and then add the Stripe add to cart & checkout buttons to the site?
>>
>>61854313
Sort of, its a bit more than that, Stripe stores payments/payment details/subscriptions but the way it works is your application sends the info straight to stripe, which verifies and returns a token to you which use. It's a more setup, but if you are just looking for webhosting, whmcs probably makes more sense
>>
>>61852655
Wtf is your problem?
>>
File: jef.jpg (2MB, 3599x2629px) Image search: [Google]
jef.jpg
2MB, 3599x2629px
Can you guys help me out, I changed the color off a couple off texts and borders in a website via the google inspector, I want to save this file so I don't have to do the same thing again when I open a new page, how can I do this?

And if theres no way I want to at least be able to save this style.

Much appreciated.
>>
>>61854290
desu I haven't used node yet so I have no idea how it works, I just want the client to receive only the final results you get in html and the source data be inaccessible
>>
>>61854450
It really depends on if its a website you own or not. If its a public website (youtube, for example) save the CSS to a text file on your desktop, then download stylish (browser addon) and add a new style to the website and copy + paste the CSS into stylish. If you own the site download the CSS file you just edited and overwrite the old CSS file on the server.

https://chrome.google.com/webstore/detail/stylish-custom-themes-for/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en
>>
>>61854513
How can I download the existing css from the chrome inspector? Sorry I'm new
>>
>>61854495
might want to read up on frontend/backend in general then.
The client has no way of knowing what your backend actually looks like. What kind of database you are running, which functions get called, or even that you are running Node in the first place and not something else.
>>
>>61854847
ok thanks

another thing, how hard would it be to implement my app into node? will I need to remake the whole thing?
>>
>>61852655
This.

>>61854442
>Wtf
Kill yourself.
>>
>>61854877
>how hard would it be to implement my app into node?
You need to post some actual information if you want to have useful answers.

Is your app currently frontend-only and you want to move it to a server instead? (If it's just for hiding the code, then that is not a good reason at all)
Or are you using something like Django, etc. and want to move to Node instead?
There is a bit of worked involved in any case, but probably less if it's already written in JS.
>>
>>61855024
the app is completely in js and uses few libraries including jquery

hiding the code is one reason but I think the app is getting a bit laggy the more complex stuff I add in, wouldn't server side make it run faster? (at least in mobiles)
>>
File: 1476943812279.jpg (68KB, 700x700px) Image search: [Google]
1476943812279.jpg
68KB, 700x700px
alright I need to make a private messenger website using reactjs & nodejs and I don't even know where to start. Just a normal chat program where you can send private messages to eachother. Are there any libraries for reactjs I could use or a good tutorial I can follow? PLEASE help, I need to do this to get a job.
>>
>>61855196
Hi anon,

Join the .net team and use signalR! ;^)
>>
>>61855196
Sounds like you're fucked, honestly. You obviously have no idea what you're doing.
>>
>>61855196
how did you find yourself in dis situation
>>
>>61855099
possibly, if you plan to utilize server-side rendering.

If your app is slow already, then that's something you have to fix first though.
Node won't miraculously take care of that problem.

>>61855196
easiest approach is probably something like socket.io
>need to
how come?
>>
>>61854925
Stfu, nobody asked you anything, faggot.
>>
File: 1460685784423.gif (3MB, 386x232px) Image search: [Google]
1460685784423.gif
3MB, 386x232px
>>61855679
>Stfu
>>
>>61855099
Seems like you need to fix some problems first. What does the app do?
Node is for the backend. What are you using for backend now?
>>
>>61852655
>>61854925
Stop posting.
>>
>>61855196
Stop lying on your cv
>>
>>61847538
why does webpack suck at including vendor css.
>>
File: 1495367742290.jpg (61KB, 600x800px) Image search: [Google]
1495367742290.jpg
61KB, 600x800px
>>61847538
I have an interview for a mid-level front end developer job in two days. I'm junior level.

What specific algorithms or technical questions should I drill? Looking at big lists of interview questions doesn't help because I have limited time and can't go through them all
>>
File: 1498298672907.jpg (81KB, 625x774px) Image search: [Google]
1498298672907.jpg
81KB, 625x774px
>>61856029
Good job specifying those job requirements in your post.
>>
>>61855196

you're not gonna make it.
>>
File: sketch-1502421081211.png (178KB, 1080x1920px) Image search: [Google]
sketch-1502421081211.png
178KB, 1080x1920px
can someone explain what these parts want. does mod cookie mean owner trip or just any mod trip. and what is the secure tripsalt.
>>
File: 1499375538750.png (6KB, 253x199px) Image search: [Google]
1499375538750.png
6KB, 253x199px
Anybody here using selenium? Or in QA business? Should I use it to check user role using selenium, or just use it to test buttons and forms?
>>
>>61855679
>>61855865
redditors OUT
>>
>tfw learning magento 2 and seeing the new programming style
I hate that its making me like it, so much conciseness and good design
>>
>>61856596
halp!
>>
>>61857196
>spamming
>tripfagging
>halp
Kill yourself.
>>
>>61857232
No (you)
>>
bulma is comfy
.net core is comfy
react is comfy

also will wdg be anything but tech support for normies who are trying to alter their tumblr theme
>>
what's the simplest way to send a request to an API in PHP? I prepare the JSON with the data, then what? I've seen several libraries and such, but I wanna see what you guys think.
>>
File: キャプチャ.png (9KB, 511x193px) Image search: [Google]
キャプチャ.png
9KB, 511x193px
is it something wrong with hph7?
>>
>>61858098
Yeah, that error about a file being missing is definitely a problem with hph7.
>ESL
>>
>>61858258
do you know a way to fix it?
>>
>>61853726
With comfy 12-hour days?
>>
I want to build a sort of scraper that looks for any image from a url and compares it to an existing database of images stored locally. Before comparing, it needs to identify the content of the image, basically if the image depics Pepe, for instance, the program compares it with other pepes stored locally to check if it is missing or not. I know how to work on images, the only problem is that I have no idea about the image recognition. I know there is some Machine Learning involved here.
Has anyone developed something similar?
I'd do it in Php/JS.
>>
>>61858726
>opencv
>study machine learning
>study image recognition
>to do your idea you need to already have a trained model/set
If you don't have a web frontend you wouldn't even need any js for this.
>>
How do you guys upload projects made with composer?

I know that a lot of people are using shared hosting for production. Many shared hosting providers do not let you have command line access necessary for running composer on the production deployment. In that case, do you deploy the project with the /vendor folder included?

In the frontend side I just use webpack to automatically inject node_modules dependencies into the final build, therefore eliminating the need to upload the entire node_modules folder.

I'm just kind of confused with this
>>
>tfw can't find motivation to continue with reactjs
Every time I work on it I just get swamped with shit I need to learn: reactjs, redux, reactor (though that one's easy af desu)...
>>
>>61851920
I actually joined it and the guys on /wdg/ are chill.

Here's an invite if you want to join the club.

https://discord.gg/wdg
>>
WHat are some ways to tie in webdev and security?

Can I run a freelancing pentesting site on the side?
>>
>>61860008
Then move on to something else you enjoy.
I honestly can't even learn about anything in stages like that. It has to all be working towards a personal project otherwise it starts feeling vague.
So try that, either work towards a project and learning necessary components as they arise or as I said earlier just move on.
>>
>>61849221
Look up data urls.
>>
>>61860128
it's for a project but it's just hard because I'm trying to go about it in a "proper" way. I built out a prototype, now I'm building it without states, then I have to get it working with states, then I need to get it ready for the backend's API, then build the backend. It's just taking such a long time that I feel like it's pointless when I know it isn't.
>>
>>61860164
If it's taking such a long time that you're starting to feel like it's pointless, why not speed up the process? Granted, this advice isn't that great if you're working on an enterprise tier bank system or some major shit, but otherwise it's a very important skill to know where to cut corners. Not every step has to be polished to perfection.
>>
This was posted in /dpt/ but is kinda relevant to /wdg/ too
>>
>>61860264
keep your garbage in the /nevergetanythingdonebecauseautism/ containment thread
>>
>>61860210
naw it's just some media hosting site. I probably should though, get states working along with the pages and have the bare minimums working.
>>
>>61855196
lol just build a mailing system with PHP and have it refresh the inbox page every 5 seconds :^)
you can do it in no time, it's better than nothing
>>
Anyone here doing anything with ethereum/solidity?
>>
Suppose I have a CRUD app working off a database of 1000 records. Fetching the entire list is pretty expensive(2-4seconds). How often am I supposed to read all 1000 records from the database?

Just once, at the beginning of the app? Every time after an insert/update/delete? Or is the best practice some weird middle ground of the two?
>>
Does anybody knows how would I approach to make an article editor like wordpress?

I want my user to be able to insert images and videos, to be able to align text and all of that but I have no idea how to start

I can't find any resources about it. any tutorial, video, source, webpage, explanation?
>>
>>61860462
Check out TinyMCE
>>
>>61860043
kill yourself
>>
File: Screenshot (57).png (43KB, 1600x900px) Image search: [Google]
Screenshot (57).png
43KB, 1600x900px
Hey guys anyone knows about p5.js?

I'm just trying the framework looks nice

any ideas on how to apply this framework into a tool like a slide show or something?

maybe I can try to make some of your ideas :D I've done some simple tests. right now I'm trying to make my version of mspaint from windows xp
just to get familair with the API
>>
>>61861114
>:D
>>
>>61856559
Working on responsive applications using JS

It wasn't too specific. I just know it'll be a typical technical interview with algo questions
>>
>>61861114
>p5.js
Why this over the better maintained processing.js?
>>
>>61856029
Fizzbuzz, fibonacci, tree traversal questions are probably the most common stock questions, if you can't do all of those without thinking start there.

Closures and async execution tricks are also common, I ask both in almost any frontend interview.

It gets a lot broader from there, probably nothing you're going to study beyond that is going to turn up in a given interview. In the future don't be a lazy piece of shit and work on studying algorithms before you start getting interviews.
>>
>>61862232
Idk I tried this one and liked it, that's about it, also proccesing.js website looks a lot more abandoned
>>
>>61862277
Thank you man.

I just started on algo questions, was working on projects till now. The interviews all just suddenly happened, I have three in a row.

Final question: if someone fails an algo/technical question, is there a way they can redeem themselves and still get the job in your eyes?
>>
>>61863369
Not him, but it depends on the company I guess. Our lead is absolutely anal about algorithms questions, he was a cs phd student once. Basically, no tree traversals - no job.

cto in the other company I worked for was much more relaxed about algo questions and all he cared about were test projects.

Just like get ready senpai, read algos. Good luck
>>
>>61862277
>Fizzbuzz, fibonacci, tree traversal questions are probably the most common stock questions, if you can't do all of those without thinking start there.

Would I be expected to know this for a junior position? Basically my first job ever (in programming) is what I'm going for. I can do fizzbuzz and fibo, but not trees.
>>
>>61853690
Thanks for the help. I need to get round to those arrow functions sometime. It isn't working...:(
>>
How much should a person charge to a small business to provide middleman services between them and a web hosting provider? Is $100 per month a good starting point, considering that I'll just be buying a domain off some standard web host for $5 per month?
>>
CSS is such a pain in the ass, bring me more Javascript
>>
>>61863665
How much time do you think you'll spend in a given year? Charge them based on that.
>>
>>61863708

I like CSS
even more since I'm learning Post CSS stuff
>>
Bruhs

if (e.keyCode === 13 && e.ctrlKey) {
inputEl.value = inputEl.value + '/n';
}

I wanna make it so that when the user presses Ctrl along with Enter, a new line is produced in the textarea field just as if they had pressed Enter normally. In my script I made pressing the Enter key into "submit value of textarea to <div> below then clear text in textarea". That works fine but this doesn't. A lil' assistance please friends
>>
>>61864401
>this doesn't
What do you expect to see and what is actually happening?
>>
>>61864553
Enter + Ctrl = new line in textarea, just like default behaviour when Enter is pressed

What happens at the moment is '\n' is inserted after the textarea's value because it is interpreted as a string and not as a directive to insert an actual newline

So "how do I insert newline into textarea with Javascript?" is what I'm asking here
>>
>>61864572
>inputEl.value + '/n';
'\n'
>>
Really simple question, but I just don't know:

How do I trigger a download in React?
I want user to click a button, which then prompts a download or an open of an image.

How do I do this?
>>
File: f9FW2.gif (2MB, 240x180px) Image search: [Google]
f9FW2.gif
2MB, 240x180px
>>61864591
Thank you
>>
>>61863543
You'll be alright with fizzbuzz and fibo. Learn data structures if you haven't already. Your interviewer will likely test you on something more practical like making a mini rest API.
>>
>>61860373
Got anything planned?
>>
>>61860384
Might be best to update it client side rather than fetching the new database after every update i.e. when the API confirms a data entry then you can add it to the client.
>>
>>61864597
in what sense is that specific to React and not JS in general?
>>
>>61864597

Do you need to use React?

<form method="get" action="myImage.jpg">
<button type="submit">download image</button>
</form>


If you prefer to use React:

https://www.npmjs.com/package/react-file-download
>>
>>61855196
Not a web dev, just dipping my head in here, but this doesn't sound too difficult to hack something shitty/simple together. Can't you just setup a REST server (tons of guides for this, I'd do it in ASP because I know C# but I'm sure node.js isn't much harder) and have users POST messages to a username/message JSON object, send it to the REST server, and then when someone wants to view their messages, just do a GET and have the server authenticate their cookie and return the list of objects with their username as the recipient? Seems like a simple backend structure. Then you just need to render it all pretty with CSS/js -- no idea how you do that, but again, something functional is probably not horribly difficult.
>>
>>61860384
How the fuck is it that slow to fetch 1000 records? 1000 records is nothing.
>>
>>61864632
thx anon. I'll spend my first paycheck on hookers and blow and think of you
>>
>>61865354
Yes I don't think it's that hard either I just wanted to hear some suggestion on how you could go about it. Thank you anon, for the first real answer. Now I just need to figure out how to do the front end.
>>
Redpill me on IndexedDB.
>>
File: loveheart.png (53KB, 2000x1814px) Image search: [Google]
loveheart.png
53KB, 2000x1814px
Anyone else here love web development?

I do.

I get to work on exciting and interesting stuff every day :)

<3
>>
>>61866146
Me too. I hated it for so long after my first web dev job went horribly wrong.

I'm just sad I wasted so many months learning nothing at that shit hole. now i have an interview at my dream place and I'm 99.99% certain i'll fail because i have a very basic knowledge and can't answer technical questions for shit.
>>
>>61866146
Yes, Incidentally I love the fact that there's so much shit going into web dev, so many technologies, so many libraries, that you feel so paralyzed that you don't even know where to start. I love that feeling.
>>
>2017
>still using var and not exclusively using let and const to declare variables
>>
>>61866328
That's not so bad when you at least know what knowledge you're missing. But then sometimes there's a thing that you had no idea you didn't know about, and just leaves you confused. E.g. "why isn't this working?" - "oh, CORS is a thing" or "oh, I need to be returning 206 partial responses".
>>
File: 1444981822903.gif (649KB, 400x300px) Image search: [Google]
1444981822903.gif
649KB, 400x300px
>>61866858
aye i'm trying to switch too just need some practice
>>
>>61866896
Not him/her, but fuck CORS.
>>
>>61866328
>walk into grocery store
>all these different types of chips, dips, vegetables, and meats
>they all fulfill different desires but ultimately the same goal
>UGHHHH THIS IS PARALYZING UGHHHHH
/g/ in 2017

- Screenplay adapted by Anon
>>
>>61851580

Ah thanks man that makes more sense now
>>
Using django, I have users create a user profile, and I want a wallet model associated to the user through a OneToOneField. I have defined the Wallet class (with a default value of $5000), and the User class, so my question is:

When the user creates a user profile, is the wallet created automatically for him (because it's one-to-one and has its only value set by default)? Should I specify for the wallet to be created in the Register_User definition? Hope the question makes some sense...
>>
>>61868489
nvm, figured it out. If anyone is interested, I ended up instantiating the wallet class within the Register_User definition.
>>
I want to create projects in JS, I really do

But my care for Javascript has sapped dry after about 2 months of learning. I feel like I have learned it all but don't really have any finished projects to show for it.

What language did you guys move on to after the basic three /wdg/?
>>
>>61868916
enlighten the ignorant, what is the basic 3?

front end html/css/js?
>>
>>61868947
yes
>>
>>61868916
AFter the big 3 I went with C#, had my fun with it, but eventually got sick of all the boilerplate, and realized I didn't want to work in the corporate environments that would lean towards that language. Then I switched to Python and stuck with it so far, really love it. It's just so much fun coding in Python. For anyone worried about performance and shit: yeah, I'm not at the stage yet where I need to actually worry about that. I'm just interested in getting shit up and running at the moment.

But If you want a statically-typed language, I would recommend Go. It feels like a mid-point between Python on one hand and C#/Java on the other, in terms of verbosity, boilerplate and all that.
>>
>>61868916
Then start some projects to demonstrate you know it. Shouldn't be too hard to come up with at least 1 project a day for a week. Nothing vast, just a demonstration of understanding obviously.
Anyways to your question, personally C#, Python, and now Swift.
>>
>>61868916
that sounds like a problem not really related to any language friend
>>
>>61869010
>>61869012
Aren't those all languages for developing software? I would like to stick to webdev right now.

>>61869029
It is either webdev or alcohol for me atm
>>
>>61869090
>Aren't those all languages for developing software?
ummmmmmm
>>
>>61868916

you need to build stuff and not just read and memorize. you won't get paid to memorize stuff but to create stuff.
>>
>>61869090
>Aren't those all languages for developing software? I would like to stick to webdev right now.
dude
>>
So what are some practical examples of output buffering usage in php?
I know ob_start() and ob_get_content will start the process and store the information in a variable, but when would you use it and why?
>>
File: 1502230780924.jpg (467KB, 1728x2592px) Image search: [Google]
1502230780924.jpg
467KB, 1728x2592px
>>61847538

How do I detect if some JS contains an eval statement?
>>
>>61870831
Detect from what?
>>
>>61870854

By reading the source with Javascript
>>

app.get('/something', function(req, res)
{

doSomethingAsynchronously(function(err, res)
{

// can't access req from here
// I know why
// but can't figure out how to work with this,
// without defining an upper-scope variable accessible from everywhere

});

});



someone help please
>>
>>61870878
As a string? source.includes('eval') or something. You're not going to get a good solution unless you say more about exactly what your scenario is.
>>
>>61870930

or even worse

file1.js


someVar=null;
myModule=require('./some_module.js')();

// there must be a built-in way to wait for someVar
// before ending the script without dirty tricks like

(function(callback)
{
wait=setInterval(function()
{
someVar!==null
?
(
clearInterval(wait),
callback()
):null;
}, 300);
})(function()
{
res.end();
});

// but how does I do?



some_module.js


module.exports=function()
{

doSomethingAsynchronously(function(err, res)
{

if(!err)
{
someVar=res;

}

});

};

>>
>>61870930
Use an ES6 arrow function to capture the outer scope
>>
>>61871069

and what I have this situation?

test.js


let res=1;
require('./test2.js')();



test2.js


module.exports=()=>
{
console.log(res);
};



results in


console.log(res);
^

ReferenceError: res is not defined



Passing res to test2.js will make a copy, so whatever I do won't change the original variable.
>>
Hey yall.

I'm wanting to build a real time chat app with web sockets/php (probably with laravel framework).

Any suggestions, tutorials, etc.?

I've been looking at Ratchet. (cboden/ratchet). Is that a good option or what?
Any suggestions appreciated.
>>
>>61870942

I am making an add-on that blocks all javascript that contains an eval statement
>>
>>61871631
Enforce a content security policy to prevent the use of eval on all pages via the browser
>>
>>61871397
your test2.js exports a function that doesn't take any argument
>>
>>61871685
>>61871397
ah looked at it again.
but yeah you need to pass that variable to the function.
>>
File: 1500071475575.jpg (119KB, 655x578px) Image search: [Google]
1500071475575.jpg
119KB, 655x578px
>>61871013
You *CAN* access req in the inner function...thats a basic concept of javascript. Look up closure.

>>61871013
>>61871397
also, your code style is disgusting senpai. oh my god I hope you are trolling
>>
>>61871730

If I pass it, it only becomes a copy within the child function's scope.

Simplest way of doing it is defining a globally available variable and assigning it up.

>>61871754

Async.
>>
>>61869754
It's often used in templating to capture output in string for post processing and to pass it around.
>>
>>61871860
>If I pass it, it only becomes a copy within the child function's scope.
that's the point?
>Simplest way of doing it is defining a globally available variable
unwise
>>
honestly code on 4chan is so ugly and unnecessarily fuckhueg how hasn't nipmoot killed himself
>>
>$15 full-stack python/django course on udemy

worth it for getting into webdev? i know python and c++ already but not proficient enough to get employed

i'll post the link if anyone wants. i don't want to look like a shill, just genuinely curious if this would be worth my time or if i should look into javascript frameworks instead
>>
>>61872338
What does 4chan use? The site has been around since 2003, does it still use PHP?
>>
Grrrr I hate using <div> elements in 2017 but sometimes you still gotta
>>
All the new stuff like async functions, promises and arrow functions just completely bewilder me
>>
>>61869090
>Aren't those all languages for developing software?

python, C# and Go can be used for developing software, but they are also used for webdev, mainly, back-end stuff. I think your confusion might come from the front-end / back-end distinction, but yeah, it's all webdev. Check out the links in the OP for clarification.
>>
>>61871965
Thanks!
>>
>>61869090
>Aren't those all languages for developing software

the internet was written in Python mang..
>>
Is using directories and .json files to save data (profiles, posts) etc. social network style noticably slower than using mysql? Does it scale worse?
>>
>>61873240
Yes, why would you do this?
>>
>>61872984
Break them down until you understand.

>>61872928
<div class="col-xD-fug">u</div>
>>
>>61873503
Because it was easy and fast to develop.

And it works quite well actually.
>>
>>61872665
No video course is worth unless on pluralsight or udacity (most of the content is free on udacity anyways). And if you're too poor, pirate. Although, I've stopped caring about video content.
And this is from experience, wasted $30 on that udemy trash when they were on sale for like 5 or 10 dollars idk
>>
>>61849448
im doing this too, and i settled for the free tier amazon elastic beanstalk, it even has tutorials for setting up django and a free namesheap .me domain name, if you are an student
>>
>>61849448
github pages and namecheap
>>
>>61873623
You say you want social network style, but if you actually get like 100 users, things are gonna go bad. Also, how is it possibly quicker to develop like this?
>>
>>61863219
>Final question: if someone fails an algo/technical question, is there a way they can redeem themselves and still get the job in your eyes?

Interviewers have a whole range of opinions. Personally I usually ask thee or four algorithm/coding questions in an interview and will advance a candidate if they don't miss more than one. Someone who answers three questions really well and freezes up on one is better in my books than someone who limps through four.

But there's usually a softball in there along the lines of fizzbuzz and if they can't do that it makes me wonder how they managed the harder ones. On the whole though yeah, one missed question is recoverable IMO.

>>61863543
>Would I be expected to know this for a junior position? Basically my first job ever (in programming) is what I'm going for. I can do fizzbuzz and fibo, but not trees.

I would strongly suggest learning the basic tree traversal algorithms. Some interviewers don't think data structures are important for frontend developers, but many others (including me) do. For a junior position you probably don't need to worry about tree balancing or the popular graph algorithms (although these should be things on your radar) but I wouldn't hire someone who couldn't do traversal or BST search. Working with the DOM is something you do every day, and the DOM is a tree, so if you don't at least know the rudiments of working with trees you're going to have a hard time.
>>
File: 1498421360984.jpg (43KB, 570x587px) Image search: [Google]
1498421360984.jpg
43KB, 570x587px
>>61871860
"Async" isn't a response

I'm not sure why you're trying to act like an authority on the topic when you're the one here asking for help.

Google "javascript closure" and educate yourself. You absolutely can access req.
>>
Is Ruby just an object-oriented Perl? Doesn't that mean that Perl is superior? After all the greatest piece of software known to man was written in Perl (cowsay).
>>
>>61871631
That doesn't seem like a good idea, eval isn't always a bad thing. If you really want to do it you can be sure your script will execute before any page scripts you can do something like:

window['eval'] = function() {}


or make it throw an exception or something.
>>
>>61874196
>Is Ruby just an object-oriented Perl?
No

>Doesn't that mean that Perl is superior?
even if it were true it wouldn't mean that
>>
>>61865939
It's broken.
Not just on most browsers (most noticably Safari, whose implementation seems like it was made up by someone who was given a rough idea of how it's supposed to work), but also the fucking thing itself.

Using it fucking sucks. The API is as inconvenient as it could be. Everyone who worked on it should be ashamed.
This is how I'd expect stuff to work in C or C++ where the language doesn't have proper constructs for managing callbacks.

I heard that IndexedDB 2.0 somewhat fixes the madness but try guessing how good browser support is.
>>
>>61874196
Perl can OOP just fine, and if you choose to use Moose it does OOP better than practically anything else out there. Ruby is just prettier and "easier" to use. That said Perl doesn't have much over Ruby besides speed
>>
>>61872322
>that's the point?
He said earlier that he wants the inner function to have access to the outer variable and be able to mutate it, so a copy doesn't work.
>>
>>61849448
Heroku has a free tier and you don't have to worry about maintaining a server. There is a certain degree of vendor lock in but it could be worse.

Other than that you could go with any of a number of cheap VPS providers. ramnode is good for hobby projects. Really pick anything off the front page of lowendbox

As for registrars, gandi is a little more expensive than the cheapest you can find but their support is a mile ahead of the competition. I consider it well worth the couple of extra bucks.
>>
What's your preferred development environment /wdg/?
>>
>>61865939
Kind of ill considered to start with, the real solution would be to give some kind of sandboxed access to low level disk operations and let userspace figure out what a reasonable DB for the browser is (honestly I'm not convinced there's an answer, at the point you need a DB in your fucking browser it's probably time to build a native app)

>>61867081
Do you realize what would happen if CORS didn't exist? Do you understand by it's a thing?
>>
>>61874392
vim on any reasonable unix operating system with all major browsers available. If I need to use browser developer tools, I usually like to use Chrome's, but Firefox's usually work almost as well
>>
>>61871860
>If I pass it, it only becomes a copy within the child function's scope.
Make res a property on some object and pass the object in?

Or better yet create an accessor function where res is in scope and pass that.
>>
>>61874392
vscode 64
black coffee
clean desk
fuckhuge sketchpad to my left
thin keyboard
and sourcetree bc im lazy with git
>>
>>61873960
Tell me, how are things gonna go bad?
Creating json files and directories isn't really any slower than sending data to a mysql database. Both take a few milliseconds only.
>>
>>61874392
nano on Gentoo
>>
>>61874574
>Creating json files and directories isn't really any slower than sending data to a mysql database
JSON sitting on your disk has no way of enforcing a schema, of indexing by anything other than filename, of enforcing typical constraints, of doing efficient join operations, of synchronizing writes, of caching.

People haven't spent decades writing insanely complex DB systems just for kicks, designing anything other than toy systems is incredibly painful with flat files.
>>
>>61874574
>>61875040
Anon is right, joins make relational data easy to model. How complicated would writing this be using JSON files...please post code, I'd love to see some wild stuff like that
>>
Thoughts on CockroachDB?
>>
Why would i want to use vue or react instead of just rendering on the server with erb/ejs/jade/whatever and augmenting with whatever js is needed in a script tag? Or if i must have an SPA why not use a simple router like page.js and the html5 template tag? I dont get it.
>>
>>61853515
I believe there's a limit on how far mongodb documents can be nested. You may hit that limit if you nest like you have, but im not sure. Have you looked up mongoose populating? It's essentially like reference keys in SQL.
>>
>>61878033
The benefits of React/Vue are vast for the right use cases. Component lifecycle methods (at least in React) are incredibly useful. Also using Redux for state management is a life send. Nothing wrong with server-side rendering, but you'll have to do a lot more leg work when dealing with state
>>
How do I better this php code

if ($start_or_end === 'start') {
$call_data = array (
'start_call_date' => $date,
'modified_date' => $date
);
} else if ($start_or_end === 'end') {
$call_data = array (
'start_call_date' => $date,
'modified_date' => $date
);
} else {
return FALSE;
}
>>
>>61879508
Second array is supposed to be end_call_date btw
>>
>>61874122
Where do you suggest starting to learn the tree traversals? I know absolutely nothing about them, except theory about the binary search.

Where can I find explanations/examples of tree traversal in JS?
>>
Advantage of NoSQL DBs over SQLs?
>>
>>61874392
vs code
>>61875508
retarded name
>>61857501
>also will wdg be anything but tech support for normies who are trying to alter their tumblr theme
At least I can make a nice post and possible help someone. Otherwise it's back to framework wars or arguing with people about muh backend language.
>>
>>61880549
PHP is the only good backend language
>>
How do you guys motivate yourself everyday to do wevdev? Whenever I get home from work I just feel like playing vidya and watching shows.
>>
>>61881054
If I would have to motivate myself to do webdev, I wouldn't do it.
>>
good place to start learning basics of programming:
https://painlessprogramming.blogspot.hr/
>>
File: lrg.jpg (118KB, 500x657px) Image search: [Google]
lrg.jpg
118KB, 500x657px
>>61881054
for me, it's all about learning. I hate frontend so I just decided to avoid it. But fucking around with databases, servers, authorization protocols, learning about the innards of the internet, I guess I love that shit. I got pic related and started reading through, just fascinated by all that arcane shit. Then I picked up a book on Redis and also just plowed through it.

My goal is not webdev itself though, I really wanna do machine learning and cool shit like that. So webdev is a stepping stone on that way. Basically, I wanna get my first programming job in webdev, and then once I'm covered financially, dive into AI and machine learning. Self-taught fag here btw.
>>
>>61881054
it is my passion so I don't need motivation to learn

>>61881392
you and I are total opposites lol, databases and servers are my least favourite aspects of web development. I love the debugging process and fixing issues though
>>
Can someone explain like I'm 5 what the difference between prototypes in javascript and classes in java? Also the difference between this is both languages. Thank you!
>>
>>61854495
>desu
kill yourself.
>>
File: W8sLp4bNnd-2.png (29KB, 300x250px) Image search: [Google]
W8sLp4bNnd-2.png
29KB, 300x250px
The magic of Javascript is a true sight to behold!

https://jsfiddle.net/o3LjLa54/
>>
>>61882215
learn the ropes before you hit the Post button, kid
>>
>>61881800
>explain like I'm 5
reddit

https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%20object%20prototypes/ch5.md
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_prototypes

>>61882215
new desu senpai
>>
>>61881054
It's just fun. I'll be playing a vidya but then like 20 mins later crave working on my project so then I do so.
I will never understand those that get into programming/webdev for money, seems like a really fast way to burn out.
>>
>>61852655
>>61854925
>>61857232
>>61860986
>>61882215
Wew.
>>
>>61882360
guess he fucked up an interview
>>
>>61879508
is this a joke
>>
Any good/cheap anonymous server hosts that accept crypto? Expecting very low traffic (<1000 hits) but I do need to be able to execute a lightweight server-side node script so I'm not sure if shared hosting is viable. Everything else is static.
>>
File: foxsquirrelly.jpg (51KB, 500x339px) Image search: [Google]
foxsquirrelly.jpg
51KB, 500x339px
ff devs getting funny with the nightly icons
>>
Javascript question:

Say I record audio from my microphone, using Recorder.js. How can I then trim/crop/slice/cut the recording? Meaning, say I record 3.5 seconds, and I want only the first 3 seconds. Any ideas?
>>
So my friend often asks me to fix things in his business wordpress website. Add a plugin, change layout, etc. What would be a reasonable charge faam? Should I charge hourly or? Not a webdev by day, so I don't know what do you guys make on average
>>
i wish i could finish projects faster and have a portfolio of work quicker instead of having to think about stuff and work issues and bugs out
>>
File: js.png (1KB, 109x67px) Image search: [Google]
js.png
1KB, 109x67px
>
>>
>>61886627
y-your lagnauge has faults too
>>
i prefer laravel over mean stack
>>
File: 1501440653678.gif (440KB, 450x337px) Image search: [Google]
1501440653678.gif
440KB, 450x337px
>>61887257
mean stack is retarded
even pretending using node for general purpose applications is ok there is no reason to use mongo for regular stuff
>>
File: cheese-pizza-dot-jay-pee-jee.jpg (90KB, 857x456px) Image search: [Google]
cheese-pizza-dot-jay-pee-jee.jpg
90KB, 857x456px
>>61887354
i was just meming man im learning mean stack, coming from a laravel background and im just tired and working :^)

what stack do you use
>>
File: 1501845029207.gif (1MB, 500x242px) Image search: [Google]
1501845029207.gif
1MB, 500x242px
>>61887569
postgresql apache java elasticsearch elixir tomcat
jk i just do java spring with postgres, proxying through apache and occasionaly use redis for caching
>>
File: 0L1keQLZYNcrp4V4Is6Y_1082126865.jpg (55KB, 590x885px) Image search: [Google]
0L1keQLZYNcrp4V4Is6Y_1082126865.jpg
55KB, 590x885px
I just bought a can of black spraypaint and covered up a Trump sticker down the street, and it gave me an idea for a site for people in my city to report graffiti. It asks for permissions for location access, and when a picture is uploaded it automatically sets to coordinates of the image and creates a marker in the database. Then it can be used to find all the graffiti around town so that city workers or even concerned citizens can clean the city up.

I know what you're thinking: I'm trying to destroy art.

No, I'm not. My city has many beautiful murals painted by students at my university (pic related) that will remain. 99% of the graffiti in my city is just people scrawling their name on both public and private property. It's an eyesore, not art.
>>
File: 1502399500791.png (204KB, 922x450px) Image search: [Google]
1502399500791.png
204KB, 922x450px
just want a job. is this still a viable field? Can I learn it if I'm a brainlet? What projects do I need to build before I can get a job?
>>
>>61888291
Learn ASP.Net MVCs
>>
>>61879120
but what are the use cases? Just seems like over engineering to the point that you get nothing done and your app is slow and janky.
>>
>>61847538
who /vue/ here?
>>
>>61887706
Can you explain proxying like I am a retard anon? Why do people proxy apache with nginx for example?
>>
>>61879508
switch statement
>>
>>61888462
i'm just using apache to direct traffic to java application servers (usually tomcat)
i do this because it is supposed to have better perfs and i can collect logs from apache which is nice
but i'm shit at sysadmin stuff and have been told nginx is superior in every way so don't trust me on it, maybe ask /fglt/ for this kind of stuff
>>
File: 1497977311656.png (4KB, 400x400px) Image search: [Google]
1497977311656.png
4KB, 400x400px
>>61888360
yeah you don't need it for absolutely everything, but some cases fit it all too well and make your HTML & JS much cleaner, easier to read and maintain.
I have the same feeling towards those state management libraries like Redux and Vuex though, so...

>>61888453
>>
File: ivdxugbj0rxy.jpg (440KB, 1520x2048px) Image search: [Google]
ivdxugbj0rxy.jpg
440KB, 1520x2048px
I have watched shitton of tutorialls like CSS, HMTL, Bootstrap, javascript and soo on.
Completed whole web developer bootcamp course on udemy(basic mean stack), but yet i can't make anytinhg meaningful.
Want to become full stack developer.
I feel so lost on all these begginer courses and videos.
Where do i go next?
Where could I find information to see the bigger picture?
How do i need to learn further?
>>
>>61888825
don't you have something in your mind, that you would like to create?
There are always interesting things to make.
>>
>>61888291
>just want a job.
try mcdonalds flipping burgers still requires a human
>>
>>61888963
Yeah i do, but have no idea where to start and how to realize these ideas.

Created simple blog page.
With logins, signups, comments and other stuff.
But it just doesn't seem right.
Every blog post is same and don't know how to format it.
Bots could easily flood my webpage with comments.
I have also succesfully implemented apis like weather.
But still it seems i way too far from creating something worth money and i don't know where to seek for help or information.
>>
>>61889181
i've already worked there and it's shit. Plus I'm sure they have AI for burger flipping now, it's only a matter of time
>>
>>61889199
>Yeah i do, but have no idea where to start and how to realize these ideas.

Okay, good. So you're starting out; That's fine. Firstly, keep in mind that just because it's been done before doesn't mean you shouldn't do it too. Sure, countless blog pages have already been done.
Next, what do you know about the MEAN stack? Can you construct a full app, with Angular front-end, Node/Express back-end, and a MongoDB database? If so, just start sketching out your plan. What else could your blog have? What's something you always WISHED a blog had that yours COULD have? Or, alternatively, what's something utterly ridiculous that your blog doesn't need at all, but still would be cool if you added it?
>>
>>61875448
Site is up and running

http://goroast.me/
>>
This one goes out to my fellow Javascript intermediates.

What interesting thing have you learned about how Javascript works recently?

My interesting thing relates to clearInterval(), particularly when used inside a setInterval() block. Only way to clear an interval inside its own code block is to declare the interval in a function expression rather than a function declaration:

So this does not do anything:
setInterval( function aiInterval() {
aiCount--;
aiCountDiv.textContent = aiCount;
if (aiCount === 0) {
clearInterval(aiInterval);
} }, 1000)


But this works:
let aiInterval = setInterval( function() {
aiCount--;
aiCountDiv.textContent = aiCount;
if (aiCount === 0) {
clearInterval(aiInterval);
} }, 1000)


Also you should use let and const for all variables and stay the hell away from var.
>>
File: 1501169284271.png (7KB, 300x300px) Image search: [Google]
1501169284271.png
7KB, 300x300px
>>61890774
>Also you should use let and const for all variables and stay the hell away from var.
Pls explain this
>>
>>61890843
let and const fulfill the requirement for block-scope and global-scope variables respectively while var makes code messy, more difficult to debug and harder to understand for others because it isn't defined to scopes
>>
>>61890585
wtf i thought you needed to be 18 to post here
>>
>>61890958
Btw I just researched and it turns out I was completely wrong about what I just said. Just look up const and let in MDN. Basically they are intended to replace var in the future to make code easier to read.
>>
in css is there something like the brightness filter, but for just the background-color?
>>
>>61890958
why is this a problem as long as you aren't a retard with your variable names?
>>
>>61879804
You can just google these things, wikipedia articles on tree traversal and binary search trees cover the relevant algorithms.

>>61890843
He doesn't know what he's talking about. Let and var are virtually identical. Var functions by creating a variable in the closes function scope, let creates a variable in the nearest block scope. The the difference is a variable defined in a for loop with `var` will exist once the loop is complete until the end of the enclosing function while if you use let it will be out of scope once execution exits the for block.

The difference is negligible, in theory let gives GC the option to collect a few vars a little earlier but in reality no one does it because running a sweep after every block exit doesn't really make sense for performance reasons. On the other hand bable has to inject a bunch of code to enforce these semantics on older JS engines and that does cost something (although not a lot).

Const is sorta useful, if you're in an ES6 environment I encourage using it where it makes sense. Using it without immutable types (any object) really limits its ability to help programmers think about code. I don't really care if a var is never reassigned if someone changes every prop on the object it points to.
>>
>>61890585
>http://goroast.me/
Your tabs are broken.

>>61891316
Is there a reason you can't just make the background color brighter?
>>
>>61891367
>Is there a reason you can't just make the background color brighter?

was meant for

>>61891273
>>
File: 1498483309445.jpg (238KB, 900x600px) Image search: [Google]
1498483309445.jpg
238KB, 900x600px
>>61891333
>a variable defined in a for loop with `var` will exist once the loop is complete
didn't know this, thanks senapi
>>
>>61891367
Huh? Tabs work just fine for me, what you're talking about?
>>
>>61891333
>Let and var are virtually identical
No, and there is no reason to use var anymore.
>>
>>61891511
What is the difference beyond what I explained? Why is let significantly better than var?
>>
>>61891367
>Is there a reason you can't just make the background color brighter?
It's for anelement that has a toggling "active" class when selected, but the different pages have their own color schemes which I want to keep, just brighten up.
>>
>>61891796
there's `filter: brightness()` but it applies to the whole element, not just the background. And browser support isn't great.

I think the best approach is probably to just have each page define what the bright variant looks like as part of its color scheme.
>>
>>61888207
that's pretty fucking cool... Want some help? what langs you wanna code that in?
>>
>>61888207
fyi you can also read exif data from the image, which can contain location. It's enabled on most smartphones by default iirc.
>>
>>61847538

Can someone explain why

js
this.navbtnToggle = function(data, index){
console.log(data, index);
};


html

<div data-bind="foreach: markerType">
<button class="nav-button" data-bind="click: $parent.navbtnToggle.bind($data, $index())">
<div data-bind="style:{color:$parent.selectedColor}, text: name"></div>
</button>
</div>


prints out the index first then the data?
>>
>>61847538
I have 4 domains with registered with godaddy and hosted on cPanel. Any suggestions/tips or good tutorials I should consult? I am using cPanel for linux more specifically, but I have windows running on both my desktop and laptop.
>>
>>61893482

Forgot to add that i'm using knockoutjs.
>>
whats the point of using a getter?
let obj1 = {
log: ["zzz"],

// getter
get items() {
if (this.log.length === 0) {
return "empty items";
}
return this.log;
},

// same as getter above
getitems: function() {
if (this.log.length === 0) {
return "empty items";
}
return this.log;
}
}

console.log(obj1.items); // ["zzz"]

obj1.log = [];

console.log(obj1.items); // "empty items"
>>
>>61893530
>2017 in the year of the Lord Jesus Lizard
>knockoutjs
>>
>>61893561

Is knockoutjs bad?
>>
>>61891599
let is block-scoped. it "lets" you create variables with similar names as long as they're on a different block. it makes your variables more controlled. it also prevents other indians from stealing your vars in other modules
>>
>>61893482
The first argument to `.bind()` will be the value of `this` when the function is evaluated, the second argument to bind will be the first to the function, third to bind second to function etc.

ko style is to refer to the current element's data by `this`, but if you don't like that you could do this instead:

data-bind="click: $parent.navbtnToggle.bind($parent, $data, $index())"


The example in the docs isn't terribly clear on this which is unfortunate. Good job picking KO btw, it's one of my favorite libs :)
>>
>>61893561
>>61893707
No, knockout is one of the few libraries in the MVVM space that doesn't tard out and try to build a colossal lock-in ecosystem. It does one thing and it doesn't it well. It doesn't ship with a testing framework or a state container or a services framework ala React, Angular et. al. It does dependency-tracked DOM re-rendering and it does it damn well.
>>
>>61893745
>let is block-scoped.
Yes, that's what I said earlier. I questioned the usefulness of block scoping over function scoping and pointed out the cost of supporting it in today's environment.

>it "lets" you create variables with similar names as long as they're on a different block.
And var does the same thing, as long as such variables are in a different function. Reusing the same variable name in the same lexical context is like punching readability in the dick though and shouldn't be done either way.

>it makes your variables more controlled.
Yeah and line-scoped variables would be more controlled too but that doesn't make it a good thing.

>it also prevents other indians from stealing your vars in other modules
You don't know how var works
>>
I mean christ, why do people bandwagon every ES6+ feature that gets shit out of commitee hell without even knowing what they do? You can think these bad ideas are good ones, if you want, but at least try to understand what they are first, christ.
>>
Hey guys, arrow functions! Isn't this great! Arrow functions cure cancer! It's not like every dev who's worked with JS for two days knows how to get the exact same semantics as arrow functions since javascript has been a thing.
>>
>>61894013
>why do people bandwagon every ES6+ feature that gets shit out of commitee hell without even knowing what they do?

Only the article writers at smashingmagazine does that. Just visit that site and you'll cringe...

>OMG A NEW FUNCTION FINALLY!
>FINALLY CSSX MEETS JSSXSX!
>>
>>61893996
>You don't know how var works
You don't know JS
>>
>>61881392
Fuck me, I feel exactly the same. Just a stepping stone to my goal.
>>
>>61894113
>Only the article writers at smashingmagazine does that.
lots of programming blogs are this way for every new stuff that's remotely related to their topic
they just are after these sweet (you)s
>>
>>61894136
So are you denying that variables declared with `var` are scoped to function blocks, or are you just a troll?
>>
>>61871610
This one has Vue in it so you can learn something new.
https://www.youtube.com/watch?v=rL-dJcxC8X8&list=PLXsbBbd36_uVjOFH_P25__XAyGsohXWlv
>>
File: c1.jpg (28KB, 296x577px) Image search: [Google]
c1.jpg
28KB, 296x577px
How many apache2 clients can run on one of these before it slows down?

I'm hosting video on a static page.
>>
>>61896334
site?
>>
File: eth0.jpg (28KB, 598x216px) Image search: [Google]
eth0.jpg
28KB, 598x216px
>>61896356
I host videos that are taken off youtube, I wont say what the name is.

17,063 page views in the last 7 days. Net traffic in photo. It's on C1 atm.
>>
>>61896412
like what hosting site
>>
>>61896460
Scaleway France
>>
Need to manage a table that has ~20k rows and a variable number of variable-width columns, to which rows might be added or deleted at any time. Needs to work on modestly resourced systems like mobile browsers. What do?
>inb4 install gentoo
Not an option, sadly.

>>61893951
Knockout masterrace reporting in
but I don't know if I'd try to use it for the above
>>
I have a few sites I've programmed but never deployed, and now I'm trying to put up a portfolio together. I don't want to pay a separate domain name for each one of them. Is it ok to do just 1 site with my name on it, and stick all the websites in there? Like this:

>www.mypersonalsite.com/site1
>www.mypersonalsite.com/site2
>www.mypersonalsite.com/site3
etc
>>
>>61896663
For a portfolio, that's fine.
>>
>>61896663
Its okay, but sub domains look nicer imo.

site1.domain.com
site2.domain.com
etc

You can do this easily in cPanel, or if you are doing apache/ngix look at "Digital Ocean Virtual Host for x"
>>
how to sanitize input in laravel server side?
text - letters and spaces only
email - must be valid email
>>
>>61893904

Wait... so the order of the data-bind matters?
>>
>>61893482
Function.bind takes a this parameter followed by partial parameters to prepend when the resulting function is called.
var fun = function(a, b) {
console.log(a, b);
}
var bound = fun.bind(document, "blah")
bound("data", "index")

calls
fun("blah","data","index")

with this equal to document.
Lose the .bind call or just do
data-bind="click: $parent.navBtnToggle"
>>
How would I create a dynamic webpage that can go through pictures without reloading the whole page on each next like Facebook photo viewer
>>
File: 1405762493945.png (248KB, 555x546px) Image search: [Google]
1405762493945.png
248KB, 555x546px
>want to get started with ecommerce
>only jobs are for wordpress
>>
Is there a way to store a setInterval() function not to call immediately but to call later on?
>>
>>61897912
setinterval always waits for the time specified to pass first.
If you want it to start even later just put it in another setTimeout() ?
>>
>>61897140
>>61897140
>>61897140

I'm using a function because I want to make a toggle switch using knockoutJS similar to.this jsfiddle.

HTML
<button data-bind="event:{click:UpdateColor}">Update Color</buttom>
<div data-bind="style:{background:selectedColor}, text:selectedColor"></div>


JS
var color = ["Grey", "White"];

var data = [];
data.remainder = ko.observable(0)
data.selectedColor = ko.observable(color[0]);

data.UpdateColor = function(){
data.remainder((data.remainder()+1)%2);
data.selectedColor(color[data.remainder()]);
}
ko.applyBindings(data);


I'm trying to make a group of buttons though, but I have no idea how to change the observableArray once it's been set :\

this.markerType = ko.observableArray([
{ name: 'foo1', tglStatus: 0},
{ name: 'foo2', tglStatus: 0},
{ name: 'foo3', tglStatus: 0},
{ name: 'foo4', tglStatus: 0},
{ name: 'foo5', tglStatus: 0}
]);

this.navbtnToggle = function(data, index){
this.remainder((this.remainder() + 1) % 2);
this.selectedColor(onoff[this.remainder()]);

console.log(index, data);
};
>>
>>61847538
how long till they call you after u apply CV?
i'm getting worried
>>
>>61898106
>>61898106
Thread posts: 312
Thread images: 36


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

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


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