Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
SMPP Delivery status format differences between Silknet & Magti
/id:(.*?) submit date:(.*?) done date:(.*?) stat:(.*?) err:(.*)/
The result of the above format is:
7439722864896249924 sub:001 dlvrd:001
/id:(.*?) (?:sub:\d+ dlvrd:\d+ )?submit date:(.*?) done date:(.*?) stat:(.*?) err:(.*)/
The result:
7439722864896249924
by Valeri Tandilashvili
2 months ago
0
PHP
preg_match
SMPP
0
SMPP SMS-Off UTF8 Support CODE
function getString(&$ar, $maxlen = 255, $firstRead = false, $encoding = 3)
{
	$s = "";
	$i = 0;
	$rep = 1;
	if ($encoding == 8) {
		$rep = 2;
	}
	do {
		$c = 0;
		for($rc = 0; $rc < $rep; $rc ++) {
			$c += ($firstRead && $i == 0) ? current($ar) : next($ar);
			$i++;
		}
		if ($encoding == 8) {
            if ($c >= 224 && $c <= 256) {
                $c += 4080;
            }
		}
		if ($c != 0) {
			$s .= mb_chr($c);
		}
	} while ($i < $maxlen && $c != 0);
	
	return $s;
}

$ar = unpack("C*", hex2bin('0001013939353539383235313533340000013930323237000000000000000008004a004800650079002010d010d110d210d310d410d510d610d710d810d910da10db10dc10dd10de10df10e010e110e210e310e410e510e610e710e810e910ea10eb10ec10ed10ee10ef10f00204000200a2'));

$service_type = getString($ar, 6, true); // 6

$source_addr_ton = next($ar); // 7
$source_addr_npi = next($ar); // 8
$source_addr = getString($ar, 21); // 29

$dest_addr_ton = next($ar); // 30
$dest_addr_npi = next($ar);
$destination_addr = getString($ar, 21); // 52

$esmClass = next($ar);
$protocolId = next($ar);
$priorityFlag = next($ar);
next($ar); // schedule_delivery_time
next($ar); // validity_period 
$registeredDelivery = next($ar);
next($ar); // replace_if_present_flag 
$dataCoding = next($ar); // 60
next($ar); // sm_default_msg_id 
$sm_length = next($ar);
$message = getString($ar, $sm_length, false, $dataCoding);

var_dump('encoding: '.$dataCoding, 'length: ' . $sm_length, 'msg:' . $message);
by Valeri Tandilashvili
2 months ago
0
PHP
SMPP
0
Permission problem - composer install/update
1 ./vendor/bin/sail exec laravel.test bash 2 mkdir -p /var/www/html/vendor/setasign 3 chmod -R 777 /var/www/html/vendor 4 chown -R sail:sail /var/www/html/vendor 5 exit 6 ./vendor/bin/sail composer require mpdf/mpdf
by Luka Tatarishvili
3 months ago
0
MySQL
0
Late static binding with attribute CODE
class a {
	const OPERATOR_ID = 0;
	public function test(){
		echo self::OPERATOR_ID;
		echo static::OPERATOR_ID;
	}
}
class b extends a {
	const OPERATOR_ID = 1;
}
(new b())->test();
by Valeri Tandilashvili
8 months ago
0
PHP
0
Third party cookie example
Create third party cookie (
setcookie.php
):
$result = setcookie('cooname', 'V37', [
    'expires' => time() + 3600,
    'path' => '/',
    'domain' => '.sibrdzne.ge',
    'httpOnly' => true,
    'secure' => true,
    'SameSite' => 'None'
]);
Receive cookie from another domain (
getcookie.php
):
header('Access-Control-Allow-Origin:'.$_SERVER['HTTP_ORIGIN'] ?? '*');
header('Access-Control-Allow-Credentials:true');
echo $_COOKIE['cooname'] ?? 'no-cookie';
Pass cookie and fetch content from another domain (from console):
fetch('https://sibrdzne.ge/getcookie.php', {
    credentials:'include'
}).then(e=>e.text()).then(e=>console.log(e));
by Valeri Tandilashvili
12 months ago
0
HTTP
0
migrate only one migration
./vendor/bin/sail php artisan migrate --path=/database/migrations/2023_11_19_200822_add_unit_id_to_multiple_tables.php
by Luka Tatarishvili
1 year ago
0
MySQL
0
1
by otar datuadze
1 year ago
10
Postman
sadsdsdsds
0
:has pseudo selector in CSS for Navbar
HTML
`
<div class="container">
          <div class="item">Home</div>
          <div class="item">Shop</div>
          <div class="item">About</div>
          <div class="item">Contact</div>
CSS
.container {
           display: flex;
           padding: 2rem 3rem;
           gap: 2rem;
           border-radius: 1 rem;
CSS
Select any .item that is not hovered, but is inside a .container which has an .item that is hovered
.item {
color: #ffffff;
transition: color 300ms;
}
.container: has(.item:hover)
   .item:not(:hover)  {
    color: #888888;
}
by Tinatin Kvinikadze
1 year ago
0
CSS
HTML
Pseudo selector
0
Array KEY outside of LOOP
$key
is useful outside of the
foreach
loop
$array = ['key1'=>1234, 'key2'=>2345, 'key3'=>3457];
foreach ($array as $key => $item) {
	
}
echo $key; // key3
by Valeri Tandilashvili
1 year ago
0
PHP
0
Calendar CODE

// Example usage:
$year = 2023;
$month = 1; // May

function generateMonthArray($year, $month) {
    $numDays = cal_days_in_month(CAL_GREGORIAN, $month, $year);
    $firstDay = date("N", strtotime("$year-$month-01")); // 1 = Monday, 7 = Sunday

    $weekdays = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];

    $monthArray = array_fill_keys($weekdays, []);

    for ($day = 1; $day <= $numDays; $day++) {
        $weekday = ($firstDay + $day - 2) % 7; // Adjust to start from Monday
        $monthArray[$weekdays[$weekday]][] = $day;
    }
    
    foreach ($monthArray as &$weekDays) {
    	if ($weekDays[0]!=1) {
    		array_unshift($weekDays, '');
    	} else {
    		break;
    	}
    }

    return $monthArray;
}

$result = generateMonthArray($year, $month);

// Print the result
foreach ($result as $weekday => $days) {
    echo $weekday . "\t" . implode("\t", $days) . "\n";
}
by Valeri Tandilashvili
1 year ago
0
PHP
0
Results: 1578