Jump to content

Neomech

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Neomech's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm in an odd situation where I need to figure out if anything "new" has shown up in the first 100 results of several different Google searches. I obviously want to avoid having to do this manually, but I'm not sure how to go about doing what I want to do. Can someone suggest a good approach for automatically comparing the results of a Google search done on Day X with the same search done on Day Y, and being alerted if there's been a change within the first Z results? I'm not looking for any code, just the general approach one might take. Thanks!
  2. Hi there. I have a feeling this is a simple problem, but I can’t figure it out. I'm using CodeIgniter and making use of the MVC concept. One of the things that I do is create dynamic javascript in some of my views. I know how to pass php variables to the view from my controller and use them to create the javascript I want on the page. What I am trying to do is pass the variables to an external javascript file. I like to keep all my javascript code in external files (and that seems to be widely encouraged). I know how to use a dynamic external .js file using the .php extension, and I can run php code in the external javascript file just fine. What I DON’T know how to do is to pass php variables from my controller that will somehow make their way into the external javascript files. I realize I could call the external javascript files with a querystring that I could set dynamically, but what if I want to pass in an array, or a simplexml object or something. I tried using global variables and didn’t seem to get anywhere with that. Does anyone know how to do what I’m attempting? Is it even possible?
  3. Hi, I'm doing some fun things with filters on my site, and I'm trying to use preg_replace to remove a filter from the url when it gets reset in my filter form. Ignoring whether or not I'm going about any of this the right way, I have a strange problem with using preg_replace that I'd like to figure out. I have a string of text like so: "filter1__is__attribute1__and__filter2__is__attribute2__and__filter3__is__attribute3" I'm using preg_replace to remove one of these filters and it's attribute if I find it in the string. The code looks like this: $new_string=preg_replace('/(??:|__and__)(filter__is__.*?__and__))|(?(?:|__and__)filter__is__.*?(?:\/|\z))(?!__and__))/','',$old_string); (I'm replacing the word filter in the above with either filter1, filter2 or filter3 depending on which one I'm trying to replace.) The above code works fine if the filter is at the start or end (filter1 or filter3), but filter2 is borked, because the preg_replace is replacing the "overall" match rather than the specific match, which in that instance is different. In other words, in the filter1 and filter3 position, the "overall" match ($match[0]) is the same as either $match[1] or $match[2], respectively, so preg_replace works fine. In the filter2 position, $match[0] is capturing "__and__filter2__is__attribute2__and__" while the value for $match[1] is "filter2__is__attribute2__and__". Since preg_replace is replacing $match[0] (and therefore replacing that leading "__and__" that I don't want to replace), it messes up my url. I got around this by using a preg_match and then two str_replaces, but I just think I'm doing something wrong in my regular expression, and was wondering if anyone could spot the error easily. Alternatively, if there's a way to use preg_replace to only replace $match[1] or $match[2], but not $match[0], that would help as well. Thanks! p.s. sorry if this is confusing...I've never asked a regex question before and am having difficulty describing it fully without being overly wordy.
  4. Okay, I think I have my head wrapped around it a little better now. Thanks for all the feedback
  5. Yeah, I was aware that web pages were parsed before they got to the client, I just didn't realize that other things (like a javascript file) get parsed as well. I'm realizing I wasn't really looking at the whole process properly before, and had this daft notion of a "page" that was distinct from a "file". An html page with php in it and a javascript file are both "files" that the browser is accessing via the http protocol, and php is running in the background on the server making sure ANY file accessed over that protocol gets parsed by the php engine first. Is that basically correct?
  6. Ahh...okay. You're right. I seem to be missing something basic then. Why is that? Is PHP parsing every file sent to the client automatically? I guess it is! For some reason I thought when I was inspecting external .js files I was, I don't know, getting them "differently" somehow (more similar to FTP). Okay, thought that might be a dumb question.....thanks!
  7. I'm not sure where to post this question, but I've been reading about using PHP to add some dynamic content to my .js files (and renaming them as .php files), which is something that I could make good use of. I'm planning to do something like described here: http://www.javascriptkit.com/javatutors/externalphp.shtml. However, my concern is that I'll then have to place this .php file in a directory below my public html directory (where I'd normally have the .js file), which would then be accessible by a user who knew what they were doing. I read somewhere that the php in such an approach isn't visible to the end-user, but I don't understand why. Isn't it just a .php file that's sitting there in an exposed directory? I understand that it gets converted to pure javascript when it's being referenced from the html page by the client's browser, but don't I still have php code sitting there in an accessible file that anyone can look at? I guess my main question is: Is there a way to dynamically generate an external .js file that's "safe" (no PHP can be seen by nosey people)? Thanks!
  8. Yeah, I'm concerned with the speed of this approach. I gather if I was using MyISAM tables I could get some headway out of a FullText search, but I'm using InnoDB so that's not an option (and my understanding is that FullText starts to get too slow eventually). I have too many distinct attributes for given product types to go with a single table, in my opinion. There would be a TON of empty fields for each product. This would obviously be easier, but I need a single search that works for the whole site. That's not something I can change at the UI level. I'm actually not sure what you're suggesting here. Could you elaborate?
  9. Hi all, I'm new to MySQL, but I'm fairly comfortable with relational database structure. I know how to use inner joins, search multiple columns, etc. My problem is that I'm creating a site with a fairly large database with many tables representing many different types of products (e.g. digital cameras, refrigerators, etc.). I am intending to use a table for each major product type rather than an Entity-Attribute-Value model, primarily because I've read so much about potential pitfalls with the EAV model. I'm using InnoDB tables because I'm concerned about referential integrity. I want to be able to have a single "search" box on the site that will allow a user to search through the entire product catalogue, and I don't know the best way to go about it. I assume doing a huge number of joins and searching through multiple columns on multiple tables is NOT the best way to go, but I don't know what the best alternative is. I've tried very hard to find something about this online, and am surprised I haven't been able to do so, as this would seem to be a fairly common issue (perhaps I'm using the wrong search criteria!) In short, I need a way to search all of my product tables and return a correct result whether someone types "10x zoom camera" or "refrigerator with ice maker". This sort of thing has the added difficulty in that the "cameras" table wouldn't normally have an entry of "10x zoom" but would instead have a field of Zoom_Length with an integer type. By the same token, the "refrigerator" table would have a boolean field of Has_IceMaker. I'm considering one of the following options, but don't know which is best, or if there's some other, easier method I'm just not considering: 1. Add a keywords column to each table and have a trigger populate the keywords whenever an item is added/updated. Then any search will search every table's keywords column. 2. Add a single keywords table that somehow stores which product table and item relate to certain keywords. 3. Use something like Sphinx or Lucene to create an index of my tables, although I'm not sure if they'll really do what I'm trying to accomplish here (particularly with the "10x zoom" problem identified above). 4. Use something like Sphider to actually search all my product pages and create an index of those, then work backwords from the URL returned by a search query to grab the appropriate products from the database (if that makes sense). Any help would be greatly appreciated. Thanks!
  10. You won't get an easy answer because you are designing your database in the wrong way (sorry, don't know a nicer way to put that). If you have 300 different schools, you should be using ONE table for all of your data about the schools. You differentiate between the different schools within that one table by having a column called "SchoolID" or something like that. I'm not sure if that's enough information to get you sorted out, but you definitely do NOT want to have 300 different tables because there are 300 different schools. You're missing a key element of database design there. Good luck!
  11. Hi, I'm kind of new to eclipse and pdt, so this may be a dumb question, but when I create a new php project in eclipse it creates bin, src and resources directories. However, I would like to customize the names of these directories and have some additional directories created upon starting a new project. Is what I'm trying to do possible, or do I just have to manually make such changes whenever I create a new project? I'm using Eclipse 3.4 and PDT 2.0, for what it's worth. Thanks!
  12. Hi, I'm totally new at PHP and MySQL, but I've got a fair bit of experience with MS SQL2005. My question relates to the different database types, particularly MyISAM and InnoDB. My very general understanding is that MyISAM is not "strict" (no foreign keys) but has a very fast "count" ability, whereas InnoDB is the opposite (more similar to PostgreSQL). Is that correct or am I off my rocker? I am used to using foreign keys, and appreciate them from a database design perspective, however I'm also looking for a database that will be pretty quick at delivering a count back to me. Any recommendations? If you want to push Postgre as an alternative, I'm not totally sold on MySQL, although I tend to think given how widely it's used I'll find an easier time getting help as I learn a new system. Thanks in advance for any replies
  13. Okay, well thanks for all the feedback! I was kinda hoping I'd get a couple of suggestions for where else to look if I ever couldn't find something here, but it sounds like that may never happen! Still, anyone have any "second" favorite forum sites they use? (distant seconds okay!)
  14. Okay, so I'm just getting into PHP and MySQL from a life of .net and SQL2005. I found this site, and am loving it. I was just wondering what some other popular forum sites were that people use for resources. I've been to MySQL.com, devshed and phpBuilder.com, but I was wondering if I'm missing any good ones, or if anyone had a favorite they could list (including phpfreaks.com, of course!) Thanks!
×
×
  • 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.