473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Coding a Hex Value

To whomever may assist,

I am trying to code an index (TLE - Tagged Logical Element) identifier to
load a customer statement into OnDemand (an archival system created by IBM).
The TLE is defined as such:

idx = new index();
tle = new String("AcctNumber"); <!-- AcctNumber is an array that can
have one or more values -->
tle.name = 'AcctNo';
tle.sequence = "\x80\x0A\x7F\xFF\xFF\xFF\xFF\xFF";
tle.level = "\xFF\xFF"

My issue is whether the syntax of "\x80" is the correct format to code a hex
value. Any assistance would be appreciated.
--

Herbert C. Brown, Jr.
ma*****@att.net
Aug 19 '07 #1
2 2554
Herbert C. Brown, Jr. wrote on 19 aug 2007 in comp.lang.javascript:
To whomever may assist,
Wow, are we correcr, Junior,
I am trying to code an index (TLE - Tagged Logical Element) identifier
to load a customer statement into OnDemand (an archival system created
by IBM). The TLE is defined as such:

idx = new index();
Is that Javascript?
[anyway, you do not use idx here,
so it cannot be amn important part of your Q.]
tle = new String("AcctNumber");
Use:

var tle = ...

<!-- AcctNumber is an array that can have one or more values -->

No, "AcctNumber" is a litteral string, not an array.
tle.name = 'AcctNo';
wouldn't you prefer to use an oblect?
tle.sequence = "\x80\x0A\x7F\xFF\xFF\xFF\xFF\xFF";
This is just applying a litteral string again.
tle.level = "\xFF\xFF"

My issue is whether the syntax of "\x80" is the correct format to code
a hex value. Any assistance would be appreciated.
\xnn is a way to enter ascii characters, as \unnnn is to enter Unicode
characters.

Remember, the characters are two bytes long in bothe methods.

<script type='text/javascript'>

var ascii = '\x48\x65\x6c\x6c\x6f';
var unico = '\u0048\u0065\u006c\u006c\u006f';

alert(ascii);
alert(unico);
alert(ascii == unico);
alert(ascii === unico);

</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 19 '07 #2
Herbert C. Brown, Jr. wrote:
To whomever may assist,

I am trying to code an index (TLE - Tagged Logical Element)
identifier to load a customer statement into OnDemand (an
archival system created by IBM).
That is all fine and good, but is too far detached from anything
directly related javascript and its use to be of any help. And it
certainly is doing nothing to explain the what and why of the code you
have posted.
The TLE is defined as such:

idx = new index();
tle = new String("AcctNumber"); <!-- AcctNumber is an array
that can have one or more values -->
Javascript has end-of-lien and multi-line comment syntaxes, which should
be the only comment syntaxes used to comment javascript.

The comment here is false. I can see the quote marks around AcctNumber
and so I can see that it is a string literal not an Array.
tle.name = 'AcctNo';
tle.sequence = "\x80\x0A\x7F\xFF\xFF\xFF\xFF\xFF";
tle.level = "\xFF\xFF"

My issue is whether the syntax of "\x80" is the correct format
to code a hex value. Any assistance would be appreciated.
The problem here is that "to code a hex value" has little meaning in
javascript. The source code character sequence - \xNN -(where NN are two
characters from the digits 0 to 9 and the letters A, B, C, D, E and F
(in upper or lower case)), when they appear in a string literal or
regular expression literal, are a Hex escape sequence that defines the
character code (16 bit Unicode code point) of the character that will be
used in the sting or regular expression in place of the escape sequence.
However you go about defining the characters used in a string literal
the string primitive value that is the result is just (and only) a
sequence of 16 bit Unicode code points.

(Note: Hex escape sequences in string literals and regular expression
literals are a left-over from before javascript was standardised to use
16 bit Unicode code points in its string literals, and Unicode escape
sequences now exist (in the form \uNNNN) to allow the rest of (all of)
the code points to be expressed as escape sequences.)

Numeric literals may also be expressed in Hexadecimal, in the form:-

var n = 0xE4A2; //the number of hex digits used can vary considerably

- but the result is a numeric value that is a 64 bit IEEE double
precision floating point number (even if that number represents an
integer). (The handling (interpretation of and translation into IEEE
double precision floats) of HexIntegerLiteral numeric literals is
defined in ECMA 262, 3rd Ed. Section 7.8.3).

Generally javascript is not a language in which you work with (or think
about) bit sequences or Hex values.

Richard.

Aug 19 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
1
by: Timo | last post by:
I haven't tried coding eventhandlers in Global.asax yet -- any "gotchas" I should be aware of? Do programming errors there require bouncing IIS? Will handlers in Global.asax be able to access...
0
by: Willie Neal | last post by:
I'm new to vb.net and would like the advice of my peers. Here is my scenario: I have a user control which consists of three buttons, three listboxes and three labels. When the user selects a button...
3
by: Anusha H via DotNetMonster.com | last post by:
Hello there, I simply need to import a text file into a sql table. Text file is fixed width and i know the column widths. Will anyone give me the exact coding in vb.net by using DTS please. Your...
60
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
7
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already...
0
by: saravanansvks | last post by:
Dear Friends, I have prepared a programme in Visual Basic for SHAPE OPERATOR.But my coding are changing the shape only.It does not changes the fill style of the shape tool .And it is not giving ant...
1
by: Gale Coleman - LSND | last post by:
ASP, VBscript, IIS 6, Access database Hello, I have a form page that people fill out and push submit. When they push submit, the information is stored in a database in two different tables....
1
by: R69D | last post by:
Write and test the following method that implements the power function: static double pow(double x, int n) This method returns the value of x raised to the power n. For example pow(2.0, -3)...
19
by: auratius | last post by:
http://www.auratius.co.za/CSharpCodingStandards.html Complete CSharp Coding Standards 1. Naming Conventions and Styles 2. Coding Practices 3. Project Settings and Project Structure 4....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.