Friday, December 16, 2011

rsync exclude many patterns

To enter more than one pattern to exlude from rsync, --exclude "pattern" elements must be repeated.

rsync -azv --dry-run --exclude "pattern1" --exclude "pattern2" /path-source /path-destination

Wednesday, November 30, 2011

Windows Notepad++ delete line shortcut

Command to delete a line in Notepad++ (WIndows):
CTRL + L

Wednesday, November 23, 2011

jQuery - Check / uncheck all checkboxes on a page

Master checkbox element:
<input type="checkbox" name="checkAllAuto" id="checkAllAuto" value="1"/>

Assigning extra JS event to the control checkbox above:
$('#checkAllAuto').click(
   function()
   {
      $("INPUT[type='checkbox']").attr('checked', $('#checkAllAuto').is(':checked'));
   }
)

Thursday, November 10, 2011

Ubuntu svn client

Eclipse - do not create project file (change project file default location)

For some reasons you don't want Eclipse to create the .project file at the same location with the files of the project (maybe you don't have write permissions to the root folder of the project).

The goal is to change .project file location for Eclipse.

Solution: Linked Resources.
You can create a virtual folder (variable) and then include it in the project, created at another location. Changing anything in the virtual folder will change it at the original location.

1) Create a new project; location for the project: local hdd, anywhere...
2) Go to: Window->Preferences->General->Workspace->Linked Resources and create a new resource that points to the folder you need
3) In the project you created at 1) right click and select "New folder" -> Advanced and include the variable (virtual folder)
4) Done! Fixed!

Sunday, November 6, 2011

JavaScript - Extend/duplicate/copy object with jQuery


var Object1 = jQuery.extend(true, {}, Object);
var Object2 = jQuery.extend(true, {}, Object);
......

Friday, November 4, 2011

JavaScript - Remove element from array (optionally preserve keys)

JavaScript - Remove element from array (unset array element)

1) Method 1: splice
array.splice(position, number_of_keys);
Example:
array.splice(1, 1);

OBS: The function doesn't preserve key association.

2) Method 2:
To preserve key association, you must do something like this:

var my_array = [1, 4, 5, 6];
var remove_key = 1;
var array_new = [];
for(var i in my_array) {
    if(i != remove_key) {
        array_new[i] = my_array[i];
    }
}


JavaScript - Generate random number (range)

JavaScript : random number range

function randomRange(minVal, maxVal, floatVal) {
    var randVal = minVal+(Math.random()*(maxVal-minVal));
    return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
}

floatVal - optional, without it, the function will return an integer; it represents the number of decimal points; precision

Custom JavaScript list - custom data elements

Custom JavaScript list Add / Remove elements.

Example: add / remove <li> element to <ul> list:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="jquery/jquery-1.4.2.min.js" type="text/javascript"></script>
<style type="text/css">
.list1 {}
.list1 li {list-style:none;}
</style>
</head>
<body>


<script type="text/javascript">

var ListManager = {
  
    next_position : 0,
    elems : [],
  
    add : function(_data) {
        this.elems[this.next_position] = _data;
        this.next_position++;
        this.addHTMLelement(this.next_position - 1);
        /* this.displayConsole(); */
    },
    remove : function(_pos) {
        /* this.elems.splice(_pos, 1); */
        var elems_new = [];
        for(var i in this.elems) {
            if(i != _pos) {
                elems_new[i] = this.elems[i];
            }
        }
        this.elems = elems_new;
        /* this.displayConsole(); */
    },
    displayConsole : function() {
        console.log('----------------');
        for(var i in this.elems) {
            console.log(i + ' : ' + this.elems[i].text + ', ' + this.elems[i].value);
        }
    },
  
    addHTMLelement : function(_pos) {
        var html = '';
        html += '<li id="list-element-'+_pos+'">';
        html += '<span style="cursor:pointer;color:red;" onclick="ListManager.remove(\''+_pos+'\');ListManager.removeHTMLelement(\''+_pos+'\');">x</span>';
        html += ' - ';
        html += this.elems[_pos].text;
        html += '</li>';
        $('#list1').append(html);
    },
  
    removeHTMLelement : function(_pos) {
        $('#list-element-'+_pos).css({display:'none'});
    }
  
}

function addElementToList(_value, _text) {
    ListManager.add({
        value : _value,
        text  : _text
    });
}

function randomRange(minVal, maxVal, floatVal) {
    var randVal = minVal+(Math.random()*(maxVal-minVal));
    return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
}

</script>


<input type="text" name="text1" id="text1" value=""/>
<input type="button" name="button1" value="add" onclick="addElementToList(randomRange(5, 15), $('#text1').val())"/>
<input type="button" name="button2" value="clear" onclick="$('#text1').val('');"/>

<ul id="list1" class="list1"></ul>


</body>
</html>


jQuery AJAX cross domain request

Cross domain AJAX request

$(document).ready(function() {
  $.getJSON('http://twitter.com/users/usejquery.json?callback=?', function(json) {
    //get information about the user usejquery from twitter api
    $('#twitter_followers').text(json.followers_count);
    //get the follower_count from the json object and put it in a span
  });
});

http://usejquery.com/posts/9/the-jquery-cross-domain-ajax-guide

Saturday, October 29, 2011

MySQL BIGINT range

MySQL BIGINT range

BIGINT - signed :: from -9223372036854775808 to 9223372036854775807

BIGINT - unsigned :: from 0 to 18446744073709551615

Sunday, October 23, 2011

Tuesday, October 11, 2011

Ubuntu pdf image to text (OCR) - Extract all text from PDF

Ubuntu pdf image to text (OCR) - Extract all text from PDF


sudo apt-get install ghostscript

gs -dNOPAUSE -sDEVICE=tiffg4 -r600x600 -dBATCH -sPAPERSIZE=a4 -sOutputFile=file-name.tif file-name.pdf

# depending on the language, you must install the corresponding package:
sudo apt-get install tesseract-ocr tesseract-ocr-eng

tesseract file-name.tif file-name-txt-without-extension -l eng


Friday, September 23, 2011

PHP: Output any string using JavaScript

Output any string from PHP using JavaScript document.write() function.

 
function echoWithJS($_str) {
    $str = str_replace(
        array('"', '</', chr(10), chr(11), chr(13)),
        array('\\"', '<\\/', '', '', ''),
        $_str
    );
    $out = '
        <script language="javascript" type="text/javascript">
            //<!--
            '.'document.write("'.$str.'");
            //-->
        </script>
    ';
    echo $out;
}


Thursday, September 8, 2011

Google +1 vs robots.txt

The presence of Google +1 button on a page will override robots.txt restrictions for that page. Google +1 button should only be placed with pages with content intended to be public, Google crawler will ignore robots.txt blocks for that page and fetch it.

Google's Top Contributors - page & map

Trafic web gratuit - WSTATS.NET & Google Analytics

Statistici trafic web gratuite pentru toate site-urile tale.

Informatii trafic site oferite gratuit folosind statistici Google Analytics.

WSTATS.NET - GRATIS, FARA ABONAMENT

Monday, September 5, 2011

mcedit undo command

How to undo in Midnight Commander editor: CTRL + u

Sunday, September 4, 2011

Mysql unix timestamp to date

Mysql unix timestamp to date:  FROM_UNIXTIME(unix_timestamp) function.

Example:
SELECT *, FROM_UNIXTIME(time_expire) texp FROM _queue ORDER BY texp;

Friday, September 2, 2011

PHP - Sort multi-dimensional array by one key

The following function sorts an array (with the form shown in the example below) by any key and supports all PHP sort types (SORT_STRING, SORT_NUMERIC) and sort direction.
Oldies but goldies: as years passed by, the function served well and was allways there when needed.
Obs: array_multisort() PHP's native function can be also of use for similar jobs (mehr oder weniger), but the function presented below doesn't make use of it.

Example sort array by key:
$a = array(
    array('name' => 'John', 'salary' => 1245),
    array('name' => 'Paul', 'salary' => 1105),
    array('name' => 'Ralf', 'salary' => 2232),
);
// Sort by name (string)
$a1 = ar1_sort($a, 'name', SORT_STRING);
// Sort by salary (int)
$a2 = ar1_sort($a, 'name', SORT_NUMERIC, 'desc');

function ar1_sort($a, $sort_key, $sort_type = SORT_NUMERIC, $direction = 'asc') {
    $t = array();
    foreach($a as $k => $v) {
        $t[$k] = $v[$sort_key];
    }
    asort($t, $sort_type);
   
    $res = array();
    foreach($t as $k => $v) {
        $res[] = $a[$k];
    }
   
    if($direction == 'desc') {
        $res = array_reverse($res);
    }
   
    return $res;
}


Test MySQL - nivel introductiv

Test MySQL - foarte util si recomandat pentru a invata MySQL

1) Sa se creeze tabela studenti care sa contina urmatoarele campuri:
id_student - int(11) UNSIGNED auto_increment PRIMARY_KEY
nume - varchar(100)
prenume - varchar(100)
data_nastere - date

2) Sa se insereze in tabela studenti urmatoarele date (nume, prenume, data_nastere):
'Popescu', 'Valentin', '1985-10-24'
'Ionescu', 'Marian', '1982-07-24'
'Iliescu', 'Ioana', '1985-09-10'
'Mutu', 'Adrian', '1979-04-12'

3) Sa se scrie:
a) un query care sa afiseze toti studentii al caror nume incepe cu "I"
b) un query care sa afiseze toti studentii al caror nume se termina cu "escu"
c) un query care sa afiseze toti studentii care sunt nascuti in 1985 (se foloseste functia YEAR, exemplu: SELECT YEAR(data_nastere) FROM studenti)

Baze de date relationale

4)
a) Sa se creeze tabela bac_probe care sa contina urmatoarele campuri:
id_proba - int(5) UNSIGNED auto_increment PRIMARY_KEY
proba - varchar(100)
b) Sa se insereze urmatoarele probe de bacalaureat: 'Matematica', 'Limba romana - scris', 'Limba romana - oral', 'Limba engleza - oral', 'Geografie', 'Fizica'

5)
a) Sa se creeze tabela bac_rezultate care sa contina urmatoarele campuri:
id_rezultat - int(11) UNSIGNED auto_increment PRIMARY_KEY
id_proba - int(5) UNSIGNED
id_student - int(11) UNSIGNED
nota - tinyint(2) UNSIGNED
b) Pentru a preveni existenta duplicatelor, perechea de campuri id_proba si id_student se defineste ca fiind UNIQUE (un student poate sustine o singura data o proba)
c) Sa se insereze note pentru studenti la toate probele disponibile (note intre 1 si 10); se insereaza valori pentru campurile: id_proba, id_student, nota (trebuie sa fie in total: 4 studenti * 6 probe = 24 de note)

6) Sa se obtina urmatoarele informatii:
a) Media notelor la toate probele pentru studentul Ionescu Marian (id_student = 2); se foloseste functia AVG (average = medie; exemplu: SELECT AVG(nota) FROM bac_rezultate WHERE id_student = 2)
b) Sa se afiseze numele, prenumele si media notelor la toate probele pentru fiecare student, ordonat descrescator dupa medie; se foloseste subquery
c) Sa se afiseze numele, prenumele si nota obtinuta la proba 'Fizica' de studentul Ionescu Marian; se foloseste JOIN (LEFT JOIN)





Saturday, August 27, 2011

Leverage browser caching - Apache optimization

Leverage browser caching. Specify an expiration at least one week in the future. Apache optimization.

$ sudo cp /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/

# Add to /etc/apache2/sites-enabled/000-default or apache2.conf :
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>

$ sudo /etc/init.d/apache2 restart

Javascript Regexp Match Test

Javascript Regexp Match Test

var my_string = '2010-09-01';
var regExp = new RegExp('^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$', 'gim');
if(my_string.match(regExp)) {
    alert('String matches expression');
} else {
    alert('String doesn't match expression');
}

Specify a character set in HTTP headers - Apache optimization

Specify a character set in HTTP headers - Apache optimization

AddDefaultCharset utf-8

Friday, August 19, 2011

PHP - Better and faster random values with mt_rand()

It's recommended to use mt_rand() instead of rand() function.

Powered by Mersenne Twister algorithm, mt_rand() is faster and produces better random values.

Ex: $rand = mt_rand(2, 200);

Ubuntu: Convert JPG files to PDF

Convert multiple JPG files to one PDF document

$ sudo apt-get install imagemagick

$ cd /...path-to-jpg-files...

$ convert jpg-file-* document.pdf

Ubuntu: Mass resize pictures

1) Applications -> Graphics -> gThumb Image Viewer

2) Select photos to be resized

3) Tools -> Scale images

Wednesday, August 17, 2011

Ubuntu 10.04 - Eclipse 3.2.2 - Projects list disappears after Ubuntu update

Problem description: After an Ubuntu update the Navigator in Eclipse is empty, it contains no projects. Creating new projects and restarting Eclipse (after reboot) ends with an empty project list.

Eclipse Error (error log file):
!MESSAGE Skipping builder org.eclipse.dltk.core.scriptbuilder for project PROJECT_NAME. Either the builder is missing from the install, or it belongs to a project nature that is missing or disabled.

Solution:

1) Install Java JDK: http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

2) Convert RPM to DEB (with alien)

3) sudo dpkg -i jdk_xxxxx.deb

4) reboot

Problem fixed!

PHP - Messages handling - Success and error messages, session based system

Handle the display of errors and success messages across all website sections.

The functionality is very simple, allowing to set a success or error message anywhere in the execution thread (in the main file, in a function or in a class method). Once the message is stored (written to session in this case), it is scheduled to be displayed. After the message is displayed, it is deleted from session. The Singleton implementation for the Messages class offers extra programming speed and ease of use.

1) Class definition

class SessionMessages {
   
    static private $instance = null;
   
    private $session_name = 'session_messages';
   
    public function __construct() {
        if(!isset($_SESSION[$this->session_name])) {
            $_SESSION[$this->session_name]['message'] = '';
            $_SESSION[$this->session_name]['message_available'] = false;
            $_SESSION[$this->session_name]['message_error'] = '';
            $_SESSION[$this->session_name]['message_error_available'] = false;
        }
    }
   
    public function getInstance() {
        if(!self::$instance) {
            self::$instance = new SessionMessages();
        }
        return self::$instance;
    }
   
    public function setMessage($_message) {
        $_SESSION[$this->session_name]['message'] = $_message;
        $_SESSION[$this->session_name]['message_available'] = true;
    }
   
    public function messageAvailableToDisplay() {
        return $_SESSION[$this->session_name]['message_available'];
    }
   
    public function getMessageForDisplay() {
        $_SESSION[$this->session_name]['message_available'] = false;
        return $_SESSION[$this->session_name]['message'];
    }
   
    public function setMessageError($_message) {
        $_SESSION[$this->session_name]['message_error'] = $_message;
        $_SESSION[$this->session_name]['message_error_available'] = true;
    }
   
    public function messageErrorAvailableToDisplay() {
        return $_SESSION[$this->session_name]['message_error_available'];
    }
   
    public function getMessageErrorForDisplay() {
        $_SESSION[$this->session_name]['message_error_available'] = false;
        return $_SESSION[$this->session_name]['message_error'];
    }
   
}

2) Storing a success message
if(...database insert ok...) {
    SessionMessages::getInstance()->setMessage('Custom OK message.');
}

3) Storing an error message
if(...database insert failed...) {
    SessionMessages::getInstance()->setMessageError('Errors encountered.');
}

4) The file which displays the messages (included in header.php for example):

if(SessionMessages::getInstance()->messageAvailableToDisplay()) {
    echo '<div class="msg">' . SessionMessages::getInstance()->getMessageForDisplay() . '</div>';
}

if(SessionMessages::getInstance()->messageErrorAvailableToDisplay()) {
    echo '<div class="errors">' . SessionMessages::getInstance()->getMessageErrorForDisplay() . '</div>';
}

It's the most rapid solution for managing messages in any PHP application.

Ubuntu - Convert RPM to DEB

Install alien:
$sudo apt-get update
$sudo apt-get install alien

Convert to deb:
$sudo alien -k file.rpm

Install deb package:
$sudo dpkg -i file.deb

Tuesday, August 16, 2011

WTX - Wstats Trafic Index - new Wstats.net Index

Wstats Trafic Index - WTX

WTX is the newest and most important indicator for a website and a user.
The four most important values for a website (Visitors, Visits, Pageviews, Bounce) are used to compute WTX, according to the formula:

Avg1 = (Visitors + Visits + Pageviews) / 3;
Val1 = (Visitors + Visits + Avg1) / 3;
Val2 = sqrt(1 + (1 - Bounce / 100));
WTX = 17 * sqrt(Val1 * Val2);
sqrt - square root

WTX index for a user is the sum of all WTX indexes of the websites belonging to the user.

This is a major update for Wstats.net, now every user having a public indicator that can be consulted anytime, by anyone, an indicator which doesn't divulge the private values: visitors, visits, pageviews or bounce rate, but yet offers an image of the user's activity.

User example: http://wstats.net/en/user/eydos
Website example: http://wstats.net/en/website/sursadestiri.ro

Monday, August 15, 2011

Javascript - Lowercase HTML input field

Lowercase HTML input field example:

<input id="title_x" type="text" name="title" value="Uppercase TEXT SAMPLE"/>

<span onclick="document.getElementById('title_x').value = document.getElementById('title_x').value.toLowerCase();" style="cursor: pointer;">lowercase</span>

Thursday, August 11, 2011

Gropi cosmice, partea a 2-a

Acum aproximativ o luna, Guatemala. Cauza fenomenului (versiunea oficiala): furtunile tropicale.

Acelasi fenomen, in 2010, in Germania (unde nu exista furtuni tropicale) si Guatemala: http://ionutb.eydos.ro/2010/11/gropi-cosmice.html

Tuesday, August 9, 2011

Jim Rogers on U.S. Downgrade, Global Markets, 08 aug 2011

Best Ubuntu mp3 player: Audacious

Audacious offers the best sound quality and also has the old xmms style (perhaps also the code).

Other mp3 players tested under Ubuntu, Gnome:
- Exaile Music Player
- RhythmBox Music Player
- Amarok

Monday, July 18, 2011

Slimbox and Carousel combination

The combination of Slimbox and Carousel offers one of the best ways to present an image collection (image gallery) to the user, giving a very pleasant experience.

Howto implement Slimbox and Carousel together

CSS declarations:

<link rel="stylesheet" type="text/css" href="/jcarousel/skins/tango/skin.css" />
<link rel="stylesheet" type="text/css" href="/style/slimebox.css"/>


Scripts inclusion:

<script language="javascript" type="text/javascript" src="/js/jquery/jquery-1.4.min.js"></script>
<script language="javascript" type="text/javascript" src="/js/jquery/jquery.jcarousel.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel();
});
</script>

<script type="text/javascript" src="/js/slimebox/mootools_full.js"></script>
<script type="text/javascript" src="/js/slimebox/slimebox.js"></script>


HTML code:

<ul id="mycarousel" class="jcarousel-skin-tango">
<li><a href="/images/screens/image1.png" rel="lightbox[picsbar]" title="Image 1"><img src="/images/screens/thumbs/image1.png" width="170" height="115" alt="Image 1" border="0"/></a></li>
<li><a href="/images/screens/image2.png" rel="lightbox[picsbar]" title="Image 2"><img src="/images/screens/thumbs/image2.png" width="170" height="115" alt="Image 2" border="0"/></a></li>
<li><a href="/images/screens/image3.png" rel="lightbox[picsbar]" title="Image 3"><img src="/images/screens/thumbs/image3.png" width="170" height="115" alt="Image 3" border="0"/></a></li>
<li><a href="/images/screens/image4.png" rel="lightbox[picsbar]" title="Image 4"><img src="/images/screens/thumbs/image4.png" width="170" height="115" alt="Image 4" border="0"/></a></li>
</ul>

Sunday, July 17, 2011

Saturday, July 16, 2011

Conversie text fara diacritice in text cu diacritice

O aplicatie foarte buna de conversie a unui text fara diacritice in text cu diacritice: http://srv.diacritice.com/.

Friday, July 15, 2011

Alternativa trafic pentru t5.ro, wta.ro, gtop.ro, SATI

Wstats.net este o alternativa noua pentru programele de monitorizare statistici trafic web existente deja. Daca vrei sa incerci o alternativa pentru wta.ro, gtop.ro, t5.ro, statistics.ro, statcounter.com, SATI, inscrie-te pe wstats.net.

Trafic web pentru toate site-urile tale prezentat altfel.

Wstats.net are o abordare noua in prezentarea statisticilor, incercand sa ofere o imagine de ansamblu asupra tuturor site-urilor detinute de un utilizator. Informarea rapida si completa cu privire la toate site-urile reprezinta obiectivul principal.

Ce ofera Wstats.net:
1) - acurateatea datelor masurate: Wstats.net este partener Google Analytics (datele sunt contorizate de Google Analytics si preluate securizat de Wstats.net).
2) - poti crea grupuri de site-uri si vedea cumulat statisticile la nivel de grup
3) - ai libertate totala in alegerea informatiilor pe care sa le faci publice despre site-urile tale:
- poti seta ce statistici sa fie publice sau private
- poti seta ce grupuri de site-uri sa fie publice sau private
- poti alege ca numele unui site sa fie privat
4) - toate serviciile sunt GRATUITE

Wstats.net este o aplicatie recunoscuta de Google, fapt ce confirma gradul de securitate ridicat pe care il asigura utilizatorilor sai.

Incearca alternativa Wstats.net

Monday, July 11, 2011

Javascript: substr, substring

Javascript: substr()

string.substr(start, length);

Sunday, July 10, 2011

Ubuntu Linux: Convert MKV to AVI

Ubuntu - Convert MKV to AVI

Method 1:
$ mencoder -mc 0 -noskip -vf expand=:::::16/9,scale=720:480,hqdn3d,harddup -ovc xvid -oac mp3lame -xvidencopts fixed_quant=3.8:me_quality=6:noqpel:nogmc:trellis:chroma_me:chroma_opt:hq_ac:vhq=4:lumi_mask:max_key_interval=300:quant_type=mpeg:max_bframes=2:closed_gop:nopacked:profile=asp5:autoaspect:bvhq=1 -lameopts vbr=2:q=6:aq=2 -o my-video.avi my-video.mkv

Method 2:
$ mplayer my-movie.mkv -dumpaudio -dumpfile audio.mp3
$ mplayer my-movie.mkv -dumpvideo -dumpfile video.264
$ mencoder -vf harddup -oac copy -ovc copy -o output_movie.avi -audiofile audio.mp3 video.264

Monday, June 27, 2011

MySQL: Check, repair and optimize tables (all tables, all databases)

MySQL check, repair or optimize:
- all tables in a databases
- all tables from all databases
- a certain table

Check tables for all databases:
$ mysqlcheck -u root -p -v --all-databases

Check tables for a certain database:
$ mysqlcheck -u root -p -v db_name

Optimize table:
$ mysqlcheck -u root -p -v --optimize db_name table_name

Repair table:
$ mysqlcheck -u root -p -v --repair db_name table_name

Auto-repair tables:
$ mysqlcheck -u root -p -v --auto-repair db_name

Linux - rm - Argument list too long - Solution

When deleting too many files in one directory using rm the following error can appear: "rm: Argument list too long".

Problem:
$ rm *
bash: /bin/rm: Argument list too long

Solution:
$ find ./ -name "*file_name_part*" -delete

Twitter Advertising, next step

Twitter is looking to introduce more advertising, targeting its most active sections: Twitter plans bolder advertisements

Sunday, June 26, 2011

Ubuntu convert VOB to AVI

How to convert VOB to AVI in Ubuntu:
ffmpeg -i video.vob -sameq new-video.avi

Thursday, June 16, 2011

FaceBook is loosing customers in U.S., Canada and other countries

FaceBook is loosing users in countries it was first established.
For the month of May: - 6 mil. users in U.S. (from 155.2 mil. to 149.4 mil.), - 1.52 mil. users in Canada (to 16.6 mil.), - 100.000 users each in U.K., Norway, and Russia.
Overall, the total number of FaceBook users increased by 1.7% driven by growth in other countries (Brazil, Mexico, etc).
The reasons are multiple:
- too much noise on the network
- privacy issues and concerns
- constant bombardment with unsolicited material
- aggressive way of introducing new features
...

Wednesday, June 15, 2011

Google Voice Search available on personal computers

Google Voice Search available on personal computers, laptops, mobile phones and any other devices.
For laptop/PC the only requirements in order to use Google Voice Search are Google Chrome Web Browser and a microphone of course. More about this:
http://googleblog.blogspot.com/2011/06/knocking-down-barriers-to-knowledge.html

Google Instant Pages, under Chrome

