Web Development Questions That Don't Need Their Own Thread v2
3,079 replies, posted
[QUOTE=toaster468;32416128]What was that website that gave away awesome free textured tiled backgrounds?[/QUOTE]
[url=http://subtlepatterns.com/]Subtle Patterns[/url]?
[QUOTE=Jelly;32416190][url=http://subtlepatterns.com/]Subtle Patterns[/url]?[/QUOTE]
Thank you sir.
I just made an account for x10 hosting then tried to use FTPbox.
Then deleted everything because it pissed me off for being slow.
I later went to my lithium account ftp.
I went away from my laptop for like 1 minute later came back and deleted the "testing" folder thinking i was still on the x10 hosting ftp and now is trying to revive my stuff back.
:suicide:
[editline]21st September 2011[/editline]
Oh ya, i have a svn that i made for fun that i have my updated files. :v: yay for backups???? no svn.
[editline]21st September 2011[/editline]
And now im posting on wrong threads. :suicide:
I'm learning Javascript using jQuery for my Web Design 2 class and I am working on my first assignment which is to make a div appear when you click on another div (bonus points for animating it) so I'm just trying to figure out how to select divs.
HTML
[code]
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="custom.js"></script>
</head>
<body>
<div id="RE4"> <a href="http://www.google.com" >I just hope these guys don't keep respawning...</a></div>
<div id="RE5"> Oh, alright. We're good. Alright - Alright! Tombstones? I just want to see the end of this puzzle... </div>
</body>
</head>
[/code]
jQuery
[code]
$(document).ready(function() {
$("#RE4").click(function() {
alert ("Dude, dude, slow the fuck down.");
}];
});
[/code]
My jQuery code isn't successfully finding the div I call RE4. What do.
[QUOTE=Take_Opal;32416757]I'm learning Javascript using jQuery for my Web Design 2 class and I am working on my first assignment which is to make a div appear when you click on another div (bonus points for animating it) so I'm just trying to figure out how to select divs.
HTML
[code]
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="custom.js"></script>
</head>
<body>
<div id="RE4"> <a href="http://www.google.com" >I just hope these guys don't keep respawning...</a></div>
<div id="RE5"> Oh, alright. We're good. Alright - Alright! Tombstones? I just want to see the end of this puzzle... </div>
</body>
</head>
[/code]
jQuery
[code]
$(document).ready(function() {
$("#RE4").click(function() {
alert ("Dude, dude, slow the fuck down.");
}];
});
[/code]
My jQuery code isn't successfully finding the div I call RE4. What do.[/QUOTE]
Small error in your JS.
[code]
$(document).ready(function() {
$("#RE4").click(function() {
alert ("Dude, dude, slow the fuck down.");
}]; [b]//Need a closed parenthesis, not bracket[/b]
});
[/code]
Ah! I didn't notice that. Thank you very much.
[editline]21st September 2011[/editline]
How would you suggest I make the first div something you can click on? Or should the .click() do that for me? If so, it isn't working for me and I've done something wrong.
[code]
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="custom.js"></script>
</head>
<body>
<div id="RE4"> I just hope these guys don't keep respawning...</div>
<div id="RE5" style="display: none"> Oh, alright. We're good. Alright - Alright! Tombstones? I just want to see the end of this pu </div>
</body>
</head>
[/code]
[code]
$(document).ready(function() {
$("#RE4").click(function() {
$(#RE5).show("slow");
});
});
[/code]
[QUOTE=Take_Opal;32417495]Ah! I didn't notice that. Thank you very much.
[editline]21st September 2011[/editline]
How would you suggest I make the first div something you can click on? Or should the .click() do that for me? If so, it isn't working for me and I've done something wrong.
[code]
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="custom.js"></script>
</head>
<body>
<div id="RE4"> I just hope these guys don't keep respawning...</div>
<div id="RE5" style="display: none"> Oh, alright. We're good. Alright - Alright! Tombstones? I just want to see the end of this pu </div>
</body>
</head>
[/code]
[code]
$(document).ready(function() {
$("#RE4").click(function() {
$(#RE5).show("slow");
});
});
[/code][/QUOTE]
add
style='cursor:pointer;'
Hmm.. If that would fix it then something is wrong with my code because it didn't show the second div.
[QUOTE=Take_Opal;32418135]Hmm.. If that would fix it then something is wrong with my code because it didn't show the second div.[/QUOTE]I've had problems registering click() with divs before, try putting the script in the body after the HTML for the divs. Or try this:
[code]<div id="RE4" onclick="$('#RE5').show('slow');">[/code]
[QUOTE=Octave;32418164]I've had problems registering click() with divs before, try putting the script in the body after the HTML for the divs. Or try this:
[code]<div id="RE4" onclick="$('#RE5').show('slow');">[/code][/QUOTE]
Yeah, that worked. I'll show my code to my teacher tomorrow and see what the deal was. Thanks for the help.
This is probably a really silly question, but are there any good free web hosting sites?
I don't have anything special I want to host, but I certainly don't have the money to pay for a site. Just something I thought I'd ask...
[QUOTE=slayer20;32418629]This is probably a really silly question, but are there any good free web hosting sites?
I don't have anything special I want to host, but I certainly don't have the money to pay for a site. Just something I thought I'd ask...[/QUOTE]
ask your parents for $10 to use on the internet and get a free domain from dot.tk or co.cc use lithiumhosting. ORRRR you can host the web yourself.
[QUOTE=zzlawlzz;32418659]ask your parents for $10 to use on the internet and get a free domain from dot.tk or co.cc use lithiumhosting. ORRRR you can host the web yourself.[/QUOTE]
I don't need to ask my parents for money. And wouldn't it be $10 a month?
Also, how would I host it myself?
[QUOTE=slayer20;32418629]This is probably a really silly question, but are there any good free web hosting sites?
I don't have anything special I want to host, but I certainly don't have the money to pay for a site. Just something I thought I'd ask...[/QUOTE]
If you're really desperate, I can hook you up. PM me if you're interested.
[QUOTE=Anti Christ;32418972]If you're really desperate, I can hook you up. PM me if you're interested.[/QUOTE]
I ain't performing no sexual services for you, if that's where you're going with this.
[QUOTE=Take_Opal;32417495]Ah! I didn't notice that. Thank you very much.
[editline]21st September 2011[/editline]
How would you suggest I make the first div something you can click on? Or should the .click() do that for me? If so, it isn't working for me and I've done something wrong.
[code]
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="custom.js"></script>
</head>
<body>
<div id="RE4"> I just hope these guys don't keep respawning...</div>
<div id="RE5" style="display: none"> Oh, alright. We're good. Alright - Alright! Tombstones? I just want to see the end of this pu </div>
</body>
</head>
[/code]
[code]
$(document).ready(function() {
$("#RE4").click(function() {
$(#RE5).show("slow");
});
});
[/code][/QUOTE]
You're missing quotes in your .show() line for the #RE5 object call.
[QUOTE=slayer20;32419178]I ain't performing no sexual services for you, if that's where you're going with this.[/QUOTE]
fuck
[QUOTE=slayer20;32418679]I don't need to ask my parents for money. And wouldn't it be $10 a month?
Also, how would I host it myself?[/QUOTE]
its $10 per year.
Anyone experienced with Code Igniter?
How would you go about matching the password a person entered at login with an encoded one in the database? Or do I not encode the password in the database?
My login method inside my controller:
[php]
// yadda yadda
if($this->form_validation->run() == FALSE) {
// if form has not been run or has errors
$this->load->view('template', $data);
} else {
// if form has no errors and has been submitted
$user_id = $this->User_model->check_login($username, $password); // returns empty if no id
if(! $user_id) {
// if no user id
$this->session->set_flashdata('login_error', 'Invalid username or password.');
$this->session->set_flashdata('encoded_password', $this->encrypt->encode($password)); // testing purposes
redirect(base_url() . 'user/login/');
} else {
// if user id exists
// set session variables - need to make a user library for this kind of shit
//$this->session->set_userdata('logged_in', TRUE);
//$this->session->set_userdata('user_id', $user_id);
}
}
[/php]
In my User_model class:
[php]
public function check_login($username, $password) {
$query_str = "SELECT * FROM accounts WHERE username = ? AND password = ?";
$query = $this->db->query($query_str, array($username, $password));
if($query->num_rows() == 1) {
return $query->row(0)->id;
} else {
return FALSE;
}
}
[/php]
If I needed to decode the password in the database, I'd need to do it in the model somewhere.. but I don't know.
Edit:
Figured out that a unique string always gets a new encoded string unlike md5 or sha1. Therefore I was checking their password with the encode function expecting it would always match with the database password. THEN I found out it can decode different strings that are the same thing. Maybe I should read up on the manual more :].
New code:
[php]
public function check_login($username, $password) {
$query_username_str = "SELECT * FROM accounts WHERE username = ?";
$query = $this->db->query($query_username_str, array($username));
if($query->num_rows() == 1) {
// username exists
foreach($query->result() as $row) {
// each column will be turned into array of $row[]
$decoded_db_password = $this->encrypt->decode($row->password);
}
if($password == $decoded_db_password) {
return $query->row(0)->id;
} else {
return FALSE;
}
} else {
// username doesn't exist
return FALSE;
}
}
[/php]
God I've come a long ways.
Where did facepunch get their icons for the rating system? I've seen them on so many sites, but don't know where everyone is getting them.
[QUOTE=Cypher100;32419553]Where did facepunch get their icons for the rating system? I've seen them on so many sites, but don't know where everyone is getting them.[/QUOTE]
[url]http://www.famfamfam.com/lab/icons/[/url]
how would one assign checkbox options a value so when you check them and press submit it adds up the values and displays them on another page?
[editline]22nd September 2011[/editline]
in html
all the methods I've found use javascript
[QUOTE=ashxu;32423480]how would one assign checkbox options a value so when you check them and press submit it adds up the values and displays them on another page?
[editline]22nd September 2011[/editline]
in html
all the methods I've found use javascript[/QUOTE]
You cannot do addition with HTML, you either have to do it with javascript, or on the back-end. With PHP, assuming all the fields in the form should be summed:
[php]$total = array_sum($_POST);[/php]
Sigh forgot the MySQL database when I backed up my site after the Brohoster crap. Lost almost a year of Wordpress posts (which detailed a school project i worked like 100 hours on). sssssssssssssssssoaölflaskjf
[quote]this might sound silly but:
im trying to pad some text thats in a div header so that it isnt in the corner
[img]http://1337.jp/_/2011/09/Screenshot-2011-09-22_17.19.54.png[/img]
padding:5%; gives me
[img]http://1337.jp/_/2011/09/Screenshot-2011-09-22_17.20.32.png[/img]
[/quote]
oh i get it now
i made a h1 and styled the h1 instead of the whole div and now it works :pwn:
I might be misunderstanding how absolute positioning works, but I thought it was supposed to use its container as the origin (or whatever), but I'm doing it and it's just using the top left corner of the browser.
[code]
<div id="aside">
<ul>
<li style="position:absolute; left:100px; top:50px;">Bremerton</li>
<li style="position:absolute; left:100px; top:150px;">Port Orchard</li>
<li style="position:absolute; left:100px; top:150px;">Vaughn</li>
<li style="position:absolute; left:100px; top:250px;">Lakebay</li>
<li style="position:absolute; left:100px; top:300px;">Gig Harbor</li>
<li style="position:absolute; left:100px; top:150px;">Artondale</li>
<li style="position:absolute; left:100px; top:150px;">Purdy</li>
<li style="position:absolute; left:100px; top:150px;">Belfair</li>
</ul>
</div>
[/code]
I'm trying to get names of places on a map line up right, I'd rather not put them on the image, so that all the text has the same look. Sorry if this is dumb, I'm not a web dev or anything, just making a website for myself.
[editline]22nd September 2011[/editline]
Of course, when I ask I figure it out, I just had to set the containers position to 'relative' I guess.
[QUOTE=Shadaez;32429974]I might be misunderstanding how absolute positioning works, but I thought it was supposed to use its container as the origin (or whatever), but I'm doing it and it's just using the top left corner of the browser.
[code]
<div id="aside">
<ul>
<li style="position:absolute; left:100px; top:50px;">Bremerton</li>
<li style="position:absolute; left:100px; top:150px;">Port Orchard</li>
<li style="position:absolute; left:100px; top:150px;">Vaughn</li>
<li style="position:absolute; left:100px; top:250px;">Lakebay</li>
<li style="position:absolute; left:100px; top:300px;">Gig Harbor</li>
<li style="position:absolute; left:100px; top:150px;">Artondale</li>
<li style="position:absolute; left:100px; top:150px;">Purdy</li>
<li style="position:absolute; left:100px; top:150px;">Belfair</li>
</ul>
</div>
[/code]
I'm trying to get names of places on a map line up right, I'd rather not put them on the image, so that all the text has the same look. Sorry if this is dumb, I'm not a web dev or anything, just making a website for myself.[/QUOTE]Use relative positioning. Relative is in relation to the container; absolute is in relation to the page.
[QUOTE=Octave;32430020]Use relative positioning. Relative is in relation to the container; absolute is in relation to the page.[/QUOTE]
no relative is in relation to the position it would normally be, absolute is supposed to be in relation to its container, but I guess you have to tell the container it's position is relative, although I thought it always was.
nvm static is default
Hello, I'm just coming in here as a small question on SQL (mysql)
So if my table is like this
[code]
X/Y/Z/USER/ETC
1/1/1/benjojo/123
1/1/1/Jane/123
1/1/1/benjojo/123
1/1/1/forman/123
1/1/1/benjojo/123
[/code]
How do I get back from a query
[code]
user/count
benjojo/3
jane/1
forman/1
[/code]
Is there a easy way to do this in one SQL statement?
How can I create something similar to the like/dislike ratio bar on youtube?
Lets say I have 1 +'s and 2 -'s like this:
[IMG]http://i51.tinypic.com/2r3dzpv.png[/IMG]
How could I make a bar go in a ratio of 1:2 like this? or any other ratio. I tried to find some type of formula, but nothing.
Example:
[IMG]http://i53.tinypic.com/15oeaex.png[/IMG]
oh, and the bar is 200px wide
Sorry, you need to Log In to post a reply to this thread.