One of the things I had to work around in the last year is that the System.Console class is static -- I needed a non-static class I could pass around so I had to wrap System.Console in another class, it was dreadful. The problem is worse because .net doesn't have Interfaces for TextReader and TextWriter. I had to create those as well.
Making a class static or Singleton simply because you don't expect to ever need more than one is not a good idea; don't limit your options unnecessarily.
That's not the point. I want to pass a reference to something that implements ITextWriter, for example, I don't care that it just happens to be System.Console in this particular case. But .net doesn't allow me to do that easily for multiple reasons.
You need to start off small and work up to a large project. Open source projects are typically large scale broken down into manageable chunks, but for a beginner they're probably too advanced.
I started by making a weights and measures converter.
I then added on a recipe section so it was useful in the kitchen.
I then added an alarm system so I could use it as a kitchen timer.
I then made it more 'intelligent' by auto calculating start times of various parts of a meal and meat cooking times - so a Chicken dinner for example, I can just enter the weight of the chicken and it will tell me exacly how long it will take, alert me to put the roast potatoes in the oven, and when to put the carrots on... etc, etc
You see how a simple small conversion project grew in stages and helped me learn about most aspects of everyday programming over time.
Find something that you will find useful and break it down into little tasks. Slowly build each part, learning as you go. Because it's for you, and you will use it you will find it easier to stay on task and learn properly - IMO of course!
You don't need to join an open source project to improve your skills, you just need to practice, practice, and practice some more.
You can pick an open source project that interests you, download the code and then work on finding and fixing bugs, or writing enhancements to the project without being part of it. When you succeed at doing something productive with the project you can submit the updates you have made to members of the project and perhaps become an active member of the project going forward. The key is that in order to learn, you have to get into code and break things, understand why you broke it, and learn how to fix it properly. No one learns without breaking something. Cheers and good luck to you.
Hey all, is there a way to detect if ANY control is clicked inside a form? The MouseUp, -Down and so on events can only be set for the form itself, but as far as I have tested i out not for any controls that reside inside it - true? Is there another way? Cheers, Dennis
why not create a global control_enter method that all of your controls use?
this.button1.Enter += new System.EventHandler(this.Control_Enter);
this.textBox1.Enter += new System.EventHandler(this.Control_Enter);
this.listBox1.Enter += new System.EventHandler(this.Control_Enter);
privatevoid Control_Enter(object sender, EventArgs e)
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
--alright, the code below worked fine for a DirectX fullscreen app if I put ...SetForeGroundWindow(FindWindow("windowName"))...--
Hello all, I'm looking for a way to set the focus back to the last window that had it. For example I'm running a fullscreen app and I've got myForm always on top (topMost = true). But the window in the background shall have the focus back after I clicked once into myForm.
First, how do I figure out a windows' name? (Edit: not needed as I know the name) - If I put the windows' name I want to have the focus instead of "aspecificname" I get a runtime error as soon as the method is run.
The name of the window I want to have focus will always remain the same. Maybe somebody could help out,
I'm having some issues with reading an AD directory,
Each time i request the directory from AD i get the following catastrophic failure Later in the program i'm using a impersonation class.
When i disable this the code works otherwise it returns the catastrophic failure.
//string OU = "OU=Medewerkers,OU=Hogeschool Utrecht,DC=medewerkers,DC=ad,DC=hvu,DC=nl"; // AD LDAP medewerkers//dirEntry.AuthenticationType = AuthenticationTypes.Secure;string OU = "DC=medewerkers,DC=ad,DC=hvu,DC=nl"; // AD LDAP medewerkers
DirectoryEntry dirEntry = new DirectoryEntry("LDAP://" + OU);
DirectorySearcher dirSearcher = new DirectorySearcher(dirEntry);
dirSearcher.SearchScope = SearchScope.Subtree;
dirSearcher.Filter = "mail=" + user;// er wordt hier gefilterd op email adres
dirSearcher.PropertiesToLoad.Add("profilePath");// Reads AD profile and returns the profilePath i.e. \\mdw\dfs\profiles\benjamin.diepeveen
SearchResult sResult = dirSearcher.FindOne();// Returns catastrophic failure
This is my impersonation, when i disable this my code works but only for local users.
using (new Impersonator(txtGebruiker.Text, txtDomein.Text, txtPw.Text))
// this will attempt to change the directory to <directoryname>.old if you have proper acccessstring profile = GetProfilePath(txtProfiel.Text);
//Directory.Move(profile, profile + ".old");
txtLog.Text = "Profiel locatie\n" + profile + "is omgezet naar .old "; // displays the profile name in log
Any help / suggestions or hints on what i did wrong are
It is a little tough to read the code because it seems there is a big chunk missing. However, when I ran into this once before, the account that I was impersonating with had to have to ability to read the section of the Active Directory I was trying to get information from. In my case, I was originally trying to use a local service account, which won't work, because it does not have rights on AD. I had to create a service account in AD, give it read permissions (and deny lots of other stuff) then use it.
As I recall there are some API calls you can make to test if these protected calls are available to your application... basically testing if you have the proper rights. That might give you a graceful way to handle the situation.
As you suggested i'm going to start testing with a service account.
I've also created a function that now reads the Directory i'm requesting,
wich no longer results in the catastrophic failure,
Seems that was the problem tough now i get nullreference error.
But i'm moving in the right direction.
The impersanation does not work however, but i'm working on it.
I think this is not the right place to post this issue here. else, please help me to fix this issue
The issue is:
I'm using smtp4dev to send email alerts from TFS. I'm using Windows VIsta. In TFS administration Console->Email Alert Settings, I set SMTP server as localhost and Email from Address is my mail id. In Visual Studio 2010, Team->Project Alerts, I enabled "Anything is checked in" and gave another email id in Send to field. After my checkins, I didn't receive any email. smtp4Dev is visible in system tray.
In Event Viewer, I found the below Error,
TF53010: The following error has occurred in a Team Foundation component or extension: Date (UTC): 12/3/2012 6:07:33 AM Machine: MACHINE112 Application Domain: TfsJobAgent.exe Assembly: Microsoft.TeamFoundation.Framework.Server, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727 Service Host: Process Details: Process Name: TFSJobAgent Process Id: 2804 Thread Id: 6996 Account name: NT AUTHORITY\LOCAL SERVICE
Detailed Message: TF271001: An error occurred while attempting to send an e-mail notification to the following address: firstname.lastname@example.org. Further e-mail notification errors that occur within the next five minutes might not be logged. Verify that the e-mail notification settings are correct in the Team Foundation Administration Console. Exception Message: Failure sending mail. (type SmtpException)