Sunday, May 28, 2006

How-To: Convert Euro correctly ... [string.ToDecimal()]

I don't really understand why this happens just with Euro, but fact is when I use string.ToDecimal() and my Cultures are formatted for a European country, then it's not converting correctly in manner of:

expected value: 1.534,40
received value: 153440.00

its a small difference, at least to me :-)

The CurrentUICulture contains an NumberFormat which we can append to convert:
System.Globalization.NumberFormatInfo nfUs = Thread.CurrentThread.CurrentUICulture.NumberFormat;

Place attention that first i use "System.Globalization.InvariantCulture" and just on the ToString i apply "c" and my needed culture.

string formattedNumber = Convert.ToDecimal(string.Concat(formating,".",formatingCents), System.Globalization.InvariantCulture).ToString("c", nfUs);

Am I the only one who faced off with this problem?

Friday, May 26, 2006

How-To: Split web.config sections into different files.

with my spin of automation I figured out that in our Build-Process we have to change some settings depends on the environment [development, testing, staging, life (we get there soon :-) )].

While each environment has its own connection strings and app-settings section we decided to split them from the web.config file and put them into different files. Well i didn't thought that this is possible, but MS have thought about it :-) Thanks!

<connectionStrings configSource="YourFileName1.xml"/>
<appSettings configSource="YourFileName2.xml"/>

Note: it has to be an XML file, correct me if I'm wrong but with anything else it worked.

great we have now own files which we can just copy after the deployment but ... here comes the clue behind it, if you do that you should also do the following thing to protect your files:


  <location path="YourFileName1.xml">
   <system.web>
    <authorization>
     <deny users="*"/>
    </authorization>
   </system.web>
  </location>

  <location path="YourFileName2.xml">
   <system.web>
    <authorization>
     <deny users="*"/>
    </authorization>
   </system.web>
  </location>

without to do that everybody else access your file's and can potentially harm your application - keep attention about it.

Tuesday, May 23, 2006

Thanks. No.

Thanks. No.: "You�re not a bad person, and no one hates you, but it would be valuable to learn the very personal preferences of your friends, family members, and co-workers before including them in unrequested email or choosing to expose their private address to people they don�t know."

ever needed to delete records based on the length?

how-to:

Delete FROM TableName where LEN(RTRIM(LTRIM( COL-Name ))) > 3

Sunday, May 21, 2006

WebserviceX.NET :: XML Web Services solution provider

useful webservices:

WebserviceX.NET :: XML Web Services solution provider: "Web services enable to quickly integrate applications across multiple platforms, systems and even across businesses. Emerging web services standards such as SOAP, WSDL and UDDI will enable system-to-system communication that is easier and cheaper than ever before.

WebserviceX.NET provides programmable business logic components and standing data that serve as 'black boxes ' to provide access to functionality and data via web services"

Thursday, May 18, 2006

The Gwigle Game

Very nice

The Gwigle Game

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge