Nest

akiselka » 25 October 2011 » In Uncategorized » No Comments

 

 

The Nest is the work of Nest Labs and Tony Fadell, who was the former chief architect at Apple, and whilst at Apple he lead the development of the iPod and the iPhone, he left Apple a couple of years ago to start up Nest Labs.

http://www.nest.com/

Continue reading...

Finding Duplicates with SQL

akiselka » 29 September 2011 » In SQL Server » No Comments

Finding duplicates in a table:

SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

Finding rows that occur exactly once:

SELECT email
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )

Continue reading...

Changing that password

akiselka » 22 August 2011 » In ASP NET, C# » No Comments

MembershipUser user = Membership.GetUser(“username”);
user.UnlockUser();
user.ChangePassword(user.ResetPassword(), “password”);

Continue reading...

Where are my ASP.NET Temporary Files Stored?

akiselka » 16 August 2011 » In ASP NET, C# » No Comments

Ever wondered where ASP.NET stored its temporary files? ASP.NET provides the HttpRuntime.CodeGenDir property which gets the physical path to the directory where ASP.NET stores temporary files (generated sources, compiled assemblies, and so on) for the current application.
Here’s how to use this property:

protected void Page_Load(object sender, EventArgs e)
{
Response.Write(HttpRuntime.CodegenDir);
}

Continue reading...

ASPXComboBox Filtering

akiselka » 03 August 2011 » In ASP NET, C#, Dev Express » No Comments

Set IncrementalFilteringMode = StartsWith

Continue reading...

Dealing with Fragmented XML

akiselka » 19 July 2011 » In Uncategorized » No Comments

XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;

string elementName = “elementName”;

using (XmlReader reader = XmlReader.Create(sr, settings))
{
reader.MoveToContent();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name == elementName)
{
XElement el = XNode.ReadFrom(reader) as XElement;
if (el != null)
{
// yield return el;
Response.Write(el);
}
}
}
}
}

Continue reading...

Single Line If Statement in C#

akiselka » 23 June 2011 » In Uncategorized » No Comments

lunchLocation = (dayOfTheWeek == “Tuesday”) ? “Fuddruckers” : “Food Court”;

Continue reading...

Format Price

akiselka » 10 June 2011 » In Uncategorized » No Comments

<%# String.Format("{0:C}", Eval("Price")) %>

Continue reading...

Cast object to decimal? (nullable decimal)

akiselka » 17 May 2011 » In Uncategorized » No Comments

decimal tmpvalue;
decimal? result = decimal.TryParse((string)value, out tmpvalue) ?
tmpvalue : (decimal?)null;

Continue reading...

Remove domain information

akiselka » 16 May 2011 » In Active Directory, ASP NET, C#, Visual Studio 2010 » No Comments

using System;
using System.Text.RegularExpressions;
public class MyClass
{
    public static void Main()
    {
        string domainUser = Regex.Replace("domain\\user",".*\\\\(.*)", "$1",RegexOptions.None);
        Console.WriteLine(domainUser);  

    }

}

Continue reading...