comments edit

Tired of annoying “pre-approved” credit card offers? I sure am. According to the Fair Credit Reporting Act (FCRA) of 1970 as amended in 1996, the four major credit bureaus have the right to sell your information to companies that want to offer you a credit card. Fortunately, the amendment also stipulated that credit bureaus must provide a way for consumers to have their names excluded from pre-approval lists. If you’re a United States citizen sick of getting pre-screened credit card offers, this article will show you how to avoid receiving them.

[Via kuro5hin.org]

comments edit

A while ago, I posted an entry imagining the next generation of Rss Aggregators and blogging engines that would in effect, create a better social network than Frienster, Tribe, etc…

Looks like efforts were already under way. A commenter pointed me to XFN, aka the XHTML Friends Network which presents a simple way to express relationships through hyperlinks. Very interesting.

After applying XFN tags, you can head over to http://www.rubhub.com and have them index your site. Entering a full or partial URL in their search engine will bring up a relationship results page. This page lists sites that link to the specified site and all the sites to which the specified site links. With each link, the search results also dislay the relationship (for example: Acquaintance).

comments edit

I received this email from a coworker. It makes you stop and think, doesn’t it?

With all the news coverage about sub-zero east coast weather and north Pacific ice storms, it’s easy to forget that Southern California has its share of devastating weather also. Check out the damage caused by a wild west coast storm which recently passed through Los Angeles (photo attached.) It really makes you cherish what you have, and reminds us not to take life for granted!!!

Warning: This photo is graphic and not for the faint of heart. Click Here.

comments edit

I wish I had this a while ago. Log Parser allows you to run SQL like queries against your IIS log files. Check it out here.

comments edit

I’m working on a project to add beauty back to the blogging experience, even when read by an Rss Aggregator.

For example, in RssBandit, you can select a style for displaying blog entries (via XSLT formatters). Currently, this setting applies to all feeds. In order for this to work well, some creative stripping of the style within an item must occur, otherwise you can get some very ugly (even unreadable) results.

I’ve been working (albeit slowly) on a spec allowing a blog to “suggest” a style (or custom formatter) for a blog entry when read in an aggregator. Based on your aggregator settings, the aggregator would either accept the style from the blog, or it would use your predefined style.

Some nice benefits include the fact that the style the RssFeed suggests could be customized to the user’s aggregator. For example, if the aggregator supports Longhorn, the RssFeed might suggest a formatter that converts the blog entry into XAML. This nicely separates the presentation from the content, and yet gives both the content producer and consumer some control over the presentation.

Some issues I need to think about is whether this should be an extension to RSS or use a new API. Not only that, I need to gather some feedback on whether or not this is even a good idea and worth my time.

comments?

code comments edit

I needed to create a temp table in SQL with a column that contained an incrementing integer, without making that column an identity.

For example, suppose I want to select record from a table of users, but add a column that contains an incrementing counter. The data in the table should look like so:

counter UserID Email
0 3432 BillBrasky@example.COM
1 7913 zoolander@example.com
2 8372 donaldtrump@example.com

To start, I can run the following query to create the temp table:

SELECT counter = 0, * FROM Users INTO #tmp_Users

This creates a temp table named #tmp_Users where the column “counter” is set to 0 for each row.

In order to update the counter column so that each row has a counter value greater than the previous row, run the following statement.

DECLARE @counter int
SET @counter = 0
UPDATE #tmp_Users
SET @counter = counter = @counter + 1

If you’re looking to master your T-SQL Fu, I recommend this book. It provides a great reference for advanced T-SQL querying techniques. Keep in mind that this book is not for beginners. It gets into some deep analysis of how querying works in SQL 2005

personal comments edit

Bush believes that an amendment is necessary to bring “clarity” to the issue of gay marriage and to preserve the social fabric of our great nation.

Praise Be The Lord! Well Ok Bush, I’m with you. But before we work on that amendment, there’s another Amendment we need to pass first. The Amendment to remove the scourge of Divorce from our country. It is necessary to preserve the social fabric. For it sayeth in the Gospel of Mathew chapter 19 verse 9 (King James Version):

