php-general Digest 27 Apr 2009 05:25:43 -0000 Issue 6089
Topics (messages 291996 through 292007):
Re: Change color of anything in double/single quotes
291996 by: Ashley Sheridan
291997 by: Robert Cummings
291998 by: tedd
291999 by: Sudheer Satyanarayana
292000 by: Robert Cummings
Re: inexplicable behaviour SOLVED
292001 by: PJ
Re: inexplicable behaviour
292002 by: PJ
292004 by: PJ
292006 by: PJ
Re: Formating Numbers
292003 by: Gary
Re: MySQL -- finding whether there's a transaction started
292005 by: Chris
CamelCase conversion to proper_c_style
292007 by: Paul M Foster
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 ---
On Sun, 2009-04-26 at 11:40 -0400, tedd wrote:
> At 9:47 AM -0400 4/26/09, Robert Cummings wrote:
> >On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
> > > On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> > > > <span class="red"><?php echo('hello'); ?></span><?php echo(' there');
> > ?>
> > > >
> > > I'd go further on that and say don't call your class 'red', as it
> > > doesn't do anything for semantic code, but that's just me trolling ;)
> >
> >I was about to say the same thing *lol*. tis true though, the class
> >should be "doubleQuoted" or something similar. What happens when they
> >decide it should be blue?
> >
> >span.red
> >{
> > color: blue;
> >}
> >
> >Uh huh, uh huh, uh huh :)
>
>
> I fully understand, but I also see two side to this.
>
> On one side, I agree that one should always keep attributes vague
> enough so they can be anything, such as class="warning" and that way
> the client may say "I don't want it red now, but orange" and it will
> be easy enough to change.
>
> On the other side, some attributes may be exactly what they claim,
> such as class="center" or class="red". There is little confusion
> about what those classes mean as compared to more vague terms. As
> such, exact attributes are indeed semantic.
>
> So as I see it, with *some* attributes it's a toss-up -- you can add
> a layer of abstraction by making them vague OR you can use a more
> exact (semantic) meaning. I don't find much fault with either way
> provided that it's not a big problem later. The dividing line here is
> one of how much work it causes.
>
> Additional consideration, one can combine exact attributes, such as
> class="center red" and it both works and is obvious.
>
> I often have in my css, rules such as:
>
> .center
> {
> text-align: center;
> }
>
> .red
> {
> color: red;
> }
>
> While it might not fit with the purest css, it works for me. YMMV. :-)
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
I think with semantic CSS names, it's more about why the text has to be
red, than what colour it is. So if it's red because it is a warning,
alert, etc, then it can sometimes be better to give it a name that
reflects that. This is mostly down to preference though really. I say
mostly, because some UA's might use the class names to derive
microformat information, such as dates, author names, etc.
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Sun, 2009-04-26 at 11:40 -0400, tedd wrote:
> At 9:47 AM -0400 4/26/09, Robert Cummings wrote:
> >On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote:
> > > On Sun, 2009-04-26 at 09:41 -0400, tedd wrote:
> > > > <span class="red"><?php echo('hello'); ?></span><?php echo(' there');
> > ?>
> > > >
> > > I'd go further on that and say don't call your class 'red', as it
> > > doesn't do anything for semantic code, but that's just me trolling ;)
> >
> >I was about to say the same thing *lol*. tis true though, the class
> >should be "doubleQuoted" or something similar. What happens when they
> >decide it should be blue?
> >
> >span.red
> >{
> > color: blue;
> >}
> >
> >Uh huh, uh huh, uh huh :)
>
>
> I fully understand, but I also see two side to this.
>
> On one side, I agree that one should always keep attributes vague
> enough so they can be anything, such as class="warning" and that way
> the client may say "I don't want it red now, but orange" and it will
> be easy enough to change.
>
> On the other side, some attributes may be exactly what they claim,
> such as class="center" or class="red". There is little confusion
> about what those classes mean as compared to more vague terms. As
> such, exact attributes are indeed semantic.
>
> So as I see it, with *some* attributes it's a toss-up -- you can add
> a layer of abstraction by making them vague OR you can use a more
> exact (semantic) meaning. I don't find much fault with either way
> provided that it's not a big problem later. The dividing line here is
> one of how much work it causes.
>
> Additional consideration, one can combine exact attributes, such as
> class="center red" and it both works and is obvious.
>
> I often have in my css, rules such as:
>
> .center
> {
> text-align: center;
> }
>
> .red
> {
> color: red;
> }
>
> While it might not fit with the purest css, it works for me. YMMV. :-)
Your thinking is flawed. Yes you could have a class called center and it
does exactly that... center the text. However to make the text left
aligned you now need to edit the HTML to assign the class left intead of
center. The whole point of CSS is to not edit the HTML to make stylistic
changes. It maybe be obvious that having classes center and red makes
the content centered and coloured red, but that is no different than
having an align attribute and a color attribute which is EXACTLY what
CSS is supposed to replace.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
At 11:59 AM -0400 4/26/09, Robert Cummings wrote:
On Sun, 2009-04-26 at 11:40 -0400, tedd wrote:
> While it might not fit with the purest css, it works for me. YMMV. :-)
Your thinking is flawed. Yes you could have a class called center and it
does exactly that... center the text. However to make the text left
aligned you now need to edit the HTML to assign the class left intead of
center. The whole point of CSS is to not edit the HTML to make stylistic
changes. It maybe be obvious that having classes center and red makes
the content centered and coloured red, but that is no different than
having an align attribute and a color attribute which is EXACTLY what
CSS is supposed to replace.
Cheers,
Rob.
Rob:
I truly see your point and I don't disagree with it.
However, there are times where the client says "I want this centered"
and center it you must without giving that section of text an
attribute name.
Sure I could say "I know the client wants this selection-of-text
centered and he isn't willing (or agree) to give this
selection-of-text a name, so I'll do it. I'll call it this
'selection-of-text' "selection-of-text". That way years from now when
the client says "I no longer want that selection-of-text centered but
right justified" I can change a single rule in the
"selection-of-text" class attribute and the critter will be done
without me altering a single line of html. Sure, that sounds good..
But experience has shown me that when that happens, the client
usually doesn't single out that specific "selection-of-text" the same
way again but rather picks something even more convoluted thereby
defeating the entire process.
I realize that the entire idea here is to remove any need to alter
the html to make styling changes, but clients usually negate that
concept for when they want to change things, it's not just styling
they want to change, but everything.
Also try explaining style sheets to a client and why they should
think in terms of elements, blocks of text, maintenance, separating
style from presentation, and all that other noble stuff, when all
they what is to make something bold, centered, red, or all three.
For example, I have one client who's entire web site shows the same
explanation-link on each page the exact same way and then he said
"Oh, on page 43, let's change that from blue and bold to red and
right justified." As such, I had to write page specific code to make
that single change for that specific page plus writing a new css
rule. Using css the correct way would have never saved me from the
additional html work.
Sometimes simple is not only simpler, but easier to understand and
faster to implement -- especially when you are dealing with clients
who have absolutely no understanding of the proper ways of doing
things. They just want their eclectic stuff shown they way they
think, which is usually anything but organized.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Robert Cummings wrote:
I was about to say the same thing *lol*. tis true though, the class
should be "doubleQuoted" or something similar. What happens when they
decide it should be blue?
Aren't CSS class names supposed to be in lower case? I would go with
something like "double_quoted".
span.red
{
color: blue;
}
Uh huh, uh huh, uh huh :)
Cheers,
Rob.
--
With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net,
Personal: http://sudheer.net
--- End Message ---
--- Begin Message ---
On Sun, 2009-04-26 at 22:52 +0530, Sudheer Satyanarayana wrote:
> Robert Cummings wrote:
> > I was about to say the same thing *lol*. tis true though, the class
> > should be "doubleQuoted" or something similar. What happens when they
> > decide it should be blue?
> >
> >
> Aren't CSS class names supposed to be in lower case? I would go with
> something like "double_quoted".
CSS class names are case-sensitive. IE supports insensitivity in
non-standards mode.
You're probably confusing the following:
C.13. Cascading Style Sheets (CSS) and XHTML
1. CSS style sheets for XHTML should use lower case element
and attribute names.
This does not refer to attribute values.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP
--- End Message ---
--- Begin Message ---
kranthi wrote:
> if $Count1 is never referenced after this, then certainly this
> assignment operation is redundent. but assignment is not the ONLY
> operation of this statement. if u hav not noticed a post increment
> operator has been used which will affect the value of $Count as well,
> and this operation is required for the script to work.
>
> the script should work even if u replace
> $Count1 = $Count++;
> with
> $Count++;
>
> Kranthi.
>
>
Not quite, since that would change the $Count variable and that is used
leater in the code.
But the problem seems to be solved as the paging needed the $Count1 wich
was not being supplied because I was debugging the code without enough
entries in the database. Once I had a larger base of info I was able to
see what the problem was. The code needed to determine how many
instances there are in the db of the search criteria and it was not
getting that; it was only getting the LIMIT of the query. So I added a
few lines to determine the total for $Count1 and it all works fine now.
:-) or until I find another glitch. ;-)
Thanks for the suggestion.
--
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
9el wrote:
> I have pagination set up and the number for pages "next" has a link but
> the "next" does not. I have experimented with all sorts of
> configurations of the code but the only thing that works (and this is
> totally "off the wall") is to do this
> *$Count* = *mysql_num_rows($results);*
> $Count1=*$Count++;* // without this, the "next" does not do the link---
> but there is no other $Count1 in the code either in the original page or
> the include page.
>
>>
>> the script should work even if u replace
>> $Count1 = $Count++;
>> with
>> $Count++;
>>
>>
>
>
> There's a NICE video tutorial available on pagination over the internet. You
> should watch it.
>
> You are counting the number of rows of a result. And you are asking to
> increase the count by 1. :D
>
> Thats not realistic.
>
> pagination is done with the help of mySQL's * LIMIT recNUMBER, count*
> *
> Look for "Pagination with PHP + MySQL" and watchit
>
>
> http://www.google.com/url?sa=t&source=web&ct=res&cd=10&url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2&ei=ohn0SdnlL8KLkAWQrNTbCg&usg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA
>
> Dont miss this SampsonVideos . PERIOD
>
>
> *Regards
>
> Lenin
>
> www.twitter.com/nine_L
> www.lenin9l.wordpress.com
>
>
Thanks, Lenin,
I appreciate the feedback and will take a look at the video.
Maybe it will expand my understanding of things and offer an alternative
to several that I have already found. :-)
--
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
> Look for "Pagination with PHP + MySQL" and watchit
>
>
> http://www.google.com/url?sa=t&source=web&ct=res&cd=10&url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2&ei=ohn0SdnlL8KLkAWQrNTbCg&usg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA
>
> Dont miss this SampsonVideos . PERIOD
>
Well, I went, I looked, I tried... but:
I'm afraid this kind of video tutorial or any program of the like is
pretty pathertic.
Although the intention of the this guy Samson may be commendable, the
execution is absolutely atrocious and unprofessional.
By profession, I am a director, director of photography and still
photography for films, videos, TV stuff, clips as well as still photos
for books & specialty of food, etc.; you name it. And this is just plain
too boring. If he were to cut the padding, it would doubtless be
interesting but 21 minutes (for just 1 of 2 clips) I'm not going to
waste. During that time I can find lots of other code examples &
tutorials. Sorry, but this is not for me.
If anyone wants any help on shooting stuff, I'll be happy to help but I
cannot encourage amateurism.
Oh, and while I am at it, I don't much care to Google; their search
engine has gone way off course (although it is probably the best
available, but I don't wish to have anything to do with any of the rest
of their overblown garbage like the analytics, and especially their
policies and capitalistic profit drive shown in their actions relating
publishing and copyright regarding electronic media.
Just love to spread the word. - Oh, yes, if you want to save the planet,
start by rethinking capitalism (it hasn't worked too well, has it)... :-D
Thanks for the opportunity to rant.
--
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme"
-------------------------------------------------------------
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
Phpster wrote:
> What parameters are you pasing in the link? That will be the telling
> point of what you are doing wrong. You could pass the search params (
> though these are best kept in a session or cookie ) and the offset
> counter to get the next block of results.
Actually, I am trying to use sessions but I'm not sure it's working.
I'll have to look throught the manuals and tutorials again to see what's
not "cookie-ing" :-)
Any suggestions on how to verify or debug sessions?
>
> Sorry for top posting.
>
> Bastien
>
> Sent from my iPod
>
> On Apr 26, 2009, at 4:23, 9el <[email protected]> wrote:
>
>> I have pagination set up and the number for pages "next" has a link but
>> the "next" does not. I have experimented with all sorts of
>> configurations of the code but the only thing that works (and this is
>> totally "off the wall") is to do this
>> *$Count* = *mysql_num_rows($results);*
>> $Count1=*$Count++;* // without this, the "next" does not do the link---
>> but there is no other $Count1 in the code either in the original page or
>> the include page.
>>>
>>>
>>>
>>> the script should work even if u replace
>>> $Count1 = $Count++;
>>> with
>>> $Count++;
>>>
>>
>>
>> There's a NICE video tutorial available on pagination over the
>> internet. You
>> should watch it.
>>
>> You are counting the number of rows of a result. And you are asking to
>> increase the count by 1. :D
>>
>> Thats not realistic.
>>
>> pagination is done with the help of mySQL's * LIMIT recNUMBER, count*
>> *
>> Look for "Pagination with PHP + MySQL" and watchit
>>
>>
>> http://www.google.com/url?sa=t&source=web&ct=res&cd=10&url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2&ei=ohn0SdnlL8KLkAWQrNTbCg&usg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA
>>
>>
>> Dont miss this SampsonVideos . PERIOD
>>
>>
>> *Regards
>>
>> Lenin
>>
>> www.twitter.com/nine_L
>> www.lenin9l.wordpress.com
>
--
Hervé Kempf: "Pour sauver la planète, sortez du capitalisme."
-------------------------------------------------------------
Phil Jourdan --- [email protected]
http://www.ptahhotep.com
http://www.chiccantine.com/andypantry.php
--- End Message ---
--- Begin Message ---
Sorry for the delay in response. I was able to figure the number_format()
function out.
Thanks for all your responses.
Gary
""Gary"" <[email protected]> wrote in message
news:[email protected]...
>I cant seem to get this to work for me. I want the number to be formated
>to money (us, 2 decimal points). I have gone through manual, tried
>money_format, number_format, along with setting the variable, but I cant
>seem to get it to work. I'm sure it is something simple I am missing.
>
> Thanks for the help.
>
> <?php
>
> $sale_value=$_POST['sale'];
> $assess_value=$_POST['assess'];
>
> $mil_rate=.03965;
> $ratio=.51;
>
> $present_tax=($assess_value) * ($mil_rate);
> $correct_tax=($sale_value)*($ratio)*($mil_rate);
> $savings=($present_tax)-($correct_tax);
>
>
> echo 'According to the information you have entered<br />';?><br />
> <?php
> echo "You are currently paying now $ $present_tax<br /><br />";
> echo "According to the information you have submitted, your taxes should
> be $ $correct_tax <br />";?>
> <br/><?php
> echo "According to our calculations, a successful assessment appeal could
> save you annually on your current real estate taxes. <b>$ $savings</b> ";
>
> ?>
>
--- End Message ---
--- Begin Message ---
Bogdan Stancescu wrote:
On 24-Apr-09 03:45, Chris wrote:
I don't think mysql has any way of finding that out. If you're using an
abstraction layer, it's easy enough in code - though rollback's are a
little harder - should they do a complete rollback or just to a savepoint?
Thank you for taking the time to sketch that mock-up -- yes, we were
also thinking about something similar as a last resort, but I just can't
believe you can't simply ask MySQL whether it's going to autocommit the
next query or not...
How can it know? What if a bad query comes through or a null value where
there shouldn't be or a bad integer value or ...
They are all situations where a transaction will be rolled back.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
I know it's probably heresy for a lot of coders, but does anyone know a
function or class or regexp or somesuch which will scan through a PHP
file and convert all the CamelCase code into proper C-type code? That
is, "CamelCase" gets converted to "camel_case". I snagged a bunch of
someone else's PHP code I'd like to modify, but it's coded the wrong
way, so I'd like to fix it.
(I'm teasing you CamelCase people. But I really would like to change
this code around, because it doesn't happen to be my preference.)
Paul
--
Paul M. Foster
--- End Message ---