myGoogleResults

Sunday, December 6, 2009

CTE SQL Server 2

WITH TestCTE (ID
,Name
,ParentId
,Level)
AS
(
SELECT ID
,Name
,ParentId
,0 Level
FROM dbo.MyFirends F1P
UNION ALL
SELECT F.ID
,F.Name
,F.ParentId
,Level - 1
FROM dbo.MyFirends F
INNER JOIN TestCTE CTE ON F.ID = CTE.ParentId
)

select ID
,Name
,ParentId
,-1*Level
from TestCTE C

CTE SQL Server

http://msdn.microsoft.com/en-us/library/ms190766.aspx


CREATE TABLE [dbo].[MyFirends](
[ID] [int] NULL,
[Name] [nchar](10) NULL,
[Date] [date] NULL,
[Address] [nchar](100) NULL,
[ParentId] [int] NOT NULL
) ON [PRIMARY]

-------------------------------------------------------------


WITH TestCTE (ID
,Name
,ParentId
,Level)
AS
(
SELECT ID
,Name
,ParentId
,0 Level
FROM dbo.MyFirends F1P
WHERE ParentId = 0
UNION ALL
SELECT F.ID
,F.Name
,F.ParentId
,Level + 1
FROM dbo.MyFirends F
INNER JOIN TestCTE CTE ON F.ParentId = CTE.ID
)

select ID
,Name
,ParentId
,Level
from TestCTE C

Sunday, May 24, 2009

Real time refreshing charts in WPF

Charts in WPF
There are sample applications and UI controls both commercial and freely available. Below 1) and 2) supports real time updating. Except the 1) and 2); with rest of the other tools the real time refreshing need to happen from the application by loading the chart periodically.

Visfire supports both windows and web applications with built in real time updating support. Both open source and commercial version (with customer support and many features) is available.




1) A WPF Sample application for a live updating line graph

Below sample application was downloaded and tested. It contains few user controls and custom classes written from scratch with tickers and lines for generating a ticking line graph.
http://decav.com/blogs/andre/archive/2007/08/25/live-updating-line-graph-in-wpf.aspx






2) Visifire

Visifire is an open Source data visualization component which can be used to create charts very quickly.
http://visifire.com/


Single API to both Silverlight & WPF
Possible to use with desktop applications (WPF), Silverlight and WPF browser applications
Embed into Desktop or Web Applications in minutes
Real time Charts / Live Update
Any property of Visifire charts can be updated in realtime. Visifire 2.0 supports realtime update from both javascript & managed code.
http://code.google.com/p/visifire/
http://visifire.com/silverlight_charts_gallery.php
Tiny footprint
Enterprise grade features
Microsoft Expression Blend compatible
Chart look and feel can be customized. Visifire charts can be designed in Microsoft Expression Blend.
Dual License - Open Source & Commercial
Open Source GPL 3.0 license
Commercial license with customer support and many features
Features: http://visifire.com/visifire_features.php
Samples are available with visifire downloads. In order to chart to get updated data points should be created programmatically and added to the chart.




3) Swordfish Charts

http://johnstewien.spaces.live.com/blog/cns!E6885DB5CEBABBC8!444.entry

This is an initial level project at sourceforge. Sample code is available for downloading.
http://sourceforge.net/projects/swordfishcharts
licensed under A Public Domain dedication




4) Telerik UI Controls for reporting

Telerik is a commercially available set of UI controls for reports. UI controls are available for WPF and Silverlight for reporting. Demos, online forums and documentation with great customer support are provided.
http://www.telerik.com/
Below sample application is for WPF chart using Telerik Rad controls for WPF. A lot of look and feel customizations and themes are possible with these UI controls.
http://blogs.telerik.com/manoldonev/posts/09-01-06/WPF_Customizing_the_chart_series_appearance_in_RadChart.aspx





5) Essential Chart for WPF

http://www.syncfusion.com/products/wpf/chart?gclid=CKS4oo3i0ZoCFQogegodBR9rDw
http://www.syncfusion.com/products/wpf/chart/line-charts

Tuesday, March 31, 2009

How to view Sinhalese Unicode characters in Windows XP SP2

How to view Sinhalese Unicode characters in Windows XP SP2

Control Panel -> Date, Time, Language, and Regional Options -> Regional and Language Options
Select Languages tab
In The supplemental language support select the below two options.
1) Install files for complex script and right-to-left languages (Including Thai)
2) Install files for East Asian languages

You may prompt for SP2 CD. Provide the appropriate CD and proceed with the installation.


Install sinhala enabling kit from below URL:
http://www.siyabas.lk/sinhala_how_to_install.html#win

Sunday, March 1, 2009

File System Encryption for Windows (Free)


EFS (Encrypting File System)


EFS aviable with windows provides file encryption for free and works transparently with the os.


1) Open Windows Explorer and select the file you want to encrypt
2) Right-click the chosen file and select Properties from the context menu.
3) Select the Advanced button to enable EFS.
4) Encrypt the file by selecting the Encrypt contents to secure data check box as shown in Figure below. Click OK.






Sunday, February 22, 2009

JavaScript client for e-jabberd (Open Source chat server - chat client)

Below are open source chat server and client suitable for enterprise usage.

Chat Server : ejabberd
http://www.ejabberd.im/

Chat Client : jwchat
http://blog.jwchat.org/jwchat/

Below url explains how to configure ejabberd with jwchat.
http://www.ejabberd.im/jwchat-localserver

Saturday, February 21, 2009

Saturday, February 7, 2009

Sunday, February 1, 2009

Call a WCF Service from Classic ASP

Dim wsdl, moniker, obj

wsdl = GetWsdlFromUrl("http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/?wsdl")

moniker = "service:wsdl=" & wsdl & ", "
moniker = moniker + "address=http://localhost:8731/Design_Time_Addresses/WcfServiceLibrary1/Service1/,"
moniker = moniker + "contract=IService1, "
moniker = moniker + "contractNamespace=http://tempuri.org/, "
moniker = moniker + "binding=WSHttpBinding_IService1, "
moniker = moniker + "bindingNamespace=http://tempuri.org/"


Set objProxy = GetObject(moniker)

Dim str
str = objProxy.GetData("2")
Response.Write(str)




Function GetWsdlFromUrl(strUrl)

Dim winHttpReq, resp

Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
resp = winHttpReq.Open("GET", strUrl, False)
winHttpReq.Send

GetWsdlFromUrl = winHttpReq.ResponseText

End Function

Sunday, January 18, 2009

Wednesday, January 14, 2009

send mail using gmail smtp server


try
{

MailMessage mm = new MailMessage(From.Trim(),To);
mm.BodyEncoding = Encoding.UTF7;
mm.Subject = Subject.Trim();
mm.Body = MessageTxt.Trim() + "\n";
mm.Priority = MailPriority.High;
mm.IsBodyHtml = false;



if (FileSt != "")
{
Attachment msgAtt = new Attachment(FileSt);
mm.Attachments.Add(msgAtt);
}

SmtpClient sc = new SmtpClient();

sc.Credentials = new System.Net.NetworkCredential("sudesh.withanage", "priyanka");
sc.Port = 587;
sc.Host = "smtp.gmail.com";
sc.EnableSsl = true;
// sc.SendCompleted +=new SendCompletedEventHandler();


sc.Send(mm);

MessageBox.Show("success");

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}


gmail pop


pop.gmail.com

995


gmail smtp


587
smtp.gmail.com