Thursday, December 16, 2010

jQuery Page Layout Manager

Rather than use the iframe itself as a layout 'pane', you could also
put the iframe 'inside' a regular pane-div. Since the pane-div has a
width and height set, all you need is:

<iframe width="100%" height="100%" ...>

This will auto-size the iframe to fit within the inner-dimensions of
the pane - ie, inside the padding.

jQuery Page Layout Manager

Demo

Left / Right Panes


South / North Panes

Friday, December 10, 2010

Equivalence Relation

Equivalence Relation: A binary relation R on a set A is an equivalence relation if and only if
(1) R is reflexive
(2) R is symmetric
(3) R is transitive

Example: The equality relation (=) on a set of numbers such as {1, 2, 3}
Example: The congruent modulo m relation on the set of integers

The set of elements of A that are equivalent to each other is called an equivalence class. The equivalence relation partitions the set A into muturally exclusive equivalence classes.


Equivalence Relation & class


applet-magic.com

Monday, December 06, 2010

Euler Circuit and Hamiltonian Circuit


In graph theory, an Eulerian trail is a trail in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian trail which starts and ends on the same vertex. They were first discussed by Leonhard Euler while solving the famous Seven Bridges of Königsberg problem in 1736. Mathematically the problem can be stated like this:



Given the graph on the top, is it possible to construct a path (or a cycle, i.e. a path starting and ending on the same vertex) which visits each edge exactly once?

The term Eulerian graph has two common meanings in graph theory. One meaning is a graph with an Eulerian circuit, and the other is a graph with every vertex of even degree. These definitions coincide for connected graphs.

Hamiltonian Circuit is a circuit that visits each vertex once without touching any vertex more than once. (Postman problem)
Every complete graph (n>2) has a Hamilton circuit.



www.pballew.net - Special Graph Problems

Thursday, December 02, 2010

Implementing a Left Join with LINQ

LINQ doesn't define keywords for cross join, left join, or right join.
As part of the LINQ grammar, you get join and group join.

The two common joins are the inner join (or just join in LINQ) and the left join. Suppose you have two collections of data. One you will call the master or left collection, and the other you'll call the detail or right collection. A left join is a join whereby all of the elements from the left collection are returned and only elements from the right collection that have a correlated value in the left sequence. Usually, the correlation is a key or some kind of unique identifier.

Using another analogy, if the left collection is the parent and the right is the child, a left join is all parents but only children with parents.
A right join returns orphans but no childless parents.


developer.com - Implementing a Left Join with LINQ

Thursday, November 11, 2010

Coding a tableless (CSS) two-column layout

As we decided, the layout will have 4 main portions - header, footer, content space and navigation. Header and footer take up the entire width, thus they are easy to set up and style, while content and navigation reside beside each other, sharing the layout width. Let's start with the easiest part.

The first thing I code is a div with ID container. Some people call it wrapper, some call it outer, you can call it jimmy if you want to give a personal feel to it - it's purpose is the same in either case: holding the entire layout and positioning it regarding the body. Width of this element will be the maximum width of your layout.

Inside this main div, we will insert header, content, navigation and footer.

Tutorial: Floating an image and caption
Nela Dunato
Smashing Magazine: CSS Float Theory
Tableless Tables

Stretch a Box to its Parent’s Bounds

Thursday, October 07, 2010

Inversion of control

Inversion of Control, or IoC, is an abstract principle describing an aspect of some software architecture designs in which the flow of control of a system is inverted in comparison to procedural programming.

Dependency injection is the main method to implement Inversion of Control.

Implementation techniques are influenced by the computer language used.

In Java there are six basic techniques to implement Inversion of Control. These are:

1.using a factory pattern
2.using a service locator pattern
3.using a constructor injection
4.using a setter injection
5.using an interface injection
6.using a contextualized lookup

You should not use an Inversion of Control container if you are not familiar with the concepts and if you do not realize the problems they try to solve.

Also, depending on the size and complexity of the project, an IoC container might be overkill. Prefer to use it on medium to large projects.


Inversion of Control and Dependency Injection: Working with Windsor Container


Castle Project offers two Inversion of Control Containers.

Thursday, September 30, 2010

Windows Workflow Foundation (WF) in .NET 4

