Reorganize Indexes

This stored procedure reorganize the indexes for the DB_Name() – DB_ID() πŸ™‚ I don’t remember from where i took some parts for this stored procedure. I’ve modify it according to my need in order to be used. I generally use this SP in a maintenance plan from RBCGxServerGeneral – RBC Etiqette

The procedure can be modified so that should reorganize indexes with an specific maximum fragementation percentage. Now this SP, reorganize indexes who are fragmented with more then 5 %. The execution of this SP should be as following.

The output message should be something like this. Enjoy it, and don’t forget to modify it as you need. …

Continue reading

Posted in MSSQL.

Database Truncate Log

This stored procedure “truncates” the log file for the DB_Name().

The execution of the stored procedure is made something like this:

The result output after the execution should be as following. The message result after the execution is the next. Feel free to modify it as you need. πŸ™‚ Enjoy  

Posted in MSSQL.

Database Backup SP

Next I present you my implementation of an stored procedure for making backup to an database. This stored procedure works very good on SQL Server 2005 Express Edition.

This stored procedure can be used like this:

The return value should be 0 in case of success, or -1 in case of error. πŸ™‚ The output messages should look something like this:   Enjoy and feel free to modify it as you need. πŸ™‚

Posted in MSSQL.

Expando Objects

Since C# 4.0 .Net Framework permits creation of dynamic object from xml content. On MSDN is presented an article about this new type. πŸ™‚ This type i’ve used in a big project in order to load an xml, and use the members from the tags. I’ve created an static class who has only an public method who returns an ExpandoObject. Here is my implementation:

The usage of this class is presented next:

As you can see any type of xml content can be loaded, and then the “dynamic” object can be used like an object with members. For this type of data i’ve found an object dumper so …

Continue reading

Posted in C#.

My Bike arrived at 6666 km

Today at 11:00 my bike arrived at 6666 km on the cyclo meter. So in more then 2 years, i’ve managed to ride more then 6000 km. For me this is an important achivement, maybe for others is not. πŸ™‚  

Posted in Hobby.

Sky Tower

On every friday evening after 17:00 people can go and visit Sky Tower building. This building is the tallest in Bucharest. It is great fun to ride the elevator to the 34 floor / 37 floors. It isΒ  free, and anyone can go and visit the “sky level”. πŸ™‚

Posted in Traveling.

My new toroidal satellite dish

Today i’ve managed to install (with help from some friends) my new toroidal satellite dish. From now on i can receive more than 16 satellites at the same time. πŸ™‚ The other two satellite dishes are for HispaSat 30W and EuroBird 28.2 E. If someone needs some details don’t hesitate to send me an email. πŸ™‚ I’ve attached an document in which you can see what was my budget calculation. Link for information.

Posted in Hobby.

Cross Table – Lines from Table1 are columns and Lines from Table2 are lines

When you need to create a table that imitates an cross tab in mssql – you can create a temporary table that can get the columns from an table, and the rows form another table. At the cross for this two tables, can be a bit type who can show if the relation between those two table has some value. First you need to see theΒ  table schema. All the rows from table CodeTypes will be considered like table columns. All the rows from table CodeContents will be considered like table lines. The table CodeContentPerCodeType contains the cross values between this two tables. The mechanism for this stored procedure is …

Continue reading

Posted in MSSQL.

Postgresql – Functions

Next i present to you one of my implementions of postgresql function usage. Generally postgresql functions should beΒ  something like stored procedures from MSSQL. From documenation you can see that the sintaxt is almost the same like MSSQL, but in my opinion it has more flexibility. I’ve tried to implement the insert, update, delete, select functions who will return a data table for C#. First you should create an table for testing purposes.

The function for insert is something like this:

For update the function looks like this:

For delete i use only a logical deleteΒ  using a flag. It can be modified in order to make …

Continue reading

Posted in Postgresql.

Cross Thread Utility

IF you want to update some information in windows form control from another thread please use the following class. πŸ™‚ IF you receive the error : “Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on ….” use the following class. πŸ™‚

This class can be used from .Net 3.5 version. How to use it:

I consider that is a good class, to use it in multi threaded aplications. Don’t forget to modify it as you want. πŸ™‚

Posted in C#.