Jump to content

The Little Guy

Members
  • Posts

    6,675
  • Joined

  • Last visited

Everything posted by The Little Guy

  1. Say I have a chunk of code that looks like this (contains imagesx): <span style="color: #0000BB">$width </span><span style="color: #007700">= </span><span style="color: #0000BB">imagesx</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">); <br /> within the code I would like to make all the php functions link to php.net I thought that the following code would work, but it does not, well because there is no spaces around the above word public function phpLinks($string){ $words = explode(" ", $string); $str = array(); foreach($words as $word){ if(function_exists($word)){ $str[] = preg_replace("/$word/i", '<a href="//php.net/'.strtolower($word).'">'.$word.'</a>', $word); }else{ $str[] = $word; } } return implode(" ", $str); } I now can not think of a good way to do this, so I am asking does anyone have any suggestions?
  2. insert 1 time then create temporary table myTemp2 select * from myTemp1; This will then duplicate the table, BUT it won't create any keys you have on the temp table. Or like mikosiko said make it a real table, then delete when done.
  3. So the script worked last night! My server was still running when I woke up this morning! So... I think this is solved! Thanks for the suggestion!
  4. I have been looking at the Cassandra Database, and I am trying to figure out how it works, I still don't understand it. I assume that you wouldn't store your members in the database because you need to search it knowing exactly what key your looking for (but maybe I am wrong). What types of items/things would you store in a Cassandra database? How would a Cassandra database best be used?
  5. I will know 100% if it worked tomorrow, php-fpm seems to stop around 2AM (my time), so I will update this then. Thanks for the help!
  6. I didn't think I could add the cron to root on my vps, but I guess I can.... It seems to be working now...
  7. I tried this (/etc/sudoers): ryannaddyps ALL=NOPASSWD: /etc/init.d/php-fpm ryannaddyps ALL=(ALL) ALL It didn't work, does it look right?
  8. I have a bash script that runs as a cron, and one of the commands in the script requires sudo to work. My question is how do I pass a password to sudo? Here is the bash cron script: #!/bin/bash PHP_FPM_FOUND=`top -n 1 -b | grep -o php-fpm | wc -l` if [ "$PHP_FPM_FOUND" = "0" ] then sudo /etc/init.d/php-fpm start echo "Started php-fpm" else echo "Didn't Start php-fpm" fi
  9. Finally found time to implement this, it work terrific! Thanks for the help!
  10. Creating an index on that query should greatly speed things up. create index ip_type_photo on pp_ipcache (ipaddr, type, photo); -- or maybe even just this: create index photo on pp_ipcache (photo); I don't know how many records that table has, and the more there is the longer it will take to create an index, and phpMyAdmin would then be the last place you would wan't to create the index. A Command prompt or shell would be best.
  11. ah... Needed to do this: $a = abs(($a / 127) - 1); // $a = alpha Thanks guys/gals! This makes me feel dumb
  12. Okay, that works, but how would you make: 127 / 127 = 0 and 0 / 127 = 1 and everything else in between (.5 = .5, .4 = .6, .3 = .7, etc.)?
  13. I can not remember how to do this, so any help would be great! I am getting an alpha value from a pixel between 1 and 127, I need to convert it to a number between 1 and 0. 0 = 127 1 = 0 If you can help me remember the math to do this, it is very much appreciated!
  14. I own http://phpsnips.com, and we are in the process of rebuilding it, and we want to add a new feature that will allow members to see a demonstration of some of the snippets we have, so they can see the result of the php in action before the use it and then find out it didn't do what they were expecting. Do you have any suggestions for us on what we should do to keep it secure? Some of the big things I was thinking of were: A. No database examples B. No examples with eval C. Don't allow examples of all code
  15. Well I threw them into a table which fixed the issue for now...
  16. I am making custom drop down menu's, and when the div is expanded, everything moves all weird. So the best I could come up with so it doesn't happen is to absolutely position them. Here is an example of two within a table. The one on the right is the year/month/day, but the month and day are hidden behind the year drop down.
  17. What is the best way to have two absolute positioned div's that don't sit on top of each other?
  18. so, it looks like all I had to do on my server was create an nginx dir in my root and add the domain dir. I then just create files in it and I was able to do this for the rewrites: rewrite ^/snip/([0-9]+)$ /snippet.php?id=$1; rewrite ^/snip-([0-9]+)$ /snippet.php?id=$1; rewrite ^/snip/images$ /images;
  19. I think I want to convert my server from Apache to Nginx, but one problem I think I may face is mod rewrite rules. my current .htaccess file looks like this: RewriteEngine on RewriteRule ^snip/([0-9]+)$ snippet.php?id=$1 RewriteRule ^snip-([0-9]+)$ snippet.php?id=$1 RewriteRule ^snip/images$ /images Is there anything I need to do when converting? do similar rewrite rules work with Nginx? Any other thoughts on converting or on Nginx?
  20. Sweet! that works like a charm! Thank You! I just had to change selectPos to selectPos-1
  21. image mouseovers should be done via css IMO basically you make one image with two images laid on top of it. so say one image is 20x20 the second one would also be 20x20, and your full image would be 40x20 (or 20x40 depending on if you want it vertical/horizontal doesn't really matter). your HTML would look like this: <a href="" id="hoverImage" /></a> and your CSS would look like this: /*create a css window with an image as a background */ a#hoverImage{ display: block; float: left; height: 20px; width: 20px; background-image: url("/path/to/large/image.png"); background-repeat: no-repeat; } /* 40x20 image this will shift the background image to the left when someone mouse's over it */ a#hoverImage:hover{ background-position: -20px 0; }
  22. I have this jquery that isn't working. It is a search box. When someone searches for something a list of suggestions shows. When they press down it is supposed to go to the first result, down again another result, and so on. The problem I am having is when someone presses down the first time it selectPos is 1, it doesn't go to the first suggest-item, it goes to the first div. press down again selectPos is now 2 and it doesn't go to the second suggest-item but the second div. This continues up till 5 and starts over (which it should do). so, why is it going to the nth div and not the nth suggest-item? The jquery: $("div#suggest div.suggest-item:nth-child("+(selectPos)+")").addClass("suggest-hover"); The HTML: <div id="suggest" style="display: none; "> <div class="suggest-header"> <div class="suggest-strike"></div> <div class="suggest-head">SNIPPETS</div> </div> <div class="suggest-nomatch">No Matches Found</div> <div class="suggest-header"> <div class="suggest-strike"></div> <div class="suggest-head">PEOPLE</div> </div> <div class="suggest-item" id="people_886">imPathpaif</div> <div class="suggest-item" id="people_1367">perybrirur</div> <div class="suggest-item" id="people_4093">Meectireen</div> <div class="suggest-item" id="people_111522">TotEsopsyZ</div> <div class="suggest-item" id="people_111560">fluffZoorn</div> </div>
  23. How do you decide the high? Maybe I am wrong but I don't think this can be done with pure MySQL...
  24. I want to upgrade my current HD to a SSD, I have been looking and I am not sure which one I should get. This is the one that sticks out most to me: http://www.newegg.com/Product/Product.aspx?Item=N82E16820233220 Any suggestions? Should I get this one or a different one?
×
×
  • 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.