Saturday, April 26, 2008

FreeBSD Tip: How to delete all IPv6 address in an interface

You can delete all IPv6 addresses in an interface using the following command (vanilla Bourne shell):

while i="`ifconfig le0 | grep inet6 | grep -m 1 -v '%'`"; do
ifconfig le0 $i delete
done
Note: replace le0 with your interface name.

Friday, April 25, 2008

Bridge problem with FreeBSD 7.0-RELEASE

Problem
The FreeBSD Handbook states that "if the bridge host needs an IP address, then the correct place to set this is on the bridge interface itself rather than one of the member interfaces."

With FreeBSD 6.x and FreeBSD 8.0-CURRENT, setting the IP address on the bridge works without any problem. With FreeBSD 7.0-RELEASE, however, this does not work. The OS doesn't even properly boot when the IP address is set via /etc/rc.conf.

Solution
This is probably a temporary solution, but try setting the IP address to one of the member interface. This is in direct opposition to the advice given in the Handbook, but it works for me.

If this is a bug (which I suspect it is), a patch probably exists somewhere. Please feel free to leave a comment.

Friday, April 18, 2008

JPEG support for ImageMagick

Problem
On Debian Linux, there seems to be no out-of-the-box support for JPEG in ImageMagick.

Solution
First, install libjpeg62-dev library. libjpeg62 doesn't work because it doesn't include the necessary development files. Next, download ImageMagick's source and compile it manually. Use ./configure --with-jpeg=yes for configuring.

Tuesday, April 08, 2008

OpenLaszlo IDEforLaszlo Eclipse plugin


Syte GMBH has provided an update for IDEforLaszlo plugin to support OpenLaszlo 4.0.10 and OpenLaszlo 3.4. IDEforLaszlo has been stale for quite some time now, and I'm glad that someone has offered their time and effort for this project. I'll be checking it out later.

IDEforLaszlo can be found at http://www.syte.ch/en/laszlo.xml.

Friday, April 04, 2008

Technical Humor

Yeesh, I found the links for the April 1 RFCs. Here's a dose of highly technical humor:
  • RFC 5241 — Naming Rights in IETF Protocols. A. Falk, S. Bradner.
  • RFC 5242 — A Generalized Unified Character Code: Western European and CJK Sections. J. Klensin, H. Alvestrand.
WARNING: Reading the above documents may result in nosebleed.

Tuesday, April 01, 2008

Morph eXchange

Our friends from Morph Labs has just launched version 2.0 of their Morph eXchange website. Congratulations, butterfly!

April 1, 2008 RFC

It's April 1 already, but I can't seem to find prank RFCs for this year...

Monday, March 31, 2008

IPv4/v6 Regular Expressions

I found these useful regexes in my notes. I probably found this somewhere on the Internet, but I forgot where.

IPv4 address

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$

IPv6 address

^[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}$

Note that this does not work with shortened form such as dead::beef. dead:0000:0000:0000:0000:0000:0000:beef must be used instead.

Thursday, March 20, 2008

dnsmasq: unknown interface xennet0

As of version 2.41, dnsmasq doesn't support Xen virtual network interfaces in NetBSD. This means that running dnsmasq inside a Xen domU results in the following error:

dnsmasq: unknown interface xennet0

Uberlord made a patch just a few moments ago:
- http://roy.marples.name/~roy/dnsmasq-netbsd.patch
- http://roy.marples.name/~roy/dnsmasq-bridge.patch

The beauty of Open Source... =)

Tuesday, March 18, 2008

Permission denied to call method XMLHttpRequest.open

Problem
When deploying DHTML OpenLaszlo applications in SOLO mode, attempts to fetch datasets results in the following error:

ERROR: uncaught exception: Permission denied to call method XMLHttpRequest.openLFCdhtml-debug.js (line 1421)
uncaught exception: Permission denied to call method XMLHttpRequest.open

Solution
As a security measure, most browsers restrict XMLHttpRequest such that they don't accept XML data if the HTTP response headers are not properly set. To fix this, simply change Content-Type to:
Content-Type: application/xml; charset=UTF-8

Monday, March 17, 2008

xen Error: Device 2050 (vbd) could not be connected. Backend device not found.

Problem
NetBSD dom0 is unable to launch more domUs. Attempting to launch more domUs results in the following error:
xen Error: Device 2050 (vbd) could not be connected. Backend device not found.
Solution
The system ran out of loop devices. Create more vnode disks using the following command:
/dev/MAKEDEV vnd1
/dev/MAKEDEV vnd2
...and so on

Friday, March 14, 2008

__LZgetNodes: p is null in Datapath

I'm creating an IPv4/IPv6 OpenLaszlo widget that can bind to a datapath. I spent hours trying to find out why this.datapath.getNodeText() doesn't work inside <handler name="oninit">, although it works fine inside <method>. I kept getting an error of "p is null in Datapath."

For developers experiencing a similar problem, you might want to check out Laszlonia's entry on his blog. It turns out that I simply had to use <handler name="ondata">.

Tuesday, March 11, 2008

