Archive for the ‘Microsoft’ Category

.NET: Check links (http, https, ftp, news etc …)

Thursday, May 14th, 2009

In this article we show how we can know what kind of address is an address. We will use the URI class, which does not allow URLs to work. The class belongs to the URI name space System.

The URI class has property “Scheme” that indicates the type of URI scheme today. The schemes that detects the URI class are:

* UriSchemeFile: tells us that points the direction in which our class is a file URI.
* UriSchemeFtp: the scheme is FTP (File Transfer Protocol)
* UriSchemeGopher: specifies that we can access through URI using the Gopher protocol.
* UriSchemeHttp: access is a URI using the HTTP protocol.
* UriSchemeHttps: the address is https, http secure.
* UriSchemeMailto: tells us that the address is an e-mail, which can be accessed via SMTP.
* UriSchemeNetPipe: tells us that the identifier URI is NetPipe.
* UriSchemeNetTcp: can access through URI using the protocol NetTCP.
* UriSchemeNews: URI is the address of a newsgroup or News.
* UriSchemeNntp: a newsgroup is accessed via NNTP.

The fields above are just reading.

In the following example, create a constant that contains the address from which we obtain information and identify which type of management is our constant.

In Visual Basic:

Const strURL As String = “http://www.wisecodes.com”
Dim strDir As New Uri(strURL)
Select Case strDir.Scheme
Case Uri.UriSchemeFile
'Code for when the address is a file
Case Uri.UriSchemeFtp
'Code for when the address is ftp
Case Uri.UriSchemeGopher
'Code for when the address is a file Gopher
Case Uri.UriSchemeHttp
'Code for when the address is http
Case Uri.UriSchemeHttps
'Code for when the address is https
Case Uri.UriSchemeMailto
'Code for when the address is an e-mail
Case Uri.UriSchemeNetPipe
'Code for when the address is NetPipe
Case Uri.UriSchemeNetTcp
'Code for when the address is NetTcp
Case Uri.UriSchemeNews
'Code for when the address is a newsgroup
Case Uri.UriSchemeNntp
'Code for when the address is a newsgroup
'accessible via NNTP.
End Select

In C Sharp

const string strURL = “http://www.wisecodes.com”
Uri strDir = new Uri (strURL);
switch (strDir.Scheme)
{
case Uri.SchemeFile:
//Code for when the address is a file
case Uri.UriSchemeFtp:
//Code for when the address is ftp
case Uri.UriSchemeGopher:
//Code for when the address is a file Gopher
case Uri.UriSchemeHttp:
//Code for when the address is http
case Uri.UriSchemeHttps:
//Code for when the address is https
case Uri.UriSchemeMailto:
//Code for when the address is an e-mail
case Uri.UriSchemeNetPipe:
//Code for when the address is NetPipe
case Uri.UriSchemeNetTcp:
//Code for when the address is NetTcp
case Uri.UriSchemeNews:
//Code for when the address is a newsgroup
caseUri.UriSchemeNntp:
//Code for when the address is a newsgroup
//accessible via NNTP.
}

Link: Via Microsoft
Happy Programming!! ;-)

SQL: New versions of SQL Server 2008 Express

Wednesday, May 13th, 2009

Microsoft has released three versions of SQL Server 2008 Express Edition, these are:
* Microsoft SQL Server 2008 Express, this is the basic version of SQL Server 2008 Express Edition, this version with other applications redistribution is free.

* Microsoft SQL Server 2008 Express Tools with this version gives us work with applications that work with data, whether to narrow or web development, this version is ideal for small server storage applications and data storage, among the features best we can name:

* Admin Tools reliable and effective.
* Interesting data protection system.

* Microsoft SQL Server Express 2008 with Advanced Services includes more features and makes it easier than ever to develop effective data-driven applications for the web or local desktop. Other features include:

* A graphical management tool.
* Interesting features to create reports.
* Run reports from SQL Server Reporting Services on local relational data.

Link: Microsoft SQL Server 2008 Express,
Link: Microsoft SQL Server 2008 Express Tools
Link: Microsoft SQL Server Express 2008 with Advanced Services

Images in Access or SQL database

Saturday, May 9th, 2009

Description: An example of how to image files in an Access or SQL database and later display in VB

There are two possibilities:

* Save the path (without the image data itself)
* Save the complete image

The first solution is probably the simpler solution, because only the pure path of the image file is stored. Second option is a bit expensive, but has the advantage that the image will be displayed again if the image file itself is not (more) on the computer is available. The big disadvantage here is that the database, depending on the number of stored images (and image size) may become very large.

Save the image information in a memo
To view the entire image in a database, it is best to use a database field of type memo. Such content can have a field up to 1.2 GByte of memory. This should then also for larger image files are sufficient.

To do this, use the following routine:

'Image in variable (string) read
Public Function wcReadPicture(strFilename As String) As String

 Dim intF As Integer
 Dim strInhalt As String

 intF = FreeFile
 Open strFilename For Binary As #intF
 strInhalt = Space$(Lof(intF))
 Get #intF, , strInhalt
 Close #intF

 wcReadPicture = strInhalt

End Function

Whenever you’re a picture in the database must therefore call on the above function:

'Save Image in Database
Table.Edit
Table("wcImage") = wcReadPicture(Your_Image_Path)
Table.Update

Image database and read in Picture / Image View Object
Now the image from the database later in a PictureBox or an Image object again, create a temporary file and save to the contents of the database image field. About LoadPicture statement, the image can then be displayed. Then the temporary file is deleted again.

And here the code:

'Load image from database and display
Public Sub wcShowPicture(Picture As Control, ByVal strInhalt As String) 

 Dim intF As Integer

 'Create a temporary image file
 intF = FreeFile
 Open App.Path & "\wcImage.tmp" For Output As #intF
 Print #intF, strInhalt;
 Close #intF

 'Picture
 Picture.Picture = LoadPicture(App.Path & "\wcImage.tmp")

 'Delete temporary file
 Kill App.Path & "\wcImage.tmp"

End Sub

The call of the procedure is then as follows:

wcShowPicture Picture1, Table("wcImage")

Happy Programming!! ;-)

An Introduction to SQLite

Friday, May 8th, 2009

http://www.wisecodes.com/2009/05/an-introduction-to-sqlite/

SQLite is a small library written in C, which offers an engine for database SQL and implementing much of the standard SQL92 and ACID properties. In contrast to database servers like MySQL or PostgreSQL, its particularity is not to reproduce the usual client / server but to be integrated directly to programs using database files. SQLite is a public domain project created by D. Richard Hipp .

SQLite is the database engine as distributed through its offices in many large public software Skype, Firefox, Gears, and some products McAfee, in many languages like PHP, Python and Perl and some mobile phones whose iPhone and those running Symbian, which totals more than 200 million settlement of the library.

Features:

SQLite does not work on the paradigm client / server, but is a function library. Among its other features, it should be noted:

  • the absence of a procedure for installation and configuration. This includes the lack of account management and user rights.
  • whole database is stored in one file.
  • the type of data stored in each database is a property of the data, not the column. A column can contain data of different types.

SQLite implements most of the SQL 92 standard with the exception of:

  • management rights with GRANT and REVOKE
  • management of foreign keys
  • the joints type RIGHT OUTER JOIN and FULL OUTER JOIN (but supports LEFT OUTER JOIN)
  • the triggers are only partially taken into account
  • the possibilities of modifying the structure of a table are limited: you can rename a table and add columns, but not modify or delete columns.

SQLite can be interesting in performance and be useful in many cases (unable to use a database server for websites or applications and embedded devices, etc..), But it does not allow different processes or thread to access simultaneously write to the same database and is not designed to handle a lot of competitors.

The library can be used in Python, C and C + +. Modules for Perl, PHP, TCL and other scripting languages are available.

PHP includes SQLite in the distribution base since version 5, when it was released as version 4 in the form of an extension PECL.

Python SQLite 3 also includes in its standard library since version 2.5.

Link: Offical Website of SQLite
Link: Interview with Richard Hipp
Link: SQLiteSpy (compatible with Unicode for Win32. Freeware.)
Link: SQLite Database Browser
Link: SQLite Database Manager

Video: (An Introduction to SQLite)

Vista will be sold until January of 2011

Thursday, May 7th, 2009

vista

According to a spokesperson for Microsoft the company expects to continue marketing its operating system Windows Vista until January 2011.

This is a little odd if we think we are now able to download Windows 7 RC, which would be marketed later this year or early next. With one year would be sold both OSes.

As for the support of Vista the company plans to extend it until April 2012, quite short compared with the support of XP, whose expiration date would be April, 2007 (in its various versions).

We know that Microsoft can offer its products for as long as it sees fit, but it is not clear if there is someone willing to buy Vista if Windows 7 is just out of the oven.

Link: Microsoft: Sun Will Slowly Set on Vista (Via PC World)

Windows 7 RC now available

Wednesday, May 6th, 2009

This is already available  for all the mortals version Release Candidate of Windows 7, the mentioned version Build 7100 with new features that you will be able to unload until the 30 of June of this year and will be able to use until June of the 2010.

Microsoft recommends a 1GHz processor or better, 1 GB RAM (32-bit) or 2 GB RAM (64-bit), 16 GB hard disk space (32-bit) or 20 GB in the case of a processor 64-bit and a GPU that supports DirectX 9. It will also be necessary to check if the processor meets the requirement of virtualization if we use the Windows XP Mode: Intel (Intel VT) / AMD (AMD-V).

According to a bulletin Technet, users of Windows 7 Beta if you need to do a backup and do a clean install, while Windows users can upgrade to Windows Vista RC without any problems, yet they suggest not thrilled because in either case to test Windows 7 RTM later be forced to do an installation from scratch.

Microsoft is very optimistic and there will surely be more surprises as they say ™ appears as a second RC version in August before the final RTM (Release to Manufacturing).

Link: Windows 7 RC (Microsoft)

SQL: Get First and Last Day of Week

Monday, May 4th, 2009

Description:
How to get First and Last Day of Week.

Select GETDATE() AS 'Today', 

DATEPART(Week,GETDATE()) AS 'Week No of Today', 

DATEADD( DAY , -DATEPART(WEEKDAY,(DATEADD( DAY , 7-DATEPART(WEEKDAY,GETDATE()),GETDATE())))
+(7-DATEPART(WEEKDAY,GETDATE()))+1 ,GETDATE()) 'First Day Of This Week', 

DATEADD(DAY , 7-DATEPART(WEEKDAY,GETDATE()),GETDATE()) AS 'Last Day Of Week'

Happy Programming!!

SQL: Get column names of a specified table.

Monday, May 4th, 2009

Description:
How to get column names of a specified table then do this code .

SELECT COLUMN_NAME As 'Columns' , DATA_TYPE As 'Type' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Your_Table_Name' ORDER BY ORDINAL_POSITION

OR

SELECT [NAME] AS 'Columns' FROM SYSCOLUMNS WHERE [ID] = Object_Id('Your_Table_Name')

Read More about INFORMATION_SCHEMA.COLUMNS 
Read More about SYSCOLUMNS

Happy Programming!!

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