Programming

NodeJs
Programming
Troubleshooting

Create your own custom mixin in LoopBack NodeJs

A mixin is nothing more than a method of two parameters: function(Model, options): “Model” is the model on which the mixin will be applied “options” are the options that may be defined in the model.json under themixins key. To add a mixin you only need to add mixinName: true. If instead of true you provide […]

Read More
NodeJs
Programming
Troubleshooting

Create your own BelongsTo Required relation Mixin in loopback NodeJs

A mixin is nothing more than a method of two parameters: function(Model, options): “Model” is the model on which the mixin will be applied “options” are the options that may be defined in the model.json under themixins key. To add a mixin you only need to add mixinName: true. If instead of true you provide […]

Read More
NodeJs
Programming
Troubleshooting

How to remove flow issues in node modules?

During run flow command, we were facing flow issues in node modules. Error is something like this: Errors Error: node_modules/bcryptjs/src/bower.json:4 4: “version”: /*?== VERSION */, ^ Unexpected token , Error: node_modules/strong-globalize/test/fixtures/extract013/intl/en/messages.json:2 2: “msgPredefined”: “This is a predefined message in a broken json ^ Unexpected token ILLEGAL Found 42 errors npm ERR! code ELIFECYCLE npm ERR! […]

Read More
Interview questions
PHP
PHP interview questions
Programming

What is the difference between $_GET and $_POST

GET: Transfers the form data through http head location & it displays the data on URL address bar. Data can be cached. Is unsecured. URL are saved in browser history. URL can be bookmarked. Transfers limited amount of data. Can’t upload the file. POST: Transfers the form data through document body. Data can not be […]

Read More
PHP
Programming

Don’t Copy Extra Variables

Some people use predefined variables to smaller-named variables to make their code appealing. This is redundant and could increase the memory of your script. Examples of variable usage: Good Approach: <?php echo strip_tags($_POST[‘myVariable’]); ?> Bad Approach: <?php $myVariable = strip_tags($_POST[‘myVariable’]); echo $myVariable; ?>

Read More
PHP
Programming
Wordpress

Insert Adsense Code Between WordPress Posts

Best place for adsense codes is between the post where it can click more. Mostly wordpress blogers use plugins for this but you can place the below code in your functions.php theme file before end of PHP “?>” tag. function ad_content($content) {     $postParas = explode(“</p>”, $content);     $content = ”;     for ($i = […]

Read More
PHP
Programming

Use isset() Instead of strlen()

This is actually a new trick, here is the example: <?php if (isset($username[5])) { // The username is at least six characters long. } ?> When you use string as an array, then each character of string is an element in the array. When you check whether an element exist and of atleast that many […]

Read More