File Download with speed limit using PHP

Sometimes we need to limit speed of file download When we have a limited bandwidth in server
So here is solution to

File download with speed limit in PHP

<?php
// local file that should be send to the client
$local_file = ‘test-file.zip’;
// filename that the user gets as default
$download_file = ‘your-download-name.zip’;
// set the download rate limit (=> 20,5 kb/s)
$download_rate = 20.5;
if(file_exists($local_file) && is_file($local_file)) {
// send headers
header(‘Cache-control: private’);
header(‘Content-Type: application/octet-stream’);
header(‘Content-Length: ‘.filesize($local_file));
header(‘Content-Disposition: filename=’.$download_file);
// flush content
flush();
// open file stream
$file = fopen($local_file, “r”);
while(!feof($file)) {
// send the current file part to the browser
print fread($file, round($download_rate * 1024));
// flush the content to the browser
flush();
// sleep one second
sleep(1);
}
// close file stream
fclose($file);}
else {
die(‘Error: The file ‘.$local_file.’ does not exist!’);
}
?>

How To Make Today Memorable

Yesterday is gone and tomorrow is just a figment of the imagination.  So if you think about it, today is the only day you’re alive.  Today is the day that matters the most.

Here’s how to make it memorable:

  • Try something totally new. – Variety truly is the spice of life.  You can see or do something a million times, but you can only see or do it for the first time once.  As a result, first time experiences usually leave a reflective mark in our minds for the rest of our lives.  So spice it up!
  • Entertain yourself with real-world experiences. – Great memories are the product of interesting life experiences.  So turn off the television (or the computer) and get outdoors.  Interact with the world, appreciate nature, take notice of the simple pleasures life has to offer, and just watch as life unfolds in front of you.
  • Work on something that’s meaningful to you. – Engage yourself in a meaningful personal project.  Or pull the trigger on doing something you’ve wanted to do for a long time, but haven’t yet had the resolve to do.  Life is short.  Today is the day to take action.
  • Challenge your mind and body. – Learn a new skill.  Be creative.  Build something from the ground up, no matter how small.  Run farther than you’ve ever run before.  Push yourself to the limits!
  • Concentrate on less, but give it your best. – Slow down.  Pay close attention to what you’re doing.  Don’t waste time juggling forgettable tasks.  Instead, concentrate on a few things that really matter.  Engage fully in this day.
  • Say “yes” to a spontaneous opportunity. – Everything in life can’t be planned.  Some of the greatest opportunities will knock on your door when you least expect them to.  Be flexible, be spontaneous, and just say “yes.”
  • Complete an important piece of unfinished business. – Today is a perfect day to finish what you started.  Few feelings are more satisfying than the one you get after an old burden has been lifted off of your shoulders.
  • Document your day. – Take lots of pictures.  Keep a journal.  Document your day so you can review it some other day.  Many moons from now, these old photos and journal entries will ignite your recollection of great memories from the past.
  • Smile, be positive, and notice what’s right. – Everything that happens in life is neither good nor bad.  It just depends on your perspective.  And no matter how it turns out, it always ends up just the way it should.  Either you succeed or you learn something.  So stay positive, appreciate the pleasant outcomes, and learn from the rest.
  • Be authentic.  Be true to yourself. – Judy Garland once said, “Always be a first rate version of yourself, instead of a second rate version of somebody else.”  Live by this statement.  There is no such thing as living a good day in someone else’s shoes.  The only shoes you can occupy are your own.  If you aren’t being yourself, you aren’t truly living… you’re merely existing.  And no day spent in a phony state of mere existence will ever be memorable or worthwhile.
  • Actively assist someone in need. – In life, you get what you put in.  When you make a positive impact in someone else’s life, you also make a positive impact in your own life.  Do something that’s greater than you, something that helps someone else to be happy or to suffer less.  I promise, it will be an extremely rewarding experience.  One you’ll likely remember forever.
  • Share time with a good friend and experience life together. – Pink Floyd once said, “The memories of a man in his old age are the deeds of a man in his prime.”  There are few things more satisfying than recounting the greatest moments of your life with your closest friends who lived these moments alongside you.
  • Make a new friend. – People are interesting creatures, and no two people are exactly alike.  So meet someone new today.  Find out what makes them tick.  They’ll likely open your eyes to fascinating ideas and perspectives.  And you never know, they just might change your life.
  • Do something fun and laugh your ass off. – Some of the most memorable moments in your life will be moments spent in laughter.
  • Be present.  Be here now. – I purposely left this bullet for last because it perfectly encompasses all of my previous points. – Don’t let your life slip by.  Instead of dwelling on the past, or worrying about the future, just practice being and living in the ‘now.’  Remember, right now is the only moment guaranteed to you.  Right now is life.  Don’t miss it.

