Archive for April, 2009

Intro to Transact-SQL (T-SQL)

Thursday, April 30th, 2009

Transact-SQL (T-SQL) is an extension of the SQL standards by Sybase and Microsoft and includes error handling, row processing and variable declaration.

Usage:
You can programs (stored procedures) on the database server and thus extend the database functionality, each user of the database can call up these programs and use. The permissions may be established for each Transact-SQL procedure to an individual user basis.

External links:

  1. Transact-SQL Reference by Microsoft for MS-SQL 2008
  2. Transact-SQL Reference for Sybase Adaptive Server Enterprise 12.5.1
  3. T-SQL Factsheet for developers as PDF

Microsoft SQL Server JDBC Driver 2.0

Thursday, April 30th, 2009

The JDBC driver supports the features of JDBC 4.0 API.

You can check the features here:

Download URL:
http://www.microsoft.com/downloads/details.aspx?FamilyID=99b21b65-e98f-4a61-b811-19912601fdc9&displaylang=en

Microsoft introduced the first beta of Vine

Wednesday, April 29th, 2009

vine

Yesterday, Microsoft released the beta version of new software integrated with a new service called Vine.

The software is a desktop client for Windows that lets you send information via email or SMS text messages. The application also meets local news from more than 20 thousand sources plotted on a map.

Like Twitter, the application can write short messages that appear on a map according to their geographical position in which is a member. May be short messages called “alerts” or Longer messages called “reporting.”

Vine is designed to keep family and friends in touch when the traditional methods of communication (telephone, etc. ..) are not available or are ineffective.

Designed and developed considering moments of crisis, as the attacks of 9/11 or Hurricane Katrina, where mobile services are saturated or simply stopped functioning.

This is where this service is intended to be the mainstay of communication to keep people connected and coordinated with a possible evacuation or just to keep a local disaster.

Initially be available in the city of Seattle, USA where the rescue services and first aid and are joining the network and participating in the Beta test period.

Link: Vine Microsoft (Microsoft)

Desktop Refreshing in .NET

Wednesday, April 29th, 2009

With this method, you can rebuild the desktop (for example, if the icon has re-positioned via code)

public static void wc_RefreshDesktop()
{
 SHChangeNotify(0x8000000, 0, IntPtr.Zero, IntPtr.Zero);
}

Happy Programming!!

Cloud Computing

Tuesday, April 28th, 2009

It is the tendency to put the applications you normally have in the computer of externally hosted services, on the web.

It is a paradigm that will have different duties as the combination of connections between services and software accessible through the web that will forget about ourselves and the infrastructure to manage and develop our applications.

See this concept through a video.

Reading source code of a WebPage

Saturday, April 25th, 2009

This method, get the HTML source code of any WebPage

C#.NET

using System.Net;

WebClient webClient = new WebClient();
string strHTMLSourceCode = webClient.DownloadString("http://www.microsoft.com");

VB.NET

Imports System.Net

Dim webClient As WebClient = New WebClient()
Dim strHTMLSourceCode As String = webClient.DownloadString("http://www.microsoft.com")

Read More about webClient.DownloadString(string)…

Happy Programming!!

ASP.Net Gridview to CSV, Excel

Saturday, April 25th, 2009

This method, export to Excel file from Gridview

VB.NET


Sub wc_gvGridviewToExcel(ByVal gvGridview As Gridview, ByVal strExcelFilePath As String)

'Columns

Dim intColumnsCount As Integer = gvGridview.Columns.Count - 1

'Header

Dim strHeaderNames As String = Nothing

For i = 0 To intColumnsCount

strHeaderNames += gvGridview.Columns(i).HeaderText & ";"

Next

WriteToExcel(strHeaderNames, strExcelFilePath)

'Each Row

Dim strRowText As String = Nothing

For Each grdRow As gvGridviewRow In gvGridview.Rows

For i = 0 To intColumnsCount

strRowText += grdRow.Cells(i).Text & ";"

Next

WriteToExcel(strRowText, strExcelFilePath)

strRowText = Nothing

Next

End Sub

Sub WriteToExcel(ByVal strText As String, ByVal strExcelFileName As String)

Dim myFileWriter As New System.IO.StreamWriter(strExcelFileName, True)

myFileWriter.WriteLine(strText)

myFileWriter.Close()

End Sub

C#.NET

public void wc_gvGridviewToExcel(Gridview gvGridview, string strExcelFilePath)
{

 //Columns

 int intColumnsCount = gvGridview.Columns.Count - 1;

 //Header

 string strHeaderNames = null;

 for (i = 0; i <= intColumnsCount; i++) {

 strHeaderNames += gvGridview.Columns(i).HeaderText + ";";
 }

 WriteToExcel(strHeaderNames, strExcelFilePath);

 //Each Row

 string strRowText = null;

 foreach (gvGridviewRow grdRow in gvGridview.Rows) {

 for (i = 0; i <= intColumnsCount; i++) {

 strRowText += grdRow.Cells(i).Text + ";";
 }

 WriteToExcel(strRowText, strExcelFilePath);

 strRowText = null;

 }
}

public void WriteToExcel(string strText, string strExcelFileName)
{

 System.IO.StreamWriter myFileWriter = new System.IO.StreamWriter(strExcelFileName, true);

 myFileWriter.WriteLine(strText);

 myFileWriter.Close();
}

Happy Programming!!

Compare Files

Friday, April 24th, 2009

This method Compares 2 files and returns true or false.

C#.NET

private bool wc_CompareFiles(string FilePath1, string FilePath2)
{
FileInfo FI1 = new FileInfo(FilePath1);
FileInfo FI2 = new FileInfo(FilePath2);

if (FI1.Length != FI2.Length)
return false;

byte[] Filebytes1 = File.ReadAllBytes(FilePath1);
byte[] Filebytes2 = File.ReadAllBytes(FilePath2);

if (Filebytes1.Length != Filebytes2.Length)
return false;

for (int i = 0; i &lt;= Filebytes2.Length - 1; i++)
{
if (Filebytes1[i] != Filebytes2[i])
return false;
}
return true;
}

VB.NET


Private Function wc_CompareFiles(ByVal FilePath1 As String, ByVal FilePath2 As String) As Boolean
 Dim FI1 As New FileInfo(FilePath1)
 Dim FI2 As New FileInfo(FilePath2)

 If FI1.Length <> FI2.Length Then
 Return False
 End If

 Dim Filebytes1 As Byte() = File.ReadAllBytes(FilePath1)
 Dim Filebytes2 As Byte() = File.ReadAllBytes(FilePath2)

 If Filebytes1.Length <> Filebytes2.Length Then
 Return False
 End If

 For i As Integer = 0 To Filebytes2.Length - 1
 If Filebytes1(i) <> Filebytes2(i) Then
 Return False
 End If
 Next
 Return True
End Function

Happy Programming!!

Adobe Buzzword: is an online text editor

Thursday, April 23rd, 2009

Recently Adobe Labs public information on an interesting project named Adobe Buzzword is an online text editor, based on Adobe Flex. An example of what is being generated with the Web 2.0

Adobe Buzzword allows the editing of documents provided a personal repository, in addition to carrying the history of changes, control versions, collaboration with others (co-authors) and access control roles. Another feature to consider is that it can export documents to various formats: PDF, MS Office 2003/2007, HTML, Text.

To access the application with just enough to register and obtain an ID and have Adobe Flash Player installed on your computer.

Excellent tool, but I notice that fails to recognize the characteristics of 100% MS Office 2007 documents, but is still a Beta and is on track.

Read More about Adobe Buzzword..

LinqPad

Thursday, April 23rd, 2009

I just learned of the existence of a very interesting tool called LinqPad, which allows query data using LINQ with. Net Framework 3.5.

Click on the image to view large.

Allows queries like:

a) LINQ to SQL
b) LINQ to Objects
c) LINQ to XML

After doing some tests I can say that is an excellent tool, very comprehensive and allows flexibility to experience the power of LINQ and more of this interesting framework, which aims to be the big bet. NET for data access.

Read More about LinqPad