sequence

What is the name of this sequence generation problem? Any comments?

I need to iterate over an ordered sequence that is defined by an array of numbers ai, i = 1..n, where n is the length of each sequence element, and each ai specifies the max number of possible values at position i in the output sequence. Example: a = {10,10,10} Sequence: 000, 001, 002, ... 999 (the decimal numbers from 000 to 999) a ...

JavaFX: concatenating sequences

Is there a standard library function or built-in construct to concatenate two sequences in JavaFX? Here a Sequences.concatenate() function is mentioned, but it is nowhere to be seen in the official API. Of course one could iterate over each sequence, inserting the values into a new sequence e.g: function concatenate(seqA: Object[], se...

Converting java.util.List into a JavaFX sequence

What is the most concise way of converting a java.util.List into a normal JavaFX sequence (in JavaFX)? e.g. def myList = java.util.Arrays.asList(1, 2, 3); def mySequence = ... // a sequence containing [1, 2, 3] ...

Algorithm to find the next number in a sequence

Ever since I started programming this has been something I have been curious about. But seems too complicated for me to even attempt. I'd love to see a solution. 1, 2, 3, 4, 5 // returns 6 (n + 1) 10, 20, 30, 40, 50 //returns 60 (n + 10) 10, 17, 31, 59, 115 //returns 227 ((n * 2) - 3) ...

Is there a way to extract continuous feature in an 2D array

Say I have an array of number a <- c(1,2,3,6,7,8,9,10,20) if there a way to tell R to output just the range of the continuous sequence from "a" e.g., the continuous sequences in "a" are the following 1,3 6,10 20 Thanks a lot! Derek ...

How to find the longest continuous subsequence whose reverse is also a subsequence

Suppose I have a sequence x1,x2,x3.....xn, and I want to find the longest continuous subsequence xi,xi+1,xi+2......xi+k, whose reverse is also a subsequence of the given sequence. And if there are multiple such subsequences, then I also have to find the smallest i. ex:- consider the sequences: abcdefgedcg here i=3 and k=2 aabcdddd he...

Number Sequence in MySQL

In Python if I wanted a sequence from 0 - 9 (inclusive) I would use xrange(0,10) . Is there a way I can do this in MySQL? ...

Retrieve autogenerated key in Oracle with SubSonic 2.2

Hi guys, I'm currently using SubSonic 2.2 to code against an Oracle XE DB, which carries certain tables that have a primary key which gets automatically filled by means of a sequence and corresponding trigger. In SQL Server this isn't a problem, since SubSonic automatically fills in the autoincrement key value into the correct property...

Hibernate: can I override an identifier generator using XML with a custom generator?

I want to use a custom sequence generator in my application, but the entity is located in a domain model jar that is shared with other applications. Apparently entity annotations can be overridden in orm.xml but I can't figure out the proper XML incantation to get this to work. I can modify the annotation in the entity like this this: ...

Increment sequence when updating freebusy in icalendar?

I'm new to icalendar, but I couldn't find an answer to this specific situation. Must the iCalendar sequence number of a published event be incremented if all that's changing is the free/busy status? I don't think that is a "mandatory" reason to increment the sequence, but I'm not sure. My web site has a shared calendar where users can ...

Randomly generating sequence of ints in a specific range

Hi, I am unsure how to put this and my math skills aren't that strong. But here's what I need. I want to generate a list of all the 16bit integers (0-65535). But everytime I do so I want to seed the algorithm randomly that each time the list starts with a different integer and all the subsequent integers will be generated once but also ...

Encode/compress sequence of repeating integers

Hey there! I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now I need some algorithm to convert this string into something compressed like a9b3a3c3a2d5 Which means "a 9 times, then b 3 times, then a 3 times" and so on, where "a" stands for 0, "b" for 1, "c" for 2 and "d" for...

Hibernate schema parameter doesn't work in @SequenceGenerator annotation

I have the following code: @Entity @Table(name = "my_table", schema = "my_schema") @SequenceGenerator(name = "my_table_id_seq", sequenceName = "my_table_id_seq", schema = "my_schema") public class MyClass { @Id @GeneratedValue(generator = "my_table_id_seq", strategy = GenerationType.SEQUE...

Is there something like "if not exist create sequence ..." in Oracle SQL?

Very probably a noob question: For my application that uses an Oracle 8 DB, I am providing an SQL script to setup stuff like triggers, sequences etc., which can be copied and pasted into SQL*Plus. I would like the script to not stop with an error if a sequence that I am trying to create already exists. For a Trigger this can easily be do...

Most elegant way to morph this sequence

Hi folks: I've got the Day of the week stored in a database table (that I do not control), and I need to use it in my code. Problem is, I want to use the System.DayOfWeek enum for representation for this, and the sequences are not the same. In the database, it's as follows: 1 2 3 4 5 6 7 S M T W T F S I need it as follo...

Hibernate sequence should only generate when ID is <=0

Hi all, I'm using the folowing sequence in my code. (I got the sequence and @Id @SequenceGenerator(name = "S912_PRO_SEQ", sequenceName = "S912_PRO_SEQ", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "S912_PRO_SEQ") @Column(name = "PRO_ID", unique = true, nullable...

Need help regarding Async and fsi

I'd like to write some code that runs a sequence of F# scripts (.fsx). The thing is that I could have literally hundreds of scripts and if I do that: let shellExecute program args = let startInfo = new ProcessStartInfo() do startInfo.FileName <- program do startInfo.Arguments <- args do startInfo.UseShellExe...

CommunicationException with 'not recognized sequence' message in WCF.

Hello, I get a CommunicationException while using WCF service. The message is: The remote endpoint no longer recognizes this sequence. This is most likely due to an abort on the remote endpoint. The value of wsrm:Identifier is not a known Sequence identifier. The reliable session was faulted. The exception is thrown in a moment after a...

MidiSystem.getSequencer() returns Audio Device Unavailable

I've keep having an exception thrown, on and on. When i try to make a new Sequencer object, i keep getting the javax.sound.midi.MidiUnavailableException: Audio Device Unavailable exception. So, here's the code: import javax.sound.midi.*; public class MiniMusicPlayer1 { public static void main(String[] args) { try { Se...

Mixed surrogate composite key insert in JPA 2.0, PostgreSQL and Hibernate 3.5

First off, we are using JPA 2.0 and Hibernate 3.5 as persistence provider on a PostgreSQL database. We successfully use the sequence of the database via the JPA 2.0 annotations as an auto-generated value for single-field-surrogate-keys and all works fine. Now we are implementing a bi-temporal database-scheme that requires a mixed key i...