/* Reto Egeter, fullparam.wordpress.com */ DECLARE @SearchStrTableName nvarchar(255), @SearchStrColumnName nvarchar(255), @SearchStrColumnValue nvarchar(255), @SearchStrInXML bit, @FullRowResult bit, @FullRowResultRows int SET @SearchStrColumnValue = ‘P042015003648’ /* use LIKE syntax P102004000005 P062005001955 P042011001733 P012009008972*/ SET @FullRowResult = 1 SET @FullRowResultRows = 20 SET @SearchStrTableName = NULL /* NULL for all tables, uses LIKE syntax */ SET @SearchStrColumnName = NULL […]
MYSQL search through whole database for a certain string.
The code above will generate a procedure called get_table(SEARCH_STRING) , that will accept 1 parameter which is your string. It will search through the whole database server besides these db(information_schema,test,mysql). But if you would like to search only in a certain DB you may use the second block. $ call get_table(‘STRING’); ## FIRST BLOCK ## […]
Javascript – Event key code cheat sheet
Today i’ve played around with event.keyCode and event.type in javascript and i found this URL that helps alot with boosting our programming for event https://css-tricks.com/snippets/javascript/javascript-keycodes/
PHP config for max_input_vars
Today i’ve encounter a problem where there are too many inputs and it failed silently. It did not update the database. If you see this in your error log PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini Update your max_input_vars in php.ini . Take note that this will […]
Nginx Load Balancer X_Forwaded_For
Forwarding Visitor’s Real-IP + Nginx Proxy/Fastcgi backend correctly
Vim Writing in Visual Block
Move the cursor to the n in name. Enter visual block mode (ctrlv). Press j three times (or 3j). Press I (capital i). Type in vendor_. Press esc.
PHP Forking with child process limit
function runProcessor() { $max_fork = 2; $tasks = [ “test1” => “process1”, “test2” => “process2”, “test3” => “process3”, “test4” => “process4”, “test5” => “process5”, “test6” => “process6”, “test7” => “process7”, “test8” => “process8”, “test9” => “process9”, “test10” => “process10”, ]; $pids = array(); $pid_count = 0; foreach ( $tasks as $seq => $task ) { […]
Jquery Check Device & width of device & check element is in middle of screen when scrolled
<script> if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { var window_width = $(window).width(); if(window_width <= 991){ console.log(“Mobile Devices width is smaller than 991”); var windowHeight = $(window).height(), gridTop = windowHeight * .3, gridBottom = windowHeight * .8; $(window).scroll(function(){ $.each($(“[class$=area]”),function(){ var thisTop = $(this).offset().top – $(window).scrollTop(); if (thisTop > gridTop && (thisTop + $(this).height()) < gridBottom) { if($(this).css(“bottom”) != […]
PHP Curl with attachment ( CurlFile)
Sender PHP Code <form method=”post” action=”<?=$_SERVER[“PHP_SELF”] ?>” enctype=”multipart/form-data”> <input name=”file” type=”file” /> <input type=”submit” value=”Upload” /> </form> <?php if(!empty($_FILES)){ $target=”https://juliusgoh.life/tut/attachment-receiver.php”; echo “<pre>”; print_r($_FILES); echo “</pre>”; # http://php.net/manual/en/curlfile.construct.php // Create a CURLFile object / procedural method $cfile = curl_file_create($_FILES[“file”][“tmp_name”],$_FILES[“file”][“type”],$_FILES[“file”][“name”]); // try adding // Create a CURLFile object / oop method #$cfile = new CURLFile(“resource/test.png”,”image/png”,”testpic”); // uncomment […]
PHP Script uses bash command to find file created within mins ago
$dir = “/home/ec2-user/julius/tmp/”; $file_type = “json”; $min = “5”; #Created How Many Min Ago $output = shell_exec(“find $dir -cmin -$min -type f -name ‘*.$file_type'”); $json_file = explode(“\n”,$output); array_pop($json_file); # To remove last \n if(empty($json_file)){exit();} print_r($json_file);