Monday, January 26, 2015

How to Start Investing



This weekend I spoke with someone interested in investing and realized my experience might help others. I'll give some back story on what I've done and then make specific suggestions at the end. Feel free to skip the backstory.

Backstory

I'm allergic to milk, but I'll always have a soft spot for pizza. When I was in the 7th grade (1995) my uncle and cousin took me to a pizza place in Chicago. They were discussing some sports star who had just gotten a $6 million dollar contract. My uncle asked "What would you do with a million dollars?"

I don't recall my answer, but my cousin's fascinated me: I'd invest it and live off of the interest. 6% on a million dollars is $60,000 per year. I was blown away. At that time I was probably spending about $200 a year (thanks mom and dad!) and couldn't fathom having let alone spending $60,000 dollars!

Since then I've been interested in investing.

Learning by Doing, Retirement Investing
My freshman year of college (2000) I opened my first retirement account when I started my internship with the State of Michigan. They had a 401K plan. That tax year but in Jan of 2001. My dad recommended opening a Roth IRA which I did with MSUFCU. It earned a fixed % (I believe 1.4)

During this time I began reading Forbes magazine and another investor magazine.

In 2002 I decided to move my Roth IRA from MSUFCU to Fidelity and put it into 'the market' I had no idea what I was doing and didn't get specific recommendations from anyone. I think people were afraid if they recommended xyz and I lost money I would be mad. I maxed out my IRA contribution (3K or 3.5K something like that), cashed out my MSUFCU money and opened a Fidelity account. Why Fidelity? Because my dad had a Fidelity account :) Without recommendations from anyone I decided to invest in some type of healthcare mutual fund.

For the next few years I maxed out my Roth contributions putting them in various mutual funds. Some while later (2006?) I realized this was not the best strategy. I learned about index funds and that they were better than mutual funds. Around this time I invested new IRA money in a NASDAQ Index fund (FNCMX) and what I thought was a S&P 500 Index fund, SPY (I later found out this is an ETF. Thanks Jason!)

Around 2012 or so I realized my mutual fund returns had been crap and decided to move everything into the S&P, which many investment vehicles benchmark again. As I was consolidating I realized my NASDAQ index fund had outperformed S&P so I left that alone (probably a mistake)

Now my retirement account consists of about 40% FNCMX and 60% SPY.

