PDA

View Full Version : Feature suggestion for the site - Random hint button


GlowingApple
04-01-2006, 12:18 AM
Hi, looking at the stats page I see there some 8.6k hints on the site. Since I made the switch about three years after the site was first created, I know I've missed a lot of great hints that probably still apply to the current release of OS X. I could go through each page, a bit at time...but I would really like to see the ability to pull up a random hint. Would be a great 5-min distraction from studying/working/etc.

mark hunte
04-01-2006, 06:37 AM
I like that idea,

I would use it.

tbsingleton73
04-01-2006, 07:45 AM
Add a bit of customization to it so that I don't keep getting OS 9 hints. Or so people who don't use Unix/Terminal the can choose not to get those hints.
I think this is a great idea too.

griffman
04-11-2006, 05:06 PM
I've thought about such a feature, but there are quite a few technical challenges to overcome. A truly random hint wouldn't be much good -- some hints were bad, many no longer work, some are "site news" or "pick of the week" entries, etc.

Other hints, though good when originally published and still functional, have been improved greatly by various commenters over the yeras. Ideally, when those were republished, the commented version would become the main hint, reflecting the knowledge of the community.

In short, it would be very labor intensive to do a meaningful random hint of the day...

-rob.

mark hunte
04-11-2006, 07:42 PM
You could set it so it only picks hints from a set period, like 1 year or 6 months.


Or have a side bar that comes up with links to possible related hints to the random hint.
I think most people realise that hints get old and would do a search to see what's new if they found the hint interesting .

fat elvis
04-11-2006, 10:24 PM
How about a widget???

I will volunteer my graphics skills to help out. I got mad art skills yo ;) There are others in here who I know work with graphics, but I didn't want to make such a suggestion without volunteering my services.

The quality of the hint shouldn't matter much..there will always be hits and misses. Perhaps if it's limited to popular subjects it'd be easier to compile(iPod, Photoshop, RAM, Network, etc.).

I'd be honored to be one of the MacOSXHints Widget-teers :)

GlowingApple
06-11-2007, 01:24 AM
This has been on my "programs to write" list for some time and I ran into it again today. As Rob mentioned, making a decent random hint would require an immense amount of work, but making a pure random hint finder shouldn't be too hard (though I doubt it could ever be polished enough to be a site feature). In any case, with the possibility of a "simple" widget in mind, I found a quick way to search for hints. Not knowing the php code and the labeling of each hint, I found out the following by trial and error:

Hints are displayed with article.php, setting the story variable to $YEAR$MONTH$DAY$HOUR$MINUTE$FIVE_OTHER_NUMBERS. This fits the submission date and time on some of the older hints I looked at, but none of the more recent hints. I'm guessing it might refer to the date and time of post time rather than submission. I also have no idea what the last five numbers are for.

In light of this complication, the new search feature is extremely useful here. There's a limit to how many entries can be shown on one page, but there's no limit to the number of pages. With that in mind, I found that http://www.macosxhints.com/search.php?mode=search&keyType=all&type=all&results=1&page=10205 can be used to locate each hint sequentially (where 10205 is the last page--at the time of posting this--and thus the first hint). Oddly enough, if I logged out (since it's going to be a bit more difficult to pass login information with a cli tool like curl or wget) page 10197 is the last page. Are there hints that only logged in viewers can view?

Also, as there are a number of hints posted every day, this maximum number would have to change dynamically. Having a program trial and error this number out each time a random hint would be requested would be possible, but would be time and bandwidth consuming, not to mention would send a lot of queries to the site every time. It might be possible to grab the main page, look at the page number of the link to the last page, and multiply by 10. The issue here is that I'm not sure if there's always 10 hints per page, and if the total number of hints mod 10 is not 0, then the program would have to work by trial and error on at most 10 tries (provided my logic is right here). This probably wouldn't be too bad, but it would be nice to find a cleaner way. Any ideas on how to better determine this value dynamically?

Anyway, using this scheme and ignoring the issues so far, running curl -s "http://www.macosxhints.com/search.php?mode=search&keyType=all&type=all&results=1&page=$HINT" | grep -A1 "$HINT\." | head -n 2 | tail -n 1 | sed 's:.*<a href="\(.*\)">.*:\1:' and setting $HINT with a random number from 1 to 10197, will return the link to a random hint.

A widget would probably be the best medium for this, though I only know a bit of javascript, not to mention I have no idea if it's possible to run shell commands with a widget, or how hard it would be to use javascript to download a page and grep, head, tail, and sed the output. I believe it is possible to have a widget run a local application, so that might be the best option for this.

In any case, I figured I'd share my findings in case someone knows of a smoother way to do this. I'll play around with it this week when I have some time and see if I can get a widget started.