Draw Bezier and B-spline curve with HTML5 + Javascript

Draw Bezier and B-spline curve by HTML5 and Javascript

 

 

 

 

 

 

This is  a online tool for drawing Bezier and B-spline curve. Main technologies used in this tool are HTML5, Javascript and Paper.js which one is a great framework that runs on top of the HTML5 Canvas.

bsplineClick here  to lunch it now.

 

Posted in CG, HTML5, Javascript Tagged with: , , ,

Timeline of human evolution

Hall of Human Origins

3900 Ma


Prokaryotic Cell

Prokaryotic Cell

Prokaryotes Cell

This marks the first appearance of photosynthesis and therefore the first occurrence of large quantities of oxygen on the earth.

Prokaryotes are single-celled organisms that are the earliest and most primitive forms of life on earth. As organized in the Three Domain System, prokaryotes include bacteria and archaeans. Prokaryotes are able to live and thrive in various types of environments including extreme habitats such as hydrothermal vents, hot springs, swamps, wetlands, and the guts of animals.

Prokaryotic cells are not as complex as eukaryotic cells . They have no true nucleus as the DNA is not contained within a membrane or separated from the rest of the cell, but is coiled up in a region of the cytoplasm called the nucleoid. Using bacteria as our sample prokaryote, the following structures can be found in bacterial cells:

  • Capsule – Found in some bacterial cells, this additional outer covering protects the cell when it is engulfed by other organisms, assists in retaining moisture, and helps the cell adhere to surfaces and nutrients.
  • Cell Wall – Outer covering of most cells that protects the bacterial cell and gives it shape.
  • Cytoplasm – A gel-like substance composed mainly of water that also contains enzymes, salts, cell components, and various organic molecules.
  • Cell Membrane or Plasma Membrane – Surrounds the cell’s cytoplasm and regulates the flow of substances in and out of the cell.
  • Pili – Hair-like structures on the surface of the cell that attach to other bacterial cells. Shorter pili called fimbriae help bacteria attach to surfaces.
  • Flagella – Long, whip-like protrusion that aids in cellular locomotion.
  • Ribosomes – Cell structures responsible for protein production.
  • Plasmids – Gene carrying, circular DNA structures that are not involved in reproduction.
  • Nucleiod Region – Area of the cytoplasm that contains the single bacterial DNA molecule.

2500 Ma


 

First organisms to utilize oxygen

By 2400 Ma, in what is referred to as the Great Oxygenation Event, the pre-oxygen anaerobic forms of life were wiped out by the oxygen consumers.

 

2100 Ma


 

Eeukaryotesukaryotes

More complex cells appear.

A eukaryote is any organism whose cells contain a nucleus and other structures (organelles) enclosed within membranes. Eukaryotes are formally the taxon Eukarya or Eukaryota. The defining membrane-bound structure that sets eukaryotic cells apart from prokaryotic cells is the nucleus, enclosed by the nuclear envelope, which contains the genetic material. The presence of a nucleus gives eukaryotes their name, which comes from the Greek ευ (eu, “well”) and κάρυον (karyon, “nut” or “kernel”). Most eukaryotic cells also contain other membrane-bound organelles such as mitochondria or the Golgi apparatus. In addition, plants and algae contain chloroplasts. Many unicellular organisms are eukaryotes, such as protozoa. All multicellular organisms are eukaryotes, including animals, plants and fungi.

Cell division in eukaryotes is different from that in organisms without a nucleus (Prokaryote). There are two types of division processes. In mitosis, one cell divides to produce two genetically identical cells. In meiosis, which is required in sexual reproduction, one diploid cell (having two instances of each chromosome, one from each parent) undergoes recombination of each pair of parental chromosomes, and then two stages of cell division, resulting in four haploid cells (gametes). Each gamete has just one complement of chromosomes, each a unique mix of the corresponding pair of parental chromosomes.

The domain Eukaryota appears to be monophyletic, and so makes up one of the three domains of life. The two other domains, Bacteria and Archaea, are prokaryotes and have none of the above features. Eukaryotes represent a tiny minority of all living things; even in a human body there are 10 times more microbes than human cells. However, due to their much larger size, their collective worldwide biomass is estimated at about equal to that of prokaryotes. Eukaryotes first developed approximately 1.6–2.1 billion years ago.


1200 Ma


Sexual reproduction evolves, leading to faster evolution.

900 Ma


choanoflagellate

choanoflagellate

Choanoflagellates

