Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
I need a bit of constructive criticism on a small bit of text, it's describing the way a Javascript form validation function works, it's not the whole thing - just a section of it regarding how the function "ends".
Seemed like the best place to post this.
[url]http://pastebin.com/4NyiCR8N[/url]
[QUOTE]Unknown Paste ID![/QUOTE]
[QUOTE=Coment;41200906][/QUOTE]
Paste expired, updated my post with the new paste link.
Can someone explain what exactly Heroku is and what's better about it than shared hosting? Thanks
It's essentially free if you have relatively low traffic and db size requirements (if you get past the juice you can get from the free environment you should be able to find a way to monetize enough to pay for your hosting in most cases)
It's much more performant than shared hosting because you're essentially running on your own VPS, except you don't have to do any of the devops stuff that you'd need to do if you were on your own VPS.
Most shared hosts aren't really going to let you run the platforms that you can run on heroku either (node.js, ruby/rack/rails, scala, etc..) and if they do it's not going to run well. I would, personally, never trust a shared host with a rails app.
[QUOTE=KmartSqrl;41205659]It's essentially free if you have relatively low traffic and db size requirements (if you get past the juice you can get from the free environment you should be able to find a way to monetize enough to pay for your hosting in most cases)
It's much more performant than shared hosting because you're essentially running on your own VPS, except you don't have to do any of the devops stuff that you'd need to do if you were on your own VPS.
Most shared hosts aren't really going to let you run the platforms that you can run on heroku either (node.js, ruby/rack/rails, scala, etc..) and if they do it's not going to run well. I would, personally, never trust a shared host with a rails app.[/QUOTE]
Thanks for the reply
If I'm running simple PHP and don't use anything exotic ever, is there any point in me getting it? Also is it hard to use or are there just directories into which you upload stuff, like shared hosting?
Thanks
Heroku uses Git for deployment rather than FTP etc last I checked, and I don't really see why you'd use PHP for it.. If you want to use PHP, I'd rather go with AppFog :)
+1 for appfog PHP, it rocks plus appfog's free tier is more generous than heroku's.
An example: [url]http://erikwolpaw.com[/url] is a freebie appfog app.
Both Heroku and AppFog have a CLI interface for pushing & pulling live apps.
[QUOTE=Shadow801;41180630]I love this.
It's quite funny really, don't get me wrong I hate Dreamweaver with a passion, but to suggest it's bad practice is a bit silly really. At the end of the day it's still the same code, wherever you type it from Notepad to DW, so it's hardly bad practice.
Sublime Text 2 and other IDEs are simply just easier to use with tools that encourage better practice, but my code is just as good quality no matter what IDE I load it in.
But don't get me wrong, if I could remove DW from existence I probably still would. Or I would rename it 'Adobe HTML Email Designer'.[/QUOTE]
The reason why I hate dreamweaver is - or well at least was, that it modified the code in a very strange way.
What are the best FTP solutions for Mac? I just got a MacBook Pro today.
I've already installed Brackets. :D
Any other good Mac web development tools you could also recommend would be extremely helpful to me, mostly because I trust most of your opinions on here and partially because I have no idea where to begin looking for apps at the moment.
I use Transmit for FTP on OSX, its a paid for app though.
[url]http://panic.com/transmit/[/url]
Filezilla works just fine though, so if you've used that on windows just get that
Panic also make Coda2 which is very popular web dev IDE/Text Editor once again its paid for though
My main IDE is xcode, you can use it for everything its the Visual Studio of OSX, and Sublime Text as my text editor. iTerm2 is also a good terminal replacement
[QUOTE=Benji;41218566]What are the best FTP solutions for Mac? I just got a MacBook Pro today.
I've already installed Brackets. :D
Any other good Mac web development tools you could also recommend would be extremely helpful to me, mostly because I trust most of your opinions on here and partially because I have no idea where to begin looking for apps at the moment.[/QUOTE]
I currently use Flow ([url]http://fivedetails.com/flow/[/url]) although may try out Transit soon.
I am kind of new to web development and I have a few questions. First of how can I publish my web app? I have written it using D and Vibe web framework and I can currently start it using localhost:port. Before that I have used Python and Google apps engine, but it doesn't support D and other languages. It is prety limeted. Also can I somehow host the app from my onw PC? And do I need any server software like Apache to run my app?
[QUOTE=bobiniki;41223119]I am kind of new to web development and I have a few questions. First of how can I publish my web app? I have written it using D and Vibe web framework and I can currently start it using localhost:port. Before that I have used Python and Google apps engine, but it doesn't support D and other languages. It is prety limeted. Also can I somehow host the app from my onw PC? And do I need any server software like Apache to run my app?[/QUOTE]
You should tell us which OS you're on but in case you're on a mac you can start using your applications on localhost (local server) using xampp - a package that includes mysql, apache and more.
No idea what the windows version would be.
Keep in mind that your PC doesn't keep the same IP all the time so hosting it on your PC and sharing it with the world are incompatible.
There is this game forum I visit and of the members has this in her signature:
[html]
Friday, 28 June 21:09:08 EEST
[/html]
It's a timer that updates each page refresh.
It seems to me like it's an external script and not a BB-code or something similar (it's not part of the forum documentation). Is there some way to do that?
EDIT: Like generating data with a text/plain header.
[QUOTE=01271;41227167]You should tell us which OS you're on but in case you're on a mac you can start using your applications on localhost (local server) using xampp - a package that includes mysql, apache and more.
No idea what the windows version would be.
Keep in mind that your PC doesn't keep the same IP all the time so hosting it on your PC and sharing it with the world are incompatible.[/QUOTE]
I'm on Win 8
Yeah I can currently run it localhost, but I was looking for an online solution.
[QUOTE=bobiniki;41227423]I'm on Win 8
Yeah I can currently run it localhost, but I was looking for an online solution.[/QUOTE]
You'll probably have to get a VPS and set it up on there, I don't think you'll find shared hosting for D. I've never worked with Vibe or D before but you should be able to make some progress by googling "Deploying Vibe web apps" or something along those lines.
How do you deal with objects and databases in PHP? Originally I thought about giving each instance a unique handle, but that seems outrageous. Should I get the database handle from outside the object and pass it in to constructor so that every object thinks it has its own handle but in reality I only have to create one per invocation of the script?
[editline]28th June 2013[/editline]
If I do this, however, I won't be able to use PDO to fetch an array of objects, because I will have a required argument to the constructor. Is there any way to have PDO pass a parameter to each object it constructs?
[QUOTE=Cassel;41227219]There is this game forum I visit and of the members has this in her signature:
[html]
Friday, 28 June 21:09:08 EEST
[/html]
It's a timer that updates each page refresh.
It seems to me like it's an external script and not a BB-code or something similar (it's not part of the forum documentation). Is there some way to do that?
EDIT: Like generating data with a text/plain header.[/QUOTE]
[php]
<?php
header('Content-Type: text/plain');
echo date("l\, j F H\:i\:s T",time());
?>
[/php]
[url=http://mcparty.co/test.php]Demo[/url]
How you would go about embedding that in a signature i have no idea though, could it be an image rather than text?
I was looking at making a bbcode parser in javascript. So it will be parsed clientside instead of serverside.. and it will allow realtime previews etc. without involving the server at all.
Searching around the web everyone says it's dangerous and to avoid it. Is it impossible to do safely?
The potential dangers are petty, and can be easily avoided. It's not impossible to do safely at all, and there are a few implementations of this out in the wild right now.
[QUOTE=garry;41236254]I was looking at making a bbcode parser in javascript. So it will be parsed clientside instead of serverside.. and it will allow realtime previews etc. without involving the server at all.
Searching around the web everyone says it's dangerous and to avoid it. Is it impossible to do safely?[/QUOTE]
I can't really think of any dangers.
But I know [URL="http://codecanyon.net/item/javascript-bbcode-parser/3840140"]this[/URL] (if you are willing to pay 4 dollars)
Want to ask if there is a framework that suits good looking design, With good functionality and not that many flaws with how it works. And yes i know about bootstrap, but that stuff just looks plain ugly.
[QUOTE=ChloeBlackSythe;41236911]Want to ask if there is a framework that suits good looking design, With good functionality and not that many flaws with how it works. And yes i know about bootstrap, but that stuff just looks plain ugly.[/QUOTE]
[url]http://gumbyframework.com/[/url]
[url]http://tuktuk.tapquo.com/[/url]
There is also [url]http://foundation.zurb.com/[/url]
But design wise I think its worse than bootstrap
None of these frameworks are really designed to "look good" they are supposed to allow you to work faster and produce something presentable. They all require you to go over the top with your own design
[QUOTE=garry;41236254]I was looking at making a bbcode parser in javascript. So it will be parsed clientside instead of serverside.. and it will allow realtime previews etc. without involving the server at all.
Searching around the web everyone says it's dangerous and to avoid it. Is it impossible to do safely?[/QUOTE]
As long as you're not using the parsed data from the client as the end result when displaying it in a post (like storing the data the client parsed), it should be fine; so, really, you still have to parse the data server-side because you can't really trust what the client sends you (since that is easily modifiable), unless you want to go through and try to validate the HTML tags that are in it.
How can i fix this?
[IMG]http://i.imgur.com/zw60qbV.png[/IMG]
CSS:
[CODE]
.sub {
background-color: #FFF;
height: 50px;
width: 100%;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-bottom:2px solid #E0E0E0;
}
.searchinput {
box-sizing:border-border;
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;
width: 100%;
padding-right: 10px;
border-width:0;
display:block;
}
[/CODE]
HTML:
[CODE]
<div class="sub">
<form action="http://www.google.at/search">
<input class="searchinput" type="search" name="q" x-webkit-speech speech required onspeechchange="startSearch" size=100>
</form>
</div>
[/CODE]
I still want to keep it responsive and without stupid @media hacks.
[QUOTE=Loli;41182988]I have a problem, basically I'm making elements on my page fade as they're moving off screen and fade in as they are coming on screen. I've got this in the $(window).scroll() event handler, this of course means that every time I scroll it will stop the animation and call the function again. Anybody got any ideas or suggestions?
[code]
$(window).scroll(function () {
updateTiles();
});
function updateTiles()
{
$('[class^="tile"]').each(function () { // <---loop the divs class starts with .tile
var position = $(this).offset().top + $(this).height();
if ((position - $(window).scrollTop()) < 64) { //<---mark the $(this).offset().top of current object
$(this).stop().fadeTo(1000, 0); //<----fadeOut the current obj
} else if (($(this).offset().top - ($(window).scrollTop() + $(window).height())) > -64) { //<---mark the $(this).offset().top of current object
$(this).stop().fadeTo(1000, 0); //<----fadeOut the current obj
} else{
$(this).stop().fadeTo(1000, 1); //<----fadeIn the current obj
}
});
}
[/code][/QUOTE]
Did my solution help you at all by the way?
So I am new to PDO, trying to get this very simple script working, its an extremely primitive login script, but for some reason I cant get it to find a user, here's what I have at the moment.
[code]
$sql = "SELECT * FROM users WHERE username = ':username' AND password = ':password'";
$stmt = $dbcon->prepare($sql);
$stmt->execute(array('username' => $username,'password' => $password));
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$results = $stmt->fetchAll();
if(count($results) > 0)
{
foreach($results as $row)
{
echo $row['username'];
echo $row['password'];
}
}
else
{
echo "no users";
}
[/code]
It connects to the DB fine, I have checked and there are values stored in username and password, but on the last if statement it always echo's "no users" no matter what.
Any help would be very much appreciated I think its probably down to me just doing something stupidly dumb.
[QUOTE=Sharpshooter;41244683]So I am new to PDO, trying to get this very simple script working, its an extremely primitive login script, but for some reason I cant get it to find a user, here's what I have at the moment.
[code]
$sql = "SELECT * FROM users WHERE username = ':username' AND password = ':password'";
$stmt = $dbcon->prepare($sql);
$stmt->execute(array('username' => $username,'password' => $password));
$stmt->setFetchMode(PDO::FETCH_ASSOC);
$results = $stmt->fetchAll();
if(count($results) > 0)
{
foreach($results as $row)
{
echo $row['username'];
echo $row['password'];
}
}
else
{
echo "no users";
}
[/code]
It connects to the DB fine, I have checked and there are values stored in username and password, but on the last if statement it always echo's "no users" no matter what.
Any help would be very much appreciated I think its probably down to me just doing something stupidly dumb.[/QUOTE]
check if the sql works on the mysql database?
[editline]29th June 2013[/editline]
you have to set fetch right after you prepare btw
Also, remove the single quotes from :username and :password; PDO automatically adds them
Sorry, you need to Log In to post a reply to this thread.