Other Investment Experience
I don't recommend any of these ideas for beginners, but I want to show my rounded out investment experience.

  • Business Loan (2003-2009)
  • Real Estate Purchase (2005)
  • Landlord (2007-2012)
  • Individual Stocks (mostly tech) (2012-2014)
  • Selling options (mostly tech (2012 0 2014)
  • Private Business Investment (2013)
  • Arbitrage (2013)
  • Bitcoin speculation (2013 - current)


Specific Suggestions

  1. Pay off high debts first. Think about returns. SPY returns about 8% / year. It doesn't make sense to earn 8% on investments while paying more than 8% for loans (ie. a credit card at 20%) However on the flip side it can make sense to borrow at low interest rates if you can loan out at higher rates. However this can be a dangerous game. It's something to keep in mind but a more experienced play.
  2. Credit card loans may be paid off more quickly with bank consolidation loans at lower interest rates, Lending Club or Prosper loans at lower interest rates, or 0% credit card balance transfers.
  3. Be aware retirement funds (401K, traditional IRA, Roth IRA) generally can't be used without penalty until retirement age. There are exceptions for things like first time home buying and medical emergencies.
  4. Have a cushion (1-2 months) of expenses in the bank before investing. It can be dangerous to invest funds into a brokerage account with Fidelity or OptionsHouse and have no cash in the bank. Then a car repair, medical expense, home repair, etc. can put one in a cash crunch needing to pull out their investments or use loans to cover the gap.
  5. Many employers have 401K retirement plans and will match employee contributions. Sometimes employers even match dollar for dollar up to a cap. This is a 100% risk-free return, probably the best deal anyone can get in their life.
  6. After maxing any 401K match money employers offer consider investing in a Roth IRA or traditional IRA. Open an account with Vanguard and invest in their S&P500 index product: VFINX.
Additional Information:

Sunday, January 25, 2015

Free Photos, Images, and Music for your Projects


Do you write blog posts, create presentations (hopefully with Prezi), or create video clips (hopefully with Camtasia)?

Adding media like music and pictures increases the effectiveness of your communications. Our brains process imagery faster than we process text.

It's also nice when you don't have to add attribution (putting the photo source to comply with copyright) unfortunately that typically means paying $30 at sites like Shutterstock (awesome selection though!). However there are some public domain sites that don't require attribution.

Free Photos

  1. Sometimes I start with a Google Image search to get my creative juices flowing. If I already have an idea in mind I just skip to step 2 though. I return back to Google Images if I can't find what I'm looking for.
  2. Pixabay - I go here first. Images are public domain which means you don't need to post attribution and can modify them at will. They have an OK selection. The Free Media image above was a combination of:
    1. Pixabay blank sign post
    2. Pixabay mountain background
    3. Some Gimp magic (image manipulation)
  3. Flickr - If I can't find a photo on Pixabay I'll go to Flickr. I often go to Flickr if I need a photo of a particular person like Bill Gates, Steve Jobs, etc. I check the search option for Creative Commons and use some nice CSS to overlay the attribution on top of the image. (for example I need a pic of the Winklevoss twins on my bitcoin Bulls site. )
  4. If those fail then I recommend trying Google Image Search I click on search tools and then usage rights then 'reuse with modification' however the process doesn't work so well. I'll probably go back to step 1 and try to come up with a different concept.

Free Vector Art
Vector images can be resized without distortion, from being tiny to fitting on pins all the way up to huge banners on the side of skyscrapers. Logos are often vector.

  1. Vecteezy - I haven't used this resource a lot, but I plan on doing more infographics this year and will be leveraging Vecteezy. Unfortunately their search doesn't have by license type and they permit a variety of licenses.


Free Music

  1. Incompetech - lots of great royalty free music! I've used incompetech music for my video projects since 2013. The default license requires attribution. For $30 you can purchase a license to skip attribution.

    Some Projects I've used Incompetech music on:
    1. My son playing with marbles.
    2. My brother playing a dance game. 
    3. This Video showing how to buy bitcoins.
    4. The intro to this btcjam webinar.
  2. YouTube Audio Library - I don't like this selection much, but your mileage may vary.
Free Video Clips
Sorry I don't know of any useful free resources.
  1. I have used Shutterstock in the past to purchase video clips.

What tools do I use to edit media?
  1. Images - Gimp I have Adobe Photoshop but I'm horrible with it. I use Gimp (free) for all my image editing. Gimp works on Windows, Linux, and Mac.
  2. Vector Images (can be resized with no loss of quality) Inkscape - Again I have Adobe Illustrator but I am horrible at it haven't tried using it. Inkscape (free) works on Windows, Linux, and Mac.
  3. Screen recording and Video Editing - Camtasia ($299). Fantastic tool from a local company.
  4. Sound editing - Audacity - take out noise, bump up volume, etc. Free tool that works on Windows Mac and Linux. I've never had a problem with the tool and never tried anything else.
  5. Making movies & rendering images - Blender. I'm just learning this tool. I haven't released anything I've done on it yet. Big learning curve!
Let me know in the comments if there is a category, tool, or resource I missed!

Monday, December 8, 2014

Startup Grind Coming to Lansing!


I'm stoked to announce Startup Grind is coming to Lansing in January 2015!

Startup Grind is a global (55 countries, 125 cities) startup community designed to educate, inspire and connect entrepreneurs.

Powered by Google for Entrepreneurs, Startup Grind recently launched in Lansing. Our first event will be in the second half of January 2015 featuring a rocking local entrepreneur. I hope you join us!

We host monthly events for Lansing entrepreneurs.  Each event features a successful local founder, innovator, educator or investor who shares personal stories and lessons learned on the road to building great companies.  We offer yummy food + drinks and spend an hour filming an informal, intimate fireside-chat-style interview with our awesome person of the month followed by a Q&A and mixer.

Each event gets archived on www.startupgrind.com – some of the past interviews were with biz legends like the founders of Nest, Capital One, Pinterest, Stripe, SoundCloud, Words with Friends, Intuit, Indiegogo... the list goes on and on.  These interviews are a unique peek behind-the-scenes at the life, journey and insights of those who have gone before, and are incredibly engaging and inspiring events.  Startup Grind was recently featured in Forbes magazine and is quickly becoming known as the Ted talks of the entrepreneur world.



Lets Build This Together!

I'm excited to be involved in bringing Startup Grind to Lansing. To take full advantage of this opportunity it is important to involve the community.

Please email me to get involved!

  • If you want to attend our first event.
  • If you want to volunteer to help.
  • Ideas on how Startup Grind can help Lansing.
  • Local media contacts to help spread the word! (name & email or phone)
  • Speaker suggestions (include speaker name, company, contact email,  & contact phone number)
  • Sponsor suggestions (include company name contact name, contact email,  & contact phone number) Ideal sponsors are those who are avid supporters of the local entrepreneur community or those who have services founders can benefit from. 

I'm already working hard with a team of people to line up killer speakers and put on valuable events. This is going to be an exciting addition to the already vibrant Lansing business community!

David Smith
Director, Startup Grind Lansing
www.linkedin.com/in/davidssmith/

Thursday, December 4, 2014

Apple Migration Assistant - Days to Minutes

I had a frustrating time using Apple's Migration Assistant. After some Google searching and the help of local vendor, Capitol Macintosh the process was quick. After the migration I was amazed at how seamless it was. I've checked all the apps I thought would be difficult like Inkscape and Gimp, but they transferred seamlessly.

The process worked so well that on my first login after migration all my windows were open just like I'd left them. It was just like using my old system.

Quickly Migrating Data
Quickly Migrating Data


Context

I recently purchased a new Macbook Air since my previous one had a bad screen.

I was excited to upgrade from 4 GB RAM To 8 GB RAM, but not looking forward to installing my apps and getting the system configured like my old one.

Updating in Minutes instead of Days

I found out during the migration both computers are unusable. This is a problem when the process takes many hours or even days over WiFi.

Following these steps would have migrated me in under an hour instead of days:
  1. Get a Thunderbolt Cable
  2. Update both systems to the latest version of OS X.
  3. Turn off sleep mode (Energy Saver)
  4. Turn off WiFi on the new system (to ensure the process is using the Thunderbolt cable)
  5. Plug in the Thunderbolt Cable to both systems.
  6. Restart the old system and hold the T key on the keyboard.
  7. Launch the Migration Assistant from the new computer.
  8. Follow the prompts.
Other Tips
  1. If you need to stop the migration assistant press Command Q.
  2. If you need to restart the migration assistant and it keeps continuing where it left off restart the system.
  3. While migrating the computer goes into a special mode and can't be used for anything else.
Rant
Why oh why did Apple make this process so difficult? After I put in a couple hours of trial, error, and Googling it worked great. But why hide this information? Computers are great at sequencing tasks and knowing not to go to sleep in the middle of important operations. 

There are no prompts are hints to discover how to massively speed up this process. It is frustrating I had to learn everything by trial, error, and the help of local Apple Authorized Servicer Capitol Macintosh to understand the best way to transfer the data. How hard would it have been to put the 8 steps above into software to walk users through the process?

I won't go deep into the usability issues, but for starters putting total estimated time up front via various methods (WiFi, Thunderbolt, etc.) would have helped loads.

Saturday, June 14, 2014

Bitcoin Mining Needs to be Fixed

Bitcoin mining is a problem and needs to be fixed for bitcoin to be successful. Right now I don't hear anyone talking about fixing it, just putting on bandaids or worse, ​asking for irrational actions.
The problem stems from the way the block reward works. Essentially it is a lottery where a large prize (currently 25 BTC) is awarded every ten minutes. One buys tickets by providing hashing power to secure the network. The problem is that most participants don't want to 'win' once every few years. They'd prefer to get paid frequently overtime. To achieve this they pool their hashing power together and distribute the block award according to each participants participation level.
Whats the Problem?
The larger the pool, the less the variance in payouts and the more incentive to join the pool. This creates a problem because the pool operator is now in control of the security of the bitcoin network. If the pool operator wants to cheat or abuse the network they can do so.
The entire point of bitcoin is not to rely on trusted third parties, and having a single dominant pool operator makes that operator a trusted third party. Most assume the pool operator won't, but what if the pool operator is hacked, tricked, or otherwise coerced? Can a multibillion or even trillion dollar bitcoin economy thrive with this fundamental threat? No.
Whats the Solution?
The solution is to fix the block reward. Satoshi's white paper states "Proof-of-work is essentially one-CPU-one-vote" while that is technically true today, miners can vote by switching pools or buying hashing power at competing pools those aren't fixes. They are bandaids. The fix is to eliminate the need for pools at the root level.
What is Wrong with Bandaids?
The solutions I primarily see proposed today consist of asking (more like yelling) at miners to switch pools and asking all bitcoin owners to spend a percentage of their bitcoin wealth used to mine the network on a pool of their choice.
It is bizarre to me that selfish people in the community are yelling at miners for being selfish and stating they should switch pools. Miners could be asking the community why not donate BTC to pool xyz to increase the block reward and incentivize the switch. It is the same concept. Bitcoin shouldn't work through subsidies and perverse incentives. It should be fixed at the root so individual incentives align with network incentives.
Another bandaid is attacking the dominant pool operator either through block withholding or denial of service attacks. Does it make any sense for the bitcoin community to rely on periodic attacks when a pool gets too large? No clearly the problem should be fixed at the root so individual incentives align with the network incentives.

Saturday, May 31, 2014

How I lost 6 pounds in 5 days doing almost nothing.

This week I lost six pounds (170 => 164) with minimal diet changes and no working out.

My Effort:

  1. 3 hours on Sunday reading 20% of The 4-Hour Body
  2. Eating eggs for breakfast instead of fruit
  3. Eating beans and spinach instead of fruit, potatoes, bread, and rice.
  4. Being thoughtful about what I ate at 3 meals outside of my home this week.
  5. Turning the shower on cold for a minute or so (not sure if this contributed or not)

The diet primarily consists of eating meat, legumes, and vegetables

Surprise
I'm still somewhat skeptical, but I'm proving myself wrong by doing it. I didn't think I could lose that much weight in such a short time frame and especially without major effort. In fact I may have eaten more than usual this week. I'm not sure how this will go, but I'll be happy to update in the future with continued progress.

Backstory
A few weeks ago my pants were getting tight on me. In 2012 reading The 4-Hour Workweek changed my life more than any other book I'd read (thanks Brian!) and knew the author had a weight loss book that promised maximal change with minimal effort. I was interested in losing weight, if I didn't have to eat stuff I don't like, work out, count calories. Basically I wanted to lose weight without expending much effort or changing my diet much. This diet fit me perfectly because I like to eat a lot and I like to eat a lot of meat.

Going forward
The book advocates a cheat day where you ignore the diet and today is my cheat day so we'll see how it goes (fruit and beer) )

As my experiment progresses I'll post updates on this blog. If it is successful I'll have before and after pics :)

Thursday, December 5, 2013

You Probably Shouldn't Buy Bitcoin

Edit I've reversed my position. Everyone should hold some bitcoin. The reward potential far outweighs the risks outlined below. Read more here.

TLDR - It is probably a bad idea for you to invest in bitcoin. Instead consider the S&P 500 which has never lost value in a 20 year period.

My Excitement
I'm very excited about bitcoin. It is going to do to payment companies what the telephone did to the telegraph. If that does happen an individual bitcoin is going to be worth tens of thousands of dollars.

My Mistake
Lately I've been wrongly advising friends to put some money into bitcoin, but by some I really mean hundreds or thousands of dollars. I claim 'an amount you can lose without issue', but if something is going to go up soooo much why would anyone get in for just a few bucks? If they believe what I'm saying why in the world would they just get $10 worth?

9 Reasons not to Invest in Bitcoin
Yesterday I blogged about bitcoin and unfortunately recommended readers buy some. Some friends brought up good counterpoints and I've reversed my position. Here is why you should not invest in bitcoin
  1. Bitcoin could drop in price 99% tomorrow. In fact on 8/17/2012 it dropped 30% in an hour.
  2. 100% of your bitcoins could be stolen from your online wallet, stolen from your computer, stolen by your online wallet, stolen by a virus on your computer, stolen by a virus on your smartphone, stolen by your online wallet host, and stolen by security flaws in your online wallet software.
  3. The online wallet you hold your bitcoins with could go out of business.
  4. You can lose 100% of your bitcoins by forgetting your password or throwing out a hard drive.
  5. You can easily violate US laws you are unaware of. I was unaware of the Foreign Account Tax Compliance Act or of the Banking Secrecy Act Report of Foreign Bank and Financial Accounts requirement which I could easily have violated.
  6. Tax compliance is difficult. You should plan ahead but probably won't.
  7. Bitcoin price swings will stress you out if your bitcoins go up a lot in price.
  8. Bitcoin price swings may cause you to sell at the wrong time, buy at the wrong time, sell at the wrong time, over and over and over. Read this man's unfortunate story.
  9. There are lots of bitcoin scams like this ponzi scheme.
