Thursday, December 27, 2007

RSS gripes

I should have a gripes tag.

I am working on an RSS aggregator. I want it to get files for me. That's all. Put them where I want them. Is that so much to ask? I think it is, so I had to do it myself. All the better, I can customize it a lot this way. (It's written in Python using feedparser, I will post it to this blog when I'm done, probably public domain.) I want it to download my music for immediate initiation to my library, videos too perhaps, images definitely (comics; probably for a desktop changer later), and also maybe text; not sure what for yet.

So at this point I have it pretty much working. Some of the nice things I don't quite have yet; filtering for certain entries, deleting files, putting the timestamp in the filename to further prevent collisions, etc. But for now I can use it, and it made me happy. Until, xkcd gave me this:

<img src="http://imgs.xkcd.com/comics/blade_runner.png" title="Blade Runner: Classic, but incredibly slow." alt="Blade Runner: Classic, but incredibly slow." />

This, and the html page (linked from the feed), are the only reference to the actual png. No direct link, so I have to now parse this bit of html, or the link that the rss feed points to. No way am I going to make a custom bit of code just for some emo nerd comic. (the fanboys already made me irritated with this comic, so it's convenient) But, it turns out that Perry Bible Fellowship does the same thing; the supposed image link is actually an html link to a page that contains the image. All the podcasts have direct links to the mp3 files; after all, podcast players like to have direct links. I guess there aren't enough, if any, comic readers yet.

And this is worse than parsing the feed, because there's no standard place to look for the link within the HTML; it's different for every comic. And the HTML page is subject to change at any moment. At least there's a standard in RSS. Some RSS feeds may have stuff in non-standard places, but I made a very easy way to define a non-standard place to look for stuff*, and I don't think they'll move it. And XML parsing is less error prone that HTML.

Well, fortunately there's a couple html parsers for Python, I'll probably use pullparser. My hope now is that it's as easy as feedparser, and I can make my custom settings a similar way*. Though, there are bound to be multiple images in the html page, so I have to somehow identify the one I want. Perhaps by tag id, or maybe the directory that holds the image. God help me if I have to write regexes; I want this to be simple, it's weird enough that my configs are a list of dictionaries in Python.

*Here's how I have it get files in non-standard fields. feedparser puts the whole feed xml file into a tree of dictionaries and lists. Within each entry, your podcast (for instance) item is usually at entry["enclosures"][0]["href"]. This is what I have as the default. But what if I wanted something at entry["link"][1]["href"] (semi-madeup example). My config file is written in Python too. I have a list of dictionaries that define each feed. To my dictionary I add "url-basis":["link", 1, "href"], and it knows to look at entry["link"][1]["href"]. It's very convenient that in Python you can say x[a], and it will try to treat x as a dictionary or list, depending on what type a is (and of course, throw an exception if you guessed wrong).

Wednesday, December 19, 2007

Idea for an anti-phishing plugin

I just thought of a decent anti-phishing scheme, which would probably make a good plugin for Firefox. Particularly useful for those sites that use unicode for evil.

The plugin would give you a button you can push that tells you if you're on one of a whitelist of sites. If you're not, and you thought you were, you're being phished. It would be tedious to whitelist every single site out there, of course. Mainly your important accounts (bank, paypal, email). Listing as many as 20 things sounds like it's worth my time for safety.

Another variation: a small popup (not a dialog you have to click on), or maybe a change of color of a widget on your browser, that comes when you are on a whitelisted site. Sounds a bit backwards at first, but really, you can't get warned when you're on a phishing site unless you have a perfect blacklist (and if there were one, there would be no use for my plugin). My thought is, eventually you'll get used to seeing the popup every time you're at on of your important sites. Then, one day you go to a phishing site. Because of habit, you'll hopefully think that something is a little off when the popup doesn't show, and take notice. Unlike the first variation, I think this variation could work for general carelessness, not just the unicode trick. You would probably combine the two, really.

Friday, September 28, 2007

And while I'm at it

I made a chat program in Visual Basic in college. It sucked as a program, but it had a neat feature I always wanted out of a chat client, which is multiple input windows. Here's an example:

____________________________________
CoolGal27: Hey how's it going?
SmooveDood69: Not bad.
____________________________________
Enter Message:
Actually, I was just getting done with my dissertation on bacteriophages. It's really quite fascinating, these virus-like agents actually attack bacteria, in a similar way to how viruses


...

____________________________________
CoolGal27: Hey how's it going?
SmooveDood69: Not bad.
CoolGal27: Want to meet up for dinner?
____________________________________
Enter Message:
Actually, I was just getting done with my dissertation on bacteriophages. It's really quite fascinating, these virus-like agents actually attack bacteria, in a similar way to how viruses dangerous to you and me would attack our cells. My personal thesis focused on



Goddammit! See, now I have to copy all this text, type in, "yeah sure, but I can't until 7", and paste my long discussion back into the input window.

I'd make a plugin that would give you two or more input windows, so you could have that long thing you were typing along side the quick thing you send over.


Another idea I had was the ability to send a message to multiple people at once. Not in a chat room, just a quick message or two privately. As it stands, if there's a kool link ^_^ that I need all my friendz 2 see, I need to paste it into all the different windows, etc. I'd like to make a plugin that gives the ability to multicast messages.


And dammit why did 2.2 get rid of the font sweep-away icon?!? The greatest thing Pidgin ever did.

Pidgin Gripes

I like Pidgin, it's straightforward, faster than AIM, etc. Last I checked (like 5 years ago or so) Trillian was slow as hell, though I don't use Windows at home anymore anyway. However there are a couple things that really annoy me about Pidgin, and sometimes IM clients in general, so I'm thinking of starting to make plugins to fix it. Kindof like I was going to make Tomboy plugins and still have yet to do. Here are my gripes:


1. Handling of Incorrect Passwords

First and FOREMOST, in any other interface I can think of, if I put in an incorrect password, the application informs me of the situation, and offers me another try. Not so with Pidgin. Maybe you never noticed because you save your password on your machine; that's not for me. (though a Keyring plugin would be super kosher).

No, what it does (if I remember correctly) is inform me that my password is wrong, and offers me to "change my account settings", "connect" (with the same wrong password, as if it'll work the second time), or just give up. Now, when I "modify my account", the bad password I just entered is in the password field. That password field is there for those that want to save the password on the disk. This worried me (since I don't want it on the disk) so I always deleted it from the field. Why was it trying to save my password when I told it not to, I wondered. Turns out that it wasn't actually going to save it, which is a bad interface choice.

Anyway, you go ahead and modify it. Then you disable and enable the account and for whatever reason it still prompts you for a password, so that's how you try logging in again. Lame.

Admittedly, with Pidgin 2.2 (which I just installed and which is strongly diffusing my argument here as I type it) it just says "Pidgin will not attempt to reconnect the account until you correct the error and re-enable the account.", and gives you a cancel button, which isn't much better but is less ironic at least. I still have to go to the menu and re-enable the account. That's much less annoying than it was before. But still, I shouldn't have to do even that, it's easy to make an immediate prompt.

So, a plugin I would make would fix this, and give me a prompt to put in my password again, if I want.


2. Sending messages while away

Remember when this was an optional feature, rather than the standard? I bet AIM still remembers this. I personally end up forgetting to take down my away message when I come back. People remind me. It makes the whole away message thing pointless, it should be up when I want people to think I'm away. Maybe some people don't forget, that's why it's a good option for them.

Though, I still like it in theory. What I would do, and this is something that would solve a gripe with all chat clients, not just Pidgin, is make a plugin that would remind me every X minutes that I was away, if I was typing while away. For convenience, the dialogue would give me the option of coming back from away, too, and probably "don't bug me about it again this time" as well. That way, I could go away, send those few messages I forgot to send, go to lunch, come back, message Cezar, and he wouldn't have to remind me that my message still says I'm at lunch.


3. Away Messages Don't Expire

Whereas the first gripe was with Pidgin and the second with IM clients in general, the third one is with myself. I forget or don't get around to changing my away message. I was apparently showering all day yesterday. What good does this sort of an away message paradigm do anybody? What I would make is the option to set an expiration time for an away message. I'd set an hour for the shower message. Then I would set a subsequent message. Like, work. Maybe I want another subsequent message (because when I get from work, I don't go and take myself off from away first I get home), this message would be a catch-all "At this point I'm not where I was when I last set my message, I can't tell you where I am, but I'm not at the computer, sorry" sort of message.

Saturday, September 1, 2007

Game Demo Progress

I think I should post my progress as long as I have this Web Log and people are forced to listen by virtue of a feed associated with a certain User Group of a certain class of operating systems. I probably never mentioned this in the first place, but I've been commissioned (probably no money involved; I had a discussion with a friend, I'm pretty sure I can still technically say "commissioned") to make a 2D game engine.

I initially chose C, with Python for scripting. Then I decided that for a prototype I should just do it in Python. Then I figured, why the hell not just make most of the actual product in Python? I would just use C for anything time intensive, such as looking for collisions ( O(N^2), unless there's some industry trick there that I have to learn ) and image effects (generated fire, as opposed to pre-animated fire).

So far I've drafted up my requirements and cleared it with the guys planning the game itself. It was a decent sized doc too, I'm reasonably happy about getting that done. Next is code design, but it was pretty hard to think of how to design it without trying to code it first (a catch 22 of sorts), so I decided to make a prototype(/demo) to help give me the ideas. Turned out downright vital that I did this because things came up that I didn't anticipate at all, as I'm sure is always the case.

For starters, I'm working on the Actor framework. Everything in this game is an actor. They send messages to each other, they have actions every frame, and then they draw. I'm not even worried about them showing themselves at this point, I'm mainly worried about laying out the code and making everything communicate properly. Input isn't really pressing either. I'll probably make a curses output module for starters, just for the heck of it, and just to show off (to myself, I guess) the modular nature (I hope) the engine will have. Actually, I'd mainly do it because it would help demonstrate that everything's working properly, and it's faster to get working than SDL, I would imagine.

So I just got message passing going. I think next I'll put in a quick framework for input (but not bother implementing it yet), but soon go onto other important things like searching for collisions, etc.

After this thing is done, or at least showing enough interesting aspects of my engine, I hope to have a presentation for this user group about game programming and Python. This would probably be my first presentation; I'm not used to doing them and it might be a while before I get around to that.

In this post I'd also like to chime in and say I'm impressed that Gnash works on Youtube, at least on a rudimentary level. Not Google Video though, sadly. So now I won't have to bust my head, having a 64 bit system, until Gutsy comes out and I can easily use the nspluginwrapper (I went from a naive Windows user that would install programs in a semi-irresponsible manner to a naive Linux user that refuses to install anything not from an official repository). Heck I may just stick with gnash, I've heard that it uses Open GL, so it should be faster than Flash. I think it is, really, the load time for the YouTube app is damn near instantaneous, though my computer is fast. Maybe I'll run a little comparison.

Sunday, July 1, 2007

Capitalism and Linux

I read Freddy Martinez's blog post about not bashing Windows and started writing a comment, and realized that it was much longer than his initial post, so I figured I'd just post it to my own blog, since I don't post here enough anyway.

Like Freddy, I have capitalist ideals. When people were telling me about Linux a few years ago, I had the hardest time comprehending how a free operating system could even get off the ground. There are a couple things to consider.

Firstly, I realized that free human interaction naturally and rightly includes both selfish competition as well as selfless collaboration. I've realized that the bottom line is freedom, not so much capitalism, if we are to define capitalism as selfish competition within a free market. (If you define capitalism just as a free market, that can also include the selfless collaboration if you think about it). So, people often get a lot of things done in the name of selfishness, as they're rewarded for their work with money. But people also can also accomplish a lot in a collaborative environment, something I was too naive to recognize back then. As much as human nature can be selfish and may often require capitalism to accomplish anything, there is also a nicer side of it. Remember that we have friends and families. As it is, capitalism and communism coexist peacefully, in a sense. (Yes I do consider free software somewhat of a a form of communism, and since there no regulations and nobody's forced to do anything it doesn't bother me). I heard a funny thing one day. A family should work like communism; from each according to his/her ability, to each according to his/her needs. Honestly, the only reason to hate communism is if it a) forces people into it (government imposed, particularly) or b) doesn't work. Free Software is free market communism, and so far it seems to work, and I think it's fantastic. Though, to be honest, I'm still pretty surprised it works as well as it does, but I think I'll grow to understand it eventually.

Secondly, and hopefully not completely nullifying the first point, Linux does make money, and as long as it's Free to the users and developers, I'm pretty sure it even has Stallman's blessings. Think about this, there's a utility that company A and company B both want. They could both invest the effort to make it, or they could both spend half the resources to make it together. Now, as the tool improves over time, the companies will patch it. Would it make sense to keep the patch for themselves? Not so much, because they would then have to keep patching each new version as it came out. Might as well submit their patch so it gets included in new versions. They make the software freely available (rather than secret between their two companies) so that Companies C and D come into the picture and start using and improving it further. Still, in a way this somewhat fits the communal view. I think it's similar to committees formed by multiple companies for their mutual benefit. (Yes the RIAA is a communist drone and must be stopped)

Saturday, June 30, 2007

taking Simple Notetaking to ridiculous ends

Anybody that knows me well enough knows that I'm very slow to change my habits. When I feel comfortable with a certain process, I feel rather uncomfortable changing it. This is particularly true when it comes to using a convenient tool, God forbid that ti has a GUI, that does a bunch of stuff for me. Instead, I do things in a very mundane and unsophisticated manner with the future (realistically far future if ever) intention to establish a more sophisticated system myself. I'd rather know everything my tools are doing, I want all interfaces to be transparent, so I can integrate everything as I want whenever I want. It's through those barriers that I broke to finally try Tomboy.

Tomboy, a Gnome app, is a pretty great tool on it's own if you're not crazy like me. It's a simple wiki-esque note taking system, automatically saves, nice keybindings and quick workflow (albeit with a few problems with key bindings, at least on my Dvorak keyboard). The big selling point is that you can make links to other notes by their name. Any text in any note (other than in the note's title) that is the name of another note automatically becomes a link to that note. It's a simplified Wiki with no "edit" screen, for a sped up work flow.

It's good for my psychotic note taking practices, however I never tried it because I wanted a more integrated, database-based thing, where I could easily move note items around, generate lists as I want them, etc. I was using vim and text files until now (and have like 100 files left to manually import, thankfully I found a python script for copying a file from standard input to the clipboard), figuring I could more easily import to whatever it is that I wrote more easily with text, but Tomboy uses XML so it's not too bad, even if I still ended up going that route.

Fortunately my issues aren't too important anyway, because Tomboy has plugins. Herein lies the heart of this post. Now I can still make any sort of integration I want. It's nice because instead of starting from scratch and making some crappy program that'll end up losing all of my notes, I can start from something relatively stable and very convenient.

Tomboy is written in Mono. It's pretty funny because the plugin files are .dll files. But it's still GTK. It was easy enough to build a sample plugin. I envision myself making a ton of these before I'm done. I also hope to describe the API on this wiki page. At this point the only documentation is the code for the existing plugins.

Why does a note taking program need plugins? Well, there are plugins available for integration with Evolution, Trac, and Gaim. Simple stuff like that which allow you type links that will activate things in those programs.

I plan to do a couple like that, but hopefully I can eventually realize the whole of my note-taking psychosis. It would be nice to integrate it with some sort of calendar support. Some sort of automation of listing things in a certain class would be nice too. This is more database-esque behavior, so I may think about integrating it with some sort of database. Though the newest version apparently supports tagging, perhaps that's a good enough platform.

I guess that's the end of it for now. I'll let you know when I make some plugins.

Monday, May 7, 2007

This is my tech blog

This is where I will start posting about technical things that are on my mind. It will eventually be aggregated to www.chicagolug.org/planet/ with other members of the LUG.