Archive for June, 2008

Mozilla Firefox 3 made a Guinness World Record!

June 22, 08 by the programmer

The people from Mozilla set a world record for a most downloaded software in 24 hours.

On June 17, 2008 they got more than 8 million Firefox 3 downloads in 24 hours, and with that they set the Guinness World Record for a most downloaded software in 24 hours.

When I wrote this post there were 16,314,714 downloads.

As a big thank you for everybody who helped Firefox to set the record, Mozilla is giving thank you certificates.

Firefox 3 Download Certificate

Get one for you here

This is the official Firefox page for the world record

http://www.spreadfirefox.com/en-US/worldrecord/

How to change text case using CSS?

June 22, 08 by the programmer

If you want to change the case of some text, word, caption on your WEB page you can do that using CSS.

There is a property in the css called “text-transform“. This property has 4 possible values:

Value Description
none Default. Defines normal text, with lower case letters and capital letters
capitalize Each word in a text starts with a capital letter
uppercase Defines only capital letters
lowercase Defines no capital letters, only lower case letters

Examples:

<span style=”text-transform:capitalize;”>capitalized text</span> Capitalized Text

<span style=”text-transform:uppercase;”>uppercase text</span> UPPERCASE TEXT

<span style=”text-transform:lowercase;”>LOWERCASE TEXT</span> lowercase text

<span style=”text-transform:none;”>Text STAYS the SAME</span> Text STAYS the SAME

Remove the Ads from Yahoo Messenger

June 22, 08 by the programmer

If you install Yahoo Messenger 8.0, you’ll notice a very annoying animated ad at the bottom of the main window.

How to get rid of the ads?

1. Close Yahoo Messenger.

2. Save this .bat file and execute it.

You won’t be able to enter the chat rooms, so if you use this feature, don’t run the patch.

The original post can be found here. There are updates for yahoo messenger 9 there also.

Very nice vista icons

June 22, 08 by the programmer

Hi,

I recently found very interesting high quality Vista style icons, and I wanted to share them with you.

This is the link

http://commons.wikimedia.org/wiki/Category:Vista_icons

MD5 Generator on minanov.com

June 21, 08 by the programmer

Hi,

I just wanted to let you know that I made a MD5 Generator on my blog.

What does this generator do?

It calculates the md5 hash of a string.

The MD5 message-digest algorithm takes as input a message of arbitrary length and produces as output a 128-bit “fingerprint” or “message digest” of the input.

MD5 Hash is widely used for storing passwords.

This is where you can find it

http://minanov.com/md5-generator.php

How to write a custom PHP page in WordPress?

June 21, 08 by the programmer

WordPress is one of the most used blogging platform in the world.

It is very extensible throw the plugins and it is very easy to use.

However sometimes we need to make some custom pages that contain forms and other custom code that is more complicated to implement using plugins, it is much easier to implement them by simply creating a custom standalone wordpress page that will have all the wordpress standard headers footers, sitebars and everything else except that it will have a unique content.

This is very simple, all you have to do is create a PHP page in the WordPress root folder and copy the code bellow. That’s it .

The code bellow is very simple example of a page that contains a simple form with one text field and a submit button. When you click on the submit button the entered text will be displayed.

<?php
require_once ‘./wp-blog-header.php’;
get_header();
# CUSTOM CONTENT GOES HERE

$submited_value = $_REQUEST[’edb_text’];

$html_code = ‘
<div id=”content”>
‘.$submited_value.’
<form method=”post”>
<input type=”text” name=”edb_text” />
<input type=”submit” value=”Submit”>
</form>
</div>
‘;
print $html_code;

get_sidebar();
get_footer();
?>

Try it and have fun :)

Be careful when getting array length in JavaScript

June 21, 08 by the programmer

JavaScript is one of the most used script languages on the WEB.

A lot of times when we make some scripts we need to use arrays in order to store some data.

I found out a very interesting thing about arrays in JavaScript a few days ago. The think is that the array is an object and this object has a method for calculating length of the array that should return the number of elements that are stored in the array.

So lets explain this with a very simple example:

var a = [”dog”, “cat”, “hen”];

a[100] = “fox”;

var array_length=a.length;

alert(array_length);

101

As you can see the length method returns 101 which means that the array has 101 elements although it has only 4 elements.
So be careful when using the array.length method if the indexes in the array are not in order.

Remember - the length of the array is one more than the highest index.
So how to get the length of an array?

Well we can do it with a simple loop throw all of its elements, using the “for - in” syntax.

var array_length = 0;

