Search Results

Search found 5101 results on 205 pages for 'expression trees'.

Page 161/205 | < Previous Page | 157 158 159 160 161 162 163 164 165 166 167 168  | Next Page >

  • Troubles with NSString writeToFile

    - by Jesse
    Hi everyone, I have been working on a simple text editor in Cocoa/Objective-C for a practice project and I have come across an error that I would never have expected. I have an NSString for my file's contents as well as an NSString for it's path. When I attempt to write the contents to a file, I use the following method: [FileContents writeToFile: CurrentFileName atomically: NO encoding: NSStringEncoding error: nil]; I've used this method many times without error yet today, I am getting an error: "Expected expression before 'NSStringEncoding'" If anyone can help me out with this it would be greatly appreciated. I can't figure out what could be causing the error. Thanks a lot!

    Read the article

  • Why isn't the compiler smarter in this const function overloading problem?

    - by Frank
    The following code does not compile: #include <iostream> class Foo { std::string s; public: const std::string& GetString() const { return s; } std::string* GetString() { return &s; } }; int main(int argc, char** argv){ Foo foo; const std::string& s = foo.GetString(); // error return 0; } I get the following error: const1.cc:11: error: invalid initialization of reference of type 'const std::string&' from expression of type 'std::string* It does make some sense because foo is not of type const Foo, but just Foo, so the compiler wants to use the non-const function. But still, why can't it recognize that I want to call the const GetString function, by looking at the (type of) variable I assign it to? I found this kind of surprising.

    Read the article

  • Is allocating a dynamic array without specifying size well formed code?

    - by Als
    The following simple program snippet gives compilation errorswith gcc-4.3.4. Program: int main() { char *ptr = new char[10]; char *ptr1 = new char[]; return 0; } Compilation errors: prog.cpp: In function ‘int main()’: prog.cpp:4: error: expected primary-expression before ‘]’ token prog.cpp:3: warning: unused variable ‘ptr’ prog.cpp:4: warning: unused variable ‘ptr1’ But the same compiles cleanly with MSVC without any diagnostic message. So my question is: Does the Standard allow an new [] to be called without specifying the size? Or this a bug in MSVC? Can someone provide a reference from the standard which will conclusively say that the above code example is ill-formed or well-formed? I have had a look at: 5.3.4 New [expr.new] & 18.4.1.2 Array forms [lib.new.delete.array] but couldnt find any conclusive evidence about the behavior.

    Read the article

  • Regex: How to leave out webding font characters?

    - by DS
    Hi, I've a free text field on my form where the users can type in anything. Some users are pasting text into this field from Word documents with some weird characters that I don't want to go in my DB. (e.g. webding font characters) I'm trying to get a regular expression that would give me only the alphanum and the punctuation characters. But when I try the following, the output is still all the characters. How can I leave them out? <html><body><script type="text/javascript">var str="???????";document.write(str.replace(/[^a-zA-Z 0-9 [:punct]]+/g, " "));</script></body></html>

    Read the article

  • (newbie) type signature "Maybe a" doesn't like "Just [Event]"

    - by sisif
    i'm still learning Haskell and need help with the type inference please! using packages SDL and Yampa i get the following type signature from FRP.Yampa.reactimate: (Bool -> IO (DTime, Maybe a)) and i want to use it for: myInput :: Bool -> IO (DTime, Maybe [SDL.Event]) myInput isBlocking = do event <- SDL.pollEvent return (1, Just [event]) ... reactimate myInit myInput myOutput mySF but it says Couldn't match expected type `()' against inferred type `[SDL.Event]' Expected type: IO (DTime, Maybe ()) Inferred type: IO (DTime, Maybe [SDL.Event]) In the second argument of `reactimate', namely `input' In the expression: reactimate initialize input output process i thought "Maybe a" allows me to use anything, even a SDL.Event list? why is it expecting "Maybe ()" when the type signature is actually "Maybe a"? why does it want an empty tuple, or a function taking no arguments, or what is () supposed to be?

    Read the article

  • Are there design-time watch windows for Visual Studio 2008/2010?

    - by Jeff
    There are many times when I need to test a little snippet of .net code but rebuilding and publishing the entire project or writing a suite of unit tests just seems like overkill. For example, I am writing a regular expression right now and I want to see if it the pattern is matching on the right parts. I could go and find a million other utilities that do that sort of thing, but that is not exactly my point. FireBug has an exact analogue to what I want - the FireBug console. There is a text box where the user can enter some JavaScript and FireBug will execute it on the spot and display the return value. I would love to be able to enter something like (new Regex("b+")).Replace("abc", "x") and see the results without having to do all the overhead. Does VS have anything like this?

    Read the article

  • Replacing Text which does not match a pattern in Oracle

    - by kutekrish
    I have below text in a CLOB in a table Table Name: tbl1 Columns col1 - number (Primary Key) col2 - clob (as below) Row#1 ----- Col1 = 1 Col2 = 1331882981,ab123456,Some text here which can run multiple lines and have a lot of text... ~1331890329,pqr123223,Some more text... Row#2 ----- Col1 = 2 Col2 = 1331882981,abc333,Some text here which can run multiple lines and have a lot of text... ~1331890329,pqrs23,Some more text... Now I need to know how we can get below output Col1 Value ---- --------------------- 1 1331882981,ab123456 1 1331890329,pqr123223 2 1331882981,abc333 2 1331890329,pqrs23 ([0-9]{10},[a-z 0-9]+.), == This is the regular expression to match "1331890329,pqrs23" and I need to know how can replace which are not matching this regex and then split them into multiple rows

    Read the article

  • How to change the text of the multiple asp:label using for loop in C# ASP.NET

    - by Minelava
    I want to change the asp label multiple times. Here is the asp.net code <asp:Label ID="lbl_Text1" runat="server" Text=""> <asp:Label ID="lbl_Text2" runat="server" Text=""> <asp:Label ID="lbl_Text3" runat="server" Text=""> <asp:Label ID="lbl_Text4" runat="server" Text=""> Instead of using this: C# Code lbl_Text1.Text = "hello"; lbl_Text2.Text = "hello"; lbl_Text3.Text = "hello"; lbl_Text4.Text = "hello"; I tried to use for loop for (int i = 1; i <= 4; i++) { lbl_Text[i].Text = "hello"; } And I get this error..... cannot apply indexing with [] to an expression of type 'system.web.ui.webcontrols.label' Is there anyone can help me on that?

    Read the article

  • Prevent RegEx Hang on Large Matches...

    - by developerjay
    This is a great regular expression for dates... However it hangs indefinitely on this one page I tried... I wanted to try this page ( http://pleac.sourceforge.net/pleac%5Fpython/datesandtimes.html ) for the fact that it does have lots of dates on it and I want to grab all of them. I don't understand why it is hanging when it doesn't on other pages... Why is my regexp hanging and/or how could I clean it up to make it better/efficient ? Python Code: monthnames = "(?:Jan\w*|Feb\w*|Mar\w*|Apr\w*|May|Jun\w?|Jul\w?|Aug\w*|Sep\w*|Oct\w*|Nov(?:ember)?|Dec\w*)" pattern1 = re.compile(r"(\d{1,4}[\/\\\-]+\d{1,2}[\/\\\-]+\d{2,4})") pattern4 = re.compile(r"(?:[\d]*[\,\.\ \-]+)*%s(?:[\,\.\ \-]+[\d]+[stndrh]*)+[:\d]*[\ ]?(PM)?(AM)?([\ \-\+\d]{4,7}|[UTCESTGMT\ ]{2,4})*"%monthnames, re.I) patterns = [pattern4, pattern1] for pattern in patterns: print re.findall(pattern, s) btw... when i say im trying it against this site.. I'm trying it against the webpage source.

    Read the article

  • Regex whitespace and special characters

    - by Sam R.
    I have this regular expression: [^\\s\"']+|\"([^\"]*)\"|'([^']*)' which works for splitting a string by white spaces, and anything within a quotation is not delimited. However, I notice that if I put in a string that starts with "" no matches are found. How would I correct this? For example, if I enter " test 2". I want it to match to [, test, 2] Note: using java to compile the regex, here is some code Pattern pattern = Pattern.compile("[^\\s\"']+|\"([^\"]*)\"|'([^']*)'"); Matcher matcher = pattern.matcher(SomeString); while (matcher.find()){ String temp = matcher.group(); //... Do something ... } Thanks.

    Read the article

  • haskell. words into binary numbers

    - by Katja
    I need to convert words into binary numbers. With a bit help of yours I got this blCo::String -> Integer blCo x = num2bin(lett2num x) blCo (x:xs) | x:xs = num2bin(lett2num x):blCo xs num2lett :: Int -> Char num2lett n | (n <= ord 'A') && (n <= ord 'Z') = chr(ord 'A'+ n - 1) | (n <= ord 'a') && (n <= ord 'Z') = chr(ord 'A'+ n - 1) num2bin :: Integer -> String num2bin n | n >= 0 = concatMap show (reverse ( n2b n)) | otherwise = error "num2bin: negative number" where n2b 0 = [] n2b n = n `mod` 2 : n2b (n `div` 2) he tells me a mistake.I dont undertsand it mistake: Couldn't match expected type `Char' against inferred type `String' In the first argument of `lett2num', namely `x' In the first argument of `num2bin', namely `(lett2num x)' In the expression: num2bin (lett2num x)

    Read the article

  • C++ iterators problem

    - by qwead
    I'm working with iterators on C++ and I'm having some trouble here. It says "Debug Assertion Failed" on expression (this-_Has_container()) on line interIterator++. Distance list is a vector< vector< DistanceNode . What I'm I doing wrong? vector< vector<DistanceNode> >::iterator externIterator = distanceList.begin(); while (externIterator != distanceList.end()) { vector<DistanceNode>::iterator interIterator = externIterator->begin(); while (interIterator != externIterator->end()){ if (interIterator->getReference() == tmp){ //remove element pointed by interIterator externIterator->erase(interIterator); } // if interIterator++; } // while externIterator++; } // while

    Read the article

  • what is wrong with my create table SQL?

    - by George2
    Hello everyone, I am using SQL Server 2008 management studio to execute the following SQL statements, and here is the related error message from SQL Server management studio. Any ideas what is wrong? SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO Create TABLE [dbo].[BatchStatus]( [BatchID] [uniqueidentifier] NOT NULL CONSTRAINT [PK_BatchStatus_ID], [BatchStatus] [int] NULL, CONSTRAINT [PK_BatchStatus_ID] PRIMARY KEY CLUSTERED ( [BatchID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO Msg 102, Level 15, State 1, Line 3 Incorrect syntax near ','. Msg 319, Level 15, State 1, Line 8 Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon. thanks in advance, George

    Read the article

  • Splitting up input using regular expressions in Java

    - by Joe24
    I am making a program that lets a user input a chemical for example C9H11N02. When they enter that I want to split it up into pieces so I can have it like C9, H11, N, 02. When I have it like this I want to make changes to it so I can make it C10H12N203 and then put it back together. This is what I have done so far. using the regular expression I have used I can extract the integer value, but how would I go about get C10, H11 etc..? System.out.println("Enter Data"); Scanner k = new Scanner( System.in ); String input = k.nextLine(); String reg = "\\s\\s\\s"; String [] data; data = input.split( reg ); int m = Integer.parseInt( data[0] ); int n = Integer.parseInt( data[1] );

    Read the article

  • Scheduling a visual studio load test using powershell giving me BSOD

    - by user952342
    I have a visual studio load test which I want to run every hour so that I can start to collect some data. To do this, I thought it would be best to make a little powershell script and put a command like this inside: Invoke-Expression -command "& '$env:VS100COMNTOOLS..\IDE\mstest.exe' /testcontainer:"C:\Users\benb\Documents\Visual Studio 2010\Projects\BBPerformanceTest\bin\Debug\HomePageOnly.loadtest"" That command works fine, but sometimes when its run I get a blue screen of death. However, when I run my load test through the visual studio GUI, I never get a BSOD. two questions: is it possible to avoid this BSOD? Is there another way I can schedule my load test? Thanks

    Read the article

  • html links & hover events over certain locations on an image.

    - by Tommy
    So i created a web site a long time ago using a designer alot like frontpage + expression design put together, and since then Ive gotten more into coding, and I'm learning html, CSS, and all that good stuff.. and i have this re-designed header that Ive made here: http://prntscr.com/8zct So what I need to know, is how i can get it so that when a user clicks on one of the links in the header design it will redirect to a page. and also if possible, how to make it so when a user hovers over a link a drop down may appear with other options. As me being quite new to this sort of stuff, could anybody help me achieve this? PS. I'm working in Visual Studio with ASP. but that doesn't change anything about the html and css stuff. just letting you guys know.

    Read the article

  • Question in Flex (parser)

    - by shkk
    Hello... I want to ask you a question about Flex, the program for parsing code. Supposing I have an instruction like this one, in the rules part: "=" BEGIN(attribution); <attribution>{var_name} { fprintf(yyout, "="); ECHO; } <attribution>";" BEGIN(INITIAL); {var_name} is a regular expression that matches a variable's name, and all I want to do is to copy at the output all the attribution instructions, such as a = 3; or b = a; My rule though cannot write with fprintf the left member of the attribution, but only = 3; or =a; One solution for that might be that, after I make the match "=" and I am in the attribution state, to go 2 positions back as to get the left operand as well. How can I do that in Flex?

    Read the article

  • meaning of (\/?) in regex / is (\w+)([^>]*?) a redundancy?

    - by thomas
    this regular expression should match an html start tag, I think. var results = html.match(/<(\/?)(\w+)([^>]*?)>/); I see it should first capture the <, but then I am confused what this capture (\/?) accomplishes. Am I correct in reasoning that the ([^>]*?)> searches for every character except > = 0 times? If so, why is the (\w+) capture necessary? Doesn't it fall within the purview of [^>]*?

    Read the article

  • Multiple LIKE, OR MySql Queries Match

    - by Codex73
    Search for: 'chemist' Problem: query which will match a string like 'onechemist' but not 'chemist'. SELECT id,name FROM `records` WHERE name LIKE '%". mysql_real_escape_string($q) ."%' This alternate try won't work: SELECT id,name FROM `records` WHERE name LIKE '%". mysql_real_escape_string($q) ."%' OR name LIKE '". mysql_real_escape_string($q) ."%' OR name LIKE '%". mysql_real_escape_string($q) ."' How could I compile the above into one single query that will match any field which has the string or optimize the query into a better expression?

    Read the article

  • Emacs auto-minor-mode based on extension

    - by vermiculus
    I found this question somewhat on the topic, but is there a way [in emacs] to set a minor mode (or a list thereof) based on extension? For example, it's pretty easy to find out that major modes can be manipulated like so (setq auto-mode-alist (cons '("\\.notes$" . text-mode) auto-mode-alist)) and what I'd ideally like to be able to do is (setq auto-minor-mode-alist (cons '("\\.notes$" . auto-fill-mode) auto-minor-mode-alist)) The accept answer of the linked question mentions hooks, specifically temp-buffer-setup-hook. To use this, you have to add a function to the hook like so (add-hook 'temp-buffer-setup-hook 'my-func-to-set-minor-mode) My question is two-fold: Is there an easier way to do this, similar to major modes? If not, how would one write the function for the hook? It needs to check the file path against a regular expression. If it matches, activate the desired mode (e.g. auto-fill-mode).

    Read the article

  • Jquery Match() IP Address?

    - by user1635970
    I'm using a jquery script to validate form fields. This works well, but I'd like to change the validation of one field to check for IP Addresses. The regex I want to use is : \b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b How do I amend the below to work with this ? (This is how the validation works for email address) jQuery("#Email").validate({ expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;", message: "Should be a valid Email id" });

    Read the article

  • Bash intercepting wildcard in script

    - by MrRoth
    I am using Bash script to read line by line from a text file, which has special characters in it (regular expression). When I use echo "${SOME_VAR}" it does not display the text as is. I am familiar with Prevent * to be expanded in the bash script. How can I display and use the text as is? UPDATE The text (TSV) file holds tuples similar to (the last entry is a psql query) bathroom bathroom select name from photos where name ~* '\mbathroom((s)?|(''s)?)\M'; I am reading the CSV as follows: tail -n+2 text.file | while IFS=$'\t' read x y z do echo "${z}" done which gives the output select name from photos where name ~* 'mbathroom((s)?|(''s)?)M'); note that the '\' is missing

    Read the article

  • How is a set partitioned into valid and invalid items using LINQ?

    - by Aaron Anodide
    Is there a way to write a single LINQ expression to get the same result of the following code? var validations = new Func<conversion, bool>[] { c => c.affiliate.affiliate_id > 0, c => c.campaign_id > 0 }; var invalidConversions = from c in extractedConversions where validations.Any(valid => !valid(c)) select c; var validConversions = from c in extractedConversions where validations.All(valid => valid(c)) select c;

    Read the article

  • Proper chart scaling in Reporting Services 2005

    - by lastas
    I'm developing a simple bar-chart in Reporting Services 2005 with a stored procedure as data-source. The values in this graph can be both positive and negative, and can span a very big range, and hence I cannot specify any non-dynamic scale that will work for all scenarios. The problem I'm facing is that the automatic scaling pretty much sucks. I get no line to show where the zero-point is, and the y-scale labels are from top to bottom: 8818 -191181 -391181 etc etc... So my question is, what is the best approach to make the scale more adapted to human reading? Is there any guide out there? Does reporting services 2008 handle this better? Also, moving away from Reporting Services is not really an option. I realize how to put values and expression in the max, min, and the gridline interval fields, although its more of a question what expressions I should put there.

    Read the article

  • Searching for URL's Relative to Site Root in Javascript Source

    - by James
    Hi, I am working on a web site with several other developers and we have had problems where people commit JavaScript code with AJAX calls that use URL's relative to the site root. An example would be /Home/Index which will not work if the site is hosted in a virtual directory. To get round the problem we use a $.url() method to convert it to a full path, e.g. $("#container").load($.url("/Home/Index")) I am trying to write a unit test that will search each JavaScript file and find places where the $.url method is not being used. The only problem is that I cannot seem to write a regex expression to do this. I have tried the following: (?!\$\.url\()"(/\w*)+" But this does not work. I cannot find a way to say that I don't want the $.url in front. Does anyone know if this is possible? Note that I need regular expressions that are compatible with .NET Thanks.

    Read the article

< Previous Page | 157 158 159 160 161 162 163 164 165 166 167 168  | Next Page >