Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. http://www.phpfreaks.com/forums/index.php/topic,269264.0.html http://www.phpfreaks.com/forums/index.php/topic,256686.0.html http://www.phpfreaks.com/forums/index.php/topic,235629.0.html http://www.phpfreaks.com/forums/index.php/topic,239343.0.html http://www.phpfreaks.com/forums/index.php/topic,232815.0.html http://www.phpfreaks.com/forums/index.php/topic,216675.0.html Need I say more?
  2. You're not selecting a database would be my guess. Both $stats and $agentcenter_database are undefined in that script. If you place echo mysql_error(); after the queries and run it, an error should pop up.
  3. Why would you ever disable such a cool feature? Because it gets annoying when you reply to topics that people get offtopic to while you type a meaningful post?
  4. As mentioned before, you should see an endwhile; somewhere later in the script. In this case it is not a ternary operator, but an alternate syntax. From the PHP manual: while (expr): statement ... endwhile; Or, both of the following are the same: <?php /* example 1 */ $i = 1; while ($i <= 10) { echo $i++; /* the printed value would be $i before the increment (post-increment) */ } /* example 2 */ $i = 1; while ($i <= 10): echo $i; $i++; endwhile; ?> Blahh... i need to turn on the notify when there is a reply again
  5. Where does $stats come from? Also, why are you selecting the database & then querying a use database, thats kinda redundant.
  6. I've had different vertical resolutions (1024 vs 1050) and its not that big of a deal to me. A lot bigger, like 768 vs 1050 might be a bit odd, but anything less than 50 pixels isn't that bad.
  7. function formatBinary($s) { $p = STR_PAD_LEFT; if(strpos($s,'-')!==false) { $s = str_replace('-','',$s); $n = true; } foreach(explode('.',$s) as $x) { $l = strlen($x); $a[] = wordwrap(str_pad($x, $l + (3-($l%3))%3, '0', $p),3,' ',true); $p = STR_PAD_RIGHT; } if(isset($n)) return '- '.implode(' . ', $a); return implode(' . ', $a); } $num="-1111101.1011"; echo formatBinary($num); Works fine for me
  8. Ahh, I didn't even think about trying that... but: $l + (3-($l%3)%3) Should be: $l + (3-($l%3))%3
  9. I highly doubt it would work, because of driver conflicts?
  10. That's what I would do. You could do it with regex, like what mjdamato was going for, but just removing it & storing a temp var is fine too. function formatBinary($s) { $p = STR_PAD_LEFT; if(strpos($s,'-')!==false) { $s = str_replace('-','',$s); $n = true; } foreach(explode('.',$s) as $x) { $l = strlen($x); $a[] = wordwrap(str_pad($x, $l-($l%3)+3, '0', $p),3,' ',true); $p = STR_PAD_RIGHT; } if(isset($n)) return '- '.implode(' . ', $a); return implode(' . ', $a); } $num="-11101.1011"; echo formatBinary($num); I do realize that the math in str_pad ($l-($l%3)+3) will cause the correct numbers to be padded (e.g. 111 would become 000 111.) If you're concerned about that, just do a quick check to see if the modulus is 0 or not.
  11. Well, what's some sample input/outputs you want?
  12. Negative? You never mentioned that lol
  13. I've ran up to 3 monitors on my desktop before, 2 smaller standards and 1 wide. Currently I'm running dual 23" wide - and I'd never go back. I finding the ease of coding & testing is 100% easier with an extra monitor, because you can code on one screen, test/multi-task on the other(s). I'm a fan of widescreens, mainly for games/movies and more screen to go across my desk without interruptions (the bezel) Now the following is based off of a Windows OS, not Mac. I haven't used Flash/Dreamweaver to know if they use the space, but I know most programs use most of the space & expand nicely. As for spreading one program's windows out on multiple monitors - yes, you can. But its a lot easier to accidentally click out of the program when they are spread across multiple monitors. Another thing to look out for is the monitor colors/contrast ratios/brightness levels. I'd recommend (if applicable with budget) to get the same monitors, so you're more likely to get a uniform picture across all of the monitors. That's something I've run into before, and no matter how hard you try to mess with the settings you just can't get it exactly the same (even with tools such as the Spyder Pro.) And yes - 3 monitors most of the time means 2 video cards. Each card typically only has 2 outputs, so you'd need a 2nd card.
  14. Please do note that using curly brackets { } in a string is considered deprecated.
  15. If you wanted to go even shorter on mine: function formatBinary($s) { $p = STR_PAD_LEFT; foreach(explode('.',$s) as $x) { $l = strlen($x); $a[] = wordwrap(str_pad($x, $l-($l%3)+3, '0', $p),3,' ',true); $p = STR_PAD_RIGHT; } return implode(' . ', $a); } $num="01101.1011"; echo formatBinary($num); Should still work the same.
  16. Got bored & played around with it.... a bit shorter. <?php $num="01101.1011"; function formatBinary($string) { $a = explode('.',$string); $count = 0; foreach($a as $p => $x) { $length = strlen($x); $mod = $length%3; if($mod!=0) { if($count==0) $side = STR_PAD_LEFT; else $side = STR_PAD_RIGHT; $x = str_pad($x, $length-$mod+3, '0', $side); } $a[$p] = wordwrap($x,3,' ',true); $count++; } return implode(' . ', $a); } echo formatBinary($num); Takes the string, explodes it based off the delimiter (period in this case) then only on the first set does it pad to the left, the rest it pads to the right with 0s, grouping in triplets with a space in between. Here's some example input/outputs: InputOutput 01101.1011001 101 . 101 100 1101101.10111001 101 101 . 101 110 1101101111001 101 101 111 11.01101.1111011 . 011 010 . 111 100
  17. DiRT 2 on the PS3 has some of the most realistic graphics I've seen in any racing game ever.
  18. I have a PS3, but forgot what my handle is on there... shows you how often I play it. I love the FPS games (socom, some of tom clancy's, etc) but I typically just play them on the PC instead of on the PS3.... Who knows, I might start playing more. I'll add you later today wayne
  19. $query="SELECT user_id FROM forum_question WHERE username =" . $_SESSION['username'] .""; should be $query="SELECT user_id FROM forum_question WHERE username = '" . $_SESSION['username'] ."'"; Notice the single quotes.
  20. Close.... fputcsv
  21. <?php function foo( ) { $a = array('foo','foobar', 'bar'); return $a; } $array = foo(); print_r($array); ?>
  22. It returns an array.
  23. But user_id isn't an auto_incre'd field in this table. Thus, you can have one - your item id.
  24. user_id doesn't look like its an auto incremented field to me... Use an auto incremented key on item_id, and when inserting, use mysql_insert_id()
  25. Can you post your table schema?
×
×
  • 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.