Saturday, December 26, 2015

Snipping tool missing in start menu in Windows 10




When you click start menu in Windows 10, in All apps, you may not find Snipping tool.
Snipping tool is in Windows 10,  but just not shows up in start menu.

To use snipping tool, right click start menu, click Run in popup menu and type
snippingtool
 snipping tool application will start to popup.

Friday, December 25, 2015

jQuery wildcard class, or name selector





You may need to click only via select only a class or name containing a string.
 Jquery has wildcard class or name selector. For example

// handle elements like <div class="someclass1"></div>
$('[class^="someclass"]').click(function() {
   // do stuff
});

// handle elements like <div class="foo someclass1"></div>
$('[class*=" someclass"]').click(function() {
   // do stuff
});
 
Reference:
 http://stackoverflow.com/questions/3697542/is-there-a-wildcard-class-selector

Thursday, December 24, 2015

jQuery click button events firing multiple times




I  has jquery click event
   $('.addRow_section').live('click',  function(){

When the button is clicked, it is fired multiple times.
This is due to that  the particular event is bound multiple times to the same element.
To fix this add die function:
             $('.addRow_section').die("click");
              $('.addRow_section').live('click',  function(){

Reference:
http://stackoverflow.com/questions/14969960/jquery-click-events-firing-multiple-times

Tuesday, December 22, 2015

Jquery dynamically generated element (class, ID) click not working




For example
  <script type="text/javascript">

        $(document).ready(function() {

            $(".div.ajax_list").click(function() {
                $(".test").html("<button class='sendmail'>click me</button>")
            });   

            $(".sendmail").on('click',  function(){
                alert('mail is sent');
            });
        });

    </script>
You will find sendmail button did not work.
change
            $(".sendmail").on('click',  function(){
                alert('mail is sent');
            });
to
            $(".sendmail").live('click',  function(){
                alert('mail is sent');
            }); 
will fix the problem.

or
             $(document).on('click',  '.sendmail00', function(){
                alert('mail is sent');
            });

Reference:
http://stackoverflow.com/questions/6658752/click-event-doesnt-work-on-dynamically-generated-elements

Tuesday, December 1, 2015

MySQL check valid email address




Check valid email address in MySQL:
emailaddresses.EmailAddress NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$')
Example
 SELECT (CASE WHEN (emailaddresses.EmailAddress NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$') AND stakeholders.ComputingID IS NOT NULL THEN
                CONCAT(stakeholders.ComputingID, '@sfu.ca')  ELSE emailaddresses.EmailAddress END) AS EmailAddress
            FROM emailaddresses, stakeholders
            WHERE emailaddresses.Stakeholder_id = stakeholders.Stakeholder_id
            AND stakeholders.Stakeholder_id = 321  LIMIT 1;