What is programming?

Since I have been a corporate trainer, I have seen people from different disciplines struggling while learning to program.
So I though I will brief out what is programming and basic terminologies using in programming.

Consider a scenario,
You are going for your best friend’s marriage and at one corner of the marriage hall, you see your school time crush talking with his/her gang of friends.
Somehow you manage to talk to him/her and get his/her mobile number and store it in your phone.

If you are outside of India this might sound weird. You might think like why would someone hide their crush for 10 to 15 years.
Believe me, for Indians, talking with their crush is still a big deal.

Coming back to programming, now that you are storing your crush’s number in the phone, lets see how this data is manipulated by mobile phone.

To type in the number, you will be using “Contacts”.
“Contacts” in this case is an application/a program that is running in your mobile phone.
For any application to run, it needs a base software which is otherwise called Operating System (OS).
OS in mobile phones can be Android, IOS, Symbian, Oxygen OS, etc
OS in computers can be Windows, IOS, Linux (Ununtu, Redhat, yocto, etc).

Now that you have entered your your crush’s mobile number through “Contacts”‘s keypad, you will try to add in a name for the contact and then click on “Save”.
These data like : mobile number, name, email address, alternate number, etc will be handled as variables.
Literal meaning of ‘Variable’ is “something which tends to change”.
Similarly a variable in a program can store data and that data can be changed by the application at any point of time.
In the above scenario, the phone number of the crush and his/her name can be stored in variables by the application.

The visuals you see as part of the “Contacts” application is identified as Graphical User Interface (GUI).

Once the “save” operation is successful, you will be able to access that contact as many time as possible.
To retain the data of a variable for a longer duration, the data will be stored permanently in Databases.

The communication between databases and GUI will be through a set of functions which can be cumulatively called as Business Logic.

Considering all the parts explain above, I would like to summarize

“Programming is creating application/software to ease out daily tasks in a more efficient way”

“Program, in most cases, gets input from user, processes it and provides an output”

Add in you comments in case of any queries.

DISCLAIMER: The above content has been added based on my views towards programming. This has not been verified through some professionals and this has been created purely for better understanding of programming concepts

To set Caret Position at the end of text in textbox or textarea

jQuery.fn.putCursorAtEnd = function() {
return this.each(function() {
// Cache references
var $el = $(this),
el = this;
// Only focus if input isn’t already
if (!$el.is(“:focus”)) {
$el.focus();
}
// If this function exists… (IE 9+)
if (el.setSelectionRange) {
// Double the length because Opera is inconsistent about whether a carriage return is one character or two.
var len = $el.val().length * 2;
// Timeout seems to be required for Blink
setTimeout(function() {
el.setSelectionRange(len, len);
}, 1);
} else {
// As a fallback, replace the contents with itself
// Doesn’t work in Chrome, but Chrome supports setSelectionRange
$el.val($el.val());
}
// Scroll to the bottom, in case we’re in a tall textarea
// (Necessary for Firefox and Chrome)
this.scrollTop = 999999;
});
};

This sets the cursor or caret at the end but doesn’t scroll that caret/cursor into view… to achieve that u shall use text_box.scrollLeft = 999999 which scrolls the view into cursor.
Before setting the scrollLeft, ensure that the focus is set on the input field

Window.load Vs document.load

Window loads after document
Window includes HTML code + associated elements like images.

If multiple document.load and window.load is written then the order of the script will be taken into account by the browser.

Vertical-align pushes div

When vertical-align : middle pushes the inner div outside the parent/container, you can fix it by adding “overflow: hidden” for the parent/container. This is automatically handled in Chrome browser and the issue arises only with IE…Even IE11

Auto Scoll for div

advanced:{ autoScrollOnFocus: “input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable=’true’], div” } –> div will not be available by default.

External Supporting info:

jQuery custom content scroller

[I am not the owner of any of the mentioned source code ]

Inserting a character into text field

Link : rangyinputs-jquery-src.js  to the html page. (I am not the author.)

Download link : https://github.com/timdown/rangyinputs (I don’t own this account.)

To insert, use the following command:

$(“#inputTextBox”).insertText(a, caretPosition , “collapseToEnd”);

a –> to contain the character to be inserted

caretPosition –> position at which the character has to be inserted.

collapseToEnd –> cursor to be placed at the end of inserted text

Making a calendar icon non-draggable

Default jQuery code should be changed as below, to make the calendar icon non draggable..

$(“</img>”).addClass(this._triggerClass).attr({src: buttonImage, alt: buttonText, title: buttonText, draggable: false});

Other possiblities i tried are changing the css of that calendar icon