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

Plesse make it stop. Is this really the future you choose?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 236
Thread images: 20

File: nodejs-light.png (14KB, 600x300px) Image search: [Google]
nodejs-light.png
14KB, 600x300px
Plesse make it stop. Is this really the future you choose?
>>
Let the shitstorm begin!
>>
Nothing serious uses nodejs so it's ok
>>
What would you guy recommend as an alternative to PHP if I wanted to setup my website?
Node.js? Ruby on Rails? Django? Another one?
>>
>>46296145
Golang, you crunchy webdev fuck. There are languages that aren't shitty interpreted half-baked shitpiles, you know.
>>
>>46296107
>PayPal
>Walmart
Oh.. Wait.. You said nothing "serious", I got it now.
>>
>>46296190
How would you do websites in golang wihtout being able to use it inline in HTML? Wouldn't it be a pain in the ass? Is there something remoetly looking like a template engine or something like that?

Or was it just trolling?
>>
>>46296145
>Python
kill yourself
>>
>>46296190
I'm not a webdev, hence why I asked for an alternative to PHP. I just wanted to try out for some personal fun.
>>46296379
Why? I like it.
>>
>>46296326
>How would you do websites in golang wihtout being able to use it inline in HTML?
PHP is the only language I know that is actually used in inline HTML. Also,
>not knowing how the server-client model works
>>
>>46296379
stay mad. Django is perfectly fine.
>>
A good test to see if someone is a programmer or a brogrammer is to ask them to explain why something is bad in their own words.

Programmers will give you a thoughtful response with practical implications

Brogrammers can't answer the question without linking someone else's blog post or using vague generalizations
>>
File: 1416508863656.jpg (22KB, 385x448px) Image search: [Google]
1416508863656.jpg
22KB, 385x448px
>>46296190
>using a language that doesn't even have generics nor a ternary operator
>>
Definitely the future I choose. JS could use a little refresh, sort of the opposite of "use strict". I want ABSOLUTE POWER -- not bondage.
>>
>>46296039
If it makes you feel better, hardware isn't improving fast enough to make that heap of shit viable for any serious project.
>>
>>46296326
http://beego.me/
http://revel.github.io/

There's many Go web framework available
While go obviously provide better performance than interpreted languages, it has a higher learning curve if you're not familiar with C-like typed languages.

Django, rails and node are good though, and have their own benefits.
What matters in the end is personal preference
>>
>>46296410
I seriously didn't know how the Server/client model worked and I did a really small piece oft read: doesn't that mean I would need a second language, for example JavaScript, for my client side?
>>
>>46296326
golang has templating as part of the standard library
>>
>>46296326
negroni is a good option. but you don't even need that really
>>
>>46296588
What I tried to say is:
>Alice wants to access Bob's website
>She sends a request to Bob's server
>Bob's httpd (a.k.a. "the server program") handles the request and returns an HTML file to Alice
The way that HTML file was generated is completely irrelevant. It may have been generated from a C program as well as from an embedded PHP one.
>>
>>46296410
JSP, ASP
>>
>>46296668
Okay I guess I am too dumb to express my question. How woul'd you do that in golang:
<div>hello <?=$_GET['Name'];?>
>>
>>46296145
Try them all, pick the one you enjoy the most
>>
>>46296738
do not do that even in PHP
>>
1. Write JSON-api in whatever language and framework you want
2. Use the database you want
3. Isolate your front-end so it can be developed by monkeys. Don't use a framework because you hurt yourself in the end.
4. Migrate to faster frameworks (Rails -> Spring) and databases (MongoDB -> Postgre) if performance is an issue.
5. Profit

It can't be that fucking hard to do full-stack web development.
>>
>>46296784
Just immagine this is your view object with the Name variable passed by the controller if it makes you feel better.
>>
>>46296738
Wtf man, are you insane? That's just fucking wrong. Oh you PHP developers you.
>>
>>46296820
>2015
>mvc
>>
>>46296738
You even forgot the closing </div>.
>>
>>46296738
Parse the URL, map the args passed to a hashmap.
Not Go nor any language, just a simple example on how it could be:
string name = url.getArg("Name");
>>
>>46296738
http://golang.org/pkg/html/template/
judging by that code, you should probably learn about mvc first though
>>
>>46296145
Rails. Rails all the fucking way
>>
>>46296904
>>46296820
Thank you anyway, this is exactly what In was looking for.
>>
File: 128490999810.png (71KB, 800x1200px) Image search: [Google]
128490999810.png
71KB, 800x1200px
>>46296258
>mfw PayPal and Walmart will have to rewrite their whole server side code eventually
>>
I don't understand what the hate for Node.js is
they even say on their website "this is a web framework made for a specific use, not a general use framework".

