What’s difference between display: none and visibility: hidden?

just when you tread into the world of dhtml or javascript, you can require the display property of CSS more than expected. So it becomes necessary to clearly understand some of the facts behind this powerful language. Here is the difference between the visibility and display property of an element.

visibility: hidden hides the element, but it still takes up space in the layout.

display: none removes the element completely from the document. It does not take up any space, even though the HTML for it is still in the source code.

Author: Realin !

Advertisements

Optimising MYSQL

Hello,

I’d like to share with the Web Collections my knowledge about tuning / tweaking mysql.

First of all, sorry if my English is not perfect. Maybe some sentences may be difficult to understand. So do not hesitate to ask me for explanations :-p

Secondly,
DO NOT CHANGE your setting without understanding what you do.
Make a backup of your my.cnf before editing the /etc/my.cnf
DO THESE CHANGES AT YOUR OWN RISKS.

My article is only to help you to more well understand how tuning mysql.

Optimising mysql is very well commented on the net, and you’ll find huge information on how to do this. There is never “best parameters”, the best parameters is those fits your needs, box hardware, mysql usage…
So, I’ll not give the best parameters but rather how to define these ones. Make some tests, and you’ll quickly find your own parameters.

I’ll give you at the end of this post some web pointers which may help you.

There a lot of available parameters but only few one are very important to tweak your mysql box.

The most important variables are (for me, and it is not exhaustive)

– max_connections
– wait_timeout
– thread_cache_size
– table_cache
– key_buffer_size
– query_cache_size
– tmp_table_size

First of all, how to find your variable, and the mysql usage ?

*VARIABLES

from mysql :
show variables;

or from command line :
mysqladmin variables

*PROCESS / STATUS

from Mysql :
show status;

or from command line
mysqladmin –i10 processlist extended-status

*SOME USEFUL COMMAND FOR YOU BOX USAGE

>Top

>ps –axfu

>vmstat 1

* OPTIMISING MYSQL

To obtain the stat of your mysql server since it has been loaded, run mysqladmin processlist extended-status as mentionned above.

1 – The two most important variables : Table_cache and Key_buffer_size

* If Opened_tables is big, then your table_cache variable is probably too small.
table_cache 64
Open_tables 64
Opened_tables 544468

This is the first serious problem. “The table_cache is the number of open tables for all threads. MySQL, being multi-threaded, may be running many queries on the table at one time, and each of these will open a table.” Therefore, even though we only have a few tables, we will need many more open_tables.

The Opened_tables value is high and shows the number of cache misses. Getting the table_cache size correct is one of the two best things you can do to improve performance.

* If Key_reads is big, then your key_buffer_size variable is probably too small. The cache hit rate can be calculated with Key_reads/Key_read_requests.
key_buffer_size 16M
Key_read_requests 2973620399
Key_reads 8490571
(cache hit rate = 0.0028)

“The key_buffer_size affects the size of the index buffers and the speed of index handling, particularly reading.” The MySQL manual (and other sources) say that “Key_reads/Key_read_request ratio should normally be < 0.01.” This is the other most important thing to get correct. Here the value seems to be correct (< 0.01)

Also check key_write_requests and key_writes.  The key_writes/key_writes_request should normally be < 1 (near 0.5 seems to be fine)

Here is a very interesting web pointer : http://www.databasejournal.com/featu…0897_1402311_3

2 – Others important settings are : Wait_timeout, max_connexion, thread_cache

A little explanation :
Generaly you have a lot of mysql process that are sleeping because wait_timeout are not set low. So I make sure that the wait_timeout is set to a very low value: 15 seconds (for me) . That means MySQL would close any connection that was idle for more than 15 seconds.

The problem is you also have to increment your max_connexion (mine is set to 300) to be sure there is not a lot of idle clients holding connections and blocking out new clients from connecting and getting real work done. The pbm is that the box has to create new threads (MySQL is a multi-threaded server) at a very high rate. That may sucks up a measurable amount of CPU time.

So the solution is to use the Thread_cache (from mysql doc) :
“How many threads we should keep in a cache for reuse. When a client disconnects, the client’s threads are put in the cache if there aren’t more than thread_cache_size threads from before. All new threads are first taken from the cache, and only when the cache is empty is a new thread created. This variable can be increased to improve performance if you have a lot of new connections. (Normally this doesn’t give a notable performance improvement if you have a good thread implementation.) By examing the difference between the Connections and Threads_created you can see how efficient the current thread cache is for you.”

* If Threads_created is big, you may want to increase the thread_cache_size variable. The cache hit rate can be calculated with Threads_created/Connections.
thread_cache_size 0
Threads_created 150022
Connections 150023

This is the second problem that should be fixed. A cache size of zero is the default for my-medium.cnf but the recommended size in my-large.cnf is 8.

you may try this formula : table_cache = opened table / max_used_connection

3 – Finally, you may also have a look at : tmp_table_size and Handler_read_rnd / Handler_read_rnd_next

* If Created_tmp_disk_tables is big, you may want to increase the tmp_table_size variable to get the temporary tables memory-based instead
of disk based.

tmp_table_size 32M
Created_tmp_disk_tables 3227
Created_tmp_tables 159832
Created_tmp_files 4444

Created_tmp_disk_tables are the “number of implicit temporary tables on disk created while executing statements” and Created_tmp_tables are
memory-based. Obviously it is bad if you have to go to disk instead of memory. About 2% of temp tables go to disk, which doesn’t seem too bad
but increasing the tmp_table_size probably couldn’t hurt either.

* If Handler_read_rnd is big, then you probably have a lot of queries that require MySQL to scan whole tables or you have joins that don’t use
keys properly.

Handler_read_rnd 27712353
Handler_read_rnd_next 283536234

These values are high, that we could probably stand to improve the indexes and queries.

I hope this will help some of you to more understand how it is possible to optimise MYSQL to fit your needs, hardaware box, or mysql current usage.

Maybe there is others tweaks to perform, but I know well only these ones. I did setup using these ones on differents mysql box, and generally it did help us to increase performance without have to change hardware (our boxes have 2GB ram)

I forgot to tell you two or three importants things like :

Used MySQL memory = key_buffer + max_connections * (join_buffer + record_buffer + sort_buffer + thread_stack + tmp_table_size)

Notice the max_connexion and the multiplier. connexion increase = memory usage increase too.

Notice key_buffer for a given memory : more you add mem to key buffer, less connexion is less is key buffer, more connexion is

If you change one of these settings for a high value, you system may swap. If you system swap, try lot decrease these values

Also, about table_cache :
Increasing the size of the table cache may really help you. But you must be careful not to make the value too large. All operating systems have a limit on the number “open file pointer” (sorry in french it is called pointer, maybe descriptors is the good translation) a single process may have.
If MySQL tries to open a lot of files, the OS may refuse it and MySQL will generate error message in the error log.

Author: Pascal

Firefox Keyboard ShortcutsFirefox Keyboard Shortcuts

Firefox is a one of the most popular browser on Internet because of supporting various themes and thousands of add-ons for customizations. Today i am sharing Some of my favorite 50 Useful Firefox Keyboard Shortcuts, you can use this keyword shortcut for view and save web pages, organize your favorite bookmark , search the web, open new WebPages .

Before we start talking about Useful Firefox Keyboard Shortcuts, Here is most common Web browser shortcut keys.

Most Common Keyboard Shortcuts for Firefox :
  • Ctrl+N – It use for Open New Browser Window.
  • Ctrl+T – It use for Open New Tab on Existing window.
  • Ctrl+W or Ctrl+F4 – It use for Close the current window or Tab.
  • Ctrl+R or F5 – For refresh The Page
  • Ctrl+F5 orCtrl+Shift+R – Refresh the page with override cache
  • Esc – Stop
  • Ctrl + O – It use for Open File
  • Alt+Home – Home
  • F1 – Firefox Help
  • F11 – Toggle Full Screen of Browser Window.
  • Ctrl+Tab – For Changing Tab between Existing window.
  • Ctrl+U – Open View Source Page of any webpage.
  • Ctrl+I or Ctrl+B – Open Bookmark window in left sidebar
  • Ctrl+P – For Print Command
  • Ctrl+A – Select All
  • Ctrl+S – Save Page As
  • Ctrl+D – Bookmark This Page
  • Ctrl+F – Find
  • Ctrl+G or F3 – Find Again
  • Ctrl+H – open History Window In left Sidebar.
  • Ctrl+J – Open Downloads Window
  • Ctrl+Z – Undo Your Process
  • Ctrl + Y or Ctrl + Shift + Z – Redo your Process
  • Ctrl+C – Copy
  • Ctrl+V – Paste
  • Ctrl + Shift + Delete – Clear your Private Data
  • F7 – To Open Browser in Caret mode
  • Backspace or Alt+Left Arrow – Back
  • Shift+Backspace or Alt+Right Arrow – Forward
  • Alt + Enter – Copy your existing window tab and Open It in New Tab
  • Ctrl + Tab or Ctrl + Shift + Tab — rotate forward to the next window tab
Page Navigation and manipulation Keyboard Shortcuts :

This shortcut is very useful for navigate your page quickly and easily.

  • Down Arrow – Scroll down
  • Ctrl+ "+" or Ctrl+ Scroll up – Increase Text Size (Zoom In)
  • Ctrl+ "-" or Ctrl+ Scroll Down – Decrease text Size (Zoom Out)
  • Ctrl+ 0 (Zero) – Normal Text Size (Default Zoom Mode)
  • Alt+ Scroll Down – One step page go down
  • Alt+ Scroll Up – One step page go Up
  • Ctrl+Shift+I – DOM Inspector
Location Bar Keyboard Shortcuts :

