Technology Related Links for May 1, 2009

If you are looking to follow this series, be sure to subscribe to my RSS feed at http://feeds.jasongaylord.com/JasonNGaylord or my Twitter account at http://twitter.com/jgaylord Series Post #4 I’ve streamlined the categories a bit more. I’m also going to add suggestions that I come across on Twitter. Do you have any suggestions for my link series? Let me know by leaving a comment here. Whether it is additional resources to find links or changing the format – all suggestions are welcome! .NET Languages – C# and Visual Basic An Introduction to Mixins for C# – Justin Etheredge Assigning from Nullable Types … Continue reading Technology Related Links for May 1, 2009

Technology Related Links – Post #1

I’m going to try to put together a list of links I grab and post them to intermittent blog posts. I’d like to do a post like this once a day or at the very least once a week, but let’s see where things go. 🙂 Anyway, here’s the first batch of links summarized by technology. Some of these may be a couple of weeks old, so please bare with me as the first list is quite lengthy. I’ll also add in recently released books, software releases and updates, and upcoming technology events. If you are looking to follow this … Continue reading Technology Related Links – Post #1

Use LINQ to XML to Generate Excel Documents

I was looking for a quick and easy solution to export data from SQL into an Excel format from within my ASP.NET application. I came across a great video posted by Beth Massi on the asp.net website (Video #7 at the bottom at http://www.asp.net/learn/linq-videos/). Beth steps through creating the LINQ to XML and how you can populate your Excel document. When I used this in an ASP.NET application, I added the XML declaration to the Response.Write so that Excel could understand the document. In ASP.NET, the XMLDocument type has a tendency to drop the XML declaration when writing out the … Continue reading Use LINQ to XML to Generate Excel Documents

Obtain the Identity of a New Row Using LINQ

It’s actually pretty easy and user friendly to obtain the value of the identity column using LINQ. After you create your object and insert it on submit, you can call the identity column’s property on your object. For instance: Dim db As New BlogDataContext() db.BlogPosts.InsertOnSubmit(MyPost) db.SubmitChanges() Dim IdentityValue As Integer = MyPost.PostID In this example, the IdentityValue variable would be assigned to the PostID of the post that was just submitted.

VB.NET’s "yield return"

I was struggling with an issue today when converting some C# to VB.NET. C# has a really cool “yield return” statement that is used in an iterator block to provide a value to the enumerator object. VB.NET does not have the “yield” keyword. So, there are a few solutions (none of which are really clean) to get around this. You could use a return statement to return the value if you are looping through and would like to break an enumerator and return a single value. However, if you’d like to return the entire enumeration, create a List() of the … Continue reading VB.NET’s "yield return"

Writing a Base64 String to the File System or Browser

Quite often, vendors pass images or PDFs to customers using the binary contents of the file. To make it more secure, they convert the binary contents to a Base64 string. A full explanation about Base64 encoding can be found at Wikipedia here. Anyway, when you receive the string, you cannot simply write it to a file or to the browser. First, you must convert the data into a Byte array. The sample code below demonstrates this: Dim str As String = “Insert Your Base64 String Here”Dim Base64Byte() As Byte = Convert.FromBase64String(str) Then, you can decide which output method you’d prefer. … Continue reading Writing a Base64 String to the File System or Browser