Monday, March 23, 2015

Killing processes in Windows 7

Found this link that gives all the details, but wanted to capture the basics here. Chrome has been randomly locking up on me and when I close all it leaves a bunch of processes hanging around. I was killing them one by one in process explorer until now!

You can run:
> tasklist 

from the command line to see all running processes. Then
> taskkill /IM chrome.exe /f

And it will kill all the chrome.exe processes that hang around. Best part is this doesn't require downloading some tool to do it for your. It's baked in to windows.

Tuesday, January 27, 2015

Free my network port!!!!

I occasionally have a process that will die and not free the port. The next time I try to run an app it can't grab the port for use. To find and kill the process you can use:
netstat -ano | find ":8080"
The last number in the output is the pid. From there go to task manager and find the process and kill it!

Monday, January 30, 2012

DebugView options to capture .Net Trace messages

DebugView is a great tool for capturing .Net Trace messages.
Add:
System.Diagnostics.Trace.WriteLine("Trace.WriteLine")
to your code. Then run debug view with the following options:

If you are looking for more permanent logging solutions check out log4net and NLog.

Monday, November 22, 2010

How to kill a Remote Desktop Connection

I got the following from: http://www.juhopark.com/?p=56

In case that site goes down here's how to do it on my Win7 machine:

  1. Open the cmd line in admin mode
  2. net use \\[server] /USER:[login] "[password]"
  3. query session /server:[server]
  4. reset session [id from above] /server:[server]
The only thing I changed was admin mode.  I wasn't able to use query.exe or reset.exe unless the command prompt had admin privileges.  These executables are in the system32 directory.

Saturday, November 6, 2010

NHibernate Hidden Gems - Speed up NHibernate startup time

This code is pulled directly from Ayende's presentation at NHDay in Bologna. I would just link there, but this code only exists in the video (no source was provided).

Here's a simple solution that Ayende showed to speed up the NHibernate startup time. The following will work great for production systems. You would need something a little more complex for development since you would need to re-save the cfg file anytime you change your mappings.

if (!File.Exists("nh.cfg"))
{
// Build your nh configuration
Configuration configuration = new Configuration()
.Configure("NHibernate.config");
// write the config out to a file (the configuration is expensive to create)
new BinaryFormatter().Serialize(File.Create("nh.cfg"), configuration);
}
var configuration = (Configuration)new BinaryFormatter().Deserialize(
File.Open("nh.cfg", FileMode.Open)
);

ISessionFactory factory = configuration.BuildSessionFactory();

NHibernate Hidden Gems - PainIsWeaknessLeavingTheBody

This code is pulled directly from Ayende's presentation at NHDay in Bologna. I would just link there, but this code only exists in the video (no source was provided).

Ayende provided an Interceptor implementation to make developers feel the network latency pain along with catching too many queries per session.

public class PainIsWeaknessLeavingTheBody: EmptyInterceptor
{
public override SqlString OnPrepareStatement(SqlString sql)
{
// check for too many queries
var count = (int)(HttpContext.Current.Items["nh_statment_count"] ?? 0)
if (++count > 30)
throw new InvalidOperationException("Stop querying the DB, dummy!");

HttpContext.Current.Items["nh_statment_count"] = count;

// add a sql delay
return new SqlString("WAITFOR DELAY '00:00:01'\r\n").append(sql);
}
}

All you have to do from here is pass in a new PainIsWeaknessLeavingTheBody to your call to OpenSession.

Some of you may think this is crazy. And as Ayende points out why in the world does SQL Server have a sleep implementation?!? I really like the idea for both tracking the number of queries per session along with adding a delay to make sure your customers aren't having to wait excessively.

Tuesday, August 17, 2010

Maybe we should all stop adding comments to code...

Jesse Liberty had an interesting post that starts like this:
I recently imposed on myself the constraint of coding without comments. Why?
  • Comments rust faster than code, even when you’re careful
  • Well written code can be read, and comments are annoying footnotes
  • Comments make for lazy coding
I've been trying to do this for a little while now. I wasn't so sure about this at first but the more and more I do it the better I like it.

Saturday, July 31, 2010

jQuery Console

A while back I found this jQuery Console bookmarklet. When you run the bookmarklet jQuery is downloaded to whatever web page you are on and a console window pops up that you can run javascript/jQuery statements in on whatever webpage you are on.

