Tuesday, April 6, 2010
join to remove values in tsql
Tuesday, March 16, 2010
Polymorphism in C#
class A {
public virtual void Method1(){}
public void Method2() {
Method1();
}
}
class B:A {
public override void Method1() { }
}
class main {
A myobject = new B();
myobject.Method2();
}
So which function gets called?
B.Method1();gets called because it properly overrides the virtual methodA.Method1();
Monday, March 15, 2010
VB.Net equivalent of C# “As”
var x = y as String;
if (x == null) ...
in VB you do this :
Dim x As String = TryCast(y, String)
If x Is Nothing Then ...
meaning "as" = "TryCast"
Thursday, March 11, 2010
Database Backup on Sql Server
Full Backup. This type of backup will lets you to backup all of extents of your database. In my previous articles, I've already explain about extent in SQL Server 2005. SQL Server always save your data in pages and extents. 1 pages contains 8 Kb of your data, and 1 extents is a group of 8 pages which contains 64 Kb data of your database. To use this type of backup, you must set your recovery model to full, before you backup your database. To set your database recovery model, you can use this query :
ALTER DATABASE [ database_name ]
SET RECOVERY [ FULL | BULK_LOGGED | SIMPLE ]
,and you can do full backup by using this query :
BACKUP DATABASE [ database_name ] TO DISK = '
TO DISK clause specify the location of your backup device, while WITH INIT clause is the common clause to tell SQL Server to overwrite existing data in backup device. You can make backup device by using SSMS or simply by using this query. Backup device is logical backup medium to save your backup data. It has extension .bak.
Differential Backup. This type of backup will backup your database since the last full backup. SQL Server will make extent map to recognize the new data in your database. When you insert data in your database, extent will have bit with 0 to 1 to represented their information. After you do full backup, it will be reseted to 0, in this way SQL Server know which data that have to be backed up in differential backup methods.Notes that you can do this type backup if you have done full backup to your database.
You can do differential backup by using this query :
BACKUP DATABASE [ database_name ] TO DISK = '
Incremental Backup. This type of backup looks similar to differential backup. But actually, it's really different. Incremental backup will back up your database since the last full backup and the last incremental backup. So if you have 100 Mb data on Sunday, 150 Mb data on Tuesday, 200 Mb data on Wednesday, and 250 Mb data on Thursday. So the size of full backup data taken on Sunday is 100 Mb, while the incremental backup data taken on Tuesday, Wednesday, and Thursday are 50 Mb data for each day.
To restore this incremental backup, you must have all of your incremental backup data, or you won't be able to restore your database completely. For example, your incremental backup data on Wednesday is lost, you won't be able to restore your incremental backup data on Thursday. This type of backup are not recommended for production database, since it has a lot of risks.
Transaction Log Backup. This type of backup needs full backup of your database. Transaction Log Backup will back up all actives log files of your database. To use this type of backup you can use this query :
BACKUP LOG [ database_name ] TO DISK = '
You also can make operators and scheduled tasks to be assigned backup job to automated backup process of your database. I won't explain it this time, but I promise I'll tell you about this later.
Thursday, February 18, 2010
setting value to a RadDatePicker on load
private void SetDateRequest(string dateValue, RadDatePicker datePicker, DateTime valueDate)
{
DateTime dateOut;
datePicker.SelectedDate = valueDate;
if (DateTime.TryParseExact(dateValue, "yyyy-MM-dd", null, DateTimeStyles.None, out dateOut))
{
datePicker.SelectedDate = dateOut;
}
}
and this is how I call it :
SetDateRequest(dateTo, ToDateRadDatePicker, endDate);
Cheers,
Tuesday, February 16, 2010
Error on TortoiseSVN installing on Windows 7
Install the 32bit version of tortoise SVN parallel the 64bit version.
TC is a 32bit program and the 64bit shell extension can't be used by [u]any[/u] 32bit program.
this solved my problem to be able to export the projects from the code repository I was in urge for.
Cheers,