welcome to my blog
The best place on the internet for random code!
www.therealgromer.com









Archive for the ‘Coding’ Category

Nov
15
    
Posted (Mike) in 2003 Server, BG Alert, Coding, General, Projects, Version Control on November-15-2007

Recently I had to reinstall 2003 on my server at home, which was home to my BG Alert SVN server. I vaguely remembered setting SVN up about a year ago, so I had to put my trust into Google. Unfortunately, there wasn’t one site that helped with the whole setup. Since I don’t want you to have to deal with that, I’ve put all the information here, in one post.

To get started, you will need to download subversion, the current version is 1.4.5. Make sure you select the setup.exe to download for the newest version as well.

Once you’ve downloaded and installed subversion on the server, create a directory for your repositories. This can be done in Windows Explorer or from the command prompts with the mkdir command (mkdir C:\repositories). You will also need to give the NT AUTHORITY\NetworkService account appropriate rights to the directory you create. If you forget to grant access, you might get denied when Read the rest of this entry »



Sep
06
    
Posted (Mike) in Coding, Linux, Neumont, SuSE on September-6-2007

When I first started using Linux (OpenSuSE 10.2), I spent a while trying to figure out how to share a folder on it with my Windows machine and vice versa. I found plenty of information through Google, but none of it was in one place. I figure it would be a great idea to put that information in one place for anyone else that wanted to set up a Samba share.

First thing you need to do is activate the Samba server on your Linux machine. It’s an easy process but you will need the root password. Open up YaST and click on Network Services in the left side. In the NetworkServices window, click on the Samba Server icon. You will now have the Samba Configuration window open and it should be on the Start Up tab:

YaST Samba Configuration Start Up Tab

You will want to select the way you want Samba server to boot up. I set mine to “During Boot” but you have the option to select “Manual.” You will also want to open the port in the firewall as well.

Next go to the Identity tab. You will want to enter in the workgroup your other computers are on. Mine were the default Windows “WORKGROUP.” You can also set it up to work on a Domain Controller, but I’m not 100% sure on how that works since I don’t run a DC in my house.

Samba Configuration Identity Tab

Once you’ve set your workgroup or domain, go to the “Shares” tab. You will be able to manage all the Samba shares here. To add a share, click the “Add” button and you’ll get the “New Share” window. Fill in the “Share Name” and the “Share Description” here. Also set the path to the directory you are sharing here. You are also able to set the share to read only here. This is also how you would share a printer.

YaST Samba Configuration Add Share

Once you’ve filled in all the new share information, clickt he OK button at the bottom right and you will come back to the Shares tab of the Samba Configuration window. Add any more shares that you want and then click the Finish button at the bottom right. It will save all the changes and you will then be able to open your shared folders from another computer:

Samba Shared Folder



Aug
25
    
Posted (Mike) in ASP.Net, BG Alert, C#, Coding on August-25-2007

I was getting this exception while finishing up the sign up page on BG Alert and I couldn’t figure out why it was doing it.  I was getting redirected after I was able to sign up.  I was getting my welcome email for my “new user,” but I was also getting an email about this error (the system sends me emails on any error for during this testing phase to help me fix bugs and issues).  I was even getting redirected, which is what threw me so much.  I was getting an error caused by the Response.Redirect, but it was still running.

Turns out that it was because the Response.Redirect was inside a try..catch block.  To fix this error, all you do is pull the Response.Redirect out of the try block or ignore the error.  Hope this helps some of you out!



Apr
27
    
Posted (Mike) in C#, Coding on April-27-2007

If any of you code in Visual Studio 2005, you might have seen this exception thrown before.

Loader Lock Detected

It can be really frustrating if you don’t have the answer. Let me take that stress away. All you need to do is press Ctrl + Alt + E and you will get this window:

Exceptions Window

Expand Managed Debugging Assistants and then scroll down until you see the LoaderLock checkbox. All you need to do is uncheck it.

Loader Lock Checkbox

Hit Okay and you won’t see this problem in this current project again. It will come back in other projects though. I’ve heard there are registry hacks to fix this, but I have yet to try. If anyone has, please comment on the success of it!



Apr
27
    
Posted (Mike) in C#, Coding on April-27-2007

If you are a programmer, I’m sure you have used try/catch blocks in your code to hopefully eliminate any dreadful unhandled exceptions. We all know they usually happen only when giving a presentation and that’s no good! You could go by throwing generic exceptions all day long…

  1. throw new Exception(“Hey, you broke my program :(”);

That’s a bit generic though. This is where custom exceptions come in. It’s more intuitive and much less generic than throwing Exception() every time. It will also give you better control over choosing what to do when any exception is thrown. Instead of having one catch block, you’ll have the catch blocks for your custom exceptions with the generic Exception() last to catch anything that got past.

First thing you’ll need to do is create a Windows Library project. I named mine CustomExceptions.

Create project window.

When the new project is open, you’ll have a file called Class1.cs which you can rename to the name of the exception you are going to create. When you do this, you will see a window like this:

Rename file popup.

Just click the Yes button and your class name will change throughout your project. Now we’re ready to do the actual coding. When creating custom exceptions, we must extend the ApplicationException class.

  1. public class IllegalInputException : ApplicationException
  2. {
  3. }

Now we need to create the instance variables to be used in your exception. We’ll need one for the severity level, one for the log level, one for the inner exception and one for the message.

  1. private int severityLevelOfException;
  2. private int logLevelOfException;
  3. private Exception innerException;
  4. private string customMessage;

The severity and log levels allow you to give a bit more information about the type and severity of the exception you are throwing. If your exception was caused by another exception, it will store the original exception data as the inner exception. Last, the custom message is what you put in it to be used when it is caught. Read the rest of this entry »



Apr
25
    
Posted (Mike) in BG Alert, Coding, Projects on April-25-2007

In addition to being a student at Neumont, I own a company named BG Alert, L.L.C. It provides parents of type 1 diabetics with ease of mind by keeping them up to date on their child’s blood glucose levels while at school, at a friend’s house, basically anywhere without parents. The child enters in their blood glucose level and sometimes some other important information about their health and they get an instant response from the database that instructs them what to do based on the numbers entered.

The best thing about this system is the parents create these messages and they are custom based on the time of day and their blood sugar at that time in the day. Once the system tells the child what to do, it sends an email and a text message to the parent(s). This eliminates the need for the parent to call the school every hour to see what’s going on and to tell them what to do. It allows the parents to have more freedom and not worry as much.

Right now, the website is not complete, but getting there. The ETA on completion is May 6th. The database is created as are most of the stored procedures used in it. The data and business layers are about 70% done as of tonight and the website has a layout that just needs the company’s copy and forms entered into. Fortunately, I’ve been able to have help from some of my good friends:

  1. Josh Arnold
  2. Dan Marolt
  3. Ryan Abreu
  4. Tommy English

Without these 4 guys, I would have an ETA of May 6th next year! If you have the opportunity to work with any of them, jump on that chance, you will not regret it.

Also, if you know of any parents of type 1 diabetics, tell them about my site and give them my email address (mike@bgalert.com), I’m going to need testers soon!