How to Surely Get Rich
The sure way to riches is with steady payments and compounding interest. I think the S&P 500 is a great investment and has never lost value in a 20 year period. I have a large percent of my retirement portfolio in the S&P through the SPY fund.

Wednesday, December 4, 2013

Bitcoin is Provably Valuable

TLDR (too long didn't read) - bitcoin is valuable. The easiest way to buy them is Coinbase.

Bitcoin is two things:
  1. A payment network (think PayPal, Visa, MasterCard, Western Union)
  2. Money - a medium of exchange, a unit of account, and a store of value.
Why are payment networks valuable?
It is more efficient to exchange money for goods and services instead of barter. For example if I wanted a pound of rice and had a cow it would be hard to fairly divide the cow for my rice, especially if I don't have a way to store the remainder of the cow. Using money it is easy to sell the cow and then purchase the pound of rice. Payment networks make it more convenient to pay for goods and services than physical money. Visa, MasterCard, Discover, and Western Union have shown that payment networks are valued by society. Today their combined market cap is over $250 billion dollars.

Why is money valuable?
Money is valuable because other people will give goods and services for it. If a government states money is valuable but people will not accept it for goods and services. Think that can't happen? It has happened many times before.  Gold is not money, but it is a store of value and gives an idea of how much something can be worth that is not backed by a government. Today the gold in the world is estimated at a value of $8 trillion. For comparison the market capitalization is 14 billion. That means bitcoin would have to go up another 571 times to be equivalent to gold. I don't think there is a question of if that can happen, but a question of if it will happen.

How does this make bitcoin provably valuable?
Bitcoin is a great payment network. Unlike PayPal, Visa, MasterCard, etc. bitcoin cannot go out of business, cannot steal from you, cannot cheat you, etc. It has no marketing budget, no CEO to compensate, no board of directors, etc. 

Bitcoin is great money. Bitcoin is the best way for people to accept money because it is the most efficient, it is nearly impossible to counterfeit, and there is no way for a third party to cancel or modify the payment. It does not use any countries currency making it immune to mistakes made by politicians and rulers of fiat currencies. Like gold there are a fixed number of bitcoins meaning after the volatility settles down it will be a great store of value.

Should I invest hundreds or thousands in bitcoin?
No and here are 9 reasons why.
If you have some money you can lose without issue I recommend considering buying some bitcoins. I believe this is a special time in history, like the 1889 land run it is possible to get very wealthy very quickly with bitcoin, like the gentleman whose $27 investment turned into just under a million dollars in 4 years.

How do I get bitcoins?
The easiest way if you live in the US is through Coinbase.

Tuesday, November 19, 2013

Your business can accept Bitcoin in 5 minutes

Bitcoin is a great way to get paid because transactions are irreversible and bitcoins can't be forged. So there are no worries about credit card chargebacks and almost no worries about fraud.

The easiest way to accept payment is through Coinbase. After signing  up on their site you can use the Coinbase merchant tools to invoice a customer via email.

Coinbase will let you avoid the price conversion fluctuations of Bitcoin by immediately converting your customers Bitcoin payment into cash and depositing it into your bank the next day. They charge a 1% fee for this service, but have a special right now where the first million USD in sales has no charge.

Coinbase also has services to setup shopping carts allowing customers to buy merchandise from your website with Bitcoins, but that takes a little bit more work to setup. If the volume would support it you may even be able to automate it where they order a product from your website, your website orders from the supplier and then when the order is delivered the customer is emailed for pickup.

Wednesday, September 18, 2013

Explaining Bitcoin to Grandma

Want to know more about Bitcoin but don't care about the geeky underpinnings?

Here are some differences between Bitcoin and the traditional US financial system:

TraditionalBitcoin
Accounts
  • Most users hold a small amount of spending money in a wallet and most of their money in an account. 
  • To create an account one needs to find a financial institution to supply the account, apply for the account, give them all kinds of personal details, fund a minimum deposit. 
  • Banks accounts pay interest for using account holder's money and charge fees for services. 

  • It is a best practice to hold a small amount of spending money in a "spending account" and large amounts of money in accounts created on machines not connected to the internet.
  • Accounts are created through software or using a service provider.
  • There are no minimum balances and no interest paid on account balances.
  • It is recommended when sending funds to include an optional fee. Today the recommended fee is around 6 cents.
Transaction History
  • A receipt is needed to provide documentation of payment between parties.
  • In financial institutions transactions are kept private, but may be provided to government entities (courts, regulators, law enforcement)

  • All transactions and account balances are publicly visible. However account holders are only known if they disclose their identity - such as submitting identifying information to an exchange or as part of a transaction.
Reversibility
  • Cash transactions are irreversible.
  • Most other types of transactions are reversible.

  • Transactions are irreversible but the other party may issue refunds.
Issued By

  • Computers solving mathematical puzzles.
  • The process is called mining. 
  • Today specialized hardware is needed to profitably mine Bitcoins.
Currency Limits
  • Governments can create as much currency as they want.
  • This devalues that government's existing currency.

  • 21 million Bitcoins. 
  • Bitcoin is created at a predictable rate and will stop being created around 2140.
Risk of Loss
  • When I've had fraudulent transactions on debit cards and credit cards they have been reversed no problem by my banks.
  • When I've had cash stolen I've never recovered any of it.
  • US depository funds are covered by the FDIC. Banks have bonds to cover losses.



  • Improper use of software can result in loss of funds.
  • Having a computer hacked can result in loss of funds.
  • Software bugs can result in loss of funds.
  • Institutions being hacked have resulted in loss of funds.
  • Computer destruction or theft can result in loss of funds.


Sending
  • To send money a great length of distance I need to use a third party or deliver it in person.
  • Taking amounts over $10,000 across the US border needs to be declared to FinCEN.

  • The difficulty of sending funds does not change with distance. Bitcoin can be delivered across the globe the same way Bitcoin is delivered to your neighbor.




Tuesday, May 22, 2012

Don't use Video Clips when Presenting

I recommend do not play video clips in your presentation. Find a different way to deliver the message.

Over the past year I've attended a few presentations where the presenter played a video clip. Often these clips range from two to five minutes.

Here are the problems with the video clips:

  1. I am here to watch the presenter. If I wanted to watch that clip I would watch it on the computer.
  2. Sometimes the clips are excerpts of shows or movies and don't make sense without the context.
  3. Audio can be hard to hear and video can be hard to see because of the lighting.  Often there is scrambling at the beginning of the clip to adjust the audio volume. It works fine on the presenters computer at home, but is then presented on a different projector and probably even a different computer.
  4. During the video clip the presenter often stands awkwardly to the side of the presentation area or look at their computer screen. This loses the audience.
Find a way for you to deliver the message instead of the video clip.

Tuesday, December 13, 2011

Free conference calling

Have you ever needed to setup a conference call without access to a corporate conference calling number?

This summer I had just such a need. For four months I used freeconference.com for weekly morning conference calls. Instead of scheduling a meeting every week I used their reservationless conference feature to have a conference call always ready to go! This enabled the meeting notices to have the same dial in number and access code and alleviated me from having to manage the meetings through their software. No  need to hand out codes to attendees each week.

This software has worked so well I hadn't logged in since I set it up. Fortunately my password manager saved my password so when I accessed the site today I didn't have to dig around for my credentials.

Tuesday, October 25, 2011

Never forget another password

In 1994 when I got on the internet in the sixth grade I had one username and password. I can remember one username and password. Life was good. Fast forward to 2011 I have no idea how many usernames and passwords I have: 50 , 200? Who knows. I've had to use forgot password buttons, forgot login buttons, had my accounts frozen for months, written passwords down in documents, had to call help desk support for assistance. I don't have to do any of that anymore.

What changed? I installed a piece of software called LastPass. This handy software remembers my usernames and passwords for me. I have it set to automatically login to sites I visit requiring passwords. It works by using a master password. I have my master password set to a passphrase, something easy to remember but impossible for computers to guess, like "myfavoriteteacherwasMrs.SavageIn7thGrade"

There have never been any security breaches of LastPass, but I don't use it to store my financial passwords just in case. This means I only have to remember 5 passwords, one for everything non-financial, and then one password per financial institution.

Try LastPass it is free and makes your life better.

Tuesday, September 27, 2011

Page_LoadComplete not being called in a user control

I needed some logic to execute in a page load event after a control event had occurred.

Initially I wrote:

        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (newQuestionControl.ShouldShow)
            {
                mpeNewQuestion.Show();
            }
        }


