Monday, May 28, 2012

Enterprise Application Architecture

A few years a go I read two books about how to create architecture for enterprise applications. Now these books are on my work table. One of them is  Microsoft .NET: Architecting Applications for the Enterprise by Dino Esposito and Andrea Saltarello. Another book is Pattern of Enterprise Application Architecture by Martin Fowler.





Squid

Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-requested web pages. Squid has extensive access controls and makes a great server accelerator. It runs on most available operating systems, including Windows and is licensed under the GNU GPL.

Squid website: http://www.squid-cache.org/

Friday, May 25, 2012

Defining a function pointer

I wrote some simple examples how to define function pointers. Defines and initializes a function that has no arguments and no return value:
void function1() {
  std::cout << "'function1' was invoked." << std::endl;
}

int main() {
  void (*func1)() = &function1;
  func1();

  return 0;
}
Defines and initializes a function that has argument and return value:
int function2(int value) {
  std::cout << "'function2' was invoked." << std::endl;
  return value;
}

int main() {
  int (*func2)(int) = &function2;
  int value = func2(10);

  return 0;
}
Here is example how to pass a function pointer as argument:
function3(func1);
Defines an array of functions:
void (*func_array1[3])() = { func1, func1, func1 };
for (int i = 0; i < 3; i++) {
  func_array1[i](); 
}
Defines and initializes a function that refers to class member:
class MyClass {
  public:
    void myFunction(int value) { 
      std::cout << "MyClass function was invoked: " << value << std::endl;
    }
};

int main() {
  MyClass mc;
  void (MyClass::*member_func)(int) = &MyClass::myFunction;
  (mc.*member_func)(1);

  return 0;
}
Rather than declaring function pointer using the full prototype each time, it is helpful to use a typedef:
  typedef void (MyClass::*FunctionPointer)(int);
  FunctionPointer funcPtr = &MyClass::myFunction;
  (mc.*funcPtr)(2);

Thursday, May 24, 2012

Professional ASP.NET MVC 3

One of the last books I read is Professional ASP.NET MVC 3. This book improved my knowledge about ASP.NET MVC3. This in-depth book shows you step by step how to use MVC 3.

Book covers new and updated features such as the new View engine, Razor, NuGet, and much more. The book's practical tutorials reinforce concepts and allow you create real-world applications. Topics include controllers and actions, forms and HTML helpers, Ajax, unit testing, and much more.