Tag Archive for print

Drupal print url args

<?php

print '<div align="left">';
print '<br/>arg-0 :' .arg(0);
print '<br/>arg-1 :' .arg(1);
print '<br/>arg-2 :' .arg(2);
print '<br/>q:' . $_GET['q'];

$view = $GLOBALS['current_view'];
$args = $view->args;

print '<br/>args-0 :' .$args[0];
print '<br/>args-1 :' .$args[1];

print '</div>';

?>

source

Rule to Dump Any Makefile Variable

echo_% :
	@echo $* = '${$*}'

source

Print Date/Time in DOS Batch File

set DATESTAMP=%DATE:~10,4%_%DATE:~4,2%_%DATE:~7,2%

set TIMESTAMP=%TIME:~0,2%_%TIME:~3,2%_%TIME:~6,2%

set DATEANDTIME=%DATESTAMP%_%TIMESTAMP%



echo Today's date is %DATESTAMP%

echo The local time is %TIMESTAMP%

echo Date and time: %DATEANDTIME%

source

CSS class for not displaying tag groups in print pages

<style type="text/css">
@media print {
.noprint { display: none; }
}
</style>

source

Modify DOM elements of a print page with jQuery code using Firebug

$('<style media="print"> body {font-size: 12pt} </
style>').appendTo('head');

source

How to Create a .csv file of a SAS dataset

www.studysas.blogspot.com

source

Go Green With CSS Print Stylesheets

@media print {

#header, #nav, #footer, #ads, img { display: none; }
#content { line-height: 1em; width: 100%; }
#content * { color: #000000; }

}

source

Exception manager for DOM event handlers – no more silent failures

/**
* Enhanced Javascript logging and exception handler.
*
* It is utterly annoying when DOM event handler exceptions fail
* silently with Firebug. This package fixes this common problem.
*
* @copyright Copyright 2008 Twinapex Research
*
* @author Mikko Ohtamaa
*
* @license 3-clause BSD
*
*
*
* <a href="http://blog.redinnovation.com/2008/08/19/catching-silent-javascript-exceptions-with-a-function-decorator/" >http://blog.redinnovation.com/2008/08/19/catching-silent-javascript-exceptions-with-a-function-decorator/</a>
*
* Twinapex
*
* High quality web hackers for hire!
*
* <a href="http://www.twinapex.com" >http://www.twinapex.com</a>
*
*/

// Declare namespace
twinapex = {}

twinapex.debug = {}

/**
* Print exception stack trace in human readable format into the console
*
* @param {Exception} exc
*/
twinapex.debug.printException = function(exc) {

function print(msg) {
console.log(msg);
}

print(exc);

if (!exc.stack) {
print('no stacktrace available');
return;
};
var lines = exc.stack.toString().split('
');
var toprint = [];
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
if (line.indexOf('ecmaunit.js') > -1) {
// remove useless bit of traceback
break;
};
if (line.charAt(0) == '(') {
line = 'function' + line;
};
var chunks = line.split('@');
toprint.push(chunks);
};
toprint.reverse();

for (var i = 0; i < toprint.length; i++) {
print('  ' + toprint[i][1]);
print('    ' + toprint[i][0]);
};
print();
}


/**
* Decorate function so that exceptions falling through are printed always.
*
* Returns a decorated function which will be used instead of the normal function.
* The decorated function has preplaced try ... catch block which will not let
* through any exceptions silently or without logging. Even though there is an
* exception it is normally throw upwards in the stack after logging.
*
*  <pre>
*
*  // myFunction can be bind to many events and exceptions are logged always
*  myfunction = function()
*     // crash here
*     var i = foobar; // missing variable foobar
*  });
*  </pre>
*
*  Then there are alternative usage examples:
*
*  <pre>
*
*  // Decorate function
*  myfunction = twinapex.debug.manageExceptions(myfunction);
*
*  // Bind with exception manager
*  $document.clicker(twinapex.debug.manageExceptions(myfunction));
*
*  // Run loader code with exception manager
*  jq(document).ready(function() {
*	    console.log("Help pop up page wide init");
*	    twinapex.debug.manageExceptions(initHelpPopUpHandlers(document));
*  });
*  </pre>
*
*
* @param func: Javascript function reference
*/
twinapex.debug.manageExceptions = function(func) {

var orignal = func;

decorated = function() {
try {
orignal.apply(this, arguments);
} catch(exception) {
twinapex.debug.printException(exception);
throw exception;
}
}

return decorated;
}

// Don't use windows load handler for init()
// since debug code might be called from other load handlers
// Browser specific logging output initialization
// - fake Firebug console.log for other browsers
if(typeof(console) == "undefined") {
// Install dummy functions, so that logging does not break the code if Firebug is not present
var console = {};
console.log = function(msg) {};
console.info = function(msg) {};
console.warn = function(msg) {};

// TODO: Add IE Javascript console output

// TODO: Add Opera console output

} else {
// console.log provided by Firefox + Firebug
}

source

Print array in readable html format

print("<pre>".print_r($your_array,true)."</pre>");

source

PHP Command Line Confirmation Prompt

$message   =  "Are you sure you want to do this [y/N]";
print $message;
flush();
ob_flush();
$confirmation  =  trim( fgets( STDIN ) );
if ( $confirmation !== 'y' ) {
// The user did not say 'y'.
exit (0);
}

source