Dropbox Saves the Day!

So I’m super into keeping my files organized via directory structure. For example, as much as I like the sorting capabilities of iTunes, I dislike that it sorts based on artist in the actual directory structure, meaning all of my awesome mix CDs are structurally compromised and split apart when importing, unless I make a playlist out of them. Which only works if I’m using iTunes.

Anyhow, like every other person with a photo-capable phone out there, I take photos with it. I want an easy way to import, but still a simple directory dump. I use photos on sites, and so I’m also frequently grabbing files and moving them out of said directory(ies). I also wanted organization, so one day in the vague past I decided to eschew whatever native plugin my iPhone was dumping all of my photos in, and find something a bit better. So I went for Picasa. Which worked fine for awhile, but either it’s convoluted or I didn’t take enough time to understand how it functions, because I would inevitably download photos I’d already downloaded, and they’d be stored in mysterious locations. At some point later (perhaps around the time the amorphous Google entity absorbed them) I stopped being able to smoothly move around the interface. It just…changed. Like some googlebeast invaded my directories and started munching on them, so photos I thought I’d deleted long ago started appearing again.

Anyhow, I became disenfranchised with Picasa.

I’ve had a Dropbox account for awhile now, but aside from using it to grab a bunch of old PSDs of art off my Windows machine, I’ve mostly left it alone. Well, it became sentient. At some point during the Picasa fiasco, when I connected my phone to my computer, Dropbox just randomly started grabbing all of the photos off of my phone. I never enabled anything. I didn’t even open anything when connecting my phone, Dropbox just did it. And, this is normally the sort of behaviour that irks me when an application develops a mind of it’s own and starts doing something I’d never asked it to do. However, in this case, I was already disgruntled about my Picasa situation, and often put off grabbing photos off of my phone because of it. But, no more! Dropbox just grabs them and unceremoniously dumps them into a single directory – automatically organized as each photo is already named based on the date of photo took anyhow. So, Dropbox is both sentient and  telepathic. You have been warned.

 

How to create multiple local websites on a Mac Mini with Lion Server

Lion Server comes with a basic web service with a default site. So you get that up and running, and you’re all wanting to use your Lion Server as a testing environment for several local sites, not just a single site (i.e with virtual hosts) . It was a bit of a pain for me to get that set up. Googling around to figure out how to do it resulted in me finding bunches of people complaining about how Snow Leopard was better for such things. I eventually figured it out, though, and pieced the instructions together here:

1.) Move your directory (or create a new directory) in:
[Hard Drive]/Library/Server/Web/Data/Sites/

2.) Add the site to the Server application under Services -> Web. For settings I used:

Domain Name: myurl.local
IP Address: Any
Port: 80
SSL: none (I’m sure you can stick this in later)
Store Site Files In: Find your directory from #1

I just left everything else as default.

3.) In a terminal, edit /etc/apache2/httpd.conf
sudo vi /etc/apache2/httpd.conf will open the file in Vi with write access
Edit this file and add this: NameVirtualHost *:80

4.) Navigate to: /etc/apache2/sites/ (cd /etc/apache2/sites/)
Look for a file ending in [newurl].local.conf
Edit this file and add this: NameVirtualHost *:80

5.) Edit the /etc/hosts file and add this to the list of hosts:
127.0.0.1 myurl.local

6.) Restart the web service using these commands:
sudo serveradmin stop web
sudo serveradmin start web

7.) Open a browser and navigate to newsite.local, and (in theory at least) the site should load!

YMMV on these instructions – I started in at the point where the default local site was already set up and working, so I’d make sure that’s all good before jumping in. Also, I’m still not completely sure if #4 negates the need for doing #3. So, feel free to try this while skipping #3, in case I totally stuck in a redundant step.

Anyhow, this worked for me. My next steps are getting MySQL installed and running, and then getting GIT up and running. I’ve been storing locally for way too long, and am looking forward to getting a nice central repository for myself and others to check things out from.

I scanned the QR code on my banana and got a link farm

I wasn’t really expecting to find a QR code on my banana in the first place. I had a strong impulse to ignore it and stick to my original plan of just eating the banana. But no! The QR code got scanned. And took me to…http://www.fruits.com/recipes.aspx

Which is a horrible waste of a QR code. First off, I was convinced that it was a link farm. That giant Del Monte logo on the top of the page, along with the top navigation? You don’t see it from your iPhone, because it’s in Flash. It doesn’t even *do* anything interesting, aside from a hover change (easily done with basic CSS), so it’s not like there’s a good argument for using Flash for it. And, argument or not, there should be *something* there besides blank space. It’s not that hard to  add in alternate content for non Flash enabled browsers, and you’d think that would have crossed someone’s mind when putting together this bizarre QR campaign.

Also, super generic. At least take me to a page for banana recipes? Also, since QR codes are generally scanned from phones, how about a page that actually looks good on a phone?

This is why hardly anyone scans QR codes. I bet there’s some really awesome uses of QR codes out there, but they will all fail horribly thanks to everyone getting burned on pointless ones like this!

 

On a completely unrelated note, I updated the theme on this site! Decided that the dark background was pretty crappy for readability, and I’ve been wanting something responsive for a bit. So, yay? Pretty generic at the moment, might try to tweak it when I acquire both the time and ambition to do so.

 

 

Making responsive navigation with selects work on Drupal 7 with Omega theme, plus tinynav.js

Oh holy crap. So I just spent several hours trying to find the teeny error that would make my dropdowns work. Finally found it, and am celebrating with this post.

So, let’s say you’re building a site in Drupal 7, and you’re using the Omega theme as you want a fairly easy and intuitive way to make your website responsive. Wide horizontal menus are a pain in the patootie on tiny screens, so you’re thinking “Hey! I can make my menu a sweet form select instead for the mobile view!” There’s no Drupal module to do this (yet, at least. I’m half tempted to figure out how to = build one myself at this point), so you go check out tinynav.js, which is a tiny sweet js that’ll get your nav all nice and selected in no time. Basically, it’ll look at whatever html list you tell it to, and make a version that’s a “<select>” tag with each “<option>” as a menu item. Then, you hide this on wider screens, and hide the list nav on your smallest screen width.

Installing it’s not too bad – just save tinynav.js to wherever you’re keeping your theme’s js files. Then, add code to whatever script file you’re using for all of your custom javascript. Your code’ll look a lot like mine, I bet!

scripts!

You’ll want to make sure your tinynav.js is loaded into your library file. To do this, you’ll need to first open your theme’s info file and add in the details for tinynav there. Might look something like this:

info file

So after this, you need to enable the file. Using your admin toolbar, go to Settings -> Themes ->Whateverthehellyourthemeiscalled and click the “Toggle Libraries” tab. You should see whatever you decided to call your file sitting there with a checkbox beside it. If you don’t see it, go clear your cache, stat! Anyhow, enable it once you see it.

You’d think this would be enough. But no, there’s more! I eventually figured a few things out, through trial and error.

First off, Drupal 7 has jQuery 1.4.4, which is apparently a bit too old to get tinynav.js to work. So, I grabbed a copy of jQuery 1.7 min, and added that in in much the same way I added tinynav.js (save to your js file, then add to the js library via the .info file for your theme – setting the weight higher so 1.7 comes first. Then, enabling it in your theme’s settings). As an aside, this totally might not be kosher at all, using two different versions of jQuery and all. But, it works? So I’m gonna go with it until a better idea comes along.

At some point I thought I needed modernizr.js as well, due to it being in the tinynav.js demo. But alas, I was misled, and ended up uninstalling it.

In conclusion, javascript is a big ole pain. However, I have working mobile nav now, so I don’t care. Woo?

 

 

 

 

How I got around a WordPress code injection

A friend recently had her WordPress site hacked. Viewing the source code revealed a <div style=”display: none;”></div> tag in the header, with a bunch of spammy links within that div. I took a look at both the code and the database, but as I haven’t had much experience in looking for injection (and the Google research I did was less helpful than it could have been) I didn’t really find much. There might have been some sort of SQL injection somewhere, which inserted javascript such that it always displayed in those divs. The links would change on page refresh, and every once in awhile there were no links, just that div tag, so my assumption is javascript.

As I mentioned, I never found a way to actually remove the script itself, since I couldn’t find the script. But, I did surgically remove the script from the template, as it were. Pretty basic, actually, once I narrowed things down a bit. I just went into the part of her template setup that was generating the page headers, and found wp_head in that code. Rather than having it print the entire thing, I exploded wp_head, splitting it at the “<div” and “</div>” tags. There’s no legitimate reason any plugin would stick div tags in a header, so it’s unlikely there’d ever be more than that one set in there. Now, the template prints everything before the “<div” and after the “</div>”, but nothing in-between, thus removing that injected code from the front-end display of her site.

I also gave her some advice on how to make her WordPress install a bit secure. Unfortunately, whatever that code is is still in her install somewhere. I’m crossing my fingers that all it’s capable of doing is grabbing spammy links, so hopefully there won’t be any more troubles with her site in the future.

403 errors and SSL Certificates using IIS7 on Windows 2008

Through the will of the gods, I somehow ended up as a client’s sysadmin for their Windows Server. Their site had an SSL certificate that I managed to get installed. However, there were a few folks that kept getting these pesky 403 errors when they tried to view any page with the SSL certificate in https. Specific systems, too – mostly on Windows behind some kinda firewall.

As, despite what I’m doing, I am no Windows sysadmin, I was at a loss for what the heck was going on, and ended up harassing Network Solutions about it. Turns out we needed an upgraded certificate, as some older systems would not recognize the discount (or “Xpress”, if grammatically incorrect branding is your thing) certificate. So we got a sweeter one, and installed it. Yet, the errors persisted.

The big problem for me was that I could not replicate the error. All seemed fine in Virginia’s Internet Land. Most of the issues were coming from Australians (which sent me down a brief and incorrect path of thinking it was a freaky cookie issue, something I dealt with before with timezones and a SSO about half a year back). Anyhow, “403” is pretty generic. So, I went into the IIS manager dealio and set the 403 errors so that non-local browsers would get a detailed view. And, got someone who was actually getting the error to send me a screenshot. Turned out it was, in fact, a 403.13 error. Something about IIS trying to find a revoked certificae list and failing. And, apparently, if you’re looking at the site from behind a firewall with proxies, this’ll fling 403 errors all up on your junk and such.

Cause, I revoked that initial “Xpress” certificate when I added the new one. Anyhow, apparently the solution was to turn off the option in Windows 2008 that checks for a revoked certificate list (CertCheckMode). Course, there was no easy way to do it, I had to get all down and dirty in the Registry for that bastard. Boo! Anyhow, that fixed the situation, so all is good in the land of SSL certificates.

Whereupon I Complain About Apartments

Or rather, I’ll complain about my specific apartment. It’s not a bad apartment, mind you. The location is really great – I walk to work, any pretty much anywhere I want to get to in downtown Denver is a short walk away (or a short walk to the free MallRide bus) and I’ve got close access to I-25 as well as the Cherry Creek bike trail. The apartment itself is nice as well – lots of closet space and a decent sized kitchen. My few complaints are that there’s no balcony, I don’t get any direct sunlight (and little breeze), and my cellphone only works sporadically. OK, that last one is kind of a big deal, but I’ve been dealing with it semi-ok.

When I first looked at the apartment, the price was a bit steep for me, but they were having a “first month free” special, which they could spread over the course of my lease. That made the rent $830/mo, which is ok considering the area and apartment. I was also told that, when I renewed, I’d get whatever special they were doing at the time, and it was pretty likely they’d still be doing the “first month free” special.

Fast-forward to a month ago. I get the renewal notice on my door. They’re asking $963/mo. I go ask the office if they’re still doing the “first month special.” Nope, no specials. I turn in my notice to vacate and let them know it’s because of the apartment getting too expensive. The office person let me know that they’re keeping pace with similar rent rises in the area, and she’d let me know if management decided to reinstate the discount. I would have been surprised if there wasn’t a rent increase, to be honest, but $130/mo was just a little too much for me. It’s not like I spend a huge amount of time at home anyhow, so I figured I could downgrade a bit so I’m not blowing all of my paycheck on housing.

Of course, then I start looking around at other apartments. I can get decent to better apartments at a comparable price. So, I’m pretty happy about that (am going to start viewing some soon). I was curious as to if my apartment was listed on my complex’s website yet, so I checked. And it was – listed for $863 or so (i.e. $100 less then they wanted me to pay to renew). I was half tempted to go talk to the office and see what was going on, since that was a price increase I’d be fine with, but I was kinda annoyed they didn’t even contact me before listing it, given the sharp increase was the reason I wanted to leave in the first place. That, and I pay my bills on time and never bug them – wouldn’t it be cheaper for them to just keep me rather than have to clean the place and find a new tenant anyhow? But, that whole “cellphone not working” thing held me back. And, I might actually get a balcony.

