Thursday, August 30, 2007

ASP.net Membership, Roles and Profile

I'm finally playing with the membership part of asp.net - works great, but i may need to develop it w/o using any kind of database - preferably all in plain XML files. It should be fairly easy, since it's all done using the provider model.
Here is a great resource - links all info in one.
4 guys from rolla did a great job as they always do - this part even has a section of code that i may use (still need to build on it though).

Update: CodePlex has complete example on the XmlProvider implementation, which includes Profiles, Memberships and Roles.

Thursday, August 23, 2007

Running Access 2003 and 2007 on the same system

I'm running 2003/2007 office on the same system (Vista) and every time i was switching between versions, i got that stupid install dialog. Well, here is the solution.
In short, run this:

reg add HKCU\Software\Microsoft\Office\11.0\Access\Options /v NoReReg /t REG_DWORD /d 1

reg add HKCU\Software\Microsoft\Office\12.0\Access\Options /v NoReReg /t REG_DWORD /d 1

More information is in this KB article.

Friday, August 17, 2007

Getting current / calling method info (C#)

Getting current method:
System.Reflection.MethodBase.GetCurrentMethod()

Getting calling method:
System.Diagnostics.StackTrace st =
new System.Diagnostics.StackTrace(false);


System.Diagnostics.StackFrame sf =
st.GetFrame(1); // previous method

return sf.GetMethod();

Wednesday, August 15, 2007

Calling WebService from VBA

Instead of struggling with writing the code yourself, use Microsoft Office 2003 Web Services Toolkit 2.01. It generates the proxy for you - nice and easy.

Open linked report in new window

Unfortunately, there's no simple way to open linked-report in new browser window. The work-around is to use the URL link, rather than report, however that has couple of issues. (a) you have to specify the location, which is a problem if you have dev/test/live environments (basically you have modify the report for each). (b) passing parameters is possible, but can be tricky in case you're passing complex texts.

Here is detailed solution.

In short:

Non-parameterized Solution
="javascript:void(window.open('http://servername
/ReportServer?%2freportFolder%2freportName&rs:Command=Render'))"



Parameterized Solution
="javascript:void(window.open('http://servername
/ReportServer?
%2freportFolder%2freportName&rs:Command=Render
&MyParam1=" & Fields!MyField.Value & "'))"

Couple things to know:

1) Notice that you have to use "http://server/
ReportServer" and NOT the "http://server/Reports" link!

2) In case your "reportFolder" and "reportName" contain spaces, either leave them there or replace them with "+" (e.g. "My Report" -> "My+Report").

3) Notice the "
&" in parametrized solution - it's safer to use than "+", because it will force string conversion on the parameter value.

4) There are more parameters you can use to modify the way the report is presented. Nice description is in this MSDN article.

Tuesday, August 14, 2007

TFS Evaluation - thoughts

I've spent last couple of days evaluating TFS along with the Team Suite version of studio. Luckily, as a trainer, i have access to the MOC 2631 course, so I was able to actually test the stuff rather than just reading about it.

Prior to this, i've evaluated SourceSafe 2005 as well as Perforce - needless to say, SS doesn't match PF by any means. PF intergrates with VS quite nicely - it may not be as smooth as TFS (especially when it comes to solutions/projects), but still good enough to keep developer happy.

For testing, i evaluated NUnit. TFS offers much more that that though (code-coverage tests, load tests, etc.).

Here are couple of my thoughts:
1) TFS server is running for about $2700 if i'm not mistaken. The real killer is VS Team Edition. If you combine that with "Visual Studio Team Suite with MSDN Premium", you're looking at almost $20,000! Ouch. Compare that to "Visual Studio Professional Edition with MSDN Professional" for $2000... It already includes license for SS! Perforce is kind of pricey as well - $750 per user.

2) What i really like about VS-TS is the integration of work-items with everything (code changes, artifacts, builds, etc.) User logs a bug, you fix it in "myobject.cs" and when you check-in the file, you just link it with the bug work-item. This really kicks a$$.

3) I haven't had a chance to do a research on UI tools for work-items though. I hope there's something that would allow regular users to add/view work-items - and I sure hope it won't require CAL for each user!

4) Documentation. We all hate it, avoid it, fake it... I've tested couple of the diagramming tools in VS-TS and I have to say i was pleasantly surprised. As an architect, I can quickly draw top-level diagram, drill down to application diagram, code-generate from that to give it to the developers. Nothing impressive yet - get this, it propagates changes in the lower-level diagrams back to the upper level ones! Still need to play with this in some real-life scenarios, but so far very impressive.

5) Policies. Oh developers are gonna hate me now - I can actually FORCE them to TEST before they submit changes back to repository.

6) SharePoint site - i'm still kind of undecided on this one. I like the idea of sharing documents in SP for each project, having them version-controlled, etc. I just don't like SP and then I'm worried about maintenance...

Final words - so far, I'm inclining towards the TFS. Yes, it's very expensive, but if you need to put process around your app development and actually have a tool that helps, i think this is the way to go. Can you do all the stuff without it? Certainly yes, but expect to pay for some of the tools (Perforce, etc.) and don't expect them to communicate as seamlessly as TFS...

This FAQ may have some questions for you as well, plus many TFS links...

Thursday, August 09, 2007

Windows Explorer has stopped working - Vista error

After about a month of being happy with Vista, i ran into this message. It all started by Vista not being able to restore from hibernation. Then, when it attempted to start normally, after log on two messages kept coming up with "Windows Eplorer has stopped working" and that Vista is restarting it... over and over... After skimming through web and basically not finding a resolution, this is what I did:

1) Restarted Vista in Safe Mode - didn't do any good - the error appeared even there.

2) Restarted Vista in Safe Mode with Command Prompt
- there i ran "MSCONFIG" and:
a) Disabled all non-microsoft services
b) Disabled all start-up programs
c) Disabled UAC (some posts on web suggested that it might be the cause of problems)

After restart, the issue was still present. So back to the Safe Mode with Command Prompt:
d) open the Event Viewer (you'll find it in the Tools tab) and check application log. In my case, there was an error that windows can't read the file "C:\Users\...\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db".
e) run command (from Tools again), and rename the file (using "move") or even delete it.

Restart and all good! Vista will then show dialog that you modified the start-up options and whether you want to take your changes back to "Normal" - do so, restart again and you sould be back in business...