Search Results

Search found 5070 results on 203 pages for 'algorithm'.

Page 170/203 | < Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >

  • Overhead of serving pages - JSPs vs. PHP vs. ASPXs vs. C

    - by John Shedletsky
    I am interested in writing my own internet ad server. I want to serve billions of impressions with as little hardware possible. Which server-side technologies are best suited for this task? I am asking about the relative overhead of serving my ad pages as either pages rendered by PHP, or Java, or .net, or coding Http responses directly in C and writing some multi-socket IO monster to serve requests (I assume this one wins, but if my assumption is wrong, that would actually be most interesting). Obviously all the most efficient optimizations are done at the algorithm level, but I figure there has got to be some speed differences at the end of the day that makes one method of serving ads better than another. How much overhead does something like apache or IIS introduce? There's got to be a ton of extra junk in there I don't need. At some point I guess this is more a question of which platform/language combo is best suited - please excuse the in-adroitly posed question, hopefully you understand what I am trying to get at.

    Read the article

  • Use C function in C++ program; "multiply-defined" error

    - by eom
    I am trying to use this code for the Porter stemming algorithm in a C++ program I've already written. I followed the instructions near the end of the file for using the code as a separate module. I created a file, stem.c, that ends after the definition and has extern int stem(char * p, int i, int j) ... It worked fine in Xcode but it does not work for me on Unix with gcc 4.1.1--strange because usually I have no problem moving between the two. I get the error ld: fatal: symbol `stem(char*, int, int)' is multiply-defined: (file /var/tmp//ccrWWlnb.o type=FUNC; file /var/tmp//cc6rUXka.o type=FUNC); ld: fatal: File processing errors. No output written to cluster I've looked online and it seems like there are many things I could have wrong, but I'm not sure what combination of a header file, extern "C", etc. would work.

    Read the article

  • How can you stream results as json string downloads?

    - by midas06
    I'm interested in presenting results faster in my mobile app. Is it possible to stream results out as the string downloads? I'm thinking about implementing an IObservable to push out the results as they are downloaded, but I don't know what algorithm to use to properly piece together the data which could be incomplete at any given point. Hope that was clear enough. CLARIFICATION: Guess it wasn't clear enough. My issue is the string downloaded is quite long. It can often take 15-20 seconds or more to download. I want to reflect changes faster to my user, so I would like to use reactive extensions to pump out entities as soon as a complete one is received. My issue is I dont know how to build the parser that can pick out complete entities from an incomplete response string.

    Read the article

  • Most optimal way to detect if black (or any color pixels) exist in an image file?

    - by Zando
    What's the best and most flexible algorithm to detect any black (or colored pixel) in a given image file? Say I'm given an image file that could, say, have a blue background. And any non blue pixel, including a white pixel, is counted as a "mark". The function returns true if there are X number of pixels that deviate from each other at a certain threshold. I thought it'd be fastest to just simply iterate through every pixel and see if its color matches the last. But if it's the case that pixel (0,0) is deviant, and every other pixel is the same color (and I want to allow at least a couple deviated pixels before considering an image to be "marked), this won't work or be terribly efficient.

    Read the article

  • What's the fastest way to search a very long list of words for a match in actionscript 3?

    - by Nuthman
    So I have a list of words (the entire English dictionary). For a word matching game, when a player moves a piece I need to check the entire dictionary to see if the the word that the player made exists in the dictionary. I need to do this as quickly as possible. simply iterating through the dictionary is way too slow. What is the quickest algorithm in AS3 to search a long list like this for a match, and what datatype should I use? (ie array, object, Dictionary etc)

    Read the article

  • Will a source-removal sort always return a maximal cycle?

    - by Jason Baker
    I wrote a source-removal algorithm to sort some dependencies between tables in our database, and it turns out we have a cycle. For simplicity, let's say we have tables A, B, C, and D. The edges are like this: (A, B) (B, A) (B, C) (C, D) (D, A) As you can see, there are two cycles here. One is between A and B and another is between all four of them. Will this type of sort always choke on the largest cycle? Or is that not necessarily the case?

    Read the article

  • how to get the value of checksum in php header

    - by sumit
    I have a header in php which contains a link like <?php header("Location: "."https://abc.com/ppp/purchase.do?version=3.0&". "merchant_id=<23255>&merchant_site_id<21312>&total_amount=<69.99>&". "currency=<USD>&item_name_1=<incidentsupporttier1>&item_amount_1=<1>&". "time_stamp=<2010-06-14.14:34:33>&**checksum=<calculated_checksum>**"); ?> when i run this page the value of checksum is calculated and the link is opened now how checksum is calculated? calculated_checksum=md5(abc); md5 is an algorithm which calculates the value of checksum based on certain values inside the bracket. now i want to know how can i pass the value of checksum in the header url

    Read the article

  • How to check that a regular expression fall into infty loop or not?

    - by Sorush Rabiee
    I'm trying to learn and hopefully use regular expression with Qt. I found that some patterns cause handler to fall into loop. for example searching \b\b in a text, never will terminate. and number of these expressions is infinite (\b\b\b,\b\b\b\b and so on). I'd like to determine and control all invalid expressions. Is there an algorithm to distinguish valid and invalid expressions? If not, how can I prevent my program from falling into an infinite loop?

    Read the article

  • Project Euler: problem 8

    - by Marijus
    n = # some ridiculously large number, omitted N = [int(i) for i in str(n)] maxProduct = 0 for i in range(0,len(N)-4): newProduct = 1 is_cons = 0 for j in range(i,i+4): if N[j] == N[j+1] - 1: is_cons += 1 if is_cons == 5: for j in range(i,i+5): newProduct *= N[j] if newProduct > maxProduct: maxProduct = newProduct print maxProduct I've been working on this problem for hours now and I can't get this to work. I've tried doing this algorithm on paper and it works just fine.. Could you give me hints what's wrong ?

    Read the article

  • 16 millisecond quantization when sending/receivingtcp packets

    - by MKZ
    Hi, I have a C++ application running on windows xp 32 system sending and receiving short tcp/ip packets. Measuring (accurately) the arrival time I see a quantization of the arrival time to 16 millisecond time units. (Meaning all packets arriving are at (16 )xN milliseconds separated from each other) To avoid packet aggregation I tried to disable the NAGLE algorithm by setting the IPPROTO_TCP option to TCP_NODELAY in the socket variables but it did not help I suspect that the problem is related to the windows schedular which also have a 16 millisecond clock.. Any idea of a solution to this problem ? Thanks

    Read the article

  • Returning a list in this recursive coi function in python.

    - by Nate
    Hello. I'm having trouble getting my list to return in my code. Instead of returning the list, it keeps returning None, but if I replace the return with print in the elif statement, it prints the list just fine. How can I repair this? def makeChange2(amount, coinDenomination, listofcoins = None): #makes a list of coins from an amount given by using a greedy algorithm coinDenomination.sort() #reverse the list to make the largest position 0 at all times coinDenomination.reverse() #assigns list if listofcoins is None: listofcoins = [] if amount >= coinDenomination[0]: listofcoins = listofcoins + [coinDenomination[0]] makeChange2((amount - coinDenomination[0]), coinDenomination, listofcoins) elif amount == 0: return listofcoins else: makeChange2(amount, coinDenomination[1:], listofcoins)

    Read the article

  • Best way to search a point across several polygons

    - by user1474341
    I have a requirement whereby I need to match a given point (lat,lon) against several polygons to decide if there is a match. The easiest way would be to iterative over each polygon and apply the point-in-polygon check algorithm, but that is prohibitively expensive. The next optimization that I did was to define a bounding rectangle for each polygon (upper bound, lower bound) and iteratively check the point against the bounding box (fewer comparisons as against checking all the points in the polygon). Is there any other optimization possible? Would a spatial index on the bound rectangle points or a geohash help ? Any guidance would be greatly appreciated. Thanks!

    Read the article

  • How to stop a MFC/win32 control re-painting

    - by John
    I have a CRichEditCtrl, and an algorithm works on its contents in-place, iterating through the contents and making changes. This seems to cause it to re-paaint every time, which causes flickering and a noticeable time to complete the operation, especially if the control starts scrolling. I wondered if there's a neat way for me to stop it repainting for a period. It's actually a custom subclass of CRichEditCtrl in use so I was thinking something like: void MyCustomEditCtrl::DoAlgorithm() { enableRepaint(false); ... //to the actual work ... enableRepaint(true); } What's the neatest approach? A custom on-paint handler which does nothing when an operation is in progress? Or can repainting actually be disabled?

    Read the article

  • how to specify a pointer to an overloaded function?

    - by davka
    I want to pass an overloaded function to the std::for_each() algorithm. e.g.: void f(char c); void f(int i); std::string s("example"); std::for_each(s.begin(), s.end(), f); I'd expect the compiler to resolve f() by the iterator type. Apparently, it (gcc 4.1.2) doesn't do it. So, how can I specify which f() I want? thanks a lot

    Read the article

  • how to create english language dictionary application with python (django)?

    - by sintaloo
    Hi All, I would like to create an online dictionary application by using python (or with django). It will be similar to http://dictionary.reference.com/. My question is (1) Are there any existing open source python package or modules or application which implements this functionality that I can use or study from? (2) If the answer to the first question is NO. which algorithm should I follow to create such web application? Can I simply use the python built-in dictionary object for this job? so that the dictionary object's key will be the english word and the value will be the explanation. is this OK in term of performance? OR Do I have to create my own Tree Object to speed up the search? or any existing package which handles this job properly? Thank you very much.

    Read the article

  • Server Side code Pushing Data to client Browser while current thread is busy Comet (programming)

    - by h_power11
    Hello Friends, I am writing one simple web page with bunch of textboxes and a button control. Now when user finished editing the values on this text boxes user has to click the button and this button invoke heavily process intensive algorithm on server side code based on the data received from client (Textboxes) And it could some time takes up to 30 to 45 minutes to complete the whole operation so the current thread is still inside the button click event handler function. That background task only provides one event, and the web page subscribes to it to get some text data after each stage of processing I was wandering if there is any way I can keep user up-to-date with what is the current progress on that background task. I have div element to print the current status information So I am looking for some sort of reverse mechanism then "get" and "post". I have read some articles on the Comet (programming) but I can't find any easy or definitive answer Thanks in advance

    Read the article

  • can a program written in C be faster than one written in OCaml and translated to C?

    - by Ole Jak
    So I have some cool Image Processing algorithm. I have written it in OCaml. It performs well. I now I can compile it as C code with such command ocamlc -output-obj -o foo.c foo.ml (I have a situation where I am not alowed to use OCaml compiler to bild my programm for my arcetecture, I can use only specialy modified gcc. so I will compile that programm with sometyhing like gcc -L/usr/lib/ocaml foo.c -lcamlrun -lm -lncurses and Itll run on my archetecture.) I want to know in general case can a program written in C be faster than one written in OCaml and translated to C?

    Read the article

  • Modify an MP3 slightly to change the data appearence

    - by Léon Pelletier
    I'm thinking about encrypting MP3s in a database, so that when user is downloading them with his software desktop player, only the software can decrypt them. This part is not a problem. The problem is I don't want a user to upload an mp3 to the database, then check which changes have been made to the file so he can reverse-engineer the file or at least see which algorithm is used to encrypt the files. So, user uploads MP3-A, then it becomes MP3-B because it has been modified, and I encrypt it to MP3-C. And when decrypted, it sounds 99.99% like MP3-A. I know MP3 format is lossy, but I wonder if there's a way to convert audio with limited loss, or if I need to forget it right now.

    Read the article

  • strategy to allocate/free lots of small objects

    - by aaa
    hello I am toying with certain caching algorithm, which is challenging somewhat. Basically, it needs to allocate lots of small objects (double arrays, < 256 elements), with objects accessible through mapped value, map[key] = array. time to initialized array may be quite large, generally more than 10 thousand cpu cycles. By lots I mean around gigabyte in total. objects may need to be popped/pushed as needed, generally in random places, one object at a time. lifetime of an object is generally long, minutes or more, however, object may be subject to allocation/deallocation several times during duration of program. What would be good strategy to avoid memory fragmentation, while still maintaining reasonable allocate deallocate speed? I am using C++, so I can use new and malloc. Thanks. I know there a similar questions on website, http://stackoverflow.com/questions/2156745/efficiently-allocating-many-short-lived-small-objects, are somewhat different, thread safety is not immediate issue for me.

    Read the article

  • DLL Load Failed: %1 is not a valid win32 application

    - by glittershark
    So I have a situation where I need to make binary patches and then be able to apply them from within python. I found bsdiff which looks like a great algorithm and has a python extension module, but that extension module doesn't have a windows installer past Python 2.5 Alright, so having never even written C seriously, let alone attempted a python extension module, I set out to compile it myself. After a few hours of bashing my head against a DLL load error with MinGW32, I managed to get it compiled and built using the setup.py provided in the source of the project. However, upon importing the resulting bsdiff module, I get: ImportError: DLL load failed: %1 is not a valid Win32 application. Any advice?

    Read the article

  • How to stable_sort without copying?

    - by Mehrdad
    Why does stable_sort need a copy constructor? (swap should suffice, right?) Or rather, how do I stable_sort a range without copying any elements? #include <algorithm> class Person { Person(Person const &); // Disable copying public: Person() : age(0) { } int age; void swap(Person &other) { using std::swap; swap(this->age, other.age); } friend void swap(Person &a, Person &b) { a.swap(b); } bool operator <(Person const &other) const { return this->age < other.age; } }; int main() { static size_t const n = 10; Person people[n]; std::stable_sort(people, people + n); }

    Read the article

  • Optimal diff between object lists in Java

    - by Philipp
    I have a List of Java objects on my server which is sent to the client through some serialization mechanism. Once in a while the List of objects gets updated on the server, that is, some objects get added, some get deleted and others just change their place in the List. I want to update the List on the client side as well, but send the least possible data. Especially, I don't want to resend Objects which are already available on the client. Is there a library available which will produce some sort of diff from the two lists, so that I can only send the difference and the new Objects accross the wire? I have found several Java implementation of the unix diff command, but this algorithm is unpractical for order changes. ie. [A,B,C] - [C,B,A] could be sent as only place changes [1-3] [3-1], while diff will want to resend the whole A and C objects (as far as I understand).

    Read the article

  • Customizing compare in bsearch()

    - by Richard Smith
    I have an array of addresses that point to integers ( these integers are sorted in ascending order). They have duplicate values. Ex: 1, 2, 2, 3, 3, 3, 3, 4, 4...... I am trying to get hold of all the values that are greater than a certain value(key). Currently trying to implement it using binary search algo - void *bsearch( const void *key, const void *base, size_t num, size_t width, int ( __cdecl *compare ) ( const void *, const void *) ); I am not able to achieve this completely, but for some of them. Would there be any other way to get hold of all the values of the array, with out changing the algorithm I am using?

    Read the article

  • database encryption questions

    - by 5YrsLaterDBA
    We are using Sybase SQL Anywhere 11. We need to encrypt some of our tables in our database. I followed the instruction and did it. We selected the "strong" option with encryptionKey and AES256_FIPS algorithm. But there are something I am not clear about them. It will require encryptonKey when we create the database, remove the database and start the database server but it will NOT require encryptionKey when we stop the database server and connect to the server to create tables and add data. Why there is NO encryptionKey asked when we connect to it or try to stop the server? I am doing something wrong? don't know how to test the encryption? I still can see all plain text in the encrypted tables when I use Sybase Central tool. If somebody knows the database user name and password, he/she can connect to the database and read the content without the encryptionKey. is this right?

    Read the article

  • deleting and reusing a temp table in a stored precedures

    - by Sheagorath
    Hi I need to SELECT INTO a temp table multiple times with a loop but I just can't do it, because after the table created( in SELECT into you can't simply drop the table at the end of the loop because you can't delete a table and create it again in the same batch. so how can I delete a table in a stored procedure and create it again? here is a snippet of where I am actualy using the temp table which is supposed to be a pivoting algorithm: WHILE @offset<@NumDays BEGIN SELECT bg.*, j.ID, j.time, j.Status INTO #TEMP1 FROM #TEMP2 AS bg left outer join PersonSchedule j on bg.PersonID = j.PersonID and bg.TimeSlotDateTime = j.TimeSlotDateTime and j.TimeSlotDateTime = @StartDate + @offset DROP TABLE #TEMP2; SELECT * INTO #TEMP2 FROM #TEMP1 DROP TABLE #TEMP1 SET @offset = @offset + 1 END

    Read the article

< Previous Page | 166 167 168 169 170 171 172 173 174 175 176 177  | Next Page >