After performing a Google Search, from the results displayed, Google makes a "guess" about which result you will click. Based on this "guess", only when you are using Google Chrome Web Browser, Google "prerenders" (preloads) the page you are about to click on. The result: when you click on that result, the target site loads instantly.
More info:
http://googlewebmastercentral.blogspot.com/2011/06/announcing-instant-pages.html
http://blog.chromium.org/2011/06/prerendering-in-chrome.html

Tuesday, June 14, 2011

Bursa de domenii

InfoDomenii.ro :: Cumpara si vinde domenii pe bursa de domenii. Gaseste parteneri pentru reclama web. Promoveaza-ti serviciile si afacerea.

Monday, June 13, 2011

Javascript: Automatically adjust iframe height to fit content

This solves the need to adjust the height of an iframe depending on the length of the content inside the iframe. The iframe may contain images, text, etc.

This solution is also appropiate for the situations when you have a form inside an iframe and the number of the fields of the form changes dynamically (javascript) depending on user actions. Also the display of form errors above the form may be a cause for content stretching over the predefined height of the iframe.

Technical description: The height of the iframe's content is read from inside the iframe and a function from the parent window is called in order to modify the height.

File 1, dynamic-height-adjusting-iframe.html :

<html>
<head>
<title>read element height</title>
<script type="text/javascript">
function adjustIframeHeight(_h) {
    var new_h = _h + 50;
    document.getElementById('my_iframe').style.height = new_h + 'px';
}
</script>
</head>

<body>

<div>
Other text here<br/>
Other text here<br/>
Other text here.<br/>
</div>

<iframe id="my_iframe" src="dynamic-height-adjusting-iframe-content.html" width="730" height="650" scrolling="no" frameborder="1" marginwidth="0" marginheight="0" style="border-top:2px solid #ccc;border-left:2px solid #ccc;border-right:2px solid #ddd;border-bottom:2px solid #ddd;"></iframe>


</body>
</html>


File 2, dynamic-height-adjusting-iframe-content.html :

 <html>
<head>
<title>read element height</title>
<script type="text/javascript">
function getXYpos(elem) {
   if (!elem) {
      return {"x":0,"y":0};
   }
   var xy={"x":elem.offsetLeft,"y":elem.offsetTop}
   var par=getXYpos(elem.offsetParent);
   for (var key in par) {
      xy[key]+=par[key];
   }
   return xy;
}
function getHeightBetweenElements(elem1, elem2) {
    var xy1 = getXYpos(elem1);
    var xy2 = getXYpos(elem2);
    return xy2.y - xy1.y;
}
function adjustMySelf() {
    var h = getHeightBetweenElements(document.getElementById('pos-reper1'), document.getElementById('pos-reper2'));
    parent.adjustIframeHeight(h);
}
</script>
</head>

<body>
<div id="pos-reper1"></div>

<div style="width: 300px; margin: 0 auto;">
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
</div>

<div id="pos-reper2"></div>

<script type="text/javascript">
adjustMySelf();
</script>
</body>
</html>

Javascript: Read element height containing dynamic text

Read the height of any DOM element (paragraph, div, etc) which doesn't have a height predefined and contains dynamically generated text (variable length content).

Example, file read-element-height.html :

<html>
<head>
<title>read element height</title>
<script type="text/javascript">
function getXYpos(elem) {
   if (!elem) {
      return {"x":0,"y":0};
   }
   var xy={"x":elem.offsetLeft,"y":elem.offsetTop}
   var par=getXYpos(elem.offsetParent);
   for (var key in par) {
      xy[key]+=par[key];
   }
   return xy;
}
function getHeightBetweenElements(elem1, elem2) {
    var xy1 = getXYpos(elem1);
    var xy2 = getXYpos(elem2);
    return xy2.y - xy1.y;
}
</script>
</head>

<body>

Other text here<br/>
Other text here<br/>
Other text here.

<div id="container">
<div id="pos-reper1"></div>
<div style="width: 300px; margin: 0 auto;" id="container-text">
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
text sakfjdsio fdiojsifojdsio fjdiojs fds
</div>
<div id="pos-reper2"></div>
</div>


<div>
Height of the dynamic text box (between 'pos-reper1' and 'pos-reper2') is:
<script type="text/javascript">
var h = getHeightBetweenElements(document.getElementById('pos-reper1'), document.getElementById('pos-reper2'));
document.write(h + 'px');
</script>
</div>

<div>
Adjusting container height and adding extra 50px...
<script type="text/javascript">
var h_container = h + 50;
document.getElementById('container').style.height = h_container + 'px';
document.getElementById('container').style.backgroundColor = 'PaleGoldenrod';
</script>
</div>

</body>
</html>

Sunday, June 12, 2011

Scroll parent window from child iframe

Scroll parent window to top, from child iframe:
<script type="text/javascript">
parent.scroll(0, 0);
</script>

Thursday, June 9, 2011

Exclude directories from TAR archive - CACHEDIR.TAG file

Prevent TAR from archiving directories of your choice. Add the file CACHEDIR.TAG in the directory you don't want it to be archived, with the following content:

$cat CACHEDIR.TAG
Signature: 8a477f597d28d172789f06886806bc55
# marked as cache in order to be excluded from scheduled backup

Linux - change default editor (usually `vi`) - set new editor: `mcedit`

To change the default editor (for commands like `crontab -e`), run:
export VISUAL='mcedit'
export EDITOR='mecedit'

Both above lines should be added to ~/.bashrc in order to keep this setting permanent.

Change default editor in MC (Midnight Commander):
In mc menu select: Options -> Configuration -> use internal edit

Monday, June 6, 2011

Grant DELETE MySQL

GRANT DELETE ON `db_name`.`table_name` TO 'user'@'localhost';

Thursday, May 26, 2011

WSTATS.NET - solutia pentru a-ti monitoriza usor si rapid statisticile GA pentru TOATE site-urile

Poti publica statisticile Google Analytics folosind WSTATS.NET (toate statisticile sunt default private).

Comparatii site-uri, grupuri site-uri, urmarire statistici cumulate pe grupuri, comparatii grupuri, cumulate valorile vizitatori/vizite/afisari per user, clasament
utilizatori in functie de aceste valori cumulate.

Interogarea Google API (Google Analytics) se face securizat(criptat), wstats.net este un domeniu-aplicatie inregistrat la Google.

Tuesday, May 24, 2011

PHP obtain date one month ago

