Its a reusable code which exports specific objects, making them available for other modules through dependency references to be used their programs.
AMD implementation is used by jQuery, Dojo, Firebug etc. There are various javascipt module loaders like RequireJS, Browserify, Webpack, SystemJS
Math.round function is used to round a number to its nearest integer. If fractional part of the number >=0.5 then the argument is rounded to next higest integer.
If fractional part of the number < 0.5 then the argument is rounded to lowest integer.
eg. Math.round(7.5) = 8
Math.round(7.2) = 7
Math.ceil function returns integer greater than or equal to a given number. Ceil means think of the ceiling of the room which is above your head.
eg. Math.ceil(7.5) = 8
Math.ceil(7.2) = 8
Math.ceil(7) = 7
Math.ceil(-7.5) = -7
Math.ceil(-7.2) = -7
Math.floor function returns integer lesser than or equal to a given number. Floor means think of the floor of the room which is below you
eg. Math.floor(7.5) = 7
Math.floor(7.2) = 7
Math.floor(7) = 7
Math.floor(-7.5) = -8
Math.floor(-7.2) = -8
What is a BLOb?
BLOb, Binary Large OBject : is a collection of binary data stored as a single entity in a database management system. Blobs are typically images, audio or other multimedia objects. Database support for blobs is not universal. Blobs were originally just big amorphous chunks of data invented by Jim Starkey at DEC(Digital Equipment Corporation)
The four BLOB types are
- TINYBLOB : A BLOB column with a maximum length of 255 (28 – 1) bytes. Each TINYBLOB value is stored using a one-byte length prefix that indicates the number of bytes in the value
- BLOB : A BLOB[(M)] column with a maximum length of 65,535 (216 – 1) bytes. Each BLOB value is stored using a two-byte length prefix that indicates the number of bytes in the value.
An optional length M can be given for this type. I
- MEDIUMBLOB : A BLOB column with a maximum length of 16,777,215 (224 – 1) bytes. Each MEDIUMBLOB value is stored using a three-byte length prefix that indicates the number of bytes in the value.
- LONGBLOB : A BLOB column with a maximum length of 4,294,967,295 bytes or 4GB (232 – 1). Each LONGBLOB value is stored using a four-byte length prefix that indicates the number of bytes in the value.
I came across this line #!/usr/bin/env and was wondering what is this and for what? I browsed some articles to get some overview about it. Any script beginning with #! is called shebang(other names are hashbang, sha-bang etc). When a script with shebang is run, it passes the file as an argument to the specified program instead of trying to execute it.
The form of a shebang interpreter directive is as follows:
- #! interpreter [optional-arg]
The interpreter must be an absolute path to an executable
In order to run the script, we need to tell the shell three things:
That the file is a script –>accomplished using shebang #!
Which interpreter we want to execute the script
The path of said interpreter
2 and 3 is accomplished using env.
Some typical shebang lines:
#!/bin/sh — Execute the file using sh
#!/usr/bin/perl — Execute using Perl
#!/usr/bin/python — Execute using Python
Shebang lines may include specific options that are passed to the interpreter.
What is so special about frameworks? We hear about these web frameworks frequently like Django, Cake PHP, Rails etc. Let’s dive into frameworks.
Framework gives you a ready-made code base which has been tested and designed by many developers and is ready to use solution for common generic problems. That is, it provides with a generic functionality which has flexibility to be changed, which helps you take advantage of this generality. It provides powerful template where the logic can be injected, helps in simplifying complex things.
- Saves lot of time, DRY(Don’t Repeat Yourself) means fewer lines of code
- Provides a standard through which the user can develop the module or a complete application instead of starting from lower level details.
- More time can be devoted in developing the software and not in preparing the environment and tools of development.
- Code is extensible for future use with clean code
Heads Up! Framework doesn’t work everywhere, for instance smaller projects which require simple coding seems to work faster than setting up a framework.
Tip for those running python script on Notepad++
Press F5 to run current script and to avoid output screen disappear instantaneously type in command: cmd /k python -i “$(FULL_CURRENT_PATH)”.