for (i in a)

{

array_length++;

}

alert(array_length);

4

So the last JavaScript code will give us the number of elements in an array.

How to disable autoplay on Windows?

June 18, 08 by the programmer
Whenever you put a USB memory in the USB port or you insert a CD or DVD the Windows attempts to start the content on the medium.
This is a big security hole that some of the viruses use to spread themselves.
This is especially true if it is a USB memory because the viruses can copy themselves on the drive from the infected computer and after that with the autoplay option they can transfer themselves on the other (uninfected) machine, and by doing that they are spreading around
So in order to stop them from spreading around you can disable the autoplay option.
You can do that by following the bellow steps:

  1. Click Start ->Run
  2. Type “gpedit.msc” in the run text field
  3. Open “Computer Configuration -> Administrative Templates -> System “
  4. Find “Turn off AutoPlay”and double click it
  5. Click on the “enabled” radio button
  6. Select all drives from the drop down list bellow
  7. Click “Apply” to apply the changes
  8. That’s it, you are done

What is GNU?

June 13, 08 by the programmer

The GNU Project was launched in 1984 to develop a complete Unix-like operating system which is free software: the GNU system.

GNU’s kernel wasn’t finished, so GNU is used with the kernel Linux. The combination of GNU and Linux is the GNU/Linux operating system, now used by millions. (Sometimes this combination is incorrectly called Linux.)

There are many variants or “distributions” of GNU/Linux. We recommend the GNU/Linux distributions that are 100% free software; in other words, entirely freedom-respecting.

The name “GNU” is a recursive acronym for “GNU’s Not Unix”; it is pronounced g-noo, as one syllable with no vowel sound between the g and the n.

The above text is quoted from the GNU official site.

So , what is GNU?

GNU is a free Unix-like operating system. They started making the operating system in January 1984. You can read the initial announcement at http://www.gnu.org/gnu/initial-announcement.html.

The Free Software Foundation was founded in October 1985, initially to raise funds to help develop GNU.

By 1990 they managed to finish most of the parts of the operating system except for the kernel. In that time a Unix-like kernel, was developed by Linus Torvalds in 1991 and made free software in 1992. Combining Linux with the almost-complete GNU system resulted in a complete operating system: the GNU/Linux system.

Estimates are that tens of millions of people now use GNU/Linux systems, typically via distributions such as Slackware, Debian, Red Hat, and others.

The GNU General Public License (GPL), the GNU Lesser General Public License (LGPL), and the GNU Free Documentation License (GFDL) were written for GNU, but are also used by many unrelated projects.

To learn more about the GNU and the complete history of development, visit the GNU official site at http://www.gnu.org and you can visit the free software foundation site at http://www.fsf.org/

You can even buy a GNU shirt or adopt a Gnu. :) http://shop.fsf.org/

Conditional subpatterns with PCRE in PHP

June 12, 08 by the programmer

PCRE (Perl Compatible Regular Expressions) library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.

This library is used in many open source projects such as Apache Web Server and PHP.

Conditional subpatterns is something like an “if” statemant in regular expressions, which means that you can implement some conditions in your regular expression patterns and solve more complex problems in a simpler way.

According to http://www.php.net/manual/en/regexp.reference.php this is how you can implement a conditional statemant in a regular expression pattern

(?(condition)yes-pattern)
(?(condition)yes-pattern|no-pattern)

The question mark can be interpreted as “if”, so if the condition is satisfied then the yes-pattern will be used, if the condition is not satisfied then the no-pattern will be used if it exists

You can use the ?! for negative assertions.

This can be used to solve a lot of problems .

This is just an example that came to my mind. Find urls that are not http://minanov.com in some text.

$string = “

http://minanov.com

http://some_domain.com

some text

“;

preg_match(”/(?(?!http\:\/\/minanov\.com)http:\/\/.*| )/i”, $string, $matches);

print(”<pre>”.print_r($matches).”</pre>”);

The above print will return all the urls except the urls in the format http://minanov.com

Array ( [0] => http://some_domain.com )

PCRE Functions defined in PHP are

  • preg_grep — Return array entries that match the pattern
  • preg_last_error — Returns the error code of the last PCRE regex execution
  • preg_match_all — Perform a global regular expression match
  • preg_match — Perform a regular expression match
  • preg_quote — Quote regular expression characters
  • preg_replace_callback — Perform a regular expression search and replace using a callback
  • preg_replace — Perform a regular expression search and replace
  • preg_split — Split string by a regular expression

More details about those functions can be found here http://www.php.net/pcre