Codecs are used to compress data to send over the wire, but when it gets
to the other end it is decoded back to its original form for display.
Shortened URLs are used to compress long URLs to send over Twitter.
So why aren't they expanded again on the other side? Why do Twitter
clients show short urls instead of expanding them back out to a long
URL, or at least a display that tells you what the real web site is.
This has implications for reducing attacks hidden in short URLs and for
allowing you to see at a glance that "Check out http://bit.ly/a567as" is
actually the same site you've already read once today from another
Tweet.
So for my own Twitter client I decided to expand all shortened URLs as
far as I could go. Here's a code snippet to do that:-
/// \<summary\>
/// Follow any redirects to get back to the original URL
/// \</summary\>
private string UrlLengthen(string url)
{
string newurl = url;
bool redirecting = true;
while (redirecting)
{
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(newurl);
request.AllowAutoRedirect = false;
request.UserAgent = "Mozilla/5.0 (Windows; U;Windows NT 6.1; en - US; rv: 1.9.1.3) Gecko / 20090824 Firefox / 3.5.3(.NET CLR 4.0.20506)";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
if ((int)response.StatusCode == 301 || (int)response.StatusCode == 302)
{
string uriString = response.Headers["Location"];
Log.Debug("Redirecting " + newurl + " to " + uriString + " because " + response.StatusCode);
newurl = uriString;
// and keep going
}
else
{
Log.Debug("Not redirecting " + url + " because " + response.StatusCode);
redirecting = false;
}
}
catch (Exception ex)
{
ex.Data.Add("url", newurl);
Exceptions.ExceptionRecord.ReportCritical(ex);
redirecting = false;
}
}
return newurl;
}
Digital Twin are an online representation of a real world object, a copy of its properties in the digital world and a way to send updated and commands to it. In effect I've been making them for years but now they have a trendy name.
Why automated learning is hard for a smart home. The perils of over-fitting, under-fitting and how the general unpredictable nature of life makes it hard to build a system that learns your behavior.
One way to reduce the volume of sensor data is to remove redundant points. In a system with timestamped data recorded on an irregular interval we can achieve this by removing co-linear points.
Home automation systems need to respond to events in the real world. Sometimes it's an analog value, sometimes it's binary, rarely is it clean and not susceptible to problems. Let's discuss some of the ways to convert these inputs into actions.
Another super useful function for handling sensor data and converting to probabilities is the logistic function 1/(1+e^-x). Using this you can easily map values onto a 0.0-1.0 probability range.
In a home automation system we often want to convert a measurement into a probability. The ATAN curve is one of my favorite curves for this as it's easy to map overything onto a 0.0-1.0 range.
Several years ago we did a major remodel. I did all of the finish electrical myself and supervised all of the rough-in electrical. I also put in all of the electrical system and water in our barn. I have opinions ...