Theme Preview Rss

Removing Empty Directory

Did you know that having empty folders on you system can cause slowdown on you system?  Yes it is true specially if you have program that traverse all the files and folders on your systems.  You know, by looking to the files at our hard disk, it is a jungle out there.

Here is a simple approach to this problem:
dir <Target Dirctory> /b /ad /s | Sort /r > <output file>

EX: dir c:\Windows /b /as /s | sort /r >DirList.TXT

and append RD for each line on of the output file

The concept here is get the directory list and sort it reverse order. Why in reverse order since the directory display the top directory then it goes to it contents.  By reversing the order you will remove the inner folder first, then the outer folder.

Since RD (Remove Directory) removes empty folder only, therefore it will just remove empty folders only.

Here is a PERL function I made:
sub EraseDir()
{


if (!-d $_[0])
{
return 0; #Function Failed
}
else
{
#Get the directory list and sort it reverse order.
system ("dir $_[0] /b /ad /s | Sort /r > _junk.file");
open LIST ,"_junk.file" || return 0; #Function Failed
open FH,">_junk.Bat";
foreach my $line (<LIST>)
{
chop $line;
print FH "RD \"$line\"\n";
}


close (FH);
close (LIST);
unlink "_junk.file";
system ("_junk.BAT");
unlink "_junk.Bat";
return 1; #Successful
}
}

Carnapping Modus Operandi – Egg Throwers

We got this from a text message of a friend.  True or not, it wouldn’t hurt to take precaution.

If you are driving at night and someone threw eggs on your windshield. DO NOT USE THE WIPER AND SPRAY WITH WATER. Because egg mixed with wiper became milky and block your vision up 92.5%.  Then you are forced to stop at the road side.  And someone will approach you and rob your things, or even take your car at the worst.  This is a new technique used by robbers.

A sample egg splat, imagine this on your windshield

Please inform your family and friends about this.

Noynoy Aquino 30 Sec TVC

Saw this from Facebook,  got this from www.youtube.com. I haven’t seen this on TV.  It is a short and cute teaser.  This video clip actually plays 27 seconds.





He is our hope. He is our future.  He is our destiny.

How to get free space of Hard Disk using script?

The fastest way to get the free disk space is by looking at Windows Explorer, however most of us want to do this in command line or integrate this to a program for any unknown reasons.

The next fastest and easy this is to use dir command. Why? Since it uses Windows native  command.  I don’t know if find first find next function on Assembly or C is faster than this one.

image

On dir result we see the summary at the last line.  All we need to do is place the result of dir command at a text file and parse the last line from the text file.

Here is a sample PERL script so you can understand what I meant.
sub getFreeDiskSpace ()
{
my $dirname = "$_[0]";
#Execution of the DIR command
system("dir $dirname /s > junk");
open FILE,"junk" || die ("Cannot open temporary file - \"junk\"");

#Parsing of the last lines of the DIR results
@_ = <FILE>;
close(FILE);
my $lastline = @_;
my $dir_size = @_[$lastline-2];
my $disk_remain = @_[$lastline-1];
my @fields = split(/ +/,$dir_size);
$_ = $fields[3];
s/,//g; #get rid of commas in the number
my $folder_size=$_;
my $file_count=$fields[1];
@fields = split(/ +/,$disk_remain);
$_ = $fields[3];
s/,//g; #get rid of commas in the number
my $free_space=$_;
my $folder_count=$fields[1];
unlink "junk";
return ($free_space,$folder_size,$file_count,$folder_count);
}

I go this concept from a script I found from the internet.  I modified it and to a function for portability on the future use.  What struck me the most is I am trying to look for a PERL function and this is what I’ve got.  The lesson I got from this function is “Don’t reinvent the wheel, since it is already invented.” So use what’s available on the market.

Cool Application UI for Windows Mobile

Are you bored with on your Windows Mobile Home Screen.  Bored with the looks since you saw it over and over again.  And you want to have the “WOW” factor as you’ve seen on the iPhone?

Introducing SBP Mobile Shell 3.5. It comes with the following features:

  1. Cool widgets to customize your Home screen. 
  2. Finger friendly contacts with Facebook integration
  3. Fast access to all your phone features and applications
  4. SPB Mobile Shell comes with integrated tools, not limited to the basic phone tools.  I also includes Weather forecasts, Internet, and Facebook & Twitter status
  5. Finally you can customize your device with different options such as
    • Widget position
    • Color Theme
    • Cool Background home screen
    • and many more…

image image image A screen shot of my Home Screen and add widget feature

Aside from the aesthetics, the feature I like the most is you can select different windows with special effects.

image image

And it has cool message reading pane for emails and SMS

image

    For full presentation please refer to this video by SPB




    This cool application cost only for US$29.95. (PHP 1,403.46)  And you can try this for 15 days before purchase.

      LTO License Plate Verification using SMS

      I just got this from an email and I think this is usefull for all of car owners.

      LTO Car Plate Number Verification System

      1. Applies to used/old or brand new cars

      2. Provides information about the REGISTRATION of any of your vehicles, whether it is filed genuinely at any LTO Office or not.

      3. There are CHECKPOINTS nowadays and some unscrupulous policemen will tell you that your CAR REGISTRATION is not duly registered even if you show the OFFICIAL RECEIPT- LTO CAR REGISTRATION. The policeman will tell you that it is either tampered or fake and you have no choice but to give the policeman bribe money.


      How to use this system:

      1. On your cellphone text this message:

      < LTO space VEHICLE space XXXooo >


      ( where XXX000 stands for your vehicle's PLATE NUMBER ( Philippines ) ) i.e.   LTO VEHICLE ZFH185


      2. SEND to 2600 and wait for Auto generated reply then save to your phone.  (An amount of P2.50 or P2.00 will be charged when you send to 2600)




        A reply message from 2600 will inform you the following about the plate no.:

        • Car Plate:

        • Model:

        • Year:

        • Color:

        • Date of Last Registered:

        • LTO Apprehension: if any

        • LTO Alarm: if any


        This is useful for:

        1. If there is a problem in CHECKPOINTS, just show this text message to the officer in charge.

        2. This text message from 2600 is also very important when buying an old and cheap used car.

        3. This will also be useful when you are following a car with a doubtful car plate no.

        4. When you register your car at any LTO Office, try to check this out whether your car is genuinely registered, or a tampered/fake OR was issued to you by an LTO employee or fixer.

        Art of Magic

        Key terms to remember:

        • Salamangka = Magic
        • Salamangkero = Magician

        When I was a little boy, I usually see magicians who performed their tricks and I was amazed and believed that “magic” really existed.  Until I realized that these were mere tricks and not magic.  How come many people still amazed when they see magic show?  The answer is Showmanship, the way on how they delivered the performance.  Someone told me if you want a successfully show, even if your tricks are simple, you need a good presentation and a good delivery.  In short nasa boka lang yan… (It in the way you say it) After watching an episode of Breaking the Magicians' Code: Magic's Biggest Secrets Finally Revealed, I understand more on how things works and I was more amazed to magic than ever before.





        Metal chain magic trick revealed

        Some people ask, if these magicians can do magic, how come they are not rich?  They can use magic to create money, and not to perform on birthday parties and any other parties anymore.  As I mentioned a while ago, these are tricks and skits that they performs to entertain us.  Anyway I know some who does magic for money. ;)

        Moving on, if you think deeper you can see some botched magic made by our dearest government official everyday.  Just tune in to you favorite TV or radio program.  I will not state names, and I know that you can related on what I am saying.  If not just go to Google.com and search the issue there.  If these tricks are successfully performed, we will not know them.  Here are some famous examples of magic tricks that our great performers botched.

        1. Diosdado Macapagal Boulevard – the most expensive boulevard in the whole universe according to Sen. Ping Lacson
        2. DeptEd Noodle Scam – PHP 12 from famous brand compared to PHP 18-22 from unknown noodle company and they said it is due to egg.
        3. Hello Garci - no explanation needed.  Nag sorry lang OK na (Just said sorry and everything back to normal).
        4. Series of expensive Lamp Post, we can see this everywhere, look at Manila Bay around 2004
        5. Le Cirque – as we know that salary of a Bank Manager is almost the same or higher than the salary of our President.  And the salary of a Congressman is smaller than the president.  So how did they magic money, as they claimed that they use their own money?
        6. At marami pang iba haay buhay…. (And many more. Oh! life….)

        See the difference? It’s magic… So on your next birthday party if you want a magician you know where to find him/her… :)

        Thanks to Technology

        Last week during the Tropical Storm Ondoy, we relied on technology a lot.  As we all know, some of the cellular phones services we’re not available, even landlines, and even electricity.  For some few lucky people (including me) our electricity we’re not cut and my internet is still available.

        We all know that, Twitter, Facebook, Plurk and other internet services saves a lot of people.  How?  Since these services can have a facility to share anything you want to say to the public, therefore the people shared what they see.

        Based from different sources, (news, personal witnesses, etc.)  we see item such as:

        1. Missing Persons

        2. Weather Updates

        3. People that needed help

        4. Traffic Updates

        5. Needed item, volunteers or any other things for help

        6. News Update


        Since these are like SMS (140 characters per twit) that you send to the whole world. We expect that all the information are clogged up and unorganized.  Some groups stepped up and created a site for a consolidated information (http://sites.google.com/site/ondoymanila/)
        OK, just got advice from a friend, we need to FOCUS. Let's not make the RT's remain as echoes... Pls read this http://tinyurl.com/y8pv24p

        8:37 PM Sep 29th from web by @JiggyCruz

        They maximized the power of Web 2.0 they used the following:

        1. Google Maps – by plotting the geographical information for those who needs help and the relief centers

        2. Google Spreadsheets – by providing different information on where to donate, missing persons, emergency numbers, and many more.


        In the end, we are not medical professionals, nor rescue or military experts.  We cannot say that we did this smooth and perfectly. However we, the Filipino Netizens, did the right thing by sharing the information we got. And we witnessed that these information saves a lot of families. I want to express my gratitude to the silent majority of the Filipino Internet Users for sharing the information they got in order to save lives, and for doing a good job!

        For closing, I want to share this picture from twitter and it said:



        To all the people in the world I just want to say: 我最喜歡我出生和長大在菲律賓 (I am very happy that I was born and grew up in the Philippines)

        Typhoon Preparedness Tips

        Here is a simple preparation tips at home I got from email. Being prepared for a typhoon means keeping informed on the progress and severity of the storm. And taking some common-sense precautions to minimize the problems a typhoon may cause for you.

        Typhoon Checklist:

        • Food and water - Better if you store food that doesn’t easily spoil like canned goods, noodles and food cooked with vinegar

        • Disposable utensils

        • Can and bottle openers

        • Plastic-ware to store food and supplies

        • First Aid Kit

        • Flashlights and candles

        • Paper towels

        • Garbage bags


        Typhoon Preparation

        Plan In Advance

        1. Check if you can remain in your home during the typhoon. You may be able to ride out a weak typhoon but will need to evacuate for stronger storms. Listen for warnings from your local government officials or official local media broadcasts in situations where evacuation is ordered. Note the evacuation routes and plan to leave early.

        2. Make lists of television and radio stations where you can get storm information, phone numbers to call in case of emergencies and locations of relief shelters. Get directions for the relief shelters.

        3. Have a location for you and your family members to meet if you get separated and the number of a relative in the province to call to say everyone is safe. Have a list of phone numbers of relatives that you will want to inform about your condition. The out-of-town relative can be the one to start the phone brigade to your list after learning you are okay.

        4. Find a place to take your pets where they will be safe if you have to evacuate. Some relief centers may not allow pets.

        5. Remember to turn off electricity, water and gas to your home before evacuating.


         Put Together a Typhoon Kit

        1. Pack food that doesn't have to be refrigerated or cooked along with disposable plates, bowls, forks, knives and spoons. Each person and pet in the home should have enough to eat for three days. For those with babies, please remember that exclusive breastfeeding is best for infants up to six months old. This is especially important in times of calamities and emergencies.

        2. Store water. Each person needs three gallons of clean water to drink and to use for washing. Pets also need water. For babies, please note that they are constantly feeding. If you are formula feeding or doing mixed feeding, please store additional sterilized water for your baby (both for feeding and cleaning bottles).

        3. Have flashlights, oil lamps, lanterns and candles, along with extra batteries, matches and fuel on hand.

        4. Include a first aid kit in your typhoon kit.

        5. Pack board games, reading materials, card decks and a battery-operated radio. For babies and small children, make sure to include a favorite toy or blanket.

        6. Prepare a box of garbage bags and paper towels.


         Pack Your Bags

        1. Pack a small bag or backpack for each person in the home. It should include clothes and toiletries for three days. For babies, make sure to include cloth or disposable diapers and extra plastic bags to store diapers or soiled cloth diapers.

        2. Include a blanket and pillow for each person and place them in garbage bags (to keep them dry) to take along when evacuating.

        3. Include a small water-proof bag or satchel of photos and documents you want to keep dry and safe, such as wills, passports and government-issued certificates.

        4. Place everyone's bag and bed bundle near the door so they can be quickly loaded into the car if you decide to evacuate. Make sure your car has enough gas.


        Reference: http://www.smartparenting.com.ph/article/typhoon-preparation-and-checklist

        Emergency Numbers

        As the Typhoon Pepng Arrived in Metro Manila area.  We better get ready and keep these emergency numbers.

        Rescue Operations

        1. National Disaster Coordinating Council (NDCC) (+632-9125668, +632-9111406, +632-9115061, +632-9122665) Help hotlines: (+65 734-2118, 734-2120)

        2. Philippine Coast Guard (+632-5276136)

        3. Air Force (+63908-1126976, +632-8535023)

        4. Metro Manila Development Authority (136)

        5. Marikina City Rescue (+632-6462436, +632-6462423, +632920-9072902)

        6. Pasig Rescue Emergency Number (+632-6310099)

        7. Quezon City Rescue (161)

        8. San Juan City Hall Command Post (+632-4681697)

        9. Bureau of Fire Protection Region III (Central Luzon) Hotline: (+63245-9634376)

        10. Senator Dick Gordon (+639178997898, +63938-444BOYS, +632-9342118, +632-4338528)

        11. Senator Manny Villar (+639174226800. +639172414864, +639276751981)


        Civil Society/ Media

        1. Philippine National Red Cross (143, +632-5270000)

        2. Philippine National Red Cross Rizal Chapter operations center hotline: (+632-6350922, +632-6347824)

        3. Go to GMA Facebook page & post complete addresses and names of people in need of immediate help.

        4. ABS-CBN Typhoon Ondoy Hotline: (+632-4163641)

        5. Jam 88.3: (+632- 6318803) or SMS at JAM (space) 883 (space) your message to 2968


        Power Supply

        • Meralco (+63917-5592824, 16211, +63920-9292824) If you want service cut off to your area to prevent fires and electrocution.


        People Tracker (using your phones, get your friends and family to turn on their finderservice for you)

        • FINDERSERVICE. For Smart, text “wis <your name> <your mobile>” to 386.

        • FINDERSERVICE. For Globe, text “find <your name> <your mobile> to 7000.


        *NOTE: Bold Red Font means easy to remember numbers



        Source: http://sites.google.com/site/ondoymanila/rescue-operations-contacts