Rumyhub

The place where stuff Happens

A new Website (kylebriffa.rumyhub.com)

A new website is uploaded to the server. Kylebriffa.rumyhub.com a portfolio for Kyle Briffa done by Kyle Briffa, a friend who is also into programming. Go take a look and forward any comments to admin@kylebriffa.rumyhub.com. Preview: http://kylebriffa.rumyhub.com homepage.     // //

New Toys are available! Visual Studio 2012

The new visual studio 2012 is out, and can be bought from Microsoft. It is quite awesome , It has a new gui that is easy like the predecessors. The new visual studio has skins available to use, for now it has dark and light. I personally recommend the dark version with is more easy to the eye.  Also Microsoft , released the express edition in three flavors, Express for Windows 8, Express for Web Development and Express for Desktop Application.Available form http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products.  You can also use Team foundation express with teams of less than 6 developers. // //

Creating a simple windows service in C#. Part 3

SimpleService.rar (26.75 kb) This is the final part is on how to install our service to the system if you are using Windows XP you can do this by Opening CMD prompt finding the directory (debug folder in your project) using CD (change directory) and then type installutil SimpleService.exe. To uninstall the service go to the directory by using the command prompt and then type installutil -u SimpleService.exe. This method will not work with Windows 7 and some may not be able to install it if you did not install Visual Studio 2010. If you have visual studio 2010, the IDE should have install the tools one of which is Visual Studio 2010 Command Prompt. This found In Visual Studio 2010 > Visual Studio Tools >  Visual Studio Command Prompt (2010) don't forget to run as Administrator or you may not have enough privileges to install the service. Like the command prompt go to the project directory (debug folder in you project) and the type installutil SimpleService.exe If successful you should have a screen like so... Can found in services manager... by accessing administrative tools in your control panel or simple writing services in start menu... To uninstall the service go to the directory by using the  Visual Studio Command Prompt (2010)  and then type installutil -u SimpleService.exe. Don't forget always as an administrator.   // //

Creating a simple windows service in C#. Part 2

SimpleService.rar (26.75 kb)   In the first part we did the service skeleton so now we a custom installer for it... Start by creating a separate class. I name my MyServiceInstaller.cs and add the following reference. using System; using System.ComponentModel; using System.Configuration.Install; using System.ServiceProcess; We also need to add [RunInstaller(true)] that will enable the system to use InstallUtil.exe that is great tool that will install services to windows and inherit from the Installer class which we will use to make the installer. In the constructor we need to add two objects for the system to install the service one is ServiceProcessInstaller that handles where the the process of the installation and the other one is ServiceInstaller that install the service. Now we set the privileges in the process installer. We set to account Local System. There a four settings that can be set with ServiceAccount LocalSystem : the service will have full priveleges, but most services do not require such. LocalService : acts like a non-priveleged user, as if anoymous NetworkService : provides extensive local priveleges , provide the credentials to remote servers User : any account choosen by the user. Then we set some information regarding the service these can left out but I recommend that we set them. The display name is to set how it will shown up when you research And start type is to set the start up to automatic or manual or even disable.   Now we tell the installer what to install, by setting the exact of the service which is MySimpleService and finally add both installers to installers list which is in base class.   // //

Creating a simple windows service in C#. Part 1

SimpleService.rar (12.12 kb) Hey, I was researching on services and on how to create them in C# . and this is what I learnt... First we start by create an empty project in visual studio.. To work with services we need to add to references to the project, the System.ServiceProcess and System.Configuration.Install that are found under .NET tab. System.ServiceProcess provides all classes that allow to implement,install and control windows services. System.Configuration.Install provides classes that allow the developer to write custom installers for components.   To add a reference to a project , right click on the project and click on add reference. And windows will pop up. Go the .NET tab and find the reference and double click on it to added to the project. Now create a class and I named mine MyService.cs and start by adding the required using. Using System; Using System.Diagnostics; Using System.ServiceProcess;  and added the base class reference for the ServiceBase. Like so.. In the constructor we set the name for us to identify in the system, we also use the constructor for Initialization code and we need the main method to tell the system to enter in the constructor.   And then we just add two methods onStart and onStop. onStart this is where the service will enter so all methods and code need to be accessed from here. onStop this is where the service will go when the service will stop, so this is the best place where to stop any thread or variables.   // //

A Small App for Christmas in C#

Hey Merry Christmas to everyone. I wrote a small application in C# that has a blinking label and it goes down and up in the form. First I set the form properties BackColor = Black BackgroundImage = set any image you like BackgroundImageLayout = Center FormBorderStyle = FixedSingle MaximizeBox = False Size =540,530 StartPosition= CenterScreen Text = Happy Holidays so the it looks similar to the picture below Now I inserted a label set its properties BackColor = Transparent Font =Microsoft Sans Serif, 48pt, style=Bold, Italic ForeColor = Green Location =13,10 Text = Merry Christmas And should look similar to this Then add two timers one interval of 10 milliseconds and the other with 250 milliseconds don't forget to enable the timers. Now for the coding part. We start by creating an integer for the location of the label and boolean to check whether the label is at the beginning or at the end of the form. Then I set the integer to 2 (the starting point) and the boolean to true(because it is at the top).   I used the timer that is set to an interval of 10 seconds to move the label up and down the form. First the app set the label position with the current position like so Then the integer is added by one if the label is position is less than the from size therefore the boolean is true, if not the integer is subtracted by one therefore the boolean is false. And For the other timer that is set to 250 milliseconds will make the label blink The method checks if the label is visible and if yes the label will be hid for the next 250milliseconds or if no the label is again visible for the 250 milliseconds  I also added a small video to show you the end result. AnnimationXMAS.rar (108.93 kb) // //