• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
[QUOTE=lilgamefreek;40376748]I'm trying to write a chat application that can detect when a user closes the window so that it can log someone offline. I haven't had any luck with the various implementations I've tried on google, so I've got to ask. How do those really annoying porn popups (the one when you try to close them pop up an alert) work?[/QUOTE] [code] window.onbeforeunload = confirmExit; function confirmExit(){ alert("Confirm exit?"); return false; } [/code]
You're just trying to find out if the user closes the window, right? If you don't want a annoying alert stuff like Killervalon suggested, you could theoretically send data to the user to let the server know the user is still on.
I'd use AJAX that every 30 seconds or so requests a page that updates a last-online field in the users table of the database. You can then assume that any user that has a last-online time greater than the current time minus 30 seconds is currently online.
[QUOTE=asantos3;40377177]You're just trying to find out if the user closes the window, right? If you don't want a annoying alert stuff like Killervalon suggested, you could theoretically send data to the user to let the server know the user is still on.[/QUOTE] I didn't suggest it, I merely gave him what he asked for.
Newbie question, normal sharing hosting companies will support python or ruby? Do I need a VPS or can do I something so that even the shitiest hosting can support?
[QUOTE=asantos3;40383364]Newbie question, normal sharing hosting companies will support python or ruby? Do I need a VPS or can do I something so that even the shitiest hosting can support?[/QUOTE] Use [url=http://heroku.com/]Heroku[/url]
[QUOTE=KmartSqrl;40383530]Use [url=http://heroku.com/]Heroku[/url][/QUOTE] but $35/mo for 2 dynos!
But why does php is supported in every hosting company and only a few have support for ruby or python?
[QUOTE=asantos3;40383676]But why does php is supported in every hosting company and only a few have support for ruby or python?[/QUOTE] Because PHP is the default standard.
I am a little confused. (A theoretical question.) In school I have gotten told to not use tables for styling purposes. Like [URL="http://i.imgur.com/JEBC5Qo.png"]this[/URL]. It just seems more fitting (to me) to use a table here. [editline]23rd April 2013[/editline] [QUOTE=asantos3;40377177]You're just trying to find out if the user closes the window, right? If you don't want a annoying alert stuff like Killervalon suggested, you could theoretically send data to the user to let the server know the user is still on.[/QUOTE] I have bad experience with accidentally closing chats and tabs I need down by accident. Annoying gets useful in certain accidents.
I need to pick a framework for a school project. My teacher gave me 3 options: 1. CodeIgniter 2. Zend 3. no framework at all Which one of these two is the best to pick for a large project?
[QUOTE=Mega1mpact;40392327]I need to pick a framework for a school project. My teacher gave me 3 options: 1. CodeIgniter 2. Zend 3. no framework at all Which one of these two is the best to pick for a large project?[/QUOTE] Why are they deciding which frameworks you are allowed to use? That's pretty dumb... I'm only familiar with CodeIgniter, no idea how Zend is
3. no framework at all Then create your framework?
[QUOTE=Mega1mpact;40392327]I need to pick a framework for a school project. My teacher gave me 3 options: 1. CodeIgniter 2. Zend 3. no framework at all Which one of these two is the best to pick for a large project?[/QUOTE] Laravel
[QUOTE=Knallex;40392359]Why are they deciding which frameworks you are allowed to use? That's pretty dumb... I'm only familiar with CodeIgniter, no idea how Zend is[/QUOTE] I suggested CakePHP (I have some experience with that one) but he said no. I'm only allowed to use those two for some reason. Also I'm the only one to use a framework because the rest of my class is too incompetent to even know how to do OO in PHP... [editline]23rd April 2013[/editline] [QUOTE=P1raten;40392590]Laravel[/QUOTE] Looks fancy.
[QUOTE=Mega1mpact;40392653]Looks fancy.[/QUOTE] I know stinkyjoe suggested me Symfony2. It's awesome. The documentation is great. If you've worked with mvc before, you should take a look at it. Maybe ask teacher why he's limiting the frameworks? Go with Zend.
[QUOTE=Mega1mpact;40392653]I suggested CakePHP (I have some experience with that one) but he said no. I'm only allowed to use those two for some reason. Also I'm the only one to use a framework because the rest of my class is too incompetent to even know how to do OO in PHP... [editline]23rd April 2013[/editline] Looks fancy.[/QUOTE] I'd go with Laravel either way. I use it often myself - if the teacher complains, tell him it's built ontop of CodeIgniter... That has to be allowed..?
[QUOTE=Ac!dL3ak;40383653]but $35/mo for 2 dynos![/QUOTE] I doubt he's doing anything that is going to need more than one dyno right now.
[QUOTE=Knallex;40393186]I'd go with Laravel either way. I use it often myself - if the teacher complains, tell him it's built ontop of CodeIgniter... That has to be allowed..?[/QUOTE] Uh. What? Afaik it's not built on top of anything rather than it being based on something. Iirc Taylor looked at CI whilst making Laravel. But that's about it.
[QUOTE=P1raten;40398699]Uh. What? Afaik it's not built on top of anything rather than it being based on something. Iirc Taylor looked at CI whilst making Laravel. But that's about it.[/QUOTE] Must have misread then - I swear I read it somewhere... My mistake
[url]http://www.reddit.com/r/tf2trade/comments/1czj7a/psa_are_you_a_web_developer_with_a_great_idea_for/[/url] how much of a scam is this? seems like he just wants to get other people to work for him and take their profits.
I'm not the biggest expert on Web Development, but I'm trying to create a website for my own that will serve as file storage. Whilst doing that I'm also trying to improve on designing a website. I've been trying to set a custom font for the website, I've done it before but somehow it's not working now. For example a title on the page. <H1 id="title">Flashbox</H1> and the CSS @font-face { font-family: ubuntu_light; src: url('fonts/Ubuntu-L.ttf'); } #title { font-family: ubuntu_light; } Is there something else that I'm not aware of? I know it's fairly simple issue but I would appreciate the help.
Cant you just do: body { font-family: ubuntu_light } ? If it's already on your computer it'll be automatically used, no?
[QUOTE=MrFlashcat;40404161] <H1 id="title">Flashbox</H1> and the CSS @font-face { font-family: ubuntu_light; src: url('fonts/Ubuntu-L.ttf'); } #title { font-family: ubuntu_light; } Is there something else that I'm not aware of? I know it's fairly simple issue but I would appreciate the help.[/QUOTE] Please don't use caps. The most probable cause it's the path, put the ttf file on the same place as your css file and see if it works. [QUOTE=Hng;40404643]If it's already on your computer it'll be automatically used, no?[/QUOTE] Nope, think about the other Operating Systems.
Squeezing in a current situation, I am authenticating users using one table called "relations", like so: [QUOTE][table="width: 500"] [tr][td]object_class[/td][td]object_id[/td][td]user_id[/td][/tr] [tr][td]-[/td][td]-[/td][td]-[/td][/tr] [tr][td]report[/td][td]852563455984639813469[/td][td]000000000000000000000[/td][/tr] [tr][td]project[/td][td]205276875140132492282[/td][td]000000000000000000000[/td][/tr] [tr][td]project[/td][td]337002439532632479837[/td][td]000000000000000000000[/td][/tr] [tr][td]report[/td][td]354470149822835397511[/td][td]000000000000000000000[/td][/tr] [tr][td]report[/td][td]679556990386938119964[/td][td]000000000000000000000[/td][/tr] [/table][/QUOTE] The plan involves calling, inserting and deleting from this table often, can it be optimized further with it's size? [editline]24th April 2013[/editline] The goal is to find a row that includes both the object's and the user's identification number, with the 'object_class' column to help find or modify multiple rows. [editline]24th April 2013[/editline] If no row is found then the user's request is denied. [editline]24th April 2013[/editline] [QUOTE=Hng;40398994][url]http://www.reddit.com/r/tf2trade/comments/1czj7a/psa_are_you_a_web_developer_with_a_great_idea_for/[/url] how much of a scam is this? seems like he just wants to get other people to work for him and take their profits.[/QUOTE] Could be an investment on his end, he may be looking for another user base; can't really say until you start doing business.
[QUOTE=MrFlashcat;40404161]I'm not the biggest expert on Web Development, but I'm trying to create a website for my own that will serve as file storage. Whilst doing that I'm also trying to improve on designing a website. I've been trying to set a custom font for the website, I've done it before but somehow it's not working now. For example a title on the page. <H1 id="title">Flashbox</H1> and the CSS @font-face { font-family: ubuntu_light; src: url('fonts/Ubuntu-L.ttf'); } #title { font-family: ubuntu_light; } Is there something else that I'm not aware of? I know it's fairly simple issue but I would appreciate the help.[/QUOTE] I would usually get something like [URL="http://www.fontsquirrel.com/tools/webfont-generator"]font squirrel[/URL] to give me the files I need. [sp]Please don't kill me[/sp]
[QUOTE=asantos3;40405132]Please don't use caps. The most probable cause it's the path, put the ttf file on the same place as your css file and see if it works. [/QUOTE] Thanks, placed it in the css folder and it worked.
Does anyone have any recommendations for setting up a build system for minifying web content? I've recently been looking into minifying content for a project I'm working on, but manually doing so will be tedious. I've heard about Google's Closure Compiler, but I'm not quite sure that's what I should be using.
Just use cloudflare.
NodeJS question: I've been banging my head against the wall trying to get a simple MySQL array to print out to a Jade template. This is using NodeJS/ExpressJS/Node-MySQL/Jade. This produces no errors. But the Jade template doesn't see the "applications" variable... In my code the MySQL query does return my data correctly. Using console.log(row[1].status); does return a value. app.js: [code] /** * Module dependencies. */ var express = require('express') , routes = require('./routes') , user = require('./routes/user') , http = require('http') , path = require('path') , mysql = require('mysql'); var app = express(); // all environments app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } app.get('/', routes.index); app.get('/users', user.list); //MySQL var sqlInfo = { host: '12.34.56.78', user: 'user', password: 'pass', database: 'user' } var client = mysql.createConnection(sqlInfo); client.connect(); client.query( "SELECT * FROM list ORDER BY status ASC LIMIT 25", function(err, row, fields){ if (err) throw err; else { var applications = row; app.render("applications", applications, function(err, html){}); } }); client.end(); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); });[/code] index.jade: [code] extends layout block content div.container div.content - if (typeof(applications) !== 'undefined') ul - each app in applications li= app.status - else p Blank slate mate... div.footer [/code] I think the issue is stemming from the app.render not being used correctly... But I'm really new to Node and my JS is pretty rusty. Any tips or hints are much appreciated!
Sorry, you need to Log In to post a reply to this thread.