Jump to content

VikR

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Posts posted by VikR

  1. Checking httpd.conf, I see:

     

    <IfModule !mpm_winnt.c>
    <IfModule !mpm_netware.c>
    #
    # If you wish httpd to run as a different user or group, you must run
    # httpd as root initially and it will switch.  
    #
    # User/Group: The name (or #number) of the user/group to run httpd as.
    #  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
    #  . On HPUX you may not be able to use shared memory as nobody, and the
    #    suggested workaround is to create a user www and use that user.
    #  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
    #  when the value of (unsigned)Group is above 60000; 
    #  don't use Group #-1 on these systems!
    #
    User myAdminUsername
    Group #-1
    </IfModule>
    </IfModule>

     

    Next to "User" it shows the same admin name I use when logging in.  I would think this would mean it would have full access to all files and folders.  What could I be missing?

  2. When executed from the terminal, the following command works perfectly:

     

    gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/gnuPlotCommandFile.gp'

     

    However, when I run it from inside PHP with:

     

    exec("gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/gnuPlotCommandFile.gp'");

     

    ...or:

     

    system("gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/gnuPlotCommandFile.gp'");

     

    ...nothing seems to happen. How can I correct this?

     

    Note - exec is enabled on my system, according to the following function:

     

    function exec_enabled() {

      $disabled = explode(', ', ini_get('disable_functions'));

      return !in_array('exec', $disabled);

    }

     

    Thanks very much in advance to all for any info.

     

  3. This is my first time using GD. I've got an image with a transparent background. All the other pixels are the identical color (#8bc4ed). I want to replace all those pixels with a given color, say #CCC5AC. Here's my code that doesn't work yet:

     

    $filepath = $_SERVER['DOCUMENT_ROOT'] . "/images/source_image.gif"; 
    $image = imagecreatefromgif($filepath); 
    
    $indexToSearchFor = imagecolorat($image, 3, 0); 
    imagecolorset($image, $indexToSearchFor, 204, 197, 172); 
    
    $filepath = $_SERVER['DOCUMENT_ROOT'] . "/images/target.gif"; 
    imagegif ($image,  $filepath);

     

    The output image is identical to the input image - no color is replaced.

     

    What is the correct way to do this?

     

    Here is a link to the image I'm trying to change in case you can tell anything from it: http://www.generalwebapps.com/images/header_2_selected.gif.

     

    Thanks very much to all in advance for any info!

  4. I have text in a table header element that is centered correctly in Firefox/XP, Firefox/Mac, and Safari/Mac, but on IE7/XP, it isn't centered. Here's a link to the demo:

     

    http://tinyurl.com/c3kj6g

     

    The text I am trying to center is "Clear All", "Save This", and "Friendly Helper". (screen shot attached).

     

    table-header-anomaly.jpg

     

    What is the correct way to get this text to center in IE7?

     

    Thanks very much in advance to all for any info.

  5. I think I just got it working using Views. Very cool!

    CREATE OR REPLACE VIEW NewAlloysPlusRatings AS 
    SELECT  brand_name, date_added, description, new_alloys_added_by_users.Alloy_ID_No, fz_score, id_of_user_who_added_this, id_of_user_who_provided_this_rating, let_other_people_use_this_info, Long_Desc, product_name, rating_was_a_plus
    from new_alloys_added_by_users left join ratings_for_fz_scores on new_alloys_added_by_users.Alloy_ID_No = ratings_for_fz_scores.Alloy_ID_No ;
    
    CREATE OR REPLACE VIEW UserPrefsPlusNewAlloys AS 
    SELECT id, NDB_No, min, max, final_amount, user_prefs_for_alloys.Alloy_ID_No
    FROM user_prefs_for_alloys
    JOIN new_alloys_added_by_users ON user_prefs_for_alloys.Alloy_ID_No = new_alloys_added_by_users.Alloy_ID_No
    WHERE (user_prefs_for_alloys.id = 1)
    AND (user_prefs_for_alloys.Alloy_ID_No >0);
    
    SELECT *
    from NewAlloysPlusRatings JOIN UserPrefsPlusNewAlloys on NewAlloysPlusRatings.Alloy_ID_No = UserPrefsPlusNewAlloys.Alloy_ID_No;

     

    Thanks very much to everyone here for your help!

     

     

  6. Thanks for the great info, xtopolis.  I am attaching the structures via SHOW CREATE TABLE.

     

    I have two queries that are working correctly. I need to join the results. Since SELECT AS is not the correct approach, what approach may I use for this purpose? Here are the two queries.

     

    SELECT  *  from new_alloys_added_by_users  left join ratings_for_fz_scores on new_alloys_added_by_users.Alloy_ID_No = ratings_for_fz_scores.Alloy_ID_No
    
    SELECT * 
    FROM user_prefs_for_alloys
    JOIN new_alloys_added_by_users ON user_prefs_for_alloys.Alloy_ID_No = new_alloys_added_by_users.Alloy_ID_No
    WHERE (user_prefs_for_alloys.id = 1)
    AND (user_prefs_for_alloys.Alloy_ID_No >0)

     

    Both queries are working correctly.  What is the correct way to join the results? Thanks very much in advance for any info.

     

    +----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    | Table                | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

    +----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    | user_prefs_for_alloys | CREATE TABLE `user_prefs_for_alloys` (

      `id` int(11) NOT NULL,

      `NDB_No` int(11) NOT NULL,

      `Alloy_ID_No` int(11) NOT NULL,

      `min` float NOT NULL,

      `max` float NOT NULL,

      `final_amount` float NOT NULL default '0',

      `fz_units_id` varchar(15) NOT NULL,

      `used_in_last_alloy_plan` tinyint(1) NOT NULL,

      KEY `id` (`id`),

      KEY `id_2` (`id`,`NDB_No`),

      KEY `id_3` (`id`,`Alloy_ID_No`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |

    +----------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    1 rows in set (0.04 sec)

     

    mysql> SHOW CREATE TABLE new_alloys_added_by_users;

    +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    | Table                    | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

    +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    | new_alloys_added_by_users | CREATE TABLE `new_alloys_added_by_users` (

      `Alloy_ID_No` int(11) NOT NULL auto_increment,

      `Long_Desc` varchar(200) NOT NULL,

      `brand_name` varchar(75) NOT NULL,

      `product_name` varchar(75) NOT NULL,

      `description` varchar(35) NOT NULL,

      `id_of_user_who_added_this` int(11) NOT NULL COMMENT 'The ID of the User who Added It',

      `fz_score` int(11) NOT NULL,

      `date_added` varchar(12) NOT NULL default '',

      `let_other_people_use_this_info` tinyint(1) NOT NULL,

      PRIMARY KEY  (`Alloy_ID_No`),

      KEY `Alloy_ID_No` (`Alloy_ID_No`),

      KEY `Long_Desc` (`Long_Desc`,`id_of_user_who_added_this`),

      KEY `Long_Desc_2` (`Long_Desc`,`let_other_people_use_this_info`)

    ) ENGINE=MyISAM AUTO_INCREMENT=125 DEFAULT CHARSET=latin1 |

    +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    1 rows in set (0.05 sec)

     

    mysql> SHOW CREATE TABLE ratings_for_fz_scores

        -> ;

    +-----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    | Table                | Create Table                                                                                                                                                                                                                                                                                                                |

    +-----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    | ratings_for_fz_scores | CREATE TABLE `ratings_for_fz_scores` (

      `Alloy_ID_No` int(11) NOT NULL,

      `id_of_user_who_provided_this_rating` int(11) NOT NULL,

      `rating_was_a_plus` tinyint(1) NOT NULL,

      KEY `Alloy_ID_No` (`Alloy_ID_No`,`id_of_user_who_provided_this_rating`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |

    +-----------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    1 rows in set (0.04 sec)

     

    mysql>

     

  7. From the stickies:

     

    the table structure & column indexes of the relevant tables [via SHOW CREATE TABLE is preferred]

     

    It says that posting the structures via SHOW CREATE TABLE is preferred, but not required, so I believe I am in compliance.

     

    Can you be more specific about how to correct the syntax I posted? I have tried moving the AS section into the "SELECT * " area, but I'm still getting the same error. I would really appreciate advice on this, as well as on improved compliance with the stickies.

     

  8. I'm working on accomplishing this by doing two separate queries, and then joining the results. Something like this...

    select  *  from new_alloys_added_by_users  left join ratings_for_fz_scores on new_alloys_added_by_users.Alloy_ID_No = ratings_for_fz_scores.Alloy_ID_No AS NewAlloysAndRatings
    
    SELECT * 
    FROM user_prefs_for_alloys
    JOIN new_alloys_added_by_users ON user_prefs_for_alloys.Alloy_ID_No = new_alloys_added_by_users.Alloy_ID_No
    WHERE (user_prefs_for_alloys.id = 1)
    AND (user_prefs_for_alloys.Alloy_ID_No >0)
    AS UserPrefsAndNewAlloys
    
    SELECT *
    from NewAlloysAndRatings JOIN UserPrefsAndNewAlloys on NewAlloysAndRatings.Alloy_ID_No = UserPrefsAndNewAlloys.Alloy_ID_No
    

     

    I don't have the syntax for the AS keyword right yet. When I enter:

     

    select  *  from new_alloys_added_by_users  left join ratings_for_fz_scores on new_alloys_added_by_users.Alloy_ID_No = ratings_for_fz_scores.Alloy_ID_No AS NewAlloysAndRatings

     

    ...I get this error:

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS NewAlloysAndRatings' at line 1

     

    Do you know how I can correct this syntax error by any chance?

     

     

  9. You may be right. Let me see if I follow. Here's what's going on with the table structure.

     

    "user_prefs_for_alloys" includes one row for each alloy, for each user. I.e. a user can have preferences for the use of any number of alloys.  The alloy_id_no indicates which alloy the row contains preferences for.

     

    "new_alloys_added_by_users" contains new alloys entered by users.  Each user can enter any number of alloys.

     

    "ratings_for_scores" is where each user can rate any of the alloys by giving it a thumbs up or a thumbs down.

     

    The reason there is a separate table for "user_prefs_for_alloys" is that all users can have preferences for the use of all alloys, whether they are the user who added that particular alloy or not.

     

    Does this make sense? Am I missing something in the table structure that is keeping the mySQL syntax from working as expected?

     

    Thanks very much for your thoughts.

     

  10. I have 3 tables:

     

    • "new_alloys_added_by_users" includes one record per each alloy added by each user.
    • "user_prefs_for_alloys" has multiple records for each user and for each alloy.
    • "ratings_for_alloy_scores" has at most one record for each user/alloy combination, but not all alloys are rated by all users.

     

    I want to do a query that will:

     

    • Select all the records from "new_alloys_added_by_users" that are marked as being used by the id of the current user (new_alloys_added_by_users.id).
    • Join to each of those records, the record from "user_prefs_for_alloys" for that alloy (user_prefs_for_alloys.alloy_ID_No) and for that user (user_prefs_for_alloys.id = 1 in this example, since 1 is the id of the current user in this example).
    • Join to each of these records, the record from "ratings_for_alloy_scores" for that alloy (ratings_for_alloy_scores.alloy_ID_No) as rated by that user (ratings_for_alloy_scores.id_of_user_who_provided_this_rating = 1)... if such a rating is available.

     

    Here's my mySQL query:

     

    SELECT * 
    FROM (new_alloys_added_by_users
    JOIN user_prefs_for_alloys ON user_prefs_for_alloys.alloy_ID_No = new_alloys_added_by_users.alloy_ID_No)
    LEFT JOIN ratings_for_alloy_scores ON ratings_for_alloy_scores.alloy_ID_No = new_alloys_added_by_users.alloy_ID_No
    WHERE (user_prefs_for_alloys.id = 1)
    AND (ratings_for_alloy_scores.id_of_user_who_provided_this_rating = 1)

     

    This is working, except that it's only giving me records where there is a rating for an alloy in the "ratings_for_alloy_scores" table. I thought a left join would also return records where there was no record in the table being left joined, in this case the "ratings_for_alloy_scores" table, and just mark the fields from the "ratings_for_alloy_scores" table as NULL.

     

    If I remove the line:

       

       

    AND (ratings_for_alloy_scores.id_of_user_who_provided_this_rating = 1)

     

    ...then I get records returned for all ratings by all users, instead of just ratings where ratings_for_alloy_scores.id_of_user_who_provided_this_rating = 1.

     

    What am I missing?

     

    Thanks very much in advance to all for any info!

     

     

    -Vik

     

    Relevant info:

     

    MySQL: Client API version 5.0.41

     

    TABLE "new_alloys_added_by_users"

    alloy_ID_No                        int              11

    Long_Desc                          varchar          200

    brand_name                          varchar          75

    product_name                        varchar          75

    description                        varchar          35

    id_of_user_who_added_this          int              11

    score                              int              11

    date_added                          varchar          12

    let_other_people_use_this_info      tinyint            1

     

     

    TABLE "user_prefs_for_alloys"

    id                                  int              11

    NDB_No                              int              11

    alloy_ID_No                        int              11

    min                                float              0

    max                                float              0

    final_amount                        float              0

    units_id                            varchar          15

    used_in_last_alloy_plan            tinyint            1

     

     

    TABLE "ratings_for_scores"

    alloy_ID_No                        int              11

    id_of_user_who_provided_this_rating int              11

    rating_was_a_plus                  tinyint            1

     

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