Search Results

Search found 2155 results on 87 pages for 'mathematical expressions'.

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

  • Understanding Regular Expressions (focus on URL Rewrite)–Part 11 (Sub-Part 2 of 2)

    - by OWScott
    This 2nd part (out of 2) on Regular Expressions covers the remaining tips necessary to get up to speed on a topic that at first seems daunting, but really isn’t that bad. Whether you use Regular Expressions for URL Rewrite, Visual Studio, PowerShell, programming or any other tool, these tips will allow you to understand the essentials of Regular Expressions. Be sure to watch Part 1 first. This is week 11 of a 52 week series on various web administration related tasks. Past and future videos can be found here.

    Read the article

  • Visual Studio 2010 Find and Replace With Regular Expressions

    - by Lance Robinson
    Here is a quick notes about using regular expressions in the VS2010 Find Replace dialog.  1.  To create a backreference, use curly braces (“{“ and “}” ) instead of regular parentheses. 2.  To use the captured backreference, use \1\2 etc, where \1 is the first captured value, \2 is the second captured value, etc. Example: I want to find*: info.setFieldValue(param1, param2); and replace it with: SetFieldValue(info, param1, param2); To do this, I can use the following find/replace values: Find what: {[a-zA-Z0-9]+}.setFieldValue\({[a-zA-Z0-9., ]+}\); Replace with: SetFieldValue(\1, \2); Use Regular Expressions is checked, of course. *If you’re wondering why I’d want to do this – because I don’t have control over the setFieldValue function – its in a third party library that doesn’t behave in a very friendly manner. Technorati Tags: Visual Studio,Regular Expressions

    Read the article

  • Executing a modified expression

    - by Sam
    I found this brief demo: http://msdn.microsoft.com/en-us/library/bb546136.aspx Which discusses modifying an expression. However the code starts with a Expression<Func<string, bool>> and ends up with a Expression so it's not complete. How do I take that expression and make it typed as Expression<Func<string,bool>> again? All the examples I have have found on executing an expression all involve dynamically created expressions which is not what this case has. Here the original expression is defined at compile time. And the code I want to write to do this won't know much about the expression, ideally as little as possible. I definately can't see how I would know what "Paramaters" to pass to Expression.LambdaExpression... In my particular case I want to search for any references to a particular propery of type A and swap them out with a reference to a property of type B then pass the expression to a call to IEnumerable.Where. ie. p=>p.Name == "Sam" where P is Foo1 becomes p=>p.FirstName == "Sam" where p is Foo2

    Read the article

  • Regular Expressions Reference Tables Updated

    - by Jan Goyvaerts
    The regular expressions reference on the Regular-Expressions.info website was completely overhauled with the big update of that site last month. In the past, the reference section consisted of two parts. One part was a summary of the regex features commonly found in Perl-style regex flavors with short descriptions and examples. This part of the reference ignored differences between regex flavors and omitted most features that don’t have wide support. The other part was a regular expression flavor comparison that listed many more regex features along with YES/no indicators for many regex flavors, but without any explanations of the features. When reworking the site, I wanted to make the reference section more detailed, with descriptions and examples of all the syntax supported by the flavors discussed on the site. Doing that resulted in a reference that lists many features that are only supported by a few regex flavors. For such a reference to be usable, it needs to indicate which flavors support each feature. My original design for the new reference table used two rows for each feature. The first row had 4 columns with a label, syntax, description, and example, similar to the old reference tables. The second row had 20 columns indicating which versions of which flavors support these features. While the double-row design allowed all the information to fit within the table without requiring horizontal scrolling, it made it more difficult to quickly scan the tables for the feature you’re looking for. To make the new reference tables easier to read, they now have only a single row for each feature. The first 4 columns are the same as before. The remaining two columns show which versions of two regular expression flavors support the feature. You can use the drop-down lists above the table to choose the flavors the table should indicate. The site uses cookies to allow the flavor choices to persist while you navigate the reference. The result of this latest update is that the new regex tables are now just as easy to read as the ten-year-old tables on the old site were, while still covering all the features big and small of all the flavors discussed on the site.

    Read the article

  • Second Edition of Regular Expressions Cookbook Has Been Published

    - by Jan Goyvaerts
    %COOKBOOKFRAME% The first edition of Regular Expressions Cookbook was published in May of 2009. It quickly became a bestseller, briefly holding the #1 spot in computer books on Amazon.com. It also had staying power. The ebook version was O’Reilly’s top seller during the whole year of 2010. So it’s no surprise that our editor at O’Reilly soon contacted us for a second edition. With Steven and I always being very busy, those plans were delayed until finally both of us found the time to update the book. Work started in January. Today you can buy your own copy of the second edition of Regular Expressions Cookbook. O’Reilly’s online shop sells the eBook in DRM-free ePub, Mobi, and PDF formats for $39.99 and the print version for $49.99. These are the list prices for the eBook and the print book. If you’re looking for a discount and free shipping of the print book, you can pre-order on one of the various Amazon sites. Deliveries should start soon. The discount rates differ and are subject to change. Amazon will also pay me an affiliate commission if you use one of these links, which pretty much doubles the income I get from the book. Amazon.com. Free shipping to the USA. Amazon.co.uk. Free shipping to the UK and Ireland. Amazon.fr. Free shipping to France, Monaco, Luxembourg, and Belgium. Amazon.de. Free shipping to Germany, Austria, Switzerland, Luxembourg, Liechtenstein, Belgium, and The Netherlands. If you don’t want to wait for the print book to arrive, the Kindle edition is already available for instant delivery. The Kindle edition works on Amazon’s Kindle hardware, and on PCs via Amazon’s Kindle software (free download). Amazon.com Amazon.co.uk Amazon.fr Amazon.de I’ll blog more about the book in the coming days and weeks with details about what’s new in the second edition.

    Read the article

  • Second Edition of Regular Expressions Cookbook Now In Stock at Amazon.com

    - by Jan Goyvaerts
    %COOKBOOKFRAME% The second edition of Regular Expressions Cookbook is now in stock as a printed book Amazon.com. Right now, the printed book is discounted 45% to $27.51, which is actually more than a dollar cheaper than the Kindle edition. The European Amazon sites don’t have the printed book in stock yet. But it shouldn’t take too long for the book to make it from the US to Europe. They do have the Kindle edition.

    Read the article

  • Regular Expressions Cookbook Is in The Money—Win a Copy

    - by Jan Goyvaerts
    %COOKBOOKFRAME%You may have heard some people say that most book authors never get any royalties. That’s not true because most authors get an advance royalty that is paid before the book is published. That’s the author’s main incentive for writing the book, at least as far as money is concerned. (If money is your main concern, don’t write books.) What is true is that most authors never see any money beyond the advance royalty. Royalty rates are very low. A 10% royalty of the publisher’s price is considered normal. The publisher’s price is usually 45% of the retail price. So if you pay full price in a bookstore, the author gets 4.5% of your money. If there’s more than one author, they split the royalty. It doesn’t take a math degree to figure out that a book needs to sell quite a few copies for the royalty to add up to a meaningful amount of money. But Steven and I must have done something right. Regular Expressions Cookbook is in the money. My royalty statement for the 3rd quartier of 2009, which is the 2nd quarter that the book was on the market, came with a check. I actually received it last month but didn’t get around to blogging about. The amount of the check is insignificant. The point is that the balance is no longer negative. I’m taking this opportunity to pat myself and my co-author on the back. To celebrate the occassion O’Reilly has offered to sponsor a give-away of five (5) copies of Regular Expressions Cookbook. These are the rules of the game: You must post a comment to this blog article including your actual name and actual email address. Names are published, email addresses are not. Comments are moderated by myself (Jan Goyvaerts). If I consider a comment to be offensive or spam it will not be published and not be eligible for any prize. If you don’t know what to say in the comment, just wish me a happy 100000nd birthday, so I don’t have to feel so bad about entering the 6-bit era. Each person commenting has only one chance to win, regardless of the number of comments posted. O’Reilly will be provided with the names and email addresses of the winners (and those email addresses only) in order to arrange delivery. Each winner can choose to receive a printed copy or ebook (DRM-free PDF). If you choose the printed book, O’Reilly pays for shipping to anywhere in the world but not for any duties or taxes your country may impose on books imported from the USA. If you choose the ebook, you’ll need to create an O’Reilly account that is then granted access to the PDF download. You can make your choice after you’ve won, so it doesn’t influence your chance of winning. Contest ends 28 February 2010, GMT+7 (Thai time). Chosen by five calls to Random(78)+1 in Delphi 2010, the winners are: 48: Xiaozu 45: David Chisholm 19: Miquel Burns 33: Aaron Rice 17: David Laing Thanks to everybody who participated. The winners have been notified by email on how to collect their prize.

    Read the article

  • Article : les expressions régulières revisitées, clair et exhaustif, tout ce qu'il vous faut pour le

    Bonsoir, Cette discussion est consacrée à l'article sur les expressions régulières. Cet article présente le fonctionnement des expressions régulières, la syntaxe et l'utilisation de cet outil avec .Net. http://stormimon.developpez.com/dotn...ns-regulieres/ N'hésitez pas à poster vos commentaires et remarques concernant l'article afin de m'aider à l'améliorer. Bonne lecture ...

    Read the article

  • Parsing mathematical experssions with two values that have parenthesis and minus signs

    - by user45921
    I'm trying to parse equations like these which only has two values or the square root of a certain value from a text file: 100+100 -100-100 -(100)+(-100) sqrt(100) by the minues signs, parenthesis and the operator symbol in the middle and the square root, and I have no idea how to start off... I've got the file part done and the simple calculation parts except that I couldnt get my program to solve the equations in the above. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> main(){ FILE *fp; char buff[255], sym,sym2,del1,del2,del3,del4; double num1, num2; int ret; fp = fopen("input.txt","r"); while(fgets(buff,sizeof(buff),fp)!=NULL){ char *tok = buff; sscanf(tok,"%lf%c%lf",&num1,&sym,&num2); switch(sym){ case '+': printf("%lf\n", num1+num2); break; case '-': printf("%lf\n", num1-num2); break; case '*': printf("%lf\n", num1*num2); break; case '/': printf("%lf\n", num1/num2); break; default: printf("The input value is not correct\n"); break; } } fclose(fp); } that is what have I written for the other basic operations without parenthesis and the minus sign for the second value and it works great for the simple ones. I'm using a switch method to calculate the add, sub, mul and divide but I'm not sure how to properly use the sscanf function (if I am not using it properly) or if there is another way using a function like strtok to properly parse the parenthesis and the minus signs. Any kind help?

    Read the article

  • Using NumPy arrays as 2D mathematical vectors?

    - by CorundumGames
    Right now I'm using lists as position, velocity, and acceleration vectors in my game. Is that a better option than using NumPy's arrays (not the standard library's) as vectors (with float data types)? I'm frequently adding vectors and changing their values directly, then placing the values in these vectors into a Pygame Rect. The vector is used for position (because Rects can't hold floats, so we can't go "between" pixels), and the Rect is used for rendering (because Pygame will only take in Rects for rendering positions).

    Read the article

  • Non-mathematical Project Euler (or similar)?

    - by Juha Untinen
    I checked the post (Where can I find programming puzzles and challenges?) where there's a lot of programming challenges and such, but after checking several of them, they all seem to be about algorithms and mathematics. Is there a similar site for purely logic/functionality-based challenges? For example: - Retrieve data using a web service - Generate output X from a CSV file - Protect this code against SQL injection - Make this code more secure - What is wrong with this code (where the error is in logic, not syntax) - Make this loop more efficient Does a challenge site like that exist? Especially one that provides hints and/or correct solutions. That would be a very helpful learning site.

    Read the article

  • Passing in a lambda to a Where statement

    - by sonicblis
    I noticed today that if I do this: var items = context.items.Where(i => i.Property < 2); items = items.Where(i => i.Property > 4); Once I access the items var, it executes only the first line as the data call and then does the second call in memory. However, if I do this: var items = context.items.Where(i => i.Property < 2).Where(i => i.Property > 4); I get only one expression executed against the context that includes both where statements. I have a host of variables that I want to use to build the expression for the linq lambda, but their presence or absence changes the expression such that I'd have to have a rediculous number of conditionals to satisfy all cases. I thought I could just add the Where() statements as in my first example above, but that doesn't end up in a single expression that contains all of the criteria. Therefore, I'm trying to create just the lambda itself as such: //bogus syntax if (var1 == "something") var expression = Expression<Func<item, bool>>(i => i.Property == "Something); if (var2 == "somethingElse") expression = expression.Where(i => i.Property2 == "SomethingElse"); And then pass that in to the where of my context.Items to evaluate. A) is this right, and B) if so, how do you do it?

    Read the article

  • What’s New in Delphi XE6 Regular Expressions

    - by Jan Goyvaerts
    There’s not much new in the regular expression support in Delphi XE6. The big change that should be made, upgrading to PCRE 8.30 or later and switching to the pcre16 functions that use UTF-16, still hasn’t been made. XE6 still uses PCRE 7.9 and thus continues to require conversion from the UTF-16 strings that Delphi uses natively to the UTF-8 strings that older versions of PCRE require. Delphi XE6 does fix one important issue that has plagued TRegEx since it was introduced in Delphi XE. Previously, TRegEx could not find zero-length matches. So a regex like (?m)^ that should find a zero-length match at the start of each line would not find any matches at all with TRegEx. The reason for this is that TRegEx uses TPerlRegEx to do the heavy lifting. TPerlRegEx sets its State property to [preNotEmpty] in its constructor, which tells it to skip zero-length matches. This is not a problem with TPerlRegEx because users of this class can change the State property. But TRegEx does not provide a way to change this property. So in Delphi XE5 and prior, TRegEx cannot find zero-length matches. In Delphi XE6 TPerlRegEx’s constructor was changed to initialize State to the empty set. This means TRegEx is now able to find zero-length matches. TRegex.Replace() using the regex (?m)^ now inserts the replacement at the start of each line, as you would expect. If you use TPerlRegEx directly, you’ll need to set State to [preNotEmpty] in your own code if you relied on its behavior to skip zero-length matches. You will need to check existing applications that use TRegEx for regular expressions that incorrectly allow zero-length matches. In XE5 and prior, TRegEx using \d* would match all numbers in a string. In XE6, the same regex still matches all numbers, but also finds a zero-length match at each position in the string. RegexBuddy 4 warns about zero-length matches on the Create panel if you set it to Detailed mode. At the bottom of the regex tree there will be a node saying either “your regular expression may find zero-length matches” or “zero-length matches will be skipped” depending on whether your application allows zero-length matches (XE6 TRegEx) or not (XE–XE5 TRegEx).

    Read the article

  • Understanding Regular Expressions (focus on URL Rewrite)–Part 10 (Sub-Part 1 of 2)

    - by OWScott
    Regular Expressions can seem difficult to understand.  In today’s lesson I attempt to bring this down to earth and make it understandable and useful for the web administrator.  While this focuses on URL Rewrite, this lesson is useful for Visual Studio, ASP.NET development and JavaScript development also. I couldn’t keep this within 10-15 minutes so this is Part 1 of 2 on Regular Expressions. This is week 10 of a 52 week series on various web administration related tasks.  Past and future videos can be found here.

    Read the article

  • Using lookahead assertions in regular expressions

    - by Greg Jackson
    I use regular expressions on a daily basis, as my daily work is 90% in Perl (legacy codebase, but that's a different issue). Despite this, I still find lookahead and lookbehind to be terribly confusing and often unreadable. Right now, if I were to get a code review with a lookahead or lookbehind, I would immediately send it back to see if the problem can be solved by using multiple regular expressions or a different approach. The following are the main reasons I tend not to like them: They can be terribly unreadable. Lookahead assertions, for example, start from the beginning of the string no matter where they are placed. That, among other things, can cause some very "interesting" and non-obvious behaviors. It used to be the case that many languages didn't support lookahead/lookbehind (or supported them as "experimental features"). This isn't the case quite as much, but there's still always the question as to how well it's supported. Quite frankly, they feel like a dirty hack. Regexps often already are, but they can also be quite elegant, and have gained widespread acceptance. I've gotten by without any need for them at all... sometimes I think that they're extraneous. Now, I'll freely admit that especially the last two reasons aren't really good ones, but I felt that I should enumerate what goes through my mind when I see one. I'm more than willing to change my mind about them, but I feel that they violate some of my core tenets of programming, including: Code should be as readable as possible without sacrificing functionality -- this may include doing something in a less efficient, but clearer was as long as the difference is negligible or unimportant to the application as a whole. Code should be maintainable -- if another programmer comes along to fix my code, non-obvious behavior can hide bugs or make functional code appear buggy (see readability) "The right tool for the right job" -- I'm sure you can come up with contrived examples that could use lookahead, but I've never come across something that really needs them in my real-world development work. Is there anything that they're really the best tool for, as opposed to, say, multiple regexps (or, alternatively, are they the best tool for most cases they're used for today). My question is this: Is it good practice to use lookahead/lookbehind in regular expressions, or are they simply a hack that have found their way into modern production code? I'd be perfectly happy to be convinced that I'm wrong about this, and simple examples are useful for examples or illustration, but by themselves, won't be enough to convince me.

    Read the article

  • Escaping In Expressions

    The expressions language is a C style syntax, so you may need to escape certain characters, for example: "C:\FolderPath\" + @VariableName Should be "C:\\FolderPath\\" + @VariableName Another use of the escape sequence allows you to specify character codes, like this \xNNNN, where NNNN is the Unicode character code that you want. For example the following expression will produce the same result as the previous example as the Unicode character code 005C equals a back slash character: "C:\x005CFolderPath\x005C" + @VariableName For more information about Unicode characters see http://www.unicode.org/charts/ Literals are also supported within expressions, both string literals using the common escape sequence syntax as well as modifiers which influence the handling of numeric values. See the "Literals (SSIS)":http://msdn2.microsoft.com/en-US/library/ms141001(SQL.90).aspx topic. Using the Unicode escaped character sequence you can make up for the lack of a CHAR function or equivalent.

    Read the article

  • Dynamic filter expressions in an OpenAccess LINQ query

    We had some support questions recently where our customers had the need to combine multiple smaller predicate expressions with either an OR or an AND  logical operators (these will be the || and && operators if you are using C#). And because the code from the answer that we sent to these customers is very interesting, and can easily be refactorred into something reusable, we decided to write this blog post. The key thing that one must know is that if you want your predicate to be translated by OpenAccess ORM to SQL and executed on the server you must have a LINQ Expression that is not compiled. So, let’s say that you have these smaller predicate expressions: Expression<Func<Customer, bool>> filter1 = c => c.City.StartsWith("S");Expression<Func<Customer, bool>> filter2 = c => c.City.StartsWith("M");Expression<Func<Customer, bool>> filter3 = c => c.ContactTitle == "Owner"; And ...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • What is the motivation behind c++0x lambda expressions?

    - by LoudNPossiblyRight
    I am trying to find out if there is an actual computational benefit to using lambda expressions in c++, namely "this code compiles/runs faster/slower because we use lambda expressions" OR is it just a neat development perk open for abuse by poor coders trying to look cool? Thanks. PS. I understand this question may seem subjective but i would much appreciate the opinion of the community on this matter.

    Read the article

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