March 2009 - Posts
blank_page Subscribe to All!
Subscribe to WMV.
Subscribe to M4V (iPod).
Subscribe to MP3.
(The cool kids subscribe, why not you?!?)
Download
WMV .
Download
M4V .
Download
MP3 .
Original Url: http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2009/03/19/asp-net-podcast-show-138-coding-microsoft-velocity-with-david-penton-video.aspx
Code Samples: http://www.aspnetpodcast.com/CS11/files/folders/podcastsupportfiles/entry1293.aspx
Show Notes:
----- Code Sample Notes -----
Four (4) assembly references are needed for a cache project: CacheBaseLibrary.dll CASBase.dll ClientLibrary.dll FabricCommon.dll Import System.Data.Caching for code using Velocity You must start with a CacheFactory. No parameters in the construct means to
read from a configuration file. From there, cache is accessed via a CacheName. You can use
Cache.DefaultCache for the default (returns null) For CTP2, you cannot easily
seek out if a region is created. Cache.DefaultRegion is null as well. There is quite a bit of log messages that are exposed by default in
Velocity. Especially for a Cache Miss.
I got my dev vpc setup and installed this evening. I was pulling my hair out looking for the latest StorageClient and ASP.NET Providers. Where the heck are they. Well, their are in the Windows Azure SDK directory. they are in the samples.zip file. I missed it because it was in a zip file.
Original Url: http://morewally.com/cs/blogs/wallym/archive/2009/03/20/windows-azure-samples-storage-client-and-asp-net-providers.aspx
I've been working on this application to send out tweets at a particular time. One thing thing I want to do is be able to look at the logged in user's timeline. I've been playing with the ASP.NET 4.0 AJAX Previews, so I thought I would marry the two. As a result, I wrote the WCF code below in C#. Note that the password is hidden, so the code won't work until you add that in. Basically, I make a request to get the friends timeline. This gives me the most recent 20 posts by default. I store the result in an XmlDocument. I need to get that data out as a complex object of type UserStatusSvc as I am returning an array of that type. I used Linq to Xml for that.
[OperationContract] public UserStatusSvc[] GetUserTimeLine(string username) { string url = "http://twitter.com/statuses/friends_timeline.xml"; //string user = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(username + ":" + password)); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = "POST"; // <--- you probably need to change this to a GET after a twitter change a couple of months ago. request.Credentials = new NetworkCredential(username, password); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string responseString = reader.ReadToEnd(); reader.Close(); XmlDocument xmld = new XmlDocument(); xmld.LoadXml(responseString); XDocument document = XDocument.Parse(responseString); var query = from e in document.Root.Descendants() where e.Element("user") != null select new UserStatusSvc { UserName = e.Element("user").Element("screen_name").Value, ProfileImage = e.Element("user").Element("profile_image_url").Value, Status = HttpUtility.HtmlDecode(e.Element("text").Value), StatusDate = e.Value.ParseDateTime().ToString() }; var users = (from u in query where u.Status != "" select u).ToList(); return (users.ToArray()); }
Here's the definition of my UserStatusSvc object.
[DataContract] public class UserStatusSvc { [DataMember] public string UserName { get; set; } [DataMember] public string ProfileImage { get; set; } [DataMember] public string Status { get; set; } [DataMember] public string StatusDate { get; set; } }
public static class StringExtensions { public static DateTime ParseDateTime(this string date) { string dayOfWeek = date.Substring(0, 3).Trim(); string month = date.Substring(4, 3).Trim(); string dayInMonth = date.Substring(8, 2).Trim(); string time = date.Substring(11, 9).Trim(); string offset = date.Substring(20, 5).Trim(); string year = date.Substring(25, 5).Trim(); string dateTime = string.Format("{0}-{1}-{2} {3}", dayInMonth, month, year, time); DateTime ret = DateTime.Parse(dateTime); return ret; } } Thanks to Tim Heue r for some code he posted on his blog to get me started. I have primarily stolen his code and reposted it here. :-)
Original Url: http://morewally.com/cs/blogs/wallym/archive/2009/03/17/calling-the-twitter-api-in-c.aspx
PS. I modified this code example to remove the hokey CheckForNull(...). It was stupid and not necessary. I didn't realize I had left it in until I got hassled for it. The line 'where Element("user") != null' resolved my problem.
Subscribe to All!
Subscribe to WMV.
Subscribe to M4V (iPod).
Subscribe to MP3.
(The cool kids subscribe, why not you?!?)
Download
WMV .
Download
M4V .
Download
MP3 .
Original Url: http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2009/03/18/asp-net-podcast-show-137-install-and-configuration-of-microsoft-velocity.aspx
Show Notes:
----- Installation Notes -----
CTP1 must be uninstalled first!
.Net Framework version 3.5
PowerShell version 1.0
Cluster configuration options
XML based
SQL Server (or SQL CE) based
Set cache cluster/host options
Cluster Name
Cluster Size: small (1-3), medium (4-6), large (7-10)
Cache Host port (default 22233)
Cache Cluster port (if configuring) (default 22234)
Max Server Memory
----- Configuration Notes -----
XML Configuration file or SQL Server
PowerShell is the de-facto configuration tool Desktop icon is created during
installation for the PowerShell entrance Keep in mind that any parameter values
are case-sensitive Basic help comes from
Get-CacheHelp
Other typical options (some have obvious names)
Start-CacheCluster
Stop-CacheCluster
Restart-CacheCluster
Get-Cache (shows the current Cache Names available and the regions)
New-Cache (creates a new cache name)
Remove-Cache (removes an existing cache name)
Get-CacheConfig (shows statistics for the cache node
specified)
With the ASP.NET 4.0 AJAX previews, there is the concept of a pseudo
column. This is similar in concept to Oracle's rownum and rowid
columns that are returned in a query. The two columns that ASP.NET 4.0
AJAX when doing databinding are $index and $dataItem.
$index is an integer which represents the current record in the data binding operation.
$dataItem are the columns that are available in the data binding operation.
Original Url: http://morewally.com/cs/blogs/wallym/archive/2009/03/16/asp-net-4-0-ajax-pseudo-columns.aspx
I'll be speaking at the Chattanooga .NET User Group on Tuesday March 17. The topic is an introduction to asp.net ajax.
I downloaded and setup the javascript files for ASP.NET 4.0 AJAX
Preview Release 4. This release was put up last Thursday night /
Friday morning. Since I had a talk on Saturday at the Atlanta Code
Camp on this subject, I decided to take the plunge and get my code
moved over and running on it to show the latest and greatest running.
While the intelligence of that decision can be debated for a long time,
I got it done. I wanted to share some stuff about the setup of the
product. There are three sets of javascript files that are in the
download, previously, there were two sets of files. The new file is
MicrosoftAjax.js. This file is a little bit surprising because there
is a file in the base Microsoft ASP.NET AJAX called this. I read the
instructions. The instructions were a little bit blurry on this setup
subject. They sort of implied that the MicrosoftAjax.js files was only
needed if you were NOT using the ASP.NET 3.5 Script Manager. Any way,
I found this to not be true. To get things setup correctly, this is
the setup I found that worked.
<asp:ScriptManager ID="sm" runat="server"> <Scripts> <asp:ScriptReference Name="MicrosoftAjax.js" Path="~/js/MicrosoftAjax.js" /> <asp:ScriptReference Path="~/js/MicrosoftAjaxAdoNet.debug.js" /> <asp:ScriptReference Path="~/js/MicrosoftAjaxTemplates.debug.js" /> </Scripts> <Services> <asp:ServiceReference Path="~/TwitterService.svc" /> <-- this is my file, so you probably don't need it. </Services> </asp:ScriptManager>
Bertrand LeRoy suggested this setup below. Given that he works on the ASP.NET team, I'll take his suggestion. :-)
<asp:ScriptManager ID="sm" runat="server">
<Scripts>
<asp:ScriptReference ScriptMode="Inherit" Name="MicrosoftAjax.js" Path="~/js/MicrosoftAjax.js" />
<asp:ScriptReference ScriptMode="Inherit" Path="~/js/MicrosoftAjaxAdoNet.js" />
<asp:ScriptReference ScriptMode="Inherit" Path="~/js/MicrosoftAjaxTemplates.js" />
</Scripts>
<Services>
<asp:ServiceReference Path="~/TwitterService.svc" />
</Services>
</asp:ScriptManager>
I hope that this helps you out in the area of getting the preview setup.
Original Url: http://morewally.com/cs/blogs/wallym/archive/2009/03/16/asp-net-4-0-ajax-preview-release-4-setup.aspx
I will be at the Atlanta Code Camp on Saturday March 14. I
will be speaking on an introduction to asp.net 4.0 ajax. I'll also be running
the podcast from the camp. Please come by and say hello.
I'll be speaking tonight at the Atlanta GGMUG User Group.
The subject is an Introduction to ASP.NET AJAX. Thanks INETA for making this
possible.
Please come by if this fits your schedule.
More Posts
« Previous page