literals

Problem with StringBuilder and XML Literals

I'm having a problem using XML literals with a StringBuilder in VB 2008. If I use this code everything is fine. Dim html As New System.Text.StringBuilder html.Append(<html><body></body></html>) MsgBox("hello") Now the problem is I want to wrap HTML around something that is generated in code. html.Append(<html><body>) msgbox("nothi...

What is the technical name of the syntactic feature "long foo = 12L;" style casting of harded-coded values in Java?

Today, I was trying to cast a hard-coded value into a short and S did not work. So, I went to search for it, but I realized that I do not even know what this feature of Java's syntax is called. Is there a name for it? If not, is there at least a list of all of the possible ways to cast hard-coded numeric values? Epilouge After getting ...

Are long-suffix and unsigned-suffix needed when declaring long literals in C++?

I have some ancient memories of writing C code like: long value = 0; in the bad old Win16 days and ending up with value being only half-initialized: i.e. the lower 16 bits were 0 and the upper 16 bits were whatever random bits were at that location in memory. As such, I became conditioned to write: long value = 0L; Is this still re...

C# Decimal Data Type

Good Day, In order to work with decimal data types, I have to do this with variable initialization: decimal aValue = 50.0M; What does the M part stand for? coson ...

When should you use === vs ==, !== vs !=, etc.. in javascript?

Possible Duplicate: Javascript === vs == : Does it matter which equal operator I use? What are the differences between === and ==, !== and ==... when should you use one and when should you use the other? Matt ...

What is array literal notation in javascript and when should you use it?

JSLint is giving me this error: Problem at line 11 character 33: Use the array literal notation []. var myArray = new Array(); What is array literal notation and why does it want me to use it instead? It shows here that new Array(); should work fine... is there something I'm missing? ...

Trouble displaying MS Word html file in Asp.Net Literal Control

When I display an html file that was created in MS Word, it doesn't render correctly in the ASP Literal control. It seems to have trouble showing tabs, dashes, bullets, etc. Is there something I can do to make this work? ...

How to type cast a literal in C

Hi, I have a small sample function: #define VALUE 0 int test(unsigned char x) { if (x>=VALUE) return 0; else return 1; } My compiler warns me that the comparison (x>=VALUE) is true in all cases, which is right, because x is an unsigned character and VALUE is defined with the value 0. So I changed my code to: if ( ((sign...

How can I force a literal or div to only be so wide

I have users enter info into a textarea that's been set to runat-"server" and that is 600px wide on 1 page. When they click a button the contents are supposed to show on the second page. I've tried displaying them as both aliteral and div. But in both cases, even if I put controls in a table and set the width of the table and columns to ...

Javascript - Replacing the escape character in a string literal

Hi everyone, I am trying to replace the backslash (escape) character in a Javascript string literal. I need to replace it with a double backslash so that I can then do a redirect: var newpath = 'file:///C:\funstuff\buildtools\viewer.html'.replace(/\\/g,"\\"); window.location = newpath; However, it seems to have no result. I don't...

Japanese COBOL Code: rules for G literals and identifiers?

We are processing IBMEnterprise Japanese COBOL source code. The rules that describe exactly what is allowed in G type literals, and what are allowed for identifiers are unclear. The IBM manual indicates that a G'....' literal must have a SHIFT-OUT as the first character inside the quotes, and a SHIFT-IN as the last character before the...

Why is String the only class for which literals exist in Java?

Why is java.lang.String the only class for which two ways of creation exist: 1) With normal way with "new" keyword. String s = new String("abc"); 2) With String literal (which is only available with String class) String s = "abc"; So why are there String literals and no literals for any other classes?? ...

How do I type literal binary in VB.NET?

How do you type binary literals in VB.NET? &HFF // literal Hex -- OK &b11111111 // literal Binary -- how do I do this? ...

Java Regexs: unexpected char: '('

I am using processing 1.0.6, which runs on java 1.6. I have the following code: Pattern pattern = Pattern.compile("func\((.*),(\-?[0-9\.]*),(\-?[0-9\.]*),(\-?[0-9\.]*)\)"); but it gives the error: unexpected char: '(' and highlights the line I pasted above. If I change the offending \( to another character like #, it complains of t...

Javascript asynchronous request NOT working.

This code only works when async is set to false, why? var contact = { XMLHttp : null, XMLDoc : null, TXTDoc : null, getData : function(dataSource) { contact.XMLHttp = new XMLHttpRequest(); contact.XMLHttp.open("GET", dataSource, false); contact.XMLHttp.onreadystatechange = contact.storeData; contact.XMLHttp.send(null); }...

C# Number Literals

With this method declaration (no overloads): void Method(double d) { // do something with d } Is there a (performance) difference at runtime between void Main() { Method(1); Method(1.0); } or does the compiler automatically convert the int literal to a double? ...

Does .Net have any built in constants for common numbers like million, billion etc?

Does .Net have any built in constants for common numbers like million, billion etc? EDIT: As has been suggested this was for readability reasons, rather than writing 1000000 or 1000000000. I know I can create my own just wanted to check that they didnt already exist before I did so. ...

How does C Handle Integer Literals with Leading Zeros, and What About atoi?

When you create an integer with leading zeros, how does c handle it? Is it different for different versions of C? In my case, they just seem to be dropped (but maybe that is what printf does?): #include <stdio.h> int main() { int a = 005; printf("%i\n", a); return 0; } I know I can use printf to pad with 0s, but I am jus...

What exactly is the danger of using magic debug values (such as 0xDEADBEEF) as literals?

It goes without saying that using hard-coded, hex literal pointers is a disaster: int *i = 0xDEADBEEF; // god knows if that location is available However, what exactly is the danger in using hex literals as variable values? int i = 0xDEADBEEF; // what can go wrong? If these values are indeed "dangerous" due to their use in various ...

Literal structure for time datatype

I'm working on a DSL that should support a time literal and am interested in two different things: What language(s) or DSL(s) support a time literal? How is the literal structured? I'm leaning towards using the following regular expression, extracted from the XSD for XML Schema itself, for identifying a time literal: T\d\d:\d\d:\d\d...