I made my small scale personal web application with Node.js, but that's in part because I was applying to be a front end web developer places so I just made everything in JavaScript for my "showcase" project. It's... meh. And MongoDB, seriously what is that shit? It behaves so strangely

Different frameworks are better for different things... you probably wouldn't make anything of a huge scale with Flask but hey if you wanted to throw together a small web application in an afternoon...
>>
I think people just like to complain and belittle on /g/ . I use node for my business, which is admittedly small, but it has been rock solid so far (running under phusion passenger) and was a breeze to develop and maintain. I make a living with it.
>>
c# and windows developer.
a client wanted delivery nodes (lieferschein in german) over the web.

first prototype was in c#/asp.net.
- good VS integration
- we had a lot of problems with hosting the prototype on debian.

first nodejs prototype ran really well on all platforms (win/debian).
- used less resources
- good VS integration
- also its really nice to use both on the client and server.

i'm not sure if i would use it on a larger project tho.

javascript itself is a mess. i recommend typecscript. turned the messy nodejs project in an well organized codebase (yay interfaces, types, classes)

npm is really nice to use too.
>>
>>46297026
>mfw you'll still be unemployed in the basement when it happens.
>>
>>46297158
>I think people just like to complain and belittle on the internet and probably in wider society too
FTFY
>>
>>46297384
>FTFY
ha true
>>
>>46297329

nodejs is nice to use on the client?
>>
>>46297459
no using js is
>>
>>46296039
iojs will take care of all the cancer
>>
>>46297329
what is typecscript? is that a cross between typescript and ecmascript?
>>
>>46297459
in my experience, Node.js seems to play nicely with front end javascript frameworks
>>
>>46297587
lol nope

like which one
>>
>>46297540
no typescript is a MS "language" (think syntax. like coffeescript) which adds features like types, classes, modules to javascript.

and then you can use the typescript compiler to generate ES5/ES6 code.

just look at the examples here: http://www.typescriptlang.org/Playground
>>
File: 1418158799253.jpg (30KB, 295x295px) Image search: [Google]
1418158799253.jpg
30KB, 295x295px
>mfw bought intel gallileo for embedded development dicking around
>mfw it now runs windows
>mfw it runs node.js
>mfw I can access the GPIO with my node.js app
>mfw Internet of Toilets

But on a serious note, it's amazing for quick proof of concept stuff, but for a serious project I would never use a stack like MEAN... fuck that shit...
>>
>>46297615
works well for me with angular
though angular usually works well with any backend
>>
>>46296039
>JS lacks basic modern langugae features like static typing and strong typing
>JS is explicitly broken (this scoping)
>people use it anyways in places where it is absolutely not mandatory
Holy shit. Why?
>>
File: 1420647327660.png (1MB, 680x567px) Image search: [Google]
1420647327660.png
1MB, 680x567px
>>46298134
>mfw I scanned this
>>
>>46296039
>>46298332
>>46297482
>>46296550
>>46296107
Those. Seriously fuck this shit.
>>
>>46297026
Yes, they will finally convert to Yesod, make their software Free as in Freedom and start giving their workers good conditions. I see.
>>
>>46298332

Because dynamically typed languages are the easiest, most productive languages around. They don't promote good programming practices, but damn if you can't shit out a project 10x as fast in JS/Python than Java/ASP.NET.
>>
File: 1232137840048.jpg (91KB, 247x312px) Image search: [Google]
1232137840048.jpg
91KB, 247x312px
systemd ported to node.js when?
>>
>>46298332

ES6 fixes the scoping issue. Static typing is a preference, not mandatory.
>>
>>46298786

you mean node.js integrated in systemd when?
>>
>>46296473
One thing I never see asked is "what is it good or bad for"? Obviously if the language or framework does not do what the developers claim then it is bad. If the developers claims are met or exceeded then it is good. I can see no other question to be asked when deciding if a language or framework is good or bad. If someone says it is bad, yet the language meets all the developers claims, my assumption would be that they are not a good enough programmer to use it to its full potential. The words, good and bad usually say more about the programmer complaining than the developers or the language
>>
File: 1412921432361.jpg (38KB, 372x385px) Image search: [Google]
1412921432361.jpg
38KB, 372x385px
Strict mode fixes most of the issues I have with JavaScript. The only thing that I still dislike is the fact that it isn't statically typed, but seeing how objects are hash tables, I'm not sure how well that would translate.

