[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 Development 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: 27
File: 1466182524466.png (868 KB, 822x552) Image search: [Google]
1466182524466.png
868 KB, 822x552
Las thread: >>55200812

'Had to use the fucking jQuery spaghetti screenshot because I'm too lazy to make a new one' edition

> Discord
https://discord.gg/0qLTzz5potDFXfdT

>IRC Channel
#/g/wdg @ irc.rizon.net
Web client: https://www.rizon.net/chat

>Learning material
https://www.codecademy.com/
https://www.bento.io/
https://programming-motherfucker.com/
https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md
https://www.theodinproject.com/
https://www.freecodecamp.com/
http://www.w3schools.com/
https://developer.mozilla.org/
http://www.codewars.com/
https://www.youtube.com/watch?v=JxAXlJEmNMg&feature=youtu.be&list=PL7664379246A246CB lecture series.

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

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

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

>NEET guide to web dev employment
https://pastebin.com/4YeJAUbT/
>How to get started
https://www.youtube.com/watch?v=pB0WvcxTbCA - "WATCH THIS IF YOU WANT TO BECOME A WEB DEVELOPER! - Web Development Career advice"
https://www.youtube.com/watch?v=zf_cb_Nw5zY) - "JavaScript is Easy" - If you can't into programming, you probably won't find a simpler introduction to JavaScript than this.


>cheap vps hosting in most western locations
https://lowendbox.com
https://www.digitalocean.com/
https://www.linode.com/
https://www.heroku.com/
https://www.leaseweb.com
https://www.openshift.com/
>NEW!
https://scaleway.com/
>>
anime is for fags
>>
Anyone here familiar with flask? I'm learning flask but I get this to work

HTML:
                     <form action="{{url_for('index')}}" method="POST">
<fieldset class="form-group">
<label for="exampleInputEmail1">Name</label>
<input type="text" class="form-control" id="exampleInputEmail1">
</fieldset>
<fieldset class="form-group">
<label for="exampleTextarea">Comment: {{com}}</label>
<textarea class="form-control" id="exampleTextarea" rows="3" name="comment"></textarea>
<small> {{com}} </small>
</fieldset>
<fieldset class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" class="form-control-file" id="exampleInputFile">

</fieldset>

<button type="submit" class="btn btn-primary">Submit</button>
</form>


Python:
#!/usr/bin/env python
from flask import Flask, redirect, render_template, url_for, request
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
app = Flask(__name__)
bootstrap = Bootstrap(app)
@app.route('/', methods=['GET', 'POST'])
def index():
return render_template('index.html')
if request.method == 'POST':
comment = request.form['comment']
return render_template('index.html', com=comment)

@app.route('/user/<name>')
def user(name):
return render_template('user.html', name=name)

if __name__ == '__main__':
app.run(debug=True)


Why won't the comment input appear in label?
>>
>>55237102
Can you post an screenshot or something, anon?
>>
>>55237150
>>
>>55237176
So you are pressing "Submit" with a non-blank comment, but the comment doesn't appear on your label, right? Or are you expecting the comment to render in realtime while you type?
>>
>>55237225
>>55237225
>you you are pressing "Submit" with a non-blank comment, but the comment doesn't appear on your label, right?

Exactly
>>
Hey guys question. So if php is a meme what should I use? Or what other options do I have? Preferably free
>>
What is /wdg/ official and approved stack?
>>
>>55237263
Oh right, the problem is your first return: you always render the template and never get to the condition.
Change your index() with:
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
comment = request.form['comment']
return render_template('index.html', com=comment)
return render_template('index.html')
>>
>>55237326
Anything but PHP.
>>
>>55237336
Thank you so much. I'm such a dumbass
>>
>>55237310
php is in no way a meme, learning it is better than learning this week's HIP and COOL framework.
>>
>>55237418
nice try, pajeet :^)
>>
How do you select specific fields with the xml parser in javascript?

Like if I have several blocks with a similar naming scheme in a string and want to select them using a logical order.

Example:
<!DOCTYPE html>
<html>
<body>

<H1>Conf</H1>
<p>This should be replaced by the Q</p>

<script>
var txt, parser, xmlDoc;

txt = "
<block type="Q_conf_set" id="4u70mA71(#a5h">
<field name="conf_name">example</field>
<value name="Q">
<block type="q6_conf" id="Au+0(n4tlchas#">
<field name="q0">0.1</field>
<field name="q1">0.2</field>
<field name="q2">0.3</field>
<field name="q3">0.4</field>
<field name="q4">0.5</field>
<field name="q5">0.6</field>
</block>
</value>
</block>
"

parser = new DOMParser();
xmlDoc = parser.parseFromString(txt,"text/xml");

qa = xmlDoc.querySelectorAll(".Q_conf_set")[0].querySelectorAll(".q6_conf")[0].getElementsByTagName("field")[0].childNodes[0].nodeValue;
var Q = qa + ", 0, 0, 0, 0, 0";
document.getElementsByTagName("p").innerHTML = Q;
</script>

</body>
</html>
>>
>>55237426
nice try americuck nodejs shill, nobody gives a fuck that your new framework is reinventing the fucking wheel. people like you are the reasons web development has become a shitty meme perpetuated by new frameworks coming out every other week claiming to be the hottest new shit. fuck you, hang yourself you worthless scum.
>>
>>55237459
>implying that I hate PHPajeet because I use anything related to cuck.js and memengoDB and not because is a clusterfuck of fuckness rotten to the core
>>
>>55237487
So stop supporting shitty standards? use php7 and PDO. the only thing wrong with php is the people that use it.
>>
File: 60556910.jpg (222 KB, 500x544) Image search: [Google]
60556910.jpg
222 KB, 500x544
>>55237349
>>
>>55237511
This.. the only people that hate PHP can't properly use it.
>>
>>55237637
http://www.4chan.org/index.php

