Posts

Stored Procedures in MySQL

Stored procedure is a segment of declarative SQL statements stored inside the MySQL Server. To define it other way, we can save (one or set) queries within stored procedure for future use. For example, we have a SELECT query that returns rows based on the condition SELECT * FROM customers WHERE city = ‘Bangalore’ ORDER BY firstName; The first time you invoke a stored procedure, MySQL looks up for the name in the database catalog, compiles the stored procedure’s code, place it in a memory area known as a cache, and execute the stored procedure. If you invoke the same stored procedure in the same session again, MySQL just executes the stored procedure from the cache without having to recompile it. A stored procedure can have parameters so you can pass values to it and get the result back. Advantages Reduce network traffic Centralize business logic More secure Disadvantages Resource Usages Troubleshooting Maintenance Creating Stored Procedures If we ...

Simple Pie Graphs Using <canvas> element in HTML 5

Now a days graphs are playing a major role to visualise the statistics in the web applications. With the help of these graphs, user can see all the information in detail at a glance. One popular kind among those graphs is Pie Graphs. So i continued my work for plotting Pie diagram with the help of simple Javascript & HTML5 <canvas> element. The canvas element properties such as 'arc()', 'beginPath()', 'lineTo()' & 'fill()' are used in this example. Let us go through each step for better understanding. Define the canvas element in your document body as shown below. You can apply styles either by using "style" tag (inline CSS) or defined class in separate .css file. <canvas id="canvas" width="800" height="500"></canvas> This text is displayed if your browser does not support HTML5 Canvas. Define your values in the form of an array as shown below. To display different filled colors for ...

Cross Site Scripting

Cross site Scripting (XSS) attacks are a type of injection problem, in which malicious scripts are injected into otherwise benign and trusted web sites. Cross site scripting flaws are the most prevalent flaw in web applications today. Cross site scripting attacks occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user. Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user in the output it generates without validating or encoding it. Attackers frequently use a variety of methods to encode the malicious portion of the tag, such as using Unicode, so the request is less suspicious looking to the user. There are hundreds of variants of these attacks, including versions that do not even require any symbols. For this reason, attempting to “filter out” these scripts is not likely to succeed. Instead we recommend validating input against a...

MySQL Conceptual Architecture

Image
The MySQL RDBMS is a very popular database system that is being used all over the world for its performance, simplicity and robustness. It is a good assumption that the architecture for MySQL is similar to that of a general RDBMS architecture. There is no actual architectural diagram for the MySQL RDBMS provided by the designers. The conceptual architecture shows the information about what the system does and how this is broken into interacting parts. The MySQL architecture was first broken down into three layers: an application layer , a logical layer , and a physical layer . The logical layer, which is focused upon in detail, was broken down into four components: a query processor , a transaction management system , a recovery management system , and a storage management system . 1. General RDBMS Architecture: It was found in all of the consulted resources that all database systems, can be viewed as a Garlan & Shaw layered architecture at the highest level of abstraction. It h...

Modernizr - An indispensable tool

Image
What is Modernixr? Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser. Why use Modernizr? Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not. It’s perfect for doing progressive enhancement easily. How it works? Modernizr runs quickly on page load to detect features; it then creates a JavaScript object with the results, and adds classes to the html element for you to key your CSS on. Modernizr supports dozens of tests, and optionally includes YepNope.js for conditional loading of external .js and .css resources. Installing Modernizr To install Modernizr, download the file from this page . Then, add a link to head tag of the file on your site. If you want to limit the features, you can select which features you intend to use in your project and generate the user-defined build. For example: <script src="js/modernizr-1.0.min.js...

Simple Line Graphs Using <canvas> element in HTML 5

After i worked with the Bar graph, i feel it is very easy to implement the line graphs using <canvas> element in HTML5. You can find many similarities in the javascript while working on this. New functions moveTo() , lineTo() , stroke() , lineWidth() has been used for line graphs. Define the canvas element in your document body as shown below with the ID attribute and mention the height & width attributes. You can apply styles either by using "style" tag (inline CSS) or defined class in separate .css file. <canvas id="myCanvas" width="800" height="500"></canvas> <script language="javascript" type="text/javascript"> var interval = 30; var linewidth = 1; var color = "blue"; var graphholder = "myCanvas"; var displayLabel = true; var labelfontstyle = "Arial"; var labelfontsize = "12px"; var labelfontclr = "#000000"; var ...

Simple Bar Graphs Using <canvas> element in HTML 5

When i worked in some projects earlier, i used to implement graphs by rendering some third party scripts either in javascript (client-side) or in php (server-side). But now using HTML5 it is very easy to develop these graphs using <canvas> & simple javascript code. We have predefined functions like fillText() , strokeRect() , fillRect() in javascript while using <canvas> element. I tried with some of these functions & deisgned this graph. This script is light weight and browser friendly compare to other scripts (We should consider the browsers like IE9,Firefox,Chrome which supports HTML5). Also a beginner of javascript can easily understand to implement this in the application. Define the canvas element in your document body as shown below with the ID attribute and mention the height & width attributes. You can apply styles either by using "style" tag (inline CSS) or defined class in separate .css file. <canvas id="myCanvas" width...