News

My Stats

  • Posts - 49
  • Comments - 33
  • Trackbacks - 0

Twitter












Tag Cloud


Recent Comments


Recent Posts


Archives


Post Categories


Image Galleries


 

The first annual Chirp has been scheduled for 14-15 April in San Francisco. Chirp is a conference, sponsored by Twitter, about the Twitter platform.

http://chirp.twitter.com

To attend the conference, you'll need to obtain the password by executing the users/show command. There are plenty of tools to help you do this if you have some degree of programming skill.  Of course, there is a .NET LINQ provider, LINQ to Twitter, that can help perform this task with ease.  In LINQ to Twitter terms, you would perform a Show query on the User entity, like this:

var user =
    (from tweet in twitterCtx.User
     where tweet.Type == UserType.Show &&
     tweet.ID == "6253282"
     select tweet)
     .SingleOrDefault();

Console.WriteLine(
    "The password to Chirp is: {0}",
    user.Identifier.ScreenName);

Based on a TwitterContext instance, twitterCtx, you can perform a user's query. There are a few different types of user querys you can make, including Show, Followers, and Friends.  In the current case, we're interested in finding the user who's Twitter ID is 6253282. In typical LINQ syntax, we're only querying for one user, so SingleOrDefault materializes that user for us.  Because queries can be based on ID, UserID, and Screen name, I designed LINQ to Twitter with a special Identifier property that held these values as returned from Twitter.  Therefore, if you want to see what you used to create the query, use the properties directly off the returned User object, If you want to see what Twitter returned, drill down into the Identifier property, as shown in the Console.WriteLine statement of the previous example.

Normally, my code comes with the output to show you the results, but considering the mission what fun would that be?

Joe


 

Friday (1/22/2010) night, Win 7 had an update to install. I looked at it, as I always do, to see what the update was about.  It was a cumulative security patch for IE8 (KB978207); details below.  After the system rebooted, I saw a message to not shut down because updates were being applied; a common occurrence and no big deal. What caught me off guard was the subsequent reboot.  The system normally starts after the initial reboot and applying the patch.  When the system came back up, I received the same message about updates being applied.  This look of update and reboot continued and it became clear that something was seriously wrong.

To get out of the loop, I pressed F8 a few times during startup and selected System Repair.  During the repair process, I selected a restore point, before when the update patch was applied.  After the restore, my system came up normally.  However, the update was still nagging to be applied.  I applied it one more time to see if it was just a temporary glitch.  However, this brought me back into the update loop.  So, I restored again to get things back to normal.

Restoring the system really isn't a fix, but at least it allows me to use my system.  When I find the real fix, I'll post an update, but just wanted to share some info in case someone else ran into the same problem.

Here are the update details:

Cumulative Security Update for Internet Explorer 8 for Windows 7 (KB978207)

Download size: 7.1 MB

You may need to restart your computer for this update to take effect.

Update type: Important

Security issues have been identified that could allow an attacker to compromise a system that is running Microsoft Internet Explorer and gain control over it. You can help protect your system by installing this update from Microsoft. After you install this item, you may have to restart your computer.

More information:
http://go.microsoft.com/fwlink/?LinkId=179104

Help and Support:
http://support.microsoft.com
 

Update - 10/5/2010 - From Santos

thanks for those tips, adobe updater was realy the culprit, but i thought i should tell you that using a windows restore point was not necessary. it might even be what complicated things for the ppl there.

i simply clicked the adobe updater icon, had it install its update, and the windows update boot looped stopped. maybe you can add that info to the page.


 

Common questions when learning LINQ to SQL revolve around many-to-many relationships. This post will describe a scenario that needs queries across many-to-many relationships, show the data and the LINQ to SQL representation of that data, explain the query, and finally output the results.

As you know, the design for many-to-many involves a join table. The following figure illustrates a many-to-many relationship between Tags and Tasks with a TasksTags join table:

 LINQ to SQL many-to-many

A scenario for working with this data is to group all tags under the tasks they're associated with. Suppose the tags table has the following data:

1 LINQ
2 Twitter
3 C#
4 MVC
5 WCF
6 Visual Studio 2010
NULL NULL

The Tasks table has the following data:

1 Support Streaming
2 Update Tutorial
3 Finish Chapter
NULL NULL

and the the TasksTags table has the following information:

1 1
1 2
2 3
3 4
3 6
NULL NULL

The trick is to start the query from the join table, TasksTags, and then do LINQ to SQL joins to the Tasks table and then the Tags table, followed with a group by.  Here's the entire query, including grouping:

var ctx = new ToDoDataContext();

var tagsPerTask =
    from taskTag in ctx.TasksTags
    join task in ctx.Tasks
        on taskTag.TaskID equals task.TaskID
    join tag in ctx.Tags
        on taskTag.TagID equals tag.TagID
    group taskTag by taskTag.Task into taskTagGroup
    select new
    {
        Task = taskTagGroup.Key,
        Tags = taskTagGroup.Select(task => task.Tag)
    };

 After the joins, the group by clause saves into a continuation variable, taskTagGroup.  You can use taskTagGroup for custom projections on the data, making it easier to get to organize the results. In the projection, Key is Task because the Task was selected in the group by.  Remember to group by the object, rather than it's key so you can access all of the grouped objects later. Tags is populated through another LINQ to SQL query that only selects the Tags related to each task. Here's how you can get to the results with a Console application:

foreach (var taskGroup in tagsPerTask)
{
    Console.WriteLine("Task: " + taskGroup.Task.Name);

    foreach (var tag in taskGroup.Tags)
    {
        Console.WriteLine(" Tag: " + tag.Name);
    }
}

The first foreach will iterate through tasks, because we want to group by tasks, using the Task property created in the custom projection in the LINQ to SQL query above.  Because we have the whole task, it's possible to access all it's members.  The nested foreach loop will iterate through the Tags property of each Task group. The Tags was populated in the custom projection of the LINQ to SQL query above. Here's the output:

 Task: Support Streaming
    Tag: LINQ
    Tag: Twitter
Task: Update Tutorial
    Tag: C#
Task: Finish Chapter
    Tag: MVC
    Tag: Visual Studio 2010

By starting at the join table, and pulling all the information together with LINQ joins before doing the group by, you can successfully organize the data into groups.

@JoeMayo


 

This is a new blog on the first day of the year starting a new decade.  The world has changed in the last 10 years and the software development we did in 1999 is much different than the software development we did in 2009. In the same spirit, the next 10 years will see dramatic changes in the way we write software and the platforms that software runs on.  Moving from compilers that targeted operating systems to targeting virtual machine platforms as mainstream software engineering was a dramatic change, but we won't stop there.

2009 was the year Twitter hit mainstream and became the darling of the press, drawing in celebrities and business.   LINQ to Twitter was already available as an open source project, but I was compelled to pull it out of moth balls, dust it off, and begin coding some new life into the product.  With the emergence of REST, cloud platforms and Web applications exposing APIs, it became clearly evident that the platform is changing.  Noone necessarily owns this platform because it is a conglomeration of different companies, public services, and open-source projects.  Additionally, there are software development tools that are hitting every platform. My favorite language, C#, is available on both .NET and Mono and Mono spans multiple platforms.  Certainly, Java has been around for years, but scripting languages, like python and ruby, are gaining in popularity.  These tools that operate on any platform and pull together information accross the Internet will change the way we develop software.

Some people are calling this Glue coding. Microsoft (perhaps others) tried to coin the name of Mashups to something similar. However, the term Mashups sounds too homegrown and I prefer something more professional to describe the potential of this new way to build software; Glue sounds fine for now.  Regardless of what it's called, Glue is something that is evolving and will either affect or present opportunities to application development that not too many people had considered 10 years ago.  It's certainly a subject on my mind and now part of this new blog; for a new year; and a new decade.