Joseph Michael Pesch
VP Programming

SQL Table/Column Schema Select

by 26. February 2010 15:28

select
  sch.name [Schema Name]
, tbl.name [Table Name]
, col.name [Column Name]
, typ.name
  + case when col.system_type_id = 167 then ' (' + convert(varchar, col.max_length) + ')' else '' end
  + case when col.precision + col.scale <> 0 then ' Precision: ' + convert(varchar, col.precision) + '; Scale: ' + convert(varchar, col.scale) else '' end
  [Column Type]
, case col.is_nullable when 1 then 'true' else 'false' end [Allow Null]
from sys.tables tbl
inner join sys.schemas sch
on tbl.schema_id = sch.schema_id
inner join sys.columns col
on tbl.object_id = col.object_id
inner join sys.types typ
on col.system_type_id = typ.system_type_id
where tbl.type = 'U'
order by
  sch.name
, tbl.name
, col.name
 

Tags:

SQL Server

JavaScript getElementsByClassName() Function

by 24. February 2010 16:09

Function from: http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/

function getElementsByClassName(className, tag, elm){
  var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
  var tag = tag || "*";
  var elm = elm || document;
  var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
  var returnElements = [];
  var current;
  var length = elements.length;
  for(var i=0; i<length; i++){
    current = elements[i];
    if(testClass.test(current.className)){
      returnElements.push(current);
    }
  }
  return returnElements;
}

Tags:

JavaScript

LINQ to SQL with WCF and Silverlight

by 7. February 2010 19:27

Tags: ,

ASP.Net | LINQ to SQL | Silverlight

Binary Data Serialization LINQ to SQL via Web Service

by 7. February 2010 18:17

http://geekswithblogs.net/frankw/archive/2008/08/29/serialization-issue-with-timestamp-in-linq-to-sql.aspx

In summary, one easy fix is manually change the LINQ data type from Binary (System.Data.Linq.Binary) to byte[] (System.Byte[])

Tags: ,

ASP.Net | LINQ to SQL

ASP.Net Read HTML Content from URL

by 5. February 2010 04:49

public static string GetHTMLFromURL(string URL)
{   
  // Download page content   
  WebClient MyWebClient = new WebClient();   
  Byte[] PageHTMLBytes;   
  PageHTMLBytes = MyWebClient.DownloadData(URL);    
  // Convert result from byte array to string   
  UTF8Encoding oUTF8 = new UTF8Encoding();   
  return oUTF8.GetString(PageHTMLBytes); 
}

Tags: ,

ASP.Net