Jump to content
Larry Ullman's Book Forums

Edward

Members
  • Posts

    1115
  • Joined

  • Last visited

  • Days Won

    27

Posts posted by Edward

  1. I had my Yii projet files in the htdocs in a mysite folder, i decided to move the files out ot this mysite folder to the htdocs web root folder. The index page of my Yii site will load but all other pages i link to come up with the error:

     

    404 Not Found

    Not Found

    The requested URL /mysite/user/create was not found on this server.

     

     

    Then i made the mysite folder again and put the Yii files back into it and now the same message comes up. Does anyone know why this is happening?

  2. This is not really a book related question but more on a question of design for my tables. If i would like an expert opinion because this could be very costly for me if i was to make a design mistake and have to come back to recode later.

     

    I have a basic item table on my website which stores all item details, title, cost, quantity etc. Now each item can have more than one local shipping or international shipping.

     

    The problem i have here is that if someone had to list 100 of there products they would have to fill out these local and international shippings 100 times. So say they had 3 local shippings and 3 international shippings that would be 6 different shippings per product which would mean they would have to copy this out 600 times which seems ridiculous.

     

    So what i have done is build a shipping module which means you create one shipping module select which local and international shippings you want, then when you list your item you can pick the shipping module you want to associate with it. This would obviously be a time saver and a bit of common sense.

     

    I have is the local and international shippings which could be 3 of each per shipping module are saved to two separate databases one for local the other for domestic as both have their own individual criteria.

     

    So how should i make my databases if the local and international shipping databases would be the same for a shipping module as to an Item?

     

    There are two solutions i have now and i am wondering which is best? This is where i need your help...

     

    Solution 1

     

    Create separate local and international shipping databases for Item and Shipping Module.

     

    For example

     

    CREATE TABLE shipping_local (
    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    item_id INT(10) UNSIGNED NOT NULL,
    cost INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (id),
    INDEX fk_shipping_local_item_idx (item_id ASC)
    )ENGINE=InnoDB;

    CREATE TABLE shipping_international (
    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    item_id INT(10) UNSIGNED NOT NULL,
    cost INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (id),
    INDEX fk_shipping_international_item_idx (item_id ASC)
    )ENGINE=InnoDB;

     

    CREATE TABLE shipping_local (
    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    shipping_module_id INT(10) UNSIGNED NOT NULL,
    cost INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (id),
    INDEX fk_shipping_local_shipping_module_idx (shipping_module_id ASC)
    )ENGINE=InnoDB;

    CREATE TABLE shipping_international (
    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    shipping_module_id INT(10) UNSIGNED NOT NULL,
    cost INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (id),
    INDEX fk_shipping_international_shipping_module_idx (shipping_module_id ASC)
    )ENGINE=InnoDB;

     

    Solution 2

     

    Create just one of each shipping_local and shipping_international database and add both shipping_module_id and item_id to each. So if an item put the shippings in local or international shipping database item_id would have the id of the item and shipping_module_id would be set as 0 rather than Null. And if the shippings where related to a shipping module, then the shipping_module_id would have the id of the shipping module and item_id would be set to 0.

     

    For example

     

    CREATE TABLE shipping_local (
    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,

    shipping_module_id INT(10) UNSIGNED NOT NULL,
    item_id INT(10) UNSIGNED NOT NULL,
    cost INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (id),
    INDEX fk_shipping_local_item_idx (item_id ASC),

    INDEX fk_shipping_local_shipping_module_idx (shipping_module_id ASC)
    )ENGINE=InnoDB;

    CREATE TABLE shipping_international (
    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,

    shipping_module_id INT(10) UNSIGNED NOT NULL,
    item_id INT(10) UNSIGNED NOT NULL,
    cost INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (id),
    INDEX fk_shipping_international_item_idx (item_id ASC),

    INDEX fk_shipping_international_shipping_module_idx (shipping_module_id ASC)
    )ENGINE=InnoDB;

     

    I know this is a long post but i really need to ask this, i have already made some major mistakes on my projects and they can take up to 6 weeks to repair or longer depending on what it is.

     

    Edward.

  3. I have a question for those with more experience than me.

     

    How does a foreach loop work if you have items in an array which are numerically indexed but in the wrong the order for example  2, 3, 1 and not 0, 1, 2. Will the foreach loop still go through each item in the order its in, or does the foreach loop sort out the values in the array first? -_-

     

    The reason i am asking this is because i have a situation when i will need server data to be in the unordered numerical format.

     

    Your help would be much appreciated by me.

  4. I have an item table:

     

    CREATE TABLE item (
    id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    user_id INT(10) UNSIGNED NOT NULL,
    category_id INT(10) UNSIGNED NOT NULL,
    price INT(10) UNSIGNED NOT NULL,
    date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    date_updated DATETIME DEFAULT NULL,
    PRIMARY KEY (id),
    INDEX fk_item_user_idx (user_id ASC)
    )ENGINE=InnoDB;

     

    but what i don't find clear is should i make a separate table for the category_id which links to a table with all the catogories like:

     

    CREATE TABLE item_category (
    item_id INT UNSIGNED NOT NULL,
    category_id INT UNSIGNED NOT NULL,
    PRIMARY KEY (item_id, category_id),
    INDEX fk_item_category_item_idx (item_id ASC),
    INDEX fk_item_category_category_idx (category_id ASC)
    )ENGINE=InnoDB;

     

    or should i include the category_id inside the item table. This is really not clear to me as i can find examples everywhere online of with both senerios. What is the correct thing to do have more tables or put everything in one. Because even if we have a middle table to glue the item and category table, the item_category table will still have repeated category values as would of had the item table??? I have some other tables that i need associating with the item so now, I am confused!

     

     

     

     

     

     

  5. I use FZ because it allowed me to use SSH and there were tutorials for it. I find Dreamweaver finicky, it wants definite folder relations that don't change. It varies, on my motivation and what i'm doing. I am currently more focussed on server config currently.

     

    I am trying to get minimum 4 hours in per day when i can code. I find my brain gets tired after 1 hours work then i am done by just over 2 hours then need to come back. By the time i get to 4 hours i couldn't think well anymore and i don't seem to be producing quality work. Sometimes its just not the best way to be no stop coding as i do get most of my good ideas when i am away from the computer. Its fun but it does get quite boring at times.

  6. I just have a quick question since i am no server expert.

     

    When uploading image files to a temporary folder on the server, what should we chmod the image permissions to? (e.g 777)

     

    Also what should the folder permission be of the temporary folder?

     

    I could upload my image files but could not move them to another folder on the server, is there a certain permission this folder should be also?

  7. I use Dreamweaver for uploading my files, why do you use FileZila if you have DW? Jonathon can i ask how many hours per day or per week do you spend working on your website. The last few months ive done pretty much bugger all, i lost my motivation when i had to go back and recode stuff. I am forcing myself now to get through the recoding stuff will be there soon, i think if i bash out the code hard for the next 8 months i should be able to get my site online to take in some Sellers.

  8. Thanks for your comments sandy. I think 777 is fine as long as you have a standard VPS this is pretty much the same as a dedicated server so in other words no one can access your files. Also you can validate any files being uploaded with chile manger just check the mimeType of the file and you can be sure what it is.

  9. Thanks Larry, that is what i originally coded, now i am going back to recode my item listing page and make it ajax submission only.

     

    I have also enabled csrf token on my site recently which caused me a major problem with my SWFUpload flash uploader which i landed up taking 6 hours to figure out the problem. Even though i had no form in my script it was still necessary to pass the csrf token in yii. In the end it turned out it was so easy to fix and all that for 6 hours work, i really thought i was going to have to make a post here but just after i thought that about that, that's when i got it, ahhhhhhhh! -_- (Just one of those days, or two days rather.)

     

    Thanks for your help im still around...Just busy with my own problems now.

  10. I have a website which in the future may have more than a million images on it :) (I HOPE SO). Images would be presented in four different sizes ranging from 100px up to 600px +.

     

    Should i save four separate images for an item so i could load the size required. (This is what i actually coded already).

     

    Or should i use the yii easyimage extension which inplements the kohana image library and enables you create each size of image you want on the fly?

     

    May be the answer to this question would be different if i had 1 million members!!

     

    I know you are a busy buy Larry but i need your advise, the things you have taught me already are considerably shortening my development time. I'm going to be there soon i can feel it.

     

     

  11. I've got the mail gun Yii extension up and running now it's great. It was coded by a Russian guy he made a good job of it. All the standard mail gun functions are there. It's definitly worth using this rather than standard php mail functions because all the mail will go through. It works well with Gmail, Yahoo and Hotmail and the new Hotmail Outlook. I think this is one of the best extensions for Yii.

×
×
  • Create New...