[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: 35
File: 1446412176192.png (1 MB, 1702x2471) Image search: [Google]
1446412176192.png
1 MB, 1702x2471
Last thread >>55163904
Searched for wdg to find the last thread long dead and buried so I guess I'll 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/
[YouTube] Crockford on JavaScript - Volume 1: The Early Years (embed) 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/ (embed)
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/ (embed)
>How to get started
[YouTube] WATCH THIS IF YOU WANT TO BECOME A WEB DEVELOPER! - Web Development Career advice (embed) - "WATCH THIS IF YOU WANT TO BECOME A WEB DEVELOPER! - Web Development Career advice"
[YouTube] Javascript is Easy (embed)) - "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
>NEW!
https://www.openshift.com/
>>
File: tumblr_o4ihdbOKAQ1se3pgko1_540.png (169 KB, 540x601) Image search: [Google]
tumblr_o4ihdbOKAQ1se3pgko1_540.png
169 KB, 540x601
>>55200812
In ruby, I'm trying to prevent users from adding someone as a friend if either one of them has the other on their ignore list.

In the friendships controller, I'm trying to define

class FriendshipsController < ApplicationController
before_action :ignored_user, only: :create


And

  def ignored_user
if current_user.foes.include?(@user)
flash[:notice] = "Unable to send friend request."
redirect_to :back
end
end


All of that seems to work except the "if current_user blah blah" line. If I replace it with "if current_user.admin?" then it works exactly as you'd expect. If that user is an admin, they can't send anyone friend requests. If I replace it with "if current_user.id == 2", it also works as you'd expect. I've tried replacing the faulty line with many variations of the above code, including things like
if Disagreement.where(foe_id: [@user, params[:id]], user_id: [current_user, params[:id]]).first

(which works elsewhere, just not here).

Any help would be greatly appreciated.
>>
I have a webpage that includes multiple JSP files. In one of those files, I have a JS function that I want to run after the entire page one of the JSP files is contained within loads. If I use $(document).ready, the code runs when the individual JSP loads and not the whole page. Any ideas on how to work around it?
>>
File: 1462365270806.png (72 KB, 211x244) Image search: [Google]
1462365270806.png
72 KB, 211x244
>>55200812
>(embed)
>>
File: 1466510863941.jpg (16 KB, 320x320) Image search: [Google]
1466510863941.jpg
16 KB, 320x320
>>55201303
how autistic do you have to be to notice
>>
How can a website deny me access without banning my IP?

I am forging my headers but it says the target machine actively refuses. I'm not banned from the website since it works on a normal browser.

Really bizarre.
>>
File: 1444197554223.png (72 KB, 300x249) Image search: [Google]
1444197554223.png
72 KB, 300x249
>>55201340
If you saw the OP for some times you'd know something is wrong.
>>
>>55201340
>[YouTube] Crockford on JavaScript - Volume 1: The Early Years (embed)
autistic enough to want to watch the youtube video, I guess
>>
>>55201303
This is what happens when we let a weeb make the thread
>>
File: 4I9nPyY.jpg (51 KB, 640x640) Image search: [Google]
4I9nPyY.jpg
51 KB, 640x640
I feel like I should get an Angular and a React project in my portfolio, but the problem is that I'm still not sure when to use them.

I think React is for the sort of "web-app" thing, where you want a web page that's highly interactive, but Angular(2) still has me confused.
>>
>>55201775
Funny, I'm slogging my way through the Angular 2 tutorial right now. Never touched Typescript before. Not sure how I feel about it.

I hear React is simpler, but I really want to get through this and build an AngularFire app.
>>
post your home/new tab pages. i want to make one but need inspiration.
>>
>>55201775
They're just front-end frameworks that utilizes RESTful api's to deliver data. at least that's what I've been doing. Think of it just a single page web application.
>>
Are there any good node competitors to wordpress?
>>
I think I got ignored in another thread so here:
I don't know javascript but I've been messing with this:
https://ghostbin.com/paste/a5kxj
How do I set this off manually?

      sendICECandidates: function (a) {
for (var b = 'id=' + encodeURIComponent(this.clientID), c = 0; c < a.length; c++) b += '&candidate=' + encodeURIComponent(JSON.stringify(a[c]));
this.sendPOST('/icecandidate', b)
},



How do I see the values of

WEB_RTC_CONFIG = Object { iceServers: Array[1] }



Thanks.
>>
File: Screenshot_2016-05-06-13-53-07.png (126 KB, 1080x1920) Image search: [Google]
Screenshot_2016-05-06-13-53-07.png
126 KB, 1080x1920
I want get into web dev, I already know python. Where can I find a good tutorial on flask? Flask is really compact, unlike Django.
>>
I want get into web dev, I already know python. Where can I find a good tutorial on flask? Flask is really compact, unlike Django.
>>
>search "junior front end" in philadelphia on indeed
>less than 3 junior front end jobs
>search same thing on stackoverflow jobs website
>0 jobs
>search same thing on dice
>less than 5 jobs
>monster
>1 job

Am I not searching right? Where are all of the job postings?
>>
>>55204386
>Where are all of the job postings?

India
>>
Just started learning PHP. What an absolute fucking mess.

If I want to write a <p> tag with a php variable in it, is there a less disgusting way than this?

[CODE]"<p>number: ".$n1."</p>";[/CODE]
>>
>>55204966
"<p>number: ".$n1."</p>";
>>
>>55202085
There never will be. Wordpress' domination comes from the fact it runs on every shitty GoDaddy account, and that there's two billion shit tier devs writing plugins.
>>
>>55204980