I put a breakpoint and noticed my logic was not being called.

Since I'm in a user control there is no LoadComplete event. I fixed it like this:


        protected void Page_Init(object sender, EventArgs e)
        {
            this.Page.LoadComplete += new EventHandler(Page_LoadComplete);
        }

Tuesday, August 30, 2011

I was on a SQL Server 2008 R2 database I wanted to backup and put on my machine.

First I tried backing it up and got this error:


Backup failed for Server. 'MyDatabaseServerName' (Microsoft.SqlServer.SmoExtended)

System.Data.SqlClient.SqlError: Cannot open backup device 'C:\MyBackupFileName.bak'. Operating system error 5(Access is denied.). (Microsoft.SqlServer.Smo)



For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1+((KJ_RTM).100402-1539+)&LinkId=20476

Then I tried generating scripts and got this error:

Microsoft.SqlServer.Management.Smo.SmoException: Could not read metadata, possibly due to insufficient access rights. at Microsoft.SqlServer.Management.SqlScriptPublish.GeneratePublishPage.worker_DoWork(Object sender, DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e) at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

I figured I must not have rights to some metadata or something. In the wizard I try selecting Tables, Views, and Schemas. My script generates fine. I notice there is no create database in the resulting script. I go back to the Choose Objects screen, unselect "Script entire database and all database objects" and "Select All" objects. My script generates fine.

