Nest

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.
#Code, Technology, Gadgets, Video, Etc.

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.
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 )
MembershipUser user = Membership.GetUser(“username”);
user.UnlockUser();
user.ChangePassword(user.ResetPassword(), “password”);
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);
}
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);
}
}
}
}
}
lunchLocation = (dayOfTheWeek == “Tuesday”) ? “Fuddruckers” : “Food Court”;
decimal tmpvalue;
decimal? result = decimal.TryParse((string)value, out tmpvalue) ?
tmpvalue : (decimal?)null;
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);
}
}