Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=gokiyono;42784949]Wouldn't getting all variables in the document be a bit overkill?[/QUOTE]
Did you read the part where he says that it won't really work well at all and that there isn't really a good way to do it because it's not something you should ever need to do?
[QUOTE=KmartSqrl;42789635]Did you read the part where he says that it won't really work well at all and that there isn't really a good way to do it because it's not something you should ever need to do?[/QUOTE]
Well as said before, I can't remember why, so it just turned into curiosity.
The answer is no then.
fucking why....
well on
[url]http://almost-there.org/new/[/url]
The "Open Settings" Menu behaves properly and doesn't cause scroll issues
[t]http://puu.sh/5cwhx.png[/t]
However...
On [url]http://almost-there.org/new/firstTime.php[/url]
When you hit "Open Settings" it causes this scroll bug, wtf?
[t]http://puu.sh/5cwjn.png[/t]
[QUOTE=lkymky;42802242]fucking why....
well on
[url]http://almost-there.org/new/[/url]
The "Open Settings" Menu behaves properly and doesn't cause scroll issues
[t]http://puu.sh/5cwhx.png[/t]
However...
On [url]http://almost-there.org/new/firstTime.php[/url]
When you hit "Open Settings" it causes this scroll bug, wtf?
[t]http://puu.sh/5cwjn.png[/t][/QUOTE]
I don't see the scroll bug
But I do see a very sucky <h3>Welcome to Almost-There!</h3> that wants to bee all the way to the side...
[editline]8th November 2013[/editline]
[t]http://i.imgur.com/34DL5ci.png[/t]
Also this is pretty funky
[QUOTE=gokiyono;42802299]I don't see the scroll bug
But I do see a very sucky <h3>Welcome to Almost-There!</h3> that wants to bee all the way to the side...
[editline]8th November 2013[/editline]
[t]http://i.imgur.com/34DL5ci.png[/t]
Also this is pretty funky[/QUOTE]
something... went wrong...
Missing an end tag for the <h1> on firstTime.php fixed that
[img]http://puu.sh/5cwTo.png[/img]
[QUOTE=lkymky;42802325]something... went wrong...[/QUOTE]
[IMG]http://i.imgur.com/YyI6BCZ.png[/IMG]
?
removing the overflow:auto; from .everythingsolves it...
[QUOTE=gokiyono;42802336][IMG]http://i.imgur.com/YyI6BCZ.png[/IMG]
?
removing the overflow:auto; from .everythingsolves it...[/QUOTE]
Thank you :D
anyone here good at mongodb? Why doesn't my query work?
db.collection.find(
{ "a":[ { "b":{ "$in":[ 361 ] } },{ "c":{ "$in":[ 30 ] } } ] }
)
And the document looks like this:
{
"name":"name",
"a":{[
{ "b": 361,
"c":30 },
{ "b": 362,
"c": 31},
{ "b": 363,
"c": 33}
]
}
}
Can someone explain to me what the fuck Google is doing? Everything they're doing is fucked up, I mean aren't Google essentially "the web" right now and they just break things constantly. Two Google+ profiles, a page for my YouTube and a personal one, it doesn't update or sync and is constantly down. What are they trying to do here. :suicide:
Okay so I have this square loading function, basically I want it to load windows live tile type things that show different information of all types (weather to user info to server info and back)
So anyways I got squares to load, I can handle making a function to make alternating sizes and backgrounds and such... but I'm wondering... can I just load content by loading another function?
here let me show you
...
[code]
<?
//this is where a function for content within the square will be defined, but it may also be from an include file
function squares( $squareContent = "/*This is where id imagine id put the variable for the function name but I'm bad at coding so please help me */", $squareTitle = "squareTitle \not defined!" ) {
echo "<div id='frontBody' class='animateSquare theBGcolor cf'> <h3>" . $squareTitle . "</h3><hr />";
// This is where I want the function to happen
echo "</div>"; }
?>
[/code]
Real life example: [url]http://almost-there.org/new/[/url]
Look for id="frontBody" #frontBody
[editline]10th November 2013[/editline]
OH ALSO squares are loaded like this...
squares( $squareTitle='New Users' );
so I guess they will be loaded like...
squares( $squareTitle='New Users' 'thisFuckingSquare' );
[QUOTE=CBastard;42821522]@Moofy
Put the scripts in the head.[/QUOTE]
[code]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="http//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<title>About</title>
<script>
$(document).ready(function() {
$(".hover").mouseenter(function() {
$(this).animate({box-shadow: "0 0 10px #888"
}, 500);
});
</script>
</head>
<body>
<img src="http://lorempixel.com/400/400/nature" alt="Image" class="hover">
</body>
</html>
[/code]
Quite new to jQuery, just messing about but I believe if it's in the head I do the (document).ready.
[QUOTE=Moofy;42821503]What am I doing wrong?
[code]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>About</title>
</head>
<body>
<img src="http://lorempixel.com/400/400/nature" alt="Image" class="hover">
<script src="http//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$(".hover").mouseenter(function() {
$(this).animate({box-shadow: "0 0 10px #888"
}, 500);
</script>
</body>
</html>
[/code][/QUOTE]
Some nice people from Bitstorm [URL="http://www.bitstorm.org/jquery/shadow-animation/"]extended the .animate[/URL] function.
Or you could go with [URL="http://jsfiddle.net/LK4Lh/"]transitions[/URL], i suppose... (Though I think it has a problem with IE9)
I have to create a table by reading in a file..
[code]
<div id="list">
<ul id="control">
<li class="button" onclick="sortTable(0, 'str', '1');" ondblclick="sortTable(0, 'str', '-1');">Item</li>
<li class="button" onclick="sortTable(1, 'str', '1');" ondblclick="sortTable(1, 'str', '-1');">Code</li>
<li class="button" onclick="sortTable(2, 'num', '1');" ondblclick="sortTable(2, 'num', '-1');">Price</li>
<li class="button" onclick="sortTable(3, 'num', '1');" ondblclick="sortTable(3, 'num', '-1');">Quantity</li>
<li class="button" onclick="sortTable(4, 'num', '1');" ondblclick="sortTable(4, 'num', '-1');">Amount</li>
</ul>
<?php
error_reporting(E_ALL);
ini_set("display_errors", "stdout");
function openFile()
{
$data = file_get_contents("db.txt", "r");
return explode("\n", $data);
}
function makeTable()
{
$array = openFile();
foreach ($array as $item)
{
echo "<ul>";
$list = explode("@", $item);
foreach($list as $col)
{
echo "<li>" . $col;
echo "</li>";
}
echo "</ul>";
}
}
makeTable();
?>
<ul>
<li class="item">Example</li>
<li>G01</li>
<li class="number">14.99</li>
<li class="number">2</li>
<li class="number">29.98</li>
</ul>
</div>[/code]
I originally was using DOM methods to create the elements and append them but it wasn't doing anything, so i replaced them with echo and it worked. Now, the table's built in sorting method doesn't work... Is there a "proper" way to add rows to the table? I also have to make a form that uses POST to add new rows to the table so i think using the DOM would be appropriate except i can't make it display any elements i create.
[QUOTE=CBastard;42821522]@Moofy
Put the scripts in the head.[/QUOTE]
I'm too tired for this but [url=http://developer.yahoo.com/performance/rules.html#js_bottom]are you sure?[/url]
[QUOTE=asantos3;42825090]I'm too tired for this but [url=http://developer.yahoo.com/performance/rules.html#js_bottom]are you sure?[/url][/QUOTE]
If he learned it from the learning center, they also use scripts at the bottom.
gokiyono told me to put it at the bottom when I first started just to make sure it loads after the DOM, but I'm quite familiar with starting my jQuery with:
[code]
$(document).ready(function() {
});
[/code]
So I guess regardless what I'm do I'm set :v:
[QUOTE=Moofy;42826658]gokiyono told me to put it at the bottom when I first started just to make sure it loads after the DOM, but I'm quite familiar with starting my jQuery with:
[code]
$(document).ready(function() {
});
[/code]
So I guess regardless what I'm do I'm set :v:[/QUOTE]
[code]$(function() {
});[/code]
[QUOTE=jung3o;42826716][code]$(function() {
});[/code][/QUOTE]
What? It should function after the document is ready, that's at least what I've learned.
iirc jquery will by default execute when the document is ready and will make that redundant.
[QUOTE=01271;42827091]iirc jquery will by default execute when the document is ready and will make that redundant.[/QUOTE]
That must be a huge lie because everywhere it tells me to make sure I execute after the document is ready. :dance:
I've been trying to do some basic ASP.net (C#) with XML, but I'm having the most trouble with writing DocTypes, everything else works fine, but it keeps telling me I can't use .DTDs in the DOCTYPE when doing this;
[code]
writer.WriteDocType("squad", null, "squad.dtd", null);
[/code]
I've tried looking it up with Google, but it keeps giving me fixes for the XMLReader, rather than the XMLWriter, and since the Writer doesn't use the [I]ProhibitDTD[/I] setting I can't just set it to false and be on my way. I've probably done something stupidly wrong and haven't noticed it, but this is really starting to bug me.
I wouldn't be doing this if writing to the XML file wouldn't delete these declarations in the first place.
What is the minimum requirement for sessions and stuff in php? I'm trying to build the site in such a way that the serverside could be replaced relatively painlessly and the entire thing is done async, so all pages of html. Should I pass the session variable in the url?
[QUOTE=mdeceiver79;42828534]What is the minimum requirement for sessions and stuff in php? I'm trying to build the site in such a way that the serverside could be replaced relatively painlessly and the entire thing is done async, so all pages of html. Should I pass the session variable in the url?[/QUOTE]
Cookies. I'm aware of the possibility of passing the PHP session ID via GET/URL, but I have yet to see a reasonable use for that option, except for to site whose users refuse to allow cookies to be saved onto their computers.
Guessing by what I've understood from your a little vague description, your site utilizes AJAX to serve content, and that content is a raw HTML file saved somewhere on the server (probably a subdirectory)? There should be a simple solution for that with some clever use of Apache's RewriteEngine/similar feature of your webserver.
The following example assumes your .html files requested with AJAX are placed in a subdirectory called "subdirWithAjaxFiles", and that you have some other login page setting $_SESSION["loginTime"] to the value of time() on login.
[code]
# .htaccess
RewriteEngine On
RewriteRule subdirWithAjaxFiles/([a-zA-Z]+).html giveContent.php?file=$1.html
[/code]
[code]
<?php // giveContent.php
session_start();
define("LOGIN_EXPIRATION", 3600*24);
if (isset($_SESSION["loginTime"]) && time() > $_SESSION["loginTime"] + LOGIN_EXPIRATION) { // check whether the user is logged in and whether their login has not already expired
if (!isset($_GET["file"]) || strpos($_GET["file"], "../") !== false || !file_exists("subdirWithAjaxFiles/" . $_GET["file"])) {
// No ?file= was specified, it didn't exist or had a '../' in the filename.
echo "File not found.";
}
else {
echo file_get_contents("subdirWithAjaxFiles/" . $_GET["file"]);
}
}
else {
echo "You aren't logged in.";
}
[/code]
I know it's kind of a silly question but I'm new to jquery (and web dev in general) and I was wondering if this is the "proper" way to use jquery
[code]
$("#Element").css('color', 'red');
$("#Element").fadeIn(300);
$("#Element").text(Error);
$("#Element").delay(2000).slideUp(400).fadeOut(400);
[/code]
Should I assign a variable to the selected element or is using a selector on it every time an ok thing to do
[QUOTE=superstepa;42832688]I know it's kind of a silly question but I'm new to jquery (and web dev in general) and I was wondering if this is the "proper" way to use jquery
[code]
$("#Element").css('color', 'red');
$("#Element").fadeIn(300);
$("#Element").text(Error);
$("#Element").delay(2000).slideUp(400).fadeOut(400);
[/code]
Should I assign a variable to the selected element in question or is using a selector on it every time an ok thing to do[/QUOTE]
yes, you should assign variable to it before you make it do multiple functions.
(probably on top of the script as a global variable)
[editline]11th November 2013[/editline]
[QUOTE=Moofy;42826949]What? It should function after the document is ready, that's at least what I've learned.[/QUOTE]
What I posted is the samething, just shorter.
[QUOTE=jung3o;42832865]yes, you should assign variable to it before you make it do multiple functions.
(probably on top of the script as a global variable)
[/QUOTE]
That's actually what I did at first, dunno why I decided to change it. Thanks
[QUOTE=superstepa;42832989]That's actually what I did at first, dunno why I decided to change it. Thanks[/QUOTE]
Definitely do it that way. When you use the selector jQuery has to parse the DOM to find the elements that you're looking for, and if you don't assign it to a variable, it has to do it every time you use the selector which can be slow.
[url]http://www.youtube.com/watch?v=JhXa20NBRhU[/url]
Have anyone had this happen to them?
[editline]Later[/editline]
I managed to fix it...
I really don't understand how I did, but, woo.
[editline]FUCKTHISFUCKTHIS[/editline]
So it was the * that broke it.. Somehow
Sorry, you need to Log In to post a reply to this thread.