One month ago date:

date('Y-m-d',strtotime('1 month ago'));

Thursday, May 19, 2011

PHP, MySQL: Obtain all days for year-month pair

Get all dates / days for a given year and month (from a table containing articles for example).

SELECT DISTINCT DAY(datec) `day`
FROM table_name
WHERE DATE_FORMAT(datec, '%Y-%m') = '$year-$month'

MySQL DATE_FORMAT() - Description from Manual

Important MySQL Full Text Search observation

The number of results returned using MySQL full text search is always less than 50% of the total table size.

This is very useful to know when performing tests during development phase.

Wednesday, May 11, 2011

Javascript Regexp Replace

Replace characters using regular expressions in JavaScript.

string = string.replace(new RegExp('[^a-z0-9 ._-]', 'gim'), '');

Thursday, May 5, 2011

Valhalla Rising

MySQL get day of week

How to get day of week in MySQL:

WEEKDAY(date)

mysql> SELECT WEEKDAY('2008-02-03 22:23:00');
mysql> SELECT WEEKDAY('2008-02-03');

(0 = Monday, 1 = Tuesday, ... 6 = Sunday)

Tuesday, May 3, 2011

Scroll page to top after AJAX request or other actions

After loading page 2 or any other page in a list using AJAX, the browser must be scrolled to top.

<a href="http://www.blogger.com/list.html#page=2" onclick="window.scroll(0,0)">2</a>

window.scroll(0,0) - scroll to top command

PS: For example Google Analytics lists leave the page unscrolled after loading a new page from the list.

Who, what, where, when, why and how

Complete description about an event: who, what, where, when, why and how!
This clarifies it 99.99% of the time.

MySQL - Create new database, new user, set privileges

Create database, create user, grant privileges, reload MySQL:

CREATE DATABASE `dbname` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE USER 'dbuser'@'hostname' IDENTIFIED BY '***password***';

GRANT USAGE ON * . * TO 'dbuser'@'hostname' IDENTIFIED BY '***password***' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;

GRANT SELECT , INSERT , UPDATE ON `dbname` . * TO 'dbuser'@'hostname';

FLUSH PRIVILEGES;

Bursa de site-uri, licitatii site-uri

Oferte/licitatii site-uri, bursa de site-uri, cumparare/vanzare domenii, cumparare/vanzare reclama, schimb de link-uri.

Tranzactii, parteneriate, calificative, multe altele.

Totul pe infodomenii.ro : bursa de site-uri, licitatii site-uri

Thursday, April 28, 2011

DNS dig alternative

dig alternative

Get DNS info for a domain:

$ host google.com
google.com has address 74.125.77.147
google.com has address 74.125.77.99
google.com has address 74.125.77.104
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.

Sunday, April 17, 2011

Methods of communication

Today's communication tools:

0) E-mail
1) Instant messaging
2) Text messaging (SMS)
3) Group chats
4) Collaboration tools
5) Internal blogs
6) Social networks
7) Talking
8) Video conferences

Full original article: 8 Email Replacement Technologies

PHP HTML minimizer; PHP CSS minimizer

Minify HTML, minify CSS using PHP and regular expressions.

Minify HTML

function minify_html1($d) {
    $d = str_replace(array(chr(9), chr(10), chr(11), chr(13)), ' ', $d);
    $d = preg_replace('`<\!\-\-.*\-\->`U', ' ', $d);
    $d = preg_replace('/[ ]+/', ' ', $d);
    $d = str_replace('> <', '><', $d);
    return $d;
}

Minify CSS

function minify_css1($d) {
    $d = str_replace(array(chr(9), chr(10), chr(11), chr(13)), ' ', $d);
    $d = preg_replace('`/\*.*\*/`U', ' ', $d);
    $d = preg_replace('/[ ]+/', ' ', $d);
    $d = str_replace('; ', ';', $d);
    $d = str_replace('} ', '}', $d);
    $d = str_replace('{ ', '{', $d);
    $d = str_replace(': ', ':', $d);
    $d = str_replace(' {', '{', $d);
    return $d;
}

Thursday, April 14, 2011

Get redirect URL from headers (recursive)

Recursively obtain the redirect URL from web server page headers.
The method makes use of regular expressions, the PHP Curl library and also offers the possibility to indicate a number of consecutive (cascaded) redirects to follow. 

Usage:

$redirect_url = xDomainTools::getInstance()->getRedirectUrlRecursive($url, 2);

[Class ]methods:

class xDomainTools {
  
static private $instance = null;
  
private $ua = array(
    'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/3.5.1',
    'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)',
);

public function __construct() {}

public function getInstance() {
    if(!self::$instance) {
        self::$instance = new xDomainTools;
    }
    return self::$instance;
}

private function getUaRand() {
    return $this->ua[rand(0, count($this->ua))];
}

public function getUrlContent($_url, $_referer = '', $_ua = '', $_return_transfer = true, $_timeout = 20, $_including_header = false, $_follow_location = true) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $_url);
    curl_setopt($ch, CURLOPT_HEADER, $_including_header);
    curl_setopt($ch, CURLOPT_REFERER, $_referer);
    curl_setopt($ch, CURLOPT_USERAGENT, strlen($_ua) ? $_ua : $this->getUaRand());
  
    curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__) . '/cookies.txt');
    curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__) . '/cookies.txt');
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $_follow_location);
  
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $_timeout);
    curl_setopt($ch, CURLOPT_TIMEOUT, $_timeout);
  
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, $_return_transfer);
  
    $d = curl_exec($ch);
    curl_close($ch);
  
    return $d;
}

public function getRedirectUrl($_url) {
    $header_content = xDomainTools::getInstance()->getUrlContent($_url, '', '', true, 20, true, false);
    $header_content = str_replace(array(chr(10), chr(11), chr(13)), ' ', $header_content) . ' ';
    preg_match('`.*(301 Moved Permanently|Redirect).*Location: (http://[^ ]+) .*`Ui', $header_content, $m);
    #printr($m);
    if(strlen($m[2])) {
        return $m[2];
    }
    return '';
}

public function getRedirectUrlRecursive($_url, $_no_redirects = 3, $_iteration = 0) {
    $_iteration++;
    if($_iteration == $_no_redirects + 1) {
        return $_url;
    }
    $url_redirect = $this->getRedirectUrl($_url);
    if(strlen($url_redirect)) {
        return $this->getRedirectUrlRecursive($url_redirect, $_no_redirects, $_iteration);
    }
    return $url_redirect;
}

}