So, this weekend I got a notice on my door for “refer someone to us and get $300 if they get a place here!” Being curious, I went and checked out their website again. My apartment is now listed for $803. $30 less than what I’m currently paying. Not only that, but, counting current and upcoming vacancies, they have over 50 apartments listed as available. It’s an 18 story building, mind you, but that’s still a huge number of vacancies, especially considering that, when I first moved here, I think they have 10 at most listed.

I was briefly tempted again to stop by the office. $30 cheaper isn’t a bad deal, if I could convince them to dismiss my vacancy notice. But then I had to consider the fact that I’m pretty sure management was taken over by drunk howler monkeys. It’s like they want to go out of business. I see no logic in their ways! Which makes me feel a bit sketch about staying here, to be honest. That, and I kinda miss having a cell phone that actually works when I’m at home.

 

Sudo lets me edit all kinds of nutty things!

Still learning how to do as many things as possible from the command line here, am writing this down for future reference for myself. If I try to edit a file, and I’m all like “vi filename” and I do my edits and am all like “:w”, and it’s all like “no, you need to use a !” to save! And so then I’m all like “:w!” and it’s all like “E212: Can’t open file for editing.” That’s when I need to edit that sucker as root. Which means I shoulda typed in “sudo vi filename” and then my password, and then I can edit that file like no one’s business!

Using the jQuery clone() method with a lightbox

So I’m using Flexslider, which is a jQuery slideshow with some great touch capabilities. However, it only displays one slide at a time, so I hacked at it until I got it to display 3. Of course, only later did I realize that someone already forked it on Github like 2 months ago and did this before me, oops. Anyhow, Flexslider uses the clone() method to pad out slides at the end of the slideshow, and, with the modified script, these cloned slides get displayed.

So I’m using Lightbox (the Lightbox2 module for Drupal 6, to be specific) and it’s not liking those cloned slides. Nope, not at all. Doesn’t work. Have no clue why, and couldn’t really find anyone else with that problem on the internets. What I did figure out, though, is when you call clone, if you call it with the parameter of true: clone(true). And that seems to work, as my cloned slides now open in lightboxes. So, yay!

Some things to get done next year

So I was waiting in the airport last week and decided to write up a list of all of the things I wanted to get done next year. And, here’s that list:

  • Finish 2011 NaNo CYOA novel (or finish first draft of 2009 NaNo adventure/maybe sci-fi novel)
  • Translate Quest into Spanish
  • Somehow convince more people to buy Quest (Hey! I wrote a CYOA YA light fantasy, called Quest for the Fountain of Life! It’s only $1.99 for Kindle!)
  • Continue food blogging at a minimum of once a week
  • Get WordPress responsive design theme and customize it with the tastyniblets.com look/branding.
  • Use probably the same theme for ptocheia.net (maybe trash current layout as it’s rather dismal, might just use a theme default)
  • Pull data from blogs and news sites onto rapidsthuglife.com. Maybe an auto-filled scoreboard?
  • Execute my fabulous idea for a MLP:FiM/Last Supper watercolor painting.
  • Do something with my pointless Tumblr account. Wait, I’ve got an account under my handle. But I can’t figure out what the login is. I used all of my email addresses trying to do “lost password”, too. Hmm, when did Tumblr start? Maybe I registered an account under an email I don’t use anymore? Hmm. Or something else janked my handle. Time to beat someone, then.
  • Do a work blog post at least once a month (I’ve seriously got like 20 topics in a .doc, I just don’t have the time to write anything.)
  • Revamp varoper.com (hmm Drupal 7? Good chance to learn Rails?)
  • Get a decent piano or keyboard (with alll the keys). Actually use it.
  • Go to gym 2-3x a week.
  • Go skiiing and snowboard this winter.
  • Build a CYOA module for Drupal 7.
  • Get more involved in local Drupal community.
  • Finish my stupid pile of sewing projects.
  • Grow some freaking tomatoes or something.
  • Repot my aloe and kiwi cactus

Unrelated (well, completely related), I do have a New Year’s resolution: get more sleep.