Mats and I met today in Palo Alto for lunch to talk about the upcoming Meetup January 7th (in two weeks) at ClickTime. We’re looking forward to both Mats presenting his Ext Scheduler, seeing some cool tricks from a surprise Ext Core Developer, and of course seeing old friends.
We also talked about Mats incorporating his schedule component into the Silicon Valley Code Camp Web site. We had 145 sessions over 2 days so it’s a target rich environment for the schedule component. I can’t wait to see how it looks on the site. Stay tuned for more blog posts.
(more…)
Say you have some logging in your code that finds something unusual going on. In my case, I have a DataContext that I check to make sure it’s not already open before I open it. The method that I call the DataContext in is a utility method that is buried many layers down. When this problem is found, I don’t want to throw an exception, but I do want to log where I was. It does not help me to know that I’m in my utility method. I need to know the stack.
(more…)
So, if you are like me, it’s easy to make mistakes on whether to use && or || when combining variables on if statements. I hate to just start nesting if statements because the code gets bulky, but if not, I have to think three times about whether I got it right.
So, Here comes Resharper for c# from Jetbrains. Simply write the if statement nested as follows:
(more…)
You all know that I’ve blogged quite a bit about LINQ2SQL. That technology has saved me a huge amount of programming effort verses using ado.net directly. We all know that LINQ2SQL is really just a stepping stone to Entity Framework (EF), though Microsoft doesn’t quite say that. I’m sure, based on how many people are using LINQ2SQL, it will live on and be supported for quite sometime. Personally, I’ve been waiting for EF to become more mature and then, I assume I’ll start all my new projects with it (EF) and slowly migrate my old ones from LINQ2SQL to EF. So, time for me to start taking EF more seriously. It’s baked into the upcoming .net 4.0 and Visual Studio 2010 beta 2. It’s obviously not done, but from what I’ve seen, when .net 4.0 releases, EF will be ready for prime time.
Now, for the review:
(more…)
This is probably something pretty simple, hardly worth blogging about, but it took me a little while (15 minutes) to figure out how to open a file ReadOnly with StreamReader, so hopefully, next person looking will hit my blog post right away and save themselves 14 minutes. StreamReader can be very useful in C#.
Say you have a block of code like the following for simply reading all lines of a file:
(more…)
This one is just to amazing to not blog about. I’ve been a die heart ReSharper user for quite a while and recently have started using their early access versions. Primarily because they seem to have added a lot of LINQ support which I use heavily now. I had the following code before the refactor. I have to admit, it’s a little .Net 1.1/2.0 ish, but what can I say, I’m a production coder and it did the job.
private static int GetTransitTime(string parcelToCheck)
{
int transitTime = 0;
foreach (var parcelSCAC in Constant.UPS_SCAC_MAP)
{
if (parcelSCAC.Key.Equals(parcelToCheck))
{
transitTime = Constant.UPS_TRANSIT_TIME[parcelSCAC.Value];
break;
}
}
return transitTime;
}
(more…)
My friend Mats Bryntse, who you may know from our our San Francisco ExtJS Meetup group based in San Francisco, has written a very pretty impressive scheduling component built for the Ext JS framework.
http://www.ext-scheduler.com/examples.html
You can choose between several different time resolutions and easily change the styling since all items shown in the grid are created by a standard Ext Template. The interaction is pretty straight forward, to create a new item in the grid, you just click somewhere and drag. Can’t be any easier. To modify an item you can both resize and use drag and drop. If you are looking for a way to schedule your resources I recommend you check this UX out!
(more…)
I’m currently watching an online video (400 level, very high) from PDC while flying home from Chicago (and blogging about it). One of the common patterns I often implement is to write some code that does a bunch of “Thread.Start” type stuff and “Thread.IsAlive”.
http://microsoftpdc.com/Sessions/FT21
With PLINQ, this can be avoided with clean error free code (as long as my method is thread safe). Here is some simple code that demonstrates this.
(more…)