In any case, I don't hate it.
>>
File: [worried laughter].jpg (69KB, 520x678px) Image search: [Google]
[worried laughter].jpg
69KB, 520x678px
>preferring static typing
>in an interpreted scripting language
haha
>>
Should I use Flask, Node, or Iron for my personal web server applications?
>>
>>46296145
Dart
>>
>>46296145
Python is the most mature language out of all of those alternatives... but why would you want anything drupal doesn't have?
>>
File: 1401159262230.jpg (42KB, 493x575px) Image search: [Google]
1401159262230.jpg
42KB, 493x575px
>not using Rust and Iron
>>
File: mongodb.png (8KB, 703x80px) Image search: [Google]
mongodb.png
8KB, 703x80px
>>46297110
I think that people hate node because of the users
>>
>>46298134
mongo and angular indeed suck
>>
>>46300092
I reckon that's not going to catch on
>>
>>46296145
gentoo
>>
>>46300701
How does one think in javascript?
>>
>>46296810
>It can't be that fucking hard to do full-stack web development.

>go into job interview
>they want a web dev
>hiring manager has an MBA from Harvard, knows nothing about programming
>"do you know node.js anon?"
>i don't use that shit i write it myself
>"don't call us, we'll call you"
>walk out of office as some bro walks in
>he flicks my nose and throws my glasses to the ground
>he giggles as he walks into the meeting
>pretty sure he called me retarded under his breath
>my spaghetti falls out of my pockets
>get kicked out of building while the bully gets hired for citing Tumblr SJWs and Medium bros that he met during his time at Yale
>>
>>46300701

Yup. Im actually interested in the node ecosystem and think it has alot of potential, but holy fuck if the userbase isn't the new rails. Faggot hipsters everywhere. It makes me envy Perl programmers
>>
>>46302856
first you have to dream in code
>>
>>46296851
What's wrong with MVC? It's a reasonable design pattern, what would you stick with?
>>
Java 8 + Spring Boot & JavaScript + EmberJS Master Race reporting in fa/g/s.

We scale the better with microservices and structured web applications.

>inb4 Scala
>>
>>46296039
The future is Go m8
>>
>>46303335
I don't like this meme JS send everything to the client to process stuff
>>
>>46297110
node.js isn't a framework it's a platform
>>
File: 1359946699290.jpg (167KB, 328x527px) Image search: [Google]
1359946699290.jpg
167KB, 328x527px
>>46296738
PHP developers everyone. Do what you would do in any language that isn't retarded-as-fuck PHP - use a tempting language. Go has one built in, Node had Jade which I like and has a go port called amber.
>>
>>46297459
Yes, I use node.js for all my client-side logic. What people mean is using Common.JS modules (browserify).
>>
>>46303373
Why the hell would you waste your own money on electricity when the users can?
>>
>>46297540
It's just JavaScript under the hood. It's a superset of JavaScript made for people who either don't understand how JavaScript works or they want to write JavaScript like you would in another language. This makes things harder to debug.
>>
>>46303453
JavaScript it's a tiny lang.

You are right about being harder to debug but not having a Strong Type System is shit on large codebases.
>>
>>46300251
Lol, Drupal, what a pile of shit.
>>
import "net"
import "net/http"
import "text/template"
import "html/template"


also,

import "github.com/gorilla/mux"
>>
>>46303413
Node has Jade? man you don't know shit about Node.js if that's what you think. Node.js isn't just Express. You can use any templating engine you want, you can make your own and publish it to NPM. You don't have to use a framework, in fact Node follows a unix-like philosophy of being modular is better. Fuck frameworks.
>>
>>46296473
And the the brogrammer goes out and gets laid and you cry yourself to sleep. Right anon?
>>
>>46303476
Only if you are incompetent.
>>
>>46303486
>he uses WordPress
>>
>>46303531

Yes, because most software these days is done by a single person.

You may want to make a point of discipline but try to do large scale JavaScript with:

3 American Programmers
7 Indian Programmers
2 Mexican Programmers
4 European Programmers

