Posted
on November 27, 2019, 11:27 pm,
by admin,
under
mysql,
php.
<?php
$dbname = 'dbname';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'hostname';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysql_select_db($dbname) or die("Could not open the db '$dbname'");
$test_query = "SELECT 1,2,3,4 FROM yourtable";
$result = mysql_query($test_query);
$tblCnt = 0;
while($tbl = mysql_fetch_array($result)) {
$tblCnt++;
echo $tbl[0]."<br />\n";
echo $tbl[1]."<br />\n";
echo $tbl[2]."<br />\n";
echo $tbl[3]."<br />\n";
}
if (!$tblCnt) {
echo "There are no tables<br />\n";
} else {
echo "There are $tblCnt tables<br />\n";
} |
Posted
on November 22, 2019, 12:41 pm,
by admin,
under
bash.
If your job is running in terminal do
bg -- Move running process to background -- |
jobs -- list the jobs in background and get id of the job you want to detach -- |
disown %1 -- use job id from previous query for detaching from the terminal -- |
Posted
on November 22, 2019, 12:00 pm,
by admin,
under
mysql.
Posted
on November 15, 2019, 1:09 pm,
by admin,
under
php.
function getNearestMatch($number, $candidates) {
$candidates = is_array($candidates) ? $candidates : array($candidates);
$size = count($candidates);
if ($size > 0) {
//absolute difference between 0th element and input value
$diff = abs($candidates[0] - $number);
//element closest to input value
$ret = $candidates[0];
//loop through the rest of the array
for ($i = 1; $i < $size; $i++) {
$temp = abs($candidates[$i] - $number);
if ($temp < $diff) {
//set new difference and closest element
$diff = $temp;
$ret = $candidates[$i];
}
}
return $ret;
} else {
return NULL;
}
} |
Posted
on October 22, 2019, 10:30 am,
by admin,
under
php.
<?php
class Rates {
function Convert($amount,$from,$to){
$url="http://adsynth-ofx-quotewidget-prod.herokuapp.com/api/1";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"method":"spotRateHistory","data":{"base":"'.$from.'","term":"'.$to.'","period":"week"}}');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_REFERER, "https://widget-yahoo.ofx.com/");
$html = curl_exec ($ch);
curl_close ($ch);
$veri=json_decode($html,true);
return $veri["data"]["CurrentInterbankRate"]*$amount;
}
}
$kur = new Rates();
echo $kur->Convert(1, 'USD', 'GBP'); |
Posted
on October 17, 2019, 1:15 pm,
by admin,
under
bash.
# Test before apply
patch -p1 --dry-run > /path/to/some.patch
# Apply patch
patch -p1 > /path/to/some.patch
# Revert
patch -p1 -R > /path/to/some.patch |
Posted
on October 2, 2019, 1:38 pm,
by admin,
under
git.
Posted
on September 15, 2019, 7:30 pm,
by admin,
under
linux.
ffmpeg -i wombsounds.mp4 -f mp3 -ab 192000 -vn wombsounds.mp3 |
Posted
on September 1, 2019, 12:09 pm,
by admin,
under
apache,
html.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_self">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="imran.aghayev@yahoo.co.uk"/>
<input type="hidden" name="item_name" value="Itemname"/>
<input type="hidden" name="item_number" value="1"/>
<input type="hidden" name="amount" value="150"/>
<input type="hidden" name="currency_code" value="GBP"/>
<input type="hidden" name="lc" value="UK"/>
<input type="hidden" name="bn" value="btn_buynow_SM.gif"/>
<input type="hidden" name="weight_unit" value="kgs"/>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynow_SM.gif" name="submit" alt="Make payments with PayPal"/>
</form> |
Posted
on August 28, 2019, 1:59 pm,
by admin,
under
dictionary.
1. Sprint Refinement – when a team goes through the backlog, score points, etc. It focuses on a long term goals
2. Scrum Planning – when a team go through the backlog and discuss tickets to be added to oncoming Sprint, assign to developer. It focuses on a short term, goals within next Sprint.
3. Scrum Retro(spective) – when a team discuss finished Sprint, how did it go, what could have been done better.
4. Scrum Review – when a project manager demonstrates achievements of last Sprint/s to the management.