elfs: (Default)

Wow, talk about a niche market ready for exploitation.

I was talking a client today, and my first question to her was the first question I try to get most of my clients to answer: “If you don’t do this, if you don’t spend the money and the time, what’s the worst that could happen?”

“The worst that could happen is that I keep getting dumped on by my tech-savvy members who know we can do better. The site is awful.” And, to be fair, she’s right: it’s done with Front Page 1999, and it looks it: Frames, 256-color palette, poor tiling of the background for wide-screen monitors, no content management.

I’m still debating between putting them on Joomla and Wordpress. Or MediaWiki, but I’m not a sadist. While I like Joomla, it’s probably more than they need, but Wordpress is less. And learning how to make a Joomla template, like a Wordpress theme or a MediaWiki skin, would be a heck of a saleable asset.

That said, 99.99% of Joomla templates are just re-arrangement of the standard layouts with art, and the art is simple to modify in-line after you’ve found a freebie that comes close.

I spent the day looking through the various websites of various labor unions and brotherhoods and so forth, and y’know what?  They’re all tragic. Not just my client’s (and she admits that her site is tragic), but all of them.   This is a niche market just the same way that election websites are a niche market: get the images and the art right, and you could sell themes to just about anyone.  And generally, unions– at least those not currently pressing a strike– tend to have some money.

One thing that gets my attention, though, is that a lot of these people keep their sites in-house.  They’d rather run it on their IIS server than trust a third party hosting solution.  Which means that I’d better get used to using the WAMP or XAMPP stacks.

This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com
elfs: (Default)

One very rare problem that hits some people with Drupal is that it hangs on installation, and never gets anywhere.  Using Firebug, I was able to track the problem down to jQuery, then ripped out the minimized copy of jQuery, stuck in a full copy, and re-ran the install, which immediately revealed the bug.

Drupal was attempting to access a URL that is not sandboxed (in the list of legal URLs for its own site) using Javascript.  Javascript limits (”sandboxes”) URLs to prevent cross-site exploits, and in this case Drupal was attempting to access an IP-based URL on a different port.

There are two interrelated problems.  First, access on the IP rather than the host name.  Firefox can’t tell those are the same address and sandboxes them apart from one another.  Attempting to access one from the other is a security violation.  Second, access on a different port: that was caused by Nginx as a front-end to the Apache box.  Drupal is relying on Apache’s “ServerName” setting, and it shouldn’t.

If you’re having this problem and you’re developing on the same box you’re browsing from,  stop and then restart Apache.  If you see this message: apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName, that’s your problem.  Use the IP address rather than any locally assigned hostnames for the Drupal install.

Secondly, if you’re using Nginx or any other reverse proxy, go around it.  Use the IP address of the Apache install directly, not the reverse proxy’s front end.

I hope this helps someone out there.

This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com
elfs: (Default)

I’ve been helping a close friend with her website, which is written in rails. She admits that’s a mistake, now, because it shares database tables with a PHP application, and the communication between the two has always less than stellar. I’ve been looking into her current major problem, but while I’ve been at it, I’ve been looking for easy solutions to put her back on an all-PHP track. (This seems to be the right thing to do; PHP is the only language she knows well, and the PHP component is the only thing that works reliably.)

I looked at Symfony as an easy PHP-based route off the rails.  It’s not bad, but getting it to run on my box was a nightmare. Undocumented are the number of things with which PHP must be configured to get Symfony running. For the record, to get the sandbox application to run, you need not just the stock PHP, but PHP with PDO, SimpleXML, and SQLLite. None of those are stock on Gentoo (and apparently not on Ubuntu, either).  Once I had rebuilt PHP (3 times!), it was all working.

But now it’s up and I can play with it. Oh, and I got Drupal running, but I had to use my production box to make it so. Annoying, that.

This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com
elfs: (Default)

I was reading through the Wordpress source code, trying to figure out a problem for a contractor, when I saw the function compact().  When I saw it I boggled, read the description, and shook my head.

Compact() takes a list of variable names as strings, and returns a hash of those variable names and their values.   So if you have something like:

$title = "My blog";
$link = "foo";
$h = compact('title', 'link');

You get back a hash of array(’title’ => ‘My blog’, ‘link’ => ‘foo’).

That, to my thinking, is completely messed up.  You’re giving this function, which has its own scope, explicit permission to twiddle with variables in the current scope and create a new variable.  It’s one of those things that convinces me that PHP is an unholy mess of silliness.

And then my brain reminded me that, hey, you can do the exact same thing in python.  So, I have:

import inspect
def compact(*args):
    return dict([(i, inspect.currentframe().f_back.f_locals.get(i, None))
                 for i in args])

def foo():
    a = "blargh"
    b = "bleah"
    c = ['1', '2', '3']
    return compact('a', 'b', 'c')

print foo()

And sure enough, this spits out: {’a': ‘blargh’, ‘c’: ['1', '2', '3'], ‘b’: ‘bleah’}

I hang my head in shame for giving Django developers one more thing around which they can develop bad habits.

This entry was automatically cross-posted from Elf's technical journal, ElfSternberg.com

Profile

elfs: (Default)
Elf Sternberg

June 2025

S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 5th, 2025 09:02 am
Powered by Dreamwidth Studios