# Questions tagged [sequence]

A sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence. In a relational database, a sequence is an object that is used to generate unique numbers for a primary key.

4,604 questions
11 views

### How to find first non-null record for every column and group by id

I have a table storing events and I want to create a view of the latest/current state for each id. Each row in the table should be build up by non-null records with the highest corresponding sequence ...
11 views

### Sniffing Wi-Fi probe requests using two antennas

I would like to check the channel sweeping patterns bursts from a device. As I attached two enabled-monitor-mode wireless cards to one Raspberry pi, one of the cards (antennas) was set to channel 1 ...
44 views

### Reorder data with start and end columns into contiguous sequence

I have a data frame where each row has a start and an end ID: df <- data.frame(start_id = c("130", "100", "150", "120"), end_id = c("150", "180", "100", "130")) # start_id ...
36 views

### How to make sequence raising a number to a sequence of powers

I have: cost = c(2^(-5),2^(-3),2^(-1),2^(1),2^(3),2^(5),2^(7),2^(9),2^(11),2^(13),2^(15)) and I would like a more elegant command, such as: seq(from = 2^(-5), to = 2^(15), by = __)
53 views

### I would like to print the arithmetic sequence triangle

I would like to print the 'number' triangle like the below sequence. 1 2 4 7 11 3 5 8 12 6 9 13 10 14 15 assume that give n is 5. means that column will give 5 and column - 1. also, the ...
29 views

### Create a Sequence With Two of Each Element Satisfying Certain Distance Criteria

