top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

About SVG - Part 1

0 votes
630 views

SVG stands for Scalable Vector Graphics.

SVG defines graphics in XML format. SVG is a platform for two-dimensional graphics.

SVG is an XML language, similar to XHTML, which can be used to draw graphics, such as the ones shown to the right.

It can be used to create an image either by specifying all the lines and shapes necessary, by modifying already existing raster images, or by a combination of both.

It has two parts:
1)XML-based file format and
2)A programming API for graphical applications.

Key features include shapes, text and embedded raster graphics, with many different painting styles.

It supports scripting through languages such as ECMAScript and has comprehensive support for animation.

SVG is used in many business areas including Web graphics, animation, user interfaces, graphics interchange, print and hardcopy output, mobile applications and high-quality design.

Simple Example:

<html>
<body>

<h1>My first SVG</h1>

<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>

</body>
</html>

Output :
enter image description here

posted Jul 11, 2014 by Amarvansh

  Promote This Article
Facebook Share Button Twitter Share Button LinkedIn Share Button


Related Articles

In HTML , SVG and Canvas are two important graphics features.It is a Vector graphics technology.

What is Vector Graphics?

Vector graphics is the use of geometrical primitives such as points, lines, curves, and shapes or polygons—all of which are based on mathematical expressions—to represent images in computer graphics.

Vector graphics range in complexity from simple to moderate to extremely complex. The following are some basic examples.

  1. Simple - Callout in a document or illustration.
  2. Moderate - Illustrations such as charts, diagrams and maps.
  3. Complex - Documents such as those used for engineering.

Canvas

Canvas is a bitmap with an immediate modegraphics application programming interface (API) for drawing on it. Canvas is a “fire and forget” model that renders its graphics directly to its bitmap and then subsequently has no sense of the shapes that were drawn; only the resulting bitmap stays around.

More Information about canvas - http://tech.queryhome.com/51054/about-html5-canvas

SVG

SVG is used to describe Scalable Vector Graphics

SVG is known as a retained mode graphics model persisting in an in-memory model. Analogous to HTML, SVG builds an object model of elements, attributes, and styles. When the element appears in an HTML5 document, it behaves like an inline block and is part of the HTML document tree.

More Information about SVG - http://tech.queryhome.com/50869/about-svg-part-1

A Comparison of Canvas and SVG

Canvas

Pixel-based (canvas is essentially an image element with a drawing API)
Single HTML element similar to image in behavior
Visual presentation created and modified programmatically through script
Event model/user interaction is coarse -- at the canvas element only; interactions must be manually programmed from mouse coordinates
API does not support accessibility; markup-based techniques must be used in addition to canvas

SVG

Object Model-based (SVG elements are similar to HTML elements)
Multiple graphical elements which become part of the Document Object Model (DOM)
Visual presentation created with markup and modified by CSS or programmatically through script
Event model/user interaction is object-based at the level of primitive graphic elements -- lines, rectangles, paths
SVG markup and object model directly supports accessibility

Video Tutorial for svg and canvas

https://www.youtube.com/watch?v=_OiVBQY9hG0

Both Canvas and SVG are important components of the HTML5 graphically rich Web.Right now there are a lot of supporting libraries available on web for both svg and canvas. If I name a few Kinetics.js, Fabric.js, Raphael.js, Paper.js and many-many more. These libraries are there to make us work with these two technologies in an easy way.

Images for svg and canvas features

Image svg-canvas

READ MORE

What is Vivus.js?

Vivus is a JavaScript library that gives your SVG the appearance of being drawn. Vivus works out of the box without a need for any dependencies (e.g. jQuery). Simply include the .js file in your HTML, and designate the SVG element you want to animate, along with some preset options to start the animation right away.
 
Vivus is a little JavaScript class to make drawing animation with SVGs in a webpage.
 
Types of animation
1)Delayed
2)Async
3)OneByOne
 
 
For More Reference - http://maxwellito.github.io/vivus/
 
 
READ MORE

What is Vector Image?

Vector graphics is the use of geometrical primitives such as points, lines, curves, and shapes or polygons—all of which are based on mathematical expressions—to represent images in computer graphics.
 
Vector graphics is the creation of digital images through a sequence of commands or mathematical statements that place lines and shapes in a given two-dimensional or three-dimensional space.
 
How to Create a Vector Image in Web Page?
 
Using SVG we can draw a vector image.Some of ways for using SVG in webpage.
 
1. Using an <object> Tag
 
<object type="image/svg+xml" data="image.svg">Your browser does not support SVG</object>

2. Using an <embed> Tag
<embed type="image/svg+xml" src="image.svg" />
3. Within an <iframe>
<iframe src="image.svg">Your browser does not support iframes</iframe>

4. Inline SVG XML Embedded Into Your HTML5 Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Embedded SVG</title>
</head>
<body>
<h1>Embedded SVG</h1>

<!-- SVG code -->
<svg width="300px" height="300px" xmlns="http://www.w3.org/2000/svg">
	<text x="10" y="50" font-size="30">My SVG</text>
</svg>

</body>
</html>
5. Using an <img> Tag
<img src="image.svg" />
6. Using a CSS Background Image
#myelement
{
	background-image: url(image.svg);
}
 
READ MORE

Variable and Data Types in C#

A variable is an entity whose value can keep changing. For example, the age of a student, the age of a student, the address of a faculty member and the salary of an employee are all examples of variables.

  

In C#, a variable is a location in the computer’s memory that is identified by a unique name and is used to store a value. The name of the variable is used to access and read the value stored in it. Different types of data such as a character, an integer or a string can be stored in variables. Based on the type of data that needs to be stored in variable, variables can be assigned different data types.

Using variables

