FAQ Database Discussion Community


Android- RecyclerView Adapter - How to implement endless scrolling without deleting previous items

scroll,adapter,recyclerview,infinite
I'm developing an app to get tweets and display them on screen. I've user RecyclerView and it works fine. The thing is that when I get to the last item, I'm swapping the adapter in order to get new items, but the previous items get deleted and I can't scroll...

Is equality testing possible between two infinite data structure in Haskell?

haskell,lazy-evaluation,infinite
In a project I'm working on, data of a certain type may sometimes contain themselves in it. For example, data Example = Apple Int | Pear Int Example a = Pear 10 a b = Pear 10 b As a programmer I know that a and b are equal, but...

Infinite loop issue in c

c,loops,infinite
The code below compiles, however when I run it I have an error that causes an infinite loop. The loop doesn't even get to scanf where I should be taking in the new value instead it just always prints the prompt. What exactly have I done wrong to cause this...

scroll to with easing does not work with infinite js. scroll to with easing conflicting with infinite js

javascript,scroll,conflict,infinite
PLEASE VIEW SOURCE CODE ON BOTH PAGES. On this page: _p1.html It is "page 1" Use the scroll bar on the right side of the browser to scroll all the way down to bottom of page. "page 2" will appear. I am using infinite scroll js. I am also using...

Logical error causing infinite loop in C

c,arrays,infinite
I am working on a project in a basic C class that involves reading polynomial equations in from a file, taking the derivatives, and outputting the derivatives back to a different file. I am doing the parsing of the array that holds the input from the file in my first...

C# Recursion Error - Extension Methods

c#,loops,methods,infinite
I get an error here saying that the program could not exit the infinite loop. public static class Program { public static void Main(string[] args) { Object obj = new Object(); Console.WriteLine(obj.GetClassName()); } public static string GetClassName(this object value) { return value.GetClassName(); } } ...

Would the ability to detect cyclic lists in Haskell break any properties of the language?

haskell,cycle,infinite
In Haskell, some lists are cyclic: ones = 1 : ones Others are not: nums = [1..] And then there are things like this: more_ones = f 1 where f x = x : f x This denotes the same value as ones, and certainly that value is a repeating...

sum of series AP GP clrs appendix A.1-4

algorithm,math,infinite,clrs,gp
I am trying to prove an equation given in the CLRS exercise book. The equation is: Sigma k=0 to k=infinity (k-1)/2^k = 0 I solved the LHS but my answer is 1 whereas the RHS should be 0 Following is my solution: Let's say S = k/2^k = 1/2 +...

Make an infinite list of natural numbers pasted together and find index python

python,list,indexing,infinite
I need to make an infinite list of numbers and list them like this: [12345678910111213141516171819...] or [1,2,3,4,5,6,7,8,9,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1,8,1,8,9....] So that the numbers are pasted together and can be separately indexed(find the position of a number eg. 15th number would be 2) So the user would have to input some numbers like...

Infinite loop using __getattr__ and getattr

python,python-2.7,infinite,getattr
Okay, I'm having a bit of a problem and I'm not quite sure why its occurring the way that it is. What I'm trying to do is allow access to attributes on an object via snake_case or camelCase in python 2.7.X I thought that __getattr__ was the correct way to...

Adding wheel factorization to an indefinite sieve

python,primes,infinite,sieve-of-eratosthenes,wheel-factorization
I’m modifying an indefinite sieve of Eratosthenes from here so it uses wheel factorization to skip more composites than its current form of just checking all odds. I’ve worked out how to generate the steps to take to reach all the gaps along the wheel. From there I figured I...

How to numerically integrate with infinite limit in MATLAB?

matlab,integration,infinite,numerical
I want to numerically integrate an integral with infinite limit. Does anyone have any idea how should I do that? int(x* exp (v*x + (1-exp(v*x))/v),x, o , inf) does not work. Note that I will have values for v. %n=10; kappa=.5; delta0=.5; Vmax=500; Vdep=2.2; l=2.2; kbT=4.1; %xb=.4; fb=10; k=1; V0=5;...

Replace Inf in R data.table / Show number of Inf in colums

r,data.table,infinite,na
I can't figure out how to use an is.na(x) like function for infinite numbers in R with a data table or show per column how many Inf's there are: colSums(is.infinite(x)) I use the following example data set: DT <- data.table(a=c(1/0,1,2/0),b=c("a","b","c"),c=c(1/0,5,NA)) DT a b c 1: Inf a Inf 2: 1...