Given a sequence of distinct items Sa, we wish to create a sequence Sb (composed of the same items in Sa, but in a different order) such that the sequence S = Sa + Sb (sequence Sb appended immediately ...
58 views

### How do I expand integer_sequence?

I have a function which looks like this: template <typename T, std::size_t... I> std::ostream& vector_insert(std::ostream& lhs, const char* delim, const T& rhs, std::index_sequence&...
30 views

### Perl how to find motifs in a multi fasta file

Given a multi fasta file named file.txt: >seq1 CCTTTGGATGGCAAAATTTNTNGTAAA AGGGCACCCANTTCTGGC >seq2 NNNNNGGGGCGTAANGAGGGGCACGG TNCC >seq3 AAAAAANNNNTAC I want to find motifs ...
6 views

### POSTGRESQL 9+ : How to drop default / sequence, if it exists, from column?

I am trying to drop the default constraint from an ID column. This query should be usable on multiple tables in which the ID may or may not have that constraint. According to postresql 9+ doc (I use 9....
50 views

### How can I take varying chunks out of a Kotlin Sequence?

If I have a Kotlin sequence, every invocation of take(n) restarts the sequence. val items = generateSequence(0) { if (it > 9) null else it + 1 } @Test fun `take doesn't remember position`() { ...
34 views

### Concatenating lazy sequences in swift?

I'd be like to be able to do something like [1, 2, 3].lazy + [4, 5, 6].lazy rather than ([1, 2, 3] + [4, 5, 6]).lazy, since the hypothetical former operation is constant, while the latter is linear.
42 views

### What is the next number in the sequence 3,0,1,6,7? And How to code this sequence up to n digits?

Got this question in a programming test. The actual question was to compute this sequence up to nth digit and compute its sum. The question said that '3,0,1,6,7 are first five numbers of the sequence'
20 views

### Scala -Convert a sequence of array of bytes to String [duplicate]

How do we print human readable form of Seq[Array[byte]] ? Tried few approaches which didn't work.
34 views

### count repeated row values without breaks

I want to count repeated values in rows one by one without breaks. If it breaks with NULL value, then count it again from zero. It is a simple table consists from action_id and event_code. | id | ...
46 views

### How to group list items into sequential tuples in Python? [duplicate]

I have a list which contains numbers in ascending order like [0, 1, 3, 4, 6] or [2, 3, 4, 5] I need to get a list of lists which contains the elements as a range items like [[start, end], [start,...
33 views

### Wait two sequence actions before do something in ngrx effect angular

I want to: create a book, then load list of books, then navigate to book detail page Assume that I have 2 effects: load list book and create book. loadListBook effect work correctly (as before) My ...
82 views

### Removing All Repetitive Elements from a Sequence

The Common Lisp sequence function remove-duplicates leaves behind one element of each multiplicity. The goal of the following analogous function remove-equals is to remove all multiplicities. However,...
37 views

### Sequence (string) consists of repeating another sequence in sliding manner

I have two arrays but will use strings to make the explanation clearer. Need to find out if the first string is a sliding repeating or the second string. Examples (pipes are just for visual delimiting,...
24 views

### T-SQL: alter sequence number current_value without changing start_value

I know how to alter a sequence number via the alter statement. : ALTER SEQUENCE dbo.seq_SomeSequnce RESTART WITH @someRandomNumber The above will reset the current_value and start_value with ...
46 views

### SQL Server user unable to see/use sequence

I can create a sequence and select values under 1 database user but even after granting update to public another DB user is still unable to use/see the sequence. What do I need to request our remote ...
34 views

### How to force a Kotlin sequence to a Kotlin sequence to evaluate

How do you force a Kotlin Sequence to evaluate all pending operators? I know you can apply a terminal operation and I have achieved that by calling .size on the sequence but that feels like a hack and ...
43 views

### Counting number of sequences of particular value for multiple columns in a data frame

I would like to create a table or a new data frame that displays, for each column in the original data frame (of which there are many), how many times a sequence of a specific value occurs. For ...
25 views

### Count number of times a particular value follows another particular value for each column in a data frame

I would like to create a table or a new data frame that displays, for each row in the original data frame, how many times a specific value precedes another specific value. For example, if I have the ...
27 views

### data.table generate sequence with intervals based on the first and last rows of unique ID

I have a data table like this. How would I generate a sequence with .25 step for each of the row with the same time in that ID number. I am pretty new to R and try to do some data wrangling ... ...
41 views

### need to pass ~a id=“myID” onclick=cEdit(“var1”,“var2”)>Display Text </a~ as an exact string to a plug-in

Good morning Team, I am new to this site, but have found it helpful over the last several months. I have a challenge with MVC .net core 2.2 and c#. I am hopeful this forum may be able to help. ...
33 views

### What is the regular expression for negating more than one sequences of characters? [duplicate]

I have (?:(?!/>)[^\s>])* to discard text which contains "/>" or " " or ">". I want to discard another sequence say "dummy". Testcases : helloworld (match "helloworld") hello world (match "...
40 views

### How to create a sequence of primes with some requirements?

There is an Asmuth-Bloom algorithm that uses Chinese reminder theorem and a sequence of primes that must meet the requirements. Requirements: 1) Each prime must be greater than some prime number (P). ...
57 views

### How to calculate the fraction of sequence that matches given datatables with start and end coordinates?

Given two datatables with start and end coordinates for sequences of integers: df1 <- data.table(CAT = c(rep("A", 3), rep("B", 3), rep("C", 3)), START = c(1, 11, 21, 1, 21, 41, 1, 11,...
18 views

### LSTM _ Can I divide a sequence to get more sequences?

I have 14 sequences of 72 timesteps and 11 features. 6 of them classify as "0" and 8 of them as "1". I would like to train an LSTM able to classify a new sequence into "1" or "0". I had an idea to do ...
38 views

### Calculate mean of specific row pattern

I have a dataframe like this: V1 = paste0("AB", seq(1:48)) V2 = seq(1:48) test = data.frame(name = V1, value = V2) I want to calculate the means of the value-column and specific rows. The pattern ...
31 views

### jQuery autocomplete sequence issue

I have jQuery autocomplete on my page. There is the JS code: var leadNamesForAutocomplete = []; leadNamesForAutocomplete.push('Create new'); \$('#filterByNameAutosuggestion option').each(function() { ...
174 views

### Is there an algorithm to figure out a 'nice' number formatting for a sequence of numbers of arbitrary order of magnitude?

I'm currently using an implementation of the Extended Wilkinson Algorithm to generate a sequence of axis tick values. For this, the algorithm is given a value range [min,max] and a number n of desired ...
32 views

### Javascript - Cannot read property 'value' of null - Combobox value

Wondering if anyone could help with the following code. I have a combobox called "cboAgreement" which is a dropdown with two values "Agree" and "Disagree". I have a form where, the comments grid is ...
52 views

### How to Reset Oracle Sequence Safely?

I want to reset my Oracle Sequence to 0 everyday my code like this: create or replace procedure reset_seq(p_seq_name in varchar2) is l_val number; begin execute immediate 'select ' || p_seq_name |...
53 views

### Rank elements in a sequence in clojure

I have a sequence on elements like ([:Jon 326] [:Mary 233] [:Matthew 255]) and would like to transform this sequence in a clever way into something like a map of {{:name Jon :rank 1} {:name Matthew ...
36 views

### Deriving a (generalized) Sequence from a Proper Sequence

A number of the Common Lisp sequence functions take a proper sequence as an input and return a sequence as output. Starting with a proper sequence, how could the function not return another proper ...
12 views

### R: Group by Sequence of Rows

I have a data frame from IMDB that looks like this. It is unfortunately not grouped but I was hoping I can make R group it. The data look like this: V1 V2 starts_with ...
63 views

### Finding kth element in the nth order of Farey Sequence

Farey sequence of order n is the sequence of completely reduced fractions, between 0 and 1 which when in lowest terms have denominators less than or equal to n, arranged in order of increasing size. ...
12 views

### Put total_cov next to the mutationtypes and frequencies for easy filtering

I am using Breseq to analyze my Shotgun-Data. It was pretty straight forward until now. I have an issue with filtering my data. I succeeded filtering out the intergenic/non-synonymous/nonsense ...
28 views

### Keras Sequential data processing order

My goals is to develop a Sequence-to-Sequence model. Assume the input data to a Keras Sequential LSTM model is time-ordered and shaped as (samples, time_length, num_features) For now, samples = 1 ...
28 views

### R: Creating a single vector using elements from two separate vectors [duplicate]

I'm trying to efficiently create a vector of sequences using a vector of the starting values and end values, but I am having a rough time coming up with a clean way to do so. I attempted to cbind ...
54 views

### MarkLogic - How to effectively filter a sequence with javascript

I need to filter a MarkLogic sequence (after the cts query) with javascript by checking the existence of an element. If the element exists, show the value. I know this is possible with XQuery by ...
22 views

### How to deal with ending token in Keras decoder for batch samples

A endocer-decoder sequence model has been trained. To apply the model for inference, the prediction at t-1'th decoder output is used as the input at t. If we have a ending_token, and I want the ...
39 views

### How can I generate random (not necessairly binary) tree?

I'm learning data structers and trying to write program, which would generate me a tree (not necessarily binary one) that contains n vertices. So far I tried Prufer sequence and it works for me well - ...
43 views

### Is there a design pattern to delay update method?

The Render function requires multiple executions before it gets called only once ( this is used for input data collection ). I could force call the Render function every time, and it will not break ...
21 views

### What's the execution sequence of this code, it seems the 'sleep' function is undefined when being executed? [duplicate]

I am a newbie at Javascript and don't understand what's the execution sequence of the code below. It seems that when the sleep function is called, it's still not defined. But the result is the browser ...
17 views

### Updating Proportional Symbols Using Sequence Control

I am working on a map which allows a user to sequence through temporal data with the map calculating proportional symbols accordingly. I have a sequence bar that accepts input (clicks/drags), and ...
17 views

### Is there a way to add a sequence function to a heat map?

I have implemented heat map code to my website but I need to be able to sequence through multiple years of data. I used the leaflet-heat.js plug in. https://github.com/Leaflet/Leaflet.heat/tree/gh-...