Monday, February 28, 2011

Storing your SQL Server Database as Text

Have you ever had trouble moving a database from one server to another?  Ever wanted to store the database in source control?  Storing the database as text (a SQL Server Script) enables plain text tools to operate on your database.

Jeff McWherter from Gravity Works showed me how to easily store a SQL Server Database as Text:
  1. In SQL Server Management Studio right click on a database
  2. However over Tasks
  3. Select Generate Scripts
  4. Click 'Set Scripting Options' to skip the first two steps.
  5. Click the 'Advanced' button
  6. For the last option in general change 'Types of data to script' from schema only to 'Schema and data'
  7. Click OK to close the Advanced dialog
  8. Select a location to save the script to
  9. Click Next to go to summary.
  10. Click Next for SQL Server Management Studio to generate the script.
  11. Click Finish and you've got your text!
  12. When executing this script
    1. Ensure the Filename in the CREATE DATABASE Statement is correct when executing this script. (Or you can comment out everything after CREATE DATABASE $YOURDBNAME$ until the first GO to have SQL Server use defaults)
    2. Since this works at the SQL Server level, you will get errors when the script attempts to create users that don't exist on the target server and then errors when it authorizes that user.

P.S. See my post SQL Server Management Studio Generating Change Scripts if you want to use SQL Server Management Studio to graphically modify the database but then script the change.

