12.10.07
Posted in POW at 9:07 pm by David Kellogg
From the why-not department, I server a Facebook app from Firefox. This opens up more fluid interaction between the browser and your friends on Facebook. In this case I produced a search engine for your local bookmarks. There is no reason why you can’t just start chatting through your profile page. Here’s how I did it.
Download the Plain Old Webserver.
You can grab the SJS code here.
I placed this code at htdocs/fb/postmarks/index.sjs in my POW server.
Maybe more interesting than the code is how I did it. I set up a similar search engine written in PHP, starting from Facebook’s mock AJAX application. I dumped Facebook’s query string to a file. I then replayed those parameters using curl to see the response. The parameter “mockfbmltext” appeared related to AJAX text. The rest of the application was just HTML. That makes things easy. On the Facebook side, they have the guts to proxy all of my content and re-write it. All javascript is scanned. The div tags are rewritten. Proxies and dynamic rewriting is slow, but it works.
Here’s the query string part of my code.
<?sjs
pow_highlight();
var textin = ““;
if(pow_server.GET[’mockfbmltext‘]) {
textin = pow_server.GET[’mockfbmltext‘];
} else if(pow_server.GET[’mockfbmltext‘] != undefined) {
document.write(”<font color=’red‘>Please enter a search</font>“);
pow_exit();
…
Here is the HTML.
<form>
<input name=”mockfbmltext” value=”” type=”text” size=”30“>
<br />
<input type=”submit”
clickrewriteurl=”http://davidkellogg.com/fb/portmarks/“
clickrewriteid=”preview” value=”Search bookmarks” />
<br />
<div id=”preview” style=”border-style: solid; border-color: black;
border-width: 1px; padding: 5px;“>
</div>
</form>
I signed up for a Facebook API key, then filled in the blanks. These are the values I used.
Application Name: Portmarks
App Server: http://davidkellogg.com/fb/portmarks/
Canvas Page URL: portmarks
Use FBML
Website
… added on Facebook?: Yes
Who can add…: Users, All Pages
Post add URL: http://davidkellogg.com/fb/portmarks/
Post-remove URL: http://davidkellogg.com/portmarks/
Default FBML: hello
Side Nav URL: http://apps.facebook.com/portmarks
If I have a bookmarks folder called “private”, those are hidden from Facebook users. If I have a “public” folder, those are the only ones shown. Once you change the code to point to your own server (CHANGE YOURSERVER.com to your IP), it should work.
My goal was to display public and private bookmarks in my Facebook profile. It was a nice proof of concept. It would be great to see even more interaction between the browser and Facebook.
Permalink
08.08.07
Posted in POW at 8:43 am by David Kellogg
If you already have POW installed on your browser, you can use this.
I created a secure proxy for POW. Mac and Linux users can now use a
personal secure server. Windows is not yet ready. Here’s how to
install it.
Download and install openssl.
Download spow.
tar zxvf spow.tgz
cd release/
# For PPC Mac users
./spow
# Or for all other *nix users
make clean
./configure
make
./spow
Go to https://localhost:6674/ in Firefox.
I included a test certificate. Generate your own certificates using
release/gen3/genkey.sh included in the source.
If you like the animation during the mouseover of the links above, visit Scrollovers.
Permalink
06.19.07
Posted in POW at 2:15 am by David Kellogg
Just four weeks after reaching 20,000 downloads we passed another myriad mark. Early this morning, the 30,000th download occurred.

It seems there are more than a few takers for this Javascript server.
Permalink
06.05.07
Posted in POW at 8:24 am by David Kellogg
After encouragement from Herb and Scott, I jumped straight into embedded heaven with my first USB-drive Pow server. I found a 2 GB USB drive for $17 at Microcenter next to the AMC theater. There’s no bubble packaging, no shiny skin. You just pull them out of a candy jar at the register. It’s slower than my hard drive, but no matter, it costs only .85 cents per MB.

To assure a truly hard-drive independent server, I needed to load the Moz Profiles directory, the /pow root directory and the server app itself onto the USB drive. In the application.ini file, I changed the executable variable from “xulrunner” to “xulrunner -profile /Volumes/FIREBRAND/Profiles”. I loaded a Windows and Mac version of Pow for use anywhere. I copied my prefs.js file, because the Mac XULRunner appears unable to save to this file.
Now that all of this is done, I have a beautiful server app worthy of taking on any library or lab computer. The best part is when I run the server, I can unplug the USB stick, but the server still runs. Now that is pure hacking glory.
Dave
Permalink
06.04.07
Posted in POW at 8:39 am by David Kellogg
Pow 0.1.3 is available.
This is one of the most important
releases yet. It gets better and better. It is also the smallest
download yet. What other software package gets smaller and better over
time? Here are my release notes.
This version adds stability and bug fixes.
* Standalone server support
* Firebug support
* Auto-restart of server after window close
* startup.sjs file auto-created for new installs
* Saving to subdirectory fixed
* Changed mime-types to binary by default
* Added many binary mime-types
* Added loopback-only option
* Fixed root directory problem
* Fixed XML download problem
* Smallest download size ever 99K -> 89K -> 73K -> 63K
The standalone server on port 6673 offers Firebug support through
Firefox. The Mac standalone version is at http://davidkellogg.com/pub/Pow%200.1.3.dmg
Scott can post the PC version address. Linux users can download
http://davidkellogg.com/pub/pow-xr.xpi and a nightly at
http://ftp.mozilla.org/pub/mozilla.org/xulrunner/nightly/latest-trunk/
and follow the instructions at http://developer.mozilla.org/en/docs/XULRunner_1.8.0.4_Release_Notes
Dave
Permalink
05.18.07
Posted in POW at 3:15 pm by David Kellogg
Sometime on Sunday, May 13, the 20,000th download of the Plain Old Webserver occurred. POW has come a long way since user zero. Now there is a vibrant user community that is helping to expand the reach of POW beyond the browser to stand-alone applications.
I knew I would use the extension at first, but I did not know POW would make it on dongles to serve quizzes to college students, or there would be a DB manager for it. It looks like my baby is growing up.
Dave
Permalink
04.30.07
Posted in POW at 4:11 pm by David Kellogg
POW 0.1.2 is available. It allows modules from developers to be loaded. Here’s how to create the “hello world” module.
hello.sjs:
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<?sjs
var a = Math.floor(Math.random()*2);
if(a < 1) {
document.writeln("¡Hola, mundo!");
} else {
document.writeln("Hello World!");
}
?>
</body>
</html>
hello.install.sjs
<html>
<head>
<title>Hello POW Module</title>
</head>
<body>
<script>
var pow_installer = {
version: "1.0.0",
name: "hello",
location: "http://localhost/~davidkellogg/xul/pow/modules/hello.zip"
};
</script>
<center>Downloading Pow Module will begin now.</center>
<br/>
If this does not happen, please go directly to <a href="hello.zip">hello.zip</a>.
Once completed please see <a href="http://localhost:6670/modules/hello/hello.sjs">Hello Mundo!</a>.
</body>
</html>
zip hello.zip hello.sjs
Place the hello.install.html file in the same directory as hello.zip.
That’s it!
A few extra notes:
1. Files ending in .install.sjs and .install.html both work as installers.
2. The installer Javascript is never executed by the chrome for security reasons, so formatting counts. Use the pow_installer formatting as shown.
3. File extensions are whitelisted (.js, .html, .sjs, .gif, .jpg, .png). All others must be copied manually. This is a security restriction.
4. Please document your module. We need to keep minimum standards.
5. Further restrictions on eval and file writes may occur. Both may result in security alerts or files that must be copied by hand.
Tell me if there any problems with your modules.
Dave
Permalink
04.23.07
Posted in POW at 4:37 pm by David Kellogg
POW (Plain Old Webserver) 0.1.1 preview is ready for review. Here are the fixes and features.
* Data/DB directory retrieval
* Fixed Windows DB bug
* Supports HTTP 1.1 “Transfer-Encoding: chunked”
* Changed scoping rules to persist only the pow_server object
The last part means that the following will no longer be possible.
Page 1:
var a = 5;
Page 2:
document.writeln(a); // ERROR: a is not defined
The following variable, though, will persist for as long as the server is running:
pow_server.a = 5; // Persists indefinitely
Dave
Permalink
04.20.07
Posted in POW at 8:57 am by David Kellogg
Wow. This is something I did not expect.
I somehow imagined people would download POW, use it for interesting, unanticipated projects and submit some patches.
What actually happened was much better. There is a great deal of interest from Russia. POW wiki pages were translated into Russian. Users ported their JS applications to POW. I will spend a while filtering through their aps to see how they work. Thanks to everyone for creating a community out of nothing. I think now I have to get back to work on scoping bugs/features.
Permalink
02.28.07
Posted in POW at 3:21 pm by David Kellogg
I created my first Thunderbird SJS app. This means I ran a server inside Thunderbird and ran a remote command. It’s a little tough going due to a lack of TB documentation, but exciting. Here it is.
test.sjs:
<?sjs
document.writeln("Hello world!");
var mess = Components.classes["@mozilla.org/messenger;1"].
getService(Components.interfaces.nsIMessenger);
mess.launchExternalURL ( "http://www.yahoo.com/" );
?>
Haven’t seen that page lately, huh? Load the page, http://localhost:6671/test.sjs to run this remotely on Thunderbird. Mind spinning yet? The reason to do these crazy things is to open up your email to yourself, remotely from anywhere, without a special client.
Dave
Permalink
« Previous entries