Monday, April 4, 2011

Easy reading, hard writing

Easy reading is damn hard writing !

The simpler the interface, the heavier the code behind it.

Sunday, April 3, 2011

iconv and strtr combination

I had to decode input strings that some times were encoded using a known charset (ex: ISO-8859-2) and other times an unknown encoding.

I must apply for the first case a conversion from ISO-8859-2 to UTF-8 using iconv.
$t = iconv("ISO-8859-2", "UTF-8//TRANSLIT//IGNORE", $t);

For the unknown encoding I must convert it using strtr.
$pairs = array('ã' => 'ă', 'º' => 'ş'); // for example
$t = strtr($t, $pairs);

Applying both conversions to the input string secventially will affect the output, malforming the characters.

The encoding should be somehow detected before applying any of the given conversions. But it is difficult and time consuming to attempt to determine the encoding of the input.

SOLUTION:
Apply strtr conversion first and compare the output with the input and if they are different, that's the right conversion, if not, the iconv conversion mut be applied.

function convChars($t) {
    $pairs = array('ã' => 'ă', 'º' => 'ş'); // for example
    $t2 = strtr($t, $pairs);
    if($t2 != $t) {
        $t = $t2;
    } else {
        $t = iconv("ISO-8859-2", "UTF-8//TRANSLIT//IGNORE", $t);
    }
    return $t;
}

Friday, April 1, 2011

Rsync over ssh custom ssh port

Directory syncronization on 2 systems using rsync over ssh.

rsync -az -e "ssh -p XXXX" /path1 user1@server1:/path2/

Sunday, March 6, 2011

Slimbox disable image scaling

File slimebox.js (Mootools Slimebox Lightbox)
...
nextEffect: function() {
switch(this.step++) {
case 1:
this.center.className = '';

this.bottom.style.display="";

scale = Math.min((Window.getHeight() * 13/15 - this.bottom.scrollHeight - 16) / this.preload.height, (Window.getWidth()) / this.preload.width);
...

Comment line: scale = Math.min.......
Add new line: scale = 1;

The large image will not be scaled to fit window size, it will be display as it is, undistorted by resize operation.

Saturday, February 12, 2011

Statistici trafic web, localizare geografica: wstats.ro

Informatii trafic web, localizare geografica, monitorizare statistici site-uri in paralel pe acelasi grafic, monitorizare grupuri de site-uri. Poti alege statisticile Google Analytics pe care vrei sa le faci publice: wstats.ro - statistici trafic web.

Sunday, February 6, 2011

Wednesday, February 2, 2011

Nested ob_start (output buffering)

PHP supports nesting ob_start() elements. This is a very new discovery. :) And a pleasant one. :)

Example:
ob_start();
ob_start();
echo 'abc...';
$c1 = ob_get_contents();
ob_end_clean();
echo 'def...' . $c1;
$c2 = ob_get_contents();
ob_end_clean();
echo $c2;

PHP Manual:
Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order.

The fast lane

Monday, January 24, 2011

Monitorizare stiri

Monitorizare Presa - serviciu de monitorizare stiri in timp real: www.sursadestiri.ro
Monitorizare presa
Informatii, stiri din toate domeniile, din surse multiple, intr-un singur loc.
util daca vrei sa fii informat despre subiectele care te intereseaza: credite, banci, brd, bcr etc.
Monitorizare stiri - Youtube Demo

Friday, January 21, 2011

Ubuntu merge mp3 files

concatenate mp3 files

$ sudo apt-get install id3 mp3wrap ffmpeg
$ mp3wrap mp3-big.mp3 1.mp3 2.mp3 3.mp3 4.mp3
$ ffmpeg -i mp3-big_MP3WRAP.mp3 -acodec copy mp3-big.mp3 && rm mp3-big_MP3WRAP.mp3
$ id3cp 1.mp3 mp3-big.mp3

Ubuntu change video file soundtrack

ubuntu edit video change sound

add mp3 sountrack to a video

mencoder -o test-out.avi -ovc copy -audiofile file.mp3 -oac copy test-input.avi

mencoder -o test-out.avi -ovc copy -audiofile file.mp3 -oac pcm test-input.avi

Thursday, January 20, 2011

Ubuntu - make youtube demo

ubuntu make youtube demo

Desktop recording tool
sudo apt-get install gtk-recordmydesktop

Ogv to avi converting
sudo apt-get install mencoder

Converting command
mencoder filename.ogv -ovc xvid -oac mp3lame -xvidencopts pass=1 -o filename.avi

Converting script
mcedit ogv2avi.sh

#!/bin/bash
# ogv to avi
# Call this with multiple arguments
# for example : ls *.{ogv,OGV} | xargs ogv2avi
N=$#;
echo "Converting $N files !"
for ((i=0; i<=(N-1); i++))
do echo "converting" $1
filename=${1%.*}
mencoder "$1" -ovc xvid -oac mp3lame -xvidencopts pass=1 -o $filename.avi
shift 1
done

chmod +x ogv2avi.sh

./ogv2avi.sh filename.ogv

Merge avi files
mencoder -ovc copy -oac copy video1.avi video2.avi -o completevideos.avi

Monday, January 17, 2011

Web colors X11 - Image

Web colors X11 - the rest is your imagination


HTML name Hex code

R   G   B
Decimal code

