Configuration proxies are a beautiful thing

Don't ask me what that means, I have no idea. I just came up with it. Proxy seemed like a good term, but I'll explain how it works, and why they were necessary.

I wanted to have filters on "dumbweb" (Read about dumbweb here). You know, the software running over at stringed.org... Well, filters are a configurable item. Just read this to learn all about them. "dumbweb" is a completely separate project, and you can't go writing very specific filter configuration parsing code in there. But, you would want dumbweb to be able to use filters in such a way that it's easy to configure, in the same config file where you define dumbweb. Hence the need for "configuration proxies".

Basically, now, in my dumbweb configuration xml, I can just write what would be in the filter configuration file but into the dumbweb configuration for the data item (i.e. "Picture") and a filter will show up for that item on the list page. Here's the xml

  <form className="jtccom.domain.data.pictures.Picture" name="Picture" listed="true">
    <filter helpIcon="https://storage.googleapis.com/jtc-public/static/images/helpicon.jpg">
      <fields>
        <field label="Album" name="PictureAlbumId" helpText="This is LONG overdue!!" />
        <field label="Labels" name="Labels" helpText="Search Labels" />
        <field label="# of Labels" name="Count(PictureId):PictureLabel" helpText="Find pictures with or without labels." />
      </fields>
    </filter>
    <operations>
      <operation name="edit" />
      <operation name="delete" />
      <operation name="add" />
      <operation name="view" />
    </operations>
  </form>


And basically what you see is the same as the filters on the Pictures, News and Downloads pages, only as a part of dumbweb. And those are configuration proxies. Configuration specifications that are used in the system but not in the current system, but the current system can... not load, but support or use the system that the proxy defines. So, dumb web configurations don't read the filter xml at all! It's read by the dumb filter system! It's neat. We can call this Configuration version 3. Read more about Configuration version 2 here, and that article links to version 1 if you're that interested.

Labels too big, had to do something...

First, here's the problem:



When you "subfilter" labels, all of them are returned and there's like a thousand of them.

Second, here's the solution:



And check out all this DOM scripting to accomplish that!

Pictures Labeled!!

This is different from the last one. I went through, for about 4 hours, painstakingly labeling each and every picture. It led me to a few conclusions:

1.) I take too many damn pictures of the same thing. I guess taking them isn't bad, but I don't have to upload 40 pictures of the Phillies game I went to a year ago. Then every picture gets the same labels "philadelphia, sports, phillies". It was very boring doing that.

2.) There has to be an easier way to label stuff.

3.) Labeling stuff sucks. I'm glad I'm done.

Also, I went ahead and got rid of download categories and replaced them with labels.

Labels are a centralized thing. If I create a label called "ducks" for example (there are pictures under that label!), then that label will show up as a choice for downloads and for pictures (and later news), whether or not there are downloads labeled "ducks" or pictures labeled "ducks". When you search the filter in downloads for labels like "duck" then "ducks" will show up. This will lead me to develop something cool in the future. Like, search a label and list anything that has that label, whether it's a download or a picture or an X or a Y. It will be pluggable.

If you want to see how I input labels, search pictures for the label "labels". Also you can search for "java" and "dev". Those two will give you a bunch, whereas "labels" will give you the four screens I took of "dumb web" and how it handles labels.

Pictures have labels

I decided to make everything have labels, and pictures are the first to be converted. There's more work to be done, but use the filter for most of your label needs. In fact, with the filter, there's really no more work to be done... I don't know, I'll probably think of something. So, now I have to go and add labels to all of my pictures... 226 of them.

But it took about a day to get the labels up, only because my data list that shows the pictures always goes back to the first record after I save a picture. It's pageable, and the first page was easy :) But after that, it goes back to the first page, so I have to keep track of what page the picture was on that I just added labels to. So I had to fix that. Now it'll keep go back to the last page you were on. That makes life easier. But isn't that what software development is supposed to do?

I've been hacking away at this site and my shared stuff (dumb, dumbweb, filter, etc, etc, etc) that I use on all my websites ever since I told my work that I won't be coming in anymore. Well, I actually just turned down the position offered to me, which was to do with VBScript, which I can't do. Not because I don't know it... it would just be a huge change in how I think when I program. If a language doesn't support standard object oriented features, then I'm f@#%@ed. I have a hammer and everything looks like a nail.

The other day I went to a User group meeting for Philly on Rails. I don't use rails or ruby, but I might start soon. Zatko said he'll play Dawn of War with me if I learn ruby and rails, so I have to since that's the best game ever, and I haven't played multiplayer yet. Actually, we have to play first then I'll learn Ruby. Jared went too. We were the bomb.

New Filter Features!!

First, notice the "Possible count" on the bottom right.

Then filter by this text exactly : Cigarettes and Carrot Juice

Then notice what it says. Cool huh?

Then, notice the help icon! I know they don't look great, I'm a n00b when it comes to CSS and DHTML. Plus, I hate Internet Explorer because I use the w3.org specs and they never work on IE. So, if you use IE, there's no support. Download a real browser.

But you're not a real programmer if you don't support IE!!

I'm a lazy programmer, as I've said many, many times. It might work... I did some standard checks, but haven't tested it. I'm on Linux and a Mac. No IE.

So that's it. I could go on explaining what I did but I'm not terribly proud of the count stuff. I did it and couldn't help but think I hacked it together. It's just not beautiful yet.

Problems with Dumb

All fixed.

First, it's common to want to do this...

Select * from Table1 join Table2 on Table1.ID = Table2.Table1ID where Table2.Something = whatever.

That now works in dumb by doing simply the following:

Table1 t = new Table1();
Table2 t2 = new Table2();
t2.setSomething(whatever);
t.setTable2(t2);

engine.load(t);


So it'll select everything from Table1 where a certain condition on Table2 is true. Like, selecting polls where a poll answer contains 'The'. Of course, this works in filters because the filter is actually generating its own SQL. Saving that object was never a problem, that's been a part of dumb since the old days, over a year ago.

Another problem I had... it's very common to have a table like this:

table UserFriend {
userId int not null,
friendId int not null,
constraint foreign key userId references (User) userId,
constraint foreign key friendId references (User) userId
}


Two fields are references to the same table. Before, my generated sql code would pretty much only work if no table was joined more than once, either from the same initial table, or later on down the joined road. Now, I can have any number of references to the same table either in the initial table or down the road. It all works now. It's beautiful.

Anyway, I'm still chugging away at the... oh wait, that last game update was the last one.

Last Game Status Update

Because I don't feel like doing them anymore. If you want to know, just ask me. Or subscribe to the newsletter...

The thing's almost done. When you have a document called "CWG_Status.odt", it of course means you're using the OpenDocument format, but also means that you are reminding yourself of what you still have to add. And when that file goes from 10.4 KB to 8.3 KB, it means your almost done! So, I poke a little fun at ODF for its size... so what? The price is just right ($0.00). It's fast enough for me. Anyways. Right now I have 9 lines of stuff that still needs to be added. One will be addressed after the initial version goes live. I know, it can't be considered "Finished" until it's actually "Finished" but, name one piece of software where the creator had no more ideas for new stuff to add after it was "finished". It's the great thing about my job, I just work and work and work, and my boss will ask "Are you finished?!" and I'll reply "Software is never finished..." And it's like eternal job security with no ship date.

That's funny though, because you can finish a work of art. Like, a song, or a painting, or a photograph. With art, though, it's like, you reach a point where you consider it done, and then you take stuff away. Especially in sculpting. They haul in a huge chunk of marble for Michaelangelo and he says "I'm done! I just have to cut some marble away now."

At some point in the last 3 years, I've learned to see computer science as more art than science, though. A program can be beautiful. It can be elegant. You can show it to other people and they may or may not (usually not) see the beauty in it. It's a messy process. I'm not talking about the user interface either. I'm talking about the code. The design. The implementation. The very little code that does a lot. The abstraction. The sweet, sweet pleasure of everything running correctly.

So the game is almost done. It's looking beautiful... not in the sense of how you probably think of beauty, but in the sense described above. The code is beautiful. The interface is not beautiful, at all. Well, it kinda looks like this site, only less gray, and more non-colorish. Here's my motto:

Function, then beauty

It makes life easier. Get it to work, then make it aesthetically appealing. That's down the road though, since this isn't like a 3D game or something. It's a web game. With an incredibly lazy creator.

There's more logic in this game than anything I've programmed in the last 3 years. Well, I guess that's an exaggerated statement. There's certainly a lot of logic in dumb and it's web counterpart. I guess I can say, there's more logic in this application than any other application I've ever done. Meaning, something specific, like this website, or other websites I've done, even in work. Underlying systems aren't applications, they're tools to help make application development easier, and that includes dumb and dumb web. And the security system, and my menu system which still holds its own. So this adds a level of complexity that I wouldn't normally find in an application, but not one that I'm not capable of handling. Basically, here's what goes on with my other applications...

