Thursday, October 20, 2011

LINQ to Entities: PredicateBuilder and Dynamic Linq

When you want to build dynamic filter for a query on LINQ to SQL or LINQ to Entities (Entity Framework, NHibernate, ..), you can use a famous Albahari's PredicateBuilder. But sometime, it may be doesn't work perfect with LINQ to Entities. To solve this problem, Pete Montgomery introduced a universal PredicateBuilder that combined the original version of Albahari's PredicateBuilder and LINQ to Entities: Combining Predicates.

Thursday, August 11, 2011

Apache: Deny access from everyone, except your IP address

To block all visitors to access your website except your IP address and customers’. You can add  following codes at the end of httpd.conf file and restart your httpd.

# Deny access from everyone, except those IP listed here:
<Files *>
  Order deny,allow
  Deny from all
  Allow from xxx.xxx.xxx.xxx
  Allow from yyy.yyy.yyy.yyy
</Files>

Wednesday, July 20, 2011

SQL: Lấy dữ liệu dòng cuối cùng trong mỗi group

Bài toán này đặt ra trong trường hợp khi bảng dữ liệu có từ hai khóa chính (primary key) trở lên, trong đó yêu cầu xác định dữ liệu sao cho một khóa chính nào đó là duy nhất và lớn nhất.