Monday, February 14, 2011

Windows and Mac are Dodo Birds

18 days ago I received a CR-48 and have used it as my exclusive computer outside of work.

This machine is perfect because :
  1. It is built for the internet.
  2. It is resilient.
  3. It is powerful.
  4. It is convenient.
Chrome OS is built for the internet.  When I'm online I am consuming information and communicating.  Neither of these tasks require the power and complexity of Windows or a Mac operating systems.  Chrome OS gets me online almost instantly and gets out of my way so I can use the web.

Chome OS is resilient.  Suffering data losses in 2001 and 2005 I moved all my important files to Google docs and Windows Skydrive.  Since moving to the cloud I have not lost a bit, and have not cared which operating system I'm on for my personal computing needs.  Chrome OS takes this a step further putting my files and applications in the cloud.  Now if my machine dies I won't waste time reconfiguring my machine the way I want it.

Chrome OS is powerful.  I was surprised I am able to take and edit photos on my CR-48, make phone calls, do online video conferencing with my son, and edit code.  Prior to receiving the CR-48 I assumed some applications didn't make sense as web apps, but now my thinking is flipped.  All apps make sense as web apps and they will all be web apps.  It is just a matter of time.

Chrome OS is convenient.  It is light, it is fast, it is portable, it is quiet, the battery lasts for 8 hours, it is secure, it is hardy.

When Windows Longhorn was announced waaaaaaaay back in the day I was excited about features it was going to deliver like WinFS.  When Windows 7 launched I didn't care about any of the features.  The world has changed.  I don't care about desktop features anymore.  None of them make my life easier and more convenient.  With Windows 8 on the horizon, I can't think of a single desktop feature I want.  Today's compelling use cases are cloud based.  I started using Mac this year.  Which features was I excited about?  Syncing with Google Calendar, syncing with Google Contacts, and storing my data in the cloud.  Chrome OS leapfrogged these operating systems and they will need to catch up or go the way of the dodo bird.

Monday, February 7, 2011

Adding Cascading Deletes

I needed to add delete functionality for an entity in one of our projects.  Unfortunately this table had 30 other tables referencing it.

This SQL generated the correct code for me faster than I could blink:


SELECT 'alter table [' + FK.TABLE_NAME + '] drop constraint [' + C.CONSTRAINT_NAME +']; ' +
'ALTER TABLE [' + FK.TABLE_NAME + 
      '] WITH CHECK ADD CONSTRAINT [' +  C.CONSTRAINT_NAME + 
      '] FOREIGN KEY([' + CU.COLUMN_NAME + 
      ']) REFERENCES [' + PK.TABLE_NAME + ']([' +
  PT.COLUMN_NAME + ']) ON DELETE CASCADE; '
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS C
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FK ON C.CONSTRAINT_NAME = FK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS PK ON C.UNIQUE_CONSTRAINT_NAME = PK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CU ON C.CONSTRAINT_NAME = CU.CONSTRAINT_NAME
INNER JOIN (
SELECT i1.TABLE_NAME, i2.COLUMN_NAME
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS i1
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE i2 ON i1.CONSTRAINT_NAME = i2.CONSTRAINT_NAME
WHERE i1.CONSTRAINT_TYPE = 'PRIMARY KEY'
) PT ON PT.TABLE_NAME = PK.TABLE_NAME
where CU.COLUMN_NAME = 'yourColumnName'

Monday, January 31, 2011

Generating a memory dump for an IIS 6 hang

This post follows up on my sample demonstration and explains how to get a memory dump from a production web server crash.

Environment:
ASP .NET 3.5
IIS 6
Windows Server 2003 64bit
Windbg 6.11.0001.404 AMD64

w3wp was crashing on the server with this in the event log.

Event Type: Error
Event Source: .NET Runtime 2.0 Error Reporting
Event Category: None
Event ID: 1000
Date: 3/3/2010
Time: 1:22:18 PM
User: N/A
Computer: _____________
Description:
Faulting application w3wp.exe, version 6.0.3790.3959, stamp 45d691cc, faulting module kernel32.dll, version 5.2.3790.4480, stamp 49c51cdd, debug? 0, fault address 0x0000000000027ded.


For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

I set adplus to get a memory dump on hang.

After spelunking around I found out I was debugging the wrong dump file w3wp.exe-APPNAME

decided to debug a different dump file: w3wp.exe_-CRMAppPool
.sympath SRV*c:\debugsymbols*http://msdl.microsoft.com/download/symbol
.loadby sos mscorwks
!threads

