I use grep a lot to find stuff in files. However, there are times when I am looking for things on different boxes, mainly servers, that do not have grep installed. I have found 'findstr' command which gives a lot of the functionality of grep that is built-in to Windows. So give it a try when grep is not available.
Friday, March 14, 2014
Tuesday, February 11, 2014
Setting focus/highlighting a field
input onfocus="this.select();" This selects field when the field receives focus
or
document.getElementById("fieldName").select(); This highlights field
document.getElementById("FieldName").focus(); Just sets focus to field.
or
document.getElementById("fieldName").select(); This highlights field
document.getElementById("FieldName").focus(); Just sets focus to field.
Setting focus on a Field at Program startup
The javascript Snippet:
</form>
<script
type="text/javascript"
language="javascript">
document.getElementById("YourControlName").focus();
</script>
</body>
Ensure the Following:
- The javascript is placed after the close form tag
- The javascript is placed before the close body tag
- The @Page Directive SmartNavigation is not set to true
- The YourControlName highlighted above is replaced with your control's ID value
Another Way to accomplish setting focus to a specific field:
window.onload = function() {
document.getElementById("TextBoxName").focus();
};
Friday, January 24, 2014
Using MYSQL to create an aging Query in A/R
I started writing an aging program for our A/R and started looking for ways to accomplish this within MYSQL.
I came up with this query that accomplished the task
[code]
set @AsOfPeriod="201312";
set @CurrentPeriod=@AsOfPeriod;
set @ThirtyDaysPeriod=PERIOD_ADD(@AsOfPeriod,-1);
set @SixtyDaysPeriod=PERIOD_ADD(@AsOfPeriod,-2);
set @NinetyDaysPeriod=PERIOD_ADD(@AsOfPeriod,-3);
select
artransactions.idealer,
artransactions.dOutStandingBalance as Bal,
min(icloseyear * 100 + iclosemonth) as minPer,
if (min(icloseyear * 100 + iclosemonth)=max(icloseyear * 100 + iclosemonth), "",max(icloseyear * 100 + iclosemonth)) as maxPer,
sum(doutstandingbalance) as SumOutBal,
sum(if ( (iclosemonth + icloseyear * 100)=@CurrentPeriod, dOutStandingBalance,0 )) as "Current",
sum(if ( (iclosemonth + icloseyear * 100)=@ThirtyDaysPeriod, dOutStandingBalance,0 )) as '30Days',
sum(if ( (iclosemonth + icloseyear * 100)=@SixtyDaysPeriod, dOutStandingBalance,0 )) as '60Days',
sum(if ( (icloseyear * 100 + iclosemonth) <= @NinetyDaysPeriod, doutstandingbalance,0)) as "Over 90Days",
@AsOfPeriod ,
@CurrentPeriod,
@ThirtyDaysPeriod,
@SixtyDaysPeriod,
@NinetyDaysPeriod
from artransactions
where artransactions.dOutStandingBalance > 0
group by idealer
order by maxper desc
[/code]
I came up with this query that accomplished the task
[code]
set @AsOfPeriod="201312";
set @CurrentPeriod=@AsOfPeriod;
set @ThirtyDaysPeriod=PERIOD_ADD(@AsOfPeriod,-1);
set @SixtyDaysPeriod=PERIOD_ADD(@AsOfPeriod,-2);
set @NinetyDaysPeriod=PERIOD_ADD(@AsOfPeriod,-3);
select
artransactions.idealer,
artransactions.dOutStandingBalance as Bal,
min(icloseyear * 100 + iclosemonth) as minPer,
if (min(icloseyear * 100 + iclosemonth)=max(icloseyear * 100 + iclosemonth), "",max(icloseyear * 100 + iclosemonth)) as maxPer,
sum(doutstandingbalance) as SumOutBal,
sum(if ( (iclosemonth + icloseyear * 100)=@CurrentPeriod, dOutStandingBalance,0 )) as "Current",
sum(if ( (iclosemonth + icloseyear * 100)=@ThirtyDaysPeriod, dOutStandingBalance,0 )) as '30Days',
sum(if ( (iclosemonth + icloseyear * 100)=@SixtyDaysPeriod, dOutStandingBalance,0 )) as '60Days',
sum(if ( (icloseyear * 100 + iclosemonth) <= @NinetyDaysPeriod, doutstandingbalance,0)) as "Over 90Days",
@AsOfPeriod ,
@CurrentPeriod,
@ThirtyDaysPeriod,
@SixtyDaysPeriod,
@NinetyDaysPeriod
from artransactions
where artransactions.dOutStandingBalance > 0
group by idealer
order by maxper desc
[/code]
Wednesday, January 22, 2014
Javascript gettng number of ticks
[code]
//numberTicks is number of ticks of current date
var d = new Date();
var numberTicks = d.getTime();
//numberTicks is number of ticks of current date
var d = new Date();
var numberTicks = d.getTime();
[/code]
I'm using the number of tick to attach to html files from the mainmenu to force the html file to be loaded from the disk and not from the cache.
menu[3][8] = new Item('Check Deposit Report', 'RptCheckReportc.html?ver=' + numberTicks, '', defLength, 0, 0);
menu[3][8] = new Item('Check Deposit Report', 'RptCheckReportc.html?ver=' + numberTicks, '', defLength, 0, 0);
Friday, January 17, 2014
.net javascript disabling buttons to show something is happening when button is selected
I have some code I use when I want to give some visual clues to the user when a button is pressed on a .net web screen.
Set up the onbeforeunload option to call the 'disableButtons()' function. It will disable the buttons after the action has been initiated, yet cause the appropriate code to execute in the code behind. If you disable a button prior to the onbeforeunload event, then the code behind will NOT receive that the button has been clicked event, because it was disabled before evoking that event.
[code]
<body class="formStyle" onbeforeunload="disableButtons();">
var ButtonsToDisable = [];
function validateUserSelections(vButton)
{
var btnCSV = document.getElementById("btnCSV");
var btnSearch = document.getElementById("btnSearch");
ButtonsToDisable.push(btnCSV);
ButtonsToDisable.push(document.getElementById("btnSearch"));
if (typeof vButton === 'undefined')
{
return true;
}
if (vButton == null)
{
return true;
}
if (vButton == 'CSV')
{
btnCSV.innerText = "Working";
}
return true;
}
[/code]
Set up the onbeforeunload option to call the 'disableButtons()' function. It will disable the buttons after the action has been initiated, yet cause the appropriate code to execute in the code behind. If you disable a button prior to the onbeforeunload event, then the code behind will NOT receive that the button has been clicked event, because it was disabled before evoking that event.
[code]
<body class="formStyle" onbeforeunload="disableButtons();">
var ButtonsToDisable = [];
{
var btnCSV = document.getElementById("btnCSV");
var btnSearch = document.getElementById("btnSearch");
ButtonsToDisable.push(btnCSV);
ButtonsToDisable.push(document.getElementById("btnSearch"));
if (typeof vButton === 'undefined')
{
return true;
}
if (vButton == null)
{
return true;
}
if (vButton == 'CSV')
{
btnCSV.innerText = "Working";
}
return true;
}
[/code]
MYSQL listing all the items that are grouped together - Group_Concat statement
1
2
3
4
| SELECT server,group_concat(user SEPARATOR ',') AS logged_in_usersFROM logged_inGROUP BY server; |
Subscribe to:
Posts (Atom)