December 20, 2011

Rewrite/redirect from one dynamic page to another.

URL rewriting always stumps me. I never remember the details and have to rely on search or looking at old .htaccess files I’ve done before to get what I need for a new project. I’m not sure it’ll ever be something I’ll “master” (in that I can write the code and not need to search for examples).

ANYWAY, the last time I was stumped was where I needed to redirect requests from /faculty/bio.php?id=45 to /people/bio.php?id=45. Seems simple enough. The problem is that regular redirects don’t work for items in the query string so something like this won’t work:

Redirect /faculty/bio.php?id=45 http://site.com/people/bio.php?id=45

Instead I needed to use a Rewrite instead of a Redirect which are far more complicated. I found a few great resources but I couldn’t get it to work. I decided that instead copy/paste I would type out what I read so that maybe I could master the syntax.

Anyway, here is what I came up with:

RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^faculty/bio.php$ /people/bio.php?id=$1 [R=301,L]

Long story short that was ALL WRONG. Because of one reason. The problem was that I kept using $1 instead of %1. $1 is matches on the first RewiteRule pattern (of which I didn’t have any) and %1 matches to the first RewriteCond pattern (the pattern in parentheses or course).

Another problem was I kept trying this:

RewriteRule ^/faculty/bio.php$ /people/bio.php?id=$1 [R=301,L]

The problem with that rule is the slash at the beginning of the url match (plus the $1 instead of %1 . . . it’s always compounding errors that take the longest to fix). The “match” in the rule always starts from the current folder and you can’t tell it to start at the root from some other folder (which makes sense . . . imagine I had a /stuff folder and it it was some redirect rule that matched on /faculty . . . that would NEVER match since you are already in the /stuff folder).

Anyway, a few tough lessons I’ll probably forget soon. Maybe writing it out here will help with my memory issues.

Sheldon

December 8, 2011

Tekpub Value

I’m a big fan of Rob Conery. I like his honesty. I like that he’s a “rabble rouser” (I was going to link to a controversial post but there are so many!). And since Scott Hansleman considers him a friend I know he’s a good guy.

Two years ago I won a free year of Tekpub by answering a trivia question of Rob’s on twitter. It came at a GREAT time since I was recently out of work and trying to learn as much as I could. By the time my year had expired I had a new job and I didn’t think twice about handing over $200 during the two for one promotion in December.

Now it’s a year later and I blew $1000 on black Friday (mostly for a new TV . . our first flat screen!) and another $200 a few days later on a Lego train (which, so far, gave me way more joy than the TV . . it’s awesome!).

Needless to say I gotta watch the budget. Do I really want to spend the $200 for Tekpub this year? If I were to purchase every production from 2011 independently, here is how it would break down:

Mmmm, $171 . . . over the course of a year. Way less than I thought. This is an easy decision. For 2012 I’ll buy the ones I really want to see and save that $200 for another Lego set.

Sheldon

October 25, 2011

Taking half

Got this in an email from “Republican John” and this was my response.

====

What about taking half and giving it to disabled kids? Or taking half and using it as payment for cleaning the sidewalks? Or taking half and giving it to kids in neighborhoods where everyone is poor and hardly anyone hands out candy?

October 21, 2011

It’s probably all a hoax.

I wish I could give credit to someone for this but I got it in a random email. Mmm, maybe I’ll try Google Image search.

Sheldon

July 6, 2011

The infrasturcture is great . . . . except for this one thing.

I have almost nothing to complain about the IT infrastructure at ASU. Wireless works great (there are TWO wireless networks to jump on, the guest one and the one and the official one that works as if you are wired in . . no VPN needed). The servers we use are rarely down. There are wiki solutions and hosting solutions provided by UTO (instead of the “IT department” it’s the University Technology Office) for faculty and staff (and students but I’m staff). my.asu.edu the “portal to everything” (including payroll, hr, help desk as well access to class schedules, grades and other student info) is slow at times and kinda clunky but it works and it’s a big job so I get that it can’t be perfect and I’m happy with how much of my info I can manage online (seems like everything related to data at ASU is done online except for things where you need a signature). I can go on and on about the good and great but this is youfailed.us not youwin.us.

I’ll sum up my problems with a help ticket I’m about to submit.

=============

I like ASU gmail. I want all my ASU email to go to gmail. But since I need Outlook for testing html email I’ve kept it around and pop’d my messages from there to ASU gmail.

This presents 2 issues: a) in the GAL (global addressbook in Outlook) my email address is sheldon@mainex1.asu.edu and that’s the address other Outlook users (including my boss) see, and b) ASU Gmail will only pop exchange about once an hour and that’s not enough (which isn’t something UTO decides . . it’s a limitation of gmail itself and there to protect resources).

Since I can’t (and UTO won’t) change the GAL to my real address without deleting my exchange account I would like to delete my exchange account. I know I would loose access to public folders and the calendar but I don’t use the calendar and we’ll figure out a new way to handle the public folders email that I need to see.

Sheldon

April 14, 2011

Been a long time . . . and today is about Taxes!

Taxes suck. We pay them at every turn. Seems like everyone it taking a piece of us no matter what we do. Income tax, sales tax, property tax, and even a death tax! And when we look at it that way, sure, TAXES ARE EVIL.

But what are taxes for? Why do we tax in the first place if we have a government for the people by the people? Why not just get rid of taxes all together? Is it because of the evil greedy politicians?

Of course not. We tax because we all want a “common good”. The common good in the greater sense is that our country is protected. Our way of life is protected. It’s no accident military spending is such a large part of the federal budget. What does the “common good” include? That’s the debate and the fundamental difference between Republicans and Democrats.

The “common good” changes over time. The better things get, the more “common good” we want. It never goes the other way around. In that view, the government and taxes can only grow larger year after year until one day all income is taxed and the government takes care of everything. Democrats greatest fear is zero taxes and no “common good” and Republicans greatest fear 100% taxes and no freedom.

We need to be mindful of both extremes. BUT, can we really know if taxing income over $250k another 3% is too close the the Republicans greatest fear? Can we know if lowering taxes further will mean greater prosperity?

I have a problem with absolutes. There are no sure fire answers. We have to remember we’re starting from right now and not starting from scratch. We are not conducting scientific experiments where we can make this change or that change and expect an outcome. We lowered taxes 40 years ago and we were prosperous. That doesn’t mean it’ll work today. Sure, we can and should look back but anyone certain of the future is kidding themselves.

The highest income tax bracket took 92% at one point and we changed it. We are constantly fine tuning taxes to meet the balance between the common good and personal freedom and we will never be done. Can we come up with something better than “you can’t tax your way out of a deficit” and “tax the rich more, they can afford it!”?

Sheldon

September 13, 2010

Windows 7 Activation problems and how MS hung up on me

I get the 3 user family pack . . . in fact, I get two just in case I want to upgrade my HTPC boxes. I install Windows 7 on my two office computers and all is well. Then one of my HTPC boxes dies and the Core 2 Duo it had was faster than the one on my main machine so I decide to switch it. Windows 7 box wants to activate again. I go ahead and let it knowing I probably lost one of three activations for the first family pack and now I don’t have any left. As for the HTPC WinXP box, well, it didn’t try to activate after the processor change and it turned out to be the video card. Side note on PC Troubleshooting 101 for computers that previously worked fine: 1) new power supply, 2) hard drive?? 3) new video card, 4) motherboard is dead.

Fast forward 5 months and that same machine dies. Hard drive issues. A month or two before I decided it’s time for a new PC and already started ordering parts. The Win7 family pack is for upgrades only so officially I can’t use it on this new machine. I know one of my XP licenses are the full version while others are the OEM versions. I have no idea what computers have what licenses but the OEM version is tied to a motherboard (or other hardware) while the full versions allows you to move to a new computer if you wipe it off the old computer.

ANYWAY . . . I don’t have a full time job now and I can’t go and buy Windows 7 too even if technically I should. I mean, I already have it! I spent $300 when it first came out because the family pack was for a limited time! And my “upgrade” was an $88 Core i3, an $88 Gigabyte motherboard, $88 for 4GB of RAM (Fry’s was having a sale) and $180 for an X-25 80 GB drive from Newegg.

Wow, this is going way longer than I thought and I haven’t even gotten to the good part.

So I go to activate Win7 on my new machine and the online activation fails (I used my instructions from an earlier post about installing on a new computer). I knew it! So then I make the dreaded phone call and read in all those numbers. The automated lady kindly tells me I’m breaking the rules . . . and then she hangs up on me!!! I was furious and that’s why I started this post.

I called back. I didn’t read in any numbers and just tapped on 0 until the nice robot asked me if I needed help and gave me the option to talk to a real person. I get a real person, read her all the numbers and she tells me a new group to type in. No questions asked!!!! I couldn’t believe it. I still can’t believe it. I guess the pirates don’t have the persistence to keep calling in!

And, no, I’m not a pirate. I also bought an OEM Windows 7 Home that day for $88 too. I couldn’t pass it up. But I didn’t have to use it it this time. And next time I have an issue I’m going to use the Family Pack DVD to do the install but use the OEM number just to see if that works! I always hated that there was 50 versions of XP and you had to use the right install disk.

August 13, 2010

Oracle is soooo smart.

Oracle suing Google is just plain crazy. The more I read about it the more I’m finding it was inevitable and it’s just the ebb and flow of business. Business buy companies not necessarily because they created a great product but because the people there are valuable and apparently so is the IP. Oracle probably bought Sun for the sole purpose of suing big companies. They get to sue one of the richest out there is all the better. Interestingly, it could be that Google KNEW it was coming and they designed Android around Sun’s patents.

I’ve got a few links here I want to share and go back to after this mess is over.

First of is Miguel (yeah, just Miguel, we’re totally friends and stuff) and his Initial Thoughts. Basically everything I wrote above is me just thinking what Miguel thinks because I just read his piece.

Miguel’s piece got me thinking about Jonathan Schwartz and I remember reading something about software patents so I looked up his blog and he’s been berry quiet waitwy. The article about copy/steal confirms what Miguel said.

I just skimmed this one but there is something about Dalvik being the “end run”.

Here is another lengthy post I really should read but since, you know, I’m writing this post it’s kinda cutting in to my reading time.

Sheldon

August 11, 2010

Google is Evil

Wired’s Epicenter wrote an extensive article about the Google/Verizon Net Neutrality “surrender”.

While I wish Google could fight forever for consumer rights their motto isn’t “Expert Independent Non-Profit”. We should be happy they fought for as long as they did. Did anyone else bid up the spectrum? What success have other manufactures had selling unlocked phones? At least Google tried to do the right thing.

Cell companies are powerful entities. So powerful that even Google couldn’t win. And if you remember, neither could Apple. The key here is that even if you bring your own phone to the table you have to pay the same monthly fees as someone who gets a subsidized phone. No manufacturer can compete with that. Google was trying to get companies to commit to a discount (they did get T-Mobile to agree) but I’m not sure what Google had to offer customers who bought directly from them instead of a carrier and so the carrier had no incentive to offer discounted plans.

The only solution here is government intervention and it’s a simple rule: If a carrier offers a phone for $199 with a 2 year contract but $599 without then $400 is the assumed value of the phone and if someone brings their own phone the monthly price has to be discounted by $400/24 or about $17/month. It’s as simple as that.

Vic Gundotra does talk about the openness and freedom of Android over the competition and Android isn’t 100% open but it’s certainly more open than iPhone or Blackberry. And while phones loaded with crapware and other carrier constraints are not ideal the blame goes with cell companies for breaking Google’s awesome operations system. Google’s openness allows cell companies freedom too. And it means *WE* have the freedom to choose another carrier. (And, maybe a new cell company that treats users with respect will emerge from all of this.)

Sheldon

I talked to Jim (who calls me a Google Apologist which is true but still) and here is my addendum.

Up until the Verizon deal many felt that Google’s interests were in line with the public interests so the “Don’t be evil” catchphrase sounded right. And now Google is being evil somehow?

Again, I don’t see it. Sure, at some point Google is going to want to do something against the public interest and we can all finally agree Google is just another company that want’s to suck us all dry but this isn’t it. I mean, net neutrality for wired and wireless will always be in Google’s best interest (as well as ours). Sure, they have Android and maybe this was a way to get Verizon to get behind the Android brand but it’s never that simple and Google knows Verizon would drop them like a bad habit if Apple came calling.

June 15, 2010

What Peter-Paul missed

While I completely agree we as web developers should make our mobile sites work with as many browsers as possible I think it’s crazy to expect anyone to test on more than iPhone and Android.

http://www.quirksmode.org/blog/archives/2010/02/the_iphone_obse.html

Sure, there are a ton of Blackberry users and Symbian users but when was the last time they went to a web site? Maybe out of desperation but it’s not something they do on a regular basis. I say you make it easy for a user to contact you and if you get a few Blackberry users that are interested enough to let you know your site sucks on their device then you can work with them to get it fixed. Beyond that you’re just solving problems you don’t have.

That’s not to say a web developer should IGNORE every other browser and be ignorant of what they could do to make their site work on as may mobile browsers as possible but there has to be a limit. One thing we know is that iPhone and Android users a) have a data plan and b) have a decent mobile browser. Can’t say that for these other supposedly popular platforms.

Mentioned in the article is that in the future the browsers for Blackberry and Symbian will get better and when they do and people start looking at sites with those browsers. It’s been 3 years since iPhone and 18 months since Android and nothing so far from Blackberry. I think I’ll worry about it when one of those companies actually deliver something.

Sheldon