SkulkrinBait
Morkin Admin
Haxx0rs == Suxx0rs! v4
Posts: 6,680
|
Post by SkulkrinBait on Sept 1, 2005 5:58:46 GMT
I'll do it when I get time, could someone post an example of what type of data it needs to process as I'm not certain what you are on about!
|
|
Freiegeister
Morkin Member
'Blasphemy is a victimless crime' - Dawkins
Posts: 1,126
|
Post by Freiegeister on Sept 1, 2005 6:17:01 GMT
I'll do it when I get time, could someone post an example of what type of data it needs to process as I'm not certain what you are on about! I was thinking of writing it myself, but I'm happy to collaborate. Member details: Alliance Member List: Ranking Lists: It would need to parse the whole page to get the date from the top so you don't have to type anything manually, just copy the pages.
|
|
SkulkrinBait
Morkin Admin
Haxx0rs == Suxx0rs! v4
Posts: 6,680
|
Post by SkulkrinBait on Sept 1, 2005 14:14:19 GMT
Actually, if you'd like to do it then be my guest, I've not got much time due to other projects and it looks a bit hard for me! I can let you see my code for the spying database if you want a good laugh and some of it might be relevant.
The reason I think it will be tough is some of the lists don't have obvious "delimitors" so the functions I used with the help of Robert wont work, they look for keywords such as Barracks or Gold, you don't have that type of thing in some of the above examples.
|
|
Freiegeister
Morkin Member
'Blasphemy is a victimless crime' - Dawkins
Posts: 1,126
|
Post by Freiegeister on Sept 1, 2005 23:18:25 GMT
Actually, if you'd like to do it then be my guest, I've not got much time due to other projects and it looks a bit hard for me! I can let you see my code for the spying database if you want a good laugh and some of it might be relevant. The reason I think it will be tough is some of the lists don't have obvious "delimitors" so the functions I used with the help of Robert wont work, they look for keywords such as Barracks or Gold, you don't have that type of thing in some of the above examples. Email it to me and I'll see. I'm thinking a single regex for each would probably work the best and then parse each line in the matched sections to extract the details.
|
|
SkulkrinBait
Morkin Admin
Haxx0rs == Suxx0rs! v4
Posts: 6,680
|
Post by SkulkrinBait on Sept 2, 2005 10:59:50 GMT
And in English that means? What's a regex Will email it tonight.
|
|
|
Post by sparrowhawk on Sept 2, 2005 11:05:10 GMT
It's a dark art. Anyone telling you otherwise is selling something!
Basically, you sepcify a template against which your value is to be compared. Problem is, a regex template is totally confusing/intricate/impossible to fathom.
Linux-heads love them!
|
|
SkulkrinBait
Morkin Admin
Haxx0rs == Suxx0rs! v4
Posts: 6,680
|
Post by SkulkrinBait on Sept 2, 2005 11:11:28 GMT
Ah right, I'll not ask any more then! Would be interested in seeing the code when it's done though. I like being confused, as you probably halibut by now.
|
|
|
Post by sparrowhawk on Sept 2, 2005 11:22:30 GMT
Here's a Javascrip regex to check that a valid email has been entered (not 100% perfect, but no email regex is, it seems). The PHP version is, I think, identical.
var email = frm.txtEmail.value;
rxEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(rxEmail.test(email) == false){ alert("The e-Mail address that you have entered is not in a recognised format"); frm.txtEmail.focus(); return false; }
|
|
|
Post by sparrowhawk on Sept 2, 2005 11:23:12 GMT
Shandy, are you able to make the code font larger, if at all possible?
|
|
SkulkrinBait
Morkin Admin
Haxx0rs == Suxx0rs! v4
Posts: 6,680
|
Post by SkulkrinBait on Sept 2, 2005 14:19:34 GMT
Ah yes, I've seen that before, on the registration code I borrowed for Pit-Stop. I saw it and then skipped to the next line I can see how it would work to validate stuff but how would it help with extracting the relevant data? Would you have a template for say a line in an alliance report and if it matched then process the data on that line?
|
|
|
Post by sparrowhawk on Sept 2, 2005 15:44:35 GMT
Yes. Maybe scan along the text stream until you find the next searchable item, so that you can delimit items.
|
|
SkulkrinBait
Morkin Admin
Haxx0rs == Suxx0rs! v4
Posts: 6,680
|
Post by SkulkrinBait on Sept 2, 2005 20:28:19 GMT
OK, v2 is ready for alpha testing, you can now use the dropdown and it uses a query string in the URL which can be bookmarked. If everyone is happy it works reliably I will merge the two bits of code together. www.speedworx.org/ik/test_view.phpI know the presentation etc needs working, gimme time! Did I sound like I knew what I was talking about?
|
|
Freiegeister
Morkin Member
'Blasphemy is a victimless crime' - Dawkins
Posts: 1,126
|
Post by Freiegeister on Sept 3, 2005 2:05:57 GMT
True, black art, but worth the effort to learn. This is ok: www.regular-expressions.info/There is also an excellent O'Rielly book on the subject. To answer your question you can group sections of the expression to match and then extract later. For example: /^Map[\r\n]+(\d\{2}\.\d{2}\.\d{4})\s(\d{2}\:\d{2}\:\d{2})/ would match the datetime following the Map text at the start of the string. There are two groupings () the first giving you the date and the second the time. So passing this regex and the text into: preg_match ($regex, $text, $matches)$matches[1] would contain the date $matches[2] would contain the time
|
|
SkulkrinBait
Morkin Admin
Haxx0rs == Suxx0rs! v4
Posts: 6,680
|
Post by SkulkrinBait on Sept 4, 2005 21:32:44 GMT
Thanks, interesting! Let me see the finished code if that;s Ok please?
Could you all remind me of the requests for upgrading the IK Spying Utility, I think some of the ideas were:
1. Password protection 2. Data showing how many of the resources were plunderable and how many merchants would be needed to carry it all off in one go. 3. Automatic calculation of time/distance to the island
|
|
soiram
Morkin Member
Morkin Godfather
Posts: 1,125
|
Post by soiram on Sept 4, 2005 23:37:06 GMT
I find the utility very useful. I think that in order to optimise it further, you need to facilitate the "view" part of the database (ie the drop-downs discussed).
An idea might be to link each record with the user who registered it, so one can filter the database through his name and then a drop-down list of the islands he has registered.
|
|