literals

Best way to convert string to array of object in javascript?

Hi guys, I want to convert below string to an array in javascript. {a:12, b:c, foo:bar} How do I convert this string into array of objects? Any cool idea? ...

Delphi Error E2283 Too many local constants

Hi everyone, this is my first post here, so please be gentle if I am missing something out ;-) I am having a compilation problem with my code in Delphi 2006. I am using a static String array: fsi_names : array [0..FSI_NUM_VARS-1] of string; In a procedure I call at the start of the program, I assign values to this array. This code i...

Literal Syntax For byte[] arrays using Hex notation..?

The compiler seems to be ok with this (single digit hex values only): byte[] rawbytes={0xa,0x2,0xf}; But not this: byte[] rawbytes={0xa,0x2,0xff}; I get a "Possible Loss of Precision found : int required : byte" error? What am I doing wrong - or are single digit hex numbers a special case ? Java 1.5.x. ...

Purpose of Scala's Symbol?

Possible Duplicate: What are some example use cases for symbol literals in Scala? What's the purpose of Symbol and why does it deserve some special literal synatx e. g. 'FooSymbol? ...

Literal in Code behind

Hi. why I cant access to literal in behind Code of my asp.net page? <%@ Page Title="" Language="VB" MasterPageFile="~/UI/Masters/Window.master" AutoEventWireup="false" CodeFile="HelpViewer.aspx.vb" Inherits="UI_Pages_HelpViewer" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %> <asp:Content ID="Content1" ContentPlaceH...

How does a function detect string pointer vs string literal argument?

I have encountered a function, such that it can differentiate between being called as foo("bar"); vs const char *bob = "bar"; foo(bob); Possibilities I have thought of are: Address of string: both arguments sat in .rdata section of the image. If I do both calls in the same program, both calls receive the same string address. RTTI...

C: memory address literal

Given a literal memory address in hexadecimal format, how can I create a pointer in C that addresses this memory location? Memory addresses on my platform (IBM iSeries) are 128bits. C type long long is also 128bits. Imagine I have a memory address to a string (char array) that is: C622D0129B0129F0 I assume the correct C syntax to dir...

Comparing Character Literal to Std::String in C++

I would like to compare a character literal with the first element of string, to check for comments in a file. Why use a char? I want to make this into a function, which accepts a character var for the comment. I don't want to allow a string because I want to limit it to a single character in length. With that in mind I assumed the e...

Javascript code, unterminated string literal with included javascript

This script works fine, unless the included file contains javascript, then it breaks with the "unterminated string" literal error. Removing spaces and linebreaks does not cure the problem. <script type="text/javascript"> var myArray = [ 'url', 'url2', 'url3', 'url4', 'url5', ]; var i, numDomains = myArray.length, found = false; for (i =...

If-else block and unexpected results with float datatype. [Edited with one more question]

Hello, I compiled the following program with gcc 4.4.1 and I get unexpected output (Well, unexpected for me) #include<stdio.h> int main() { float x=0.3, y=0.7; if(x==0.3) { if(y==0.7) printf("Y\n\n"); else printf("X\n\n"); }...

MySQL unicode literals

I want to insert a record into MySQL that has a non-ASCII Unicode character, but I'm on a terminal that doesn't let me easily type non-ASCII characters. How do I escape a Unicode literal in MySQL's SQL syntax? ...

Include various Javascripts without getting "unterminated string literal" error?

I get the "unterminated string literal" error with this code. This code used to work by using escaped quotes. Not possible now because because Google Adsense is including several script files. <script type="text/javascript"> <!-- var t=0; var myArray = []; myArray[0]= 'condition1'; myArray[1]= 'condition2'; myArray[2]= 'condition3';...

How to use double quotes in a string when using the @ symbol?

I need to use double quotes in a string that uses the @ symbol. Using double quotes is breaking the string. I tried escaping with \, but that doesn't work. Ideas? ...

inverted comma and string in python..

I'm kinda' new to python, but I have already written many programs including some like download-managers, games and text-editors which require a lot of string manipulation. For representing a string literal I use either single or double inverted commas.. whichever comes to my mind first at that time. Although I haven't yet faced any tro...

One Hyperlink In Many Different Locations

I'd like to implement a hyperlink in many locations on my website, however I just want to have it defined once not several times over. What is the best way to achieve this? I started down the road of listing it in the node of web.config but I was only able to get that to list as a literal and wasn't successful in having it end up as a...

The dot after the integer number value in JavaScript?

In JavaScript it is valid to end an integer numeric literal with a dot, like so... x = 5.; What's the point of having this notation? Is there any reason to put the dot at the end, and if not, why is that notation allowed in the first place? UPDATE: Ok guys, since you mention floats and integers... We are talking about JavaScript here...

JavaScript: JSLint throws "Read Only.

My code: note: the Slider Object is declared but omitted in the snippet below for better readability "use strict"; /*global arrayContainer, SliderInstance, DomObjects */ arrayContainer = new Slider.constructArray(); SliderInstance = Object.beget(Slider); DomObjects = { animationContainer: document.getElementById('animationContain...

Creating a list with >255 elements

Ok, so I'm writing some python code (I don't write python much, I'm more used to java and C). Anyway, so I have collection of integer literals I need to store. (Ideally >10,000 of them, currently I've only got 1000 of them) I would have liked to be accessing the literals by file IO, or by accessing there source API, but that is disallow...

really funky C# compiler behavior with nullable literals

The C# 4.0 compiler does not complain about this (not even a warning): if(10.0 > null + 1) { } if (myDoubleValue > null) { } And it seems to be always false. What is going on here? Is null automatically converted to Nullable<double> or something? If so why doesn't this work then: double myDoubleValue = null + 1; Also, why ...

Advantages and disadvantages of using strdup on a string literal

I want to be clear about all the advantages/disadvantages of the following code: { char *str1 = strdup("some string"); char *str2 = "some string"; free(str1); } str1: You can modify the contents of the string str2: You don't have to use free() Faster Any other differences? ...