Tuesday, September 5, 2017

Contentful API and memcached

Contentful API and memcached: Some crazy gotchas

  1. Don't use the default transcoder.  Everything NEEDS to be [Serializable] which might be sort of impossible.  Switched over to that Install-Package Enyim.Memcached.Transcoders.Json -Version 1.0.0 transcoder and things were like gravy.
  2. If you are having trouble, execute the MemcachedClient.ExecuteStore method because it returns an object that gives you error messages.  Please try it.
  3. AWS ElastiCache is not accessible from outside of AWS without using a NAT Instance and some other magic.  Don't do it.  Just set up a publicly accessible instance and move on with you life(for development only of course).
There are probably some more, but I have forgotten.  It's been rough out there.


Friday, September 30, 2016

AX 2012 Query To Get Vendor Address Information

Here is a SQLServer query that can be run against the database to pull vendor address information.  In this case, it is pulling addresses with the "Remit To" address role belonging to a company designated as "gi".

SELECT
  vt.*,
  dpt.*,
  dpl.*,
  ll.*,
  lpa.*,
  dplr.*,
  llr.*
FROM VendTable vt
INNER JOIN DIRPARTYTABLE dpt
  ON vt.PARTY = dpt.RECID
INNER JOIN DIRPARTYLOCATION dpl
  ON dpl.PARTY = dpt.RECID
INNER JOIN LOGISTICSLOCATION ll
  ON ll.RECID = dpl.LOCATION
INNER JOIN LOGISTICSPOSTALADDRESS lpa
  ON ll.RECID = lpa.LOCATION
INNER JOIN DIRPARTYLOCATIONROLE dplr
  ON dplr.PARTYLOCATION = dpl.RECID
INNER JOIN LOGISTICSLOCATIONROLE llr
  ON llr.RECID = dplr.LOCATIONROLE
INNER JOIN PARTITIONS AS p
  ON vt.PARTITION = p.RECID
WHERE vt.DATAAREAID = 'gi'
AND GETUTCDATE() BETWEEN lpa.VALIDFROM AND lpa.VALIDTO
AND llr.Name = 'Remit To'
ORDER BY vt.ACCOUNTNUM

Enjoy!!!

Thursday, August 20, 2015

TeamCity Installation

I recently installed TeamCity on a Windows 2012 R2 Server on Amazon Web Services.  Here are a few things that would have made my experience much smoother.

  • On the server, add a new Local User account called TeamCity (or whatever you want to call it) and make sure that the user is able to Run As A Service.  This is done in the Local Security Policy.  Use this user for your Service Accounts for the application as well as the build server.  Using the System account just didn't work for me.
  • In SQLServer, go ahead and set up a user and database to hold your TeamCity information.  I used SQL Authentication when I connected to the database specifying a user name and password.
  • In the application installation, you can specify that a build agent be installed.  Don't run the build agent again later.
After you get things installed, read Richard Cirerol's blog post on Implementing Team City for .NET projects.  It helped me with a few things.

Friday, March 7, 2008

Examples using Enterprise Library Data Access Application Block

These are examples of using the Enterprise Library Data Access Application block.


using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

public MyDataset.MyEntityDataTable GetAllEntities()
{
SqlDatabase db = new SqlDatabase(this.ConnectionString);
StringBuilder sql = new StringBuilder();
sql.Append("dbo.my_entity_select_all");

using (DbCommand command = db.GetStoredProcCommand(sql.ToString()))
{

using (MyDataset.MyEntityDataTable dt = new MyDataset.MyEntityDataTable())
{
using (IDataReader reader = db.ExecuteReader(command))
{
while (reader.Read())
{
AddMyEntityRow(dt, reader);
}
return dt;
}
}
}
}



public MyDataset.MyEntityDataTable GetMyEntity(string MyEntityId)
{

SqlDatabase db = new SqlDatabase(this.ConnectionString);
StringBuilder sql = new StringBuilder();

sql.Append("dbo.My_Entity_Select_By_My_Entity_ID);

using (DbCommand command = db.GetStoredProcCommand(sql.ToString()))
{
db.AddInParameter(command, "
@EntityId", DbType.String, Entity_Alias);
using (MyDataset.MyEntityDataTable dt = new MyDataset.MyEntityDataTable())
{
using (IDataReader reader = db.ExecuteReader(command))
{
while(reader.Read())
{
AddMyEntityRow(dt, reader);
}
return dt;
}
}
}
}

Thursday, February 21, 2008

Custom Configuration Sections

Here are a couple of good links related to creating CustomConfigurations in .NET applications.  This link from dotnetslackers.com gives the simplest explanation I've found so far.
 
This example explains using Collections in your custom config.  Really cool!!!  If you want the basics, check out this article on MSDN.

Monday, January 28, 2008

New C# Features

There is an interesting article on DevX.com about new C# features written by Wei-Meng Lee.  It is the first in a series of other articles to come.  This article covers Implicit typing, automatic properties, collection initializers, and labmda expressions.  Check it out!

Thursday, January 24, 2008

Cool C# and VB Language Comparison

I found a cool comparison chart on C# and VB.Net provided by Frank McCown.  It is really helpful if you find yourself going back and forth between C# and VB.Net.  Check it out!