You will end with shit. Not because of race or whatever but because lack of structure.

The price of freedom is bad choices, that applies to programming languages and life.

Also, I have heard of a Ceylon transpiler for JS.
>>
File: nodejs not iojs shiggity.png (35KB, 660x548px) Image search: [Google]
nodejs not iojs shiggity.png
35KB, 660x548px
>>
>>46296326
>inline PHP
Oh god
>>
So, I've been looking at go, and it seems a lot simpler and easier to read than node, but I don't understand it. It seems very C-like.
>>
>>46303449
Node.js is just a platform, like PHP. You still have clients perform client-side logic
>>
>>46303628
ur mom was very C-like last night
>>
>>46303476
the only problem is when interfacing with raw data. The next iteration of ECMAScript solves that though with optional strong typing.
>>
>>46303663
>optional strong typing

source? if you're talking about 'use strict'; that's not static typing
>>
>>46303576
there was drama tonight in their IRC about a virtual stabbing

I shit you not
>>
>>46303789
Well maybe next time konobi will learn to drink the kool-aid.
:^)
>>
>>46303660
Edgy.js
>>
>>46296039
>not writing your own script language
>>
>>46303628
I mean, yeah, it's more similar to C than some script-based shitpile like PHP or Node (which I've never laid eyes on). Which basically just means it's less retarded.
>>
Ruby > Nodejs > Python >>> Golang >>>>>>>>>>>>>>>>>>>>>> PHP

:^)
>>
>>46296190
>Golang
>shit naming conventions
>syntax inherently forbids banner style formatting
>impossible to find decent documentation on
>300M install
bin'd

i would rather write a webapp in C, as an apache module
>>
I have no problem with nodejs. But why would anybody write desktop software in it? This is what makes me mad usually. You don't see desktop software written in PHP, then why js?
>>
>>46304829
>not using php-gtk
>>
>>46304829
Because it's really fucking quick to do anything.

I was a software developer for ages and web dev confused the shit out of me. I did the codeacademy tutorials for html \ javascript and javascript is just retarded easy.
>>
>>46304839
It makes me relieved that is a dead project.
>>
>>46304839
When you think you've seen everything in you're life.
>>
>>46304944
apparently you haven't seen enough english lessons in school
>>
>>46304979
>being this new
>>
>>46304996
>damage control
>hurr durr you're/your is ebin meme
fucking horrible cunt
>>
>>46303571
Yes but only because of the 7 indians.
>>
it helps tremendously for unifying front end scripts to a single file.
>>
>>46296542
>Passing functions
>this context binding
>prototype chain
>modify base classes like object or array
>getters and setters
>control over enumerability and configuration of properties.


What more power do you want? The only thing I can think of is manually deleting items from memory, but that's silly when you have a garbage collector. 'use strict' isn't as much as restricting your abilities or permissions, but rather more strictly following w3 specs.
>>
Is CofeeScript any good?
>>
>>46300646

Mah nigga.
>>
>>46304818
>syntax inherently forbids banner style formatting
Having one enforced syntax is the best thing that can happen to a language, nobody likes 10 different coding styles and every project uses a different one.
>>
>>46306138
if condition {
} else {
}

vs
if condition {
}
else {
}

honestly, which would you prefer?
>>
File: 1398639142492.png (46KB, 778x1068px) Image search: [Google]
1398639142492.png
46KB, 778x1068px
Agreed OP, why anyone would use node.js over the more superior io.js is beyond me
>>
>>46296039
It's io.js these days, faggot.

Not that this is better.
>>
>>46298737
>what is type inference
>>
>>46304724
This. With all the hindsight from the downfalls of JS, Ruby, Python, Perl, Lua, PHP, Pike, VimScript, Tcl and many more, how hard can it be not to fuck up like them.
>>
>>46306266
first one
>>
>>46306266

2nd example is master race.
>>
>>46306322
disgusting faggot
>>
>>46306322
Then you are a tasteless faggot.

The 80s is over.

So imposes the god of programming. And I'm not even that guy.
>>
>>46306138
>implying the designers of a language know exactly what style is best for practice
code style develops over time. habits change to adapt to new circumstances. it's a bit like evolution.
>>
>>46306266
frist
>>
File: data_fgsfds.jpg (30KB, 404x384px) Image search: [Google]
data_fgsfds.jpg
30KB, 404x384px
>>46306319
>writing your own scripting language
>how hard can it be
>>
>>46303413
A beginner posts shitty code...
>hurr durr php developers everyun! urrrrr!
>>
It seems like the problem is that /g/ just seems to hate javascript for some reason.
>>
>>46297615
Socket.IO
>>
>>46306427
we're all hillbillies that don't want none of that javascript shit here