R   G   B
Red colors
IndianRed CD 5C 5C 205  92  92
LightCoral F0 80 80 240 128 128
Salmon FA 80 72 250 128 114
DarkSalmon E9 96 7A 233 150 122
LightSalmon FF A0 7A 255 160 122
Crimson DC 14 3C 220  20  60
Red FF 00 00 255   0   0
FireBrick B2 22 22 178  34  34
DarkRed 8B 00 00 139   0   0
Pink colors
Pink FF C0 CB 255 192 203
LightPink FF B6 C1 255 182 193
HotPink FF 69 B4 255 105 180
DeepPink FF 14 93 255  20 147
MediumVioletRed C7 15 85 199  21 133
PaleVioletRed DB 70 93 219 112 147
Orange colors
LightSalmon FF A0 7A 255 160 122
Coral FF 7F 50 255 127  80
Tomato FF 63 47 255  99  71
OrangeRed FF 45 00 255  69   0
DarkOrange FF 8C 00 255 140   0
Orange FF A5 00 255 165   0
Yellow colors
Gold FF D7 00 255 215   0
Yellow FF FF 00 255 255   0
LightYellow FF FF E0 255 255 224
LemonChiffon FF FA CD 255 250 205
LightGoldenrodYellow FA FA D2 250 250 210
PapayaWhip FF EF D5 255 239 213
Moccasin FF E4 B5 255 228 181
PeachPuff FF DA B9 255 218 185
PaleGoldenrod EE E8 AA 238 232 170
Khaki F0 E6 8C 240 230 140
DarkKhaki BD B7 6B 189 183 107
Purple colors
Lavender E6 E6 FA 230 230 250
Thistle D8 BF D8 216 191 216
Plum DD A0 DD 221 160 221
Violet EE 82 EE 238 130 238
Orchid DA 70 D6 218 112 214
Fuchsia FF 00 FF 255   0 255
Magenta FF 00 FF 255   0 255
MediumOrchid BA 55 D3 186  85 211
MediumPurple 93 70 DB 147 112 219
Amethyst 99 66 CC 153 102 204
BlueViolet 8A 2B E2 138  43 226
DarkViolet 94 00 D3 148   0 211
DarkOrchid 99 32 CC 153  50 204
DarkMagenta 8B 00 8B 139   0 139
Purple 80 00 80 128   0 128
Indigo 4B 00 82  75   0 130
SlateBlue 6A 5A CD 106  90 205
DarkSlateBlue 48 3D 8B  72  61 139
MediumSlateBlue 7B 68 EE 123 104 238

HTML name Hex code

R   G   B
Decimal code

R   G   B
Green colors
GreenYellow AD FF 2F 173 255  47
Chartreuse 7F FF 00 127 255   0
LawnGreen 7C FC 00 124 252   0
Lime 00 FF 00   0 255   0
LimeGreen 32 CD 32  50 205  50
PaleGreen 98 FB 98 152 251 152
LightGreen 90 EE 90 144 238 144
MediumSpringGreen 00 FA 9A   0 250 154
SpringGreen 00 FF 7F   0 255 127
MediumSeaGreen 3C B3 71  60 179 113
SeaGreen 2E 8B 57  46 139  87
ForestGreen 22 8B 22  34 139  34
Green 00 80 00   0 128   0
DarkGreen 00 64 00   0 100   0
YellowGreen 9A CD 32 154 205  50
OliveDrab 6B 8E 23 107 142  35
Olive 80 80 00 128 128   0
DarkOliveGreen 55 6B 2F  85 107  47
MediumAquamarine 66 CD AA 102 205 170
DarkSeaGreen 8F BC 8F 143 188 143
LightSeaGreen 20 B2 AA  32 178 170
DarkCyan 00 8B 8B   0 139 139
Teal 00 80 80   0 128 128
Blue/Cyan colors
Aqua 00 FF FF   0 255 255
Cyan 00 FF FF   0 255 255
LightCyan E0 FF FF 224 255 255
PaleTurquoise AF EE EE 175 238 238
Aquamarine 7F FF D4 127 255 212
Turquoise 40 E0 D0  64 224 208
MediumTurquoise 48 D1 CC  72 209 204
DarkTurquoise 00 CE D1   0 206 209
CadetBlue 5F 9E A0  95 158 160
SteelBlue 46 82 B4  70 130 180
LightSteelBlue B0 C4 DE 176 196 222
PowderBlue B0 E0 E6 176 224 230
LightBlue AD D8 E6 173 216 230
SkyBlue 87 CE EB 135 206 235
LightSkyBlue 87 CE FA 135 206 250
DeepSkyBlue 00 BF FF   0 191 255
DodgerBlue 1E 90 FF  30 144 255
CornflowerBlue 64 95 ED 100 149 237
MediumSlateBlue 7B 68 EE 123 104 238
RoyalBlue 41 69 E1  65 105 225
Blue 00 00 FF   0   0 255
MediumBlue 00 00 CD   0   0 205
DarkBlue 00 00 8B   0   0 139
Navy 00 00 80   0   0 128
MidnightBlue 19 19 70  25  25 112

HTML name Hex code

R   G   B
Decimal code

R   G   B
Brown colors
Cornsilk FF F8 DC 255 248 220
BlanchedAlmond FF EB CD 255 235 205
Bisque FF E4 C4 255 228 196
NavajoWhite FF DE AD 255 222 173
Wheat F5 DE B3 245 222 179
BurlyWood DE B8 87 222 184 135
Tan D2 B4 8C 210 180 140
RosyBrown BC 8F 8F 188 143 143
SandyBrown F4 A4 60 244 164  96
Goldenrod DA A5 20 218 165  32
DarkGoldenrod B8 86 0B 184 134  11
Peru CD 85 3F 205 133  63
Chocolate D2 69 1E 210 105  30
SaddleBrown 8B 45 13 139  69  19
Sienna A0 52 2D 160  82  45
Brown A5 2A 2A 165  42  42
Maroon 80 00 00 128   0   0
White colors
White FF FF FF 255 255 255
Snow FF FA FA 255 250 250
Honeydew F0 FF F0 240 255 240
MintCream F5 FF FA 245 255 250
Azure F0 FF FF 240 255 255
AliceBlue F0 F8 FF 240 248 255
GhostWhite F8 F8 FF 248 248 255
WhiteSmoke F5 F5 F5 245 245 245
Seashell FF F5 EE 255 245 238
Beige F5 F5 DC 245 245 220
OldLace FD F5 E6 253 245 230
FloralWhite FF FA F0 255 250 240
Ivory FF FF F0 255 255 240
AntiqueWhite FA EB D7 250 235 215
Linen FA F0 E6 250 240 230
LavenderBlush FF F0 F5 255 240 245
MistyRose FF E4 E1 255 228 225
Gray colors
Gainsboro DC DC DC 220 220 220
LightGrey D3 D3 D3 211 211 211
Silver C0 C0 C0 192 192 192
DarkGray A9 A9 A9 169 169 169
Gray 80 80 80 128 128 128
DimGray 69 69 69 105 105 105
LightSlateGray 77 88 99 119 136 153
SlateGray 70 80 90 112 128 144
DarkSlateGray 2F 4F 4F  47  79  79
Black 00 00 00   0   0   0