This is COOL!!!! I’m gonna have to sign up for a larger number of messages on my cellphone plan now.
Category: technology
Another SAMF. Must read and implement on my new servers.
Silicon Valley WebGuild
Ignore. YASAMF.
Just something I want to keep around for reference. Ignore if you don’t program. – matte
Reprinted from SitePoint Community Crier #71. Without permission but credit is given.
A JavaScript expression will sometimes be more intuitive (and easier to understand) when written a certain way, but, often, we may actually need the inverse of that expression. For example, in Listing 1 below, our code only needs to react if (x && y) is false. We need to invert the expression.
Listing 1
if (x && y)
{
// we don't have anything to do here
}
else
{
// we want to do something here
}
De Morgan’s laws describe how to invert a logical expression. In Listing 2, we see De Morgan’s Laws in action within the JavaScript syntax.
Listing 2
!(x || y) == (!x && !y)
!(x && y) == (!x || !y)
The rule inverts each logical term and each logical operator.
In Listing 3, we invert the expression from Listing 1 by applying De Morgan’s Laws.
Listing 3
if (!x || !y)
{
// we want to do something here
}
Sometimes, a logical term is more complex than a simple boolean variable. A logical term may be a relational expression, such as (p <>= q)
Inverting the next logical term (r != s) we get (r == s)
Inverting the logical operator && we get ||
The result is shown in Listing 5.
Listing 5
if (p >= q || r == s)
{
// we want to do something here
}
So, if you find yourself struggling with a JavaScript problem, pick up an old math textbook — your solution is probably in there.
Visit us at the SitePoint JavaScript Forum if you have any questions.
Keep it fun
Mike Foster – Programming Team Mentor
TopStyle Pro 3.11 BETA 1!!!!
WOO HOO!!! Finally a new version of my favorite HTML/PHP/CSS/JS/Hieroglyph editor. If you are a registered user of TS Pro 3.1 then download it and help make the next one even better. If you AREN’T a registered user. WHY NOT??? <grin>
I couldn’t pass this up.
What if Mozilla were to win in the end? via DivaBlog
Another report via a preponderance of evidence
still here …
… but busy or not very “bloggy”. Way behind on my reading. Should be more chatty soon. Here are some links to keep you busy …
- Firefox 0.9.2 – don’t let the version number scare ya. it’s 1000% better than Internet Exploder
- Thunderbird 0.7.2
- For people who make websites …
- See this band!!!!!
- TMBG’s new album “The Spine” is out July 13
Pop Goes the GMail
Finally, I have a justification to get a GMail account. Looks like someone finally wrote a POP3 access program for GMail. Check it.
Now if only I had an account. Anyone have an invite??? Please???
[UPDATE] – I HAVE AN ACCOUNT!!! Thank you Carey for the invite. Happytowners RULE!!!! Everybody else DROOLS!!!! heh. I’ll send an email announcement to people soon with my new email address.