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.
I am trying to find a frequency of each symbol in any given text using an algorithm of O(n) complexity. My algorithm looks like:
s = len(text)
P = 1.0/s
freqs = {}
for char in text:
try:
freqs[char]+=P
except:
freqs[char]=P
but I doubt that this dictionary-method is fast enough, because it depends on the underlying implementation of the dictionary methods. Is this the fastest method?
Hi,
Why does the Javascript function call isNaN(123.) return false? Is this a universally acceptable number or will it cause errors downstream?
I'm validating whether a value is a valid decimal using isNaN along with split. Are there cross-browser issues with isNaN? Should I use a bespoke implementation?
Thanks.
I'm designing a web application.
I was wondering if it was feasible to design a php front end (using some php framework e.g. CakePHP), which stores and retrieves data to display to the user.
Then develop a java backend which listens to the database for changes, and depending on what was changed, performs some actions and updates the database.
Any thoughts on this type of implementation would be appreciated.
HI,
I'm new to iphone programming and developing travel application, which retrieve most of it data from remote database.
What is the best way to implement this solution? I thought of generating XML files in server side and getting data via XML files to iPhone app and displaying them...
Is there better implementation to this, thank you in advance?
Waruna.
i have an object which is instantiated in an initialize file, which is called with every request. the name is right, so why is it telling me that oourls isn't an object and that redirectLoggedIn isn't its method? a var dump on oourls says NULL. but it's instantiated, and the backtrace at the bottom shows that it goes through initialization and instantiates it. pretty small snippet of code, here's the relevant bit:
if($email) {
global $session;
$session->grantLogin($email);
global $oourls;
$oourls->redirectLoggedIn();
} else {
return false;
}
and here's the output of debug_print_backtrace i threw in above the oourls method call because i'm completely confused:
#0 accounts::verifyEmailRegisterAccount(37a6274c8f4bfa5c537b40e8e04d634a) called at [\public\includes\default\verifyemail.php:16]
#1 require_once(\public\includes\default\verifyemail.php) called at [\support\php\ObjectOrientedURLs.class.php:48]
#2 ObjectOrientedURLs->mhqqrVerifyemail(Array ([0] => 37a6274c8f4bfa5c537b40e8e04d634a))
#3 ReflectionMethod->invoke(ObjectOrientedURLs Object (), Array ([0] => 37a6274c8f4bfa5c537b40e8e04d634a)) called at [\support\php\ObjectOrientedURLs.class.php:280]
#4 ObjectOrientedURLs->parseAndInvokeURL() called at [\support\php\ObjectOrientedURLs.class.php:255]
#5 ObjectOrientedURLs->__construct() called at [\support\php\initialize.php:76]
#6 require_once(\support\php\initialize.php) called at [\public\index.php:2]
I'm new to C# three tier implement and I've found a lot of implementations in Internet. I don't know what difference and benefit from its .
Thanks a lot for reading this and I'm waiting for your answers. And I really want to know your implementation :)
I am using Lucene MultiFieldQueryParser and the implementation is as shown below
QueryParser parser = new MultiFieldQueryParser (Version.LUCENE_30,new String[] {"First Name","Middle Name","Last Name"}, standardAnalyzer); Query query = parser.parse(queryString);
and using it to find a match for the input string in my DB columns First Name, Middle Name and Last name .
I am able to get the hits with normal search and fuzzy search - The only problem I am facing is finding which column of the three generated the hit - Can you pls help me here - Thanks
I have to write 300+ files to a server share on a hourly basis. A quick implementation using CreateText takes approximately 1.4 seconds per file. I know there is a better way to do this, but I am unsure which way is actually the quickest/most efficient; hence my question:
Which text writing class is the most efficient for writing hundreds of small files ( 336 bytes on average ) to a server share?
I just wonder is there's any way to fire any event via IE's event-triggering implementation - fireEvent. I've tried to use it but failed with all event except click.
The only reason i've get interested with this issue it curiousity, thus, any answers like "just do not trigger events, it is a bad idea" - all such answers would be considered, well...not full)))
thanks in advance
I've been told a few times that Business Units in CRM 2011 are "tricky" and shouldn't be set up lightly since they have irreversible consequences for a CRM 2011 implementation.
On the other hand, teams in CRM 2011 seem much more flexible in managing record security.
For what reason would I still choose to set up Business Units in CRM 2011? What can I do with Business Units that I can't with Teams (and vice versa)?
Anyone knows how to implement XXTEA in MySQL?
For example - SELECT xxtea_encrypt('text here', 'key here');
possible implementation is by creating a FUNCTION in MySQL using CREATE FUNCTION statement, e.g.
CREATE FUNCTION xxtea_encrypt
XXTEA Procedures here...
RETURN encrypted string
Thanks & Best regards
I've had a big problem in some library code, which I've pinned down to a single statement:
System.out.println((String) null);
Ok, the code doesn't actually look like that, but it certainly calls println with a null argument. Doing this causes my whole applicaio to throw an unexpected NullPointerException.
In general, should println throw this exception under that circumstance, or is this non-standard behavior due to a poor implementation of the out instance?
I'm designing a web application.
I was wondering if it was feasible to design a php front end (using some php framework e.g. CakePHP), which stores and retrieves data to display to the user.
Then develop a java backend which listens to the database for changes, and depending on what was changed, performs some actions and updates the database.
Any thoughts on this type of implementation would be appreciated.
I'm trying to load an image to a div background using the following file structure in the root.
WebContent --
|
zharaimages --
|
[ItemID] --
|
Image.jpg
This is done by jQuery and the file structure is inside the root. The ItemID folder is dynamic and I have to check whether the path exists using jQuery and if the path is not valid, I should go to a default path to fetch the default image. How can I check the path is valid using jQuery. I'm hoping to this can be done without an ajax call.
Can any one help me on a tutorial or an API I can use for this!
UPDATE
The files are on the server. The concept I have is that I have 100s of item elements & I want to load an image for each item element. The images are saved in the server ( a local host ) and the folder hierarchy is divided using the item ID as shown. What I want to do is check whether the image file exists before appending it to the background of the item element div. Is this possible. This is a web application developed using spring.
I have done strace on my multi-threaded c++ application running on linux
after couple hours of running, none of the threads got run, for about 12 seconds.
I have seen that the unfinished select system call which is called with a timeout was unfinished before the thread was suspended, reported after it resumed that, it took 11.x seconds for the operation to finish.
This is clear indication that the process got starved for a long time.
All threads in the process are created with default scheduling policy(SCHED_OTHER) of linux and default priority.
There are another 5 similar apps running on the same box which are also heavy I/O bound like this app due to heavy data received on the socket. But most of the time, this app is getting scheduled delay. The other apps are created with same sched policy and priority as this i.e. the defaults. why is only this process gets blocked almost all of the time?
Could it be because this process is more I/O intensive as in more busy due to may be higher rates of data? So, the linux dynamic priority adjusting in play here which pushed this process down?
I'm setting up my website and want to have it so all subdomain requests are rewritten to the appropriate subdirectory. For example
http://projects.karimsa.net/ -> http://karimsa.net/projects/
But I want to use the Apache rewrite mod to do this so that the URL in the browser stays the same. Here is what my config looks like at the moment:
## rewrite subdomains
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*).karimsa.net
RewriteCond %{HTTP_HOST} !^www.karimsa.net [NC]
RewriteRule ^(.*)$ http://karimsa.net/%1/$1 [R=301,L]
And my CNAME records on 'projects.karimsa.net':
Domain TTL Data Type
projects.karimsa.net 14400 karimsa.net CNAME
Theoretically, I feel this should work. But when I go to the URL, it gives me a server misconfiguration error, my provider's default webpage. What I should see is the index.php under /projects/.
What am I doing wrong? Any help would be appreciated, thanks for reading.
Addition:
I realized I forgot to mention some of the problem. The domain 'karimsa.net' is parked at 'karimsa.x10.mx'. If I set up the same configuration on 'projects.karimsa.x10.mx', the rewrite and CNAME work. But on the parked domain I still get the default webpage.
Does anyone know of an existing Java component that implements a TokenField, similar to Cocoa's NSTokenField?
An overview of the Cocoa control is at:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TokenField%5FGuide/Introduction/Introduction.html
Suggestions for implementation?
Thanks!
Often, it is more efficient to use a sorted std::vector instead of a std::set. Does anyone know a library class sorted_vector, which basically has a similar interface to std::set, but inserts elements into the sorted vector (so that there are no duplicates), uses binary search to find elements, etc.?
I know it's not hard to write, but probably better not to waste time and use an existing implementation anyway.
If I have a class that contains a std::list<Foo>, how can I implement iterators to a Foo* collection, preferably without using boost?
I'd rather not maintain a parallel collection of pointers. For now I have std::list<Foo>, mostly so that removing or inserting an element does not invalidate all other iterators, but would it be possible to implement other iterators too, so that the collection type used in the implementation is opaque to the user of the class?
Our existing compile-time assert implementation is based on negative array index, and it provides poor diagnostic output on GCC. C++0x's static_assert is a very nice feature, and the diagnostic output it provides is much better. I know GCC has already implemented some C++0x features. Does anyone know if static_assert is among them and if it is then since what GCC version?
Hello,
I would like to know and get an implementation help, if possible,
about the best way to transfer very large amount to pure text from C
to Java using JNI.
thank you
I have a div element which contains UL and UL contains the LI items. One of the LI item has an ID of stocknumber. I need to select that li.
Here is my code which works fine I am just looking for a better implementation.
$(".block").children("ul").children("#stocknumber") // gets me the li and it works!!
JAXB treets empty int XML attribute as 0, which is fine with me, but I've got requirement to store it as a null. Seems I can't change DataConverterImpl class to custom implementation. What could be done if at all?
Hi, I'm looking for an algorithm that given two permutations of a sequence (e.g. [2, 3, 1, 4] and [4, 1, 3, 2]) calculates the cycles that are needed to convert the first into the second (for the example, [[0, 3], [1, 2]]).
The link from mathworld says that Mathematica's ToCycle function does that, but sadly I don't have any Mathematica license at hand... I'd gladly receive any pointer to an implementation of the algorithm in any FOSS language or mathematics package.
Thanks!