ORA-24761 Unable to get error message (6107)

Error:

10 minute limit on distributed transactions

Running a distributed transaction on Windows XP SP2 that exceeds 10 minutes will cause the transaction to rollback with an ORA-24761 error. The error message is:

Unable to get error message (6107) (0)

The time out defined for the component in Component Services does not matter.

Solution:

If no timeout is specified in the TransactionScope constructor, a transaction has 1 min timeout by default.

This timeout can be overridden in the app.config (or web.config ) by adding following lines.

<system.transactions>
<defaultSettings timeout=”00:30:00″ />
</system.transactions>

Anyway, to prevent too long transactions, a maximum timeout can be specified at machine.config level by setting

<system.transactions>
<machineSettings maxTimeout=”00:30:00″ />
</system.transactions>

If this is not specified explicitely, the maxTimeout has a default value of 10 minutes.

So at the end my code looks like:

1
2
3
4
5
6
7
8
9
try
{
// set no timeout in the constructor
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
}
}
catch
{}

个人所得税计算器

新的个人所得税法案在2011年9月1号后生效,试试这个计算器,看看自己需要为国家做多大贡献。
[js]
function calculateTax()
{
var salary = document.getElementById(“salary”).value;

if(salary == undefined || salary == NaN)
{
alert(“Input the salary please.”);
return;
}

var newSalary = salary – 3500;
var taxRate = 0.03;

if(newSalary > 80000)
{
taxRate = 0.45;
}
else if (newSalary > 55000) {
taxRate = 0.35;
}
else if (newSalary > 35000) {
taxRate = 0.30;
}
else if (newSalary > 9000) {
taxRate = 0.25;
}
else if (newSalary > 4500) {
taxRate = 0.20;
}
else if (newSalary > 1500) {
taxRate = 0.10;
}
else if (newSalary < = 0) {
taxRate = 0.00;
}

var tax = newSalary * taxRate;
alert("Your salary " + salary + " = " + tax + "(tax) + " + (salary - tax));
}
[/js]
Salary:

.Net中var的使用方式

The following restrictions apply to implicitly-typed variable declarations:

  • var can only be used when a local variable is declared and initialized in the same statement; the variable cannot be initialized to null, or to a method group or an anonymous function.
  • var cannot be used on fields at class scope.
  • Variables declared by using var cannot be used in the initialization expression. In other words, this expression is legal: int i = (i = 20); but this expression produces a compile-time error: var i = (i = 20);
  • Multiple implicitly-typed variables cannot be initialized in the same statement.
  • If a type named var is in scope, then the var keyword will resolve to that type name and will not be treated as part of an implicitly typed local variable declaration.

You may find that var can also be useful with query expressions in which the exact constructed type of the query variable is difficult to determine. This can occur with grouping and ordering operations.

The var keyword can also be useful when the specific type of the variable is tedious to type on the keyboard, or is obvious, or does not add to the readability of the code. One example where var is helpful in this manner is with nested generic types such as those used with group operations. In the following query, the type of the query variable is IEnumerable>. As long as you and others who must maintain your code understand this, there is no problem with using implicit typing for convenience and brevity.

However, the use of var does have at least the potential to make your code more difficult to understand for other developers. For that reason, the C# documentation generally uses var only when it is required.

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