jasonrichardsmith
Members-
Posts
19 -
Joined
-
Last visited
Never
Everything posted by jasonrichardsmith
-
Play random youtube videos from urls in database
jasonrichardsmith replied to JohnOP's topic in PHP Coding Help
What html is it producing? -
Play random youtube videos from urls in database
jasonrichardsmith replied to JohnOP's topic in PHP Coding Help
Well what does your source show when the page renders. Does straight html work? I also don't think you need the &feature=feedu -
<?php $string='this is a sentence with a load of [great, clever, textual] variables '; if(preg_match("/[[](.*)[]]/", $string, $matches)){ $pieces = explode(", ", $matches[0]); foreach ($pieces as $value) { $replace = array( '[', ']' ); $value = str_replace($replace,'',$value); echo "this is a sentence with a load of $value variables.<br>"; } } else{ print "no matches found"; } ?> This works but I am guessing there is a more efficient way to not include the [] without doing a str_replace.
-
I am not an authority on preg_match but this should be damn close to what you want. if(preg_match('#\[[^)]+\]#', $string, $matches)){ $pieces = explode(", ", $matches[0]); foreach ($pieces as $value) { echo "this is a sentence with a load of $value variables.\n"; } } else{ print "no matches found"; }
-
I am not sure if this will fix your problem or not. I never tried this: usermod -G users www-data Then add the user option to fstab /dev/sda1 /foo/foo ext3 user,noauto,umask=0002 0 0 /foo/foo needs to change to your mount point and ext3 may not be the file system type. And /dev/sda1 may not be your device.
-
Now that I think about it, giving Apache server the right to mount and unmount is sorta dumb. I recommend setting up a cron job.
-
Not really. If you can mount stuff, your user name and root can mount that does not mean www-data can mount.
-
What are you looking to do with this? Is this for sorting like the title suggests?
-
text link to a URL variable from a database
jasonrichardsmith replied to jewelsmac6's topic in PHP Coding Help
? my sql close seems to be hanging out there. ?>">Read more...</a></p></table>'; mysql_close(); } } else { $dynamicList = "There aren't any articles yet, submit one today!"; } ?> -
I have currently developed a script that consumes a web service. It is running real slow. I think this is due to the web service provider. How do I diagnose/measure this?
-
Sorry should have checked it first. His callback "option" breaks its ability to work. replace this: <script type="text/javascript"> $(document).ready(function() { $('span.countdown').countdown({seconds: 30,window.location.replace("visit.php")}); }); </script> with the following: <script type="text/javascript"> $(document).ready(function() { $('#countdown').countdown({seconds: 5}) setTimeout(function() { window.location.href = "visit.php"; }, 5000); }); </script> no his seconds are 5 which equals the 5000 milliseconds in the setTimeout. I just tested this and it works.
-
paste this in a file named jquery.countdown.js /** * jQuery's Countdown Plugin * * display a countdown effect at given seconds, check out the following website for further information: * http://heartstringz.net/blog/posts/show/jquery-countdown-plugin * * @author Felix Ding * @version 0.1 * @copyright Copyright(c) 2008. Felix Ding * @license http://www.opensource.org/licenses/bsd-license.php The BSD License * @date 2008-03-09 * @lastmodified 2008-03-09 17:48 * @todo error & exceptions handling */ jQuery.fn.countdown = function(options) { /** * app init */ if(!options) options = '()'; if(jQuery(this).length == 0) return false; var obj = this; /** * break out and execute callback (if any) */ if(options.seconds < 0 || options.seconds == 'undefined') { if(options.callback) eval(options.callback); return null; } /** * recursive countdown */ window.setTimeout( function() { jQuery(obj).html(String(options.seconds)); --options.seconds; jQuery(obj).countdown(options); } , 1000 ); /** * return null */ return this; } Put this at the top of your page <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript" src="put.the.path.to.jquery.file.you.just.created"></script> Put this on the bottom of you page. I put all javascript on the bottom of the page per the Jquery cookbooks suggestion. <script type="text/javascript"> $(document).ready(function() { $('span.countdown').countdown({seconds: 30,window.location.replace("visit.php")}); }); </script> replace 30 with however long you want. keep this echo 'You\'ll be redirected in <span id="countdown"></span> secs. If not, click <a href="visit.php">here</a></div>.'; this should do everything for you
-
Stuck with a Broken Functions, cant figure it out.
jasonrichardsmith replied to monkeytooth's topic in PHP Coding Help
Geany is an excellent cross platform open source editor. http://www.geany.org/Documentation/Screenshots -
I would suggest not using a separate webpage for the countdown, I am not sure why you would do that, when you can use the same javascript on the same page. I would recommend you just use this jquery plugin and make it much easier. http://plugins.jquery.com/project/jquery-countdown echo 'You\'ll be redirected in <span id="countdown"></span> secs. If not, click <a href="visit.php">here</a></div>.';
-
get timestamp for your day, using string to time. subtract current time. multiply results to get your answer.
-
I have a soap client written up that works well on small requests, but on large ones I face out of memory issues. I want to be able to write the response directly to a file as an xml document, so I can use something like xpath. When I try this even on small responses it seems to go into a loop: $infile = $client->Retrieve($criteria); $outfile = fopen('./sites/all/modules/cvent/data.txt', 'w'); while (!feof($infile)) { fwrite($outfile, fread($infile, 2048)); } how can I put the data into a file straight from the response and still be economical on memory?