Plain Old Webserver Help and Hints

Announce and Discuss the Latest Theme and Extension Releases.
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Post by dakellog »

Philip Chee wrote:
Cannikin wrote:* It seems like if you have certain syntax errors (I was playing around, adding a new .prototype method for the Array object), the server just won't serve anything anymore, even valid pages like your welcome screen. Nothing brings it back short of closing and reopening Firefox. Is this just a limitation of trying to do server side javascript inside of Firefox, or do you think you can do something on your end to catch these kinds of errors and let us know?
Well don't add new methods to the Array prototype. Mostly because it causes problems with extensions - including POW as you noticed.

Phil


The usual problem is function name collision. I have gone through great lengths to namespace everything as "pow_ ...". With prototype, you have to go through every single function name and compare them to pow functions and variables. The other thing to do is to check the Error Console, then the YOUR_FF_PROFILE/pow/log/error.txt file for more errors. The third is you computer console itself. On the Mac, it is called Console. In Linux, the command line can be viewed. On Windows, I can't help you.

Good luck and post when you port it.

Dave
---
DKPHD
User avatar
Philip Chee
Posts: 6475
Joined: March 1st, 2005, 3:03 pm
Contact:

Post by Philip Chee »

http://blog.metawrap.com/blog/WhyIDontUseThePrototypejsJavaScriptLibrary.aspx
What I and many many others have discovered is that using the prototype object on the Array and Object inbuilt types increases the chances that your code will conflict with existing or external code. It makes your code not play well with others, so once you start using prototype.js, you have to keep using prototype's paradigm because by extending Array and Object via the prototype object it secretly modifies some of JavaScripts default behavior.

http://abcdefu.wordpress.com/2006/12/27/prototypejs/
Some issues that I have noticed with prototype.js is that it alters the for in loop and as a result, when I include prototype.js, my older files not built using this library throw errors

http://www.robsanheim.com/?p=148
James McParlane wrote a entry detailing why he won’t use the Prototype library, as extending Object or Array’s builtin prototype is bad.

Phil
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Re: Use of pow_exec

Post by dakellog »

tdhombre wrote:I am trying to use the pow_exec to call a perl script (which works with an empty 2nd parameter) passing an "array of argumennts" in the second parameter of the call. I am unable to get this to work. Can anyone provide a code snippet showing a working implementation of pow_exec? Here is what I am trying:

var abcde= new Array();
abcde = pow_server.REQUEST;
pow_exec("runme","abcde"); // call a script and pass the array of variables
var contents = pow_file("./results.txt"); // read results file into variable
document.writeln("file: " + contents); // output variable to document content

The sjs and "runme" scripts run without error but I can not get any parameters to pass into the perl script. The perl script writes the "results.txt" file read in by the sjs script.

Suggestions??


I pass the second argument directly through to XPCOM layer. It should be an array, such as var a = new Array(); a[0] = 'abc'; pow_exec("runme", a);

This just worked for me with a bash script.
---
DKPHD
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Re: setTimeout() or sleep() ?

Post by dakellog »

pivo wrote:Is it possible to wait a certain amount of time in sjs, so that data is produced in chunks with a delay in between? That's important to debug incremental rendering and complex javascripts.


No. Sorry. This is a single threaded server with a TCP queue. There is no wait() function in JS, because JS is not multi-threaded. The only way I can think of is a nasty, long, empty loop.

Dave
---
DKPHD
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Post by dakellog »

brettz9 wrote:I have one more thought. If SSL could be supported, this would seem to offer the very interesting possibility of allowing a peer-to-peer proxy (which would be unencumbered by blocked public proxies) and with a minimum of setup hassle (just install an extension--heck, maybe it could even be added to the Firefox trunk (though turned off by default), in order to avoid the extension site being blckd). This would be very important for some folks living in certain places.



thanks,
Brett


I have searched in vain for a while to support SSL. You can give it a shot.

As for XML, I'm not a huge fan, but you are welcome to write a POW module. All of the tools are available in XPCOM.
---
DKPHD
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Re: Halp?

Post by dakellog »

Dinjaga wrote:I've set it up, and everything works fine on my computer, but other people can't access it! My infinilink doesn't work...I have the startup.sjs document and everything, it still doesnt work! I downloaded it, made a helloworld.sjs document, made the system folder and the startup.sjs document. What else do I need to do?

208.63.114.185
My IP.



I'm behind a firewall at work, and no one should get to my server. It appears you have this setup. If your ISP does not allow servers, you have to talk to them.

Dave
---
DKPHD
TM68
Posts: 28
Joined: February 3rd, 2006, 7:46 pm

Post by TM68 »

I have put POW on a laptop for my brother to use to prove to a customer that his computer is not the problem when the customers ISP is down for some reason.

It works very nicely except that I can not get the websites served up by it to show jpeg images.

I can point Firefox to the file that POW is serving and the images show.

