Sunday, April 30, 2006
Minimalist XML. Formula Script Generator
<?xml version="1.0" encoding="utf-8"?>
<TableSummary
nbsp;Comment="
nbsp;This is a summary table, there are two types of summary table, one is by actual count, and the other is count by trail">
<?xml version="1.0" encoding="utf-8"?>
<TableSummary
Comment="
This is a summary table, there are two types of summary table, one is by actual count, and the other is count by trail">
<ByActualCount>
<Tables Comment="the following tables have no date:">
<BranchIndividualMotor/>
<IndividualMotor/>
<Motor/>
<RptOnBranchMotor/>
</Tables>
<Formulas Comment="formulas of by actual count, no date trailing">
<InQty>
MIN_A_QTY
+ MFL_A_QTY
+ MRS_A_QTY
+ MRB_A_QTY
+ MRP_A_QTY
+ MSR_A_QTY
+ MRI_A_QTY
+ MNR_A_QTY
</InQty>
<OutQty>
MPR_D_QTY
+ MMB_D_QTY
+ MSI_D_QTY
+ MSC_D_QTY
+ MMN_D_QTY
+ MAM_D_QTY
</OutQty>
<ActualQty>
(
MIN_A_QTY
+ MFL_A_QTY
+ MRS_A_QTY
+ MRB_A_QTY
+ MRP_A_QTY
+ MSR_A_QTY
+ MRI_A_QTY
+ MNR_A_QTY
)
-
(
MPR_D_QTY
+ MMB_D_QTY
+ MSI_D_QTY
+ MSC_D_QTY
+ MMN_D_QTY
+ MAM_D_QTY
)
</ActualQty>
<InCost>
MIN_A_COST
+ MFL_A_COST
+ MRS_A_COST
+ MRB_A_COST
+ MRP_A_COST
+ MSR_A_COST
+ MRI_A_COST
+ MNR_A_COST
</InCost>
</Formulas>
</ByActualCount>
<ByTrailCount>
<Tables Comment="the following tables have date to facilitate trailing:">
<RptOnBranchMotorDaily/>
<RptOnBranchMotorMonthly/>
<RptOnBranchMotorYearly/>
<RptOnMotorDaily/>
<RptOnMotorMonthly/>
<RptOnMotorYearly/>
</Tables>
<Formulas Comment="formulas of bytrail count, with date:">
<InQty>
MIN_A_QTY
+ MFL_A_QTY
+ MRS_A_QTY
+ MRB_A_QTY
+ MRP_A_QTY
+ MSR_A_QTY
+ MRI_A_QTY
+ MNR_A_QTY
</InQty>
<OutQty>
MPR_D_QTY
+ MMB_D_QTY
+ MSI_D_QTY
+ MSC_D_QTY
+ MMN_D_QTY
+ MAM_D_QTY
</OutQty>
<EndQty Comment="if sql server facilitates nested formula, we can simplify the formula below with this: BeginQty + InQty - OutQty">
BeginQty
+
(
MIN_A_QTY
+ MFL_A_QTY
+ MRS_A_QTY
+ MRB_A_QTY
+ MRP_A_QTY
+ MSR_A_QTY
+ MRI_A_QTY
+ MNR_A_QTY
)
-
(
MPR_D_QTY
+ MMB_D_QTY
+ MSI_D_QTY
+ MSC_D_QTY
+ MMN_D_QTY
+ MAM_D_QTY
)
</EndQty>
<InCost>
MIN_A_COST
+ MFL_A_COST
+ MRS_A_COST
+ MRB_A_COST
+ MRP_A_COST
+ MSR_A_COST
+ MRI_A_COST
+ MNR_A_COST
</InCost>
<OutCost>
MPR_D_COST
+ MMB_D_COST
+ MSI_D_COST
+ MSC_D_COST
+ MMN_D_COST
+ MAM_D_COST
</OutCost>
<EndCost>
BeginCost
+
(
MIN_A_COST
+ MFL_A_COST
+ MRS_A_COST
+ MRB_A_COST
+ MRP_A_COST
+ MSR_A_COST
+ MRI_A_COST
+ MNR_A_COST
)
-
(
MPR_D_COST
+ MMB_D_COST
+ MSI_D_COST
+ MSC_D_COST
+ MMN_D_COST
+ MAM_D_COST
)
</EndCost>
<InstallmentProfit>
MSI_D_PRICE - MSI_D_COST
</InstallmentProfit>
<CashProfit>
MSC_D_PRICE - MSC_D_COST
</CashProfit>
<RepossessedProfit>
MAM_D_PRICE - MAM_D_COST
</RepossessedProfit>
<TotalProfit Comment=
"InstallmentProfit + CashProfit + RepossessedProfit">
(MSI_D_PRICE - MSI_D_COST)
+
(MSC_D_PRICE - MSC_D_COST)
+
(MAM_D_PRICE - MAM_D_COST)
</TotalProfit>
</Formulas>
</ByTrailCount>
</TableSummary>
SQL Server, SP4 installation Quirks
"service control opertaion failed for the MSSQLSERVER service: 1460
This operation returned because the timeout period expired"
i found an article stating this problem: http://www.sql-server-performance.com/forum/post.asp?method=TopicQuote&TOPIC_ID=9483&FORUM_ID=4
Posted - 07/28/2005 : 00:31:56 Might be issue where sql server on restart is taking more time to accept client connection. What is the size of database and transaction logs on server. May be you can try to install it from command prompt as below: Also try to install direcly from box and not thru remote desktop or PC anywhere. That was what MS did in of our cases |
heheh, no way i would go to the office just to install SQL Server Service Pack 4, it is sunday today :D
then i use RAdmin, the installation went okay. hmmm... strange :)
Saturday, April 22, 2006
.NET Notepad Programming
* Server and Development machine
* Download .NET Framework to Server (20 MB) Free
* Download .NET Framework SDK to your Development Machine (360 MB) Free Too!
* Notepad. Absolutely Free!!!
C# cast, rounding, conversion
using System;
public class a
{
static void Main()
{
int i;
double d = 3.5;
i = System.Convert.ToInt32(d);
System.Console.WriteLine("Convert: {0}",i); // uses banker's rounding
d = 3.5;
i = (int) d; // doesn't use banker's rounding, result in 4
System.Console.WriteLine("Typecast: {0}",i);
d = 3.5;
i = (int) Math.Round(d,0); // uses banker's rounding
System.Console.WriteLine("Round then typecast: {0}",i);
}
}
output:
Convert: 4
Typecast: 3
Round then typecast: 4
web services: no source code on the server. compiled to dll
Approach Two: no source code on the server
Cons: extra step, compilation
Pros: seems faster than compiled-on-the-fly, no source code on server, more secure
create a directory on server, c:\testCompiledWs
create a virtual directory named SoSharp on IIS, pointing to c:\testCompileWS
*** create webservices on your development machine. 2 step ***
Step 1 of 2.
create a file geek.cs on your development machine...
using System;
using System.Web.Services;
using System.Web.Services.Protocols;public class OfTheTitans : WebService
{
[WebMethod]
public string Interest()
{
return " batman " + DateTime.Now.ToString();
}};
...create a file geek.cs on your development machine
Step 2 of 2.
compile geek.cs to dll...
csc.exe /t:library geek.cs
Note: this will create geek.dll on your development machine
...compile geek.cs to dll
*** deploy geek.dll to your server. 2 steps ***
Step 1 of 2.
create a directory bin on server on c:\testCompiledWs
copy geek.dll on server on to c:\testCompiledWs\bin
Step 2 of 2.
create a file anorak.asmx on c:\testCompiledWs\bin ...
<%@ WebService Language="C#" CodeBehind="geek.cs" class="OfTheTitans" %>
... create a file anorak.asmx
Note: To test your webservices on your development machine, open your favorite browser, visit http://yourserveraddresshere/SoSharp/anorak.asmx
*** consume your webservices on your development machine. 3 steps ***
Step 1 of 3.
wsdl.exe http://yourserveraddresshere/SoSharp/anorak.asmx
Note: this will create OfTheTitans.cs on your development machine
Step 2 of 3.
create a file useanorak.cs on your development machine ...
public class First
{
public static void Main()
{
OfTheTitans o = new OfTheTitans();
System.Console.WriteLine("C# " + o.Interest());
}
}
...create a file useanorak.cs
Step 3 of 3.
compile and run the application...
csc.exe useanorak.cs OfTheTitans.cs
useanorak.exe
...compile and run
*** consume your webservices on your development machine, using VB.NET. 3 steps ***
Step 1.
wsdl.exe /l:vb http://yourserveraddresshere/SoSharp/anorak.asmx
Note: this will create OfTheTitans.vb on your development machine
Step 2.
create a file useanorak.vb on your development machine ...
Public Class First
Public Shared Sub Main()
Dim o As OfTheTitans = new OfTheTitans()
System.Console.WriteLine("VB " & o.Interest())
End Sub
End Class
...create a file useanorak.vb
Step 3.
compile and run the application...
vbc.exe useanorak.vb OfTheTitans.vb
useanorak.exe
...compile and run
Note:
OfTheTitans.cs can also be compiled to dll so other language can use it as well, to consume OfTheTitans.dll in useanorak.vb, use /r compile option, reference:
vbc /r:OfTheTitans.dll useanorak.vb
this will create useanorak.exe
Approach One: source code is compiled "on-the-fly" on the server
Approach One:source code IS compiled "on-the-fly" on the server
Pros: easy to test from front-end app
Cons: source code can be inspected from the server, sensitive code might be seen. might be slower than compiled(dll)
*** Create webservices on server. 1 step ***
Create nerd.asmx file on server on c:\inetpub\wwwroot ...
<% @ WebService Language="C#" class="Mate" %>
using System;
using System.Web.Services;
using System.Web.Services.Protocols;[WebService(Namespace="http://yourserveraddresshere/")]
public class Mate : WebService
{
[WebMethod]
public string TheServerTime()
{
return " of the jedi " + DateTime.Now.ToString();
}}
...create nerd.asmx file
to test if your services is working, from your development machine open in your favorite browser this site: http://yourserveraddresshere/nerd.asmx
*** To consume webservices in your development machine. 3 steps...
step 1 of 3.
create a code that parses your webservices to get the result, this can be automated using the code generator, use wsdl of .NET SDK...
wsdl.exe http://yourserveraddresshere/nerd.asmx
Note: this will generate Mate.cs file on your development machine
...create a code that parses
step 2 of 3.
create usenerd.cs file on your development machine ...
public class A
{
public static void Main()
{
Mate m = new Mate();
System.Console.WriteLine(m.TheServerTime());
}
}
... create usenerd.cs file
step 3 of 3.
compile and run the application...
csc.exe usenerd.cs Mate.cs
usenerd.exe
...compile
*** To consume webservices in your development machine. using VB.NET. 3 steps...
step 1 of 3.
create a code that parses your webservices to get the result, this can be automated using the code generator, use wsdl of .NET SDK...
wsdl.exe /l:vb http://yourserveraddresshere/nerd.asmx
Note: this will generate Mate.vb file on your development machine
...create a code that parses
step 2 of 3.
create usenerd.vb file on your development machine ...
Public Class A
Public Shared Sub Main()
Dim m As Mate = new Mate()
System.Console.WriteLine(m.TheServerTime())
End Sub
End Class
... create usenerd.cs file
step 3 of 3.
compile and run the application...
vbc.exe usenerd.vb Mate.vb
usenerd.exe
...compile