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

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

Thread replies: 255
Thread images: 24
File: wdg.png (4 MB, 2235x1500) Image search: [Google]
wdg.png
4 MB, 2235x1500
>IRC Channel
#/g/wdg @ irc.rizon.net
Web client: https://www.rizon.net/chat

>Learning material
https://www.codecademy.com/
https://www.bento.io/
https://programming-motherfucker.com/
https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md
https://www.theodinproject.com/

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

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

>Useful tools
https://pastebin.com/q5nB1Npt/
https://libraries.io/ - Discover new open source libraries, modules and frameworks and keep track of ones you depend upon.

>NEET guide to web dev employment
https://pastebin.com/4YeJAUbT/
>>
var grounds = [
{lat:51.481663,lng:-0.1909565},
{lat:50.905824,lng:-1.3909358},
{lat:53.4831413,lng:-2.202584},
{lat:53.7778194,lng:-1.5743333},
{lat:52.9882676,lng:-2.177653}
];

var markers = [];
var map;

function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 6,
center: {lat: 52.4559389,lng:0.700765}
});
}

function addMarkerWithTimeout(position, timeout) {
window.setTimeout(function() {
markers.push(new google.maps.Marker({
position: position,
map: map,
animation: google.maps.Animation.DROP
}));
}, timeout);
}

function drop() {
for (var i = 0; i < grounds.length; i++) {
addMarkerWithTimeout(grounds[i], i * 200);
}
}

google.maps.event.addDomListener(window,'load', initMap, drop());


The above code loads the map onload but doesn't load the drop function. it doesn't load even when i put it outside of the google maps function.
>>
>>51667162
I don't think addDomListener works how you think it works.
look at its documentation.

besides, you'd execute drop() and add its return value to the listener.

try with
google.maps.event.addDomListener(window,'load', function() {
initMap();
drop();
});
>>
I asked this in /sqt/ (>>51666359) but now that someone made /wdg/ maybe it's better place to ask:

Why does executing
document.body.style.filter = 'grayscale(100%)';
on facebook's landing page (as well as on some other sites) make the whole page completely white?
I'm wondering why the page responds like this.
>>
>>51667576
interesting.
seems like a bug.
>>
>>51667795
I guess so. I made a Greasemonkey script and noticed some websites didn't load properly and tracked it down to that line.

Setting a filter to any other element other than body or the wrapper div works as expected.
>>
>>51667464
Thanks anon
>>
Is backbone dead? also, what's the most popular framework to work with java in backend?
>>
>>51668095
>most popular framework to work with java in backend
Spring
>>
>>51668112
Thanks, anon.
>>
>>51668146
You're welcome. If you're just building a REST api, Spring Boot will save you a lot of headache.
>>
>>51668095

Express
>>
File: yung_leany.jpg (58 KB, 500x667) Image search: [Google]
yung_leany.jpg
58 KB, 500x667
Sup anons
can someone recommend me a good way(provider or something) to start a vagrant dev env to develop some php on windows?
>>
What makes a web project manager good or shitty?
Anything you appreciate or hate?
>>
>>51669287
scallability
>>
>>51669185
Just install latest debian/ubuntu server dist and install apache php.

Or get XAMPP if you don't need other dependencies.
>>
>>51669401
Does everything has to be scalable?
>>
>>51669287
>web project manager
What the hell is this?
>>
>>51669477
A project manager for projects related to websites.
>>
>>51669496
So someone to take shit from customers? That's good then since it lets developers develop.
>>
How the fuck do you make stuff change when you scroll down?
$(document).ready(function(){

var scrollBottom = $(document).height() - $(window).height() - $(window).scrollTop();

switch(scrollBottom > 0){
case scrollBottom > 10:
$('body').css("background", "linear-gradient(to right, #000 50%, #fff 50%)");
continue;
case scrollBottom >50:
$('body').css("background", "linear-gradient(to right, #ffddaa 50%, #a21212 50%");
break;

}
});
>>
Because it's a pixel filter. It applies the effect on the pixels contained by the element. So all the children will get the effect too. Greyscale 100% is white Greyscale 0% is black.
>>
>>51669765
https://api.jquery.com/scroll/
>>
>>51669765
http://codepen.io/anon/pen/wMvBzG?editors=101
Like this?
>>
>>51669439
a manager has to be.
If you can only use it to make small things, you do not have very good system.
>>
>>51669813
But grayscale(<anything including 0%>) is also white. Strange.
>>
>>51667899
>>51667576
Unprefixed filter implementation is still sketchy, as far as I know. That's why prefixed filters are still largely used.

It might be that. In which browser does this happen? In one, in most, in all? Version?
>>
>>51670574
I've tested this in current version firefox.
It's not exclusive to grayscale either, any filter effects seems to do the same.
I've read somewhere it happens when an element has overflow set to hidden, though I couldn't reproduce that.
>>
>>51670605
Hm, yeah, you're right. Seems to be from something on Facebook's end.

If you try the same thing on other sites it works.

Also, if you try in other browsers, it works. This works in Chrome on the Facebook landing page:
document.body.style.webkitFilter = 'grayscale(100%)';
>>
>>51670574
I tried it in only in Firefox. For some reason with prefix it doesn't work at all.

>>51670605
That's an interesting theory. On facebook wall, it converts the page to grayscale, but as soon as new content is loaded, the whole page turns white, until you scroll back to the top.

>>51670849
Thanks. So it was firefox + facebook combo.
>>
>>51669910
>>51670328
Thanks for the help guys, much appreciated.
>>
Jesus fuck I hate ansible so much.
I want to write python, not fucking yaml.
>>
>>51670944
Lots of funny shit on the Facebook page. In Firefox it displays this in the console:
                                           
