AT&T 3G Service

27 Sep

I usually check my email on my iPhone when I am getting ready for work in the morning. Thursday as I was using my phone I noticed that I had a 3G signal at my house. I was pretty excited about that. I commute to work in Bloomington, IL. which has had 3G service for a couple of years but I live near Champaign, IL. which didn’t have 3G service. I couldn’t understand why Champaign didn’t have 3G service since its the home of the U of I one of the premier universities for engineering in the country.

Now when I am in Champaign and I want to look something up on my phone I won’t have to wait on the dreadfully slow Edge connection anymore.

Test Post

18 Sep

Testing a code highlighter plugin.


Lorem ipsum...
SELECT *
FROM Products
WHERE Price > 19.99

LINQ to SQL DataContext and Transactions

17 Sep

I am posting this as a way to remember it, since I am starting a real project using LINQ to SQL soon.

LINQ to SQL orders the objects with pending changes based on their dependencies. LINQ to SQL starts a transaction to wrap the SQL statements. The SQL statements are issued one by one. Any errors detected by the database cause the process to stop and all the changes are rolled back. The DataContext still contains the pending changes enabling you to try and resolve the issue and SubmitChanges again as in this example.

   1: Northwnd db = new Northwnd(@"c:\northwnd.mdf");
   2: // Make changes here. 
   3: try
   4: {
   5:     db.SubmitChanges();
   6: }
   7: catch (ChangeConflictException e)
   8: {
   9:     Console.WriteLine(e.Message);
  10:     // Make some adjustments.
  11:     // ...
  12:     // Try again.
  13:     db.SubmitChanges();
  14: }

Weekend Update

13 Sep

The boy started his art class yesterday so my wife drove him over to it and took the girl along so I had the entire morning to myself. Unfortunately I had to do some work remotely instead of having time to myself. I had to write up a personal performance evaluation. I am not a big fan of doing things like that as it seems to take me forever to write stuff like that.

In the afternoon I went to the bookstore to browse around. It was busier than I have seen it in almost a year. I picked up Neal Stephenson’s Anathem. I haven’t started reading it yet, I mostly picked it up because I had a 30% off coupon.

In the evening we watched the movie Sunshine Cleaning. I thought it would be kind of dark and quirky but it was just depressing. The main character is so pitiful its almost hard to watch. I told my wife we would find something silly to put at the head of the Netflix queue for next weekend.

Styling Alternating Items in ASP.NET MVC Views

8 Sep

Here are a couple of ways to apply styles to alternating items in ASP.NET MVC views.

The jQuery way:

$(’ul > li:nth-child(even)’).addClass(’alt’);
$(’ul > li:first’).addClass(’first’);
$(’ul > li:last’).addClass(’last’);

Rick Strahl’s Odd/Even Looping Method:

<%
    bool oddEven = true;
    foreach (CodeSnippetListItem snip in snippetList)
    {
%>
    <div class="<%= (oddEven = !oddEven) ? "evenclass" : "oddclass" %>">
            Content goes here...
    </div>
<% } %>