I'm looking to develop a CMS project based on UMBRACO but I also need to index the documents created and to offer search functionality therefore I would like to know if you have any suggestion for a lightweight search engine available in .net technology. The main requirement is to be simple and efficient (nothing complex like solr or sphinx ).
I have written this function in Scala to calculate the fibonacci number given a particular index n:
def fibonacci(n: Long): Long = {
if(n <= 1) n
else
fibonacci(n - 1) + fibonacci(n - 2)
}
However it is not efficient when calculating with large indexes. Therefore I need to implement a function using a tuple and this function should return two consecutive values as the result.
Can somebody give me any hints about this? I have never used Scala before. Thanks!
I already have a solid knowledge of Object-oriented PHP as well as HTML/Javascript/MySQL plus a basis in Java.
Now I would like to implement my projects in an efficient way, whether it is a web project in PHP or an Android application.
My problem is once my code gets bigger I start messing error handling, with form validation etc, and I guess its because of my poor basis in software architecture.
Thanks.
Having a bit of difficulty figuring out how to create a named_scope from this SQL query:
select * from foo where id NOT IN (select foo_id from bar) AND foo.category = ? ORDER BY RAND() LIMIT 1;
Category should be variable to change.
What's the most efficient way the named_scope can be written for the problem above?
Hi,
Is enterprise library for exception handling and logging efficient in terms of its memory usage for the functionality provided?
What are the pros and cons?
Thanks
I am building a website on top of nhibernate. Is there any efficient way to build reports? BY reports, I mean is there anyway to execute a complicated query that grabs random pieces of data? StoreProcedures? Hql?
Can I get single, non mapped values from hql?
why do programmers say that "live" is inefficient?
So what are the alternative
methods to replicating that function
that are more efficient?
How do we measure the impact of how much it slows things down?
Hello,
I have a the following table with rows:
================================================================
id | name | group1 | group2 | group3 | group4 |
================================================================
1 | Bob | 1 | 0 | 0 | 1|
================================================================
2 | Eric| 0 | 1 | 0 | 1|
================================================================
3 | Muris | 1 | 0 | 1 | 1|
================================================================
4 | Angela | 0 | 0 | 0 | 1|
================================================================
What would be the most efficient way to get the list with ActiveRecords ordered by groups and show their count like this:
group1 (2)
group2 (1)
group3 (1)
group4 (4)
All help is appreciated.
I have created and committed to Mercurial repository that was created on my local drive. I now have a remote Windows 2003 web server setup to serve repositories via hgwebdir.cgi.
How do I move the locally created repository to the web server?
It looks like an ftp of the .hg folder on the local drive to the remote web server does the trick. Am I doing it the right way. Is there a more efficient way?
Say I have http://www.mysite.com/I-Like-Cheeseburgers and I want that to point to Item with id 3. Sometime later, I change the name of the item, and now its http://www.mysite.com/I-Like-Hamburgers (and perhaps many more times). I want all these URLs to remain pointing to Item 3. Is it efficient to simply keep a table of [strings,item_ids] and do a lookup on this? Is there a better way?
Is
for (var i=0, cols=columns.length; i<cols; i++) { ... }
more efficient than
for (var i=0; i<columns.length; i++) { ... }
?
In the second variant, is columns.length calculated each time the condition i<columns.length is checked ?
I'm trying to detect the browser's current size (width and height). I know it's super easy in jquery with $(document).width and $document.height, but I don't want to add the size of the jquery lib to the project, so I'd rather just use built in javascript. What would be the short and efficient way to do the same thing with javascript?
Hi, I'm importing a project into a svn repository using netbeans 6.8, and there's a whole subtree I don't want to import. Is there an efficient way to exclude it or will I just have to go file by file telling it to skip them ?
Thanks
Answer I need help with is:
Recall that paging is implemented by
breaking up an address into a page and
offset number. It is most efficient to
break the address into X page bits and
Y offset bits, rather than perform
arithmetic on the address to calculate
the page number and offset. Because
each bit position represents a power
of 2, splitting an address between
bits results in a page size that is a
power of 2.
i don't quite understand this answer, can anyone give a simpler explanation?
I need to calculate permutations iteratively. The method signature looks like:
int[][] permute(int n)
For n = 3 for example, the return value would be:
[[0,1,2],
[0,2,1],
[1,0,2],
[1,2,0],
[2,0,1],
[2,1,0]]
How would you go about doing this iteratively in the most efficient way possible? I can do this recursively, but I'm interested in seeing lots of alternate ways to doing it iteratively.
i wonder if the multi threading in python/ruby is equivalent to the one in java?
by that i mean, is it as efficient?
cause if you want to create a chat application that use comet technology i know that you have to use multi threading.
does this mean that i can use python or ruby for that or is it better with java?
thanks
We have following type of "Unique ID" column for many tables in the database (Oracle). It is a string with following format
<randomnumber>-<ascendingnumber>-<machinename>
So we have some thing like this
U1234-12345-NBBJD
U1234-12346-NBBJD
U1234-12347-NBBJD
U1234-12348-NBBJD
U1234-12349-NBBJD
The UID value is unique, we have unique index on them. Does the following format is more efficient than above for index scans?
NBBJD-U1234-12345
NBBJD-U1234-12346
NBBJD-U1234-12347
NBBJD-U1234-12348
NBBJD-U1234-12349
I want to remove hyphens (-), slashes (/) and white space () from a string name(i) so that I can use it as a structure field name.
This is the ugly way I am currently doing it using the function strrep:
cell2mat(strrep(strrep(strrep(name(i), '-',''),'/',''),' ', ''))
I have also tried other variations, such as:
strrep(name(i),{'-','/'},{'',''});
strrep(name(i),['-','/'],['','']);
What is a more efficient way of doing this?
Example array
$myArray[0] = array('23, null, 43, 12');
$myArray[1] = array('null, null, 53, 19');
$myArray[2] = array('12, 13, 14, null');
All nulls should be replaced with 0. I was hoping someone would have an efficient way of doing this, perhaps a built in PHP function that I am unaware of.
What data type should I use for data that can be very short, eg. html link (think twitter), or very long eg. html blog post (think wordpress).
I am thinking if I use varchar(4000), it maybe too short for a html formated blog entry? but if I use text, it will take up more space and is less efficient?
I'm programming a function for a ti-nspire, so I can't use the builtins from inside a function. what is the most generally efficient algorithm for sorting a list of numbers without modifying the list itself? (recursion and list-splitting are fair game, as is general use of math.)
What is the most efficient way to look up values in a BDB for several files in parallel? If I had a Perl script which did this for one file at a time, would forking/running the process in background with the ampersand in Linux work?
How might Hadoop be used to solve this problem?
Would threading be another solution?
Given a infinite stream of random 0's and 1's that is from a biased (e.g. 1's are more common than 0's by a know factor) but otherwise ideal random number generator, I want to convert it into a (shorter) infinite stream that is just as ideal but also unbiased.
Looking up the definition of entropy finds this graph showing how many bits of output I should, in theory, be able to get from each bit of input.
The question: Is there any practical way to actually implement a converter that is nearly ideally efficient?