|
I'm trying to put together a text comparison tool, that will compare two strings (more than likely containing largish volumes of fulltext), and show the different, something like Wikipedia's diff functionality. Doing a simple character-by-character comparison will not work, because the first "new" character in a string will push all the others forward, causing almost everything after that point to be highlighted. Tokenising the string seems to be the way forward, but I can't work out a good way of comparing that doesn't "match" completely unrelated words later on in the text. Is there an accepted way of doing this, or am I going to need to invent some new kind of wheel?
|
# ¿ Mar 31, 2008 08:37 |
|
|
# ¿ May 7, 2024 23:43 |
|
I'm looking at implementing my own RSS feed generator, which will work off of a series of existing tables in my database. I had planned to simply write a PHP script that output the required XML straight to the client, but most of the tutorials that I've seen on the web do it by generating a flat text file at a regular interval and having that serve as the feed. I had hoped to be able to do customisable feeds (ie: so the user can filter out particular contributors or topics and get a feed containing only that), but if I'm to generate flat files that will mean I'll need to do hundreds of them to cover every possibility. Is there some compelling reason why I can't just take a querystring (rewritten with mod_rewrite, of course) and spit the output directly to the user based upon the input parameters?
|
# ¿ Jun 2, 2008 05:40 |
|
clockworkjoe posted:Can someone confirm the site looks okay in firefox 3 beta? Don't know about Firefox, but looks okay in Opera 9.27: http://www.halo-17.net/iomha/upload/080602_2_raillery.png
|
# ¿ Jun 2, 2008 07:45 |
|
fletcher posted:You will probably want to implement some sort of cache so you can store the messages in memory rather than querying the DB for each message every time you use it. In the past, I've created files that contain translation tables for each text element that I want translated: php:<? // /languages/en.php $lang->login = "Login"; $lang->logout = "Logout"; $lang->welcome = "Welcome"; // ... // /languages/ga.php $lang->login = "Logáil isteach"; $lang->logout = "Logáil amach"; $lang->welcome = "Fáilte!"; ?> php:<? // default language require_once("languages/en.php"); // user preference language require_once("languages/$userprefs->lang.php"); ?> I've never done this for a site with more than a couple of dozen text elements though, and it's probably horribly inefficient for a site that has thousands of them.
|
# ¿ Jun 5, 2008 11:43 |
|
drcru posted:So I'm trying to implement Dijkstra's algorithm for a side project I'm working on but I'm having difficulty grasping how the whole thing works... I've done this before but I don't have the code in front of me, so bear with me. But yes, I made the "sectors" or "room" the vertices and then had a separate table that acted as vertices/paths. The main drawback with my method was that one had to have the entire graph in memory, which was a bit of a downer when you only wanted to go across to the next node. If you haven't got working code, this might help: http://en.giswiki.net/wiki/Dijkstra's_algorithm
|
# ¿ Jul 13, 2008 14:38 |
|
What is the current cool framework to use for PHP? At the moment I'm playing with CodeIgniter, but I'm happy to jump ship if there's something better out there.
|
# ¿ Nov 21, 2008 11:55 |
|
Anveo posted:If you are going to look into it, you will probably want to start with version 1.2. I've just had a quick look through the docs, and it actually looks fairly good. I'll have a bit of a play with this, thanks for the tip!
|
# ¿ Nov 26, 2008 13:14 |
|
MrMoo posted:Does anyone bother altering HTTP status codes for errors? Taking R1CH's upload script for example: Yes, I use some obscure status codes (402 and 405, for instance) for things like malformed requests or unsupported requests. Perhaps not so useful for screenscrapers (who are the only ones who usually do these things), but useful for log tracking to see what bots are getting up to.
|
# ¿ Nov 28, 2008 06:01 |
|
I've got some strings that need to be inserted into the database via an UPDATE command. However, the strings may or may not already be escaped (don't ask). For instance, I might have "don't go not don't" or "don/'t go not don/'t" passed to my module. Is there any reliable way to make sure that apostrophes have only one slash, and are not double-slashed like in this thread title?
|
# ¿ Feb 1, 2009 13:41 |
|
|
# ¿ May 7, 2024 23:43 |
|
Supervillin posted:Yep, do this to whatever your input variable is before you escape stuff yourself: Great, this looks like exactly what I'm after. Thanks!
|
# ¿ Feb 4, 2009 13:22 |