Posts

Showing posts from 2009

Running an application as a domain user when you are not a member of that domain ...

I have the privilege to be able to bring my laptop to work instead of using the computers provided by my customer. This grants me better hardware and less frustration, and thus I am a happier consultant. Issues arise, however, when I need to access shared resources. My client, for example, uses Integrated Security when accessing its SQL Server instances. Earlier consultants have solved this by accessing the SQL Server instances through a Virtual PC that is a member of the domain. This is a different approach: Start - Run - CMD: runas /env /netonly /user: domain \ user application Faked example: runas /env /netonly /user:EXAMPLE\BENNY "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe" This could easily be turned into shortcuts: - One to start an arbitrary application as your domain user - One specific for each application, ex. the above one for your SQL Server Management Console

Infragistics.Win.ToolTip - determining whether or not the close button was clicked

Infragistics offers a nice-looking desktop alert control (more info here ). However, it is slightly lacking in terms of functionality, namely the ability to notify us when the close button was clicked, i.e. when the user is not interested in this particular announcement for whatever reason. Wanted: An event: DesktopAlertCloseButtonClicked. ... but since it's missing, here's how you do it: private Rectangle desktopAlertCloseRect; ... desktopAlert.DesktopAlertClosed += desktopAlert_DesktopAlertClosed; desktopAlertCloseRect = new Rectangle(   Screen.PrimaryScreen.Bounds.Width - 19,   Screen.PrimaryScreen.Bounds.Height - 110,   17, 17 ); ... private void desktopAlert_DesktopAlertClosed(object sender, DesktopAlertClosedEventArgs e) {   if(desktopAlertCloseRect.Contains(Cursor.Position))     //Close button was clicked } To resolve whether or not the alert closed due to the user clicking your link, simply attach an event handler to DesktopAlertLinkClicked where y

Managed Extensibility Framework

I'd say it took me about an hour to implement MEF, and then I spent most of it making my loadable modules look good in my form (I'm not an Art Designer...). Verdict: Love. A colleague and I are writing a Business Administration Application that will be shipped with one piece of functionality, but that we expect will grow over time. Thusly, I have converted it from a Main-Form-with-a-Child-Form piece of work (very tightly coupled) to a ... Main-form-that-can-load-"any"-module-into-its-UI solution. Changes: Added a reference to System.ComponentModel.Composition to my project Created a new Class Library ("Modules") with a single interface: "IModule" Referenced my Class Library project from my main project Revamped the Main(string[]) code:   Application.EnableVisualStyles();   Application.SetCompatibleTextRenderingDefault(false);   var mainForm = new ApplicationWindow();   var container = new CompositionContainer(new DirectoryCatalog(&qu

The danger in ALMOST working [agile|any methodology]

If you are to endaveour on a journey from a, say, waterfall-style project model to an agile one, it's EXTREMELY IMPORTANT that the people in your team - even if you have a big team - are with you on that journey. If not, individual team members can easilly just take the terms - "agile" - for example, apply their own logic and then presume that everyone else view the world like they do. Practical example: Today, a colleague of mine was working on a sprint backlog item when his project manager rushed in, saying "stop what you're doing! I have a production issue that you have to take care of". Said and done, my colleague dropped what he was doing and started working on the production issue. Moments later, a tester from anothter team came rushing to my colleague, and told him to help the tester with an issue; it was extremely important! My colleague, trying to follow scrum practices, asked the tester to talk to the project manager, so that they could weigh

An existing connection was forcibly closed by the remote host

... can be caused by the fact that your WCF service cannot receive more connections at the moment. As a default, a WCF service can receive 10 concurrent (session based) requests. If you are writing an internal WCF service (intranet, not internet) that has more than 10 constant consumers (consumers-with-a-session), you need to configure it accordingly: In system.serviceModel, add: <behaviors> <serviceBehaviors> <behavior name="ThrottleBehavior"> <serviceThrottling maxConcurrentCalls="6" maxConcurrentInstances="200" maxConcurrentSessions="200"/> </behavior> </serviceBehaviors> </behaviors> ... where maxConcurrentInstances/maxConcurrentSessions are the expected number of clients and maxConcurrentCalls are clients/100. On your service, add the attribute: behaviorConfiguration="ThrottleBehavior" I hope this saves you 6 hour

Evernote - my GTD tool

Evernote has been featured before in several Lifehacker articles. This is my take on it. I started using Evernote as a centralized way of storing my time reports (I'm a consultant). By using Evernote, I could easilly review and edit my time reports regardless of where I were. I previously used Google Notebook for this, but I have always liked the idea of a installed client application, why Evernote suited me so much better. As time progressed, I found more and more ways to utilize Evernote. Today, I use it as my master Inbox, my scribble pad, link collection, screen shot generator and, of course, my time report management. To support this, I have mapped my Insert key to capture selection from any program (Tools - Options - Clipper - Global Clip Selection Hot key - Custom hot key). This makes sure I don't overwrite text when I code (I never liked that insert key ...) and also serves as a dedicated "save this for later" key. Thusly, whenever I surf, read mail, co