Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Posts posted by dreamwest

  1. I have a few prices and need to find the median of them, the problem is there is sometimes one really high price that distorts the median.

     

    Is there a way to normalize the figures?

     

    Example numbers

     

    76
    87
    95
    78
    104
    1098

     

    Normally i would do it this way but it gives a distorted view of the median number

     

    $lowest = 76;
    $highest = 1098;
    
    $mid = (($lowest - highest) / 2) + $lowest; // echos 511

  2. lol, I know, my girl hasn't put out in a while

     

    Most of my friends are married and in the same boat. They tell me "why did i get married?" and i laugh like a hyena .... sorry like a hyena on weed.

     

    Seems like the only one thats happy has married an asian chick 20+years his junior - aint it great  :D

  3. Trying to get the percentage of rent for a property in php. Im completely lost ....

     

    <?php
    
    $purchase = 44000;
    $rent = 9860;
    
    $percent = $purchase * $rent; //this is wrong, it returns 4.3 but should be over 18
    
    echo "Percentage is {$percent}%";
    
    ?>

  4. Simple  array_replace()  but it throwing an error, can anyone see what ive done wrong?

     

    while($row2 = mysql_fetch_assoc( $res2 )){
    	  
    		$title2 = "replace desc";
    
    //$row2 prints array( l_desc => title )
    
    $row2 = array_replace($row2, array('l_desc' => $title2));
    print_r($row2);	
    
    	  $show[] = $row2;
    }//end while
    

     

    Fatal error: Call to undefined function array_replace() in .....

     

    Im using PHP 5+

  5. Thanks. I used a id instead.

     

    <form name='x'>
    <input type="radio" name="type" value='1' id='T1'  /> Renovation <br>
    <input type="radio" name="type" value='2' id='T2'  /> Buy and hold (Rental)<br>
    <input type="radio" name="type" value='3' id='T3'  /> Development <br>
    <br />
    <input type='button' onclick="if(!document.getElementById('T1').checked && !document.getElementById('T2').checked && !document.getElementById('T3').checked) { alert('Select a Property Type'); } else { alert('ok'); }" value='Continue &#187;' />
    </form>

  6. I want to check if a radio button has been selected, but the following doesnt work.

     

    <form name='x'>
    <input type="radio" name="type" value='1'  /> Renovation <br>
    <input type="radio" name="type" value='2'  /> Buy and hold (Rental)<br>
    <input type="radio" name="type" value='3'  /> Development <br>
    <br />
    <input type='button' onclick="if(document.x.type.checked == false) { alert('Select a Property Type'); } else { alert('Checked'); }" value='Continue &#187;' />
    </form>
    

  7. $q = urlencode("hollywood cal");
    $data = @file_get_contents("http://www.google.com/ig/api?weather={$q}");
            $n_data = @new SimpleXmlElement($data, LIBXML_NOCDATA);
         
            if($n_data){
                            $show_img2 = "http://www.google.com{$n_data->weather->current_conditions->icon->attributes()->data}";
                    $show .= "<div style='float:left;padding:10px;border-right:1px solid grey;width:180px'>
    		<h3>{$n_data->weather->forecast_information->city->attributes()->data} weather</h3><br>
    
    		<div style='float:left;padding:10px;'>
    		<img title='{$n_data->weather->current_conditions->condition->attributes()->data}' src='{$show_img2}'><br>
    		</div>
    		{$n_data->weather->current_conditions->temp_f->attributes()->data} F | {$n_data->weather->current_conditions->temp_c->attributes()->data} C<br>
    		<nobr>{$n_data->weather->current_conditions->humidity->attributes()->data}</nobr><br>
    		<nobr>{$n_data->weather->current_conditions->wind_condition->attributes()->data}</nobr>
    		</div>";
    
    		if(!$n_data->weather->current_conditions->icon->attributes()->data){
    		$show = '';
    		}
            
            foreach ($n_data->weather->forecast_conditions as $md) {
            
    	        $show_img = "http://www.google.com{$md->icon->attributes()->data}";
                  	$show .= "<div style='float:left;padding:10px'>{$md->day_of_week->attributes()->data}<br>
    		           <img title='{$md->condition->attributes()->data}' src='{$show_img}'><br>
    		           <span title='Low' style='color:grey;'>{$md->low->attributes()->data}</span> <span title='High'>{$md->high->attributes()->data}</span>
    		          </div>";
    		}//end foreach	
    
    		echo "<div style='padding:10px;min-height:100px'>{$show}</div>";
      
    	}//end if array

  8. one builds a database ...

    one tracks the searches with ips ...

    one makes a search with chrome ...

    one finds google bot is making the exact search a few minuets later ...

    one assumes chrome browsers are sending all form input straight to googlebot for indexing ...

    one ...

  9. Yes you just send the value though Http Request <input type='checkbox' onclick='stuff(100);' />, and have a div as the callback, in php just echo the result back.

     

    function init() {
    		if	(window.XMLHttpRequest){
    		return new XMLHttpRequest();					
    		}else if(window.ActiveXObject){
    		return new ActiveXObject("Microsoft.XMLHTTP");
    		}else{ 
    		document.getElementById('err').innerHTML = "Your browser seems to be out of date, Please update!"; 
    		return;
    		}
    }//end init 
    
    function stuff(amount){ 
    
       	var req = init();
    
    	req.open("GET",  "url.php?id="+amount, true);
    	req.onreadystatechange = function() {
    	    if (req.readyState == 4) {
    	      if (req.status == 200) {
    	          document.getElementById('callback_div').innerHTML = req.responseText;
    	      }
    	    }
    	  };
    	req.send();
    }//end related
    

     

    <span id='callback_div'></span>

×
×
  • 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.