Jump to content

boo_lolly

Members
  • Posts

    1,172
  • Joined

  • Last visited

About boo_lolly

  • Birthday 04/20/1984

Profile Information

  • Gender
    Male
  • Location
    cloud nine

boo_lolly's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Unfortunately the second query does not work because MySQL will not delete from a table that you are performing joins on in a SELECT sub-query. For example DELETE FROM food_tags WHERE food_id IN ( SELECT foods.id FROM food_tags JOIN foods ON foods.id = food_tags.food_id JOIN tags ON tags.id = food_tags.tag_id WHERE food_id NOT IN ( SELECT MIN(id) FROM foods GROUP BY name ) ) This does not work. Error message: You can't specify target table 'food_tags' for update in FROM clause Also it doesn't alleviate the fact that it has 2 SELECT sub-queries which I'm trying to avoid if at all possible for performance reasons.
  2. @Psycho, Thanks for your quick reply! Your first query does what it says, but not what I need. The issue is that we cannot simply grab all that don't match. We must grab records from the food_tags table that have a specific set of food ids. Otherwise we would be deleting several records for several other foods based on additional criteria from the food_tags table which we do not want to do. It must be a specific set of food ids. Hence the initial SELECT * FROM `food_tags` WHERE `food_id` IN (... Think of it like narrowing down the food ids list rather than simply grabbing all that don't match a specific criteria. However, I believe your second query does in fact grab a specific list of only matching food ids. I will test that out and see if this is the case. In response to your initial question - the goal is the migrate the database schema incrementally to accommodate this.
  3. In short, I have have a table `foods` that has duplicates on occasion. I have another associated table `food_tags` that has tags associated with the foods listed in the `foods` table. **Objective:** I want to retrieve the records from the `food_tags` table for all duplicates found in the `foods` table except for the *first* records in the `foods` table (the records with the lowest `id` value). SQL Fiddle - http://sqlfiddle.com/#!9/ee1c6/2 I have a working example of what I want but I'm almost certain this is not the best way to do it. Here's what I have: SELECT * FROM `food_tags` WHERE `food_id` IN ( SELECT `id` FROM `foods` WHERE `id` NOT IN ( SELECT MIN(`id`) FROM `foods` GROUP BY `name` ) ) Basically I want to exclude the first record of the duplicates in the `foods` table (the one with the lowest `id`), but retrieve all the remaining duplicates and then get the results from the `food_tags` table based on the `food_id` of the duplicates. I'm very curious to see what your ideas are on how to solve this problem and the best way to approach it based on the constraints. **Additional Information:** Ultimately the goal is to delete these records, along with other records in other tables based on the same criteria. I realize that there are ways you can setup the schema or normalize the database to handle duplicate entries and automatic deletions of records from one table based on deletions in another related table. For the sake of the issue, let's assume that these options are not available. Thanks in advance for your time and insight.
  4. Of course you get to plan it, you're the developer! But as soon as your company starts eating the cost of the project just to make sure your code is structured and documented properly and everybody's adhering to the coding standards of the framework, your boss will tell you none of that shit matters anymore, get the project out the door, I don't care how it looks. THE CLIENT WILL PROBABLY NEVER LOOK AT YOUR CODE AND EVEN IF THEY DO, THEY WON'T BE ABLE TO TELL IF IT'S GOOD OR NOT.
  5. Jaguar, you're right, but I was mainly talking about the freelance business environment where YOU are the boss, not a code-monkey drillin out syntax for the man. In any sense though, the purpose of a framework is to make it easier for you to perform all tasks, or easier to collaborate with others when dividing tasks. Popular frameworks are more documented because they HAVE to be (there's a LOT more ground to cover). More thoroughly tested? No. Not if you grab the same code and change it a bit to fit your needs... It's even better, actually. It also doesn't matter if others have zero experience with a totally custom framework... there's a good chance it's easier to use than all the other ones out there, it makes more sense, it's super light-weight, and therefore easier to learn/work with. Nobody starts out with 100% experience in any framework. There is always a learning curve, and I think one of the main goals for most popular frameworks is how EASY they are to get started, learn, and use. If that's the case, then you must see how downloading, installing, configuring, and using a popular framework is always heavier than you'll ever require, and eventually won't be the perfect solution to a project, and you spent so much time trying to learn how to make it be the perfect solution for all projects. Sometimes... you guys gotta write procedural code. And that's why light-weight/custom frameworks are best... they are pluggable in the way that YOU want them to be. Not mandatory to install the whole thing if you want to use ONE cool feature. Strip it down to that one cool feature, and toss it into your own framework. I promise you'll get over your own learning curve a LOT faster than someone else's.
  6. I've used all kinds of web-frameworks with all kinds of different languages over the past 5-6 years. Here's what I've learned... None of them are as good as yours would be if you just wrote your own. It's really ... really not that hard. It'll be for sure at most 1/10th the size of most frameworks. They are so heavy with features you'll never use to their full potential, so it naturally loads 50% more code than you'll ever tap into, which slows down page loading time even for low-traffic sites. By the time you use, test, learn, break, and fix a bunch of frameworks, you can pick and choose the procedures you liked the most out of all of them. Grab different blocks of code from each, maybe even some from snipplr.com, strip them down and rewrite them, and before you know it, you've got a really awesome little framework that works for YOU, and doesn't focus on being so robust and user-friendly it can be used by a total idiot (which is a factor contributing the weight of most frameworks). I have built many websites for many purposes and have taken each opportunity to either test a new software/framework/language, or refine my own php framework. I possess now what I feel is the best possible framework for every type of website. It includes fast and simple methods for database queries, clean urls, templating, user authentication (session, cookie, and database), form error handling and processing (both server-side and client-side), a bunch of jquery features that are pre-templated and simple to integrate... it's really sexy. Besides, there's no use in pursuing the study of frameworks for anything other than creating your own because businesses and developers that take the initiative to really understand the inner-workings of a framework and take pride in their ability to push it to the next level and advertise this service in hopes that it'll help them find a niche market... Well, all they did is get better at something some other team developed... for their purposes... not yours. Not YOUR niche market... So why not take what they did right, and ONLY what they did right, and apply it to your preferred process? I don't know about you but I got into this business for two reasons: to make money and write beautiful code... in that order. Most developers go about it the opposite way and end up the average under-compensated, under-appreciated, under-challenged, and disgruntled techie. And we have all come across the client that (before you) has in the past been swindled into a $12,000 website and it looks like it was built in 19diggitydoo with the most archaic features. Take that as a lesson. The client NEVER knows more about the web than you, so it's really just about your ability to sell a particular process or software that will determine if you'll land the project or not. As far as the client is concerned, it has nothing to do with the process or the software itself, again, because they never know more about their website than you do. They're not going to look at the code. Why would they? They wouldn't know how to interpret it, that's why they hired you in the first place! So work on your own simple, light-weight framework that works for YOU, while most frameworks will tell you "you must abide by our rules... that's how you get the most out of it..." Screw that! Programmers are clever, creative, and innovative, especially when it comes to programming stuff for themselves. So try them all, test them all, pitch them all to your clients or even for yourself. You'll probably like some features, and hate others. In the grander scheme of things, you'll inevitably encounter a project where the framework you've chosen to dedicate yourself to is NOT the best solution. Program your own, pitch your own with confidence, and get rich faster. Cheers
  7. As the title indicates, I'm looking for all the required config variable settings, htaccess conditions and rewrites, etc. Basically, I'm looking for all opinions and examples because I'm almost positive I'll miss something the first time. So far, I've reviewed and slightly understood the validity of the following solutions: http://codeigniter.com/forums/viewthread/86113/ http://stackoverflow.com/questions/1818869/htaccess-https-to-http I'm not sure which applies to me, since several options are available. But the kicker is that it's hosted on a client's GoDaddy shared hosting account, and for some reason, "index.php" in the url doesn't work... it MUST be "index.php?" in the url, otherwise it just brings up a "No input file specified" error. It's BS. Anyway can I get some assistance here? Thanks in advance.
  8. pbs, THAT TOTALLY WORKED! I can see that I had an extra closing parenthesis at the end that was not necessary and the opening parenthesis right after VALUES was also not necessary
  9. I cannot for the life of me figure this out. PhpMyAdmin puts there error somewhere around the word VALUES. INSERT INTO `tasks` ( `id`, `challenge_id`, `title`, `frequency`, `category`, `description` ) VALUES ( ( "", 12, "title1", "frequency1", "category1", "somedesc1" ), ( "", 12, "title2", "frequency2", "category2", "somedesc2" ), ( "", 12, "title3", "frequency3", "category3", "somedesc3" ) ); I have not left out any columns in the query on the table `tasks`. Can anyone else see what i'm doing wrong? I've been banging my head over this for like an hour...
  10. Alright so the problem was not Wordpress, it wasn't .htaccess, it wasn't the subdirectory permissions, it was a centos server thing. If there's nothing inside the directory, it'll automatically bring up a 403 error. As soon as I put a blank index.php file in there, everything was fine.
  11. Hey all, I have a Wordpress installation (inside the root directory) that uses a .htaccess file to have clean urls for posts and pages. It looks like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress However, I want to add a subdirectory inside this wordpress installation so I can add other stuff or another app or whatever I want and still access it. So to verify, wordpress is here: http://www.mydomain.com/, and my subdirectory is here: http://www.mydomain.com/subdir/. However, when I go to my subdirectory in my web-browser I get a 403 error: Forbidden You don't have permission to access /subdir/ on this server. I know that the permissions to this directory are just fine (777 just to be sure) and I still get the same error. How can I write a rule or condition in my .htaccess file that will allow normal use of this directory??
  12. I'm trying to figure out the easiest and best way to have a little bit of javascript functionality. So let's say for example I have a page like this: <div id="copy"></div> <input type="text" name="userinput" /> I would like the div to display the text of whatever the end user is typing in the input field while end user is typing it in real time seamlessly. I'm sure there is no need for a javascript toolkit or framework for this one, but I'm already using jQuery with this project so if you decide to submit a working example using jQuery by all means do. Any help, resources, or advice is welcomed. Thanks!
  13. I found a solution with jQuery here: http://kitchen.net-perspective.com/sf-example-3.html
  14. This is a bit tough to explain without screenshots. I need a div element to stay at the bottom of the user's browser screen as they scroll down the page, but once the div element has reached the bottom of its container element, the inside (footer) div should stop and stay there while allow the user scrolls down to view the rest of the page. Also, if the user is scrolling all the way up, then as soon as the inside (footer) element hits the bottom of the user's browser, it will stay at the bottom of the browser until it reaches the top of its container element, there it will stop and the user can continue to browse toward the top of the page. An example of this can be seen at http://www.mininova.org/ Look to the right at the advertisement. As you scroll down, it follows, then when you get close to the bottom of the page, it stops before you scroll all the way to the bottom. I want the same effect, except I want the element will be horizontal, and in the middle of the page. Can anyone help me with this effect? From the research i've done it looks like it's a combination of relative and fixed positioning.
×
×
  • 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.