Jump to content

tidalik

Members
  • Posts

    29
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

tidalik's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Unfortunately L2c your fix doesn't work. It shifts the canvas down the page and I still have the first div sliding out when I hover on the second div.
  2. An image disappeared so you didn't realise the div was there. Try: http://jsfiddle.net/Xb2q9/4/
  3. I have 2 menu div's floating to the right of a canvas. They menus are designed to slide out on hover and slide back to normal afterwards. The problem is that when I hover on the second div, the location (position) of the first div shifts with it. Example of it in action is at: http://jsfiddle.net/Xb2q9/ I know it has to do with the order that the divs are listed and position: relative but haven't managed a work around. My HTML <table class="unpadded-table"> <tr> <td> <div id="screen"> <canvas id="screenCanvas" width="640" height="480" sytle="border:1px soid #000000;" class="example">Your browser doesn't support HTML5canvast</canvas> <div id="firstmenu"> <div id="firstmenucontents">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc elementum lacus nec felis condimentum, et feugiat felis adipiscing. In hac habitasse platea dictumst. Integer in felis placerat, porta arcu in, aliquam nulla. In fermentum sed odio sollicitudin lobortis. Morbi id commodo orci. Quisque semper sem in sem bibendum lobortis. Praesent nisl purus, sollicitudin non est vitae, dapibus dictum libero. Nam sem sem, lacinia sit amet quam quis, vulputate facilisis purus. Ut placerat euismod felis, non pharetra libero dictum in. Pellentesque elit est, lacinia sed nibh quis, tempor interdum enim. In ante ligula, bibendum et accumsan ut, sagittis quis purus. Morbi tempor nisi vel feugiat consectetur. Vivamus at porttitor risus, tristique bibendum risus. Nullam vel venenatis lectus. Maecenas quis interdum mauris.</div> </div> <div id="secondmenu"> <div id="secondmenucontents">Etiam varius orci in diam fringilla sollicitudin. Etiam ac vestibulum nisi, at vulputate massa. Proin porta nec metus tincidunt imperdiet. Sed vel pellentesque sapien. Quisque gravida eros eget neque commodo feugiat. Donec ut ante sit amet nisl auctor varius. Phasellus placerat arcu viverra lacus dictum, at lobortis massa dictum. Morbi eget imperdiet mauris. Sed lobortis venenatis turpis. Nulla et orci arcu. Nunc ultrices elit in massa venenatis venenatis. Aenean non nibh id massa hendrerit sodales vitae sed sapien.</div> </div> </div> </td> </tr> </table> My CSS: #firstmenu { float:right; background: url('http://www.bussecombat.com/images/rollover/rollover_10-Anatomy-of-a-bu.gif') no-repeat right top; padding-left: 10px; ; margin-top: 15px; padding-top: 0px; width: 10px; height: 180px; position:relative; overflow:hidden; transition: left 0.5s; -webkit-transition: left 0.5s; -moz-transition-duration:.5s; -o-transition-duration:.5s; display: inline-block; } #secondmenu { float:right; background: url('http://www.dailyblogtips.com/wp-content/uploads/googlevert.gif') no-repeat right top; padding-left: 10px; margin-left: 0px; padding-top: 0px; width: 10px; height: 250px; position:relative; overflow:hidden; transition: left 0.5s; -webkit-transition: left 0.5s; -moz-transition-duration:.5s; -o-transition-duration:.5s; margin-top: 250px; display: inline-block; } #firstmenucontents{ background: #ffffff; margin-right: 15px; margin-top: 0px; margin-left:0px; width: 135px; overflow:hidden; -webkit-transition-duration:.5s; -moz-transition-duration:.5s; -o-transition-duration:.5s; opacity:0.0; border:1px solid black; float:left; } #firstmenu:hover{ width: 150px; opacity:1.0; } #secondmenu:hover{ width: 150px; opacity:1.0; } #firstmenucontents:hover, #secondmenucontents:hover { opacity:1.0; width: 135px; } .example { border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; border:1px #000 solid; float: left; width: 655px; margin-left: 100px; width: }
  4. Hi all, I have a dynamic list that is refreshed regularly from the server using AJAX. When one of the listed items is in use, I highlight it and have an "In use" tag added. I'd like to be able hover over the "In use" tag and get details of the usage. I have written the php script that outputs the details of a usage when passed an ID, now I want to get the hover pop working. I've searched google a bit over the last couple of days but keep finding tutorials that use divs for the content (which doesn't work so well as I am already loading the list into a div). I'd appreciate some pointers Code currently in use: index.php <script> $(document).ready(function() { $("#list").load("current.php"); var refreshId = setInterval(function() { $("#list").load('current.php'); }, 3000); $.ajaxSetup({ cache: false }); }); </script> <!------Snip----------------> <h3>Current Usage</h3> <div id="list"> </div> current.php outputs a html table ie: <table id="registrations"> <tr><td>Number</td><td>In Use</td></tr><tr class="inuse"><td>5001</td><td><a href="../detaileduse.php?ref=5001" class="onhover" target=new>Yes</a></td></tr> <tr><td>5002</td><td></td></tr> </table> At present the link I've set up in the "In Use" doesn't work, but does if I choose to open in new window or tab.
  5. Have you noticed you are using all different variable names here? $search_type $type $searchterm $type isn't being set by anything (unless register_globals is on) for a switch you can do more than echo out something fex; $myVariable = cleanFunction($_GET(variable); //where cleanFunction sanitizes the imput switch ($myVariable){ case "Type 1": $columnName = "TypicalOne"; echo "Choosing TypicalOne"; break; case "Type 2": $columnName = "TypicalTwo"; echo "Choosing TypicalTwo"; break; default: $columnName = "Typicals"; echo "Choosing Default"; } So use the switch to set the variable that changes in the query.
  6. Er, you do know you have commented out the echo //echo "I'm not logged in"; header('Location: index.php'); And you need to set the session variable "real_name" before the rest will show....
  7. I'm trying to calculate the % influence (contribution) a certain ancestor has with in a family tree. Each generation has a % of influence which is [tex]1/x[/tex] where [tex]x[/tex] is the number of ancestors in the generation. So parents are 1/2, grandparents 1/4, greatgrandparents 1/8 etc etc. If a ancestor appears more than once, then it's influence is the sum of all instances is (such that if it's a parent and a grandparent then it's 1/2 + 1/4) I have a function that works well to tell me the number of ancestors in a generation and another that calulates the % influence. [ancestersPerGeneration() & getPercentage()] My database is structured so it is - id, name, fatherid, motherid I have a function that get's the parent's IDs and returns a 2 element array. //Set Generation number $gens = 4; $Id = 6916; //a random database member $ancestorList[0] = $Id; $ancestorInfluence[$Id]= 1; echo $ancestorList[0]." is the starter.<br>"; for ($k=1; $k < $gens; $k++){ //Work out how many entries to check this iteration $ro = ancestorsPerGeneration($k); for ($r=1; $r < $ro; $r++){ $mode = each($ancestorList); //Get Parents $parents = getParentIDs($mode[value]); //Get Contribution for each parent foreach ($parents as $parent) { $influence = getPercentage($k); $ancestorList[] = $parent; //Check if the parent is in the influence array already if (!in_array($parent, $ancestorInfluence)){ $ancestorInfluence[$parent] = $influence; } else { $ancestorInfluence[$parent] = $ancestorInfluence[$parent] + $influence; } echo "$ro Ancestors this generation. Currently at Ancestor $r.<br>"; echo "<p>$parent has $influence</p"; $r++; } } } $totalAncestors = totalAncestors($gens); echo "<h2>Expected there to be ".($totalAncestors+1)." in Ancestor array and there was ".count($ancestorList)."</h2><br>"; print_r($ancestorInfluence); There is something really *really* wrong with my logic. Output looks like this: I think perhaps I am going about this the wrong way. Can anyone else me straighten this out? Thanks
  8. Found the answer myself. The only way was to rewrite it as a join, went from running at 1.88 secs down to 0.31 secs select count(DISTINCT p1.PedigreeId) from peds p1, peds p2 where (p1.SireId = 3023 OR p1.DamId = 3023) AND (p1.PedigreeId = p2.SireId OR p1.PedigreeId = p2.DamId)
  9. I have a query that works, but desperately needs to be optimised. MySQL Ver: 5.0.45 The statement finds the number offspring of a nominated Sire or Dam who themselves have offspring. In this case the nominated Sire or Dam is 1093. The table index is PedigreeId, SireId/DamId are the PedigreeId of the Sire/Dam. Table has at present 13 000 entries. The query: select count(PedigreeId) from peds where (SireId = 1093 OR DamId = 1093) AND (PedigreeId IN (select SireId from peds) OR PedigreeId IN (Select DamId from peds)) As you can see, selecting all the SireId and DamId in the entire db is overkill - but I don't know how best to select the PedigreeId who are either sires or dams. The query works, it is just very slow. Table structure: CREATE TABLE `peds` ( `PedigreeId` int(11) NOT NULL auto_increment, `Name` varchar(64) default NULL, `SireId` int(11) default NULL, `DamId` int(11) default NULL, `Sex` varchar(10) default NULL, `DOB` date default NULL, `PreTitle` varchar(32) default NULL, `PostTitle` varchar(32) default NULL, `RegNo` varchar(64) default NULL, `Color` varchar(64) default NULL, `Photo` varchar(200) default NULL, `COI` varchar(64) default NULL, `COO` varchar(64) default NULL, PRIMARY KEY (`PedigreeId`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Edited to stop query scrolling
  10. //Check if the form has been submitted if ($_GET[submit]){ //update the database } else { //output the form } Fit your code parts into that framework.
  11. You should always check if the form has been submitted FIRST, then if it has - update the database. If it hasn't, then output the form with all the data.
  12. ::)IF you read the manual you would see they give TONS of examples. PHP.net is one of the best online manuals, it makes sense, low on the jargon and gives you lots of working examples. Type the suggestions into the function search at php.net
  13. tidalik

    Security

    Yeah they could, if they were serious about it. I said it cuts down opportunistic hackers. I also mentioned that perhaps appending the user's username to the "word" and then encrypting this would make that particular "word" ONLY applicable to THAT user on THAT day.
  14. tidalik

    Security

    To prevent people using their own forms and pointing it to my script I installed a hidden field with a value that changes daily. It was very simple and it's automated. Basically I have a database of novelty "words", I select one based on the day then append another form related "word" to it and encrypt it (so that no 2 forms have the same hidden value). If the post data I am recieving does not have the right encrypted "word" for the day I don't process it. There are small annoyances when server days roll over but it's minor. Once a year I throw out my novelty "words" and add new ones. I don't rely solely on this though, all incoming data is checked and rechecked. It just cuts down the opportunistic ones. I think I'd add the username of the logged in person as well in the encrypted "word" so that for each person, every day, there was a new "word".
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.