Google Search

Google Search

HTML/JavaScript

Thursday, September 1, 2011

VALIDATION JS AND AJAX FORMAT

Validation for gif,pdf,bmb,jpeg,doc

foreign language characters in my mysql DB?

foreign language characters in my mysql DB?




3 down vote accepted


Is the connection to the database also UTF-8 encoded?

Give this a try: right after connecting to the mysql database, run the following query.

SET NAMES utf8;

Great! It worked wonderfully! I added $conn->query('SET NAMES utf8'); Thanks again!

mysql_query("SET NAMES utf8");

URL VALIDATION JS

Upload temp folder server settings error

upload_tmp_dir = /tmp/

Upload images

$c1 = rand(0,9);$c2 = rand(0,9);$c3 = rand(0,9);$c4 = rand(0,9);
$rand = $c1.$c2.$c3.$c4;
$dir_path = "album/".$rand.$_FILES['upload1']['name'];
$dir_patha = $dir_path;
$file=$rand.$_FILES['upload1']['name'];
if(move_uploaded_file($_FILES['upload1']['tmp_name'],"../".$dir_path)){

Unlink

unlink($arr1[$y]);

Text focus JS

SSL, or Secure Socket Layers, is what makes secure sites secure.

SSL, or Secure Socket Layers, is what makes secure sites secure.

Here's how it works:

When you log onto a secure server it communicates with your browser for a few seconds. During this communication, it sends your browser encryption information that only it and your browser can read.

Once this encryption is set, it acts like a normal web page, except that all info coming or going is encrypted. This encryption makes it extremely difficult for any third party who would intercept the transaction to decipher it. (All this extra protection is why secure servers seem to run slower than their unsecured counterparts.)

Secure connections only protect the info as its coming and going, not when it's just sitting on the server.

That being said, you probably have a better chance of getting ripped off by a sales clerk copying your credit card number at a department store than getting your information stolen over the internet.

You can tell a secure site by the first part of its web address. If it starts with https:// rather than http:// it's a secure site.

PDF to imGAE code

[R-sig-mediawiki] Revised Rext 0.03 with better error reporting
Alex Brown alex at transitive.com
Tue Sep 26 15:03:44 CEST 2006

* Previous message: [R-sig-mediawiki] Revised Rext 0.02 with better error reporting
* Next message: [R-sig-mediawiki] R-News article
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

Attached is a version of Rext 0.03 with my previous changes plus a
set of changes to improve error reporting, including:

if iframe images cannot render, you get the program text + the error

if inline R (default output) contains an error, you get the error
message in red inlined with the wiki page

if inline R (output=display) fails to render, you get the program
text + the error inlined with the wiki page

In the long run, I plan to unify the 3 different output modes,
starting with default and display - I have a prototype (not included)
that does this.

I have attached a patch as well as the complete file.

-Alex

====

patch from 0.03

--- Rext_orig.php 2006-09-26 12:56:55.345076291 +0100
+++ Rext.php_3_with_debug 2006-09-26 13:57:03.412252560 +0100
@@ -36,7 +36,7 @@
defined('convert') || define('convert', getCmd('', 'convert', ''));
defined('sudo') || define('sudo', getCmd('', 'sudo', ' -u
' . sudouser . ' '));
defined('chmod') || define('chmod', getCmd('', 'chmod', ' 664
'));
-defined('r_cmd') || define('r_cmd', getCmd('', 'R', ' --
vanilla'));
+defined('r_cmd') || define('r_cmd', getCmd('', 'R', ' --
vanilla --quiet'));
defined('r_dir') || define('r_dir', getcwd() .
DIRECTORY_SEPARATOR . 'Rfiles' );
defined('r_url') || define('r_url', extractUrl(r_dir));
@@ -103,17 +103,21 @@
return $ret;
}
-function runRinShell ($cmd, $chmf) {
+function runRinShell ($cmd, $chmf, &$r_exitcode) {
+ $stdout = "";
if (security>1) {
$msg = shell_exec (sudo . $cmd);
if ($chmf!='') {
$cmd = sudo . chmod . $chmf;
- shell_exec ($cmd);
+ exec ($cmd, $stdout, $r_exitcode);
# error ('R', $cmd, $msg);
}
} else {
- $msg = shell_exec ($cmd);
+ exec ($cmd, $stdout, $r_exitcode);
}
+
+ foreach($stdout as $row) $msg .= $row . "\n";
+
# error ('R', $cmd, $msg);
return ($msg);
}
@@ -138,6 +142,8 @@
$url = r_url . DIRECTORY_SEPARATOR . $sha1 . '.jpg';
$urlpdf = r_url . DIRECTORY_SEPARATOR . $sha1 . '.pdf';
$htm = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.html';
+
+ $r_exitcode = 0;
if (!file_exists($jpg) or onsave) {
$content = '';
if ($ws!='') {
@@ -153,38 +159,48 @@
$fn = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.R';
$fd = fopen ($fn, 'w') or error ('R', 'can not open file:
' . $fn, $input);
fwrite ($fd, $content);
- fclose ($fd);
- $err = $err . runRinShell (r_cmd . ' < ' . $fn, '');
- $err = $err . runShell (convert . ' ' . $pdf . ' ' .
$convert . ' ' . $jpg);
+ fclose ($fd);
+ $err = $err . runRinShell (r_cmd . ' 2>&1 < ' . $fn, '',
$r_exitcode);
+ if ($r_exitcode == 0)
+ {
+ $err = $err . runShell (convert . ' ' . $pdf . ' ' .
$convert . ' ' . $jpg);
+ }
}
- if (!file_exists($jpg)) {
- $jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.jpg.0';
- if (file_exists($jpg)) {
- for ($i=0; ; $i++) {
- $old = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.jpg.' . $i;
- $new = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-' . $i .
'.jpg';
- if (file_exists($old)) {
- rename ($old, $new);
+ if ($r_exitcode == 0)
+ {
+ if (!file_exists($jpg)) {
+ $jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.jpg.0';
+ if (file_exists($jpg)) {
+ for ($i=0; ; $i++) {
+ $old = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.jpg.' .
$i;
+ $new = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-' .
$i . '.jpg';
+ if (file_exists($old)) {
+ rename ($old, $new);
+ } else {
+ break;
+ }
+ }
+ }
+ $jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-0.jpg';
+ file_exists($jpg) or error ('R', 'JPEG file does not
exist: ' . $jpg, $input . $err);
+ $url = r_url . DIRECTORY_SEPARATOR . $sha1 . '-0.jpg';
+ $ret = 'border="0" style="' . style . '">';
+ for ($i=1; ; $i++) {
+ $jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-'. $i .
'.jpg';
+ $url = r_url . DIRECTORY_SEPARATOR . $sha1 . '-' . $i .
'.jpg';
+ if (file_exists($jpg)) {
+ $ret = $ret . '';
} else {
break;
}
- }
+ }
+ } else {
+ $ret = 'border="0" style="' . $style . '">';
}
- $jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-0.jpg';
- file_exists($jpg) or error ('R', 'JPEG file does not exist:
' . $jpg, $input . $err);
- $url = r_url . DIRECTORY_SEPARATOR . $sha1 . '-0.jpg';
- $ret = 'border="0" style="' . style . '">';
- for ($i=1; ; $i++) {
- $jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-'. $i .
'.jpg';
- $url = r_url . DIRECTORY_SEPARATOR . $sha1 . '-' . $i .
'.jpg';
- if (file_exists($jpg)) {
- $ret = $ret . '';
- } else {
- break;
- }
- }
- } else {
- $ret = 'border="0" style="' . $style . '">';
+ }
+ else
+ {
+ $ret = '
' . $err . '
';
}
$fd = fopen ($htm, 'w') or error ('R', 'can not open HTML
file: ' . $htm, $input . $err);
fwrite ($fd, makeHTML($prg . $ret, $direct));
@@ -211,7 +227,8 @@
$fd = fopen ($fn, 'w') or error ('R', 'Can not open file:
' . $fn, $input . $err);
fwrite ($fd, $content);
fclose ($fd);
- $err = $err . runRinShell (r_cmd . ' < ' . $fn, $htm);
+ $r_exitcode = 0;
+ $err = $err . runRinShell (r_cmd . ' < ' . $fn, $htm,
$r_exitcode);
}
file_exists($htm) or error ('R', 'HTML file does not exist:
' . $htm, $input . $err);
$cont = file_get_contents ($htm);
@@ -238,14 +255,22 @@
$fd = fopen ($fn, 'w') or error ('R', 'Can not open file:
' . $fn, $input . $err);
fwrite ($fd, $content);
fclose ($fd);
- $cmd = renderFilename(r_cmd . ' --slave < ' . $fn . ' > ' .
$rst);
- $err = $err . runRinShell ($cmd, $rst);
+ $cmd = renderFilename(r_cmd . ' --slave 2>&1 < ' . $fn . ' >
' . $rst);
+ $r_exitcode = 0;
+ $err = $err . runRinShell ($cmd, $rst, $r_exitcode);
}
file_exists($rst) or error ('R', 'Text file does not exist:
' . $rst, $input . $err);
$cont = file_get_contents ($rst);
if (strpos ($cont, '') === false) {
$fd = fopen ($rst, 'w') or error ('R', 'can not open file:
' . $rst, $input . $err);
- fwrite ($fd, makeHTML($prg . '
' . $cont . '
',
$direct));
+ if ($r_exitcode == 0)
+ {
+ fwrite ($fd, makeHTML($prg . '
' . $cont . '
',
$direct));
+ }
+ else
+ {
+ fwrite ($fd, makeHTML($prg . '
' . $cont . 'style="color:red">' . $err . '' . '
', $direct));
+ }
fclose ($fd);
}
$ret = $rst;


====

actual file:



/*

Plugins for Mediawiki

(C) 2006- Sigbert Klinke (sigbert at wiwi.hu-berlin.de), Markus Cozowicz

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA

*/

# for Special::Version:
$wgExtensionCredits['parserhook'][] = array(
'name' => 'R extension',
'author' => 'Sigbert Klinke',
'url' => 'http://mars.wiwi.hu-berlin.de/mediawiki/sk/
index.php/R_Plugin_for_MediaWiki',
'version' => 'v0.03',
);

// global params
if (!defined('extbase')) {
include ('extbase.php');
}

// security = 0: no checks on code
// security = 1: some R commands are forbidden
// security = 2: sudo
defined('security') || define('security', 2);
defined('sudouser') || define('sudouser', 'rd');

defined('convert') || define('convert', getCmd('', 'convert', ''));
defined('sudo') || define('sudo', getCmd('', 'sudo', ' -u
' . sudouser . ' '));
defined('chmod') || define('chmod', getCmd('', 'chmod', ' 664
'));
defined('r_cmd') || define('r_cmd', getCmd('', 'R', ' --
vanilla --quiet'));

defined('r_dir') || define('r_dir', getcwd() .
DIRECTORY_SEPARATOR . 'Rfiles' );
defined('r_url') || define('r_url', extractUrl(r_dir));
defined('r_cgi') || define('r_cgi', getcwd() .
DIRECTORY_SEPARATOR . 'R.php');
defined('r_ext') || define('r_ext', getcwd() .
DIRECTORY_SEPARATOR . 'extensions' . DIRECTORY_SEPARATOR . 'R');


//Add the hook function call to an array defined earlier in the wiki
code execution.
$wgExtensionFunctions[] = "wfRParse";

//This is the hook function. It adds the tag to the wiki parser and
tells it what callback function to use.

function wfRParse() {
global $wgParser;
# register the extension with the WikiText parser
$wgParser->setHook("R", "renderR" );
$wgParser->setHook("Rform", "renderRform" );
}

function makeStyle ($param, $default) {
$list = explode (';', $default);
$n = count($list);
$arr = array();
for ($i=0; $i<$n; $i++) {
$pair = explode (':', $list[$i]);
$arr[$pair[0]] = $pair[1];
}
$list = explode (';', $param);
$n = count($list);
for ($i=0; $i<$n; $i++) {
$pair = explode (':', $list[$i]);
$arr[$pair[0]] = $pair[1];
}
$list = array_keys($arr);
$ret = '';
for ($i=0; $i<$n; $i++) {
if (strlen($list[$i])>0) {
$ret = $ret . $list[$i] . ':' . $arr[$list[$i]] . ';';
}
}
return $ret;
}

function makeHTML ($input, $direct) {
if (!direct) {
$ret = 'Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
$ret = $ret . 'content="0">';
$ret = $ret . $input;
// $ret = $ret . '
' . date("d.m.Y") . ' ' . date("H:i:s");
$ret = $ret . '';
} else {
$ret = $input;
}
return $ret;
}

function renderRform( $input , $params ) {
array_key_exists('name', $params) or error ('Rform', 'attribute
"name" required', $input);
$name = $params['name'];
$ret = '
target="' . $name . '">';
$ret = $ret . '';
$ret = $ret . $input;
$ret = $ret . '
';
return $ret;
}

function runRinShell ($cmd, $chmf, &$r_exitcode) {
$stdout = "";
if (security>1) {
$msg = shell_exec (sudo . $cmd);
if ($chmf!='') {
$cmd = sudo . chmod . $chmf;
exec ($cmd, $stdout, $r_exitcode);
# error ('R', $cmd, $msg);
}
} else {
exec ($cmd, $stdout, $r_exitcode);
}

foreach($stdout as $row) $msg .= $row . "\n";

# error ('R', $cmd, $msg);
return ($msg);
}

function runShell ($cmd) {
$cmd = str_replace ("\n", ' ', $cmd);
return (shell_exec ($cmd));
}

function runR ($output, $convert, $sha1, $input, $direct, $echo, $ws) {
// Generate a graphics
$prg = '';
if ($echo) {
$prg = '
' . $input . '
';
}
$err = "\n";
$rws = r_dir. DIRECTORY_SEPARATOR . $ws;
switch ($output) {
case 'display':
$jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.jpg';
$pdf = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.pdf';
$url = r_url . DIRECTORY_SEPARATOR . $sha1 . '.jpg';
$urlpdf = r_url . DIRECTORY_SEPARATOR . $sha1 . '.pdf';
$htm = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.html';

$r_exitcode = 0;
if (!file_exists($jpg) or onsave) {
$content = '';
if ($ws!='') {
$content = $content . 'sys.load.image("' . $rws . '",
TRUE)' ."\n";
}
$content = $content . 'rfiles<-"' . r_dir . '"' . "\n" .
'rpdf <- "' . $pdf . '"' . "\n";
$content = $content . 'source("' . r_ext .
DIRECTORY_SEPARATOR . 'StatWiki.r")' . "\n";
$content = $content . $input . "\n";
if ($ws!='') {
$content = $content . 'sys.save.image("' . $rws .
'")' ."\n";
}
$content = $content . 'q()';
$fn = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.R';
$fd = fopen ($fn, 'w') or error ('R', 'can not open file:
' . $fn, $input);
fwrite ($fd, $content);
fclose ($fd);
$err = $err . runRinShell (r_cmd . ' 2>&1 < ' . $fn, '',
$r_exitcode);
if ($r_exitcode == 0)
{
$err = $err . runShell (convert . ' ' . $pdf . ' ' .
$convert . ' ' . $jpg);
}
}
if ($r_exitcode == 0)
{
if (!file_exists($jpg)) {
$jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.jpg.0';
if (file_exists($jpg)) {
for ($i=0; ; $i++) {
$old = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.jpg.' .
$i;
$new = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-' .
$i . '.jpg';
if (file_exists($old)) {
rename ($old, $new);
} else {
break;
}
}
}
$jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-0.jpg';
file_exists($jpg) or error ('R', 'JPEG file does not
exist: ' . $jpg, $input . $err);
$url = r_url . DIRECTORY_SEPARATOR . $sha1 . '-0.jpg';
$ret = 'border="0" style="' . style . '">';
for ($i=1; ; $i++) {
$jpg = r_dir . DIRECTORY_SEPARATOR . $sha1 . '-'. $i .
'.jpg';
$url = r_url . DIRECTORY_SEPARATOR . $sha1 . '-' . $i .
'.jpg';
if (file_exists($jpg)) {
$ret = $ret . '';
} else {
break;
}
}
} else {
$ret = 'border="0" style="' . $style . '">';
}
}
else
{
$ret = '
' . $err . '
';
}
$fd = fopen ($htm, 'w') or error ('R', 'can not open HTML
file: ' . $htm, $input . $err);
fwrite ($fd, makeHTML($prg . $ret, $direct));
fclose ($fd);
$ret = $htm;
break;
case 'html':
$htm = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.html';
if (!file_exists($htm) or onsave) {
$content = '';
if ($ws!='') {
$content = $content . 'sys.load.image("' . $rws . '",
TRUE)' ."\n";
}
$content = $content . 'rfiles<-"' . r_dir . '"' . "\n";
$content = $content . 'source("' . r_ext .
DIRECTORY_SEPARATOR . 'StatWiki.r")' . "\n";
$content = $content . 'rhtml<-"' . $htm . '"' . "\n";
$content = $content . 'cat("", file=rhtml, append=FALSE)' .
"\n";
$content = $content . $input . "\n";
if ($ws!='') {
$content = $content . 'sys.save.image("' . $rws .
'")' ."\n";
}
$content = $content . 'q()';
$fn = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.R';
$fd = fopen ($fn, 'w') or error ('R', 'Can not open file:
' . $fn, $input . $err);
fwrite ($fd, $content);
fclose ($fd);
$r_exitcode = 0;
$err = $err . runRinShell (r_cmd . ' < ' . $fn, $htm,
$r_exitcode);
}
file_exists($htm) or error ('R', 'HTML file does not exist:
' . $htm, $input . $err);
$cont = file_get_contents ($htm);
if (strpos ($cont, '') === false) {
$fd = fopen ($htm, 'w') or error ('R', 'can not open file:
' . $htm, $input . $err);
fwrite ($fd, makeHTML($prg . $cont, $direct));
fclose ($fd);
}
$ret = $htm;
break;
default:
$rst = r_dir . DIRECTORY_SEPARATOR . $sha1 . '.html';
if (!file_exists($rst) or onsave) {
$content = '';
if ($ws!='') {
$content = $content . 'sys.load.image("' . $rws . '",
TRUE)' ."\n";
}
$content = $content . 'rfiles<-"' . r_dir . '"' . "\n" .
$input . "\n";
if ($ws!='') {
$content = $content . 'sys.save.image("' . $rws .
'")' ."\n";
}
$content = $content . 'q()';
$fn = r_dir . '/' . $sha1 . '.R';
$fd = fopen ($fn, 'w') or error ('R', 'Can not open file:
' . $fn, $input . $err);
fwrite ($fd, $content);
fclose ($fd);
$cmd = renderFilename(r_cmd . ' --slave 2>&1 < ' . $fn . ' >
' . $rst);
$r_exitcode = 0;
$err = $err . runRinShell ($cmd, $rst, $r_exitcode);
}
file_exists($rst) or error ('R', 'Text file does not exist:
' . $rst, $input . $err);
$cont = file_get_contents ($rst);
if (strpos ($cont, '') === false) {
$fd = fopen ($rst, 'w') or error ('R', 'can not open file:
' . $rst, $input . $err);
if ($r_exitcode == 0)
{
fwrite ($fd, makeHTML($prg . '
' . $cont . '
',
$direct));
}
else
{
fwrite ($fd, makeHTML($prg . '
' . $cont . 'style="color:red">' . $err . '' . '
', $direct));
}
fclose ($fd);
}
$ret = $rst;
}
return $ret;
}

function checkCommands ($input) {
// Thanks to the R-php people :)
$banned = array('.C', '.Call', '.Call.graphics', '.External',
'.External.graphics',
'.Fortran', '.readRDS', '.saveRDS', '.Script',
'.Tcl',
'.Tcl.args', '.Tcl.callback', '.Tk.ID',
'.Tk.newwin', '.Tk.subwin',
'.Tkroot', '.Tkwin', 'basename', 'browseURL',
'bzfile',
'capture.output', 'close', 'close.screen',
'closeAllConnection', 'data.entry',
'data.restore', 'dataentry', 'de', 'dev.control',
'dev.copy2eps',
'dev.cur', 'dev.list', 'dev.next', 'dev.prev',
'dev.print',
'dev.set', 'dev2bitmap', 'dget', 'dir', 'dir.create',
'dirname', 'do.call', 'download.file', 'dput',
'dump',
'dyn.load', 'edit', 'edit.data.frame', 'emacs',
'erase.screen',
'example', 'fifo', 'file', 'file.access',
'file.append',
'file.choose', 'file.copy', 'file.create',
'file.exists', 'file.info',
'file.path', 'file.remove', 'file.rename',
'file.show', 'file.symlink',
'fix', 'getConnection', 'getwd', 'graphics.off',
'gzcon',
'gzfile', 'INSTALL', 'install.packages', 'jpeg',
'library.dynam',
'list.files', 'loadhistory', 'locator',
'lookup.xport', 'make.packages.html',
'make.socket', 'menu', 'open', 'parent.frame',
'path.expand',
'pico', 'pictex', 'pipe', 'png',
'postscript', 'print.socket', 'prompt',
'promptData', 'quartz',
'R.home', 'R.version', 'read.00Index', 'read.dta',
'read.epiinfo',
'read.fwf', 'read.mtp', 'read.socket',
'read.spss', 'read.ssd',
'read.xport', 'readBin', 'readline', 'readLines',
'remove.packages',
'Rprof', 'save', 'savehistory', 'scan', 'screen',
'seek', 'setwd', 'showConnection', 'sink',
'sink.number',
'socketConnection', 'source', 'split.screen',
'stderr', 'stdin',
'stdout', 'sys.call', 'sys.calls', 'sys.frame',
'sys.frames',
'sys.function', 'Sys.getenv', 'Sys.getlocale',
'Sys.info', 'sys.nframe',
'sys.on.exit', 'sys.parent', 'sys.parents',
'Sys.putenv', 'Sys.sleep',
'Sys.source', 'sys.source', 'sys.status',
'Sys.time', 'system',
'system.file', 'tempfile', 'textConnection',
'tkpager', 'tkStartGUI',
'unlink', 'unz', 'update.packages', 'url',
'url.show',
'vi', 'write', 'write.dta', 'write.ftable',
'write.socket',
'write.table', 'writeBin', 'writeLines', 'x11',
'X11',
'xedit', 'xemacs', 'xfig', 'zip.file.extract');
# 'pdf',
$n = count($banned);
for ($i=0; $i<$n; $i++) {
if (substr_count($input, $banned[$i])>0) {
// okay, we found something forbidden, now we need a regular
expression to check if it is a function call like 'name (', 'name ='
or 'name.' !
$pattern = '/\b' . str_replace ('.', '\.', $banned[$i]) . '[\W]
*[\(\=\.]+/';
if (preg_match ($pattern, $input, $match) > 0) { return $banned
[$i]; }
# preg_match ($pattern, $input, $match);
# error('Check', '', print_r($match, true));
}
}
return '';
}

function renderR( $input , $params ) {
//Eval the code between the tags.
$style = array_key_exists('style', $params) ? ' style="' .
$params['style'] . '"' : '';
$output = array_key_exists('output', $params) ? $params
['output'] : 'text';
$alt = array_key_exists('alt', $params) ? $params
['alt'] : $input;
$convert = array_key_exists('convert', $params) ? $params
['convert'] : '';
$onsave = array_key_exists('onsave', $params);
$echo = array_key_exists('echo', $params);
$direct = !array_key_exists('iframe', $params);
$sha1 = sha1($input . $output . $style);
$ws = array_key_exists('workspace', $params)? $params
['workspace'] : '';

// security checks
if (security>0) {
$chkres = checkCommands($input);
# error ('R', $chkres, $input);
(strlen($chkres)==0) or error ('R', 'security check failed: used
banned command or parameter "' . $chkres . '"', $input);
$input = $input . "\n#" . $chkres;
}
(preg_match('/\W+/', $ws)==0) or error ('R', 'security check
failed: invalid workspace name "' . $ws . '"', $input);
// check if iframe is given, if not then assume direct output
$iframe = 'width:100%;height:250px;';
if (!$direct) {
$iframe = makeStyle ($params['iframe'], $iframe);
}
if (array_key_exists('name', $params)) {
// we may reuse the program ..., thus save all infos
$sav = r_dir . DIRECTORY_SEPARATOR . $params['name'] . '.sav';
$fd = fopen ($sav, 'w') or error ('R', 'can not open file: ' .
$sav, $input);
fwrite ($fd, '@output ' . $output . "\n");
fwrite ($fd, '@convert ' . $convert . "\n");
fwrite ($fd, '@sha ' . $sha1 . "\n");
fwrite ($fd, '@direct ' . $direct . "\n");
fwrite ($fd, '@echo ' . $echo . "\n");
fwrite ($fd, '@workspace '. $ws . "\n");
fwrite ($fd, $input);
fclose ($fd);
}

// execute R program
$fn = runR ($output, $convert, $sha1, $input, $direct, $echo, $ws);
$name = array_key_exists('name', $params) ? $params['name'] : $sha1;

// now switch between direct output and iframe output
if ($direct) {
$ret = file_get_contents ($fn);
} else {
$ret = '';
}

return ($ret);
}



* Previous message: [R-sig-mediawiki] Revised Rext 0.02 with better error reporting
* Next message: [R-sig-mediawiki] R-News article
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

More information about the R-sig-mediawiki mailing list

Create handle for new PDF document


// create handle for new PDF document
$pdf = pdf_new();

// open a file
pdf_open_file($pdf, "philosophy.pdf");

// start a new page (A4)
pdf_begin_page($pdf, 595, 842);

// get and use a font object
$arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 10);

// print text
pdf_show_xy($pdf, "There are more things in heaven and earth, Horatio,", 50, 750); pdf_show_xy($pdf, "than are dreamt of in your philosophy", 50, 730);

// end page
pdf_end_page($pdf);

// close and save file
pdf_close($pdf);

Only number restrictions



 -->

User Id

(Mobile-No / Email-Id)
 




 

Password 


 


Confirm Password 


 


 


 I Accept Terms & Conditions

 




 
































 









| Home | Profile | Contact Us|

| Call Request | Terms & Conditions | Privacy policy | Disclaimer |



















Number,parseint JS

Upload initial setup

ini_set("upload_max_filesize","10M");
ini_set("post_max_size","10M");
ini_set("max_execution_time","10M");
ini_set("max_input_time","10M");

Image upload

$video_file1=$_FILES["fileupload3"]["name"];
$c1 = rand(0,9);$c2 = rand(0,9);$c3 = rand(0,9);$c4 = rand(0,9);

$rand = $c1.$c2.$c3.$c4;

$date = date("Y-m-d");

if($video_file1!='') {

move_uploaded_file($_FILES['fileupload3']['tmp_name'],'../product_images/'.$rand.$_FILES['fileupload3']['name']);

}


if($video_file1!='') { $path3 = 'product_images/'.$rand.$_FILES['fileupload3']['name']; } else { $path3=$image; }

Java script CDATA

//
function validate(f)
{

var regex = /\W+/;
var str = "";

if (f.title.value == "")
{
str += "\nThe title field is blank.";
}
if (f.pathnew.value == "")
{
str += "\nThe file path is blank.";
}

if (str == "")
{
f.submit();
}
else
{
alert(str);
return false;
}
} //]]>

Carat purity


The carat (abbreviation ct or kt) is a measure of the purity of gold alloys. In the United States and Canada, the spelling karat is used, while the spelling carat is used to refer to the measure of mass for gemstones (see Carat (mass)).
Measure

As a measure of purity, one carat is \tfrac{1}{24} purity by mass:

X = 24\,\frac{M_g}{M_m}

where

X is the carat rating of the material,
Mg is the mass of pure gold or platinum in the material, and
Mm is the total mass of the material.

Therefore 24-carat gold is fine (99.9% Au w/w), 18-carat gold is 75% gold, 12-carat gold is 50% gold, and so forth.
24 carat "Chuk Kam" (99.0% min)
22 carat (91.6%)
21 carat (87.5%), 18 carat (75.0%) in most Egypt
18 carat (75.0%)
8-18 carat (33.3 - 75.0%)

USSR stands for Union Of Soviet Socialist Republics.

Directorate of Marketing and Inspection has a set up for quality certification of agricultural produce through the net work of 22 Regional Agmark Laboratories at different places in the country with Central Agmark Laboratory, Nagpur as the apex laboratory. 250 technical persons are working in these laboratories. These laboratories have been established to formulate standards and conduct physical and chemical analysis of agricultural and allied commodities in accordance with APGM Act 1937.



Central Agmark Laboratory has the following specialized commodity divisions for carrying out research and standardization work more efficiently.

1. Agricultural Products (Foodgrains)

2. Spices and Essential Oils

3. Oils and Fats

4. General Chemistry

5. Livestock Products including microbiology

6. Toxicology



The main functions of Central Agmark Laboratory are:



To work as apex laboratory for challenged sample under APGM Act 1937

a) To evolve/standardize methods of analysis/tests of agricultural and allied commodities and meat products.

b) To advise on technical matters to various quality control agencies and State Government Grading Laboratories, in relation to grading of various agricultural commodities, food under Agmark.

c) Formulation of specifications for new commodities for bringing under the purview of Agmark.

d) Revision of specifications of various agricultural, allied products, meat products etc. periodically.

e) Training to the personnel engaged in the analysis of various commodities under Agmark.

f) To create awareness with regard to grading, standardisation and quality of various agricultural and food products.

]

The Regional Agmark Laboratories are engaged in analysis of agricultural and food commodities for evaluating the quality of the product. The main activities of Regional Agmark Laboratories are as follows:



a) Analysis of commodities covered under Agmark,

b) Technical advice to approved grading laboratories

c) Training of Grading chemists of the private approved lab., State Grading Lab and other similar organization.

d) Associate with Central Agmark Laboratory, in collaborative studies/research/standardization work of various

agricultural, food and livestock products.

e) To organize Awareness programmes in grading, standardisation and quality control.

VISION

a) To organize training and awareness programme on good marketing practices, grading, standardization and quality

certification for the benefit of the farmers.

b) To organize training in chemical and microbiological analysis and for food safety parameters.

c) Framing of specification for Research and Standardization work of agricultural, food and allied commodities, meat products including food safety parameters under SPS measures.

d) Development of method of analysis

e) Collection of data on food safety parameters and quality parameters for harmonization of standards for international

acceptance.

f) To accord accreditation to laboratories engaged in analysis work under “Agmark” and MFP Order.

g) Preparation of manual on Grading, Standardisation and quality certification, Good Agricultural Marketing Practices, analysis of agricultural produce at farmer’s level.

h) To obtain accreditation of laboratories for validation of test reports.