Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Add semi-colons
;
to the end of the function calls in order for them both to work.
<input id="btn" type="button" value="click" onclick="pay(); cls();"/>
by Luka Tatarishvili
4 years ago
0
HTML
JavaScript
functions
0

trait A
{
    private function smallTalk()
    {
        echo 'a';
    }

    private function bigTalk()
    {
        echo 'A';
    }
}

trait B
{
    private function smallTalk()
    {
        echo 'b';
    }

    private function bigTalk()
    {
        echo 'B';
    }
}

trait C
{
    public function smallTalk()
    {
        echo 'c';
    }

    public function bigTalk()
    {
        echo 'C';
    }
}

class Talker
{
    use A, B, C {
        //visibility for methods that will be involved in conflict resolution
        B::smallTalk as public;
        A::bigTalk as public;

        //conflict resolution
        B::smallTalk insteadof A, C;
        A::bigTalk insteadof B, C;

        //aliases with visibility change
        B::bigTalk as public Btalk;
        A::smallTalk as public asmalltalk;
       
        //aliases only, methods already defined as public
        C::bigTalk as Ctalk;
        C::smallTalk as cmallstalk;
    }

}

(new Talker)->bigTalk();//A
(new Talker)->Btalk();//B
(new Talker)->Ctalk();//C

(new Talker)->asmalltalk();//a
(new Talker)->smallTalk();//b
(new Talker)->cmallstalk();//c
by გიორგი უზნაძე
4 years ago
0
PHP
OOP
Traits
0
A static property (trvar) can only be accessed using the classname (C1). But a static function (stfunc) can be accessed using the classname or the instance ($obj).
trait Counter {
    static $trvar=1;

    public static function stfunc() {
        echo "Hello world!"
    }
}
class C1 {
    use Counter;
}
print "\nTRVAR: " . C1::$trvar . "\n";   //prints 1

$obj = new C1();
C1::stfunc();   //prints  Hello world!
$obj->stfunc();   //prints Hello world!
by გიორგი უზნაძე
4 years ago
0
PHP
OOP
Traits
0
Why we use async and await in JavaScript?
Async/Await
was created to simplify the process of working with and writing chained promises.
Async
functions return a Promise. If the function throws an error, the Promise will be rejected. If the function returns a value, the Promise will be resolved.
by Luka Tatarishvili
4 years ago
0
HTML
JavaScript
functions
0
by გიორგი უზნაძე
4 years ago
0
JavaScript
DOM
0
Get sum of multiple average grouped by specific column
SELECT SUM(avg1) FROM (SELECT user_id, AVG(score) as avg1 FROM results GROUP BY user_id)
in this case results table might have multiple records on 1 user id so basically it gets average score of all users and than sums all average number
by გიორგი უზნაძე
4 years ago
0
MySQL
0
Dinamic scroll
html {
  scroll-behavior: smooth;
}
The scroll-behavior CSS property sets the behavior for a scrolling box
As default it's
auto
but if we use scroll-behavior: smooth; the scroll will be animated and smooth. In HTML
<div class="main" id="section1">
  <h2>Section 1</h2>
<a href="#section2">Click Me to Smooth Scroll to Section 2 Below</a>
</div>
Div's must have specified
id="someid" 
which will be passed in a href attribute.
<a href="#someid">1</a>
With Jquery we can make it more manageable. We can specify exact pixels and positions.

let id = $(this).closest('li').attr('id');

$('html, body').animate({
                 scrollTop: $('div#section-content-'+id).offset().top - 200
             }, 1000);
by Luka Tatarishvili
4 years ago
0
CSS
HTML
animation
0
position: fixed
always fixates an element to some position within its scrolling container. no matter how you scroll its container..
position: sticky
basically acts like
position: relative
until an element is scrolled beyond a specific offset, in which case it turns into
position: fixed
by Luka Tatarishvili
4 years ago
0
CSS
HTML
Animation
0
Basic authentication
Postman request
Authorization type: Basic Auth
Username: usr
Password: pwd
PHP cURL request
curl_setopt($ch, CURLOPT_USERPWD, "usr:pwd");
by Valeri Tandilashvili
4 years ago
0
PHP
Postman
0
Receive root permissions
To receive root permissions, we run the following command
sudo -i
Note: after running the above command, we need to enter the user's password
by Valeri Tandilashvili
4 years ago
0
Linux
0
Results: 1578