Wednesday, February 06, 2008

Jonathan Snook:How I built an effective blog comment spam blocker

Arrol ir, hogy egy pontrendszer segitsegevel szuri ki a spameket a comment-ek kozul.

A lenyeg:

For everything in a comment that I like, you get a point. For everything I don’t like, you lose a point (or two, or three). If you get a 1 or higher, you’ve made it on the site as a valid comment. If you get a 0, it’s set for moderation and I’ll take a look at it. If it’s below 0, it’s marked as spam and I’ll never see it (although I check every couple weeks just in case a legitimate comment needs to be unflagged). If it falls below -10, I don’t even bother saving it to the database since it is so obviously spam.

Pontokat meg ezekre ad:

How many links are in the body More than 2 -1 point per link
Less than 2 +2 points
How long is the body More than 20 characters and there’s no links + 2 points
Less than 20 characters -1 point
Number of previous comments from email Approved comments +1 point per
Marked as spam -1 point per
Keyword search Levitra, viagra, casino, etc. -1 point per
URLs that have certain words or characters in them .html, .info, ?, & or free -1 point per
URLs that have certain TLDs .de, .pl, or .cn (sorry guys) -1 point
URL length More than 30 characters -1 point
Body starts with… Interesting, Sorry, Nice or Cool. -10 points
Author name has http:// in it -2 points per
Body used in previous comment
-1 point per
Random character match 5 consonants -1 point per

Wednesday, January 09, 2008

Scott Mitchell: Two Common Pitfalls When Submitting a Web Form Using the Enter Key

Itt van az egesz, de ami a lenyeg:

A regular button has a type attribute value of “button”. By default, the ASP.NET Button Web control renders a submit button.

Multiple Submit Buttons on the Page
…when a user hits Enter in a single-line textbox, the browser submits the form. In most situations, the browser includes the submit button’s name/value pair in the form fields returned on submission (although this is not always the case, as we’ll see later on in this article). If there are multiple submit buttons on the form, the browser sends the first submit button’s name/value pair on form submission (the first one being the one that first appears in the rendered HTML markup, not necessarily the one that appears visually first on the page).

Imagine that you have a page that collects user input and everything works fine. The user can hit Enter to submit the form, which causes the browser to send the submit button’s name/value pair, which executes the corresponding Button’s Click event handler, where you process the user’s entered data. Great. But what would happen if you (or a coworker) updated the site’s master page and included an ASP.NET Button control that, when clicked, would, say, Response.Redirect the user to a Login page? With this change, if a user visited your form and hit Enter to submit it, the browser would send the Login submit button’s name/value pair, and the user would be redirected to the login page!

The net result is that the Login Button’s Click event is raised on postback, and the user is sent to the Login page. Talk about a confusing user experience! Everything works fine if they click the “Submit Form” button, but if they hit Enter, they are redirected to the Login page.

To fix this, we need to instruct the Login Button control that it should not render as a submit button, but rather a regular button. To accomplish this, set the Login Button’s UseSubmitBehavior property to False. This causes the Login button to render as a regular button along with the necessary JavaScript to submit the form when the button is clicked (along with sending additional information so that ASP.NET knows that that button was what caused the postback so that its Click event handler can be raised).

Using Enter to Submit a Form with Only One Single-Line TextBox
Another gotcha involving submitting forms with the Enter key arises with Internet Explorer and forms with just one single-line TextBox. Earlier I said that when hitting Enter in a single-line textbox, the browser submits the form and (usually) includes the first submit button’s name/value pair in the form submission information. Unfortunately, this is not the case when using Internet Explorer and a Web Form with just one single-line TextBox. A more thorough description of this problem is documented in an earlier article of mine, Enter and the Button Click Event.

In short, the workaround is to never create a Web Form with just one single-line TextBox. If your form only requires one single-line TextBox, then add another one but use Casecading Stylesheets (CSS) to hide it…Yes, it’s a hack, but it works.

Monday, January 07, 2008

Kalid Azad: An Intuitive Guide To Exponential Functions & E

Latvanyos magyarazat ezekkel a celokkal:
  • Explain why e is important: It’s a fundamental constant, like pi, that shows up in growth rates.
  • Give an intuitive explanation: e lets you see the impact of any growth rate.
  • Show how it’s used: e^x lets you predict the impact of any growth rate and time period.
  • Get you hungry for more: In the upcoming articles, I’ll dive into other properties of e.

Wednesday, November 28, 2007

arguments array a javascript fv-ekben

Ahogy Michael Kuehl irja:

