Handling xml script responses in http_server.pl

View: New views
7 Messages — Rating Filter:   Alert me  

Handling xml script responses in http_server.pl

by Kai-37 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I am currently experimenting with some Ajax stuff and need to deliver  
xml content back to the browser through a perl script (using the "/
SUB;subroutine()" calls). I noticed that regardless of the content,  
the script response header always contains "text/html" as a mime-type,  
but for xml content it should be "text/xml" instead.

I have created a small patch for fixing this, which you will find  
attached to this e-mail. It would be great if somebody could review it  
and - if it looks alright - commit it to svn.

Cheers,
Kai

P.S.: I also noticed that the favicon.ico is always sent as mime-type  
"text/html" - I have changed this to "image/gif" in the patch as well.







------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


http_server.pl.patch (1K) Download Attachment

Re: Handling xml script responses in http_server.pl

by David Norwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Done.

Now, would you do me a favor and test the ajax examples i committed to svn a
few days ago?  I haven't heard from anyone that they actually work.

David

----- Original Message -----
From: "Kai Kreuzer" <temp1@...>
To: "The main list for the MisterHouse home automation program"
<misterhouse-users@...>
Sent: Thursday, September 03, 2009 1:54 PM
Subject: [mh] Handling xml script responses in http_server.pl


> Hi all,
>
> I am currently experimenting with some Ajax stuff and need to deliver
> xml content back to the browser through a perl script (using the "/
> SUB;subroutine()" calls). I noticed that regardless of the content,
> the script response header always contains "text/html" as a mime-type,
> but for xml content it should be "text/xml" instead.
>
> I have created a small patch for fixing this, which you will find
> attached to this e-mail. It would be great if somebody could review it
> and - if it looks alright - commit it to svn.
>
> Cheers,
> Kai
>
> P.S.: I also noticed that the favicon.ico is always sent as mime-type
> "text/html" - I have changed this to "image/gif" in the patch as well.
>
>


--------------------------------------------------------------------------------


>
>
>
>


--------------------------------------------------------------------------------


> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july


--------------------------------------------------------------------------------


> ________________________________________________________
> To unsubscribe from this list, go to:
> http://sourceforge.net/mail/?group_id=1365
>
>



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Handling xml script responses in http_server.pl

by Kai-37 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi David,

Thanks a lot for the commit!

Sorry that I didn't yet look into the details of your ajax work yet; I  
was so far only dealing myself with the iphone UI and had my XML  
problem there with the used framework.

I have now briefly tested your examples - as I do not have set up a  
weather hash, I only looked at example 3. And yes, I can confirm that  
it works very well with my KNX/EIB installation. I hope that you can  
merge this work with the stuff that Mike Pieper has done already as  
well, this might be a great foundation for a fancy new mh UI ( and I  
would love to see this kind of automatic updates in the iphone UI one  
day as well - I will help working towards this goal!)

Regards,
Kai


Am 04.09.2009 um 05:41 schrieb David Norwood:

Done.

Now, would you do me a favor and test the ajax examples i committed to  
svn a
few days ago?  I haven't heard from anyone that they actually work.

David

----- Original Message -----
From: "Kai Kreuzer" <temp1@...>
To: "The main list for the MisterHouse home automation program"
<misterhouse-users@...>
Sent: Thursday, September 03, 2009 1:54 PM
Subject: [mh] Handling xml script responses in http_server.pl


> Hi all,
>
> I am currently experimenting with some Ajax stuff and need to deliver
> xml content back to the browser through a perl script (using the "/
> SUB;subroutine()" calls). I noticed that regardless of the content,
> the script response header always contains "text/html" as a mime-type,
> but for xml content it should be "text/xml" instead.
>
> I have created a small patch for fixing this, which you will find
> attached to this e-mail. It would be great if somebody could review it
> and - if it looks alright - commit it to svn.
>
> Cheers,
> Kai
>
> P.S.: I also noticed that the favicon.ico is always sent as mime-type
> "text/html" - I have changed this to "image/gif" in the patch as well.
>
>


--------------------------------------------------------------------------------


>
>
>
>


--------------------------------------------------------------------------------


> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july


--------------------------------------------------------------------------------


> ________________________________________________________
> To unsubscribe from this list, go to:
> http://sourceforge.net/mail/?group_id=1365
>
>



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
30-Day
trial. Simplify your report design, integration and deployment - and  
focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Two Serial Ports for ibuttons

by Brad Yarotsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there anything special that I need to setup to get my Misterhouse (on
Windows) scripts to use both serial port connectors? I have two serial
adapters for my ibuttons because I am going in two different directions.

I have defined both serial ports in the config:
iButton_serial_port=com1
iButton_2_serial_port=com3  (this is actually on a USB adapter)

When I ask Misterhouse to list all of the ibutton devices it pops up two
windows with the devices listed on each adapter.

But my scripts will only talk to the primary com port (iButton_serial_port).

If I reverse com1 and com3 in the mh.private.ini then the opposite list of
devices are now used. But unable to use both lists at the same time.

Any suggestions?

Thanks Brad

By the way, I finally got my DS2408 boards running in Misterhouse thanks to
Anders Sandell.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Handling xml script responses in http_server.pl

by David Norwood-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you for testing my example.  It's good to hear it is working for you.
I'm slowly going through Mike's code trying to figure out how to make it
more generalized.  I think it will be useful to use the long poll technique
for all types of data, not just item states.  Mike's code works well, but it
only works for one specific item status page.  I would like to see Ajax
technology used for things like the status bar, print and error logs,
display calls, and photo slideshows.  Any place the current web interface
does refreshes.   I have already updated the xml server to only output when
items change state.

I would also like to see a common JavaScript file developed for misterhouse
that all of these web applications share.  As you may have realized I have
no idea what I'm doing, so any input you and others may have is appreciated.

David

----- Original Message -----
From: "Kai Kreuzer" <temp1@...>
To: "The main list for the MisterHouse home automation program"
<misterhouse-users@...>
Sent: Saturday, September 05, 2009 11:02 AM
Subject: Re: [mh] Handling xml script responses in http_server.pl


> Hi David,
>
> Thanks a lot for the commit!
>
> Sorry that I didn't yet look into the details of your ajax work yet; I
> was so far only dealing myself with the iphone UI and had my XML
> problem there with the used framework.
>
> I have now briefly tested your examples - as I do not have set up a
> weather hash, I only looked at example 3. And yes, I can confirm that
> it works very well with my KNX/EIB installation. I hope that you can
> merge this work with the stuff that Mike Pieper has done already as
> well, this might be a great foundation for a fancy new mh UI ( and I
> would love to see this kind of automatic updates in the iphone UI one
> day as well - I will help working towards this goal!)
>
> Regards,
> Kai
>
>
> Am 04.09.2009 um 05:41 schrieb David Norwood:
>
> Done.
>
> Now, would you do me a favor and test the ajax examples i committed to
> svn a
> few days ago?  I haven't heard from anyone that they actually work.
>
> David
>
> ----- Original Message -----
> From: "Kai Kreuzer" <temp1@...>
> To: "The main list for the MisterHouse home automation program"
> <misterhouse-users@...>
> Sent: Thursday, September 03, 2009 1:54 PM
> Subject: [mh] Handling xml script responses in http_server.pl
>
>
>> Hi all,
>>
>> I am currently experimenting with some Ajax stuff and need to deliver
>> xml content back to the browser through a perl script (using the "/
>> SUB;subroutine()" calls). I noticed that regardless of the content,
>> the script response header always contains "text/html" as a mime-type,
>> but for xml content it should be "text/xml" instead.
>>
>> I have created a small patch for fixing this, which you will find
>> attached to this e-mail. It would be great if somebody could review it
>> and - if it looks alright - commit it to svn.
>>
>> Cheers,
>> Kai
>>
>> P.S.: I also noticed that the favicon.ico is always sent as mime-type
>> "text/html" - I have changed this to "image/gif" in the patch as well.
>>
>>
>
>
> --------------------------------------------------------------------------------
>
>
>>
>>
>>
>>
>
>
> --------------------------------------------------------------------------------
>
>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and
>> focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>
>
> --------------------------------------------------------------------------------
>
>
>> ________________________________________________________
>> To unsubscribe from this list, go to:
>> http://sourceforge.net/mail/?group_id=1365
>>
>>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ________________________________________________________
> To unsubscribe from this list, go to:
> http://sourceforge.net/mail/?group_id=1365
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ________________________________________________________
> To unsubscribe from this list, go to:
> http://sourceforge.net/mail/?group_id=1365
>



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Handling xml script responses in http_server.pl

by Mike Pieper :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 5 Sep 2009 17:40:43 -0700, "David Norwood" <dnorwood2@...>
wrote:
> ...  I think it will be useful to use the long poll technique
> for all types of data, not just item states.  Mike's code works well, but
> it only works for one specific item status page.
Do you have an idea how to monitor the other types of data? Perhaps there
is some perl magic to detect changes easily.

My code doesn't work for only "_one_ specific item status page". Only in
the current application with GD where only a page is generated it works
like this. On misterhouse side many monitoring objects can exists parallel.
If you use frames every frame can have its own update loop.
I also have some javascript code which works as an update service on the
web client side. You can give the item name, the current state and a
callback function (listener) to it. Everytime the item state changes the
callback function is called. Monitored items can be deleted and added
everytime.

If someone has an idea how to let calls to xml_server or to SOAP open after
"handling" them, I would change the interface to support it. The current
interface is not very nice.
The interface should be extended to have the object type. Then the monitor
object could use different ways to detect changes. For instance we could
say that changes to the e.g. weather hash are checked only every 10
seconds. But item changes, which can be detected event driven, are handled
immediately.

I will rewrite your ajax examples to use this javascript update service.
Currently I have other things to do. I think in one week I'll have time for
it.

Mike



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365


Re: Two Serial Ports for ibuttons

by Brad Yarotsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry, I answered my own question. Helps if you read the manual...

$ib_temp1  = new iButton '1000000029a14f', $config_parms{iButton_2_serial_port};


Thanks
Brad


> Is there anything special that I need to setup to get my Misterhouse (on
> Windows) scripts to use both serial port connectors? I have two serial
> adapters for my ibuttons because I am going in two different directions.
>
> I have defined both serial ports in the config:
> iButton_serial_port=com1
> iButton_2_serial_port=com3  (this is actually on a USB adapter)
>
> When I ask Misterhouse to list all of the ibutton devices it pops up two
> windows with the devices listed on each adapter.
>
> But my scripts will only talk to the primary com port (iButton_serial_port).
>
> If I reverse com1 and com3 in the mh.private.ini then the opposite list of
> devices are now used. But unable to use both lists at the same time.
>
> Any suggestions?
>
> Thanks Brad
>
> By the way, I finally got my DS2408 boards running in Misterhouse thanks to
> Anders Sandell.
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ________________________________________________________
> To unsubscribe from this list, go to:
> http://sourceforge.net/mail/?group_id=1365
>
>



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
________________________________________________________
To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365