Mögliche Alternative zu in_array bei großen Arrays

Published 2006-08-21, 02:03

http://de2.php.net/manual/de/function.in-array.php#60559

[…]

The non technical explanation is before is you had 100 items and it took you 100 microseconds for in_array with 10 000 items it would take you 10 000 microseconds. while with the second one it would still take you 100 microsecond if you have 100 , 10 000 or 1 000 000 ids.

(the 100 microsecond is just a number pulled out of thin air used to compare and not an actual time it may take)

Topic(s): Link, PHP No comments - :(

Es sind die kleinen Dinge…

Published 2006-08-21, 01:39

die ein Forum besser nutzbar machen:

Achtung – während Sie geantwortet haben, ist eine neuer Beitrag geschrieben worden. Sie sollten das Thema erneut lesen.

Gesehen in einem Forum mit SMF.

Topic(s): Link, Notiz 1 single comment - :/

Beliebte mod_rewrite-Fehler

Published 2006-08-19, 18:21

Unter den Rewriteflags werden in der Dokumentation zu mod_rewrite 4 wichtige Punkte angesprochen. Dummerweise werden diese durch die blaue Box nicht etwa hervorgehoben, sondern rücken eher in den Hintergrund.

Dies ist schade, denn würde jeder Webmaster der mit mod_rewrite herumspielt diese Regeln durchlesen, gäbe es viel weniger Missverständnisse und Verwirrung was die Funktionsweise der RewriteRules angeht. Deshalb hier nochmal:

Note: Enabling rewrites in per-directory context

To enable the rewriting engine for per-directory configuration files, you need to set „RewriteEngine On“ in these files and „Options FollowSymLinks“ must be enabled. If your administrator has disabled override of FollowSymLinks for a user’s directory, then you cannot use the rewriting engine. This restriction is needed for security reasons.

Ganz beliebter Fehler Nutzung von mod_rewrite bei Hostern wie Hosteurope.

Note: Pattern matching in per-directory context

Never forget that Pattern is applied to a complete URL in per-server configuration files. However, in per-directory configuration files, the per-directory prefix (which always is the same for a specific directory) is automatically removed for the pattern matching and automatically added after the substitution has been done. This feature is essential for many sorts of rewriting – without this, you would always have to match the parent directory which is not always possible.

There is one exception: If a substitution string starts with „http://“, then the directory prefix will not be added, and an external redirect or proxy throughput (if flag P is used) is forced!

Wenn man das einmal verstanden hat, werden die Regeln viel klarer.

Note: Substitution of Absolute URLs

When you prefix a substitution field with http://thishost[:thisport], mod_rewrite will automatically strip that out. This auto-reduction on URLs with an implicit external redirect is most useful in combination with a mapping-function which generates the hostname part.

Remember: An unconditional external redirect to your own server will not work with the prefix http://thishost because of this feature. To achieve such a self-redirect, you have to use the R-flag.

Das versteh ich ehrlich gesagt selbst nich 😉

Note: Query String

The Pattern will not be matched against the query string. Instead, you must use a RewriteCond with the %{QUERY_STRING} variable. You can, however, create URLs in the substitution string, containing a query string part. Simply use a question mark inside the substitution string, to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine a new query string with an old one, use the [QSA] flag.

Probleme mit Queries gehören nach Verstehen dieses Absatzes zum Glück auch der Vergangenheit an.

Topic(s): Notiz, Technik 2 comments - :)

WordPress-Plugin: Relative Dates for WordPress

Published 2006-08-02, 00:58

Relative Dates is a simple plugin for WordPress that displays the date of your posts as the time elapsed since it was posted (based on the date that the user is viewing the post; i.e., „Posted 2 weeks, 1 day ago“).

http://justinblanton.com/projects/relativedates/

Topic(s): Link, Technik, Wordpress No comments - :(

Fremdes iFrame scrollen

Published 2006-08-01, 23:12

Das muss jetzt niemand verstehen, ich möchte den Gedanken einfach festhalten:

Will man ein iFrame, auf dessen Inhalt man keinen Einfluss hat, zu einem bestimmten Koordinatenpunkt scrollen, kann man das fremde iFrame in ein eigenes iFrame einbetten und dieses scrollen.

Quelle: http://douweosinga.com/projects/googlerandomimage

Topic(s): (X)HTML No comments - :(

Adsense extrem

Published 2006-07-30, 20:04

http://myspace-modz.com/

via Workboxers.com

Tools für reguläre Ausdrücke: The Regulator & Regulazy

Published 2006-07-28, 08:46

Keiner mag reguläre Ausdrücke. Deshalb gibt es auch so viele toole Tools, die helfen sollen sie zu verstehen, visualisieren oder zu erstellen. The Regex Coach von Edi Weitz nutze ich schon eine Zeit lang. 2 weitere sind mir gerade über den Weg gelaufen:

  1. The Regulator

    The Regulator is an advanced, free regular expressions testing and learning tool written by Roy Osherove. It allows you to build and verify a regular expression against any text input, file or web, and displays matching, splitting or replacement results within an easy to understand, hierarchical tree.

  2. Regulazy

    Regulazy is a visual Regex Creation tool for beginners. Easy point and click user interfaces, predictive technology and much more! Still in alpha, but more features are coming!

Beide sind übrigens von Roy Osherove und werden in nächster Zeit mal bei mir getestet.

Topic(s): Link, Notiz, PHP, Technik No comments - :(

Adwords: Tuzhilin-Report / Klickbetrug

Published 2006-07-27, 00:00

Mal zur Abwechslung etwas interessantes und unerwartetes aus dem Google-Universum:

Findings on invalid clicks

As part of the settlement in the click-fraud case Lane’s Gifts v. Google, we agreed with the plaintiffs to have an independent expert examine our detection methods, policies, practices, and procedures and make a determination of whether or not we had implemented reasonable measures to protect all of our advertisers. The result of that is a 47-page report, written by Dr. Alexander Tuzhilin, Professor of Information Systems at NYU.

Hier der direkte Downloadlink: http://googleblog.blogspot.com/pdf/Tuzhilin_Report.pdf

Insgesamt keine großen Überraschungen, wer mit Adwords und/oder Adsense zu tun hat findet aber vielleicht noch einige interessante Informationen. Dabei ist jedoch zu beachten, dass die Informationen nicht direkt von Google stammen, sondern von einem dritten zusammengetragen wurden. Einige Absätze möchte ich aber hervorheben bzw. einfach zur späteren Referenz hier zitieren:

Seite 9, vorletzter Absatz:

The top-of-the-page placement rank is also determined by the above Ad Rank formula; however, the value of the QualityScore for the top-of-the-page placement is computed somewhat differently than for the side ads.

Der QualityScore für die Adwords-Anzeigen über den Suchergebnissen wird also anders berechnet als für normale Anzeigen. Weitere Informationen gibt es nicht dazu.

Seite 36:

9.3.2 Auto-Termination System for AdSense Publishers

Initially, all the terminations of the AdSense publishers for inappropriate behavior were done manually. Currently, it is a mixture of manual and automated terminations, with the auto-termination rates growing steadily.

Auto-Termination System is an automated offline system for detecting the AdSense publishers who are engaged in inappropriate behavior violating the Terms and Conditions of the AdSense program. It examines online behavior of various publishers and either immediately terminates or warns the publishers who are engaged in the activities that the system finds to be inappropriate.

More specifically, the Click Quality team has developed a set of conditions indicative of a strong possibility of inappropriate behavior of the publishers. If certain combinations of these conditions hold, the Auto-termination system would take one of the following actions depending on the severity of these conditions:

  • Automatically terminate the publisher if the violating conditions are really severe;
  • Automatically warn the publisher if the violating conditions are indicative of inappropriate activities but are not as severe as in the previous case. This warning happens when certain “flags are raised,” but not enough hard evidence is accumulated to be certain that the publisher is engaged in inappropriate activities. As a part of the warning, Google requests the publisher to disengage from these activities and gives a grace period to the publisher. If these inappropriate activities do not stop within a certain time period, the publisher is terminated by the autotermination system.
  • Request for a Manual Inspection: Pass the publisher’s case for a manual inspection by the team of Google’s investigators in case the auto-termination system does not have strong evidence to terminate or even warn the publisher. This request is placed in the inspection queue and is subsequently retrieved and inspected by one of the Click Quality investigators using the inspection tools described in Section 9.4.

The decision to terminate, warn or manually inspect the publisher is based on a set of various conditions pertaining to publisher’s behavior that were developed by Google’s Click Quality team based on their extensive prior experiences in dealing with the AdSense publishers.

The first prototype of the auto-termination system was built in the early 2005 and the system was launched in the summer 2005. Recently, Google has developed major enhancements to the current version of the auto-termination system deploying an alternative set of technologies.

Dies erklärt die teilweise unerwarteten Warnmails, die einige Adsense-Publisher bekommen haben.

Seite 39:

Detection of duplicate publishers: Google has a system that detects multiple publishing accounts opened by the same person or an entity. Such cases are manually inspected after detection.

[…]

Duplicate accounts, i.e., whether a particular individual or an entity has duplicate publishing accounts or had a previously terminated publishing account(s) with Google.

Seite 40:

When a publisher is terminated, all the clicks (valid and invalid) from the terminated publisher within a certain time period are credited back to the affected advertisers.

Worauf sich „a certain time“ bezieht, wird natürlich nicht geklärt.

PHP: Zeilennummer ausgeben mit __LINE__

Published 2006-07-21, 13:08

Ach, da code ich nun seit x Jahren mit PHP durch die Gegend und bin nie auf die Idee gekommen, mal zu schauen, ob denn die Zeilennummer, die gerade ausgeführt wird, ausgeben werden kann.

Heute hatte ich dann endlich diese Idee: http://de.php.net/constants.predefined

Das hat man nun vom „Learning by Doing“…

Topic(s): PHP, Technik 2 comments - :)

Cursor vs. Cursor mit Haken

Published 2006-07-20, 00:52

Mir nun schon mehrmals aufgefallen, und ich muss peinlicherweise zugeben, dass ich keine Ahnung habe, was den Unterschied zwischen diesen beiden Text-Cursorn ausmacht:

Cursor vs Cursor mit Haken

Der zweitere mit Haken taucht hin und wieder auch in meiner Firefox-Adressleiste auf, allerdings ohne erkennbaren oder nachvollziehbaren Grund.

Kennt jemand den Unterschied zwischen diesen beiden Cursorn?

Topic(s): Kram, Technik 8 comments - :)

16 queries. 0,118 seconds.