Search for files modified in the last X amount of days in UNIX

Searches for files modified up to 2 days ago.

find ./ -type f -mtime -2 -exec ls -al {} \

Kilo Bytes Per Second vs. Kilo Bits Per Second (KBps vs. kbps)

Measure of file size: KBps

File size i.e. how big the file or how much space a file occupies in the hard disk measured in terms of KiloBytes (KB upper case “K” and upper case “B”). In computing terms the upper case “K” stands for 1024. 1024 is computed from 210. (2 power 10). 2 denote the number of characters in the binary system which is used to store data in the disc (ones and zeroes).

Other abbreviations like mega, giga and terra also use the base as 1024,

1KB (KiloByte) = 1024 Bytes (approximately 1000 Bytes)

1MB (MegaByte) = 1024 KB (approximately 1000 KiloBytes or 1 million Bytes)

1GB (GigaByte) = 1024 MB (approximately 1000 MegaBytes or 1 billion Bytes)

1TB (TerraByte) = 1024 GB (approximately 1000 GigaBytes or 1 trillion Bytes)

Measure of data transfer speeds: kbps

Data transfer speed over the networks (including the internet) is calculated in terms of bits per second: kilobits (kb small case “k” and small case “b”). The higher the kbps i.e. more the bits transferred per second, more the speed, faster the network/connection. Here k stands for 1000 (103 )

1 kbps (kilo bits per second) = 1000 bits per second

1 Mbps (mega bits per second) = 1000 kilo bits per second.

1 Gbps (giga bits per second) = 1,000 mega bits per second.

ISP bandwidth and download speeds

The most common confusion caused by the similarity of KBps and kbps is when it comes to internet bandwidth and download speeds. People often complain that their ISP promised 512kbps connectivity but they are seldom able to download any file at 512 KBps. They fail to notice the difference in cases of the units and hence think their ISP is cheating them or offering them poor quality service. As mentioned earlier data transfer speeds are always calculated in terms of kilo bits per second (kbps) so an ISP connectivity of 512 kbps promises of transfer of at the max 512 kilo bits per second.

On the other hand, file size measure is always in Kilo Bytes and thus download speeds are always calculated based on how many Bytes per second are downloaded and hence Kilo Bytes per second (KBps). KBps and kbps are not interchangeable.

So an internet connectivity of say 512kbps can never achieve a download speed of 512 KBps. To calculate the maximum download speed of a “X kbps” connection, we need to use a simple formula as below.

Download KBPS speed = (Kbps value*1000) /8)) / 1024.

I.e. For a connectivity of 512 kbps

kbps value * 1000 = 512 * 1000 = 512000

512000 / 8 = 64000

64000 / 1024 = 62.5 KBps

Therefore theoretically an internet connection of 512kbps bandwidth can download at a speed of 62.5 KBps

If you don’t want to go through all the hassles of the above formula, just multiply the kbps value with 0.1220703125 to get the KBps value.

512 kbps * 0.1220703125 = 62.5 KBps. Simple!

Internet connectivity Download speed (approx)
256 kbps 31.3 KBps
384 kbps 46.9 KBps
512 kbps 62.5 KBps
768 kbps 93.8 KBps
1 mbps ~ 1000kbps 122.1 KBps

I have mentioned download speed as approximate because they will vary (always reduce) by 15 – 20% due to network signal loss, computer hardware overheads etc. So for realistic, real world figures always reduce 15 – 20% from the computed KBPS download speeds

Now I guess the confusion of kbps and KBps has cleared away. Just remember when you talk in terms of network it’s always bites per second (bps) and when you talk in terms of storage and files its always Bytes per second (Bps). And next time you won’t complain when your 512 kbps connection does not give you download speeds of 512KBps because now you know why.

Code Tutorials

How to create a 1 gig file

dd if=/dev/zero of=big-file.bin bs=1g count=1


mkfile 1g big-file.bin

Code Tutorials Work

How to tar a directory and only include certain file types

find myProjectDirectory -type f \( -name \*\.php -o -name \*\.js -o -name \*\.css -o -name \*\.inc \) | xargs tar -rf myProjectTarName.tar
Code Tutorials Work

How to change file or folder permissions recursively with chmod

To set only files that end with .tpl to 600 (pattern escaped with slashes)

find . -name \*\.tpl -exec chmod 600 {} \;
Tutorials Work

Facebook Conversion Tracking Prestashop Module

The Facebook Conversion Tracking Prestashop Module.

Need to track your ROI from Facebook Ads? With this easy to use Prestashop module you can. This module automatically adds the tracking conversion code when a customer makes a purchase so you can measure if your Ads are working.

You can download the Facebook Conversion Tracking Prestashop Module using the link below:
Facebook Conversion Tracking Prestashop Module

iPhone Tutorials

eHow – How to Repair the Glass on an iPhone

eHow Contributing Writer

If your iPhone 3G screen is cracked, check first with Apple to see if your warranty covers the repair or a replacement. This repair can be difficult and should be attempted only if the image behind the glass screen is visible.

With those precautions, repairing it yourself should cost about $45. This method by Lee Waterman received several positive reviews.

Difficulty: Moderately Challenging


Things You’ll Need:

    Taking the iPhone apart

  1. Step 1

    Turn off the iPhone. Remove the SIM card by inserting a paper clip into the small hole at the top. Remove the two screws at the bottom. Push the suction cup onto the glass. Pull up to separate the glass.

  2. Step 2

    Three cables will hold the two pieces together. Remove the first two using a paper clip. The third is beneath a tab under the first two cables. The last cable should be pulled out gently.

  3. Step 3

    On the screen, remove six screws: two on one side, one on the bottom of the surface behind the glass, one visible on the other side and two under tape on that side.

  4. Step 4

    To remove the LCD, use a paper clip on the sides to hook the bottom corner that has a circle, and pull out.

    Removing the broken glass

  5. Step 1

    Using tweezers, remove the black tape behind the glass on each of the four edges.

  6. Step 2

    Use a hair dryer around the edges of the glass for about 5 minutes to heat the glue.

  7. Step 3

    Pry the glass from the plastic holder. Be sure to remove all the broken glass.

    Installing the glass

  8. Step 1

    Put the adhesive strips at the top and bottom of the plastic holder.

  9. Step 2

    On the new glass screen, remove all the film from the black bottom and top, leaving the protective film on the glass so no fingerprints will get inside. There will probably be two pieces of film on the black parts.

  10. Step 3

    Line up the glass with the holder, making sure the cable goes under the holder. When the two pieces match up, press down to stick the glass to the adhesive strips.

  11. Step 4

    Remove the film from the glass.


  12. Step 1

    Put the LCD back in the holder with all the holes for the screws aligned. Press it in place. Replace all the screws.

  13. Step 2

    Press all the cables into place in the reverse order of their removal.

  14. Step 3

    Align the two pieces — the screen and the unit — and press them together with the holes lined up.

  15. Step 4

    Replace the screws and your SIM card.

Tips & Warnings



Prestashop Manually Converting Carts to Orders

Prestashop Cart2Order Module

I recently had the need to convert customer carts into actual orders and since there wasn’t an easy way to do that with the base install code and a module didn’t exist, I wrote my own.

Basically what this simple module does is convert a customer cart into an order. Here’s how it works by example:

If you have, say for instance Google Checkout and Paypal payment modules installed, then you will have the option to convert a customer’s cart using one of those installed payment modules.

Just click on the payment module icon and it will confirm if you want to convert the cart into an actual order. After you confirm, it will convert the cart and the new order will appear on the orders tab with the status “Payment Accepted”. It does everything as if a real order was placed.

Prestashop Cart2Order Module on 1.4.3

Compatible with Prestashop versions 1.3.x – 1.4.x

You can download the Cart2Order module using the link below:
Cart2Order Prestashop Module

Forum discussion link below:


Preventing the copying of your site design templates

I was browsing the prestashop forum and ended up on a thread concerning an issue with people stealing a site design by downloading the template files from the theme directory. It struck me that this is probably something that those of you who use other template systems with your sites may also face, so thought I’d post the solution here too.

The problem is that although php files cannot be viewed directly on your browser, other source files can be e.g. files ending in .tpl

For example take a look at the following file that has the default permissions:

Unprotected template file

The best way to protect your site is to change the permissions on these files to 600. This will make them accessible only by your own code on the server and present anyone nosey enough to try and look at them with a 403 (forbidden) error. The same is true for php files (although these shouldn’t display the source unless your server configuration is broken).

Have a look at this file with the permissions set to 600:

Protected template file



Customising Prestashop Module Templates

Please don’t edit those originals!

I came across this little gem a while ago on the Prestashop forum, and thought I would draw attention to it in the hopes that it will help someone, somewhere.

I’m not one to complain, but my pet hate is folks who edit the original source files on their stores, when there’s no need to. It bugged me in Zen Cart when people happily modified the “classic” and “default” template files, then wondered why it was difficult to upgrade… and lo and behold folks started doing the same thing to the Prestashop default theme too. Aaaargh!! How hard is it to make a copy, rename it and edit that version instead?

Where my purist instincts failed however, way back in the bad old days, was when it came to the .tpl files that were stored in the module directories themselves — there seems like there’s no choice but to edit them if you want to customise the output for your store — or is there!

The answer is surprisingly simple, and will make you nod your head in grateful appreciation… all you need to do is create a modules/ directory in your custom theme directory (well you aren’t going to be working in the default theme directory now are you), copy the original .tpl from the module directory into it and edit away to your heart’s content.

As an example, you can take the template file from the blockadvertising module (blockadvertising.tpl) and make a copy under /themes/mycooltheme/modules/blockadvertising. Now modify the copy of the original that looked like:

{l s='Advertising' mod='blockadvertising'}


{l s='A fantastic site for Prestashop goodies' mod='blockadvertising'}

Pure joy! Although the observant will notice that unless you edit the {$image} variable and place a static path to your graphic in its place, then you’ll have to change the picture in the module directory…. well you can’t have it all I guess.