Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Posts posted by hitman6003

  1. Those are data (*.MYD) and index (*.MYI) files for a mysql table.  if you delete them, it will delete the mysql table (and probably screw with the database as well).  If you need to shrink them, remove some data from the table.

     

    If the table is no longer inserted into (i.e. it's read only) you can use myisampack to compress it.

     

    You can try and OPTIMIZE the table, but you probably won't get much improvement.

     

    http://dev.mysql.com/doc/refman/5.0/en/optimize-table.html

  2. He doesn't need a FULLTEXT for his "basic search".  I use FULLTEXT for most of my searches, but this one is so simple that it's almost complete overkill.

     

    He never stated it was a "simple search".  If all content on the site is considered "news", then search becomes vital.  Inaccurate search is worse than no search in most cases, so fulltext indexing may be the best solution.

  3. What storage engine are you using?  MyISAM (and Falcon and Maria) all have builtin full text indexing, which is a VAST improvement over the 'WHERE column LIKE "%word%"' SQL queries.

     

    Aside from using one of the above storage engines (Falcon and Maria are MySQL 6 only at the moment, so it's MyISAM or bust) you can use an external full text indexer...Lucene, sphinx, etc.

  4. Why not return the element you want?

     

    function doSomething( $element = null ){
      $arr[] = 'something';
      $arr[] = 'something_else';
    
      // return the entire array if no element is specified
      // else return the specified element
      return (is_null($element) ? $arr : $arr[$element]);
    }
    
    echo doSomething( 0 );

     

    You could also make an object out of it and address it that way...

  5. It's probably not a "write lock" on the file, but a permission issue. 

     

    Whenever a file is on the desktop that you don't have permissions on, it shows up with a lock (su to root, set the umask to 077 and create a file on the logged in user's desktop...you'll see the same lock on the icon).  Add yourself to the same group as the apache user and make sure the group has read/write permissions.  Or chmod the file (as root) to 777, then see if the lock goes away.

  6. There is a bit of a workaround...

     

    -- essentially we are determining the number of spaces in the string (by subtracting the length
    -- of the string without spaces from the length with) and dividing the number of spaces into the 
    -- total number of characters 
    SELECT LENGTH(column_name) / (LENGTH(column_name) - LENGTH(REPLACE(column_name, ' ', ''))) AS num_of_words
    FROM table_name

     

    It's not 100% accurate, but it'll pass.

×
×
  • 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.