Jump to content

dzhax

Members
  • Content Count

    363
  • Joined

  • Last visited

Everything posted by dzhax

  1. dzhax

    Edit In Place?

    I am working on a record editor for a widget. I have everything printing out on the page but now i need to make it so the user can update the record. The data is printing to a table and my idea was using the onclick=" " of the TD to edit that field. Any idea how i could use java script to take the text in a TD and replace it with a text field that contains the text that was in the TD so it can be edited? Once I get this part the saving and updating the record should not be hard. My idea was something like this: function editRecord(fightID, editField){ currentValue = document.getElementById(editField).innerHTML; document.getElementByName(editField+"_"+fightID).innerHTML = '<input type="text" value="'+currentValue+'" />'; } <td class="editable" onclick="editRecord('<? echo $filterRow['id']; ?>', this.id)" name="fighterName1_<? echo $filterRow['id']; ?>" id="fighterName1" ><? echo $filterRow['fighterName1']; ?></td> But it simply is not working... I know everything is sending to the function properly because I through in an alert(' ') call before the document.getElementByID(... and it loads all of the information just fine. Any help appriciated
  2. dzhax

    Help correcting a error

    ok its working now i ripped out all the ob connection garbage and just set $this->view->data = $scode;It loads fine now. Not sure what the ob connection thing does but it must need a specific syntax to work properly.Ingolme thanks for the idea of echoing $scode. at first i would navigate directly to controller.php and get 3 but when i naviagted to the index the 3 still showed on the page thats when I made the above changes. <?phpclass Widget_FightSubmitController extends Engine_Content_Widget_Abstract{ public function indexAction() { $scode = $this->_getParam('data'); $this->view->data = $scode; }}?>
  3. dzhax

    Help correcting a error

    ok it has to be syntax... I cleared the field that was loading the number 3 (so its blank) and now it loads fine.
  4. dzhax

    Help correcting a error

    $scode echos 3which is correct 3 should display on the index.tpl for the minimum auth level.is it maybe because its a number and not letters? I'm not sure exactly what is going on it is a take existing code and modify it to suite my needs type of thing.
  5. I am working on a widget for Social Engine 4 and Randomly get the following error Parse error: syntax error, unexpected '}' in /home/standth1/public_html/csr/application/widgets/fightsubmit/Controller.php(8) : runtime-created function on line 1Fatal error: Function name must be a string in /home/standth1/public_html/csr/application/widgets/fightsubmit/Controller.php on line 10 I was trying to change the variable "data" into something more descriptive when it started. So I did what I normally do... I put it all back to data. And I am still getting the same exact message.Controller.php: <?phpclass Widget_FightSubmitController extends Engine_Content_Widget_Abstract{ public function indexAction() { $scode = $this->_getParam('data'); $func = create_function (null, $scode ); ob_start(); $func(); $this->view->data = ob_get_contents(); ob_end_clean(); }}?> Manifest.php: <?phpreturn array( 'package' => array( 'type' => 'widget', 'name' => 'fightsubmit', 'version' => '1.0.0', 'path' => 'application/widgets/fightsubmit', 'repository' => '', 'meta' => array( 'title' => 'Fight Submit', 'description' => 'Submit fight data.', 'author' => 'garrett-innovations.com', ), 'directories' => array( 'application/widgets/fightsubmit', ), ), // Backwards compatibility 'type' => 'widget', 'name' => 'fightsubmit', 'version' => '1.0.0', 'title' => 'Fight Submit', 'description' => 'Submit fight data.', 'category' => 'Widgets', 'autoEdit' => true, 'adminForm' => array( 'elements' => array( array( 'Text', 'data', array( 'label' => 'Minimum CP Access Level:' ) ), ) ),) ?> index.tpl: <?php $currentDisplayName = Engine_Api::_()->user()->getViewer()->displayname; echo 'Welcome, ' . $currentDisplayName; $currentAuthLevel = Engine_Api::_()->user()->getViewer()->level_id; echo '<br/>Authorization Level: ' . $currentAuthLevel . '<br/><br/>'; echo 'Minimum Auth Level: '. $this->data . '<br/><br/>';?> Any help on this is much appreciated.
  6. dzhax

    Help with a query

    I am editing a query that I have been using and not sure how to do thisI need to use both AND & OR Statements in the same query.I already have: (Please mind the format... this is being put into a php script) 'SELECT * FROM rank_fight_list WHERE fighterID1='.$this->fighterID.' OR fighterID2='.$this->fighterID; I need to add that the STATUS field must also be 'Official' or 'NSF'Not sure if I need to break the two or statements up with parentheses along with an AND in between or not.Any help would be appreciated. I would experiment but i hate butchering what already works fine.
  7. i replaced lookup with an alert('MESSAGE HERE') and it does the same thing.so its not the code taking to long to load. its got the be the event simply not triggering when its supposed to.http://projects.garrett-innovations.com/csr-rank^ that's the page that i am working with. and pulled the test code from.its loading a string from the rpc.php and splits it into an array that it displays as the suggestion below the textbox.I use Cage of Chaos for my test. under the event field. I will add an alert to first name with the same onkeyup to show how it does the same thing.EDIT:It could be load time for the array. If that is the case is there a better way to implement this process. maybe finding a way to load and split the array with the onfocus event then onkeyup it just has to read the array? or onload for the whole page load each fields arrays and call them individually?
  8. dzhax

    asp noob needs some help

    it redirects to itself. that is customer.aspxI dont see where it updates the fields though.
  9. i have this page that I am analyzing to help make a escalation tool to use at work.This is the source of a form used in another tool already developed that has the ability to pull information from our billing system with some javascript (atleast thats how I think it works).Anyway, I need to be able to formulate a simple function that will pull the customers Account Number, First Name, Last Name, and Phone Number from the billing system and input the data into a form.In order to do that I guess I need to understand asp and some more java.In fact I am such a noob at ASP i'm not even sure why the page starts like a normal HTML file.If someone could break it down for me how i can preform the above that would be awesome.Some things that need to be known, the process that actually pulls the data is the onclick of the Get ACSR Customer button which calls SCRAPE().Its only dependency that I can see is <script language="JavaScript" src="includes\SitAoi.js"></script>If needed I can post the source of that aswell.the page mentioned above: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML> <HEAD> <title>Customer</title> <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="C#" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema"> <META http-equiv="REFRESH" content="1140"> <script language="JavaScript" id="1" src="includes\er.js"></script> <script language="JavaScript" src="includes\SitAoi.js"></script> <script language="javascript"> var bValidate = false; //------------------------------------------>> function ValidateForm() //------------------------------------------>> { if (bValidate) { var aStrRequiredFields = Array("TxtBoxFirstName", "TxtBoxLastName", "DrpDwnRegion", "TxtBoxZip", "DrpDwnState", "DrpDwnCity", "TxtBoxAddressLine1", "TxtBoxStreetNumber", "TxtBoxStreetName", "TxtBoxCsgSubAcct", "TxtBoxAcctCorp", "TxtBoxHouse", "TxtBoxCust"); var aStrRequiredDescriptions = Array("First Name", "Last Name", "Region", "Zip Code", "State", "City", "Address", "Street Number", "Street Name", "Subscriber Account Number", "Account Corp", "Account House Number", "Account Customer Number"); var strMsg = "Please correct the following fields:\n\n"; var iMsgLentgth = strMsg.length; for (var i = 0; i < aStrRequiredFields.length; i++) { var oField = document.getElementById(aStrRequiredFields[i]); if (oField) { switch(oField.type) { case "select-one" : if (oField.selectedIndex == 0 || oField.selectedIndex == -1 || oField.options[oField.selectedIndex].text == "[SELECT]") strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n"; break; case "select-multiple" : if (oField.selectedIndex == -1) strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n"; break; case "textarea" : break; case "text" : switch (oField.name) { case "TxtBoxCsgSubAcct" : var oChkBoxNonSub = document.getElementById("ChkBoxNonSub"); if (!oChkBoxNonSub.checked && 0 == oField.value.length && document.getElementById("DrpDwnRegion").value != '4' && document.getElementById("DrpDwnRegion").value != '5' && document.getElementById("DrpDwnRegion").value != '6' && document.getElementById("DrpDwnRegion").value != '7' && document.getElementById("DrpDwnRegion").value != '8') strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n"; break; case "TxtBoxAcctCorp" : var oChkBoxNonSub = document.getElementById("ChkBoxNonSub"); if (!oChkBoxNonSub.checked && 0 == oField.value.length) strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n"; else if (oField.value.length > 0) { if(oField.value.length > 5 || oField.value.length < 4) strMsg += " - " + aStrRequiredDescriptions[i] + " Appears to be too long or too short for a valid account number 4 or 5 characters"; else if (!ValidField("ACCTNUM", oField.value)) strMsg += " - " + aStrRequiredDescriptions[i] + " must contain only numbers"; } break; case "TxtBoxHouse" : var oChkBoxNonSub = document.getElementById("ChkBoxNonSub"); if (!oChkBoxNonSub.checked && 0 == oField.value.length) strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n"; else if (oField.value.length > 0) { if(oField.value.length > 6 || oField.value.length < 1) strMsg += " - " + aStrRequiredDescriptions[i] + " Appears to be too long or too short for a valid account number 1 to 6 characters"; else if (!ValidField("ACCTNUM", oField.value)) strMsg += " - " + aStrRequiredDescriptions[i] + " must contain only numbers"; } break; case "TxtBoxCust" : var oChkBoxNonSub = document.getElementById("ChkBoxNonSub"); if (!oChkBoxNonSub.checked && 0 == oField.value.length) strMsg += " - " + aStrRequiredDescriptions[i] + " is required (Unless NON SUB is checked) \n"; else if (oField.value.length > 0) { if(oField.value.length > 4 || oField.value.length < 1) strMsg += " - " + aStrRequiredDescriptions[i] + " Appears to be too long or too short for a valid account number 4 or 5 characters"; else if (!ValidField("ACCTNUM", oField.value)) strMsg += " - " + aStrRequiredDescriptions[i] + " must contain only numbers"; } break; case "TxtBoxZip" : if (oField.value == "" || oField.value == null) strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n"; else if (oField.value.length != 5 && oField.value.length != 10) strMsg += " - " + aStrRequiredDescriptions[i] + " must be 5 or 10 characters \n"; else if (!ValidField("ZIP", oField.value)) strMsg += " - " + aStrRequiredDescriptions[i] + " must contain only numbers and hyphens \n"; break; default : if (oField.value == "" || oField.value == null) strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n"; break; } break; default: if (oField.value == "" || oField.value == null) strMsg += " - " + aStrRequiredDescriptions[i] + " is required\n"; } } } bValidate = false; if (strMsg.length == iMsgLentgth) return true; else { parent.document.getElementById("TblHeader").focus(); alert(strMsg); return false; } } else return true; } //------------------------------------------>> function EnableValidation() //------------------------------------------>> { bValidate = true; } //------------------------------------------>> function RequireConfirmation(iReason) //------------------------------------------>> { if (document.getElementById("dgCustomerMatches")) { document.getElementById("TrDataGrid1").style.display = 'block'; document.getElementById("TrDataGrid2").style.display = 'block'; if (document.getElementById("LblCustomerHistory")) { document.getElementById("TrCustomerHistory1").style.display = 'block'; document.getElementById("TrCustomerHistory2").style.display = 'block'; document.getElementById("TrCustomerHistory3").style.display = 'block'; } } var strPrompt = ""; if (0 == iReason) alert("Please select an existing customer or confirm that this is a new customer."); else { if (1 == iReason) strPrompt = "This Customer has an open ticket. Are you sure you want to create a new ticket? Please confirm that this is a new issue by typing I CONFIRM below."; else if (2 == iReason) strPrompt = "Are you sure this is not an existing customer? Please confirm that this is a different customer by typing I CONFIRM."; else if (3 == iReason) strPrompt = "Are you sure this is a new or existing customer? Please check the account number and confirm that this a new or existing customer by typing I CONFIRM."; var strConfirm = prompt(strPrompt, ""); if (null != strConfirm && "I CONFIRM" == strConfirm.toUpperCase()) document.location.href = "WizardPage.aspx?WizardType=Ticket"; else if (null != strConfirm) { alert("Please Confirm by typing I CONFIRM."); RequireConfirmation(iReason); } } } //------------------------------------------>> function GetTicket() //------------------------------------------>> { var lstBoxCustomerHistory = document.getElementById("LstBoxCustomerHistory"); var iSelected = lstBoxCustomerHistory.selectedIndex; document.location.href="Customer.aspx?CustomerHistoryRequest=" + lstBoxCustomerHistory.options[iSelected].value; } //------------------------------------------>> function HistoryError() //------------------------------------------>> { alert("Sorry, History for this ticket has been archived and is not available"); } //------------------------------------------>> function CustomerReturn(result) //------------------------------------------>> { if (result.indexOf('^ERROR') == 0) alert(result); else document.location.href = "Customer.aspx?" + result; } //------------------------------------------>> function ComtracsScrape() //------------------------------------------>> { //--->> Validate each entry field if (document.Form1.txtCorp.value == null || document.Form1.txtCorp.value == "" || document.Form1.txtCorp.value == " " || !ValidField("NUMERIC-", document.Form1.txtCorp.value) || document.Form1.txtCorp.value.length < 4 ) alert (document.Form1.txtCorp.value + " Not a valid CORP Please Re-Enter Corp and try again"); else if (document.Form1.txthouse.value == null || document.Form1.txthouse.value == "" || document.Form1.txthouse.value == " " || !ValidField("NUMERIC-", document.Form1.txthouse.value) || document.Form1.txthouse.value.length > 6 || document.Form1.txthouse.value.length < 1) alert (document.Form1.txthouse.value + " Not a valid House Number Please Re-Enter House Number and try again"); else if (document.Form1.txtcustNum.value == null || document.Form1.txtcustNum.value == "" || document.Form1.txtcustNum.value == " " || !ValidField("NUMERIC-", document.Form1.txtcustNum.value) || document.Form1.txtcustNum.value.length < 1 ) alert (document.Form1.txtcustNum.value + " Not a valid Customer Number Please Re-Enter Customer Number and try again"); else { document.location.href = "Customer.aspx?ScrapeAmdocs=1&Corp=" + document.Form1.txtCorp.value + "&House=" + document.Form1.txthouse.value + "&CustNum=" + document.Form1.txtcustNum.value; } } //------------------------------------------>> function Scrape() //------------------------------------------>> { var oCustomer = new SitCust(1); var bScrapeSuccess = oCustomer.ExecuteQuery(); if (!bScrapeSuccess) { oCustomer = new SitCust(2); bScrapeSuccess = oCustomer.ExecuteQuery(); if (!bScrapeSuccess) { if ("" != document.getElementById("TxtBoxCsgSubAcct").value) document.location.href = "Customer.aspx?ScrapeAccountNumber=" + document.getElementById("TxtBoxCsgSubAcct").value; else if ("" != document.getElementById("TxtBoxHomePhone").value) document.location.href = "Customer.aspx?ScrapePhoneNumber=" + document.getElementById("TxtBoxHomePhone").value; else alert("S.I.T. Communicator is not installed. Please contact the helpdesk for installation."); } } if (bScrapeSuccess) { //-->> CHECK ACSR SCRAPE FIRST if (oCustomer.ExecuteQuery()) { var strParam = "ScrapeACSR=1&FirstName="; strParam += escape(oCustomer.getFirstName()); strParam += "&LastName="; strParam += escape(oCustomer.getLastName()); strParam += "&Address1="; strParam += escape(oCustomer.getAddress1()); strParam += "&Address2="; strParam += escape(oCustomer.getAddress2()); strParam += "&City="; strParam += escape(oCustomer.getCity()); strParam += "&State="; strParam += escape(oCustomer.getState()); strParam += "&Zip="; strParam += escape(oCustomer.getZip()); strParam += "&HomePhone="; strParam += escape(oCustomer.getHomePhone()); strParam += "&WorkPhone="; strParam += escape(oCustomer.getWorkPhone()); strParam += "&AccountNumber="; strParam += escape(oCustomer.getAccountNumber()); strParam += "&HouseKey="; strParam += escape(oCustomer.getHouseKey()); strParam += "&Principal="; strParam += escape(oCustomer.getPrincipal()); strParam += "&MgmtArea="; strParam += escape(oCustomer.getMgmtArea()); if ("" == oCustomer.getLastName()) alert("Please ensure that you are on the Account Information screen in ACSR and try again. If problem persists contact the helpdesk."); else document.location.href = "Customer.aspx?" + strParam; } } &nb
  10. opps my bad I was trying some different methods and manually put the code back to what i had beforeonkeyup = "lookup(this.value,'event')"this is what that should of read.still same situation.
  11. I am using ie9, firefox 5, and chrome to test a page.the onkeyup event is supported by all 3 browsers but it hardly ever works.I am using it with jquery.autocomplete to pull from my database what the user might be trying to type in. <html><head><script src="lib/js/jquery-latest.js"></script><link rel="stylesheet" href="lib/css/main.css" type="text/css" /><link rel="stylesheet" href="lib/css/jquery.autocomplete.css" type="text/css" /><script type="text/javascript" src="lib/js/jquery.bgiframe.min.js"></script><script type="text/javascript" src="lib/js/jquery.autocomplete.js"></script> <script type="text/javascript"> function lookup(inputString, field){ if(inputString.length > 0) { var url2load = 'lib/rpc.php?queryString=null&field='+field; $.get(url2load, function(data){ //alert(data); var results = data.split('~!~'); $("#inputString"+field+"").autocomplete(results); }); } }</script></head><body> <div> Event: <input id="inputStringevent" onkeydown="lookup(this.value'event');" /> </div></body></html> this code in order to load the autocomplete i have to type atleast 1 letter and click on the textbox like 4-5 times before the suggestion(s) show up.is there something wrong with my application of the code that is causing this?
  12. you just need the number right?if so explode '* 'then explode ' 'that would get you the id number.EDIT: as far as getting the date. you have a discrepancy in format. the top 3 have a space after the " and the last one doesn't.
  13. ok it seems to be working. I think i need to fill in some test data to be sure.
  14. Ok I peiced it together and I am getting this Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in ************************/csr-rank/cron-job.php on line 5 this is what I put in, which from what I see should print the score for fighter 1. <?$con = mysql_connect('localhost','USER','PASS') or die('Unable to connect');class Fighter { $fighterID = 0; $opponent = array(); $numOpponents = 0; $kappa0 = 0; //number of wins by knockout or submission $kappa1 = 0; //number of losses by knockout or submission $tau0 = 0; //number of wins by TKO $tau1 = 0; //number of losses by TKO $gamma0 = 0; //number of wins by decision $gamma1 = 0; //number of losses by decision $delta = 0; //8 lookin symbol - number of draws function __construct($fighterID) { $this->fighterID = $fighterID; } function loadStats() { global $con; $query = 'SELECT * FROM rank_fighter_stats WHERE fighterID='.$this->fighterID; $result = mysql_query($query, $con); if (!$result) return false; $row = mysql_fetch_assoc($result); if (!$row) return false; $this->kappa0 = (int) $row['k_wins']; $this->kappa1 = (int) $row['k_losses']; $this->tau0 = (int) $row['t_wins']; $this->tau1 = (int) $row['t_losses']; $this->gamma0 = (int) $row['d_wins']; $this->gamma1 = (int) $row['d_losses']; $this->delta = (int) $row['draws']; } function loadOpponents() { global $con; $query = 'SELECT * FROM rank_fight_list WHERE fighterID1='.$this->fighterID.' OR fighterID2='.$this->fighterID; $result = mysql_query($query, $con); if (!$result) return false; $this->numOpponents = mysql_num_rows($result); $key = 0; while (($row = mysql_fetch_assoc($result)) !== false) { $opponentFighterID = (int) (($this->fighterID === (int) $row['fighterID1']) ? $row['fighterID2'] : $row['fighterID1']); $this->opponent[$key] = new Fighter($opponentFighterID); $this->opponent[$key]->loadStats(); $key++; } }}function beta($fighter){ return (1.15*$fighter->kappa0 + $fighter->tau0 + 0.85*$fighter->gamma0);}function littleLambda($fighter){ return ( (1.5*$fighter->kappa0 + $fighter->tau0 + 0.5*$fighter->gamma0 + 0.1*$fighter->delta) / ( 1.5*($fighter->kappa0 + $fighter->kappa1) + ($fighter->tau0 + $fighter->tau1) + 0.5*($fighter->gamma0 + $fighter->gamma1) + 0.1*$fighter->delta ) );}function sigma($x){ return (log(10.0 * $x + 12.0) / 6.5);}function omega($fighter){ return (0.6*sigma(beta($fighter)) + 0.4*littleLambda($fighter));}function bigLambda($fighter){ $lambda = 0; for ($i=0; $i < $fighter->numOpponents; $i++){ $lambda += omega($fighter->opponent[$i]); } return $lambda / $fighter->numOpponents;}function rho($fighter){ $rhoStep1 = 0; for($i=0; $i < $fighter->numOpponents; $i++){ $rhoStep1 += bigLambda($fighter->opponent[$i]); } $rhoStep1 /= $fighter->numOpponents; return (0.65*omega($fighter) + 0.25*bigLambda($fighter) + 0.1*$rhoStep1);}$fighterID = 1;$fighter = new Fighter($fighterID);$fighter->loadStats();$fighter->loadOpponents();$score = rho($fighter);echo $score;?>
  15. class Fighter { $fighterID = 0; $opponent = array(); $numOpponents = 0; $kappa0 = 0; //number of wins by knockout or submission $kappa1 = 0; //number of losses by knockout or submission... }}$fighterID = 1;$fighter = new Fighter($fighterID);$fighter->loadStats();$fighter->loadOpponents(); So with this, say i want to echo fighter 2's rank what would i call?
  16. dzhax

    Add Comment on Post?

    for what you are using that would be an easy way to do it but I agree it is not secure. anyone that would wish to hurt your site can easily manipulate the output. you can encrypt the $_GET data with base64 or something else and then decrypt it upon loading or you can use JavaScript to send the page data as $_POST data.EDIT: there are many different ways to do this above is just some easy suggestions. I have heard of something called pagination that might work for you as well. I have not read up on it though.
  17. A big problem I am having is there are hundreds maybe thousands of fighters each having multiple fights which means multiple opponents.So I would have to load the top data for the current fighter.Find out who else he has fought.Load those fighters data.And loop it thorough the functions to determine this fighters rank over all other fighters, not just his opponents.
  18. dzhax

    Add Comment on Post?

    Here is a default table structure that you can use. table.BlogPostID TITLE BODY-- ------- ------------1 Title 1 body text...2 Title 2 body text...table.BlogCommentID PARENT COMMENT-- ------ ---------1 1 Comment 12 1 Comment 23 1 Comment 34 1 Comment 45 2 Comment 16 2 Comment 2table.CommentReplyID PARENT COMMENT-- ------ -------1 1 Reply 12 2 Reply 13 3 Reply 14 3 Reply 25 4 Reply 16 5 Reply 1 Some SQL Queries SELECT * FROM table.BlogPostSELECT * FROM table.BlogComment WHERE 'PARENT' = 'x'SELECT * FROM table.CommentReply WHERE 'PARENT' = 'y' The Loop while($row = mysql_fetch_array($result)) { $i+=1; echo $row['body'] . '<br/><br/>'; /* Do the same as above to loop through looking for comments */ while(...) { $ii+=1; echo $row2['comment'] . '<br/><br/>'; /* Do the same as above to loop thorugh looking for replies */ while(...) { $iii+=1; echo $row3['reply'] . '<br/><br/>'; } } }
  19. I have been working with an algorithm that a mathematician came up with and trying to convert it into a useable php script for about a month now.I just can not seem to grasp how to do it.If someone is willing to take a look at this and make it work I will pay up to $100.I was givin this PDF to start withhttp://combatsportsrank.com/rank/mmaRanking.pdfit outlines the functions needed to be done in order to get the Rank.I have attempted to convert the majority of it into PHP but I have no idea how to implement it.From what I see it needs like 2 or 3 loops to just get one rank and its got to take a lot of time to get the info.Here is what I have so far: http://w3schools.invisionzone.com/index.php?showtopic=38459So i am thinking it might have to be a bunch of little cron jobs that can be ran to gather info and post it into a database so it can be grabbed faster when needed.Ultimately we are making a website that is a social network and doubles as a ranking site for MMA fighters. Fight data is entered then parsed to determine a specific fighters rank.This rank is used in dynamic images that can be used on the site and posted on other sites such as Facebook, Myspace, Etc.If anyone is up to the challenge I would greatly appreciate it. I would like to be all said and done with it in 2 weeks. definitely before the end of the month.
  20. dzhax

    floating divs

    I am using some JavaScript to show suggested terms that have already been entered.I want these terms to show below the textbox on top of the next field.I can not use static placing for the div because different browsers and screen resolutions.Is there code that will place a divs top left corner 3px below the bottom left corner of a certain textbox?Not sure if this would fall under JS or CSS.EDIT:Some more info...I am using the following tutorial to display it http://www.nodstrum.com/2007/09/19/autocompleter/but i want to edit the look of it so it fits a little smoother.basically if the left can line up and set the height 3px below the textbox and on top of everything so it doesn't push down the next field.
  21. dzhax

    advanced math equations

    I think im in over my head here... Just thinking about how I will calculate all of this is mind boggling.This is what i have does anyone see any errors? $numOpponents = ''; $kappa0 = ''; //number of wins by knockout or submission $kappa1 = ''; //number of losses by knockout or submission $tau0 = ''; //number of wins by TKO $tau1 = ''; //number of losses by TKO $gamma1 = ''; //number of wins by decision $gamma0 = ''; //number of losses by decision $delta = ''; //8 lookin symbol - number of drawsfunction beta($fighter){ return (1.15*$fighter->$kappa0 + $fighter->$tau0 + 0.85*$fighter->$gamma0);}function littleLambda($fighter){ return ( (1.5*$fighter->$kappa0 + 0.5*$fighter->$gamma0 + 0.1*$fighter->$delta) / ( 1.5*($fighter->$kappa0 + $fighter->$kappa1) + ($fighter->$tau0 + $fighter->$tau1) + 0.5*($fighter->$gamma0+$fighter->$gamma1) + 0.1*$fighter->$delta ) );}function sigma($x){ return (log(10.0 * $x + 12.0) / 6.5);}function omega($fighter){ return (0.6*sigma(beta($fighter)) + 0.4*littleLambda($fighter));}function rho($fighter){ $rhoStep1 = 0; for(int i=0; i < $fighter->$numOpponents; i++){ $rhoStep1+=bigLambda($fighter->$opponent[i]); } $rhoStep1/=$fighter->$numOpponents; return (0.65*omega($fighter) + 0.25*bigLambda($fighter) + 0.1*$rhoStep1);} i dont understand where $fighter comes from.and i would assume this would need to be looped to get the info
  22. dzhax

    advanced math equations

    does anyone know what this part is? class Fighter {public: Fighter(int numOpps){ numOpponents = numOpps; opponent = new Fighter*[numOpponents]; } Fighter **opponent; int numOpponents; int kappa0,kappa1,tau0,tau1,gamma1,gamma0,delta;}; it looks like the part that defines the variables.I have the following: Fighter(int numOpps){ numOpponents = numOpps; opponent = new Fighter*[numOpponents]; } Fighter **opponent; $numOpponents = ''; $kappa0 = ''; $kappa1 = ''; $tau0 = ''; $tau1 = ''; $gamma1 = ''; $gamma0 = ''; $delta = ''; but i don't think it is quite right. specifically the Fighter(int numOpps){ numOpponents = numOpps; opponent = new Fighter*[numOpponents]; } Fighter **opponent; I have rewritten the code by removing all of the doubles and adding function to the beginning of the equations. Fighter(int numOpps){ numOpponents = numOpps; opponent = new Fighter*[numOpponents]; } Fighter **opponent; $numOpponents = ''; $kappa0 = ''; $kappa1 = ''; $tau0 = ''; $tau1 = ''; $gamma1 = ''; $gamma0 = ''; $delta = '';function beta(Fighter *f){ return 1.15*$f->$kappa0 + $f->$tau0 + 0.85*$f->$gamma0;}function littleLambda(Fighter *f){ return ( (1.5*f->$kappa0 + 0.5*f->$gamma0 + 0.1*f->$delta) / ( 1.5*(f->$kappa0 + f->$kappa1) + (f->$tau0 + f->$tau1) + 0.5*(f->$gamma0+f->$gamma1) + 0.1*f->$delta ) );}function sigma(double x){ return log(10.0 * x + 12.0) / 6.5;}function omega(Fighter *f){ return 0.6*sigma(beta(f)) + 0.4*littleLambda(f);}function rho(Fighter *f){ rhoStep1 = 0; for(int i=0; i < f->numOpponents; i++) rhoStep1+=bigLambda(f->opponent[i]); rhoStep1/=f->numOpponents; return 0.65*omega(f) + 0.25*bigLambda(f) + 0.1*rhoStep1;}
  23. dzhax

    advanced math equations

    i didnt know C was so similar to php math operations. all the doubles throw me off and not knowing the names of the math symbols is also hurting me. //Bf is the weighted sum of fighter f's wins$Bf = 1.15*$k0+$t0+0.85*$y0;//Hf is fighter f's weighted winning percentage$Hf = (1.5*$k0+$t0+0.5*$y0+0.1*$draws)/(1.5($k0+$k1)+($t0+$t1)+0.5($y0+$y1)+0.1*$draws);//O(x) is a logarithmic weighting function used to map Bf to a value between 0 and 1. This gives a fighter with few wins significantly less credit than a fighter with many wins. However, for two fighters who have a similar number of wins, and they’ve both won many fights, their scores from this criterion will be very similar.function sigma($x){ return log(($x*=10)+12)/6.5;}//Wf is a linear combination of fighter f’s weighted winning percentage, and the remapped and weighted win total.$Wf = 0.6*sigma($Bf)+.04*$Hf;//Let O(F) the overall score for a fighter F. Then, A(F) is the average Wx for all of the opponents of fighter F.function A($F){ return ();}// p(F), the overall score for a fighter F, is a linear combination of Wf(the fighters winning score), A(F)(the fighter's opponents' average winning score), and the average winning score of the fighter's opponents'. Rank fighters based on their value of p(F).
  24. dzhax

    advanced math equations

    oops my bad. its late and kind of in a hurry to get this done sryi got to the first 2 equations <?/* MMA ALGORYTHM */$k0 = ''; //number of wins by knockout or submission$k1 = ''; //number of losses by knockout or submission$t0 = ''; //number of wins by TKO$t1 = ''; //number of losses by TKO$y0 = ''; //number of wins by decision$y1 = ''; //number of losses by decision$draws = ''; //8 lookin symbol - number of draws//Bf is the weighted sum of fighter f's wins$Bf = 1.15*$k0+$t0+0.85*$y0;//Hf is fighter f's weighted winning percentage$Hf = (1.5*$k0+$t0+0.5*$y0+0.1*$draws)/(1.5($k0+$k1)+($t0+$t1)+0.5($y0+$y1)+0.1*$draws);?> Some email communication that I clarified with the writer of the formulaEmail from me to the formula creator His response attached file:#include <math.h>class Fighter {public: Fighter(int numOpps){ numOpponents = numOpps; opponent = new Fighter*[numOpponents]; } Fighter **opponent; int numOpponents; int kappa0,kappa1,tau0,tau1,gamma1,gamma0,delta;};double beta(Fighter *f){ return 1.15*(double)f->kappa0 + (double)f->tau0 + 0.85*(double)f->gamma0;}double littleLambda(Fighter *f){ return ( (1.5*(double)f->kappa0 + 0.5*(double)f->gamma0 + 0.1*(double)f->delta) / ( 1.5*(double)(f->kappa0 + f->kappa1) + (double)(f->tau0 + f->tau1) + 0.5*(double)(f->gamma0+f->gamma1) + 0.1*(double)f->delta ) );}double sigma(double x){ return log(10.0 * x + 12.0) / 6.5;}double omega(Fighter *f){ return 0.6*sigma(beta(f)) + 0.4*littleLambda(f);}double bigLambda(Fighter *f){ double lambda = 0; for(int i=0; i < f->numOpponents; i++){ lambda+=omega(f->opponent[i]); } return lambda/(double)f->numOpponents;}double rho(Fighter *f){ double rhoStep1 = 0; for(int i=0; i < f->numOpponents; i++) rhoStep1+=bigLambda(f->opponent[i]); rhoStep1/=(double)f->numOpponents; return 0.65*omega(f) + 0.25*bigLambda(f) + 0.1*rhoStep1;} ugh its in C or C++ i fail at C
  25. Hey guys I have a tough situation here. I am working on a project for a site built around ranking mma fighters.We have the site done but we need to write the script to determine rank.A friend of mine hooked me up with someone who created a formula for determining rank. This was great! The only problem was I don't understand how to turn it all into something php can calculate.Here is the formula: mmaRanking.pdfAny help on this is much appriciated. I would just put the above in code tags but i cant seems to get the formulas out of the pdf he sent me.-----Not sure if this is allowed but I am willing to pay for it to be converted to a working php script ready to be fed data.^let me know about this if so I will remove this.
×
×
  • Create New...