[CODE<?php
$n1 = 1;
echo "<p>$n1</p>";
?>[/CODE]

so no not really.
>>
>>55205071
[CODE]<?php
$n1 = 1;
echo "<p>$n1</p>";
?>[/CODE]
>>
>>55204386
>front end

>>55204966
"<p>number: {$n1}</p>";
However, you are fucking retarded to send back HTML from your controllers. Get a proper front end framework and send back JSON instead.
>>
>>55203773
Try https://www.amazon.com/Flask-Web-Development-Developing-Applications/dp/1449372627
>>
>>55201512
They probably gave you a unique session ID and blocked that.
>>
>>55205107
>Get a proper front end framework and send back JSON instead.
desu this is retarded
communications on the internet work by a client making a request, and the server sending back a response
there shouldn't be a "front-end framework" doing anything here.
>>
>>55205107
>However, you are fucking retarded to send back HTML from your controllers. Get a proper front end framework and send back JSON instead.

You're making it unnecessarily complicated, people who use frameworks for everything are the problem
>>
>>55205071
Oh, so I don't need to separate out HTML and variables? That'd be useful.
>>
>>55205107
Look, I'm new to this. And I don't exactly plan on taking PHP further than this course requires.
>>
>>55202501
1) Paste expired
2)
WEB_RTC_CONFIG = Object { iceServers: Array[1] }
isn't even JS.
>>
Is Jade/Pug worth using? What's the benefit?
>>
>>55205477
Slow as fuck. Just use ES6 template strings or DOT.js
>>
Holy FUCK webdev is such a pain in the ass, I don't want anything to do with it as soon as I'm done changing my 4chan css
>>
>>55205513
Is this dot? https://github.com/olado/doT
>>
>>55205580
Yes, that. But you might want to take a look at https://garann.github.io/template-chooser/
>>
File: 1433099140658.gif (51 KB, 500x376) Image search: [Google]
1433099140658.gif
51 KB, 500x376
Which will be more likely to get me a job? C#/.net and SQL or Java and SQL?
>>
How much do websites cost?

A guy asked me that If I could make him small website and I said "400€ + you will provide all the images and text content"
Am I asking too much?
>>
>>55205432
http://www.omegle.com/static/omegle.js
>>
>>55203723
flask website?
>>
I want to change the color of my navbar when you scroll to certain parts of my page. what jquery events would I be triggering on? is there something like "when this element is on the page"?
>>
>>55207741
try .scrollTop
>>
>>55207741
google "change css when reach point on page" and you'll find stuff
>>
>>55207908
thanks
>>
File: Capture.png (53 KB, 846x469) Image search: [Google]
Capture.png
53 KB, 846x469
this should DEFINITELY be working

why isn't it? do you think it has to do with the cookies?

http://pastebin.com/mZy6scN5
>>
how do you track state changes in redux store and update the relevant react components?
been trying componentwillrecieveprops with no luck so far
>>
File: 2016-06-22-18:30:34-scrot.png (193 KB, 1280x800) Image search: [Google]
2016-06-22-18:30:34-scrot.png
193 KB, 1280x800
Who /dankmemes/ here?
I just GPL'd my javascript so it works in LibreJS.
>>
>>55208715
>librejs is addon for browser
If it was javascript library providing abstraction using only "libre js" then I would be interested, that library could even stop working when "non free js" is in the code.
To limit myself to a subset just because, seems fucking retarded
>>
Trying to fix an html page for someone.

There's a line <br /></span></span></span></p>

I want it to be <br /></span></p>

Every time I change it and update it, it reverts back by itself. I'm retarded, sorry.
>>
do you guys write tests? is this the standard practice?

i'm working for some small company. they don't write tests. they release code every day without running tests or doing anything to ensure it's alright. is this common? is this the shittiest company ever?
>>
>>55208715
>mfw my JavaScript works even in IE5
Well, it almost works, arrow keys and base64 embedded images don't work there.
>>
Can someone explain what does "=>" mean in the following code ?

@using (Html.BeginForm("AddWithHTMLHelperAndModel", "User", FormMethod.Post))
{
@:UserName : @Html.TextBoxFor(m => m.username)
@:Age : @Html.TextBoxFor(m => m.age)
<input type="Submit" value="Submit">
}
>>
>>55204386
>also in philly
>just started actually digging into webdev about a month ago
please don't kill the only hope i have left, anon
>>
>>55203723
There's a flask tutorial somewhere. I just did the very basics and started my own project. No need to learn shit like wtf-forms
>>
>>55203723
>http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
>>
After like a fucking week of working on this, I think I may have actually created a version of this form that doesn't look like absolute bullshit.

Am I correct?
>>
>>55210729
Have a screenshot with slightly more context, actually
>>
>>55210778
>All of that wasted vertical space on the screen
I hope that people like you die in a fire
>>
File: 1415776918450.gif (4 MB, 270x263) Image search: [Google]
1415776918450.gif
4 MB, 270x263
>>55210872
>Previous iteration was full width
>Everybody says "No, it's too wide, make it thinner"
>Make it thinner
>"Holy shit, wasted space, please die"
>>
>>55201775
>I think React is for the sort of "web-app" thing, where you want a web page that's highly interactive, but Angular(2) still has me confused.
React is not interactive, it only handles the view
>>
>>55210872
>>55210905
How the fuck would that ever work on today's wide resolutions? 1440p? 4k? Ultrawide? Literally nobody is doing 100% width websites.
>>
>>55210905
>/g/ is one person
>>
>>55210905
Either spread it out or keep it that thin but lose that white space, extend the background to the full page
>>
>>55210729

what the fuck nigger
>>
>>55211262
The breaks in background are important, though. It shows different sections of the form.

Designing this has been such a fucking bitch.
>>
>>55211328
At least change it to off-white then
>>
>>55211328
It is off-white. It's #f0f0f0
>>
Every time I look at Angular I feel glad that I dodged a bullet and used React instead
>>
Starting to learn js and have a simple question. Does the code always run or read from top down no matter what? Like, does it always run in that exact order?
>>
>>55211403
No, because callbacks exist.

console.log("first");

setTimeout(function() { console.log("third"); }, 500);

