Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. Statements need to be terminated with a semi-colon.
  2. http://docs.cpanel.net/twiki/bin/view/ApiDocs/Api2/ApiSubDomain
  3. Your production server should be configured like this already. Just make sure that your input is what you expect like: preg_match_all('#href\="([^"]+q=([^&]+)[^"]+oi=revisions_inline[^"]+)"#miu', $googleRes, $matches); return !empty($matches) && 3 <= sizeof($matches) ? array_map('urldecode', $matches[2]) : array(); IGnace i have Curl on Server.. Another thing, as per my understanding adding this code will keep me from showing any Error message when google HTML Out put Changes.... Right? That's not necessary. See my previous post.
  4. Yes, Google provides an API for their translation services. See this post for an example.
  5. Your production server should be configured like this already. Just make sure that your input is what you expect like: preg_match_all('#href\="([^"]+q=([^&]+)[^"]+oi=revisions_inline[^"]+)"#miu', $googleRes, $matches); return !empty($matches) && 3 <= sizeof($matches) ? array_map('urldecode', $matches[2]) : array(); The additional checks are redundant because $matches[2] will always exist and be an array even if it doesn't find anything. See: $googleRes = 'foo'; preg_match_all('#href\="([^"]+q=([^&]+)[^"]+oi=revisions_inline[^"]+)"#miu', $googleRes, $matches); var_dump($matches); Output: array(3) { [0]=> array(0) { } [1]=> array(0) { } [2]=> array(0) { } }
  6. The problem with using DOM is just that Google doesn't provide valid HTML, so DOMDocument will complain when it parses it. Also, your script doesn't output anything.
  7. Well, if Google changes its output then you just won't get any matches. You shouldn't get any error messages. Still, I tried making it as general as possible. Essentially all it does is that it looks for links that has oi=revisions_inline in it and then it extracts the q (the search query) part. If they for some reason stop doing that, then it won't work.
  8. Well, print_r just prints out an array so you can read it. You can do like this: $related = getRelatedTerms('paintball'); foreach ($related as $term) { // do something }
  9. An example of what?
  10. This should do it (until Google changes their HTML output): <?php function getRelatedTerms($term) { $url = sprintf('http://www.google.com/search?q=%s', urlencode($term)); $userAgent = 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3'; $ch = curl_init($url); curl_setopt_array($ch, array( CURLOPT_RETURNTRANSFER => true, CURLOPT_USERAGENT => $userAgent, )); $googleRes = curl_exec($ch); curl_close($ch); preg_match_all('#href\="([^"]+q=([^&]+)[^"]+oi=revisions_inline[^"]+)"#miu', $googleRes, $matches); return array_map('urldecode', $matches[2]); } print_r(getRelatedTerms('paintball'));
  11. Try downloading some more RAM: http://www.downloadmoreram.com/
  12. Does Kohana send a 500 status code when an application error happens? Is is possible to have your own error page, but still send a 500 response, and that would be the correct thing to do.
  13. Maybe someone installed something like VNC on your computer and is messing with you.
  14. http://www.joelonsoftware.com/articles/Unicode.html
  15. That's just because you're not disciplined enough then. If you skip straight to the answer then it's your own fault if you don't learn from exercises.
  16. I'm not sure how you would choose to actually implement it, but a line in [imath]\mathbb{R}^2[/imath] from (1,1) to (4, would be represented by the following set of points: [math]M = \left\{\left(x,\frac{7}{3}x+1\right)|1\leq x \leq 4\right\}[/math] This set is infinite of course, so when actually drawing the line you would select a discrete amount of points and paint the pixel that is nearest a particular point. For a curve you could use a Bézier curve.
  17. v is a function they do not define, but which they've plotted for varying values of ε (epsilon). c is defined in the image you inserted in your post: [math]c^2 = 2\beta^2+\sigma^2_{winner}+\sigma^2_{loser} \Rightarrow c = \sqrt{2\beta^2+\sigma^2_{winner}+\sigma^2_{loser}}[/math] ε is what they call a "draw margin" and it depends on the game mode. So it's a constant that is set by you. β2 (beta) is "the variance of the performance around the skill of each player" as mentioned in the article. v and w are functions of two variables, so the comma separates the first from the second. Here is another example of a such function: f(x,y) = x+y There is no difference between the square brackets and parentheses here. When you nest parentheses it can sometimes be difficult to read and see where they end, so you might sometimes choose to alternate them.
  18. That makes me want to immigrate The catch is that you pay higher taxes.
  19. When you can tell me at which point you "know PHP", I'll tell you how long time it took me learning it.
  20. That's not true where I live. On the contrary, it's usually the people without an education (or corresponding professional experience) who have difficulty finding a job over here. Getting a degree in something doesn't exclude you from starting your own business. Starting a business is free over here, so are educations. Funny how some people thing that the situation they are in apply to everybody else in the world as well.
  21. Please solve your business with thorpe privately as outlined in the "Disputes" section here: http://www.phpfreaks.com/page/rules-and-terms-of-service
  22. Magic quotes hasn't been removed from anywhere: daniel@daniel-laptop:~/projects/php/php/php-src/trunk$ sapi/cli/php --version; sapi/cli/php -i | grep magic PHP 5.3.99-dev (cli) (built: Apr 21 2010 15:24:13) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2010 Zend Technologies magic_quotes_gpc => On => On magic_quotes_sybase => Off => Off magic_quotes_runtime => Off => Off The fate of magic quotes is undecided, and so is the feature set of PHP 6.
  23. Search this board. The question has been asked before and consequently the answer to why we won't do it is already available.
  24. http://en.wikipedia.org/wiki/Functional_dependency
  25. You are not guaranteed any normalization form just because you've made an E/R-diagram. How do you mean: 1) The person creating the ERD has a limited knowledge of database design and can therefor not create a normalized ERD? 2) or, the person creating the ERD has sufficient knowledge in database design, but due to not using Codd's method ends up with an ERD of which he only thinks is normalized? Neither. I just mean that because you created a diagram of a schema, you aren't ensured that it's normalized. Consider the two E/R-diagrams I've attached (bold outlined attributes are primary keys, I couldn't figure out how to make things underlined using graphviz). In foo.png, we have two functional dependencies on Movies: Title,Year -> Genre,Director Director -> DirectorAddress This violates BCNF (Boyce-Codd Normal Form) because it requires that all left-side terms of non-trivial functional dependencies must be a superkey in that relation. However, Director is not a superkey in the Movies relation. Title,Year is a superkey though, because functional dependencies are transitive. The bar.png diagram shows a normalized version. [attachment deleted by admin]
×
×
  • 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.