Awesome Content Curation Tools

Have you been ever stuck finding the most accurate content related to your search criteria? Do you think content should be compiled in a way that enables you to find the right piece of information over internet without having to waste time reading the unwanted information? Yes, Content Curation is the answer to your query. This enables you to swim across the ocean of websites over internet and reach the right direction via filtering online content based on the subject of information. This is usually inform of status updates, tweets, articles and more. Listed here are some great Content Curation tools that might come handy for you anytime anywhere.

content-dictionary1. Digg

Sharing news of interest within your own community is all about Digg. This social networking platform allows you to share content with a specific group who can then rank your content value In this process, the higher the rate or ranking of your content, greater are the views you receive. This results in increased clicks or higher site traffic. For instance, as an e-commerce related content, your information will fall under either business or technology. And if you happen to chose a different and specific classification for your content, undoubtedly you would increase your site’s relevance as a tool for social media.

2. Equentia

Reaching your target audience and influencing your prospects and current clients with all the information that is useful and engaging is all synonymous to Equentia. You can dig the most relevant information and flesh out the most crisp and pertinent content as per your requirement. Equentia also helps you socialize the same content by allowing you to re-publish or use it privately.

3. Technorati

The world of internet is full of bloggers and Technorati is their friend. It is a blog search engine to serve as a content purifier. It is a directory that scans and indexes content from over a million blogs. Technorati was founded in 2002 and was the first among social networking platforms like Facebook and Twitter. In case you are the one who wants to be included in Technorati’s information bank, you will have to create an account and submit the blog’s website address. You can create a personal profile and use this tool to ignite the social media. It helps you to become critical and relevant amongst your readership.

Conclusion

Remember you should exploit the content curation tools to benefit you directly. The ideal curation solution can be achieved when you actually index your information into your private CMS. This way your traffic is not diverted to a third party site however your searchers stay and view your own site. There are more tools like Sphinn, BizSugar, PaperLi among many more who can help you get organized on this online bank of information. You need to find the most appropriate way to filter information to suit your needs in your own special way. Share socially for increased social capital.

Snow Theme Website design with Photoshop

Get your Photoshop on and follow this step by step tutorial of building a snowboarding themed website layout. The design we’ll be creating takes inspiration from the typical style of the snowboarding culture, with grungy textures and distressed brush marks adding detail to the design. We’ll start by producing a core grid to base the design elements on, then use a mix of photography and Photoshop manipulation to create a concept web design for a fictional brand named ‘Snow Candy’.

 

Snowboard themed website design

Ideas, Research and Sketches

A good place to start any design project is in your sketchbook. Before opening up Photoshop, I took the time to jot down some keywords and create a brand persona for Snow Candy. The website would aim to present a few key elements of information such as upcoming events, latest video and focus areas that could send the user deeper into the website. I then sketched out a potential layout that balanced out the page elements, and outlined my idea of using a large header graphic to catch and draw in the viewer’s attention.

Creating an underlying grid

Using a grid to base your design on is one of the core design principles that helps bring out balance and cohesion in your designs. This particular design is based on a simple 12 column layout making up a total width of 970px, and a uses a baseline of 24px;

A useful tool for generating a grid for your design is the Grid System Generator, where you can create a template and steal the handy pink column graphic to paste it into Photoshop! To create a baseline, create a 24x24px document in Photoshop, and draw a single pixel line across the bottom. Go to Edit > Define Pattern, then in your main document fill a black layer with this pattern to give a baseline template to set your text and page items to.

Let’s shred the gnar!

With the page template ready to rock, let’s get on with some creative Photoshop work. Start by filling the background with a light blue (#b9d2f8), then add a gradient spanning from a dark blue (#02357a) at the top through to a mid blue (#295ba6) then blending out to the #b9d2f8 background colour.

Head over to Bittbox and download one of the awesome noir grunge textures. Paste the texture into the document and scale down in size. Also change the blending mode to Luminosity and drop the opacity to 25%.

Add a layer mask to the texture, then use a large soft brush to blend out the texture so that it spans from the top center of the document. Black paint renders the area invisible while white represents the visible portions of the mask.

With Snow Candy being a fictional brand, we can quickly throw together a cool logo that fits into the overall style we’re aiming for. Download the flowing Black Rose font and set out the words in lower case. Remember to make the most of your grid by scaling and positioning the logo in relation to the columns and baseline.

Rough up the logo a little by adding a layer mask and brushing over it with some grungy Photoshop brushes. I’m using my paint stroke brushes that are available for download from Blog.SpoonGraphics. Set the opacity of the brush to 10% then slowly build up the layers of distress.

To draw focus to the logo add a soft and subtle drop shadow, then draw a white radial gradient on a new layer. Set the layer style to Overlay and move into position behind the logo. Once in place tone down the effect by dropping the opacity to 50%.

Type out a simple navigation list to the right of the logo, following on the same baseline. Use a widely available font such as Helvetica or Arial to allow the text to be rendered in HTML when coded up for real.

Create a visual clue to highlight the active menu item by adding a small brush stroke in white behind the navigation text. Reduce the opacity to keep the white text legible.

Draw a large content area that spans the whole 970px width and fill with white.

Reduce the opacity of the content area to 30%, and add a very subtle drop shadow. Alter the distance and spread to 0px, while setting the size to 10px. Drop the opacity down to 25% to maintain a subtle shading effect.

One of the main features of the design is a large heading that holds a Snowboarding action shot. This area could be used as a rotating slideshow of featured content on the final website build, but for now, we’ll just mockup one of these features. Paste in, rotate and scale a photograph. This particular shot can be found on SXC.

Add some design tweaks to the shot by dabbing some vibrant spots of colour over the image. Choose a bright pink, blue and yellow and paint them onto a layer above the photograph.

Set this colour layer to Overlay and set the opacity to 35%. The result is a subtle colour shift that spices up the photograph.

Use a range of Photoshop brushes to draw a rough border around the shot. Paint the brush marks in black, then change the blending mode to Overlay to allow the colours to interact.

Painting brush strokes on a couple of layers will also allow each layer to overlap, creating more depth and interest as different levels of transparency appear.

Next, we’ll create a creative typographic layout for some event details. Here I’m manipulating the text in Illustrator for ease, but there’s no real reason to move out of Photoshop. Use guides to aid the alignment of all the words.

A few snowboading vector graphics can be sourced from FreeVectors.net that help add the finishing touches to the styling of the event information.

Paste the text into the main web design document and scale into place. Position the words between the columns and lay it perfectly on the baseline grid.

Underneath this main feauture header the secondary content can appear. Use headers to create clear visual anchors to attract the eye and give immediate regonition of the content. Manipulate the text with tight tracking and lowercase appearance, and draw some small icons with the pencil and eraser tools to back up the wording with a visual clue.

A mockup of the featured video can be created with another Snowboarding action shot. Add a grungey border using the rough Photoshop brushes.

On a new layer, draw a circular mask and fill with black. Draw a triangle using the Polygonal Lasso Tool to represent the play icon, then delete this shape out of the circle. Drop the opacity to allow the video content to show through.

To the right of the video will be a short list of upcoming events. Write out the title and back this up with an icon. Zoom right in to adjust the finest details of the icon.

Set out the event information with style. Use a range of font sizes to create a hierarchy of importance.

When laying out the content, especially the text, remember to base everything on the baseline grid. With our baseline being 24px, use a line height of 24px on all paragraphs. Finish off the content area with the desired number of elements, and end each section with an anchor that links through to deeper levels of the website.

Below this content, we’ll lay out some elements that span the width of both columns. Lay out some portrait shots to build up the Meet the Team section. Add a small white stroke and subtle drop shadow to give the appearance of a tactile photographs.

Rotate each portrait shot to give the impression of a collection of photographs that have been roughly placed on the page.

Continue the casual theme of the design by typing out the names of each team member in a hand-drawn font.

To finish off the design, copy a selection of the texture used in the header area. Move it into position behind the lower portion of the content panel.

Alter the layer style and opacity to tone down the effect and blend the colours toghether, then use a layer mask to allow the texture to peek out from the center of the panel.

Snowboard themed website design

The visual concept is complete! The blue colour scheme helps tap into the coolness of the snowboarding scene, while the mix of textures and distressed brush strokes add some gnarliness that relates well to the culture and lifestyle of extreme sports in general.

Surreal, Abstract, Metallic Text Effect

With this tutorial, we will show you how to create a unique, Surreal and Abstract Text Effect with Metal Texture in Photoshop, step by step. This tutorial involves some steps which are a little tricky, but then, who said Photoshop was easy! ;)

The objective of this tutorial is to show how can you manipulate texture/stock image with layer masks and blending options to create an eye candy with special effect. Also we will show you how to use adjustment layer to add colours in the end.

Required Resources:

Step 1

Create a new document sized 800px * 1040px with black background. Create a new layer and use the space brush to paint a background pattern, compress it down and set some perspective to it as shown below:

1 persp1 500x676 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Create a new layer and further add some space pattern, reduce the layer opacity to around 80% and use a soft eraser to erase the centre portion as shown below:

Hint: by performing the above two things, we added some depth to the image and get ready for adding the text in the following step.

1 paint1 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Let’s add some simple light effect – create a new layer and use a big white brush to paint a dot light as shown below:

1 paint light 500x414 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Use a soft eraser with smaller brush size than the dot light, erase the top right part of the dot as shown below:

1 erase2 500x359 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Duplicate this layer and rotate the duplicated layer 180 degrees, you will have the following effect:

1 effect1 500x656 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Step 2

We can now work on the letter. Type a letter on the centre of the canvas, as shown below:

2 type1 500x633 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Load the “metal texture 1″ image into Photoshop. Then load this text layer selection and move it to the metal texture, copy and paste it back onto our text:

2 sel2 500x344 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Turn off the original text layer, and you will have the following effect:

2 paste2 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Open up the liquify filter, grab the forward warping tool and make sure you enable “Show Backdrop” and use the following setting: (this will make the background visible, easier to apply the liquify effect)

2 liquid sest Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Go crazy with the liquify tool, add some flowing effect around the text edges as shown below:

2 liq 500x595 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Then erase the following area with the a soft eraser:

2 erase Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Step 3

We can now apply some adjustments layers on the metal texture as clipping mask:

Black and White

3 bw2 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Levels

3 lv Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Curves

3 curves Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Then use the Lasso Tool with 30px feather, draw a selection on the following area:

3 sel 500x370 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Then add another Levels adjustment layer as clipping mask: (this will darken the Lasso Selection)

3 levels Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Render or paint some cloud (with cloud or smoke brush, plenty of them on the internet) around the text to add dramatic effect:

3 cloud 500x583 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Step 4

We can now add some small metal particles into the image – load the “metal texture 2″ image into Photoshop and use the quick selection tool to select a few small pieces on the image:

4 quick sel 500x348 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Copy and paste the selection onto our document, erase the edges to blend those small pieces into the main text:

4 erase1 500x346 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Duplicate the selection a few times, attach them to different parts of the text, as shown below:

4 dup 500x532 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Merge the duplicated layers and apply the following black and white adjustments to it:

4 bw1 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

and here is the effect so far:

4 effect2 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

You can also further duplicate this metal texture layer a few more times, resize them to small scale and move them around the text, as shown below:

4 small part 500x618 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Step 5

To add some extra effect, I decided to use the Pen Tool to draw some red lines around the text. So let’s use the Pen Tool to draw a work path as shown below:

5 draw path 500x431 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Prior to stroking the path, go to the brush panel and set the brush size to 3px, hardness 95%, red colour as shown below:

5 colour 500x397 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Then go back to select the Pen Tool, right-click and choose “Stroke Path”:

5 stroke 500x389 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Stroke this path with the following settings:

5 stroke brush 500x272 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

and you will have the following effect:

5 effect1 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Duplicate this line layer a few more times and resize each duplicated layer and rotate them, attach the lines to different part of the text:

5 effect 2 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

You can also mix some yellow lines via adjusting the Colour Hue, in order to add some variety on the text:

5 yellow 500x255 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Step 6

OK we’re almost done! For some final retouches, we can flatten the image and apply the following Smart Sharpen filter to the image to sharpen the text a bit:

6 smart sha 500x317 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

To add some colour effect to image, I apply the following image adjustment layers to the image:

Selective Color

6 sel red Design Abstract Surreal Text Effect with Metal Texture in Photoshop

6 sel white Design Abstract Surreal Text Effect with Metal Texture in Photoshop

6 sel neu Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Curves

6 curves Design Abstract Surreal Text Effect with Metal Texture in Photoshop

Brightness and Contrast

6 bc Design Abstract Surreal Text Effect with Metal Texture in Photoshop

I then further added some slight colour adjustment and here is the final effect I have: (click to enlarge)

metal text flatten 500x650 Design Abstract Surreal Text Effect with Metal Texture in Photoshop

That’s it for this tutorial! Hope you enjoy it and find it useful! Don’t forget to share!

Better Photography with your iPhone

Nowadays, Apple’s iPhone is considered as one of the most popular smartphone. More than its sleek, elegant design, smartphone users choose the iPhone because of its functionality. One of the best features of the iPhone is its ability to take quality photos and videos. In this article, we will tackle 13 tips that will enhance the quality of photos taken from your iPhone.

Iphone Photography1. Clean the Lens

People would commonly put their iPhones inside their bags or pockets. So, before taking any photos make sure that the lens of your camera is clear from any traces of dusts and fingerprints. Having a lens covered with dusts and fingerprints will affect the clarity and over-all quality of your photos.

2. Adjust the Settings According to Your Preference

Always remember that your iPhone already has built-in settings and modes that can aid you in taking pictures that will turn-out to be just the way you like them to be taken. Read the manual and maximize the use of your iPhone camera’s built-in features.

Iphone stand3. Try to Find an iPhone Stand

Keep in mind that it takes a few seconds for the iPhone to process shots into photos. If your hands are having a difficult time in staying still at a certain position position for around ten seconds, it is highly advisable for you to use an iPhone stand when taking photos. This will prevent your pictures from looking blurry because of slight hand movements while waiting for your shot to be processed.

4. Learn When to Use Flash

It is not wise to always activate your camera’s flash. There are only particular situations wherein taking shots with an enabled flash is advisable. Only turn on the flash when taking photos in broad daylight and utter darkness. Don’t use flash when taking photos of people, glasses, still objects, and events.

5. Refrain from Using the Zoom Function

If you want to take a good shot of something, move as close to it as you can before taking a shot. Don’t settle with taking a shot at a far distance by utilizing the zoom function because this will greatly compromise the quality of your photo by making it look grainy.

instagram6. Take Advantage of Apps

Oftentimes, the iPhone’s built-in features have limitations; but don’t fret, because the downloadable apps can make up for their insufficiencies. For instance, the TrueHDR is a good complement to the HDR feature of the iPhone.

7. The Rule of Thirds

The Rule of Thirds is one of the most basic techniques in photography. Luckily, the iPhone has a built-in function – the Grid Option – to help you take better shots. Once you have enabled the option, simply position your subject along the lines for maximum results.

8. Use HDR

Another great built-in feature of the iPhone is the HDR or High Dynamic Range. This feature allows you to take high-quality photos by putting together three photos taken in different modes into a singular picture with just one shot.

9.Position Your Subject

Every photo has a subject. As the photographer, it is up to you on how you wish to portray the subject in your photo. Experiment with different angles and position your subject properly to capture the best shot possible.

10. Find Good Lighting

Regardless of the technology that you are using for taking photos, lightning is an essential aspect of photography that must never be forgotten. Make sure that when taking photos with your iPhone, you have sufficient light to enable you to capture a visible subject. For best results, take photos with your iPhone when outdoors where sunlight is present.

iphone lens11. Buy Extra Lenses

If you are really serious with taking exceptional photos with your iPhone, it is highly encouraged that you buy magnetic wide lenses that can be attached to your iPhone. These lenses will help you take better quality shots and help you overcome the limitations of your iPhone’s built-in lenses.

12. Edit Your Photos

To enhance the pictures you have taken, you may want to edit your photos. Using available apps or any photo-editing software, you may enhance a photo by changing the color, tone, lighting, resolution, and many more.

13. It is a Camera: Treat it Like One

Your iPhone camera is not much different from the traditional camera you have always known. Therefore, treat it like one buy holding it as if you are holding a camera. Use your two hands and hold it firmly.

The iPhone in itself already has the capacity to take great photos. Follow the aforementioned tips and you are well on your way to become a professional photographer by simply using the camera of your iPhone.

QuickSort algorithm, code for Java, C++

Quicksort is a fast sorting algorithm, which is used not only for educational purposes, but widely applied in practice. On the average, it has O(n log n) complexity, making quicksort suitable for sorting big data volumes. The idea of the algorithm is quite simple and once you realize it, you can write quicksort as fast as bubble sort.

Algorithm

The divide-and-conquer strategy is used in quicksort. Below the recursion step is described:

  1. Choose a pivot value. We take the value of the middle element as pivot value, but it can be any value, which is in range of sorted values, even if it doesn’t present in the array.
  2. Partition. Rearrange elements in such a way, that all elements which are lesser than the pivot go to the left part of the array and all elements greater than the pivot, go to the right part of the array. Values equal to the pivot can stay in any part of the array. Notice, that array may be divided in non-equal parts.
  3. Sort both parts. Apply quicksort algorithm recursively to the left and the right parts.

Partition algorithm in detail

There are two indices i and j and at the very beginning of the partition algorithm i points to the first element in the array andj points to the last one. Then algorithm moves i forward, until an element with value greater or equal to the pivot is found. Index j is moved backward, until an element with value lesser or equal to the pivot is found. If i ≤ j then they are swapped and i steps to the next position (i + 1), j steps to the previous one (j – 1). Algorithm stops, when i becomes greater than j.

After partition, all values before i-th element are less or equal than the pivot and all values after j-th element are greater or equal to the pivot.

Example. Sort {1, 12, 5, 26, 7, 14, 3, 7, 2} using quicksort.

Quick Sort at Work


N
otice, that we show here only the first recursion step, in order not to make example too long. But, in fact, {1, 2, 5, 7, 3} and {14, 7, 26, 12} are sorted then recursively.

Why does it work?

On the partition step algorithm divides the array into two parts and every element a from the left part is less or equal than every element b from the right part. Also a and b satisfy a ≤ pivot ≤ b inequality. After completion of the recursion calls both of the parts become sorted and, taking into account arguments stated above, the whole array is sorted.

Complexity analysis

On the average quicksort has O(n log n) complexity, but strong proof of this fact is not trivial and not presented here. In worst case, quicksort runs O(n2) time, but on the most “practical” data it works just fine and outperforms other O(n log n) sorting algorithms.

Code snippets

Partition algorithm is important per se, therefore it may be carried out as a separate function. The code for C++ contains solid function for quicksort, but Java code contains two separate functions for partition and sort, accordingly.
JAVA

C/C++

Graphics in Turbo C/C++

Turbo C has a good collection of graphics libraries. If you know the basics of C, you can easily learn graphics programming. To start programming, let us write a small program that displays a circle on the screen.

    To run this program, you need graphics.h header file, graphics.lib library file and Graphics driver (BGI file) in the program folder. These files are part of Turbo C package. In all our programs we used 640×480 VGA monitor. So all the programs are according to that specification. You need to make necessary changes to your programs according to your screen resolution. For VGA monitor, graphics driver used is EGA.BGI or VGA.BGI.

Here, initgraph() function initializes the graphics mode and clears the screen. We will study the difference between text mode and graphics mode in detail latter.

InitGraph:
Initializes the graphics system.Declaration:
void far initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver);Remarks: To start the graphics system, you must first call initgraph.

initgraph initializes the graphics system by loading a graphics driver from disk (or validating a registered driver) then putting the system into graphics mode.

initgraph also resets all graphics settings (color, palette, current position, viewport, etc.) to their defaults, then resets graphresult to 0.
Arguments:

*graphdriver: Integer that specifies the graphics driver to be used. You can give graphdriver a value using a constant of the graphics drivers enumeration type.

*graphmode : Integer that specifies the initial graphics mode (unless *graphdriver = DETECT). If *graphdriver = DETECT, initgraph sets *graphmode to the highest resolution available for the detected driver. You can give *graphmode a value using a constant of the graphics_modes enumeration type.

pathtodriver : Specifies the directory path where initgraph looks for graphics drivers (*.BGI) first.  If they’re not there, initgraph looks in the current directory.  If pathtodriver is null, the driver files must be in the current directory.  This is also the path settextstyle searches for the stroked character font files (*.CHR).

closegraph() function switches back the screen from graphcs mode to text mode. It clears the screen also. A graphics program should have a closegraph function at the end of graphics. Otherwise DOS screen will not go to text mode after running the program. Here, closegraph() is called after getch() since screen should not clear until user hits a key.

If you have the BGI file in the same folder of your program, you can just leave it as “” only. you need not mention *graphmode if you give *graphdriver as DETECT.

In graphics mode, all the screen co-ordinates are mentioned in terms of pixels. Number of pixels in the screen decides resolution of the screen. In the example 1.0,  circle is drawn with x-coordinate of the center 200, y-coordinate 100 and radius 150 pixels. All the coordinates are mentioned with respect to top-left corner of the screen.

Basic Shapes and Colors:

Now let us write a program to draw some basic shapes.

 

Here is the screenshot of output:

Here, circle() function takes x, y coordinates of the circle with respect to left top of the screen and radius of the circle in terms of pixels as arguments. Note that, in graphics, almost all the screen parameters are measured in terms of pixels.

Function outtextxy() displays a string in graphical mode. You can use different fonts, text sizes, alignments, colors and directions of the text that we will study later. Parameters passed are x and y coordinates of the position on the screen where text is to be displayed. There is another function outtext() that displayes a text in the current position. Current position is the place where last drawing is ended. These functions are declared as follows:

void far outtextxy(int x, int y, char *text);
void far outtext(char *text);

Circle, arc, pieslice are declared as follows:

Declaration:

  •  void far arc(int x, int y, int stangle, int endangle, int radius);
  •  void far circle(int x, int y, int radius);
  •  void far pieslice(int x, int y, int stangle, int endangle, int radius);

Remarks:

  • arc draws a circular arc in the current drawing color.
  • circle draws a circle in the current drawing color.
  • pieslice draws a pie slice in the current drawing color, then fills it using
    the current fill pattern and fill color.

Arguments:

  • (x,y): Center point of arc, circlew, or pie slice
  • stangle: Start angle in degrees
  • endangle: End angle in degrees
  • radius: Radius of arc, circle, and pieslice

Here, stangle and endangle are in degrees starting from the +ve x-axis in the polar coordinate system in the anti-clockwise direction. if stangle is 0, endangle is 360, it will draw a full circle. Refer this figure for clear idea: For the details of current color, fill color and fill patterns, refer the sections Lines and Colors.

Another basic shape that we come across is a rectangle. To draw a border, use rectangle with the coordinates of outline, to draw a square use rectangle with same height and width. drawpoly() and fillpoly() are two functions useful to draw any polygons. To use these functions, store the coordinates of the shape in an array and pass the address of array as an argument to the function. By looking at the output of the previous program, you can understand what drawpoly is. fillpoly is similar except that it fills in the shape with current fill color.

Declaration:

  • void far rectangle(int left, int top, int right, int bottom);
  • void far drawpoly(int numpoints, int far *polypoints);
  • void far fillpoly(int numpoints, int far *polypoints);

Remarks:

  • rectangle draws a rectangle in the current line style, thickness, and drawing color.
  • drawpoly draws a polygon using the current line style and color.
  • fillpoly draws the outline of a polygon using the current line style and color, then fills the polygon using the current fill pattern and fill color.

Arguments: 

  • (left,top) is the upper left corner of the rectangle, and (right,bottom) is its lower right corner.
  •  numpoints:  Specifies number of points
  • *polypoints: Points to a sequence of (numpoints x 2) integers. Each pair of integers gives the x and y coordinates of a point on the polygon.

To draw a closed polygon with N points, numpoints should be N+1 and the array polypoints[] should contain 2(N+1) integers with first 2 integers equal to last 2 integers.

Let us study more about shapes latter. Here is some idea about colors. There are 16 colors declared in graphics.h as listed bellow.

BLACK:                  0
BLUE:                     1
GREEN:                  2
CYAN:                       3
RED:                          4
MAGENTA:              5
BROWN:                   6
LIGHTGRAY:           7
DARKGRAY:            8
LIGHTBLUE:            9
LIGHTGREEN:        10
LIGHTCYAN:          11
LIGHTRED:             12
LIGHTMAGENTA: 13
YELLOW:                14
WHITE:                    15

To use these colors, use functions setcolor(), setbkcolor() and setfillstyle(). setcolor() function sets the current drawing color. If we use setcolor(RED); and draw any shape, line or text after that, the drawing will be in red color. You can either use color as defined above or number like setcolor(4);. setbkcolor() sets background color for drawing. Setfillstyle sets fill pattern and fill colors. After calling setfillstyle, if we use functions like floodfill, fillpoly, bar etc, shpes will be filled with fill color and pattern set using setfillstyle. These function declarations are as follows.

Declaration:

  •  void far setfillstyle(int pattern, int color);
  • void far setcolor(int color);
  • void far setbkcolor(int color);

Remarks:

  • setfillstyle sets the current fill pattern and fill color.
  • setcolor sets the current drawing color to color, which can range from 0 to getmaxcolor.
  • setbkcolor sets the background to the color specified by color.

The parameter pattern in setfillstyle is as follows:

 Names Value Means  Fill With…
EMPTY_FILL 0 Background color
SOLID_FILL 1 Solid fill
LINE_FILL 2
LTSLASH_FILL 3 ///
SLASH_FILL 4 ///, thick lines
BKSLASH_FILL 5 \\\, thick lines
LTBKSLASH_FILL 6  \\\
HATCH_FILL 7 Light hatch
XHATCH_FILL 8 Heavy crosshatch
INTERLEAVE_FILL 9 Interleaving lines
WIDE_DOT_FILL 10 Widely spaced dots
CLOSE_DOT_FILL 11 Closely spaced dots
USER_FILL 12 User-defined fill pattern

Here is an example program with colors, pixels, bar, cleardevice etc. stdlib.h is used for random number generation. We have a function random(no), it returns a random number between 0 an no. The effect is by drawing random radius, random color circles with same center and random pixels. kbhit() function(defined in conio.h) returns a nonzero value when a key is pressed in the keyboard. So, the loop will continue until a key is pressed.

Thank you for reading!

Make Content look Impactful with different Web Design Techniques

One of the unanimous truths of the web world is that content is the king. However, in order to present this content in the best possible manner, it is important to implement contemporary web designs in the website. A content marketing strategy is incomplete without powerful web design as the World Wide Web is full of information and a website can scores good only if the relevant information is portrayed in unique pattern. Even professional web content writers can’t deny the fact that website designing forms an integral part of content marketing. Mentioned below are the famous website designing trends that compliment content marketing strategies, have a look.

Implementation of Responsive Website Design

The present day generation has shifted from PCs to tablets and Smartphones and thus it is important that a website adjusts its dimensions as per different devices. With Responsive Website Design, one can create a web portal that fits well in all devices. This helps the website in enhancing its reach to the targeted market. The increasing use of tabs and Smartphones for browsing internet has led to the popularity of responsive design. If a website fails to fit in the gadget of the prospects, they take half a minute to switch to another portal.

Conveying Message via Embedded Videos

Embedded videos are one of the latest web design trends prevailing in the cyber space. Visitors today want everything quickly; they don’t have time to go through the entire text and there comes the role of videos. Videos are interactive and conveying information via this medium is best for getting a hold on the visitor’s attention.

The Magic of Special Effects

As mentioned before, it’s all about presenting the information in a unique pattern and what can be better than a pinch of special effects. The best part is that with the emergence of CSS3 and HTML5, it has become easy to embellish the website with feature of visual effects. Lightbox, slideshows and interactive buttons are a few effects that can be implemented to enhance the content marketing strategy of a web portal.

Use of Minimalist and User-friendly Design

One can avail custom web design services for incorporating minimalist and user friendly outlook for the website. Yes special effects and videos do leave an impact on the viewers, but the more professional the content looks the more prospects turn into leads. One live example of minimalist and user friendly design is Tumbler. It’s simple, it’s professional and thus attracts maximum amount of targeted audience.

Increasing the Role of Social Media Integration

The rising popularity of social media is not hidden from anyone. Social media is one of the biggest players of internet marketing and therefore it is important to use it wisely. The use of share buttons is not new; it’s just that with the spinning wheel of time its use is increasing.

This makes it crystal clear that getting proper website design is as important as availing professional web content writing services. Irrespective of the device on which the user is browsing a website, he always wants a beautifully laid down content to please his eyes and comfort his knowledge hunger. With these new emerging wed designs, it will become easy for the websites to serve exactly what their visitors expect from them.

Finding the Right License Scheme for your Software

Software companies rely on license fees for their revenues. A number of different licensing schemes are available and each type has its advantages. The exact choice of licence scheme will depend on the target user and their way of deriving utility from the software. Below, you will find a detailed explanation of six types of license schemes. As a producer or consumer, knowledge of these different forms will assist you to choose what is right for your personal or organizational use.software licence

1. License by user
License by user infers that only one person has authorization to use the particular software. The user may use different devices but no other user is allowed to use the same software. If there are many employees in an organization, everyone has to get their own license. License per user works well with web-based software that does not tie a user to a particular physical location.

2. License by installation
This is different from the license by user because it does not restrict the number of users that can use the software. Instead, it restricts the usage of the software to only one device. If the software installation happens on a laptop or a tablet and the licensing also happens for that device, then any person who accesses the device will be able to use the software. Sellers prefer this license model when they expect very little mobility of the user and the software. The scheme works best for software bought for personal use.

3. License by client
When the software deployment takes place in a server environment where there are many server-clients, sellers may opt to licence by client. In this case, all devices that connect to the server to use the software will need a license. In addition, it is common for sellers to issue a license for the server that clients connect to, in the organization.

4. No license fees
Sometimes software can arise out of a voluntary effort and the creators may not have an inclination to earn from their work. In other cases, companies choose to not to sell their software license in the hope that, they will recoup their production costs when they provide paid support. Most open source software use a no license fees scheme.

5. Licence by developer
Just as some businesses only deal with other businesses, some software only works by assisting other software developers to create solutions for their customers. Development tools and libraries are critical software development components. The person using these tools may be compelled to acquire a developer license; however, the resulting software sold to end users will not be part of the license by developer.

6. License by site
Sometimes an organization has many employees with a high staff turnover. It does not make economic sense to buy every staff a user license. In addition, some employees might be working remotely and therefore need more than the license by installation, since they use more than one device. Such organizations and businesses can opt to acquire site licenses if the software seller offers them. The license by site allows anyone within the unit that qualifies as the site, to use the software. In most cases site can mean a physical local or an organization. For example, with organization as the site, the license may allow everyone who is an employee to access to the software irrespective of his or her location.

The exact limits of the rights of usage given by a specific license will always depend on the license scheme used. By following the description of each license scheme listed above you will be in a good position to select what will work best for your organization. The right license affords you the support that you need to keep your devices and organization secure. For sellers, choosing the right license scheme gives you the right options of marketing your software to clients.

Levenshtein Distance Algorithm with C++

Those with some courses or computer classes may understand better. For example,

  • If source string is “transform” and the target string is “transcend”, then the distance is 4 because the last four letters “form” will each be substituted respectively with “cend”.
  • If one string is “string” and other is “song”, then distance is 3 (I replacement, 2 deletions)
  • If one string is “gotcha” and other is also “gotcha”, this distance is zero because no transformations are needed. The strings are already identical.

The greater the Levenshtein distance, the more distinct the strings are.

Levenshtein distance is named on its inventor, the Russian scientist Vladimir Levenshtein, who devised the algorithm in 1965. The property is also called edit distance sometimes.

The Levenshtein distance algorithm is widely used for:

  • Spelling check
  • DNA analysis (surprised??)
  • Plagiarism detection (You may hate it or love it ;) )
  • Speech recognition

The Algorithm Steps

Step Description
1 Set n to be the source string with a length equal to s
Set m to be the target string with a length equal to t
If n = 0, return m.
If m = 0, return n.
Initialize a matrix with 0..m rows and 0..n columns.
2 Let the first row elements be equal to 0,1,…,n (in order)
Similarly assign the first column to 0,1,…,m
3 Loop through each character of s (i from 1 to n).
4 In a sub-loop, iterate each character of t (j from 1 to m).
5 If s[i] and t[j] are equal, the cost is 0.
If s[i] doesn’t equate to t[j], the cost is 1.
6 Assign to cell d[i,j] of the matrix to be equal to the minimum of:
a. The value of field immediately above, plus 1: d[i-1,j] + 1.
b. The value of field immediately to the left plus 1: d[i,j-1] + 1.
c. The value of field diagonally above and to the left plus the cost: d[i-1,j-1] + cost.
7 After the processing steps (3, 4, 5, 6) are complete, the distance is that stored in the cell d[n,m] in the end.

The Code for C++

Win32 Multithreading and Synchronization

Introduction:

This tutorial will explain how to create and manage multiple threads in Windows. This is an advanced tutorial; the reader should be familiar with Win32 programming.
The need for responsive user-centric programs is a good reason to create programs that use multiple threads. By creating multiple threads, a program can seem to do many things at once (on a computer with more than one CPU, the program actually will do many things at once). For example, a word processor could have one thread that handles the painting of the processor’s window while another thread saves the document being typed every few minutes while yet another thread actively monitors the document for spelling errors all without forcing the user to wait while each task is completed.

Background:

On a single CPU Windows machine, all threads are kept track of and given a slice of processor time (usually a few milliseconds). Windows will cycle through the list it keeps, pausing and resuming each thread. Once a thread has used up its time on the processor, Windows will pause the thread, record its CPU registers (along with some other data), and, after restoring all its data, activate the next thread. Each thread has two priorities: base and dynamic. The base priority can be changed, however, it cannot be changed to have a priority higher than that of the parent thread. Dynamic priority is the same as the base priority, however, it can be raised or lowered by Windows. Windows chooses which thread to run next based on the thread’s dynamic priority. Naturally, threads with a higher dynamic priority run first.

Multithreading:

Initially, every program gets one thread, known as the primary thread, which is created by the Windows Object Manager. The primary thread can be used to create child threads. To create another thread callCreateThread. CreateThread takes the following parameters:

If the first parameter is passed as NULL, the thread will get the default security descriptor. The second parameter allows you to set the initial stack size, you can pass 0 to give the thread the default stack size. The third parameter is a pointer to the function the thread should start executing. The fourth parameter holds any arguments you want to pass to the function. You can pass either a 0 or CREATE_SUSPENDED to the fifth parameter. If it is 0, the thread starts running as soon as it is created. If the value is CREATE_SUSPENDED, the thread will be created suspended and will not start running until you call ResumeThread. The last parameter is a pointer to a DWORD which will hold the unique ID of the thread, after it is created.

If a thread was created with the CREATE_SUSPENDED flag, you will want to call ResumeThread to start using it. ResumeThread takes the following parameter:

hThread is the handle received by CreateThread. To suspend the thread again, call SuspendThread:

Once again, hThread is the handle received by CreateThread.

While a thread is suspended, you may want to raise its base priority and then wake it again. A thread with a higher priority will get more processor time. To change a thread’s base priority, call SetThreadPriority:

nPriority can be one of seven values:

THREAD_PRIORITY_LOWEST Two levels below process
THREAD_PRIORITY_BELOW_NORMAL One level below process
THREAD_PRIORITY_NORMAL Normal priority
THREAD_PRIORITY_ABOVE_NORMAL One level above process
THREAD_PRIORITY_HIGHEST Two levels above process
THREAD_PRIORITY_TIME_CRITICAL Priority of 15
THREAD_PRIORITY_IDLE Priority of 1

To retrieve a thread’s base priority level, call GetThreadPriority:

After you are done using a thread, you may want to terminate it. To do this, call ExitThread. ExitThread followed by a CloseHandle is the graceful way to shut down a thread. To immediately stop a thread, callTerminateThread. The specs of each function are:

