How does Trie and B+ tree compare for indexing lexicographically sorted strings [on the order some billions]?
It should support range queries as well.
From perf. as well as implementation complexity point of view.
In C, it is considered bad practice to call strlen like this:
for ( i = 0; strlen ( str ) != foo; i++ )
{
// stuff
}
The reason, of course, is that it is inefficient since it "counts" the characters in a string multiple times.
However, in Python, I see code like this quite often:
for i in range ( 0, len ( list ) ):
# stuff
Is this bad practice? Should I store the result of len() in a variable and use that?
I am involved in a project where I need to provide subset of our production data (for a date range) to one of my co-workers for trouble shooting.I would like to insert a scrubbed subset of the production data into a new database table that my co-worker can access. Please suggest best approach to achieve this.
I understand I can set the background color of the value from min to the current slider selection by doing a:
#slider .ui-slider-range { background: #88ac0b; }
How do I set the background color for the entire slider (not just from the min or max to the selected value)
Have a model called contact_email.date_sent
I want to be able to run a report which displays all those where the date_sent range is between date.today and date.today 5 days ago.
I assume I use something like
@send_emails = Contact_Email.find(:conditions=> ???)
But not clear what exactly is the best way. Thanks!
I'm trying to change the value of my checkbox to true based on a another cell's value
if range("A1").value = "green" then
Checkbox1.value= true
end if
How to I change the value property to true for multiple checkbox at the same time
For some reason the code that i've tried doesn't do anything at all.
P.S. I'm using format checkboxes
Are there any libraries knocking around that provide any additional general purpose math functions for Javascript? Say things like sums over a range, derivatives, integrals, etc. I can imagine that many things aren't possible, so even libraries that do rough approximations would be interesting.
Thanks!
i have a very simple report that is generated from just one table. one of the columns in the table is a date.
i need to be able to allow the user of the report to enter a range of dates and display data only between those dates.
how do i do this?
Sorry if SO is not the best place, but I have time-tracking enabled in JIRA and want to be able to generate a time-report for each user over a given date range. The only time-tracking report option I have is very limited and doesn't do what I want, is it possible through standard functionality or a free plugin perhaps?
I'm trying to piece together a dynamic view that will give a list of all emails that are still being rejected.
Table structure:
EmailName - varchar(150) - An email address
StartRejection - Date - Day to start rejecting email
Duration - Small Int - Duration of rejection
IsIndefinate - Bit - Is the rejection 'non date range specific' but indefinate
I need to perform a very large sql server insert from a c# application. Somewhere in the range of 20,000 through 50,000 records.
What is the fastest way through SQL server to perform the insert?
There are several options I know of, but I don't know which is the fastest.
insert into MyTable(column1, column2, ..., column*)
select 'value','value',...,'value'
union
select 'value','value',...,'value'
VS
insert into MyTable(column1, column2, ..., column*)
exec('select ''value'',''value'',...,''value'''
'select ''value'',''value'',...,''value''')
VS
bulk insert from a data file
VS
Any better way that you know of :)
Often, I am building an array by iterating through some data, e.g.:
my_array = []
for n in range(1000):
# do operation, get value
my_array.append(value)
# cast to array
my_array = array(my_array)
I find that I have to first build a list and then cast it (using "array") to an array. Is there a way around these? all these casting calls clutter the code... how can I iteratively build up "my_array", with it being an array from the start?
thanks.
I want to save the results of my function binomal_aux to a tuple but I don't have an idea how to, here is my code I have right now.
def binomal (n):
i=0
for i in range(n):
binomal_aux(n,i) #want this to be in a tuple so, binomal (2) = (1,2,1)
return
def binomal_aux (n,k):
if (k==0):
return 1
elif (n==k):
return 1
else:
return (binomal_aux(n-1,k) + binomal_aux(n-1,k-1))
I've got a view like the following:
from django.views.decorators.http import condition
def stream():
for i in range(0, 40):
yield " " * 1024
yield "%d" % i
time.sleep(1)
@condition(etag_func=None):
def view(request):
return HttpResponse(stream(), mimetype='text/html')
However, it definitely doesn't seem to be streaming at all. All the data is dumped at once, at the end, after about 40 seconds. How can I get it to flush correctly?
I have a problem with "pairing" arrays into one (by index). Here is an example:
INPUT:
inputArray = [ [0, 1, 2, 3, 4], [2, 3, 5, 7, 8], [9, 6, 1] ]
OUTPUT:
outputArray = [
[0,2,9],
[1,3,6],
[2,5,1],
[3,7,chooseRandom()],
[4,8,chooseRandom()]]
Questions:
1) How to avoid out of range problem
2) How to write chooseRandom() to choose N neighbour
I'm using python but feel free to share your thoughts in any language.
Is there a git command to add differences within a range of line-numbers to the index?
I want to be able to select lines in my editor and run a macro to add any changes in the selection to the index.
I tried the following && conditional for my if statement and I get a "bad range" error:
<% if (from_today(contact, call.days) == 0..7) && (show_status(contact, call) == 'no status') %>
Why and how can I fix it? The only other way I could do it was to have a second nested if statement and break it apart...not pretty :(
Hi,
How can I take a line like this:
Digital Presentation (10:45), (11:30), 12:00, 12:40, 13:20, 14:00, 14:40, 15:20, 16:00, 16:40, 17:20, 18:00, 18:40, 19:20, 20:00, 20:40, 21:20, 22:00, 22:40, 23:10, 23:40.
And match all the 24 hour times so I can convert to a more human readable format using date()?
Also I want to match times in the 24:00-24:59 range too
Thanks!
The Underline-Tag are removed on HTML5…
But the execCommand creates that Tag…
Is there any alternative working like the execCommand? (An Alternative who prevents also things like nicetestString, things like that will happen if i use only the surroundContents Methode of the Range… it throws a BAD_BOUNDARYPOINTS_ERR)
hello.
Is there significant cpu/memory overhead associated with using automatic arrays with g++/Intel on 64-bit x86 linux platform?
int function(int N) {
double array[N];
overhead compared to allocating array before hand (assuming function is called multiple times)
overhead compared to using new
overhead compared to using malloc
range of N maybe from 1kb to 16kb roughly, stack overrun is not a problem
Thank you
Suppose I have a list as follows
bar=c()
bar["1997-10-14"]=1
bar["2001-10-14"]=2
bar["2007-10-14"]=1
How can I select from this list all values for which the index is within a specific date range? So, if I look for all values between "1995-01-01" and "2000-06-01", I should get 1. And similarly for the period "2001-09-01" and "2007-11-04", I should get 2 an 1.
I have this for a for loop which I made I was wondering how I would write so it would work with a while loop.
def scrollList(myList):
negativeIndices=[]
for i in range(0,len(myList)):
if myList[i]<0:
negativeIndices.append(i)
return negativeIndices
So far I have this
def scrollList2(myList):
negativeIndices=[]
i= 0
length= len(myList)
while i != length:
if myList[i]<0:
negativeIndices.append(i)
i=i+1
return negativeIndices
Hello,
is their any way to make this work, without sacrificing the cdef in cdef caller? (no use of cpdef either)
from array import *
from numpy import *
cdef class Agents:
cdef public caller(self):
print "caller"
A[2].called()
cdef called(self):
print "called"
A = [Agents() for i in range(2)]
def main():
A[1].caller()