I like php it was easier to pick up than perl in the cgi-bin.
>>55237647
OOphp needs to die though, php should be procedural.
>>
Does anyone here have experience with CherryPy?
>>
>>55237680
Why? OOP is easy
>>
I'm learning how to implement HTML5 videos to a website, but for some reason when I try playing them on android, I get a message that the video format or mime is not supported.

Source file is .mp4, should I be including a source in a different format for mobile? What would be best in terms of size and format?
>>
>>55237758
.mp4 should be fine.
>>
>>55237758
mime type error is usually a server thing
>>
Does anyone know of a resource on node.js?
I want to know how to get it to work, not how I should write the code.

I want to know about how to set things up.
>>
>>55237748
Pajeets have a hard time understanding it, it seems
>>
>>55237768
Thanks. Do you know if I should be including a smaller resolution file as well, so it loads faster on android maybe?

>>55237784
So I can't diagnose this myself, I'd have to contact the website admin? I'm using HTML and AjaXplorer to do this.
>>
learning reactJS is giving me a headache.
I cant progress.
My table just isnt showing uo and no one in my company knows react.js

pls sympathize.
>>
>>55237789
Nodejs is just running a java program as a server.

>>55237801
I learned some of the OOP stuff I know from pajeet youtube videos ironically.
>>
>>55237789
its ez as piss mate

http://blog.modulus.io/absolute-beginners-guide-to-nodejs
>>
>>55237834
>I learned some of the OOP stuff I know from pajeet youtube videos ironically.
That explains why you think Node.js is Java
>>
>>55237834
>Nodejs is just running a java program as a server.
spotted the CS major
>>
>>55237858
Maybe, I haven't slept for the last 4 days.
>>
>>55237834
I thought it was a C program
>>55237837
when I type node in a terminal, it exits right away... How do I get error messages and stuff?
>>
File: chart.png (2 MB, 1600x1200) Image search: [Google]
chart.png
2 MB, 1600x1200
Is there anyone here using more uncommon web tech? For example Erlang/Elixir, Common Lisp or Scheme, Haskell, C etc.

I'm thinking of getting running with Common Lisp and Hunchentoot.
>>
>>55237834
nodejs is v8 js engine as a server
faggot
>>
>>55237893
C# aspnetcore, fucking boss wants the bleeding edge on everything.
>>
>>55237877
>>55237837
ah... The guide is wrong.... You should use nodejs instead of node...
What is the other application for?
>>
>>55237894
>>55237877
>>55237867
My mistake then
>>
File: aviato-logo.jpg (85 KB, 1000x381) Image search: [Google]
aviato-logo.jpg
85 KB, 1000x381
Guys, tabs or spaces?
>>
>>55237936
tabs
>>
>>55237936
i use spaces here and there to keep everything aligned
>>
>>55237911
what version of linux are you using?
>>
>>55237965
I use ubuntu 14.04.
>>
>>55237936
Anything that doesn't force me to press the backspace button several times or any button for that matter
>>
>>55237976
He asked what version of Linux you use, not what version of Ubuntu
>>
>>55237647
The only people that hate PHP are the ones that have used any language that isn't a retarded_mysqld_convoluted_way_of_doing_stuff1(func). Not to mention it from a language analysis and grammar perspective.
PHP was designed by morons. It has its uses but stop selling it as the best thing ever pajeet
>>
>>55237989
well the kernel version would not affect if the binary is called node or nodejs.
Clearly he was asking about the packaging, so I thought the shortest answer would be to tell him what made sense in the context.
>>
>>55238005
THEN STOP USING DEPRECATED MYSQL FUNCTIONS AND FUCKING USE PDO REEEE
>>
>>55238005
Why are you trying to re-invent the wheel and not use a proper framework?
>>
Maybe a more relevant question:

I have a website (single html file) which takes in a lot of javascript functions. The variables is stored in the browser of whoever receives this html file.

How do I send a variable from the browser to an application on the server?

I was thinking I could use nodejs as I can use sockets from there, but I am not sure I am doing this right.

In the end I should get the value on a C++ application on the server (probably using zmq), but I don't know if I even can do this with nodejs?
>>
Is there a reason that when putting javascript into a site, some things only work when the script is written into the body of the html? I liked the idea of having all js on an external page that I can link to in the header but whenever I do that, I can't get some stuff to run.
>>
Anyone here with advanced web integration experienced?

I'm trying to do the following:
- create WP frontend for customers to register for an event

- use SuiteCRM as backend

- use RabbitMQ as the communicating tool between the 2.

Anyone here with integration experience?
>>
>>55238096
It's how js loads, try rearranging your scripts.
>>
>>55238096
<script src="your_script.js"></script>
>>
>>55237817
HOLY SHIT EVEN THE FUCKING HELLO WORLD TUTORIAL DOESNT SHOW ANTHING WTF REEEEEEEEEEEEEEEE
>>
>>55237442
does anyone know?
Or does anyone know what I should be looking for?
>>
>>55238052
I used a framework when I had to work in PHP anon ^_^
Most people don't though and that's your bad luck if you ever have to maintain that.
>>55238027
But I always used PDO and frameworks :^)
>>55238187
Stop browsing 4chan at work, you will get fired.
>>
>>55238085
You can skip node and just use sockets with C++
>>
>>55238211
okay. How do you use sockets in javascript then?
Are there some good libraries?
I have no problem with c++ to c++ communication, but I am completely new to the web site of things.
>>
File: help a retard out.png (27 KB, 980x664) Image search: [Google]
help a retard out.png
27 KB, 980x664
Trying to set up a test page with html, and I have two videos centered in one line, with space between them.

