Search Results

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

Page 120/205 | < Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >

  • What does this regex do?

    - by Lizard
    ^.+\\(.*\\) I am struggling to work this one out, any help would be greatly appreciated... also is there a site that lets youu paste in a regular expression then spits out in plain text what it means?

    Read the article

  • Zxing project as library in a project won't build

    - by iie
    ( again ) I want to use the ZXing library in my project, I followed this tutorial http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/ [ only difference I'm using netbeans ]after building zxing android project and marking it as a library, I wanted to od it as a library in my own project. After doing it, I can't build it. It looks like the R file can't be created in both [library and myProject ] for example: error: constant expression required case R.id.zxinglib_auto_focus:

    Read the article

  • How to access a named element of a derived user control in silverlight ?

    - by Mrt
    Hello, I have a custom base user control in silverlight. <UserControl x:Class="Problemo.MyBaseControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <Border Name="HeaderControl" Background="Red" /> </Grid> </UserControl> With the following code behind public partial class MyBaseControl : UserControl { public UIElement Header { get; set; } public MyBaseControl() { InitializeComponent(); Loaded += MyBaseControl_Loaded; } void MyBaseControl_Loaded(object sender, RoutedEventArgs e) { HeaderControl.Child = Header; } } I have a derived control. <me:MyBaseControl x:Class="Problemo.MyControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:me="clr-namespace:Problemo" d:DesignHeight="300" d:DesignWidth="400"> <me:MyBaseControl.Header> <TextBlock Name="header" Text="{Binding Text}" /> </me:MyBaseControl.Header> </me:MyBaseControl> With the following code behind. public partial class MyControl : MyBaseControl { public string Text { get; set; } public MyControl(string text) { InitializeComponent(); Text = text; } } I'm trying to set the text value of the header textblock in the derived control. It would be nice to be able to set both ways, i.e. with databinding or in the derived control code behind, but neither work. With the data binding, it doesn't work. If I try in the code behind I get a null reference to 'header'. This is silverlight 4 (not sure if that makes a difference) Any suggestions on how to do with with both databinding and in code ? Cheers

    Read the article

  • How can I replace a plus sign in JavaScript?

    - by William Calleja
    I need to make a replace of a plus sign in a javascript string. there might be multiple occurrence of the plus sign so I did this up until now: myString= myString.replace(/+/g, "");# This is however breaking up my javascript and causing glitches. How do you escape a '+' sign in a regular expression?

    Read the article

  • Is Odersky serious with "bills !*&^%~ code!" ?

    - by stacker
    In his book programming in scala (Chapter 5 Section 5.9 Pg 93) Odersky mentioned this expression "bills !*&^%~ code! In the footnote on same page: "By now you should be able to figure out that given this code,the Scala compiler would invoke (bills.!*&^%~(code)).!()." That's a bit to cryptic for me, could someone explain what's going on here?

    Read the article

  • How do I get the length of a regex match in vim?

    - by misfo
    If I want to get the length of each match within the parentheses in the following regex, how do I do it?: ^\(\-\+\s\)\+ I'm trying to modify the width of columns in a buffer with data that is laid out as a table. Since the first two rows of the table will look like this DESIGN_ID DESIGN_YEAR SOURCE_REFERENCE ---------- ----------- ---------------- I want to use the regular expression to find the current width of each column.

    Read the article

  • Parsing text file in python

    - by Ockonal
    Hello, I have html-file. I have to replace all text between this: [%anytext%]. As I understand, it's very easy to do with BeautifulSoup for parsing hmtl. But what is regular expression and how to remove&write back text data?

    Read the article

  • Regex Matches not working as excepted

    - by Eibx
    Hi StackOverflow, I'm trying to group the following string into three groups. 0:0:Awesome:awesome That being "0", "0" and "Awesome:awesome" Using this regular expression: ^([0-9]+)\:([0-9]*)\:(.*)$ It works fine on online regex services: http://rubular.com/r/QePxt57EwU But it seems like .NET doesn't agree.

    Read the article

  • XmlDocument filter nodes by datetime string

    - by Eatdoku
    Trying to apply filter / attribute comparison in the Xmldocument. Obviously , the following code snippet wouldn't work because the expression can't be converted using number() function. (according to the answer of my other question). I'm wondering if there is a way to do the DateTime string comparison in XmlDoc. XmlNodeList test = x2PathDoc.SelectNodes("//Config /Entity [@TargetDateTime> '2010-12-19T03:25:00-08:00']");

    Read the article

  • How to use CREATE LOGIN sql statement?

    - by truthseeker
    Hi, How to use CREATE LOGIN statement on SQL Server 2005? I was trying nearly everything, with commas, without them, with strings, without them etc. CREATE LOGIN @loginame WITH PASSWORD = 'pass', DEFAULT_DATABASE='dbname' DEFAULT_LANGUAGE='us_english', CHECK_POLICY= OFF; I always get below error: Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.

    Read the article

  • Regex to Exclude Double spaces

    - by Ian
    Hi, I am looking for a regular expression for c# asp.net 3.5 that will fail if there are ever any double spaces in a sentence or group of words. the cat chased the dog = true the cat chased the dog = false (doubles spaces occur at random intervals) thanks

    Read the article

  • Can this be imporved? Scrubing of dangerous html tags.

    - by chobo2
    Hi I been finding that for something that I consider pretty import there is very little information or libraries on how to deal with this problem. I found this while searching. I really don't know all the million ways that a hacker could try to insert the dangerous tags. I have a rich html editor so I need to keep non dangerous tags but strip out bad ones. So is this script missing anything? It uses html agility pack. public string ScrubHTML(string html) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); //Remove potentially harmful elements HtmlNodeCollection nc = doc.DocumentNode.SelectNodes("//script|//link|//iframe|//frameset|//frame|//applet|//object|//embed"); if (nc != null) { foreach (HtmlNode node in nc) { node.ParentNode.RemoveChild(node, false); } } //remove hrefs to java/j/vbscript URLs nc = doc.DocumentNode.SelectNodes("//a[starts-with(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'javascript')]|//a[starts-with(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'jscript')]|//a[starts-with(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'vbscript')]"); if (nc != null) { foreach (HtmlNode node in nc) { node.SetAttributeValue("href", "#"); } } //remove img with refs to java/j/vbscript URLs nc = doc.DocumentNode.SelectNodes("//img[starts-with(translate(@src, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'javascript')]|//img[starts-with(translate(@src, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'jscript')]|//img[starts-with(translate(@src, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'vbscript')]"); if (nc != null) { foreach (HtmlNode node in nc) { node.SetAttributeValue("src", "#"); } } //remove on<Event> handlers from all tags nc = doc.DocumentNode.SelectNodes("//*[@onclick or @onmouseover or @onfocus or @onblur or @onmouseout or @ondoubleclick or @onload or @onunload]"); if (nc != null) { foreach (HtmlNode node in nc) { node.Attributes.Remove("onFocus"); node.Attributes.Remove("onBlur"); node.Attributes.Remove("onClick"); node.Attributes.Remove("onMouseOver"); node.Attributes.Remove("onMouseOut"); node.Attributes.Remove("onDoubleClick"); node.Attributes.Remove("onLoad"); node.Attributes.Remove("onUnload"); } } // remove any style attributes that contain the word expression (IE evaluates this as script) nc = doc.DocumentNode.SelectNodes("//*[contains(translate(@style, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'expression')]"); if (nc != null) { foreach (HtmlNode node in nc) { node.Attributes.Remove("stYle"); } } return doc.DocumentNode.WriteTo(); }

    Read the article

  • In what situation should the built-in 'operator' module be used in python?

    - by apphacker
    I'm speaking of this module: http://docs.python.org/library/operator.html From the article: The operator module exports a set of functions implemented in C corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expression x+y. The function names are those used for special class methods; variants without leading and trailing __ are also provided for convenience. I'm not sure I understand the benefit or purpose of this module.

    Read the article

  • PHP 'instanceof' failing with class constant

    - by Nathan Loding
    I'm working on a framework that I'm trying to type as strongly as I possibly can. (I'm working within PHP and taking some of the ideas that I like from C# and trying to utilize them within this framework.) I'm creating a Collection class that is a collection of domain entities/objects. It's kinda modeled after the List<T> object in .Net. I've run into an obstacle that is preventing me from typing this class. If I have a UserCollection, it should only allow User objects into it. If I have a PostCollection, it should only allow Post objects. All Collections in this framework need to have certain basic functions, such as add, remove, iterate. I created an interface, but found that I couldn't do the following: interface ICollection { public function add($obj) } class PostCollection implements ICollection { public function add(Post $obj) {} } This broke it's compliance with the interface. But I can't have the interface strongly typed because then all Collections are of the same type. So I attempted the following: interface ICollection { public function add($obj) } abstract class Collection implements ICollection { const type = 'null'; } class PostCollection { const type = 'Post'; public function add($obj) { if(!($obj instanceof self::type)) { throw new UhOhException(); } } } When I attempt to run this code, I get syntax error, unexpected T_STRING, expecting T_VARIABLE or '$' on the instanceof statement. A little research into the issue and it looks like the root of the cause is that $obj instanceof self is valid to test against the class. It appears that PHP doesn't process the entire self::type constant statement in the expression. Adding parentheses around the self::type variable threw an error regarding an unexpected '('. An obvious workaround is to not make the type variable a constant. The expression $obj instanceof $this->type works just fine (if $type is declared as a variable, of course). I'm hoping that there's a way to avoid that, as I'd like to define the value as a constant to avoid any possible change in the variable later. Any thoughts on how I can achieve this, or have I take PHP to it's limit in this regard? Is there a way of "escaping" or encapsulating self::this so that PHP won't die when processing it?

    Read the article

  • win32 ruby1.9 regexp and cyrillic string

    - by scriper
    #coding: utf-8 str2 = "asdf????????" p str2.encoding #<Encoding:UTF-8> p str2.scan /\p{Cyrillic}/ #found all cyrillic charachters str2.gsub!(/\w/u,'') #removes only latin characters puts str2 The question is why \w ignore cyrillic characters? I have installed latest ruby package from http://rubyinstaller.org/. Here is my output of ruby -v ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] As far as i know 1.9 oniguruma regular expression library has full support for unicode characters.

    Read the article

  • Can this be improved? Scrubing of dangerous html tags.

    - by chobo2
    I been finding that for something that I consider pretty import there is very little information or libraries on how to deal with this problem. I found this while searching. I really don't know all the million ways that a hacker could try to insert the dangerous tags. I have a rich html editor so I need to keep non dangerous tags but strip out bad ones. So is this script missing anything? It uses html agility pack. public string ScrubHTML(string html) { HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(html); //Remove potentially harmful elements HtmlNodeCollection nc = doc.DocumentNode.SelectNodes("//script|//link|//iframe|//frameset|//frame|//applet|//object|//embed"); if (nc != null) { foreach (HtmlNode node in nc) { node.ParentNode.RemoveChild(node, false); } } //remove hrefs to java/j/vbscript URLs nc = doc.DocumentNode.SelectNodes("//a[starts-with(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'javascript')]|//a[starts-with(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'jscript')]|//a[starts-with(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'vbscript')]"); if (nc != null) { foreach (HtmlNode node in nc) { node.SetAttributeValue("href", "#"); } } //remove img with refs to java/j/vbscript URLs nc = doc.DocumentNode.SelectNodes("//img[starts-with(translate(@src, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'javascript')]|//img[starts-with(translate(@src, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'jscript')]|//img[starts-with(translate(@src, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'vbscript')]"); if (nc != null) { foreach (HtmlNode node in nc) { node.SetAttributeValue("src", "#"); } } //remove on<Event> handlers from all tags nc = doc.DocumentNode.SelectNodes("//*[@onclick or @onmouseover or @onfocus or @onblur or @onmouseout or @ondoubleclick or @onload or @onunload]"); if (nc != null) { foreach (HtmlNode node in nc) { node.Attributes.Remove("onFocus"); node.Attributes.Remove("onBlur"); node.Attributes.Remove("onClick"); node.Attributes.Remove("onMouseOver"); node.Attributes.Remove("onMouseOut"); node.Attributes.Remove("onDoubleClick"); node.Attributes.Remove("onLoad"); node.Attributes.Remove("onUnload"); } } // remove any style attributes that contain the word expression (IE evaluates this as script) nc = doc.DocumentNode.SelectNodes("//*[contains(translate(@style, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'), 'expression')]"); if (nc != null) { foreach (HtmlNode node in nc) { node.Attributes.Remove("stYle"); } } return doc.DocumentNode.WriteTo(); }

    Read the article

  • Quick question regarding this issue, Why doesnt it print out the second value(converted second value

    - by sil3nt
    Quick question, What have I done wrong here. The purpose of this code is to get the input into a string, the input being "12 34", with a space in between the "12" and "32" and to convert and print the two separate numbers from an integer variable known as number. Why doesn't the second call to the function copyTemp, not produce the value 34?. I have an index_counter variable which keeps track of the string index and its meant to skip the 'space' character?? what have i done wrong? thanks. #include <stdio.h> #include <string.h> int index_counter = 0; int number; void copyTemp(char *expr,char *temp); int main(){ char exprstn[80]; //as global? char tempstr[80]; gets(exprstn); copyTemp(exprstn,tempstr); printf("Expression: %s\n",exprstn); printf("Temporary: %s\n",tempstr); printf("number is: %d\n",number); copyTemp(exprstn,tempstr); //second call produces same output shouldnt it now produce 34 in the variable number? printf("Expression: %s\n",exprstn); printf("Temporary: %s\n",tempstr); printf("number is: %d\n",number); return 0; } void copyTemp(char *expr,char *temp){ int i; for(i = index_counter; expr[i] != '\0'; i++){ if (expr[i] == '0'){ temp[i] = expr[i]; } if (expr[i] == '1'){ temp[i] = expr[i]; } if (expr[i] == '2'){ temp[i] = expr[i]; } if (expr[i] == '3'){ temp[i] = expr[i]; } if (expr[i] == '4'){ temp[i] = expr[i]; } if (expr[i] == '5'){ temp[i] = expr[i]; } if (expr[i] == '6'){ temp[i] = expr[i]; } if (expr[i] == '7'){ temp[i] = expr[i]; } if (expr[i] == '8'){ temp[i] = expr[i]; } if (expr[i] == '9'){ temp[i] = expr[i]; } if (expr[i] == ' '){ temp[i] = '\0'; sscanf(temp,"%d",&number); index_counter = i+1; //skips? } } // is this included here? temp[i] = '\0'; }

    Read the article

< Previous Page | 116 117 118 119 120 121 122 123 124 125 126 127  | Next Page >