The choanoflagellates are a group of free-living unicellular and colonial flagellate eukaryotes considered to be the closest living relatives of the animals. As the name suggests, choanoflagellates (collared flagellates) have a distinctive cell morphology characterized by an ovoid or spherical cell body 3–10 µm in diameter with a single apical flagellum surrounded by a collar of 30–40 microvilli. Movement of the flagellum creates water currents that can propel free-swimming choanoflagellates through the water column and trap bacteria and detritus against the collar of microvilli where these foodstuffs are engulfed. This feeding provides a critical link within the global carbon cycle, linking trophic levels. In addition to their critical ecological roles, choanoflagellates are of particular interest to evolutionary biologists studying the origins of multicellularity in animals. As the closest living relatives of animals, choanoflagellates serve as a useful model for reconstructions of the last unicellular ancestor of animals.

Each choanoflagellate has a single flagellum, surrounded by a ring of actin-filled protrusions called microvilli, forming a cylindrical or conical collar (choanos in Greek). Movement of the flagellum draws water through the collar, and bacteria and detritus are captured by the microvilli and ingested. Water currents generated by the flagellum also push free-swimming cells along, as in animal sperm. In contrast, most other flagellates are pulled by their flagella.

In addition to the single apical flagellum surrounded by actin-filled microvilli that characterizes choanoflagellates, the internal organization of organelles in the cytoplasm is constant. A flagellar basal body sits at the base of the apical flagellum, and a second, non-flagellar basal body rests at a right angle to the flagellar base. The nucleus occupies an apical-to-central position in the cell, and food vacuoles are positioned in the basal region of the cytoplasm. Additionally, the cell body of many choanoflagellates is surrounded by a distinguishing extracellular matrix or periplast. These cell coverings vary greatly in structure and composition and are used by taxonomists for classification purposes. Many choanoflagellates build complex basket-shaped “houses” called lorica, from several silica strips cemented together. The functional significance of the periplast is unknown, but in sessile organisms, it is thought to aid in attachment to the substrate. In planktonic organisms, there is speculation that the periplast increases drag, thereby counteracting the force generated by the flagellum and increasing feeding efficiency. Choanoflagellates are either free-swimming in the water column or sessile, adhering to the substrate directly or through either the periplast or a thin pedicel. Although choanoflagellates are thought to be strictly free-living and heterotrophic, a number of choanoflagellate relatives such as members of Ichthyosporea or Mesomycetozoa follow a parasitic or pathogenic lifestyle. The life histories of choanoflagellates are poorly understood. Many species are thought to be solitary; however coloniality seems to have arisen independently several times within the group and colonial species retain a solitary stage.

 

600 Ma


sponge

sponge

Sponge-like creature

It is thought that the earliest multicellular animal was a sponge-like creature.

Sponges are among the simplest of animals, with partially differentiated tissues.

Sponges (Porifera) are the phylogenetically oldest animal phylum extant today.

 

 

 

 

 

 

 

 

580 Ma


 

Cnidarians

Animal movement may have started with cnidarians. Almost all cnidarians possess nerves and muscles. Because they are the simplest animals to possess them, their direct ancestors were very probably the first animals to use nerves and muscles together. Cnidarians are also the first animals with an actual body of definite form and shape. They have radial symmetry. The first eyes evolved at this time.

 

 

Posted in Game

Algorithm in C# : Write a C# program to sort a array using Bubble Sort algorithm

banner_bubbles[1]

Bubble sort is one of the simplest sorting algorithm but if you ask anyone to implement on the spot it gives you an opportunity to gauge programming skills of a candidate.

Let us take the array of numbers “5 1 4 2 8”, and sort the array from lowest number to greatest number using bubble sort. In each step, elements written in bold are being compared. Three passes will be required.

 

First Pass:
5 1 4 2 8 ) \to ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 > 1.
( 1 5 4 2 8 ) \to ( 1 4 5 2 8 ), Swap since 5 > 4
( 1 4 5 2 8 ) \to ( 1 4 2 5 8 ), Swap since 5 > 2
( 1 4 2 5 8 ) \to ( 1 4 2 5 8 ), Now, since these elements are already in order (8 > 5), algorithm does not swap them.
Second Pass:
1 4 2 5 8 ) \to ( 1 4 2 5 8 )
( 1 4 2 5 8 ) \to ( 1 2 4 5 8 ), Swap since 4 > 2
( 1 2 4 5 8 ) \to ( 1 2 4 5 8 )
( 1 2 4 5 8 ) \to ( 1 2 4 5 8 )
Now, the array is already sorted, but our algorithm does not know if it is completed. The algorithm needs one whole pass without any swap to know it is sorted.
Third Pass:
1 2 4 5 8 ) \to ( 1 2 4 5 8 )
( 1 2 4 5 8 ) \to ( 1 2 4 5 8 )
( 1 2 4 5 8 ) \to ( 1 2 4 5 8 )
( 1 2 4 5 8 ) \to ( 1 2 4 5 8 )

 

 

Posted in Algorithm, C# Tagged with: ,

Algorithm in C# : How to reverse String

hellowworld

This is one of my favorite question. Since String is one of the most important type in programming, you expect lot of question related to String any data structure interview. There are many ways to reverse Sting in C# or any other programming language, and interviewer will force you to solve this problem by using without API i.e. without using reverse() method of StringBuffer. In follow-up he may ask to reverse String using recursion as well.

string-reverse[1]

 

 

 

 

Posted in Algorithm, C# Tagged with: ,

Algorithm in C# : In an integer array, there is 1 to 100 number, out of one is duplicate, how to find?

number array

This is a rather simple data structures question, especially for this kind of. In this case you can simply add all numbers stored in array, and total sum should be equal to n(n+1)/2. Now just subtract actual sum to expected sum, and that is your duplicate number. Of course there is a brute force way of checking each number against all other numbers, but that will result in performance of O(n^2) which is not good. By the way this trick will not work if array have multiple duplicates or its not numbers forming arithmetic progression. 

Method 1:

Method 2:

 

Posted in Algorithm, C# Tagged with: ,

Algorithm in C# : How to find 3rd element from end in a linked list in one pass?

ironchain

This is another frequently asked linked list interview question. This question is exactly similar to finding middle element of linked list in single passIf we apply same trick of maintaining two pointers and increment other pointer, when first has moved upto 3rd element, than when first pointer reaches to the end of linked list, second pointer will be pointing to the 3rd element from last in a linked list.

 

 

Posted in Algorithm, C# Tagged with: ,

Algorithm in C# : How to find if linked list has loop ?

linkedlist

This question has bit of similarity with earlier algorithm and data structure interview question. I mean we can use two pointer approach to solve this problem. If we maintain two pointers, and we increment one pointer after processing two nodes and other after processing every node, we are likely to find a situation where both the pointers will be pointing to same node. This will only happen if linked list has loop.

 

 

Posted in Algorithm, C# Tagged with: ,

Algorithm in C# : How to find middle element of linked list in one pass?

linkedlist

One of the most popular question from data structures and algorithm, mostly asked on telephonic interview. Since many programmer know that, in order to find length of linked list we need to first traverse through linked list till we find last node, which is pointing to null, and then in second pass we can find middle element by traversing only half of length. They get confused when interviewer ask him to do same job in one pass. In order to find middle element of linked list in one pass you need to maintain two pointer, one increment at each node while other increments after two nodes at a time, by having this arrangement, when first pointer reaches end, second pointer will point to middle element of linked list.

Below is the structure of linked list

gdprZ[1]

To solve this problem with C#, first we need to make a linked list.

Define a simple class which has three attributes: Name, Pre and Next, Name is only for identifying, the Pre and Next point to its previous and next item.

 

 

Posted in Algorithm, C# Tagged with: ,

A Localization Approach With Json Data for .NET Application

Globalization-Localization-banner

There are two approaches in localization implement in .NET development, the traditional one is using resource file, another one is based on database.

The technique of using resource to solve localization problem is very mature, it can be easily implemented by developer by using resource manager, but its maintainability is weakness, although the resource file is based on xml structure, but it is flat, no more structure meaning, and also can not find a good editor except MS Visual Studio.

For big, frequent update and complicated system, database is  better choice for localization data storage, and it’s necessary to have a powerful administration tool for localization data CRUD operation.

Json data is being more and more populate in vairious project development, and the conversion between Json and object also become convenient, the Newtonsoft.Json is a great solution for using Json data on .NET platform.

Is it possible to use json data for localization in .NET application?

The answer is positive. By using Newtonsoft.Json we can make the localization data more clean and structured, and the localization data can be edited by any text editor easily.

Let’s start with an example which is a simple APS.NET page.

1. Create a new text file with name “en.json” in /resources/ folder.

2. Define the Json data structure and localization content in en.json file.

We can define the Json structure as we want,  even more levels in data organizing  if we like.

3. Use Newtonsoft.Json to parse the Json file into object.

4. Show localization text in front page.

 

Posted in ASP.NET, C# Tagged with: ,

Notepad++ Keyboard Shortcuts

Notepad++6.1.1+Free+Download[1]

Posted in Uncategorized Tagged with: