Nov 17

What is the best way to extract MP3 Length Duration in a directory? Windows

I recently had a task of identifying total duration of 1800 MP3 files in a folder. I used Powershell and other tools but I couldn’t get the most accurate information. Powershell only spits out “length” almost like Unix epoch time and now it is up to you to convert that into duration so it is dead end.

The solution is:
1- Install Winamp from
2- Add all the MP3 files into Playlist.
3- At the bottom of the Playlist generator, you will see the total duration.
4- If you click on a MP3 file, you might lose the total duration. If that happens, select all in your playlist and it will automatically re-calculate.

That is it.

You can see attachment below:

Winamp Playlist Duration Calculator

Winamp Playlist Duration Calculator

Sep 29

XCache Best Settings

XCache is one of many opcode cachers that are available for PHP. There are many articles for nginx, apache, php and mysql best settings but I could not find one for XCache while I was struggling with configurations and I decided to put together this post.

I am assuming you already have XCache installed and you have either separate xcache.ini file or you are configuring inside php.ini. I would strongly urge you to install the XCache Admin panel or XCache dashboard. It helps a lot to get the best out of the settings.

You can use:

locate xcache | grep htdocs

to locate XCache Admin Panel. Once you locate it, you can copy it under your www folder. If you are using cPanel, it would be

 cp /home/cpeasyapache/src/xcache/xcache-3/htdocs /home/your_user_name/public_html/xcache -R

Once you copy this folder then you need to enable the Admin configuration from the php.ini file.

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20100525"
; password cleartext md5(your_password_and_copy_the_output_to_below)

XCache settings that need your attention

  • xcache.admin.user – There is an HTTP authentication window when you access the admin page, this is the username
  • xcache.admin.pass – You need to create md5 password for authentication.
  • xcache.size – This is the most critical setting. xcache.size setting refers to the aggregate memory of all cache threads. So, each thread gets roughly size/count amount of memory. If you have multiple sites and around 4GB or more, 128M seems like a good number. Please beware, setting xcache.size to zero is equivalent to disabling xcache.
  • xcache.count – This number divides total cache size into threads in order to increase the efficiency. If you have 128M xcache.size and you set the count as 4, that means each thread will manage 32M size of cache.
  • xcache.slots – This is one of the most confused and least explained settings. According to XCache Wiki, Keeping xcache.slots small means more slots in memory thus better performance but more memory usage. I don’t really understand the logic behind it so I leave it as is.
  • xcache.var_size – Variable cache is different then regular cache. Do you need this or not really depends on your application. See below for further info.
  • xcache.var_count xcache.var_slots xcache.var_ttl are all alike their non-var versions so I skip them.
  • xcache.ttl=0 means we want file to remain in the cache forever.

XCache settings that you can’t care less

  • xcache.mmap_path=”/dev/zero” seems like beating the purpose but it is not. The reason you would write the output of a memory cache to a file is mainly to check and make sure you have the correct data. In other words, you would be doing read/write and read to make sure your data is safe. Dumping it to null means, you don’t care about the data consistency but just the performance and if something is broken in the cache, you are not too worried about it.
  • xcache.readonly_protection=”Off” – According to XCache Wiki, The cache can be corrupted by accident, it might be modified along the process – before or after the cache so the cache with readonly permission won’t allow this happen.
  • xcache.stat determines whether Xcache should check the filesystem to see if the file has changed or not.

XCache comes with two different caches

  • Static cache that are generated by compiling your PHP scripts
  • Variable cache that can be used by application through XCache API

If your application is not taking advantage of XCache variable cache then there is no need to enable variable cache so you would use xcache.var_size=”0″. W3 Cache for WordPress is able to xCache, there are other tools and plugins that are compatible with XCache but not all the software can take advantage of this storage.

I would highly recommend you to take a look at the Dashboard to see how XCache is performing for your environment and make the adjustments accordingly.

How do you reset XCache cache?

One last thing before finish, xcache var is reset when you restart the PHP service. If you are using PHP bound with Apache, restarting Apache will kill the cache. If you are using PHP like PHP-FPM, restarting PHP-FPM proxy service will clean the cache.

Please leave any comments and questions.

Apr 17

Gmail IMAP/HTTP Down

Gmail went down roughly 15 minutes ago (7:15 Central time on 04/17/13). When accessed from web interface, it gives the error message “Server error”. When accessed from Outlook, it pops up the username and password window then disconnects from server.

There are 150 reports on and twitter is full of people starting day with people complaining not being able to access to their emails.

Google Apps – Server error
Help|Sign out
Server error

We are unable to process your request at this time, please try again later.


Dec 11

Solution for Schannel Event ID:36888 VPN Problems

I have been experiencing issues when I use VPN. It started occuring after installing latest Windows Updates. So what happens was, as soon as I get on VPN, although I can ping public servers and even use telnet/ftp etc. to get information, surfing web pages was not possible.

After going through series of troubleshooting, I found out it was caused by a Windows Security update (2585542 MS12-006: Description of the security update for Webio, Winhttp, and schannel in Windows: January 10, 2012)

If you go on this website ( there is more details about the reason Microsoft had to come up with this security patch and also mentions “side effects” of installing this update. Right under “Known issues with this security update”. The solution to this problem is fairly simple:

By default, this security update sets the Opt-in mode at the schannel level, because of application compatibility issues. To disable this security update for all applications system-wide, you must add a DWORD value named SendExtraRecordthat has a value of 2 to the following registry subkey:


To add this schannel registry entry registry entry, follow these steps:

  1. Click Start, click Run, type regedit in the Open box, and then click OK.
  2. Locate and then click the following subkey in the registry:
  3. On the Edit menu, point to New, and then click DWORD Value.
  4. Type SendExtraRecord for the name of the DWORD, and then press ENTER.
  5. Right-click SendExtraRecord, and then click Modify.
  6. In the Value data box, type 2 to disable the split record in schannel, and then click OK.
  7. Exit Registry Editor.


Sep 18

Hacked Joomla website

I found out of one my friend’s joomla site was hacked and hidden links were embedded into his website. It took me almost an hour to figure out where they had added the code. It started with finding out template change that they could hide links from us.

templates/rt_maelstrom/css/template.css:#rt-lm {display-none;}
templates/rt_maelstrom/css/template.css:#rt-lm{position: absolute; top: 0px; left: -5000px;}

Next step was looking for the URL and where they were getting it but lots of ‘grep’ -ing and phpMyAdmin search resulted with nothing. While I was giving up on it, I found it in article.php file under templates folder. Ofcourse encoded as usual.

echo base64_decode($pml);?>

Older posts «