.d8888b. 888 888
d88P Y88b 888 888
Y88b. 888 888 This is a browser feature intended for
"Y888b. 888888 .d88b. 88888b. 888 developers. If someone told you to copy-paste
"Y88b. 888 d88""88b 888 "88b 888 something here to enable a Facebook feature
"888 888 888 888 888 888 Y8P or "hack" someone's account, it is a
Y88b d88P Y88b. Y88..88P 888 d88P scam and will give them access to your
"Y8888P" "Y888 "Y88P" 88888P" 888 Facebook account.
888
888
888

Not sure the formatting will display right. You can check it out in the console in Firefox, though.
>>
>>51671129
lol.
Turning Facebook into what's essentially a blank page might not be a bad idea. I'll pretend my script does that on purpose.
>>
>>51671024
Use fabric

Ansible runner module is pretty shit so far (cant access and run playbooks programmatically)
>>
who here:
>no school
>self-taught
?
>>
>>51671323
All the companies I've talked to/tried to get hired at use Ansible, or Chef, or Puppet. I got sneered at for using Fabric. Fuckers.

It is missing the wealth of modules that Ansible/Salt has. Wish I could easily spin up servers from Fabric but I'd have to write it myself and I want to focus on the app, not sysadmin shit.
>>
>>51671615
I finished High School and did some "college/university". But social anxiety won.
Keep studying, unless you have your own Facebook.
>>
>>51671615
Self-taught & Last year of CS here.
>>
Why is having a reverse proxy a good thing? I don't understand all this modern web serving shit.
>>
Can someone tell me how to make PNGs with transparent backgrounds look better in IE?
Also, the fonts I'm using look great in FF and Chrome, I switch to IE and they look like low resolution shit - same problems with PNGs essentially. I don't understand.
>>
>>51671821
Load balancer is an example of a reverse proxy, or a web accelerator like Varnish.

Do you understand why those are good?
>>
File: Capture.png (104 KB, 1299x131) Image search: [Google]
Capture.png
104 KB, 1299x131
>>51671824

IE is on the left, Chrome is on the right.
>>
>>51671900
I understand they allow a site to handle more users/load but not much more than that

Also aren't load balancers a different i.e. distinct thing?
>>
>>51671734
>I finished High School and did some "college/university". But social anxiety won.
literally me, the post

>Keep studying, unless you have your own Facebook.
trying to build my own facebook. starving and broke in the process

>>51671814
>Self-taught & Last year of CS here.
self taught myself as well.
of course CS will help you get jobs, but has it actually helped you with web dev?
>>
>>51672137

Not that guy, but I'm a CIS final year and I've done two courses so far dedicated to web design & development. It helps, and it'll look damn good on a resume.
>>
Current web dev looking to go back to college, the school (UCI) offers CompSci, Software Engineering, and Informatics. Any advice on which would be best for advancing in web dev?
>>
>>51672137
Every employer asks for a CS degree even for something like this in my country, so there's that.

>but has it actually helped you with web dev?
Not much desu. I took a Web Development class this year but it was kinda rushed since there's too much to handle(We were taught the basics of http, frontend and backend with rails). I also took 3 networking classes but networking isn't really valued here.

>>51672367
Comp. Sci isn't exactly about programming, expect lots of math. I'd say Software Engineering.
>>
>>51672473
Which country?
>>
>>51672512
Colombia, a shithole.
>>
File: web_scale.jpg (10 KB, 480x360) Image search: [Google]
web_scale.jpg
10 KB, 480x360
>>51672046
No, they're not different. So there's the overarching idea of a reverse proxy.

Client comes in, reaches reverse proxy, reverse proxy might modify the request, reverse proxy then sends the request to app servers, takes their response, maybe modifies it, and hands the response back to client.

Load balancers/web accelerators are two kinds of reverse proxies. There's also SSL terminator proxies, for example. There's more but i can't be fucked to look it up.

So for a load balancer, it splits up the requests among a bunch of different app servers. The client doesn't know there's 10 different app servers, but the load balancer does, and so it can do shit like stop sending requests to failed app servers or scale up and start new app servers and spread the load.

For the web accelerator, it can help by say caching unchanged content and sending it back without talking to the app servers. SSL accelerator, all it does is SSL and passing along the now HTTP request and vice versa and nothing else, so it can be HW accelerated or just optimized for SSL.

This can all get real complex fast, but are you starting to understand why it's a good thing?


Mind you, you actually need real Web ScaleTM user numbers to make this anything but wanking around. Any site most people make can probably do just fine on some cheapass VM with apache/nginx.
>>
Well I got my first job offer as a full stack engineer today. I'm fucking terrified please help.
>>
>>51672862
what pay?
>>
>>51672576
I'm a front end dev, but I worked on a very large site once that had a few servers sitting behind a load balancer, if the traffic reached a certain amount then the servers would automatically spin up new instances of themselves and that sort of thing, it's not something I know a lot about but I find it fascinating, I can't remember how many views we got on the first weekend but it was over 10,000 people on the site at any one time at times (and this was a wordpress site, I kid you not...Varnish goes a long way)
>>
>>51672862
Why are you terrified?
>>
>>51672862
>full stack engineer

Oh you fancy. Good luck.
>>
How do you track clicks on your site? Say I have a banner that rotates images. Is it weird to use campaign parameters on this? I want to be able to measure how many clicks came from my banner image links vs my menu links vs say a smaller image link
>>
How much traffic can I expect to handle on a $5 digital ocean server?
>>
>>51673457
Serving up what?
Static pages?
Basic dynamic pages with caching and CDN?
Shittily coded dynamic pages full of N+1 queries?
Video encoding?

In short, it depends.
>>
What language to use in the backend? I tried JavaScript but that wasn't really for me.

I know some PHP but people keep saying it's shit, and I don't know if it's a good idea.
>>
>>51674165

For what purpose?
>>
>>51674165
PHP is shit.

Try Python or Ruby if you don't know any better.
>>
File: nth-child.png (278 KB, 760x461) Image search: [Google]
nth-child.png
278 KB, 760x461
>when you get a selector right the first time and it's using that weird-ass 'nth-child()' syntax
i'm not sure if i should be proud of myself
I'm kinda weirded out by having memorized this weird-ass syntax
>>
>>51674165
a year ago i tried javascript backend
got mysql wrapper working
stopped
tried php
thought it was great
almost finished writing an app in php, rewrote it all in js in a day
im not going back
[spoiler]i love php's echo and $_session though, and their for ... in support is greatr
>>
>>51674203
Web dev, of course
>>51674220
What are the tl;dr pros and cons of each?
>>51674257
So why did you drop it in the first place?
>>
>>51674165
PHP works and has an overwhelming market share. There are a lot of haters for some reason, but be careful what you listen to. I find it a bit too cumbersome for large scale projects, but it's pretty much been the default backend for 20 years. Python and Node on the other hand are focused primarily at something called "app deployment". The people who use Ruby seem to like it, but it's niche to the point where no-one really cares much about it.

So basically yeah, any of those might do what you want. They are all different ways of doing the exact same shit.
>>
>>51674316
What's this app deployment stuff?
>>
File: jquerydontlikelessthansymbols.png (214 KB, 1494x252) Image search: [Google]
jquerydontlikelessthansymbols.png
214 KB, 1494x252
Ah looks like jquery don't need those > symbols.
>>
>>51674344
They are just buzzwords that mean nothing. Either that or it's about those shit mobile oriented sites that take forever to load then don't work properly.
>>
>>51674316
>There are a lot of haters for some reason
Because PHP is a fractal of bad design.

You can make it fly. You can make a pig fly by shoving a rocket up its ass. It's fucking terrible.

The upside to it is it's easy as fuck to do something with it, so there's lots of morons who know how to do something with it, so finding replacement programmers is easy.

>>51674274
I use Python, but it's a matter of taste, really. Just try both out and see which one works for you. The major frameworks are Django for Python, Ruby on Rails for Ruby.
>>
>>51674274
javascript is a superior language to use, it just don't have server-side tools built in.

After taking a javascript class for a more thorough background in the language, we went over some basic node.js servers and I realized that my two favorite PHP features aren't needed if I use jquery well.

my favorite two features of php:
1. the ability to mix my php into my html document.
[spoiler]turns out this is a no-no, you're not supposed to mix your data/controller and your views, no matter what programming task you're doing. learned this after making a gui in openGL w/ c++. Turns out, javascript allows you to "echo" things into the document easily, but you need something: a knowledge of how to select things from the dom, and god damn is jquery good for that. once you have a way to hook into the dom (like by selecting an element), you can manipulate it in any way using javascript in a <script > tag. Also, turns out it's better to keep your logic and view seperate - I was rewriting PHP every time my front end guy changed something. Now I just have one
<script src = "" \>
tag @ end of document and I don't even need 2 change it. just slap id's on things for selection and you don't even need to do that thanks to the
nth-child()
usage[/spoiler]

