Sunday, December 24, 2017

TEEJ Christmas

Hi Teej!

I made a Christmas video game for you!  It's insane.

Some things you should know before you play.

  1. You might get a message that says, "Please note that Unity WebGL is not currently supported on mobiles.  Press OK if you wish to continue anyway."  Just click OK!
  2. The file size is big.  It may take a little while to download.
  3. To play the game, click or touch a location and you will move there.
  4. Push the bad guys off the screen!
  5. Don't go off the screen yourself or you will die!
  6. There is no score!  Sorry.  For some reason I could not get that to work,
I think that's it!  Enjoy the game.

Tuesday, October 17, 2017

Enviro Empress Igniter

Our Enviro Empress is a great stove, but it has stopped lighting!  I looked at the manual and found some tips online for how to troubleshoot it.  You can give it 120V power (somehow?) and also test to see if fuses are burned out or if the igniter is getting enough power using a voltage detector.

What I did is just remove the igniter.  It was not easy to get in there, but I used a socket wrench with a T20 "star" drill bit to remove the screws.  I also created a home-made tool to finish backing out the screws because the socket wrench barely fit.

I placed the igniter on the hearth in very fireproof place, plugged the stove back in and turned it on.  In 2 minutes I had a red hot igniter, but it was not hot all the way to the end, as you can see in the pictures.

So I ordered a new one from Amazon.  Hopefully that will do the trick!

I have received the new igniter!  It is so much cleaner than the old one (which was actually slightly bent).  the crazy thing about the new igniter is that the holes in the mounting plate are smaller than the provided screws and the screws I already had from the old igniter.  What the heck!?  Anyway, I was able to use a metal screw bit to enlarge the holes and install the igniter.

The new igniter is working great!  The stove fires right up.

Wednesday, September 13, 2017

Colonization Rampage 2

OK.  This old game is still wicked fun.

I downloaded the new Colonization game on the iPhone.  It was playable, but the controls were really bad and it was not very fun.

I downloaded the game again from GOG.  I decided to try another game with a challenge.

Here are my old challenges.  Never going back to Europe was my favorite.

Save the Natives

Anyway, I wanted to play a game where I tried to prevent all native villages from being destroyed.

I started one game as the Spanish near the Tupi tribe.  My rationale was to be the Spanish to prevent their Indian village attack bonus from being used.  That did not work so well and the Tupi were not very good to trade with (being nomadic).

I started this other game as the French and went to war with the Spanish (and other Europeans) early and often.  Some things that have happened that were fun and/or helped:

  1. I got Hernando de Soto first!  That was lucky.  All my exploration is always positive.  But I never dug any burial mounds.
  2. I got Hernan Cortez second.  I was able to do a lot of exploration and have the king's galleons transport my treasure for free.
  3. I have created a TON of missionaries, but I have gotten very few converts so far.
  4. I also NEVER took any Indian land, only land that was unoccupied.  (1 square away from all villages)
  5. I have armed every single tribe I am in contact with with many horses and guns.  I always just give 2 horses at a time and it counts as an entire horse herd.

Some pictures from midway through:

And here is the final pic.  Only one native village was destroyed by the Spanish.  I finally beat down the Spanish so much that they retired from the New World.


"There shall be no money, but you shall have complete enlightenment, which is nice."

Never have any money.  Ever.

So that means there are certain things you just can't do like:

  • Visit native villages - they sometimes give you gifts
  • Explore - ruins give you money
  • Trade - this one is obvious
  • Take over European settlements - this comes with spoils!

This was a fun one.  It was really hard in the beginning.  My military was super weak at first.  I basically had one soldier to guard 2 settlements until I got my first cannon.  Even then I was super weak.  I finally got horses from the Apache - they gifted them to me.  I could have also gotten them from immigrant scouts, but I didn't get that until very late in the game.

Anyway, I decided to play as the English because of their immigration bonus.  I created lots of churches and preachers to get more immigrants.

My war of independence was pretty rocky until I got Dutch intervention.  After that it was smooth sailing.

Late Comer!

I've been reading a bit about the actual history of some colonies like Jamestown, Santo Domingo, Plymouth, New Amsterdam, etc.  It is very interesting how the English and Dutch colonization really didn't ramp up until the 1600s.

So I decided to play the game as Late Comer Jr.  I didn't take any screen shots, but it was fun.  I basically held down the space bar until it became 1595 at which point I landed my settlers and founded a colony.  Actually I should have explored a bit by ship first which did historically happen.

I used the English.  I was amazed at how the game mimicked reality.  One of the reasons the English were successful colonizers is because of their lateness.  The local native populations were already reduced by smallpox and other diseases to such a degree that certain areas that were good for settlements were abandoned by the native Americans.  This is a very tragic part of American history.  

In the game, there is no disease, but the Spanish and Dutch had already come through and fought off many of the local tribes, so I did have plenty of space for settlements.  I was able to build a church very quickly and get a swarm of immigrants.  I needed that to catch up to the other European players.

I founded 4 colonies, but decided not to finish the game.  I had already caught up to the other players in terms of population and military.

Thursday, August 24, 2017

How to create a Bootstrap 3 Theme

Wow, it was really easy once I figured out how to do it.

I all relies on a config.json file.  You don't have one?  Download the base bootstrap from this link.

