Categories
SQL / MySQL Tips and Tutorials

MySQL: Incorrect key file error AND InnoDB: Error: unable to create temporary file; errno: 2

When I encounter the incorrect key file for table error, it’s almost certainly because the disk is full and MySQL can’t write to the tmpdir. The solution is simple, just move tmpdir to another partition with enough disk space.

Open my.ini and change tmpdir to another directory with enough disk space. Restart MySQL and that should do it.

However on Windows, such as for WAMP, you need to make sure you use slashes (/) rather than backslashes (\) in the path for tmpdir in my.ini, or it would be this error and mysqld would simply refuse to start:

InnoDB: Error: unable to create temporary file; errno: 2

Categories
Hosting Tips & Deals Manage Your Own Server SQL / MySQL Tips and Tutorials

Make phpMyAdmin Show Exact Number of Records for InnoDB Tables

By default, phpMyAdmin shows an estimated number of records for InnoDB tables that have more than 20,000 rows. It can vary by every fresh as much as 50% or even more. Makes it hard to get an exact number of records for the tables as we have to explicitly run an SQL query to do that:

SELECT COUNT(*) FROM table_name

While it would make it a bit slower for phpMyAdmin to open up the database tables list page because it has to count the exact total number of records of each table in the database by this query, it’s worth it for some of us as we want to know the exact number of rows the InnoDB table currently has. phpMyAdmin does it for MyISAM tables, and we want it to do the same with InnoDB tables.

So how can we make phpMyAdmin show exact number of records for InnoDB tables?

Simple. Just open the config.inc.php in your phpMyAdmin installation directory and add this line:

$cfg['MaxExactCount'] = 2000000;

This configuration parameter sets the threshold that phpMyAdmin executes COUNT(*) against the table.

In this case, if the total number of recrods in this InnoDB table is larger than 2,000,000, the Rows count will be estimated, starting with a wave sign, ~; on the other hand, if the total number of records in this InnoDB table is smaller than 2,000,000, phpMyAdmin will run COUNT(*) against the table so an exact Rows count is displayed.

You get the idea.

To make phpMyAdmin show exact number of rows on all InnoDB tables, simply make the parameter $cfg[‘MaxExactCount’] large enough.

Categories
Guest Posts Science & Nature

Amazing Science – Photons and Optical Fiber Cable

Today, most of our online data transmissions pass through fiber-optic cables. And as most of us know, fiber-optic cables are simply long, thin strands of glass which allow light to bounce and refract from one-end to the other without leaving the cable. It’s a bit like shining a flashlight down a long, mirrored tube.

One of the great benefits of fiber-optic cabling is that it can transmit multiple signals at the same time by combining different colors. (Photons with different wavelengths) Because of this, the number of simultaneous signals which can pass through a fiber optic cable is theoretically limited only by the accuracy and precision of the hardware. Compare this with a copper wire, which can only send one signal at a time.

But few people really appreciate how much incredible science goes into fiber optic networking, or the fascinating principles which govern this technology that has such a profound impact on our daily lives.

One of these principles is what’s often called the “Lifeguard Principle”, also referred to as the “principle of minimal action” or “principle of least action”.

Now I’m not a scientist, and I may slightly over-generalize in certain areas. But I’ll attempt to present these principles in the most accurate way that I can in laymen’s terms.

We all know that the shortest path from point A to point B is a straight line. But what about the FASTEST distance?

How to get from A to B?

For example, let’s assume that you’re a lifeguard that sees a drowning swimmer off in the distance. The shortest route to that swimmer would be to follow a straight line towards the swimmer through land and water.

From A to B in shortest path

But in a life-or-death situation, every second counts. The running portion of this trajectory may be very fast, but the swimming portion will be very slow. If you waste too much time swimming, the person you’re trying to save might drown.

From A to B in potentially shortest time (fasted path)

Another approach might be to run along the beach until you reach the point which offers the shortest swimming distance. Although this may take care of the swimming problem, now you’ve spent too much time running. Yes, this route may be faster than the “straight line” approach, but it’s still possible to shave off a few more precious life-saving seconds.

Somewhere in between these 2 strategies, there is a sweet spot where the combination of swimming and running time is reduced to the absolute minimum.

From A to B in shortest time (fasted path)

It’s possible to calculate this optimal trajectory using complex calculus, but I won’t bore you with that for this article.

Now let’s take this principle and apply it to a photon of light instead of a lifeguard.

If you’re standing in a boat and you point a laser at a fish in the water, what will happen?

Photons automatically travel in fasted path

Of course, we all know that the light beam will bend when it hits the surface. But how does the beam “decide” which angle to bend at?

Scientists have been able to calculate the speed at which light travels through different substances such as air and water. And when you combine the speed of light through air and the speed of light through water, you can make an interesting observation.

If you add up the time it takes for the light to go from the laser to the water and the time it takes for the light to travel from the water’s surface to the fish, it turns out that the trajectory which is taken by those photons is the shortest possible route for a photon of that wavelength.

In other words:

If the photon was a lifeguard and the fish was a drowning swimmer, the light would always pick the route which requires the least amount of time to reach the swimmer. And it’s this principle which dictates how the light decides to refract when it reaches the water’s surface.

To an untrained layman, this seems almost miraculous. It’s almost as if the photon could see into the future and plot a path to its final destination before it ever left the laser. And it’s almost as if the photon was able to perform the difficult calculus required to find the shortest possible path.

Of course, it’s not quite that simple. But it’s a clear demonstration of how beautiful science can be.

This least-action principle is also critical to optical networking technology. When you send a message through a fiber optic cable, it truly does take the fastest possible route to its final destination. And if it wasn’t for the principle described above, Internet connectivity would not be possible.

There are many other implications which result from this phenomenon, but they are simply beyond my understanding so I couldn’t speak to those issues.

About The Author: Patrick Jobin is a technical writer with Storagepipe Solutions, a leader in serious server online backup services for datacenters and corporate networks.

Categories
eCommerce & Shopping Online

Unparalleled Magento extensions support from Iceberg Commerce

I bought 2 extensions from Iceberg Commerce for my dresses and gowns store Princessly over a year ago to enhance the URLs of the tags with regards to SEO:

  1. Magento tags SEO URLs
  2. Admin can add tags to products in editor

They were both very easy to install and use. Only I needed a few modifications to the SEO-friendly tags extension so I reached out to Raman who has created them. This is something Raman didn’t have to do for me because it’s beyond what the product was designed for. I thought he’d ignore my message and he had every right to do so. However, Raman turned out to be an extremely nice person and helped me all the way through to get my custom requirements done.

That was over 1 year ago.

Just yesterday I again asked him for help regarding a minor error the extension is spitting out and he’s doing everything he could to get my problem solved. After exchanging 20 or so email messages, he got it again.

I just thought someone like him, avidly supporting an ordinary customer (I only spent about $70), over 1 year after the sale, deserves a dedicated post here.

Categories
Microsoft Windows

How to Free C:\ Drive Disk Space in Windows 7 and Reduce System Size?

Windows 7 is a beast in consuming hard drive disk spaces, especially the system drive, C, which is constantly being filled up. After a while it will keep annoying you with low disk space warnings because C drive is running out of space and almost full. So how can I safely free up all the disk spaces in C drive in Windows 7 and reduce its disk storage?

The methodology is to find the fattest folders in C drive, move as many of them to another drive (such as D, E, etc.) as possible, and make symbolic links (by mklink) from C drive to the folders in other drives.

Step 1 – Find culprit folders that occupy the most disk space!

There are so many ways to do this but what I did was to look at the size stats for each of the major folders in my C drive. After 10 minutes, I was able to pinpoint these folders that are consuming large chunks of the disk volume:

  • C:\Windows\winsxs – very high-profile system folder that are not easily reduced / moved, which I’ll leave alone.
  • C:\Windows\Installer – Over 3GB, program installers that can be moved safely and easily.
  • C:\Users\Administrator\AppData\Google – About 0.8GB, Google products data such as those by Chrome.
  • C:\Users\Administrator\AppData\Mozilla – About 1.6GB, Firefox profiles and browser data.
  • Some folders in C:\Program Files – I wish I could move this entire folder but I couldn’t. I could only move some of the folders such as “Microsoft Games”.
  • Some folders in C:\Program Files (x86) – Same as above.

This is just my case. You may as well find totally different folders that need to be moved. After you have found something, proceed to step 2 to duplicate them elsewhere.

Step 2 – Copy these folders to another drive that is much more spacious!

This one is easy. Just perform the omnipotent Ctrl+C and Ctrl+V combination to copy these folders to another drive. In this example, we’ll copy these folders to their new destination – D:\C_DRIVE:

  • C:\Windows\Installer –> D:\C_DRIVE\Windows\Installer
  • C:\Users\Administrator\AppData\Google –> D:\C_DRIVE\Users\Administrator\AppData\Google
  • C:\Users\Administrator\AppData\Mozilla –> D:\C_DRIVE\Users\Administrator\AppData\Mozilla

After the duplications, proceed to step 3.

Step 3 – Delete original folders and create the symbolic links

Now we need to delete the original folders in drive C. Some files and folders in Windows 7 are owned by TrustedInstaller while some by SYSTEM that cannot be easily deleted by Administrator. To delete them, you have to acquire SYSTEM privileges to do this, because the most privileged account in a Windows 7 computer is SYSTEM, not Administrator.

To do this, just create a file named syscmd.bat and put in the following commands:

sc Create SysCMD binPath="cmd /K start" type=own type=interact
sc start SysCMD

Double click to run the file syscmd.bat and you will be prompted by a dialog with 2 buttons, click the top one to view the interactive message.

And you will enter a command line interactive mode with SYSTEM privileges which basically grant you full rights to the computer – you can do whatever you want now.

Run these commands one by one – line by line, you type in the command and hit enter:

rmdir /s /q C:\Windows\Installer
rmdir /s /q C:\Users\Administrator\AppData\Google
rmdir /s /q C:\Users\Administrator\AppData\Mozilla

Now that the original folders are deleted, we’ll make symbolic links in the same name so that any requests for these folders are correctly diverted to those on the D drive:

mklink /D C:\Windows\Installer D:\C_DRIVE\Windows\Installer
mklink /D C:\Users\Administrator\AppData\Google D:\C_DRIVE\Users\Administrator\AppData\Google
mklink /D C:\Users\Administrator\AppData\Mozilla D:\C_DRIVE\Users\Administrator\AppData\Mozilla

That’s it.

After these 3 steps, my C drive is successfully reduced in size by 5.4GB. I can move more folders to further enlarge / extend the free space but for now, it’s good enough for me.

Feel free to leave any comment about how you are doing with this approach.

Categories
Kavoir & Whatever Science & Nature

New LHC Data Hints Strongly at Higgs Boson

What gives matter mass?

This seemingly simple question has had physicists around the world working to detect and identify the Higgs boson, known in popular media as the “God particle,” the physical constituent that has long been thought to interact with other forms of matter, giving it mass. The search has lasted since 1964, the year that physicist Peter Higgs and his colleagues presented the scientific community with a fully fleshed-out theory on the mass-giving particle; more than 45 years later, the search may be over.

Scientists working in Switzerland’s CERN-owned Large Hadron Collider announced yesterday that years of study have culminated in observations of a new particle, thought widely to be the Higgs boson due to its intrinsic properties. While some of the particle’s properties have yet to be analyzed, it was found in the the mass region around 125-126 GeV, the energetic area expected to produce the “God particle.”

I congratulate the thousands of scientists around the globe for their outstanding work in searching for the Higgs boson. Today’s announcement on the latest results of this search shows the benefits of sustained investments in basic science by governments around the world. Scientists have been looking for the Higgs particle for more than two decades; these results help validate the Standard Model used by scientists to explain the nature of matter.

– Steven Chu, U.S. Secretary of Energy

The announcement is being hailed by scientists from every part of the globe as a major success story in the long search for one of the most important fundamental particles in the universe (not to mention its popularity with those in design fields given scientists’ use of the widely-loathed Comic Sans font in their presentation materials), as the $6 billion LHC particle accelerator continues to analyze new detail in the hopes of offering indisputable evidence of the new particle next year.

Absolute surety or not, July 3, 2012 will be remembered throughout scientific history as the day that humankind’s ingenuity lead us to to solve one of the most subtle mysteries of the physical universe.

Source: Fermilab Today