hence noscript being so popular
>>
>>46303789
What is a virtual stabbing
>>
Muh niggas
>>
>>46296686
Assembly Server Pages?
>>
>>46306622
Annoying Server Pages
>>
Why all this hate about PHP?

I think it has become a good option together with some enhancing stuff like HHVM. It's an (awful and) awesome scripting language which is designed exactly for one purposes and it fits this purpose at it's best.

I have to admit that I also made some minor CLI-scripts in PHP before I learned C, but now atfer 6 years of C programming I still enjoy doing webpages in PHP and frontends in Javascript, tell me one good reason not to do that?
>>
>>46307290
You talking about WebForms? Then yes, that can rot in hell.

ASP.Net MVC5 is great. Plus ASP.Net 5 & MVC6 will be open source.
>>
>>46306427
It's a troll, anon
gosh
>>
>>46309486
Is it seriously worth taking a closer look at it? I mean like spending a whole weekend learning it in order to claim to your next employer you have years of experience in it?
>>
>>46296039

What's wrong with it?
>>
File: aspjobs.jpg (143KB, 1224x742px) Image search: [Google]
aspjobs.jpg
143KB, 1224x742px
>>46309556
yes
>>
>>46309596
>trying too hard
germans...
>>
spring or wicket?
>>
>>46306327
>>46306329
>>46306330
>muh closing curly needs a new line

kek. Else goes with the if block. It's not it's own statement. It's tied to the if. Also first example didn't show code inside
if (condition) {
// ...
} else {
// ...
}

vs
if (condition) {
// ...
}
else {
// ...
}
>>
>>46306266
>writing else statements

Protip: there should almost never be a time you write "else." There is something wrong with your program flow or decomposition if you do.
>>
>>46309761
if(condition)
{
//...
}
else
{
//...
}

master race reporting in
>>
>>46296039
Node is great because: V8 is great, libuv is great, NPM is great, ECMAScript 6 is LISP without S-EXPS so it's quite good.

Node is the best platform for web development currently available. ONly a stupid faggot would deny this fact.
>>
>>46309596
Why does the Swiss tech industry sucks so much? I just want to find a comfy business that isn't completely brainwashed by muh enterprise standards from 10 years ago.
>>
>>46309794
>implying haskell
>>
>>46309843
>haskell
Honestly never tried it. Does it fit my mindset?
>>
>>46309794
there is nothing wrong with using 'else'
>almost never
oh, right, but you knew that huh.
faggot
>>
>>46309866
you sound like a retard so yeah
>>
>>46309925
Else implies something is wrong. Give me an example when that isn't true.

The "almost" is talking about assignment based on boolean values, but that should just be the ternary operator
>>
Is anyone else falling more in love with Perl with every new web dev trend coming and going? It amazes me how easy it is to implement all of these fancy features all of the "rockstars" go on and on about in Perl.
>>
>>46309866
in haskell every if must have an else
>>
We've had this future since 1995. JavaScript didn't exactly invent callbacks.
>>
File: faragepleasure.jpg (20KB, 416x289px) Image search: [Google]
faragepleasure.jpg
20KB, 416x289px
>>46309795
>>
>>46310039
https://www.youtube.com/watch?v=gweDBQ-9LuQ
>>
>>46310129
Yeah, but it made it viable.
>>
>>46310168
Nah, this shit did it two decades ago: https://bitbucket.org/naviserver/naviserver/.
>>
>>46309972
e.g. where you may want to branch to execute several commands either way.
i love ternary but it can become unwieldy.

i dunno string comparisons or something. how are you going to do that?
>>
>>46310144
Sounds like someone didn't read the docs. You could put this kind of presentation together for any language.
>>
>>46310395
Then why are these bugs present in the standard library? Does this mean that perl developers have never read the docs in 20 years?
>>
>>46310426
I'm 10 minutes in and aside from Perl behaving differently from -insert language here-, there's literally nothing of substance. Half of what he's complaining about are features or ignorance about refs.
>>
>>46305486
>control over enumerability and configuration of properties.
What?
>>
>>46297329
What is a good resource/book to learn TypeScript from? No video, plz.
>>
>>46299450
ES6 fixes "this"? Really?
>>
Please don't laugh at me, I am a JavaScript "hobbyist", I code Angular, Node etc... This thread has made me want to learn go, but following the official documentation I'm hardly failing.