The download link is at the very bottom.

Once you have the file, tweak the LESS variables to your heart's content!  I put in my brand colors, tweaked a lot of the padding, and some fonts.

Then using the same URL above, upload the config.json and see that all of the variables you changed are reflected in the page.  Then simply download it again!  Voila!

Note.  I tried to add inline comments to the JSON in // and /**/ form, but the parser did not like that at all.

Thursday, December 15, 2016

How to Import Excel or CSV data into SQL Server using SSDT

I have recently rebuilt my computer and decided to give SSDT a try.  This is SQL Server Data Tools.  I would use it instead of SQL Server Management Studio (SSMS).

It has been going really well so far.  I'm able to do all the normal things I'm used to.  Until now.  I wanted to import an Excel file into a table.  I've done it a million times in SSMS, but how do I do it in SSDT?

After some googling, I came up empty.  I should note that I am a C# developer.  I'm not using database projects.

Anyway, I figured out a really easy and almost ridiculous way to import the data.

Before you do this, make sure your database is backed up.  Only do this with small data sets.

  1. Open Visual Studio with SSDT.  To see if you have SSDT, look in your Help > About dialog and look in the list of Installed products.
  2. Open the SQL Server Object Explorer view.  (It's in the View menu).
  3. Connect to your DB and drill down to the table you want to import to.
  4. Right click the table and select View Data.
  5. Now go into Excel and select the data you want to import and hit our good old friend, CTRL-C or Copy.
  6. Switch back to Visual Studio, click on the row with all of the NULL values.  This row is intended for adding a single new row.  However, with the row selected, you can hit CTRL-V and paste all of the data into the new table.  Make sure the data fields line up.
  7. This will even work with IDENTITY columns.  Just make sure to have a column in Excel filled with zeros.
  8. That's it!  You might have to wait a while!
I should note that this is not the best plan if you have many rows of data.  If you have 1000 or less, this seems like a decent approach.  It may take a little while to import the data via copy/paste though.

Friday, May 27, 2016

Comparison and Review of .NET Fuzzy Matching Nuget Packages

I am simply using Jaro-Winkler to get a similarity factor of 2 strings.  I'm using this for name and address comparisons and doing my own score aggregation and weighting.

I first tried Fuzzy String.  Unfortunately, it has several issues preventing it from working properly.  Even among these issues, I found other examples that caused the Jaro-Winkler algorithm to go into an infinite loop.  It's funny that this package has a 5 star rating, because for my use case, only using Jaro-Winkler, it failed miserably.

Then I tried BlueSimilarity.  This package also had issues loading a BlueSimilarity.Interop.dll.  At this point I was tired of troubleshooting and just wanted a solution that worked.  Besides, on nuget the project site is a broken link.  Man.

Finally I tried SimMetrics-TextFunctions.  This worked really well!  I had a few small unit tests to simply verify that the bugs in FuzzyString are not in this implementation.  Awesome!
EDIT: Wow.  I found out 7 months later that this package does indeed have a bug.  It is easy to work around, but I consider it a bug non-the-less.  This code, with a space prefix on one of the strings returns with a zero similarity.  EDIT 2: Over a year later, I have found a bug.  With strings "Canyon Rd" and "Canyon Est Dr" I am getting a similarity score of .4.  It should be much higher than that.  So...  I'm changing my implementation... again.

Now I am using some code from Stack Overflow.  I'm really surprised that all the NuGet packages have some kind of issue and that this bit of code passes where all the others fail.  Thank goodness for unit tests.  I have a ton of them.

Monday, May 9, 2016

My Entity Framework Cheat Sheet

This is a list of tools I use to get generated code and get work done quickly with Entity Framework.

Generate Classes for Entity Framework Code-First from Database

  1. Prerequisite: An existing database
  2. Do one time:  Download Entity Framework 6 Tools for Visual Studio 2012 & 2013.
  3. Right click a project
  4. Add new item...
  5. Search for ADO, select ADO.NET Entity DataModel.
  6. Name it.
  7. Select Code First from database.
  8. Select / Create Database connection.
  9. Select tables you want to include.
  10. Finish
  11. Now you have models and a DbContext to work with.

Generate SQL/Database from a DbContext

  1. For the entities, create a models directory and create classes in it.
    1. If your primary key does not follow convention name, use the [Key] attribute.
    2. Create navigation properties for many to one relationships; create a property for the ID and the object.
    3. If your nav prop ID does not follow convention, use the [ForeignKey] attribute on the object.
    4. Other attributes to use: Required, MaxLength, Index, InverseProperty, Column (if you want your db column to have a different name), [Table("TableName", Schema = "SchemaName")]
  2. VIEW > Other > Package Manager Console.
  3. Make sure the console is showing the correct project.  You also may need to set that project as the startup project in VS so it can find the correct config file with the DB connection string.
  4. If you are trying to recreate your database, make sure to drop the DB or change the connection string.  Also remove the Migrations folder.
  5. Make sure you have a DbContext file with:
    1. A good database connection string.
    2. Sub-classing DbContext
    3. public DbSet<Entity> Entities {get;set;}
  6. Type: Enable-Migrations
  7. Add-Migration MigrationName
  8. Update-Database -Script.  Save off the SQL if you want it.
  9. Update-Database.  Now your database tables are created.