The arguments array is a special array that gets set when you enter a function call in javascript. The only thing special about it, though, is that it holds all the arguments that the function was called with - other than that it acts like a normal array.

Also, the arguments array is not read only. This means that you can alter its contents, or even clear the array itself.

And if you modify the arguments array itself (i.e, in this case set it to null), you loose the ability to access the arguments through the arguments array, but it doesn’t affect any of the actual variables.

WebDAV

WebDAV stands for “Web-based Distributed Authoring and Versioning”. It is a set of extensions to the HTTP protocol which allows users to collaboratively edit and manage files on remote web servers.

Wednesday, November 21, 2007

Chris Knowlton: Bit Rate Throttling Configuration Walkthrough

The Internet Information Services 7.0 (IIS7) Media Pack – Bit Rate Throttling module provides the ability to throttle progressive downloads of media files (in which audio/video playback starts as soon as sufficient data has been buffered on the client) based on the content bit rate. For sites that deliver audio and video files that may not be watched in their entirety, this module could significantly reduce your media-related bandwidth costs. A secondary feature of the Bit Rate Throttling Module is that it can also be used to throttle non-media (”Data”) file types at specified bit rates

Tuesday, October 09, 2007

ADsafe

ADsafe defines a subset of JavaScript that is powerful enough to allow an ad to perform valuable interactions, while at the same time preventing malicious or accidental damage or intrusion by the ad.

Wednesday, September 26, 2007

Datalength - NText, Text, Image mezok hosszanak lekerkdezesere

Itt irjak, hogy ha NText, Text vagy Image mezok hosszat szeretnenk megtudni arra nem fog mukodni a LEN() fv, de a DATALENGTH() mar igen.

Thursday, August 16, 2007

7-es elotti IE-nel problemat okozhat a HEAD-hez uj elem hozzaadasa, ha van mar beolvasott BASE tag

A korabban itt es itt emlegetett dinamikus javascript betoltessel kapcsolatban Shaun Inman belefuott egy problemaba IE-nel (7-esnel regebbi):

Ran into a JavaScript problem with everybody’s favorite browser recently. Manipulating the head element from within (say by adding additional script or link elements before the page loads) was resulting in an enormously helpful “Operation Aborted” error message in versions of Internet Explorer prior to 7. Of course, like all things IE, this error’s appearance was inconsistent.

I was eventually able to track the problem down to the presence of a base tag. It didn’t matter if it was an open <base> or a self-closing <base />, if it came before the <script> that was manipulating the head, then IE stopped everything and issued the error. (At this point in script execution document.getElementsByTagName('head')[0] is a valid HTML element so testing for its availability before attempting to appendChild() doesn’t avoid the error. try/catch() is also of no assistance.)

Sunday, August 05, 2007

K. Scott Allen: What ASP.NET Developers Should Know About JavaScript

Itt van az egesz.

Az erdekesebb pontok a vegefele vannak:

  • Object Prototypes
  • how to add private members to a JavaScript object
  • we can “simulate” namespace using objects

Henri Sivonen: HOWTO Avoid Being Called a Bozo When Producing XML

Itt van az egesz, de a az elejet es a tartalomjegyzeket be is masolom:

Note about the scope of this document: This document focuses on the Unicode layer, the XML 1.0 layer and the Namespaces in XML layer. Getting higher layers like XHTML and Atom right are outside the scope of this document. Also, anything served as text/html is outside the scope of this document, alhough the methods described here can be applied to producing HTML. In fact, doing so is even a good idea.

Contents

  1. Don’t think of XML as a text format
  2. Don’t use text-based templates
  3. Don’t print
  4. Use an isolated serializer
  5. Use a tree or a stack (or an XML parser)
  6. Don’t try to manage namespace declarations manually
  7. Use unescaped Unicode strings in memory
  8. Use UTF-8 (or UTF-16) for output
  9. Use NFC
  10. Don’t expect software to look inside comments
  11. Don’t rely on external entities on the Web
  12. Don’t bother with CDATA sections
  13. Don’t bother with escaping non-ASCII
  14. Avoid adding pretty-printing white space in character data
  15. Don’t use text/xml
  16. Use XML 1.0
  17. Test with astral characters
  18. Test with forbidden control characters
  19. Test with broken UTF-*

Henri Sivonen: Activating the Right Layout Mode Using the Doctype Declaration

Itt van az egesz, de par dolgot bemasolok:

In order to deal with both old tag soup written to old browser quirks and new CSS-compliant pages, Firefox (and other Mozilla Gecko-based browsers), Safari, Opera (7 and later), Internet Explorer 6 and 7, Mac IE 5, and Konqueror (3.2 and later) have two main layout modes. In one mode the layout engine attempts to render conforming pages according the CSS specifications. In the other mode the layout engine tries to mimic old browsers. In Firefox these modes are known as “the Standards mode” and “the Quirks mode” respectively. In this document the same names are used also when referring to the modes of the other browsers.

Background

The bugs and non-standard behaviors of old browsers such as Netscape Navigator 4.x and IE 5 for Windows are called “quirks”. For example, not inheriting styles into tables is a quirk. Sometimes pages have been authored in such a way that their layout depends on quirks.

Most quirks are related to layout and, hence, are in conflict with CSS. Rendering quirky pages according to CSS would make them look different from what the author most likely intended. On the other hand, being able to use CSS as specified is a big win compared to writing for old quirks forever.

Layout Modes

To address the conflicting goals of backwards compatibility and CSS conformance, contemporary browsers have two or three layout modes.

Quirks Mode

In the Quirks mode the browsers violate CSS specifications in order to achieve backwards compatible layout. Different browsers implement different quirks. Therefore, “Quirks mode” is not a single target. For example, Mozilla focused on imitating Netscape 4.x initially. Windows IE 6 and 7, on the other hand, are focused on imitating Windows IE 5.

The point of the Quirks mode is avoiding “breaking” old pages. If you are authoring new pages now, you are supposed to comply with the relevant specifications (CSS 2.1 in particular) and target the Standards mode.

Standards Mode

In the Standards mode the browsers try to give conforming documents the specification-wise correct treatment to the extent implemented in a particular browser.

Almost Standards Mode

Firefox, Safari and Opera 7.5 (and later) also have a third mode known as “the Almost Standards mode”, which implements the vertical sizing of table cells traditionally and not rigorously according to the CSS2 specification. Mac IE 5, Windows IE 6 and 7, Opera prior to 7.5 and Konqueror do not need an Almost Standards mode, because they don’t implement the vertical sizing of table cells rigorously according to the CSS2 specification in their respective Standards modes anyway. In fact, their Standards modes are closer to Mozilla’s Almost Standards mode than to Mozilla’s Standards mode. It is important to remember that even though the various browsers have conceptually similar modes, the corresponding modes of the different browsers are not identical.

Firefox, Safari, Opera (7 and later), Windows IE 6 and 7, Mac IE 5 and Konqueror (3.2 and later) all use doctype sniffing in order to decide the layout mode for text/html documents. This means that the mode is picked based on the document type declaration (or the lack thereof) at the beginning of an HTML document. (Documents served using an XML content type always get the Standards mode.)

Szinten itt talalhato egy tablazat is arrol, hogy melyik browser melyik doctype-ot hogyan rendereli.

++++

Anne van Kesteren pedig keszitett egy tablazatot arrol, hogy a browserek hogyan impelementaljak a clientHeight, offsetHeight es scrollHeight-ot a body es html tagen quirks es standards mode-ban.

Friday, July 27, 2007

above the fold (above the scroll, above the crease)

“Above the fold” is a graphic design concept that refers to the location of an important news story or a visually appealing photograph on the upper half of the front page of a newspaper. Most papers are delivered and displayed to customers folded up, meaning that only the top half of the front page is visible. Thus, an item that is “above the fold” may be one that the editors feel will entice people to buy the paper. Alternatively, it reflects a decision, on the part of the editors, that the article is one of the day’s most important.

The term can be used more generally to refer to anything that is prominently displayed.

Above the scroll, a concept in web design referring to location of an item near the top of a web page, which can thus be viewed in a browser without scrolling. Some web marketers have called this “above the crease” referring to way in which newspapers of yesteryear were folded and creased.

tag soup

Tag soup is HTML code written without regard for the rules of HTML structure and semantics (HTML is the markup language which composes Web pages). Generally, tag soup is created when the author is using HTML for a presentational document rather than a semantic document. Because web browsers have always treated HTML errors leniently, tag soup is also used by browser implementers to refer to all HTML. HTML must be treated by web browsers as tag soup in comparison to XML where errors need not, and should not, be corrected according to the specification.

web bug (a.k.a. tracking image, clear gif, 1-by-1 gif, invisible gif)

What exactly is a Web Bug?

A Web Bug is a graphics on a Web page or in an Email message that is designed to monitor who is reading the Web page or Email message. Web Bugs are often invisible because they are typically only 1-by-1 pixel in size. They are represented as HTML IMG tags.

What information is sent to a server when a Web Bug is viewed?

  • The IP address of the computer that fetched the Web Bug
  • The URL of the page that the Web Bug is located on
  • The URL of the Web Bug image
  • The time the Web Bug was viewed
  • The type of browser that fetched the Web Bug image
  • A previously set cookie value

What kinds of uses does a Web Bug have in an Email message?

  • A Web Bug can be used to find out if a particular Email message has been read by someone and if so, when the message was read.
  • A Web Bug can provide the IP address of the recipient if the recipient is attempt to remain anonymous.
  • Within an organization, A Web Bug can give an idea how often a message is being forwarded and read.

Firefoxban a noscript extension az 1.1.6.11-es verziotol letilthatova teszi (about:config > noscript.blockNSWB)

Thursday, July 26, 2007

Tenni Theurer: Maximizing Parallel Downloads in the Carpool Lane

Itt van az egesz, de lenyeg, hogy a HTTP/1.1 specifikacioban leirt ajanlas szerint az IE es a Firefox is max 2 dolgot tolt le parhuzamosan ugyanarrol a hostrol (IP cimet nem nez). Ezt meg lehet valtoztani kliens oldalon.

Az IE-nel a registy manipulalasaval:

  1. Start Registry Editor (Regedt32.exe).
  2. Locate the following key in the registry:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
  3. On the Edit menu, point to New click DWORD Value, and then add the following registry values:
    Value name: MaxConnectionsPer1_0Server
    Value data: 10
    Base: DecimalValue Name: MaxConnectionsPerServer
    Value data: 10
    Base: Decimal
  4. Quit Registry Editor.

Firefoxban pedig az about:config oldalon a
network.http.max-persistent-connections-per-server atallitasaval.

Kimertek, hogy mennyit huz a sebessegen, ha tobb hostname aliast hasznalnak amivel arra szorithatjak a browsert, hogy egyszerre tobb elemet toltson le, de az jott ki, hogy 2 aliasnal tobbet nem erdemes hasznalni, mert csak meglassabb lehet az egesz, de gyorsitani biztos nem fog.

Ryan Bran merese szerint viszont siman megeri 3 kulonbozo subdomaint hasznalni.

Wednesday, July 25, 2007

Reload IE-ben a cahce kiiktatasaval.

Ha ugy akarunk ujratolteni egy oldalt IE-ben, hogy ne hasznalja a cache-t, akkor nyomni kell kozben a controlt es a shiftet.

Thirteen Simple Rules for Speeding Up Your Web Site by Yahoo! Developer Network

Itt van az egesz, de idemasolom a tartalomjegyzeket:

1. Make Fewer HTTP Requests
2. Use a Content Delivery Network
3. Add an Expires Header
4. Gzip Components
5. Put CSS at the Top
6. Move Scripts to the Bottom
7. Avoid CSS Expressions
8. Make JavaScript and CSS External
9. Reduce DNS Lookups
10. Minify JavaScript
11. Avoid Redirects
12. Remove Duplicate Scripts
13. Configure ETags

Monday, July 23, 2007

palindromic pangram

A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction.

A pangram or holoalphabetic sentence, is a sentence which uses every letter of the alphabet at least once.

A palindromic pangram is a multi-word palindrome that includes all 26 letters of the alphabet.

Tuesday, July 17, 2007

Fritz Onion: Beware trailing comma in JavaScript prototypes

Itt van, de rovid ugyhogy be is masolom:

When defining a number of functions in a prototype in JavaScript, do not include a trailing comma after the last

MyType.prototype = {
foo : function() {
// ...
},

bar : function() {
//...
}, //<- fails in IE!
}

function:What was especially tricky about tracking this problem down was that FireFox works with or without the trailing comma, so it only fails in IE!

Aza Raskin: Never Use a Warning When you Mean Undo

Itt van az egesz, de lenyeg, hogy webalkalmazasokban mondjuk ha torlunk valamit akkor jo lenne a warning helyett (amit sokszor automatiksuan leokezunk, majd a fejunkhoz kapunk) egy undo megoldas. Peldanak a Gmail leveltorleset hozza fel, ami nem figyelmeztet, de rogton utana egy mozdulattal vissza tudjuk vonni, ha tevedesbol tettuk.

Row Swan: Conflicting Absolute Positions

Ez a problema:

“On two separate occasions this month, I’ve been required to produce a layout in which a fixed-width scrolling side “pane” and flexible scrolling main “pane” must resize to fill all available space in a browser window.”

Vegigjarja a dolgot es vegul Div-ekkel es CSS-sel oldja meg. Persze most is az IE bonyolitja a megoldast.

Monday, July 16, 2007

Peter-Paul Koch: The this keyword (in javascript)

