Add Prefix in text field

When you have to prefix any hard coded value in a text field, like for example in telephone field you have to prefix the country code and dont want the user to remove it, then in that case assign the prefix code in the text field and add the below javascript code code

jQuery("input[name='job-code']").keydown(function(e) {
    var oldvalue = jQuery(this).val();
    var field = this;
    setTimeout(function() {
        if (field.value.indexOf('JPC-') !== 0) {
            jQuery(field).val(oldvalue);
        }
    }, 1);
});

Demo: https://codepen.io/phpweblamp/pen/yLwPqjJ

Detect Change in form fields

<script type=”text/javascript”>
var formChanged = false;
jQuery(window).load(function() { // This is triggered when the entiire page is loaded fully
// form id and all the possible filed type in that form, You can also target by field type, name, class or id
jQuery(‘#FrmIdToTarget input[type=text], #FrmIdToTarget select.form-control’).each(function (i)
{
// console.log(‘a’);
jQuery(this).data(‘initial_value’, jQuery(this).val());
});

jQuery(‘#FrmIdToTarget input[type=text], #FrmIdToTarget select.form-control’).keyup(function()
{
if (jQuery(this).val() != jQuery(this).data(‘initial_value’)) {
// console.log(‘1’);
handleFormChanged(‘saveDriverInfoBtn’);
}
});
jQuery(‘#FrmIdToTarget input[type=text], #FrmIdToTarget select.form-control’).bind(‘change paste’, function()
{
// console.log(‘b’);
handleFormChanged(‘saveDriverInfoBtn’);
});

jQuery(document.body).on(“click”, “#submitFormButtonId, button.cancelBtnDrvbtn”, function () {
if(formChanged === true){
return confirmNavigation();
}

});

});

function handleFormChanged(formSaveBtnId) {
// alert(‘formSaveBtnId=’+formSaveBtnId);
jQuery(‘#’+formSaveBtnId).removeAttr(‘disabled’);
formChanged = true;
}

function confirmNavigation() {
if (formChanged) {
return confirm(‘You have changes to save, Please save before moving to next tab? Otherwise your changes will be lost!’);
} else {
return true;
}
}
</script>

How to search string in all files in a folder and sub folder recursivelly

How to use “grep” command in linux or macos to find text inside all files in a folder and including subdirectories

Command for the same is
grep -rl "string to search" /absolute-path/to/folder/

-r (or –recursive) option is used to traverse also all sub-directories of /path
-l (or –files-with-matches) option is used to only print filenames of matching files
-i ( for ignore case sensitive)

If you’re looking for lines matching in files, then use the below command

grep -Hrn "string to search" /absolute-path/to/folder/

-H causes the filename to be printed (implied when multiple files are searched)
-r does a recursive search
-n causes the line number to be printed
/absolute-path/to/folder/ can be . (dot) to search in the current directory

Ajax call using jquery

function makeAjaxRequest(data1,data2,.....,datax){
    $.ajax({
        'type':'POST',
        async: false,
        url: 'http://www.example.com/some_request_url',
        data:{param1:data1,param2:data2,....,paramx:datax},
        success : function(response) {
            console.log(response); // Using this you can check the posted data in browser console window
            return true;// you can process and return the response as required
            //location.reload(); // or you may reload the current page also
        },
        error: function (jqXHR, exception) {
            // If some error is returned, you can check the details below
            var msg = '';
            if (jqXHR.status === 0) {
                msg = 'Not connect.\n Verify Network.';
            } else if (jqXHR.status == 404) {
                msg = 'Requested page not found. [404]';
            } else if (jqXHR.status == 500) {
                msg = 'Internal Server Error [500].';
            } else if (exception === 'parsererror') {
                msg = 'Requested JSON parse failed.';
            } else if (exception === 'timeout') {
                msg = 'Time out error.';
            } else if (exception === 'abort') {
                msg = 'Ajax request aborted.';
            } else {
                msg = 'Uncaught Error.\n' + jqXHR.responseText;
            }
            $('#post').html(msg); // return the error response in your html page or process it further as required
        }
    });
}

 

Hacker Group Anonymous Vows To Destroy Facebook On November 5 2011

Hacktivist group Anonymous, which has been responsible for cyber-attacks on the Pentagon, News Corp, and others, has vowed to destroy Facebook on November 5th (which should ring a bell).
Citing privacy concerns and the difficulty involved in deleting a Facebook account, Anonymous hopes to “kill Facebook,” the “medium of communication [we] all so dearly adore.”
This isn’t the first time Anonymous has spoken out against social networks.
After Google removed Anonymous’ Gmail and Google+ accounts, Anonymous pledged to create its own social network, called AnonPlus.
The full text of the announcement, made on YouTube and reported by Village Voice, is below:

Operation Facebook

DATE: November 5, 2011.

TARGET: https://facebook.com
Press:
Twitter : https://twitter.com/OP_Facebook
http://piratepad.net/YCPcpwrl09
Irc.Anonops.Li #OpFaceBook
Message:

Attention citizens of the world,

We wish to get your attention, hoping you heed the warnings as follows:
Your medium of communication you all so dearly adore will be destroyed. If you are a willing hacktivist or a guy who just wants to protect the freedom of information then join the cause and kill facebook for the sake of your own privacy.

Facebook has been selling information to government agencies and giving clandestine access to information security firms so that they can spy on people from all around the world. Some of these so-called whitehat infosec firms are working for authoritarian governments, such as those of Egypt and Syria.

Everything you do on Facebook stays on Facebook regardless of your “privacy” settings, and deleting your account is impossible, even if you “delete” your account, all your personal info stays on Facebook and can be recovered at any time. Changing the privacy settings to make your Facebook account more “private” is also a delusion. Facebook knows more about you than your family. http://www.physorg.com/news170614271.html http://itgrunts.com/2010/10/07/facebook-steals-numbers-and-data-from-your-iph….

You cannot hide from the reality in which you, the people of the internet, live in. Facebook is the opposite of the Antisec cause. You are not safe from them nor from any government. One day you will look back on this and realise what we have done here is right, you will thank the rulers of the internet, we are not harming you but saving you.

The riots are underway. It is not a battle over the future of privacy and publicity. It is a battle for choice and informed consent. It’s unfolding because people are being raped, tickled, molested, and confused into doing things where they don’t understand the consequences. Facebook keeps saying that it gives users choices, but that is completely false. It gives users the illusion of and hides the details away from them “for their own good” while they then make millions off of you. When a service is “free,” it really means they’re making money off of you and your information.

Think for a while and prepare for a day that will go down in history. November 5 2011, #opfacebook . Engaged.

This is our world now. We exist without nationality, without religious bias. We have the right to not be surveilled, not be stalked, and not be used for profit. We have the right to not live as slaves.

We are anonymous
We are legion
We do not forgive
We do not forget
Expect us

Please follow SAI on Twitter and Facebook.
Follow Ellis Hamburger on Twitter.

Who is Anna Hazare ?

1. Who is Anna Hazare?

An ex-army man. Fought 1965 Indo-Pak War

2. What’s so special about him?

He built a village Ralegaon Siddhi in Ahamad Nagar district, Maharashtra

3. So what?
This village is a self-sustained model village. Energy is produced in the village itself from solar power, biofuel and wind mills.

In 1975, it used to be a poverty clad village. Now it is one of the richest village in India. It has become a model for self-sustained, eco-friendly & harmonic village.

4. Ok,…?

This guy, Anna Hazare was awarded Padma Bhushan and is a known figure for his social activities.

5. Really, what is he fighting for?

He is supporting a cause, the amendment of a law to curb corruption in India.

6. How that can be possible?

He is advocating for a Bil, The Lok Pal Bill (The Citizen Ombudsman Bill), that will form an autonomous authority who will make politicians (ministers), beurocrats (IAS/IPS) accountable for their deeds.

7. It’s an entirely new thing right..?

In 1972, the bill was proposed by then Law minister Mr. Shanti Bhushan. Since then it has been neglected by the politicians and some are trying to change the bill to suit thier theft (corruption).

8. Oh.. He is going on a hunger strike for that whole thing of passing a Bill ! How can that be possible in such a short span of time?

The first thing he is asking for is: the government should come forward and announce that the bill is going to be passed.

Next, they make a joint committee to DRAFT the LOK PAL BILL. 50% goverment participation and 50% public participation. Because you cant trust the government entirely for making such a bill which does not suit them.

9. Fine, What will happen when this bill is passed?

A LokPal will be appointed at the centre. He will have an autonomous charge, say like the Election Commission of India. In each and every state, Lokayukta will be appointed. The job is to bring all alleged party to trial in case of corruptions within 1 year. Within 2 years, the guilty will be punished. Not like, Bofors scam or Bhopal Gas Tragedy case, that has been going for last 25 years without any result.

London shop to make breast milk ice cream

Women breast milk ice-cream
LONDON (Reuters Life!) – A specialist ice cream parlour plans to serve up breast milk ice cream and says people should think of it as an organic, free-range treat.

The breast milk concoction, called the “Baby Gaga”, will be available from Friday at the Icecreamists restaurant in London’s Covent Garden.

Icecreamists founder Matt O’Connor was confident his take on the “miracle of motherhood” and priced at a hefty 14 pounds ($23) a serving will go down a treat with the paying public.

The breast milk was provided by mothers who answered an advertisement on online mothers’ forum Mumsnet.

Victoria Hiley, 35, from London was one of 15 women who donated milk to the restaurant after seeing the advert.

Hiley works with women who have problems breast-feeding their babies. She said she believes that if adults realised how tasty breast milk actually is, then new mothers would be more willing to breast-feed their own newborns.

“What could be more natural than fresh, free-range mother’s milk in an ice cream? And for me it’s a recession beater too — what’s the harm in using my assets for a bit of extra cash,” Hiley said in a statement.

“I tried the product for the first time today — it’s very nice, it really melts in the mouth.”

The Baby Gaga recipe blends breast milk with Madagascan vanilla pods and lemon zest, which is then churned into ice cream.

O’Connor said the Baby Gaga was just one of a dozen radical new flavours at the shop.

“Some people will hear about it and go, ‘yuck’ but actually it’s pure, organic, free-range and totally natural,” he said. “I had a Baby Gaga just this morning and I feel great.”

(Reporting by Paul Casciato; Editing by Steve Addison)