Wednesday, July 13, 2011

Tech: Change Your Phone's Camera Resolution

Chances are that if you have a smartphone, you like to share the pictures you take with it.  Take a moment to take a look at the resolution your camera is set at.  My Droid Incredible goes up to 8 MegaPixel (3264x1952).  Because of the small lens, the pictures are pretty noisy, even in daylight.  So I'd never print anything larger than a 4x6.  Realistically I'd probably print a 3x4.  Most photo printers recommend a resolution of 300 dots per inch.  So a photo printed at 4 inches by 6 inches would need a resolution of 1800 x 1200.  On my phone this resolution is just below my 3 megapixel setting.  So at 3x4 I'd only need to use my 1 megapixel setting.  This also makes emailing and uploading my photos to Facebook MUCH faster!  Furthermore it uses less disk space on my memory card.

Tuesday, July 5, 2011

Code: EF Code First Column Name Mapping

When using Entity Framework Code First there are a couple of ways to map your classes to your database, below is a code snippet of what made the most sense to me.  It maps property names to column names, denotes the table name to use for the class, and specifies the primary key.  There are also a handful of different properties on this class, but because they have the same name as the column in the database they don't need to be explicitly set.

public class LocateDB : DbContext
    public LocateDB()
        : base("LocateDB")
    public DbSet<LocateAccount> LocateAccounts { getset; }
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
        var entity = modelBuilder.Entity<LocateAccount>();
        entity.Property(x => x.PR_Fax).HasColumnName("PR_Fax#");
        entity.Property(x => x.PRATT_Fax).HasColumnName("PRATT_Fax#");
        entity.HasKey(x => x.LocateId);