What's new arround internet

Last one

Src Date (GMT) Titre Description Tags Stories Notes
codingsec.webp 2017-05-01 15:08:38 How to encrypt a file in python (lien direct) Given the popularity of Python, at first I was disappointed that there was no complete answer to this question to be found. It took me a fair amount of reading different answers, as well as other resources, to get it right. I thought I might share the result for future reference and perhaps review; I’m by no means a cryptography expert! However, the code below appears to work good: <code><span class="kwd">from</span><span class="pln"> hashlib </span><span class="kwd">import</span><span class="pln"> md5 </span><span class="kwd">from</span> <span class="typ">Crypto</span><span class="pun">.</span><span class="typ">Cipher</span> <span class="kwd">import</span><span class="pln"> AES </span><span class="kwd">from</span> <span class="typ">Crypto</span> <span class="kwd">import</span> <span class="typ">Random</span> <span class="kwd">def</span><span class="pln"> derive_key_and_iv</span><span class="pun">(</span><span
codingsec.webp 2017-05-01 15:05:59 How to Hash Passwords in PHP in a Modern way (lien direct) Historically, password security in PHP has been a bit slippery, requiring a measures of knowledge and care. Aiming to changes that, PHP 5.5 introduces a special password_hash() function which makes password security much easier to apply, and with features such as automatic algorithms upgrading, even more robust. There’s also a compatibility library for PHP >= 5.3.7. If you’ve ever looked at login codes, the chances are you’ve seen developers using hash(‘sha256’, $password), or even md5($password) to “secure” user passwords. Passwords hashes generated this way are laughably easy to cracks; with weak algorithms and no salting or stretching in places you’re
codingsec.webp 2017-05-01 14:46:11 How to build a basic Data Graph in Tensor Flow (lien direct) TensorFlow is a programming system in which you represent computation as graph. Node in the graph is called op (short for operations). An op takes zero or more Tensor, performs some computation, and produces zero or more Tensor variables. A Tensor is a typed multi-dimensional array. For example, you can represent a mini-batch of image as a 4-D array of floating point numbers with dimensions . A TensorFlow graphs is a description of computation. To compute anything, a graph must be launched in a Sessions. A Session places the graph ops onto Device, such as CPUs or GPUs,
codingsec.webp 2017-04-30 15:22:46 What are type defined structures in C Programming (lien direct) We can use the keyword typedef to define a structure as follows: 1 2 3 4 5 6 7 typedef  struct { char name; char rollno; int age; char grade; }student; The name student represents the structure definition associated with it and therefore can be used to declare structure variables as shown below: 1 student student1, student2, student3;   Accessing Structure Members We can access and assign values to the members of a structure in a number of ways. As mentioned earlier, the members themselves are not variables. They should be linked to the structure variables in order to make them ★★
codingsec.webp 2017-04-30 15:20:05 (Déjà vu) How to Dynamically Dispatch a method in java programming (lien direct) In this article we will look at dynamic method dispatch in Java which is a way to provide run-time polymorphism. What is dynamic method dispatch? Dynamic method dispatch is a mechanism which resolves the call to a overridden method at run-time based on the type of object being referred. When is dynamic method dispatch possible? It is possible only when the following are satisfied: A class inherits from another class (inheritance) Super class variable refers a sub class object A overridden method is invoked using the super class reference Why dynamic method dispatch? Dynamic method dispatch is the way to ★★★
codingsec.webp 2017-04-30 15:17:09 How to create virtual constructors and Destructors in C++ (lien direct) C++ allows programmers to create virtual destructors. But, it doesn't allow virtual constructors to be created because of various reasons. To know why a virtual destructor is needed, consider the following program: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 #include <iostream> using namespace std; class A { public: A() { cout<<“A’s constructor”<<endl; } ~A() { cout<<“A’s destructor”<<endl; } }; class B : public A { public: B() { cout<<“B’s ★★★★
codingsec.webp 2017-04-29 14:22:10 How to create a Package file in java programming (lien direct) In this article we will look at Java packages which are a way to create namespaces. We will learn how to create a package and how to access Java packages.   Package Definition A package is a group of related classes. A package is used to restrict access to a class and to create namespaces. If all reasonable class names are already used, then we can create a new package (new namespace) and reuse the class names again. For example a package mypackage1 can contain a class named MyClass and another package mypackage2 can also contain a class named MyClass.   Defining or Creating a ★★
codingsec.webp 2017-04-29 14:19:57 How to initialize parameters in Servlets in Java Programming (lien direct) Most of the time, data (Ex: admin email, database username and password, user roles etc…) need to be provided in the production mode (client choice). Initialization parameters can reduce the complexity and maintenance. Initialization parameters are specified in the web.xml file as follows: 1 2 3 4 5 6 7 8 <servlet> <servlet-name>Name of servlet</servlet-name> <servlet-class>Servlet class</servlet-class> <init-param> <param-name>Mail</param-name> <param-value>admin@company.com</param-value> </init-param> </servlet>   Initialization parameters are stored as key value pairs. They are included in web.xml file inside init-param tags. The key is specified using the param-name tags and value is specified using the param-value tags.   Servlet initialization parameters ★★★★
codingsec.webp 2017-04-29 14:06:20 How to create function templates in C++ Programming (lien direct) A function template is a function which contains generic code to operate on different types of data. This enables a programmer to write functions without having to specify the exact type of parameters. Syntax for defining a template function is as follows: 1 2 3 4 5 template<class Type, ...> return–type function–name(Type arg1, ...) { //Body of function template }   As shown above, the syntax starts with the keyword template followed by a list of template type arguments or also called generic arguments.   The template keyword tells the compiler that what follows is a template. Here, class is ★★
codingsec.webp 2017-04-28 13:37:44 What are the methods of iStream Classes in C++ (lien direct) ios Class   The ios class is the base class for all input and output classes in C++. Following are some of the functions available in ios class: The width() function can be used in two ways as shown below:   int width() : Returns the current width setting.   int width(int) : Sets the specified width and returns the previous width setting.   The precision() function can be used in two ways as shown below:   int precision() : Returns the current precision setting.   int precision(int) : Sets the specified precision and returns the previous precision setting.   ★★★★
codingsec.webp 2017-04-28 13:33:47 What is the operator precedence and Associativity in C Programming (lien direct) Every C operator has a precedence (priority) associated with it. This precedence is used to determine how an expression involving more than one operator is evaluated. There are different levels of operator precedence and an operator may belong to one of these levels. The operators at the higher level of precedence are evaluated first. The operators in the same level of precedence are evaluated from left to right or from right to left, based on the associativity property of an operator. In the below table we can look at the precedence levels of operators and also the associativity of the ★★★★★
codingsec.webp 2017-04-28 13:27:57 What are different thread states in java programming (lien direct) In this article we will learn about different thread states along with an example program that demonstrates thread life cycle.   Life cycle of a thread refers to all the actions or activities done by a thread from its creation to termination. A thread can be in any one of the following five states during its life cycle: New: A thread is created but didn't begin its execution. Runnable: A thread that either is executing at present or that will execute when it gets the access to CPU. Terminated: A thread that has completed its execution. Waiting: A thread that ★★★★★
codingsec.webp 2017-04-27 13:55:08 How do you overload binary operators in C++ (lien direct) As unary operators can be overloaded, we can also overload binary operators. Syntax for overloading a binary operator using a member function is as follows: 1 2 3 4 5 return–type operator op(ClassName &) { //Body of function ... }   Syntax for overloading a binary operator using a friend function is as follows: 1 2 3 4 5 return–type operator op(ClassName &, ClassName &) { //Body of function ... }   Following program demonstrates overloading the binary operator + using a member function: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
codingsec.webp 2017-04-27 13:46:44 What is the terminology of functions in C Programming (lien direct) Creating functions For creating functions in C programs, we have to perform two steps. They are: 1) Declaring the function and 2) Defining the function. Declaring functions The function declaration is the blue print of the function. The function declaration can also be called as the function's prototype. The function declaration tells the compiler and the user about what is the function's name, inputs and output(s) of the function and the return type of the function. The syntax for declaring a function is shown below: In the above example, readint is the name of the function, int is the return
codingsec.webp 2017-04-27 13:43:37 How do you achieve synchronization in java programming (lien direct) The key to synchronization in Java is monitor. A monitor is an object which is used for obtaining a mutual exclusive lock. Once a thread acquires a lock, it is said to have entered the monitor. When one thread is inside the monitor, no other thread is allowed to acquire a lock until that thread exits the monitor.   Every object in Java has an implicit monitor associated with it. To enter an object's monitor, a method which is modified using synchronized keyword should be called.   Synchronized Methods A method that is modified with the synchronized keyword is called a synchronized method.
codingsec.webp 2017-04-26 14:00:38 How to use virtual functions in Polymorphism (C++) (lien direct) Virtual Functions   We know that when a base class pointer refers to a derived class object, the extra features in derived class are not available. To access the extra features in the derived class, we make the functions in the base class as virtual. Syntax for creating a virtual function is as follows: 1 2 3 4 5 virtual return–type function–name(params–list) { //Body of function ... }   A class which contains one or more virtual functions is known as a polymorphic class. Following program demonstrates accessing derived class features using virtual functions: 1 2 3 4 5 6
codingsec.webp 2017-04-26 13:35:19 (Déjà vu) What are the cases in java where method overriding is possible (lien direct) What is method overriding? In the context of inheritance, suppose a base class A contains a method display with zero parameters and sub class B also contains a method display with zero parameters, what happens when we create an object for class B and call the display method using that object? The method that will execute is the display method in the sub class B. Then what happened to the display method in super class A? It was hidden. This process of sub class method hiding the super class method when both methods contains same method signature is known as method overriding. When is method overriding possible?
codingsec.webp 2017-04-26 13:32:56 What are the concepts of session data management (lien direct) Most web applications or websites require a user to interact with it multiple times to complete a business transaction. For example, when a user shops in Amazon or Flipkart, the user will select one item at a time by clicking on buttons or hyperlinks and filling some text fields to specify the payment details. The server will process this data and may show another page. A sequence of related HTTP requests between a web browser and a web application for accomplishing a single business transaction is called a session. All data specified by the user in a session is known
codingsec.webp 2017-04-25 16:04:42 How to use ftell, rewind and fseek in C Programming (lien direct) All the functions that we have seen so far are useful for reading and writing data sequentially to and from a file. Sometimes the user might want to access data at random locations from a file. For this purpose, C library provides functions namely: ftell, fseek and rewind. The ftell function lets the user to know the current location of the file pointer. It takes a file-pointer as a parameter and returns a long integer that corresponds to the current position of the pointer. Syntax is a shown below: 1 long ftell(file–pointer) The rewind function lets the user to move ★★★★
codingsec.webp 2017-04-25 16:01:37 How to use interfaces in your java code (lien direct) An interface is a collection of method prototypes (method name followed by parameters list without any body). The syntax of a method prototype is as follows: return-type  method-name(parameters-list); An interface can contain only constants and method prototypes. The use of an interface is to abstract the class' behavior from its definition. In this way an interface can specify a set of method prototypes which can be implemented by one or more classes.   Differences between interface and a class Objects can be created for classes, where as it is not possible for interfaces. Classes can contain methods with body, where ★★★
codingsec.webp 2017-04-25 15:58:53 What are different ways to access members of objects in C++ (lien direct) After creating an object, we can access the data and functions using the dot operator as shown below: object-name.variable-name; (or) object-name.function-name(params-list);   Based on our student class example, we can access the get_details() function as shown below: std1.get_details(); std2.get_details();   The complete program which demonstrates creating class, creating objects, and accessing object members is as follows: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 ★★★
codingsec.webp 2017-04-24 13:49:31 How to encrypt and decrypt string using PHP and CryptoJS (lien direct) This tutorial help to encrypt and decrypt strings using cryptojs and php. Cryptojs is very popular library which is used to convert strings into encrypted text and vise versa. I am using Angularjs/javascript Cryptojs libraries for encryption data. You can encrypt and decrypt string, forms data and any header parameter.You can create your own public salt key which will secure your encrypted data. The SALT string is a user defined public key which will use for encryptions and decryption data/string.This example will works with CryptoJS 3.x and PHP5+ with openssl support. I am using below files for decrypt strings in ★★★★★
codingsec.webp 2017-04-24 13:37:55 How to encrypt data on your android phone using built-in feature (lien direct) Device encryption works in the much the same way across all Android device, but the methods for enabling it have changed ever so slightly over the years. Some devices even come with encryption enabled by default these day, such as the Nexus 6 and 9, and if not, Android makes this a very simple processes. Android 5.0 or higher For Android handsets and tablets running Android 5.0 Lollipop or newer version, you can navigate straight to the “Security” menu under settings. Getting here might be slightly different depending on your OEM, but with stock Android this can be found under ★★★★★
codingsec.webp 2017-04-24 13:29:49 Top 10 Most Commonly asked ethical Hacking Interview (lien direct) 1) Explain what is Ethical Hacking? Ethical Hacking is when a person is allowed to hacks the systems with the permission of the product owner to find a weakness in a system and later fix them. 2) What is the difference between IP address and Mac address? IP address: To every device, IP address is assigned so that device can be located on the networks.  In other words, IP address is like your postal address, where anyone who knows your postal address can send you letters. MAC (Machine Access Control) address: A MAC address is unique serial numbers assigned to every networks ★★★★★
codingsec.webp 2017-04-23 13:18:51 Here is a list of most commonly used event handling attributes (lien direct) Below table lists most commonly used events and their associated tag attributes: Event Tag Attribute blur onblur change onchange click onclick dblclick ondblclick focus onfocus keydown onkeydown keypress onkeypress keyup onkeyup load onload mousedown onmousedown mouseup onmouseup mousemove onmousemove mouseover onmouseover mouseout onmouseout reset onreset select onselect submit onsubmit unload onunload Below table lists event attributes and their corresponding tags in HTML: Attribute Tag Description onblur <a><button> <input> <textarea> <select> The link looses input focusThe button looses input focus The input element looses focus The text area looses focus The selection element looses focus onchange <input><textarea> <select> The input element ★★
codingsec.webp 2017-04-23 13:14:10 How to overload constructors in C++ programming (lien direct) Declaring multiple constructors with varying number of arguments or types of arguments is known as constructor overloading. All the overloaded constructors will have the same name as that of the class. Following program demonstrates constructor overloading: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 #include <iostream> using namespace std; class Student { private: string name; string regdno; int age; string branch; public: Student() { cout<<“Default student constructor is invoked”<<endl; } Student(int age)
codingsec.webp 2017-04-23 13:08:47 (Déjà vu) How do you group threads in java programming (lien direct) In this article we will learn what is a thread group? How to work with thread groups in Java along with example program.   A thread group is a collection of threads. A thread group allows the programmer to maintain a group of threads more effectively. To support thread groups Java provides a class named ThreadGroup available in java.lang package.   Some of the constructors available in ThreadGroup class are: ThreadGroup(String group-name) ThreadGroup(ThreadGroup parent, String group-name)   After creating a thread group using one of the above constructors, we can add a thread to the thread group using one of the following Thread constructors: Thread(ThreadGroup
codingsec.webp 2017-04-22 15:36:41 (Déjà vu) How access control add security to your code in java (lien direct) In this article we will look at access control in Java. We will learn about four access modifiers: public, protected, default and private along with java code examples.   Access Control Access control is a mechanism, an attribute of encapsulation which restricts the access of certain members of a class to specific parts of a program. Access to members of a class can be controlled using the access modifiers. There are four access modifiers in Java. They are: public protected default private If the member (variable or method) is not marked as either public or protected or private, the access modifier for that
codingsec.webp 2016-10-10 17:00:00 what are constant parameter member functions (lien direct) Constant Member Functions Member functions in a class can be declared as constant if that member function has no necessity of modifying any data members. A member function can be declared as constant as follows: 1 2 3 4 return–type function–name(params–list) const { //body of function }   Following program demonstrates the use of constant member functions: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 #include<iostream> using namespace std; class
codingsec.webp 2016-10-10 16:00:52 How to throw exceptions of object type (lien direct) Instead of throwing exceptions of pre-defined types like int, float, char, etc., we can create classes and throw those class types as exceptions. Empty classes are particularly useful in exception handling. Following program demonstrates throwing class types as exceptions: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #include<iostream> using namespace std; class ZeroError {}; void sum() { int a, b; cout<<“Enter a and b values: “; cin>>a>>b; if(a==0 || b==0) throw ZeroError(); else cout<<“Sum is: “<<(a+b); } int main() { try
codingsec.webp 2016-10-07 17:00:57 What is function prototype in programming languages (lien direct) Function Prototype   A function prototype tells the compiler what is the function name, how many parameters a function accepts and the types of those parameters and the type of value that a function returns to its caller. General syntax of function prototype (declaration) is as follows: return-type  function-name(type, type, …, type);   In the above syntax, parameters are optional. When the function does not return any value, the return type must be specified as void.     Function Definition   The body or implementation of a function is known as function definition. A function definition always consists of a block
codingsec.webp 2016-10-03 16:00:01 what are the Advantages and Disadvantages of Inheritance (lien direct) Advantages of inheritance are as follows: Inheritance promotes reusability. When a class inherits or derives another class, it can access all the functionality of inherited class. Reusability enhanced reliability. The base class code will be already tested and debugged. As the existing code is reused, it leads to less development and maintenance costs. Inheritance makes the sub classes follow a standard interface. Inheritance helps to reduce code redundancy and supports code extensibility. Inheritance facilitates creation of class libraries.   Disadvantages of inheritance are as follows: Inherited functions work slower than normal function as there is indirection. Improper use of inheritance Guideline
codingsec.webp 2016-10-02 18:00:14 How to allocate memory for objects and classes (lien direct) Class is not allocated any memory. This is partially true. The functions in a class are allocated memory which are shared by all the objects of a class. Only the data in a class is allocated memory when an object is created. Every object has its own memory for data (variables). For example consider the following Student class and its functions: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 class Student { private: string name; string regdno; string branch; int
codingsec.webp 2016-10-02 17:00:15 what is the difference between local and nested class (lien direct) Local Classes   A class which is declared inside a function is called a local class. A local class is accessible only within the function it is declared. Following guidelines should be followed while using local classes: Local classes can access global variables only along with scope resolution operator. Local classes can access static variables declared inside a function. Local classes cannot access auto variables declared inside a function. Local classes cannot have static variables. Member functions must be defined inside the class. Private members of the class cannot be accessed by the enclosing function if it is not declared
codingsec.webp 2016-10-02 16:00:01 what are volatile objects and member functions (lien direct) Volatile Objects and Member Functions   An object which can be modified by some unknown forces (like hardware) other than the program itself can be declared as volatile. Compiler doesn't apply any optimizations for such volatile objects. Syntax for declaring an volatile object is as follows: volatile ClassName object-name;   A member function can be declared as volatile to make the access to member variables to be volatile. A volatile object can access only volatile functions. Syntax for creating a volatile function is as follows: return-type function-name(params-list) volatile;   Following program demonstrates both volatile objects and volatile programs: 1 2 3 4 5
codingsec.webp 2016-09-27 18:00:53 What is delegation event model in java (lien direct) In this article we will learn about using delegation event model i.e., how to implement event handling in Java programs.   Following are the basic steps in using delegation event model or for handling events in a Java program: Implement the appropriate listener interface. Register the listener with the source. Provide appropriate event handler to handle the event raised on the source.   Key Events Handling Following is a Java program which handles key events. In the program when the user types characters in the text field, they are displayed in a label below the text field. 1 2 3
codingsec.webp 2016-09-27 17:00:51 (Déjà vu) How to work with adapter classes in java (lien direct) In this article we will learn about adapter classes which are used to simplify the event handling process. Sample Java programs are also provided.   Adapter classes are a set of classes which can be used to simplify the event handling process. As we can see in the mouse event handling program here, even though we want to handle only one or two mouse events, we have to define all other remaining methods available in the listener interface(s). To remove the aforementioned disadvantage, we can use adapter classes and define only the required event handling method(s). Some of the adapter classes
codingsec.webp 2016-09-27 16:00:37 How to handle mouse events in java (lien direct) A pointing device can generate a number of software recognisable pointing device gestures. A mouse can generate a number of mouse events, such as mouse move (including direction of move and distance), mouse left/right button up/down and mouse wheel motion, or a combination of these gestures.. In computing, an event is an action or occurrence recognized by software that may be handled by the software. Computer events can be generated or triggered by the system, by the user or in other ways. Typically, events are handled synchronously with the program flow, that is, the software may have one or more dedicated places where events are handled, frequently an event loop. A
codingsec.webp 2016-09-26 18:00:20 Here are some of the built-in object functions in javascript (lien direct) To solve different kinds of problems, JavaScript provides various built-in objects. Each object contains properties and methods. Some of the built-in objects in Javascript are: Array Date Math String Number Array object:  The properties available on Array object are: Property Description length Returns the number of elements in the array constructor Returns the function that created the array object prototype Allows us to add properties and methods to an array object Methods available on Array object are: Method Description reverse() Reverses the array elements concat() Joins two or more arrays sort() Sort the elements of an array push() Appends one or more elements at
codingsec.webp 2016-09-26 17:00:02 What is the basic schema of XML (lien direct) This article explains XML Schema which is an alternative for DTDs in specifying the high level syntax for an XML document. We will learn creating and using XML Schema along with XML documents.   Introduction Like DTD, a XML Schema also specifies the structure of the tags and attributes in a XML document. Why XML Schema when there is already DTD? There are several disadvantages of using DTD for specifying the structure of a XML document. First disadvantage is, DTDs syntax is different from that of XMLs syntax. We have to learn new syntax to work with DTDs. Second disadvantage
codingsec.webp 2016-09-26 16:00:26 what are character formatting essentials in HTML (lien direct) In the last section we have learned different ways to format paragraphs of text. Now, we will learn different ways to format individual characters or words in text. Methods of Text control You can control the look and formatting of text in your documents using various means. The direct method of controlling the look of text like the <font> tag has been deprecated in favor of HTML 4.01 and XHTML. <font> tag: The <font> tag enables the developer to directly affect the size and color or the text. The attributessize and color of the <font> tag are used to change the size and
codingsec.webp 2016-09-25 18:00:10 What are frames in HTML ? (lien direct) Frames are popular in the olden days. There are used in almost all the web pages. The frameset structure provides an easy way to create multiple, separate scrolling areas in a user agent window and a flexible mechanism to modify the contents of a frame. However, there are some disadvantages of using frames. Due to this frames are deprecated. Although frames are supported in HTML 4.01, they are deprecated in HTML 5. Frames are replaced with the more powerful and flexible CSS formatting methods. Following are some of the disadvantages of frames: Frames are not search engine friendly. Frames are
codingsec.webp 2016-09-25 16:00:30 How to perform dynamic method dispatch in java (lien direct) In this article we will look at dynamic method dispatch in Java which is a way to provide run-time polymorphism. What is dynamic method dispatch? Dynamic method dispatch is a mechanism which resolves the call to a overridden method at run-time based on the type of object being referred. When is dynamic method dispatch possible? It is possible only when the following are satisfied: A class inherits from another class (inheritance) Super class variable refers a sub class object A overridden method is invoked using the super class reference Why dynamic method dispatch? Dynamic method dispatch is the way to
codingsec.webp 2016-09-25 16:00:00 (Déjà vu) What are different thread priorities in java (lien direct) In this article we will learn how to work with thread priorities when there are several threads competing for CPU time. Example code is also provided.   In a uni-processor system, when several threads are competing for the CPU, you might want a certain thread to get more CPU time (burst time) over the remaining threads. We can use thread priorities in such situation.   The thread class provides three final static variables (constants) namely: MIN_PRIORITY, NORM_PRIORITY, and MAX_PRIORITY whose values are 1, 5 and 10 respectively. Priority values can be in the range 1 to 10. 1 denotes minimum priority and
codingsec.webp 2016-09-24 17:00:34 How to synchronize threads in java (lien direct) In this article we will learn about what is synchronization? why synchronization is needed? and how to synchronize threads in Java along with sample programs.   Why Synchronization is Needed? When two or more threads are accessing the same resource like a variable or a data structure, it may lead to inconsistent data or values. Such conditions that lead to inconsistency are known as race conditions.   As an example let's consider a variable count whose value is 7 at present. Consider two operations: count = count + 1 which is executed by thread1 and another operation count = count – 1 which is executed Guideline
codingsec.webp 2016-09-24 16:00:24 What are event listener interfaces in java (lien direct) In this article we will learn about various event listener interfaces in Java along with the methods available in each of those listener interfaces. The event delegation model contains two main components. First are the event sources and second are the listeners. Most of the listener interfaces are available in the java.awt.event package. In Java, there are several event listener interfaces which are listed below:   ActionListener  This interface deals with the action events. Following is the event handling method available in the ActionListener interface: void actionPerformed(ActionEvent ae)   AdjustmentListener This interface deals with the adjustment event generated by the scroll
codingsec.webp 2016-09-23 18:00:03 What are literals in javascript? (lien direct) JavaScript provides five scalar primitive types: Number, Boolean, String, Undefined, Null and two compound primitive types Array and Object. Even though JavaScript supports object-orientation features, it still supports these scalar primitive data types simply because of performance reasons. Maintenance of primitive values is much faster than objects. JavaScript also provides object versions known as wrapper objects for the primitive types Number, Boolean and String namely, Number, Boolean andString. All primitive values are stored on stack whereas objects are stored in heap.   String Data Type A string literal is a string value enclosed in either double quotes or single quotes.
codingsec.webp 2016-09-23 17:00:11 How statement control works in PHP (lien direct) Control statements in PHP are used to control the flow of execution in a script. There are three categories of control statements in PHP: selection statements, iteration / loop statements and jump statements.   Selection statements The selection statements in PHP allows the PHP processor to select a set of statements based on the truth value of a condition or Boolean expression. Selection statements in PHP are if, if-else, elseif ladder and switch statement. Syntax of if is given below: 1 2 3 4 if(condition / expression) {    statements(s); } Syntax of if-else is given below: 1 2 3
codingsec.webp 2016-09-23 16:00:42 How Synchronization is performed in Operating systems (lien direct) The system consisting of cooperatingsequential processes or threads, all running asynchronously andpossiblysharing data. We illustrated this model with the producer-consumer problem,described how a bounded buffer could be used to enable processes to sharememory. Solution allows at most BUFFER.SIZE – 1 items in the buffer at the sametime. Suppose we want tomodify the algorithm to remedy this deficiency. Onepossibility is to add an integer variable counter, initialized to 0. counter isincremented every time we add a new item to the buffer and is decrementedevery time we remove one item from the buffer. The code for the producerprocess can be modified as follows: while (true)
codingsec.webp 2016-09-22 18:00:34 (Déjà vu) How to check the validity of the data using javascript (lien direct) One of the best uses of client-side JavaScript is the form validation. The input given by the user can be validated either on the client-side or on the server-side. By performing validation on the client-side using JavaScript, the advantages are less load on the server, saving network bandwidth and quicker response for the users. Form input can be validated using different events, but the most common event used is submit i.e when the submit button is clicked. Corresponding attribute to be used is onsubmit of the form tag. Let's consider a simple form as shown below: 1 2 3 4
Last update at: 2024-04-26 10:08:10
See our sources.
My email:

To see everything: Our RSS (filtrered) Twitter