Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. <span class="bullet">text with a bullet</span> .bullet { background-image: url(images/bullet.gif); background-repeat: no-repeat; background-position: center; padding-left: 20px; } For semantics sake you should be using a LI
  2. Go to http://services.runescape.com/m=hiscore/hiscorepersonal.ws and enter your name type everything you see under Skills into the $skills array I already provided a few examples: if (isset($_POST['username'])) { $flags = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES; if ($stats = file('http://hiscore.runescape.com/index_lite.ws?player=' . $_POST['username'], $flags)) { $skills = array('overall', 'attack', 'defence', 'strength', 'hitpoints', 'ranged', ..); $player = array(); foreach ($stats as $line) { $key = current($skills); $player[$key] = array_map('trim', explode(',', $line)); //the below line only works if minigames stats are left out //this would allow you to do: $player['overall']['rank'] instead of $player['overall'][0]; //$player[$key] = array_combine(array('rank', 'level', 'xp'), array_map('trim', explode(',', $line))); if (!next($skills)) break;// no skills left } print_r($player);// 'overall' => array ( 0 => 11767, 1 => 2138, 2 => 209351778 ) .. } else { //error: username $_POST['username'] not found or highscores temporarily unavailable } } Have fun!
  3. if($_GET['form']=='processed') That would need to be: if(isset($_GET['form']) && 'processed' === $_GET['form']) Notice isset leaving this out would cause a warning to appear "Undefined index 'form'" everytime you would load the page without the ?form= parameter
  4. For the voting itself I would use the Bayesian Average instead of just using the Mean http://en.wikipedia.org/wiki/Bayesian_average
  5. http://en.wikipedia.org/wiki/Round-robin_tournament
  6. $flags = FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES; $lines = file('path/to/file.txt', $flags); // VALIDATE: $line >= 1 unset($lines[$line - 1]);// 0-based file_put_contents('path/to/file.txt', implode(PHP_EOL, $lines));
  7. Great design altough I would line-up Latest Tweet with Buzzed Out Host
  8. OOP is based around four basic principles: abstraction, inheritance, encapsulation and polymorphism. Nightslyr has already done a great job explaining these Besides these four principles there are principles which are considered good-practice and carry the mnemonic name SOLID (http://en.wikipedia.org/wiki/Solid_%28Object_Oriented_Design%29)
  9. Something like this just constitutes the idiot, moron and asshole you are. Never got enough love from mommy?
  10. ignace

    structure

    game (id, name) achievement (id, game_id, title, description, image_uri) user (id, username, password) achievement_collection (user_id, game_id, achievement_id, data) Don't worry about the logic behind achieving an achievement as the game is responsible for this your database is responsible for storing it. A query to select all achievements for user $uid filtered by game $gid: SELECT a.* FROM achievement_collection ac, achievement a WHERE ac.user_id = $uid AND ac.game_id = $gid AND ac.achievement_id = a.id
  11. Q1. What's the best way to implement the renderers, as part of the Widget class or as a separate class? 1a. If separate, how would it interact with the widget class(es)? Use a view helper instead of a "model" In your view: $this->widget($widget); Q2. How could I improve this design to simplify creation of new kinds of widgets? Use the factory pattern this allows you to create a PieChartWidget or a BarChartWidget Q3. And lastly, I feel like I am missing something here with regards to data encapsulation. How does data encapsulation relate to the requirements and play out in this scenario? It doesn't. Q4. How best could it be harnessed this project? Keep It Simple
  12. - If you click on a link nothing changes because everything happens below the fold you barely notice the change. - If I click on Start today also nothing happens - Add the Live Support to the top navigation - "DP1DLRLMR6.40Fixed Amount2010-01-31" <- not readable add more spacing - 98.9% Uptime is bad marketing altough it may be true your competitor will write 99.9% and hog all your clients - 30 Day Money Back so you know your hosting sucks? Why would you otherwise provide such a guarantee? - Press takes you to a news page with press news not a forum - Some of your links are dead - Integrate your support or make it look like your website template - There is alot bugged on your website all that does not comfort the client that you are a reliable host
  13. You can use either use a framework or just write from scratch. A framework has the advantage of delivering most common tasks like bootstrapping your application thus decreasing the time required to build your application however the learning curve can sometimes be difficult.
  14. Or some Flash as it's a game anyway. Is it gonna be a PBBG?
  15. $error='Username or Password are empty'; header("location:http://www.mysite.com/login.html?error=$error"); Should be: $error=urlencode('Username or Password are empty'); header("location:http://www.mysite.com/login.html?error=$error"); or header('Location: http://www.mysite.com/login.html?error=' . urlencode('Username or Password are empty'));
  16. if ($_SESSION['trackBrowsing'] !== 'value01' && $_SESSION['trackBrowsing'] !== 'value02') Note the && makes this code only execute when $_SESSION['trackBrowsing'] equals something different then value01 and value02 otherwise if you would use || this code would execute when one of both returns true $_SESSION['trackBrowsing'] === 'value01' by which it does not equal value02 for example
  17. 60*60 = 3600 write it instead of calculating it again and again.
  18. It's true for any language on which a skilled developer has worked. False otherwise.
  19. $search = $_POST['search']; If nothing was submitted and this code is accessed it throws an error of level E_NOTICE: Undefined index 'search' in .. on line ..
  20. No. Rely only on Arial, Verdana, Helvetica (Helvetica is considered the prettiest of 'em all)
  21. Yes Daniel0 gave them to me recently http://en.wikipedia.org/wiki/Bayesian_average http://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval I recommend Bayesian average as it is the easiest to implement The simplest of them all is calculating the median altough I'm not sure if this correct the previous stated problem: http://en.wikipedia.org/wiki/Median
  22. First off: ORDER BY Type In your query. Then using PHP: $type = ''; while ($row = mysql_fetch_assoc($result)) { if ($type !== $row['Type']) { $type = $row['Type']; print "<h2>$type</h2>"; } echo '<p>', $row['CompanyName'], '</p>'; } This will give you something like: Association CompanyName1 CompanyName2 CompanyName3 Consultant CompanyName4 CompanyName5 CompanyName6 Contractor CompanyName7 CompanyName8 CompanyName9
×
×
  • 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.