This shortcut is very useful for to find Location Bar

  • Ctrl + L or ALT + D – Select Location Bar
  • Ctrl + Enter - To complete URL with .com
  • Ctrl + Shift + Enter – To complete URL with .org
  • Shift + Enter – To complete URL with .net
Search Engine selection Tab Keyboard Shortcuts :
  • Ctrl + Up Arrow – Choose previous Search engines to search information
  • Ctrl + Down Arrow – Choose Next Search engines to search information
  • Alt + Up Arrow or Alt + Down Arrow – Open List of available Search Engine

Author: raj

What is SPAM?

It is really difficult to define spam. But generally speaking, spam is unsolicited information, which is forced upon the reader and is purported to advertise some service or product. The unsolicited information is not provided just once or twice; the reader is, in fact, so much bombarded with the same kind of information that he gets exasperated.

Here are some of the important features of spam.

Spamming through emails

The spammers consider email as the best medium for sending spam. They try to remain anonymous and send mails in massive quantities. The sender addresses are generally spoofed or harvested to conceal the identity of the real senders.

You may also receive political messages, appeals for charities, chain letters and spam to spread malware.

All unsolicited mails are not spam. For example, you have given your email id with a permission to receive messages, newsletters and business proposals. If the sender also sends legitimate business proposals, charity appeals, invitation to seminars, e-books through his emails, they are not considered spam. The reason is that the sender has already sought your permission to send you mails.

Sometimes the unsolicited messages of genuine nature may come from senders who have not sought your permission. Let us say you have only one supplier of certain product that you are trading. You wish you could know some other supplier for a competitive buying.  Suppose you get a message from an Asian producer of the same product who quotes lower rates, then you would not consider this unsolicited message as a spam.

The key word for spam is ‘bombardment’ with unsolicited messages. Spam has spread its tentacles in other forms of internet marketing especially article marketing.

Most article writers tend to cater to the search engines rather than the searchers of information through search engines. Search engines accord prominent display to popular websites on their first pages. Their criterion for popularity of a website is the number of links that connect to that website.

So the article marketers fill up their articles with large number of links to their websites to hoodwink the search engine robots called crawlers.  Not only that, they submit the same articles to hundreds of article directories through automatic submission software. The strategy is to create a deluge of links to fool the search engines.

Since their only objective is to create links, the articles mostly contain duplicate or copied content. Though prominent article directories such as Ezine Articles discourage such articles, there are numerous other article directories that turn a blind eye to such submissions. This type of spamming is called link spamming through articles.

How to treat the spam?

Though you cannot stop the link spamming through articles, as it is for the article directories and search engine robots to devise methods to discourage their submissions, there are several ways you can stop spam in your emails to some extent.

Do not post your email ids on the public forums, newsgroups, chat rooms or websites.

Do not open messages that appear spam

Email service providers usually offer effective tools and filters to stop the spam mail. Yahoo, probably the most popular email service, provides options to do so. You can select all the messages that appear spam and click on the Spam button. They will stop appearing in your inbox. Yahoo also offers spam filters. You should add the spam mail’s id in the prescribed filter box and you will stop receiving mails from that sender.

Iframe / Virus in Website Pages, How to Fix Iframe issue

The reason why this virus comes is only because of the either of the following :

1) You have a weak 7 vulnerable code on your website which is exploited by a hacker.
2) Your ftp password is weak and generally a dictionary word which is cracked by brute force attempts.

How Iframe Virus Works?
The hackers behind this have not actually “hacked” into servers, but are using the Webs OWN programming errors to inject this code into search results pages created by the Web sites OWN internal search engines!

The hacker searches for popular keywords, like “furniture” on the Wal-Mart Web site using its internal search engine. But instead of running a normal search, the (hacker?) adds on an HTML command to the end of his search string. HTML = hyper text markup Language…the stuff we write websites with mainly.
This command then opens up an invisible “iframe” window in the victims browser which then redirects to a malicious Web site, which then (if successful) installs fake antispyware or a version of the “Zlob Trojan Horse” – a malware on the victims (meaning YOU) PC.

And hear this! These (hackers) actually have great Google rankings!!
In order to boost their Google rankings, Web sites often save a copy of these search results and submit them to Google. When a victim searches Google for the keyword, these cached search results then pop up, with the malicious code now inside them.

How the hack is done?
Client side PC infected with virus.
Virus gets FTP username/password from the FTP clients.
Using the username/password, the virus downloads the index files, add iframe code it and re-uploads it.
The iframe code points to the same virus. So, anyone accessing this website gets infected with the same virus, and it uses the FTP username/password to spread again!!!!

Solutions #

1) Ensure that your code is free from such kind of vulnerabilities.
2) Change all the ftp passwords and keep them safe & a combination of alpha + numbers + special characters like ^%$@^#%
3) Before updating the new password in their FTP clients, advise them to do a full system Virus scan with a reliable virus scanner updated with the latest virus definition files.
4) Advise the clients not to save ( remember ) the FTP username/password on FTP clients.

Author: Tanuj