Monday, May 18, 2015

Improve your typing speed using Typing Tutor Online

‪#‎typingtest‬ ‪#‎typingtutor‬ Improve your typing speed using Typing Tutor Online. This typing tutor lets you learn typing in simple way without any registration! This app Typing tutor is completely free you can use this without paying any cost for it! http://bit.ly/1Id5c8k


Monday, November 3, 2014

How to Upgrade to iOS 8 When It Cannot Be Installed?

Welcome to Tech section! When you wish to upgrade to iOS 8 but you find that it could not get installed for lack of space, then you do not have to get tensed.


Use the following steps to upgrade to iOS 8:

  1. Look at the apps that are running and tracking the most storage
  2. Now to go to Settings
  3. Wait for the list of apps to load
  4. Now delete apps such as Twitter, iTunes and so one.
  5. You can also take backup with iCloud
  6. It is also possible to delete music as well as photos
  7. Use iTunes Sync to restore songs as well as videos

If you wish to get more tips on tech. do try to visit this space regularly. You can make your best choice to get all important tips on tech.

Wednesday, June 5, 2013

Selecting random record from MySQL database table.

The simplest way of selecting random rows from the MySQL database is to use "ORDER BY RAND()" clause in the query.

Solution 1--
SELECT * FROM `table` ORDER BY RAND() LIMIT 0,1;
The problem with this method is that it is very slow. The reason for it being so slow is that MySQL creates a temporary table with all the result rows and assigns each one of them a random sorting index. The results are then sorted and returned.

There are several workarounds to speed things up.

The basic idea is to get a random number and then select a specific row using this number.

In the case that all the rows have unique ids we will just have to pick a random number between the smallest and the biggest id and then select the row with id that equals that number. To make this method work when ids are not evenly distributed we will have to use ">=" operator instead of "=" in the last query.

To get the minimum and maximum id values in the entire table we will use MAX() and MIN() aggregate functions. These functions will return minimum and maximum value in the specified group. The group in our case is all the values of `id` column in our table.

Solution 2 [PHP]
$range_result = mysql_query( " SELECT MAX(`id`) AS max_id , MIN(`id`) AS min_id FROM `table` ");
$range_row = mysql_fetch_object( $range_result ); 
$random = mt_rand( $range_row->min_id , $range_row->max_id );
$result = mysql_query( " SELECT * FROM `table` WHERE `id` >= $random LIMIT 0,1 ");

As we mentioned this method is limited to tables with unique id for each row. What to do if it's not the case?

The solution is to use the MySQL LIMIT clause. LIMIT accepts two arguments. The first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1).

To calculate the offset to the first row we will generate a random number between 0 and 1 using MySQL's RAND() function. Then we will multiply this number by number of records in the table, which we will get using COUNT() function. Since LIMIT arguments must be integers and not float values we will round the resulting number using FLOOR() function. FLOOR() is an arithmetic function that calculates the largest integer value that is smaller than or equal to the expression. The resulting code will look like this:

Saturday, March 30, 2013

HTML5 Interview Questions With Answers ?


Q:What is HTML?
A: HTML is a markup language written in HTML elements, used to display content, images and all other things which we want to be displayed on web page.

Q: What is the difference between HTML and HTML5 ?
A: HTML5 is the new HTML standard with new elements, audio, video support, 2D, 3D graphics, local storage and many other features. This reduces the usage of external plugins in the site.

Q: Give the definition of HTML tag? A: A HTML tag is nothing but a element which tells browser to execute it, when it gets loads. It`s same as functions in C.

Q: Is it necessary to use <! DOCTYPE> in HTML5 ?A:  <! DOCTYPE> is nothing but an instruction to web browser about the version of current HTML page. Unlike other HTML tags <! DOCTYPE> doesnot have an end tag.

To be clear it`s not important to add <!DOCTYPE> in HTML5. And the reason is, all <! DOCTYPE > declarations require a reference to a Document Type Definition, because HTML 4.01 was based on Standard Generalized Markup Language (SGML). But HTML5 is not based on SGML, so it`s not required.


Livemans A Complete Magazine