July 11, 2008 at 12:45 am
· Filed under Development
Version 0.7 of the Firefox slideshow extension is now up. Compatible with Firefox up to 3.0.1 RC (and a few versions thereafter) and capable of displaying image attachments on certain online forums, the latest version can be found on my projects page.
Permalink
March 22, 2007 at 10:53 pm
· Filed under Development
I upgraded the Firefox slideshow extension to support better duplicate link checking. You can download the new version at my Projects page.
Permalink
March 22, 2007 at 1:11 pm
· Filed under Development
Getting JWChat to work with OpenFire is difficult without some customization. Here’s a step-by-step guide to how I got it working with Apache running on Linux:
- Make sure Apache is running - The computer I was using had Apache 2 installed but Apache 1 configuration files, preventing Apache from starting. Since I didn’t have any site data to lose, copying the default Apache 2 configuration file worked fine.
- Make sure OpenFire is running - This seems pretty obvious since you need a Jabber server to connect to.
- Edit /etc/httpd/conf/httpd.conf - If you don’t have a <VirtualHost> section for your site, you’ll have to make one; <VirtualHost *> works just fine for a single site server. The following JWChat configuration lines need to be added inside the <VirtualHost> block that you’ll be setting JWChat up in:
<Directory /var/www/html>
Option +Multiviews
</Directory>
AddDefaultChatset UTF-8
ProxyPass /http-bind/ http://127.0.0.1:8080/http-bind/
- Extract JWChat - Download JWChat from the project site and extract it into your website directory. I moved the files to
/var/www/html/, but you may want to place it elsewhere, so update any paths to match your set-up.
- Edit /var/www/html/config.js - JWChat needs to be configured to connect to your OpenFire server. Make the following changes:
- Change SITENAME to reflect the server name that OpenFire is configured to host for.
- Comment out the existing backends in BACKENDS and add your own. You can provide your own name and description, but these must be same:
httpbase:"http-bind/"
type:"binding"
servers_allowed:[SITENAME]
- Edit OpenFire properties - Log into OpenFire as an administrator and add two server properties:
xmpp.httpbind.client.requests.polling = 0
xmpp.httpbind.client.requests.wait = 10
These are required because of a bug where JWChat won’t respect the polling values given to it by the server.
- Restart Apache - Run
apachectl graceful to restart Apache gracefully and load the new configuration.
At this point, when you visit your site, you should see a JWChat login screen. The username is without the @domain suffix.
Permalink
February 17, 2007 at 9:53 am
· Filed under Development
Cygwin is my preferred development environment for C/C++ programs at the moment, but I don’t want to create executables or libraries which depend on cygwin1.dll, forcing me to release my programs under the GPL and requiring distribution of an extra DLL. To compile libcurl without Cygwin dependencies, use the following configure line:
./configure \
--build=mingw32 \
CPPFLAGS="-mno-cygwin" \
LDFLAGS="-mno-cygwin"
I’m also a stickler for only building exactly what you need, and since I plan on using libcurl for static linking, I want the library to be as small as possible. Here are my configuration options for generating a small library:
./configure \
--disable-ftp \
--disable-file \
--disable-ldap \
--disable-dict \
--disable-telnet \
--disable-tftp \
--disable-manual \
--disable-ares \
--disable-verbose \
--disable-sspi \
--disable-debug \
--disable-crypto-auth \
--disable-cookies \
--without-ssl \
--without-libssh2 \
LDFLAGS="-Os -s"
One drawback to this approach is having to manually edit the resulting curl-config script to remove -Os -s so it doesn’t forcefully optimize a project depending on libcurl.
Note that neither of these compile lines will work in the standard Windows command-prompt without removing the backslashes and new-lines. If you combine the two options, that makes:
./configure \
--build=mingw32 \
--disable-ftp \
--disable-file \
--disable-ldap \
--disable-dict \
--disable-telnet \
--disable-tftp \
--disable-manual \
--disable-ares \
--disable-verbose \
--disable-sspi \
--disable-debug \
--disable-crypto-auth \
--disable-cookies \
--without-ssl \
--without-libssh2 \
CPPFLAGS="-mno-cygwin" \
LDFLAGS="-mno-cygwin -Os -s"
That results in a 12.6 MB library suitable for static linking and without dependencies on Cygwin. Unfortunately, that seems rather large, considering a 90 KB library can be created according to the “Reducing Size” section of the curl install guide.
Permalink
October 24, 2006 at 8:25 pm
· Filed under Development
I updated my slideshow extension to work with Firefox 2.0. If you’re curious, crack it open (it’s only a ZIP file renamed to an XPI file) to check the changelog. I’ve posted it on my projects page; while you’re there, check out some of the other work I’ve done. For those of you who are impatient, you can download it directly.
Permalink
August 30, 2006 at 10:23 pm
· Filed under Development
I like programming in Java. Java has a lot of features that make programming with it very pleasant. For instance, it has a very well documented API and the same code can run on many different operating systems with only small modifications. One feature that I only recently learned about is anonymous inner classes. Once I discovered this feature, it quickly became invaluable. Being able to define a new class, without naming it, anywhere in code allows tight encapsulation of functionality as well as keeping relevant sections of code together. As an example, to handle events generated by pressing a button control in AWT or Swing, I can define an anonymous class right in the method call! This may sound lazy, but this feature allows inner classes to have access to private data that ordinary classes wouldn’t. In the example, my anonymous inner class would have access to any local data, like parameters passed to the method I’m defining the class in.
Now, focus on C++. Its many advantages over Java include small executable size and high-speed code. One feature sorely lacking, though, is the style of anonymous inner classes that Java supports. In C++, in order for an inner class to access the private data of an outer class, the inner class must be a friend of the outer class. In order to be a friend, it must be named, therefore, anonymous inner classes in C++ have severely restricted functionality. As I write this, it feels that, without garbage collection support built into the language, this feature isn’t possible. In C++, local data is deallocated as soon as it goes out of scope unless you allocate it from the heap (either using *alloc or new), and memory allocated from the heap is never automatically deallocated, so supporting this feature without memory management would cause memory leaks. Even so, when working on Aldahar, many situations have come up where I’ve wished for this feature to make coding much simpler.
Permalink
August 21, 2006 at 11:38 pm
· Filed under Development
I updated my Firefox slideshow plugin to eliminate consecutive duplicate links from the list so you won’t see exactly the same image twice in a row. Download the new version.
Permalink
June 6, 2006 at 1:41 pm
· Filed under Ubuntu
A default install of Ubuntu 5.06 might come up with these errors when compiling glibc 2.4:
mawk: scripts/gen-sorted.awk: line 19: regular expression compile failed (bad class -- [], [^] or [)
mawk: scripts/gen-sorted.awk: line 19: syntax error at or near ]
mawk: scripts/gen-sorted.awk: line 19: runaway regular expression /, “”, subd …
It turns out that mawk, the AWK interpreter that comes installed on Ubuntu by default, isn’t supported by glibc. To fix this, open up Synaptic (System, Administration, Synaptic Package Manager) and install the gawk package in the Interpreted Computer Languages section. Afterwards, you’ll need to reconfigure glibc before compiling it again so it knows to use gawk instead of mawk. As a side note, make sure you always use the latest release version of packages; trying to compile glibc 2.3.6 won’t work on Ubuntu 5.06.
Permalink
April 11, 2006 at 10:07 am
· Filed under Development
Python is a glorious language; a decent amount of documentation (not as much as PHP and Java, but far more than any other language) plus a great library of built-in functions (easy GUI library built-in!) make programming in Python fun. The only headache I’ve discovered thus far is distribution. There are a few projects that exist which are designed to package all your python source code and necessary library files (DLLs on Windows, SOs on Unix/Linux) so you can distribute a folder containing all you need to run the program. Unfortunately, this turns a 2 KB PY file into a 2 MB distribution folder. I know that a lot is required to run a Python program, but this kind of ballooning can be discouraging.
One project, PyInstaller, seems to be able to package all the files together into a single executable and manages to keep the number of imported libraries down to those you actually use. I haven’t tested it on non-Windows, but it took a rudimentary chat-server I wrote and made a stand-alone executable out of it, which ran fine. I also haven’t tested the executable on a computer without Python installed to make sure it doesn’t have any dependencies. PyInstaller is a continuation of a similar installer written by Gordon McMillan whose website seems to have disappeared.
If this works out, I may be able to re-write some of my other useful applications in Python and make them easier to maintain and distribute.
Permalink
March 18, 2006 at 11:14 pm
· Filed under Development
For a long time, I never thought before throwing an image into a webpage. I know all the rules about not using images for spacing or layout, but no one ever warned me about using them for buttons or headers. Then I started working on a website where I wanted the non-CSS version to look nice for text/mobile browsers, and I discovered that images really screw things up without layout. I googled for placing images using CSS only, and I discovered image replacement. In CSS3, you’d be able to do something like this:
<h1 style="content: url(header.jpg);">Header</h1>
Unfortunetly, no browser implements CSS3, so a little hacking is in order. The nicest solution I came up with looks like this:
<h1>Header</h1>
h1
{
background: url(header.jpg) no-repeat;
overflow: hidden;
padding-top: 45px;
width: 186px;
/* WIN IE5 hack */
height: 133px;
voice-family: "\"}\"";
voice-family:inherit;
height: 0;
}
The trick is to pad the top of the box as the size of the image, then hide the overflowing text. As you can see, it requires some hacks to work in IE5, but to anyone who does web development, this should be no surprise. A cool benefit of this is the ability to add a title attribute to the h1 tag, which replicates the alt information you’d normally stick with an img tag. Thanks to Dave Shea for the information.
Permalink