Just drag this link to you bookmarks jQuery Console and you can click it when you are on the page you want to mess around with. Here's a image of my boring use.


I didn't write this. If you did or you know who did let me know and I'll link the original post.

Thursday, July 15, 2010

Crazy Visual Studio regex

I'm not sure why, but I've never really looked into regex in the find (& replace) dialog in Visual Studio. A couple days ago I had an interesting reason to dig in, so here's my attempt to be able to do this the next time I need to.

First here are the docs on the syntax (of course I looked for this after I finished my task, so below may not be the best example): http://msdn.microsoft.com/en-us/library/aa293063(VS.71).aspx

Here are the two expressions I ended up with (I'm sure they could be better):

Find: ^{:b*}proxy\::b*new Ext.data.AspNetAjaxHttpProxy.*\n[^'"]*['"]{[^'"]*}['"]\n[^,]*
  1. A line that starts with some white space captured
  2. then "proxy:"
  3. then some white space
  4. then "new Ext.data.AspNetAjaxHttpProxy"
  5. then any characters to the end of the line
  6. then new line
  7. then any characters except a single or double quote
  8. then a single or double quote
  9. then capture the characters inside of the quotes
  10. then a new line
  11. then any characters that are not a comma
Replace: \1proxy\: window.getProxy('\2')
  1. fill in with the whitespace captured in step 1 above
  2. then insert "proxy: window.getProxy(
  3. then the chars capterd in step 9 above
  4. then insert )