ThreadCount: 11
UnstartedThread: 0
BackgroundThread: 11
PendingThread: 0
DeadThread: 0
Hosted Runtime: yes
                                              PreEmptive                                                Lock
       ID OSID        ThreadOBJ     State   GC     GC Alloc Context                  Domain           Count APT Exception
XXXX    1 1a14 00000000001aa520   1808220 Disabled 0000000000000000:0000000000000000 00000000055650d0     1 Ukn (Threadpool Worker) System.StackOverflowException (00000000100b10d0)
XXXX    2 2014 000000000019d5c0      b220 Enabled  0000000000000000:0000000000000000 0000000000122e20     0 Ukn (Finalizer)
XXXX    3 2298 0000000005722570      1220 Enabled  0000000000000000:0000000000000000 0000000000122e20     0 Ukn
XXXX    4 1524 000000000556b570    80a220 Enabled  0000000000000000:0000000000000000 0000000000122e20     0 Ukn (Threadpool Completion Port)
XXXX    5  904 000000000556bb40   200b220 Enabled  0000000000000000:0000000000000000 00000000055650d0     0 Ukn
XXXX    7 2228 000000000c7e17b0   880a220 Enabled  0000000000000000:0000000000000000 0000000000122e20     0 Ukn (Threadpool Completion Port)
XXXX    8 2324 000000000c6ee560   200b220 Enabled  0000000000000000:0000000000000000 00000000055650d0     0 Ukn
XXXX    9 19f8 00000000055c7480   200b220 Enabled  0000000000000000:0000000000000000 00000000055650d0     0 Ukn
XXXX    a 2104 0000000005b8b9e0   180b220 Enabled  0000000000000000:0000000000000000 00000000055650d0     1 Ukn (Threadpool Worker)
XXXX    b 213c 000000000d039d10   180b220 Enabled  0000000000000000:0000000000000000 0000000000122e20     0 Ukn (Threadpool Worker)
XXXX    6 2370 000000000de00b90   200b220 Enabled  0000000000000000:0000000000000000 00000000055650d0     1 Ukn

Aha!  three threads with locks and one with a StackOverflowException.
The column with the XXXX is supposed to list out the native thread so I can switch to it and see the problem.
0:000> ~
.  0  Id: 226c.2274 Suspend: -1 Teb: 000007ff`fffa2000 Unfrozen

When this memory dump was taken the native thread had already been cleaned up.

A KB article provided instructions on running an action when a process is orphaned.

Following those instructions I get a log file but no .dmp :(

I modify action.cmd changing %COMMAND% to %COMMAND% >> %LOG%

Now the log displays: 

Microsoft (R) Windows Debugger Version 6.11.0001.404 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Cannot debug pid 8220, Win32 error 0n87
    "The parameter is incorrect."
Debuggee initialization failed, Win32 error 0n87
    "The parameter is incorrect."

Hmmm... maybe I can manually take a dump.

Using iisapp I see:

W3WP.exe PID: 11072   AppPoolId: ClientProject
W3WP.exe PID: 10824   AppPoolId: 3rdPartyVendor
W3WP.exe PID: 4836   AppPoolId: AnotherClientProject
W3WP.exe PID: 8220   AppPoolId: CRMAppPool

create problem.  wait 30 seconds:

C:\>"C:\Program Files\Debugging Tools for Windows (x64)\cdb.exe" -c ".dump /o /m
a c:\crash_PID_11072_3_03_2010_10_01_16_54.dmp;q" -p 11072

success!  Using this dump we were able to identify the problem.

Monday, January 24, 2011

Becoming a Better Listener

Today I received my first downvote on StackOverflow (a programmer question and answer site).  This means the downvoter said my answer sucked.  Fortunately they left a comment explaining why.  Immediately I thought "Hey! I'm right!" My answer is technically correct.  I think?.  I read the other two provided responses and noticed they both referenced a 50x50 Green square.  Mine did not.  Then I read the question again.  Oh, they want a green 50x50 square.  I didn't realize that!

I answered the question in as little time as possible without making a good attempt at understanding what they were trying to do.  I don't even know if my code really solves their problem because I copy and pasted code from my blog and put a warning on my answer "this worked two and a half years ago."  I told myself it was OK though because I put a smiley face at the end of the sentence to feel better about submitting an untested answer.

What happened after that?  Two people took time out of their day to improve the formatting and clarity of my answer and then a third person took time out to tell me why my answer wasn't good.  My answer did not provide value to the community.  Better answerers came along and posted more concise answers that directly solved the problem.  I had wasted community member's time.  I deleted my answer.

In the real world I do the same thing.  When people talk often times I have a response ready before they are done talking.  When someone criticizes me I often interrupt stating why I am right.  Listening is key to communication and learning.  I am working on being a better listener, and if you catch me not listening, help me out :)