A new control flow activity called Flowchart has been added to make it possible for developers to use the Flowchart model to define a workflow. The Flowchart more closely resembles the concepts and thought processes that many analysts and developers go through when creating solutions or designing business processes. Therefore, it made sense to provide an activity to make it easy to model the conceptual thinking and planning that had already been done. The Flowchart enables concepts such as returning to previous steps and splitting logic based on a single condition, or a Switch / Case logic.


MSDN: Windows Workflow Foundation (WF) in .NET 4

Tuesday, September 28, 2010

.NET Windows Workflow Foundation (WF) WF Rule Engine using External WF Rules

Windows Workflow Foundation (WF) includes a flexible Rule Engine, allowing the Workflow developer to logically separate your application's business rules from the Workflow Assemblies. Rules allow you to model and implement the business requirements of your application into a set of declarative statements, which can be enforced at runtime.

A WF Rule is composed out of the following three separate parts:

1.A Condition which evaluates to a Boolean result.
2.A Then Action which is executed if the condition evaluates to true.
3.An optional Else Action which is executed if the condition evaluates to false.
The WF Visual Studio designers include a set of Rule Editor Dialogs. These editors allows the developer to create individual rules, and combine them together into a RuleSet. Alternatively, you can use any .NET language to create the a RuleSet through custom code.

Traditionally, WF Rules are used in the following two context:

1.Within a Declarative Rule Condition. Such a rule condition can be part of an IfElseBranchActivity, a WhileActivity, or any other activity which needs to evaluate a simple or compound boolean expression.
2.Within a Policy activity. A Policy activity evaluates a RuleSet, and applies the Then or Else actions of each Rule in the RuleSet, based upon the Rule's condition. The Rule Engine has the ability to apply forward chaining, which is a mechanism in which dependencies within rules are automatically detected, and Rules can be re-evaluated as a result of these dependencies.


Alternative Applications for the WF Rule Engin

Monday, September 27, 2010

Jess: The Rule Engine for the Java Platform

Jess is a rule engine and scripting environment written entirely in Sun's Java language by Ernest Friedman-Hill at Sandia National Laboratories in Livermore, CA. Using Jess, you can build Java software that has the capacity to "reason" using knowledge you supply in the form of declarative rules. Jess is small, light, and one of the fastest rule engines available. Its powerful scripting language gives you access to all of Java's APIs. Jess includes a full-featured development environment based on the award-winning Eclipse platform.

Jess uses an enhanced version of the Rete algorithm to process rules. Rete is a very efficient mechanism for solving the difficult many-to-many matching problem (see for example "Rete: A Fast Algorithm for the Many Pattern/ Many Object Pattern Match Problem", Charles L. Forgy, Artificial Intelligence 19 (1982), 17-37.) Jess has many unique features including backwards chaining and working memory queries, and of course Jess can directly manipulate and reason about Java objects. Jess is also a powerful Java scripting environment, from which you can create Java objects, call Java methods, and implement Java interfaces without compiling any Java code.

Friday, September 24, 2010

Rule-Based Systems and Identification Trees

Using a set of assertions, which collectively form the ‘working memory’, and a set of rules that specify how to act on the assertion set, a rule-based system can be created. Rule-based systems are fairly simplistic, consisting of little more than a set of if-then statements, but provide the basis for so-called “expert systems” which are widely used in many fields. The concept of an expert system is this: the knowledge of an expert is encoded into the rule set. When exposed to the same data, the expert system AI will perform in a similar manner to the expert.

Rule-based systems are a relatively simple model that can be adapted to any number of problems. As with any AI, a rule-based system has its strengths as well as limitations that must be considered before deciding if it’s the right technique to use for a given problem. Overall, rule-based systems are really only feasible for problems for which any and all knowledge in the problem area can be written in the form of if-then rules and for which this problem area is not large. If there are too many rules, the system can become difficult to maintain and can suffer a performance hit.

To create a rule-based system for a given problem, you must have (or create) the following:


  • A set of facts to represent the initial working memory. This should be anything relevant to the beginning state of the system.

  • A set of rules. This should encompass any and all actions that should be taken within the scope of a problem, but nothing irrelevant. The number of rules in the system can affect its performance, so you don’t want any that aren’t needed.

  • A condition that determines that a solution has been found or that none exists. This is necessary to terminate some rule-based systems that find themselves in infinite loops otherwise.



Rule-Based Systems and Identification Trees - James Freeman-Hargis