console.log("second");


You'll find that a lot of JS libraries are based around handling events.
>>
>>55211337
Fuck, >>55211378 was meant for you.
>>
File: 1461770199156.jpg (26 KB, 221x221) Image search: [Google]
1461770199156.jpg
26 KB, 221x221
>>55200812
Say you have two controllers in ruby, one for users and one for friendships. @user is defined and most often referenced under the show action in the users controller. Ignore lists also exist, which should prevent users from adding someone as a friend if either user is ignoring the other. Under the friendships controller, how can you reference @user to specify "don't create this friendship if @user is ignored by current_user (the user who's logged in and trying to add someone as a friend) or vice versa"? No matter what I try, this always fails because the friendship controller can't figure out what @user is. It always returns nil, even if I redefine @user under every single action in the friendship controller. What should I do? And sorry for the dumb question, you can probably tell I'm new.
>>
Is there a better way to override bootstrap's styling besides using "!important" on everything?
>>
>>55211732
How are you defining @user?

If this is a nested route, you should be able to do:

possible_friend = User.find(params[:user_id])
if current_user.is_ignoring? possible_friend
# do some shit
else
current_user.make_friends_with possible_friend
end


Or something similar.
>>
File: trumpsolo.gif (1 MB, 422x281) Image search: [Google]
trumpsolo.gif
1 MB, 422x281
friends, i have done it. i have finally written my own bit of js that isn't part of a codecademy course. feast your eyes on my masterpiece.

var yourAss = function() {
var answer = prompt("Is your ass FAT or NOT?");
if (answer==="FAT") {
confirm("nice!");
} else if (answer==="NOT") {
confirm("fuck off");
};
};

yourAss();
>>
>>55212037
nice. Now make it with html buttons and shiet
>>
File: 1461630593102.png (63 KB, 400x250) Image search: [Google]
1461630593102.png
63 KB, 400x250
>>55212033
It's funny you mentioned that. I was just about to leave for awhile, but I wrote a note in a text file telling me to try to define something like "current_user.ignored_or_ignoring" after I got back. (@user.foes is defined elsewhere and works, but won't work in this controller since it doesn't recognize @user.) Since you say that should work, I have high hopes that it will. Thank you!
>>
>>55212103
No it wont.

If @user is nil you're still fucked. Please copy and paste the code defining @user
>>
>>55212145
But if I define current_user.is_being_ignored_or_is_ignoring in the helper method that allows current_user to be used in the friendships controller in the first place, won't it be fine? I've confirmed that things like "if current_user.admin?" and "if current_user.id == 1" make the friend requests fail when they should. But anyway,

@user = User.find(params[:id])
>>
Say I wanted to automate a task I hate doing.. It needs to do the following:
1. Check a youtube/vimeo channel for a new video
2. Rip audio
3. FTP the file to a server
4. Go to a site and fill out some forms