When I open it on an android browser and view it sideways, it looks like this. I don't get it, how do I have them aligned, but also have space between them?
>>
>>55238197
I've used several. Someone please kill the people that produced CakePHP.
>>
>>55237326
MEAN and LEMP
>>
>>55238272
I used Codeigniter. Dunno what's the general sentiment about it. It was alright for my needs.
>>
>>55238275
I prefer the KEK stack
>>
>>55238352
>Not using the MEME stack or the PEPE stack
It's like you want your startup to fail because it wasn't dank enough
>>
>>55238257
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications

Don't count on legacy support.
>>
>>55238394
cool thanks..
>>
>>55238384
>MEME stack
>MySQL
>Express.js
>MathML
>Erlang
>>
File: url.jpg (5 KB, 284x177) Image search: [Google]
url.jpg
5 KB, 284x177
I have a question, if anyone would be able to help with an opinion or tip.


I'm using Threejs to render canvas contents to a texture to go on a sphere. Recently realised I need an alpha map to go with it for partial transparency, in some places.

Trouble is, I render these textures in realtime based on users' input, with multiple instances of these canvases, one for each user, before putting it all together onto the texture for the sphere.

I need to be as close to 60fps as I can get.

--

Would anyone be able to recommend which way would be better to go about this, keeping in mind performance:

• rendering both texture and alpha map canvases at the same time, for each user
• parsing the users/final texture and taking out the alpha data, and rendering the alpha map from that
• something else..?


Option 1 seems to be the most straight-forward, and I've started working on that, but it would probably nearly halve the number of concurrent users I can have.

Option 2 seems like the cleaner way to go about doing things, but the textures are fairly large, 4x the viewport size, and iterating through its imageData takes a long time, definitely not a 60fps approach.

--

Thank you for any help, I appreciate it.
>>
>>55238449
>not using TempleOS in his web stack
what is this, 1987?
>>
>>55238567
Doesn't specify an OS (MEME doesn't have a T in it), you can use TempleOS if you want.

Good luck getting networking though.
>>
>>55238634
>Do you have whitespace in your HTML code?
this is actually the worst thing about HTML desu, who thought it was a good idea for a newline to be interpreted as a space?
>>
>>55238634
months start at 0, so 8 is september and only has 30 days.
>>
Haters gonna hate
>>
File: 4046753.jpg (32 KB, 400x353) Image search: [Google]
4046753.jpg
32 KB, 400x353
>>55239184
Nice meme.
>>
>>55239184
Cancer and AIDS are likewise infamous.
>>
>>55239314
>>55239184
kek, it's true, it's famous and there are several job openings... even where I'm applying as a C# Web dev, there's a more senior position for PHP... fug.
I will admit, I started doing web design in Frontpage and Web Development in PHP, modding shit in Invision Power Board and phpBB.
Met some cool people in different forums when I was just a wee lad doing amateur scripting. So yeah, php... you might be ugly and fucked up beyond recognition internally but you were my first...
>>
>>55239329
kek
>>
File: asd.jpg (31 KB, 673x245) Image search: [Google]
asd.jpg
31 KB, 673x245
question about formatting. The money sign is part of this image. Looks great when customer uses/purchases a gift cert of a 2 digit amount. However if they go 3 digits (100 bucks are higher) the "1" in the "100" overlaps the money sign. I tried moving the amount to the right, which made it looks good for a 3 digit amount, but then a 2 digit amount leaves a large space between the money sign and the amount. Suggestions?
>>
>>55239409
don't make the $ sign part of the image.
use a smaller font for 3 digits to make it fit
>>
>>55239409
Maybe increase/decrease the font-size depending on the length/size of the text? I don't know how much leverage you have with the formatting and how dynamic it might be.
Just a thought if you want your content to fill the circle.
Looks qt btw
>>
PHP truly is the best language.
>>
>>55239438
>>55239444

Thanks. I wrote a script that took care of it

    //adjust GC price font size if 100 dollars are more
var GCBalanceStr = document.getElementById("ctl00_ctl00_NestedMaster_PageContent_Balance");
if (GCBalanceStr.innerHTML.length == 3) {
GCBalanceStr.style.fontSize = "55px";
GCBalanceStr.style.position = "relative";
GCBalanceStr.style.top = "20px";
}
else if (GCBalanceStr.innerHTML.length >= 4) {
GCBalanceStr.style.fontSize = "37px";
GCBalanceStr.style.position = "relative";
GCBalanceStr.style.top = "35px";
}
>>
>>55237908
Core is being released in a couple days, and it's a huge improvement over MVC5 and previous iterations. You have nothing to complain about.
>>
>>55240168
don't do that.
at least only change the elements class and control it with css instead of hardcoding something like this.

if you're already using asp.net you could do that on the server side.
and why the fuck are you still using webforms.
also you can disable id inheritance in the web.config to avoid having hundreds of ctl00_ctl00 etc.
>>
>>55239409
can't you combine the $ and the number into one string which you center with flexbox?
>>
File: frameworks.png (6 KB, 566x124) Image search: [Google]
frameworks.png
6 KB, 566x124
Lads, which one should I use?
In terms of user friendliness and useful/up to date documentation, which one of these is the best?
>>
>>55240190

