2010-07-30
Posted in Geek Stuff
at 21:43
Until recently, I’d been using WhatIsMyIP.com’s API to fill in the external IP field in my Conky readout, but a few days ago, they started a very silly thing where, for whatever reason, clients have to follow a 301 redirect to the URL they just asked for in order to get the IP. I decided that was excuse enough to write a more direct solution.
Since, recently, I’d learned that it’s possible to muck about in m0n0wall without pulling the CF card (despite the lack of proper SSH), I decided to take m0n0wall’s interfaces readout page, strip out everything that wasn’t necessary to get the WAN IPv4 address, and add an explode() call to separate the IP from the hostmask.
If you want it for your own m0n0wall box, here are the instructions:
- Grab
api_wan_ipaddr4.php from my GitHub Gist.
- Go to exec.php on your m0n0wall box (http://192.168.1.1/exec.php with the default DHCP configuration)
- (optional) Type “
status_interfaces.php” into the download box and use a tool like diff to verify that I haven’t added anything nefarious.
- Use the exec.php upload interface to upload
api_wan_ipaddr4.php.
- Run these commands using the exec field:
mv /tmp/api_wan_ipaddr4.php /usr/local/www
chmod 755 api_wan_ipaddr4.php
- Load it in your browser (http://192.168.1.1/api_wan_ipaddr4.php with defaults) to confirm that it’s working.
- Use wget/curl/etc. with HTTP authentication to retrieve your external IP whenever you want. I use this command for my conky:
curl -s --insecure --anyauth --netrc https://192.168.0.1/api_wan_ipaddr4.php
Permalink
2010-07-28
Posted in Geek Stuff
at 15:20
Whenever I have to set up a Python project, I’m always amazed at how little documentation there is on extending distutils to add new commands or otherwise deal with un-anticipated (and apparently, some anticipated) circumstances. In the absence of an easily found HOWTO or guide, I’ve had to go source-diving… and when I do that, it’s only good manners that I share what I found.
The following questions are things I found myself frequently wondering, but feel free to ask me other questions. I’ll add answers for the “likely to be frequent” ones as time permits.
- How do I create a new command for distutils?
- As I find myself often forgetting this, I’ve posted a template with explanatory comments as a GitHub Gist.
- How do I add my custom command to multiple projects without including it and setting
cmdclass in each one?
- As far as I know, using only distutils, you can’t. However, setuptools provides a mechanism.
- How do I make a custom command fail gracefully if non-optional dependencies aren’t present?
-
- For dependencies internal to Python (modules, specific module versions, etc.), you can define your command inside a
try/except or if block. my template includes an example.
- For external commands, I recommend defining your command inside an
if block and using a which function to test for them. (Using an external “which” command is ugly and fragile)
- How do I access the attributes I passed to
setup() from my custom command?
- This was a surprisingly involved thing to figure out.
setup() passes its arguments to an instance of distutils.dist.Distribution which then parcels them out to various places.
The simple explanation is that, if it’s set in setup() and setup.py doesn’t complain about it being unrecognized, your command can access it as an attribute of either self.distribution or self.distribution.metadata. (With the possible exception of it being a command-specific option. I forget how those work)
However, the metadata also offers a comprehensive collection of getter methods which return strings like “UNKNOWN” in place of None, so you’ll probably want to ask PyDoc for details:
pydoc distutils.dist.DistributionMetadata
A practical example of the most common use I’ve had for this is retrieving the list of packages to be installed via self.distribution.packages so a tool like Epydoc or Pylint can be run on them.
- Is there a clean, sane way to bundle resources (eg. custom toolbar icons) with my project
- Not really. [1] [2] [3] The approaches linked aren’t pretty, but they’re all I’ve been able to find.
- Where do I find new commands?
- Given that Python has PyPI, you’d think there would at least be a repository of commands for setuptools. However, aside from the commands that come bundled with their associated programs (nosetests, flakes, build_sphinx, etc.), I haven’t found anything. The wiki mentioned in the next question has a very sparse cookbook though.
- There’s really no community documentation for this stuff?
- There is, but it only covers some of the questions listed here. One of these days when I’m not feeling so unmotivated, I’ll merge this FAQ into theirs.
- Isn’t anybody working to fix this mess?
- Yes, but it’s not going to happen overnight.
Permalink
2010-06-28
Posted in Geek Stuff, Otaku Stuff
at 13:34
Rating: 4.5/5
A few months back, I was informed of an offering known as the Humble Indie Bundle. Seeing it as an opportunity to finally pick up a copy of World of Goo, I bought in. However, my brother quickly insisted that I try another one of the games in the bundle…
Aquaria is an aquatic platformer. More specifically, an aquatic platformer with gorgeous art, beautiful music, and a focus on semi-linear exploration. If Braid is one possible expression of “Super Mario Bros.’s almost nonexistant story done right” (A review for another day), then Aquaria is an expression of “Super Metroid done right”.
Everything about the game seems carefully crafted to emphasize the atmosphere around you and it makes exploration a treat, there’s a wide variety of enemies, and the “forms” system throws back to the various weapons Samus had to use… though with less focus on different attacks and more on different skills to pass region barriers.
However, it is still firmly a platformer, so while the story gets a fair bit more work than Super Metroid, there are some rough edges which clearly show that storytelling was not the creators’ specialty and that, while a significant improvement on Super Metroid, improvements still could be made.
The combat mechanic does sometimes take precedence in situations where it’s detrimental to the atmosphere (for example, the boss battles where, without fail, you have to defeat enraged or corrupted gods, receiving boons from them in moments of lucidity before they finally die) and the descent into the abyss near the end of the game does make the game less engaging… something a corresponding increase in story-focus could have mitigated.
However, given how rare Metroid-style exploration platformers are and how much I enjoyed exploring the world, I’m willing to forgive that somewhat. It would definitely have been nicer, though, if they’d provided more “ancient turtle” warp points. (The three largest regions in the game still only get one apiece and one surprise region of respectable size gets none at all, while the surface waters get two) More frequent save points would also have probably been a good idea, given that not everybody is as flexible with their schedule as I am.
A more significant problem, story wise, was the feeling that, toward the end, the story was at once both rushed and sparse. Structuring the game more like an essay, with most of the abyss-crawling in the middle and the triumphant revelation of the coral reefs of the surface (or some “beyond” area) would have helped significantly, as would more voice-acted “vision” sequences. As is, it feels as if it’s building toward something as you head for the surface waters… and then the plunge into the abyss quickly ends the story with loose plot threads being tied up before they could fully be developed.
The fact that, apparently, some recipes in the cooking system are alternate paths to dishes and can only be found by experimentation further develops this impression as players tend to measure their progress by the proportion of discoverable items they’ve found compared to the total number. Speaking of the cooking system…
I did find the cooking mechanic enjoyable, primarily because it let me handle my health and powerup management in my own distinctive fashions (and because I used to play games like Harvest Moon), but I felt that, to use a programming term, the set of recipes was oriented too much toward depth rather than breadth. Too many ingredients useful in only one recipe, too many recipes that require multiple steps, and too much dependence on a small set of core ingredients that aren’t proportionally available unless you grind sources of them. Nonetheless, it was fun.
Finally, the collectable trophies seemed too “collectable for the sake of having them”, given how thoroughly hidden some of them were. (In some cases, you have to either know where they are already, or be just plain insane to find them) Of all the trophies I collected, the one I still like most is the ever-respawning pot of fish meat. (one of those few over-utilized base ingredients I talked about)
Overall, it gives the impression that the designers had plenty of skill and envisioned something that they, at the time, didn’t realize would be twice as long as they had the budget for. Nonetheless, I’d give it a solid 4.5 out of 5 and encourage anyone who enjoyed the old 2D Metroid games (or enjoys 2D platformers and 3D Metroid).
P.S. If you really want to feel the atmosphere to its fullest, let a friend or family member wait through the intro that plays the first time you start the game so you don’t see it, then click on the crystal in the menu screen to view it (for the first time) after completing Mithalas Cathedral. That way, you won’t have any potentially inaccurate preconceptions to color Naija’s initial realization that she knows nothing of her origins.
Update: If you get the chance, listen to the special OST-only track “Fear the Dark” before and after you play Aquaria. It’s a beautiful piece (preview) and it does a beautifully clever job of hiding its relation to Aquaria so that you only “get” it once you’ve beaten the game. (Thanks to their clever use of pronouns and implicit subjects, it just sounds like very beautiful, if ordinary, love song unless you know who is being talked about)
Permalink
2010-05-14
Posted in Geek Stuff, Site Updates
at 8:25
Just a quick status update.
I’ve done some significant re-theming on http://www.ficfan.org/ and fixed a bug that was causing many of the quotes to not show their additional metadata.
While doing so, I noticed that, because of how wp-lifestream caches paths (though I can see no benefit to it), the switchover to the new fileserver caused it to get in a fight with PHP’s safe_mode. (Why doesn’t anybody tell me these things?) That is now fixed.
Finally, now that I’m on vacation, I had time to dig into wp-lifestream and add a workaround for the double-encoded YouTube links. YouTube faves in my lifestream now actually work.
Enjoy.
Permalink
2010-04-18
Posted in Geek Stuff
at 16:00
Before I begin with my argument, let me say that I generally like Google Chrome (or more correctly, Chromium, the open-source release). It’s the only reasonably responsive open-source (not Opera) browser for tabbed-browsing freaks on Linux, the minimalist UI and “prevent amateur authors from cluttering things” extension API work very nicely to keep things clean yet functional, and I love the little touches like extending the active areas of edge widgets like scrollbars and the tab bar all the way to the edge of the screen in maximized windows.
I also agree that, to make progress, you have to experiment. However, when the Chrome devs start making not-so-smart changes, ignoring mass-complaint by the users of their “Dev Channel” releases, not even compromising with a simple checkbox, and marking well-starred issues as WontFix, they start to approach the level of arrogance and hubris I once thought reserved for the developers of The GIMP. (They’re not quite there since, in my experience, GIMP developers will also insult you or dismiss valid complaints as rude before setting RESO INVALID or RESO WONTFIX)
Here are a few of the more controversial changes, to put it politely, which they have forced on Chrome users in the last few months:
…and that doesn’t even cover the many issues that should be trivial fixes but have languished for months or even years… presumably while the UI change reviews required by Google are continually de-prioritized in favor of whatever it is that the devs actually care about. (eg. native RSS support, reliable middle-click, debugged pop-up blocker, file associations, working blur()/focus(), download completion protection, a comfortable download shelf [1] [2] [3], and various others.
I’m not saying they should do things my way, but I find it, at the very least, insulting to be forced to do things their way without so much as an about:config or hard-to-find checkbox.
To be perfectly honest, for all its flaws, if Firefox 4.x can provide compact toolbars and a properly responsive GUI on Linux, I’ll switch back in a heartbeat. It may be a messy free-for-all with an extension system based on fragile monkey-patching and a rendering engine that’s more sumo wrestler than rocket, but at least it doesn’t presume to tell me how to use my own browser.
Update: As I mentioned in one of the following comments, another reason this really gets to me is the condescension, arrogance, and hypocrisy of claiming to make these changes “for the user” and then implicitly qualifying it with “We know what you want better than you do”. There’s a reason I don’t like Apple, there’s a reason I don’t like Microsoft, there’s a reason I don’t like the Apple fanboys in charge of GNOME and Ubuntu UI design, and now it looks like I also have a reason to not like Google… especially given the good arguments for reverting and the convoluted excuses against reverting that I’m seeing on the issue tracker entry for the removal of http:// from the omnibar.
Update 2: And, in what seems like an admission of defeat to me, the Google Chrome devs have now marked the issue entry for the removal of http:// read-only. In my experience, that’s the corporate equivalent of ”Ohh, nothing’s going my way. Mom!”
Update 3: While Google still seems to be convinced that their “we know you better than you do” approach to UI design is correct, they are not completely immune to reason. According to the Chrome 5.0.375.17 ChangeLog, they’ve temporarily reverted “http:// truncation, star icon, etc…”. Their official stance is “We are currently examining ways to address the usability issues that were raised and plan to reintroduce in a future release” though, so I doubt they’ll be willing to admit that stripping http:// on a non-cellphone browser is inherently a dumb idea.
Permalink
2010-04-15
Posted in General, Web Wandering & Opinion
at 1:26
You may be familiar with the “Hitler rants” meme which produced such parodies as “Hitler gets banned from Xbox Live“. However, what you probably haven’t noticed is that, thanks to a user named hitlerrantsparodies, a continuity has started to coalesce in which Hitler’s greatest enemy is apparently not the Allies, but his prankster brother-in-law Fegelein who continually talks Günsche into informing Hitler of stupid, pointless things until finally Fegelein steals Hitler’s pizza takeout and the others decide to make Fegelein leader.
Here’s my interpretation of said Bizarro world’s timeline:
- Hitler is asked “Why so serious?” (where we see that Fegelein hasn’t yet distracted Hitler to the point where he essentially forgets about the Allies)
- Hitler is informed he is Fegelein (which apparently takes place before Hitler catches on to the source of Günsche’s stupid reports)
- Hitler is informed Fegelein has locked him into his room (where Hitler starts to realize that Fegelein is the source of all his problems)
- Hitler is informed he is Hitler (…but he still hasn’t realized that Günsche is in on it)
- Hitler is informed he is sitting down (…and now he has)
- Hitler’s glued to his chair (Fegelein’s twisted sense of humor responds to the previous incident, we see how typical this kind of thing is, and Hitler’s patience wears thin)
- – Fegelein leaks the parodies which arrived on the web first –
- Hitler is informed Fegelein is missing (when Günsche tells Hitler that Fegelein’s ass-kicking for leaking the early parodies will have to wait)
- Various Pranks: Helium, Fegelein’s Death, Mass Cloning, etc.
- Hitler is losing his voice (from ranting about Fegelein’s antics all the time)
- Hitler is informed his pizza will arrive late
- Hitler Phones Fegelein
- Hitler is informed Fegelein is now the leader
All I can say is that it made my day evening.
Permalink