Tuesday, December 04, 2007

Tech: Using Curl to Generate a Pubcookie for Programatic SSO Access

A pubcookie login server is a handy way to create SSO authorization accross internal resources deployed to many different application servers. However, this may create a challenge for programatic access to these same resources. Rather than attempting to hunt down and re-use the auth cookie out of your browser cookie cache, curl's cookie engine may be a better automated solution. Pubcookie's behavior is detailed at: http://www.pubcookie.org/docs/how-pubcookie-works.html . The simple script below will provide you with a re-usable token for programatic access to pubcookie protected resources.



#!/bin/bash



###########################################
# getPubcookie
# v2 - robaker
# Fetches a web resource from a server
# that is pubcookie-enabled and stores the
# SSO token locally for future requests
# as long as the token remains valid.
#
# Usage: getPubcookie [App URL ]
#
# App URL must be a pubcookie-enabled
# server. Before initial use, USERNAME
# and PASSWORD need to be changed to
# your own login credentials. As such,
# this file should retain 700 unix
# permission leveling and should not be
# stored on a system with shared-level
# administrative access
###########################################


APPURL=$1
LOGINURL='https://login.com'
USERNAME='yourUsername'
PASSWORD='yourPassword'
PROGRAM_NAME=${0##*/}

usage()
{
echo "usage: ${PROGRAM_NAME} [App URL]"
echo "e.g: ${PROGRAM_NAME} https://wiki.com/wiki/User:Robaker"
exit 2
}

[ $# -ge 1 ] || \
usage

if [ -f pubcookie_s ]; then
# Verify session remains valid
curl -k -b pubcookie_s -s $LOGINURL | grep "You are still logged in" > /dev/null 2>&1;
if [ $? -eq 0 ]; then
# Session is valid, fetch the App URL
curl -k -b pubcookie_s $APPURL;
exit;
fi
fi
# Request pre-session and granting request cookies from pubcookie auth-controlled App Server
curl -k -c pubcookie_pre_s -s -o /dev/null $APPURL
# Parse login form hidden fields... Admittedly a bit hacky
opts=`curl -k -b pubcookie_pre_s -s -c pubcookie_l $LOGINURL | grep hidden | grep -v "<\!--" | sed -e 's/^.*name=\"//' -e 's/\" value/ /' -e 's/ //' -e 's/>//' -e 's/\"//g' | tr '\n' '&'`
# Append login credentials
opts=$opts"user=${USERNAME}&pass=${PASSWORD}"
# Send POST request to the Login Server to get granting cookie
curl -k -b pubcookie_l -c pubcookie_g -d "$opts" -s -o /dev/null $LOGINURL
# Re-request initial App URL and establish valid session
curl -k -b pubcookie_g -c pubcookie_s -L $APPURL
# Remove temporary cookie files
rm pubcookie_pre_s pubcookie_l pubcookie_g
exit;


Sunday, November 25, 2007

Opinion: How to Creatively Save Money...

Let's face it, we live in a spendthrift society. Our own financial market thrives on consumer confidence. Banks that fleece consumers through high interest rates pump that money back in to burgeoning new businesses only after a lofty profit-taking exercise. The average credit debt an American household carries climbs daily (over $8,000 on average), sharing the limelight with banking institutions practice of underwriting sub-prime loans as the leading culprits for the dramatic increase in home foreclosures.

In the midst of technology that enables consumers to spend money faster, now merely requiring a hand-waiving gesture over a magnetic pad, saving can be the last thing on our minds. So, I thought I'd provide a few insights in to my newly adopted approach for putting a few dollars on the side. Actually, the idea came from listening to a radio advertisement about a savings plan offered by Bank of America to round up the cents on any purchase to a dollar, and whisk away that difference to a specialized savings account.

This savings plan works based on the number of transactions you have during any given month rather than the size of those transactions. The advantage to this is that the total amount that you save will not break the budget. It's easier to sock away small amounts of money more often, than it is to try and allocate a large sum of money to savings.

I chose to model my own rainy day savings plan after the Bank of America service by applying it to all of my outgoing expenses, rather than just check card use. Check cards themselves seemed like they would be the ultimate answer to preventing credit card run up because they represented actual money you had in the bank. However, what I have discovered personally in that regard is that your own money becomes vulnerable to fraud every time you use a check card, and the bank is less than enthusiastic about recovering your money lost due to fraudulent use of your check card.

To model the savings plan, simply export your monthly statement to a CSV or Excel sheet, and use the following formula on each charge amount:

=MOD(B2,1)

Note that your expenditures should all be negative numbers. This formula will treat positive numbers (payments) a bit differently, but a little extra savings never hurt right? The table below shows how easy this is to calculate monthly:














DateChargeChangeMerchant
10/30/07-3.70.3STARBUCKS USA 00056630 MOUNTAIN VIEWCA
10/29/07-97.370.63RADISSION HOTEL DUBLIN DUBLIN CA
10/29/07-31.970.03SHELL OIL 27440097809 PLEASANTON CA
10/29/07-14.130.87KRAGEN #404500040451 DUBLIN CA
10/28/07-4.50.5DUBLIN SPORTS PUB & GRILLDUBLIN CA
10/28/07-43.290.71TARGET 00020883 SAN JOSE CA
10/27/07-74.690.31LOS GATOS AUTO MALL LOS GATOS CA
10/27/07-50.140.86SHELL OIL 27425758508 PALO ALTO CA
10/25/07-3.70.3STARBUCKS USA 00056630 MOUNTAIN VIEWCA
10/25/07-7.990.01QUIZNOS SUB 4407 Q22 SAN MATEO CA
Total:4.21


As you can see, in just a couple of days, you've racked up over four dollars in savings! All that's left to do is total up the Change from each monthly invoice you receive, and transfer it to a savings account. Wells Fargo for instance now offers specialized savings plan accounts that make transfers for this kind of savings approach straight forward. Even better is that although the savings amounts transferred each month will be relatively small (unless you have thousands of transactions!), you will benefit from compounded interest which will grow the savings account more quickly (similar to a 401(k) w/o the pretax benefits). If you seed the account with an appreciable amount of money, or choose instead to transfer to a money market fund, you will see even better results. Just don't forget to pay for your monthly expenditures as well, or your savings interest will be a wash (or worse) with your credit card APR. I'm tracking how this approach works over the course of the next year, but I'd be interested if anyone else has historical results from this or a similar savings approach. Please feel free to comment.

Wednesday, September 19, 2007

Opionion: Bank of America Rejection of Default Pricing Ammendment

Banks have to be held accountable to some degree for their tenacity in quitely changing credit card terms right underneath consumer's feet, and then tacking on impossibly high default rates and fees associated with "services". Further, the fox has to stop guarding the hen house and an impartial third part that does not appeal to credit grantors in how credit scores are calculated. For example, if my credit card agreement is ammended to unfavorable terms and I close the account with a 0 balance, no late payments, and no over-the-limit occurances, my credit score should not be damaged in any way, shape or form. Catching consumer credit card companies when they make ammendments can offer consumers little hope but to begrudgingly accept the terms becase they are carrying a high balance and cannot pay it off in order to close the account, or they do not want to pay a 5% charge for a balance transfer to another card. Recently Bank of America sent me an ammendment with terms that were so insane, I felt that a letter of rejection was the least that I could do in response. Here's what I had to say:


September 19, 2007
FIA Card Services, NA
P.O. Box 17151
Wilmington, DE 19850


To Whom It May Concern:
The purpose of this letter is to reject the proposed amendment of the Default Pricing portion of my credit card agreement for card number #### #### #### ####.

Specifically, I find the proposed changes to be outright offensive in that the amendment gives carte blanche to adjust my APR to a default rate with NO FURTHER NOTICE. Worse yet, is the ludicrous default rate currently set at 32.24% , which can only be lowered at 2% intervals over consecutive 6 month spans of on-time payments. This is not consumer credit, it is highway robbery, and I will have no part of it.

This kind of surreptitious act is what will ultimately result in the demise of the US economy if the banking institutions’ insidious offers of sub-prime loans and credit offers to illegal aliens doesn’t deal the ultimate deathblow first.


Monday, September 17, 2007

Opinion: Sun "Jumps the Shark" by Reselling Windows and Branding it's Stock Ticker After a Non-Profitable Product Line

I have long surmised that Sun would not suffer the same fate as the once high flying Silicon Graphics. That hope beyond hopes has become quite a bit more uncertain with Sun's recent announcement that they would become a Windows reseller, along with what can only be a marketing move gone horribly awry to change the company's stock ticker from SUNW to Java. That's not even mentioning the clever 5-to-1 reverse stock split no doubt intended to make the company appear to be more valued than it actually is.
The latest round of layoffs it would seem, did not ensnare the same marketing baffoons that coined Sun as the DOT in DOT COM, a statement which suredly caused the stock to tumble at an accelerated pace when the DOT COM boon became the DOT COM bust. Now, the term Java has been so overused by the company that invented it, that it is certain to have the same catastrophic effect when the next great programming language rolls around, or Service Oriented Architecture takes a firmer hold allowing for a language agnostic metaverse.
Instead of continuing to innovate at the frenetic pace it once had, Sun has now made countless lapses of judgement that could have otherwise spelled a comeback for the struggling tech giant. Consider just these few examples:


  • Reverse stock split - will it remain above 20 or plummet back down to 5?
  • SUNW changes to Java - a programming language now identifies what was supposed to be an innovative systems company on the cutting edge of Internet technology. This is as stupid a move as if Apple were to instead change their name to iPod
  • Sun mucks up opportunity to use Solaris as the underlying operating system in Apple's OSX by demanding that Apple use Sun's Sparc processors, something Sun itself can't decide whether or not it wants to continue to use. Apple goes on to make a bajillion dollars and turn OSX in to quite possibly the best Unix derived operating system ever.
  • Sun churns out cross-platform hairball called Java System; Microsoft can't help but to snicker after Sun themselves referred to Windows as a hairball for years only to turn around and start selling it themselve--much like Silicon Graphics back in the day.
  • Sun gets SUSE Linux distribution purchased out from under them by Novell with the help of IBM - Java Desktop System gets spanked as a result
  • Sun buys Cobalt and refuses to open it to developers; product line quashed by the now countless resurrection of a half hearted endeavor to legitimize Solaris on X86 architecture


So, the question is, has Sun officially "Jumped the Shark" or will the next Bill Joy save the company by actually thinking about something other than Java for once?

Tuesday, July 03, 2007

Tech: Looking for a Job? Check for HTTP Response Headers

If opportunity knocks, you may be surprised just what the door just may look like. Look out Bay Area Jobs!

HTTP/1.1 200 OK
X-hacker: If you're reading this, you should visit automattic.com/jobs and apply to join the fun, mention this header.

X-Pingback: http://daily.gigaom.com/xmlrpc.php
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Date: Tue, 03 Jul 2007 17:23:04 GMT
Server: LiteSpeed
Connection: close

Sunday, July 01, 2007

Opinion: Day 1, Apple Shines, AT&T Falls Flat...

If there was any moment for AT&T to prove to the US market that they had themselves subscribed to the notion that phones and service plans can indeed be two entirely different entities, it would have been day 1 of the much ballyhooed iPhone release. What happened instead was pure carrier grade ineffeciencies, and deplorable customer service. Where there were cheers and high fives at Apple stores as each proud new iPhone owner exited, at AT&T their were 15 minute checkouts per person, and a blatent disregard for line length in relation to limited supply many hours after the scheduled release time.

So did Apple conclude AT&T to be the lesser of too many evils, or was it that Apple could better utilize 3G technology as a stepping stone to rolling the iPhone out to an International audience? Whatever the reason may be, it did seem as though iPhone's release would serve as a lesson to AT&T wireless about how to properly rollout a new consumer device while bypassing all of the service inefficiencies that continue to plague each and every US wireless provider. Yet, even with Apple writing an iTunes storefront for wireless subscribers, AT&T still could not stay on top of the onslaught of activation requests, with some new users waiting hours and even a day after their purchase for the activation to complete.

The iPhone release also served a much needed lesson to AT&T about customer loyalty. Why were there lines outside of AT&T stores for the first time in the Companies' history after entering in to the wireless fray? Because Steve Jobs said it would be a good place to pick one up. In retrospect, it would seem that Jobs was simply making a mockery of what he must have already known would happen at the AT&T locations; which is why every Apple retail employee and extra product that could be mustered assembled at the Apple stores in preparation for the momentous occasion.

I happened to experience the stark contrast between the two companies on day 1 as I stood in the 70th or so position in a line that had formed outside of an AT&T store in Mountain View, California, just a stones throw from Apple's HQ. At 6:00 PM PDT, the line compressed but everyone remained cordial, even jovial that the hype would soon undergo a serious unadulerated level of scrutiny and validation. The first customer did not walk out of the store until almost 7 o'clock, and a handful of others filtered out in 15 minute increments thereafter; some of whom were visibly disturbed by the amount of time it took in order to simply purchase the device. I could only imagine that the AT&T employees were simply filling out "iPhone" or "N/A" in every single form field required to purchase a phone as a part of one of their service plans. Two hours and fifteen minutes in to the line, an AT&T employee began to count off the line, and stopped at around 30. By now the line had grown to almost 150 people because there had been no communication whatsoever as to product availability, and instead of coming clean at 6:00, they had purposely waited hoping to encourage presales from anyone not able to walk out of the store with a phone that day. AT&T is extremely lucky that action did not incite a riot..or maybe it did, but I didn't stick around to watch because I was off to the Apple store in Valley Fair Mall expecting the worst-- because I knew at the Apple store purchases were allowed two per person rather than just one.

The prospects at Valley Fair indeed looked dim as well, especially after seeing another person who I'd been in line with a short time earlier at the AT&T store. There were at least a hundred people in front of us and perhaps another 50 or so already in the store. I was quickly doing the math in my head, 100 people per hour, 2 phones each, 1,000 units total, on sale for 3 hours. As the line quickened my equations altered to , 200 people per hour, 2 phones each, 1,000 units total, on sale for 3 hours. As the "not meant to be" thought crossed my mind, I suddenly realized that "wait, Apple wouldn't let this many people stand in line if they did not have product to back it up". What had seemed so obvious as I left the AT&T store empty handed had already been cast aside by my hastily drawn mathmatical conclusion. In an astoundingly short 8 and a half minutes I walked out of the store after making two separate purchases (1 for the phones, and 1 for accessories). High fives, and an overexuberant enthusiasm errupted upon my exit, and I could almost hardly believe how polarized the two experiences were. So, without even opening the box to toy with the technological ingenuity that the iPhone possesses, it became clear to me at that moment that Apple's wireless phone revolution had undoubtedly already begun.

Thursday, June 28, 2007

Tech: Keeping your DSL Provider Honest...

So you've got an always on Internet connection? Throw in a static IP address or two, and you're probably already paying too much per month for your oversubscribed DSL. Add in the occasional DSL downtime, and like me, you can get pretty frustrated. If you have an SLA for uptime baked in to your DSL contract, then, as Jim Cramer would put it, "time to back the truck up". Now all you need is evidence right? Here is a bash shell I wrote to do just that. You can either run it from your home network using outbound pings, or run it how I am using inbound pings. In your haste, don't forget to make sure you haven't flubbed something up before you go ranting about service credits. Now go out and make your DSL provider honest!


#!/bin/bash

# Name: pinger
# Usage: nohup ./pinger &
# Output: $HOME/dslDown.txt and email Notifications
# Changes required prior to use: emailTo, testIP


emailTo=you@domain.com;
testIP=10.10.10.220;
counter=0;
minutes=0;
startDate=`date`;
if [ -f $HOME/dslDown.txt ]; then
mv $HOME/dslDown.txt $HOME/dslDown$$.txt;
fi
echo "Ping tests to $testIP initiated on $startDate" >> $HOME/dslDown.txt;

while (true); do
ping -W 5 -c 1 $testIP > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo "Unreachable at `date`" >> $HOME/dslDown.txt
counter=$[counter+=1]
if (($counter==10)); then
minutes=$[minutes+5];
counter=0;
echo "DSL down for a total of $minutes minutes between $startDate and `date`." >> $HOME/dslDown.txt
mailx -s "DSL down for a total of $minutes minutes between $startDate and `date`." $emailTo < $HOME/dslDown.txt;
fi
fi
sleep 30
done

Tuesday, May 22, 2007

Personal: Paso Robles 2007

After swearing that the Paso Robles Wine Festival was something that my wife and I could do every year...even after we had kids, we set out this year to prove it could indeed be done.

Saturday, April 14, 2007

Tech: All Hail the Parallels Transporter Agent

When faced with the very real possibility that my personal Macbook was no longer going to be allowed on the corporate network, Parallels came through in a clutch. In just under an hour I had an entire image of my newly allocated "Productivity PC" running seemlessly on my 13" Core2duo Macbook. All that remained was a memory upgrade so that the virtual machine could have it's own Gig of memory to make XP happy. The only thing that does not appear to be working at this juncture is: IPSEc from the Parallels VM machine through PPTP on OSX over the WiFi interface. What does that mean? When I'm not wired, I can't use VPN for both machines. That's a small price to pay for the upside though. From a software perspective, I am now adhering to all corporate policies regarding updates, scheduled virus scans, etc, but I don't have to lug two laptops around. From a hardware standpoint, I can continue taking advantage of all of the wonderful OSX offerings, and be, well productive. There's drag and drop between machines, a single desktop interface through coherence, and WiFi interface sharing, all available in the most recent Parallels update, but it is the Transporter Agent that truly makes it all worthwhile:

Here's how to image your corporate laptop so that you can start being productive:
(note that I bear no responsibility whatsoever as to your adherence to your own corporate IT policies by following these steps)

1) Download the updated transporter agent to your PC and follow the instructions for installation and running of the transporter agent (http://www.parallels.com/products/desktop/transporter)
2) Plug both boxes in to a FastEthernet LAN
3) From your Macbook, start up the Parallels Transporter.app, and set it to migrate from another computer
a) This migration technique allows you to avoid an IT hardcoded documents folder that might prevent you from creating a local (or mounted) image.
4) Be sure to set the memory to something realistic like 1GB (if you've maxed out your memory)
5) Once the VM machine starts, immediately drop it to the BIOS using F8 and run in safe mode
6) At the login screen, use the Parallels Action bar to send keys (ctrl+alt+del) to login
7) Now, disable all of the services that are machine specific from start -> all programs -> administrative tools -> services
a) I looked for anything that had referenced machine-specific hardware (IBM, Thinkpad...etc)
8) Next, remove unecessary sofware through start -> control panel -> add remove programs
a) Following the same guidelines as step 7, remove softare that may not be happy running on new hardware. Keep in mind if you screw up, the worst thing that happens is that you'll have to start from step 3 again. If you miss something, the VM Machine may crash on normal boot sequence.
9) Restart your Parallels VM and run in normal mode.
10) Parallels tools will now automatically install
11) Once the tools are installed, you can switch to coherence mode to get rid of the unsightly Window desktop and the task bar settings can be changed so that selecting the Parallels VM from the OSX dock will work as the Windows Start button.

That's all there is to it! At this point I haven't had to spoof the MAC adress or worry about strange authentication requirements but I'm confident Parallels will stay one stop ahead and allow users to remain productive. All Hail the Parallels Transporter Agent!

For entertainment, just watch the commercial http://movies.apple.com/movies/us/apple/getamac_ads2/touche_480x376.mov .