literals

javascript/json date literal

What's the date literal for JSON/JavaScript ( if such thing does exists? ) ...

Is there a boolean literal in SQLite?

I know about the boolean column type, but is there a boolean literal in SQLite? In other languages, this might be true or false. Obviously, I can use 0 and 1, but I tend to avoid so-called "magic numbers" where possible. From this list, it seems like it might exist in other SQL implementations, but not SQLite. (I'm using SQLite 3.6.1...

Where to split a string literal

Every time I have to split a long string literal into two (or more) pieces, because it does not fit into a single line, I have to decide if I split the text before or after a space. For example: const char * long_text1 = "This is a long text, which does not fit " "in one line"; /* or */ const char * long...

Is there a literal notation for decimal in IronPython?

suppose I have the following IronPython script: def Calculate(input): return input * 1.21 When called from C# with a decimal, this function returns a double: var python = Python.CreateRuntime(); dynamic engine = python.UseFile("mypythonscript.py") decimal input = 100m; // input is of type Decimal // next line throws RuntimeBinde...

how to create a string literal as a function argument via string concatenation in c

I need to pass a string literal to a function myfunction("arg1" DEF_CHAR "arg1"); now part of that constructed string literal needs to be a function return stmp = createString(); myfunction("arg1" stmp "arg2"); //oh that doesn't work either is there any way to do this in one line? myfunction("arg1" createString() "arg2"); //what i...

Object reference not set to an instance of an object (NullreferenceException was unhandled by user code)

How can I get around this exception? Dim imagepathlit As Literal = DownloadsRepeater.FindControl("imagepathlit") imagepathlit.Text = imagepath Here is the repeater: <asp:Repeater ID="DownloadsRepeater" runat="server"> <HeaderTemplate> <table width="70%"> <tr> <td colspan="3"><h2>Files you can download</h2></td> </tr> </Heade...

Django IN query as a string result - invalid literal for int() with base 10

Trying to query a 'Favorites' model to get a list of items a user has favorited, and then querying against a different model to get the objects back from that query to present to the template, but I'm getting an error: "invalid literal for int() with base 10" Looking over all of the other instances of that error, I couldn't find any in ...

Possible to convert list of #defines into strings (C++)

Suppose I have a list of #defines in a header file for an external library. These #defines represent error codes returned from functions. I want to write a conversion function that can take as an input an error code and return as an output a string literal representing the actual #define name. As an example, if I have #define NO_ERROR ...

javascript literal initialisation loop

I have an object which has several properties that are set when the object is created. This object recently changed to object literal notation, but I've hit a bit of a problem that searching on the net doesn't reveal. Simply stated I need to do this: Star = function(_id, _x, _y, _n, _o, _im, _c, _b, _links) { var self = { ...

Nested function inside literal Object...

Hello guys, if in a literal object i try to reference a function using "this" inside a nested property/function, this don't work. Why? A nested property have it's own scope? For example, i want to call f1 from inside d.f2: var object = { a: "Var a", b: "Var b", c: "Var c", f1: function() { alert("This is f1"); }, ...

Java equivalent of C#'s verbatim strings with @

Hi all, Quick question. Is there an equivalent of @ as applied to strings in Java: For example I can do @"c:\afolder\afile" in C# and have it ignore the escape characters when processing instead of having to do "c:\\afolder\\aFile". Is there a Java equivalent? hmmm: stackoverflow is escaping on me .. lol. The second example should rea...

xsl literal with <xsl:if>

Hi, I have to write a very simple code in xsl: IF column=0 if result = .34 set background color to green and write $result, but if result = 0.10 set background color to white and write the word "QQQ" and what doesn't work is: <xsl:if test="$result = 0.35 and $column = 0"> <xsl:attribute name='background-color'>#669933</xs...

How to convert JavaScript literal into JSON array?!

Possible Duplicate: How to count JavaScript array objects? If it's not a JavaScript array, so how to convert it into JSON array? var member = { "mother": { "name" : "Mary", "age" : "48" }, "father": { "name" : "Bill", "age" : "50", "friend": { "co-worker" : "Jake" ...

JavaScript function, which reads connections between objects

I have a JavaScript literal: var members = { "mother": { "name" : "Mary", "age" : "48", "connection": { "brother" : "sun" } }, "father": { "name" : "Bill", "age" : "50" }, "brother": { "name" : "Alex", "age" : "28" } } Than I have a fun...

Convert javascript string to an array

I'm retrieving an array of objects from a hidden html input field. The string I'm getting is: "{"id":"1234","name":"john smith","email":"[email protected]"},{"id":"4431","name":"marry doe","email":"[email protected]"}" Now I need to pass this as an array of objects again. How do I convert this string into array of objects? ...

Using Container.DataItem with an If statement within <% %>

I have the following code in a c# aspx page: <ItemTemplate> <a <% if(((Dictionary<string, string>)Container.DataItem)["type"]==Session["type"]){%> class="active"<%}%> This code is causing the following error. Compiler Error Message: CS0117: 'System.ComponentModel.Container' does not contain a definition for 'DataItem' Why is th...

Using C preprocessor to construct a string literal for scanf?

I'm attempting to create an sscanf string literal to aid in buffer overrun prevention in C99. The goal is something like: #define MAX_ARG_LEN 16 char arg[MAX_ARG_LEN] = ""; if (sscanf(arg, "%"(MAX_ARG_LEN-1)"X", &input) > 0) The obvious "manual" solution is something like: #define MAX_ARG_LEN 16 #define MAX_ARG_CHARS "15" char...

Initializing a value through a Session variable

I need to Initialize a value in a Javascript by using a c# literal that makes reference to a Session Variable. I am using the following code <script type="text/javascript" language="javascript" > var myIndex = <%= !((Session["myIndex"]).Equals(null)||(Session["myIndex"]).Equals("")) ? Session["backgroundIndex"] : "1" %>; However ...

Is 2+3 considered as a literal?

Suppose i have something like int x = 2 + 3; Is x considered to be a literal? ...

what's the right tool/way to auto generate java client code by a given wsdl file (document literal wrapped style)

I tried the tool wsdl2java from axis2, but looks something wrong with the XML Java class binding, so when making the call, a ADBException (adb binding used) will be thrown out. can someone kindly tell the bet tool/way to generate can-work client code from such style of wsdl file (standard .net style:document literal wrapped)? Thanks. ...