Search Results

Search found 2819 results on 113 pages for 'conditional expressions'.

Page 80/113 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • What is Perl's secret of getting small code do so much?

    - by sak
    I've seen many (code-golf) Perl programs out there and even if I can't read them (Don't know Perl) I wonder how you can manage to get such a small bit of code to do what would take 20 lines in some other programming language. What is the secret of Perl? Is there a special syntax that allows you to do complex tasks in few keystrokes? Is it the mix of regular expressions? I'd like to learn how to write powerful and yet short programs like the ones you know from the code-golf challenges here. What would be the best place to start out? I don't want to learn "clean" Perl - I want to write scripts even I don't understand anymore after a week. If there are other programming languages out there with which I can write even shorter code, please tell me.

    Read the article

  • String Functions in IIS Url Rewrite Module

    - by Nariman
    The IIS URL Rewrite Module ships with 3 built-in functions: * ToLower - returns the input string converted to lower case. * UrlEncode - returns the input string converted to URL-encoded format. This function can be used if the substitution URL in rewrite rule contains special characters (for example non-ASCII or URI-unsafe characters). * UrlDecode - decodes the URL-encoded input string. This function can be used to decode a condition input before matching it against a pattern. The functions can be invoked by using the following syntax: {function_name:any_string} The question is: can this list be extended by introducing a Replace function that's available for changing values within a rewrite rule action or condition? Another way to frame the question: is there any way to do a global replace on a URL coming in using this module? It seems that you're limited to using regular expressions and back-references to construct strings, without a search/replace functionality to replace every X with Y in {REQUEST_URI} before issuing a redirect.

    Read the article

  • Problem when reading backslash in Prolog

    - by Jerry
    I'm writing a lexer in Prolog which will be used as a part of functional language interpreter. Language spec allows expressions like for example let \x = x + 2; to occur. What I want lexer to do for such input is to "return": [tokLet, tokLambda, tokVar(x), tokEq, tokVar(x), tokPlus, tokNumber(2), tokSColon] and the problem is, that Prolog seems to ignore the \ character and "returns" the line written above except for tokLambda. One approach to solve this would be to somehow add second backslash before/after every occurrence of one in the program code (because everything works fine if I change the original input to let \\x = x + 2;) but I don't really like it. Any ideas?

    Read the article

  • Regular expression match, extracting only wanted segments of string

    - by Ben Carey
    I am trying to extract three segments from a string. As I am not particularly good with regular expressions, I think what I have done could probably be done better... I would like to extract the bold parts of the following string: SOMETEXT: ANYTHING_HERE (Old=ANYTHING_HERE, New=ANYTHING_HERE) Some examples could be: ABC: Some_Field (Old=,New=123) ABC: Some_Field (Old=ABCde,New=1234) ABC: Some_Field (Old=Hello World,New=Bye Bye World) So the above would return the following matches: $matches[0] = 'Some_Field'; $matches[1] = ''; $matches[2] = '123'; So far I have the following code: preg_match_all('/^([a-z]*\:(\s?)+)(.+)(\s?)+\(old=(.+)\,(\s?)+new=(.+)\)/i',$string,$matches); The issue with the above is that it returns a match for each separate segment of the string. I do not know how to ensure the string is the correct format using a regular expression without catching and storing the match if that makes sense? So, my question, if not already clear, how I can retrieve just the segments that I want from the above string?

    Read the article

  • Debug error in NetBeans

    - by avd
    I am running a C program in NetBeans (cygwin on windows). Generally for all C programs I have run in the past, while debugging, it stops and shows the line number of segmentation fault. But for this particular program, it does not show the line number and just stops and in the output tab, it shows prog stopped by SIGSEGV. I have tried conditional breakpoint, but it is not stopping. What could be the other conditions for error? If u want have a look at my program, here it is.http://codepad.org/cujYTIeg and the in.txt file from where it reads the input. http://codepad.org/vNySA6uh

    Read the article

  • Searching for simple variable names like 'c' or 'x' in Emacs.

    - by wpeters
    I often wish to search for variables that are simply called 'c' or 'count'. For example int c, count; Unfortunately when I use an incremental search for 'c' or 'count' I get a lot of unnecessary hits like the 'c' in 'choice', or the 'count' in 'wordcount' which do not interest me. I know Emacs can do i-searches with regular expressions but I don't know the correct regular expression needed to match just 'c' and 'count'. These words are often surrounded by any number of white spaces. Anyone know the regex I can use to narrow my search?

    Read the article

  • What's the best way to call jQuery scripts, in HTML/PHP template, or seperate js file?

    - by j-man86
    StackOverflow is telling me this is a subjective question, but I think it's a matter of fact! I have a number of scripts that I'm using on different parts of my site. In terms of making fewer http requests, I know it's better to combine all of these scripts into one .js file. However, isn't a waste of time for a page to call a .js full of 10 or 15 different functions when it's only using one? The other method I am using is to use PHP conditional statements... <?php if( is_page() ) { > $(document).ready(function(){ ... }); <?php } ?> What's the best method or comination of these methods?

    Read the article

  • ASP .NET - What's going on behind an Eval() ?

    - by Amokrane
    Hi, I'm trying to understand how Eval() works for a specific purpose. I'm working on a project I don't really know and I need to read some data and put them in drop down list. These data are already read and are displayed inside an ItemTemplate. I noticed there are read using the Eval() method. Something like: <ItemTemplate> <a href="...=<%# Eval("foo") %>></a> </ItemTemplate> I need to know where Eval is getting these data from in order to discover where I should read them for my drop down list! But I didn't really understand how it works! I know that Eval() evaluates data binding expressions at runtime but where do you think I should take a look at? Thank you

    Read the article

  • Select records from XML column (SQL Server 2005) based on node order

    - by jdoe
    I have a column in a SQL Server 2005 table defined as an XML column. Is there a way to select records from this table based on the order of two nodes in that column? For example, we have the following structure in our XML: <item> <latitude/> <longitude/> </item> I want to see if there are any records that have latitude/longitude in the opposite order i.e. <longitude/> then <latitude/>. I've tried some XPath expressions but with no luck.

    Read the article

  • GUID.TryParse() ?

    - by Jack Marchetti
    Obviously there is no public GUID.TryParse() in .NET CLR 2.0. So, I was looking into regular expressions [aka googling around to find one] and each time I found one there was a heated argument in the comments section about RegEx A doesn't work, use RegEx B. Then someone would write Regex C yadda yadda So anyway, What I decided to do was this, but I feel bad about it. public static bool IsGuid (string possibleGuid) { try { Guid gid = new Guid(possibleGuid); return true; } catch (Exception ex) { return false; } } Obviously I don't really like this since it's been drilled into me since day one to avoid throwing exceptions if you can defensibly code around it. Does anyonek now why there is no public Guid.TryParse() in the .NET Framework? Does anyone have a real Regular Expression that will work for all GUIDs?

    Read the article

  • C# VS 2008 Build Configurations - using different classes for different builds

    - by evan
    I'm writing an application which has two classes that provide basically the same functionality but for different situations. I'd like to have three versions of the software - one where the user can change an ini file to configure the program to use one of the two classes, and then one version that only uses one of the two classes. Right now I have it working via an ini file, but I'd like to be able to build versions that don't include the code for the unneeded class at all. What is the best way to go about this? My current line of thinking is that since both classes derive from a common interface I'll just add a compile time conditional that looks at the active build configuration and decides whether to compile that class. What is the syntax to do that? Thanks in advance for your help and input!

    Read the article

  • How cast in c#/.net 3.5 works? for types with '?'

    - by Inez
    This is my code which works public decimal? Get() { var res = ... return res.Count() > 0 ? res.First() : (decimal?) null; } and this one doesn't work public decimal? Get() { var res = ... return res.Count() > 0 ? res.First() : null; } giving the compilator error: Error 1 Type of conditional expression cannot be determined because there is no implicit conversion between 'decimal' and '' I wonder why? any ideas?

    Read the article

  • Would it be simply better to use the system's functions rather than use the language?

    - by Nullw0rm
    There are many scenarios where I've questioned PHP's performance with some of its functions, and whether I should build a complex class to handle specific things using its seemingly slow tools. For example, Complex regular expressions with sed and processing with awk would seemingly be exponential in performance rather than making PHP's regular expression and seemingly excessive functions parse and in time manage to finish it. If I were to do a lot of network tasks such as MX lookups/DIGging/retrieving simultaneously I would rather pass it via system() and let the OS handle it itself. There are simply too many functions in PHP, that are inefficient and result in slow pages or can be handled easier by the OS. What are your opinions? Do you think I should do the hard work with the OS in its own/custom functions?

    Read the article

  • Is it possible to "learn" a regular expression by user-provided examples?

    - by DR
    Is it possible to "learn" a regular expression by user-provided examples? To clarify: I do not want to learn regular expressions. I want to create a program which "learns" a regular expression from examples which are interactively provided by a user, perhaps by selecting parts from a text or selecting begin or end markers. Is it possible? Are there algorithms, keywords, etc. which I can Google for? EDIT: Thank you for the answers, but I'm not interested in tools which provide this feature. I'm looking for theoretical information, like papers, tutorials, source code, names of algorithms, so I can create something for myself.

    Read the article

  • Lookup function not working (RS SP2)

    - by Al Reyes
    Hi, I made the upgrade to SP2. I'm trying to use the Lookup function to link data from two different servers. I'm trying first a simple exercise linking data from two datasets from the same server, having one dataset with journals and the other with the account description. My Expression looks like this at a field on the table I have: =Lookup(Fields!ACTINDX.Value,Fields!ACTINDX.Value,Fields!ACTDESCR.Value,"ACCTINFO") I made sure of the names and using only uppercases for datasets and fields but I'm receiving the following message when I try to preview: "An error occurred during local report processing. The definition of the report '/DETAIL' is invalid. The Value expression for the text box 'ACTINDX' refers to the field 'ACTDESCR'. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope". I'll appreciate any suggestions. Regards, Al

    Read the article

  • CSS sticky footer makes scroll bar unscrollable in IE 8

    - by maraujop
    I'm using this sticky footer in my website: http://www.cssstickyfooter.com/using-sticky-footer-code.html It is fully working in Firefox, Chrome, IE7, but not IE8. In IE8 the scrollbar appears but doesn't work, and I don't have any other way to move down. I'm using the conditional statement that appears in the web: <!--[if !IE 7]> <style type="text/css"> #wrap {display:table;height:100%} </style> <![endif]--> Sorry, but I can't post an address, I don't have a server online right now with the web.

    Read the article

  • IIS7: URL Rewrite - can it be used to hide a CDN path?

    - by Wild Thing
    Hi, I am using Rackspace Cloud CDN (Limelight CDN) for my website. The URLs of the CDN are in the format http://cxxxxxx.cdn.cloudfiles.rackspacecloud.com/something.jpg My domain is mydomain.com. Can I use IIS URL rewriting to show http://cxxxxxx.cdn.cloudfiles.rackspacecloud.com/something.jpg as http://images.mydomain.com/something.jpg? Or is this impossible without the CDN setup accepting my CNAME? If so, can you please help create the URL rewrite rule? (Sorry, don't know how to use regular expressions) Thanks, WT

    Read the article

  • C# Dynamic Query Without A Database Model

    - by hitopp
    I have been searching the web for a solution to dynamic queries. I have found many different solutions (e.g. Linq to Sql, Dynamic Linq Expressions, Dynamic Query), but all of these solutions involve some sort of previous knowledge of the database (like a model in code). Maybe what I am asking is way off the deep end, but is there any possible way to dynamically query a database without a model? For example, a database has a Customers table with the following columns: CustomerID Name FavoriteColor I want to create a query as SELECT Name FROM Customers WHERE @0 = @1, where the two placeholders are populated dynamically. The resulting data does not tie to a model class and I would prefer to use some sort of framework to build the queries, not simple string concatenation. The System.Linq.Dynamic namespace came really close to fulfilling this request, but it uses a database model. I realize this is crazy, but I was just curious.

    Read the article

  • c# Delegates, Events and Lambda Expr for new students

    - by MarkP
    I've been asked by my pointy haired boss to educate our new co-ops (interns) in the ways of C#. I have roughly ~30mins to cover the topics of Delegates, Events and Lambda Expressions. The time restriction is rather tight and the topics are broad. Since I'm not a C# guru, I would like some hints and pointers. Since my time is short, what points should I cover with respect to the three topics listed above? What are some good Do's and Dont's when using those three things? I might have time for a short Lambda Expr demo. What is the most common use of LExpr (probably a Select().Where() statement on an enumerable??) that I could demo? Thanks. EDIT: The students have working knowledge of C++ and Java.

    Read the article

  • How does cast in C#/.NET 3.5 work for types with '?'

    - by Inez
    This is my code which works public decimal? Get() { var res = ... return res.Count() > 0 ? res.First() : (decimal?) null; } and this one doesn't work public decimal? Get() { var res = ... return res.Count() > 0 ? res.First() : null; } giving the compiler error: Error 1 Type of conditional expression cannot be determined because there is no implicit conversion between 'decimal' and '<null>' I wonder why? any ideas?

    Read the article

  • BASH Expression to replace beginning and ending of a string in one operation?

    - by swestrup
    Here's a simple problem that's been bugging me for some time. I often find I have a number of input files in some directory, and I want to construct output file names by replacing beginning and ending portions. For example, given this: source/foo.c source/bar.c source/foo_bar.c I often end up writing BASH expressions like: for f in source/*.c; do a="obj/${f##*/}" b="${a%.*}.obj" process "$f" "$b" done to generate the commands process "source/foo.c" "obj/foo.obj" process "source/bar.c "obj/bar.obj" process "source/foo_bar.c "obj/foo_bar.obj" The above works, but its a lot wordier than I like, and I would prefer to avoid the temporary variables. Ideally there would be some command that could replace the beginning and ends of a string in one shot, so that I could just write something like: for f in source/*.c; do process "$f" "obj/${f##*/%.*}.obj"; done Of course, the above doesn't work. Does anyone know something that will? I'm just trying to save myself some typing here.

    Read the article

  • Using report viewer, how do I pull from two seperate Datasets

    - by Robert
    I have two datasets I need to pull from, A base that both reports use and then a separate one that only one report pulls from. I get the error Error 12 The Value expression for the text box ‘Textbox9’ refers to the field ‘Name’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. My best guess is I have to associate them with the correct dataset but I have not been able to find any documentation on this. Can someone please tell me where in the rdlc document I need to code something like name.value, "dataset1" or something similar?

    Read the article

  • Creating a border around cells with the same value.

    - by Liam
    I have a table like the one below. How can I get Excel to put borders around groups with the same number in the 4th column so that there is a border around the groups. I was thinking conditional formatting could do it but I can't think how. So I think the only option is a macro. Could anybody help? 1 64436 549419 1 2 64437 549420 1 3 64438 549421 1 4 64439 549422 1 5 64440 549423 1 6 64441 549424 1 7 64442 549425 1 8 64443 549426 1 9 64444 549427 1 10 64445 549428 1 11 64446 549429 1 12 64447 549430 1 13 64448 549431 2 14 64449 549432 2 15 64450 549433 2 16 64451 549434 2 17 64452 549435 2 18 64453 549436 2 19 64454 549437 2 20 64455 549438 2 21 64456 549439 2 22 64457 549440 4 23 64458 549441 4 24 64459 549442 5 25 64460 549443 5 26 64461 549444 5 27 64462 549445 5 28 64463 549446 5 29 64464 549447 5 30 64465 549448 6 31 64466 549449 6 32 64467 549450 6 33 64468 549451 6 34 64469 549452 6 35 64470 549453 6 36 64471 549454 6 37 64472 549455 9 38 64473 549456 9 39 64474 549457 9

    Read the article

  • FOR loop performance in Javascript

    - by AndrewMcLagan
    As my research leads me to believe that for loops are the fastest iteration construct in javascript language. I was thinking that also declaring a conditional length value for the for loop would be faster... to make it clearer, which of the following do you think would be faster? Example ONE for(var i = 0; i < myLargeArray.length; i++ ) { console.log(myLargeArray[i]); } Example TWO var count = myLargeArray.length; for(var i = 0; i < count; i++ ) { console.log(myLargeArray[i]); } my logic follows that on each iteration in example one accessing the length of myLargeArray on each iteration is more computationally expensive then accessing a simple integer value as in example two?

    Read the article

  • Facebook API - Get comments

    - by Simon R
    Our business has a Facebook Fan Page. The fan page doesn't seem to generate any emails to us when updates are made to the page, whether someone adds a new status or someone comments on one of the statuses etc. Currently, we are running a very crude script to grab the content of the page and then use regular expressions to get the information we require. Obviously this is not fool proof and I'm looking into alternatives to this method. I've been looking at the facebook API and wonder if the rest server might be an option. I cannot, however, seem to find out how to return information of fan page statuses and their comments. Is anyone able to direct me how to use the API to retrieve this information. I am an admin of the fan page. The programming language I'm using is PHP. Many thanks.

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >