Teddy Zugana

public String getLongestCommonSubstring(String str1, String str2)
{
int m = str1.length();
int n = str2.length();

int max = 0;

int[][] dp = new int[m][n];
int endIndex=-1;
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
if(str1.charAt(i) == str2.charAt(j)){

// If first row or column
if(i==0 || j==0){
dp[i][j]=1;
}else{
// Add 1 to the diagonal value
dp[i][j] = dp[i-1][j-1]+1;
}

if(max < dp[i][j])
{
max = dp[i][j];
endIndex=i;
}
}

}
}
// We want String upto endIndex, we are using endIndex+1 in substring.
return str1.substring(endIndex-max+1,endIndex+1);
}
}

--

--

#php

<?php
$inputdata = @$_POST[‘inputdata’];
if(empty($inputdata))
{
$inputdata = @$_GET[‘inputdata’];
}
$result = array();if(is_numeric($inputdata))
{
if(!empty($inputdata))
{

$result = array();

for ($i = 0; $i < $inputdata; $i++)
{
$dataseriestemp=series($i);
if($dataseriestemp==0)
{
}
else if($dataseriestemp%2==1)
{
$result[]=$dataseriestemp;
}
}
}
}function series($num)
{
if($num == 0)
{
return 0;
}
else if($num == 1)
{
return 1;
}
else
{
return (series($num-1) + series($num-2));
}
}
rsort($result);
header(‘Content-Type: application/json’);
echo json_encode($result);
?>

--

--

#php

function getLongestMatchingSubstring($str1, $str2)
{
$len_1 = strlen($str1);
$longest = ‘’;
for($i = 0; $i < $len_1; $i++)
{
for($j = $len_1 — $i; $j > 0; $j — )
{
$sub = substr($str1, $i, $j);
if (strpos($str2, $sub) !== false && strlen($sub) > strlen($longest))
{
$longest = $sub;
break;
}
}
}
return $longest;
}

--

--

ON .htaccess Add =


Options -Indexes
<Files ~
“\.(env|json|config.js|md|gitignore|gitattributes|lock)$”>
Order allow,deny
Deny from all
</Files>
<Files ~ “(artisan)$”>
Order allow,deny
Deny from all
</Files>
<Files *.php>
Order Deny,Allow
Deny from all
</Files>
<Files index.php>
Order Allow,Deny
Allow from all
</Files>

hide .env passwords in Laravel Debug output on config/app.php file add inside return

return ['debug_blacklist' => [
'_ENV' => [
'APP_KEY',
'DB_PASSWORD',
'REDIS_PASSWORD',
'MAIL_PASSWORD',
'PUSHER_APP_KEY',
'PUSHER_APP_SECRET',
],
'_SERVER' => [
'APP_KEY',
'DB_PASSWORD',
'REDIS_PASSWORD',
'MAIL_PASSWORD',
'PUSHER_APP_KEY',
'PUSHER_APP_SECRET',
],
'_POST' => [
'password',
],
],
`];`

--

--