Could you provide me some good written tutorial for doing my first steps and understanding the language better?
>>
>>46310575
https://gobyexample.com/
>>
File: Screenshot-29-01-2015-07-24-54.png (144KB, 1481x260px) Image search: [Google]
Screenshot-29-01-2015-07-24-54.png
144KB, 1481x260px
Write the same script in your autist language of choice that processes the first 9 pages on /g/, grabs 80 characters from the first post on each page and prints it out.

You must do it in 17 lines or less, without cheating by putting everything on one line, and it must be faster than 608ms.

Lets see you faggots back up your node bashing with some proof.

I bet you can't.
>>
>>46310575
Learn TypeScript first as an intro to static typing.
>>
>>46296379
Django and Flask power a shit ton of stuff you dolt.
>>
>>46311336
I'm taking your b8, man.
#!/bin/sh
for page in $(seq 9); do
curl -s "http://a.4cdn.org/g/$page.json" | jq -r '.threads[0].posts[0].com' | cut -c -80
done
>>
>>46306518
/me stabs you

people got offended
>>
>>46311919
Pffffffffffffffffffffff. Seriously?
>>
>>46309972
if value == special_case {
dospecial_case()
} else {
dodefault()
}

the trick is understanding that you don't want to call the dodefault function if you have a special case. The only alternative is
if value == special_case {
dospecial_case()
goto skipdefault
}
dodefault()
skipdefault:
>>
>>46311858
A parallel version that meets the speed requirement. It's also a "true" one-liner.
#!/bin/sh
seq 9 | xargs -L 1 -P 9 -I {} sh -c 'curl -s "http://a.4cdn.org/g/$1.json" | jq -r ".threads[0].posts[0].com" | cut -c -80' -- {}


