February 4, 2012

jQuery Selector Magic

swings jQuery Selector MagicI’ve been working on a Drupal module to automatically make CSS-styled drop-down menus from the built-in menuing system. That’s been going great, and I’m really enjoying Drupal’s modular architecture and theming abilities. However, I ran into a little problem which was solved just perfectly by an elegant bit of jQuery Javascript.

What I wanted to do was to mark a list active if any of its children were active. That’s a common design request. “Make this tab active if the current page is one of that tab’s children.” However, I’d written the menu routines recursively, and it just isn’t worth it to me to rewrite them to add this one little feature.

[Read more...]

CSSEdit is my friend

kungfu CSSEdit is my friendDeveloping sites for clients involves a lot of heavy CSS work for me. I’d been using Aquamacs, an Emacs editor for OSX. That was good, but I don’t care for any of the CSS modes available. I moved to TextMate, which was much better, but still very much a code, reload, code, reload cycle.

That gets very slow, especially when developing using something like Drupal which isn’t very speedy to begin with.

[Read more...]

Taxonomy Theme, how I love thee

love hands Taxonomy Theme, how I love theeI’m building a new Drupal 5 site for a client, and I was dreading the hack-work I was going to have to do to make it look like what the designer had come up with. There are at least five distinct page templates in the crazy thing!

I love working with a designer, since then I don’t have to make all the choices, but sometimes it can lead to tons of work. It certainly has in this case. Most Drupal sites have just one template for a reason, but this one needed several, and they also needed to be maintainable and assignable after I was gone from the picture.

[Read more...]

Howto Reset The Admin Password in Django

I keep needing to do this, darn it! I leave a project for a few months, possibly push it live, and then I go back to fire up the dev server but I simply cannot remember the password I used for admin during development.

Why don’t I use my stupid-development-password? I don’t know, but this seems to happen with some regularity.

Luckily, it is trivial to fix with a few lines at the python commandline:

Deep:/opt/webapps/invisible bruce$ ./manage.py shell
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.2 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: from django.contrib.auth.models import User

In [2]: users = User.objects.all()

In [3]: users
Out[3]: [<User: admin>]

In [4]: users[0].set_password('whatever');

In [5]: users[0].save()

That’s it, fire up the dev server again and your new password will get you in.

[tags]django,python,commandline,auth,login,password[/tags]

Semitransparent rollovers made easy with JQuery

I’m continuing to enjoy working with jQuery. This article shows a simple method for enabling semi-transparent rollovers which actually work on IE 6. Yes, you could use a .gif file for a crude version, but many effects, especially “glowing” effects just look much better if you use a format which supports alpha channel transparency.

[Read more...]