In a plan to make metrics easier to record and show I have built my own database tables to record custom metrics. Metrics – Year View C# Metrics Admin Page C# Table Creation Metrics YEar View Page C# Metrics Admin Page C# Table Creation
Category: Code
This area of the site is dedicated to code snippets for quick and easy reference
Bring Application Back Into Focus
Sometimes when you are running long processes your application can get away from you and you need to bring the application back into focus. While there are many that may have arguments for or against this method this is one way that has always worked for me.
FormatDateTime Function
This is a default function within VBScript that should work in any VBScript situation. Date is required and has to be in a valid format but easily can accept date() or now() Date() would only display the current date where now() would be date and time. Format would be something…
Prevent Browser Cache
Sources: ASP – http://support.microsoft.com/kb/311006/en-us PHP – http://www.php.net/manual/en/function.header.php ColdFusion – http://www.bpurcell.org/blog/index.cfm?entry=1075&mode=entry JSP – http://www.jguru.com/faq/view.jsp?EID=377&page=2
Windows Login Page Restriction
Sometimes you have to restrict the visitor of a page to a username, if you don’t want to take the time to build a database you can simply use the username on the domain. In the code below make sure you replace “<DOMAIN>” with your companies domain
PHP – File Size
Example: [insert_php] function getsize($file,$type) { $size = filesize(“$file”); if($type = ‘Bytes’) { echo $size; } elseif($type = ‘Kb’) { $kbmath = 1024 * $size; echo $kbmath; } elseif($type = ‘Mb’) { $mbmath = 1024 * $kbmath; echo $mbmath; } } echo getsize(getcwd() . $_SERVER[‘PHP_SELF’],’Bytes’) . ‘ Bytes’; [/insert_php]