2. the
$_SESSION
variable. turns out you can make your own and it's really fucking easy thanks to Javascript's support for clojure variables. Clojure variables remember their values even if you leave their scope - they're kinda like static variables in C
>>
>>51674434
I thought JavaScript was too messy and confusiong, but I'll give it another chance.
>>
I can't even figure out how to install Django by reading the quick install guide. Fuck me sideways.
>>
>>51674495
It's actually delightful to use. If you formed that opinion I have to wonder how much time you actually invested into learning Javascript. Really we should be talking about Ecmascript; there are so many features that make it great:
Objects and functions can be passed around like variables
The language supports clojures
Probably the biggest community / code base out there (there's always an answer to your question)
Thus, shitloads of libraries just waiting for you to try them
Unlike C, you can easily make a key/value hash - it's as simple as saying
somevariable["some key"]
don't like that notation? there's also
somevariable.somekey
and
somevariable[someothervariable]

function hoisting...
prototypical inheritance
want to add a method or value to an object, but didn't do it in the object's definition? It's as easy as saying
existingobject.newkey = literally_anything
>>
>>51674531
eventually when i go to learn python, I'm going to do it with a how2blackhat book
>>
File: workit.png (690 KB, 1924x1080) Image search: [Google]
workit.png
690 KB, 1924x1080
i love linux
doesn't even complain about how shitty my server is
just does everything like a champ
>>
>>51674618
That's mint right?
>>
>>51669765
You use code that doesn't have cancer
>>
>>51674577
I didn't invest much time, but it does sounds good in theory. My only experience with JS is fucking around on the frontend, and trying node for a couple of hours.
>>
I just got a job as a java backend developer. I don't know shit about java what do I do.
>>
>>51674675
Kill yourself and hope to be born in India on your next life
>>
>>51674531
You should probably just give up then. The world of web dev is not for you if you can't figure out something that simple.

>>51674675
Hire Rajeesh to do your job for you. You get paid 1st world wages, Rajeesh gets paid 3rd world wages, everyone benefits.
>>
>>51674705
I don't want to poo in the streets

>>51674706
How much is it? I get paid a lot.
>>
>>51674725
Don't worry, you can do it in the loo
>>
>>51674675
Just look for some tutorial series in youtube. Java is not even difficult to understand
>>
>>51674763
But the streets are the loo in India
>>
>>51674643
Yeah. I'm thinking about trying a different distro though, I think I've got spyware
>>
>>51674773
rofl you can't get spyware on linux
>>
>>51674765
I"m more lost on what java stacks to expect. I have no experience working with any real java projects. Java the language is easy though.
>>
>>51674434
>1. the ability to mix my php into my html document.
>[spoiler]
I really don't see a way around this in any language. How the fuck else are you supposed to output a for loop etc?
>>
>>51674773
>I think I've got spyware
What makes you think that?

Also, try Xubuntu, it's the best version of Ubuntu and about as easy to use as Mint.
>>
>>51674788
Well then, what >>51674706 said, look for Rajeesh.
>>
>>51674675
>>51674788
How the fuck did you get hired?

>>51674804
Proper web stacks use templates to separate code and HTML. You pass the template and some context to the template engine, and it generates the HTML, so that handles say looping through a list of objects and generating some HTML for each.
>>
>>51674839
>How the fuck did you get hired?
Because I'm smart. And they're paying me 6 figs too haha
>>
>>51674839
>Proper web stacks use templates to separate code and HTML
Thats still embedding code in the html. You still have to call the function that prints the template. Its just hiding it in a different file.
>>
File: 1446705726407.gif (1 MB, 500x281) Image search: [Google]
1446705726407.gif
1 MB, 500x281
What can I work on to showcase my skills? I feel like my resume is lacking.
>>
>>51674863
We're going to disagree about this, I can tell.
>>
>>51674804
>>51674839
Don't use backend languages for anything except transporting data. Backend rendering is only a good idea for heavy sites with few users, light sites or sites with a lot of users should front end render.

I see web programming as naturally following MV*
HTML/CSS is your view
JavaScript is the viewmodel or controller
Your backend handles the data/business model

Transport the data to JavaScript using Ajax, use pre/append/html replace functions to load the data into the HTML, use the HTML itself as templates. If you must, use the hidden attribute to create templates and load them into JavaScript (either using jQuery or using the boilerplate document.getelementid whatever).

Mixing backend and you presentation code is one of the worst things about php, namely that it promotes this clear breakage of MV*.
>>
>>51674900
Website

Implement your own http server, benchmark it, and call yourself a full stack, tell them to shut up when they ask you what full stack means and if you've contributed to the Linux kernel.
>>
If I learn django, do I need to know (besides python) any other languages like html, css, or javascript to be able to make a complete website, or can I do everything with just django?
>>
>>51675245
makeWebsite()
>>
>>51675094
How do you handle page reloads? Most states in a website or page should be restored when pressing f5.
PHP and other web languages have templating libraries available.
>>
>>51675245
See >>51675094
You still need HTML and JavaScript, CSS too unless you want very messy HTML code.


>>51675348
Local storage.
>>
>>51675471
I mean, the user, or google, requests /modules/page/34.
What should be the proper response from the http server?
>>
>>51674675
start by going to the proper general, this is web development general. you're looking for the daily programming thread you damn biscuit
>>
My problem with doing things on the front end is that it makes it easier for people to steal your work
>>
>>51675514
Either 304 or a 200 with the information?

I found my backend is kind of unique in that it's the only one that even tries to cache.
>>
>>51675553
You said before that Javascript should be in charge of rendering the page.
If not, who is generating said information?
>>
>>51675577
Well the database or backend. The actual way it's presented (colours, position, div ids etc) should be handled by JavaScript. What's actually in that, like names, numbers and posts, should come from the database.

>If not, who is generating said information?
With all due respect sir, lolwut?

By the original user who sent the post? By the backend programmer at compile time? It's not a clear simple answer, you're looking for something that doesn't exist.

Basically I'm 501ing you, this shit isn't implemented.
>>
>>51675661
Can I still use backend languages to render common websites, with some javascript for interactive parts? :^)
>>
>>51675690
But why? Your static webserver (nginx or apache) probably does that for you faster. And what are you even using your backend for?

The idea is simple: don't mix presentation code with data handling code. That's all. You are now a MV* master.
>>
>>51675745
Things like multi-language support, message boards, pagination, websites with tons of content, etc... make caching difficult.
You can still use MVC in the backend.

SPAs are fine for several types of applications, but you may eventually run into problems due to a restrictive model.
>>
Guys, could someone tell me why should one pick spring hateoas instead of spring rest? I' m learning web services. Btw, if someone could give me a good and complete tutorial (like making a real world project) for spring rest, that'd be awesome.
>>
>>51671824
Stop supporting IE.
>>
>>51675245
You absolutely need to know HTML, but HTML is not a programming language, it's a markup language. CSS is not a programming language either, and if you use pre-existing designs like Bootstrap or Foundation you don't need to learn that much about CSS until later.

And you can usually ab(use) jQuery enough to do most webby things you'll want to do with a little googling.
>>
>>51674577
why ecma and not coffee
>>
>>51677057
Because Ecmascript is the standard. Who the hell uses Coffee right now? You're learning ES6/ES7 right?
>>
>>51668095
Not dead at all. Very nice for buildings performant application around their infrastructure. It is a solid lightweight solution, but no longer hip enough for the framework memers.
>>
>>51678565
It is nice to now senpai, I was looking to learn it sometime soon.
>>
>>51678801
know* im a retard
>>
What does Django do?
[spoiler]Asking because chrome mobile is fucking broken right now and no other computer access at the moment[/spoiler]
>>
https://awesomelists.me/#/ - Basically the list in the OP with a better format.
>>
>>51675745
>And what are you even using your backend for?
For getting entries out of the database?
>>
What's an appropriate price for a "PSD to HTML" kind of job- 3-4 pages, responsive, some minor AJAX to submit a form, potentially quite a few revisions?

>inb4 hourly rate
I know, but I hate timetracking and find myself happier giving a fixed project fee.
>>
>>51680377
figure out your daily rate

guess how many days it will take you

