Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=dustymcp;44743915]You should never build your portfolio on top of free hosting, first of all your work could go missing without a clue. Second of all would you hire a programmer who cant even host a webpage?
I feel its sort of the same for when you make a buisness card and put on your [email]me@gmail.com[/email] it just doesnt look good, and you should avoid it. Hosting these days cost less than what you use in the sandwichbar, basically if you cant afford the domain, you got other priorities :)[/QUOTE]
He said a portfolio not a business, and if he did have a contact form wouldn't matter that much he had a [email]me@gmail.com[/email] for personal email questions etc. Nothing wrong with free hosting like GitHub pages, a lot of people do this already for sites like this. Even blogs.
[URL="http://hackerwins.github.io/#/"]This might be Chinese but you get the point.[/URL]
[QUOTE=Moofy;44744056]He said a portfolio not a business, and if he did have a contact form wouldn't matter that much he had a [email]me@gmail.com[/email] for personal email questions etc. Nothing wrong with free hosting like GitHub pages, a lot of people do this already for sites like this. Even blogs.
[URL="http://hackerwins.github.io/#/"]This might be Chinese but you get the point.[/URL][/QUOTE]
Having a github and a portfolio for me is 2 entirely different things, github is for management and building while my portfolio is my marketing.
I get that you can do these things and there is nothing wrong with doing so if its private, however if you want to monetize it you should treat it like a buisness.
Having gmail and such things only makes me think its an unproffesionel buisness, and i they wont hear from me again. Its fine using gmail and forwarding mails to it again 2 different things, but if you have to hand out a portfolio to people its alot easier having an address, that first of all is easy to remember, and not geoshitties.getpooanal.something.com. Think of the end user and who you want to project yourself onto.
All of this is important, while you can do it the other way it just makes it harder for your
self.
Then in the end what is 20$ a year for a proper site ?
[QUOTE=dustymcp;44744177]Having a github and a portfolio for me is 2 entirely different things, github is for management and building while my portfolio is my marketing.
[B]I get that you can do these things and there is nothing wrong with doing so if its private, however if you want to monetize it you should treat it like a buisness.[/B]
...
[/QUOTE]
He asked if someone offered [B]free[/B] hosting if there was ads on it, not that he [B]wanted[/B] ads on it.
[url]http://anacleanacle.github.io/[/url]
Github seems pretty aweseome! Thanks for the help guys, I really appreciate it. This is something I've been considering for a while, so it's nice to actually have some (very minor) progress!
[editline]7th May 2014[/editline]
[QUOTE=dustymcp;44743915]You should never build your portfolio on top of free hosting, first of all your work could go missing without a clue. Second of all would you hire a programmer who cant even host a webpage?
I feel its sort of the same for when you make a buisness card and put on your [email]me@gmail.com[/email] it just doesnt look good, and you should avoid it. Hosting these days cost less than what you use in the sandwichbar, basically if you cant afford the domain, you got other priorities :)[/QUOTE]
It's not a portfolio for getting work really, it's more of a hobby. Somewhere to document various things I make/have made. Somewhere to show off the things I'm proud of, you know? I will bare what you've said in mind, however. If it does become something more than this, I'll be sure to migrate a better host.
[QUOTE=~ZOMG;44745800]
It's not a portfolio for getting work really, it's more of a hobby. Somewhere to document various things I make/have made. Somewhere to show off the things I'm proud of, you know? I will bare what you've said in mind, however. If it does become something more than this, I'll be sure to migrate a better host.[/QUOTE]
His point about the domain name is completely moot in this case because you can [url=https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages]easily associate your own domain name with a GitHub Pages site[/url]. As for e-mail, well, you don't need to set up your own server, either. You can just rely on a cheap mail hosting provider with support for custom domains. Set the right MX record on your domain's name server, and voila - you got yourself what he describes without needing to get a VPS or something like that.
[QUOTE=Alternative Account;44747396]His point about the domain name is completely moot in this case because you can [url=https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages]easily associate your own domain name with a GitHub Pages site[/url]. As for e-mail, well, you don't need to set up your own server, either. You can just rely on a cheap mail hosting provider with support for custom domains. Set the right MX record on your domain's name server, and voila - you got yourself what he describes without needing to get a VPS or something like that.[/QUOTE]
I have a number of emails with my domain, and just have them all forward onto my gmail
Forwarding email accounts are free with my provider while actual email accounts are extra, plus I like being able to see all emails in one location and I dont have to give out my real/personal email
Just a quick opinion thing - I've decided that Java is too much of a pain in the ass to set up and use for web development and I'm trying to avoid PHP like the plague. Would you guys consider Ruby to be the best alternative here?
I've got absolutely 0 experience with Ruby but I'm hoping to set up a web server on a VPS with 512MB of RAM and 1 CPU core to handle very low traffic on a web application that'll access a MySQL database - is this doable? I know with PHP it is (Apache + MySQL or NGINX + MySQL if you're really after performance) but again I'm looking to stay away from PHP.
Basically I'm asking if you guys think Ruby is a good route to take and how easy it is (in comparison to PHP and Java) to get a server up and running. PHP is pretty easy, a few apt-get commands and you're good for a very basic install. Java has proven to be a PITA. I haven't looked into Ruby yet since I'd rather not waste my time like I did with Java which is why I'm checking in here.
[QUOTE=Banana Lord.;44757830]Just a quick opinion thing - I've decided that Java is too much of a pain in the ass to set up and use for web development and I'm trying to avoid PHP like the plague. Would you guys consider Ruby to be the best alternative here?
I've got absolutely 0 experience with Ruby but I'm hoping to set up a web server on a VPS with 512MB of RAM and 1 CPU core to handle very low traffic on a web application that'll access a MySQL database - is this doable? I know with PHP it is (Apache + MySQL or NGINX + MySQL if you're really after performance) but again I'm looking to stay away from PHP.
Basically I'm asking if you guys think Ruby is a good route to take and how easy it is (in comparison to PHP and Java) to get a server up and running. PHP is pretty easy, a few apt-get commands and you're good for a very basic install. Java has proven to be a PITA. I haven't looked into Ruby yet since I'd rather not waste my time like I did with Java which is why I'm checking in here.[/QUOTE]
Ruby and Node are both easy to install, and of those, I'd say Ruby's the easiest to learn. Just install ruby (if it's not already installed, that is) with [URL="http://rvm.io/"]RVM[/URL], and then it's just as easy as just executing the main file after writing the site. You can also use Nginx as a proxy for it, which is a bit more work, but it's not that hard.
[QUOTE=Banana Lord.;44757830]Just a quick opinion thing - I've decided that Java is too much of a pain in the ass to set up and use for web development and I'm trying to avoid PHP like the plague. Would you guys consider Ruby to be the best alternative here?
I've got absolutely 0 experience with Ruby but I'm hoping to set up a web server on a VPS with 512MB of RAM and 1 CPU core to handle very low traffic on a web application that'll access a MySQL database - is this doable? I know with PHP it is (Apache + MySQL or NGINX + MySQL if you're really after performance) but again I'm looking to stay away from PHP.
Basically I'm asking if you guys think Ruby is a good route to take and how easy it is (in comparison to PHP and Java) to get a server up and running. PHP is pretty easy, a few apt-get commands and you're good for a very basic install. Java has proven to be a PITA. I haven't looked into Ruby yet since I'd rather not waste my time like I did with Java which is why I'm checking in here.[/QUOTE]
If you have knowledge with frameworks before, Ruby & Rails would be a good alternative. I've seen the power it holds, but I've never gotten attached to it.
As a PHP guy here, I didn't understand jack shit of it at first. For me, it looked more like a command-line language instead of actual code. [I]Install a gem here and there, add a line there and there and run this command and you're done[/I] type of language.
Before you step into Rails, you should really learn a good portion of Ruby first. Otherwise it's like learning CodeIgniter/Symfony before learning PHP. It'll be a hefty task, but probably worth it in the end.
To get RoR running on your VPS, get [URL="http://www.modrails.com/documentation/Users%20guide%20Nginx.html"]nginx with the passenger module[/URL] or use the gem [URL="http://code.macournoyer.com/thin/"]thin[/URL].
Many RoR's likes thin, while passenger is [URL="http://izumi.plan99.net/blog/index.php/2008/03/31/benchmark-passenger-mod_rails-vs-mongrel-vs-thin/"]faster[/URL]. Although that post is from 2008, thin or passenger might've been drastically improved. Found an interesting answer about this matter from an author of passenger on [URL="http://stackoverflow.com/a/13154077/1765851"]stackoverflow[/URL].
[QUOTE=supersnail11;44757891]Just install ruby (if it's not already installed, that is) with [URL="http://rvm.io/"]RVM[/URL], and then it's just as easy as just executing the main file after writing the site.[/QUOTE]
I'd suggest [url=https://github.com/sstephenson/rbenv]rbenv[/url] over RVM. It's easy to set up and really just focuses on managing which versions of Ruby are installed. They both do the same thing in that regard, though, so just make your pick. (And stay away from RVM's "gemsets" - if you want to manage your application's dependencies, just use [url=http://bundler.io/]Bundler[/url]. It doesn't depend on RVM.)
[QUOTE=supersnail11;44757891]You can also use Nginx as a proxy for it, which is a bit more work, but it's not that hard.[/QUOTE]
I second that. The benefit of it is that your Ruby server needn't serve static assets like images, JS or CSS. nginx is really fast at serving static files, even more so than Apache. It's also (subjectively) easier to configure for me, especially when it comes to things like rewrites. If the site has very low traffic, though, as you said, it doesn't matter at all.
[QUOTE=Svenskunganka;44757969]If you have knowledge with frameworks before, Ruby & Rails would be a good alternative. I've seen the power it holds, but I've never gotten attached to it.[/QUOTE]
Depending on how large the application should be, using something like [url=http://www.sinatrarb.com/]Sinatra[/url] together with [url=https://github.com/sinatra/sinatra-contrib]sinatra-contrib[/url] and something to handle SQL database stuff (sinatra-activerecord, sinatra-sequel, ...) might do a great job. Funnily enough, I'd rather suggest Rails to a newcomer, though - it's more integrated as it doesn't require you to manually add and install tons of other things, and there's a [url=http://guides.rubyonrails.org/]boatload of documentation[/url] at your disposal.
[QUOTE=Svenskunganka;44757969]To get RoR running on your VPS, get [URL="http://www.modrails.com/documentation/Users%20guide%20Nginx.html"]nginx with the passenger module[/URL] or use the gem [URL="http://code.macournoyer.com/thin/"]thin[/URL].[/quote]
If you don't plan on using nginx for the aforementioned reasons, Thin is really neat.
I'm trying to create a "playlist" kind of thing where you can click items in the main browser window, and it will bring them into a list for comparative analysis in a new window.
This is the code I'm using now:
[CODE]
if (jQuery.inArray(event.start, dateArray) > -1) {
dateArray = $.grep(dateArray, function(value) {
return value != event.start;
});
arrayInc--;
window.alert("Already in Array");
}
else {
dateArray[arrayInc] = event.start;
arrayInc++;
window.alert("Added to array");
}
$.ajax({
type: "POST",
data: {data:dateArray},
url: "explore.php",
success: function(msg){
var w = window.open();
$(w.document.body).html(msg);
}
});
[/CODE]
The main window is a calendar, and the items are events in the calendar.
The problem with my current code is that it opens a new window every time an event is clicked, rather than updating the already open window.
Does anyone know how to make this work?
[editline]9th May 2014[/editline]
The code above is being fired on eventClick in the calendar
[QUOTE=Poo Monst3r;44765265]I'm trying to create a "playlist" kind of thing where you can click items in the main browser window, and it will bring them into a list for comparative analysis in a new window.
This is the code I'm using now:
The main window is a calendar, and the items are events in the calendar.
The problem with my current code is that it opens a new window every time an event is clicked, rather than updating the already open window.
Does anyone know how to make this work?
[editline]9th May 2014[/editline]
The code above is being fired on eventClick in the calendar[/QUOTE]
You have
var w = window.open();
$(w.document.body).html(msg);
in your code. window.open() opens a new window, so it's doing what you tell it to.
If you want to update the already open window, you should do something like $(this).html(msg) , which will change the current page's HTML for the one in msg.
[QUOTE=Coment;44766080]You have
var w = window.open();
$(w.document.body).html(msg);
in your code. window.open() opens a new window, so it's doing what you tell it to.
If you want to update the already open window, you should do something like $(this).html(msg) , which will change the current page's HTML for the one in msg.[/QUOTE]
I get that, I'm just wondering how I would reference that open window to update the content.
Well you don't have anything in your window.open, you need a file for the window to open. Then you have your script in that file
[php]
$a=array("images/bg_blue.png","images/bg_green.png","images/bg_blue.png","images/bg_yellow.png","images/bg_brown.png");
define('BG', array_rand($a, 1));
[/php]
Trying to randomly select a background from this array, any obvious reason this isn't working?
[code]top - 18:54:50 up 14 days, 4:26, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 118 total, 1 running, 117 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.0%sy, 0.0%ni, 99.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3792752k total, 2299056k used, 1493696k free, 207600k buffers
Swap: 6143992k total, 0k used, 6143992k free, 1645436k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
14024 apache 20 0 378m 51m 3928 S 0.3 1.4 0:06.81 php-fpm
# strace -p 14024
Process 14024 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
nanosleep({0, 10000000}, NULL) = 0
[/code]
My php-fpm is running as apache and prevents any and all connections for a user when that user is asking for another page after aborting the loading of a page.
That's the stack trace for it. Any ideas?
[QUOTE=Milkshaker;44767169][php]
$a=array("images/bg_blue.png","images/bg_green.png","images/bg_blue.png","images/bg_yellow.png","images/bg_brown.png");
define('BG', array_rand($a, 1));
[/php]
Trying to randomly select a background from this array, any obvious reason this isn't working?[/QUOTE]
array_rand returns a random [B]key[/B]. This means, you need to do $a[BG].
What's the rest code that works with BG?
(Also, 1 is the default, so it's not needed there)
(Also, you've included bg_blue two times. Just in case it was appearing too many times...)
Does anybody know why Garry's Mod isn't executing the GameDetails javascript function for sv_loadingurl while it executes the rest of the functions just fine?
[QUOTE=Poo Monst3r;44765265]I'm trying to create a "playlist" kind of thing where you can click items in the main browser window, and it will bring them into a list for comparative analysis in a new window.
This is the code I'm using now:
[CODE]
if (jQuery.inArray(event.start, dateArray) > -1) {
dateArray = $.grep(dateArray, function(value) {
return value != event.start;
});
arrayInc--;
window.alert("Already in Array");
}
else {
dateArray[arrayInc] = event.start;
arrayInc++;
window.alert("Added to array");
}
$.ajax({
type: "POST",
data: {data:dateArray},
url: "explore.php",
success: function(msg){
var w = window.open();
$(w.document.body).html(msg);
}
});
[/CODE]
The main window is a calendar, and the items are events in the calendar.
The problem with my current code is that it opens a new window every time an event is clicked, rather than updating the already open window.
Does anyone know how to make this work?
[editline]9th May 2014[/editline]
The code above is being fired on eventClick in the calendar[/QUOTE]
code works fine, you're just trying to manipulate the dom before it's finished loading, do this:
[code]
var w = window.open();
$(w.document).ready(function(){
$(w.document.body).html(msg);
});
[/code]
I'm a bit unsure how I should approach this:
I have a website with an open market. Anyone can sell things on there (from a specific game), but the item that’s sold is a one-time selling.
So, when people buy itemX they pay using PayPal where the money goes directly to the seller. I get the IPN and send them the item.
My problem here is that if two individuals decide to buy this item almost at the same time. After they’ve selected ‘Pay now using PayPal’, I have no way of telling them that somebody else was quicker in the payment process and purchased it?
I’ve considered making the item unavailable as soon as a person clicks the ‘Pay now using PayPal’ button, but this could be abused pretty much couldn’t it?
[CODE]<?php
$myid = $_SESSION['id'];
if (!isset($_GET['d'])) {
$d = "root";
} else {
$d = $_GET['d'];
}
$d = mysql_real_escape_string($d);
$query = mysql_query("SELECT * FROM files WHERE folder=$d AND owner=$myid");
while ($file = mysql_fetch_array($query)) {
echo '<button class="button">';
echo "{$file['name']}.{$file['type']}";
echo '</button>';
}
?>[/CODE]
For some reason this does nothing... not even giving me an SQL Error (or any other error)... All i see is this:
[IMG]http://i.imgur.com/rUKZA9d.png[/IMG]
I'd recommend switching to PDO. The mysql_* library is deprecated and just crap in general. PDO has prepared statements (which means proper SQL injection prevention) and much better error handling.
[editline]10th May 2014[/editline]
Do you ever connect to the MySQL server?
Yeah, i got a config.php... this file is included in a index.php which already has config.php included.
Are you sure your query returns something? If there is nothing to select it won't show anything. Oh and use PDO or mysqli.
Is there any easy way to override a title on a page?
I want to have a default, generic title just in case I forget about it or something. But, at the same time, I want to be able to change it easily on the pages I deem fit.
I originally thought about having the generic one on a template and then run that on each page, adding another <title> tag with the dynamic one after the template (so, two title tags), but that doesn't seem to work, needing to remove the generic one for the dynamic to display.
[editline]10th May 2014[/editline]
I know you can do document title with Javascript, but I'd rather only use HTML( or PHP) for this.
[QUOTE=Coment;44774053]Is there any easy way to override a title on a page?
I want to have a default, generic title just in case I forget about it or something. But, at the same time, I want to be able to change it easily on the pages I deem fit.
I originally thought about having the generic one on a template and then run that on each page, adding another <title> tag with the dynamic one after the template (so, two title tags), but that doesn't seem to work, needing to remove the generic one for the dynamic to display.
[editline]10th May 2014[/editline]
I know you can do document title with Javascript, but I'd rather only use HTML( or PHP) for this.[/QUOTE]
I don't think you can change it purely with html, with php couldn't you just echo something different inside the title tag instead of adding a new title? Like
[code]
<?php
$title = "This title";
?>
<title> <?php echo $title ?> </title>
[/code]
[QUOTE=Coment;44774053]Is there any easy way to override a title on a page?
I want to have a default, generic title just in case I forget about it or something. But, at the same time, I want to be able to change it easily on the pages I deem fit.
I originally thought about having the generic one on a template and then run that on each page, adding another <title> tag with the dynamic one after the template (so, two title tags), but that doesn't seem to work, needing to remove the generic one for the dynamic to display.
[editline]10th May 2014[/editline]
I know you can do document title with Javascript, but I'd rather only use HTML( or PHP) for this.[/QUOTE]
Use [URL="http://php.net/manual/en/class.domdocument.php"]DOMDocument[/URL] and sub-classes.
Example:
[CODE]
$dom = new DOMDocument;
$dom->loadHTML($page_contents);
$head = $dom->getElementsByTagName('head')->item(0);
if(!is_a($head, 'DOMNode'))
{
trigger_error('Could not parse DOM (Missing <head> tag)', E_USER_WARNING);
}
$title = $dom->createElement('title', 'YOUR TITLE HERE');
$head->appendChild($title);
[/CODE]
[img]http://i.imgur.com/MZldDFl.png[/img]
does anyone recognize what font this icon's from? it's been imported and packaged with others, so i can't tell
Hey, I have an issue where I set a header and footer to be 100% width in a fixed position but for some reason there are 5 or so pixels to the left that they don't cover. Any idea how I could fix this?
[url]http://i.gyazo.com/883727acb054844414f09c7cae874b40.png[/url]
The colors and most of the stuff are temporary. I just wanna get the layout done. Thanks :)
[QUOTE=YourStalker;44785343]Hey, I have an issue where I set a header and footer to be 100% width in a fixed position but for some reason there are 5 or so pixels to the left that they don't cover. Any idea how I could fix this?
[url]http://i.gyazo.com/883727acb054844414f09c7cae874b40.png[/url]
The colors and most of the stuff are temporary. I just wanna get the layout done. Thanks :)[/QUOTE]
Try adding left: 0; to the css
Sorry, you need to Log In to post a reply to this thread.