So, you'd think working on websites all day I'd be more on top of this, but I had my domain name getstonered.com registered under an email address I rarely checked. That meant, that when it was time to renew the notice went to that email.
Thursday, January 14, 2010
Stupid Domain Grabbers
Magic Mouse + MagicPrefs + AppleScript = Awesome
5 months since my last post? Not bad.
I just recently picked up an Apple Magic Mouse and have been playing with MagicPrefs to try to find the best setup for how I use my Mac. Since I already use a lot of keyboard shortcuts I didn't want to use mouse commands for something I can already do easily.
Here's the list:
Left Click: Two Finger Click + One Finger Left Click
Right Click: One Finger Right Click
Scroll: Single Finger Scroll
Dashboard: One Finger Middle Axis Click (Like clicking the trackball on a Mighty Mouse)
Expose - All Apps: Two Finger Swipe Down*
Expose - Desktop: Two Finger Swipe Down*
* I thought about using pinch in/out for these two commands but thought I'd rather have that for zooming in certain applications.
iTunes Controls
One of the great things about MagicPrefs is the ability to map gestures to Custom Targets, such as Applications, Keyboard Combinations, and Applescript Commands (awesome!). So I setup some applescript commands for iTunes to use with the mouse. All iTunes Controls use 3-finger commands since I didn't see those being too useful for other things.
Play/Pause - Three Finger Click - 'tell application "iTunes" to playpause'
Next Track - Three Finger Swipe Right - 'tell application "iTunes" to next track'
Prev Track - Three Finger Swipe Left - 'tell application "iTunes" to previous track'
Volume Up (by 10) - Three Finger Swipe Up - 'set output_vol to output volume of (get volume settings)
set volume output volume (output_vol + 10)'
Volume Down (by 10) - Three Finger Swipe Down - 'set output_vol to output volume of (get volume settings)
set volume output volume (output_vol - 10)'
Friday, August 7, 2009
The Kobe Angry Face
As a big Utah Jazz fan (and basketball in general) I follow a lot of what goes on in the basketball world. During last NBA playoffs a lot of media coverage was given to Kobe's "Intensity" face (I call it his Angry Face) and how it shows he's a true competitor.
Luckily, I managed to find the real source of inspiration as showcased in the image below. What an imposter!
Tuesday, December 16, 2008
Beware of the Doghouse - Great Online Advertising
I see this as the future of really effective online advertising. Creating spots that can work on their own, even if people aren't aware that it's an advertisement.
Watch the following video and see at what time in the video you realized it was an ad. It probably could have been branded a little more effectively at the end of the ad, but overall I think they did a fantastic job.
http://bewareofthedoghouse.com/videoPage.aspx
I think I realized it at about the 4:10 mark.
Friday, December 12, 2008
Yahoo Games - iPod Touch Ad
Sorry, it's been a while since I posted, but I found my new favorite online advertising campaign, courtesy of Apple, Inc. This is one that you'll definitely want to see in action.
Head over to http://games.yahoo.com and wait for the ad to load. I've included some screenshots below for those too lazy to click on a link.
For those who can't quite figure out 'How They Did THAT?!' I'll include a little info.
The entire ad is Flash, and is laid over the default Yahoo header. I assume it's a single flash file, rather than multiple flash files coordinated through some javascript or some other means. The top of the flash covers the yahoo navigation and logo, except when you mouse over the top. You'll notice the animated navigation elements stop moving and there's even a very slight shift in the location of the elements. That shift gives away that the top of the Flash ad is being hidden to allow the user to interact with and select other pages.
Last, you can right click anywhere on the top half of the page and you'll see that it's all Flash. Lovely.
UPDATE: The ad's gone, but here's a video capture someone posted on Youtube. http://www.youtube.com/watch?v=sSZ_IAXuSSk
Wednesday, October 8, 2008
The Problem With Politics & Elections - McCain and Obama
This is a bit of a departure for the blog, since it deals mostly with technology topics. However, the ongoing soap opera that is the 2008 Presidential Election has got me frustrated and after reading some great articles I think I've got a fantastic change to how elections should be run.
As a preface, you may want to read this great NPR article that my good friend Russ Page turned me on to. You can read the article here: What We (Still) Don't Know About Obama and McCain
For those of you too busy (or lazy) to read it, I'll summarize really quickly. NPR's Ron Elving argues that the debates up to this point have really given us no real information on McCain or Obama's campaign. They manage to skirt around any specific questions addressing policy and most moderators (read: Tom Brokaw) don't feel compelled to force a direct answer.
In particular Elving addresses the fact that neither candidate has given any indication of who would fill their cabinet positions. I think this is even more important with some of the tasks these cabinet members would be given. I am interested to know who each candidate would appoint as Secretary of the Treasury, now given the task of using the ridiculous $700 billion bailout just passed. I would like to know who Obama would appoint as Secretary of Defense, as I feel this is one area he seems weakest. For McCain, I'd like to know who would be Secretary of State, and how he feels his administration would address some of the international image issues our country faces. As these people often dictate national policy, all voters should be interested and concerned over who the candidates plan to appoint. Elving also points out that this should even extend to Supreme Court Justice nominations.
I would love to see Elving's ideas implemented. However, I think this should be taken a step further. The idea of a campaign is to to educate voters on why the candidate is the best choice. Unfortunately, under the current campaign system we get absolutely no concrete information on what the candidates are actually going to do during their tenure as President. We get lip service to curbing government spending, securing borders, pulling out of or winning the war in Iraq, or fixing our lagging economy. The one thing I don't hear are concrete plans for actually doing this.
And that is where the current election, and every previous one, has failed. The candidates should be creating a plan for the country for the next 4 years that includes concrete appointments and concrete ideas. Who would be some of their major cabinet appointments (and can we hold a candidate to appointing from this list)? What specifically would they do to address the national healthcare? How would they address social security and what financial projections would their solutions actually create? Do they actually have a plan for winning or successfully withdrawing from Iraq?
If you visit either campaign website, www.barackobama.com or www.johnmccain.com, you'll find a large portion of the site dedicated to 'The Issues.' Each outlines what they feel are the most important topics of the campaign, and list how they will address those issues. Upon closer inspection, what you really find is that there is almost no actual information about what their plan is. The great majority of the time each websites simply states the supposed results their plan will bring. What they don't discuss is what the plan actually is. Below are actual excerpts from each site.
Obama and Biden will level the playing field for all businesses by eliminating special-interest loopholes and deductions, such as those for the oil and gas industry.
http://www.barackobama.com/issues/fiscal/
John McCain believes we should send a strong message to world markets. Under his plan, the United States will be telling oil producing countries and oil speculators that our dependence on foreign oil will come to an end - and the impact will be lower prices at the pump.
http://www.johnmccain.com/Issues/JobsforAmerica/relief.htm
Both these statements do not given any specifics on how they plan to accomplish this, just the intended result. Even when either side does specific a particular piece of legislation they want to change, there is rarely any specific course of action that is given. Everything is wrapped in a nice blanket of generality, preventing anyone from making a truly informed decision. I suppose this allows the candidate to prevent his opponent from using any specific idea against them. The losers in this campaign of generality is the American people.
My solution is to follow Ron Elving's advice. We need concrete plans from each side that all Americans can read to make an informed decision on who he/she believes can best lead this country for the next four years. I propose in this bill they focus on some specific items listed below. Each of these items should include an actual plan plus financial projects (where applicable) or a breakdown of expected results and when we can expect those results.
- Cabinet Appointments
- Economic Policies
- Sub-prime Plan
- Social Security
- US National Debt
- Taxes (honestly, how can Russian manage to implement a flat tax-rate and we can't?)
- Poverty/Welfare
- Foreign Policy
- Iraq War
- Fight against Terrorism
- America's Global Image
- Relations with (potentially) hostile countries (Iran, North Korea, China, Russia, Venezuela)
- Education
- Health Care
Luckily, with the availability of information on the Internet we have more information on the two candidates than we've ever had. Naturally, each tries to show their positions on specific key policies, but we need more than positions.
I don't want to know that John McCain plans to reform the health care system by introducing more competition to make it easier to get coverage and foster better quality. I want to know his plan of action for creating the competition. His belief means nothing without the details on how he plans to introduce this competition.
I don't want to know that Barack Obama feels we need to amend the North American Free Trade Agreement. I want to hear his course of action for actually doing it.
I commend Obama for his Blueprint for Change (you can download it on his website). It's the closest I've seen to try to give a concise overview of a campaign. However, similar to each website, in the end it winds up being largely a statement of position and not as Senator Obama claims, that it "lays out very clearly how I will achieve these goals for the American people."
Without giving us an actual plan of action, neither campaign is giving us anything that truly explains the steps each plans to take to carry out the change that each is so adamant to mention. Without a specific course of action, the American people cannot hold our next President accountable for the promises he made. And without that accountability, no change in Washington can truly be carried out, no matter how much each candidate claims otherwise.
* Let me know why I'm an idiot or a genius or what I may have missed in the comments.
Wednesday, September 10, 2008
CakePHP Model::findAllThreaded Frustrations
Been working on a shopping cart system at work, and we were having some weird issues with the category hierarchy manager we had built. For some reason (randomly it seemed at first) we would add a category and then shuffle its parent category and suddenly it would disappear from the threaded list. After about an hour of trying to debug the code for findAllThreaded (show below) I finally found the culprit in our case.
function __doThread($data, $root, $index = 0) {
$out = array();
$sizeOf = sizeof($data);
for ($ii = $index; $ii < $sizeOf; $ii++) {
if (($data[$ii][$this->alias]['parent_id'] == $root) || (($root === null) && ($data[$ii][$this->alias]['parent_id'] == '0'))) {
$tmp = $data[$ii];
if (isset($data[$ii][$this->alias][$this->primaryKey])) {
$tmp['children'] = $this->__doThread($data, $data[$ii][$this->alias][$this->primaryKey], 0);//$ii);
} else {
$tmp['children'] = null;
}
$out[] = $tmp;
}
}
return $out;
}
Basically, the way the function is structured if a child comes before a parent in the findAll results that findAllThreaded uses then it won't find it because it only looks after the parent for any children results, which forces you to do one of two things:
1. In our case, I edited the line $tmp['children'] = $this->__doThread(... to pass '0' for the $index parameter instead of $ii. This forces the function to go through all results each time. In our case we are only using findAllThreaded in the admin area of our cart, so we felt any hit in performance wasn't too serious. In your case, it might be.
2. Ensure the order you are using for the findAll results pulls results that are already structured somewhat hierarchal. You could have an order field that you sort by, but it needs to be somewhat static so that it can't be easily changed and mess up your list again (hence using something like the built in modified date field in CakePHP could cause some issues).
Hope this helps you bakers out there. If you have a better idea on how to ensure findAllThreaded works properly, drop a line in the comments.
EDIT: Actually, you can simplify all this by just ordering you results by the parent_id. So far that seems to work great without having to edit any of the cake core code. Plus it won't eat up as many resources as having to loop through all the results every time.
Posted by Graydon Stoner at 4:05 PM
Tags: CakePHP, Coding Practices, findAllThreaded, PHP
Saturday, August 23, 2008
Two Coding Styles Face Off
I notice that anytime I'm programming a new (CakePHP) site I'm often fighting internally about my coding practices.
In the blue corner is quick and serviceable. Quick and serviceable has come in winning many fights. His speed makes him difficult to corner, and he can be very adept at completing many things quickly. Unfortunately, this also leads to more problems as situations arise that were not considered originally making him more vulnerable.
In the red corner is longer and more thorough. He often takes a while to get going initially, leading to losses in shorter bouts. However, when entering the later rounds, he becomes a more serious opponent, and his record becomes even more impressive in closing out projects, I mean fighters, effectively.
We've been working on a new shopping cart site lately, and I have an add to cart script that checks the current product being added (along with any product attributes that may differentiate it) against the current shopping cart to see whether to add it as a new product or to an existing one.
My original inclination was to check by pulling all attribute groups for a product. Since they are associated with only that product I could easily assume that those attributes were also in the product in the cart. A simple loop through and comparison with the attributes in the cart should do the trick.
However, what if someone administering the site changed an attribute after someone added something to their cart, but before they want back and decided to buy some more. While that may not happen very often, it's just that type of thing that causes headaches and late night calls from clients wondering why a customer is angry with an issue with the website.
So instead of making that assumption, I loop through all the product attribute groups. Then, I check specifically if each product attribute group has actually been submitted by the customer (which originally I was going to just assume actually took place), and then check to make sure that the actual attribute values correspond before adding to a previous cart item or making a new cart entry.
What practices give you fits? Let me know in the comments.
Tuesday, July 1, 2008
MySQL and I are in a fight over MAX() and SUM()
I have a sort of love/hate relationship with MySQL. Although I probably shouldn't drag MySQL into this. SQL and I have a love/hate relationship. I love creating database driven sites since it allows for so many possibilities.
But I'm no genius database guru, so when I have a complex query to try to put together our relationship usually is on the outs.
I had been working on a solution to get a list of weekly stats for stats that get run daily. I managed to get a query working that allows me to find the weekly stats for a specific person for every week and sort them however I need.
SELECT SUM(Stats) as AllStats, Name, week(logdate) AS week_num, MIN(logdate) AS week_start, MAX(logdate) AS week_end FROM stat_table WHERE person_id = 'XXXX' GROUP BY week(logdate) ORDER BY AllStats DESC;
However, I wanted to expand that to allow the query to pull the top people in a group and find out what week was their best week. This is where it started to break down. I thought I could switch things around a bit and use the following query...
SELECT MAX(SUM(Stats)) as MaxStats, Name, person_id, week(logdate) AS week_num, MIN(logdate) AS week_start, MAX(logdate) AS week_end FROM stat_table WHERE group_id = 'XXX' GROUP BY week(logdate), person_id ORDER BY week_num DESC;
That was a no go. And the weird thing was if I took out the MAX() function at the beginning (and only select SUM(Stats)) I could run all stats for that group.
But, thanks to some really helpful people at SitePoint's MySQL forum (r937 in particular) I got a new, uber-complex subquerying query that seems to work great. I've posted it below for anyone else that is looking for a way to find the MAX() of a SUM() or wants to find weekly data when they have multiple records per week.
SELECT week_totals.person_id,
week_totals.Name,
week_totals.week_num,
week_totals.week_start,
week_totals.week_end,
week_totals.AllStats
FROM (
SELECT person_id
, Name,
, WEEK(logdate) AS week_num,
, MIN(logdate) AS week_start,
, MAX(logdate) AS week_end,
, SUM(Stats) AS AllStats
FROM stat_table
WHERE group_id = 'XXX'
GROUP
BY person_id
, WEEK(logdate)
) AS week_totals
INNER
JOIN (
SELECT week_num
, MAX(AllStats) AS max_stats
FROM (
SELECT person_id
, WEEK(logdate) AS week_num
, SUM(Stats) as AllStats
FROM stat_table
WHERE group_id = 'XXX'
GROUP
BY person_id
, WEEK(logdate)
) AS week_totals_1
GROUP
BY week_num
) AS week_max GROUP BY person_id;
MySQL and I may just be on speaking terms again.
Special thanks to Blogger for maintaining such wonderful formatting in the queries posted above.
Tuesday, June 17, 2008
SproutCore - A MVC Framework for Javascript
I've really been enjoying CakePHP more and more, and have just starting delving into the AJAX helper more and implementing that into some new sites. However, there is only so much functionality built into CakePHP, and you'd probably have to integrate one of the other AJAX frameworks out there (like jQuery, etc) to get something more 'Desktop-like'.
But after monitoring Apple's just finished WWDC and hearing about SproutCore, I dropped by the site to see what it's all about. It looks like Charles Jolley has put together a really nice framework that Apple has added to and leveraged for their new Mobile Me service.
From reading the site, though, it seems as though Ruby on Rails is required to get the framework installed. I'm hoping someone will put together a nice and easy way to integrate SproutCore with PHP (and hopefully with CakePHP) so you could leverage both frameworks together.
If anyone does, drop me a line.