Find: ^{:b*}reader\::b*new Ext.data.JsonReader\(.*\n.*\n[^,]*,:b*
Replace: \1reader\: window.getJSONReader(

Some of the things I learned:
  1. There is multi-line support, but it's not great
  2. I would have been better off using :q for my quoted string in the first example
  3. You can do grouping with "()" to capture n number of \n characters. I didn't know about this at the time, but could have used it where I have back to back ".*\n" sequences.
  4. Capture groups are pretty easy using "{}" and replacing with "\n" where 'n' is the 1 based index of the capture.

Tuesday, December 22, 2009

Easy way to make external links to open in a new tab/window

A few months ago I meant to update all my external links to open in a new tab. I never got around to it, but today I found a post by Mads that reminded me. His post is about how to embed an image in a css file.

I'm sure there are better ways to do this, but this was easy and the first thing that came to mind.

I had been meaning to add jQuery to the site. The first line goes and gets the latest jquery 1.* version from google. The second line uses a css selector to add target=blank to all the hrefs that don't point to my site.
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script> 
<script type='text/javascript'>
$("a[href^=http://]").not("a[href^=http://www.yourdomain]").attr("target", "blank");
</script>

Wednesday, December 16, 2009

Fun with javascript

I know this is nothing new. It's all the fad with bookmarklets. Just type the following in your address bar.
javascript:(function(){alert('hey there')})()

You can start doing some really cool stuff with selectors (replace nav with the id of an element on your page)...
javascript:(function(){alert(document.getElementById('nav').innerHTML)})()

There's lots you can do with this. Maybe I'll post a better example later.

Sunday, December 6, 2009

Creating ISOs

I'm done trying to find driver/software DVDs. From now on I'm going to start ripping ISOs of the software that goes with my hardware. I've had good luck with ImgBurn. Ripping my Linksys WRT320n disk to my server now!

Hopefully this post will remind me of the tool I use... I have used this in the past, but I couldn't remember what the name was when trying to create this backup. I spent 5 min looking for any exe with "iso" in the title.

Tuesday, August 4, 2009

ms-dos list files in directory

I just found this on stackoverflow.com and don't want to forget it.

In windows, to list only directories:
dir /ad /b /s


to list all files (and no directories)
dir /a-d /b /s

Wednesday, July 29, 2009

Using javascript and regex to parse date time string

In the last year I've been parsing a lot of strings that represent dates into javascript Date objects. Somewhere along the way I decided to write some date parsing code using regular expressions.

Requirements:
We wanted to let the user entry of date/time data to be easy. This meant that formats like "2p" should parse as well as "1/21 3". In our actual solution there is usually a context date we use to fill in the information that the user leaves out, but the implementation below just uses the current time.

The code we used also takes culture into account (think reversed month and day), but I'll leave that for you to solve (unless I get requests and have time to work on it).

I should point out that we started off using DateJS, but we ran into some parsing errors where we were getting off by 1 hour parsed dates. So that was the end of that...

Hopefully I can add more description to this post later, but I want to publish this draft.

(function(method)
{
var rexp = new RegExp(
"^" +
"(?:" + // date
"(1[0-2]|0?[1-9])" + // Month
"[/-]" +
"(3[0,1]|[1,2][0-9]|0?[1-9])" + // Day
"(?:[/-]" +
"(19[7-9][0-9]|2[0-9]{3}|[0-9]{2})" + // Year
")?" +
"\\s?" +
")?" +
"(?:" + // Time
"(2[0-3]|1[0-9]|[1-9])" + // Hour
"(?:[:]" +
"([0-5][0-9])" + // Min
"(?:[:]" +
"([0-5][0-9])" + // Sec
")?" +
")?" +
"\\s?" +
"(?:([aApP])[mM]?)?" + // ampm
")?$"
);
var i = { Month: 1, Day: 2, Year: 3, Hour: 4, Min: 5, Sec: 6, AMPM: 7 };
var trim = function(s) { return s.replace(/^\s+|\s+$/g, ''); };
if (Date[method]) throw method + " already exists on the date object.";

Date[method] = function(strDate)//, optFormat)
{
strDate = trim(strDate);
var parsed = rexp.exec(strDate);
if (!strDate || !parsed) { return null; }

var ret = new Date(); // could also pass in a context date

var year = ret.getFullYear();
if (parsed[i.Year])
{
switch (parsed[i.Year].length)
{
case 4:
year = parseInt(parsed[i.Year], 10);
break;
case 2:
year = year - (year % 100) + parseInt(parsed[i.Year], 10);
break;
}
}

var month = (parsed[i.Month] ? parseInt(parsed[i.Month], 10) - 1 : ret.getMonth());
var day = (parsed[i.Day] ? parseInt(parsed[i.Day], 10) : ret.getDate());
var hour = (parsed[i.Hour] ? parseInt(parsed[i.Hour], 10) : 0);
var min = (parsed[i.Min] ? parseInt(parsed[i.Min], 10) : 0);
var sec = (parsed[i.Sec] ? parseInt(parsed[i.Sec], 10) : 0);
var ms = 0;

ret.setFullYear(year, month, day);
ret.setHours(hour, min, sec, ms);
if (!parsed[i.AMPM]) { return ret; }

if (hour > 12 && parsed[i.AMPM].toLowerCase() === 'p')
{
ret.setHours(ret.getHours() + 12);
}
else if (hour === 12 && parsed[i.AMPM].toLowerCase() === 'a')
{
ret.setHours(ret.getHours() - 12);
}
return ret;
};
})('parseDate');


You'll notice the usage in the test code below Date.parseDate('12/26/2005 8pm');
And yes I know it's a stretch to call these tests, but KISS. If you don't like parseDate as the fn name then change it in the last line above.

function test(str)
{
document.write("<tr><td>(" + str + ")</td><td>" + Date.parseDate(str) + "</td></tr>");
}
document.write("<table>");
test("1/13");
test("1/13/1999");
test("1/13/2001");
test("1/13/99");
test("1/13/01");
test("4/5/2008 2:00:06 pm");
test("11/5/2008 2:00 pm");
test("4/5/2008 2 pm");
test("4/5/2008");
test("4/5");
test("2:00:00");
test("4:00am");
test("4 am");
test("3p");
test("12:00");
test("22:59");
test("1:59");
test("12:45 a");
test("3");
test("19");
test("4p");
test("5 p");
test("12/26/2008");
test("1/2/08");
test("1/2");
test("1/03");
test("01/03");
test("01/13/2008");
test("1/2 2p");
test(" 2 ");
test(" 2 ");
test("01-13-2008");
test("1-2 2p");
test("FAIL CASES:");
test("");
test(" ");
test("24");
test("24 pm");
test("36:00");
test("1:60");
test("13/02");
test("2008/13/02");
document.write("</table>");


Here's the output:

(1/13)Tue Jan 13 2009 00:00:00 GMT-0500 (Eastern Standard Time)
(1/13/1999)Wed Jan 13 1999 00:00:00 GMT-0500 (Eastern Standard Time)
(1/13/2001)Sat Jan 13 2001 00:00:00 GMT-0500 (Eastern Standard Time)
(1/13/99)Tue Jan 13 2099 00:00:00 GMT-0500 (Eastern Standard Time)
(1/13/01)Sat Jan 13 2001 00:00:00 GMT-0500 (Eastern Standard Time)
(4/5/2008 2:00:06 pm)Sat Apr 05 2008 14:00:06 GMT-0400 (Eastern Daylight Time)
(11/5/2008 2:00 pm)Wed Nov 05 2008 14:00:00 GMT-0500 (Eastern Standard Time)
(4/5/2008 2 pm)Sat Apr 05 2008 14:00:00 GMT-0400 (Eastern Daylight Time)
(4/5/2008)Sat Apr 05 2008 00:00:00 GMT-0400 (Eastern Daylight Time)
(4/5)Sun Apr 05 2009 00:00:00 GMT-0400 (Eastern Daylight Time)
(2:00:00)Wed Jul 29 2009 02:00:00 GMT-0400 (Eastern Daylight Time)
(4:00am)Wed Jul 29 2009 04:00:00 GMT-0400 (Eastern Daylight Time)
(4 am)Wed Jul 29 2009 04:00:00 GMT-0400 (Eastern Daylight Time)
(3p)Wed Jul 29 2009 15:00:00 GMT-0400 (Eastern Daylight Time)
(12:00)Wed Jul 29 2009 12:00:00 GMT-0400 (Eastern Daylight Time)
(22:59)Wed Jul 29 2009 22:59:00 GMT-0400 (Eastern Daylight Time)
(1:59)Wed Jul 29 2009 01:59:00 GMT-0400 (Eastern Daylight Time)
(12:45 a)Wed Jul 29 2009 00:45:00 GMT-0400 (Eastern Daylight Time)
(3)Wed Jul 29 2009 03:00:00 GMT-0400 (Eastern Daylight Time)
(19)Wed Jul 29 2009 19:00:00 GMT-0400 (Eastern Daylight Time)
(4p)Wed Jul 29 2009 16:00:00 GMT-0400 (Eastern Daylight Time)
(5 p)Wed Jul 29 2009 17:00:00 GMT-0400 (Eastern Daylight Time)
(12/26/2008)Fri Dec 26 2008 00:00:00 GMT-0500 (Eastern Standard Time)
(1/2/08)Wed Jan 02 2008 00:00:00 GMT-0500 (Eastern Standard Time)
(1/2)Fri Jan 02 2009 00:00:00 GMT-0500 (Eastern Standard Time)
(1/03)Sat Jan 03 2009 00:00:00 GMT-0500 (Eastern Standard Time)
(01/03)Sat Jan 03 2009 00:00:00 GMT-0500 (Eastern Standard Time)
(01/13/2008)Sun Jan 13 2008 00:00:00 GMT-0500 (Eastern Standard Time)
(1/2 2p)Fri Jan 02 2009 14:00:00 GMT-0500 (Eastern Standard Time)
( 2 )Wed Jul 29 2009 02:00:00 GMT-0400 (Eastern Daylight Time)
( 2 )Wed Jul 29 2009 02:00:00 GMT-0400 (Eastern Daylight Time)
(01-13-2008)Sun Jan 13 2008 00:00:00 GMT-0500 (Eastern Standard Time)
(1-2 2p)Fri Jan 02 2009 14:00:00 GMT-0500 (Eastern Standard Time)
(FAIL CASES:)null
()null
( )null
(24)null
(24 pm)null
(36:00)null
(1:60)null
(13/02)null
(2008/13/02)null

Thursday, June 25, 2009

Gmail and Google Reader shortcuts


Being the keyboard junkie that I am I'm always looking for a way to keep my hands off the mouse and navigate using my keyboard.

@shanselman just posted a cool shortcut for gmail '?'. Read that as shift + '/'. This shows the all the gmail keyboard shortcuts. It also works in reader. Maybe I'll finally be able to keep up with my Google Reader now!

Thursday, June 18, 2009

Javascript to get query params from url

This is one of those things that comes up from time to time that I always forget...

If you need some javascript to parse your url query parameters here it is:
var str="http://www.google.com?q=blah&vv=ha&test&nah=yeah"; // window.location.href
var regex = /[?&]([^=&]*)(?:=([^&]*))?/g;
var res, params = {};
while ((res = regex.exec(str)) != null)
{
params[res[1]] = res[2] || "n/a";
}

for (a in params)
{
document.write(a + "=" + params[a] + "<br/>");
}

results in:
q=blah
vv=ha
test=n/a
nah=yeah

Note I stuck n/a into the empty query parameters. You can do whatever you like. Also, don't use for in loops you can run into all types of issues.

Wednesday, May 6, 2009

Vista Defrag Tool

I am trying to dual boot my Vista pc with Windows 7, but when I went to shrink my vista partition it said that I couldn't shrink it even 1 MB!!! What's the deal? I have over 80 GB of free space. It's been awhile since I defragged, so I'm hoping that's my problem.

So I went to use the defrag tool and found this new POS that just has a defrag button. I pressed the button and that was over 4 hours ago. Granted it said this may take a few minutes or a few hours, but really? And to top it all off there's no indication as to when it's going to finish or how fragmented my drive is!

So now at the risk of slowing my defrag down by using my pc I'm writing this post (mostly as a reminder to myself) about some command line defrag options that I'm hoping will make this experience better next time.

These all came from this site.

What I really wanted to do was open my cmd window as an admin and run:

defrag c: -a

to get the status of the drive. I'm sure it was bad if it's taking this long, but it would have been nice to know how bad.

I'm hoping that this command will pump some real status info out... I haven't tried it yet

defrag c: -v

I'll post back more if I find anything else interesting.

UPDATE: So the Vista defrag didn't help at all. It ran 8 hours, but the disk management tool still didn't let me create a partition. I did some more searching and found out that it's the MFT blocks that were my problem. I found two other cool free tools that are faster for defrag. First one is from Sysinternals Contig. This is a command line tool, but it also has a ui tool that you can use called Power Defragmenter. The ui isn't really any good, but it saves you from having to learn the options. Another tool more similar to the old Windows defrag tool is Auslogics Disk Defrag. It gives you a nice visualization of the blocks on disk.

Even with those two great tools it still didn't allow me to partition my drive. So, I went with Perfect Disk 10 which you can purchase for $30 (and there's a 30 free trial). This tool is still running on my pc, but it is shifting and organizing all the blocks on my disk into one group. It's not done, but I can already tell you that I am able to finally partition my drive. Hopefully the Win7 install will be much easier!

The complete article that I finally ended up using is Working Around Windows Vista's "Shrink Volume" Inadequacy Problems from the how to geek. The article's not great and nothing from it worked until I got to Perfect Disk, but I did use the steps (the early steps may have helped).

Friday, April 10, 2009

Enable ignore spaces for Team Foundation Server (TFS)

I was a big fan of windiff back in the pre VS 2003 days. When I got the new diff tool with Team Foundation Server and VS 2005 & 8 I though it was pretty good... Until I realized that there were no configuration items on the UI. I loved the ignore spaces option, so I didn't have to see lines that were spaced differently. Today I found a great post on the command line options for TF.exe (the TFS command line tool). Real TFS Command Line Help One of the options is to ignorespace. There's also an ignoreeol.

Just set these settings in the Configure Tool as show in the pic above.
Extensions: .*
Operation: Compare
Command: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\diffmerge.exe
Arguments: %1 %2 /ignorespace /ignoreeol

Tuesday, March 10, 2009

js regexp to remove a tags from string

If you need to replace a bunch of <a> tags in your page with the innerText you can use replace with regular expressions.
"<a href=.....>Some Text</a>".replace(/<a[^>]*>([^<]*)<\/a>/gi, "$1");
I had to use this for generating a printer friendly version of a page.

Sunday, September 28, 2008

jQuery to be a Standard Visual Studio library

It appears that the ASP.Net team has decided to pull in jQuery instead of reinventing the wheel. It will start shipping with future versions of Visual Studio. They are claiming that this is a good supplement to the existing ASP.Net AJAX and Control Toolkit, but I'd say this invalidates a large portion of what used to be Atlas. I wonder if they will start dropping the Atlas way to start going with jQuery. I'd say this is a great move by MS. They were far behind jQuery in terms of development and usage. Lead, Follow, or Get Out of the Way!

The Scotts posted on this here and here, and here's an opinion from the jQuery side.

Sunday, September 21, 2008

Gmail https

I was finally talked into turning on https for gmail (and notifier). I had tried this in the past, but it broke notifier and I didn't really think it was that important because I didn't care if people read my email on the wire. The one thing that turned me was having someone insert a reference to an image or something on googles server which would in turn return my session cookie to the user. (This wouldn't happen if I actually logged out of my email when I close it, but I never do.) With the session cookie they would be allowed to login to my account and change things. So now I've switched.

Here's some info on the setting and how to update notifier to work over https.

http://mail.google.com/support/bin/answer.py?answer=74765&cbid=46z5rrnkqlck&src=cb&lev=answer

REST in WCF Blog Series

Rob Bagby wrote a great series on REST with WCF. This should give me what I need to get ExtJS working with WCF.

Wednesday, August 20, 2008

Batch file goodness

I have to do this just frequently enough that I always forget when it comes time to do it again.

changing a bunch of file extensions: ren *.old *.bak
for loop:
for %a in (*.js) do ECHO %a is a javascript file


for more advanced moves use xmove from codeproject.com

Sunday, May 18, 2008

Great Article on JSON WCF Services in ASP.Net AJAX

This isn't the newest article, but it still gives a great basic description of using WCF from ASP.Net AJAX.

http://dotnetslackers.com/articles/ajax/JSON-EnabledWCFServicesInASPNET35.aspx#575 (Dino)

Thursday, April 3, 2008

SessionState Links

I just found some great links on scaling SessionState, so I decided to post them so I could find them later.

It all started with Scott Hanselman's:
-> Troubleshooting Expired ASP.NET Session State and Your Options

And that led to a great series by Maarten Balliauw
-> ASP.NET load balancing and ASP.NET state server (aspnet_state)
-> ASP.NET Session State Partitioning
-> ASP.NET Session State Partitioning using State Server Load Balancing

Wednesday, February 27, 2008

AJAX ASP.Net Calendar style

Here's a follow up to the my last post. Just showing a completed calendar and the code to implement it.

As you can see the style I chose was to just add a black background with white text when the day % 3 == 0.



Here's the code I used to creat it. The asp above this is just a basic ajax asp.net page with a textbox and a CalendarExtender.

Wednesday, February 20, 2008

Javascript is just a hashtable...

I'm still new to AJAX and JavaScript. I've been developing using static languages (C#, C++, and Java) for several years now, but I finally had to break into ASP.Net AJAX and javascript for a web app at work.

The first thing to remember about javascript is that it's just a hashtable. If you are using some 3rd party javascript control library AJAXControlToolkit and you don't like some behavior... overwrite it! That's right, all a method is is an entry in a hashtable.

We ran into a case at work where we had to modify the Calendar styling to display different color styles to different dates on the calendar when it popped up. For example all weekdays needed to have a yellow background. Unfortunatelly the calendar doesn't provide a hook to style random dates different ways. So I went and dug through CalendarBehavior.js which comes as part of the AjaxControlToolkit, and found that the calendar sets the style for each date using a method named _getCssClass. That is part of:

AjaxControlToolkit.CalendarBehavior.prototype = {
[...]
_getCssClass : function(date, part) {
/// <summary>
/// Gets the cssClass to apply to a cell based on a supplied date
/// </summary>
/// <param type="Date" name="date">The date to match</param>
/// <param type="String" name="part">The most significant part of the date to test</param>
/// <returns type="String">

if (this._isSelected(date, part)) {
return "ajax__calendar_active";
} else if (this._isOther(date, part)) {
return "ajax__calendar_other";
} else {
return "";
}
}
[...]
}

For those of you that don't know the prototype is basically the class definition, so all objects of the CalendarBehavior type that get created will have all elements (functions and variables) defined in the prototype.

So now that we've found the method we just need to overwrite in on client side. Here you have two options.

  1. You can overwrite the prototype and all Calendars on the page will used this updated version.

  2. Or you can update the mehtod for a specific instance.

Either way you need to register with AJAX for the onload event.
Sys.Application.add_load(InitCalendars);

Then create the InitCalendars function and set _getCssClass to your new implementation.

function InitCalendars()
{
AjaxControlToolkit.CalendarBehavior.prototype._getCssClass =
function(date, part) {
[Your updated code here]
}
}

Your othe option is basically the same except you can find the control you want to modify the code for by assigning a BehaviorID to the control. Then you can do the following in the InitCalendars function

$find('the behavior id you assigned')._getCssClass =
function(date, part) {
[Your updated code here]
}

So what's wrong with this approach
Well this isn't perfect. The "_" in front of the function name usually means that this is an internal piece of code not meant for outside use. This means that the function name may change or it may be removed without braking the "interface" of the prototype. You could verify that _getCssClass equals something in testing so some sort of notice will occur if the method changes or gets removed from use. That's all I have to say 'bout that...

I hope someone finds this useful. Let me know if you have a better way.

Verizon Wireless Service

If you're like me, which most people are based on the number of Verizon hate sites out there, then you've had your fair share of run-ins with bad Verizon support. My first instance was after I got my first bill and they gave me a prorated number of minutes for the month without telling me. Oh btw my favorite customer no service issue out there is .oo2 cent issue from the http://verizonmath.blogspot.com/. It's worth at least listening to the first few minutes to hear how clueless some reps can be.

I didn't write this knock Verizon. I've been a customer for 4 years now because they have the most reliable cell service. I used to travel all over the US and their coverage always beat my friends coverage. I've always dreaded using their customer service though. Two days ago I called to complain about my year old Moto Krzr (btw don't buy this phone!!! you've been warned) which after a full nights charge would die after 14.5 minutes of talk time. The automated system said they had extended waits, but I got through with less that 2 minutes of wait time. And when I told the rep the problem he said "ok, I'll send out a new battery... it should get there in two days." I was shocked at how easy this was. No mention of me paying or jumping through hoops. I just wanted to make sure that I got at least one positive Verizon post on the web... :)

My new Dell XPS M1530

As a lot of tech people I'm pretty particular about what type of computer I use. I've given up going to the store because they never have the computer I want with the features think I need. That along with the fact that I get a pretty good discount through Dell's EPP program makes my choice a no brainer.

I get the computer I want at a decent price. I started off looking at the d830 which is the business line performance notebook. I figured that the latitude line may be a little more reliable since businesses usually use it. After looking around a little I found that I was getting a better deal with the XPS line. I got nearly $1000 off list price.


The key benefits were:


  1. Its default configuration came with more memory @ 3 gb (saving me from having to purchase 2 gb of ram from crucials online site.

  2. It came with Photoshop Elements and Premiere (Isn't it funny how so many tech people have a photography hobby?)

  3. It had an identical processor (Intel Core 2 Duo T7500 2.20ghz) That seemed like value point for the processors.

  4. A larger hard drive with the free fall sensor and 7200 rpm. 200 gb

  5. It also had the video card I wanted the NVIDIA GeForce 8600M GT 256 gb

  6. I was able to get Vista Ultimate for $50. The verdict is still out on this. I like the OS, but it's no where near as stable as even a young Windows XP. I do think that some of this is due to 3rd party software not running as stable. My most recent BSOD, yeah I've had 4 in less than a month, was caused by my AVG free anti-virus.

  7. I also upgraded my battery to the 9 cell. This seems like a no brainer, but I didn't realize that it was going to stick out from the bottom of the PC.

  8. The thing that really limited me to the d830 and the 1530 was my screen and resolution requirements. Have to have the 1680 x 1050 and 15.4 inch screen. This tends to eliminate a lot of other options even outside of Dell. I did look at some lenovo's and HP's, but their cost far exceeded that of the Dell. And I have 3 year in home service, so I'm not too worried.

  9. These didn't make me buy it, but it was nice that it comes with a remote, noise cancelling ear buds, and it looks nice also.

I read a lot about the pc before I got it. I wasn't worried about complaints of a loud cd/dvd drive (It's not that loud). The computer definitely gets hot on your lap. Years ago I once asked a dell support person why they call it a laptop if it can't be used on your lap. I was quickly corrected... These are "notebooks". Yes it does get hot. I also prefer the different inputs to be on the back of the laptop, but I've found the side access okay for my usb mouse and the power cord.

Overall I think the only regret may be getting Vista. SP1 should be out any day now, but I don't think Vista will be able to compete with XPs stability.

If it means anything to you my Vista Windows Experience Index is a 4.8 which is pretty good for today's computers

Friday, December 21, 2007

IE ToolBar & AjaxView

Okay, I know that this is old news, but I'm just now finding out about it... IE has a development toolbar from Microsoft. I got to try this out today on IE7 and it seems to work very well. It is quick enough that it will definitely be my preferred way of viewing page source code. I sure could have used this a couple weeks ago when I was debugging multiple scroll bars!

I also just found out about AjaxView, from MS Research. This looks like a useful tool for monitoring traffic and performance of your Ajax/javascript pages. I have not tried it yet, but I'm looking forward to it.

Hope you can find some use for these tools.

P.S. I have not used the FireFox development toolbar, but have heard that it's better.