it's an older website i guess. Lots of our web apps still use it. I think I prefer having the id inheritance because then I can control what I want and not give it id's manually. I'm pretty new to asp.net. I honestly have no idea how to dynamically format something like this with just CSS. What exactly is wrong with vanilla js?
>>
>>55238352
Koa.js Ember.js Karma (for testing)

It could work
>>
>>55240248
not formatting with css dynamically.
but using classes instead of setting css values with JS.
separate your code and markup.
if you want to change something you now have to dig into the markup/js files to change styling compared to changing it in your css file.

but again, for what you are trying to do you could just make your own server side control that puts its classes exactly like you need already, then you don't need to check with JS.
it's unnecessary bloat.
>>
>>55240297

so i could have done it using just asp.net? do you mind pointing me in the right direction of how i would set up a control that would do this?
>>
>>55237817
post a jsfiddle, bitch
>>
>>55240214
All shit.
>>
File: rampart_money.gif (913 KB, 500x341) Image search: [Google]
rampart_money.gif
913 KB, 500x341
>>55237459
>nodejs shill
>>
>>55238511
I went with compiling both the normal and alpha map. Performance seemed ok, though, I've not tested with many users, so who knows..
>>
>>55240420
k
>>
>>55240214
Laravel
>>
>>55240356
make a custom class and inherit whatever control you're using now and do something like
this.Attributes["class"] += " price-tag price-tag-" + this.Text.Length;

so you can use the .price-tag class for general styling and .price-tag-2 or .price-tag-3 for whatever text length you have.
>>
why does apache run out of memory even on very low requests?
>>
>>55240248
just admit that youre old and lazy already
>>
Node.js or php as first back end language?
>>
>>55240657
It spawns a process per resource to be served. System processes have a lot of overhead. Use nginx instead.
>>
>>55240671

nah mid twenties. Vanilla js is great. But i found a much better solution anyway. I just removed the Replace method in the aspx.cs file that removed the money sign, and edited the image so it doesn't include the money sign. So now the money sign is a part of the actual text. There's a very slight position difference between 2 digit and 3 digit values, but as long as it's in the circle, it's fine.
>>
>>55240881
Node.js shit. Use python.
>>
>>55240881
Go or Python.
>>
>>55240881
C#
>>
>>55240899
>>55240915
Why?
>>
>>55241014
1) PHP is utter garbage and only worth learning, if you have no self-respect and will Pajeet for money.
2) Node is better, but pre-ES7 JS is still horrible. And the libraries for Node are nowhere close to par.
>>
>>55241014
I am no language-warfag but I am using Python and it's just fucking great. Fast and great community. There is a package for everything.
                                                                                                                                  even your mom[\code]
>>
File: mKWNh.jpg (58 KB, 322x252) Image search: [Google]
mKWNh.jpg
58 KB, 322x252
>>55237459

>nodejs shill
>>
>>55238096
HTML is parsed from top-to-bottom and any JS is run as soon as it's read. So any code in a header referencing a body element won't work because those elements don't exist yet.

If you want to keep your JS in the header, you should wrap it in an event handler so the code only runs when the page is ready. If you're using jQuery this is $(document).ready().

You could also move all your JS to the bottom of the page.
>>
>>55237459
>>55240431
>>55241399
It's funny how PHPajeets don't even stop to consider there are other web dev languages besides PHP and JS.
>>
>>55240881
php isnt a language its a hack for creating dynamic content in 1994

its only for use in Personal Home Pages in 1994 and even back then I said no thanks ill make my toasters fly and babies dance with dhtml+flash
>>
>>55240883
yes but i don't understand why it spawns so many when so few requests and keep alive time is low
>>
File: holy fuck yes.gif (891 KB, 300x169) Image search: [Google]
holy fuck yes.gif
891 KB, 300x169
>mfw I landed a 2nd interview for a web-dev position

At this point I have a 90% chance of getting accepted unless my autism gets the best of me and I fuck it up somehow.
>>
>>55241885
What are your credentials and where are you?
>>
>>55241885

>1 interview not enough

lel wut. Unless the first interview was just a phone interview or something?
>>
>>55241901
I have a degree in SE (recent graduate) and I live in Southern Europe.

>>55241917
That's normal here. They use the 1st interview to weed out the retards and the second interview to finalize their decision.
>>
>>55241885
how long you been at it, family?
>>
>>55241949
I've been programming for the last 8 or so years.Never really got into webdev until recently, familia.
>>
>>55241885

few months ago i took a 40k a year web dev job in the states. Still here. Hopefully pay raise later in the year. I made it...I think...
>>
>>55241994
>40k per year

Isn't 40k a shitty salary for the USA?
>>
>>55240881
you'll need to learn Node anyways
grunt, gulp, browserify, webpack and all that stuff runs on it
>>
>>55242024

ya it is but i was desperate to get a web dev job and get professional experience. Pretty sure i'll be making a lot more in a year or 2
>>
>>55242053
I know that feel nigga. This is my (hopefully) first IT job so I'll take anything I can get to have some experience under my belt.
>>
File: 1355270623282.jpg (13 KB, 351x351) Image search: [Google]
1355270623282.jpg
13 KB, 351x351
Got a raise and a bonus and a pension scheme and private health insurance from work.

Aaaaaand the world economy just shit the bed. Lets see how long this lasts.
>>
Why does PHP cast bools to string as 1 and "" instead of "true" and "false"? Who the fuck thought that was a good idea?
>>
>>55237893
I am using Clojure+Clojurescript. At my actual job, not just playing with it.
And it's fucking amazing.
>>
>>55237936
Company convention over language convention over your preference (spaces in my case).
>>
>>55238005
>PHP was designed by morons.

Yet these same people cokcgobble over JS so much, yet lack the knowledge to even know the history on how JS was created in the first place.
>>
File: cia-nigger-dildo.jpg (115 KB, 1280x702) Image search: [Google]
cia-nigger-dildo.jpg
115 KB, 1280x702
>>55238585

Spotted the cia nigger
>>
Is google go a meme language for backend?
>>
>>55242663
ur dad
>>
>>55242663
Aren't all variables stored as strings or some ridiculous shit like that?
>>
What is that Chrome addon that tells you what a made with?
>>
>>55243537
Nm found it

Wappalyzer
>>
>>55242024
In many parts of Texas, 40k is only 10k under family income. So husband and wife or queer and steer combined.
>>
Well a recruiter scouted me for a Perl web dev job, this is odd. Anyone have experience with Perl and web development? Am I just going to be maintaining legacy code?
>>
>>55243955
Recruiters suck ass.

I get calls for python dev in san fransisco which is like a 36 hour drive away.

They just blanket spam people.
>>
>>55244001
Should add that I use PHP and JS, not python.
>>
>>55244001
nah this guy seemed interested in me, i had applied for a different position within the company. I think im gonna take this job cuz the pay is good, but ill wait and see after the interview. gotta learn me some mojolicious
>>
Two questions :
I like programming but I don't like Web design much because it's less about programming and more about making a pretty looking website.
Is there something like a GUI builder but for HTML?

And how is asm.js? I like the idea of programming in C and having it translated into Javascript
>>
>>55244657
use bootstrap, or any other css framework that has templates, if you dont like messing with gui

thats not how asm.js works, its just an optimization thingamajig. if you target its "api" you will get better performance (kinda like using simd)
what you are probably after is emscripten, this will translate/transpile c(++), with the help of llvm, onto regular js code (targeting asm.js during the transpiling will produce faster results on browsers that implement native asm.js)
>>
>>55244001
this guy know what he is talking about, online recruiters are a fucking pain.
dont accept to do anything for them unless they ask you to show up on the job site and to talk with their hr or recruiting personnel (and even then its a gamble)
>>
finally bought a herman miller aeron.

I'm comfy, anons.
>>
Is using a Controller absolutely necessary in Laravel? Because I've found shit way easier to do it directly like this:

Route::get('/blog', function () {
$posts = App\Blog::all();
return view('blog', array('posts' => $posts));
});


Only downside I can see to this is that I cant reuse that same method across different pages without rewriting the same code, but in this case I'd only need it once.
>>
>>55240170
Thank god, I had trouble with some bugs and had to do lots of workarounds with RC2.
>>
so what does your startup do /wdg/?
>>
>>55241604
PHP is the only worthwhile server side language.
>>
Any backend devs here? How do you categorize background jobs, with say Celery+Redis? So you might have jobs doing things A and jobs doing things B, and you can get the status of these jobs by pinging /jobs/{A|B}/<id>. How would you differentiate jobs of type A and those of type B? All I can come up with is prefixing job IDs with "A-" or "B-".
>>
>>55241604
Pretty sure a lot of Indians are into java as well.
>>
>>55245641
Took a service that is popular but expensive and made it free because I'm not a retarded dickhead that needs to use an expensive API.
>>
>>55245652
There are a few, but if you can disregard the beauty and readability of better languages then you can appreciate the amazing flow that PHP has, no matter how chaotic it actually is.

You can drool a constant stream of PHP and it will work, but God help you if you want to fix something.

Obviously this is for procedural PHP which is where it shines. OOP PHP has no place in web dev when better languages do exist.
>>
>>55246722
I agree, OOP PHP is cancerous. If you don't need your application to be maintainable, write it in PHP.
>>
>>55247249
If you're working solo then PHP is perfect.
>>
How likely is it for a robot such as myself to get a job in web dev/graphic design without any sort of college diploma, and let's say I'm not exactly passionate about programming but am willing to learn it to get a semi-decent position?
>>
So I want to get started with trading real stocks with fake money through a web interface because I don't know anything about finances. Has anyone here done that before? Where do I start? What APIs are best?
>>
>>55241666
It was designed like that. Seemed like a good idea at the time. Later we discovered eventful multithreading to be a better paradigm.
>>
>>55243039
It's pretty good, but still evolving implementation-wise. Better GC and speeds soon.

>>55245677
What specifically are you doing that needs categorizing jobs and checking status during execution?
>>
>>55248618
no man i think something's wrong with my config or something i'm not able to see because other people are able to handle much more number of requests with the same resources
>>
>>55248763
I'm analyzing input data and storing the results in the database which takes a while.
>>
>>55248485
<?php
echo(shell_exec("cat /proc/uptime | cut -d ' ' -f 1"));
?>

            <div class="thumbnail thumbnail-uptime">
<label class="label-counter">Server Uptime</label>
<span class="server-uptime-counter"></span>
</div>
<button type="button" role="button" class="btn btn-default btn-counter-stop">Stop Counter</button>
<style type="text/css"> .thumbnail-uptime { max-width: 200px; }</style>
<script type="application/javascript">
(function(){
var counterElement = $('.server-uptime-counter');
var startCounter = {};
startCounter.promise = new Promise(function(res, rej){ startCounter.resolve = res; startCounter.reject = rej; });

startCounter.promise.then(function(){
var myIntv = setInterval(function(){
var oldTime = Number(counterElement.text());
counterElement.text((oldTime + 1));
}, 1000);
});
$.get('/php/serverUptime').then(function(r, s, x){
counterElement.text(r.split('.')[0]);
startCounter.resolve(r);
});
return undefined;
})();
</script>
>>
>>55249882
forgot about the button, here's the revised javascript
(function(){
var counterElement = $('.server-uptime-counter');
var startCounter = {};
startCounter.promise = new Promise(function(res, rej){ startCounter.resolve = res; startCounter.reject = rej; });

startCounter.promise.then(function(){
var myIntv = setInterval(function(){
var oldTime = Number(counterElement.text());
counterElement.text((oldTime + 1));
}, 1000);
startCounter.intv = myIntv;
});
$.get('/php/serverUptime').then(function(r, s, x){
counterElement.text(r.split('.')[0]);
startCounter.resolve(r);
});
$('.btn-counter-stop').on('click', function(e){
clearInterval(startCounter.intv);
});
return undefined;
})();
>>
Article on web-scaling with Django, for all the django lads

https://engineering.instagram.com/web-service-efficiency-at-instagram-with-python-4976d078e366#.e35hk0g64
>>
>>55248485
>>55249882
>>55249909
Once more, done in angular. The button is a toggle button. You can stop, start again, stop again, start again. And it'll always stay in sync.
>>
Anyone worked with Sails.js before? Im looking for a framework for a web application (lots of server/client communication) and Sails seems good for that. Does anyone have experience with it?
>>
>>55250191
if the framework ends in .js it's probably trash. that's my advice.
>>
>>55250225
What framework (or what language) would you recommend? PHP is shit, ruby is shit, JS is shit...
>>
>>55250278
PHP.js on Rails.

but PHP7 really isn't that bad, the only terrible part about PHP is the community and the hatred for past versions. inb4 pajeet.
>>
>>55250076
Are these two statements equivalent in angular?

this['toggleCounter'] = function(){};
this.toggleCounter = function(){};
>>
File: Screenshot_2016-06-25_14-44-38.png (104 KB, 788x743) Image search: [Google]
Screenshot_2016-06-25_14-44-38.png
104 KB, 788x743
Writing a websocket login system. You'll be able to register/login without any page refreshes. Now I just need a way to authenticate logged in sessions and log out. A command to logout all devices would be nice too.
>>
>>55250293
they are equivalent in javascript generally.
>>
File: 1378485682885.gif (993 KB, 500x375) Image search: [Google]
1378485682885.gif
993 KB, 500x375
>>55250665
Thanks bruh
>>
for (var i in names){
splitNames.push(names[i].split(" "));
}


for(var i = 0; i < names.length; i++) {
splitNames.push(names[i].split(" "));
}



Is there a reason why I should use one over the other?
>>
>>55250968
in a compiled language they're both the same thing, the only real difference is how readable and concise one is.
>>
>>55237817
Do this tutorial for React http://survivejs.com/

If you want to use Redux for state management, do this afterwards:
http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html
>>
>>55250968
The former for objects, the latter arrays. Arrays also have the 'length' property.
>>
>>55251010
Arrays are also objects in JavaScript so as everything else so it works with them as well. As far as I know the only way you can iterate through the key value pairs in objects is with the for in loop so that's one thing they can do that normal for loops can't, but I don't know if one is faster than the other while using them on simple arrays.
>>
>>55251049
You are missing my point for...in will also iterate over the 'length' property. For arrays use for...of or C-style for loops.
>>
in php why can i not just put all of my database connection shit into another file then call include at the start of my other files? also tried require and require_once but they didn't work either.
>>
>>55250293
Dot notation is faster to write and clearer to read.

Square bracket notation allows access to properties containing special characters and selection of properties using variables

Otherwise they're the same.
>>
>>55237176
Someones watching shemaleporn. Watch your tabs buddy.
>>
>>55250968
The correct answer in this case is map, since you're just changing the contents of each element, and not changing the structure of the array you're loooping over.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

var splitNames = names.map(function (name) {
return name.split(" ");
});
>>
>>55251285
you can, that's how it works.

not sure what you're doing wrong, you didn't post any code or error message.
>>
>>55251743
well that's the problem, i don't get any error back. i literally just took the PDO connection shit from my index.php, stuck it in database.php, then did include 'database.php' at the top of index.php. Let me try again and see if i fucked something up.
>>
>>55251743
>>55251760
lmao it now somehow works, i fucking hate php sometimes.
>>
>>55251285
i have the same question but node.js

why do i need mongoose when i can just access a .json file with fs?

t. didntgotocollege
>>
>>55247249
...unless you use a framework.
>>
>>55245652
personal home pages is a hack from 1994
>>
>>55251794
Because a database, even one that stores json, is more complicated than a file containing json. A database is optimized to be read and written to by multiple users, and to find specific information.

You're not supposed to just load your entire data set into a variable and into RAM and then look through it to find what you want, that's your database's job.

Mongo's shit tho. Try CouchDB instead, its a way better noSQL database. It has a HTTP interface too so its ez mode.
>>
>>55249882
Using shell_exec is lazy, and can fuck with portability
>>
Why do people argue about object oriented vs functional programing? Can't we use both? I'm currently learning them after finishing some basic JavaScript courses but to me it just looks like OOB is how you structure your code while functional is more specific in how you work with your data by using different techniques. I don't see why you couldn't use functional principles in your object methods and so on.
>>
>>55252441
/g/entoo users need SOMETHING to argue about, so they try to pick the most inane topics possible. i don't even know the difference between oop and functional lmao
>>
>>55237748

There is no advantage compared to simply procedural software, especially in small scripts that don't need to be extended.

There is up to today no actual proof that OOP improves maintenance or productivity, so best thing you can say is that it offers additional means of extension.
>>
>>55252723

I like Go's approach with interfaces
>>
>>55252723
>There is up to today no actual proof that OOP improves maintenance or productivity

This is one of those statements I'll see and think it's absolute bullshit but I actually agree with it.
>>
>>55253080
>This is one of those statements I'll see and think it's absolute bullshit
Why, though?
There is no actual proof for a lot of things up to today.
>>
on a scale of 1-10, how good is codecademy? i've been doing the javascript course lately and feel like it's pretty decent but have no way of knowing.
>>
>>55253598
2
>>
>>55237936
`go fmt`
>>
File: 59.jpg (676 KB, 1456x2382) Image search: [Google]
59.jpg
676 KB, 1456x2382
I'm reading this book and I'm at the part of Event Delegation, actually I'll just take a screenshot of the page, is this used a lot? I've seen a few intro to JS videos but have never seen people use event delegation, maybe because they were so basic?
>>
>>55253598
-0
>>
Anyone here ever use the Google Custom Search API? This thing is driving me up the fuckin wall, bros

I'm using node.js and the request module to query the API. It spits back some JSON, all's good, etc.

I use the .body property access to get into another object filled with a load of properties. I want to access "items", an array filled with the data I'm building this app to access. It should literally be as simple as res.body.items. However, when I do that and log that access to the console, all I get back is undefined.

I have no idea why, I've checked it in a JSON viewer and that shit is literally right fuckin' there

Any ideas?
>>
>>55254966
Nevermind, I've found out the problem. res.body is a string

WEW LAD WEEEEEEEEEEEEEW LAD

WEEEEEEEEEEEEEW FUCKIN LAD WEWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
>>
File: 4b7.jpg (14 KB, 500x333) Image search: [Google]
4b7.jpg
14 KB, 500x333
What's with this industry in particular and sjws? I'm just learning web dev and decided to follow some developers on twitter expecting my feed to have relevant info on the industry but all I see is fucking retweets of white guilt, liberal garbage and feminist agendas.
>>
>>55255338
Because the tech industry is centered on San Francisco, the gay/liberal capital of the world.
>>
Javascript question:

When I run JSON.parse on a string I'm turning into an object, I lose some detail.

Here's an object within an array within the object:
{
"pagemap": {
"cse_thumbnail": [
{
"width": "152",
"height": "136",
"src": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTpPziiwMQOplmbDJte-YLQIjEQjZ71oxDLjG3omulap166wnkJv1omlmI"
}
],
"metatags": [
{
"author": "Axis41",
"viewport": "width=device-width,initial-scale=1"
}
],
"cse_image": [
{
"src": "http://www.carrots.com/public/images/homepage/OCT_employee_appreciation_post_image_01.jpg"
}


When I convert that into an object, it becomes
 { 
pagemap: { organization: [Object], metatags: [Object] }
}


What's going on with this?
>>
>>55256048
it works.
how do you know it's not working? what are you checking it with?
>>
File: source_sink.jpg (8 KB, 300x209) Image search: [Google]
source_sink.jpg
8 KB, 300x209
Any Cycle.JS users here?
How do you incorporate your back-end?
Do your apps contain most of their login in the front end?
Do you like working with Rx.js?
>>
>>55256524
*logic, not login
>>
>>55250551
>You'll be able to register/login without any page refreshes.
Neato
>>
Coming from Java I have to say JS and PHP are weird, though PHP less so.

>EVERYTHING'S AN OBJECT, EVEN FUNCTIONS

Crazy.
>>
What's a good way to define a class in JS? There seems to be at least three or four ways. Right now I'm trying to work with prototypes, which seems to give me a better look at a class concept in JS. Coming from Java. Also the weak typing is giving me a headache. Trying to get JSDoc in Webstorm for that next.
>>
Im kinda new in this web development world, i want to create a gis web app, that can capture attributes for a mark on a map, do filter searchs and some graphics, wich is the best option to do it?
>>
Also, do you write inline scripts for form submits or rather load a reference in the HTML? My concrete use case is I load a HTML page into a div as a submenu.
>>
>>55256635
Use babeljs or any other es6 interpreter then you have class, super, extends, etc
>>
>>55256691
Oh I should have said that due to time constraints I'd rather stick to plain JS and jQuery for now.
>>
>>55256657
openlayers/leaflet
>>
>>55256717
babel is command line program you can install which you then run to convert es6 to es5

so you can do this:
$babel youres6.js > lib/youres5.js

and if you use a build tool like grunt or gulp you can have them watch your js files and automatically transpile them to es5
>>
>>55256669
never ever make inline scripts.
separate code and markup.
>>
>>55256763
Thank you
>>
>>55256578
the functions as fist class citizen thing is neat though. i think java has lambdas or something now
>>
>>55257264
Yeah it's interesting, especially the closures stuff. Itcactually reminded me of lambdas or that thing in c#. Still needs some time wrapping my head around it.

>var _this = this; //hurr durr
>>
>>55237893
Elm on front end. It nice. go backend
>>
>>55245677
I would still appreciate an answer on this one lads.
>>
I'm receiving JSON data from an API via a node.js http request.

I carry out property accesses on the JSON data and store the results in variables. However, sometimes, the property does not exist on the JSON object for whatever reason. In that case, node throws an error, e.g. " if (bodyObj.items[i].pagemap.cse_image[0].src) {
^

TypeError: Cannot read property '0' of undefined"

I thought I was being a sly fox by sticking these property accesses into if checks, and then assigning a placeholder string if they were undefined e.g.
if (bodyObj.items[i].link === undefined) {
// code to assign placeholder string
}


However, this doesn't work. Node just throws the same error as before during the lookup within the if statement clause.

Any ideas on what to do? Am I going to be doing try/catch blocks to solve this?
>>
>>55258821
if (typeof bodyObj.items[i].link === 'undefined') { }


or
let myLink = bodyObj.items[i].link || 'placeholder';
>>
>>55258996
A good suggestion, but it still throws the same error:

if (typeof bodyObj.items[i].pagemap.cse_image[0].src === undefined) {
^

TypeError: Cannot read property '0' of undefined


It seems to happen any time the property access occurs. Dunno how I'm meant to test for the presence of something like this if it's going to throw a shitfit every time I so much as dare to check
>>
Cycle.js? Nobody?
>>
>>55259066
cse_image is undefined, not src.
also undefined should be a string, it's not an object.
>>
>>55259086
>cse_image is undefined, not src.

I know. The data I'm looking for will be at the end of this access chain. However, a property could be missing at any point in this chain, in this case it's cse_image, but it could as easily be src.

>also undefined should be a string, it's not an object.

I'm not sure what you mean by this. If I perform a property lookup that doesn't exist, it would return undefined
>>
>>55259143
typeof returns the type as a string, so you have to compare it to the string 'undefined'

you need to check every property on its own before accessing it.
it sucks, but that's how it works.

if you have a lot of objects and keys to check use a function that tests based on a string.
see the different answers of http://stackoverflow.com/q/2631001
>>
I'm a project lead at my job for a website we're building. We're using material angular, but I'm still fairly new to it.

More of a design question, but should I only put logic in services/factories? If so, what's the correct way to pass data from the controller to the service and vice versa? There's many ways to do it from what I've seen, but I want to avoid spaghetti code if I can.
>>
>>55258821
jsyk,
something == null
is the same as
something === 'undefined'
>>
>>55259210
>http://stackoverflow.com/q/2631001
Thanks for all the help, this is exactly what I was looking for.

>>55259270
cool beans
>>
>>55259270
damn, there is a typeof missing on the second code tag, but you get the just of it
comparing with null seems easier to read and write than using typeof just to check for undefined
>>
I'm so tired of having to find a job every 2 years.

Why is this field so unstable?

There's always lay offs, off shoring, etc etc.

I'm so jealous of people who have an average paying job for at least 10 years.

I can't see myself ever being able to buy a house or settle down like this.
>>
The grass is always greener on the other side

Someone working the same job for the last ten years is sick of the routine of driving to the same place to work with the same people to do the same tasks. Work dictates a general rhythm to your life, it's not necessarily a bad thing if that shakes up.

Swings and roundabouts; it's very easy to idealise the alternative choice
>>
>>55245677
i dont have much experience with celery, but cant you use a queue for each task type?
>http://docs.celeryproject.org/en/latest/userguide/routing.html#defining-queues
>http://docs.celeryproject.org/en/latest/userguide/workers.html#queues-list-of-active-queues
if you need priority on them them you might need two workers
>http://docs.celeryproject.org/en/master/faq.html#does-celery-support-task-priorities

but then again i only touched this thing once or twice so i could be talking out of my ass
>>
>>55259371
Are you qualified to work in any other field? I plan on doing web dev part time as a second job, maybe you should too.
>>
I am going through angularjs docs and why is this so easy? Am I some kind of genius for understanding directives? Filters? Wtf? Where is the hard part I'm hearing about. Am I blind? Like, one of the biggest parts of the docs are directives and every one of them is explained in a few sentences. I went through some of ng-book and I got the same shit. Tutorials on internet are all the same and are piss easy.

I don't get it why are people talking that angular is like a full operating system in size.

WHAT AM I MISSING SRSLY, I DON'T WANT TO SHOW UP ON WORK AND REALIZE I KNOW NOTHING.
>>
Is there anything better than node to write a chat in?
>>
>>55259887

Not really. I've been doing this thing for so long that it's my only trade.

I'm also getting old which is why this is now so tiresome.

Also this seems endemic to most webdev / tech field jobs now. I would have to look at something completely different, but any serious professional education costs an arm and a leg.

It's an irritating situation.
>>
what's work/life balance like in web dev jobs?

i'm not interested in pledging my life to the shareholder's interests
>>
>>55259518
Appreciate the answer. Using one queue for each type of job should work. Not sure how to handle multiple users using one queue though. I'll keep looking, thanks anon
>>
>>55259891
If you're talking about Angular 2, then yes, you're a genius.
>>
>>55260029
Try getting a certification, they're nowhere near as expensive as getting a degree. CompTia Network+ or Security+, or you could try getting a CISCO or Microsoft certification of some sort. That way you'll be better able to land a more stable job in tech.
>>
>>55259960
Go.
>>
>>55260909
Is that a request or are you talking about the language?
>>
>>55260973
Language.
>>
>>55261002
Ah. Is it an easy transition from knowing PHP to learning go?
>>
>>55261013
Mostly. Biggest hurdle is learning pointers, if you don't know them already. Go is generally very easy to learn, if you already know a C-style syntax language. Take https://tour.golang.org and see how you like it.
>>
>>55261066
Alright, thanks for the help.
Thread replies: 255
Thread images: 27

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.