Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Javascript Articles
Page 529 of 534
How to get the pixel depth and color depth of a screen in JavaScript?
Javascript window object has provided many methods to get various kinds of information regarding the browser. It has provided screen.colorDepth and screen.pixelDepth to get the color depth and pixel depth of browser screen respectively. Let's discuss them individually. Color depth The window object has provided screen.colorDepth method to return the color depth. Color depth is nothing but the number of bits used to display one color. All modern computers use 24 bit or 32 bit hardware for color resolution. Example document.getElementById("depth").innerHTML = "Screen color depth is " + screen.colorDepth; Output Screen color depth is ...
Read MoreWhat is the use of ()(parenthesis) brackets in accessing a function in JavaScript?
The ()(parenthesis) brackets play an important role in accessing a function. Accessing a function without () will return the function definition instead of the function result. If the function is accessed with () then the result can be obtained. Without () Example In the following example, the function is accessed without () so the function definition is returned instead of the result as shown in the output. function toCelsius(f) { return (5/9) * (f-32); } document.write(toCelsius); Output function toCelsius(f) { return (5/9) * (f-32); } With () Example ...
Read MoreDynamic Programming in JavaScript
Dynamic programming breaks down the problem into smaller and yet smaller possible sub-problems. These sub-problems are not solved independently. Rather, results of these smaller sub-problems are remembered and used for similar or overlapping sub-problems. Dynamic programming is used where we have problems, which can be divided into similar sub-problems so that their results can be re-used. Mostly, these algorithms are used for optimization. Before solving the in-hand sub-problem, the dynamic algorithm will try to examine the results of the previously solved sub-problems. The solutions of sub-problems are combined in order to achieve the best solution. For a problem to be ...
Read MoreHow to show if...else statement using a flowchart in JavaScript?
The if statement is the fundamental control statement that allows JavaScript to make decisions and execute statements conditionally. Let’s see how to show if…else statement using flowchart in JavaScript.
Read MoreRaise the Mobile Safari HTML5 application cache limit?
Application cache on Safari has no limit on storing data, but for mobile Safari the rues are different.The upper limit is 5MB.On mobile safari, the local storage and session storage are 5MB each. On WebSQL, a user is asked for permissions but you cannot store data any more than 50MB.With the latest iOS version, if a web app needs more then 5MB of cache storage, a user will be asked if it has permission to increase it. This is done so that the user can manage own memory space.
Read MoreDisplay video inside HTML5 canvas
You can try the following code snippet to display video inside HTML5 canvas.var canvas1 = document.getElementById('canvas'); var context = canvas1.getContext('2d'); var video = document.getElementById('video'); video.addEventListener('play', function () { var $this = this; (function loop() { if (!$this.paused && !$this.ended) { context.drawImage($this, 0, 0); setTimeout(loop, 1000 / 30); } })(); }, 0);
Read MoreEscaping/encoding single quotes in JSON encoded HTML5 data attributes
To escape single quotes, use json_encode() to echo arrays in HTML5 data attributes.printf('', htmlspecialchars(json_encode(array('html5', ...)), ENT_QUOTES, 'UTF-8'));Or you can also using built-injson_encode(array('html5', ...), JSON_HEX_APOS)
Read MoreHTML5 and Amazon S3 Multi-Part uploads
Yes, it is possible to use the HTML 5 File API with the Amazon S3 multi-part upload feature. You would need a server backup as well as Amazon API keys.Amazon S3, a web service offered by Amazon Web Services provides storage through web services interfaces. Amazon launched S3 in 2007.Create multipart upload with Amazon API and send "key"(filename) and "upload id" back to the web page. For the multi-part, you need to send part data directly to Amazon S3 via the "part upload URL" using "date" and "auth header".
Read MoreWebsocket for binary transfer of data & decode with HTML5
Use base64 encode/ decode on client and server. All the web browsers with WebSockets have window.atob (base64 decode) and window.btoa (base64 encode). The WebSockets server has base64 libraries.To transfer binary data, you would be working with wsproxy included with no VNC that is a web based VNC client.The wsproxy is a WebSockets to generic TCP sockets proxy. The base64 encodes/decodes all traffic to/from the browser. Use it to connect from a WebSockets capable browser to any type of TCP port.
Read MoreHTML5 <audio> tag on Android for PhoneGap application
PhoneGap is a software development framework by Adobe System, which is used to develop mobile applications. PhoneGap produces apps for all popular mobile OS platforms such as iOS, Android, BlackBerry, and Windows Mobile OS etc.HTML5 Audio support is not consistent across different devices due to codec licensing issues and OS implementation. Forplaying MP3 file, handle by using PhoneGap's Media class that would provide reliable audio programming on all the platforms.To repload audio and polyphony or layering, you can use the LowLatencyAudio PhoneGap native plugin.
Read More