Minggu, 14 Mei 2017

How do you distribute python apps

Having created an exemplary application structure of a web site that uses flask, we can continue with taking the first step into preparing the distribution. Altering the Folder Structure In order to package our application well, we need to make some additions to our folder structure. <code>/MyApplication |-- run.py |__ /app |-- __init__.py |-- /module_one |-- __init__.py |-- controllers.py |-- models.py |__ /templates |-- module_one |-- hello.html |__ /static |__ .. |__ . |-- setup.py # Distribution setup file |-- README.txt # Read-me file |-- MANIFEST.in # Distribution manifest file |-- CHANGES.txt # Changes log </code> Alter the folder structure

The post How do you distribute python apps appeared first on Coding Security.


How do you distribute python apps
read more

10 Regular Expressions that every web developer should know

The hardest part is learning the syntax and learning how to write your own regex code from scratch. To save time, I have selected 30 different regex code snippets that you can use in your projects. And since regex is not limited to a particular language, you can apply the following paragraphs in any language from Javascript to PHP or Python. 1 The strength of the password <code class="hljs language-JavaScript">^(?=.*.*)(?=.*)(?=.*.*)(?=.*.*.*).{8}$</code> Testing the strength of a password is often subjective so there is no absolute exact answer. But I feel that this regex is a great starting point if you don’t

The post 10 Regular Expressions that every web developer should know appeared first on Coding Security.


10 Regular Expressions that every web developer should know
read more

Kamis, 11 Mei 2017

What are the uses of the Goto statement in programming

Unlike other selection or branching statements that we have seen so far which branches based on a condition, the goto statement branches unconditionally. That is why the goto statement is also referred to as unconditional jump statement. There are two more unconditional branch statements in C. They are: break and continue. We have already seen the break statement in switch statement. But both break and continue are extensively used inside loops. So, we will discuss about these two unconditional branch statements later. By using the goto branch statement, we can either skip some instructions and jump forward in the program

The post What are the uses of the Goto statement in programming appeared first on Coding Security.


What are the uses of the Goto statement in programming
read more

What are different types of user exceptions in Java Programming

In this article we will learn how to create user defined exceptions (own exceptions) and how to use them in Java programs. Although Java provides several pre-defined exception classes, sometimes we might need to create our own exceptions which are also called as user-defined exceptions. Steps for creating a user-defined exception: Create a class with your own class name (this acts the exception name) Extend the pre-defined class Exception Throw an object of the newly create exception As an example for user-defined exception, I will create my own exception named NegativeException as follows: 1 2 3 4 5 6 7 8 9

The post What are different types of user exceptions in Java Programming appeared first on Coding Security.


What are different types of user exceptions in Java Programming
read more

What are different built-in objects in javascript

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

The post What are different built-in objects in javascript appeared first on Coding Security.


What are different built-in objects in javascript
read more

Rabu, 10 Mei 2017

How to make threads communicate with each other in java programming

In this article we will learn how to implement inter thread communication i.e how can we coordinate the communication between two or more threads.   Although we can restrict the access of data or code to a single thread at a time by using synchronization, it can’t guarantee the consistent execution of our logic.   As an example let’s consider the conventional Producer-Consumer problem which is generally introduced in Operating Systems course. In this problem Producer process or thread produces items and stores in a queue and Consumer process or thread consumes items from the queue. Note that the Consumer thread should wait

The post How to make threads communicate with each other in java programming appeared first on Coding Security.


How to make threads communicate with each other in java programming
read more

How to accept objects as function arguments

Like variables, objects can also be passed using pass-by-value, pass-by-reference, and pass-by-address. In pass-by-value we pass the copy of an object to a function. In pass-by-reference we pass a reference to the existing object. In pass-by-address we pass the address of an existing object. Following program demonstrates all three methods of passing objects as function arguments: 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 #include<iostream> using namespace std; class Student {

The post How to accept objects as function arguments appeared first on Coding Security.


How to accept objects as function arguments
read more