Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 180/269 | < Previous Page | 176 177 178 179 180 181 182 183 184 185 186 187  | Next Page >

  • Using a database/index sequential file independently of the Unix distribution

    - by Helper Method
    What I'm planning to do is a) parse a file for some lines matching a regular expression b) store the match in some sort of database / file so I don't have to do the parsing again and again c) call another program passing the matches as arguments While I can imagine how to do a) and c), I'm a little bit unsure about b). The matches are of the form key:attribute1:attribute2:attribute3 where attribute 2 may be optional. I'm thinking of storing the results in a simple database but the problem is the database needs to available on a number of Unix platform for the program to work. Are there any (simple) databases which can be found on any Unix platforms? Or should I use some sort of index-sequential file?

    Read the article

  • Why can't I project ToString() in VB?

    - by Martinho Fernandes
    If you try to compile the query below in Visual Basic .NET, it fails. From x In {1, 2} Select x.ToString() The error given by the compiler is: Range variable name cannot match the name of a member of the 'Object' class. There is nothing wrong with the equivalent C# query, though: from x in new[]{1, 2} select x.ToString() This does not happen with the ToString overload that takes a format (it is a member of Int32, not Object). It does happen with other members of Object, as long as they don't take an argument: with GetType and GetHashCode it fails; with Equals(object) it compiles. Why is this restriction in place, and what alternatives can I use?

    Read the article

  • The return value should be a list but doesn't return as expected?! - Python newbie

    - by user1432941
    Hi this must be a very simple solution that has eluded me this last hour. I've tried to build this test function where the return value of the test_cases list should match the values in the test_case_answers list but for some reason, test case 1 and test case 2 fail. When i print the return values for the test cases they return the correct answers, but for some reason test case 1 and test case 2 return False. Thanks for your help! import math test_cases = [1, 9, -3] test_case_answers = [1, 3, 0] def custom_sqrt(num): for i in range(len(test_cases)): if test_cases[i] >= 0: return math.sqrt(test_cases[i]) else: return 0 for i in range(len(test_cases)): if custom_sqrt(test_cases[i]) != test_case_answers[i]: print "Test Case #", i, "failed!" custom_sqrt(test_cases)

    Read the article

  • sports league database design

    - by John
    Hello, I'm developing a database to store statistics for a sports league. I'd like to show several tables: - league table that indicates the position of the team in the current and previous fixture - table that shows the position of a team in every fixture in the championship I have a matches table: Matches (IdMatch, IdTeam1, IdTeam2, GoalsTeam1, GoalsTeam2) Whith this table I can calculate the total points of every team based on the matches the team played. But every time I want to show the league table I have to calculate the points. Also I have a problem to calculate in which position classified a team in the last 10 fixtures cause I have to make 10 queries. To store the league table for every fixture in a database table is another approach, but every time I change a match already played I have to recalculate every fixture from there... Is there a better approach for this problem? Thanks

    Read the article

  • Is it possible to scroll in isearch mode?

    - by Leo Alekseyev
    Is there a way to scroll through a document without exiting isearch mode? I have isearch-allow-scroll set to t, but that limits my scroll range to make sure the current isearch match is visible in the buffer. Ideally, I would like to be able to scroll with the mousewheel, having all the isearch matches highlighted as I scroll. I am aware of M-x occur, but a lot of the time simply being able to scroll in isearch mode would be more efficient (in addition, M-x occur does not play well with folding mode).

    Read the article

  • 2 or more FOR loops in command shell merging fileA line1 with fileB line1, &c.

    - by rfransix
    Hi, i'm trying to build an ldif import file. I have 2 files, one with the DN and another with the employeeNumber, they match up line for line. Here's the code that does not work: @echo on ::Set BATCH Input Directory set batchdir=e:\Meta ::Set the input file containing the server list set infile=%batchdir%\DDNs3 set infile2=%batchdir%\DDNs4 ::If exists, we remove output file Rm DDNs3.ldif ::For loop below process each line in the input list. FOR /F "tokens=* delims=" %%i IN (%infile%) do ( FOR /F "tokens=* delims=" %%k IN (%infile2%) do ( Echo dn: %%i Echo changetype: modify Echo replace: employeeNumber Echo employeeNumber: %%k ) ) DDNs3.ldif I've tried several variations, including: ::For loop below process each line in the input list. FOR /F "tokens=* delims=" %%i IN (%infile%) do ( Echo dn: %%i Echo changetype: modify Echo replace: employeeNumber FOR /F "tokens=* delims=" %%k IN (%infile2%) do ( Echo employeeNumber: %%k echo. ) ) DDNs3.ldif

    Read the article

  • jquery integrate form parameter in one object

    - by jesse
    There are many forms in my page. I want to merge them in one object and submit them in one object. But I find serializeArray() or serialize() do not match my request, the serializeArray function will generate a array object and serialize is used by get model, it is not an object. is there a jquery or local function can merge them in one object. I have one solution but it is not perfect, loop the array object generated by serializeArray, use $.extend to merge them in one object. is there a better method? kindly help, thanks.

    Read the article

  • Validate authenticity of website owner

    - by Cyber Junkie
    Hello all! I'm planning to develop a web app where users will list their site/blog. When people submit their sites, how can I confirm that they are the owners of it? So for instance there is a user Mark who wants to submit someone else's website without their approval. I want to restrict Mark from doing so unless he is the actual owner. My idea was to do a comparison between the user's email domain and the website domain she/he wants to submit. If they match allow the user to submit the website. However most people don't register with their website domain address.. or perhaps I'll implement a Facebook connect in the future. What other methods would you suggest?

    Read the article

  • Is it possible to have a composite index with a list property and a sort order?

    - by npdoty
    And if not, why not? The following index always fails for me, even though I had thought I could have a sort order with a list property as long as the index didn't sort or match against any other properties. - kind: Foo properties: - name: location_geocells - name: time direction: desc If such a composite index is allowed, are there any reasons that this might be failing for me? Do the existence of other indices on the same model increase the likelihood of this failure? Does the combination of a sort order with a list property require more than N entries, where N is the number of values in the list property? (If so, how many does it require?)

    Read the article

  • Squid logs on mongodb

    - by user306241
    Hi, I'm planning to log my squid instances to a mongodb, but the actual problem is that we have a huge traffic to be logged, every access authenticated with user/pass. Eventually we have to make some reports based on logs. I was thinking to insert the logs distributed by months and by users, so my collection will look like this: {month: 'april', users: [{user: 'loop0', logs: [{timestamp: 12345678.9, url: 'http://stackoverflow.com/question/ask', ... }]}] So if I want to generate my reports based on the month of april I just have to get the right month instead of looking in zillions of lines to fetch the lines that timestamp match between April, 1 and April, 30. Of course this type of insert will be slower than just insert the log line directly. So my question is: is there a best way to do this? Nowadays we have around 12 million lines of log by day.

    Read the article

  • Regular expression one or more times JAVA

    - by user1381564
    Hi i am trying to match a string against a pattern this is the possible string signal CS, NS, dl: stateType := writeOrRead0; signal CS, pS : stateType := writeOrRead0; signal dS : stateType := writeOrRead0; i am only concerned with the pattern as far as the first colon. but the number of signals define can be more than one it could be three or four even this is the regular expression i have ^signal\\s*(\\w+),*\\s*(\\w+)\\s*: it will pick up the second two signal but and for the second one it picks up CS and pS and but the d and S in the next signal when i use matcher.group() come up seperately Can anyone give me an expression that will pick up all signal names whether there is one two three or more?

    Read the article

  • Why is Drupal writing to root and not sites/default/files?

    - by Candland
    I'm using Drupal 6.14 on Win7. Everything seems to work except files that should be written to sites/default/files are trying to be written to /. The site was moved from a linux installation, which is writing the files correctly. I have setup a web.config w/ the rewrite rules for drupal. Not sure what or where else I should check. Thanks for any help. <rule name="Drupal Clean URLs" stopProcessing="true"> <match url="^(.*)$" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" /> </rule>

    Read the article

  • How do I convert a number (as a String) to an array of bytes in Java?

    - by user1795595
    I'm creating a method specific method for a java project i'm working on. The UML given specifies the return type to be of static byte[] that accepts the arguments (String, byte) So far, looks like this: public static byte[] convertNumToDigitArray(String number, byte numDigits) { } This method is supposed to convert a number (as a String) to an array of bytes. The ordering must go from most to least significant digits. For example, if the number String is “732” then index 0 of the array should contain 7. The last argument (numDigits) should match the length of the string passed in. How do I do this?

    Read the article

  • Cross version line matching.

    - by BCS
    I'm considering how to do automatic bug tracking and as part of that I'm wondering what is available to match source code line numbers (or more accurate numbers mapped from instruction pointers via something like addr2line) in one version of a program to the same line in another. (Assume everything is in some kind of source control and is available to my code) The simplest approach would be to use a diff tool/lib on the files and do some math on the line number spans, however this has some limitations: It doesn't handle cross file motion. It might not play well with lines that get changed It doesn't look at the information available in the intermediate versions. It provides no way to manually patch up lines when the diff tool gets things wrong. It's kinda clunky Before I start diving into developing something better: What already exists to do this? What features do similar system have that I've not thought of?

    Read the article

  • Exclude subexpression from regex in c++

    - by wyatt
    Suppose I was trying to match the following expression using regex.h in C++, and trying to obtain the subexpressions contained: /^((1|2)|3) (1|2)$/ Suppose it were matched against the string "3 1", the subexpressions would be: "3 1" "3" "1" If, instead it were matched against the string "2 1", the subexpressions would be: "2 1" "2" "2" "1" Which means that, depending on how the first subexpression evaluates, the final one is in a different element in the pmatch array. I realise this particular example is trivial, as I could remove one of the sets of brackets, or grab the last element of the array, but it becomes problematic in more complicated expressions. Suppose all I want are the top-level subexpressions, the ones which aren't subexpressions of other subexpressions. Is there any way to only get them? Or, alternatively, to know how many subexpressions are matched within a subexpression, so that I can traverse the array irrespective of how it evaluates? Thanks

    Read the article

  • Combining IN and NOT IN in SQL as single result

    - by UltraVi01
    I apologize for the vague title. I am attempting to write a query that returns an alias column with matching values (resulting from an IN) as well as an alias column with values that do not match (using NOT IN). I want the result set to have: userId | matches | nonmatches. I currently have the following query which returns the matches as expected. I am having trouble getting the nonmatches in the result set -- that is, from a NOT IN statement SET @userId = 9; SELECT ug.user_id, COUNT(DISTINCT goal_id) as matches FROM user_goal ug WHERE ug.user_id!=@userId AND goal_id IN (SELECT iug.goal_id FROM user_goal iug WHERE user_id=@userId) GROUP BY user_id ORDER BY matches DESC LIMIT 4 So, the NOT IN would look something like this: goal_id NOT IN(SELECT uggg.goal_id FROM user_goal uggg WHERE user_id=@userId) AS nonmatches I am just not sure how to incorporate the NOT IN statement in my query so I get all the results

    Read the article

  • Turning user ID into name (seperate tables) in PHP

    - by mobile
    I am currently trying to display the username of people who i am following, the problem is that during the following process, only the ID of me and the person i'm following is stored. I've got it to the point where the ID's are displayed but i'd like to show the names hyperlinked. $p_id is the profile ID. Here's what I've got: $following = mysql_query("SELECT `follower`, `followed` FROM user_follow WHERE follower=$p_id"); I am following: <?php while($apple = mysql_fetch_array($following)){ echo '<a href="'.$apple['followed'].'">+'.$apple['followed'].'</a> '; }?> The usernames are in a different table "users" under the field "username" - I need them to match up with the ID's that are currently displayed, and be displayed. Any help appreciated, thanks guys

    Read the article

  • Is it possible to have file filters for multiple extension types?

    - by Jon Cage
    I'm using a standard Windows FileDialog to allow the user to select some files. I'd like to filter out only the file types I'm interested in though (lets call them *.a and *.b). Is there any way to do this without using *.*? I've tried the following but it fails to match any files at all: this->openFileDialog1->DefaultExt = L"*.a,*.b"; this->openFileDialog1->FileName = L"openFileDialog1"; this->openFileDialog1->Filter = L"My Data Files (*.a,*.b)|*.a,*.b";

    Read the article

  • regex no character

    - by iamnotmad
    In this text: warning here there are several types of warnings in this string warning.gif at the end warning end of line warning I want to match every warning except warning.gif. I cannot seem to get it to include the last one that has no character (control or otherwise) after it. using warnings?[^\.] gets what I want except for the last warning (on the last line). I think because there is no character at all after. How can I get it to include that one?

    Read the article

  • Display x if x display y if y (bad title I know)

    - by user1914940
    Ok so after reading the title you are most likely like...what? Ok, so I have a jquery code that displays input box if an item with prefix Blue from dropdown menu is selected. Code: $(function() { $('#text1').hide(); $('#select2').on('change', function(event) { var opt = this.options[ this.selectedIndex ]; var picked_blue = $(opt).text().match(/Blue/i); if(picked_blue) { $('#text1').show(); } else { $('#text1').hide(); } }); }); But what I also need to add is to display something else if any other item from dropdown menu is selected.

    Read the article

  • MySQL AND alternative for each table in a join

    - by Scott
    I have a simple join in a query however I need to have a condition on both of the tables "confirmed='yes'" but if one of the tables doesn't have any that match the query returns with no rows. Database: .----------parties----------. | id - party_id - confirmed | |---------------------------| | 1 1 yes | | 1 2 no | | 1 3 no | +---------------------------+ .-----------events----------. | id - event_id - confirmed | |---------------------------| | 1 1 no | +---------------------------+ Query: SELECT p.party_id, e.event_id FROM parties p LEFT JOIN events e ON p.id=e.id WHERE p.id = '1' AND p.party_id IN (1,2,3) AND e.event_id IN (1) AND p.confirmed='yes' AND e.confirmed='yes' It returns nothing but I want it to return party_id 1 with a empty event_id. I hope this make sense and I not missing anything, Thanks for your help!

    Read the article

  • In-memory data structure that supports boolean querying

    - by sanity
    I need to store data in memory where I map one or more key strings to an object, as follows: "green", "blue" -> object1 "red", "yellow" -> object2 I need to be able to efficiently receive a list of objects, where the strings match some boolean criteria, such as: ("red" OR "green") AND NOT "blue" I'm working in Java, so the ideal solution would be an off-the-shelf Java library. I am, however, willing to implement something from scratch if necessary. Anyone have any ideas? I'd rather avoid the overhead of an in-memory database if possible, I'm hoping for something comparable in speed to a HashMap (or at least the same order of magnitude).

    Read the article

  • Membership provider to use or not to use?????

    - by Shekhar_Pro
    Hi every one , Wish u all a Happy New Year. I am developing a website that uses facebook. Now for managing user i thought Using membrship provider. and choose'd to develop a Custom membership provider. Now my problem is that My data base schema dosn't match the Standred membership schema and the functions provided to Override take different argument than i expect. Like membership uses username as a username to log in. But i haev to use User email ID as the user name, also its searching functions is based on using Username as way to serach but i want it to search by UserID. Same Goes for User insertion, deletion, Updation.. please help me .... Edit Its just an idea, Would it be feasible to forcefully pass my values in the arguments and then handle them in my code.

    Read the article

  • Creating new Entities from Stored Procedure

    - by SK
    I have a stored procedure that retrieves existing rows from a table and also creates includes new rows that match the table definition and mapped entity (.net 3.5 entity framework). These new rows are not written to the database in the stored procedure. The stored procedure executes, but the new rows that were created will not load the navigation properties sucessfully i.e. the rows that do not actually exist in the database. e.g. database rows: key, data, FK 1, xxx, a 2, xxx, b returned rows from stored procedure: key, data, FK 1, xxx, a 2, xxx, b 3, yyy, a 4, yyy, b The entity will load FK entities a and b for rows 1 and 2, but for rows 3 and 4 the FK entity is null. Do I somehow need to add the new rows to the data context? or turn off tracking?

    Read the article

  • How to compare 2 pdf files using command line or any tool

    - by Darzen
    I have to compare 2 pdf files and check if they are same or different. I have tried my luck with WinMerge and Beyond compare. however they dont solve my issue. The issue is that there are 2 files which are exactly same except for the time in which they were saved. I have a piece of code that embeds the time of saving into the file. but i am not supposed to do any modifications to the code I have. Hence the above mentioned tools will say that the files dont match and There is just one difference, that is timestamp. Can anyone suggest me a way to handle this. Please. Thanks

    Read the article

< Previous Page | 176 177 178 179 180 181 182 183 184 185 186 187  | Next Page >