bash prompt and echoing colors inside a function

I found this topic looking for answer how to set bash color with escaping \[ \] from bash function. Actually there is solution. Bash allows to generate PS1 prompt each time prompt is rendered. set_bash_prompt(){ PS1=”\u@\h $(call_your_function) $>” } PROMPT_COMMAND=set_bash_prompt This way, PS1 will be interpreted each time prompt will be displayed, so it will … Read more

PHP to search within txt file and echo the whole line

And a PHP example, multiple matching lines will be displayed: <?php $file=”somefile.txt”; $searchfor=”name”; // the following line prevents the browser from parsing this as HTML. header(‘Content-Type: text/plain’); // get the file contents, assuming the file to be readable (and exist) $contents = file_get_contents($file); // escape special characters in the query $pattern = preg_quote($searchfor, “https://stackoverflow.com/”); // … Read more

How to clear previously echoed items in PHP

<?php ob_start(); echo ‘a’; print ‘b’; // some statement that removes all printed/echoed items ob_end_clean(); echo ‘c’; // the final output is equal to ‘c’, not ‘abc’ ?> Output buffering functions The output buffering functions are also useful in hackery to coerce functions that only print to return strings, ie. <?php ob_start(); var_dump($myVar); $data = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)