quote them that

£250 a day for 5 days, so £1250
>>
>>51679185
Bigger Flask
>>
Quick question.

I have 3 a elements and I want to use the "this" attribute in the function but if I write functionName(this) as the object property I'm calling that function, so I decided to use anon functions.
Why does this return MouseEvent and not the a element?
http://hastebin.com/ekisufumaj.coffee
system thinks my post is spam so I uploaded the code here.
>>
What are some good sources on the subject of code reusability with javascript?
>>
How do you guys test sites for responsiveness for older devices?

I tested one page in the Chrome emulator and it worked right. It also worked right on all major desktop browsers (IE9+).

But when I actually tested on someone's LG with Android 4.1.1 (so older Android), the site was completely broke. It worked from 4.4+ onwards, of course, but it turns out there are many people out there who are not aware you can or you should upgrade your old piece of crap phone. So, eventually they're going to see your site in a broken form.

It seems that sites like caniuse or mozzila's site are not good indicators on whether you can use some CSS or JS features, especially for older Android versions.

The only real test is to actually have a bunch of devices with many types of viewports and OS versions and just do the test literally physically. I haven't seen any good emulator. It seems testing simply based on user agent can be deceiving.
>>
>>51682690
Honestly, what I do is make sure it works on the latest stuff first, then I will post it on something like Reddit (hurr), and then see the response. If someone with an older device or browser finds inconsistencies/errors, I'll ask what their device is and modify accordingly.

Pretty much, just don't worry about EVERY little device, because it would be the biggest pain in the ass to accommodate for everything. As long as you have the modern stuff working, and some of the older stuff that has a high market value (old version of IE), then you will be fine.

If there is some kid down the road with a shitty LG phone that hasn't updated in years, don't worry too much about it, because odds are it won't affect a lot of people.

Also, mobile first is always good to do, but like I said, some phone will be inconsistent
>>
Django + Python is so much easier to use than Laravel + PHP.
>>
I want to start up a business from home, and do web shit, at the same time, I want to generate invoices, I know there are some free tools I can use like simpleinvoices, but what would be the easy way to get word out?
>>
>>51683080
By 'get the word out', do you mean 'find clients'?

That's hard. I'm self-employed and finding clients is a fucking pain. Online you have to compete with streets shitters willing to work for rupees. My suggestion is find local small businesses who need work. Work your friends and family to find one, make him happy, then use him as a springboard to find others.

And don't be afraid to charge what you're worth and fire shitty clients.
>>
>>51683169
I just want to get shit straight and have the necessary things i need, even at amateur level, I want to set up things on paper and generate invoices and if as you said I get a shitty client, I'll just show him the door.
>>
File: 1442705420330.gif (4 MB, 512x384) Image search: [Google]
1442705420330.gif
4 MB, 512x384
Master student here. Thinking of starting my own one-men-company while studying. UI and Web-Dev. Anyone with experience? My fear is that I won't get any costumers because I'm still a "student" and there are many companies doing that stuff. From Germany btw.
>>
Recommend a simple app i can create /wdg/. I'll be using sinatra
>>
>>51684714
grocery list
>>
>>51683243
If you have decent social skills and can go hunting for jobs then go for it, don't expect them to come to you until you're well-known.
>>
>>51684714
>Sinatra
Huh, Flask-style Ruby web framework. Didn't even know there were Ruby web frameworks other than RoR.

A to-do list, because every fucking framework probably has a to-do list somewhere, so you can find another and compare it with yours.
>>
>>51683243

I'm a student (final year) as well. I'd be willing to help you get started and work with you (for free) so I can have something to use as reference for work experience or a personal portfolio.
If you're interested let me know.
>>
I am new.

If you use javascript to change the value of an html element why doesn't the change show up when you view source but it shows up in the browser?
>>
>>51685695
Because view-source is mostly what you got from the server, use inspect if you want the current state of the DOM.
>>
>>51685695

JS is runtime. The html is modified by JS as soon as the page is loaded, but it otherwise remains the same.
>>
>>51685732
Thanks my big nig.
>>
I'm quitting my job and going freelance soon, but I have no idea how to find clients. Any help?
>>
I have some problems with multiple databases in Flask-SQLAlchemy.

Tried to ask on Stack Overflow, here:
>http://stackoverflow.com/questions/34095875/flask-sqlalchemy-multiple-databases-creation

I'd like to use multiple databases, but I'm seriously thinking about switching to a single database and maybe later scale up

Wat do, /g/?
>>
What exactly are DataMapper and ActiveRecord and what are the differences between them?
>>
>>51686034
Sure! Find your local foodbank sooner rather than later.

Collect old newspaper to stay warm.

Sometimes it's shank or be shanked, so keep something handy.

And just remember, even when you're really hungry, make your new clients wear a condom.
>>
>>51686416
It's not a permanent thing, it's just temporary while I find something else.
>>
>>51686050
Jesus fuck dude use a single database
That's what tables are for
>>
>>51686197
They're two kinds of ORMs, and the difference is, who's responsible for interacting with the db.

ActiveRecord - the object's responsible.
Blog.save()

RecordMapper - an entity manager's responsible
Mapper.save(Blog)
>>
>>51686588
I'm concerned about performances, that's all
>>
Is Python web hosting any more expensive than PHP? I assume it will be considering PHP is the standard.
>>
>>51686969
1) Your shitty app doesn't need to worry about performance.

2) Multiple databases are going to *slow* down performance any time you have to join data between them.

3) Use tables you stupid fuck, the database is smart enough to optimize its performance without you trying to be clever. You are getting in its way.

4) Don't use sqlite you stupid fuck.

