Thursday

Wednesday

msbuild release configuration

to build release from command line:
 msbuild  buildsrc\Test\Test.sln   /p:Configuration=Release 

Wednesday

C# bind dropdown to enum

For example we have enumeration Enum1 and want to bind ddEnum1.
here is how to do it in directly into html page , when GetEnum1 is function in codebehing , that will be getting SelectedValue for every record object (passign by parameter)
     
<asp:TemplateField HeaderText="Type" ItemStyle-Width="5%" ItemStyle-Wrap=False HeaderStyle-HorizontalAlign=Center HeaderStyle-Wrap=False ItemStyle-HorizontalAlign=Center>
<ItemTemplate>
<asp:DropDownList id="typeDropDown" runat="server" Width='150'
DataSource="<%# Enum.GetNames(typeof(myEnum1)) %>"
SelectedValue='<%# GetEnum1(Container.DataItem) %>'
OnInit="InitDropDown" />

</ItemTemplate>
</asp:TemplateField>


here is how to do it in codebehind
       
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
ddEnum1.DataSource = Enum.GetNames(typeof(Enum1));
ddEnum1.DataBind();
}
}

private void ddEnum1_SelectedIndexChanged(object sender, System.EventArgs e)
{
Enum1 selectedEnum1 = (Enum1)Enum.Parse(ddEnum1.SelectedValue);
}



Monday

This application has failed to start because vcl60.bpl was not found.


Easiest way for C++ Builder 6.0:
Project/Options:
Compiler tab: Click 'Release'

Packages tab:
Un-check 'Bulid with runtime packages'

Linker tab:
Uncheck the first 3 items under 'Linking'

more...

Tuesday

linq "in" exisits


var itemQuery = from cartItems in db.SalesOrderDetails
where cartItems.SalesOrderID == 75144
select cartItems.ProductID;


var myProducts = from p in db.Products
where itemQuery.Contains(p.ProductID)
select p;

details

mercurial source control visual studio

HgSccPackage - Mercurial Source Control Plugin for Microsoft Visual Studio 2008/2010

VisualHG - Mercurial Source Control Plugin for Microsoft Visual Studio 2005, 2008 and 2010

more...

Tuesday

C# shuffle list


public void Shuffle<T>(List<T> list)
{
Random rng = new Random();
int n = list.Count;
while (n > 1)
{
n--;
int k = rng.Next(n + 1);
T value = list[k];
list[k] = list[n];
list[n] = value;
}
}

more...

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...