Jump to content

Triple_Deuce

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by Triple_Deuce

  1. Is there anyway to get the $sires & $dams arrays to properly display like this when necessary? It looks like it's not tracking all occurrences. DOG ID: 52 | ID | NAME | SIRE | DAM | | | | DIST | DIST | |-----|--------------------|------|------| | 44 | A | 2,2,2,2| 2,2,2,2| .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 | 45 | B | 2,2,2,2| 2,2,2,2| .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 total ICO: 0.25
  2. Ok, I've put in the following: $c = array_map(function () { return array_sum(func_get_args()); }, $sires[$id], $dams[$id]); foreach($c AS $key =>$value){ $ico = pow(.5,($value + 1)) + $ico; } print_r($c); which calculates U correctly now... however J is now wrong, it's showing as 0.125 instead of .5 (full sibling x full sibling = .5 (50%)). What am I missing?
  3. Ok, as I was typing this, I think i see my error! DogU is supposed to be .375 (37.5%) DogO & DogP are only behind DogU TWICE. I have my equation in a nested foreach() which is why I'm getting the 4 extra (2 of each) when I shouldnt. foreach($sires[$id] as $keyS => $valueS){ foreach($dams[$id] as $keyD => $valueD){ $ico = pow(.5,($valueS + $valueD + 1)) + $ico; } } What would be the best approach to break out of that and and potentially pair either $sires or $dams with empty $valueD/S?
  4. Are you getting that on my thing? http://play.ratsofnimh.com/pedigree/inbreeding2.php or somewhere else?
  5. Yes, this is correct but I was talking about getting U's ICO...
  6. OK, after some digging, I think I've decided the green site isnt accurate... I found this site http://www.fao.org/docrep/006/x3840e/X3840E03.htm (at the bottom) "Pedigree illustrating the fact that the mating of two inbred, but unrelated, fish will produce offspring with no inbreeding: FJ = 25% and FU = 37.5%, but because they are not related, FZ= 0%." Based on given info I get .5 (50%) as inbreeding on FU (ID#: 59) instead of .375 (37.5%).... but my stuff is calculating FJ (ID#: 52) @ .25 (25%) & FZ (ID#: 60) @ 0 correctly. If my program leaves out either O (#53) or P (#54) from the equation it calculates correctly at .375 (37.5%) for FU but I'd of thought that both the great grandparents should have been counted... | ID | NAME | SIRE | DAM | | | | DIST | DIST | |-----|--------------------|------|------| | 53 | O | 2,2| 2,2| 0.03125 0.03125 0.03125 0.03125 | 54 | P | 2,2| 2,2| 0.03125 0.03125 0.03125 0.03125 | 55 | Q | 1| 1| 0.125 | 56 | R | 1| 1| 0.125 I'm going to try and get some better help to understand the equation because I'm missing something or misunderstanding something in the equation.
  7. From my reading I'm beginning to wonder if that site is wrong. Based on the sites I've read and calculated by hand I keep getting different than that site... I get the .1875 so maybe that is more accurate than the site I was checking myself against? Especially since it wasnt counting certain instances? How did you find that Dog 20 was being ignored on that site and only 2 of the 3 instances of 17 were being used? http://www.fao.org/docrep/006/x3840e/X3840E03.htm Which I've been calculating FA as 0 since we don't know for sure. Thank you for your continued help.
  8. I'd of thought the 2nd method would have been correct but according to the site I'm using to check myself (http://www.czerwonytrop.com/inb/) neither are right. I'm going to have to go back through the equation and work by hand and see where I'm screwing up. i'll come back once I've ironed out my error in the equation.
  9. Dog Id Dog Name Dog Sire Dog Dam 1 Nimh's Delorean 2 3 2 Dog B 4 9 3 Dog C 7 8 4 Dog E 7 9 5 Dog F 10 11 7 Dog H 14 15 8 Dog I 16 17 9 Dog J 16 17 10 Dog K 18 19 11 Dog L 20 21 14 Dog O 20 17 15 Dog P 0 0 16 Dog Q 14 17 17 Dog R 0 0 18 Dog S 0 0 19 Dog T 0 0 20 Dog U 0 0 21 Dog V 0 0 22 Dog W 0 0 23 Dog X 0 0 24 Cedric 25 26 25 Phantom 27 0 26 Walton Mare 27 0 27 Walton 0 0 28 A 0 0 29 B 0 0 30 C 29 28 31 D 29 28 32 E 0 30 33 F 0 31 34 I 33 32 35 J 0 0 36 K 0 0 37 L 0 0 38 M 0 0 39 N 0 0 40 Dog1 0 0 41 Dog2 0 0 42 Dog3 40 41 43 Dog4 42 41 hope this is what you were looking for. 0 means no ancestor registered, so isnt counted.
  10. Thank you for helping... The above code does not give correct output. I've got it working on some scenarios while not working on others. My monkey wrench is basically with multiple positions. http://play.ratsofnimh.com/pedigree/inbreeding2.php inputting ID: 9 ICO = .375 ; this is correct Then, branching a little further to input id: 4 /Id 4's dam is ID 9/ it totals .1875 ; this is wrong, it should be .15625 So if you look at id4 and it's relative 17, 17's data looks like this: | ID | NAME | SIRE | DAM | | | | DIST | DIST | |----|--------------------|------|------| | 17 | Dog R | 2 | 3,2,1| I think it would fix the problem if I could get the respective numbers to line up and everyone else is paired with 0. something like: | ID | NAME | SIRE | DAM | | | | DIST | DIST | |----|--------------------|------|------| | 17 | Dog R | 2 | 1| | 17 | Dog R | 0 | 2| | 17 | Dog R | 0 | 3| I dont know if that makes any sense or not and I dont know if that would actually solve my problem. I just know that probably not every number should be added to one another. I'm positive it stems from my foreach statement since I have it nested, because numbers are being added together that shouldnt be but unsure of how to match the other numbers with 0 if needed. I'm not sure what another option would be, just know it needs to be unnested.
  11. Looks like I got this working... my only issue seems to be if a certain dog is behind the sire or dam multiple times... which i think stems from the array_intersect_key().... I'd like to list every apparence of a dog, even if shown multple times and calculate that appear in the table to use that data in the calculate... does that make sense? http://play.ratsofnimh.com/pedigree/inbreeding2.php Putting in ID 34 returns the proper ICO: 0.0625 (6.25 %) Putting in ID 9 returns the wrong ICO of 0.25 (25 %) because it's only counting dog ID 17 twice, instead of the 3 times it shows. The ICO should be 0.375 (37.5%)... any suggestions? Thanks
  12. I really appreciate the help. I got it to work... now I have the following: http://play.ratsofnimh.com/pedigree/inbreeding2.php I'm trying to figure out how to take the given data and plug it into the equation... Sire Dist and Dam Dist would be plugged into N1 and N2... I guess i need to figure out where to put the equation because Fa will be the already calculated inbreeding COI
  13. I couldnt find out to edit my post above... Correction... it works on your data but not my data.
  14. @Barand I apologize, I had not seen replies to this topic and just happened to stumble across it again on a google search. I've tried your code and I'm not receiving results, my thought as to why is because $common = array_intersect_key($sires,$dams); $sires[] & $dams[] will not intersect since they aren't of the same gender.
  15. I am in the process of trying to create a pedigree website (php/mysql)... I want to be able to calculate a dog's inbreeding coefficient on 10 generations. I am so not sure where to even begin. I have a database table: dogs: Fields: id name sireid damid equation: FX = å [ (½) n1+n2+1 (1 + FA)] http://www.highflyer.supanet.com/coefficient.htm Can someone give me a starting point? Do I need to learn bianary trees? could I do this with an array? Thanks
  16. I have done some looking around and i have found that you cant pass plain php variables through this javascript... how do i make it so it can be passed? all works, i have done other php with short tags etc just this one is mixed with a javascript function that works by itself but disappears with the variable
  17. I found this javascript Rich Text editor and I cant pass a php variable to it... what I have: writeRichText('rte1', '<? echo "$body";?>', 400, 200, true, false); which doesnt work, doesnt show the text editor when ran. please help me out.
  18. the code above is my whole code if someone could help me re-write it
  19. <?php //Connect to database $db_name = "tripled_vpa"; $connection = @mysql_connect("localhost", "tripled_user", "triple222") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $count = 0; $test = 0; $breed = "Brittany";//test $showid=5;//test //////////////////////////////////////////////////// $showinfo = "SELECT * FROM shows WHERE showid='$showid'"; $infoshow = @mysql_query($showinfo,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($infoshow)) { $type = $row['type']; $showname = $row['name']; $shnum = $row['show_num']; $close = $row['close']; } echo "Viewing Entires of: <b>$breed</b><Br><Br>"; echo "<table>"; $getentries = "SELECT * FROM entries WHERE breed = '$breed' AND show_num='$showid'"; $entryget = @mysql_query($getentries,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($entryget)) { ++$count; $show_num= $row['show_num']; $image= $row['image']; $s_name= $row['s_name']; $gender= $row['gender']; $breed= $row['breed']; $age= $row['age']; $owner= $row['owner']; $vpa_num= $row['vpa_num']; if($age >= 1 && $age <= 59 ) { $age = "Young"; } else if($age >= 60 && $age <= 210 ) { $age = "Adult"; } else if($age >= 211 && $age <= 360 ) { $age = "Senior"; } else if($age > 360) { $age = "Retired"; } echo "<tr><td align=\"center\"> <img src=\"$image\"><BR> <b>$s_name</b><br> VPA#$vpa_num<Br> Gender: $gender<Br> Age: $age<Br> Owner: $owner</td></tr>"; } echo "</table><Br>"; //////////////////////////////////////////////////// //I know that I have the stuff in two different places, //the above works but puts it straight down the page, //i left it in to be able to see correct information //////////////////////////////////////////////////// echo "<table>"; for ( $i = 0; $i < $count; ++$i) { echo "<tr>"; for ( $n = 0; $n < 4; ++$n) { echo "<td align=\"center\"><img src=\"$image\"><BR> <b>$s_name</b><br> VPA#$vpa_num<Br> Gender: $gender<Br> Age: $age<Br> Owner: $owner</td>"; } echo "</tr>"; } echo "</table>"; ?>
  20. No, if you go down in the code a lil further you will see the variables i am using while ($row = mysql_fetch_array($entryget)) this is what i have in the original code: echo <img src=\"$image\"><BR> <b>$s_name</b><br> VPA#$vpa_num<Br> Gender: $gender<Br> Age: $age<Br> Owner: $owner"; i left it in the original area just for comparison
  21. Ok, I have code that I have made and i need to format it's output into a sort of table... $db_name = "tripled_vpa"; $connection = @mysql_connect("localhost", "tripled_user", "triple222") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $count = 0; $test = 0; $breed = "Brittany"; $showid=5; //////////////////////////////////////////////////// $showinfo = "SELECT * FROM shows WHERE showid='$showid'"; $infoshow = @mysql_query($showinfo,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($infoshow)) { $type = $row['type']; $showname = $row['name']; $shnum = $row['show_num']; $close = $row['close']; } echo "Viewing Entires of: <b>$breed</b><Br><Br>"; $getentries = "SELECT * FROM entries WHERE breed = '$breed' AND show_num='$showid'"; $entryget = @mysql_query($getentries,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($entryget)) { ++$count; $show_num= $row['show_num']; $image= $row['image']; $s_name= $row['s_name']; $gender= $row['gender']; $breed= $row['breed']; $age= $row['age']; $owner= $row['owner']; $vpa_num= $row['vpa_num']; if($age >= 1 && $age <= 59 ) { $age = "Young"; } else if($age >= 60 && $age <= 210 ) { $age = "Adult"; } else if($age >= 211 && $age <= 360 ) { $age = "Senior"; } else if($age > 360) { $age = "Retired"; } echo <img src=\"$image\"><BR> <b>$s_name</b><br> VPA#$vpa_num<Br> Gender: $gender<Br> Age: $age<Br> Owner: $owner"; } I have gotten this: echo "<table>"; for ( $i = 0; $i < $count; ++$i) { echo "<tr>"; for ( $n = 0; $n < 4; ++$n) { //this was taken from above just showing where i want it. echo "<td align=\"center\"><img src=\"$image\"><BR> <b>$s_name</b><br> VPA#$vpa_num<Br> Gender: $gender<Br> Age: $age<Br> Owner: $owner</td>"; } echo "</tr>"; } echo "</table>"; but it doesnt print out the different ones, it prints out the same entry... I need it to print a different entry in each <td></td> Help me, i am unsure how to get it to give the entries different 'names' or a way of calling the different ones... hope that makes since... thanks
  22. Ok... I want people to login and once they login they can access multiple pages... I want to make sure that no one else can access those pages unless logged in. Basically... I dont want the special pages to keep asking for the login information everytime they visit a different special page. how would I go about doing this? so far I just have a simple login, but like i said...i need it to be able to go through many pages... hope this makes sense <? if ((!$_POST[username]) || (!$_POST[password])) { header("Location: authuser.html"); exit; } $db_name = "tripled_vpa"; $table_name = "user"; $connection = @mysql_connect("localhost", "tripled_user", "triple222") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name WHERE username = '$_POST[username]' AND password = password('$_POST[password]')"; $result = @mysql_query($sql,$connection) or die(mysql_error()); $num = mysql_num_rows($result); if ($num !=0) { $msg = "Logged In!"; } else { header("Location: authuser.html"); exit; } ?> <html> <head> <title></title> </head> <body> <center> <LINK REL=stylesheet HREF="style1.css" TYPE="text/css"> <? echo "$msg"; ?> <br> <a href="menu2.html" target="left">>Click Here<</a> </body> </html>
×
×
  • 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.