Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

20120526

Wait a sec, did I read that right?

I thought this would have been fine ...

I had to read this several times, have some coffee, stop drinking for a week and then mouth out the individual syllables out loud. Yes, it really does say this.

Honestly, there's no shopping here. Start a project to use MSMQ and then try to directly set the correlationId of a message. Easily repeatable.

No man is an island, no company is perfect, software is hard.

20110306

Soft Issues - everyone's got 'em

Things humans are good at:

So I'm playing with Microsoft's Visual Studio 2010 and the entity framework. One of the nifty new features I noticed when making a new "ADO .NET Entity Data Model" was the option to "Pluralize or singularize generated object names". The created items then just make more sense and it is a welcome addition.

Never mind the fact that my database table "Octopi" did not translate to "Octopus" as we would all expect. That is an edge case for sure and I don't really use Octopi that much. My issue is how it took my table named "Movies" and ended up with the singular model name "Movy". You could argue that the spelling is kinda cute, but you couldn't argue it is correct.


I'm just saying ...

20090528

It could be a rumor ...

My favorite programmer asks: Which genius put this into the common library?

return bool.Parse("true");

instead of

return true;



I don't care where you come from, that's funny!

20090119

Why we need code reviews

The ever diligent programmer P noted this bit of code today:

  • throw(new ArgumentException(errorMessage, "It is a very twisted intersection!"));
I would hate to be the person reading through the error logs a year from now ...

20081218

Simplify Simplify Simplify

Here is the code as found ::
private string FormatTime(object DateTimeValue)
{
string result = " ";
if (DateTimeValue != null)
{
DateTime dt = DateTime.Parse(DateTimeValue.ToString());
if (dt.Hour < 10)
result = FILLER_NUMBER + dt.Hour.ToString() + ":";
else
result = dt.Hour.ToString() + ":";

if (dt.Minute < 10)
result += (FILLER_NUMBER + dt.Minute.ToString() + ":");
else
result += (dt.Minute.ToString() + ":");

if (dt.Second < 10)
result += (FILLER_NUMBER + dt.Second.ToString());
else
result += dt.Second.ToString();
}

return result;
}


Here is the refactored version::

return DateTime.Parse(DateTimeValue.ToString()).ToString("HH:mm:ss");

20081212

The wheels of the object go round and round

Notice that if dsSTData were null you will allocate it, but not use it to look up the ThingyMin :)

public int ThingyMin
{
get
{
int _ThingyMin = 0;
if (dsSTData == null)
{
this.dsSTData = ONAME.ProdName.Common.Business.CONAMESystemDataList.STs;
}
else
{
foreach (System.Data.DataRow row in sSTData.Tables[this.DEFAULT_TABLE].Rows)
{
if (Convert.ToInt32(row[0]) == this._STID)
{
_ThingyMin = int.Parse(row[OllCommon.COL_THINGY_MIN].ToString());
break;
}
}
}
return _ThingyMin;
}
}

20081210

How to ruin a set of data

From my bud. Not strictly SQL but close enough. He would like to know:

I'm not asking a lot. I just would rather see
"if (this.Order.IsPacked)"


instead of
"if (
this._DataSet.Tables[OrderCommon.TBL_ORDER].Rows[OrderCommon.DEFAULT_ROW][OrderCommon.COL_IS_PACKED] == DBConst.DBNull)"

License & copyright

Creative Commons License
StinkySQL weblog and any related pages, including the weblog's archives are licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.