Windows automatically calls ExitThread when a thread ends its function. dwExitCode is the exit code you want to pass. The exit code can later be retrieved using GetExitCodeThread:

The following is an example of how to use threads.

Synchronization:

Picture this: a word processor program creates two threads, one to read a file and another to write to a file. Everything is fine at first, the first thread waits for the second to finish writing to the file before reading it. The two threads work happily, everything is fine as long as the writing thread always writes first. But one dark day, the reading thread reads the file before the writing thread writes to the file and the program fails. This is known as a race condition because both threads race to finish their file operation. The program will always fail if the reading thread wins the race. A race condition is the result of bad synchronization. Another problem is the dreaded deadlock. In a deadlock, both threads will wait for each other to finish but neither thread will finish until the other finishes first, causing them to become locked. The solution to this problem is to use one, or more, of the synchronization objects provided by Windows.

To gain ownership of any of the synchronization objects, a thread can use WaitForSingleObject, WaitForSingleObjectEx, WaitForMultipleObjects, or WaitForMultipleObjectsEx.

WaitForSingleObject allows a thread to suspend itself while it waits for ownership of one of the synchronization objects.

The second parameter is the amount of time, in milliseconds, the thread is willing to wait for the object before it returns. If the second parameter is set to INFINITE, the function will not time-out. If the second parameter is set to 0, the function will try to gain ownership of the object and return immediately, even if it didn’t gain ownership.

WaitForSingleObjectEx is the same as WaitForSingleObject except, it adds one more option: alert if I/O operation completes.

If the last parameter is set to true, the function will return when an asynchronous I/O operation completes.

WaitForMultipleObjects allows a thread to wait for multiple synchronization objects at once. It can be set to return when any or all of the objects become available.

If the third parameter is set to TRUE, the function will wait for all of the objects to become available. If the third parameter is set to FALSE, the function will wait for any of the objects to become available, the return value of the function will be the index to the handles array to let you know which object that has been obtained.

WaitForMultipleObjectsEx is the same as WaitForSingleObjectEx, except it allows you to wait for multiple objects.

Mutexes:

Like all other synchronization objects, a mutex is created by the Windows Object Manager. Mutex is short for mutual exclusion, meaning that only one thread can own it at a time. Think of it as a sort of ticket, any thread holding the ticket gets to access whatever is being protected by the mutex. While the thread is doing its job, all the other threads wait. Once the thread is done, it gives the ticket away and the next thread can do what it needs to do while the other threads wait.

To create a mutex call CreateMutex:

The first parameter can be passed as NULL to obtain the default access rights. If the second parameter is set to TRUE, the creator of the mutex will have ownership first. The third parameter is optional, it can be used to easily identify the mutex.

To release the mutex after doing whatever needs to be done, call ReleaseMutex.

Only the thread that owns the mutex can release it. To destroy the mutex, call CloseHandle with the handle to the mutex.

Semaphores:

A semaphore is useful when you want to only allow a limited amount of threads to access a protected resource at a time. With a mutex, only one thread can own it at any given moment. With a semaphore, multiple threads can own it at a time. Consequently, any thread can also destroy the semaphore. To create a semaphore call CreateSemaphore.

The first parameter is handled the exact same as the first parameter of CreateMutex. The second parameter sets the initial count of the semaphore, usually it’s set to the same value as that of the maximum count. The initial count cannot be less than zero nor greater than the maximum count. The third parameter sets the maximum count which limits the number of threads that can own the semaphore. The last parameter is handled the same way as that of CreateMutex. After a thread gains possession of the semaphore the initial count is decremented one. If the initial count reaches 0, no more threads can gain possession of the semaphore. The initial count is incremented after a thread releases the semaphore.

To release a semaphore, call ReleaseSemaphore.

The second parameter sets by how much the count should be incremented, usually this is 1. The third parameter holds a pointer to a variable that will be filled with the previous count, after ReleaseSemaphore completes.

Critical Sections:

A critical section is very similar to a mutex. A critical section can only be owned by one thread at a time, however, a critical section cannot be shared between processes, a mutex can. Because of this, a critical section works more quickly. To create a critical section, call InitializeCriticalSection; to own a critical section, call EnterCriticalSection; to give up ownership of a critical section, call LeaveCriticalSection; to destroy a critical section, call DeleteCriticalSection.

All of the functions require a pointer to the critical section object. You declare one like this:

Any thread that is of the process that created the critical section can destroy the critical section.

Events:

An event object is useful when you want to alert threads of an action occurring, a button being pushed for example. An event object is sent to all waiting threads. Call CreateEvent to create an event; call SetEvent to signal an event; call ResetEvent to turn the signal off. When an event is signaled, all threads that wait for it will receive it; when the event is not signaled, the threads will wait. You can also call PulseEvent to quickly signal and unsignal an event. This is useful in releasing the waiting threads.

CreateEvent takes the following parameters:

If the second parameter is set to TRUE, the event must be reset manually. If the second parameter is set to FALSE, the event will return to its unsignaled state immediately after a call to SetEvent. If the third parameter is set to TRUE, the event will be created and set to the signaled state. The last parameter is an optional name for the object.

SetEvent, ResetEvent, and PulseEvent are all called in the same way:

hEvent being the handle returned from CreateEvent.

The combination of a mutex and an event is a good way to avoid deadlocks. The following is an example of using the mutex and event synchronization objects.

1 2 3 4 51