And I say unto you, Whosoever shall put away his wife, except it be for fornication, and shall marry another, committeth adultery: and whoso marrieth her which is put away doth commit adultery.

For your homework, also look up Deut 22:19, Matt 5:32, 19:9, Mark 10:9-12, Luke 16:18, Rom 7:2, 1 Cor 7:10-11, 7:39.

personal comments edit

We went on a triple date last night with Walt, Celine, Dan, and Judy to eat at Jiraffe. They are having some sort of Monday prefixe special. Unfortunately, a lot of French food has egg product in it to give it an added richness, which makes it difficult for my wife. I, on the other hand, had no problem with any of the food. Especially the Fois Gras. Very rich and tasty!

comments edit

I just left to do some thinking where I get my best thinking done. While washing my hands, I realized I should mention a few issues with my previous recommendation.

Adding the SerializableAttribute to a class indicates to .NET that the class may be automatically serialized via reflection. When the class is being serialized, .NET uses reflection to obtain the values of every private, protected, and public member. What this means for your exception class, is that any properties it exposes should themselves be serializable. Should .NET attempt to serialize your class, and your class contains a member that cannot be serialized, it will throw a SerializationException during run-time

Now, I’m not sure if this is the best design, but I often expand any object parameters to my custom exception constructors rather than storing a reference to the object. For example:

[Serializable]
public class MyException : ApplicationException
{
  public readonly int ObjectID;
  public readonly string ObjectName;
    
  /// <summary>   
  /// Constructor stores the properties of sourceObject instead   
  /// of a reference to sourceObject itself.   
  /// </summary>   
  public MyException(string message, MyObject sourceObject)
  {
    ObjectID = sourceObject.ID;
    ObjectName = sourceObject.Name;
  }
}

This allows me not to have to worry about whether or not MyObject is serializable.

Another way to deal with this is to mark any members that are not serializable with the NonSerializedAttribute like so:

 
[Serializable]
public class MyException : ApplicationException
{
  [NonSerialized]
  private MyObject sourceObject;
    
  /// <summary>   
  /// Constructor stores the properties of sourceObject instead   
  /// of a reference to sourceObject itself.   
  /// </summary>   public MyException(string message, MyObject sourceObject)
  {
    this.sourceObject = sourceObject;
  }
}

The .NET runtime will ignore any members with the NonSerialized attribute during serialization. After deserialization, the member will have its default value (null for reference types).

Finally, you can forego automatic serialization and provide your own serialization by having your class implement ISerializable If you do so, you must still mark your class as serializable with the SerializableAttribute

 [Serializable]
public class MyException : ApplicationException
{
  [NonSerialized]
  private MyObject sourceObject;
    
  /// <summary>   
  /// Constructor stores the properties of sourceObject instead   
  /// of a reference to sourceObject itself.   
  /// </summary>   public MyException(string message, MyObject sourceObject)
  {
    this.sourceObject = sourceObject;
  }
}

What do you think?

comments edit

Just had lunch with Erik and Ben at Manpuku. If you’ve never been, Manpuku is on Sawtelle just north of Olympic in the strip mall where Hurry Curry is. If none of that made sense to you, then you probably don’t live in L.A. ;)

In any case, they had the bento boxes and I had an Ishiyaki Bibimpap. Rice with vegetables and ground beef, served in a steaming hot clay bowl with a red hot paste mixed in. Too good.

In any case, sounds like Ben and Erik are doing well at my former establishment of employment. Erik and his wife are expecting in two months. Not much has changed, we spent five minutes catching up on personal lives, and 55 minutes talking about Microsoft Reporting Services and the various code we’re all writing.

comments edit

When writing a custom Exception class, don’t forget to mark the class as Serializable? Why? If the exception is ever used in a remoting context, exceptions on the server are serialized and remoted back to the client proxy. The proxy then throws the exception on the client. By default, .NET types are not serializable. But by adding a simple Serializable attribute decoration on your class, .NET is able to serialize your exception.

[Serializable]
public class MyException : Exception
{
  // Custom Code
  
}

Technorati Tags: Tips

personal comments edit

Let’s see. On Friday we went to see a sneak preview of Starsky and Hutch. If you liked Zoolander, I think you’ll like this. It’s not the same, but has similar type of humor. It’s hard to approach Zoolander in my book, but Starksy and Hutch does well.

Saturday played a game of soccer in the cold rain. Had a stalwart crew of 10 people out there.

And on Sunday, slept in till noon, had lunch in Eagle Rock, and basically had a nice relaxing lazy day.

comments edit

This is probably the funniest thing I’ve ever heard happening on a train:

Yesterday my mom and I went on a train ride that is often billed as being a way for couples to spend a special occassion. The train was full of couples celebrating anniversaries, birthdays and other special occassions. Quite a number of couples were making out openly at the end of the train ride whose main features are a picturesque dinner on the train and a stop with a tour of a local winery.

One of the less romantic aspects of this train ride is that for the most part you have to share a table with another couple facing them. this means they get to overhear your conversation and interrupt yours. The couple we shared our table with were celebrating the guy’s birthday and his girlfriend was treating him to a special day out that ended with the train ride. After we got back on the train from the winery tour the unexpected happened. They were engaged in conversation and he was comparing her favorably to ex-girlfriends, then all of a sudden he got down on one knee and pulled out a box with a ring in it. After a stunned silence she took it, said some words softly then said “I appreciate the sentiment but the timing is inappropriate” and handed it back. This was followed by her voicing her concerns about his ability to support them and him rattling of how much he made a month plus various bonuses, etc. I think it went downhill from there.

All through this I was staring out the window trying to make small talk with my mom but failing miserably. If and whenever I do end up proposing to someone I’ve definitely learned a thing or two about what not to do.

[Via Dare Obasanjo aka Carnage4Life]

comments edit

UPDATE: Whoops! I should have read the SLA for my free hosting provider more carefully. There’s a size limit to the files I may post on my ftp server. I will work to rectify this situation by finding a new FTP site. In the meantime, email me and I will send you the documents referenced below.

This is a work in progress. Pick up the Word doc here. Please make updates and changes with change tracking on and I’ll be sure to incorporate them into the master document.

Also, just for kicks, I generated MSDN style documentation of the RssBandit class library using NDoc. You can pick that up here

If the files are unavailable, let me know. Sometimes files get deleted if I go over my quota.

comments edit

My latest task is to produce reports useful for fraud detection. We’ve recently had incidents in which users from Vietnam opened up several accounts via stolen credit cards, deposited money via Paypal, then commit a charge back.

I won’t go into details about the specifics of these reports, but they simply identify common patterns in fraudulent activity and alert us to the potential mischief.

csharp code datetime comments edit

What is the proper way to add three hours to a DateTime for the PST timezone? Is it this?

var d = DateTime.Parse("Oct 26, 2003 12:00:00 AM");
var later = d.AddHours(3.0);
Console.WriteLine(later); // displays 10/26/2003 03:00:00 AM which is NOT correct!

A valiant attempt, but wrong. Instead try this:

var d = DateTime.Parse("Oct 26, 2003 12:00:00 AM");
var later = d.ToUniversalTime().AddHours(3.0).ToLocalTime();
Console.WriteLine(later); // displays 10/26/2003 02:00:00 AM which is correct!

Or better yet, use DateTimeOffset.

const string dateFormat = "MMM dd yyyy h:mm tt zzz";
var d = DateTimeOffset.ParseExact("Oct 26 2003 12:00 AM -07:00", dateFormat, CultureInfo.InvariantCulture);
var later = d.AddHours(3.0);
Console.WriteLine(later);

Why all the rigamarole of converting to universal time and back to local time? A little thing we like to call Daylight savings time. Without the conversion, adding three hours would have set the time to 3:00 AM which would be wrong.

Realizing this probably would have saved me from many hours of intense debugging sessions. I remember one particular case with a system of scripts and tools I set up to analyze the very large log files for a big client. It hummed along nicely until one fine spring day when it failed miserably. After an entire day of tracking down the source of the problem, I finally nailed it down to a script’s mishandling of Daylight Savings.

To find out more about proper DateTime handling, read the following article concerning best practices with manipulating date times.

comments edit

