Updates from January, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • Richard 1:54 pm on January 21, 2011 Permalink |  

    Uploading blobs to Azure Storage 

    Made a lot easier with this tool:

    https://www.myazurestorage.com/

     
  • Richard 7:56 am on January 13, 2011 Permalink |  

    Reading SQL Timestamp in Castle ActiveRecord 

    The timestamp field in SQL Server (which is a unique number for every insert/update in the database) can be accessed in ActiveRecord as a byte array (of 8 bytes):

    [Property]        
    public  Byte[] Timestamp { get; set; }

    This can be converted to a hexadecimal string representation with the BitConverter class:

    return BitConverter.ToString(Timestamp).Replace("-", String.Empty);

    Timestamp is very useful if you want to keep track of changes to records, as SQL server manages the field for you, and has total precision, unlike a datetime field.

    Advertisement
     
  • Richard 8:45 am on January 12, 2011 Permalink |  

    Endpoint address in Silverlight 

    A silverlight control running in your browser normally loads data from your server via WCF. By default, the endpoint is pulled out of your .config file, which is fine. However, suppose the control is loaded using slightly different domain names (www.foo.com and foo.com). In this case, cross-site scripting prevention will fail the request when the host names doesn’t perfectly match.

    The way around this is to programatically set the enpoint URI, which you can do like this:

    var client = new FooSoapClient();
    client.Endpoint.Address = new System.ServiceModel.EndpointAddress(
       "http://" + System.Windows.Browser.HtmlPage.Document.DocumentUri.Host + "/Foo.asmx");

    The control will now work regardless of the domain name.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel