karthikeya Boyini

karthikeya Boyini

1,421 Articles Published

Articles by karthikeya Boyini

Page 99 of 143

How can we combine multiple print statements per line in Python?

karthikeya Boyini
karthikeya Boyini
Updated on 05-Mar-2020 5K+ Views

You can combine multiple print statements per line using, in Python 2 and use the end argument to print function in Python 3.examplePython2.x print "Hello", print " world" Python3.x print ("Hello", end='') print (" world")OutputThis will give the output −Hello worldAnother thing you could do is put all the things in an array and call ''.join(array). examplearr = ["Hello", "world"] print(' '.join(arr))OutputThis will give the output −Hello world

Read More

HTML5 Canvas layer disappears on mouse click in Fabric.js and Firefox stops responding when creating a canvas for the image?

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 529 Views

If the HTML5 Canvas layer disappears on mouse click in Fabric.js and Firefox stops responding when creating a canvas to the image, then there is a way to drag and drop images from your computer to canvas using Fabric.This can be done by making image draggable property to true by this way −

Read More

Bootstrap complex form layout for combined vertical/inline fields with HTML

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 334 Views

Bootstrap form for combined vertical/ inline fields − Left side Right side longer forms shorter forms shorter forms shorter forms shorter forms Right

Read More

Phonegap + Windows Phone 8 : HTML5 viewport meta & scaling issue

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 157 Views

Whenever you face such issue, it would mean you have not written the CSS properly.Just add the following in CSS −* {    zoom:1;    -ms-content-zooming:none; }For some code, even the following works −@viewport {    width:320px; } @-ms-viewport {    width:320px;    zoom-user:fixed;    max-zoom:1;    min-zoom:1; }

Read More

Animating canvas to infinitely animate the noise to give the appearance of movement in HTML

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 158 Views

The putImageData() method places the image data onto the canvas. To animate canvas, we create a reusable ImageData object outside the main loop,var ct = c.getContext("2d", {alpha: false}); // context without alpha channel. var a = ct.createImageData(c.width, c.height); var buffer = new Uint32Array(a.data.buffer); function loop() { noise(ct); requestAnimationFrame(loop) })() function noise(ct) { var l =buffer.length - 1; while(l--) buffer[l] = Math.random() >0; ct.putImageData(a, 0, 0); }

Read More

How do I get an address latitude-longitude using HTML5 Geolocation or Google API?

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 547 Views

In order to get latitude and longitude using an HTML5 Geolocation or any Google API, we need to add JavaScript for this. The script is as follows −if (navigator.geolocation) { /* If current position is obtained then there is success otherwise there is failure. On failure, separate error message is shown */ navigator.geolocation.getCurrentPosition(successFunc, errorFunc); } else { alert(‘Geolocation is not enabled in your browser. Please use a latest browser to supports it.'); }

Read More

HTML5 Canvas and select / drag-and-drop features in a JS library?

karthikeya Boyini
karthikeya Boyini
Updated on 04-Mar-2020 793 Views

If you want to use HTML5 canvas to draw shapes, texts and curves and also want to attach traditional DOM events like onClick or drag and drop functions, a crossbar framework Raphael is used for doing drag and drop or touch events.This technology uses SVG and XML for older versions of IE.  Drag and drag using HTML is shown below.  Example                    Raphaël · Drag-n-drop                                                   ...

Read More

How to capture file not found exception in Java?

karthikeya Boyini
karthikeya Boyini
Updated on 20-Feb-2020 439 Views

While using FileInputStream, FileOutputStream, and RandomAccessFile classes, we need to pass the path of the file to their constructors. In case of a file in the specified path does not exist a FileNotFoundException is raised.Examplepublic class Sample { public static void main(String args[]) throws Exception { File file = new File("myFile"); FileInputStream fis = new FileInputStream(file); System.out.println("Hello"); } }OutputException in thread "main" java.io.FileNotFoundException: myFile (The system cannot find the file specified) ...

Read More

How to access the private methods of a class from outside of the class in Java?

karthikeya Boyini
karthikeya Boyini
Updated on 18-Feb-2020 7K+ Views

You can access the private methods of a class using java reflection package.Step1 − Instantiate the Method class of the java.lang.reflect package by passing the method name of the method which is declared private.Step2 − Set the method accessible by passing value true to the setAccessible() method.Step3 − Finally, invoke the method using the invoke() method.Exampleimport java.lang.reflect.Method; public class DemoTest {    private void sampleMethod() {       System.out.println("hello");    } } public class SampleTest {    public static void main(String args[]) throws Exception {       Class c = Class.forName("DemoTest");       Object obj = c.newInstance(); ...

Read More

How do we initialize a variable in C++?

karthikeya Boyini
karthikeya Boyini
Updated on 11-Feb-2020 262 Views

You can initialize a variable using the assignment operator or use its constructor when initializing it. For example,int i = 0; MyClass instance(1, "Hello");It will be automatically initialized ifIt's a class/struct instance in which the default constructor initializes all primitive types; like MyClass instance; You use array initializer syntax, e.g. int a[10] = {} (all zeroed) or int a[10] = {1,2}; (all zeroed except the first two items: a[0] == 1 and a[1] == 2) It is a global/extern variable It is defined static

Read More
Showing 981–990 of 1,421 articles
« Prev 1 97 98 99 100 101 143 Next »
Advertisements