Jump to content

dreamwest

Members
  • Posts

    1,223
  • Joined

  • Last visited

    Never

Everything posted by dreamwest

  1. Why dosent this work, im trying to match upper case, lower case and numbers only $id = '3xDJ7@#'; if (!preg_match('/^[a-zA-Z0-9]/', $id)){ echo "ERROR!"; }else{ echo 'ok'; } This always echos "ok"
  2. Actually i was wrong about the 18yo powers thing, its jesus that got his "powers" at 18yo, supes had his powers when he first was brought into the sunlight
  3. Itll be different this time (trust me), theres a new director Christopher nolan, i have great faith in his imagination. Anyhow its going to be a new story - reintroduction of superman from the beginning. What would be really REALLY great if they did a similar theme to how lois and clark the new adventures of superman started out as. Maybe his parents dont tell him hes an alien and when he starts getting his powers at 18yo it could be a discovery thing.
  4. Yeah i finally figured it out $res = mysql_query("SELECT * FROM styles_q"); while ($new = mysql_fetch_assoc( $res )){ $tmb[$new['st_id']] = array('name' => $new['st_name']); } echo $tmb['32']['name'];
  5. Close but i only have the id "38" not the array number, is there a way i can number the array so i can just call the name? Array ( [32] => Array ( [name] => acid jazz ) [78] => Array ( [name] => african ) [62] => Array ( [name] => alternative country ) [19] => Array ( [name] => alternative dance ) [4] => Array ( [name] => alternative metal [id] => 33 ) [38] => Array ( [name] => alternative rap ) )
  6. Oh yeah!! The greatest superhero of all time is returning to the big screen (Hopefully in 3D) http://www.collider.com/2010/10/16/superman-man-of-steel-zack-snyder/?_r=true
  7. Im trying to get a name from an array Array ( [0] => Array ( [name] => acid jazz [id] => 32 ) [1] => Array ( [name] => african [id] => 78 ) [2] => Array ( [name] => alternative country [id] => 62 ) [3] => Array ( [name] => alternative dance [id] => 19 ) [4] => Array ( [name] => alternative metal [id] => 33 ) [5] => Array ( [name] => alternative rap [id] => 38 ) ) Basically all ive got is the id, so if array[5] has id of 38 i want to return the name, aka "alternative rap"
  8. Usually if you go to a url like: http://site.com/cache/file.html The browser will detect the gzip file from htaccess settings, but its not accepting the gzip file in this case ..pity cause its a huge saver
  9. dreamwest

    gzip

    Ive gzipped some static html files and want to send it to the browser but not sure how to approach it So i have : http://site.com/cache/file.html (14gb) http://site.com/cache/file.html.gz (1kb) I did this but do i still need a header?? <?php if(file_exists('cache/file.html')){ @readfile("cache/file.html"); } ?>
  10. shadowbox can do that and its only 20kb (4kb gzipped)
  11. function redirect( $url ){ if (! headers_sent( ) ){ header( "Location: ".$url ); exit( 0 ); } echo "<script language=Javascript>document.location.href='".$url."';</script>"; exit( 0 ); } $test = $_POST['test']; $page_vars = $_GET['page_vars']; //etc if($test){ redirect('http://site.com/index.php?forum=1&topic=1&page=2&post=236#p236'); //redirect to any url }
  12. down the bottom you have an {if} tag, it should be {if $variable eq 'something'} anyways just delete it, its like having if(){} in php see how the following is? Code: {if $product.forsale ne "B"} <tr> <td colspan="2"> {include file="customer/main/product_prices.tpl"} </td> </tr> {/if}and after add Thats how you should structure if/else tags
  13. like most desktop apps do, magical gnomes sit there and translate the text for you ..but back to your question (which im asking also) "How the hell is it supposed to translate the text for you?" Answer: It doesnt it just swaps text Which brings me back my first question - whats the point? Im gonna name it "swaptext"
  14. It would be interesting if it actually did translate, not just replace your own translated text an example: The translator will have to edit these, either by hand or with a translation tool like Poedit, or Emacs with its editing mode for .po files. When they are done, the entry will look like this: #: src/name.c:36 msgid "My name is %s.\n" msgstr "Je m'appelle %s.\n" Basically its just replacing text
  15. What the point of gettext when you STILL have to manually edit language.po files, might as well named it preg_replace
  16. if your joining tables make sure each has a prefix, your basically smashing three tables together $res = mysql_query("SELECT * FROM table1 as a, table2 as b, table3 as c WHERE a.field='stuff' etc.... "); Join as many as you like Also index any joined fields and delay key write for speedy gonzalez
  17. A good way to build a database is to think of it like a pyramid, dating/user profile first then hobbies relating to that user then friends of that user etc, that way you can relate any data to that one user anywhere in the database no matter how many tables ..and dont waste time with template building get a decent css one for $20, youll save yourself a month of work
  18. Your better off developing some of your own apps first and get some exp before you even think about building apps for a company..its just easier
  19. Theres a better way without using preg_replace, you can even replace regex patterns $remove = array(';',"'",'/'); $file_name = str_replace($remove,'',basename($_FILES[$upload_name]['name']); see so much simpler..
  20. <?php $homepage = "http://www.example.com"; $page_contents1 = file_get_contents($homepage); $names1 = preg_match_all('~<span class\s?=\s?[\'"]video_date[\'"]>(.*)</span> - <a class\s?=\s?[\'"]b[\'"] href\s?=\s?[\'"]/(.*)/[\'"]>(.*)</a><br/>~is', $page_contents1, $matches1); echo implode(", ", $matches1[1]); ?>
  21. $data = @file_get_contents("http://steamcommunity.com/profiles/76561197968575517/stats/L4D2/?xml=1"); $n_data = new SimpleXmlElement($data, LIBXML_NOCDATA); foreach ($n_data->playerstats->stats as $d) { echo $d->campaign; //etc... }
  22. wizecho has a good muti crawler class - just delete the stuff you dont need. http://www.wizecho.com/nav=scripts&s=spider AND dont forget to learn smarty, a lot of programming jobs now require advanced smarty skills http://smarty.net
  23. Well i managed to get my mysql queries down to < 0.3 secs (front end) by delaying key write, setting default order and using fulltext - let me know what you get. Im working on a mod to get asynchronous results from mysql and instantly display them when a user clicks "submit", its more of a trick though
  24. Indeed. Considering the speed you get from sphinx, do you think this query matches the performance: $string = "foreach loops";foreach(str_word_count($string,1) as $word)$search_sql .= "+{$word} ";$res = mysql_query("SELECT * FROM `freaks` WHERE MATCH `topic` AGAINST('{$search_sql}' IN BOOLEAN MODE) "); I have 40 Million + rows with 10 GB data and get queries < 0.5 secs
×
×
  • 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.