map methods execute*() methods in Agavi

Agavi is architecturally beautiful. I can really appreciate the way they designed this thing. One fundamental problem with this framework, however, is that it lacks good documentation. You need to read the code, or ask others who already did, for you to answer some very simple questions.

In my case, I was looking for a way to change the HTTP verb mappings with AgaviWebRequest methods.

Agavi maps executeCreate() with HTTP PUT and executeWrite() with HTTP POST. If I use these functions in the context of REST architecture, it makes more sense if they are mapped the other way around. Although I understand that there is no single way to implement REST, there seems to be a general agreement that update operations should be mapped to HTTP PUT while create operations should be mapped to HTTP POST.

Fortunately, Agavi provides a simple (undocumented) way to change the mappings. In config/factories.xml, simply add:
              <request class="AgaviWebRequest">
<parameter name="method_names">
<parameter name="POST">create<parameter>
<parameter name="GET">read<parameter>
<parameter name="PUT">write<parameter>
<parameter name="DELETE">delete<parameter>
<parameter>
<request>
Thanks to the crazy guy, MikeSeth. =)

Friday, March 07, 2008

confused on implementing REST using HTTP PUT

I'm implementing a REST web service using PHP5 right now. I'm a bit confused on how to implement a write operation using HTTP PUT verb.

In PHP, data that are sent via HTTP POST are in the following format:
variable1=data&variable2=data
The data is immediately available via $_POST. Data that is sent via HTTP PUT is uploaded as a file to the server and must be parsed before reading. There's nothing wrong with it per se, except that writing data is inconsistent. There's no problem requiring my REST clients to upload a file using HTTP PUT, except that it's inconsistent.

So far, I used curl for testing my web app. I haven't tried sending data via <form> using a web browser, and I don't know whether <form method="put"> works. If it does, then the browser would probably send the data similar to POST's format, with only a different header (UPDATE - 2008/03/11: yepp, it indeed works that way). Blah, possibilities, possibilities.

I'm using Agavi framework, by the way. It's a kick-ass lightweight framework. Agavi is beautiful, but the documentation is sparse. Documentation effort is underway, and I hope to see more of it in the coming weeks. Without it, Agavi is considered "fringe" at the moment (I like fringe software; I even use fringe operating systems such as *BSD hehe).

cvsmode in csup

Nice, there are now patches for CVSMode support in csup: http://people.freebsd.org/~lulf/patches/csup/cvsmode/. This means that csup can now fetch complete CVS repositories. Thank you Ulf, whoever you are!

Tuesday, February 26, 2008

pfSense 1.2



It's official! pfSense 1.2 has now been released.

pfSense is a free, open source customized distribution of FreeBSD tailored for use as a firewall and router. In addition to being a powerful, flexible firewalling and routing platform, it includes a long list of related features and a package system allowing further expandability without adding bloat and potential security vulnerabilities to the base distribution. pfSense is a popular project with more than 1 million downloads since its inception, and proven in countless installations ranging from small home networks protecting a PC and an Xbox to large corporations, universities and other organizations protecting thousands of network devices.

This project started in 2004 as a fork of the m0n0wall project, but focused towards full PC installations rather than the embedded hardware focus of m0n0wall.

Tuesday, February 19, 2008

Live DVD for Linux Games

I'm currently researching for information on how to build BSD systems that are small enough to fit inside a CF card with enough space left for user data. This is for an embedded application project that would magically transform packets through some magical incantation.

As I was googling, however, I came across a Linux project for Linux games. The project is live.linuX-gamers.net, "a collection of games [that would run directly] from DVD without the user in need to know about Linux or care about his system." Its motto is "boot 'n play."

Very cool. I might try it some time.

Wednesday, February 13, 2008

Xen on NetBSD amd64

I'm trying to install Xen hypervisor on our amd64 box with NetBSD-4.0. I'm getting a couple of errors on getting it to run. The friendly folks at #netbsd told me that I either need to use i386 kernel or use the bleeding edge NetBSD-CURRENT. They suggested that I setup a wiki page to document my progress. I've created an account at http://wiki.netbsd.se/ and I'll see how it goes. I hope this small contribution would benefit others who need to use Xen/NetBSD on x86_64 hardware.

UPDATE: Here's the wiki page-- http://wiki.netbsd.se/Xen_3.1_on_x86_64

Saturday, February 02, 2008

NetBSD 4.0

Okidoki, I finally had time to install NetBSD 4.0. As expected, NetBSD was able to support a box with ICH9 chipset. Impressive. I was about to assign almost 250GB to my / partition (I hate having to assign fixed space among multiple partitions, and I don't find dangerously-dedicated partitions particularly dangerous anyway), but I've stumbled upon an online discussion stating that Xen has some issues with a large root partition (yeah, yeah... I often find myself stumbling upon something that I wasn't looking for pretty lately. I seem to have this thing with serendipity). It also has a few issues on non FFSv1-formatted partitions as well. Oh well, I guess I just have to take their word for it. The box is humming steadily as it downloads the necessary packages.