Tuesday, December 4, 2012

Delete files / folders older than X days on windows (bat file)

This script will delete all MS SQL database backups (*.bak files) older than 30 days on the current directory and all its subdirectories:

forfiles /s /m *.bak /d -30 /c "cmd /c del @path"

This script will delete all MS SQL database backups (*.bak files) older than 30 days on a specified directory and all its subdirectories:

forfiles /p "c:\database\backups" /s /m *.bak /d -30 /c "cmd /c del @path"

This script will delete all folders older than 30 days on a specified directory:

forfiles /p "C:\todelete" /m * /d -30 /c "cmd /c rd /s /q @path"  

More from here: ForFiles

If you don't have the forfiles.exe, you can download it from here: ForFiles.zip

Tuesday, November 13, 2012

The untold origin and history of jeepney

The Known Story (Extracted from Wikipedia)

When American troops began to leave the Philippines at the end of WWII, hundreds of surplus jeeps were sold or given to the Filipinos. They were stripped down and altered; metal roofs were added for shade; and decorated the vehicles with vibrant colors and chrome-plated hood and other ornaments. They reconfigured the jeeps to accommodate more passengers and classified them as passenger-type jeeps. Its size, length and passenger capacity had increased as it evolved though the years. The non-extended, original-seat configuration jeeps were labeled owners, short for owner-type jeep, and used non-commercially.
The jeepney rapidly emerged as a popular and creative way to re-establish inexpensive public transportation, which had been virtually destroyed during WWII. 

The Untold Story

After World War II, a foreign journalist went to Cebu, Philippines. He saw one of the colorful jeepneys and was dazzled by the sight of it. It was the first time that the jeepney reflected into a foreigner's eyes. Out of excitement, he approached one of the drivers and asked:

Journalist: How do you call this vehicle?

Driver : ha?
[english: what?]

Interpreter : ingon siya unsa daw tawag aning imong sakyanan?
[english: he's asking what do you call this vehicle?]

Driver: ahhh... kani? Jeep ni..
[english: ah, this one? This is Jeep]

Journalist: Jeepney? Cool!

Bisaya to English Transalation:
kani = this
ni = shortcut for "kani"
Jeep ni = This is Jeep

history has written its name... JEEPNEY!

Sunday, September 9, 2012

Fight Starts at 40! - The Manny Pacquiao vs Floyd Mayweather Jr. controversy

If Manny Pacquiao vs Floyd Mayweather Jr. should happen, it should be 7 years from now to have a sensible caption for the long-delayed fight.

"Fight Starts at 40!"


"Life Fights at 40!"


"40-Fight Degrees"

Book now and watch later!!!

Sunday, August 12, 2012

Rich in GOLD.. but never got GOLD

The Philippine Government should not have any reasons not to join / support the Olympic games...... but these are few reasons why we should join:

1. Because we have plenty of water

"Because the rower from Niger was competing in the Olympics despite the fact that he only took up the sport three months ago, his home country doesn't have a single rowing boat and is mostly desert. Yes, he came in last. But he also got one of the biggest cheers of the day."

2. Because we are 92 million in population

Montenegro secure first Olympic medal

"It's amazing this success for a country of 600,000 people. It's historic, something we'll never forget," 

3. Because we have plenty of physically capable athletes

"if Pistorius can compete in the Olympics with no legs, then I should be able to overcome the adversity that I have."

4. Because we have plenty of female athletes

"Because in spite of the fact she pulled up injured within the first few steps of her 100m preliminary round, Qatar's first ever female Olympic athlete broke down barriers - as did Sarah Attar and Wojdan Shaherkani, Saudi Arabia's first ever female Olympians. They may not have won, but they made history."

5. Because we are a nation

All they know about Filipinos is about domestic helpers and monkeys. Isn't this a chance to tell them that we are not?



Thursday, May 31, 2012

MSSQL Random Rows

SELECT TOP 100 * FROM Company_Products p
ORDER BY (CAST(CHECKSUM(NEWID(),p.id) & 0x7fffffff AS float)
/ CAST (0x7fffffff AS int))

Tuesday, April 3, 2012

Custom JQuery Validation with MVC.Net Ajax.BeginForm

<% using (Ajax.BeginForm("Save", "Setup", new AjaxOptions { OnSuccess = "saveComplete", OnBegin = "validateForm", OnComplete = "ScreenManager.Complete" }, new { id = "setup-edit-form" }))

<%= Html.Label("Name") %><%= Html.TextBox("Name",Model.Name) %>

<%}% >

<script type="text/javascript">
$(document).ready(function () {
rules: {
Name: "required"


function validateForm()
var validated = $('#setup-gateways-edit-form').valid();
if (validated) {
alert('this is validated');
return validated;

Monday, April 2, 2012

JQuery Tab Click Custom Event with Ajax load of contents

<div id="setup-tabs">
<li><a href="/Admin/Setup/Sites" title="Setup Tabs Sites">Sites</a></li>
<div id="Setup_Tabs_Sites"></div>

<script type="text/javascript">
select: function (event, ui) {
//ajax loads the content from http://yourdomain/Admin/Setup/Sites
var url = $.data(ui.tab, 'load.tabs');

//retrieves the id of the tab clicked
var tabID = $(ui.panel).attr('id');

//format the function name and retrieve the object
var tabClick = window[tabID + "_Click"];

//checks if function exists
if(typeof tabClick == 'function') {
//executes the function
return true;
load: function (event, ui) {

function Setup_Tabs_Sites_Click()