I'm well aquainted with JavaScript, but what language or program can I use to create this task automation?
>>
>>55212145
I just tried it your way in a few different ways, and none of them worked. (In hindsight, I realize I've already tried them before, but I've tried so many things [30+] that it's easy to forget.) The same error message comes up whenever I try defining @user anywhere (or even EVERYwhere) in the controller:
Couldn't find User with 'id'=
So I guess defining current_user.either_ignoring as a helper method, which should hopefully make it available in the friendships controller, is the only thing left I haven't tried.
>>
>>55211786
Manually edit the css and dont use a cdn.
>>
>>55212223
YouTube API and https://www.youtubeinmp3.com/api/

EZ
>>
>>55212223
Node and React or something. Mostly Node, don't know if you'll need a front-end framework for this.
>>
A company is paying me $17 an hour to learn Laravel as an intern.

Is this the promised land?
>>
>>55212804
You're making it. Work hard.
>>
>>55212804
Getting paid for learning?
God how is that possible?
>>
>>55213201
I don't even know what they get out of it besides maybe two or three internal systems that they were needing done.
>>
>>55204386
>Where are all of the job postings?
In the bay. I found dozebs of junior front end positions in the bay with very minimal requirements

Crash soon however.
>>
It seems like every thing I've read and learned just jumps into it with HTML/CSS. Any good resources to actually learn about browsers and what they do?
>>
>>55213420
where did you find those?
>>
>>55213420
>Crash soon however
pls NO. is web dev still going to be a viable career path in a year's time?
>>
>>55213431
What do you mean learn about browsers? Read about HTTP and you will understand just fine how browsers work outside of rendering.
>>
The senior developers in the company joined puts business logic in controllers and do not give a fuck about decoupling in general. Should I just do what they do?
>>
>>55206154
rip
>>
>>55213581
If you aren't a senior dev then no, stay in your lane.
>>
>>55213736
Do I bring it up at all or will I sound like a massive tryhard turbo autist?
>>
>>55213763
When you become a senior developer, you can make architectural decisions in the project. Let them be and do your work according to their instruction.
>>
Does anyone else have trouble maintaining self taught info. I can only read so many tutorals.
>>
>>55213581
What is business logic, and what is wrong with this. For example, I am creating a web app where the controller checks passwords against hashes from the db. Is there anything wrong with this. I'm pretty nooby
>>
>>55213891
>what is business logic
>is writing a web app

What?
>>
>>55212381
>>55212193
That error means that your params[:id] is empty, or not a valid user id.
>>
>>55214466
Yeah, that could be it. Any idea on how to fix it? This is the only instance I've run into where this breaks. I've even tried redefining this method in the application controller itself, which the friendship controller inherits from, and it's still not recognizing @user, @user.id, etc. despite that.

When I change ".find" to ".find_by" it gets one step closer to working, except, no matter what, according to the console, @user.id is always 1, regardless of whose profile I was on when I clicked the Add Friend button.
>>
What do your routes look like?
>>
>>55214817
Depends on the traffic really. If its earlier in the day, say around 10-3 I can drive pretty much anywhere without hitting too much traffic. Anywhere between 7-10 AM and anytime after 3PM is a nightmare, sheesh. The roads aren't great either, which causes things to move slowly.
I don't usually go out at night though.
>>
>>55214510
Fuck

See >>55214817
>>
I started to love Javascript but nowadays, the more I learn about it the more I hate it.

Reading about Promises has been the saddest thing I have done today. How did this abomination come into existence? How did they allow a need for something such as this to develop
>>
>>55213869
It's a struggle anon. I usually try to do a tutorial once, then go back over it again slowly, and I fiddle and experiment with the new code on each step to really gain an understanding of it. Otherwise I would just go through it once and decide I knew it, but then get stumped again as soon as I tried to build something. You really have to take it slow.
>>
File: Routes.png (23 KB, 483x232) Image search: [Google]
Routes.png
23 KB, 483x232
>>55214986
>>
>>55215033
>ruby

How's the language nowadays? I kind of lost touch after Ruby 2.0.
>>
How would you go abut doing a simple 2D game engine using JS?
>>
>>55215033
If you're using
resources :friendships
, that controller is in no way related to Users. The id in params[:id] should refer to the id of a friendship, not a user.

Try to use nested routes.

>>55215051
It's quite good! The new stuff in 2.3 (nilsafe navigation operator especially) was great, and it's significantly faster now.

>>55214996
Use async/await. It's worth the compile times, trust me.
>>
What stack do you use /wdg/?
>>
>>55215133
React/ES6/SCSS/Rails/Ruby/Postgres
>>
>>55204386
>Where are all of the job postings?

Not in Philadelphia. There's not really a tech scene there.
Source: I am from there and moved for work.
>>
>>55215108
There's a bunch of options. I did a tiny project in Phaser and it was mostly painless
>>
File: 1446611361009.jpg (134 KB, 800x600) Image search: [Google]
1446611361009.jpg
134 KB, 800x600
>>55215051
Sorry, I have no idea. I'm an absolute novice.

>>55215127
Thanks! I need it to refer to a user somehow. Do you have any tips on how nested routes work? Like, is there something I can change about the routes to make the friendship controller recognize that params[:id] refers to a user, not a friendship?
>>
So I posted about this as this horror was unfolding before my eyes yesterday. I was having trouble with my startpage that was previously working just fine, after tinkering around with it a bit I found the problem...the html and css had blanked themselves.

I was able to recover the html, but I had to start the stylesheet from scratch, luckily it wasn't anything too complicated.

Is there anyway I can ensure this never happens again?
>>
>>55215247
Read http://guides.rubyonrails.org/routing.html all the way through.

You want params[:id] to refer to a friendship, since you will eventually be doing other operations (deleting, etc) on a friendship. So you want something else in your params hash to refer to a user upon creation.

You don't even really need to use nested routes. You could instead put a form on the show action of your users controller that looks like:

<%= form_for Friendship.new do |f| %>
<%= f.hidden_field :friend_a_id, value: @user.id %>
<% end %>


Which would go to the create action of your friendships controller.
>>
>>55215108
Why is everyone utterly obsessed with idiotic game engines? You'd have programmed the game already if you had forgotten about them and simply wrote the goddamn game.

>>55215127
Yeah async/await looks much, much better than the idiotic promises thing, but the thing reeks of a deeper problem: the entire notion of an event loop.

The goddamned event loop plagues every single line of code we write in Javascript because who knows what pieces of code will be slow enough to block the loop. Suddenly, idiotic hacks like endless callbacks and promises somehow start making sense because you need to fragment the hell out of your code so that they can all be processed over many event loop ticks.

The best solution is to use worker threads because long computations are just like I/O anyway. But hell will freeze over before stuff like Node actually supports something like that. That bunch seems to have visceral reactions to the word "thread"

>Ruby
>nilsafe navigation

That's one hell of a good news. Now the Haskell wanna-bes can finally go away, taking their Monad wrapper types with them. They were so annoying, forcing that shit on everyone

>performance

Man I used to love exploring YARV codebase back in the day. It was becoming a very respectable execution engine back then, must be interesting now!

I looked up news and there are hints of gradual typing for Ruby 3.0, that was awesome. But will they ever fix rubygems? Python has it beat when it comes to the module abstraction.

>Ruby 2.4 preview

They got rid of {Fix,Big}num! WTF! Some slightly better unicode handling that's still fundamentally broken on so many levels. Yawn. It casemaps semi-correctly now. Well not like any other popular language is any better.
>>
>>55215286
Use

Fucking

Version

Control

https://www.atlassian.com/git/tutorials/
>>
>>55215322
What were the problems you had with Rubygems?
>>
>>55215322
>Why is everyone utterly obsessed with idiotic game engines
Maybe because I want to learn how they're made, making a game is not my main goal for this.
>>
File: 1462978193034.jpg (74 KB, 540x304) Image search: [Google]
1462978193034.jpg
74 KB, 540x304
>>55215311
Oh, I've already created friend requests, friendships, the ability for users to delete friend requests from other people, the ability for users to change their minds and delete their own friend requests to other people, the ability for either user in a friendship to delete the friendship, and the ability to accept friend requests, among other things! But somehow, I need to be able to refer to a user's ID within the friendship controller so that this will work:

>before_action :non_ignored_user, only: :create

I want to restrict user1 from creating a friendship with user2 in the event that either one of them is ignoring the other one. Since no friendship will exist under these circumstances (users can't send friend requests if a friendship already exists between them) and I don't want one to exist (since one or both users are ignoring each other) I don't need to refer to the friendship in a more advanced way than I already understand. But I definitely do need to figure out a way to refer to @user or params[:id] in regards to a user in the friendships controller.

All that being said: what's the f.hidden_field thing you showed me, and what does friend_a_id refer to? I've succeeded in hiding the "Add Friend" button if either user is ignoring the other, but to me, that's not good enough since people could still manually get around the ignore by adding /friendships?friend_id=[their ID here] after that user's URL, and I don't want users to be able to harass others by spamming them with friend requests even after they've been ignored.

Also, is it possible to fix this problem by editing the routes somehow? And thank you! I appreciate all this advice.
>>
>But somehow, I need to be able to refer to a user's ID within the friendship controller so that this will work:

Use some sort of alternate param. You can get params into your controller via form data or URL parameters.

>before_action :non_ignored_user, only: :create

I would make this a validation on your model.

>All that being said: what's the f.hidden_field thing you showed me,

Generates an
<input type="hidden">
form tag.

>and what does friend_a_id refer to? I

A hypothetical parameter on the friendship model.

>
/friendships?friend_id=[their ID here]


If you're already generating that url, you can get the
friend_id
from
params[:friend_id]
, as you're passing it in as a query parameter.

What tutorial are you using for this? Your questions indicate to me that you're probably using a shitty one. Not that you're stupid, but the way you're asking questions is suggesting that you're learning things in (what I think is) the wrong order.
>>
my job is making me run Javascript on JVM for their company AI. it's an abysmally shitty combination that makes the whole job a lot harder without any benefit.

Is there any way for me to get around this so I can use the basic goddamn JS methods? I can't install anything else on their server
>>
File: tumblr_o2jz048Cz01tv4vo6o3_1280.png (111 KB, 542x524) Image search: [Google]
tumblr_o2jz048Cz01tv4vo6o3_1280.png
111 KB, 542x524
>>55215485
>I would make this a validation on your model.
I tried, but I never figured out how to make it work. The extent of my validation knowledge is validates :friend_id, presence: true

>If you're already generating that url, etc.
Oh my god, you're absolutely right. That sounds like it should work since friend_id is exactly the same as @user's ID in every single case, and I can't think of a reason why the friendship controller wouldn't be able to understand friend_id. Thank you so much for this and everything else!

The initial tutorial I used was this: http://www.tobyh.com/thoughts/4 I first found it and did everything it said about three weeks(?) ago. At the same time, since it wasn't working out for me (after following it, users could send friend requests, aaand... That was it, haha. Accepting them didn't work and deleting them didn't work), I also used as many other relevant tutorials/Q&As on other sites as I could, along with editing all of that stuff to the best of my own abilities. And it's okay, I am pretty stupid when it comes to programming, and I'm almost certainly learning things in the wrong order.

I'd be happy to chat with you some more about all this, but I'm going out for groceries before the stores close, so I'll be gone for awhile. I'll try implementing your solution as soon as I get back home.
>>
>>55215340
One problem I have with it is rubygems isn't really part of the language.

I realize it's implemented this way because it's too expensive to change now that everyone adopted it, but still, it's unpleasant. There's no real concept of a gem or a module or anything of the sort. It's really just a bunch of files. A gem is literally a tarball with YAML metadata.

You require a gem. You're really just loading that gem's lib/<gem-name>.rb file in the most direct way possible. That file will then load all ruby files within the source tree, often without regard to whether they actually depend on the file or not. It's not very DRY. There is no isolation; the whole gem thing gets imported into global Ruby VM state and everything but local variables seep outside the file scope. You can't pick and choose. You don't get a nice API-in-an-object like in Javascript. It's an uncomfortably thin abstraction on top of the load method, which should sound as sane as reading all the files in a gem's manifest and straight up evaluating them. Rubygems is nearly nothing but a glorified PATH management system with a package manager on top

This is fundamentally different from Python's import. You can say from x import y, z and you will have imported exactly y and z from x. There's special syntax for this. Python understands the module you're importing, and allows you to import just x and y and leave the rest out. You can even use as to import things with different names. Modules are part of the language

I think Ruby is a better language than Python as far as design is concerned, but in this particular area they failed hard. At least we know where this stupid design came from: Scheme. Ruby got a lot of good qualities from Scheme, but this isn't one of them. This is the exact type of epic fail that standard Scheme displayed; its module system was non-existent and the herculean efforts to implement one didn't matter because implementations solved the problem themselves.
>>
>>55215108
Try the game project on EloquentJavascript.com. There's a tutorial
>>
Let's talk jobs.

Every job here is for WordPress dev.

No idea why, just is. Pay is 65k too.

Should I go from LAMP/LEMP to WordPress or move to MEME stack and pray for startups?
>>
anyone know a sublime package that will syntax highlight both html and the js code inside the html?
>>
>>55212037
It's beautiful
>>
how gay am I for not returning proper status codes but instead a body with all the data you need
>>
>>55215921
what's so hard about using proper http statuses?
>>
>>55216129
the need for my shit app to work as fast as possible
the lack of time to fix old code with http status codes
the lack of will to live
>>
>>55215597
I can agree with this, to some extent. I came from the C/C++ world, so I was used to having everything be loaded at once from the onset.
>>
File: ss+(2016-06-22+at+10.06.35).png (31 KB, 713x294) Image search: [Google]
ss+(2016-06-22+at+10.06.35).png
31 KB, 713x294
>>55215485
>>55215594
>>
How difficult would it be to roll your own CMS from scratch? Nothing major, just a very basic one.
>>
>>55216613
What is this?

Looks beautiful.

That Python?

Fuck, that's sexy.
>>
File: wG51k7v.png (66 KB, 597x255) Image search: [Google]
wG51k7v.png
66 KB, 597x255
>>
File: tumblr_n26iagfHhk1t2yvn6o1_500.gif (936 KB, 500x281) Image search: [Google]
tumblr_n26iagfHhk1t2yvn6o1_500.gif
936 KB, 500x281
>>55216686
I-I'm glad you like my spaghetticode, anon. That's ruby!

On rails!
>>
>>55216686
Also, the three "puts" lines were to output messages to the console to help me figure out what was going wrong, so you could remove those three lines and it would be fine
>>
>>55216702
Fucking kekked
>>
>>55216686
Check out Ruby m'friend. The syntactic sugar is sexy as fuck.
>>
>>55216702
you are drunk Java, go home, you are not Python
>>
>>55216632
If you know what the fuck you're doing (in your language of choice) it shouldn't take you more than a few days since its very basic.
>>
>>55216632
7/10 difficult
>>
>>55216561
#includes are actually better than Ruby's castrated require, which are almost as sad as Python's lambdas. In C, you have compile time errors. The compiler doesn't allow other people's code to trample all over yours with impunity. Conflicts are forced out of existence.

>>55216632
Ridiculously easy. Install a templating engine like Jade and write HTML5 templates. You can easily compose them into full web pages while avoiding repetition. Wire it up with a process that generates HTML5 and commits the files to git and you get free GitHub pages hosting.

This is good because you can provide rich structural markup and even RDFa metadata. Trendy markdown blogs will never, ever be able to do that. Why setup a motherfucking database when you can have the document itself serve as the dataset? Actual web servers are orders of magnitude more stable than some shitty trendy technology like Node.js.

If you ever need any dynamic shit, setup HTTP endpoints so you can communicate with your server using JSON. Call them from the client-side.
>>
>>55216884
Not bad, but you suggest a very specific approach that maybe doesn't match the anon's requirements.

Also
>Node.js
>shitty
>>
>>55216739
You don't say! What a marvel these 'puts' are, fine sir.
>>
File: 1459989836299.jpg (431 KB, 768x1024) Image search: [Google]
1459989836299.jpg
431 KB, 768x1024
>>55216930
S-Sorry, I'll go now
>>
>>55215779
Where do you live?

Anyway, here's what you're gonna do:
> get one of those shitty wordpress jobs for about a year to get experience
> Learn MEME stack on the side
> quit job
> go find a good job
> filter through the thousand proposals you are going to get
> cash in on startup money
> get addicted to hookers and drugs
> rehab
> repeat

I'm already on my 3rd iteration bro, step up
>>
>>55216686
Ruby.

Fucking amazing language.

>>55216739
Use the Rails logger instead of puts, by the way.
logger.debug
is functionally equivalent.
>>
>>55214980
underrated post
>>
>>55215779
While working at a LAMP shop, I learned MEAN on the side. Managed to get a job in it (kinda, it's a bastardized stack). But desu don't really feel passionate about working with people. Kinda sucks since I know it's just part of being a programmer but whatever.
>>
>>55217057
Well, you chose a profession that allows little working with people.

That said, it's hard to hit 100k unless you are a people's person.
>>
>>55215779
At least you have dev jobs there. There's no IT jobs here and getting money to move is difficult.
>>
Should I into Perl 5 or Perl 6? Is one more relevant than the other?
>>
>>55217104
Where do you live? Try freelancing bro
>>
>>55217089
Seems to be more of the luck of the draw. This team expects constant pairing and it's a little annoying. But yeah, I know it's definitely possible. Maybe better luck next time.
>>
>>55217117
South Texas. I'm working on it.
>>
>>55217116
Why do you want to learn any Perl at all?
>>
>>55217151
Not the anon you're talking to, but I actually just left working in San Antonio. There are definitely jobs there depending on what stacks you know. Still is a pretty big PHP place.
>>
>>55216921
He said he wanted to roll his own CMS. Truth be told, he really doesn't have to. And I don't mean using Wordpress or some other ridiculous PHP shit. I mean using an actual CMS, and that is git.

He wants to serve HTML5 content. He should do exactly that. What he shouldn't do is fuck around with PHP and databases and their endless bullshit. It's simply not necessary. He needs exactly two orphan branches in his repository: master and author. He authors templated HTML5 content in author branch, invokes a process that generates static HTML5 files, commits them to master, pushes to GitHub pages and away he goes.

Markdown bloggers make me sick. They worship that stupid technology as if it came out of God's asshole itself.

It is a mistake to use some stripped down blogging language that compiles down to HTML5. Because what you want to write is really HTML5. If W3 consortium wanted authors to design shitty, non-structured, non-accessible web sites that break in automated or text-only user agents, they would have designed HTML differently. But they didn't.

You really do want to use all the features the blogging language is hiding away. They're the difference between an average or even good website and a great one. Google notices it.

There is no reason to have some idiotic PHP hackup pull static data from some random database just to generate some static pages that won't ever really change unless the user himself updates them. It's just an endless source of headache; the thing goes down, you have to update it constantly, it's an attack vector, etc.

It's a much better approach to keep HTML5 as static as possible, and compose the pages out of reusable templates. Simple, almost timeless.

>node
>not shitty

It's in the same state Rails used to be, some kind of semi-finished state where features that should've been there from the start are only now being added to some developer's TODO list for some distant version of Node.
>>
>>55217188
I live in Corpus. I know people sometimes associate San Antonio with South Texas, but it's more central Texas/hill country to me. The area south of the San Antonio area is what I'm referring to.
>>
>>55216980
Sucks. No friends or family?
>>
>>55217104
I'm who you're responding to. I'm in North Texas. Come on up. Jobs everywhere for inexperienced people if you have a portfolio.
>>
>>55217197
> suggesting git as the data structure
Edgy. I mean, it could work, but why not use an already established static site generator? Most edge cases are already handled by them.

>Markdown
>non-accessible
Markdown is text, there is nothing more accessible than that. How you compile it to HTML depends on you.

> static blog
I agree on this one, there is very little need for a dynamic blog.
>>
>>55217250
Actually just kidding about the last part. I'm doing ok.
>>
>>55217258
When I get money to move.
>>
>>55217280
>> suggesting git as the data structure

I suggested git as the actual content management system, which is what git actually is: a content-addressable CMS. The point is to, well, manage the content.

Serving it is simply checking out master in the webserver's directory. Github pages does it for free.

>why not use an already established static site generator

Sure. Any templating engine suffices. This is the heart of any "CMS" out there anyway.

The point of the tool is to avoid repetition by taking advantage of the hierarchical nature of the document. He can literally pick any templating language. I chose Jade, but it really doesn't matter too much, it just needs to support composition of documents using various pieces

>Markdown is text, there is nothing more accessible than that

Nil metadata support and literally no structural markup support outside the most basic of elements. Somehow the idea that you can write verbose HTML markup inline isn't very reassuring.

The output of Markdown is simple, structurally poor HTML. It's got no metadata, no real structure besides the aforementioned basic elements. It's nothing but a bunch of lists and headers and paragraphs. Can't get more bread-and-butter than this. Beginner HTML5 authors will want to break out of this cage as soon as they read up on how Google's bots make use of page structure. Screen readers need this. Textual browsers need this. Also, the richer the document is, the more useful. Properly done, the document becomes a dataset that can be easily queried for information, unlike PDFs which are some kind of assembly language of documents.

I'm not saying you can't compile it to HTML. You can. I'm saying it's always a better idea to write HTML5 straight up.
>>
>>55214342
i'm an intern and they don't teach me shit. I have to do this all through tootorals
>>
PHP is so frustrating. It's like giving instructions to a retarded kid
>>
File: ayyphp.jpg (245 KB, 1024x680) Image search: [Google]
ayyphp.jpg
245 KB, 1024x680
>>55217494
>
>>
>>55217535
I'd gladly gouge my eyes out with that. I just don't want to deal with PHP anymore
>>
>>55217494
mysqli_real_escape_string_second_edition_serious_this_time_2
>>
>>55217617
They deprecated that one
>>
>>55217617
queque
>>
File: queque.jpg (75 KB, 570x330) Image search: [Google]
queque.jpg
75 KB, 570x330
>>55217664
>>
>>55217699
Hemos encontrado al latino. Apuesto a que programas cobol
>>
>>55217745
Gracias a Dios COBOL ya es muy viejo incluso para Chile, acá Java es el estandar y Python es """innovador""".
>>
>>55217765
Interesante, Python esta bastante bien. En Uruguay estamos mas del lado de Ruby y Node.js.
>>
>>55217805
Ruby se usa moderadamente por acá, pero extrañamente node.js no es nada popular
>>
>>55217211
Why don't you learn the MEAME stack or ruby/rails stack and move to Austin?
>>
>>55209124
That you bohrmeista?
>>
What would be a good under $500 thinkpad for programming(aka installing linux)? I am on the market for a decent laptop to practice my linus skills. I don't need it to be a super computer cuz I already have a battle station, I just need something to take with me just in case I gotta keep working on a program on the go. Thanks i n advance.
>>
How do I avoid XSS and SQL injectiosn?
>>
>>55219423
Sanitize input
>>
>>55219443
How? Suppose a user sends a script into a comment, how do I display it like it was typed?
>>
>>55219450

>>55219443
>>
>>55219450
It's a big question, depends on certain things like what your site is built with, and has no single easy answer

I suggest you research it
>>
I'm trying to build a program with electron-shell but I can't work out how I want to store data.

The application will track details on a day to day basis, but a user should be able to edit the data from past days.

Does anyone have any suggestions?
>>
>>55201775
>>55201792

AngularJS is so much comfier than Angular2. Attach a <100Kb file, insert a module into the script file, a few tags into html and you're good to go. I don't know why they've named it Angular2 when it's far from what AngularJS initially was.
>>
>>55220247
What are the clear advantages even? I can't figure out what's supposed to be so great about 2
>>
The backend link in the OP doesn't work.
>>
>>55220640
That's what happens when you let weebs make the thread
>>
I know Python so-so. From what I can start learning Flask framework? Tutorial from Miguel outdated(some modules already is update and don't work as it must in tutor)

Thanks.
>>
Can someone tell me why z-index in CSS doesn't actually fucking work?
If I set the z-index for something to be 1, then set another thing to be z-index of 10, then shouldn't the second appear above the first without question?
I can't get this shit to work.
>>
>>55220810
Weebs always make the thread.
>>
>>55221036
Try the official Flask webpage then. And after that, the official page for each module you want to learn.
>>
>>55221511
Butt... i'm beginner
>>
>>55221548
Then do Miguel's tutorial installing the modules with specific versions, and after that, learn what's new on each of those and try to figure out why they aren't working.
>>
>>55221453

even with position: relative ?
>>
>>55221608
Do I add that to both elements?
>>
why does my background image not scale correctly on my shitty android phone's chrome? I've got the meta tags and shit for mobile.

excuse the shitty meme site I'm working on
>>
>>55223332
also why the fuck do I need to manually override chrome's shitty form styling? I should just restrict access to my site based on useragent desu.
>>
>>55205650
My own experience: C#/.NET plus SQL.
But there's good market for Java/SQL too.

>>55213800
Thank you. Senior devs acknowledging newer dev suggestions are not the norm (I do listen to my kouhais tho).
Even if you are right I'd be bothered if you go full autist on it.
>>
>>55217617
>>55217535
kek
my bachelor's thesis was about improving an internal uni system built on php. it was a headache but at least the previous team had used a framework so it was less retarded.
> tfw a full complex page built by echo concatenation and eval
>>
What are for loops and arrays even used for in building websites?
>>
>>55223546
probably a dumb question but what is eval? how were they using it to make a page?
>>
>>55205071
<?php
$n1 = 0;
echo "<p>".($n = 1)."</p>";
>>
>>55220311
>>55220247
Different anon here, please redpill me on Angular2.
Been using Angular and I agree that it's comfy af when you finally git gud.
>>55223574
http://php.net/manual/en/function.eval.php

They had several cases where some code was "generated" dynamically(all concatenated in a string), then that string was passed to an eval function to determine some extra values and then the output was echoed as/with html show a view.
>>
File: face_billgates.jpg (49 KB, 981x736) Image search: [Google]
face_billgates.jpg
49 KB, 981x736
>>55223568
for looping through arrays to build websites
>>
>>55223568
well loops are normally used for displaying a bunch of information like comments, just fetchall from a database then use a loop to show them all. information from sql is normally returned as an array so i can just do (pseudocode):

$sql = "SELECT * FROM comments WHERE user_name = meme" 

for $sql->fetchAll as $row {
echo $row['text']
}
>>
>>55223646
loading told.exe to himem
>>
>>55223628
I mean concatenating shit and then echoing them I can understand, but why would you EVER use eval?
>>
>>55223813
Shitty workaround or bad design maybe.
That part was awfully implemented but it worked so we couldn't be arsed to refactor it.
>>
>>55223835
what php frameworks are good anyway? I've pretty much just been using shit like

<p><?php echo $comment ?></p>


for my little website, I mean it works, but is there a better way? preferably not a bloated framework.
>>
I have some text showing using hover effect how can I replace the effect for mobiles? I already have other function for clicking so I don't want to put on click too
>>
>>55223879
Laravel is slow but comfy to use, if you want less bloat learn phalcon.
>>
>>55223879
For large or complex sites it is far easier to manage the amount of code and if you apply a pattern supported by the framework (MVC, MVVM).

Plus it brings along several services or helpers that can make your life easier when it comes to data access, sanitization and utilities in general.

But for a simple website it can be too much work to implement and more effort to get started.
>>
>>55223568
Displaying results from database.
You can even make a table to make it look fancy.
>>
>work on my website
>everything going great
>suddenly power failure
>boot back up
>can't start the server anymore
>Error opening a connection: Error communicating with the server: Connection refused (os error 111)
>no firewall is running
>other services successfully listen on ports on localhost
>ip a and ifconfig show lo is active on localhost
>>
>>55200812
I hear amazing things about Michael Hartl's Ruby On Rails tutorial (book + screencast).

Is there a similarly good resource for Python and Django?
>>
>>55223653
This looks way better than how I loop through rows.
>>
>>55215804
Doesn't it do it automatically?
>>
>>55212037
Please add some spaces in your conditions for readability.
>>
>>55224898
How are you currently doing it αηοη?
>>
>>55216702
Please don't.
>>
>>55224938
He does it like an average web developer my man.
>>
>>55224973
do I want to know how that is?
>>
>>55224938
while loop. Looks gross.
>>
>>55225001
post your code so we can tell you how to fix it
>>
>>55222058
Yes, you fucking idiot. Jesus Christ, why are you even here if you can't comprehend something as easy as CSS? You're absolutely pathetic.
>>
>>55223332
Could you show me your CSS?
>>
>>55225098
on my phone right now, from what I've read I think I just need to force body to have a height of 100vh.
>>
>>55223653
foreach
is better.
>>
>>55225145
yeah I think that's what I have in my code, that was just some shitty pseudocode off the top of my head.
>>
>>55223911
Laravel is not slow. 5.2/PHP7 is fast as shit. And I meant 'diarrhea spurting out of your anus' fast
>>
>>55223897
Use @media queries.
>>
>>55208715
Did you read that License thread yesterday? Just AGPL-ed my MIT web app.
>>
>>55225139
Why not do:
height:100%;

?

>>55225168
I was about to say, because I don't think for even works like that; or it must be some PHP memey way of doing things, i.e. like:

echo "Hi, this", $var, "var uses commas";

echo "Hi, this" . $var . "used dots";


First one is faster though, but can only be uses in echos or vars that are about to be echoed.
>>
>>55225263
>PHP memey way of doing things
PHP is only memes.
>>
>>55209121
I write tests for anything testable (not complicated stateful user interaction). Most companies don't.
>>
For a new project should I use React instead of Angular? Does any Google project even use Angular?
>>
>>55225012
while($row = mysqli_fetch_array($r, MYSQLI_ASSOC))
>>
>>55225282
I like the language. It's the first one I've learned and even though I've been using it for 6 years, 2 professionally, I'm still learning something new every day. I see it as an adventure.

I do like my Python from time to time too though.
>>
>>55225263
>Why not do:
>height:100%;
>?
The nice people on SO said to use 100vh, but I assume both with work the same.

>I was about to say, because I don't think for even works like that;
Coding on your phone: not even once.
>>
>>55225313
>the year of our Lord 2016
>still not using PDO
>>
>>55225313
FUCKING USE PDO. THIS ISN'T A JOKE ANON.
>>
>>55225351
I don't think I've touched PDO in a while. Getting too used to Laravel's Eloquent.
>>
>>55225366
Last time I tried it fucked my shit up senpai.

I couldn't find a way to fetch results properly with fetch_assoc, fetch_all, fetch_results. I couldn't get anything to return results into row.
>>
>>55204386
There's more than 0-3 jobs lol, try removing junior from your search and filtering based on the posted requirements yourself. Philly isn't NYC/SV but there's still plenty of jobs here.

Also there's tons of places up in KoP area if you like a corporate environment. But if you want to work at a startup, move to NYC
>>
>>55225453
PDO has a completely different syntax, to fetch all you literally just execute your statement then do
$results = $query->fetchAll()
. that returns all of the results in an array. to fetch a single result I'm sure you can guess the command. Then you just so something like

foreach $results as $row {
echo $row['ur column here']
}


not using PDO and prepared statements is just asking to be memed.

https://phpdelusions.net/pdo
>>
>>55205650
They are both so fucking similar and so saturated with jobs it doesn't really matter which one you choose. If you are on Windows pick c#, otherwise pick Java I'd say. Once you learn one, you can mostly learn the other in like a day.
Thread replies: 255
Thread images: 35

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.