sequence

How do I create a period date range from a mysql table grouping every common sequence of value in a column

My goal is to return a start and end date having same value in a column. Here is my table. The (*) have been marked to give you the idea of how I want to get "EndDate" for every similar sequence value of A & B columns ID | DayDate | A | B ----------------------------------------------- 1 | 2010/07/1 | 200 | 300 2 | 2010/07/2 | 2...

Calculate Sums with accumulate

procedure accumulate is defined like this: (define (accumulate combiner null-value term a next b) (if (> a b) null-value (combiner (term a) (accumulate combiner null-value term (next a) next b)))) problem 1: x^n ;Solution: recursive without accumulate (define (expon x n) (if (> n 0) (* x (ex...

Python splitting list based on missing numbers in a sequence

I am looking for the most pythonic way of splitting a list of numbers into smaller lists based on a number missing in the sequence. For example, if the initial list was: seq1 = [1, 2, 3, 4, 6, 7, 8, 9, 10] the function would yield: [[1, 2, 3, 4], [6, 7, 8, 9, 10]] or seq2 = [1, 2, 4, 5, 6, 8, 9, 10] would result in: [[1, 2], [4, ...

Microsoft Access - Create a numerical sequence based on field value changes?

For query data like this: Name , Details JEFF , TEST1 JEFF , TEST2 JEFF , TEST3 BOB , TEST1 BOB , TEST2 How do I query so that a numerical sequence (1,2,3...) can be added that resets back to 1 each time the name changes (ie from JEFF to BOB)? Is it possible to use the DCOUNT function? What ...

sql sequences count

hello everyone i have table a follows userid answer 1 true 1 true 1 false 1 true 1 true 1 true 2 true 1 true i want to get the latest count of true sequence per user so i will get userid count 1 4 2 1 please help ...

What are the tradeoffs when generating unique sequence numbers in a distributed and concurrent environment?

I am curious about the contraints and tradeoffs for generating unique sequence numbers in a distributed and concurrent environment. Imagine this: I have a system where all it does is give back an unique sequence number every time you ask it. Here is an ideal spec for such a system (constraints): Stay up under high-load. Allow as many...

common lisp cons creates a list from two symbols, clojure cons requires a seq to cons onto?

(Disclaimer - I'm aware of the significance of Seqs in Clojure) In common lisp the cons function can be used to combine two symbols into a list: (def s 'x) (def l 'y) (cons s l) In clojure - you can only cons onto a sequence - cons hasn't been extended to work with two symbols. So you have to write: (def s 'x) (def l 'y) (cons s '(l...

Animate returned elements from each() in order

I'm using this script to animate some images inside anchors: $('#locations a').each(function() { // set opacity 0 take initial position $(this).css('opacity', '0'); var left = $(this).css('left'); var top = $(this).css('top'); // reset position and animate $(this).css({'left' : '0', 'top'...

Fibonacci under 4 millions!

Possible Duplicate: Python program to find fibonacci series. More Pythonic way. Hey, i was trying to write a script which sums all the even terms in "Fibonacci Sequence" under 4 millions. Fibonacci1 = 1 Fibonacci2 = 2 a = 2 i = 4 for i in range(1,4000000): Fibonacci1 = Fibonacci1 + Fibonacci2 if Fibonacci1 % 2 == 0: a = a...

"average length of the sequences in a fasta file": Can you improve this Erlang code ?

I'm trying to get the mean length of fasta sequences using Erlang. A fasta file looks like this >title1 ATGACTAGCTAGCAGCGATCGACCGTCGTACGC ATCGATCGCATCGATGCTACGATCGATCATATA ATGACTAGCTAGCAGCGATCGACCGTCGTACGC ATCGATCGCATCGATGCTACGATCTCGTACGC >title2 ATCGATCGCATCGATGCTACGATCTCGTACGC ATGACTAGCTAGCAGCGATCGACCGTCGTACGC ATCGATCGCATCGATGCTACGATC...

What's the fastest way to generate a random sequence from a list of data?

Let's say that I have a list of data: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} where n = 10 elements I'd like to randomly choose k elements of this set to form a sublist, say k = 5. In that case, I could end up with a sublist that looks like {9, 3, 5, 2, 7} I could accomplish this by: Randomly determining an offset within the list, between 0 a...

Using SEQUENCE(Oracle) in WHERE Clause

Possible Duplicate: Oracle sequences: CURRVAL not allowed here? In my program i am inserting a values using sequence. Procedure 1 Insert tablename(id,name) values(seq.nextval,somename) now i need to update this same table. how do i do it. I use another Procedure to update. Procedure 2 Update set name ='someothername' wh...

Take N elements from sequence with N different indexes in F#

Hi, I'm new to F# and looking for a function which take N*indexes and a sequence and gives me N elements. If I have N indexes it should be equal to concat Seq.nth index0, Seq.nth index1 .. Seq.nth indexN but it should only scan over indexN elements (O(N)) in the sequence and not index0+index1+...+indexN (O(N^2)). To sum up, I'm looking...

generating sequence number in csharp

I am working on ASP.Net using C# I want to generate a sequence id that should be like this: ELG0001 , ELG0002, ... ELG is the PREFIX and 0001 should be in sequence i am using sql server 2005 This ID will be generated and added to my database. How can I do this? can u help me with coding ...

XML Schema with complext type containing <xs:all> and <xs:any> ?

I want to define a complex type that contains elements that may or may not exist, and also allows for additional undefined elements so I've got something like this: <xs:complexType name="MyType"> <xs:sequence> <xs:element name="A" type="xs:float" minOccurs="0" maxOccurs="1" /> <xs:element name="B" type="xs:float" minOccurs="0" maxO...

Zipping Collections

How do you zip two sequences in Clojure? IOW, What is the Clojure equivalent of Python zip(a, b)? EDIT: I know how to define such a function. I was just wondering whether standard library provides such a function already. (I would be *very* surprised if it doesn't.) ...

Concise Lisp code to apply a list of functions all to the same argument(s) and get a list of the return values?

Suppose I have a single element, and I have a list of predicates (functions). I want to apply each of these predicates to the single element and get a corresponding list of return values. I know that map and friends can apply a single function to each a list of arguments, but is there any concise syntax to apply many functions to a singl...

How to make runtime sequence (C#)

Hi all, <asp:GridView ID="gvCentersList" runat="server" AutoGenerateColumns="False" ShowFooter="true" DataKeyNames="CenterID" CssClass="gv-style"> <FooterStyle CssClass="gv-style_footer"/> <PagerStyle CssClass="gv-style_pager" /> <AlternatingRowStyle CssClass="gv-style_alter" /> <SelectedRowStyle CssClass="gv-style_row-selec...

Getting all combinations of array items while preserving sequence - Ruby

Given an array of strings ["the" "cat" "sat" "on" "the" "mat"] I'm looking to get all combinations of items in sequence, from any starting position, e.g. ["the"] ["the" "cat"] ["the" "cat" "sat"] ... ["cat" "sat" "on" "the" "mat"] ["sat" "on" "the" "mat"] ["on" "the" "mat"] ... ["sat" "on"] ["sat" "on" "the"] Combinations out of t...

how to update multiple rows with the same sequnce value

I'm using DB2 and want to update several rows that meet my condition with the same next value from my sequence. Here is what I tried but this doesn't work as the next value is fetched for each row:- update dependency dep set vid=NEXT VALUE FOR seq_VID where id in ('8371','8372','8373') id is the the primary key and seq_VID is a sequen...