agentLately it seems that everybody is playing “six-degrees of separation” by sprouting a social networking service. Some of the most prominent are Friendster.com, Tribe.com, MySpace.com, and Google’s Orkut. The promise these services make is that by joining, you’ll be where all your friends are and in the process make new friends and business contacts, though in reality they tend to look like glorified dating services. Look around the blogosphere and you’ll find several opinions concerning the problems and weaknesses of these services. For example, Dare’s take on social networking services, Warren Ellis’s evaluation of Orkut, and Don Park’s suggestion for improving existing services. Robert Scoble, a popular blogger, points out in this blog entry, that none of these networks interoperate. A person ends up entering his data into each site over and over again.

A better model for social networking is the blogging community itself. Most blogs these days contain a list of other blogs called a blogroll. Typically a blogroll is a list of other blogs that the blogger finds interesting. Click on a link within a blogroll and you’re instantly transported to another blog with its own blogroll. Continue navigating blogrolls and you may cover the entire blogging community, or just end up with a headache and a strong desire never to hear about another person’s opinion of Janet Jackson’s Super Bowl boob.

These blogrolls create a de-facto network, though I hesitate to call it a “friendship” network as the social networking services do, but it is a network nonetheless. Many call the larger network of blogs, the “blogosphere”.

It wouldn’t be too difficult to create a software component that could index your blogging network and provide features similar to Friendster: “Haacked is in your network, would you like to kick him out?”, or “You have 13,237 bloggers in your network. You spend too much time online.” Perhaps this would be a web control hosted by a blog, or a new feature for an RSS aggregator.

Many of these blogs are hosted by some sort of blogging back-end software whether it is http://www.blogger.com, http://radio.userland.com/, or my personal favorite Subtext. With some of these tools, there are more powerful ways to establish networks than simply following links in a blogroll. For example, after reading a blog entry about the definition of a track back, I realized that social networking occurs both ways. Not only are the owners of the blogs you link to (and those they link to and so on and so on) members of your network, but those that link to you (referrals) and those that comment on your site and create trackbacks to your site are also members.

Trackbacks are particularly interesting in that they are a form of machine communication between your blog and the blog of another author. “Hi, I’m Haacked’s blog. He recently wrote a post that referred to an entry in your blog and trashes you and your family. Here’s the URL. Have a nice day!” This communication provides more information than a simple link. Not only does the recipient of this trackback know that I read her blog, but she also knows that I was motivated enough to refer to her site in a post on my own blog.

In such an exchange, your blog is acting as a software agent on your behalf. Think about that for a second. In Subtext for example, the simple act of posting a blog entry with a link to another person’s blog grants your blog permission to contact her blog (on your behalf) and communicate your acknowledgment of her blog entry.

Now imagine if the next generation of these blogging tools contained new features focused on this idea of a blog as social networking tool and personal agent. Your blog could have many capabilities to act as an agent on your behalf. It’s nice to know that your blog is looking out for you.

For example, you might give your blog several pieces of personal information and create some rules about who is allowed to gain access this information in sum or in part. Taking the concept of the blogroll one step further and creating various new “rolls”, a rule might be, “Anyone that is in my “close-friend-roll” may have access to all of this information. Anyone in my “colleague-roll” may have access to my business information. And anyone who trackbacks to me may have my email address.” Now, the next time I link to your blog entry, your blog might volunteer some information about your blog to my blog, at which point my blog may refuse or accept this information (depending on my preferences).

Taken further, blogs may move past being a simple journal of your everyday thoughts, but become your representative on the web. Tired of filling out your billing and shipping information every time you shop online? Add the selected merchant sites to your “secured-merchant-roll” and the next time you purchase something from Amazon.com, just give them your URL and let them get your billing and shipping information.

This rich communication between blogs would occur through XML standards built into the next generation of blogging software. The current crop of blogging tools already supports a variety of XML standards such as the MetaWeblog API, TrackBack API, Comment API, and Blogger API. Perhaps these new communication abilities would be built on top of these existing APIs or require new APIs altogether.

The beauty of this approach is the fact that these APIs are open and not proprietary. Not to beat a TLA to death, but this architecture is an example of Microsoft’s favorite TLA these days, SOA or Service Oriented Architecture. It doesn’t matter which platform your blog is implemented on. As long as it supports these various API’s and can make an http request, it can participate in this rich communication.