select data from the database
show it


or

show a form
input data to the database


With dumb and JSF, there was literally no work do be done here. I can't say what's going on now, only because it's too complex and it would give away my great ideas.

I look forward to releasing this game on the web for the 4 people in the world that will enjoy it. Should be within the next week or so. w00t!

Picture Filter Added

Also, you've probably noticed the news categories on the left of the main page are gone

(<---- psst... over there)

This is due to the filter destroying this page and taking up all the landscape, and no need to list categories anymore since you can just filter by them, and Todd wanted to know when I replied to his comment in "The end of the world".

So, now my website seems VERY busy. I want to add more crap...

I started to reply to Todd, then had to go to work, saved the text in a file on my MacMini, went to work, came home a few hours later, then the Phillies were playing the Yankees and our fearless genius leader, Charlie Manuel, had set the lineup so Abreu and Howard were sitting and Chase Utley was playing first... it was something I had to see... they won!! Amazing. I was being sarcastic about Charlie being a genius. Oh, and I watched game seven of the Stanley Cup Finals, and was cheering for Edmonton so that probably doomed them, since Carolina won the Stanley Cup, those b@#tards. So, I had to work on that stuff after those games. Now it's like 2am and I have to go to bed. So, probably tomorrow Todd :)

Out of curiosity, due to the fact that when my web game comes out, it will require probably tons of disk space, I checked the amount of space left on my hard drive on this server. It's an 80 GB drive. There are a few websites on it, and one with lots of images, and this one has lots of images, and there is a lot of data in my databases, and of course Linux and software like Java, Tomcat, GNU tools, etc, etc, etc. Lots of stuff. There are three partitions, and one's not a file system (maybe it's a backup?). Here's what the "df" command in Linux returns. I was like "SWEET!"

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda2 75790304 4175216 67765112 6% /
/dev/hda1 101089 9324 86546 10% /boot
none 252864 0 252864 0% /dev/shm

Basically, I'm using 4 Gigabytes for all this junk. Well, you can add it up. The boot partition has a 101 MB partition, which is nothing compared to the 67 GBs I have left on hda2 (Linux doesn't use C: or D: like Windows. HDA is the first hard drive, and 1 or 2 [3,4,5, etc] refer to the partition). In other words, I have plenty of f@#%ing room.

Improved Filter

You can thank Zatko for this one. Since I only test this on my laptop so far, my mouse pad is directly accessible from my keyboard without much effort. So, on my laptop I am much quicker. You can refer to the post entitled "Hell" (use the filter, silly!) to see how much I hate how people go between their keyboard and mouse, when they can just use the keyboard all the time. So, generally, on a laptop, I don't have a problem with using the mouse moreso than on a desktop, since it's so close. And naturally, I totally forgot about keyboard accessibility when designing the filter.

So Zatko says "I would recommend using a form post instead of that link. i kept typing stuff and pushing enter and nothing was happening."

Touche. As this implies, great programmers think alike and hate using the mouse when they've already got two hands on the keyboard.

So, I've scripted up some script-y JavaScript. It now checks if you press enter on the form. Due to incredible programming ( ... in onkeypress, return false in a child control ... ), it will process the subfilter, where you search for News Categories on this site, and not process the filter, when pressing enter on a subfilter's text box. But, when you check an item in the result and press enter, it'll process the filter. It's quick and responsive like that.

However, I'm not sure it's 100% valid. I've noticed in the html reference for the FORM element, that s@#% doesn't have an "onkeypress" attribute. So, instead I used the good old fashioned "document.forms['formId'].onkeypress = funcKeypress;" method of doing it, instead of "<form onkeypress='(some javascript code)'>". Function pointers are always an excellent way of doing things. I searched for the second one, and the only sites I could find are *SHOCK* Microsoft web development sites like ASP and ASP.NET forums. I'm just not sure if Mozilla is allowing it in Quirks Mode or if it's an actual event on the form object. Who knows. It works, but that just doesn't seem good enough for me. Oh, and I have no idea if it works in any Microsoft related technology, since I've only tested it on my Linux and Mac computers... The gaming computer is the only Windows one up, and I'm not sure it's fit to be browsing in IE, and I don't install any software on it besides games :)

So, it's a lot simpler to use, thanks to me being down to 3/4ths of the number of computers I'm used to having, and the one being the one I spend most of my time browsing the internet on, and of course, to Zatko.

New Filter!!

I'm heading out to watch the Phillies today, so real quick I decided to put up a filter on the news. It's like being a proud father, you just want everyone to see your kid hit home runs. I just want to be able to have everyone search for news. You can always find quality stuff when you enter "drinking" (or "beer") into the "Text" search. I know it doesn't make sense to have a filter AND have the categories listed on the left, but I literally have to go get ready for this game and buy some beer to bring along, which of course means I have to hit up WaWa, get money, and buy smokes and something to keep me occupied while the Phillies are getting slaughtered by whoever they play today. They're the only sport right now in Philly, so when they suck, your whole summer sucks.

I'll be putting one up for pictures and downloads soon. Pictures especially needs some help. Plus, there's a major bug on the page that I notice every time I go there, like 3 times a week, and I haven't devoted any time to fixing it yet. Plus, I'll be adding more cool filter types so you can say "List news that has comments". Or like, "List news with comments between 5/1/2006 and 6/17/2006... 0 results returned!!" Oh well.

Filter almost done!!

Man, this thing's cool. Dynamically rendering, populating, and filtering.. filter.

(Forgive the colors... the Linux Gnome screenshot utility kinda cut out some colors, but it looks good on it)

In this screenshot, I search for all "Works" where the title contains "My" (or "my" or "MY" or "mY"...) within the last 9 days, and that costs at least 0 "gold". This is kinda giving away some secrets of my game, but there's more fun parts to it.



In this one, the filter doesn't change, but I am actually searching for "Labels" that I would want to filter by. Labels are like "Tags", where a user can enter any number of comma separated labels, and they get parsed and put into a table if they don't already exist. Basically, that table contains a LabelId and a LabelText field. When I search for Works with a Label, I am actually searching neither the Work table nor the Label table (rhyme!!). I'm searching a link table called "WorkLabel" which has WorkId and LabelId. It's neat, but necessary.



Here, I actually search for Works labeled "jtccom". None came up, because I created that work 10 days ago, so I had to change the Date filter to be within the last 10 days.




And that's all created with a simple JSP tag, as shown here:



Filter name comes from the following config file, which is where all most of the magic happens is defined.



So, there you have it. Automatic filters, based on "Dumb". My life doesn't get much easier.

It's not done yet of course. But I made it so I could easily add more "modes" for controls. For example, the Date filter right now only has one mode, "within". That searches for a date after the value computed from the filter. I could add a "withinof" mode, which will basically have a second input area for a Date, and you could specify "within 3 days of March 23, 2007". So, filters can be extended. Also, I have two other objects that work behind the scenes pretty heftily. There's a FilterProcessor object, which takes a FilterInput object and, using SQLDOM (another home made thingy), crafts a where clause. That where clause is appended to any other where clauses already in the select statement. A "Work" will only be listed if it is Active, however, that's not in the "autoFilters" section of the filter-config.xml file (although it could be). It's specified in my application.

Just take my word on it, it's sweet. :)

Latest Game Status Update

I do this every time. I get so close to finishing something, then I decide that I must add something that I find to be a common thing, so that I never have to do it again, for any project in the future. And of course, it must be flexible, customizable, etc, and above all, it must work.

The latest thing is a filter, or an automated filter system. For instance, I have news on this site. News has a date, the title, the text, and some categories. So basically, I want to create a filter system that will have some control for each of these fields, a user can type "I am hot" in the description field, and it'll find all the news with that in the description. It's a search, basically, but a search only has a text field, therefore it's more of a filter. One thing is they'll be able to say "Find all the news in this category with this in the description"... or "Find the news within 5 days of this day and in this category".

So, I have to finish that now before I'll be able to work further on the game.

I love Regular Expressions

I have a shirt from ThinkGeek that has a regular expression on it. I wear it to work sometimes.

I'm making my web game, and one of the requirements that I came up with is to allow formatting HTML but not all HTML. This is a pretty reasonable request.

It's easy to get rid of all HTML tags using a simple regular expression in Java. It's

<[/]?.*?>

Just do this:

String regex = "<[/]?.*?>";
myHtmlFilledString.replaceAll(regex,"");


This is elaborate. I actually wrote an app so I could upload screenshots. The Java source code is here.

What I needed to do, for now, is replace all HTML except those basic HTML tags that do formatting... essentially to bold, italicize and underline. You can think of it methodically, easily. "Go through, if it's an HTML tag but it's not bold, italic, or underline, erase it." But I'm lazy. Here's the shot of my test application replacing all HTML in an input string. The input string is on top, the result is in the middle, and the regular expression used is on the bottom. The button simply performs that replacement.



Here is the regex I found to replace "not allowed" HTML tags... those that aren't bold, underline and italics (for now).

<[/]?[^/uUbBiI].*?>

I basically went through hell to get that though. It's fun but man it's a mind bender to think in terms of regular expressions. Here's the screenshot of that regex.



That is all.

Web Game Progress

So far I am 0% done my web game. This is as of Friday night at 10:20 (or as my Linux box shows the time, 22:20). So far, I have two documents written on it though. One is a functional specification. The other is a technical specification. Working in the software world, you learn to depend on these two documents. Here is what they are:

Functional Spec: (Sometimes refered to as the f@#%ing spec... by me only apparently. Commonly refered to as the Design Document) This document gives an overview of the various use cases of the software. During the functional spec, you lay out that this is indeed a software solution to an otherwise real world problem. Say you are designing an email program. You will say that the user will be able to send and receive emails, using at least one server. They will be able to view the entire contents of emails, and have a hierarchy of folders to hold archived emails. They will be able to flag emails by importance. The solution should filter spam automatically, determined by a number of factors, some of them user specified.

Now, a technical spec, on the other hand, takes the functional spec and builds out, in detail (as much detail as you can before you start writing actual code in an [in this case] OpenDocument text document), each high level feature of the functional spec, and defines exactly how each feature will interact with other features. This makes it simple to write software. If you hand me a functional spec and a tech spec, and say "Get to work, you lazy bearded b@#%^@", I will reply with "Yes, Sir, may I have another?!?" As you can see, these are highly desireable in the field of software design and development.

Note also, that when "speccing" (actual word in IT) out a set of "Design Documents" (you can also refer to the whole set as "Design Documents", as well as just the functional spec... Software is flexible like that, and everyone knows what you mean by the singular form, and that you mean the group in the plural form)... where the f*@#! was I? Too many parentheses. Oh right. When speccing out design documents for your own, home brewed project, it is a much more enjoyable scenario. Like, I can be going through and say "You know what... f@%! that feature, no one will use it and they'll all probably send hate mail to me if I include it", whereas in work, you have to do it because it was predetermined that we don't care about customers enough to make them happy, therefore the feature must stay. Also what makes home project docs more enjoyable is that it's your s@#%. You get full credit, people worship you, girls send you pictures of themselves in bikinis, guys question their sexuality, etc. It's just cool.

Anyway, I have to get back to work. It's speccing out to be much more complex and detailed than what I first imagined, however, I'm speccin' I won't go past my two week estimate. (O Brother, Where Art Thou shout-out : "I'm speccin' you'll be wantin' them chains knocked off". Great movie).

I'm gonna start on this

My web game. I'm becoming increasingly sick of the internet and it's "nothing fun to do for a 5 minute window of time to waste". I was looking for something to easily scan images in that I create on paper, but the only thing I can find got bad reviews. It was a "pen scanner", literally 8.5 inches wide and about 1/2 inch thick, and you roll it on paper to scan it, but people were saying how the quality was diminished. I do have a flatbed scanner, but it's a POS. Basically, I wanted to make the site look professional, since I can't draw with a mouse. I used to draw as a kid, and was pretty good at copying images from, say, a Teenage Mutant Ninja Turtles trading card, and scaling it up to fit onto a standard art pad (10x14 i think). I would color it in and show it off. One time I drew a picture of Homer Simpson and said to my oldest brother, "Want to see a picture I drew of Homer?" He said sure, so I showed him, and he was like "Man, I was expecting something pretty bad but that looks just like him!" I also did pictures from Marvel comics like Wolverine and the Fantastic Four. They were fun. Point is, I used to be able to draw, and remember enjoying it a bit, and think I can still do it with the right equipment. Like this picture I drew in work at my last job:



Pretty f@#%@ing sweet, huh?!? Anyway, I'm going to just program the site this weekend during times of soberness (Three day weekend!!!), see how far I get, then do some art for it later. It'll be fun, and like the original post says, there's nothing like it out there.