5) If your shitty app ever has to worry about performance you can pay someone who's not a stupid fuck to improve it. It is unlikely that multiple databases will be his solution.
>>
>>51687195
You'll have less choices if you want shared or managed hosting, but you could just buy a VPS for pocket change and host whatever you want.
>>
>>51687294
not that anon but what's wrong with sqlite? Why is it only meant for development?
>>
>>51687298

From what I've seen, the average cost of a VPS is around $25. That is too expensive for me right now (in college, don't have a job).
Mochahost has Python hosting for $4 a month. Makes me wanna just write my own website in PHP and be done with it.
>>
>>51687294
Thanks dude, really, thanks!
>kek

Jokes aside, I intend to use sqlite only in development process, I'm setting up a light database just to test functionalities.

I'll move to MySQL in testing and releasing
>>
>>51687525
Digital Ocean doesn't suck and has $5/month VMs on SSDs.
>>
>>51687525
$25/month, what?

https://www.scaleway.com/
Here's a dedicated with 2GB RAM and good enough processor for €3/month. I have one of these and it performs well.
>>
>>51687525
If you're in college you can get the Github student pack w/ 50 dollar for Digital Ocean. With Azure you can host .NET webapps for free.
>>
>>51687658
Bro, those are ARM machines.
>>
>>51687729
Are you saying Python doesn't work on ARM?
>>
File: killme2.png (70 KB, 445x764) Image search: [Google]
killme2.png
70 KB, 445x764
I have a page that generates a different amount of a hrefs in a list. When you click on a link, javascript needs to be called to expand a div, and make another div visible inside the expanded div. This needs to be toggleable. Each link needs to send a parameter to the javascript function so it can identify which div to toggle. That is the part i cant figure out.

I have made it work but in a terrible way that makes no sense. I have hard coded like 30 of the exact same methods, each calling its own div. How do i simply send a parameter to one function that can do the work? I have tried make a function but the toggle wont work, it just expands once and wont close when i click on it again.

TLDR: Im terrible plz halp
>>
>>51687755
I'm sure they're okay for toys, but in that case you might as well test it on your virtualbox machines.
What kind of sorting, querying, etc. performance would you get on those vs a normal x86 VPS?
>>
>>51687781
Oh wow. Can't you use this or something to refer to the thing you just clicked?

