• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
[QUOTE=Marlamin;45164696]You can always go with external authentication providers that use OAuth or OpenID something like that. For a site like SteamDB it works fine as all our users are on Steam, so we use [url=http://steamcommunity.com/dev]Steam's OpenID[/url] for authentication. It's somewhat harder for a general purpose forum, though. I guess you could go for "[url=https://developers.google.com/accounts/docs/OAuth2Login]Login with Google[/url]" if you [b]really[/b] don't want to deal with saving login details.[/QUOTE] I started on my own forum a while ago and I used sign in through steam too. It works like a charm, to be honest.
I'm attempting to have this login button be as wide with the input boxes, but for some reason the button is just a little less wide on the right, shown below: [URL="http://i.imgur.com/iAzCUM4.jpg"][IMG]http://i.imgur.com/iAzCUM4.jpg[/IMG][/URL] the CSS: [URL="http://i.imgur.com/phm6LMM.png"][IMG]http://i.imgur.com/phm6LMM.png[/IMG][/URL] Anyway to fix this?
try doing this padding: 0 1px;
[QUOTE=jung3o;45167403]try doing this padding: 0 1px;[/QUOTE] didn't seem to work, :(
[QUOTE=Nectarine;45167542]didn't seem to work, :([/QUOTE] oh whoops. you can do either margin: 0 1px; or add a same colored border
It's width:100%; of parent container, have a look at all the parents until you find one with padding, or not correct width.
[QUOTE=jung3o;45167669]oh whoops. you can do either margin: 0 1px; or add a same colored border[/QUOTE] Using margin and making outline 2px instead of 1 seemed to do the trick! Thanks :) [IMG]http://i.imgur.com/x2IEqM9.jpg[/IMG]
probably could be something you could solve with "* { box-sizing: border-box; }"
I would like to make gradient [i]text[/i] that also has a drop shadow on it. Is this possible? So far the fruits of my labor are thus: [img]http://puu.sh/9DnYe/41376e0549.jpg[/img] [code].goldFade { background: -webkit-linear-gradient(#a59975, #8c8264); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .pop { text-shadow: 0px 2px 4px #000; }[/code] It's a subtle gradient, so I [i]could[/i] do without it. But it looks nice so I'd rather keep it if I can. [editline]21st June 2014[/editline] [img]http://puu.sh/9Dp5j/baaf7f3bf6.jpg[/img] hmmmm
-snip, see post below for better answer-
[QUOTE=biodude94566;45172760]I would like to make gradient [i]text[/i] that also has a drop shadow on it. Is this possible? So far the fruits of my labor are thus: [img]http://puu.sh/9DnYe/41376e0549.jpg[/img] [code].goldFade { background: -webkit-linear-gradient(#a59975, #8c8264); -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .pop { text-shadow: 0px 2px 4px #000; }[/code] It's a subtle gradient, so I [i]could[/i] do without it. But it looks nice so I'd rather keep it if I can. [editline]21st June 2014[/editline] [img]http://puu.sh/9Dp5j/baaf7f3bf6.jpg[/img] hmmmm[/QUOTE] You could always add another set of properties after the first shadow [url]http://jsfiddle.net/Pe3hC/1/[/url]
[QUOTE=gokiyono;45174302]You could always add another set of properties after the first shadow [url]http://jsfiddle.net/Pe3hC/1/[/url][/QUOTE] Doing that would override the method I'm using to get the gradient text, though. So far the best thing I've found is using the :after selector to basically recreate the text.
I've been looking for a good hour right now on how to start with a Node.js webserver. Basically, what I want, is a "PHP-like" way of handling pages. I want to be able to just go "domain.com/" and it should show the index page, and if they go to /login it should show the login page. Currently all I have found were examples for static file servers and webservers that only show .html pages. I want to be able to code my pages separately. Any help?
[QUOTE=Cyberuben;45179039]I've been looking for a good hour right now on how to start with a Node.js webserver. Basically, what I want, is a "PHP-like" way of handling pages. I want to be able to just go "domain.com/" and it should show the index page, and if they go to /login it should show the login page. Currently all I have found were examples for static file servers and webservers that only show .html pages. I want to be able to code my pages separately. Any help?[/QUOTE] You might want to learn Node.js first.
[QUOTE=supersnail11;45179452]You might want to learn Node.js first.[/QUOTE] I do know Node.js and I do know Javascript. Currently I have a webserver running but I have trouble with the content types. Usually apache and PHP do this for you so I'm not used to doing it myself. Currently I have the following code: [code]var express = require('express'); var http = express(); var fs = require('fs'); var url = require('url'); var path = require('path'); var mime = require('mime'); http.get(/^(.+)$/, function(req, res) { var filename = '.' + url.parse(req.url).pathname; if (filename == './') { filename = 'root/index.html'; }else{ filename = 'root/'+filename; } fs.exists(filename, function(exists) { if(!exists) { res.send(404, '404 - File not found'); return; } fs.readFile(filename, 'utf8', function(error, file) { var content_type = mime.lookup(filename); res.set('Content-Type', content_type); console.log(content_type) res.send(file); }); }) }); var server = http.listen(80, function() { console.log('Running HTTP server at http://107.170.52.62:%d', server.address().port); });[/code] HTML, CSS and JS load, but images etc don't. Changing res.send(file); to res.sendfile(file); will make my browser display the entire page as plain text. [t]http://i.imgur.com/7ziNNv6.png[/t] [t]http://i.imgur.com/g8vaJgI.png[/t]
[QUOTE=Cyberuben;45179473]I do know Node.js and I do know Javascript. Currently I have a webserver running but I have trouble with the content types. Usually apache and PHP do this for you so I'm not used to doing it myself. Currently I have the following code: [code]var express = require('express'); var http = express(); var fs = require('fs'); var url = require('url'); var path = require('path'); var mime = require('mime'); http.get(/^(.+)$/, function(req, res) { var filename = '.' + url.parse(req.url).pathname; if (filename == './') { filename = 'root/index.html'; }else{ filename = 'root/'+filename; } fs.exists(filename, function(exists) { if(!exists) { res.send(404, '404 - File not found'); return; } fs.readFile(filename, 'utf8', function(error, file) { var content_type = mime.lookup(filename); res.set('Content-Type', content_type); console.log(content_type) res.send(file); }); }) }); var server = http.listen(80, function() { console.log('Running HTTP server at http://107.170.52.62:%d', server.address().port); });[/code] HTML, CSS and JS load, but images etc don't. Changing res.send(file); to res.sendfile(file); will make my browser display the entire page as plain text. [t]http://i.imgur.com/7ziNNv6.png[/t] [t]http://i.imgur.com/g8vaJgI.png[/t][/QUOTE] Why are you including express but not using it?
does anyone know how I could maybe disable ONLY the annotations on youtube that are just text? I wanna keep the ones that are the rectangular box that they put around animated suggested videos at the end I just don't want the ones that say "CLICK LIKE!!!!!!!!!!!!" or whatever. im thinking a greasemonkey script should be able to do it right?
[QUOTE=supersnail11;45179951]Why are you including express but not using it?[/QUOTE] he is though [quote][code]var http = express();[/code][/quote]
[QUOTE=jung3o;45180008]he is though[/QUOTE] But then he does [code]http.get(/^(.+)$/[/code] which completely removes any benefit that express gives you.
I was not aware. I'm going to try another framework though. What I am trying to achieve, is make a "Remote Console Viewer". Source has the ability to send UDP packets to whichever IP and port you want, and using that you can read the console output from remote. Even though it's not the exact same output, [url=https://github.com/Facepunch/garrysmod-requests/issues/287]I made a request if this could be changed[/url]. Regardless of this happening, I want to make it possible for people to go to my website, click "Create server", it'll give them a port they can send their UDP packets to, and they will receive the console output using WebSockets. Now my problem is, I need to be able to start another node.js process that listens on a specific port. Creating this script isn't a problem, listening on this port isn't a problem, but I am not sure how to create another process. I've read something like "require('child-process');", but I am not sure how I would stop this process so I don't think this is a good solution. The subprocess would be a script that first retrieves information from MySQL about the server in case. It'd get the port it has to listen on, the IP of the server sending the packets, etc. As soon as that info is retrieved, a UDP server listens for packets. When a packet is received and matches the IP specified, the UDP packet is sent to another process, with the first 4 bytes set to the server's ID (also retrieved from MySQL). When my other server receives that packets, it's checking which server it belongs to, and then sends it to all WebSocket clients that are authenticated for that server. As far as I know, something like this has never been done before and I'd like to change that, making it easier for people to read their console output remotely without having to log in to remote desktop or giving people access to remote desktop. They can write their own authentication for the WebSocket so they determine who can see the console output and can embed it in their own website, such as a forum. Anyone willing to get me started? The problem is that I can hardly find any good "tutorials" on how to create a modular webserver that both has script execution and static content.
[QUOTE=Cyberuben;45181973] I've read something like "require('child-process');", but I am not sure how I would stop this process so I don't think this is a good solution.[/QUOTE] You could use [url=http://nodejs.org/api/child_process.html#child_process_child_kill_signal].kill()[/url] with one of [url=http://man7.org/linux/man-pages/man7/signal.7.html]these[/url].
[QUOTE=tdlive aw'sum;45183239]You could use [url=http://nodejs.org/api/child_process.html#child_process_child_kill_signal].kill()[/url] with one of [url=http://man7.org/linux/man-pages/man7/signal.7.html]these[/url].[/QUOTE] But how would I keep track of all my processes? What I need is the following: Someone logs in to my website. Sees a list of his "services". User clicks "Start", process starts, port listens to UDP packet, and script keeps running. All processes will have the same "name", I expect, as what I'm going to run would be something like "node listener.js serverid=<id>". How do I stop a server with a specific ID? I could always do something hacky and send an UDP packet on localhost, to the port that the person uses with a command that'll kill the process, but I'm not sure if people are able to spoof IPs in such a way that it appears to be originated from localhost.
[QUOTE=Cyberuben;45183846]But how would I keep track of all my processes? What I need is the following: Someone logs in to my website. Sees a list of his "services". User clicks "Start", process starts, port listens to UDP packet, and script keeps running. All processes will have the same "name", I expect, as what I'm going to run would be something like "node listener.js serverid=<id>". How do I stop a server with a specific ID? I could always do something hacky and send an UDP packet on localhost, to the port that the person uses with a command that'll kill the process, but I'm not sure if people are able to spoof IPs in such a way that it appears to be originated from localhost.[/QUOTE] Generate a static pid when starting the process.
[QUOTE=Cyberuben;45181973]Anyone willing to get me started? The problem is that I can hardly find any good "tutorials" on how to create a modular webserver that both has script execution and static content.[/QUOTE] Use express's static module and just define express routes? It's a good idea to learn the tools that you're using.
[QUOTE=supersnail11;45185900]Use express's static module and just define express routes? It's a good idea to learn the tools that you're using.[/QUOTE] But I can't find any good tutorials on how to use it. I find NodeJS highly undocumented, everything around it as well.
[QUOTE=Cyberuben;45186181]But I can't find any good tutorials on how to use it. I find NodeJS highly undocumented, everything around it as well.[/QUOTE] Look up any Express tutorial? Like [URL="http://code.tutsplus.com/tutorials/introduction-to-express--net-33367"]this[/URL] one. Node is very well documented, on par with MDN.
[QUOTE=supersnail11;45186821]Look up any Express tutorial? Like [URL="http://code.tutsplus.com/tutorials/introduction-to-express--net-33367"]this[/URL] one. Node is very well documented, on par with MDN.[/QUOTE] That just made so much sense. Thanks a lot! :)
[QUOTE=Cyberuben;45186181]I find NodeJS highly undocumented[/QUOTE] And you think you're having a bad time: [t]http://i.imgur.com/n2Um65q.png[/t] [editline]23rd June 2014[/editline] WHY CHROME
[QUOTE=Cyberuben;45186181]I find NodeJS highly undocumented, everything around it as well.[/QUOTE] You aren't looking in the right place then... Node usually has awesome documentation and guides. [url]http://expressjs.com/4x/api.html[/url] [url]http://expressjs.com/guide.html[/url] [url]http://nodejs.org/api/[/url]
Has anyone tried [URL="https://nodebb.org/"]NodeBB[/URL] out yet? Any inputs?
Sorry, you need to Log In to post a reply to this thread.