Archive for the ‘Uncategorized’ Category
You can always use or misuse or overuse Shakespeare to make a point. Hopefully this is an example of “use” and not “misuse”. 🙂
Somewhere on this blog I posted about using “var” in C# (“var” is a pronoun). In it I said you should only use it when it was obvious what the data type is. Well, I’ve changed my mind. What can I say? Times change, people evolve, live with it.
I now use “var” all of the time. I rarely, if ever, don’t use it. If I am declaring a variable and setting it to null then I will explicitly name the data type, otherwise it’s “var”.
Why the change? The first thing that led to it was some study of F#, which does implicit typing all the time. Even if you don’t assign a value to a new variable the compiler will still figure out what the type is based on what you do with it later in your program. Very nice.
But back to the point. So, studying a functional language that has implicit typing and seeing the advantages of that was the first reason. The second reason was laziness. The third and (for me) most important reason was that I really wasn’t gaining anything by explicitly naming the types. Honest, in the years that I’ve been using “var” I have never had a problem figuring out a bug or how to modify some existing code because I used “var”. So why would I not use it? The fourth and final reason was that I can change the type of something and not need to change assignment statements. E.g., var myVar = SomeMethod(); If SomeMethod returns a bool and I change it to return a string – I don’t need to change that assignment statement.
If you need a deeper analysis of this then read Eric Lippert’s excellent article: Uses and misuses of implicit typing. Or just start using “var” and see for yourself if it ever causes a problem.
A couple of weeks ago I made some changes to my computer to speed it up. The usual stuff like fixing up the Registry, defragmenting the disks, etc. The machine did speed up but not as much as I wanted.
So, I went further and turned off some of the Win7 graphics features and turned off some services.
Turning off graphics features is not a big deal but the services … well you have to be careful with those, as I found out.
In the week following my tuning I noticed that I couldn’t open Windows Explorer from the “Action” menu of a SharePoint site. Now what would that have to do with a local service?
Turns out that the “WebClient” service is needed. I turned it back on and the SharePoint “Open with Windows Explorer” menu item works again.
Who’d a thunk?
I’ve seen it on tons of sites. You click the button, it becomes disabled and the page posts. The disabling is so you don’t go clicking it multiple times while waiting for the server processing to complete.
It’s all over the place, so it must be simple right?
Well, actually, once you find out how to do it, yes it is simple, but getting there? What a pain.
I foolishly thought I could just add another even handler for the button click using jQuery. Nope. Although jQuery adds the event handler rather than replacing existing event handlers, the action of disabling the button seems to kill the ASP.NET postback script.
Well, of course, I should be using the “OnClientClick” property of the asp:Button control. No problem. Nope. That doesn’t work either. It overwrites the ASP.NET postback script.
This is ridiculous. So it’s time to start asking Google. The first few results tell me to add the ASP.NET postback script in server code and other real complex solutions. These just seemed way too complex to me. I have a rule of thumb that I follow at times like this: “If it’s getting more complex you’re going in the wrong direction.”
So I hunted some more and sure enough here is the simple answer: Disable a button control during postback.
Totally simple but what a pain to discover.
I tweaked it and varied it and found other ways to do it and they all worked in IE and they all failed in Firefox. With no explanation, no error message, no nothing. It just silently failed.
And then today I had to write something to make a set of checkboxes uncheck if the user checked the “None of the above” checkbox and uncheck the “None of the above” checkbox if they checked any of the others. And it worked easily with minimal debugging (basically some typos on my part).
So, I will state unequivocally that jQuery rocks and I love it.
Online versions of Microsoft Word, Excel, PowerPoint and OneNote are now available for free.
Go to Windows Live and sign up. You can use any email account you want, it doesn’t have to be Hotmail. Once you have signed up you will see a menu at the top of the page and one of the items is “Office”. Click it and you go to the Office home page where you see a list of your recently edited docs and to the right you see “Create a new online document” with icons for Word, Excel, PowerPoint and OneNote.
So far I’ve tried out Word, Excel and OneNote. They are limited versions of the full-blown desktop software, but they have all the basic features you use the most.
If you want a local copy of your work, you can click on the “File” tab and there is a download option. (With OneNote you have to click “File > Properties” and then find the “Download” link on the menu on the Properties page. Why they did it that way is anyone’s guess.)
Usage is supported by advertising, so it’s not really free, but free enough I think.
You have 25 Gig of space for your docs, so you shouldn’t run out of room anytime soon.
So, now you can get started on that novel you’ve been meaning to write without spending a dime on a fancy new word processor.
When your password is about to expire on a remote network which you access via remote desktop then how do you change your password?
Easy just press Ctrl-Alt-Del and the Windows Security screen (“Lock this computer/Switch User/ … /Change a password/…”) comes up.
Errr, well, actually, no it doesn’t. The screen for your local computer comes up, not the screen on the remote computer.
So what now? Do you just quietly sob? Do you scream at the remote desktop machine and throw things at your monitor?
Never fear. All is not lost. Try “Ctrl-Alt-End” and, surprise, surprise, the screen you want on the remote machine appears and you can now change your pesky password.
For info on more keyboard shortcuts while in a Remote Desktop session: Remote Desktop Tips and Tricks
You’d think this would be simple because it’s something people have had to do for a long time.
My situation is this: I maintain an old system that is part VB6 and part .NET but the VB6 IDE does not run on Vista or Win7 (unless you have hardware virtualization and can use XP Mode), so I have a Windows XP virtual machine that I use. It works great, but domain policy of the client requires a password change every 30 days. This would be no big deal if I was in their office, but I’m not, so I had to figure out some way of synching up the domain credentials on the remote computer with those on the client’s network so that things like connecting up to the CVS repository (yes, they still use it) would work.
I Googled and Binged it but only found incomplete “solutions” or way complicated “solutions”.
The simplest solution was “lock the computer, then unlock and you’ll be asked for the new credentials” – didn’t work. But after trying a couple of things I figured out something that did work and forced the “lock the computer” solution to work: I mapped a network drive, using my new credentials and after a few seconds I got one of those XP balloon messages telling me that I needed to lock the computer and then log in with the new password. So I did and it worked.
So the real solution (at least on Windows XP) is:
Connect up to a network resource using the new credentials and after a few minutes Windows will ask you to lock your computer and log in using the new credentials.
I don’t remain connected to network resources on the VM, but maybe if I did, that would also force the synch. If you remain connected to network resources then please tell me if that also works.
I hope that helps.