Search Results

Search found 3479 results on 140 pages for 'sequence diagram'.

Page 16/140 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • What should I call a class that contains a sequence of states

    - by Robert P
    I have a GUI tool that manages state sequences. One component is a class that contains a set of states, your typical DFA state machine. For now, I'll call this a StateSet. However, I have another class that has a collection (possibly partially unordered) of those state sets, and lists them in a particular order. and I'm trying to come up with a good name for it - not just for internal code, but for customers to refer to it. I've got: Sequence (maybe) StateSetSet (reasonable for code, but not for customers) Any other suggestions or ideas?

    Read the article

  • Fibonacci sequence subroutine returning one digit too high...PERL

    - by beProactive
    #!/usr/bin/perl -w use strict; sub fib { my($num) = @_; #give $num to input array return(1) if ($num<=1); #termination condition return($num = &fib($num-1) + &fib($num-2)); #should return sum of first "n" terms in the fibonacci sequence } print &fib(7)."\n"; #should output 20 This subroutine should be outputting a summation of the first "x" amount of terms, as specified by the argument to the sub. However, it's one too high. Does this have something to do with the recursion? Thanks.

    Read the article

  • Fibonacci Sequence using loop and recur

    - by AdamJMTech
    I am doing the Project Euler challenge in Clojure and I want to find the sum of all the even numbers in a fibonacci sequence up to a certain number. The code for a function that does this is below. I know there are quicker and easier ways of doing this, I am just experimenting with recursion using loop and recur. However the code doesn't seem to work it never returns an answer. (defn fib-even-sum [upto] (loop [previous 1 nxt 1 sum 0] (if (or (<= upto 1) (>= nxt upto)) sum) (if (= (mod nxt 2) 0) (recur nxt (+ previous nxt) (+ sum nxt)) (recur nxt (+ previous nxt) sum)))) I was not sure if I could do recur twice in the same loop or not. I'm not sure if this is causing the problem?

    Read the article

  • How do I execute a sequence of servlets?

    - by Legend
    I have some servlets that act as individual URLs for populating a database for some dummy testing. Something of the form: public class Populate_ServletName extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); //Insert records //Print confirmation } } I have about 6 such servlets which I want to execute in a sequence. I was thinking of using setLocation to set the next page to be redirected but was not sure if this is the right approach because the redirects should happen after the records have been inserted. Specifically, I am looking for something like this: public class Populate_ALL extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); //Call Populate_1 //Call Populate_2 //Call Populate_3 //... } } Any suggestions?

    Read the article

  • MS SQL replace sequence of same characters inside Text Field (TSQL only)

    - by zmische
    I have a text column varchar(4000) with text: 'aaabbaaacbaaaccc' and I need to remove all duplicated chars - so only one from sequence left: 'abacbac' It should not be a function, Procedure or CLR - Regex solution. Only true SQL select. Currently I think about using recursive WITH clause with replace 'aa'-'a', 'bb'-'b', 'cc'-'c'. So recursion should cycle until all duplicated sequences of that chars would be replaced. DO you have another solution, perhaps more Permormant one? PS: I searched through this site about different replace examples - they didnt suit to this case.

    Read the article

  • Write a function in c that includes the following sequence of statements [Wont Compile]

    - by Cody
    There is a question in my programming languages textbook that is as follows: Write a C function that includes the following sequence of statements: x = 21; int x; x = 42; Run the program and explain the results. Rewrite the same code in C++ and Java and compare the results. I have written code, and played with it in all three languages but I can not even get it to compile. This includes declaring x above the three lines as well as in the calling function (as this question is obviously attempting to illustrate scoping issues) I'd like to explain the results and do the comparisons on my own, as it is an assignment question but I was wondering if anyone had any insight as to how to get this code to compile? Thanks

    Read the article

  • InvalidOperationException sequence contains more than one element even when only one element

    - by user310256
    I have three tables, tblCompany table, tblParts table and a link table between them tblLinkCompanyParts. Since tblLinkCompanyParts is a link table so the columns that it has are LinkCompanyPartID(primary key), CompanyID from tblCompany table and PartID from tblParts as foreign keys. I have tied them up in the dbml file. In code if I write LinkCompanyParts.Parts (where LinkCompanyParts is an object of the tblLinkCompanyParts type) to get to the corresponding Part object I get the "InvalidOperationException: Sequence constains more than one element". I have looked at the data in the database and there is only one Parts record associated with the LinkCompanyPartID. The stack trace reads like at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source) at System.Data.Linq.EntityRef`1.get_Entity() at ... I read about SingleOrDefault vs FirstOrDefault but since the link table should have a one-one mapping therefore I think SingleOrDefault should work and besides "SingleOrDefault" statement is being generated behind the scenes in the designer.cs file at the following line return this._Part.Entity; Any ideas?

    Read the article

  • Process every pair in a sequence

    - by Henry Jackson
    I'm looking for a concise way to process every (unordered) pair of elements in a sequence in .NET. I know I can do it with nested foreach loops, but I was looking for something a little more readable. I was imagining something like a modified Any() extension method: IEnumerable<Transaction> transactions = ... if (transactions.AnyPair( (first, second) => first.UniqueID == second.UniqueID)) throw ... Or maybe a foreach-style one: IEnumerable<JigsawPiece> pieces = ... pieces.ForEachPair( (first, second) => { TryFit(first, second); }); This question has been asked for other languages (e.g. see http://stackoverflow.com/questions/942543/operation-on-every-pair-of-element-in-a-list), but I'm looking for a .NET solution.

    Read the article

  • Get a string sequence from a node-set in xpath 1.0

    - by Miguel
    I'm using xpath 1.0 to parse an html file and I want to get a string sequence from a node-set. First I select a node-set (eg: //div) and then I want the string-value of each node of the set. I've tried with string(//div) but it only returns the string-value of the first node in the set. Example <foo> <div> bbbb<p>aaa</p> </div> <div> cccc<p>aaa</p> </div> </foo> I expect a result like ('bbbbaaa', 'ccccaaa') but I only get 'bbbaaa'

    Read the article

  • Playing animations in sequence in objecive c

    - by Ohmnastrum
    I'm trying to play animations in sequence but i'm having issues playing them as a for loop iterates through the list of objects in an array. it will move through the array but it won't play each one it just plays the last... -(void) startGame { gramma.animationDuration = 0.5; // Repeat forever gramma.animationRepeatCount = 1; int r = arc4random() % 4; [colorChoices addObject:[NSNumber numberWithInt:r]]; int anInt = [[colorChoices objectAtIndex:0] integerValue]; NSLog(@"%d", anInt); for (int i = 0; i < colorChoices.count; i++) { [self StrikeFrog:[[colorChoices objectAtIndex:i] integerValue]]; //NSLog(@"%d", [[colorChoices objectAtIndex:i] integerValue]); sleep(1); } } it moves through the whole cycle really fast and sleep isn't doing anything to allow it to play each animation... any suggestions?

    Read the article

  • How to add a sequence column to an existing table with records

    - by user1888543
    I had created a new table named USERLOG with two fields from a previous VIEW. The table already consist of about 9000 records. The two fields taken from the VIEW, i.e. weblog_views consist of IP (consists of IP address), and WEB_LINK (consists of URL). This is the code I used, CREATE TABLE USERLOG AS SELECT C_IP, WEB_LINK FROM weblog_views; I want to add another column to this table called the USER_ID, which would consists of a sequence starting with 1 to 9000 records to create a unique id for each existing rows. I need help with this part. I'm using Oracle SQL Developer: ODMiner version 3.0.04. I tried using the AUTO-INCREMENT option, ALTER TABLE USERLOG ADD USER_ID INT UNSIGNED NOT NULL AUTO_INCREMENT; But I get an error with this, Error report: SQL Error: ORA-01735: invalid ALTER TABLE option 01735. 00000 - "invalid ALTER TABLE option" So, I would really appreciate any help that I can get!

    Read the article

  • check sequence in matlab

    - by gabboshow
    I have a vector that should contain n sequences from 00 to 11 A = [00;01;02;03;04;05;06;07;08;09;10;11;00;01;02;03;04;05;06;07;08;09;10;11] and I would like to check that the sequence "00 - 11 " is always respected (no missing values). for example if A =[00;01;02; 04;05;06;07;08;09;10;11;00;01;02;03;04;05;06;07;08;09;10;11] (missing 03 in the 3rd position) For each missing value I would like to have back this information in another vector missing= [value_1,position_1; value_2, position_2; etc, etc] Can you help me?

    Read the article

  • Core Data NSFetchedResultsController sorting in certain sequence

    - by Moze
    I'm writing iphone app that has UITableView and uses Core Data. Data in UITableView is shown using NSFetchedResultsController. I use NSPredicate operator "IN" to fetch only needed entries. NSArray *filterArray = [NSArray arrayWithObjects:@"789", @"963", @"445", @"198", nil]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"id IN %@", filterArray]; Now the problem is that I need to show entries in same sequence they are in filterArray. How can I do it? How I can create NSSortDescriptor that would sort all entries in that way? I tried without sort descriptor, but I get error that NSFetchedResultsController needs sortDescriptor to be set.

    Read the article

  • Emulating a transaction-safe SEQUENCE in MySQL

    - by Michael Pliskin
    We're using MySQL with InnoDB storage engine and transactions a lot, and we've run into a problem: we need a nice way to emulate Oracle's SEQUENCEs in MySQL. The requirements are: - concurrency support - transaction safety - max performance (meaning minimizing locks and deadlocks) We don't care if some of the values won't be used, i.e. gaps in sequence are ok. There is an easy way to archieve that by creating a separate InnoDB table with a counter, however this means it will take part in transaction and will introduce locks and waiting. I am thinking to try a MyISAM table with manual locks, any other ideas or best practices?

    Read the article

  • write cache and write sequence order

    - by excanoe
    ok, here i have some weird question: let say we have some binary file (.log), and sequence of write operations, for example log1, log2, log3 and each has some block size n (raw data). question: can I be sure that log1,log2 and log3 sequences can be written in the correct order in ONE file, even if i have few cache levels (disk hardware and os level)? update very interested in what will be with records order (not with records) if we have software or hardware failure (reboot or another reason). update there can be some percent of write failures, but main question is: will write order stay correct?

    Read the article

  • Event firing sequence for a submit button.

    - by JSTyro
    Say a submit button has a click event handler as well (yes, it's wrong, but that's really the code I'm working on). And the click handler sets a value in a field of the form that's about to be submitted. So when the submit button is clicked: What will fire first, the form submit event or the click event? Will the value set in the form field by the click event submitted to the server? I think this depends on the answer to Q1. If the form is posted first, I'm guessing it won't. Note: I'm not looking for alternatives and advice. I know what the proper way of handling this will be. Just trying to understand the sequence of events and their implications.

    Read the article

  • Let and construct versus let in sequence

    - by Stringer
    Consider this OCaml code: let coupe_inter i j cases = let lcases = Array.length cases in let low,_,_ = cases.(i) and _,high,_ = cases.(j) in low,high, Array.sub cases i (j-i+1), case_append (Array.sub cases 0 i) (Array.sub cases (j+1) (lcases-(j+1))) Why the expression let ... and ... in is used in place of a let ... in let ... in sequence (like F# force you to do)? This construct seems quite frequent in OCaml code. Thanks!

    Read the article

  • FLEX: sequence of puppets... 3 requirements

    - by Patrick
    hi, I'm implementing this sequence of puppets in flex: http://dl.dropbox.com/u/72686/itemsSequence.png I want to show the caption when the mouse rolls over the puppet I want the user being able to click on the buttons of the caption (so the caption doesn't have to disappear when I move the mouse out from the user over the caption). I don't want the puppet component to become bigger when the caption is added (it becomes visible), because the puppets have to stay nearby each other, I cannot resize the objects. So.. I need some guidelines to do it. More precisely: 1) Should I add the components in MXML or pure actionscript ? 2) If I use MXML, should I add also the caption to the flex model, and make it invisible and then change the value with actionscript ? What's the common way to implement it ? thanks

    Read the article

  • SQL Server concurrency and generated sequence

    - by Goyuix
    I need a sequence of numbers for an application, and I am hoping to leverage the abilities of SQL Server to do it. I have created the following table and procedure (in SQL Server 2005): CREATE TABLE sequences ( seq_name varchar(50) NOT NULL, seq_value int NOT NULL ) CREATE PROCEDURE nextval @seq_name varchar(50) AS BEGIN DECLARE @seq_value INT SET @seq_value = -1 UPDATE sequences SET @seq_value = seq_value = seq_value + 1 WHERE seq_name = @seq_name RETURN @seq_value END I am a little concerned that without locking the table/row another request could happen concurrently and end up returning the same number to another thread or client. This would be very bad obviously. Is this design safe in this regard? Is there something I can add that would add the necessary locking to make it safe? Note: I am aware of IDENTITY inserts in SQL Server - and that is not what I am looking for this in particular case. Specifically, I don't want to be inserting/deleting rows. This is basically to have a central table that manages the sequential number generator for a bunch of sequences.

    Read the article

  • Sequence Number in testing Spring application with JUnit (Hibernating, Spring MVC)

    - by MBK
    I am testing DAO in Spring Application. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:/applicationContext.xml") @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) @Transactional public class CommentDAOImplTest { @Autowired //testing mehods here} The tests are running good. Iam able to add an comment and I also have a defaultRollback property set. So, the added comment will be deleted automatically. happy!..Now the problem is with the sequence number for mcomment. Can I, in any way rollback the seq number? any suggestins on that. I dont want to mess up the sequrnce number. Business requires comment Id to be showed. (I still dont know why). I know in memory db is an option....but I am guessing defaultRollback purpose is to eliminate in memory db testing and mocking. (Just my opinion.)

    Read the article

  • ValueError: setting an array element with a sequence.

    - by MedicalMath
    This code: import numpy as p def firstfunction(): UnFilteredDuringExSummaryOfMeansArray = [] MeanOutputHeader=['TestID','ConditionName','FilterType','RRMean','HRMean','dZdtMaxVoltageMean','BZMean','ZXMean' ,'LVETMean','Z0Mean','StrokeVolumeMean','CardiacOutputMean','VelocityIndexMean'] dataMatrix = BeatByBeatMatrixOfMatrices[column] roughTrimmedMatrix = p.array(dataMatrix[1:,1:17]) trimmedMatrix = p.array(roughTrimmedMatrix,dtype=p.float64) myMeans = p.mean(trimmedMatrix,axis=0,dtype=p.float64) conditionMeansArray = [TestID,testCondition,'UnfilteredBefore',myMeans[3], myMeans[4], myMeans[6], myMeans[9] , myMeans[10], myMeans[11], myMeans[12], myMeans[13], myMeans[14], myMeans[15]] UnFilteredDuringExSummaryOfMeansArray.append(conditionMeansArray) secondfunction(UnFilteredDuringExSummaryOfMeansArray) return def secondfunction(UnFilteredDuringExSummaryOfMeansArray): RRDuringArray = p.array(UnFilteredDuringExSummaryOfMeansArray,dtype=p.float64)[1:,3] return firstfunction() Throws this error message: File "mypath\mypythonscript.py", line 3484, in secondfunction RRDuringArray = p.array(UnFilteredDuringExSummaryOfMeansArray,dtype=p.float64)[1:,3] ValueError: setting an array element with a sequence. However, this code works: import numpy as p a=range(24) b = p.reshape(a,(6,4)) c=p.array(b,dtype=p.float64)[:,2] I re-arranged the code a bit to put it into a cogent posting, but it should more or less have the same result. Can anyone show me what to do to fix the problem in the broken code above so that it stops throwing an error message?

    Read the article

  • Weird output as the numbers get bigger in Fibonacci sequence

    - by Jon
    I noticed in my fibonacci sequence that I'm getting negative numbers after a certain point. Does this have to do with the limited range of "int"? or is there something wrong with my code? Here is the code: using std::cout; int main() { int n = 50, f1 = 0, f2 = 1, fn = 0, i = 0; cout << "0 "; for (i = 0; i < n; i++) { fn = f1 + f2; f2 = f1; f1 = fn; cout << fn << " "; }

    Read the article

  • Image processing on bifurcation diagram to get small eps size

    - by yCalleecharan
    Hello, I'm producing bifurcation diagrams (which are normally used in nonlinear dynamics). These diagrams identify abrupt changes in topologies due to stability changes. These abrupt changes occur as one or more parameters pass through some critical value(s). An example is here: http://en.wikipedia.org/wiki/File:LogisticMap_BifurcationDiagram.png On the above figure, some image processing has been done so as to make the plot more visually pleasant. A bifurcation diagram usually contains hundreds of thousands of points and the resulting eps file can become very big. Journal submission in the LaTeX format require that figures are to be submitted in the eps format. In my case one of such figures can result in about 6 MB in Matlab and even much more in Gnuplot. For the example in the above figure, 100,000 x values are calculated for each r and one can imagine that the resulting eps file would be huge. The site however explains some image processing that makes the plot more visually pleasing. Can anyone explain to me stepwise how go about? I can't understand the explanation provided in the "summary" section. Will the resulting image processing also reduce the figure size? Furthermore, any tips on reducing the file size of such a huge eps figure? Thanks a lot...

    Read the article

  • Swimlane Diagram Softwares with Expand/Collapse Features

    - by louis xie
    I've been searching real hard for a software which can fulfill my needs, but to no avail. I have a swimlane diagram which is extremely huge, and almost impossible to model using Visio or any traditional swimlane software. I would need to model both the operational process, as well as the interactions within an application and between different applications. Therefore, without wasting additional effort modelling these separately, I am looking for a solution which I can combine both views together. That is, possibly one which I can expand/collapse/group/ungroup processes/subprocesses together. Take a typical credit card process for instance, a hypothetical description of the swimlane could be as such: Customer submits application form to the bank Bank Officer A receives the application form and validates that it was correctly filled Bank Officer A submits application form to Bank Officer B for processing. Bank Officer B checks credit quality of the customer through Application X. Application X submits query to Application Y to retrieve Credit Report. Application X retrieves credit report and submits to Application Z for computation of credit scores Bank Officer B validates that customer is credit worthy, and submits application to Bank Officer C for processing. The above is an over-simplified credit card request process, and a purely hypothetical one. What I'm trying to drive at is, each of the above processes have sub-processes, and I want to be able to switch between a "detailed" view and "aggregated" view. If possible, add in time dependency of the different tasks, as well. I haven't been able to find one such software which could do this.

    Read the article

  • Invalid byte 1 of 1-byte UTF-8 sequence

    - by user275886
    I have a MyFaces Facelets application, where the page coding is a bit rugged. Anyway, it's developed with Eclipse and built with Ant, and kindof runs ok in Tomcat 2.0.26. So far so good. Now, I'd rather build with Maven, so I made a couple of pom-files, opened them in Netbeans and built, and now I have a war file that deploys ok. However, on any facelet page it barfs out with com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:684) at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:554) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1742) So, I've tried a lot of different things, and the application actually run simple pages without facelet stuff. But, everything runs if I just build with Ant instead ... So my question is: What's the most likely difference between an ant build and a maven build that may cause this? It also seems that even though I've configured for UTF-8 in Netbeans and pom-files, Netbeans eventually ends up reporting the facelet files as ISO-8859-1 after some editing. I've made sure that most central libs are of same version (especially xerces 2.3.0), I've added an encoding servlet filter that had no effect. And, I'd rather fix the maven build and keep the buggy pages, than the other way around ... it's my intention to introduce Naven, not fix buggy pages.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >