
displaying data from mysql onto browser in correct format .. (usingtemplate toolkit )
--20cf30050e0e2a9ca304a43fad46
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi
I am using TT to display my data from my db ,
i insert the following data from a Front end using ( <textarea> ) into
my database the data is like this in mysql :
------------------------------------------------------------ ---------------=
-----------+------+---------------+-------------+----------- --+
LV Name /dev/VolGroup01/zeeweblinux1
VG Name VolGroup01
LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF
LV Write Access read/write
LV Status available
# open 1
LV Size 50.00 GB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:8
+-----------+------+---------------------------------------- ---------------=
------------------------------------------------------------ ---------------=
------------------------------------------------------------ ---------------=
------------------------------------------------------------ ---------------=
------------------------------------------------------------ ---------------=
------------------------------------------------------------ ---------------=
--------------------------------------+------+-------------- -+-------------=
+-------------+
when i try to retrieve this data using TT i to put it in a hash , so here
is what my hash looks like :
$VAR1 =3D [ { 'result' =3D> { 'lvm' =3D> 'LV Name /dev/VolGroup01/blinux1 =
VG Name
VolGroup01 LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write Access
read/write LV Status available # open 1 LV Size 50.00 GB Current LE 12800
Segments 1 Allocation inherit Read ahead sectors auto - currently set to 25=
6
Block device 253:8 ', } } ];
ultimately it it gets displayed without the new-line character :
LV Name /dev/VolGroup01/blinux1 VG Name VolGroup01 LV UUID
iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write Access read/write LV Status
available # open 1 LV Size 50.00 GB Current LE 12800 Segments 1 Allocation
inherit Read ahead sectors auto - currently set to 256 Block device 253:8
is there a way i can display on my browser with a new-line or <br/>
thanks for all the help
--
Regards
Agnello D'souza
--20cf30050e0e2a9ca304a43fad46--
Re: displaying data from mysql onto browser in correct format .. (using template toolkit )
On Friday 27 May 2011 13:48:21 Agnello George wrote:
> Hi
>
> I am using TT to display my data from my db ,
>
>
> i insert the following data from a Front end using ( <textarea> ) into
> my database the data is like this in mysql :
>
> ------------------------------------------------------------ ---------------
> -----------+------+---------------+-------------+----------- --+ LV Name
> /dev/VolGroup01/zeeweblinux1
> VG Name VolGroup01
> LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF
> LV Write Access read/write
> LV Status available
> # open 1
> LV Size 50.00 GB
> Current LE 12800
> Segments 1
> Allocation inherit
> Read ahead sectors auto
> - currently set to 256
> Block device 253:8
> +-----------+------+---------------------------------------- ---------------
> ------------------------------------------------------------ ---------------
> ------------------------------------------------------------ ---------------
> ------------------------------------------------------------ ---------------
> ------------------------------------------------------------ ---------------
> ------------------------------------------------------------ ---------------
> --------------------------------------+------+-------------- -+-------------
> +-------------+
>
> when i try to retrieve this data using TT i to put it in a hash , so here
> is what my hash looks like :
>
> $VAR1 = [ { 'result' => { 'lvm' => 'LV Name /dev/VolGroup01/blinux1 VG
> Name VolGroup01 LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write
> Access read/write LV Status available # open 1 LV Size 50.00 GB Current LE
> 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently
> set to 256 Block device 253:8 ', } } ];
>
>
> ultimately it it gets displayed without the new-line character :
>
> LV Name /dev/VolGroup01/blinux1 VG Name VolGroup01 LV UUID
> iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write Access read/write LV Status
> available # open 1 LV Size 50.00 GB Current LE 12800 Segments 1 Allocation
> inherit Read ahead sectors auto - currently set to 256 Block device 253:8
>
>
> is there a way i can display on my browser with a new-line or <br/>
>
First of all, make sure you avoid HTML-injection/cross-site-scripting (XSS)
attacks:
http://community.livejournal.com/shlomif_tech/35301.html
Then you can use something like:
$s =~ s{\n}{
}g;
to put line breaks in the HTML.
Regards,
Shlomi Fish
--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Optimising Code for Speed - http://shlom.in/optimise
We have nothing to fear but fear itself. Fear has nothing to fear but XSLT.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: displaying data from mysql onto browser in correct format ..(using template toolkit )
--000e0cd56a5402cd1a04a44165d1
Content-Type: text/plain; charset=ISO-8859-1
On Fri, May 27, 2011 at 6:05 PM, Shlomi Fish <shlomif [at] iglu.org.il> wrote:
> On Friday 27 May 2011 13:48:21 Agnello George wrote:
> > Hi
> >
> > I am using TT to display my data from my db ,
> >
> >
> > i insert the following data from a Front end using ( <textarea> )
> into
> > my database the data is like this in mysql :
> >
> >
> ------------------------------------------------------------ ---------------
> > -----------+------+---------------+-------------+----------- --+ LV Name
> > /dev/VolGroup01/zeeweblinux1
> > VG Name VolGroup01
> > LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF
> > LV Write Access read/write
> > LV Status available
> > # open 1
> > LV Size 50.00 GB
> > Current LE 12800
> > Segments 1
> > Allocation inherit
> > Read ahead sectors auto
> > - currently set to 256
> > Block device 253:8
> >
> +-----------+------+---------------------------------------- ---------------
> >
> ------------------------------------------------------------ ---------------
> >
> ------------------------------------------------------------ ---------------
> >
> ------------------------------------------------------------ ---------------
> >
> ------------------------------------------------------------ ---------------
> >
> ------------------------------------------------------------ ---------------
> >
> --------------------------------------+------+-------------- -+-------------
> > +-------------+
> >
> > when i try to retrieve this data using TT i to put it in a hash , so
> here
> > is what my hash looks like :
> >
> > $VAR1 = [ { 'result' => { 'lvm' => 'LV Name /dev/VolGroup01/blinux1 VG
> > Name VolGroup01 LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write
> > Access read/write LV Status available # open 1 LV Size 50.00 GB Current
> LE
> > 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently
> > set to 256 Block device 253:8 ', } } ];
> >
> >
> > ultimately it it gets displayed without the new-line character :
> >
> > LV Name /dev/VolGroup01/blinux1 VG Name VolGroup01 LV UUID
> > iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write Access read/write LV
> Status
> > available # open 1 LV Size 50.00 GB Current LE 12800 Segments 1
> Allocation
> > inherit Read ahead sectors auto - currently set to 256 Block device 253:8
> >
> >
> > is there a way i can display on my browser with a new-line or <br/>
> >
>
> First of all, make sure you avoid HTML-injection/cross-site-scripting (XSS)
> attacks:
>
> http://community.livejournal.com/shlomif_tech/35301.html
>
> Then you can use something like:
>
> $s =~ s{\n}{
}g;
>
> to put line breaks in the HTML.
>
> Regards,
>
> Shlomi Fish
>
> --
> ------------------------------------------------------------ -----
> Shlomi Fish http://www.shlomifish.org/
> Optimising Code for Speed - http://shlom.in/optimise
>
> We have nothing to fear but fear itself. Fear has nothing to fear but XSLT.
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>
awesome!! it works
i had to do some thing like this !!
my $select_dom0_data = $DBH->selectall_hashref("select
dom0_name,cpu,lvm,ram,ip,application,assigned_to from dom0_info where
dom0_name='$dom0_server' and rid=$rack_n",'dom0_name' );
$select_dom0_data->{$dom0_server}{lvm} =~ s{\n}{
}g; ;
--
Regards
Agnello D'souza
--000e0cd56a5402cd1a04a44165d1--
Re: displaying data from mysql onto browser in correct format .. (using template toolkit )
On Friday 27 May 2011 15:51:21 Agnello George wrote:
> On Fri, May 27, 2011 at 6:05 PM, Shlomi Fish <shlomif [at] iglu.org.il> wrote:
> > On Friday 27 May 2011 13:48:21 Agnello George wrote:
> > > Hi
> > >
> > >
> > > is there a way i can display on my browser with a new-line or <br/>
> >
> > First of all, make sure you avoid HTML-injection/cross-site-scripting
> > (XSS) attacks:
> >
> > http://community.livejournal.com/shlomif_tech/35301.html
> >
> > Then you can use something like:
> > $s =~ s{\n}{
}g;
> awesome!! it works
>
> i had to do some thing like this !!
>
> my $select_dom0_data = $DBH->selectall_hashref("select
> dom0_name,cpu,lvm,ram,ip,application,assigned_to from dom0_info where
> dom0_name='$dom0_server' and rid=$rack_n",'dom0_name' );
>
This interpolation of string variables into an SQL statement is an SQL
injection attack waiting to happen:
* http://en.wikipedia.org/wiki/SQL_injection
* http://community.livejournal.com/shlomif_tech/35301.html
* http://bobby-tables.com/
Please avoid it by using placeholders.
> $select_dom0_data->{$dom0_server}{lvm} =~ s{\n}{
}g; ;
You probably should assign that to a temporary variable.
Regards,
Shlomi Fish
--
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
Best Introductory Programming Language - http://shlom.in/intro-lang
My Commodore 64 is suffering from slowness and insufficiency of memory, and
its
display device is grievously short of pixels. Can anybody help? -- Omer Zak
Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: displaying data from mysql onto browser in correct format ..(using template toolkit )
--20cf303f6d58c2a09704a45232fe
Content-Type: text/plain; charset=ISO-8859-1
On Fri, May 27, 2011 at 6:21 PM, Agnello George <agnello.dsouza [at] gmail.com>wrote:
>
>
> On Fri, May 27, 2011 at 6:05 PM, Shlomi Fish <shlomif [at] iglu.org.il> wrote:
>
>> On Friday 27 May 2011 13:48:21 Agnello George wrote:
>> > Hi
>> >
>> > I am using TT to display my data from my db ,
>> >
>> >
>> > i insert the following data from a Front end using ( <textarea> )
>> into
>> > my database the data is like this in mysql :
>> >
>> >
>> ------------------------------------------------------------ ---------------
>> > -----------+------+---------------+-------------+----------- --+ LV Name
>> > /dev/VolGroup01/zeeweblinux1
>> > VG Name VolGroup01
>> > LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF
>> > LV Write Access read/write
>> > LV Status available
>> > # open 1
>> > LV Size 50.00 GB
>> > Current LE 12800
>> > Segments 1
>> > Allocation inherit
>> > Read ahead sectors auto
>> > - currently set to 256
>> > Block device 253:8
>> >
>> +-----------+------+---------------------------------------- ---------------
>> >
>> ------------------------------------------------------------ ---------------
>> >
>> ------------------------------------------------------------ ---------------
>> >
>> ------------------------------------------------------------ ---------------
>> >
>> ------------------------------------------------------------ ---------------
>> >
>> ------------------------------------------------------------ ---------------
>> >
>> --------------------------------------+------+-------------- -+-------------
>> > +-------------+
>> >
>> > when i try to retrieve this data using TT i to put it in a hash , so
>> here
>> > is what my hash looks like :
>> >
>> > $VAR1 = [ { 'result' => { 'lvm' => 'LV Name /dev/VolGroup01/blinux1 VG
>> > Name VolGroup01 LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write
>> > Access read/write LV Status available # open 1 LV Size 50.00 GB Current
>> LE
>> > 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently
>> > set to 256 Block device 253:8 ', } } ];
>> >
>> >
>> > ultimately it it gets displayed without the new-line character :
>> >
>> > LV Name /dev/VolGroup01/blinux1 VG Name VolGroup01 LV UUID
>> > iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write Access read/write LV
>> Status
>> > available # open 1 LV Size 50.00 GB Current LE 12800 Segments 1
>> Allocation
>> > inherit Read ahead sectors auto - currently set to 256 Block device
>> 253:8
>> >
>> >
>> > is there a way i can display on my browser with a new-line or <br/>
>> >
>>
>> First of all, make sure you avoid HTML-injection/cross-site-scripting
>> (XSS)
>> attacks:
>>
>> http://community.livejournal.com/shlomif_tech/35301.html
>>
>> Then you can use something like:
>>
>> $s =~ s{\n}{
}g;
>>
>> to put line breaks in the HTML.
>>
>> Regards,
>>
>> Shlomi Fish
>>
>> --
>> ------------------------------------------------------------ -----
>> Shlomi Fish http://www.shlomifish.org/
>> Optimising Code for Speed - http://shlom.in/optimise
>>
>> We have nothing to fear but fear itself. Fear has nothing to fear but
>> XSLT.
>>
>> Please reply to list if it's a mailing list post - http://shlom.in/reply.
>>
>
>
> awesome!! it works
>
> i had to do some thing like this !!
>
> my $select_dom0_data = $DBH->selectall_hashref("select
> dom0_name,cpu,lvm,ram,ip,application,assigned_to from dom0_info where
> dom0_name='$dom0_server' and rid=$rack_n",'dom0_name' );
>
> $select_dom0_data->{$dom0_server}{lvm} =~ s{\n}{
}g; ;
>
>
>
the new line character substitution with <br/> seem to have worked , but i
also want to substitute \t+ or \t with
$select_dom0_data->{$dom0_server}{lvm} =~ s{\n}{
}g;
$select_dom0_data->{$dom0_server}{lvm} =~ s{\t}{ }g;
the whole formating goes for a toss and the new line substitution dont work
..
any ideas .
> --
>
Regards
Agnello D'souza
--20cf303f6d58c2a09704a45232fe--
Re: displaying data from mysql onto browser in correct format ..(using template toolkit )
--000e0cd350f83e09e604a453cd15
Content-Type: text/plain; charset=ISO-8859-1
On Sat, May 28, 2011 at 2:24 PM, Agnello George <agnello.dsouza [at] gmail.com>wrote:
>
>
> On Fri, May 27, 2011 at 6:21 PM, Agnello George <agnello.dsouza [at] gmail.com>wrote:
>
>>
>>
>> On Fri, May 27, 2011 at 6:05 PM, Shlomi Fish <shlomif [at] iglu.org.il> wrote:
>>
>>> On Friday 27 May 2011 13:48:21 Agnello George wrote:
>>> > Hi
>>> >
>>> > I am using TT to display my data from my db ,
>>> >
>>> >
>>> > i insert the following data from a Front end using ( <textarea> )
>>> into
>>> > my database the data is like this in mysql :
>>> >
>>> >
>>> ------------------------------------------------------------ ---------------
>>> > -----------+------+---------------+-------------+----------- --+ LV Name
>>> > /dev/VolGroup01/zeeweblinux1
>>> > VG Name VolGroup01
>>> > LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF
>>> > LV Write Access read/write
>>> > LV Status available
>>> > # open 1
>>> > LV Size 50.00 GB
>>> > Current LE 12800
>>> > Segments 1
>>> > Allocation inherit
>>> > Read ahead sectors auto
>>> > - currently set to 256
>>> > Block device 253:8
>>> >
>>> +-----------+------+---------------------------------------- ---------------
>>> >
>>> ------------------------------------------------------------ ---------------
>>> >
>>> ------------------------------------------------------------ ---------------
>>> >
>>> ------------------------------------------------------------ ---------------
>>> >
>>> ------------------------------------------------------------ ---------------
>>> >
>>> ------------------------------------------------------------ ---------------
>>> >
>>> --------------------------------------+------+-------------- -+-------------
>>> > +-------------+
>>> >
>>> > when i try to retrieve this data using TT i to put it in a hash , so
>>> here
>>> > is what my hash looks like :
>>> >
>>> > $VAR1 = [ { 'result' => { 'lvm' => 'LV Name /dev/VolGroup01/blinux1 VG
>>> > Name VolGroup01 LV UUID iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write
>>> > Access read/write LV Status available # open 1 LV Size 50.00 GB Current
>>> LE
>>> > 12800 Segments 1 Allocation inherit Read ahead sectors auto - currently
>>> > set to 256 Block device 253:8 ', } } ];
>>> >
>>> >
>>> > ultimately it it gets displayed without the new-line character :
>>> >
>>> > LV Name /dev/VolGroup01/blinux1 VG Name VolGroup01 LV UUID
>>> > iqj9g1-qzfQ-IHyc-Ebov-CKNb-NIYQ-dZKBXF LV Write Access read/write LV
>>> Status
>>> > available # open 1 LV Size 50.00 GB Current LE 12800 Segments 1
>>> Allocation
>>> > inherit Read ahead sectors auto - currently set to 256 Block device
>>> 253:8
>>> >
>>> >
>>> > is there a way i can display on my browser with a new-line or <br/>
>>> >
>>>
>>> First of all, make sure you avoid HTML-injection/cross-site-scripting
>>> (XSS)
>>> attacks:
>>>
>>> http://community.livejournal.com/shlomif_tech/35301.html
>>>
>>> Then you can use something like:
>>>
>>> $s =~ s{\n}{
}g;
>>>
>>> to put line breaks in the HTML.
>>>
>>> Regards,
>>>
>>> Shlomi Fish
>>>
>>> --
>>> ------------------------------------------------------------ -----
>>> Shlomi Fish http://www.shlomifish.org/
>>> Optimising Code for Speed - http://shlom.in/optimise
>>>
>>> We have nothing to fear but fear itself. Fear has nothing to fear but
>>> XSLT.
>>>
>>> Please reply to list if it's a mailing list post - http://shlom.in/reply.
>>>
>>
>>
>> awesome!! it works
>>
>> i had to do some thing like this !!
>>
>> my $select_dom0_data = $DBH->selectall_hashref("select
>> dom0_name,cpu,lvm,ram,ip,application,assigned_to from dom0_info where
>> dom0_name='$dom0_server' and rid=$rack_n",'dom0_name' );
>>
>> $select_dom0_data->{$dom0_server}{lvm} =~ s{\n}{
}g; ;
>>
>>
>>
>
>
>
> the new line character substitution with <br/> seem to have worked , but
> i also want to substitute \t+ or \t with
>
> $select_dom0_data->{$dom0_server}{lvm} =~ s{\n}{
}g;
> $select_dom0_data->{$dom0_server}{lvm} =~ s{\t}{ }g;
>
> the whole formating goes for a toss and the new line substitution dont work
> .
>
> any ideas .
>
>
>
>> --
>>
> Regards
> Agnello D'souza
>
>
>
great !! i used tinymce in my insert form that solved all my html alignment
problem :)
--
Regards
Agnello D'souza
--000e0cd350f83e09e604a453cd15--
Re: displaying data from mysql onto browser in correct format .. (using template toolkit )
From: "Agnello George" <agnello.dsouza [at] gmail.com>
> great !! i used tinymce in my insert form that solved all my html =
alignment
> problem :)
It would be much great if you wouldn't quote more than 140 lines of =
previous messages just to answer a single line... :-)
Octavian
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Re: displaying data from mysql onto browser in correct format ..(using template toolkit )
--001517592fa0a3cab304a46df56b
Content-Type: text/plain; charset=ISO-8859-1
>
> This interpolation of string variables into an SQL statement is an SQL
> injection attack waiting to happen:
>
> * http://en.wikipedia.org/wiki/SQL_injection
>
> * http://community.livejournal.com/shlomif_tech/35301.html
>
> * http://bobby-tables.com/
>
> Please avoid it by using placeholders.
>
how can i have place holder when i am trying to get a hashref ..
$select_hashref = $DBH->selectall_hashref(" select * from mytable where
username=$name ") ;
i can not use a the <<?>> place holder here can i .. ?/
> --
>
Regards
Agnello D'souza
--001517592fa0a3cab304a46df56b--
Re: displaying data from mysql onto browser in correct format .. (using template toolkit )
From: "Agnello George" <agnello.dsouza [at] gmail.com>
> >
>> This interpolation of string variables into an SQL statement is an =
SQL
>> injection attack waiting to happen:
>>
>> * http://en.wikipedia.org/wiki/SQL_injection
>>
>> * http://community.livejournal.com/shlomif_tech/35301.html
>>
>> * http://bobby-tables.com/
>>
>> Please avoid it by using placeholders.
>>
>
>
> how can i have place holder when i am trying to get a hashref ..
> $select_hashref =3D $DBH->selectall_hashref(" select * from mytable =
where
> username=3D$name ") ;
>
> i can not use a the <<?>> place holder here can i .. ?/
>
Hi,
From perldoc DBI about selectall_hashref:
"This utility method combines "prepare", "execute" and =
"fetchall_hashref"
into a single call. It returns a reference to a hash..."
Use prepare, execute and fetchall_hashref and you will be able to do the =
same thing and also use placeholders.
read:
perldoc DBI
Octavian
--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/