Archive for March, 2010

What is the Best Ruby on Rails CMS?

If you are looking for the best Ruby on Rails content management system, then Radiant should be on your short list of options. Radiant provides all the facilities of a content management system in a very easy and powerful way. It can help you by creating a nice website for personal or organizational purpose. It provides the foundation for an easy to maintain a website when it is developed. Radiant is not a PHP based CMS; it is written in Ruby and utilizes the Ruby on Rails framework. It is very efficient for developing websites. Usually, smaller companies without large amounts of content, need for document management and/or integrated workflow use Radiant as the content management system for their purposes.

You can add additional functionality by adding extensions. Extensions enhance the capabilities of the website and make it more flexible and easy to use.

Radiant includes all the features of a good content management system. It consists of a simple administrative interface which is quite good for beginners. The three key components of the administrative panel are page, snippets and layouts. It looks similar to three functions used in blog software, but it possesses more functionality and enhancements when compared to blog software. Different pages are managed through the “pages” part, content is managed through “snippet” part and the website designs and layouts are managed in the “layout” part.

Radiant also comes with a macro language called Radius which works in the form of custom tags. It provides a variety of useful dynamic functionality; example: manage parent-child page relationships and inclusion of content from a snippet. The feature of page caching is also available in Radiant content management system.

With all these features, it is possible to create an easily maintainable website which will solve the purpose of personal website. As it is open source, you can use the content management system without spending your money. So if you want to use a simple, easy to use, ruby based content management system, then you should choose the Radiant Content management system.

This article is free for republishing
Source: http://www.articlealley.com/article_495682_4.html

The iPhone Isn’t Easy

How to get started building an app

CUDA, Supercomputing for the Masses: Part 16

CUDA 3.0 provides expanded capabilities

Syndicated via RSS From: http://www.drdobbs.com

Commenting: It’s Your Turn Now

One of the cool features of the ‘new and improved’ DrDobbs.com is the commenting system.

The Most Used Web Programming Language

PHP is now considered to be the most popular web programming language. The biggest advantage is that, it is an open source platform. This helps in reducing cost and time for any web developing organization.

Are you craving to build a website or a web based application that will not only give you a user friendly experience but also manage your database? Hyper Text Pre-processor or PHP is considered to be one of the best web programming languages and is widely preferred since its inception in 1995. This is the perfect choice of program if the client wants the project to be integrated with a database. The best part of PHP is that it is an open source web development framework. It has all built-in enhancements that make it a complete web application developing program for any requirement. PHP gains the winning edge over its competitors such as .Net and java which are also giants in the web development industry.

Today, most of the companies prefer a dynamic web site where the content can be modified and updated periodically. The web world was lacking such sites. This seemed to be a nightmare to all programming languages and it made things worse when the client demanded an SEO friendly website. The birth of PHP as a dynamic web programming language ended the issue of a website being static all the time. Each version that was released increased the performance and security of the internet programming language.

Features of PHP Development

• PHP reduces the lines of code drastically. This helps the quality assurance team when the testing process is done.

• The applications are safe and secure like never before.

• The websites built using PHP increase performance and promises to be reliable and user friendly.

• PHP being an open source language is a huge advantage. This reduces cost and time to build an application or a website.

• Websites built using PHP not only helps the developers, but also the owners. The site is easy to maintain and further enhancements can be implemented since the language PHP uses is of international standards.

Website owners who have developed their websites using PHP can boast of a trouble free, search engine friendly website and can develop multi featured web based applications.

This article is free for republishing
Source: http://www.articlealley.com/article_1325231_4.html

PHP Coding Tools for Dreamweaver

Quickly insert control structures (if statement, etc.) and insert your custom PHP variables: no more typos!

The free PHP Code extension for Dreamweaver helps to speed up code writing in two ways:

* it inserts the chosen control structure (if statement, etc.);

* it inserts the PHP variable chosen in the list of all variables found in the current document.

HeartOS RTOS Support for ARM Processors

Provides scalable, compact, lightweight safety-critical platform for ARM processors

Syndicated via RSS From: http://www.drdobbs.com

NVIDIA Releases CUDA Toolkit v3.0

Includes support for powerful Fermi-based GPUs

Syndicated via RSS From: http://www.drdobbs.com

Probability Selector

For when you really do need randomness

How can I get objects and property values from expression trees?

This is a follow-up to the Getting Information About Objects, Types, and Members with Expression Trees post, so I would recommend that you read that one first.

Among other code examples in that blog post, I demonstrated how you can get a property name as a string by using expression trees. Here is the method.

public static string GetName<T>(Expression<Func<T>> e)
{
    var member = (MemberExpression)e.Body;
    return member.Member.Name;
}

And here is how you can use it.

string str = "Test";
Console.WriteLine("{0} : {1}",
GetName(() => str.Length), str.Length);
// Prints Length : 4

When you go deep into expression trees, you may need to get the actual value of the property or the reference to the containing object out of the expression itself. I’m going to show some tricks using simple and contrived examples, but remember that scenarios when you really need to do this are usually much more advanced. (Think about LINQ providers.)

Let’s say I want to create a method that prints not only the name of a property, but also the value of the property. Such a method might look like this.

public static void PrintProperty<T>(Expression<Func<T>> e)
{
    var member = (MemberExpression)e.Body;
    string propertyName = member.Member.Name;
    T value = e.Compile()();
    Console.WriteLine("{0} : {1}", propertyName, value);
}

Now let’s look closely at this magic line:

T value = e.Compile()();

In general, T is the type of the value that the expression produces. To simplify the example, the code only works for expressions like 
()=>obj.Property
. So in this case, T is the type of the property.

To get the property value, I need to compile this expression into a delegate and then invoke the delegate. In fact, I can write two separate lines of code instead of the shorter syntax used above:

Func<T> del = e.Compile();
T value = del();

So far, so good. Now I have a method that prints both the property name and its value:

string str = "Test";
PrintProperty(() => str.Length);
// Prints Length : 4

Let’s take it one step further. Suppose that I want this method to print not only the property value, but also the string itself:

String: Test
Length : 4

How can I do this? If I have an expression like () => str.Length, I can parse it like this:

public static void PrintPropertyAndObject<T>(Expression<Func<T>> e) 
// e represents "()=>str.Length"
{
    MemberExpression member = (MemberExpression)e.Body; 
    // member represents "str.Length"

    Expression strExpr = member.Expression; 
    // strExpr represents "str"

    . . .     
}

The object I need is now represented by strExpr. However, I can’t compile this expression into a delegate.

String resultStr = strExpr.Compile()(); // Compiler error here.

Only lambda expressions can be compiled into delegates. The problem is that strExpr is not a lambda expression.

Luckily, there is a trick that solves this problem. You can convert expressions into lambda expressions by using the Expression.Lambda<Tdelegate>() method. So, if I have an expression that represents "str", this method converts it to "()=>str".

To use this method, I need to specify a type of the delegate for the lambda expression. ()=>str returns string, so I am going to use Func<String> here.

// Converting the expression into a lambda expression.
Expression<Func<string>> lambdaExpr = Expression.Lambda<Func<string>>(strExpr);

Now I can compile and invoke lambdaExpr:

// Compiling the lambda expression into a delegate.
Func<String> del = lambdaExpr.Compile();

// Invoking the delegate.
String resultStr = del();

Or I can use shorter syntax and combine these three lines of code into one:

String resultStr = Expression.Lambda<Func<String>>(member.Expression).Compile()();

Of course, if strExpr is not a string, I get a runtime exception. But I can check whether it is a string by using the Expression.Type property.

if (strExpr.Type == typeof(String))
{
    String str = Expression.Lambda<Func<String>>(strExpr).Compile()();
    Console.WriteLine("String: {0}", str);
}

And here is the whole method:

public static void PrintPropertyAndObject<T>(Expression<Func<T>> e) 
{
    MemberExpression member = (MemberExpression)e.Body; 
    Expression strExpr = member.Expression; 
    if (strExpr.Type == typeof(String))
    {
        String str = Expression.Lambda<Func<String>>(strExpr).Compile()();
        Console.WriteLine("String: {0}", str);
    }
    string propertyName = member.Member.Name;
    T value = e.Compile()();
    Console.WriteLine("{0} : {1}", propertyName, value);
}

Once again, remember that this is a contrived example. I definitely would not recommend using this technique to print the value of a string object. But it might come in handy when you are debugging or analyzing complex expression trees.

Last but not least, remember that compiling expression trees is not a fast operation. So do not overuse it, or the performance of your application may degrade.

P.S.

Special thanks to Bill Chiles for patiently reading and reviewing three different versions of this post.

Syndicated via RSS From: http://blogs.msdn.com/b/csharpfaq/