Search Results

Search found 639 results on 26 pages for 'literal'.

Page 2/26 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • ColdFusion structs Direct Assignment vs object literal notation.

    - by Tom Hubbard
    The newer versions of ColdFusion (I believe CF 8 and 9) allow you to create structs with object literal notation similar to JSON. My question is, are there specific benefits (execution efficiency maybe) to using object literal notation over individual assignments for data that is essentially static? For example: With individual assignments you would do something like this: var user = {}; user.Fname = "MyFirstnam"; user.Lname = "MyLastName"; user.titles = []; ArrayAppend(user.titles,'Mr'); ArrayAppend(user.titles,'Dr.'); Whereas with object literals you would do something like. var user = {Fname = "MyFirstnam", Lname = "MyLastName", titles = ['Mr','Dr']}; Now this limited example is admittedly simple, but if titles was an array of structures (Say an array of addresses), the literal notation becomes awkward to work with.

    Read the article

  • How to perform a literal match with regex using wildcard

    - by kashif4u
    I am trying to perform literal match with regular expression using wildcard. string utterance = "Show me customer id 19"; string pattern 1 = "*tom*"; string patter 2 = "*customer id [0-9]*"; Desired results: if (Regex.IsMatch(utterance, pattern 1 )) { MATCH NOT FOUND } if (Regex.IsMatch(utterance, pattern 2 )) { MATCH FOUND } I have tried looking for literal match solution/syntax in wildcard but having difficulty. Could you also enlighten me with with an example on possible Pattern Matching Strength algorithm i.e. if code match 90 select? Note: I have table with 100000 records to perform literal matches from user utterances. Thanks in advance.

    Read the article

  • UNIX "find" command, match literal "dot"

    - by Robottinosino
    I need files ending with ".pdf" or ".png"; here's my attempt: find /Users/robottinosino/Desktop/_PublishMe_ -type f -regex '.*[pdf|png]' this incorrectly includes files ending with "Apdf", "Zpdf", etc. (missing literal dot before file extension) I tried adjusting the pattern to: find /Users/robottinosino/Desktop/_PublishMe_ -type f -regex '.*\.[pdf|png]' but then no results are returned. Escaping the . with a backslash does not work. Why? [0] $ uname -a Darwin Robottinosino.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386 Thanks!

    Read the article

  • String literal recognition problem

    - by helicera
    Hello! I'm trying to recognize string literal by reading string per symbol. Here is a sample code: #region [String Literal (")] case '"': // {string literal ""} { // skipping '"' ChCurrent = Line.ElementAtOrDefault<Char>(++ChPosition); while(ChCurrent != '"') { Value.Append(ChCurrent); ChCurrent = Line.ElementAtOrDefault<Char>(++ChPosition); if(ChCurrent == '"') { // "" sequence only acceptable if(Line.ElementAtOrDefault<Char>(ChPosition + 1) == '"') { Value.Append(ChCurrent); // skip 2nd double quote ChPosition++; // move position next ChCurrent = Line.ElementAtOrDefault<Char>(++ChPosition); } } else if(default(Char) == ChCurrent) { // message: unterminated string throw new ScanningException(); } } ChPosition++; break; } #endregion When I run test: [Test] [ExpectedException(typeof(ScanningException))] public void ScanDoubleQuotedStrings() { this.Scanner.Run(@"""Hello Language Design""", default(System.Int32)); this.Scanner.Run(@"""Is there any problems with the """"strings""""?""", default(System.Int32)); this.Scanner.Run(@"""v#:';?325;.<>,|+_)""(*&^%$#@![]{}\|-_=""", default(System.Int32)); while(0 != this.Scanner.TokensCount - 1) { Assert.AreEqual(Token.TokenClass.StringLiteral, this.Scanner.NextToken.Class); } } It passes with success.. while I'm expecting to have an exception according to unmatched " mark in this.Scanner.Run(@"""v#:';?325;.<>,|+_)""(*&^%$#@![]{}\|-_=""", default(System.Int32)); Can anyone explain where is my mistake or give an advice on algorithm.

    Read the article

  • ASP.NET Custom Control - Template Allowing Literal Content

    - by Bob Fincheimer
    I want my User Control to be able to have Literal Content inside of it. For Example: <fc:Text runat="server">Please enter your login information:</fc:Text> Currently the code for my user control is: <ParseChildren(True, "Content")> _ Partial Public Class ctrFormText Inherits FormControl Private _content As ArrayList <PersistenceMode(PersistenceMode.InnerDefaultProperty), _ DesignerSerializationVisibility(DesignerSerializationVisibility.Content), _ TemplateInstance(TemplateInstance.Single)> _ Public Property Content() As ArrayList Get If _content Is Nothing Then Return New ArrayList End If Return _content End Get Set(ByVal value As ArrayList) _content = value End Set End Property Protected Overrides Sub CreateChildControls() If _content IsNot Nothing Then ctrChildren.Controls.Clear() For Each i As Control In _content ctrChildren.Controls.Add(i) Next End If MyBase.CreateChildControls() End Sub End Class And when I put text inside this control (like above) i get this error: Parser Error Message: Literal content ('Please enter your login information to access CKMS:') is not allowed within a 'System.Collections.ArrayList'. This control could have other content than just the text, so making the Content property an attribute will not solve my problem. I found in some places that I need to implement a ControlBuilder Class, along with another class that implements IParserAccessor. Anyway I just want my default "Content" property to have all types of controls allowed in it, both literal and actual controls.

    Read the article

  • ODBC: Mapping of literal type names in create table statements

    - by matthias-meyer
    I was wondering if data types in a a literal "create table" statement, executed over ODBC, are replaced with their database specific counterparts (platform is Windows/.Net/C#). I cannot find this feature in the ODBC docs, and there seems to be no list of literal "ODBC data types". However, I know that this works for Oracle, SQL Server and Access; the following statement is executed correctly, although the type LONGVARBINARY is no native type in all of these systems: CREATE TABLE (MYCOLUMN LONGVARBINARY) However, e.g. for Oracle the mapped native type depends on the used ODBC driver. Is this an undocumented feature? Is there a list of supported type names anywhere? Thanks!

    Read the article

  • Resharper Split String literal

    - by Ismael
    I was not lucky in my 15 minutes googling. Maybe bad luck with good keyword? Why does the Resharper suggest spliting a string in function parameter? Example: From this: return PartialView("Categorias", lista); To this: return PartialView("Cat" + "egorias", lista); I checked documentation here: link And it says: Split string literal - Splits string literal into two literals. I want to discover why is this a good practice, what are the fundamental idealogic behind the scenes that achieved this practice. I don't want to do it without knowing why... Help is soooo appreciated.

    Read the article

  • passing string literal to std::map::find(..)

    - by ra170
    I've got a std::map. I'm passing string literal to find method. Obviously, I can pass a string literal such as .find("blah"); However, I wanted to declare it upfront, instead of hardcoding the string, so I have couple of choices now: const std::string mystring = "blah"; const char mystring[] = "blah"; static const char * mystring = "blah"; They all work. (or at least compile). My question is, which one should I use? what's the advantage/distavantage over of the other?

    Read the article

  • Displaying windows-1252 text in a literal control

    - by GordonB
    I currently have an aspx page that has a placeholder on it. In the code-behind page i'm adding a literal control to the placeholder controls collection. The literal control just contains text/html read from a sql server database field. The only text character encoding i've used so far is UTF-8. I have the requirement for a specific page to use windows-1252 encoding. I've strapped this to the page, and browsers now recognise the proper encoding. <% Response.Charset= "windows-1252" %> My issue is that i have various german characters ( ö / ü / etc ) that aren't displaying correctly. As presumably they are still be written to the page in UTF-8 not in windows-1252. I'm looking at; Dim textEncoder = System.Text.Encoding.GetEncoding(1252) Which seems to be more geared up to dealing with byte arrays than text. Do i have to change my text to a byte array then encode as windows-1252 then get the text back out again, or is there a simpler way of achieving what i'm after?

    Read the article

  • How to get a Class literal from a generically specific Class

    - by h2g2java
    There are methods like these which require Class literals as argument. Collection<EmpInfo> emps = SomeSqlUtil.select( EmpInfo.class, "select * from emps"); or GWT.create(Razmataz.class); The problem presents itself when I need to supply generic specific classes like EmpInfo<String> Razmataz<Integer> The following would be wrong syntax Collection<EmpInfo<String>> emps = SomeSqlUtil.select( EmpInfo<String>.class, "select * from emps"); or GWT.create(Razmataz<Integer>.class); Because you cannot do syntax like Razmataz<Integer>.class So, how would I be able to squeeze a class literal out of EmpInfo<String> Razmataz<Integer> so that I could feed them as arguments to methods requiring Class literals? Further info Okay, I confess that I am asking this primarily for GWT. I have a pair of GWT RPC interface Razmataz. (FYI, GWT RPC interface has to be defined in server-client pairs). I plan to use the same interface pair for communicating whether it be String, Integer, Boolean, etc. GWT.create(Razmataz) for Razmataz<T> complains that, since I did not specify T, GWT compiler treated it as Object. Then GWT compiler would not accept Object class. It needs to be more specific than being an Object. So, it seems there is no way for me to tell GWT.create what T is because a Class literal is a runtime concept while generics is a compile time concept, Right?

    Read the article

  • Searching for literal "> \" using ack-grep

    - by Stephen Gornick
    I am looking for lines that literally have a greater than character (a "") followed by a space followed by a backslash character (a "\") i.e., a line with this: \ I thought escaping would allow this, and for the greater-than it does: $ ack-grep " " returns lines that have " " in them. But when I try to escape the backslash as well I get: $ ack-grep " \" ack-grep: Invalid regex ' \': Trailing \ in regex m/ \/

    Read the article

  • SnowLeopard Xcode warning: "format not a string literal and no format arguments"

    - by Justin Galzic
    Since upgrading to the latest XCode 3.2.1 and SnowLeopard, I've been getting the warning, "format not a string literal and no format arguments" on the following: NSError *error = nil; if (![self.managedObjectContext save:&error]) { NSLog([NSString stringWithFormat:@"%@ %@, %@", errorMsgFormat, error, [error userInfo]]); } If 'errorMsgFormat' is an NSString with format specifiers (eg: "print me like this: %@"), what is wrong with the above NSLog statement? And what is the recommended way to fix it so that the warning isn't generated?

    Read the article

  • What is the Null Character literal in TSQL?

    - by David in Dakota
    I am wondering what the literal for a Null character (e.g. '\0') is in TSQL. Note: not a NULL field value, but the null character (see link). I have a column with a mix of typical and a null character. I'm trying to replace the null character with a different value. I would have thought that the following would work but it is unsuccessfull: select REPLACE(field_with_nullchar, char(0), ',') from FOO where BAR = 20

    Read the article

  • Objective C -- passing array literal to a method

    - by morgancodes
    This seems to work (compiler doesn't complain, anyway): float adsr[4] = {0,1.0/PULSE_SPEED, 0,1}; [sequence setBaseADSR:adsr]; but I want to make it more concise and do this: [sequence setBaseADSR:{0,1.0/PULSE_SPEED, 0,1}]; How do I do it? In javascript, I'd call stuff in the brackets an "array literal". Not sure if C languages have the same concept or terminology though.

    Read the article

  • the error "invalid literal for int() with base 10:" keeps coming up

    - by ratce003
    I'm trying to write a very simple program, I want to print out the sum of all the multiples of 3 and 5 below 100, but, an error keeps accuring, saying "invalid literal for int() with base 10:" my program is as follows: sum = "" sum_int = int(sum) for i in range(1, 101): if i % 5 == 0: sum += i elif i % 3 == 0: sum += i else: sum += "" print sum Any help would be much appreciated.

    Read the article

  • how to specify literal value in linq union

    - by lowlyintern
    I have the following SQL query, note I want the literal value '0' in the second field in the second SELECT statement from the ItemSale table. How do I express this in LINQ? I get the error message 'Invalid anonymous type member declarator'. SELECT BranchNumber,QuantitySold FROM Department UNION SELECT BranchNumber,0 FROM ItemSale How to express the '0' in LINQ? var unionQuery = (from dept in Department select new { dept.BranchNumber, dept.QuantitySold, }) .Concat(from item in ItemSale select new { item.BranchNumber, 0 });

    Read the article

  • How to retrieve values of an enumeration of given string literal

    - by TonyP
    Need to get a value of an enumeration of a given string literal like "xlCenter" (these values are cut and pasted from Excel Macro). I would like to retrieve the actual constant value (int) -4108="xLCenter" via com marshaling is this possible ? if so how ? Ideally I am looking for function like this public int ExcelConstant(string constantName) { ...} Thanks

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >