Perl strict Benchmark

This is a Example-Benchmark about to turn off things you don’t need in Perl:

Our Result:

Maybe a good solution is to use it to check your code and then to comment it out, maybe with a debug variable, for this take a look at Perl Debug Output.

(This is just an Example, don’t turn of use strict.)

C# Calculator

This is an old calculator program I wrote in C# :

Feel free to copy and share.

JavaScript location

In this article I wrote about the location object in JavaScript and what are the different between them.

Host

This two prints the host name, the different between them are that only host is with the port number from the host.

as example:

and we get this:

 

Port

If you just want to get the Port you could use this:

as example:

and we get this:

Together with “location.host” and “location.port” you could get “location.hostname”.

 

Protocol

To get the Server protocol you just need this:

as example:

and we get this:

 

Href,Origin and Pathname

To get some other URL information run this:

as example:

and we get this:

Href just returns the URL with the pathname, origin just the URL without the pathname, pathname just the path behind the URL and at least the search parameter returns the parameters behind the “?”.

Perl random password generator

This is an little example how to generate some password with numbers,lower letter, upper letter and some special chars in Perl :

Some random passwords:

Perl trim decimal number

This is a function to trim a decimal number in Perl, this function did not round the number just make an sub string from the dot to the end:

Result looks like this:

we see missing positions are filled with 0 and longer numbers are trimmed.

Java CSV to Array and Array to CSV

This is a little example in Java to convert a CSV String into an Multidimensional Array, after that i convert the Array back into a CSV String, you could choose the delimiter by yourself. In this case i take the “-” to see the different:

This is the Output, fist block separated with the “;” is the input and with “-” is the output:

PHP image upload

This is my image upload solution:

The name its stored is always an md5 hash of the file to avoid duplicate files.

Perl sub Benchmark

This is a Benchmark about the subroutines in Perl:

Result:

We see the normal way is the best solution.