Is there something obvious that I am missing?

I used HTTrack Website Copier to obtain two different working sites and the same thing happens with both.

Does POW just not work with images?

Thanks in advance.
Windows XP Pro, Firefox 3.0 RC1,Thunderbird 2.0.0.14
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Post by dakellog »

TM68 wrote:I have put POW on a laptop for my brother to use to prove to a customer that his computer is not the problem when the customers ISP is down for some reason.

It works very nicely except that I can not get the websites served up by it to show jpeg images.

I can point Firefox to the file that POW is serving and the images show.

Is there something obvious that I am missing?

I used HTTrack Website Copier to obtain two different working sites and the same thing happens with both.

Does POW just not work with images?

Thanks in advance.


Not the version you are using. POW 0.1.1 had this problem. It is fixed in the upcoming 0.1.2. It should be out in a couple of days.

Dave
---
DKPHD
TM68
Posts: 28
Joined: February 3rd, 2006, 7:46 pm

Post by TM68 »

Thanks for the response. I see from the guys on the Google group for POW that most of them were having this problem using Windows XP.

The laptop that I am running it on is running Windows 2000.

I went to the Mozilla add-ons site to look for the 0.1.2 version. Of course, it isn't there yet. I assumed that it must be stuck in their new sandbox system so I jumped through all the hoops to get access to the sandbox. It is not their either, but of course, I just may not understand how to access it over their.

If the new version has been submitted to AMO but doesn't show up in the next day or so, could you put a link for a direct download over on the Google group?

Thanks again. I really do like this extension even though I do not fully understand how to use most of it yet.
Windows XP Pro, Firefox 3.0 RC1,Thunderbird 2.0.0.14
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Post by dakellog »

Here is the 0.1.2 preview version.

http://davidkellogg.com/pub/pow.xpi

My updates are faster coming online than at the addons site. The addons version is good, because that is the software that has been thoroughly reviewed by many eyes.

The real version is marked as "pending" in the Mozilla queue. I never checked the sandbox. I think now I should.

Dave
---
DKPHD
TM68
Posts: 28
Joined: February 3rd, 2006, 7:46 pm

Post by TM68 »

Thank you!

I uninstalled the old version and installed this one.

Now my web sites show in all their glory with pictures.

The way that I am using this is to provide working websites for my brother to connect up to new systems that he sells to users who do not understand that ISPs do have outages.

One customer in particular tends to start clicking on everything and re-installing windows etc until he gets his system so messed up that it won't run.

He then blames my brother for selling him a bad computer and starts talking about replacing it with a lesser computer from Dell.

By connecting this laptop running POW with good websites accessible from his computer, he will be given a way to know that his computer is indeed working and hopefully will not begin the often repeated process off thoroughly destroying the Windows installation on his computer before calling my brother.

Thank you again.
Windows XP Pro, Firefox 3.0 RC1,Thunderbird 2.0.0.14
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Post by dakellog »

I love this story. He might be interested in the standalone POW based on XULRunner. It's such USB fun, it's wonderful.

Here's the server on a stick.

http://davidkellogg.com/blog/2007/06/05 ... n-a-stick/
---
DKPHD
rssist
Posts: 1
Joined: June 28th, 2007, 11:23 am

hlp please

Post by rssist »

hi
i've just installed pow and it functions in the local network, but if i click the InfiniLink i get <a href="http://img403.imageshack.us/img403/5890/screenshot2xr4.png">THIS</a>.

i have a home network with 2computers (win + linux) bridged with a TP-Link 8841 Router.

it's the first time i try to start a web server so i need some help... :eyeroll2:

<i>(ps:: i didn' cancel the ip in the picture because i've a dinamic ip)</i>
Error 401: Too long signature.
dakellog
Posts: 33
Joined: July 31st, 2006, 12:06 pm

Re: hlp please

Post by dakellog »

rssist wrote:hi
i've just installed pow and it functions in the local network, but if i click the InfiniLink i get <a href="http://img403.imageshack.us/img403/5890/screenshot2xr4.png">THIS</a>.

i have a home network with 2computers (win + linux) bridged with a TP-Link 8841 Router.

it's the first time i try to start a web server so i need some help... :eyeroll2:

<i>(ps:: i didn' cancel the ip in the picture because i've a dinamic ip)</i>


On your router, you need to set up port forwarding to forward 9970 traffic to "192.168.1.100" or the like.

You might try ipchicken.com to see what others see in your machine.

It appears you set up the infinilink feature at some time. That means you modified startup.sjs. The confusing part is that you have a Cooleris preview error. Maybe you could uninstall Cooleris for a moment to see if that helps.
---
DKPHD
bmix
Posts: 37
Joined: November 19th, 2005, 3:59 pm
Location: Budapest/Hungary
Contact:

Post by bmix »

I would LOVE to see this being implemented in Webrunner. Just imagine.... :-D
Andreas
Post Reply