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.

Wednesday, March 3, 2010

Fisher Price Cradel Swing Uses the Same Motor as Air Wick Fresh Matic

   I had to post this, for the simple fact that it astounds me. Yesterday, our baby swing, a Fisher Price Cradel Swing crapped out on us. The music and mobile continuted to work, but the swing, did not, in fact, swing. So loooking around, we found that the cheapest model in stores is around $70, which was a bit pricey for me at the moment. So instead, I appealed to the internets to resolve my solution, and I stumbled on the following site:  http://www.fixya.com/support/t1101519-fisher_price_natures_touch_cradle_swing An lo and behold, it says that with an hour, and an Air Wick Fresh Matic you can replace the motor in the swing and it would fix it.
   At $11 for the air wick, I figure, what the hey, I'll give it a shot. Long story short, one dismembered air wick (it uses triangle bit screws, I don't have that, but I do have two pairs of pliers tougher than the plastic), a cut thumb, and a bit of sweat later, the swing swings again. So, crazy, ya? Anyhow, thanks to the internets for saving me $60.
  For anyone who actually tries this, it is possible for someone who isn't incredibly mechanically minded, however, you'll probably disagree with me half way through.

Friday, January 22, 2010

Script for a table dropping utility.

This a script that I've created to power drop a table. It kills all constraints, (Foreign Keys, Uniqueness, Primary, etc.) attached to the table, then drops said table. This is specific to SQL Server Express, I'm not sure how well it translates to other versions. Much thanks to http://drsql.spaces.live.com/Blog/cns!80677FB08B3162E4!1191.entry for the portion that kills all the relationships.

To Create the Stored Procedure:

GO
IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[utility$powerDropTable]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
BEGIN
DROP PROCEDURE dbo.utility$powerDropTable
END
GO
create procedure utility$powerDropTable
(
@table_schema sysname = 'dbo', --does not do a like comparison
@parent_table_name sysname = '%', --it is the parent when it is being referred to
@child_table_name sysname = '%', --it is the child table when it is the table referring
--to another
@constraint_name sysname = '%' --can be used to drop only a single constraint
) as
-- ----------------------------------------------------------------
-- Drop all of the foreign key contraints on and or to a table
-- ----------------------------------------------------------------
begin
set nocount on
declare @statements cursor
set @statements = cursor static for
select 'alter table ' + quotename(ctu.table_schema) + '.' + quotename(ctu.table_name) +
' drop constraint ' + quotename(cc.constraint_name)
from information_schema.referential_constraints as cc
join information_schema.constraint_table_usage as ctu
on cc.constraint_catalog = ctu.constraint_catalog
and cc.constraint_schema = ctu.constraint_schema
and cc.constraint_name = ctu.constraint_name
where ctu.table_schema = @table_schema
and ctu.table_name like @child_table_name
and cc.constraint_name like @constraint_name
and exists (select *
from information_schema.constraint_table_usage ctu2
where cc.unique_constraint_catalog = ctu2.constraint_catalog
and cc.unique_constraint_schema = ctu2.constraint_schema
and cc.unique_constraint_name = ctu2.constraint_name
and ctu2.table_schema = @table_schema
and ctu2.table_name like @parent_table_name)
open @statements
declare @statement nvarchar(1000)
While (1=1)
begin
fetch from @statements into @statement
if @@fetch_status <> 0
break
exec (@statement)
end
declare @dropStatement nvarchar(1000)
set @dropStatement = 'IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N''[dbo].[' + @parent_table_name + ']'') AND type in (N''U'')) DROP TABLE ' + quotename(@parent_table_name)
exec (@dropStatement)
end

To use said said stored procedure:

exec utility$powerDropTable @parent_table_name = 'YourTableName';

This was created as we have a source control script that rebuilds the entire database for us to use on our local sql server. The script would create the table if it was missing, but didn't clear the table and recreate it. Now it kills it, then recreates it, so column additions, renames, etc get picked up when the script is run.

Switching Modes

Hello All,
(And by that, I mean, hello me, as I'm the only one who has ever read this, lol.) While I will still post the occasional rant, I'm going to dual mode this blog. I'm a programmer, and I'm learning lots of new and useful things. Anything that I have a sever issue with searching out on the web, I'm going to post here.
- The Slow Kid