Learning to Compile, Unix Style

Have installed Ubuntu on a virtual box, and am starting to have fun.  First, went to compile something using the “make” file included, and received a bunch of happy fun errors like this:

error: stdio.h: No such file or directory

Resolved this issue with this command:

sudo apt-get install build-essential

Found on this useful web site:

http://www.spiration.co.uk/post/1291

Why you SHOULD comment.

Nice article on commenting your code.  Please comment your code, if for no other reason than I can at least see what you were trying to do when I come in to fix your bugs.  Yes, you have bugs in your code (and so do I).  If I’m not even sure what you were trying to do, I’m more likely to rewrite it, which has wasted both of our time.

SQL Server: Transacation Log Restore Sample

Some snippets of sample code showing how to backup and restore from transaction logs.

FULL BACK UP

BACKUP DATABASE [AdventureWorks]
TO
DISK = N’H:\SQLServer2008_RC0\MSSQL10.MSSQLSERVER\MSSQL\Backup\AdventureWorks.bak’
WITH
NOFORMAT, INIT, NAME = N’AdventureWorks-Full Database Backup’
,
SKIP, NOREWIND, NOUNLOAD, COMPRESSION, STATS = 10
GO

declare @backupSetId as int
select
@backupSetId = position
from
msdb..backupset
where
database_name=N’AdventureWorks’
and
backup_set_id=(select max(backup_set_id)
from
msdb..backupset
where
database_name=N’AdventureWorks’ )

if @backupSetId is null
begin

raiserror
(N’Verify failed. Backup information for database ”AdventureWorks” not found.’, 16, 1)
end

RESTORE VERIFYONLY FROM DISK = N’H:\SQLServer2008_RC0\MSSQL10.MSSQLSERVER\MSSQL\Backup\AdventureWorks.bak’
WITH FILE = @backupSetId, NOUNLOAD, NOREWIND
GO

TRANSACTION LOG BACKUP

BACKUP LOG [AdventureWorks]
TO
DISK = N’H:\SQLServer2008_RC0\MSSQL10.MSSQLSERVER\MSSQL\Backup\AdventureWorks.bak’
WITH
NOFORMAT, NOINIT, NAME = N’AdventureWorks-Transaction Log Backup’, SKIP
,
NOREWIND, NOUNLOAD, STATS = 10
GO

declare @backupSetId as int
select
@backupSetId = position
from
msdb..backupset
where
database_name=N’AdventureWorks’
and
backup_set_id=(select max(backup_set_id)
from
msdb..backupset
where
database_name=N’AdventureWorks’ )

if @backupSetId is null
begin

raiserror
(N’Verify failed. Backup information for database ”AdventureWorks” not found.’, 16, 1)
end

RESTORE VERIFYONLY
FROM DISK = N’H:\SQLServer2008_RC0\MSSQL10.MSSQLSERVER\MSSQL\Backup\AdventureWorks.bak’
WITH
FILE = @backupSetId, NOUNLOAD, NOREWIND
GO

RESTORING FROM FULL, APPLYING TRANSACTION LOGS.

RESTORE DATABASE [AdventureWorks]
FROM
DISK = N’H:\SQLServer2008_RC0\MSSQL10.MSSQLSERVER\MSSQL\Backup\AdventureWorks.bak’
WITH
FILE = 1, NORECOVERY, NOUNLOAD, REPLACE, STATS = 10
GO

RESTORE LOG [AdventureWorks] FROM DISK = N’H:\SQLServer2008_RC0\MSSQL10.MSSQLSERVER\MSSQL\Backup\AdventureWorks.bak’
WITH
FILE = 2, NOUNLOAD, STATS = 10
GO

ASP.Net – A fresh beginning

So, started trying to pick up ASP.Net.  Some things I learned:

A decent tutorial site: http://www.functionx.com/aspnet_csharp/Lesson05.htm

The “rel” html tag establishes a “relationship” between pages.  Most notably, this is used for establishing a relationship to a stylesheet.

Some simple code that demonstrates a clever string to int conversion:


if (TextBox1.Text == "")
{
TextBox1.Text = "2";
}
else
{
try
{
int val;
val = int.Parse("0" + TextBox1.Text); ;
val = val * 2;
TextBox1.Text = val.ToString();
}
catch (Exception myException)
{
}
}

Follow

Get every new post delivered to your Inbox.