Jump to content

dyluck

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

About dyluck

  • Birthday 06/03/1981

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Calgary, Alberta

dyluck's Achievements

Member

Member (2/5)

0

Reputation

  1. dyluck

    Query Help!

    You Rule! thanks kickstart! Don't fully understand what inner / outer actually means but it works
  2. dyluck

    Query Help!

    HI There I am having trouble witt this query: $query = "SELECT roster.RID, roster.FIRSTN, roster.LASTN, cities.CITY, provstate.PROVSTATE, countries.COUNTRY FROM roster INNER JOIN cities ON roster.CITY = cities.CTID JOIN countries ON cities.COUNTRY = countries.ABBREV JOIN provstate ON cities.PROVSTATE = provstate.ABBREV ORDER BY roster.RID DESC LIMIT $rows,5"; The problem is that some rows cities.PROVSTATE is empty. The current statement ignores rows where PROVSTATE is empty even though cities.PROVSTATE also has an empty value there. Please help! Thanks
  3. Worked like a charm! thanks!
  4. Hi there, Does anyone have a sql query to replace a piece of string? I have many rows in a column with various filenames like blaa.gz baaaa.gz etc. I need to find the .gz and replace with .zip Is that possible in a mysql query? Thanks, dyluck
  5. Thanks a ton! works great!
  6. Hi There, I need help to remove a string with a slash and numbers like this pattern /176-0723275-0880505 Everythign I have tried doesn't work Thanks,
  7. well figured this one out on my own. first of all, it will update the user's cron not the main system cron (still want to figure that one out) Make sure that the cron.deny file doesn't have "nobody" or "whatever user the apache is using" in the list. make the cron.allow file in the same directory as cron.deny (if its not already there) and do the following: type: nobody apacheuserid CTRL X to save and Y and enter. to find out what apacheuserid is, do the following in a php file: $result = shell_exec("whoami"); echo "I am $result"; once you edit the cron.allow file, restart cron # /etc/init.d/crond restart Try again and it will write to the user cron file. to find the user's cron file to see if you even have one, do a # locate cron you will see one with your user id.
  8. For the life of me, this command will not work. how to i get php to echo the errors (if any?) shell_exec('crontab /home/dyluck/cron/mfd.txt');
  9. Cron jobs run by the system basically the main crontab -e Here is what I have so far: mfd.sh #!/bin/sh crontab /home/dyluck/cron/mfd.txt echo 'CRONTAB HAS BEEN UPDATED' # end script mfd.txt 0 2 * * * indexer --config /usr/local/sphinx/etc/sphinx.conf --all --rotate 3 2 * * * /usr/local/sphinx/bin/searchd --stop 4 2 * * * /usr/local/sphinx/bin/searchd* cronmfd.php <? system('sh /home/dyluck/cron/mfd.sh'); ?> Basically I figure that I can easily edit a txt file and then envoke a linux shell script from php. When I invoke my mfd.sh file from SSH it works fine. When I do it wiht the php command, it doesn't work
  10. Hi there, How do you edit the crontab file from php? I need to make adjustments to the crontab file from mysql / php where would I start. I have searched high and low and came up with very little.
  11. awesome works Thanks!
  12. excellent thanks haha silly me that got rid of the errors. Still is returning just the host name and not the list of files though
  13. Trying to connect to FTP. With one host, it works fine and lists all the files, with another, all it returns is the host server name. function ftpdirectory( $host, $username, $password, $directory ) { // set up a connection or die $conn = ftp_connect($host) or die("Couldn't connect to $ftp_server"); if (ftp_login($conn, $username, $password)) { ftp_pasv($conn, true); // Change the dir if(@ftp_chdir( $conn, $directory )) { ftp_chdir($conn, $directory); } $ftp_nlist = ftp_nlist($conn, "."); sort($ftp_nlist); $x = 0; $neg = "-1"; foreach ($ftp_nlist as $v) { //1. Size is '-1' => directory if (ftp_size($ftp_connect, $v) == $neg) { //output as [ directory ] $flist[$x] = $v; $x++; } } foreach ($ftp_nlist as $v) { //2. Size is not '-1' => file if (ftp_size($ftp_connect, $v) <> $neg) { //output as file $flist[$x] = $v; $x++; } } //ftp_close($conn); return $flist; ftp_close($conn); } else { return false; ftp_close($conn); } } echo implode("<br>", ftpdirectory( $host,$username,$password,$directory)); No matter what I get a long list of the following error on the one that works: Warning: ftp_size() expects parameter 1 to be resource, null given in The one that doesn't work does this: Warning: ftp_size() expects parameter 1 to be resource, null given in /home/public_html/test/testfunctions.php on line 89 Warning: ftp_size() expects parameter 1 to be resource, null given in /home/public_html/test/testfunctions.php on line 100 ftp.host.com Thanks!
  14. I've used preg_match in other applications however not in this one. do you have a practical example?
  15. Hi There, Trying to figure out the best function to display the closest match to a string. I have tried similar_text() and levenshtein() I wrote this myself and it doesn't seem to work well. function checksimilar( $word, $wordlist ) { foreach($wordlist as $value) { similar_text($word, $value, $percent); if($percent > .75) { $newstring[$value] = $percent; } else { $thekey = "No Close Suggestions"; $newstring[$thekey] = 1; } } asort($newstring); $key = key($newstring); return $key; } Tried this too, doesn't work very good either: function checksimilar( $word, $wordlist ) { $input = $word; // array of words to check against $words = $wordlist; // no shortest distance found, yet $shortest = -1; // loop through words to find the closest foreach ($words as $word) { // calculate the distance between the input word, // and the current word $lev = levenshtein($input, $word); // check for an exact match if ($lev == 0) { // closest word is this one (exact match) $closest = $word; $shortest = 0; // break out of the loop; we've found an exact match break; } // if this distance is less than the next found shortest // distance, OR if a next shortest word has not yet been found if ($lev <= $shortest || $shortest < 0) { // set the closest match, and shortest distance $closest = $word; $shortest = $lev; } } echo "Input word: $input\n"; if ($shortest <> 0) { return $closest; } //end checksimilar Here is example of what the comparrision is comparing: $word = GameFly_Online_Video_Game_Rentals-Rental_Product_Catalog.txt.gz $wordlist = array(GameSharkStore-Product_Catalog.txt.gz, GameFly_Online_Video_Games_Rentals-Rental_Product_Catalog2.txt.gz, Geeks_com-Product_Catalog_.txt.gz); I of course want it to suggest: GameFly_Online_Video_Games_Rentals-Rental_Product_Catalog2.txt.gz its slightly different then the original word but very close. Hope someone else has a better way of doing this!
×
×
  • 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.