Kilg.us – Fantasy Stat Tracker …Tracker

A blog about the development of Kilg.us – The Fantasy Baseball Stat Tracker

Posts Tagged ‘industry’

Find Friends

Tuesday, May 11th, 2010

I jumped into the Find Friends section of Kilg.us this evening, planning to update the logic to auto-accept all friend requests to “Major League Baseball” (at present, I manually check the account daily and accept requests). Hitting the page, though, I encountered a Lucene search error, so that derailed my attention.

It looks like the search logic was getting confused when the page was sent an empty query (just clicking the “Find Friends” link rather than using the form on the Dashboard). This wasn’t happening a month or so ago when I set it up, so I’m guessing it has something to do with the size of the index that is being queried now.

Anyway, I updated the code to handle empty queries more gracefully. While testing that, I noticed an issue when requesting Friends that don’t have a name on their profile. When making the request, the prompt would ask if you wanted to request ” ” to be your friend. That isn’t very helpful. I updated that script to pull in the user’s email address if a name isn’t on the profile. Now when you ask someone to be your friend, you will either be prompted with their name or their email address. Much better.

In the process, my JavaScript errored out a couple times. This, unfortunately, means I requested to be friends with a couple people I don’t know. So if you got a random friend request from me, I won’t be offended if you decline!

Indexing Users

Saturday, April 3rd, 2010

Earlier this Spring I changed the search function for finding friends and creating Industries. The biggest change was moving to a system that uses the Lucene search engine. Part of that engine requires that an index be built for the data to be searched. This was my first implementation of Lucene, so I didn’t have experience with maintaining that index of data. As it turns out, each time the data within the database changes, the index needs to be rebuilt to include all the correct information.

Initially, I wrote a short script to build the index. As more and more people signed-up for Kilg.us, though, the data became out of date because it wasn’t automatically re-indexing.

I have updated the processes for creating an account and changing user settings to display information publicly. Both processes now include a step that re-indexes user data. This should ensure that the user index is always up-to-date and all users with their information shared will be findable in the Find Friends search.

Managing Industries

Wednesday, March 17th, 2010

Kilg.us allows you to form industries with your friends so you can view eachother’s team and track one another’s stats. Here’s how it works.

Enter Your Info

After signing-up for a Kilg.us account, you’ll want to be sure to enter some of your personal information. By default, only your email address will be searchable on Kilg.us. To add more details, click “Manage my Settings” in the utility box at the top-right of any page. This will take you to a page on which you can enter your:

  • name
  • home town
  • home state
  • cell phone number

We recommend you include at least your full name. The other information will just make it that much easier for your friends to find you when they search.

Find Friends

Now that you’ve enter your information, go search for your friends! You can begin your search from your dashboard or by clicking “Find Friends” in your utility box.

In both places you’ll find a single search form in the right column. You can type any criteria into this field that you think might match your friend–his name, email address, phone number, home town, or home state. Kilg.us uses an open-source search engine called Lucene to try to find matches.

If matches are found, they will appear to the left of the search box. Once you find the friend you’re looking for, clicking on his name will start the process of adding him to your industry.

While Lucene is a pretty smart search, it’s not perfect. If your search terms don’t return a match, try changing them up a bit. In general, try to use more than 3 characters in a search and avoid punctuation.

What if you can’t find your friends?

It could be that you can’t find your friend because he isn’t signed-up for Kilg.us. If that might be the case, you can send an invitation! From your dashboard you just need to enter your friend’s name and email address to send an email invitation. In fact, you can invite as many of your friends as you’d like. If you want your whole league to try Kilg.us, invite them all at once!

Confirm Friends

Once you make an industry request, your friend will receive an email notifying them of the request. At that point, they will need to log-in to Kilg.us and accept your request before you can start viewing eachother’s teams.

When you get industry requests from friends, you will receive an email notification and will see an alert on your dashboard. You can accept or decline the request by clicking on the alert message on your dashboard.

Share Your Teams

Once the request is confirmed, you will see your friend in the right column of your dashboard. By clicking on your friend’s name you can select which of your team’s they can view. By default, they won’t get access to any. Keep in mind that sharing your team just allows your friend to view your stats. It doesn’t let them edit your roster in any way.

You can also change which of your friends’ teams show on your dashboard. This is managed through the “Select teams to Display” link in the middle of your dashboard. This page will list all the teams your friends have shared with you. You can pick whether to show or hide each one.

Player Layer and Language

Tuesday, June 23rd, 2009

While clicking through my team stats today on Kilg.us, I noticed that the stats display layer seemed to be out of date. After a little investigation, I found that the XML feed for the stats had not been updated since June 16. A little more digging turned up what looks like a change in the way MLB is storing their data. The format of the data itself seems to be the same, but they moved its home on the server. After updating the path to the data, all seems to be well and cumulative stats are up-to-date again.

In other news, I resolved an issue that yesterday’s IE7 “fixes” introduced. In the mega-drop-down, the new JavaScript set a negative top-margin for IE browsers. Turns out IE8 is enough better than IE7 for this to be a problem. So that method has been updated to only apply the margin to Internet Explorer version 7.

And lastly, some new language throughout the site. The Account Info page now displays an alert message if the User’s profile is set to Public but they don’t have a first or last name defined. Obviously it is difficult to find people in a search if you can’t search on their name(s). The new language encourages the inclusion of a name to help other Users in their searches. The Account Info and Sign-up pages now also have note text added to the password sections indicating that passwords must be at least 6 characters long. Previously the only way to know this would be to enter a password that was too short and try to submit it. At that point an alert would pop-up identifying the shortcoming. Now the User is informed up front.

Industry Emails

Monday, June 1st, 2009

Ever since Industries were added to Kilg.us, you may have noticed a little checkbox on your Account Information page labeled “Notify me by email of industry requests.” At the time, the addition of that checkbox was a preemptive step. As of tonight, it actually does something. When one Owner (requestor) requests an Industry with another Owner (requested), the requested will receive an email notifying them of the request if they have the box checked. The email includes direction and links for the requested to approve or deny the Industry request.

Up next will be an email notice to let a requestor know if their Industry request has been accepted. I expect that will probably find its way in sometime this week.

Drag-and-Drop

Sunday, May 31st, 2009

It is now possible to change the order in which your Kilg.us Industry teams display on your Dashboard and team-selection drop-down menu. Both displays use the same ordering. To change the order, click the “Select teams to Display” link from the “My Industry” section of your dashboard. This will open a page that lists all the teams your Industry friends have exposed for you to view. In addition to selecting to show or hide the teams, you can drag-and-drop to change the order of list. After making all the show/hide and ordering changes, click the “Save Display Selections” button to save your changes.

For a team to be visible on your Dashboard and team-selection drop-down, they must have the “Show” option selected. All teams (whether shown or not) can be re-ordered on the page, but only teams marked to Show will be visible to you elsewhere in Kilg.us.

The new drag-and-drop functionality is done using a JQuery plug-in–TableDnD. It should work across all modern browsers, but if you have any difficulty with it, please let me know.

In other developments, I tweaked the display of the Find Users page to utilize avatars and look more like the Owners list on the Dashboard. Doing so removed the “+” that used to be the activator to request an Owner join your Industry. You can now click anywhere (their avatar, name, email, etc.) on the Owner to make the request. There is still a confirmation dialog before the request is actually make so you won’t accidentally add people you don’t know to your Industry.

I also did some tuning to the logic behind the process of requesting Owners to join your Industry and the acceptance/denial flow thereafter.

Lastly, some style tweaks for all elements that use avatars and contain links. To identify hover-states, those elements will now display a gray border. The style uses the border-radius attributes from CSS3 that Webkit (Safari, Chrome) and Firefox make available. Those of you using less capable browsers (ie, IE) will have to suffer through square corners on your borders.

Housekeeping

Friday, May 29th, 2009

No new features on Kilg.us today, but hopefully the existing features are working a little better.

If you were online tracking your team tonight and had any Rangers or Athletics on your team, you may have noticed some odd behavior. It took a couple hours, but I think double-header stats should all be compiling correctly. I ended up working through a series of iterations over the process of collecting all the stats between games 1 and 2, adding them, and being sure not to collect stats over and over if they haven’t changed.

It was also pointed out this morning that, if a team didn’t have any players on it, errors would be thrown on the Dashboard and Team pages. That issue has been resolved. The issue manifested from an error in the team creation process. A team created with an apostrophe in it’s name would throw an error. The team would not be created and an empty, unusable team would be associated with the Owner. I deleted all those blank teams so if you used to have one on your Dashboard, hopefully it’s gone now. You can now create teams with apostrophes in their names.

Finally, when approving an Industry request, a 404 error (page not found) was reported. Turns out a typo had found it’s way into the path to the script. That has been fixed. I had noticed no new industries in the last couple days, though, so apologies to anyone else who encountered the 404 error in the last couple days.

If you encounter any errors or unexpect behavior while you’re using Kilg.us, please shoot me an email with a description so I can get it fixed up. Thanks to everyone who helped identify the bugs today!

Double Headers and Postponements (and more avatars)

Tuesday, May 26th, 2009

As I noted last week, making Kilg.us handle double-headers and postponements better was a priority for this week. After doing some fun work with avatars yesterday, I dug back into the guts of the app today. Kilg.us now checks for two games worth of stats for each player, each day. There is a particular pattern for the URL to gather a player’s stats, so the stat gathering process now checks for that pattern for both “_1″ and “_2″ games (games 1 and 2 of a double-header, respectively).

Checking for the second game is handled in the same manner as checking for the first game: first we check if the file exists, then we check if it was updated since we last collected it, then (if the previous two conditions pass) we collect the data. Hopefully this means we won’t see a noticeable slow-down in the performance of Kilg.us gathering stats.

At this point, all I can verify is that the code doesn’t break with the new additions. We’ll have to wait for an actual double-header before we know if the additions actually work or not. I know the Rangers have one on Friday, so I’ll be paying close attention to see how things go. Please be fore-warned, though: if something is wrong with my updates, it will become apparent on Friday. If I notice any peculiarities, I’ll post a note here on the Tracker describing what is happening.

Postponements

Postponements have been another pain-point for some users. In scanning the data coming from MLB, I believe when there is a postponement the data for players involved in the game are removed from the server. If this is true, the recent effort to schedule regular checks on player stats should, theoretically, address this issue. When stats are checked early in the morning, Kilg.us should notice that stats for any player involved in a postponed game are missing and correspondingly clear out that player’s day. This probably will happen before boxscore emails are sent, but likely won’t occur immediately after a postponement is called.

If I am wrong and MLB does not remove the data for players involved in a postponement, I’ll need to add some further logic. The Linescore file for each game notes if there is a postponement, but it is done through a text field so I’ll need to extensively research all the possible terms they could be using (postponed, postponement, cancelled, delayed, delay, etc.) before I can start checking for them. Because that will be significant work, I’m going to put off that effort until I’ve verified whether the previous described mechanism is working. Should it not be, please bear with me.

Avatars

Last night I posted briefly on the addition of avatars for Users and Teams in kilg.us. To elaborate a litte, the avatars are used exclusively on the Dashboard at this point and consist of a pre-defined set of images. My goal with the avatars is to help make Kilg.us more scannable. I think the first step (the dashboard) has been successful. I hope to pull those avatars into other areas of the application where they could be helpful. Activities around finding, approving, and defining permissions for other Owners in Industries are an obvious opportunity.

To implement avatars I added a table (to store the default Kilg.us images) and a couple of columns (to associate avatar filenames with Users and Teams) to the Kilg.us database. This structure will allow me to define avatars that any User can choose from (basically, those you see as options right now) and allow for Users to upload their own avatars without exposing them for other people to use. Until I build-out the file upload and image manipulation mechanisms, the only options for avatars will be those I draw and add. Once those mechanisms are built, you’ll be able to upload your own avatars.

The biggest obstacle to being able to use your own avatars is the image manipulation that will need to be done when files are uploaded. Kilg.us is using two sizes of avatars: 48×48 pixel images for Users/Owners and 32×32 pixel images for Teams. For the sake of consistency, all uploaded images will need to be re-sized to fit the proper dimensions. I think I should be able to handle that with manipulations and masks using ImageMagick. It is not something I’ve done before, though, so I imagine a fair bit of trial-and-error.

Bits and Pieces

Tuesday, May 12th, 2009

Updates to Kilg.us today:

  • Boxscore emails tomorrow morning should include team statistical totals.
  • Find Industry Members results page now identifies owners with a “pending” status (you can’t re-request an Industry now).
  • Add Players default state is updated so it lists all players instead of pulling in a seemingly random player.
  • Dashboard -> Industry “What’s This” link now opens a modal layer describing Industries and providing a link to the Tracker “social-networking” page instead of linking directly to that page.
  • Create Team and Change Team Name flows now encourage a 3 character minimum team name.

I’ll be out of town most of the next two weeks, so there probably won’t be many–if any–Kilg.us updates until late May.

New Statistics Calculator

Tuesday, May 5th, 2009

The new mechanism for calculating statistics that I mentioned yesterday is now in place and in use on Kilg.us. Instead of only calculating team stats on your team page, Kilg.us now can calculate the stats anywhere on the site. The Team page has been updated so it is now using the new stats calculator which might show modest improvements in page load time (previously stats were calculated client-side, which is generally slower). More interesting, the Dashboard is now displaying summary team stats for all your teams and your Industry teams. The summaries display batting average, on-base percentage, and slugging percentage on the offensive side and ERA, WHIP, strikeouts per 9, and walks per 9 on the pitching side. All summary stats are only for the players currently in the team’s lineup.

After monitoring the performance of the new calculator, I plan to implement the stat totals on the daily boxscore emails. Look for that in the coming days (but not tomorrow).

In addition to the new calculator, I also had to put in place a new engine for collecting stats. Previously stats were collected each time a Team page was loaded. For every player on the team, Kilg.us would check if newer stats were available (newer than what Kilg.us had stored in its database). If there were, they would be pulled into the system and the database updated. This process is still in place. But this method meant if nobody had visited their team page on any given day, the stats that would be displayed on the Dashboard could be out-of-date.

To solve this dilema, I added a scheduled process to gather stats. The process runs on the hour from 10am-1am Eastern time each day (March through October, anyway). It collects the latest stats for every player that is associated with a team in Kilg.us. This means dashboard stats could potentially be a little out of date, but should be reasonably recent. And up-to-the-second stats are, of course, always available on your Team page.