php-general Digest 1 Oct 2010 22:43:11 -0000 Issue 6969
Topics (messages 308381 through 308396):
Little Parsing help...
308381 by: Don Wieland
308382 by: Richard Quadling
308391 by: Don Wieland
Friday's Post
308383 by: tedd
308384 by: Robert Cummings
308386 by: Gary
308388 by: Adam Richardson
308389 by: Bob McConnell
308392 by: Peter Lind
308393 by: Paul M Foster
308394 by: Floyd Resler
308395 by: Per Jessen
308396 by: Nathan Rixham
Re: Friday's Post (WOT)
308385 by: Jay Blanchard
Re: PHP Email Question
308387 by: kranthi
Re: file_get_contents() failing on CentOS.
308390 by: kranthi
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Hello,
I am building a web Song DB. That will simple song chord charts in the
DB. I would like the ability to do KEY changes for the different
songs. I am looking for some direction on how to do this. This was my
original thought but I am open if there is a better way.
I defined a table called Chords (here is the mySQL Dump):
DROP TABLE IF EXISTS `Chords`;
CREATE TABLE `Chords` (
`id` int(11) NOT NULL auto_increment,
`original_note` varchar(2) default NULL,
`up_note` varchar(2) default NULL,
`down_note` varchar(2) default NULL,
`flatted` varchar(2) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
LOCK TABLES `Chords` WRITE;
/*!40000 ALTER TABLE `Chords` DISABLE KEYS */;
INSERT INTO `Chords`
(`id`,`original_note`,`up_note`,`down_note`,`flatted`)
VALUES
(1,'A','A#','G#',NULL),
(2,'A#','B','A','Bb'),
(3,'B','C','A#',NULL),
(4,'C','C#','B',NULL),
(5,'C#','D','C','Db'),
(6,'D','D#','C#',NULL),
(7,'D#','E','D','Eb'),
(8,'E','F','D#',NULL),
(9,'F','F#','E',''),
(10,'F#','G','F','Gb'),
(11,'G','G#','F#',NULL),
(12,'G#','A','G','Ab');
/*!40000 ALTER TABLE `Chords` ENABLE KEYS */;
UNLOCK TABLES;
---------------
now this is a sample of my Music Charts:
C Dm7 Em
This is the first line of my song
C/E Em7 Dm7
and I know it can get real long
Gm7 Am7
If you know I will say
G/B C
That it will help to ease the day
What I was hoping for is to check patterns in the CHORD LINES. I
realize I need to mark which lines do PHP will now which line to
parse. I was thinking that the user would add a asterisk "*" at the
beginning of the chord line like so:
* C Dm7 Em
This is the first line of my song
* C/E Em7 Dm7
and I know it can get real long
* Gm7 Am7
If you know I will say
* G/B C
That it will help to ease the day
Then have PHP look for occurrences in the lines that begin with an "*".
So if I want to transpose up 1/2 step, it would look like this:
* C# D#m7 Fm
This is the first line of my song
* C#/F Fm7 D#m7
and I know it can get real long
* G#m7 A#m7
If you know I will say
* G#/C C#
That it will help to ease the day
So if I want to transpose up 1/2 step, it would look like this:
* B C#m7 D#m
This is the first line of my song
* B/D# D#m7 C#m7
and I know it can get real long
* F#m7 G#m7
If you know I will say
* F#/A# B
That it will help to ease the day
I guess the challenge would that once the value was changed, it would
not get changed again it same process. Also, I need to make sure that
EXACT Case is only changed. For example, there might be a chord like
"Asus add 9" where I would not want the "a" of add9 to change.
Any suggestions would be appreciated.
Don Wieland
--- End Message ---
--- Begin Message ---
On 1 October 2010 14:35, Don Wieland <[email protected]> wrote:
> Hello,
>
> I am building a web Song DB. That will simple song chord charts in the DB.
> I would like the ability to do KEY changes for the different songs. I am
> looking for some direction on how to do this. This was my original thought
> but I am open if there is a better way.
>
> I defined a table called Chords (here is the mySQL Dump):
>
> DROP TABLE IF EXISTS `Chords`;
>
> CREATE TABLE `Chords` (
> `id` int(11) NOT NULL auto_increment,
> `original_note` varchar(2) default NULL,
> `up_note` varchar(2) default NULL,
> `down_note` varchar(2) default NULL,
> `flatted` varchar(2) default NULL,
> PRIMARY KEY (`id`)
> ) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
>
> LOCK TABLES `Chords` WRITE;
> /*!40000 ALTER TABLE `Chords` DISABLE KEYS */;
> INSERT INTO `Chords` (`id`,`original_note`,`up_note`,`down_note`,`flatted`)
> VALUES
> (1,'A','A#','G#',NULL),
> (2,'A#','B','A','Bb'),
> (3,'B','C','A#',NULL),
> (4,'C','C#','B',NULL),
> (5,'C#','D','C','Db'),
> (6,'D','D#','C#',NULL),
> (7,'D#','E','D','Eb'),
> (8,'E','F','D#',NULL),
> (9,'F','F#','E',''),
> (10,'F#','G','F','Gb'),
> (11,'G','G#','F#',NULL),
> (12,'G#','A','G','Ab');
>
> /*!40000 ALTER TABLE `Chords` ENABLE KEYS */;
> UNLOCK TABLES;
>
> ---------------
>
> now this is a sample of my Music Charts:
>
> C Dm7 Em
> This is the first line of my song
> C/E Em7 Dm7
> and I know it can get real long
> Gm7 Am7
> If you know I will say
> G/B C
> That it will help to ease the day
>
> What I was hoping for is to check patterns in the CHORD LINES. I realize I
> need to mark which lines do PHP will now which line to parse. I was thinking
> that the user would add a asterisk "*" at the beginning of the chord line
> like so:
>
> * C Dm7 Em
> This is the first line of my song
> * C/E Em7 Dm7
> and I know it can get real long
> * Gm7 Am7
> If you know I will say
> * G/B C
> That it will help to ease the day
>
> Then have PHP look for occurrences in the lines that begin with an "*".
>
> So if I want to transpose up 1/2 step, it would look like this:
>
> * C# D#m7 Fm
> This is the first line of my song
> * C#/F Fm7 D#m7
> and I know it can get real long
> * G#m7 A#m7
> If you know I will say
> * G#/C C#
> That it will help to ease the day
>
>
> So if I want to transpose up 1/2 step, it would look like this:
>
> * B C#m7 D#m
> This is the first line of my song
> * B/D# D#m7 C#m7
> and I know it can get real long
> * F#m7 G#m7
> If you know I will say
> * F#/A# B
> That it will help to ease the day
>
> I guess the challenge would that once the value was changed, it would not
> get changed again it same process. Also, I need to make sure that EXACT Case
> is only changed. For example, there might be a chord like "Asus add 9" where
> I would not want the "a" of add9 to change.
>
> Any suggestions would be appreciated.
>
> Don Wieland
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
For each key I would guess you'd need the chord order, so if you
change key, you change chords accordingly.
I don't know if that is accurate.
If it is, then a song is recorded in a particular key.
The song will then play the chords/notes of that key. Key1, Note1,
Note2, Note2, Note3, Note4, Note1.
Change key, the same notes are played. For that key ... Key2, Note1,
Note2, Note2, Note3, Note4, Note1.
Or
Key4, Note1, Note2, Note2, Note3, Note4, Note1.
If this is the same for chords, then I'd go with :
A Key table (ID, Keyname) - all the names of the keys
A Notes table (ID, KeyID, Note, Sequence) - the notes in order per key
with a unique composite key of KeyID+Sequence
A Song table (ID, NormalKeyID, Title) - the key that the song is
normally sung in.
A Song Notes table (ID, SongID, NoteSequenceNumber) - Which notes are played.
Changing the NormalKeyID and using that ID with NoteSequenceNumber
should give you the new note to play.
I think.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--- End Message ---
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
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.
Thanks,
tedd
--
-------
http://sperling.com/
--- End Message ---
--- Begin Message ---
On 10-10-01 10:23 AM, 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.
Until you posted this... I didn't... bah!
Cheers,
Rob.
>:)
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
--- End Message ---
--- Begin Message ---
tedd wrote:
> What do you people think of the .NET framework?
It's a framework, like any other framework - can make your life easier,
can make your life harder by forcing you to take the path determined as
TOTP by its designers.
That's "The One True Path", not "Top Of The Pops".
--- End Message ---
--- Begin Message ---
On Fri, Oct 1, 2010 at 10:23 AM, tedd <[email protected]> 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.
>
> Thanks,
>
> tedd
> --
> -------
> http://sperling.com/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Powerful.
Developers typically have to maintain a subscription to MSDN to be
particularly effective, however the toolset is very polished.
Additional costs come into play if you're using ASP.Net, as the servers
require licenses, too. However ASP.Net MVC represents a significant upgrade
over webforms ASP.Net (I've been developing websites using ASP.Net since
version 1, and I can't begin to count the number of times the markup and
postback model drove me nuts in the webforms version), and I'd have no
problem using ASP.Net MVC for most any web application. Additionally, I use
Rackspace Cloud for hosting, and it's pretty easy and cheap to spin up a
Windows server when needed.
The .Net technologies all integrate very nicely. For example, while the new
mobile OS is really late to the party (I'm not sure it will be able to
compete with Android and the iPhone), I can develop software for it using
technologies which would seem very familiar to any web or desktop
application developer.
I particularly appreciate F#, a functional language that looks a lot like
OCaml with a few .Net-centric additions, although C# has made some very nice
improvements that bring functional programming techniques to it language,
too.
That all said, I still use PHP for most of my web projects. Why? PHP is
fast, well-supported, cheap, and I like the community, although some
projects do seem to benefit from .Net (e.g., if web services are interacting
with a desktop app, it's easier to just build the whole thing using .Net
technologies.)
I could see the day when anything I would normally do in Flash is switched
over to Silverlight. I just find it a better conceived development
environment for RIA than Flash.
Adam
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com
--- End Message ---
--- Begin Message ---
From: Gary
> tedd wrote:
>> What do you people think of the .NET framework?
>
> It's a framework, like any other framework - can make your life
easier,
> can make your life harder by forcing you to take the path determined
as
> TOTP by its designers.
>
> That's "The One True Path", not "Top Of The Pops".
The installer and the license limit its use to just a subset of a single
platform. The attempts at producing clones on other platforms are
clouded by license and patent restrictions, and will perpetually be at
least one release behind the MS-Windows version.
In reality, .Net is a poor clone of the Java runtime environment, while
C# is a poor clone of the Java language. They were created after the
courts told Microsoft the Sun license did not allow them to subvert the
Java API to build applications that would only run on their OS.
Bob McConnell
--- End Message ---
--- Begin Message ---
On 1 October 2010 17:11, Bob McConnell <[email protected]> wrote:
> From: Gary
>
>> tedd wrote:
>>> What do you people think of the .NET framework?
>>
>> It's a framework, like any other framework - can make your life
> easier,
>> can make your life harder by forcing you to take the path determined
> as
>> TOTP by its designers.
>>
>> That's "The One True Path", not "Top Of The Pops".
>
> The installer and the license limit its use to just a subset of a single
> platform. The attempts at producing clones on other platforms are
> clouded by license and patent restrictions, and will perpetually be at
> least one release behind the MS-Windows version.
>
> In reality, .Net is a poor clone of the Java runtime environment, while
> C# is a poor clone of the Java language. They were created after the
> courts told Microsoft the Sun license did not allow them to subvert the
> Java API to build applications that would only run on their OS.
>
C# has by now exceeded Java by quite a bit - and is, unlike Java, very
actively maintained and has fairly frequent releases with lots of new
functionality (4.0 was released this year and has functionality that
definitely makes me consider taking it on).
As for whether .Net is a better library than the JVM, I wouldn't be
able to judge that.
Regards
Peter
--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>
--- End Message ---
--- Begin Message ---
On Fri, Oct 01, 2010 at 10:23:31AM -0400, 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.
I'll be politically incorrect and say that it's evil.
Microsoft is a well-documented monopolist corporation which typically
either steals or buys most of the "original" technologies it issues. (I
just saw a video where a guy bemoaned all the advertising Microsoft did
for Windows 7. Many, many of the "amazing" features of Window 7 have
existed for years in Linux and MacOS. And as far as I know, they still
don't have what Linuxers would call desktops and MacOS would call
workspaces or spaces.)
It's also a *corporation*, which means hitching your wagon to them is a
liability. Just ask users of PageMaker, MySQL, OpenOffice, etc.
PageMaker languishes in Adobe's hands now. MySQL users (and its original
developer) are still waiting for the next shoe to drop from Oracle.
Major Open Office developers have now forked OOo, because of whatever
Oracle is doing/going to do with the programs. As an example, I recently
went on an interview with my old boss, who, when I worked for him, did
FoxPro development on a widely used accounting package. That accounting
package was bought by a couple of corporations in the last few years,
and now languishes. Further, Microsoft recently announced the "end of
life" for FoxPro, the language it was written in. Goodbye to a whole
industry of users and developers who based their business on a language
and software owned by corporations who simply have no time for them any
more. My old boss spent months searching for a comparable and
comparably-priced accounting package to take up the slack in his
business.
To .NET specifically, the framework was originally built on Java 1.4,
according to an acquaintance who knows much more about Microsoft
internally than I do. After a dispute with Sun over co-development of
Java, Microsoft went "not invented here" and created its own version of
the platform.
.Net is heavy and expensive, as detailed elsewhere.
I realize there are often economic issues involved, but let me reiterate
that I strongly advocate against using any language owned by a
corporation (like C#). I feel the same way about storing documents in
.doc format. We all know the version-to-version incompatibilities with
.doc format. But Microsoft can do anything they like with it; it belongs
to them.
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
On Oct 1, 2010, at 12:04 PM, Paul M Foster wrote:
> I'll be politically incorrect and say that it's evil.
It's funny you should say that because years ago I did a short video called
"PHP Commando". PHP Commando was battling the evil forces of Dr. Dot Net and
his sidekick, Macro Mae. Leave it to me to do a parody of a parody!
Take care,
Floyd
--- End Message ---
--- Begin Message ---
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.
> and is, unlike Java, very actively maintained and has fairly frequent
> releases with lots of new functionality (4.0 was released this year
> and has functionality that definitely makes me consider taking it on).
Almost every newer programming language in the world has gone further
than Fortran, C, Cobol and PL/I, but they're all very much alive and
kicking. And will each individually probably be able to muster
more "deployed lines of code" than any other language.
--
Per Jessen, Zürich (12.1°C)
--- End Message ---
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
[snip]
What do you people think of the .NET framework?
[/snip]
I am not a fan.
--- End Message ---
--- Begin Message ---
I cant see why you are getting the letter 'z' (assuming $msgContent
was referenced properly) . Complete code will be helpful to debug the
problem.
Also, Heredoc syntax will be more helpful in your situation. And usage
of global keyword is strongly discouraged in favor of $GLOBALS
superglobal array
http://php.net/GLOBALS
http://php.net/heredoc
Kranthi.
http://goo.gl/e6t3
--- End Message ---
--- Begin Message ---
probably not the issue, but is the php engine behind a proxy server ?
wget uses the environment variable, but PHP does not
Kranthi.
http://goo.gl/e6t3
--- End Message ---