Re: [PHP] Re: Friday's Post
Peter Lind wrote: > On 1 October 2010 20:21, Per Jessen wrote: >> Peter Lind wrote: >> >>> C# has by now exceeded Java by quite a bit - >> >> I've been away from the Java "scene" since 2002 (when I worked for >> BEA deploying J2EE on Linux/390), but assuming you're talking >> about "deployed lines of code" or some other real-life measurement, I >> find it hard to believe that C# should have exceeded Java. > > Language functionality. I'd much rather use C# than Java as I can do > more in C# and easier than with Java. For instance, C# 4 has " support > for late binding to dynamic types". Does Java have an equivalent? Is > it planned? I don't know, but Java obviously supports late binding. -- Per Jessen, Zürich (14.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Friday's Post
On 2 October 2010 11:05, Per Jessen wrote: > Peter Lind wrote: > >> On 1 October 2010 20:21, Per Jessen wrote: >>> Peter Lind wrote: >>> C# has by now exceeded Java by quite a bit - >>> >>> I've been away from the Java "scene" since 2002 (when I worked for >>> BEA deploying J2EE on Linux/390), but assuming you're talking >>> about "deployed lines of code" or some other real-life measurement, I >>> find it hard to believe that C# should have exceeded Java. >> >> Language functionality. I'd much rather use C# than Java as I can do >> more in C# and easier than with Java. For instance, C# 4 has " support >> for late binding to dynamic types". Does Java have an equivalent? Is >> it planned? > > I don't know, but Java obviously supports late binding. > I was looking more for dynamic types, much more of interest to the average PHP dev as that's one of the typical stumbling blocks when switching languages. And no, far as I can tell Java doesn't offer that. Regards Peter -- WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Friday's Post
On Fri, 2010-10-01 at 23:42 +0100, Nathan Rixham wrote: > tedd wrote: > > Hi gang: > > > > What do you people think of the .NET framework? > > > > Please provide your thoughts as to cost, maintenance, benefit, and > > whatever else you think important. > > .NET is loaded up with patents and pretty much Microsoft only, however > that said it is rather good. Previous versions of C# (1/2) are > standardized under ECMA-Script 334 and 335 which covers a lot of .NET > however doesn't include asp.net, ado.net and windows forms - thus a nice > open source implementation and platform is quite common now, namely > Mono, this is .net compatible and has good support/development and has > been used for everything from the unity game engine through to sims 3. > Might be worth having a quick look at DotGNU and portable.net (as well > as mod_mono for apache http - which supports as.net pages etc). > > Might be worth noting that Stallman (as in Richard Stallman from FSF) > doesn't recommend using it because he's thinks MS will come with the > patent trolls soon, however microsoft has effectively tied themselves in > to a patent non assert ("community promise") which would prevent this. > > Also worth having a look at "M" for something different/interesting/from > microsoft, and also OData which is a nice RESTful protocol. > > Best, > > Nathan > > I'd like to add a little there. Although the Mono project is great, it is always left a step behind, because Microsoft has a tendency to release newer features of .Net that the Mono developers have to play catch-up with. Like Paul mentioned, it's probably not safe to let yourself be tied in to a closed format, even if it has open parts. One only has to look back a few years to find more examples of companies losing data because it was locked into an old format, or being stuck with old and obsolete versions of software because the company that makes it stopped writing it, or went bust. This sort of thing doesn't really happen with OSS, because there is always a community ready to take up the projects. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Little Parsing help...
Don, How far along are you? To get started something like this may work for you... preg_match_all('/[A-G]{1}#?/', $line, $matches); That SHOULD return each note of the line (you can retrieve them via the $matches array), given that there are no other upper-case characters that are not notes. Also this assumes that $line has exactly one line in it. :) If you get that working, perhaps you can setup something using the preg_replace method? http://php.net/manual/en/function.preg-replace.php Another option is to use the str_replace function. http://us3.php.net/manual/en/function.str-replace.php I gotta run (else I would type some more) but let me know if you want any advice on using those! Chris. On Fri, Oct 1, 2010 at 11:20 AM, Don Wieland wrote: > The logic I need is pretty straight forward, but I am having a hard time > replicating it using PHP functions. I will try to break it down to it's > simplest form: > > I have a field that has several lines of text. Chords and Song Lyrics. > > The "Chord" lines begin with an asterisk "*" and end with the line break. > This is the string I want to parse. Lines with no asterisk at the beginning > are ignored. > > Based on 3 arrays of NOTES, I want SUBSTITUTE the text (based on exact text > character patterns - just NOTES not the chord type) of the lines in my field > that start with an asterisk "*". > > original_chord_array = A, A#, B, C, C#, D, D#, E, F, F#, G, G# > transpose_up_array = A#, B, C, C#, D, D#, E, F, F#, G, G#, A > transpose_down_array = G#, A, A#, B, C, C#, D, D#, E, F, F#, G > > It is important that it only effects EXACT strings. Notes will always be > capitalized and chord types will be lower case. Maybe we can use that > characteristic to better identify what to change. Here are some examples of > chords: > > A > Asus7 > Csus add9 > Dmaj7 > F#m7 > G# > C#dim no3 > > When I transpose UP these chords, just the NOTE should change: > > A# > A#sus7 > C#sus add9 > D#maj7 > Gm7 > A > Ddim no3 > > When I transpose DOWN these chords, just the NOTE should change: > > G# > G#sus7 > Bsus add9 > C#maj7 > Fm7 > G > Cdim no3 > > I am working on a function, but still not producing the proper results. > Hopefully this break down is more clear and someone will bail me out ;-) > > Thanks again for the feedback. > > Don > > > On Oct 1, 2010, at 7:02 AM, Richard Quadling wrote: > > Changing the NormalKeyID and using that ID with NoteSequenceNumber >> should give you the new note to play. >> >> I think. >> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
[PHP] Scraping Multiple sites
I'm currently stuck on a little problem. I'm using cURL in conjunction with DOMDocument and Xpath to scrape data from a couple of websites. Please note that is only for personal and educational purposes. Right now I have 5 independent scripts (that traverse through 5 websites) that run via a cron tab every 12 hours. However, as you may have guessed this is a scalability nightmare. If my list of websites to scrape grows I have to create another independent script and run it via cron. My knowledge of OOP is fairly basic as I have just gotten started with it. However, could anyone perhaps suggest a design pattern that would suit my needs? My solution would be to create an abstract class for the web crawler and then simply extend it per website I add on. However, as I said my experience with OOP is almost non-existant therefore I have no idea how this would scale. I want this 'crawler' to be one application which can run via one cron rather than having n amount of scripts for each websites and having to manually create a cron each time. Or does anyone have any experience with this sort thing and could maybe offer some advice? I'm not limited to using PHP either, however due to hosting constraints Python would most likely be my only other alternative. Any help would be appreciated. Cheers, Russell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scraping Multiple sites
On Sat, Oct 2, 2010 at 9:03 PM, Russell Dias wrote: > I'm currently stuck on a little problem. I'm using cURL in conjunction > with DOMDocument and Xpath to scrape data from a couple of websites. > Please note that is only for personal and educational purposes. > > Right now I have 5 independent scripts (that traverse through 5 > websites) that run via a cron tab every 12 hours. However, as you may > have guessed this is a scalability nightmare. If my list of websites > to scrape grows I have to create another independent script and run it > via cron. > > My knowledge of OOP is fairly basic as I have just gotten started with > it. However, could anyone perhaps suggest a design pattern that would > suit my needs? My solution would be to create an abstract class for > the web crawler and then simply extend it per website I add on. > However, as I said my experience with OOP is almost non-existant > therefore I have no idea how this would scale. I want this 'crawler' > to be one application which can run via one cron rather than having n > amount of scripts for each websites and having to manually create a > cron each time. > > Or does anyone have any experience with this sort thing and could > maybe offer some advice? > > I'm not limited to using PHP either, however due to hosting > constraints Python would most likely be my only other alternative. > > Any help would be appreciated. > > Cheers, > Russell > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Are the sites that you are crawling so different as to justify maintaining separate chunks of code for each one? I would try to avoid having any code specific to a site, otherwise scaling your application to support even a hundred sites would involve overlapping hundreds of points of functionality and be a logistical nightmare. Unless you're simply wanting to do this for educational reasons... My suggestion would be to attempt to create an application that can craw all the sites, without specifics for each one. You could fire it with a single cron job, and give it a list of the urls you want it to hit. It can crawl one url, record the findings, move to the next, repeat. Chris.