Archive

Archive for the ‘Uncategorized’ Category

Stimulate 2011

September 23, 2011 Leave a comment

Personally I don’t believe it is the place of the Government to be stimulating the economy. It is the place of government to make rules which allow for an efficient economy. I can see times were stimulation can return a positive ROI and in those situations it doesn’t bother me as much. What I really don’t like is an unbalanced budget with a debt to GDP ratio of 90%.
Right now President Obama wants to spend $500 Billion dollars to repair existing roads and bridges, and to pay for teachers salaries. I don’t find this to be real stimulus. There’s no way it will pay back the interest accumulated through the debt taken on to pay for it. The way to stimulate the economy will be to help community banks lend.
The Federal Government should guarantee up to $500 Billion in loans made by community banks to small businesses. This will get money into the hands of entrepreneurs and may save community banks; placing them in a better position for when the big banks disintegrate. I would be surprised is all of the loans default. Since they won’t default tax payers won’t be on the hook for all $500 Billion. While I don’t like it I can get behind it more so then the current proposed stimulus President Obama wants passed now.

Categories: Uncategorized

Flying car parts

October 7, 2010 Leave a comment
This morning as I was walking out to the bus a car pulling out of a side street caught my attention. It was a small commuter car and the piece of plastic which protects the front underside of the car was holding on by one screw. This large piece of plastic was being held on by a single screw on one side of the car, leaving the rest of it to drag along the ground. From anybody standing outside of the car it’s obvious that it is dragging a large piece of the car under it. How does the driver not notice this?
When the car accelerated upto about 20 mph I saw how the driver might not notice. There was enough of an air current being pushed under the car that the wing shaped like piece of plastic started "flying". I can hear the Car Talk conversation in my head right now.
Caller: "There’s a dragging sound everytime I accelerate, coming from under the car, but then it goes away once I get to street speeds. Any idea what it is?"
Car Talk Host: "I wonder if there’s a squirrel trapped under your car trying to get out."
Categories: Uncategorized

Warning, using Hotmail EAS will create duplicate contacts

September 1, 2010 Leave a comment
Last night I configured my phone to sync with Windows Live through the new Hotmail EAS service. My first attempt at configuring it was through the messaging app on the phone. Bad idea. That’s configured to always do hotmail email addresses through the older Windows Live App. So I uninstalled the Windows Live App and no luck. I then thought to see if there was an ActiveSync application on the phone and there was. I configured it through there. This cause a bunch of duplicate contacts to be created. Turns out I should have left the Windows Live App installed. That would have managed the incoming contacts better than Windows Mobile 6.1.
Lesson learned.
Categories: Uncategorized

Natural Born Hunter

January 20, 2010 2 comments

So I was watching a video on things to do with your cat. One of the things it mentioned was if the cat ate kibble (dry cat food) to put the cat food in a cup on the floor. That way instead of having it in an easy to access bowl, the cat has to knock the cup around the floor to get a little bit of food out. This appeals to cats, who are natural hunters. It’s not as strenuous as hunting, but it is more exciting than a boring bowl in the same place every day.

So I put some food for Isis in a cup on the floor. She wouldn’t even try to get any food out of it. I knocked the cup around a little bit to show her the idea. Eventually I gave in and put the food in her bowl, which she started eating right away. We did this for a few days, until one day Isis got hungry enough that she put her paw in the cup, scooped out some pieces of kibble onto the floor, ate the food, and repeated until she was done. We did this a few more times, and now I’ve given up on trying to give her any challenge to getting her food.

But if something has feathers, she’ll hunt for it.

Categories: Uncategorized

It wasn’t much of an execution

January 10, 2010 Leave a comment

I just finished playing Tales of Monkey Island 4: The Trial and Execution of Gybrush Threepwood. It was a fun game. I had plenty of times where I wanted to give in and look up the next clue online. Thankfully I never did. The title is a bit misleading though. Our protagonist, Guybrush Threepwood isn’t executed. That doesn’t mean though that there’s not a climatic ending. I actually want to get a screen shot of the ending for a computer wallpaper. It’s a very climatic and fun ending and I can’t wait to play the next Tales of Monkey Island game.

Categories: Uncategorized

A Resource Pool for use once objects

January 4, 2010 Leave a comment

At work today I had a meeting where we went over a scenario where it would be useful to have a bunch of objects ready to use, but we don’t trust other people to not misuse shared resources. So what they wanted was a pool that would have a minimum number of objects ready to go, but that nothing would be placed back into the pool. The idea being that they might grab a number of object from the pool, and then the pool should fill up again while the main code was doing work.

using System;
using System.Collections.Generic;
using System.Threading;

namespace PreFetchPool
{
    /// <summary>
    /// Class to precreate objects to ensure that there is a minimum of use once resources
    /// </summary>
    /// <author>jader3rd</author>
    public class PreFectchPool<T> : IDisposable where T : class
    {
        private ReaderWriterLockSlim poolLock;
        private Queue<T> pool;
        private Func<T> createFunc;
        private bool disposing;
        private readonly TimeSpan timeout = TimeSpan.FromSeconds(15);
        private ManualResetEvent poolHasItems;

        /// <summary>
        /// The amount of items which should exist in the pool. Default is 10.
        /// </summary>
        public uint Quota { get; set; }

        public PreFectchPool(Func<T> create)
        {
            createFunc = create;
            poolLock = new ReaderWriterLockSlim();
            pool = new Queue<T>();
            disposing = false;
            Quota = 10;
            pool.Enqueue(createFunc.Invoke());
            poolHasItems = new ManualResetEvent(true);
            ThreadPool.QueueUserWorkItem(checkPool);
        }

        /// <summary>
        /// Unblock any threads waiting on the pool. Dispose of any objects left in the pool.
        /// </summary>
        public void Dispose()
        {
            disposing = true;
            poolHasItems.Set();
            poolLock.EnterWriteLock();
            poolLock.ExitWriteLock();
            if (null != poolLock)
            {
                poolLock.Dispose();
                poolLock = null;
            }

            while (0 < pool.Count)
            {
                T item = pool.Dequeue();
                if (item is IDisposable)
                {
                    ((IDisposable)item).Dispose();
                }
            }
        }

        /// <summary>
        /// If the pool needs more objects, create one and add it to the pool.
        /// </summary>
        /// <param name="state">Not used, just there to satisfy QueueUserWorkItem</param>
        private void checkPool(Object state)
        {
            if (disposing) return;
            try
            {
                poolLock.EnterUpgradeableReadLock();
                if (pool.Count < Quota)
                {
                    T item = createFunc.Invoke();
                    try
                    {
                        poolLock.EnterWriteLock();
                        pool.Enqueue(item);
                        poolHasItems.Set();
                    }
                    finally
                    {
                        if (poolLock.IsWriteLockHeld) poolLock.ExitWriteLock();
                    }
                }
            }
            finally
            {
                if (poolLock.IsUpgradeableReadLockHeld) poolLock.ExitUpgradeableReadLock();
            }
            ThreadPool.QueueUserWorkItem(checkPool);
        }

        /// <summary>
        /// Get an item from the pool
        /// </summary>
        /// <returns>The item</returns>
        public T Get()
        {
            if (disposing) throw new ObjectDisposedException(GetType().Name);
            T item = null;
            do
            {
                // If the pool doesn't have any items for the timeout period try to create an object
                if (poolHasItems.WaitOne(timeout) && !disposing)
                {
                    try
                    {
                        poolLock.EnterWriteLock();
                        if (0 < pool.Count)
                        {
                            item = pool.Dequeue();
                        }
                        if (0 == pool.Count)
                        {
                            poolHasItems.Reset();
                        }
                    }
                    finally
                    {
                        if (poolLock.IsWriteLockHeld) poolLock.ExitWriteLock();
                    }
                }
                if (null == item)
                {
                    if (disposing) throw new ObjectDisposedException(GetType().Name);
                    ThreadPool.QueueUserWorkItem(checkPool);
                }
            } while (null == item);

            ThreadPool.QueueUserWorkItem(checkPool);
            return item;
        }
    }
}
Categories: Uncategorized

Frozen Seattle Nights

December 15, 2009 2 comments

For all of those who don’t know the Seattle area has gone through two weeks of freezing weather. The temperature has stayed below freezing for most of the two weeks. The sky has been cloudless and there hasn’t been much wind. They kept on predicting snow, but it kept staying too cold for the moisture to move in. I don’t think that any records were broken for how cold it got, but what’s different this time is how long it stayed below freezing. It has been abnormal.

On Saturday night Amanda and I were in bed and just about ready to turn off the light when the fire alarm went off. It is very loud. Poor Isis, our cat, was scared to death. So Amanda took Isis outside. The fire alarm was going off for everyone in our building (16 units). Everybody else was coming outside too about this time, but with their freaked out dogs. Isis was not happy being taken into the cold and being surrounded by dogs. Amanda had to foil her many attempts to flee to a place with no alarm and no dogs.

What had happened was one of the external fire sprinklers had started pouring water, causing the fire alarm to go off. The fire department showed up, turned off the alarm, turned off the water and helped clean up. They said that they cold was causing fire sprinkler heads to freeze and burst. It was their ninth call that night for just the same reason. The buildings around here haven’t seen consecutive cold like this before and it’s showing.

The management company is going to take a few days to get to fixing our building because they are dealing with this all over. We were lucky in that it didn’t affect a unit, only the exterior stair well. I’m sure there are lots of other places where it’s causing burst pipes inside of units.

It made for quite a lot of excitement.

Categories: Uncategorized