Parse USB Port Via Script?
Aug 5, 2009I am planning to use a USB barcode scanner and use web browsers as my interface.
Is it possible to parse the USB port via javascript? (or any client-side languages)
I am planning to use a USB barcode scanner and use web browsers as my interface.
Is it possible to parse the USB port via javascript? (or any client-side languages)
Is JavaScript able to send/listen for data on a specific port? I'm seeking
a solution to real time data interaction with my web server that doesn't
require refreshing the page. I.e., a chat room, where the data can be
broadcast from the server arbitrarily and displayed by the client
browser(s). To accomplish the data transmission can I use JS, or do I need
to augment my client-side platform to something like Java, et al?
Basically, I want to have a javascript that will watch for data coming
in on a specific port - like HTTP on port 80, etc. Is this at all
possible with pure javascript?
I'm a newbie to javascript programming and I'm seeking on a solution on how to connect to a tcp port using javascript. Basically, we have phone server that is constantly streaming XML data on port 1024 (serverIP:1024). I've ran a packet sniffer and was able to gather the elements and attributes for the XML data that the server is streaming. Now, I have a test XML parser which works with the XML document using the elements and attributes i've gathered from the packet sniffer. Is there a way for me to connect to the TCP port i've mentioned using javascript and incorporate it with the XML parser that I have. code...
View 3 Replies View RelatedHow to do serial port communication using Javascript?
View 2 Replies View RelatedI have been directed from .NET section to this section. My original post and question are here. forums.devshed.com/net-development-87/asp-net-how-to-send-data-to-parallel-port-600691.html
Is it possible to send data to parallel port using javascript?
Okay, this an attempt to port PHP's date() function as much as possible to JavaScript. Could use some refactoring though. Any critique, comments, appraisal and any other opinion is very welcome. Feel free to discuss and also take a look at beetles code here: http://www.codingforums.com/showthread.php?s=&threadid=11069
Oh, and the date() function is described here: http://www.php.net/manual/en/function.date.php
Date.prototype.monthNames = new Array(
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"
);
Date.prototype.dayNames = new Array(
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
);
Date.prototype.format = function (formatStr) {
var heap = formatStr.split("");
var resHeap = new Array(heap.length);
var escapeChar = ""; // you can change this to something different, but
// don't use a character that has a formatting meaning,
// unless you want to disable it's functionality
// go through array and extract identifiers from its fields
for (var i = 0; i < heap.length; i++) {
switch(heap[i]) {
case escapeChar:
resHeap[i] = heap[i+1];
i++;
break;
case "a": // "am" or "pm"
var temp = this.getHours();
resHeap[i] = (temp < 12) ? "am" : "pm";
break;
case "A": // "AM" or "PM"
var temp = this.getHours();
resHeap[i] = (temp < 12) ? "AM" : "PM";
break;
case "d": // day of the month, 2 digits with leading zeros; i.e. "01" to "31"
var temp = String(this.getDate());
resHeap[i] = (temp.length > 1) ? temp : "0" + temp;
break;
case "D": // day of the week, textual, 3 letters; i.e. "Fri"
var temp = this.dayNames[this.getDay()];
resHeap[i] = temp.substring(0, 3);
break;
case "F": // month, textual, long; i.e. "January"
resHeap[i] = this.monthNames[this.getMonth()];
break;
case "g": // hour, 12-hour format without leading zeros; i.e. "1" to "12"
var temp = this.getHours();
resHeap[i] = (temp <= 12) ? temp : (temp - 12);
break;
case "G": // hour, 24-hour format without leading zeros; i.e. "0" to "23"
resHeap[i] = String(this.getHours());
break;
case "h": // hour, 12-hour format; i.e. "01" to "12"
var temp = String(this.getHours());
temp = (temp <= 12) ? temp : (temp - 12);
resHeap[i] = (temp.length > 1) ? temp : "0" + temp;
break;
case "H": // hour, 24-hour format; i.e. "00" to "23"
var temp = String(this.getHours());
resHeap[i] = (temp.length > 1) ? temp : "0" + temp;
break;
case "i": // minutes; i.e. "00" to "59"
var temp = String(this.getMinutes());
resHeap[i] = (temp.length > 1) ? temp : "0" + temp;
break;
case "I": // "1" if Daylight Savings Time, "0" otherwise. Works only on the northern hemisphere
var firstDay = new Date(this.getFullYear(), 0, 1);
resHeap[i] = (this.getTimezoneOffset() != firstDay.getTimezoneOffset()) ? (1) : (0);
break;
case "J": // day of the month without leading zeros; i.e. "1" to "31"
resHeap[i] = this.getDate();
break;
case "l": // day of the week, textual, long; i.e. "Friday"
resHeap[i] = this.dayNames[this.getDay()];
break;
case "L": // boolean for whether it is a leap year; i.e. "0" or "1"
resHeap[i] = (this.getFullYear() % 4) ? false : true;
break;
case "m": // month; i.e. "01" to "12"
var temp = String(this.getMonth() + 1);
resHeap[i] = (temp.length > 1) ? temp : "0" + temp;
break;
case "M": // month, textual, 3 letters; i.e. "Jan"
resHeap[i] = this.monthNames[this.getMonth()];
break;
case "n": // month without leading zeros; i.e. "1" to "12"
resHeap[i] = this.getMonth() + 1;
break;
case "O": // Difference to Greenwich time in hours; i.e. "+0200"
var minZone = this.getTimezoneOffset();
var mins = minZone % 60;
var hour = String(((minZone - mins) / 60) * -1);
if (hour.charAt(0) != "-") {
hour = "+" + hour;
}
hour = (hour.length == 3) ? (hour) : (hour.replace(/([+-])(d)/, "$1" + 0 + "$2"));
resHeap[i] = hour + mins + "0";
break;
case "r": // RFC 822 formatted date; e.g. "Thu, 21 Dec 2000 16:01:07 +0200"
var dayName = this.dayNames[this.getDay()].substr(0, 3);
var monthName = this.monthNames[this.getMonth()].substr(0, 3);
resHeap[i] = dayName + ", " + this.getDate() + " " + monthName + this.format(" Y H:i:s O");
break;
case "s": // seconds; i.e. "00" to "59"
var temp = String(this.getSeconds());
resHeap[i] = (temp.length > 1) ? temp : "0" + temp;
break;
case "S": // English ordinal suffix for the day of the month, 2 characters; i.e. "st", "nd", "rd" or "th"
var temp = this.getDate();
var suffixes = ["st", "nd", "rd"];
var suffix = "";
if (temp >= 11 && temp <= 13) {
resHeap[i] = "th";
} else {
resHeap[i] = (suffix = suffixes[String(temp).substr(-1) - 1]) ? (suffix) : ("th");
}
break;
case "t": // number of days in the given month; i.e. "28" to "31"
resHeap[i] = this.getDay();
break;
/*
* T: Not implemented
*/
case "U": // seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
// remember that this does not return milisecs!
resHeap[i] = Math.floor(this.getTime() / 1000);
break;
case "w": // day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
resHeap[i] = this.getDay();
break;
case "W": // ISO-8601 week number of year, weeks starting on Monday
var startOfYear = new Date(this.getFullYear(), 0, 1, 0, 0, 0, 0);
var firstDay = startOfYear.getDay() - 1;
if (firstDay < 0) {
firstDay = 6;
}
var firstMonday = Date.UTC(this.getFullYear(), 0, 8 - firstDay);
var thisDay = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate());
resHeap[i] = Math.floor((thisDay - firstMonday) / (1000 * 60 * 60 * 24 * 7)) + 2;
break;
case "y": // year, 2 digits; i.e. "99"
resHeap[i] = String(this.getFullYear()).substring(2);
break;
case "Y": // year, 4 digits; i.e. "1999"
resHeap[i] = this.getFullYear();
break;
case "z": // day of the year; i.e. "0" to "365"
var firstDay = Date.UTC(this.getFullYear(), 0, 0);
var thisDay = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate());
resHeap[i] = Math.floor((thisDay - firstDay) / (1000 * 60 * 60 * 24));
break;
case "Z": // timezone offset in seconds (i.e. "-43200" to "43200").
resHeap[i] = this.getTimezoneOffset() * 60;
break;
default:
resHeap[i] = heap[i];
}
}
// return joined array
return resHeap.join("");
}
I know about the same-origin policy and that one of the only ways to load data from a cross-domain is to load it as JSON. However, all I am trying to do is access data from a server on another port (which I believe the browser still treats as cross-domain). I need to do this because the server my application is on is a map server and the other server (Apache) is the only one that can handle php scripts. I have also tried out the plug-in from [URL] and while it works when I do $('#phpContent').load('http://www.google.com'); it doesn't work when I try $('#phpContent').load('http://localhost:80/mapScripts/getFiles.php'); I have also tried$.get('http://localhost:80/mapScripts/getFiles.php', function(data) { $('#phpContent').html(data); });
So here I am breaking my brain and do not know what else to attempt.
I have created a payment system using Jquery. The problem I run into is when I move from http to https. I get the following error: Error: [Exception... "Access to restricted URI denied" code: "1012"
[Code]...
Hides the element by sliding it down.
$("div").click(function () { $(this).hide("slide", { direction: "down" }, 1000); });
I am new to Jquery. How do I reverse this code to slide element into viewport as opposed to slide out of view port. This is the link to the effect [URL]. What I want to do is the element will be hidden originally on loading the page and then slides into view with a click anywhere on the page, an anchor or after a few seconds.
I am working on a robot project, that is required to create a website to control the robot via serial port.. The website is plainly html, no linking to database is needed...
I have no idea how and what language to use and can JavaScript communicate with serial port? and how?
I have got this xml file which has a background params which is <background>igmp:
{theme.background_video_ip}:1234</background>.
I have done the validation to check if the igmp protocol is used like this
if (clientSpecificData.background.substr(0, 7) == "igmp:") {
Right now I am trying to find out how I can use regular expressions to check whether a port number is used at the end.
I'm trying to find the position of an element with respect to the view port area. So, when the user scrolls the page down, I want to know the x and y positions of the element with respect to the viewing (view port) area.
The overall goal is to know exactly where on the element this user clicked.
I need to parse the url for 'forums'.
I have some fastclick code that cannot go on my forums, so I want to put a javascript conditional on the code. Can someone help me?
I.E.
Code:
Is there a way to turn the document.referrer string into a Location like
object, so I can extrac the domain and other parts of it?
I have this div and I AJAX html into it, the problem is that the AJAXed html does not interact correctly with the rest of the page. I think i need to re parse the div, but not sure... Does anyone know how to have it parse the div? or a better way to fix this?
This is the div that the html is AJAXed into: <div id="insert_searchs" class="update"> </div>
How to parse String 01?
When I use parseInt("01"), js will give me 0.
What matter?
I know javascript can't do this natively but with flash or java it should be possible right? I'm thinking of doing something along the lines of a tuner ( [URL] , but a bit different). Any framework for reading notes from the mic with javascript? Preferably something which takes care of all the flash/java integration.
View 1 Replies View RelatedI am using the infamous hidden IFRAME trick to manage some image uploading. My server-side ASP page passes back XML to indicate success or failure. It was a snap to grab this in FireFox and parse it using the standard JQuery methods. Then I spent most of an afternoon trying to do the same in IE, I finally found this page and this comment: [url]
JavaScript, IE, XML, IE uses MSXML and an XSL stylesheet to transform the XML to some HTML document that pretty-prints the structure of the XML. That way when you access the iframe document you indeed access an HTML document that IE renders. However IE stores the original XML document in an XMLDocument property of the HTML document object so to access the XML data (and not the HTML document) you can do e.g. var xmlDoc = window.frames.frameName.document.XMLDocument; [...]
The solution thus ended up as follows:
From there I can use all of the normal JQuery code to traverse the XML. Anyway I am not sure if this is an IE bug, a JQuery bug and/or presumably specific to this wacky IFRAME scenario versus a normal document.
I am trying to get two values from a web service response.
The web service was called using jquery $ajax:
$.ajax({
url : "http://localhost:3032/ufs/integration/copymoveTerm",
type : "POST",
dataType : "xml",
[Code]....
All I want to do is to get the values of UNDO_COUNT and MSG into separate variables.
Here is the jquery I am trying to use:
function undoSuccess(xmlData, status, xmlResponse)
{
$(xmlResponse).find('res:OUTPUT').each(function () {
var undoCount = $(this).attr('res:UNDO_COUNT).text();
var msg = $(this).attr('res:MSG).text();
});
}
I have tried it with and without the name space "res:". I have tried it with xmlData and with xmlResponse I have tried changing the web service so that UNDO_COUNT and MSG were elements in their own right or were attributes of OUTPUT all without success it just bypasses the initial find on OUTPUT.
I want to send data to a database by a classic asp page. This page returns xml which I want to parse on the client.
[Code]...
I am trying to parse a value into a plugin, but it does not work. an alert(myborderimage); shows that I am getting the value, but I cannot parse it to jQuery
$(document).ready(function(){
var myborderimage = $("#myborderimage").val();
$('#myborder').borderImage('url("borders/+myborderimage
+") 30% 35% 40% 30%');
});
New to this, worked through the w3c tutorials and am really fascinated by some of the concepts. I'm only familiar with html, css, js (basics), so am trying to keep things as simple as I can for this.
For simplicity I'll use books.xml with a listing of books. Each book has a <title><author><year><price> and <image> element. The images are stored in a folder called "images" a path is listed in the xml document.
Using js and an array I can loop through the xml file and have it extract each node into a table, if I mouseOver a ROW in the table, it displays that listing in a DIV above and I would like it to display the image/thumbnail for that particular listing within another div called thumbnail which is in the same location regardless of which listing you mouseOver.
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
[Code]....
So the way this looks is there's a grey div. At the top it says listing, and when the body loads it lists the [0] first entry from the array. To the right of this is a small div called thumbnail that is empty and I would like it to load the relevant image from the path in the <image> tag in the xml file.
Below the listing is a table with 4 columns (title, genre, price, image) and an equal number of rows to the number of listings in the xml file. Under the "image" column it just shows the path to the image.
So how do I tie the empty thumbnail div to the listing so it'll just add the path from the xml <image> tag into a <img src="pathnamefromxmldocument">
I have a HTML string (which I retrieve from an XML file) and when I display it with
elm.firstChild.data = response;
Where 'response' is the HTML string, it will show the HTML tags non-parsed. How can I make it parse the HTML inside the string?
I'm playing a bit with the goo.gl API and Javascript using the jsonlib like this:
function googl(url, cb) {
jsonlib.fetch({
url: 'https:www.googleapis.com/urlshortener/v1/url?key=<my-api-key>',
header: 'Content-Type: application/json',
[Code]....
PS: I've removed my API Key from the code to make it public, on my test the API Key is there and it is correct, since I can see the valid JSON if I click on the fetch:1 on the Safari Debugger
I have a variable which contains a string of html that I wish to output into a content div on the click of a button.I can toggle the content of the div with the string above, but I wish to include the ability to parse that string before output, so I can translate its language before its output.I can easily do this once the html is output into the content div using the JS HTML DOM, but due to this conversion not being instant I'm looking into ways of translating this text before it is output, so changing the string stored in the variable html.
View 4 Replies View Related