CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

12 February, 2019

Install Node.js on Linux/Ubuntu/CentOS

 Programing Coderfunda     February 12, 2019     Nodejs-Hindi, Nodejs-Install-Linux/Ubuntu/CentOS     No comments   

Linux / Ubuntu / CentOS पर Node.js स्थापित करें

 
हम आसानी से लिनक्स / ubuntu / centOS / fedora / linuxmint आदि पर Node.js स्थापित कर सकते हैं। Linux (Ubuntu) ऑपरेटिंग सिस्टम पर Node.js स्थापित करने के लिए, इन निर्देशों का पालन करें:

1) उबंटू टर्मिनल खोलें (आप शॉर्टकट कुंजियों का उपयोग कर सकते हैं (Ctrl + Alt + T)।


2) टाइप कमांड sudo apt-get install python-software-properties

3) एंटर दबाएं (यदि आपने अपने सिस्टम के लिए पासवर्ड सेट किया है तो यह पासवर्ड मांगेगा)

4) पासवर्ड टाइप करें और एंटर दबाएं


5) टाइप कमांड सुडो एप-ऐड-रिपॉजिटरी ppa: chris-lea / node.js

6) एंटर दबाएं
 


7) फिर से जारी रखने के लिए Enter दबाएँ

8) टाइप कमांड sudo apt-get update (कुछ समय तक प्रतीक्षा करें)
 


9) टाइप कमांड सुडो एप्ट-गेट इनस्टॉल नोडज एनपीएम

10) टाइप कमांड सुडो एप-गेट इनस्टॉल नोडज

स्थापन पूर्ण हुआ। अब आप नोड के संस्करण को नोड --version द्वारा जांच सकते हैं

Npm -v द्वारा npm के संस्करण की जाँच करें

अब आप इस कमांड को टाइप करके अपने इंस्टाल प्रोग्राम लिस्ट में node.js को चेक कर सकते हैं

dpkg --get-selections
 
 
 
 
 
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Install Node.js on Windows

 Programing Coderfunda     February 12, 2019     Nodejs-Hindi, Nodejs-Install     No comments   

विंडोज पर Node.js स्थापित करें

 Node.js के लिए एक वातावरण स्थापित और सेटअप करने के लिए, आपको अपने कंप्यूटर पर उपलब्ध निम्न दो सॉफ्टवेयर्स की आवश्यकता होगी:

     पाठ संपादक।
     Node.js बाइनरी इंस्टॉल करने योग्य

पाठ संपादक:

आपके प्रोग्राम को टाइप करने के लिए टेक्स्ट एडिटर का उपयोग किया जाता है। उदाहरण के लिए: नोटपैड का उपयोग विंडोज में किया जाता है, vim या vi का उपयोग विंडोज के साथ-साथ लिनक्स या यूनिक्स पर भी किया जा सकता है। टेक्स्ट एडिटर का नाम और संस्करण ऑपरेटिंग सिस्टम से ऑपरेटिंग सिस्टम तक भिन्न हो सकते हैं।

टेक्स्ट एडिटर के साथ बनाई गई फाइलों को सोर्स फाइल्स कहा जाता है और इसमें प्रोग्राम सोर्स कोड होता है। Node.js कार्यक्रमों के लिए स्रोत फाइलें आमतौर पर एक्सटेंशन ".js" के साथ नामित की जाती हैं।

Node.js रनटाइम:

स्रोत फ़ाइल में लिखा गया स्रोत कोड केवल जावास्क्रिप्ट है। यह व्याख्या और Node.js दुभाषिया द्वारा निष्पादित किया जाता है।

Node.js कैसे डाउनलोड करें:

आप https://nodejs.org/en/ से Node.js की नवीनतम संग्रह फ़ाइल डाउनलोड कर सकते हैं।











Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Features of Node.js

 Programing Coderfunda     February 12, 2019     Nodejs-Features, Nodejs-Hindi     No comments   

Node.js की विशेषताएं

निम्नलिखित Node.js की कुछ महत्वपूर्ण विशेषताओं की एक सूची है जो इसे सॉफ्टवेयर आर्किटेक्ट्स की पहली पसंद बनाती है।

    अत्यधिक तेज़: Node.js Google Chrome के V8 जावास्क्रिप्ट इंजन पर बनाया गया है, इसलिए इसकी लाइब्रेरी कोड निष्पादन में बहुत तेज़ है।
    I / O एसिंक्रोनस और इवेंट ड्रिवेन है: Node.js लाइब्रेरी के सभी API एसिंक्रोनस हैं यानी नॉन-ब्लॉकिंग। तो एक Node.js आधारित सर्वर डेटा वापस करने के लिए कभी भी एपीआई का इंतजार नहीं करता है। सर्वर कॉल करने के बाद अगले API पर जाता है और Node.js के ईवेंट की सूचना तंत्र पिछले API कॉल से प्रतिक्रिया प्राप्त करने में सर्वर की मदद करता है। यह भी एक कारण है कि यह बहुत तेज है।
    सिंगल थ्रेडेड: Node.js इवेंट लूपिंग के साथ सिंगल थ्रेडेड मॉडल का अनुसरण करता है।
    अत्यधिक स्केलेबल: Node.js अत्यधिक स्केलेबल है क्योंकि इवेंट तंत्र सर्वर को गैर-अवरुद्ध तरीके से प्रतिक्रिया करने में मदद करता है।
    कोई बफ़रिंग नहीं: ऑडियो और वीडियो फ़ाइलों को अपलोड करते समय Node.js समग्र प्रसंस्करण समय में कटौती करता है। Node.js अनुप्रयोग किसी भी डेटा को कभी भी बफ़र नहीं करते हैं। ये एप्लिकेशन बस डेटा को चंक्स में आउटपुट करते हैं।
    खुला स्रोत: Node.js में एक खुला स्रोत समुदाय है जिसने Node.js अनुप्रयोगों में अतिरिक्त क्षमताओं को जोड़ने के लिए कई उत्कृष्ट मॉड्यूल का उत्पादन किया है।
    लाइसेंस: Node.js एमआईटी लाइसेंस के तहत जारी किया जाता है।
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

What is Node.js

 Programing Coderfunda     February 12, 2019     Node-Introduction, Nodejs-Hindi, What is Node.js     No comments   

Node.js क्या है


Node.js ब्राउज़र के बाहर जावास्क्रिप्ट अनुप्रयोगों को चलाने के लिए एक क्रॉस-प्लेटफॉर्म रनटाइम वातावरण और लाइब्रेरी है। इसका उपयोग सर्वर-साइड और नेटवर्किंग वेब एप्लिकेशन बनाने के लिए किया जाता है। यह खुला स्रोत है और उपयोग करने के लिए स्वतंत्र है। इसे इस लिंक https://nodejs.org/en/ से डाउनलोड किया जा सकता है

Node.js के कई बुनियादी मॉड्यूल जावास्क्रिप्ट में लिखे गए हैं। Node.js का उपयोग ज्यादातर वास्तविक समय सर्वर अनुप्रयोगों को चलाने के लिए किया जाता है।

इसके आधिकारिक दस्तावेज द्वारा दी गई परिभाषा इस प्रकार है:

? Node.js आसानी से तेज और स्केलेबल नेटवर्क अनुप्रयोगों के निर्माण के लिए क्रोम के जावास्क्रिप्ट रनटाइम पर बनाया गया एक मंच है। Node.js एक घटना-चालित, गैर-अवरुद्ध I / O मॉडल का उपयोग करता है जो इसे हल्के और कुशल बनाता है, जो डेटा-गहन वास्तविक समय अनुप्रयोगों के लिए एकदम सही है जो वितरित उपकरणों के बीच चलता है।

Node.js वेब अनुप्रयोगों के विकास को सरल बनाने के लिए विभिन्न जावास्क्रिप्ट मॉड्यूल की एक समृद्ध लाइब्रेरी भी प्रदान करता है।


    Node.js = Runtime Environment + JavaScript Library   


Node.js के विभिन्न भागों


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Node.js ट्यूटोरियल In Hindi

 Programing Coderfunda     February 12, 2019     Nodejs-Hindi     No comments   

Node.js ट्यूटोरियल

Node.js ट्यूटोरियल Node.js. की मूल और उन्नत अवधारणाएँ प्रदान करता है हमारा Node.js ट्यूटोरियल शुरुआती और पेशेवर दोनों के लिए डिज़ाइन किया गया है।

Node.js जावास्क्रिप्ट अनुप्रयोगों को चलाने के लिए एक क्रॉस-प्लेटफॉर्म पर्यावरण और पुस्तकालय है जो नेटवर्किंग और सर्वर-साइड एप्लिकेशन बनाने के लिए उपयोग किया जाता है।

हमारे Node.js ट्यूटोरियल में Node.js के सभी विषय शामिल हैं जैसे कि Node.js विंडोज़ और लिनक्स पर स्थापना, REPL, पैकेज मैनेजर, कॉलबैक, ईवेंट लूप, ओएस, पाथ, क्वेरी स्ट्रिंग, क्रिप्टोग्राफ़ी, डीबगर, URL, DNS, नेट आदि। UDP, प्रोसेस, चाइल्ड प्रोसेस, बफ़र्स, स्ट्रीम, फाइल सिस्टम, ग्लोबल ऑब्जेक्ट, वेब मॉड्यूल आदि। Node.js इंटरव्यू प्रश्न भी दिए गए हैं, ताकि आप Node.js तकनीक को बेहतर ढंग से समझने में मदद कर सकें।



 Node.js Index



Node.js Tutorial
  • Node.js Tutorial
  • What is Node.js
  • Node.js Features
  • Install Node.js Windows
  • Install Node.js Linux
  • Node.js First Example
  • Node.js Console
  • Node.js REPL
  • Node.js NPM
  • Node.js CL Options
  • Node.js Globals
  • Node.js OS
  • Node.js Timer
  • Node.js Errors
  • Node.js DNS
  • Node.js Net
  • Node.js Crypto
  • Node.js TLS/SSL
  • Node.js Debugger
  • Node.js Process
  • Node.js Child Process
  • Node.js Buffers
  • Node.js Streams
  • Node.js File System
  • Node.js Path
  • Node.js StringDecoder
  • Node.js Query String
  • Node.js ZLIB
  • Node.js Assertion
  • Node.js V8
  • Node.js Callbacks
  • Node.js Events
  • Node.js Punycode
  • Node.js TTY
  • Node.js Web Modules 


  • Node.js MySQL
  • MySQL Create Connection
  • MySQL Create Database
  • MySQL Create Table
  • MySQL Insert Record
  • MySQL Delete Record
  • MySQL Select Record
  • MySQL Select Unique
  • MySQL Drop Table
Node.js MongoDB
  • Create Connection
  • Create Database
  • Create Collection
  • MongoDB Insert
  • MongoDB Select
  • MongoDB Query
  • MongoDB Sorting
  • MongoDB Remove
Difference
  • Node.js vs AngularJS
  • Node.js vs Python
  • Node.js vs PHP
  • Node.js vs Java
Node.js Express
  • Express.js Tutorial
  • What is Express.js
  • Install Express.js
  • Express.js Request
  • Express.js Response
  • Express.js Get
  • Express.js Post
  • Express.js Routing
  • Express.js Cookies
  • Express.js File Upload
  • Express.js Middleware
  • Express.js Scaffolding
  • Express.js Template
Interview Questions
  • Node.js Interview
  • AngularJS Interview
  • JavaScript Interview
  • jQuery Interview
  • Backbone.js Interview
  • Ember.js Interview
  • Neo4j Interview
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

11 February, 2019

25 PHP Interview Questions and Answers You Must Know

 Programing Coderfunda     February 11, 2019     php, PHP-Interview-Questions     No comments   


Here are some PHP questions and answers for experienced developers (with some beginner concepts covered).
 
Do you need to test a developer's PHP skills or have an internal PHP interview?

Some of the best developers in our network share their best PHP questions, answers and interview tips to help test a developer's knowledge and PHP experience.

If you are the one who interviews PHP developers, keep in mind that you should also ask these interview questions about a developer's experience and interview questions to test communication and management skills, or simply consult our Detailed Guide to hire PHP developers.

Without further ado, let's jump!
PHP interview tip # 1

     "One of the most important things that I observe is the creativity of the person I interviewed. I try to catch developers who constantly learn new things, are motivated by curiosity and are also very creative, not only in solving problems, but also in general. I mainly ask about PHP and PostgreSQL (I use this combo most of the time). "
 
PHP Interview Question 1

What is the difference between the include () and require () functions?
 
 
Then, the process of the file, and the goes out of specific and may include, the clinic will cost you in the bear, if that can be included in the table, when it is said to involve as far as it can be to jump up to the next level and the next step will pass to execute the sentence.
 
How can we get out of a client is the IP address?

This problem may candidate to create and show you how playful is because there are not many options. $ _SERVER [ 'REMOTE_ADDR "]; the easy solution is not able to write only the question of the candidate's line of x.
 
PHP Interview Question # 3

What is the difference between the unset () and unlink ()

unset () sets variable "end" while unlink () deletes a file from the file system must pass.

PHP Interview Question # 4

Why is it that the output of code:

$ A = '1';
$ & $ A = b;
B $ = "$ 2 B ';
$ voice by ".". $ B;

PHP developer Laszlo Surý Sea

Tip # 2 PHP Interview

    "During an interview of a candidate ask potential to understand how they are updated with the new language features a very basic level of understanding. In my opinion, this is a good developer to define what may happen in the future." ~ Agli pancreatic: Lead Developer

PHP Interview Question # 5

The error of such as differ principally in PHP, and see that this figure

PHP in three main types of errors:

    3 - simple, non-critical errors that were not met, and it is executed. Under The data are not accessing an undefined variable.

    Warning - mistakes rather than earlier, but the execution's continue. Many, therefore, does not include () a file that does not exist.

    Fatal - this type of termination of this error leads to death, since it is occurs. An example of the largest losses we'll be accessing it from nothing into something, or require () is not a revision.

The understanding of what is going on, however, in the kinds of the error of the developers very happy with it and do not understand the help of the program, and what is meant by debugging to look for.

PHP Interview Question # 6

The crisis sent for blade?

    Buy displays the data submitted as part of the URL: After this information, as it's shown encoded by the petition.
    Buy can handle a maximum of 2048 characters POST has to subnavigation.
    Only the ASCII characters suffer me to the knowledge of GET, POST has, consist of no exceptions, is not given and granted to binary.
    To retrieve information when you get is normally used, and update the log to match.

HTTP protocol is most important is that the fundamentals for the PHP developer, and the difference is an essential part of it having been summoned by pretiosive Post.

PHP Interview Question # 7

How to control the error reporting php?

Check if "display_errors" is equal to "over" in php.ini or do "ini_set ( 'display_errors', 1)" in the script.
Then include "error_reporting (E_ALL)" in the code, to show error messages in all sorts of writing execution.


Question # 8 PHP Interview

What Features?

Features a mechanism that allows you to create reusable code in a place where many languages ​​like PHP inheritance is not supported. And courteously informed from the instantiated, not of his own accord.

Heavy is a powerful developer features that it knows about the language (s) in this work, and to deposit such features.

Question # 9 PHP Interview

Can the value of the constant change in the execution of the letter?

No, because once changed will not be based on declared value with PHP's execution.

PHP Interview Question # 10


You extend determined by the final race?

You are unable even extend fi nal defined also includes the kind of. If you want peace declaration or the kind of child's kind of the same.

PHP Interview Question # 11
What is __construct () and __destruct () PHP in kind are there?

All the ways in which we see things, and have built thee a PHP Constructor Destructor. After the artist once said that a new instance is created in general and to initialize it's the kind of properties. The Destructor method takes no parameters.

Comparable to these two, the white in PHP is to say, should know how to out of it are the basics OCF, in PHP.

PHP Interview Question # 12


In order to get the number of elements in an array?

The count () function is the returning number of elements in the array.

Your understanding array related helper functions, and it is important for the PHP developer.

Agli pancreatic lead developer PHP

PHP Developers tour
PHP developers to find high today.

CodementorX to hire PHP developers for your old team.
 
  


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

25 PHP Interview Questions and Answers You Must Know

 Programing Coderfunda     February 11, 2019     php, PHP-Interview-Questions     No comments   


Here are some PHP questions and answers for experienced developers (with some beginner concepts covered).
 
Do you need to test a developer's PHP skills or have an internal PHP interview?

Some of the best developers in our network share their best PHP questions, answers and interview tips to help test a developer's knowledge and PHP experience.

If you are the one who interviews PHP developers, keep in mind that you should also ask these interview questions about a developer's experience and interview questions to test communication and management skills, or simply consult our Detailed Guide to hire PHP developers.

Without further ado, let's jump!
PHP interview tip # 1

     "One of the most important things that I observe is the creativity of the person I interviewed. I try to catch developers who constantly learn new things, are motivated by curiosity and are also very creative, not only in solving problems, but also in general. I mainly ask about PHP and PostgreSQL (I use this combo most of the time). "
 
PHP Interview Question 1

What is the difference between the include () and require () functions?
 
 
Then, the process of the file, and the goes out of specific and may include, the clinic will cost you in the bear, if that can be included in the table, when it is said to involve as far as it can be to jump up to the next level and the next step will pass to execute the sentence.
 
How can we get out of a client is the IP address?

This problem may candidate to create and show you how playful is because there are not many options. $ _SERVER [ 'REMOTE_ADDR "]; the easy solution is not able to write only the question of the candidate's line of x.
 
PHP Interview Question # 3

What is the difference between the unset () and unlink ()

unset () sets variable "end" while unlink () deletes a file from the file system must pass.

PHP Interview Question # 4

Why is it that the output of code:

$ A = '1';
$ & $ A = b;
B $ = "$ 2 B ';
$ voice by ".". $ B;

PHP developer Laszlo Surý Sea

Tip # 2 PHP Interview

    "During an interview of a candidate ask potential to understand how they are updated with the new language features a very basic level of understanding. In my opinion, this is a good developer to define what may happen in the future." ~ Agli pancreatic: Lead Developer

PHP Interview Question # 5

The error of such as differ principally in PHP, and see that this figure

PHP in three main types of errors:

    3 - simple, non-critical errors that were not met, and it is executed. Under The data are not accessing an undefined variable.

    Warning - mistakes rather than earlier, but the execution's continue. Many, therefore, does not include () a file that does not exist.

    Fatal - this type of termination of this error leads to death, since it is occurs. An example of the largest losses we'll be accessing it from nothing into something, or require () is not a revision.

The understanding of what is going on, however, in the kinds of the error of the developers very happy with it and do not understand the help of the program, and what is meant by debugging to look for.

PHP Interview Question # 6

The crisis sent for blade?

    Buy displays the data submitted as part of the URL: After this information, as it's shown encoded by the petition.
    Buy can handle a maximum of 2048 characters POST has to subnavigation.
    Only the ASCII characters suffer me to the knowledge of GET, POST has, consist of no exceptions, is not given and granted to binary.
    To retrieve information when you get is normally used, and update the log to match.

HTTP protocol is most important is that the fundamentals for the PHP developer, and the difference is an essential part of it having been summoned by pretiosive Post.

PHP Interview Question # 7

How to control the error reporting php?

Check if "display_errors" is equal to "over" in php.ini or do "ini_set ( 'display_errors', 1)" in the script.
Then include "error_reporting (E_ALL)" in the code, to show error messages in all sorts of writing execution.


Question # 8 PHP Interview

What Features?

Features a mechanism that allows you to create reusable code in a place where many languages ​​like PHP inheritance is not supported. And courteously informed from the instantiated, not of his own accord.

Heavy is a powerful developer features that it knows about the language (s) in this work, and to deposit such features.

Question # 9 PHP Interview

Can the value of the constant change in the execution of the letter?

No, because once changed will not be based on declared value with PHP's execution.

PHP Interview Question # 10


You extend determined by the final race?

You are unable even extend fi nal defined also includes the kind of. If you want peace declaration or the kind of child's kind of the same.

PHP Interview Question # 11
What is __construct () and __destruct () PHP in kind are there?

All the ways in which we see things, and have built thee a PHP Constructor Destructor. After the artist once said that a new instance is created in general and to initialize it's the kind of properties. The Destructor method takes no parameters.

Comparable to these two, the white in PHP is to say, should know how to out of it are the basics OCF, in PHP.

PHP Interview Question # 12


In order to get the number of elements in an array?

The count () function is the returning number of elements in the array.

Your understanding array related helper functions, and it is important for the PHP developer.

Agli pancreatic lead developer PHP

PHP Developers tour
PHP developers to find high today.

CodementorX to hire PHP developers for your old team.
 
  


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Features CodeIgniter

 Programing Coderfunda     February 11, 2019     codeigniter, Features-CodeIgniter     No comments   

Features CodeIgniter


There is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advantages. The web application developed on CodeIgniter performs effectively and quickly. Provides an advanced set of aspects for writing from scratch to create a dynamic web application.


Important Features

Free to use

     They are licensed under the MIT license, so they are free to use.
     The MVC pattern follows

     It uses a controller display model that basically separates logic and presentation parts. The request comes to the controller, the database procedure is executed through the form and the output is displayed through the views.

     But in regular PHP language, each page represents MVC which increases the complexity.
     Lightweight

     It's very lightweight. The core CoreIgniter system requires a very small library, and other libraries can be added based on dynamic demand based on your needs. This is why it is very fast and light weight weighted.
     Generate SEO Friendly URLs

     The URLs created by CodeIgniter are friendly and clean. It uses a slide-based approach rather than a standard query approach.
     Integrated Libraries

     Comes with full package libraries that enable all necessary web tasks such as database, form validation, email sending, image manipulation, email sending, etc.


Some other Features

 Security and XSS filtering
      File upload, session management, page numbering, data encryption
      Flexible URI routing
      Zip Encoding Layer
      Error recording
      Full Page Cache
      Site
 

 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Features CodeIgniter

 Programing Coderfunda     February 11, 2019     codeigniter, Features-CodeIgniter     No comments   

Features CodeIgniter


There is a great demand for the CodeIgniter framework in PHP developers because of its features and multiple advantages. The web application developed on CodeIgniter performs effectively and quickly. Provides an advanced set of aspects for writing from scratch to create a dynamic web application.


Important Features

Free to use

     They are licensed under the MIT license, so they are free to use.
     The MVC pattern follows

     It uses a controller display model that basically separates logic and presentation parts. The request comes to the controller, the database procedure is executed through the form and the output is displayed through the views.

     But in regular PHP language, each page represents MVC which increases the complexity.
     Lightweight

     It's very lightweight. The core CoreIgniter system requires a very small library, and other libraries can be added based on dynamic demand based on your needs. This is why it is very fast and light weight weighted.
     Generate SEO Friendly URLs

     The URLs created by CodeIgniter are friendly and clean. It uses a slide-based approach rather than a standard query approach.
     Integrated Libraries

     Comes with full package libraries that enable all necessary web tasks such as database, form validation, email sending, image manipulation, email sending, etc.


Some other Features

 Security and XSS filtering
      File upload, session management, page numbering, data encryption
      Flexible URI routing
      Zip Encoding Layer
      Error recording
      Full Page Cache
      Site
 

 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

16 January, 2019

JqueryUI - Widget Factory

 Programing Coderfunda     January 16, 2019     JqueryUI - Widget Factory     No comments   

JqueryUI - Widget Factory

Earlier, the only way to write custom controls in jQuery was to extend the $.fn namespace. This works well for simple widgets. Suppose you build more stateful widgets, it quickly becomes cumbersome. To aid in the process of building widgets, Widget Factory was introduced in the jQuery UI, which removes most of the boilerplate that is typically associated with managing a widget.
The jQueryUI Widget Factory is simply a function ($.widget) that takes a string name and an object as arguments and creates a jQuery plugin and a "Class" to encapsulate its functionality.

Syntax

The following is the syntax of jQueryUI Widget Factory method −
jQuery.widget( name [, base ], prototype )
name − It is a string containing a namespace and the widget name (separated by a dot) of the widget to create.
base − The base widget to inherit from. This must be a constructor that can be instantiated with the `new` keyword. Defaults to jQuery.Widget.
prototype − The object to use as a prototype for the widget to inherit from. For instance, jQuery UI has a "mouse" plugin on which the rest of the interaction plugins are based. In order to achieve this, draggable, droppable, etc. all inherit from the mouse plugin like so: jQuery.widget( "ui.draggable", $.ui.mouse, {...} ); If you do not supply this argument, the widget will inherit directly from the "base widget," jQuery.Widget (note the difference between lowercase "w" jQuery.widget and uppercase "W" jQuery.Widget).

Base Widget

Base widget is the widget used by the widget factory.

Options

The following table lists the different options that can be used with the base widget −
Sr.No.Option & Description
1disabledhide This option disables the widget if set to true. By default its value is false.
2hide This option determines how to animate the hiding of the element. By default its value is null.
3show This option determines how to animate the showing of the element. By default its value is null.

Methods

The following table lists the different methods that can be used with the base widget −
Sr.No.Action & Description
1_create() This method is the widget's constructor. There are no parameters, but this.element and this.options are already set.
2_delay( fn [, delay ] ) This method invokes the provided function after a specified delay. Returns the timeout ID for use with clearTimeout().
3_destroy() The public destroy() method cleans up all common data, events, etc. and then delegates out to this _destroy() method for custom, widget-specific, cleanup.
4_focusable( element ) This method sets up element to apply the ui-state-focus class on focus. The event handlers are automatically cleaned up on destroy.
5_getCreateEventData() All widgets trigger the create event. By default, no data is provided in the event, but this method can return an object which will be passed as the create event's data.
6_getCreateOptions() This method allows the widget to define a custom method for defining options during instantiation. The user-provided options override the options returned by this method, which override the default options.
7_hide( element, option [, callback ] ) This method hides an element immediately, using built-in animation methods, or using custom effects. See the hide option for possible option values.
8_hoverable( element ) This method Sets up element to apply the ui-state-hover class on hover. The event handlers are automatically cleaned up on destroy.
9_init() Any time the plugin is called with no arguments or with only an option hash, the widget is initialized; this includes when the widget is created.
10_off( element, eventName ) This method unbinds event handlers from the specified element(s).
11_on( [suppressDisabledCheck ] [, element ], handlers ) Binds event handlers to the specified element(s). Delegation is supported via selectors inside the event names, e.g., "click .foo".
12_setOption( key, value ) This method is called from the _setOptions() method for each individual option. Widget state should be updated based on changes.
13_setOptions( options ) This method is called whenever the option() method is called, regardless of the form in which the option() method was called.
14_show( element, option [, callback ] ) Shows an element immediately, using built-in animation methods, or using custom effects. See the show option for possible option values.
15_super( [arg ] [, ... ] ) This method invokes the method of the same name from the parent widget, with any specified arguments. Essentially .call().
16_superApply( arguments ) Invokes the method of the same name from the parent widget, with the array of arguments.
17_trigger( type [, event ] [, data ] ) This method triggers an event and its associated callback. The option with the name equal to type is invoked as the callback.
18destroy() This method removes the widget functionality completely. This will return the element back to its pre-init state.
19disable() This method disables the widget.
20enable() This method enables the widget.
21option( optionName ) This method gets the value currently associated with the specified optionName.
22option() This method gets an object containing key/value pairs representing the current widget options hash.
23option( optionName, value ) This method sets the value of the widget option associated with the specified optionName.
24option( options ) This method sets one or more options for the widget.
25widget() This method returns a jQuery object containing the original element or other relevant generated element.

Events

Sr.No.Event Method & Description
1create( event, ui ) This event is triggered when a widget is created.

jQueryUI widget factory Lifecycle

The jQueryUI widget factory, provides an object-oriented way to manage the lifecycle of a widget. These lifecycle activities include −
Creating and destroying a widget: For example,
$( "#elem" ).progressbar();
Changing widget options: For example
$( "#elem" ).progressbar({ value: 20 });
Making "super" calls in subclassed widgets: For example
$( "#elem" ).progressbar( "value" );
or
$
( "#elem" ).progressbar( "value", 40 );
Event notifications: For example
$( "#elem" ).bind( "progressbarchange", function() {
alert
( "The value has changed!" );
});

Example

Now let us create a custom widget in the following example. We will create a button widget. We will see how to create options, methods and events in a widget in the following examples −

Creating Custom Widget

Let us first create a simple custom widget.
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>jQuery UI Widget - Default functionality</title>
<link rel = "stylesheet" href = "//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<script>
$
(function() {
$
.widget("iP.myButton", {
_create
: function() {
this._button = $("<button>");
this._button.text("My first Widget Button");
this._button.width(this.options.width)
this._button.css("background-color", this.options.color);
this._button.css("position", "absolute");
this._button.css("left", "100px");
$
(this.element).append(this._button);
},
});
$
("#button1").myButton();
});
</script>
</head>

<body>
<div id = "button1"></div>
</body>
</html>
Let us save the above code in an HTML file widgetfactoryexample.htm and open it in a standard browser which supports javascript, you must also see the following output −

Adding Options To Custom Widget

In the previous example, we used the _create function to create a custom control. But users generally want to customize the control by setting and modifying options. We can define an options object which stores the default values for all of the options you define. _setOption function is used for this purpose. It is called for each individual option that the user sets. Here we are setting width and background-color of the button.
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>jQuery UI Widget - Default functionality</title>
<link rel = "stylesheet" href = "//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<script>
$
(function() {
$
.widget("iP.myButton", {
_create
: function() {
this._button = $("<button>");
this._button.text("My first Widget Button");
this._button.width(this.options.width)
this._button.css("background-color", this.options.color);
this._button.css("position", "absolute");
this._button.css("left", "100px");
$
(this.element).append(this._button);
},
_setOption
: function(key, value) {
switch (key) {
case "width":
this._button.width(value);
break;
case "color":
this._button.css("background-color",value);
break;
}
},
});
$
("#button2").myButton();
$
("#button2").myButton("option", {width:100,color:"#cedc98"});
});
</script>
</head>

<body>
<div id = "button2"></div>
</body>
</html>
Let us save the above code in an HTML file widgetfactoryexample.htm and open it in a standard browser which supports javascript, you must also see the following output −

Adding Methods to Custom Widget

In the following example we will add methods that the user can make use of and these are very easy to build into the framework. We will write a Move method, that shifts the button a specified horizontal distance. To make this work, we also need to set the position and left properties in the _create function −
this._button.css("position", "absolute");   
this._button.css("left", "100px");
Following this, the user can now call your method in the usual jQuery UI way −
this._button.css("position", "absolute");   
this._button.css("left", "100px");
$("button3").myButton("move", 200);
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>jQuery UI Widget - Default functionality</title>
<link rel = "stylesheet" href = "//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<script>
$
(function() {
$
.widget("iP.myButton", {
_create
: function() {
this._button = $("<button>");
this._button.text("My first Widget Button");
this._button.width(this.options.width)
this._button.css("background-color", this.options.color);
this._button.css("position", "absolute");
this._button.css("left", "100px");
$
(this.element).append(this._button);
},

move
: function(dx) {
var x = dx + parseInt(this._button.css("left"));
this._button.css("left", x);
if(x>400) { this._trigger("outbounds",{}, {position:x}); }
}
});
$
("#button3").myButton();
$
("#button3").myButton("move", 200);
});
</script>
</head>

<body>
<div id = "button3"></div>
</body>
</html>
Let us save the above code in an HTML file widgetfactoryexample.htm and open it in a standard browser which supports javascript, you must also see the following output −

Adding Events To Custom Widget

In this example we will demonstrate how to create an event. To create an event all you have to do is use the _trigger method. The first parameter is the name of the event, the second any standard event object you want to pass and the third any custom event object you want to pass.
Here we are firing an event when if the button moves beyond x=400. All you have to do is to add to the move function −
if(x<400) { this._trigger("outbounds",{}, {position:x}); }
In this case the event is called outbounds and an empty event object is passed with a custom event object that simply supplies the position as its only property.
The entire move function is −
move: function(dx) {
var x = dx + parseInt(this._button.css("left"));
this._button.css("left", x);
if(x<400) { this._trigger("outbounds",{}, {position:x}); }
}
The user can set the event handling function by simply defining an option of the same name.
$("button4").myButton("option", {
width
: 100,
color
: "red",
outbounds
:function(e,ui) {
alert
(ui.position);}
});
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>jQuery UI Widget - Default functionality</title>
<link rel = "stylesheet" href = "//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

<script>
$
(function() {
$
.widget("iP.myButton", {
_create
: function() {
this._button = $("<button>");
this._button.text("My first Widget Button");
this._button.width(this.options.width)
this._button.css("background-color", this.options.color);
this._button.css("position", "absolute");
this._button.css("left", "100px");
$
(this.element).append(this._button);
},
move
: function(dx) {
var x = dx + parseInt(this._button.css("left"));
this._button.css("left", x);
if(x>400) { this._trigger("outbounds",{}, {position:x}); }
}
});
$
("#button4").myButton();
$
("#button4").on("mybuttonoutbounds", function(e, ui) {
alert
("out");
});
$
("#button4").myButton("move", 500);
});
</script>
</head>

<body>
<div id = "button4"></div>
</body>
</html>

 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...
  • Fast Excel Package for Laravel
      Fast Excel is a Laravel package for importing and exporting spreadsheets. It provides an elegant wrapper around Spout —a PHP package to ...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda