While working on a project I was using a MsSQL 2012 database for my persistence layer but wanted to use a SQLITE in memory database for my unit/integration testing. As part of my mapping setup I used an NHibernate Version column which used DateTime2:
NHibernate Mapping Code:
Unforntuently SQLITE doesn't support DateTime2. After searching around and not finding a good solution, I ended up extending SQLiteDialect class to map it to TEXT per the following link: http://stackoverflow.com/a/16597386/2544235
SQLiteDialect Code:
Tuesday, April 19, 2016
Friday, January 23, 2015
Monday, October 6, 2014
Windows 10 "element not found" - explorer.exe error
I recently installed windows 10 preview on an old laptop (Dell Precision) which has an Nvidia Quadro 3000M video card. After running windows update i was getting an error every time i tried to load any metro app including the feedback app.
Error: The error popped up a box saying Explorer.exe with text "element not found".
Fix: Disable the Optimus feature in the bois.
It appears to be a Nvidia optimus problem similar to the one that initially affected Windows 8 and most likely will not be fixed till the vendor puts out windows 10 specific drivers.
More info:
http://answers.microsoft.com/en-us/windows/forum/windows_tp-hardware/nvidia-optimus-not-working-properly/a059390d-dfc1-44aa-9a47-d2172d70933e
https://forums.geforce.com/default/topic/779669/nvidia-optimus-doesnt-work-with-windows-10-tech-preview/?offset=2
http://en.wikipedia.org/wiki/Nvidia_Optimus
Error: The error popped up a box saying Explorer.exe with text "element not found".
Fix: Disable the Optimus feature in the bois.
It appears to be a Nvidia optimus problem similar to the one that initially affected Windows 8 and most likely will not be fixed till the vendor puts out windows 10 specific drivers.
More info:
http://answers.microsoft.com/en-us/windows/forum/windows_tp-hardware/nvidia-optimus-not-working-properly/a059390d-dfc1-44aa-9a47-d2172d70933e
https://forums.geforce.com/default/topic/779669/nvidia-optimus-doesnt-work-with-windows-10-tech-preview/?offset=2
http://en.wikipedia.org/wiki/Nvidia_Optimus
Thursday, July 24, 2014
Recurly Credit Card Processing - True Metered Billing
Overview: I have a client that wants to simply bill a transaction fee at the end of each month. After doing my due diligence, Recruly appeared to be the best solution for the problem as they assured me that what was i doing was not only possible but simple.
To make a long story short, technical support couldn't provide me with an example nor would they tell me anything but "look at our website" which was less then helpful as it contradicted itself. Sometimes it would say to modify the plan subscription itself, sometimes it would say to create an addon. None of this is correct.
The correct way to do metered billing with Recurly using is to use the following procedure:
To make a long story short, technical support couldn't provide me with an example nor would they tell me anything but "look at our website" which was less then helpful as it contradicted itself. Sometimes it would say to modify the plan subscription itself, sometimes it would say to create an addon. None of this is correct.
The correct way to do metered billing with Recurly using is to use the following procedure:
- Create an account without a subscription plan
- At the end of each month simple add an adjustment to the account and invoice the pending charges.
Code (C#):
private void CreateAccount(RecurlyAccount recurlyAccount) { var account = new Account(recurlyAccount.AccountCode) { FirstName = recurlyAccount.FirstName, LastName = recurlyAccount.LastName, Email = recurlyAccount.Email, CompanyName = recurlyAccount.CompanyName, }; account.BillingInfo = new BillingInfo(account) { LastName = recurlyAccount.RecurlyBillingInfo.FirstName, FirstName = recurlyAccount.RecurlyBillingInfo.LastName, Address1 = recurlyAccount.RecurlyBillingInfo.Address1, Address2 = recurlyAccount.RecurlyBillingInfo.Address2, City = recurlyAccount.RecurlyBillingInfo.City, State = recurlyAccount.RecurlyBillingInfo.State, Country = "US", PostalCode = recurlyAccount.RecurlyBillingInfo.PostalCode, CreditCardNumber = recurlyAccount.RecurlyBillingInfo.CreditCardNumber, CardType = recurlyAccount.RecurlyBillingInfo.CardType, ExpirationMonth = recurlyAccount.RecurlyBillingInfo.ExpirationMonth, ExpirationYear = recurlyAccount.RecurlyBillingInfo.ExpirationYear, Company = recurlyAccount.RecurlyBillingInfo.Company }; account.Create(); }
public virtual void BillCreditCard(Account account, int quantity, int amountInCents) { account.NewAdjustment("USD", amountInCents, "Orders", quantity).Create(); account.InvoicePendingCharges(); }
Wednesday, May 14, 2014
Scaling Agile Across the Enterprise
Microsoft put out some videos about "Scaling Agile Across the Enterprise". I particularly like the video which talks about how the waterfall method is not a good way to design software anymore and how businesses struggle with that.
It can be found here: https://www.youtube.com/watch?v=n79fJUiQ-PU
It can be found here: https://www.youtube.com/watch?v=n79fJUiQ-PU
Wednesday, March 12, 2014
Nhibernate, Abstract Base Classes and JSON.NET
While working on a project I ran into an issue where JSON.NET was not serializing and deserializing my nhibernate entities that used polymorphism. I found plenty of examples that showed how to do this with objects directly but none with Lists and Collections. This code isn't generic like it should be but worked for my purposes.
So here is my code:
POCO:
JsonConverter:
POCO:
[JsonConverter(typeof(LineItemConverter))] public virtual ICollectionLineItems { get; set; }
JsonConverter:
public class LineItemConverter : JsonConverter { public override bool CanConvert(Type objectType) { return typeof(LineItem).IsAssignableFrom(objectType); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var lineitems = JArray.Load(reader); var lineItemObjects = new List(); foreach (var lineitem in lineitems) { switch (EnumUtil.ParseEnum (lineitem["lineItemType"].Value ())) { case LineItemType.Assessorial: lineItemObjects.Add(lineitem.ToObject ()); break; case LineItemType.DeficitWeight: lineItemObjects.Add(lineitem.ToObject ()); break; case LineItemType.Discount: lineItemObjects.Add(lineitem.ToObject ()); break; case LineItemType.FloorAdjustment: lineItemObjects.Add(lineitem.ToObject ()); break; case LineItemType.Freight: lineItemObjects.Add(lineitem.ToObject ()); break; case LineItemType.Fuel: lineItemObjects.Add(lineitem.ToObject ()); break; case LineItemType.Other: lineItemObjects.Add(lineitem.ToObject ()); break; default: break; } } return lineItemObjects; } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var lineitems = value as ICollection ; serializer.Serialize(writer, lineitems.ToArray()); }
Tuesday, January 28, 2014
Angluar JS + c# Web API decimals not routing
For some reason when i would put/get decimal values with the angularjs $resource i would get a 404. After lots of research i found out that this is due to $resource dropping trailing slashes (more info here: http://stackoverflow.com/questions/14533117/angular-trailing-slash-for-resource ). There is talk that in angular 1.3 they will add this as an option but for now we need to use a hack.
HACK: Add "\\/" to the end of your url in the $resource. For example: return $resource('/api/pricingAgreementItem/:id/:action/:value\\/', { id: '@id' },... See below for a more complete example.
Javascript: C#:
HACK: Add "\\/" to the end of your url in the $resource. For example: return $resource('/api/pricingAgreementItem/:id/:action/:value\\/', { id: '@id' },... See below for a more complete example.
Javascript: C#:
Subscribe to:
Posts (Atom)
-
While working on a project I was using a MsSQL 2012 database for my persistence layer but wanted to use a SQLITE in memory database for my u...
-
Redmine Install Process -- Download and install turnkey linux's redmine appliance http://www.turnkeylinux.org/redmine -- install up...
-
I recently started a project which used the following technologies: Visual Studio 2013 + Angularjs + JasmineJS + Resharper 7/8 (or Chutzpah)...