Week 40 Resolving Legit Blocked Ports Through Windows Week 40
01/05/2012
Wisdom From Chinese Fortune Cookie
The wisdom dispensed by Chinese Fortune Cookies you get in America is typically useless. Today, however, a co-worker dropped one off at my desk (since he didn't want it), and just out of curiosity, I cracked it open to read its message. This one turned out to be a pretty one one, in my opinion:
Maxim for life: "You get treated in life the way you teach people to treat you."
12/25/2011
Age is a terrible thief indeed!
"...Age is a terrible thief. Just when you're getting the hang of life, it knocks your legs out from under you and stoops your back. It makes you ache and muddies your head and silently spreads cancer throughout your spouse..."
// JAVASCRIPT FUNCTION LIBRARY FOR FIELD VALIDATION (FV)...
//=====================================================================================
//----------------------------------------------------------------------------------------------------------------------------------
// BEGIN HELPER FUNCTIONS - These functions do not display any alert messages, they simply return values or boleans...
//----------------------------------------------------------------------------------------------------------------------------------
/*Formats a JavaScript date object to a MM/DD/YYYY format string*/
function formatDate(dtValue)
{
var strFormattedDate;
/*JavaScript uses 0 to 11 for months, so add 1*/
var strMonth = new String(dtValue.getMonth() + 1);
var strDay = new String(dtValue.getDate());
var strYear = new String(dtValue.getFullYear());
if(strMonth.length == 1)
{
strMonth = '0' + strMonth;
}
if(strDay.length == 1)
{
strDay = '0' + strDay;
}
strFormattedDate = strMonth + '/' + strDay + '/' + strYear;
return strFormattedDate;
}
/*Returns the number of decimal places after the period in a number string*/
function getDecimalPlaces(theValue)
{
var myExp = /./;
if(myExp.exec(theValue))
{
var right = RegExp.rightContext;
return right.length;
}
return 0;
}
/* Checks to see if one value is between two other values [Accepts integers, floats, and strings] */
function isBetween(theValue, low, high)
{
var result = false;
if(theValue >= low && theValue <= high)
{
result = true;
}
return result;
}
/* Accepts an array. Checks whether the first element is found in the rest of the elements. */
function isIn(arrValues)
{
var result = false;
for(var x=1; x largest)
{
largest = arguments[k];
}
}
return largest;
}
// Function returns the minimal value if a given list...
function smallestValue()
{
var smallest = arguments[0];
for(var k = 1; k < arguments.length; k++)
{
if(arguments[k] < smallest)
{
smallest = arguments[k];
}
}
return smallest;
}
//----------------------------------------------------------------------------------------------------------------------------------
// END OF HELPER FUNCTIONS - These functions do not display any alert messages, they simply return values or boleans...
//----------------------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------------------
// BEGIN FIELD VALIDATION FUNCTIONS
//----------------------------------------------------------------------------------------------------------------------------------
/* Checks to see if the date in question is between a lower and an upper bound
Can be used to replace old fv.date_future: use CF function dateAdd("m", # of months, visit_date)
to determine upper bound */
function dateRange(txtField, strMinDate, strMaxDate)
{
if(txtField.value.length > 0)
{
if(formatDateField(txtField))
{
var dtValue = new Date(txtField.value);
var dtMinDate = new Date(strMinDate);
var dtMaxDate = new Date(strMaxDate);
if(!isBetween(dtValue, dtMinDate, dtMaxDate))
{
raiseErrorOnForm(txtField);
alert('Invalid date. Date should be between ' + formatDate(dtMinDate) + ' and ' + formatDate(dtMaxDate));
txtField.focus();
txtField.select();
}
}
}
}
function formatDateField(txtField)
{
var strTemp = txtField.value;
var intLength = strTemp.length;
if(intLength > 0)
{
// If there are 8 characters (01012003), format MM/DD/YYYY
if(intLength == 8)
{
txtField.value = strTemp.substr(0,2) + "/" + strTemp.substr(2,2) + "/" + strTemp.substr(4,4);
}
// If there are 7 characters (1012003), format 0M/DD/YYYY
else if(intLength == 7)
{
txtField.value = "0" + strTemp.substr(0,1) + "/" + strTemp.substr(1,2) + "/" + strTemp.substr(3,4);
}
// If there are 9 characters (1/01/2003), format 0M/DD/YYYY
else if(intLength == 9)
{
txtField.value = "0" + strTemp;
}
// Check if date is valid
if(!isDateValid(txtField.value))
{
alert('This is not a valid date.');
txtField.focus();
txtField.select();
return false;
}
else
{
return true;
}
}
}
/*Check if the value of the field is in the range between the low and high integer value*/
function inRange(txtField, intLow, intHigh)
{
if(txtField.value.length > 0)
{
if((!isBetween(txtField.value, intLow, intHigh) || !isInt(txtField.value)))
{
alert('This field should be between ' + intLow + ' and ' + intHigh + ' inclusive, with no decimals.');
txtField.focus();
txtField.select();
return false;
}
}
return true; // Means that there were no problems...
}
//----------------------------------------------------------------------------------------------------------------------------------
// END FIELD VALIDATION FUNCTIONS
//----------------------------------------------------------------------------------------------------------------------------------
10/19/2011
SQL Server - Change schema on all tables of your database...
This is prety cool...
My issue was that I had all my tables created using the 'victor3434' schema name. I wanted, instead, to have all of them under the dbo schema. I did a little google search and found a posting with the following SQL query which selects all of your tables and concatenates a string for each table that you then need to execute against the database to perform the change.
SELECT
'ALTER SCHEMA dbo TRANSFER '+ TABLE_SCHEMA +'.'+TABLE_NAME
FROM
INFORMATION_SCHEMA.TABLESWHERE TABLE_SCHEMA =
'victor3434'
In my case, this select statement generated the following strings which I could then easily execute to finish the job.
ALTER SCHEMA dbo TRANSFER victor3434.event_EVT ALTER SCHEMA dbo TRANSFER victor3434.eventType_ETY ALTER SCHEMA dbo TRANSFER victor3434.pages_PAG ALTER SCHEMA dbo TRANSFER victor3434.pagesLog ALTER SCHEMA dbo TRANSFER victor3434.photoGalleries_PGL ALTER SCHEMA dbo TRANSFER victor3434.photoGalleryItems_PGI ALTER SCHEMA dbo TRANSFER victor3434.templates_TMP ALTER SCHEMA dbo TRANSFER victor3434.adminUsers_ADU ALTER SCHEMA dbo TRANSFER victor3434.calendarItem_CAI
Welcome to your group summary. Nelnet groups loans according to features to help organize your account. Typically, these features include lender name, guarantor, interest rate, and subsidy benefits.
Sanchez, Victor
04/26/2011
Nelnet Serviced Loans
Account No:JK09216xxxx
Group ID:A
NELNET STUDENT LOAN TRUST
STAFFORD
$15.29
Subsidized
$0.00
$0.00
$0.00
3.270 / Variable
05/14/2014
$0.00
PIF BY BORROWER
$0.00
$0.01 - 04/25/2011
Account No:JR09216xxxx
Group ID:B
NELNET STUDENT LOAN TRUST
STAFFORD
$21.27
Unsubsidized
$0.00
$0.00
$0.00
3.270 / Variable
05/14/2014
$0.00
PIF BY BORROWER
$0.00
$0.01 - 04/25/2011
Account No:JZ09216xxxx
Group ID:C
NELNET STUDENT LOAN TRUST
STAFFORD
$149.32
Subsidized
$0.00
$0.00
$0.00
3.270 / Variable
05/14/2014
$0.00
PIF BY BORROWER
$0.00
$1,105.15 - 04/25/2011
01/15/2011
Sample Batch File
@ECHO off CLS TITLE = LDPC - ECLIPSE WORK BENCH SET copyName=victor3434.bat SET success=success.txt COPY testss.bat %copyName% > error.txt rem IF NOT ERRORLEVEL == 0 (NOTEPAD error.txt) IF ERRORLEVEL == 0 (NOTEPAD %copyName%) IF NOT ERRORLEVEL == 0 (NOTEPAD error.txt) PAUSE EXIT
CamStudio - very nice free tool for capturing screen videos
Cam Studio:
Great tool to easily create training or documentation videos. Utility allows you to capture a video of your actions on your computer screen...and best of all, it's free!!!
Pretty cool stuff. This little car can sit 4 and weights less than 1000 lbs. And amazinglly has a fuel economy of over 100 miles per gallon!!!
08/31/2010
Bloom Energy - Green energy of the future.
Interesting new company: Using NASA-based technology to generate GREEN energy...perhaps the future of power generation in the world...This company was featured in 60 minutes. Some big companies are already testing the technology, including the likes of Google, Ebay, etc...
Just when you think you got life all figured out, it turns around and changes the rules on you. Life is short; enjoy it while you can.
05/19/2010
Congratulations to Chesca and Vivien!!!
Today, Chesca and Vivien passed their Neonatology Boards Examination. This is a huge deal! Congratulations to the both of you!!!
02/13/2010
Day 50 - Push-ups program
Today I completed day 50! Good deal!
01/30/2010
Day 37 of my 'Incremental Push-ups Program'
Today is day #37 of my Incremental Push-ups Program. Since the beginning of this year, my resolution was, as it is for billions of people across the world, to get in better shape. To that end, I decided to implement my incremental push-up program.
Here's how it works: On day one, I did 10; on the second day, 11 push-ups and son on. I give myself all day to complete my commitment of push-ups. As long as i get them done, I don't care how or when. In fact, there's been a couple of days when I made up push-ups from the previous day. No big deal. So far, I have not missed a single push-up, and I'm proud to say that today, my commitment is 37.
It might not seem like much, but those push up sare starting to add up. But since it is a very gradual program, your body has enough time to adjust. I
Victor Sanchez and I approve of this message!
01/17/2010
First day on Sole S77
According ot the machine, I burned 1000 calories today.
01/17/2010
Hunger-Around-The-World Awareness Program at Allegheny College
A very efficient hunger-awareness program!!!
The full details of how the program escape me now, but I'll try to describe it as best I remember...
When I was in college (Allegheny College in Meadville, PA) they once had a very interesting hunger-awareness program that was very effective. Via e-mail message, students were invited to participate in a special 'alternate lunch program' for one day. If you wanted to participate, you would give up your dinner meal for a ticket. This special ticket had a number on it and could be taken to the hunger-awareness dinner event. At the event, peole were divided into 3 social classes (Rich, Middle Class, Poor) using a type of random lottery system. Here's how the class-assignment worked:
Based on the number on your ticket, you were assigned to one of the 3 classes at random
The Rich Class had the fewest members, say 5, the Middle Class some 20, while the Poor class had the most, 50.
The Rich class had the fewest numbers, while the Poor class had the majority of participants, just like in real life)
The Rich were allowed to make any request from members of the other groups and were not required to be particularly polite
Members of the Poor Class were expected to be polike and to wait their turn.
The event was a simple dinner where the 3 social classes dinned together, but the disbribution of food was similar to that in real life. The few rich sat on fancy, well decorated tables where the food was abundant and fresh. The rich were waited on and treated with respect. Their every need was taken care of by waiters.
Members of the Middle Class were allowed to sit on tables and chairs, but they were a bit older and not well decorated. Their food seemed less fresh and less abundant, and were not waited on by anyone. They essentially had to serve themselves.
Finally, members of the Poor class were instructed to sit on the floor. The food they were allowed to have was of poor quality and much less of it despite the fact that they were the largest group. Before they could begin to eat, they had to wait for the other two groups to finish. The poor were not allowed to initiate conversation with the rich and could only speak to them if spoken to.
The program, for me, was particularly powerful because it clearly illustrated the differences and unfairness in the world. The random assignment into the different social classes was important to illustrate that as individuals, were don't get to choose which life we are born into. Having all 3 classes dine side-by-side also made the differences between rich and poor more evident and impossible to avoid. We might not see it as much in real life because we don't all dine together, but when you are next to each other, it is especially powerful. Of those who participated, some belonged to a higher social class in real life than they ended up in during the event, and this was especially eye-opening for them as they were treated, perhaps for the first time, like everyone else without any special treatment.