$ time sh 4.sh
MPlayerX vs MPlayer OSX Extended. <br><br>I&#039;ve always used MPlayer OSX Exte
The /g/ Wiki:<br><a href="http://wiki.installgentoo.com/">http://wiki.installgen
I am currently working on simple keylogg in C here, it runs pretty smoothly thou
http://m.sweclockers.com/artikel/19<wbr>964<br><br>Seems like a new socket is co
/g/ i&#039;m sick of working on fucking stupid projects.<br>is anyone hiring on
ITT: Outdated technology
Can anybody get me working a office powerpoint 2010 product key? I need it for a
fuck you /g/ i decided to install Linux mint 17.1 cinnamon, on the basis that a
<span class="quote">&gt;...and this [&quot;Don&#039;t Break Userspace!&quot;] is
sh 4.sh 0.05s user 0.08s system 21% cpu 0.575 total


>0.575 total
>>
>>46296039
what's wrong with it?
>>
>>46311336
>talks about getting the first 80 characters
>gets 81
that's why I don't like javascript "developers"
<?php
for($iPage = 1; $iPage <= 9; $iPage++)
{
$aPage = json_decode(file_get_contents('http://a.4cdn.org/g/'.$iPage.'.json'), 1);
echo substr($aPage['threads'][0]['posts'][0]['com'], 0, 79).PHP_EOL;
}
>>
>not using phpjsâ„¢ for you're daily web development needs

/g/ is now full of plebs and I want to leave

https://github.com/kvz/phpjs
>>
>>46312138
>not checking if his code works correctly
>assuming substr in JavaScript works the same as in PHP
You are no better than he.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr
>>
File: >MUH SLOC.png (28KB, 535x719px) Image search: [Google]
>MUH SLOC.png
28KB, 535x719px
>>46311336
>>
>>46312138
>writing a script that returns 79 characters
Not sure if bait or retarded
>>
>>46312307
Now time a Python 3.x version for comparison.
>>
>>46312307
Neat.
>>
>>46312307
you could compress it even further by eliminating the empty lines and importing both items in the same line
>>
>>46312138
>>46312321
>PHP developers
>>
File: pages.png (156KB, 773x586px) Image search: [Google]
pages.png
156KB, 773x586px
>>46312138
>implying 9 file_get_contents calls run in less than 600 ms
>>
>>46311336
>>46311858
>>46312095
>>46312138
>>46312307
Not doing one single request to "http://a.4cdn.org/g/catalog.json", everyone fail
>>
>>46312419
>>46312427
Oh well.
>>
/g/ just hates web development in general.

PHP and JS are the most common languages used in web dev so they get the most hate here. They also seem to have some kind of issue with HTML as well. Not a programming language, but still.
>>
>>46312331
I would but gevent doesn't seem to work with 3.4 just yet.
Python "there's a package for that" 2.7 is still the best.

>>46312363
I know but as hinted by the last print I believe that the readability of a language is an important feature. I dislike JS for that reason.
>>
>>46312427
I thought the point was to make nine requests quickly.
>>
>>46312460
Is it possible to find an entry level CS job that isn't web development?

I got a Java certification thinking "Java's a big language, maybe now I can get a job" but every job listing I've seen is just for web dev and uses Spring or JS or something.
>>
>>46312531
One request is more fast and in the end you while have the same data.

Used to optimize my code.
>>
>>46312552
Web is the big thing right now so there's a lot of demand for it in the job market. Most of /g/ is unemployed so I think a lot of it is just sour grapes.

But hey, keep looking.
>>
>>46311336
Racket babby coming through.
#lang racket

(require net/url)
(require racket/format)
(require json)

(for ([i (range 9)])
(let* ([url (format "http://a.4cdn.org/g/~s.json" (+ i 1))]
[input (get-pure-port (string->url url))]
[post (hash-ref (first (hash-ref (first (hash-ref (string->jsexpr (port->string input)) 'threads)) 'posts)) 'com)]
[trimmed (substring post 0 (min 80 (string-length post)))])
(displayln trimmed)
(close-input-port input)))

Kinda slow though, there's probably a better way to make requests.
>>
>>46312824
Actually just noticed the (require racket/format) line can be removed.
>>
>>46311336
>muh async
(ns tmp.core
(:require [cheshire.core :as json]))

(defn get-post [i]
(let [data (json/parse-string
(slurp (format "https://a.4cdn.org/g/%d.json" i)))
post (get-in data ["threads" 0 "posts" 0 "com"])]
(if (> (.length post) 80)
(subs post 0 80)
post)))

(time (doall (pmap get-post (range 1 10))))

"Elapsed time: 376.285749 msecs"
("The /g/ Wiki:<br><a href=\"http://wiki.installgentoo.com/\">http://wiki.installgen" "Anybody have
any experience with Android tablets? Know of any good resources/rev" "Does Java have a native way to
play music files, like .mp3? Every solution I&#03" "AMD thread? AMD thread.<br><br>Discuss AMD the
300 series the next gen CPU&#039;" "Do you put your smartphones in cases /g/?" "About to try the Win
dows 10 preview, but<br>I&#039;m not into virtual machinery." "Hey /g/, can I just stay on Windows 7
forever?<br><br>I don&#039;t get these new" "Does /g/ use VPNs?<br>How much do guys trust services
like hide.me?" "<span class=\"quote\">&gt;...and this [&quot;Don&#039;t Break Userspace!&quot;] is")
>>
>>46312850
Functional programmers really are something else.
>>
>>46311336

>API Rules
>
>1. Do not make more than one request per second.
>>
>>46312961
>giving a fuck about the rules
>>
>>46312961
I wonder if these rules are ever going to be enforced.
>>
I like to invent my own language in my head for /g/ fizzbuzz questions

let url = "https://a.4cdn.org/g/{}.json"

foreach 1...9 (i -> {
let json = format url i >> Http.get >> Json.parse
print (json.threads[0].posts[0].com >> String.first 80)
})
>>
>>46306377
Not that hard, given all the better languages that appear from time to time.

User base is another matter.
>>
>>46313204
>foreach has an inclusive end
>arrays start at 0
lol gay
>>
Worse is better.
>>
Laravel API + Angular Frontend master race

How every single web application should be developed
>>
>>46313032
>>46313041
i actually never tried not throttling for 4chan api, so i though i would get throttled... who knew?
>>
PHP dinosaurs scared of the future.
>>
I actually like it. It's not bad for what it is.
I don't know how it scales for big applications though.
>>
>>46300251
Drupal is horrible. It is slow as fuck, the community is shitty and the conventions are horrible.
>2015
>Not writing your own CMS
>>
>>46313318
Angular can't even do
<{{tag}}>shit</{{tag}}>
and it's gonna require its own scripting language next version, absolutely disgusting.
>>
>>46313440
Why the fuck would you ever need to do that
>>
>>46313471
<audio>
and
<video>
have a lot of common properties, for example.
>>
>>46309486
I-I like mvc5 too... I also like visual studio, but I hide it in the dark, behind muh GNU/LInux and vim and flask.
>>
I recently tried React.js
for some small application and rather enjoyed writing it.
At least facebook did something good I guess.
>>
>>46312961
fuck the police
>>
>>46313509
facebook labs is actually pretty good
It's a natural consequence of having lots and lots of money to pay competent people with
>>
>>46313505
What does that have to do with anything
>>
>>46313574
>good
>allowing all Unicode thingies ever as names in HHVM based languages

pick one
>>
>>46311336
>var pages = [1,2,3,4,5,5,6,7,8,9];
>>
>>46313767
This isn't a problem, esp. if they do unicode normalization at parsetime
>>
>>46310469
In es5 you can use Object.setProperty to change different... properties (I guess?) of a property.

For example, you can use
for (var prop in obj) {
to enumerate over the properties of an object, but you can set the enumerability of a property to false, where it exists on an object, but won't show up in a for..in loop (an example is a function you would like to add to an array or map)

You can also do read only or treat the property as a getter setter combo. You can also set configurability to false, meaning no one can futher modify the property's enumerability, getter setter, etc.
>>
>>46313893
It's obviously a troll though
>>
>>46313930
And then have similar looking characters that can't be normalized because they have nothing to do with each other. Or even exploit normalization. Or exploits incomplete normalization libraries. Or fuckwhat.

Unicode is a piece of shit compromise and shouldn't be used in code.

Maintenance might become a nightmare and anyone who thinks normalization solves that is a fucking moron.
>>
>>46314142
>Unicode is a piece of shit compromise and shouldn't be used in code.
*apart from literals
>>
>>46311336
import http.client, json, threading
def printPage(p):
conn = http.client.HTTPConnection("a.4cdn.org", 80)
conn.request("GET", "/g/{}.json".format(i))
result = conn.getresponse().read().decode("utf-8")
print(json.loads(result)["threads"][0]["posts"][0]["com"][0:79])
threads = []
for i in range(1, 11):
t = threading.Thread(target=printPage, args=(i,))
t.start()
threads.append(t)
for thread in threads:
thread.join()
[/thread]
IDK much about Node.js, but I guess this "Promise" parallelize requests, so I used threads to simulate it. Still smaller lol.
>>
Something will eventually (read: soon) kill it off just as its killing off RoR.
>>
>>46296145
Assembler.
>>
>>46314606
import http.client, json, threading
def printPage(p):
conn = http.client.HTTPConnection("a.4cdn.org", 80)
conn.request("GET", "/g/{}.json".format(p))
result = conn.getresponse().read().decode("utf-8")
print(json.loads(result)["threads"][0]["posts"][0]["com"][0:79])
threads = []
for i in range(1, 11):
t = threading.Thread(target=printPage, args=(i,))
t.start()
threads.append(t)
for thread in threads:
thread.join()


lol, fixed, idk how it even ran with the ".format(i)" bit, i think i didn't save the file.
>>
>>46311336
my shitty scala solution

import argonaut._

object G extends App {
(1 to 9 par) map { n =>
val json = scala.io.Source.fromURL("http://a.4cdn.org/g/" + n + ".json").mkString
val c = Parse.parseOption(json).get.hcursor
val post = ((c --\ "threads" \\) --\ "posts" \\) --\ "com"
for (elem <- post.focus; text <- elem.string)
println(text take 80)
}
}
>>
>>46314606
>I guess this "Promise" parallelize requests
Promises serialize requests. node does blocking things in parallel by default.
>Still smaller lol
Except it's not, and the original one is implementing a timer that you neglected completely.
>>
>>46314762
technically it could all be on one line

import argonaut._

object G extends App {
(1 to 9 par) map { n => println((((Parse.parseOption(scala.io.Source.fromURL(s"http://a.4cdn.org/g/$n.json").mkString).get.hcursor --\ "threads" \\) --\ "posts" \\) --\ "com").focus.get.string.get.take(80)) }
}
Thread posts: 236
Thread images: 20


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

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


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