$(".toggleListRow").toggle(function() {
$(this).find('listRowToggle').animate
$(this).find('listRowContent').animate

Or go find a toggle jQuery library to do this shit for you.
>>
>>51687921
Welp, fucked that up and forgot the class '.'
$(this).find('.listRowToggle').animate

So it finds the descendants of this that match a specific class, and animates them or whatever.
>>
>>51687781
You can use the "data-" attribute on links, but it's hard to say if this is the best option, post the HTML layout, otherwise you can probably locate them in the immediate tree.
<a href="#" data-whatever="hello">Bla</a>

$('a').on('click', function(e) {
alert($(this).data('whatever')); // hello
});


>>51687833
I'm pretty sure you could host cacheable production sites on these machines, the issue is with disk IO since they're on the network.

This has some stats (thinks it's spam)
amon DOT cx/blog/scaleway-vs-digitalocean-and-deploying-webapps-on-arm/

They're good for testing things and keeping them available.
>>
>>51687781
var $rows = $(".toggleListRow-0, .toggleListRow-1, etc...");

$rows.toggle(function() {
$(this).animate({height:230},100);
$(this).css();
}, function() {
$(this).css();
$(this).animate();
})

>>
Why do I feel so bad using jquery? It has nothing to do with javascript, just I always thought that a page should not need javascript to function.
>>
>>51688087
because of people doing it like this >>51687781
>>
>>51677128
i just know basic javascript. don't use any of those compilers yet
>>
>>51688121
Hate the player not the game
>>
>>51688030
why are you calling css and animate without any parameters?
>>
>>51688030
This doesn't work. You fucked up.

>>51688186
CoffeeScript is transpiled to JavaScript, not compiled. ES6/7 are versions of JavaScript. Big difference.
>>
>>51687961
>amon DOT cx/blog/scaleway-vs-digitalocean-and-deploying-webapps-on-arm/

The comments are more interesting than the article, t-b-h.

It seems like the guy screwed up his benchmarks.
>>
File: mensa club.jpg (111 KB, 1280x720) Image search: [Google]
mensa club.jpg
111 KB, 1280x720
>>
File: MyExperienceWithJavaScript.png (91 KB, 335x460) Image search: [Google]
MyExperienceWithJavaScript.png
91 KB, 335x460
I'm currently in a class where I need to make a simple countdown to new years. It doesn't even need to tick, it just needs to load up when you open the webpage. I src'd the provided script, set the variables in the HTML page, and I am trying to have it write out a string but I'm starting to suspect I'm missing a painfully obvious step because when I go to open the page, the place the time should be at is fucking blank.
>>
>>51688982
my magic glass ball tells me you are setting text before the element exists.

post some fucking code.
>>
>>51688982
Use my new startup, countit.io
just do a json call to http://countit.io/2016/1/1/midnight and append the result inside a div

Dev accounts free, $10/month for SSL, GitHub integration, and monitoring

You're welcome bro.
>>
>>51688996
I'm woefully new to /g/ and don't know how you guys do it yet. Though I am thankful you at least seem interested.
>>
>>51689044
>actually thought you were serious for a second
This is what the world has come to.
>>
>>51689065
You forgot the
>post some fucking code
put in inside [ code] [ /code] tags.
>>
>>51689065
pastebin, jsfiddle, [ code ] tags (without the spaces), anything.
if you have a problem with something and you don't show your problem then no one can help you.
>>
>>51689044

Pls go
>>
>>51687961
Holy crap that worked wonders. I had no idea about the existence of the data attribute. That makes so many things way simpler. Thanks!
>>
>>51689085
Still not as good as https://devnull-as-a-service.com/code/
>>
>>51689097
Ah, that's what I didn't know how to do. Basically I have the header which is all the usual stuff with the inclusion of:
<script src="library.js" type="text/javascript"></script>

Then in the body I have:
<script type="text/javascript">
var Today=new Date();
var ThisDay=Today.getDate();
var ThisMonth.Today.getMonth();
var ThisYear=Today.getFullYear();
var DaysLeft=NYEDays(Today);
var MonthTxt = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "Novemeber", "December");
<!-- Add date output statement -->
document.write("Today is " + MonthTxt[ThisMonth] + " " + ThisDay ", " + ThisYear + "<br />");
</script>


If this doesn't submit right, I'll likely delete the post out of autism and shame.
>>
>>51689164

>
var ThisMonth.Today.getMonth();


wat
>>
>>51689164
I am saddened to see they teach you outdated javascript and don't even introduce you to the development tools first.

Press F12 in any (modern) browser and development tools pop up, where you should spot your mistakes immediately.

here's a more in-depth guide for chrome
https://developer.chrome.com/devtools
>>
>>51689164
lrn2check yr browser console
>>
>>51689210
Fixed it. I'm retarded. Though apparently changing that didn't make it display the message. I'd feel more embarrassed and leave, but at this point I don't have much in the way of dignity.
>>
>>51689250
The professor outright admitted it was outdated too. I just want to get this code working the way it's outlined though so I can actually try and understand how this stuff works.
>>
>>51689281
post library.js
>>
>>51689261
Honestly, I don't blame you, I blame your teachers.

>>51689292
Yes, please, I want to laugh/weep.
>>
>>51689292
>>51689301

<!--Making me feel real self conscious posting this-->
function NYEDays(CheckDay) {
var XYear=CheckDay.getFullYear();
var XDay=new Date("December, 31, 2015");
XDay.setFullYear(XYear);
var DayCount=(XDay-CheckDay)/(1000*60*60*24);
DayCount=Math.round(DayCount);
return DayCount;
}
>>
>>51689164
you are missing a + next to "ThisDay" in your document write.

The browser tells you, look at its console.
>>
>>51689164
That's some weird ass code anyway.

var newYears = Date.parse('2015-12-31T23:59:59Z') / 1000;
var now = Date.now() / 1000;
var delta = newYears - now;

var days = Math.floor(delta / 86400);
var hours = Math.floor(delta / 3600) % 24;
var minutes = Math.floor(delta / 60) % 60;
var seconds = Math.floor(delta % 60);

console.log("Days", days, "Hours", hours, "Minutes", minutes, "Seconds", seconds);
>>
>>51689362
...FUCK. NOW IT WORKS. I WASTED AN EMBARRASSINGLY LARGE AMOUNT OF TIME OVERLOOKING THAT STUPID FUCKING +.
>>
>>51689408

Happens to the best of us.
>>
File: 1447571930468.png (79 KB, 327x390) Image search: [Google]
1447571930468.png
79 KB, 327x390
I'm sorry to bother but I'm having trouble with JS's DOM.

http://hastebin.com/umolicuxey.coffee

I want to select the <p>s ontop of <a> but I'm getting undefined. Any idea why? They are definetly on the same level.Thanks!
>>
>>51689421
I owe one of you my first born.
>>
>>51689408
I'm going to blow your mind.
http://www.jslint.com/

Try pasting your code into that.

JavaScript sucks, use tools to make your life better.
>>
>>51689522
ok. I lied. I get #text, but I can't set the .style.visibility = "hidden"; of #text because all I get is
"Uncaught TypeError: Cannot set property 'visibility' of undefined"
>>
Just decided to benchmark my wordpress site

>initial test of 1000 requests/min
>10 secs in
>failed and crashed the server

>activated wp super cache
>fine at 1000 r/m
>1500 fine
>2000 fine
>5000 fine
>10000 requests/min no problem at all
>>
>>51689522
can you post an example, I'm too lazy to set one up on my own.
>>
>>51688982
Are you waiting for the dom to load before you are adding the time to it?
>>
>>51689559
Serving static files is indeed much faster than generating them.
>>
>>51689522

Try passing in event to hidePElement.

function hidePElement(event) {
...
}
>>
>>51689566
Sure here you go! And thanks!
http://hastebin.com/izayuxubar.xml

>>51689610
Didn't get me anywhere, this could be solved if I could pass "this" as a function atribute surely, but I can't because then addEventListler wouldn't work.
>>
>>51689879
Sorry, screwed up a little, this verison is better
http://hastebin.com/elezozetax.xml
>>51689566
>>
>>51689841
Never touched Laravel, but it could be HTML sanitizing URL::asset or something. That's my first guess, at least.
>>
>>51689933

What exactly are you trying to do after you've selected all the A's?
>>
>>51689879

Use

event.target.previousElementSibling


which would then allow you to, for example, remove the paragraph prior to the link by doing this:

document.body.removeChild(prevElement);


currentTarget and previousSibling are memes invented by Jews and Mark Zuckerberg to control good goyim.
>>
>>51689522
>If you add whitespace between the two li elements, the result will be "undefined".

It's a common error when working with
previousSibling


Check out the example here and how they implement it: http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_node_previoussibling
>>
>>51690099
>laughing_sluts.jaypeg

You're seriously linking to w3schools?
>>
>Javascript OO
Jesus H Christ, what have I gotten myself into? Does it get better?
>>
>>51689994
Hide the P's wich are the previous siblings of a.
>>
>>51690046
>previousElementSibling
Holy shit! That fixed everything!

Why the hell did my teacher tell me to use previousSibling and why does it exist???

You helped me out real good, thanks.
>>
>>51690099
Do i have <li> elements? The problem is I have to make this work without touching anything outside the <script> tags.
Thanks.
>>
>>51690154
Use Typescript or something or ES6/7 if you don't care about compatibility. It's simple anyway.
>>
File: dicks.png (139 KB, 1747x1117) Image search: [Google]
dicks.png
139 KB, 1747x1117
>>51690179

Common mistake. Also, if you use a browser with a good rendering engine like Firefox or Chrome, you can explore an object you console.log.

So if you do

console.log(event);


You should get something like pic related.
>>
>>51690196

Why can't you touch them? Do you realize you could do it manually?

Clicking an <a id="firstA"> -----> Hide <p id="firstP">

Write the code that hides the <p> with the ID "firstP" after you've clicked an <a> with the ID "firstA".

I'd do it for you but I'm lazy.
>>
>>51690208
Even better, use babel.js + ES7
>>
>>51690316
I know how to acess console and draw the DOM, I use console.log for most my outputs and logging, but I don't know what I'd gain from printing all that event info to my console, I already knew at all times the targetElement

Sorry, I'm a little green and my course is shit
>>
>>51690332
It's an asignament and it's part of the exersize.
>>
File: rwd.jpg (101 KB, 2090x861) Image search: [Google]
rwd.jpg
101 KB, 2090x861
Hey so I wanna code a responsive website, what dialect of HTML do I need to know? I heard there's also SGML and XML. And it all goes through HTTP?

Can someone give me a framework that codes what I think into a mobile first web design? It should have a sidebar and a menu, as well as a large area for posts. I'm also open to learning advanced programming languages like CGI, JavaScript applets, and GitHub.

Thanks!
>>
>>51690416
You've got the lingo down, I have big hopes for you.
>>
File: too_big_for_bait.jpg (92 KB, 680x989) Image search: [Google]
too_big_for_bait.jpg
92 KB, 680x989
>>51690416
0/8
>>
Im using bootstraps tooltip thing (http://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_tooltip&stacked=h) but it only works the first time i hover over something. If i move the mouse away and then hover over it again, the tooltip only appears for 0.5 seconds and goes away real quick. So it only works once per page load, then its fucked. WHY?!
>>
>>51690416

Please go.
>>
>>51690496
1) Show us your code
2) Have you checked your browser console?
>>
File: fuck.png (33 KB, 882x989) Image search: [Google]
fuck.png
33 KB, 882x989
Do you guys have any explanation as to why this doesn't bring up an alert window when I click on the image? I'm about to lose my shit
>>
>>51690416
Squarespace
>>
>>51690581
Its literally identical to the example, copy pasted it into a view. Console shows nothing
>>
>>51690629
1 - Install a linter on your editor, or open the console window of your browser.
2 - The script is executed before the image is added to the DOM.
>>
>>51690629
Put the script tag just before the closing body tag
>>
>>51690316
>>51690099
>>51690046
Fuck you guys helped me out big time but it only works on chrome and my atom browser mozilla just refuses to work.
Anyway I can say I got it working, thanks.
>>
>>51690783
>>51690726
awwww fuck I can't believe I didn't see that, thanks guys.
>>
>>51690805
Sorry vanilla js purists, but this is why jQuery was invented in the first place.
>>
File: hover.webm (371 KB, 400x400) Image search: [Google]
hover.webm
371 KB, 400x400
>>51690655
>>51690496

This is torture. Literally copy pasted example. Even used an empty project with no other shit mixed with it. Does not work on local copy or on my hosting service. Must be something wrong with my bootstrap/jquery files or my entire framework?
>>
>>51690829
Fixed it adding event to the attributes of the fucnctin, thank for all your help his and good night
>>
>>51690496
Why aren't you using the official documentation?
>>
>>51691073
>>51691089
>>51690496

I made a new discovery. If i put data-animation="false" it works. According to documentation, when its true (default) it will "Apply a CSS fade transition to the tooltip".

How the hell is my CSS fucking with the tooltip, even if i remove all the css files except bootstraps? Havent even touched the thing...
>>
>>51689559
meanwhile 10k requests per second is no problem for me on my laptop, then again i'm not using a bloated cms written in a shitty language :D
>>
>>51691275

IIRC the bootstrap CSS files have some animations built in.
>>
Best method of storing passwords?

Using PHP/mySQL
>>
>>51692534
Hashed and salted
>>
>>51692565
Where could I place the salt that would be more secure than the db?
>>
Looking for a little basic help with jscript\CSS.

I have a list of objects set out like:
Name
description
item id (in text, not an actual id)

I have a nodelist that I'm filtering down, I want to filter it further based on any itemid that's less than a threshold. I can access the text with class.innerhtml and I can turn it into a workable integer with parseInt. Thing is I've been using getelementsbyclassname and queryselectorall to filter the list and they only really want to work with strings.

I figure I can call parseInt and contain .innerHTML within a variable as a number, great; but how am I supposed to use that to filter my nodelist? Is there a selector function that will accept variables, and allow me to check it against another number?

This is my first time scripting anything and it's hard to put into words what my issue is, hopefully I came across alright.
>>
>>51687781
Protip: Check out loops
>>
>>51692534
PASSWORD('$password') in an sql table
>>
Am I retarded if I can't make a fucking image move around using event listeners in JS? Trying to do a drag and drop type thing
>>
>>51693267
Depends what type of drag and drop you're talking about.
>>
>>51693322
just free movement of an image around a page

its just supposed to follow the cursor when you click on the image
>>
>>51693453
If mouse down within left top and left+image width top+image height , then mousemove image css left is pageX and top is pageY.

on mouse up, get pageX and pageY set image CSS left top in the same way you used mousemove.
Thread replies: 255
Thread images: 24

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

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