Sunday, April 21, 2013

R Package: mcga

Machine coded genetic algorithm (MCGA) is a fast tool for real-valued optimization problems. It uses the byte representation of variables rather than real-values. It performs the classical crossover operations (uniform) on these byte representations. Mutation operator is also similar to classical mutation operator, which is to say, it changes a randomly selected byte value of a chromosome by +1 or -1 with probability 1/2. In MCGAs there is no need for encoding-decoding process and the classical operators are directly applicable on real-values. It is fast and can handle a wide range of a search space with high precision. Using a 256-unary alphabet is the main disadvantage of this algorithm but a moderate size population is convenient for many problems. Package also includes multi_mcga function for multi objective optimization problems. This function sorts the chromosomes using their ranks calculated from the non-dominated sorting algorithm.

Package Url:

http://cran.r-project.org/web/packages/mcga/index.html

R Installation:

  install.packages ("mcga")

For help and example type

  ?mcga

in R console.


Tuesday, October 16, 2012

Encryption Functions in PHP: crypt() and md5()

Hi! In this article, I am going to share encryption functions on PHP programming language with you. Well, there are several functions about this subject, but here the point is crypt and md5.


md5 function is a text encryption. Here the text or string may be probably as password. md5 function makes the text a value which is 32-digit. Sure this value is probably going to be more complex than older text value.
print md5("phpservisi.com");
md5 function's output
The example given above shows us phpservisi.com string value's output with md5 function.

crypt function is the same mission with md5. Namely this is encryption function too. Here the variety is complexity of output. Because of it is some of us use this one, like me :) 

One more feature is the output of crypt function's about making one-way string hashing. crypt function will return a hashed string using alternative algorithms that may be available on the system.

Now, I'm coding about this:


echo crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com"); 
echo "\n".crypt("phpservisi.com");

crypt function's output
As you've seen on the top is crypt function's output. I did the same thing 8 times, and crypt function has just given us different results about those.

If you want to learn more information about this subject, you can visit the PHP Manual web page: md5cryptsha1_filecrc32sha1hash

Friday, August 17, 2012

A nice video on RCaller 2.0


A nice video on RCaller is in Youtube now. The original link is in Quantlabs.net. Thanks for the uploader.

Wednesday, August 8, 2012

libjvm.so: cannot open shared object file: No such file or directory


In my Ubuntu Linux, I was trying to call Java from C++ using JNI. Compiling progress was succeed but at runtime I saw an error on concole:

libjvm.so: cannot open shared object file: No such file or directory

Finding the right solution took five seconds but it was quite easy. I modified the LD_LIBRARY_PATH environment variable using export command in the Linux shell:

export LD_LIBRARY_PATH=/usr/lib/jvm/default-java/jre/lib/i386:/usr/lib/jvm/default-java/jre/lib/i386/client

The location of JDK is always changed because of updates but Ubuntu stores the links of current JVM in default-java directory. It is /usr/lib/jvm/default-java in my Linux. Two directories must be added to LD_LIBRARY_PATH. The first one is jre/lib/i386 and the second one is jre/lib/i386/client or jre/lib/i386/server in default-java directory. Use of export solves my problem.

Good luck!


Monday, August 6, 2012

Online Interpreters and Compilers in codepad.org

Today, I stumbled upon a web page which has got an online interpreter/compiler interface for many languages including C, C++, D, Haskell, Lua, OCaml, Php, Perl, Python, Ruby, Scheme and Tcl.

Just write your code, select the corresponding language and hit the submit button.
You will be forwarded to an other page in which the output of your code is shown.

Click here to goto codepad.org. Have Fun!