Google help on software/programming And Windows Tricks

helponsoftware

Friday, 5 June 2015

Add Extra Button in CK Editor

editor.addCommand("mySimpleCommand", { // create named command
    exec: function(edt) {
        CKEDITOR.instances.ckeditor.setData("yes i am working");
      
    }
});

editor.ui.addButton('SuperButton', { // add new button and bind our command
    label: "Spine",
    command: 'mySimpleCommand',
    toolbar: 'insert',
    icon: 'https://avatars1.githubusercontent.com/u/5500999?v=2&s=16'
});

           editor.on( 'change', function( evt ) {
    // getData() returns CKEditor's HTML content.
    console.log( 'Total bytes: ' + evt.editor.getData());
});

Exclude any field from select query


CREATE TEMPORARY TABLE IF NOT EXISTS table2 AS (SELECT * FROM table1);

ALTER TABLE table2 DROP field_name;
SELECT * FROM table2;
DROP TABLE table2;

Tuesday, 26 May 2015

Remove inline style in attachments

add_filter('wp_get_attachment_link', 'remove_img_width_height', 10, 1);

function remove_img_width_height($html) {
    $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
    return $html;
}

Tuesday, 28 April 2015

calculate the maximum length of palindrome by given any array of names or string

<?php
   function PalindromeLengthPuzzle($input1)
    {
$polin_array =array();
foreach ($input1 as $key => $value) {
  $res[]= substr($value,0,1);
}
print_r($res);
for($c=0;$c<=1000;$c++):
shuffle($res);

$result= implode('',$res);

if($result==strrev($result)){
 $polin_array[]=$result;   
}

endfor;
$polin_array=array_unique($polin_array);
print_r($polin_array);

foreach ($polin_array as $key => $value) {
    $val =strlen($value);
}
echo $val;
}

echo PalindromeLengthPuzzle(array('Bharti', 'Bharat','Brijesh','Bhavna','Anjit','Chand','Aushil'));
?>

Monday, 27 April 2015

Wordpress Login by Any page

<?php
include('../impact windows/wp-load.php');
?>
<form method="post" action="http://localhost/anjit/impact%20windows/wp-login.php">
<input type="text" name="log">
<input type="password" name="pwd">
<input type="submit" name="sumit">
<input type="hidden" name="redirect_to" value="http://localhost/anjit/impact%20windows/wp-admin/edit.php?post_type=service" />

</form>