Search Results

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

Page 162/203 | < Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >

  • Encode/compress sequence of repeating integers

    - by Alex
    Hey there! I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now I need some algorithm to convert this string into something compressed like a9b3a3c3a2d5 Which means "a 9 times, then b 3 times, then a 3 times" and so on, where "a" stands for 0, "b" for 1, "c" for 2 and "d" for 3. How would you do that? So far nothing suitable came to my mind, and I had no luck with google because I didn't really know what to search for. What is this kind of encoding / compression called? PS: I am going to do the encoding with PHP, and the decoding in JavaScript.

    Read the article

  • In Haskell, how can you sort a list of infinite lists of strings?

    - by HaskellNoob
    So basically, if I have a (finite or infinite) list of (finite or infinite) lists of strings, is it possible to sort the list by length first and then by lexicographic order, excluding duplicates? A sample input/output would be: Input: [["a", "b",...], ["a", "aa", "aaa"], ["b", "bb", "bbb",...], ...] Output: ["a", "b", "aa", "bb", "aaa", "bbb", ...] I know that the input list is not a valid haskell expression but suppose that there is an input like that. I tried using merge algorithm but it tends to hang on the inputs that I give it. Can somebody explain and show a decent sorting function that can do this? If there isn't any function like that, can you explain why? In case somebody didn't understand what I meant by the sorting order, I meant that shortest length strings are sorted first AND if one or more strings are of same length then they are sorted using < operator. Thanks!

    Read the article

  • PHP Code to Generate Simple Flowchart

    - by revbackup
    I am making a flowchart out the subjects in the curriculum of our school. a flowchart is generated through its preRequisite.... for example FIRST YEAR FIRST SEMESTER SUBJECTS ---- PREREQUISITE MATH 1 ---- NONE MATH 2 ---- NONE ENGL 1 ---- NONE SOCIO 1 ----- NONE POLSCI 1 ----- NONE FIRSTE YEAR SECOND SEMESTER SUBJECTS ---- PREREQUISITE MATH 3 ----- MATH 1 MATH 4 ----- MATH 2, MATH 1 ENGL 2 ----- ENGL 1 POLSCI 2 ----- POLSCI 1 So, I must print it this way, just using simple PHP but difficult Logic.: MATH1 -----> MATH3 -----> MATH4 MATH 2 ----->MATH 4 ENGL1 -----> ENGL 2 SOCIO 1 POLSCI 1 -----> POLSCI 2 Can anyone give me a good algorithm for this, because this is really difficult. I am planning to echo the results in an HTML table, and it makes it more complicated. Do you have suggestions how to solve this problem properly and display the results also properly???? Thank you in advance!

    Read the article

  • Document ranking strategy for P2P file sharing system.

    - by ablmf
    Recently, I got a task of building a P2P file sharing system. There is one requirement : the system should have a document ranking algorithm so that it could be used help users find more valuable files. Several strategy might be useful : force user to give a score to a file before it was downloaded The documents containing certain key words would get higher rank Manager could modify file ranking manually the more a file was downloaded, it would get a higher rank. Do you know any other strategy or methods that also appropriate? Or is there any real world example?

    Read the article

  • SQLAlchemy custom sorting algorithms when using SQL indexes

    - by David M
    Is it possible to write custom collation functions with indexes in SQLAlchemy? SQLite for example allows specifying the sorting function at a C level as sqlite3_create_collation(). An implementation of some of the Unicode collation algorithm has been provided by James Tauber here, which for example sorts all the "a"'s close together whether they have accents on them or not. Other examples of why this might be useful is for different alphabet orders (languages other than English) and sorting numeric values (sorting 10 after 9 rather than codepoint order.) Is this possible in SQLAlchemy? If not, is it supported by the pysqlite3 or MySQLdb modules, or for any other SQL database modules supported by python for that matter? Any information would be greatly appreciated.

    Read the article

  • Is there a sample set of web log data available for testing analysis against?

    - by Peter
    Sorry if this isn't strictly speaking a programming question, but I figure my best chance of success would be to ask here. I'm developing some web log file analysis algorithms, but to date I only have access to a fairly small amount of web log data to process. One algorithm I want to use makes some assumptions about 'the shape' of typical web log data, and so I'd like to test it against a larger 'exemplar' - perhaps the logs of a busy site with a good distribution of traffic from different sources etc. Is there a set of such data available somewhere? Thanks for any help.

    Read the article

  • GA written in Java

    - by EnderMB
    I am attempting to write a Genetic Algorithm based on techniques I had picked up from the book "AI Techniques for Game Programmers" that uses a binary encoding and fitness proportionate selection (also known as roulette wheel selection) on the genes of the population that are randomly generated within the program in a two-dimensional array. I recently came across a piece of pseudocode and have tried to implement it, but have come across some problems with the specifics of what I need to be doing. I've checked a number of books and some open-source code and am still struggling to progress. I understand that I have to get the sum of the total fitness of the population, pick a random number between the sum and zero, then if the number is greater than the parents to overwrite it, but I am struggling with the implementation of these ideas. Any help in the implementation of these ideas would be very much appreciated as my Java is rusty.

    Read the article

  • What first game did you program, and did it make you a better developer?

    - by thenonhacker
    What first game did you program? Name your game, the OS and language, and even a Website URL to get your game. Old DOS Games and Flash Games with ActionScript are allowed. Game kits are allowed, too. ...and did it make you a better developer? Programming games can be addicting, and it will bring out the best in us as we create our first game. What lessons did you learn form most? Algorithm and/or AI's? Graphics? User Interface? File Formats and Data Storage? Project and Time Management? Can you say that because you practiced programming by creating this game, you became more immersed with the programming language you used and helped you become a better developer?

    Read the article

  • how to compare/validate sql schema

    - by Ron Harlev
    I'm looking for a way to validate the SQL schema on a production DB after updating an application version. If the application does not match the DB schema version, there should be a way to warn the user and list the changes needed. Is there a tool or a framework (to use programatically) with built-in features to do that? Or is there some simple algorithm to run this comparison? Update: Red gate lists "from $395". Anything free? Or more foolproof than just keeping the version number?

    Read the article

  • Vectorizing sums of different diagonals in a matrix

    - by reve_etrange
    I want to vectorize the following MATLAB code. I think it must be simple but I'm finding it confusing nevertheless. r = some constant less than m or n [m,n] = size(C); S = zeros(m-r,n-r); for i=1:m-r for j=1:n-r S(i,j) = sum(diag(C(i:i+r-1,j:j+r-1))); end end The code calculates a table of scores, S, for a dynamic programming algorithm, from another score table, C. The diagonal summing is to generate scores for individual pieces of the data used to generate C, for all possible pieces (of size r). Thanks in advance for any answers! Sorry if this one should be obvious...

    Read the article

  • Memcache failover and consistent hashing

    - by Industrial
    Hi everyone, I am trying to work out a good way to handle offline/down memcached servers in my current web application that are built with PHP. I just found this link that shows an approach on how to do what I want, I think: http://cmunezero.com/2008/08/11/consistent-memcache-hashing-and-failover-with-php/ Anyhow, it gets me confused when I start working with it and reading the PHP documention about failover with memcache. Why is offline memcache servers added to the $realInstance server pool together with the online servers? Reading the memcache documentation confuses me even more: http://www.php.net/manual/en/memcache.addserver.php status Controls if the server should be flagged as online. Setting this parameter to FALSE and retry_interval to -1 allows a failed server to be kept in the pool so as not to affect the key distribution algorithm. Requests for this server will then failover or fail immediately depending on the memcache.allow_failover setting. Default to TRUE, meaning the server should be considered online. Thanks,

    Read the article

  • Qt QTextEdit Qt4.2 Valid HTML String

    - by Matthew Hoggan
    I am trying to generate the correct HTML to render to a QTextEdit Using Qt 4.2 on RHEL 5.3. So far my algorithm generates the following html. I am not an expert web developer, but to me this string seems valid. 319:14:27:22: <font color="rgb(255,0,0)" bgcolor="rgb(255,0,0)">Message</font><br> What needs to change to get the colours to render. Currently it just renders as black text on a white background.

    Read the article

  • What does 'salt' refer to in string-to-key (s2k) specifier?

    - by WilliamKF
    What does 'salt' refer to in string-to-key (s2k) specifier? It appears to be a random number generator to shake things up, but I would like to know what 'salt' stands for? For example it is written: 3.6.1.2. Salted S2K This includes a "salt" value in the S2K specifier -- some arbitrary data -- that gets hashed along with the passphrase string, to help prevent dictionary attacks. Octet 0: 0x01 Octet 1: hash algorithm Octets 2-9: 8-octet salt value Salted S2K is exactly like Simple S2K, except that the input to the hash function(s) consists of the 8 octets of salt from the S2K specifier, followed by the passphrase. But salt is not defined, although its meaning seems clear.

    Read the article

  • Simple string encryption in .NET and Javascript

    - by jonathanconway
    I'm developing an ASP.NET MVC application in which I want to encrypt a short string on the server, using C#, and send it to the client-side. Then on the client-side it will be decrypted through Javascript code. Any thoughts on how to implement this? Do you know of a simple encryption algorithm (doesn't have to be bullet-proof secure) that can be easily translated from C# to Javascript or vice-versa? NOTE: I could do this entirely in C# and do the decryption through Ajax, but I'd prefer not to do it this way, as I want to reduce website traffic as much as possible.

    Read the article

  • matlab fit exp2

    - by HelloWorld
    I'm unsuccessfully looking for documentation of fit function using exp2 (sum of 2 exponents). How to operate the function is clear: [curve, gof] = fit(x, y,'exp2'); But since there are multiple ways to fit a sum of exponents I'm trying to find out what algorithm is used. Particularly what happens when I'm fitting one exponent (the raw data) with a bit of noise, how the exponents are spread. I've simulated several cases, and it seems that it "drops" all the weight on the second set of coefficients, but row data analysis often shows different behavior. Does anyone have suggestions of documentation?

    Read the article

  • Counting viable sublist lengths from an array.

    - by Ben B.
    This is for a genetic algorithm fitness function, so it is important I can do this as efficiently as possible, as it will be repeated over and over. Lets say there is a function foo(int[] array) that returns true if the array is a "good" array and false if the array is a "bad" array. What makes it good or bad does not matter here. Given the full array [1,6,8,9,5,11,45,16,9], lets say that subarray [1,6,8] is a "good" array and [9,5,11,45] is a "good" array. Furthermore [5,11,45,16,9] is a "good" array, and also the longest "good" subarray. Notice that while [9,5,11,45] is a "good" array, and [5,11,45,16,9] is a "good" array, [9,5,11,45,16,9] is a "bad" array. We wants the length counts of all "good" arrays, but not subarrays of "good" arrays. Furthermore, as described above, a "good" array might begin in the middle of another "good" array, but the combination of the two might be a "bad" array.

    Read the article

  • pgp key information

    - by calccrypto
    can someone show a description of the information of what a pgp looks like if only the descriptions were there but not the actual information? something like (i dont remember if the values are correct): packet-type[4 bits], total length in bytes[16 bits], packet version type [4 bits], creation-time[32 bits], encryption-algorithm[8 bits], ...,etc,etc ive tried to understand rfc4880, but its tedious and confusing. so far, i am think i have extracted the 4 i wrote above, but i cant seem to get the rest of the information out. can anyone help? i know i can just find some pgp program, but the whole point of this is to allow me to learn how those programs work in the first place

    Read the article

  • Java text classification problem

    - by yox
    Hello, I have a set of Books objects, classs Book is defined as following : Class Book{ String title; ArrayList<tags> taglist; } Where title is the title of the book, example : Javascript for dummies. and taglist is a list of tags for our example : Javascript, jquery, "web dev", .. As I said a have a set of books talking about different things : IT, BIOLOGY, HISTORY, ... Each book has a title and a set of tags describing it.. I have to classify automaticaly those books into separated sets by topic, example : IT BOOKS : Java for dummies Javascript for dummies Learn flash in 30 days C++ programming HISTORY BOOKS : World wars America in 1960 Martin luther king's life BIOLOGY BOOKS : .... Do you guys know a classification algorithm/method to apply for that kind of problems ? A solution is to use an external API to define the category of the text, but the problem here is that books are in different languages : french, spanish, english ..

    Read the article

  • Prevent Method call without Exception using @PreAuthorize Annotation

    - by Chepech
    Hi all. We are using Spring Security 3. We have a custom implementation of PermissionEvaluator that has this complex algorithm to grant or deny access at method level on the application. To do that we add a @PreAuthorize annotation to the method we want to protect (obviously). Everything is fine on that. However the behavior that we are looking for is that if a hasPermission call is denied, the protected method call only needs to be skipped, instead we are getting a 403 error each time that happens. Any ideas how to prevent that? You can find a different explanation of the problem here; AccessDeniedException handling during methodSecurityInterception

    Read the article

  • how to pass an arbitrary signature to Certifcate

    - by eskoba
    I am trying to sign certificate (X509) using secret sharing. that is shareholders combine their signatures to produce the final signature. which will be in this case the signed certificate. however practically from my understanding only one entity can sign a certificate. therefore I want to know: which entities or data of the x509certificate are actually taken as input to the signing algorithm? ideally I want this data to be signed by the shareholders and then the final combination will be passed to the X509certificate as valid signature. is this possible? how could it done? if not are they other alternatives?

    Read the article

  • C++ assignment question [closed]

    - by Adam Joof
    (Bubble Sort) In the bubble sort algorithm, smaller values gradually "bubble" their way upward to the top of the array like air bubbles rising in water, while the larger values sink to the bottom. The bubble sort makes several passes through the array. On each pass, successive pairs of elements are compared. If a pair is in increasing order (or the values are identical), we leave the values as they are. If a pair is in decreasing order, their values are swapped in the array. Write a program that sorts an array of 10 integers using bubble sort.

    Read the article

  • Python ValueError: not allowed to raise maximum limit

    - by Ricky Bobby
    I'm using python 2.7.2 on mac os 10.7.3 I'm doing a recursive algorithm in python with more than 50 000 recursion levels. I tried to increase the maximum recursion level to 1 000 000 but my python shell still exit after 18 000 recursion levels. I tried to increase the resources available : import resource resource.setrlimit(resource.RLIMIT_STACK, (2**29,-1)) sys.setrecursionlimit(10**6) and I get this error : Traceback (most recent call last): File "<pyshell#58>", line 1, in <module> resource.setrlimit(resource.RLIMIT_STACK,(2**29,-1)) ValueError: not allowed to raise maximum limit I don't know why I cannot raise the maximum limit ? thanks for your suggestions .

    Read the article

  • Clojure: Avoiding stack overflow in Sieve of Erathosthene?

    - by nixx
    Here's my implementation of Sieve of Erathosthene in Clojure (based on SICP lesson on streams): (defn nats-from [n] (iterate inc n)) (defn divide? [p q] (zero? (rem q p))) (defn sieve [stream] (lazy-seq (cons (first stream) (sieve (remove #(divide? (first stream) %) (rest stream)))))) (def primes (sieve (nats-from 2))) Now, it's all OK when i take first 100 primes: (take 100 primes) But, if i try to take first 1000 primes, program breaks because of stack overflow. I'm wondering if is it possible to change somehow function sieve to become tail-recursive and, still, to preserve "streamnes" of algorithm? Any help???

    Read the article

  • 50 sequences in one line

    - by user343934
    I have Muttiple sequence alignment (clustal) file and i want to read this file and arrange sequences in a such a way that in looks more clear and precise in order. I am doing this from biopython using AlignIO object. My codes like this alignment = AlignIO.read("opuntia.aln", "clustal") print "Number of rows: %i" % len(align) for record in alignment: print "%s - %s" % (record.id, record.seq) My Output-- http://i48.tinypic.com/ae48ew.jpg , it looks messy and long scrolling. What i want to do is print only 50 sequences in each line and continue till the end of alignment file. I wish to have output like this---http://i45.tinypic.com/4vh5rc.jpg from --http://www.ebi.ac.uk/Tools/clustalw2/, sorry two links are just a text due to my reputation. Any suggestions, algorithm and sample code is appreciated Thanks in advance Br,

    Read the article

  • SQL Encryption - Asymmetric Key - 2nd Server

    - by Jason Heine
    Hello, I created an asymmetric key on one of my SQL servers (2008). I encrypted a password field and I am able to retrieve that password just fine on my development server. The issue comes into play where I need to move this data to a production server. Here is the code for the key that was created: CREATE MASTER KEY ENCRYPTION BY PASSWORD='#########' CREATE ASYMMETRIC KEY UserEncryptionKey WITH ALGORITHM = RSA_2048 Now, when I run this on the production server, it creates the key just fine. However, when I run my sproc to get the password, it returns NULL. SQL: SELECT EncryptByAsymKey(AsymKey_ID('UserEncryptionKey'), Password ) FROM Users WHERE UserName = '######' Any thoughts on what I need to do to get the encrypted field to work on multiple SQL Servers? Please let me know if I need to clarify something. Thanks

    Read the article

< Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >