Saturday, March 2, 2013

Devious Mind Of A Three Year Old

  Just figured I'd share a fun story with you that happened this afternoon. There are two things you need to know to appreciate this story. The first is that my daughter sucks her pinky and sometimes her ring finger to pacify herself. She is getting old enough now to where it is starting to damage her teeth, and we've been working to get her to stop. It isn't going well. The second is that I'm currently super sleep deprived. I had a head cold that turned into a sinus infection that was bad enough it infected my eye, which I didn't realize could happen. Regardless, I've not been sleeping well. I did however get a potent anti-biotic yesterday, and this afternoon finally had a good nap.
  The story begins with with me buying some "No Bite" today. It is a nail polish that has a nasty nasty taste.  It is to provide reinforcement to not bite nails / suck thumbs, or in our case, a pinky. I put it on her, and she was not well pleased. I caught her trying to wash it off her fingers, which of course doesn't work without nail polish remover. As I have the habit of biting my fingernails, I put some on me as well.
  While watching them today, I fell asleep on the couch and napped very very deeply for about two hours, woke up, realized it was bed time, and after having the kids help clean up and feeding them, put them to bed. Whilst cleaning, I found the No Bite lid half off. I asked the kids what had happened with it, and of course "No one" had touched it. I can usually tell when son number one or son number two lies, as they have tells. My daughter however will boldly look you in the eye while lying through her tiny crooked teeth.
 When I finally got around to eating myself, I kept getting hints of the nasty No Bite flavor, and figured I must have gotten it on my fingers. I then carefully washed the finger pads and tested them, and the flavor was gone. Mission accomplished. Upon returning to eating, food still tasted of No Bite. While pondering what was happening, I just happened to lick my lips, and realized, that is where the taste was coming from. My Lips.
  I don't know for sure, but I'm fairly certain that my daughter, while I was sleeping, painted my lips with the No Bite. Probably in retaliation for putting it on her fingers. The real kicker is, it is supposed to last for three days, and only comes off with nail polish remover.... I can't use that on my lips.

Thursday, June 14, 2012

After much searching, finally found someone who could "power set offline" a sql server database. Our prod environment has several web services that continually connect to the database and once present, keep the connection open. I don't have control over those, which leaves me with the pain of restoring backups with connections that just won't shut up. Every where you look has the alter database code for setting single user. This won't work always.  So I'm pointing you to The Intraweb Home of Andy White who created the following script. Much like he did, I want easy access to this. That guy is my hero. Impossible to hunt down and kill the 30ish respawing connections the way I was trying.

-- Kill all processes connected to a database.
use master;
declare @DatabaseName varchar(50);
declare @Spid varchar(20);
declare @Command varchar(50);
set @DatabaseName = 'MyDatabase';
print 'This query''s SPID: ' + convert(varchar, @@spid);
-- Select all SPIDs except the SPID for this connection
declare SpidCursor cursor for
select spid from master.dbo.sysprocesses
where dbid = db_id(@DatabaseName)
and spid != @@spid
open SpidCursor
fetch next from SpidCursor into @spid
while @@fetch_status = 0
begin
    print 'Killing process: ' + rtrim(@spid);
    set @Command = 'kill ' + rtrim(@spid) + ';';
    print @Command;
    execute(@Command);
    fetch next from SpidCursor into @spid
end
close SpidCursor
deallocate SpidCursor

Thursday, October 21, 2010

Popped the trunk twice, and the dang hood still won't open.

Ocassionally, I wonder if I really am fit to be driving. The other day, I was late for work, and didn't remember until on the road that A: I needed gass and B: I needed to add a quart of oil.  So, I stop at the nearby 7-11. I hurridly pop the trunk and step outside the car to begin filling.
I immediately found a problem. I'd forgotten to pop the gas. So, I unlock my car, (I locked it cause I was going to pick up a drink.) and pop the gas. Relock the door, and start to pump my gas. Once the gas is going, I walked to the hood to check my oil.  The dang thing won't open.
I go back, unlock the door, pop the trunk again, lock the door, and try the hood again. Still stuck. At this point, (it is important to know that I drive a crappy problematic car) I wonder if once again, the hood popper is stuck. It had had the problem a year ago. However, I know I need oil, so I determine to fight through it.  I unlock the door, and go to pop the trunk, and reallize what I'd been doing. So, laughing at my stupidiy, I pop the hood, lock the door, and proceed to check / add oil. I put away the gas nozzle, and got ready to fill my mug.... which was locked in the car.
Even more irritated at the repeated locking / unlocking, I retrieve my mug, fill it, and start on my way. I got about a half block before I realized I'd forgotton something.... my trunk was bobbing up and down, flapping in the wind.

Friday, September 3, 2010

... If I Had My Wallet!

I needed to pay a friend $60 bucks. I planned on it, so I withdrew the $60 and proceeded about my day. In the course of the day, my wife asked me to pick up some formula. I was in a hurry, so I just used the cash I had on hand, figuring that when I get gas (for I was almost out) I'd get some cashback.

Being who I am, I was late getting up the next morning so I rushed out, forgetting to get gas. I realize this on the way, it's fine, I'll get there ok, just do it during my morning break. During my morning break, I go to the gas station to get my gas. This would have worked great.... if I had my wallet.

As the day progressed, the team started talking about lunch. After much discussion, we decided on a local mexican restaurant.  I was all jazzed and ready to go on the team lunch, which would have worked great.... if I had my wallet.

During my sack lunch later, I recall that I was supposed to get money back for my friend. So I jump in my car, and head to the bank. I was in a rush, so I figure I'll just hit the atm. This would have worked great.... if I had my wallet.

A few hours later, I was totally immersed in work.  I surfaced long enough to realize that I didn't have to use my card. I could just go into the bank to get my money. As I was working late, I decided to go during dinner. So I jumped in my car, got to the bank and was on my way in when I conveniently remembered that you need ID to withdraw cash. Which would have worked great.... if I had my wallet.

In the end, I had to make a separate trip to give them the money, and in fact had to borrow some money to even get home.

It was not a good day.

Saturday, August 28, 2010

And switching back.

Haven't really done anything for awhile. Mostly because this is something I do when I don't have anything else I'm more interested in. (Read, no new games, no work, no kids to play with.) Anyhow, I set up a more professional site for myself, and will post further coding comments there at DeMille Development Blog. This will now be for my more original and whacked posts. Rant on my friends.

Monday, March 8, 2010

PBBG Domain of Heroes

I don't know how many of you have actually looked into PBBGs. It stands for Persistent Browser Based Game. They require only a browser, and store information about you. Now, I've never tried any but the RPG's, however, I've found them fairly nostalgic. If you ever played any old school text based video games, these may fit the bill.
For me, it is like one of the old choose your destiny books. Where you can take actions, and influence the quest. I've been amazed at the amount of creativity and time that have been put ino them. The current one I've been toying with, is Domain of Heroes. It is a much more "hands off" version than I've seen before, with a very interesting business model. I say hand's off, because you queue to fight monsters, and it will continue your last action, and continue brining in monsters, until you time out. Every action resets the time out, or you can walk away. I'm enjoying it, because it can be played while playing other games.
The business model is very comprehensive. They have a "wish" system. You can do account upgrades or character upgrades for wishes. Wishes can be either bought or earned. (For example, if you refer others to the game, you get a percentage of wish for every wish they buy.) The purchases can be astetic, such as changing your chat color or getting an icon next to your name, or functional, such as increasing inventory and collection capacities. In additon, there are "ease of use" upgrades that are intersting, such as allowing you to type in longer messages in chat (you are initially limited to 50 characters) or making it so you can join a guild. Anyhow, this specific one has held my insterest for longer than others, so I figured I'd share. If you're interested, you can check it out (and hook me up) by using this link http://www.DomainOfHeroes.com/?rpid=60267 . If you do choose to try it, I suggest reading the quick start guide before you dig in, it is fairly short, and you'll be better off for it.

Friday, March 5, 2010

Enitity Framework CAN Support Stored Procedures That Do Not Have A Return Value

I didn't realize this, but apparently there articles that state that EF does not support procedures that return no result. This surprised me because I've been doing that in my application.

To Do So:
When you import your objects, make sure the stored proecure is imported. Next go to your Model Browser, and go the the EntityContainer in your Model. Right click Function Imports and add the name of your stored procedure.


Once you have done that, you can call the procedure through EF in the following manner:

//Create the Context then set up a DbCommand.
YourEntityModel.sprocContext = new YourEntityModel.();
DbCommand command = sprocContext.Connection.CreateCommand();
command.CommandText = "YourEntityModel.yourStoredProcedure";
command.CommandType = CommandType.StoredProcedure;
//If parameters are needed
DbParameter parameter = command.CreateParameter();
parameter.DbType = DbType.Int32;
parameter.ParameterName = parameterName;
parameter.Value = value;
command.Parameters.Add(parameter);
//Excecute the command
DbCommand nonQuery = (DbCommand)nonQueryObject;
nonQuery.Connection.Open();
nonQuery.ExecuteNonQuery();

It is as simple as that.