Sunday, September 28, 2008

Monte Carlo Simulations

From http://omlc.ogi.edu/software/mc/

"Despite appearances to the contrary (e.g., MCML), Monte Carlo code does not need to be long and complicated. To emphasize this idea of the inherent simplicity of the Monte Carlo approach, I have written three short programs. Enjoy!"

Labels: , ,

PHPDig.net - php - eval

From http://www.phpdig.net/ref/rn39re741.html :

eval() is used to evaluate a string as PHP code. It's most often used to execute PHP code that's built at runtime or to get around some of the limitations in the PHP parser. Use of eval() can be somewhat tricky at times. Novice programmers have suggested that evil() would be a more appropriate name for the function.

eval() behaves as if the string being evaluated was a normal block of code in the same scope as the call to eval() . The best way to explain this is by using a few simple code examples. In PHP 4, there is an exception to this rule. A return() statement can be used to stop parsing of the evaluated string. The value after the return() statement will be returned by the eval() function. The following scripts should be equivalent:

Labels: ,

RSA Encryption in .NET -- Demystified!

From http://www.eggheadcafe.com/articles/20020630.asp

The "KEY" to RSA Encryption

Whenever you create a new default constructor instance of the RSACryptoServiceProviderclass, it automatically creates a new set of public / private key information, ready to use. However, if you want to re-use previously created keys, you can do this by initializing the class with a populated CspParameters object.

For example [VB.NET]:

Dim cspParam as CspParameters = new CspParameters()
cspParam.Flags = CspProviderFlags.UseMachineKeyStore
Dim RSA As System.Security.Cryptography.RSACryptoServiceProvider
= New System.Security.Cryptography.RSACryptoServiceProvider(cspParam)

Labels: , ,

Erlang Mimeparse

From http://code.google.com/p/mimeparse/ :

"This module provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification RFC 2616 for a complete explanation.

Contents

Labels: , ,

Generating Keys for Encryption and Decryption

From http://msdn.microsoft.com/en-us/library/5e9ft273(VS.80).aspx :

".NET Framework Developer's Guide
Generating Keys for Encryption and Decryption

Creating and managing keys is an important part of the cryptographic process. Symmetric algorithms require the creation of a key and an initialization vector (IV) that must be kept secret from anyone who should not decrypt your data. Asymmetric algorithms require the creation of a public key and a private key. The public key can be made public to anyone, while the private key must known only by the party who will decrypt the data encrypted with the public key. This section describes how to generate and manage keys for both symmetric and asymmetric algorithms."

Labels: , ,

.net Crypto

From http://msdn.microsoft.com/en-us/library/tswxhw92(VS.80).aspx

"
.NET Framework Developer's Guide
How to: Store Asymmetric Keys in a Key Container

Asymmetric private keys should never be stored verbatim or in plain text on the local computer. If you need to store a private key, you should use a key container. For more information on key containers, see the CryptoAPI section in the Platform SDK documentation at http://msdn.microsoft.com.
"

Labels: , ,

Mime Types



From : http://www.xml.com/pub/a/2005/06/08/restful.html

"One of the benefits of using HTTP correctly is that we can dispatch on a whole range of things. To make the discussion more concrete, let's look at an example HTTP request:

GET / HTTP/1.1
Host: 127.0.0.1:8080
User-Agent: Mozilla/5.0 (...) Gecko/20050511 Firefox/1.0.4
Accept: text/xml, application/xml, application/xhtml+xml, text/html;q=0.9,
text/plain;q=0.8, image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

There are three items of interest here. First, the HTTP request method is GET. Second, the URI is carried in two locations. The path and query parameters are on the first line of the request. The remainder of the URI, the domain name of the server, is carried in the Host header. Third, the media type is carried in the Accept header because this is a GET request. For other POST or PUT requests, the Content-Type header in the request carries the media type of the entity body."

Labels: ,