• Web Development Questions That Don't Need Their Own Thread v2
    3,079 replies, posted
[QUOTE=toaster468;31917189]I finished Rails for Zombies, but the problem is, they only taught you some basics [i]after[/i] it was installed. Is there any tutorial for setting up a rails server on my website?[/QUOTE] Use [url=http://www.modrails.com/]Passenger[/url]. Works on both Apache and nginx
[QUOTE=toaster468;31917189]I finished Rails for Zombies, but the problem is, they only taught you some basics [i]after[/i] it was installed. Is there any tutorial for setting up a rails server on my website?[/QUOTE] nginx + [url=http://code.macournoyer.com/thin/]Thin[/url] if you have a server with 128 MB RAM like I do :v: You do realise you can test locally, in case that's what you mean, right? "rails s"
just a quick question, can anyone help me with this snippet of code, it keeps giving me the error... [code] Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''25/08/11'')' at line 1 [/code] when i try to run this... [code] $name = mysql_real_escape_string( strip_tags( $name ) ); $description = mysql_real_escape_string( strip_tags( $description ) ); $contact = mysql_real_escape_string( strip_tags( $contact ) ); $website = mysql_real_escape_string( strip_tags( $website ) ); $keyfeatures = mysql_real_escape_string( strip_tags( $keyfeatures ) ); $date = date("d/m/y'"); mysql_select_db($database); $result = mysql_query("INSERT INTO `robamcou_ukcons`.`products` (`id`, `title`, `description`, `contact`, `website`, `keyfeatures`, `date`) VALUES ('" . rand(1, 10000) . "', '" . $name . "', '" . $description . "', '" . $contact . "', '" . $website . "', '" . $keyfeatures . "', '" . $date . "');"); [/code]
[QUOTE=Bambo.;31937113]just a quick question, can anyone help me with this snippet of code, it keeps giving me the error... [code] Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''25/08/11'')' at line 1 [/code] when i try to run this... [code] $name = mysql_real_escape_string( strip_tags( $name ) ); $description = mysql_real_escape_string( strip_tags( $description ) ); $contact = mysql_real_escape_string( strip_tags( $contact ) ); $website = mysql_real_escape_string( strip_tags( $website ) ); $keyfeatures = mysql_real_escape_string( strip_tags( $keyfeatures ) ); $date = date("d/m/y'"); mysql_select_db($database); $result = mysql_query("INSERT INTO `robamcou_ukcons`.`products` (`id`, `title`, `description`, `contact`, `website`, `keyfeatures`, `date`) VALUES ('" . rand(1, 10000) . "', '" . $name . "', '" . $description . "', '" . $contact . "', '" . $website . "', '" . $keyfeatures . "', '" . $date . "');"); [/code][/QUOTE]You know you can stick variables directly into double quoted strings, right? No need to use the concatenation operator. Also use PDO
You have an additional ' at the end of $date, thus making it '25/08/11''.
[QUOTE=Dragory;31937694]You have an additional ' at the end of $date, thus making it '25/08/11''.[/QUOTE] I love you, i've been fucking around with the query for hours now. Thanks!
Ok so basically all I want to do is if a session is running/active I want to hide one div tag and show another. How can I do this? [url]http://jamglobe.net/[/url] Just wanna hide that top bit with the please register / login boxes and display "Welcome, username" Here's the code for the top bit, it's probably a mess and a bad way of doing it but I'm fairly new to it all. [code]<div class="register">Welcome, user. Please sign up... <img src="icons/user_go.png" width="16" height="16" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="-1,1,20,20" href="register.php" /> </map> </div> <div class="login"> <form method="post" action="checklogin.php" style="width:530px;height:22px;float:right;" name="loginform" id="loginform"> <input type="text" name="username" value="Username" id="username" /> <input type="password" name="password" value="password" id="password" /> <input name="image" type="image" value="submit" src="icons/accept.png" style="margin-top:2px;" alt="SUBMIT" align="right" width="16" height="16" border="0" /> </form> </div>[/code]
Can anyone answer my question, pretty please?
[QUOTE=Gustafa;31939845]Ok so basically all I want to do is if a session is running/active I want to hide one div tag and show another. How can I do this? [url]http://jamglobe.net/[/url] Just wanna hide that top bit with the please register / login boxes and display "Welcome, username" Here's the code for the top bit, it's probably a mess and a bad way of doing it but I'm fairly new to it all. [code]<div class="register">Welcome, user. Please sign up... <img src="icons/user_go.png" width="16" height="16" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="-1,1,20,20" href="register.php" /> </map> </div> <div class="login"> <form method="post" action="checklogin.php" style="width:530px;height:22px;float:right;" name="loginform" id="loginform"> <input type="text" name="username" value="Username" id="username" /> <input type="password" name="password" value="password" id="password" /> <input name="image" type="image" value="submit" src="icons/accept.png" style="margin-top:2px;" alt="SUBMIT" align="right" width="16" height="16" border="0" /> </form> </div>[/code][/QUOTE] Use php to include a file with everything you want to be shown when the user is logged in and include another file if they aren't. And don't use image maps. Use <a></a> tags instead.
[QUOTE=pdkm931;31940677]Use php to include a file with everything you want to be shown when the user is logged in and include another file if they aren't. And don't use image maps. Use <a></a> tags instead.[/QUOTE] Alright I'll give it a go, and thanks for the advice I'll bear that in mind.
In [url=http://pusher.com/]this site[/url], the container holding the gallery thingy at the top is called the "masthead", and each of the page things are marked as "hero" - what does the "hero" mean?
[QUOTE=a2h;31951696]In [URL="http://pusher.com/"]this site[/URL], the container holding the gallery thingy at the top is called the "masthead", and each of the page things are marked as "hero" - what does the "hero" mean?[/QUOTE] It's ridiculous how hard it is for me to try and say this plainly (or even just paraphrase the following article), but it's generally just a term used for a large promotional image. Apple makes heavy usage of Hero images and to great effect. This article explains it better than I ever could: [URL]http://www.istockphoto.com/article_view.php?ID=790[/URL]
Is there a way to copy one blog content to another in real time? I thought RSS feeder would be sufficient enough, but I realized that RSS copies only the title and first few lines of the blog post.
[QUOTE=oldboy;31964353]Is there a way to copy one blog content to another in real time? I thought RSS feeder would be sufficient enough, but I realized that RSS copies only the title and first few lines of the blog post.[/QUOTE] Depends on what blog platform you're using. Some support JSON, so you can probably use that.
Could anyone tell my why this doesn't center the inputs? CSS: [code] div.field { margin: 0 auto 5px; } [/code] HTML: [code] <form> <div class="field"> <input type="text" name="username" /> </div> <div class="field"> <input type="password" name="password" /> </div> </form> [/code] Go easy on me i just started learning today :P
[QUOTE=MayorBee;31967606]Could anyone tell my why this doesn't center the inputs? CSS: [code] div.field { margin: 0 auto 5px; } [/code] HTML: [code] <form> <div class="field"> <input type="text" name="username" /> </div> <div class="field"> <input type="password" name="password" /> </div> </form> [/code] Go easy on me i just started learning today :P[/QUOTE] Try margin: 0 auto; or you could just text-align: center; the form.
margin: 0 auto; didn't change anything but text-align fixed it, thanks. Still somewhat puzzled as to why margin didn't work though.
[QUOTE=MayorBee;31967688]margin: 0 auto; didn't change anything but text-align fixed it, thanks. Still somewhat puzzled as to why margin didn't work though.[/QUOTE] div.field needs a width.
[QUOTE=R1Z3;31968102]div.field needs a width.[/QUOTE] width: auto; should do.
I just started coding JQuery and I have ran into a but of a wall. I am trying to make it so when I click on a div class (button#), it will open up a page (text#), by sliding the div that is open up. Then the other div would open after a delay of 0.2 seconds. [code] $(function(){ $(function(){ $('.text1').hide(); $('.text2').hide(); $('.text3').hide(); }); $('.button1').click(function(){ $('.text2').slideUp(600); $('.text3').slideUp(600); $('.text1').slideDown(600); }); $('.button2').click(function(){ $('.text1').slideUp(600); $('.text3').slideUp(600); $('.text2').slideDown(600); }); $('.button3').click(function(){ $('.text1').slideUp(600); $('.text2').slideUp(600); $('.text3').slideDown(600); }); }) [/code] This is what I have so far, as you can tell it only closes the divs that are possibly open and opens the selected div with out a delay. I have tried queues and delays but I failed, please help.
[QUOTE=Dark7533;31979108]I just started coding JQuery and I have ran into a but of a wall. I am trying to make it so when I click on a div class (button#), it will open up a page (text#), by sliding the div that is open up. Then the other div would open after a delay of 0.2 seconds. [code] $(function(){ $(function(){ $('.text1').hide(); $('.text2').hide(); $('.text3').hide(); }); $('.button1').click(function(){ $('.text2').slideUp(600); $('.text3').slideUp(600); $('.text1').slideDown(600); }); $('.button2').click(function(){ $('.text1').slideUp(600); $('.text3').slideUp(600); $('.text2').slideDown(600); }); $('.button3').click(function(){ $('.text1').slideUp(600); $('.text2').slideUp(600); $('.text3').slideDown(600); }); }) [/code] This is what I have so far, as you can tell it only closes the divs that are possibly open and opens the selected div with out a delay. I have tried queues and delays but I failed, please help.[/QUOTE]Try using IDs instead of classes, seems like the classes there aren't needed.
I just figured out how to do it i feel dumb. D= [code] $(function(){ $(function(){ $('.text1').hide(); $('.text2').hide(); $('.text3').hide(); }); $('.button1').click(function(){ $('.text2').slideUp(600); $('.text3').slideUp(600); $('.text1').delay(800).slideDown(600); }); $('.button2').click(function(){ $('.text1').slideUp(600); $('.text3').slideUp(600); $('.text2').delay(800).slideDown(600); }); $('.button3').click(function(){ $('.text1').slideUp(600); $('.text2').slideUp(600); $('.text3').delay(800).slideDown(600); }); }) [/code]
Would someone mind posting some book recommendations for CSS, HTML, PHP, and whatever else. Thanks.
[QUOTE=Dark7533;31979794]I just figured out how to do it i feel dumb. D= [code] $(function(){ $(function(){ $('.text1').hide(); $('.text2').hide(); $('.text3').hide(); }); $('.button1').click(function(){ $('.text2').slideUp(600); $('.text3').slideUp(600); $('.text1').delay(800).slideDown(600); }); $('.button2').click(function(){ $('.text1').slideUp(600); $('.text3').slideUp(600); $('.text2').delay(800).slideDown(600); }); $('.button3').click(function(){ $('.text1').slideUp(600); $('.text2').slideUp(600); $('.text3').delay(800).slideDown(600); }); }) [/code][/QUOTE] You have a $(function() {}) within a $(function() {}). I don't think there is exactly anything wrong with it, but it is redundant.
[QUOTE=deadeye536;31980361]You have a $(function() {}) within a $(function() {}). I don't think there is exactly anything wrong with it, but it is redundant.[/QUOTE] That is so I can reference the code at the top of my html and have the js still run. I could make it this but the way I have it is shorter. [code] $(document).ready(function(){ bla bla bla }) [/code] @Gaza Pen Pal I don't know about books but if you are just starting to code than Think Vitamin is a good source. Think Vitamin has a lot of great videos on html-html5 css-css3 jquery java ruby and other stuff. It costs money to watch all the videos, but they have over 400 of them.
You can leave the first $(function()) call, but the second one is redundant. Edit: This [code]$(function(){ $('.text1').hide(); $('.text2').hide(); $('.text3').hide(); ... })[/code] Is equivalent to this [code]$(function(){ $(function(){ $('.text1').hide(); $('.text2').hide(); $('.text3').hide(); }); ... })[/code]
Oh he was talking about there, I fixed it, thanks. Is there any way to shorten the code so I don't have to use the slideUp function twice or is there a way to find what one is down then make it slide up?
[QUOTE=Dark7533;31982336]Oh he was talking about there, I fixed it, thanks. Is there any way to shorten the code so I don't have to use the slideUp function twice or is there a way to find what one is down then make it slide up?[/QUOTE] For your case, I would recommend doing a few things in your HTML structure. [html] <nav> <ol> <li id="button1">Show Text 1</li> <li id="button2">Show Text 2</li> <li id="button3">Show Text 3</li> </ol> </nav> <div id="container"> <div id="text1" class="text">Stuff</div> <div id="text2" class="text">Stuff</div> <div id="text3" class="text">Stuff</div> </div> [/html] Javascript: [code] $(function() { $('.text').hide(); $('#button1').click(function() { $('.text').slideUp(600); $('#text1').delay(800).slideDown(600); }) // ... }); [/code] This should make things easier to maintain.
Does anyone know how to make craigslist like emailing system on Ruby on Rails 3? Anyone have some tutorial link?
Guys, I need some help / advice, for my A2 project we've got to create a macromedia (Adobe) flash based product, and I decided to do a basic website, would some of you be able to provide some tips / tutorials to help me get started and achieve a decent grade? Much appreciated guys!
Sorry, you need to Log In to post a reply to this thread.