Itt van az egesz, de a lenyeg:

What does this refer to in the function doSomething()?

function doSomething() {
this.style.color = '#cc0000';
}

If you want to use this for accessing the HTML element that is handling the event, you must make sure that the this keyword is actually written into the onclick property. Only in that case does it refer to the HTML element the event handler is registered to. So if you do

element.onclick = doSomething;
alert(element.onclick)

you get

function doSomething()
{
this.style.color = '#cc0000';
}

As you can see, the this keyword is present in the onclick method. Therefore it refers to the HTML element.

But if you do

alert(element.onclick)
you get

function onclick()
{
doSomething()
}

Examples - copying

this is written into the onclick method in the following cases:
element.onclick = doSomething
element.addEventListener('click',doSomething,false)
element.onclick = function () {this.style.color = '#cc0000';}

Examples - referring

In the following cases this refers to the window:

element.onclick = function () {doSomething()}
element.attachEvent('onclick',doSomething)

Sunday, July 15, 2007

Ackermann fuggveny

A:N x N -> N

A(m,n) =

  • n+1, ha m=0
  • A(m-1,1), ha n=0
  • A(m-1, A(m, n-1)), ha m>0, n>0
    Ahogy a wikipediaban irtak:
    A(4, 2) nagyobb, mint az Univerzum részecskéinek száma a 200. hatványon. A(5, 2) tízes számrendszerben írva nem férne el a fizikai Univerzumban…Ha megtehetnénk, hogy a mostani Univerzum minden részecskéjét egy csettintéssel egy univerzummá tágítsuk, utána ugyanezt a megjelent univerzumok részecskéivel, és ezt sokszor megtennénk, meghalnánk végelgyengülésben mielÅ‘tt a részecskék száma elérné a A(4, 3)-t.”

Tuesday, July 10, 2007

Miert ne hasznaljunk with-et javascriptben

Crockford nem ajanlja, mert peldaul a


with (o) {
foo = null;
}

jelentheti azt is, hogy az o.foo lesz null meg azt is, hogy a globalis foo valtozo lesz null vagy akar mindketto.

throw a javascriptben

A sima throw new Error(reason); mellett lehet object literalt is hasznalni.

Pelda a Crockford videobol:


throw {
name: exceptionName,
message: reason
}

for..in buktato javascriptben

Vegig lehet menni egy object minden member-en igy:


for (var name in object) {...}

de ilyenkor vegigmegyunk azoknak az object-eknek is minden elemen amibol a mi objectunk szarmaztatva volt. Ezert Crocford szerint jobb igy megszokni meg ha csunya is:


for (var name in object) {
if (object.hasOwnProeprty(name)) {..}
}

laballed break a javascriptben

Crockford video (00:23) slide 40
  • Statements can have labels.
  • Break statements can refer to those labels.


loop: for (;;) {
...
if (...) {
break loop;
}
...
}

Egymasba agyazott ciklusoknal is mukodik.

Friday, July 06, 2007

Honnan tudjuk, hogy az utolag include-olt javascript mar betoltodott. [2]

Az elozo problemara a codingforums.com-on callback-es megoldast javasolnak a firefoxban az element.addEventListener, IE-ben pedig a onreadystatechange event segitsegevel:


function loadScript(src, callback) {
var node = document.createElement("script");
if (node.addEventListener)
node.addEventListener("load", callback, false);
else
node.onreadystatechange = function() {
if (this.readyState == "complete") callback.call(this);
}
node.src = src;
document.getElementsByTagName("head").item(0).appendChild(node);
node = null;
}


// load 30k script.
// Listener.cleanUp is defined at the bottom of drag.js
callback = function() {
var self = this;
alert("Loaded: " + this.src + "\nListener.cleanUp (nested):" + Listener.cleanUp);
};
loadScript("http://dhtmlkitchen.com/editor/js/drag.js", callback);

[Update]
Ahogy Jan Volter is emliti jobb vigyazni ezzel a readyState propertyvel es onreadystatechange eventtel, mert:
The “this.readyState == ‘complete’” test doesn’t actually entirely work. The readyState theoretically goes through a series of states:

0 uninitialized
1 loading
2 loaded
3 interactive
4 complete

But in fact, states may be skipped. In my experience with IE 7, you get either a loaded event or a completed event, but not both. It may have something to do with whether you are loading from cache or not but there seem to be other factors that influence which events you get. Sometimes I get loading or interactive events too, and sometimes I don’t. It’s possible the test should be “this.readyState == ‘loaded’ || this.readyState == ‘complete’“, but that risks triggering twice.