Monday, March 14, 2011

Image Script

I've been mentioning this on Twitter a bunch, but haven't actually posted about it.

I'm writing a JavaScript application that will let you easily browse through all the images in a directory on a web server.

I wrote this because I needed it.  The directory I've been saving images to on my server has been growing at a steady rate, and the default Apache-generated directory listing was too cumbersome of a way to browse it.

So far, it's been a ton of code all in one file, which is nice for drop-in installs but bad for organization.  I'm working on getting it ready to be migrated to a multi-file implementation, but I need to learn AJAX before I can actually do the migration.

I'll give a basic overview of its features here, since I do intend on releasing it into the wild at some point.

It has small navigation bars at the top and the bottom of the page.  They both have Previous and Next links for navigating through the images.  The one on top tells you the current file name and gives a link to the actual file.  The one on the bottom has a link that brings up the list of files so you can pick one to be displayed, since having just Previous and Next links is kind of limiting for navigation.

The majority of the browser window's space is reserved for the image itself.  The image is resized to fit within this space if necessary, and can be clicked to toggle between the full size image and the resized image.  When it's full size, scroll bars appear within the interface to allow you to scroll the image around, so that the navigation bars are always visible.

For a script I wrote out of sheer necessity that was intended to be a quick and dirty solution, it works surprisingly well, to the point that I feel motivated to keep working on it.

*restarts Firefox so that it won't use 100% CPU while I'm typing*

It works reasonably well cross-browser, with one gaping exception that I have no motivation whatsoever to fix: Internet Explorer.

Oh god dammit what the hell, Firefox is still using 100% CPU while I'm typing.

*restarts it again*

Seriously though.  Internet Explorer lacks support for some standard CSS (the opacity selector and position: fixed;) as well as standard JavaScript Document Object Model methods like addEventListener().  This script depends heavily on those things and since I have no clue how to implement workarounds for IE, the issue is closed as WONTFIX.  Use a better browser.

I've tested the script in two non-Firefox browsers, and it works flawlessly in Chromium, and almost flawlessly in Opera.  Opera has a weird issue where it will let JavaScript set all the cookies it wants, but won't let JavaScript read them back.  I can work around that by having the server get the cookie and send the value back in the page source.  It's ugly, but it'll work.

The other Opera issue is with the popup file list.  It insists on floating the element containing the image's dimensions to the right of the containing element, rather than agreeing with all the other browsers I've tested it in and floating it to the right of the link that closes the dialog and sets that image as the current one.  Since there's no space for it to float it where it's trying to, it wraps it down to the next line.  So essentially every image's dimensions show up on the line below the image.  This is fixable by using a table.  It's so ugly that nobody would hit it with an arbitrary number of crowbars with the lights off from behind with a bag over its head, but it'll work.

Chromium used to have an issue that I'd found and solved in Firefox, but due to differences in image loading behavior still existed in Chromium.  Namely, when Previous or Next were clicked, the currently displayed image would stretch or squish according to the dimensions of the new image.  I fixed it in Firefox by removing the src attribute from the img tag and re-adding it after changing the dimensions.  That seemed to work fine in Opera as well, but it still did it in Chromium.  So what's the Chromium fix, you ask?  Well, I'll tell you.  Remove the img tag altogether and insert another one into the DOM containing the width, height, and src attributes for the new image.  My guess is that Chromium doesn't want to display the next one until it's completely loaded, whereas the other browsers were fine with displaying an image while it was loading.

Since I hate writing browser detection code, which is never clean and is also easily circumvented by the very browser we're trying to detect, all of my browser-specific issue solutions have to work cross-browser.

I'm not going to provide a link to a demo of this script, because the only place it's running right now is on my server, which is on my home internet connection.  I don't really feel like giving my IP address out to total strangers.  Once the script becomes a lot closer to release quality I'll stick a demo up somewhere on the internet.  Sadly, "release quality" probably means I'll have to write a bunch of dirty hacks to make it work in IE.

The main post is done, but here are twothree random asides.

Aside #1: Even though Firefox is no longer using 100% CPU while I'm typing, it's still hovering around 30-40%.  What the hell is it doing?  It seems to be related to the Blogger post editor, as when I switch to other tabs the CPU usage goes away entirely.  After the second Firefox restart I also switched from the Blogger In Draft post editor back to the regular Blogger post editor.

Aside #2: While typing this, it came to my attention that Firefox doesn't have the word "resize" in its spell-checking dictionary by default.  What the hell?

Aside #3: The CPU usage has shot back up to 100% while I'm typing again, and it also happens while typing in HTML view.  What the hell?

Saturday, March 12, 2011

oh lol

I remembered that Wolfenstein 3D for the SNES supported the SNES mouse, so I fired that sucker up in ZSNES.  Turned out I already had a save state most of the way through the game.  The fun thing about it supporting the SNES mouse is, you can set your emulator's controls to standard FPS controls and then it's just like playing a really (really) pixellated FPS with grey "dogs" and no blood or Nazi armbands or German speech.

Yeah, the SNES version was a bastardization of it, but it's still an FPS, and it's still fun.

So basically if you set up your emulator like this:
  • Enable SNES mouse on port 2.  Mouse controls, just FYI:
    • Left click shoots
    • Right click moves forwards
    • Mouse X-axis turns
    • Mouse Y-axis moves forwards/backwards
  • Up: W (move forwards, scroll map up)
  • Down: S (move backwards, scroll map down)
  • L: A (strafe left)
  • R: D (strafe right)
  • A: Either E or Spacebar (opens doors, hits end-of-level levers)
  • Select: Left Ctrl (change weapons)
  • Start: Tab (bring up map)
  • Left: Z (turn left, scroll map left)
  • Right: X (turn right, scroll map right)
Then you'll have access to all the game's controls and can play it like a regular FPS.  Technically the game also uses the B button, but that's just another fire button.  The only thing weird about the controls is the mouse Y-axis moving you forwards and backwards.  I tried to use X-Mouse Button Control's axis-locking features to get around this, but even though I set a key for the toggle, it doesn't seem to lock the Y-axis when I press it.

Friday, March 11, 2011

Moar!

The next place I had to go was actual story: Tasnica's castle.  Apparently there was a spy or something.  I talked to their king, who turned out to not actually be their king, or was under mind control, or something.  I hear the boss music, and out comes a Dark Stalker.

Killed in three hits.

According to the FAQ I'm using to remind myself of where I have to go next when I start the game back up, it appears later as a regular enemy.

Anyway.

I got the sword's orb I was missing from that.  Hopped onto Flammie and went back to the mountains, where I had to see Sage Joch.  It was apparently time for a test of courage, which essentially meant a doppleganger fight.  Kicked the dopplegangers' asses and then flew back to Gold Isle to get the sword forged so I could level it up.  Then, where to?  Where else?  My favorite weapon levelling spot: Ice Country.

With the sword at level 6 on everyone, it became time to continue the story.  Serious shit went down too, the Empire raised a sunken continent that contains the Mana Fortress.  I managed to get the next elemental, but couldn't release the Mana Seed, so no level 8 elementals just yet.

The area beneath the Tree Palace, once raised, has a fairly long tunnel system containing a bunch of enemies with the dreaded rare drops of awesome equipment.  Being the RPG player I am, naturally I immediately want to farm the best stuff out of it.  Also, I've got a bunch of weapon orbs now that I might go back and get forged (and then grind out the levels on everyone).  Also, I should level up the last elemental to level 7 right now, so that once I get that final seed, I won't have to grind it all 8 levels in one go...

Progress Report

Guild Wars

I was right; the ability to have 7 heroes in your party makes a huge difference for the War in Kryta.  I still managed to use all 9 of the Powerstones of Courage I had, but that's because I had a low bullshit tolerance and was using them to get rid of partywide death penalty as soon as it was acquired.  The quest I was stuck on, A Little Help From Above, turned out to be a rather large difficulty spike in the difficulty curve of the War in Kryta quests, as the one immediately following it was easy and I did it first try.  For reasons unknown I stopped after that, even though I'm on the second to last quest.

There's a trick for speeding up A Little Help From Above, which also allows you to avoid 50% of the quest's bullshit.  The first objective is all the way on the other side of the map from the rest of the objectives.  You kill your way there, kill the target boss to get the key you need, and under normal circumstances turn around to find the path you just cleared now has hidden groups of White Mantle that appear unpredictably as you try in vain to work your way back.

The trick is simple.  There's only one resurrection shrine in the entire zone, and it's where you start.  After killing the boss and getting the key, die.  You will resurrect back in safety.  Pop a Powerstone of Courage or other death penalty removers for the party, and carry on like the hidden groups of White Mantle never existed in the first place.

Frozen Soil is as required as ever.  The White Mantle and Peacekeeper enemies simply have too much resurrection.  If they're allowed to use it, fights will drag on and since their groups are bigger, they'll win.

As for Hard Mode, I warmed myself up with a rather flawless Gates of Kryta mission+bonus, then proceeded to fail hard on D'Alessio Seaboard.  The first time it was because I rushed to the NPC that triggers the bonus, who is under attack when you get to the town he's in.  The second time through I cleared out a bunch of the attacking undead before going to help him (he doesn't start taking damage until you get close enough to him), and it worked beautifully.

Paved my way to the Temple of Tolerance along the bonus path, and proceeded to fall dead in my tracks.  For some unknown reason, Arenanet thought it would be funny if the NPC whose life you have to protect in the temple was under attack immediately as soon as you get within radar range of him.  You have to take a somewhat winding path to get to him, and I have yet to get to him before he dies.  Once I figure that out, I then have to stay there and defend as several waves rush in from two different directions, so who knows how well the mission will go if I can keep him alive long enough to find out.

Secret of Mana

Levelled the girl's elementals up to 6.  Realized I really needed somewhere with enemies to do the rest of it, so I hopped on Flammie and went to Ice Country where the enemies are relatively weak and I can just mow through them quickly.  Got the sprite's elementals up to 6.  Got the weapons to 6 as well, with the sole exception of the sword, whose sixth orb I'm currently lacking.

You know what this means?

Story!

Imagine that!

...or so I thought.  My next stop was in fact the Moon Palace, to get yet another elemental.  Which meant only one thing: More grinding!

Realized that the Wind Palace is the best place to level grind for the girl (free MP refill, plus elementals level up faster if weapons are out).  Got all the elementals for both the girl and the sprite up to level 7.  No more levelling to do until I get the sword's orb in the next area.

So, now.  Story.  Well, next time.  I'm tired of pressing buttons on a controller.

Real Life

I'm getting a haircut today.

Thursday, March 10, 2011

Elementals Get.

After spending a few hours farming to get the last Unicorn Helm and three Gauntlets (which really did take forever), I beat the crap out of the boss in the Palace of Darkness.  Seriously.  Its element is Undine (water), so I whipped out Salamando (fire) and beat it in the face with chain-casts of Exploder and Fire Bouquet.

From that, you get the Shade elemental (Dark magic), but only for the sprite.  After a little talking to NPCs you work your way to the Gold Isle where there's a tower containing Lumina (Light magic) that you can grab for the girl.

Also in that one tiny tower there's four weapon orbs.  FOUR FUCKING WEAPON ORBS.

Upgraded my helms and body armor, but thanks to the really high armor value on the gauntlets, I won't need to replace them anytime soon.

So next post will be about grinding.  Not that I didn't do my fair share of grinding in this session.  The sprite has all its elementals at 5, and the girl has everything but Lumina at 5, and Lumina is at 1.  I'll work my way through everything else next time, including the metric fuckton of weapons I have to level up.  At this point, it's everything but the sword (and the whip, which is already at level 6) that needs grinding.

Wednesday, March 9, 2011

Resuming Secret of Mana-thon

So for reasons I don't even know, I kind of stalled playing Secret of Mana.  So I fired it back up earlier and I'm resuming the grind.

Quite literally, in fact.  All I did during this most recent session was get weapons levelled up.  That was mostly due to having to reacquaint myself with where I was (Mandala), where I was supposed to go (the Palace of Darkness), and what needed to be done.  During that I took a look at the Levels screen and noticed that the boy had some progress on the axe.  It turned out that the axe needed to go to level 5 on everyone, as well as the javelin and gloves.  In addition, I discovered that the whip needed to go to level 6.

I got all of that done, and farmed for some rare drops in the Palace of Darkness while I was doing so.  The Fierce Heads have Unicorn Helms as a rare drop, which is a much better helm than the Circlet that's available for purchase in the area, and since it can be equipped by everyone, it meant I could upgrade the girl's headgear from the Tiger Cap.  Also available as a rare drop is the Gauntlet, from the Dark Knights.  It has a defense of 90, which is much higher than the mere 20 defense given by the Ivy Amulets available for purchase in the area.

I got two of three Unicorn Helms, and due to only having found one accessible Dark Knight so far, haven't gotten any Gauntlets.

And yeah, if you bring up all posts with the tag "Secret of Mana", you'll see that I could have just read my previous post on the subject to figure out where I was and what I was doing, but whatever.

Saturday, March 5, 2011

Guild Wars Update: 7 Hero Parties

YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES

Now I can finish War in Kryta, and continue with HM and Eye of the North dungeons.

Also I can get me a Black Widow, and I'll have a full Zaishen Menagerie.

Mercenary Hero slots are neat, but not 100% necessary.  I don't use my existing heroes 100%, no need for me to bring other characters on my account as heroes just yet...

Also, as a part of this hero-related update, the hero dropdown goes from being completely disorganized to being grouped by profession, making it a lot easier to get the exact hero grouping you want.  I approve.

Embark Beach now offers a nice and fast way to get to any outpost in the game that you've unlocked.  I would have preferred that the boat travel dialog be extended to do this, but they added an extra town in the Battle Isles for it.  Whatever.

Drunkard title was changed so you no longer need to be essentially idling in-game for 10,000 minutes of real-time.  It's now point-based like the Party Animal and Sweet Tooth titles, with different levels of points for different alcohols based on their strengths.  Now I no longer need an entire storage tab dedicated to holding alcohol...

I haven't yet played my Necromancer to try out the minion panel, but honestly I'm surprised that it took them over 5 years to think of and implement the idea.  Hopefully it makes targetting individual minions for spells like Death Nova and Jagged Bones easier.  Edit (March 8): Just tried it out, and it now makes having a human play a Jagged Bones MM or a minion bomber possible.  Before it was impossible to reliably target different minions, but now you get a list with their health bars and whatnot.

Now I just need to get more HoM points for GW2.