-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
There are a lot of tools out there that do this already, but I guess it depends on what you are wanting to do whether or not they'd be useful. For example I normally use Xenu (free) for basic crawling. My company purchased a license for Wasp which is a bit more robust but cost monies. But if you are looking to write your own tool, I agree with requinix: using regex to scrape pages for links is not advisable, since regex is not designed to parse html. Basically you would need to: start with the "seed" URL (usually like http://www.yoursite.com/) Use cURL (this is harder to implement, but more advisable, since you can take advantage of cURL's multi-threading. Here is a nice class for multi-threaded cURLing) or file_get_contents (easier to implement, but not advisable, since you can't multi-thread) to get the contents of the URL. Use something like DOM or simplehtmldom to pull all links from the page and store them in an array NOTE: neither method will allow you to get client-side dynamically generated links! There really isn't much you can do about that except get all complicated about it..basically you'd have to setup your server to basically request the script through a "browser" program that will execute javascript and get the links that way. [*]Then basically the overall "loop" would be to repeat the first 2 bullet points until there are no more links in the array.
-
this won't really work, there's potential for collision. Since you are multiplying by random and then substringing...throwing time() into the mix is pretty useless...
-
If it must be an integer, then I would go with Jesirose's suggestion to just make it sequential. If you can let it be alphanumeric, an easy way would be to dechex(time()) If this still doesn't work for you, the next reliable method would be to just generate a random integer and look up in your db if it already exists. Wrap it in a while loop until one is generated that doesn't exist. This could conceivably become an issue when you start to have lots of numbers to lookup against, but that's something you're gonna have to live with, given your current restrictions.
-
Need help with: Property '$' of object [object Window] is not a function
.josh replied to LLLLLLL's topic in Javascript Help
why don't you just upgrade to the latest jQuery and use only one instance of it? -
So it sounds/looks basically like what most IDE "auto-complete" features do. Not sayin' it's a bad idea, just saying it seems more like reinventing the wheel, not really seeing anything new or different from this. IOW between auto-completes from site search boxes or IDEs...this is kinda already covered... Also, it's only really useful as a quick guide for people who already know what they are looking for but fail at remembering details like argument orders. If someone knows there is probably a function out there that does what they want but can't quite describe it, they are likely going to be entering into a search bar a description of what they are trying to do. That makes the rest of the search results returned more useful. sidenote: I like auto-complete suggestion dropdowns for search boxes but fuck all i fucking HATE code auto-completers... I know a lot of people like it, especially since the "popups" do usually show syntax and descriptions etc.. but for me...it ends up hurting more than helping. Like for instance I use html-kit and I can't tell you how many times I've gone to make an opening php tag only to have html-kit decide I wanted an html p tag. /me shakes angry fist at auto-complete.
-
Perhaps you should better illustrate/explain what your idea is, because I still fall back to my original statement in that it sounds like a regular site-search input field to me? Virtually every online doc has a search box somewhere...you enter in a function name and it lists results. Usually the actual manual entry is the first result returned if the user spelled it right and all that... so I'm not really sure what more you're bringing to the table here...
-
I don't understand why you would need to write the formatter in both php AND js to begin with? Whether you decide to do it with php (good idea) or js (bad idea), you should only be having to do it once...can you explain why you think you would need to do it in both places? Anyways, using js to format your data is a bad idea, and it will most certainly hurt your SEO efforts, for all the reasons already given.
-
Also, I disagree with your statement about how php doc can be better...how much experience do you have sorting through manuals? php is by miles one of the most well organized, clear, easily navigated documents out there, complete with useful examples and tons of useful comments in the entries, even before they implemented a rating system. It is second to none..
-
Maybe i'm missing something, but it sounds to me like you are just wanting to make a standard site search box?
-
You need to have a condition to check if the form was submitted. You can check with $_POST['textFieldNameHere']. If it exists, call your function, passing the value of the posted variable, and echo the results. Then after that (outside of the condition), you need to echo out the html code for the form with the input field (and a name attribute matching what your condition looks for), and submit button. The form method should be POST and the action should be left blank, or else the URL of the script.
-
See my previous post listing the reasons you may still not see it... the bottom line is that these functions are not part of the standard js specification, and even if they are built into a browser, different browsers may or may not block it, or certain things within it. Add something else in your function like a simple console.log("goobye!"). Open up your javascript console in Chrome. Refresh the page. You will see that your goodbye function is being called. You will see that the console.log call works. And you will see a message in the console telling you that Chrome specifically blocked the alert call. There isn't really anything you can do about this stuff. The bottom line is that when it comes to performing an action before the page is unloaded, there is no reliable cross-browser method. And even for what does work, it is limited, because people do not like it when sites do stupid things like popup "are you sure you want to leave?" messages and the like. Even if you have legitimate operations to perform before a visitor leaves (eg: deleting a logged in session cookie, etc..), the "annoying popup" sites kinda ruined it for everybody. So basically what I'm advising here is to just forget about coding something for the unload event. There are other ways to go about whatever it is you need to do, and if what you "need to do" is display some annoying "don't leave!" message, absolutely nobody likes that sort of thing, and it's a guaranteed way to make sure people never return to your site.
-
hmm okay, well here are some possible reasons it's not working: - you are using a browser that doesn't have .onunload (it is not a standard) - I noticed specifically that the function is being called on unload, but alert is being blocked in my current version of FF and Chrome. You could try using .onbeforeunload instead... window.onbeforeunload = goodbye;
-
So you tried changing this: window.onunload = goodbye(); to this? window.onunload = goodbye; notice the lack of () after the goodbye. p.s. - my username is .josh and the "advanced member's" username is nogray. Our usernames are in the light blue header of each post, same as where it shows your name!
-
so are you saying you get that "Thank you for visiting. come back soon!" message when your page first loads?
-
preg_quote escapes all characters in your string that mean something special to the regex engine. The dot is escaped because it is a meta character that matches (almost) any one character. Since you want to match for a literal dot instead of any character, it is escaped. So in other words, it is working as intended. p.s. - If you had read the manual entry for preg_quote, you would have seen this right there at the top. In case you didn't know, php.net has a nifty shortcut to their functions, just go to www.php.net/functionNameHere
-
Likely your problem is with your server-side code; at face value I don't see anything wrong with the js. If you posted your server-side code on pastebin, the link is invalid, so I cannot see it.
-
According to the documentation, it will remove the target element and all elements within it, including any events bound to it. As always, the best way to find out if it works for you is to try it out.
-
3.3m USD to build a website: what are your thoughts?
.josh replied to peppericious's topic in Miscellaneous
$100/hr is pretty damn cheap for an agency to be charging...I doubt many do, except for possibly a super small company of like 5 people... I would expect an enterprise level agency to be charging more like $250-$300/hr minimum. I don't really get involved in the money end of things at my job but I've seen a few SOWs of ours and from 3rd party agencies for clients we've worked together with, and that's what I've seen... -
3.3m USD to build a website: what are your thoughts?
.josh replied to peppericious's topic in Miscellaneous
I'm guessing you probably have little or no experience trying to do projects for big companies or governments. There is a lot more cost associated to doing a project than the actual coding of the website. I have done plenty of projects with big company clients where we easily burn through 100 hours just talking about and planning and getting approval for shit...and when it came down to actually coding something..barely a handful of hours of actual coding. Spending (and charging for) 20 hours worth of < 1 hour worth of "coding" is not uncommon in the business world. -
list three websites in this like - "or" operator
.josh replied to toolman's topic in Javascript Help
You need to make a nested loop. The outer loop would loop through links, and the inner loop would loop through your newWin array. Also, this is wrong: if (links[i].getAttribute("href") == 'newWin') { you are comparing the href value to the literal string 'newWin'. You want to compare it to newWin[ii] where ii is the counter for the inner loop (which you don't currently have). But also, this would be an exact match. You would actually want to either do a substring match or else first pull out the domain part of the href. But even then, your newWin values don't have any subdomains listed, so you will need to add them in if you want to stick with exact matches... Also, supposing all that is sorted out, FYI, you are overwriting the onclick attribute w/ that new function. So if anything else is already hooked to it, you are overwriting it. Also, are you using a framework like jQuery? This whole thing would be a lot easier if you were... Also, it would help if you explained what you are actually trying to accomplish when you find matches.. -
Okay well I can't give you any specific insight without knowledge of the tracking script. But are you looking to suppress the code from executing and reporting data, or are you looking to have the data routed to a different "account"?
-
I think perhaps you may want to try using getimagesize instead.
-
read the manual entry for imagesx and imagesy. It requires an image resource, not some arbitrary filename (string).
-
well at face value, you can do this: preg_match("~<td style='font-weight:bold'>(.*?)</td>~s",$file_string,$price); $price = trim($price[1]); But that will 1) require an exact match of that td tag, 2) seeing as how that td tag is pretty generic.. it's possible that there may be other td tags like that on your page and it may match that instead...
-
Does this by chance have to do with a tracking script such as Google Analytics or Omniture SiteCatalyst? I only ask because whenever I see a question like this, it is almost always about tracking code, and making it not pop on dev/qa sites. If by chance this is what it is about, you should know that most tracking tools have solutions for dealing with this. I can go into more detail if that is what this is about.