sequence

Using Hibernate sequence generators manually

Basically, I want a way to access sequence values in a database-neutral way. The use case is that I have a field on an entity that I want to set based on an incrementing value (other than the id). For instance, say I have a Shipment entity. At some point after the shipment gets created, it gets shipped. Once it gets shipped, a manife...

Performing BLAST/SmithWaterman searches directly from my application

I'm working on a small application and thinking about integrating BLAST or other local alignment searches into my application. My searching has only brought up programs, which need to be installed and called as an external program. Is there a way short of me implementing it from scratch? Any pre-made library perhaps? ...

How to generate a multiplication table sequence?

I want to generate a sequence like a multiplication table. So for a start of 1 and a stop of 10 I am looking for a sequence like 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // 1*1 - 1*10 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, // 2*1 - 2*10 3, 6, 9, 12, ... // 3*1 - 3*10 Here is my lame start at it, however I can't seem to figure out how to cleanly i...

Oracle sequences: CURRVAL not allowed here?

The following Oracle SQL code generates the error "ORA-02287: sequence number not allowed here": INSERT INTO Customer (CustomerID,Name) VALUES (Customer_Seq.nextval,'AAA'); SELECT * FROM Customer where CustomerID=Customer_Seq.currval; The error occurs on the second line (SELECT statement). I don't really understand the problem, becaus...

pythonic format for indices

Hello, I am after a string format to efficiently represent a set of indices. For example "1-3,6,8-10,16" would produce [1,2,3,6,8,9,10,16] Ideally I would also be able to represent infinite sequences. Is there an existing standard way of doing this? Or a good library? Or can you propose your own format? thanks! Edit: Wow! - thank...

Generating Sequence Diagrams using EnterpriseArchitect v7.5?

I have a NUnit test case which connects to a WCF service hosted in IIS6 (on Vista). I would like to use EA to record the stack-trace of this and generate a sequence diagram. Does anyone have any step-by-step instructions in how to get can be done (or even how to get any recording done when using NUnit) using EA? Thanks. ...

Adding class to all elements using :eq

I want to add the class 'second-col' to all second TD's in each row, but this isn't working: $('table.tst3 tbody td:eq(1)').addClass('second-col'); Thanks! ...

Dynamic programming problems

I'm looking for some pointers about a dynamic programming problem. I cannot find any relevant information about how to solve this kind of problem. The only kind of problem I know how to solve using dynamic programming is when I have two sequences and create a matrix of those sequences. But I don't see how I can apply that to the followin...

An algorithm for splitting a sequence in equally spaced, non colliding subsequences.

Hi to all, I got this problem that I can't just solve algorithmically. Let's say i have a video capture that always captures video frames at a fixed rate F (let's say 30 frames per second). What I want is to "split" this frame sequence in n (say four) subsequences. Each subsequence has its framerate fn, that's obviously < F. Frames in ...

C# - Append Number To File Being Saved

I have created a screenshot program and all is working great. The only problem is, I am not sure how I can make it so the screenshots are saved with appending numbers. Example: Screenshot 1, Screenshot 2, Screenshot 3, Screenshot 4, etc. Obviously this could be applied to other files being saved. Any ideas? Thank you. ...

Recurrence sequence in Java / Python / Mathematica

How can you write the following statement in the given languages? a(0) = 1 a_(n+1) = 1 - 1 / ( a_n + 3) I need to find the smallest value of n when a_n -> 0.732050.... My attempt in Mathematica a[(x+1)_] = 1 - 1/(a[x_] + 3) The problem is apparently in this a[(x+1)_]. However, I do not know how to do it iteratively in Mathematica....

Why leading zero not possible in Python's Map and Str

What is the reason that you cannot use zero at the beginning of a number when converting the number to a sequence? Code example map(int,str(08978789787)) which gives Syntax error. I would like to convert numbers which leading digit is zero to a sequence. How can you convert such a number to a sequence? ...

How to design table that can be re-sequenced?

I need to make a design decision about database. The requirment is that one database table has an *AUTO_INCREMENT PRIMARY KEY* field called id. By default, each row is shown to user (in web) sorted ascendenting by id. For example, if there are 4 records in the table. The UI will show rows in sequence of 0, 1, 2, 3. Now, there is require...

MySQL: Add sequence column based on another field

Hi all, I'm working on some legacy code/database, and need to add a field to the database which will record a sequence number related to that (foreign) id. Example table data (current): ID ACCOUNT some_other_stuff 1 1 ... 2 1 ... 3 1 ... 4 2 ... 5 2 ......

iPhone Syncing a time sequence with music

Hey I'm using AVAudioPlayer to play music in my iPhone app. In a class that I wrote I have an array that contains random ascending integers. (2, 4, 9, 17, 18, 20,...) These integers represent times in the song at which a certain event should occur. So if you take the above array, after 2 seconds of the song playing, some method should...

Are there any PHP to Sequence Diagram Converters and vice versa?

Obviously it's a lot easier to convert from code to Sequence Diagrams, rather than from a Sequence Diagram to a bunch of code that doesn't match your implementation at all. However, these do exists for languages like Java, and .NET. Does anyone have any links to such tools for PHP? ...

Transform this Clojure call into a lazy sequence

I'm working with a messaging toolkit (it happens to be Spread but I don't know that the details matter). Receiving messages from this toolkit requires some boilerplate: Create a connection to the daemon. Join a group. Receive one or more messages. Leave the group. Disconnect from the daemon. Following some idioms that I've seen used ...

Geometric sequence puzzler

The following problem has been puzzling me for a couple of days (nb: this is not homework). There exists two geometric sequences that sum to 9. The value of their second term (t2) is 2. Find the common ratio (r) Find the first element (t1) of each The answers to (1) are 2/3 and 1/3 and the answers to (2) are 3 and 6 respectively. U...

SCORM 2004 Sequencing... what am i doing wrong (Passed automaticaly in LMS)

Dear friends... help me please... see my manifest above.. I believe it's correct but still enter to the course in LMS and the items mod01, mod02 and mod03 show "passed" and the sequency show totaly open... HELP. ADL SCORM 2004 3rd Edition GESTÃO ESTRATÉGICA TESTANDO SESSÃO <item identifier="mod01"> <title>HAB...

How to use @GeneratedValue in a non pk field

Hello, I would like to know how we could use a sequence in JPA. We have a non-pk field which value must come from a sequence in DB. How could I update that value updating the entity? Thanks in advance. ...