In C# , memory is allocated to a variable at the time of its creation. During creation, a variable is given a name that uniquely identifies the variable within its scope. For example, you can create a variable called empName to store the name of an employee.

You can initialize the variables at the time of creating the variable or at a later time. Once initialized, the value of a variable can be changed as required.

In c#, variable enable you to keep track of data. When you are referring to a variable, you are actually referring to the value stored in that variable.

The following syntax is used to declare variable in c#,

<datatype> <variableName>;

Where,

Datatype: Is a valid data type in C#.

VariableName: Is a valid variable name.

Data Types

You can store different types of values such as numbers, characters or strings in different variables. But the compiler must know what kind of data a particular variable is expected to store. To identify the type of data that can be stored in a variable, c# provides different data types.

When a variable is declared, a data type is assigned to the variable. This allows the variable to store values of the assigned data types. In C# programming language, data types are divided into two categories. These are:

 

Value Types: variable of value types store actual values. These values are stored in a stack. The values can be either of a built-in data type or a user-defined data type. Most of the built-in data type are value types. The value type built-in data types are int, float, double, char and bool. Stack storage results in faster memory allocation to variables of value types.

Reference Type: Variables of reference type store the memory address of other variables in a heap. These values can either belong to a built-in data type or a user-defined data type. For example, string is a built-in data type which is a reference type. Most of the user-defined data types such as class are reference types.

Predefined Data Types

The predefined data types are referred to as basic data types in c#. These data types have a predefined range and size. The size of the data type helps the compiler to allocate memory space and the range helps the compiler to ensure that the value assigned is within the range of the variable’s data type.

The predefined data types in c# is given below:-

Data Type

Size

Range

byte

Unsigned 8-bit integer

0 to 255

short

Signed 16-bit integer

-32, 768 to 32,767

int

Signed 32-bit integer

-2,147,483,648 to 2,147,483,647

long

Signed 64-bit integer

-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

float

32-bit floating point with 7 digits precisions

±1.5e-45 to ±3.4e38

double

64-bit floating point with 15-16 digits precision

±5.oe-324 to ± 1.7e308

decimal

128-bit floating point with 28-29 digits precision

±1.0  x 10e-28 to ±7.9 x 10e28

char

Unicode 16-bit character

U+0000 to U+ffff

bool

Stores either true or false

True or flase

 

READ MORE

Networks can be configured to be so incredibly redundant now - for reasonable prices - that there is no excuse for a data center not to achieve five nines (99.999%) of availability.

But what about the servers and applications? Why spend so much time up front configuring the network to make sure it doesn't fail, and then deploy an application to a single server?

Sure, there are ways to make sure individual servers have some redundancy to minimize failures -- things like RAID1, RAID5, or RAID10 (redundant array of inexpensive disks) which will protect against a disk drive failure (and I highly recommend this type of configuration for all production servers - and preferably the use of hardware RAID vs. software RAID). But what happens if a file gets corrupt on the RAID array? Or a recent configuration change brings the application down? Or a newly released patch conflicts with other settings and causes problems? Well, in these situations the server will go down and the application(s) hosted on that server will be offline.

A good monitoring and alerting process will allow the system administrator to detect and address these issues quickly, but still there will be some level of downtime associated with the issue. And depending on the type of issue, even the best system administrator might not be able to immediately resolve the issue - it may take time. Time during which your application is unavailable and you may be losing business due to the site interruption.

So, what can you do?

A great option - and one that has recently become more affordable - is to host your application on a webfarm. A webfarm consists of two or more web servers with the same configuration, and that serve up the same content. There are special switches and processes involved that allow each of these servers to respond to a request to a single location. For example, say we have two servers - svr1.orcsweb.com and svr2.orcsweb.com - that have 100% the same configuration and content. We could configure a special switch* to handle traffic that is sent to www.orcsweb.com and redirect the traffic to either of these nodes depending on some routing logic. All clients visiting the main URL (in this case www.orcsweb.com) have no idea whether this is a single server - or ten servers! The balancing between nodes is seamless and transparent.

[*note: There is also software that could handle the routing process but experience and test have shown that these types of solutions are generally not as scalable, fast, or efficient as the hardware switch solutions]

The routing logic can be a number of different options - most common are:

  • Round-robin: Each node gets a request sent to it "in turn". So, node1 gets a request, then node2 again, then node1, then node2 again.
  • Least Active: Whichever node shows to have the lowest number of current connects gets new connects sent to it. This is good to help keep the load balanced between the server nodes.
  • Fastest Reply: Whichever node replies faster is the one that gets new requests. This is also a good option - especially if there are nodes that might not be "equal" in performance. If one performs much better than the other, why not send more requests there?

In any of these scenarios the switch will also detect if a node were to fail. So, if svr1.orcsweb.com was taken offline for maintenance - or it had a critical failure - the switch would detect that and only send traffic to svr2.orcsweb.com. And since the clients always access the site via the main URL (not the node names) they have no idea that one of the nodes is down - the application continues to serve client requests seamlessly.

Besides high-availability (continuing to satisfy requests during a failure), a webfarm also gives an application a higher level of scalability - the ability to handle more and more load. If load increased on the application to the point where performance started to degrade, more nodes could be added to the webfarm (again, without clients noticing), giving the ability to handle potentially unlimited levels of traffic (just keep adding nodes!).

Of course there are a lot of factors surrounding the proper support of a webfarm - the switches, fail over between switches (don't let the switch be a single point-of-failure!), replication of content, synchronization of server changes, synchronization of application changes, etc, etc.. But a good system administrator (or experienced hosting company) can help address all of these issues for you.

Hopefully this has been a good introduction to webfarms for you, and hopefully I've properly communicated enough of the benefits for you to consider this as a hosting option for yourself. With the rates now down to affordable levels - why not get this additional layer of protection?

Happy hosting!

READ MORE
...