Black and White in Photoshop

I found a new method to convert to black-and-white; I think it works pretty well.

You can find the instructions here.
(copyright © DigDaan.nl); You can also download the action here.

Channel 9

Interesting: http://channel9.msdn.com/

Alpha Beta Searching

I have a test tonight. I am fairly certain I will get an A; however, there is only one thing that I am unsure about: AlphaBeta searching. So I went online and read couple of books. Here’s my understanding (in brief of course):

AlphaBeta searching is an optimized searching model based on MinMax searching (or MiniMax search). So to understand AlphaBeta searching we must first understand MinMax searching.

MinMax searching can be applied on game trees (if you are not familiar with game trees then please go here). The MinMax comes from the fact that the searching algorithm alternates between searching for a maximum value, and a minimum value. For instance, if it’s the computers move then the computer searches for a maximum node (when I refer to maximum I am referring to the move-value which is the heuristic value for that move). On the other hand, when it turn for the opponents move the computer searches for a MIN value and so on.

AlphaBeta searching improves on the MinMax algorithm with the following assumption. Lets say you know a node K is better than node K’ and you can prove that the best possible move can be K then how much better is K than K’ is absolutely irrelivant because no matter what value K’ is you will end up choosing K because K is the best move. Therefore if K’ had a subtree none of that needs to be computed which eventually saves tremendous amount of time.

Binding Problem

Recently I came to know about this very interesting problem known as the: “Binding Problem”. To understand the problem consider the following scenario: “you see a round, red ball rolling on a flat floor”. In this scenario there are several different things happening.

1) You recognized the shape of the ball (which is done by a certain part of the brain)

2) You also recognized the color of the ball (which is done by another part of the brain)

3) Finally you recognized that the ball was rolling on the floor (which is done by yet another part of the brain).

The binding problem is to understand how these three distinct knowledge (or data) get “bound” together.

The reason I am taking about this problem is because, recently there has been a breakthrough. Scientists at: Caltech was able to find when our brain fails to bind. It’s a very interesting concept and you should go here to test yourself.

For more information click here.

CSS level 3

CSS level 3 (extension to CSS level 2) is coming out. W3C is proposing some amazing features. I will talk about some but more can be found here.

In the new CSS release you will have the ability to test attributes. For instance:

input[type=reset] {
	/* default content of HTML4/XHTML1 input type=reset button */
	background-color: #9cf;
}

The above CSS would change the background color for only reset buttons. You can’t do this now! To do the same thing in CSS2 you have to create a class and find
all reset buttons and add the attribute class=”…”

Secondly.. A feature that allows you to use system-fonts. For instance:

body {
	appearance:desktop;
}

The above code would use whatever font the client is using on their desktop to be applied to the body of the HTML page.

Unique Elements (in XSLT)

At work I have this XML document that lists all the employees along with their responsiblities. The general format looks something like this (staff.xml):

<ga-staff>
  <department title="Administration">

    <employee>
      <responsibility>Director, Corporate Accounting</responsibility>
      <name>...</name>
      <phone>...</phone>
      <email>...</email>
    </employee>

    <employee>
      <responsibility>Manager</responsibility>
      <name>...</name>
      <phone>...</phone>
      <email>...</email>
    </employee>

  </department>

  <department title="">
    ...
  </department>
</ga-staff>

I was asked to generate a flat (meaning only their name, phone and e-mail) output (sorted by name) of all the staffs in our department. The only problem with using (existing) staff.xml is that there are certain employees who have multiple responsiblities, so their name appears more than once. Of course I cannot
display their name more than once in the flat output. That makes no sense. The output would be something like this:

	PersonA		1234	persona@finance.ucla.edu
	PersonA		1234	persona@finance.ucla.edu

To solve this problem I could have very well have used the Microsoft.DOMDocument, but I decided to use XSLT.

The first step was to generate an XML document (dynamically using XSLT) that would transform the staff.xml into an XML document that looked like this (sorted by name):

<ga-staff>
  <employee>
    <name> ... </name>
    <phone> ... </phone>
    <email> ... </phone>
  </employee>
</ga-staff>

This is done using the following XSLT document (staff.xsl):

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
  <ga-staff>

    <xsl:for-each select="//employee">
      <xsl:sort select="name" order="ascending" />
        <employee>
	  <name><xsl:value-of select="name" /></name>
	  <phone><xsl:value-of select="phone" /></phone>
	  <email><xsl:value-of select="email" /></email>
	</employee>
       </xsl:for-each>
  </ga-staff>
</xsl:template>
</xsl:stylesheet>

Now that the data is sorted I can remove all the duplicate elements and generate a unique employee list. This is done using the following XSLT document (unique.xsl):

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
<xsl:template match="/">
  <ga-staff>
    <xsl:for-each select="//employee[not (name = preceding-sibling::employee/name)]">
      <xsl:if test="not(contains(name,'- Open -')) and not(contains(name,'/'))">
        <xsl:copy-of select="."/>
      </xsl:if>
    </xsl:for-each>
  </ga-staff>
</xsl:template>
</xsl:stylesheet>

That’s it! Finally I used Microsoft.DOMDocument to apply these transformations to staff.xml. That is done using the following code:

Dim source, styles, unique, tmp, xdocument

' ** Load source XML Data
set source =   CreateObject("MSXML2.DOMDocument")
source.async = false
source.load(Server.MapPath("xml/staff.xml"))

' ** Load styles
set styles = CreateObject("MSXML2.DOMDocument")
styles.async = false
styles.load(Server.MapPath("xml/xslt/staff.xsl"))

set unique = CreateObject("MSXML2.DOMDocument")
unique.async = false
unique.load(Server.MapPath("xml/xslt/unique.xsl"))

' ** Resulting transformation
set tmp = CreateObject("MSXML2.DOMDocument")
tmp.async = false
tmp.validateOnParse = true

set xdocument = CreateObject("MSXML2.DOMDocument")
xdocument.async = false
xdocument.validateOnParse = true

source.transformNodeToObject styles, tmp
tmp.transFormNodeToObject unique, xdocument

Sasser Worm

Can your computer get infected even if you are not using the computer? According to this article you can. I am not sure how it works — and what events cause the virus to infect a system, but a scary thought.

To check and possibly remove the virus you can go to here.

If you have a router which uses a hardware firewall (like I do) then you are much safer.

And of course apply all the updates.