I found this on Stack Exchange. Brilliant!
Thursday, August 9, 2018
Tuesday, July 24, 2018
Try Catches are not necessary for logging exceptions
I support a large system where there are try catches everywhere to log the exception. See my post Simple and secure exception handling for .NET web applications for a better way. I found an instance where instead of just removing the (unnecessary) try catch, I simply removed the line that logged the error and then threw the exception expecting the Application_Error event to log. Unfortunately, the stack trace that was logged only indicated the line number of the Throw statement and not where the error actually occurred! The lesson is, if you use a try catch, then log it right there. If not, just get rid of the try catch completely.
Thursday, July 19, 2018
Remove TFS source control from a .NET solution
Sometimes, you want to remove all TFS source control bindings from a solution. This is helpful if you are moving the solution to a different TFS project or you want to use a different source control product.
First remove the .vssscc file from the solution folder, and the .vspscc file in each individual project folder.
Then, open up the solution file in Notepad. Remove the following section completely:
First remove the .vssscc file from the solution folder, and the .vspscc file in each individual project folder.
Then, open up the solution file in Notepad. Remove the following section completely:
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {########-####-####-####-############}
SccTeamFoundationServer = https://tfs.yourdomain.com/tfs/my_collection
SccLocalPath0 = .
SccProjectUniqueName1 = MyProject\\MyProject.vbproj
SccProjectName1 = MySolution
SccLocalPath1 = MySolution
EndGlobalSection
Thursday, July 12, 2018
Add an Alpha Channel to GIMP Images to support transparency
A common task when using GIMP, is to remove the background of an image and make it transparent. Use the fuzzy select tool to select the background. An image must have something called an "alpha channel" in order to support transparency. If the image already has an alpha channel, pressing the delete button will make the background transparent. If it doesn't, pressing delete will do nothing while your frustration mounts. Simply, select Transparency in the Layer menu and choose Add Alpha Channel.
Thursday, September 21, 2017
Git cloning
A previous post described how to create a repository for the first time. If your repository has been pushed to a remote repository, such as on Assembla, you will need to clone the repository to pull it down to your local PC. This is pretty simple (at least with Assembla).
Notice, that I typed http instead of https. If you choose https, you have to do some additional configuration with a certificate, that can get a little hairy. I have found that for my purposes I don't need the encryption of https.
- If you don't already have a folder where you keep all your git projects, the create one.
- Open up Git Bash.
- cd to the folder (using double slashes) like so:
cd c:\\gitprojects
- Sign into the Assembla site.
- Select your git project.
- Choose the Git menu option.
- In the upper right corner, you'll see a drop down arrow next to the word Clone.
- Clicking on the drop down will reveal a box with three options.
- Choose HTTPS, and copy the URL that appears in the box.
Then, back in Git Bash, type:
git clone http://git.assembla.com/NAMEOFPROJECT.git
Notice, that I typed http instead of https. If you choose https, you have to do some additional configuration with a certificate, that can get a little hairy. I have found that for my purposes I don't need the encryption of https.
Thursday, July 27, 2017
Potentiometers Explained
A potentiometer or "pot" has three terminals. There are two different configurations for two different users.
- Variable Resistor. If only an end terminal and the middle terminal are used, then the pot acts as a resistor that can very from 0 resistance to the resistance rating of the pot.
- Voltage Divider. If and end terminal is connected to a power source, and the other end terminal is connected to ground, then the middle terminal will vary the voltage from the full voltage from the power source down to 0.
A pot can be thought as containing two resistors (R1 and R2) with the middle terminal between the two. As the knob is turned, R1 increases resistance while R2 decreases resistance. All voltage divider circuits work this way whether they use a pot or not. The equation to determine the output voltage is illustrated below.
Monday, July 10, 2017
Sign in as a different user in SharePoint 2013
Microsoft took away the menu option to Sign in as a different user. This was invaluable to test sites to make sure everything looked right for different users or to test access. There are a couple of ways you can still do this. You can append this to the site address:
/_layouts/closeConnection.aspx?loginasanotheruser=true
Or you can hold down shift while right clicking the Internet Explorer option. Then choose Run as different user. Then navigate to the site.
/_layouts/closeConnection.aspx?loginasanotheruser=true
Or you can hold down shift while right clicking the Internet Explorer option. Then choose Run as different user. Then navigate to the site.
Subscribe to:
Comments (Atom)