And I leave you with this to think about:

We all agree that life is short.  Sooo…

Why do we do so many things we don’t like and like so many things we don’t do?

How to Add a Program to the Ubuntu Startup List (After Login)

If you are coming from Windows, you are probably familiar wtih adding a shortcut to the Startup folder in the Start menu so that the program will start after you log in.

Ubuntu provides a little utility to help you accomplish the same thing, but it’s not named quite what you’d think, so you may not have found this.

And yes, for the more technical users, you can modify the startup script and accomplish the same thing.

You’ll find the tool on the System \ Preferences\ Sessions menu item:

Click the Add button, and type in the full path to the executable you are trying to start if it’s not in your path already. For instance, if you wanted to start the vmware toolbox, you’d put in vmware-toolbox into the textbox. You can also browse directly to the item you want to start.

Secure your facebook account

Like others have said, FB, MySpace, Twitter, etc., create privacy concerns and are a waste of time. Spend real time with the real people in your life. Really, what a self-important lot we’ve become. Most don’t care what you are doing. For those that do, how about actually communicating via phone or in person? Now there’s a revolutionary idea! I don’t see these services as bringing people together. They are actually more a way to keep people at a distance. Think about it.

for securing your face book account this is best article
http://www.allfacebook.com/2009/02/facebook-privacy/

check out ! 🙂

How to improve and organize your memory

Everyone can take steps to improve their memory, and with time and practice most people can gain the ability to memorize seemingly impossible amounts of information. Whether you want to win the World Memory Championships, ace your history test, or simply remember where you put your keys, this article can get you started. Scientists believe that exercising your brain can create a cognitive reserve that will help you stay sharp as you age.

1. Convince yourself that you do have a good memory that will improve. Too many people get stuck here and convince themselves that their memory is bad, that they are just not good with names, that numbers just slip out of their minds for some reason. Erase those thoughts and vow to improve your memory. Commit yourself to the task and bask in your achievements; it’s hard to keep motivated if you beat yourself down every time you make a little bit of progress.

2. Keep your brain active. The brain is not a muscle, but regularly exercising the brain actually does keep it growing and spurs the development of new nerve connections that can help improve memory. By developing new mental skills especially complex ones such as learning a new language or learning to play a new musical instrument and challenging your brain with puzzles and games you can keep your brain active and improve its physiological functioning.

3. Exercise daily. Regular aerobic exercise improves circulation and efficiency throughout the body, including in the brain, and can help ward off the memory loss that comes with aging. Exercise also makes you more alert and relaxed, and can thereby improve your memory uptake, allowing you to take better mental pictures.

4. Reduce stress. Chronic stress, although it does not physically damage the brain, can make remembering much more difficult. Even temporary stresses can make it more difficult to effectively focus on concepts and observe things. Try to relax, regularly practice yoga or other stretching exercises, and see a doctor if you have severe chronic stress.

5. Eat well and eat right. There are a lot of herbal supplements on the market that claim to improve memory, but none have yet been shown to be effective in clinical tests (although small studies have shown some promising results for ginkgo biloba and phosphatidylserine). A healthy diet, however, contributes to a healthy brain, and foods containing antioxidants ”broccoli, blueberries, spinach, and berries, for example”and Omega-3 fatty acids appear to promote healthy brain functioning. Feed your brain with such supplements as Thiamine, Vitamin E, Niacin and Vitamin B-6. Grazing, eating 5 or 6 small meals throughout the day instead of 3 large meals, also seems to improve mental functioning (including memory) by limiting dips in blood sugar, which may negatively affect the brain.

6. Take better pictures. Often we forget things not because our memory is bad, but rather because our observational skills need work. One common situation where this occurs (and which almost everyone can relate to) is meeting new people. Often we don’t really learn people’s names at first because we aren’t really concentrating on remembering them. You’ll find that if you make a conscious effort to remember such things, you’ll do much better. One way to train yourself to be more observant is to look at an unfamiliar photograph for a few seconds and then turn the photograph over and describe or write down as many details as you can about the photograph. Try closing your eyes and picturing the photo in your mind. Use a new photograph each time you try this exercise, and with regular practice you will find you’re able to remember more details with even shorter glimpses of the photos.

7. Give yourself time to form a memory. Memories are very fragile in the short-term, and distractions can make you quickly forget something as simple as a phone number. The key to avoid losing memories before you can even form them is to be able to focus on the thing to be remembered for a while without thinking about other things, so when you are trying to remember something, avoid distractions and complicated tasks for a few minutes.

8. Create vivid, memorable images. You remember information more easily if you can visualize it. If you want to associate a child with a book, try not to visualize the child reading the book that’s too simple and forgettable. Instead, come up with something more jarring, something that sticks, like the book chasing the child, or the child eating the book. It’s your mind make the images as shocking and emotional as possible to keep the associations strong.

9. Repeat things you need to learn. The more times you hear, see, or think about something, the more surely you’ll remember it, right? It’s a no-brainer. When you want to remember something, be it your new coworker’s name or your best friend’s birthday, repeat it, either out loud or silently. Try writing it down; think about it.

10. Group things you need to remember. Random lists of things (a shopping list, for example) can be especially difficult to remember. To make it easier, try categorizing the individual things from the list. If you can remember that, among other things, you wanted to buy four different kinds of vegetables, you’ll find it easier to remember all four.

11. Organize your life. Keep items that you frequently need, such as keys and eyeglasses, in the same place every time. Use an electronic organizer or daily planner to keep track of appointments, due dates for bills, and other tasks. Keep phone numbers and addresses in an address book or enter them into your computer or cell phone. Improved organization can help free up your powers of concentration so that you can remember less routine things. Even if being organized doesn’t improve your memory, you’ll receive a lot of the same benefits (i.e. you won’t have to search for your keys anymore).

12. Try meditation. Research now suggests that people who regularly practice mindfulness meditation are able to focus better and may have better memories. Mindfulness (also known as awareness or insight meditation) is the type commonly practiced in Western countries and is easy to learn. Studies at Massachusetts General Hospital show that regular meditation thickens the cerebral cortex in the brain by increasing the blood flow to that region. Some researchers believe this can enhance attention span, focus, and memory.

Alter Table Row Background Colors(Zebra rows for Tables) Using JavaScript

This first example uses a style element through which we have defined two classes for background colors:

<style>
.odd{background-color: white;}
.even{background-color: gray;}
</style>

The style is flexible: it could just as well define something else, such as that every second row should display in italics. The complete function looks like this:

function alternate(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
//manipulate rows
if(i % 2 == 0){
rows[i].className = "even";
}else{
rows[i].className = "odd";
}
}
}
}

App Store hits 15,000 apps and 500 Million downloads!!

A new banner has appeared on the Apple homepage in the last 48 hours that boasts that there are now currently 15,000+ apps on the App Store, and that they have reached the incredible milestone of 500 Million downloads.

Considering that the App Store only opened 6 months ago it is an amazing achievement. Apple’s last milestone announcement came on December 5th 2008, which stated that they had exceeded 10,000 apps and 300 Million downloads. This shows a massive increase in apps and downloads in comparison to previous announcements.

Suprisingly over the holiday period iFart mobile increased sales threefold, and on christmas day alone made over $27,000 after apples cut, so it just shows that its not just the really useful apps that are getting hammered its also the ones that stink…