Arjun Thakur has Published 1025 Articles

Java program to implement selection sort

Arjun Thakur

Arjun Thakur

Updated on 13-Mar-2020 05:44:07

4K+ Views

Selection sort is a simple sorting algorithm. This sorting algorithm is an in-place comparison-based algorithm in which the list is divided into two parts, the sorted part at the left end and the unsorted part at the right end. Initially, the sorted part is empty and the unsorted part is ... Read More

How to Find Hash of File using Python?

Arjun Thakur

Arjun Thakur

Updated on 05-Mar-2020 10:46:21

3K+ Views

You can find the hash of a file using the hashlib library. Note that file sizes can be pretty big. Its best to use a buffer to load chunks and process them to calculate the hash of the file. You can take a buffer of any size.Exampleimport sys import hashlib ... Read More

Usage of :lang pseudo-class in CSS

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 12:46:57

87 Views

Use the :lang pseudo class to specify a language to use in a specified element. This class is useful in documents that must appeal to multiple languages that have different conventions for certain language constructs.ExampleYou can try to run the following code to understand the usage of :lang pseudo class ... Read More

CSS outline-color property

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 12:43:00

106 Views

The outline-color property allows you to specify the color of the outline. Its value should either be a color name, a hex color, or an RGB value, as with the color and border-color properties.ExampleYou can try to run the following code to implement outline-color property −         ... Read More

Specify the left padding of an element with CSS

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 11:03:59

106 Views

The padding-left specifies the left padding of an element. It sets the left padding of an element. This can take a value in terms of length of %.Eaxmple                                This is demo content.                           This is another demo content.            

Change HTML navbar color in Twitter Bootstrap 2.0.4

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 06:44:02

215 Views

To change navbar color,Set navbar background −navbarBackground: #c79810 ;Set navbar background highlight −navbarBackgroundHighlight: #eab92d ;Set navbar text color −navbarText: #f9ed9d ;Set navbar link color −navbarLinkColor: #f9ed9d ;

Get pixel color from canvas with HTML

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 06:30:51

346 Views

To get the pixel color from canvas, use the following code. This returns the color in rgba −var index = (Math.floor(y) * canvasWidth + Math.floor(x)) * 4 // color in rgba var r = data[index] var g = data[index + 1] var b = data[index + 2] var a = data[index + 3]

Drawing an image from a data URL to a HTML5 canvas

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 05:06:54

1K+ Views

If you have a data url, you can create an image to a canvas. This can be done as shown in the following code snippet −var myImg = new Image; myImg.src = strDataURI;The drawImage() method draws an image, canvas, or video onto the canvas. The drawImage() method can also draw ... Read More

Client Checking file size using HTML5

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 05:02:06

427 Views

Before HTML5, the file size was checked with flash but now flash is avoided in web apps. Still the file size on the client side can be checked by inserting the below given code inside an event listener.if (typeofFileReader !== "undefined") {    // file[0] is file 1    var ... Read More

Using HTML5 file uploads with AJAX and jQuery

Arjun Thakur

Arjun Thakur

Updated on 04-Mar-2020 04:58:53

677 Views

When the form is submitted, catch the submission process and try to run the following code snippet for file upload −// File 1 var myFile = document.getElementById('fileBox').files[0]; var reader = new FileReader(); reader.readAsText(file, 'UTF-8'); reader.onload = myFunc; function myFunc(event) {    var res = event.target.result; var fileName = document.getElementById('fileBox').files[0].name; ... Read More

Advertisements