Looking for a story about language rapidly evolving

Question: I remember reading a story (I thought from Asimov) about a language evolving so rapidly that a foreigner who was trying to write a grammar could not keep the pace.
Anybody knows it?
Comment: Thank you so much! I have been having this question on the back of my mind for years, then occasionally stepped into this site and decided it is worth a try. Amazing!
Comment: Hi, welcome to the site. In roughly which year did you read this story, and when do you think it might've been published? Also, did you read it in an anthology, a magazine, or online?
Comment: Honorable mention for "The Persistence of Vision" by John Varley.
Comment: You're welcome!
Answer: "Shall We Have a Little Talk?", a novelette by Robert Sheckley, first published in Galaxy Magazine, October 1965, available at the Internet Archive. You may have read it in one of these compilations.

He could learn this language, of course.
But by the time he had learned it, what would it have changed into?
Jackson sighed and rubbed his face wearily. In a sense it was inevitable. All languages change. But on Earth and the few dozen worlds she had contacted, the languages changed with relative slowness.
On Na, the rate of change was faster. Quite a bit faster.
The Na language changed like fashions change on Earth, only faster. It changed like prices change or like the weather changes. It changed endlessly and incessantly, in accordance with unknown rules and invisible principles. It changed its form like an avalanche changes its shape. Compared with it, English was like a glacier.
The Na language was, truly and monstrously, a simulacrum of Heraclitus's river.
You cannot step into the same river twice, said Heraclitus: for
other waters are forever flowing on.
Concerning the language of Na, this was simply and literally true.

The story was reviewed on the linguistics blog Tenser, said the Tensor.
Comment: Mun? Mun mun mun mun! (translation: yes, that was a great story).  Dunno if there are statistics on authors, but I'd bet Sheckley is at least 10% of them. Also, I might point out that the *reason* an outsider was trying to compile a grammar, his nation was trying to *conquer* them and force them to sign a peace-treaty, in their native-language. Which was problematic.


Can jams and compotes be frozen?

Question: Suppose that my jams and compotes are in an uninsulated, cold place, i.e. -20°C in the winter.
Is it possible that they will be frozen, and the glass breaks, or not?
Answer: As you would normally fill a jar of jam only to the shoulder there should be room for expansion on freezing and most jars shouldn't crack. Jams are also <50% water, and if they contain significant pieces of fruit won't even be at the same concentration so won't freeze solid at a well-defined temperature, allowing them time to expand into the headspace.
The other main risk is thermal shock (as when you poor boiling water into a cold jar).  This is unlikely except if you bring in a jar to use and put it on a hot surface or try to defrost it quickly.  To be on the safe side (and, depending on your jam, to keep the colour nice) you should probably avoid direct sunlight on the jar.
A further factor to consider is loosening  of the lids from freeze-thaw cycling changing the pressure inside -- expansion of the jam (water) will cause an increase in pressure at low tempertatures but the air will contract and cause a decrease.  The net effect will depend on the relative volumes, the temperatures, and the rates of cooling/heating. If when the jars come back up to room tempearture, the lids are loose, the jam has probably not kept.  So I suggest using proper jam jars with safety button pop-top lids so that you can tell.
Answer: If the jar is filled to the brim, then there is a good chance that on freezing the jar will break. If not it shouldn't break as long as there is no sudden temperature change. That being said, there are also jars available that are freeze-safe and you can use those for freezing jams for a longer time
Comment: Why do you emphasize that freeze safe jars can be used to freeze the jam for a longer time - wouldn't that also be true for those that aren't specifically labelled as such, but froze just fine? The critical part is the temperature window where the jam freezes, not the storage at significantly lower, but constant temperature.

Can jams and compotes be frozen?


How to generalize a point feature class

Question: I have a point featureclass with a point for every 25cm - in Total 400,000 Points.
I would like to reduce this resolution to one point every Meter. How could I instruct ArcGIS Advanced(ArcInfo) to do this? I can´t see a thinning tool or generalization tool for Point feature classes and don´t want to create a raster from the data yet to resample.
Comment: What data is assigned to each point, and are you trying to retain it or sum/count/average it?
Comment: are these points forming a regular grid ? in which form the points are placed ?
Comment: Yes...a regular grid 25cm between each point. Each point contains contamination levels.
Answer: 1) create a new grid with 1 m spacing (fishnet)
2) use "spatial join" to aggregate the attributes of the points falling inside the polygons
3) create the centroids of the polygons
3b) Alternatively, you can make a spatial join between the centroids and your original points so that you can define more advanced merging rules (aka based on the distance)
Comment: Understood....so there is no Thinning tool available.
Answer: Use the Delete Identical (Data Management) tool in ArcGIS.  You can see from the screenshots, I generated a uniform grid of points within the polygon extent and used the Delete Identical tool with a 10m XY tolerance to thin the points.
Alternatively, use the Integrate (Data Management) tool to make points coincident at a certain XY tolerance.
Answer: You can use the thinning tool that is available for LAS datasets, lasthin, from LASTools (free download).
Although I haven't used it a lot on shapefiles myself (I have tried it on LAS files though), the help text states:

Uses lasthin.exe to thin LiDAR points by placing a uniform grid over
  the points and keeping within each grid cell only the point with the
  lowest (or the highest or a random) Z coordinate.
The LiDAR input can be LAS, LAZ, BIN, SHP, ASC, or TXT. The LiDAR
  output can be in LAS, LAZ, BIN, or TXT format.

Additinally, if you have access to FME, there's a PointCloudThinner transformer there which should do what you need.
Answer: "Thinning" implies dimensionality, which points do not possess. Given a regular grid of point values, I'd convert the points to a raster, then resample to the desired interval, and convert back to points. This would be a lot less computationally intensive than trying to solve this with vector datatypes.

How to generalize a point feature class


What are attributes in .NET?

Question: What are attributes in .NET, what are they good for, and how do I create my own attributes?
Answer: Metadata. Data about your objects/methods/properties.
For example I might declare an Attribute called: DisplayOrder so I can easily control in what order properties should appear in the UI. I could then append it to a class and write some GUI components that extract the attributes and order the UI elements appropriately.
public class DisplayWrapper
{
    private UnderlyingClass underlyingObject;

    public DisplayWrapper(UnderlyingClass u)
    {
        underlyingObject = u;
    }

    [DisplayOrder(1)]
    public int SomeInt
    {
        get
        {
            return underlyingObject .SomeInt;
        }
    }

    [DisplayOrder(2)]
    public DateTime SomeDate
    {
        get
        {
            return underlyingObject .SomeDate;
        }
    }
}

Thereby ensuring that SomeInt is always displayed before SomeDate when working with my custom GUI components.
However, you'll see them most commonly used outside of the direct coding environment. For example the Windows Designer uses them extensively so it knows how to deal with custom made objects. Using the BrowsableAttribute like so:
[Browsable(false)]
public SomeCustomType DontShowThisInTheDesigner
{
    get{/*do something*/}
}

Tells the designer not to list this in the available properties in the Properties window at design time for example.
You could also use them for code-generation, pre-compile operations (such as Post-Sharp)  or run-time operations such as Reflection.Emit.
For example, you could write a bit of code for profiling that transparently wrapped every single call your code makes and times it. You could "opt-out" of the timing via an attribute that you place on particular methods.
public void SomeProfilingMethod(MethodInfo targetMethod, object target, params object[] args)
{
    bool time = true;
    foreach (Attribute a in target.GetCustomAttributes())
    {
        if (a.GetType() is NoTimingAttribute)
        {
            time = false;
            break;
        }
    }
    if (time)
    {
        StopWatch stopWatch = new StopWatch();
        stopWatch.Start();
        targetMethod.Invoke(target, args);
        stopWatch.Stop();
        HandleTimingOutput(targetMethod, stopWatch.Duration);
    }
    else
    {
        targetMethod.Invoke(target, args);
    }
}

Declaring them is easy, just make a class that inherits from Attribute.
public class DisplayOrderAttribute : Attribute
{
    private int order;

    public DisplayOrderAttribute(int order)
    {
        this.order = order;
    }

    public int Order
    {
        get { return order; }
    }
}

And remember that when you use the attribute you can omit the suffix "attribute" the compiler will add that for you.
NOTE: Attributes don't do anything by themselves - there needs to be some other code that uses them. Sometimes that code has been written for you but sometimes you have to write it yourself. For example, the C# compiler cares about some and certain frameworks frameworks use some (e.g. NUnit looks for [TestFixture] on a class and [Test] on a test method when loading an assembly).
So when creating your own custom attribute be aware that it will not impact the behaviour of your code at all. You'll need to write the other part that checks attributes (via reflection) and act on them.
Comment: For what it's worth, this is a list of all (built in) .NET attributes: http://msdn.microsoft.com/en-us/library/aa311259(VS.71).aspx
Comment: How would you use your "SomeProfilingMethod" as an attribute?
Comment: @RayLoveless its not an attribute, SomeProfilingMethod is the instrumentation code that is looking for profiling attributes. Specifically in the example I gave its looking for an "opt-out" attribute (NoTimingAttribute) as opposed to an "opt-in" one. The idea is that it times everything.
Comment: @Quibblesome could you add something like "Attributes don't do anything by themselves - there needs to be some *other* code to use them (compiler cares about couple, different frameworks use some). Just creating attribute will not impact behavior of the code - you need to write the other part that checks attributes (via reflection) and act on them". (or I can do that if you are ok). Many people expect attributes to magically work and none of the answers here clarify that. (or just link to https://stackoverflow.com/questions/4879521/how-to-create-a-custom-attribute-in-c-sharp which covers it)
Comment: only if you stop using Bing. Nah. j/k I use DuckDuckGo as my primary which mainly uses Bing iirc. :)
Comment: btw you got any links to the sort of unfortunate expectations that devs have about features? Its a very interesting subject particularly considering how well the base framework was written to promote self-discovery.
Answer: Many people have answered but no one has mentioned this so far...
Attributes are used heavily with reflection.  Reflection is already pretty slow.
It is very worthwhile marking your custom attributes as being sealed classes to improve their runtime performance.
It is also a good idea to consider where it would be appropriate to use place such an attribute, and to attribute your attribute (!) to indicate this via AttributeUsage.  The list of available attribute usages might surprise you:

Assembly
Module
Class
Struct
Enum
Constructor
Method
Property
Field
Event
Interface
Parameter
Delegate
ReturnValue
GenericParameter
All

It's also cool that the AttributeUsage attribute is part of the AttributeUsage attribute's signature.  Whoa for circular dependencies!
[AttributeUsageAttribute(AttributeTargets.Class, Inherited = true)]
public sealed class AttributeUsageAttribute : Attribute

Answer: Attributes are a kind of meta data for tagging classes. This is often used in WinForms for example to hide controls from the toolbar, but can be implemented in your own application to enable instances of different classes to behave in specific ways.
Start by creating an attribute:
[AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
public class SortOrderAttribute : Attribute
{
    public int SortOrder { get; set; }

    public SortOrderAttribute(int sortOrder)
    {
        this.SortOrder = sortOrder;
    }
}

All attribute classes must have the suffix "Attribute" to be valid.
After this is done, create a class that uses the attribute.
[SortOrder(23)]
public class MyClass
{
    public MyClass()
    {
    }
}

Now you can check a specific class' SortOrderAttribute (if it has one) by doing the following:
public class MyInvestigatorClass
{
    public void InvestigateTheAttribute()
    {
        // Get the type object for the class that is using
        // the attribute.
        Type type = typeof(MyClass);

        // Get all custom attributes for the type.
        object[] attributes = type.GetCustomAttributes(
            typeof(SortOrderAttribute), true);

        // Now let's make sure that we got at least one attribute.
        if (attributes != null && attributes.Length > 0)
        {
            // Get the first attribute in the list of custom attributes
            // that is of the type "SortOrderAttribute". This should only
            // be one since we said "AllowMultiple=false".
            SortOrderAttribute attribute =
                attributes[0] as SortOrderAttribute;

            // Now we can get the sort order for the class "MyClass".
            int sortOrder = attribute.SortOrder;
        }
    }
}

If you want to read more about this you can always check out MSDN which has a pretty good description.
I hope this helped you out!
Answer: An attribute is a class that contains some bit of functionality that you can apply to objects in your code. To create one, create a class that inherits from System.Attribute.
As for what they're good for... there are almost limitless uses for them.
http://www.codeproject.com/KB/cs/dotnetattributes.aspx
Comment: "functionality" is the wrong word here; they are metadata, not functionality
Answer: Attributes are like metadata applied to classes, methods or assemblies.
They are good for any number of things (debugger visualization, marking things as obsolete, marking things as serializable, the list is endless).
Creating your own custom ones is easy as pie. Start here:
http://msdn.microsoft.com/en-us/library/sw480ze8(VS.71).aspx
Answer: In the project I'm currently working on, there is a set of UI objects of various flavours and an editor to assembly these objects to create pages for use in the main application, a bit like the form designer in DevStudio. These objects exist in their own assembly and each object is a class derived from UserControl and has a custom attribute. This attribute is defined like this:
[AttributeUsage (AttributeTargets::Class)]
public ref class ControlDescriptionAttribute : Attribute
{
public:
  ControlDescriptionAttribute (String ^name, String ^description) :
    _name (name),
    _description (description)
  {
  }

  property String ^Name
  {
    String ^get () { return _name; }
  }

  property String ^Description
  {
    String ^get () { return _description; }
  }

private:
  String
    ^ _name,
    ^ _description;
};

and I apply it to a class like this:
[ControlDescription ("Pie Chart", "Displays a pie chart")]
public ref class PieControl sealed : UserControl
{
  // stuff
};

which is what the previous posters have said.
To use the attribute, the editor has a Generic::List <Type> containing the control types. There is a list box which the user can drag from and drop onto the page to create an instance of the control. To populate the list box, I get the ControlDescriptionAttribute for the control and fill out an entry in the list:
// done for each control type
array <Object ^>
  // get all the custom attributes
  ^attributes = controltype->GetCustomAttributes (true);

Type
  // this is the one we're interested in
  ^attributetype = ECMMainPageDisplay::ControlDescriptionAttribute::typeid;

// iterate over the custom attributes
for each (Object ^attribute in attributes)
{
  if (attributetype->IsInstanceOfType (attribute))
  {
    ECMMainPageDisplay::ControlDescriptionAttribute
      ^description = safe_cast <ECMMainPageDisplay::ControlDescriptionAttribute ^> (attribute);

    // get the name and description and create an entry in the list
    ListViewItem
      ^item = gcnew ListViewItem (description->Name);

    item->Tag = controltype->Name;
    item->SubItems->Add (description->Description);

    mcontrols->Items->Add (item);
    break;
  }
}

Note: the above is C++/CLI but it's not difficult to convert to C#
(yeah, I know, C++/CLI is an abomination but it's what I have to work with :-( )
You can put attributes on most things and there are whole range of predefined attributes. The editor mentioned above also looks for custom attributes on properties that describe the property and how to edit it.
Once you get the whole idea, you'll wonder how you ever lived without them.
Answer: As said, Attributes are relatively easy to create. The other part of the work is creating code that uses it. In most cases you will use reflection at runtime to alter behavior based on the presence of an attribute or its properties. There are also scenarios where you will inspect attributes on compiled code to do some sort of static analysis. For example, parameters might be marked as non-null and the analysis tool can use this as a hint.
Using the attributes and knowing the appropriate scenarios for their use is the bulk of the work.
Answer: Attributes are, essentially, bits of data you want to attach to your types (classes, methods, events, enums, etc.)
The idea is that at run time some other type/framework/tool will query your type for the information in the attribute and act upon it.
So, for example, Visual Studio can query the attributes on a 3rd party control to figure out which properties of the control should appear in the Properties pane at design time.
Attributes can also be used in Aspect Oriented Programming to inject/manipulate objects at run time based on the attributes that decorate them and add validation, logging, etc. to the objects without affecting the business logic of the object.
Answer: You can use custom attributes as a simple way to define tag values in sub classes without having to write the same code over and over again for each subclass.  I came across a nice concise example by John Waters of how to define and use custom attributes in your own code.
There is a tutorial at http://msdn.microsoft.com/en-us/library/aa288454(VS.71).aspx
Answer: To get started creating an attribute, open a C# source file, type attribute and hit [TAB].  It will expand to a template for a new attribute.
Comment: How does it answer the question? it should be a comment, not an answer.
Answer: Attributes are also commonly used for Aspect Oriented Programming. For an example of this check out the PostSharp project.

What are attributes in .NET?


How to make requests with HessianKit

Question: I am working on an ios app that needs to connect to a hessian service to get live stock prices.  I am using HessianKit for ios.
I was told to connect to:
http://www.ourserviceurl.com:8080/tt/sub?hessian=true&tickers=BA|C
tickers is a pipe delimited list.
i had to hide the name of the url as well.
My protocol is:
<code>@protocol CWHelloService
    -(NSString*)sub:(BOOL)hessian tickers:(NSString *)tickers;
@end
</code>
I tried to connect this way:
<code>NSURL * url = [NSURL URLWithString:@"http://www.ourserviceurl.com:8080/tt/"];
id<CWHelloService> proxy = (id<CWHelloService>)[CWHessianConnection proxyWithURL:url protocol:@protocol(CWHelloService)];
NSLog(@"hello: %@", [proxy sub:YES tickers:@"BA|C"]);
</code>
I keep getting a 404 error when trying to make the connection.
I have never used the hessian protocol before and I am sure I am missing something simple, but still can't figure out where I am going wrong
Answer: i was just informed that we are using the hessian streaming protocol and that this isn't supported by the various hessian apis that are out there right now.  As of right now it seems like the problem is unresolvable.

How to make requests with HessianKit


Low brightness setting doesn't "stick" in iBooks

Question: I like to read in iBooks with the brightness turned down, but I have to re-adjust this every time I open the app.  Is there a way to make my brightness setting "stick"?
Answer: On the off chance you weren't already aware, you can modify the system-wide brightness by double-tapping the home button and swiping the "shelf" to the left.
iBooks can set a lower brightness than the system will allow outside the application -- so if you frequently set it lower than the system's lowest setting, you'll have to make that change every time you open the app.  As you can see in the screenshot below, when the iPad is at it's lowest system brightness, the iBooks brightness bar is at about 20%.
Comment: The brightness control in the iOS multitasking bar maps to the brightness control in the settings app. Both of those settings persist correctly. The one colored off-white accessible from the top right page doesn't map to the other brightness controls and gets reset each time the app closes.
Answer: It is well documented that iBooks uses a non-documented, private API to modify brightness and you can clearly see some of the side effects of this since that setting does not stick and is confusing since it doesn't stick across sessions because it is not using the main settings but instead temporarily overriding them.
Only Apple can say whether this behavior is by design or a bug, but as a user you might want to officially send them some general feedback as they clearly felt it was a good enough to ship. You can also leave a review for iBooks in the App Store but that's generally less effective than a bug report or direct feedback about a problem. If enough people request a change, it stands a better chance of change in an upcoming releas.
Answer: I have been asking myself the same question for quite some time. Sadly I couldn't "fix" it.
The iPhone/Pad goes back to the brightness you have in the Settings every time, and in fact, the iBooks app, changes the brightness of the whole phone/pad, but as soon as it's "suspended" and "woken" it reverts back to the settings you had in the settings.
Answer: There is a way to actually make your entire screen go darker

Go to settings > General > accessibility > zoom > toggle on
Double tap with 3 fingers on the screen
Hit the drop down bar at the bottom of the window
Choose filter
Low light
Hit full screen zoom
Double  tap again

To make it as fast as sonic do these steps: Settings > General > Accessibility > Accessibility shortcuts > Zoom
Triple tap home button for low light


how is logical error rate calculated?

Question: I have a CSS code defined through binary matrices $H_X$ and $H_Z$. I also have the logicals $L_X$ and $L_Z$ as binary matrices. I decode $H_X$ and $H_Z$ independently as classical codes. The decoder outputs the corrected codewords (from which I can calculate the residual errors). How do I calculate whether the residual error results in a logical error or not? It should be a (simple?) operation involving $L_X$ and $L_Z$ but I'm not clear on the details.
Comment: Ok. A logical error is just when the residual error applies a logical operation. So you could just check whether it is a non-trivial linear combination of the $L_X$ ($L_Z$). Or alternatively whether it anti-commutes with any of the $L_Z$ ($L_X$), for a CSS code this is equivalent to whether $l_Z \cdot r = 1$ for any row $l_Z$ of $L_Z$.
Comment: Do you mean $L_X$ and $L_Z$ as binary vectors?
Comment: @ChrisD they would be vectors if the code has k=1; otherwise each is  a $k \times n$ matrix for an $[[n,k,d]]$ code.
Comment: @ChrisD I tried this before posting the question but the simulation results didn't seem right...now it's possible there's a simulation bug somewhere. At any rate if you have a reference for the the above then please post it as an answer; if things checkout I'll be happy to accept.
Answer: We have a stabilizer code $C(S)$, formed from stabilizer group $S$, with a set of stabilizer generators $\{S_i\}_i$, and a set of logical operators representatives $\{\bar{X}_i\}_i \cup \{\bar{Z}_i\}_i$.
We know that the logical operators all commute with the stabilizers. We can check this by confirming that
$$
[\bar{X}_i, S_j] = 0, \quad\text{for all } i,j, \\
[\bar{Z}_i, S_j] = 0, \quad\text{for all } i,j.
$$
At the same time not all logical operators commute with each other (see this Q&A). We have the conditions that
$$
[\bar{X}_i, \bar{Z}_i] \ne 0, \quad\text{for all } i,\\
[\bar{X}_i, \bar{X}_j] = 0, \quad\text{for all } i,j,\\
[\bar{Z}_i, \bar{Z}_j] = 0, \quad\text{for all } i,j.
$$
Now, our encoded code state $\psi\rangle$ encountered an error $E$, and the decoder provided recovery operation $R$, which leads to what you call the residual error $RE$. Assume that $RE$ brings the state back inside the code, i.e. $RE|\bar\psi\rangle \in C$. Then there are two possibilities,

Either $RE \in S$ (successful recovery), or
$RE = \bar{A}_i$ for some $A \in \{X,Z\}$ and $i$ (logical error).

To check which case occurred, we can use the second set of commutation relation above. We evaluate
$$
[RE, \bar{A}_i] \text{ for all } A \in \{X, Y\}, i.
$$
If $[RE, \bar{X}_j] \ne 0$, then that means that $RE = \bar{Z}_j$. Similarly, if $[RE, \bar{Z}_j] \ne 0$, then $RE = \bar{X}_i$.
Checks in the binary vector representation
Suppose the code in question is a $[[n,k,d]]$ code with $m=n-k$ stabilizer generators. Let there be $m_X$ pure-$X$ generators and $m_Z$ pure-$Z$ generators, such that $m_X + m_Z = m$.
We will represent elements of the Pauli group $\mathcal{P}_n$ by binary vectors of length $2n$, with the first $n$ bits acting as the $X$-part and the rest for the $Z$-part. Let us use small letters to label them.
In this picture, the $k$ logical $X$ operators $\{\bar{X}_i\}$ are represented by a $k \times 2n$ matrix $L^X$. The $i$th operator will the $i$th row of the matrix $L^X_i$. Similarly, for the logical $Z$ operators. You have not mentioned in your question if the logical operators of your code are pure $X$ or $Z$. So, I will not assume this to be so.
The error is vector $e$ and recovery operation (provided by the decoder) is vector $r$. The residual error is $f = r+e$, where the addition is modulo 2.
The check $[RE, \bar{X}_j]$, in the binary vector picture translates to the symplectic inner product $f \cdot L^X_j$.
Similarly, the check $[RE, \bar{Z}_j]$ translates to $f\cdot L^Z_j$.
That is all. For checking if the recovery made a logical error, you only need to evaluate these $2k$ symplectic inner products. If your logical operators are pure $X$ and pure $Z$ types, then the symplectic inner products will naturally simplify to normal inner products.
What if the decoder is faulty
The decoder could return a recovery operation $R$ such that $RE|\bar\psi\rangle \not\in C$. To check this, you should verify that
$$
[RE,S_i] = 0 \quad \text{ for all } i.
$$
In the binary vector picture you will first have to expand $H^X$ to a $m_X \times 2n$ matrix. Similarly $H^Z$. Then $[RE,S_i]$ translates to computing the symplectic inner product $f\cdot s_i$.
Comment: All this looks reasonable but can you translate the process in terms of $H_X,H_Z,L_X,L_Z$. To simplify things you can consider $H_X$ and $L_Z$ only since I'm decoding the two classical codes independently. Are you saying that just calculate the "syndrome" of the residual error $r$ and $L_Z$? that is a logical error is when $r \cdot L_Z \neq 0$? Is $r \cdot H_X$ relevant? either way a reference would make things complete especially if it works with matrices, dot products, ...
Comment: I have added more details. Hopefully this clarifies more. I have not particularly discussed how things simplify if you are decoding the two classical codes separately. Need too much notation for it. But roughly, if your logical operators are pure $X$ or $Z$, you can determine the residual $X$ error from the physical $X$ errors and the $X$ part of the recovery. If that is $f_X$, then indeed $f_X \cdot L^Z_i \ne 0$ will tell you if a logical error has occurred.
Comment: I appreciate the added details, but the case of the "decoder is faulty" isn't clear.  If $f \cdot s_i \neq 0$ then this is not considered a logical error?. To keep things simple you can just work with $H_X, L_Z$ and assume the error is a $Z$ error; no need to go to Pauli operators or symplectic products
Comment: I call a decoder-faulty error one in which the recovery operation fails to return the state back to the Code. I call a logical error one in which the state is returned back to the Code, but perturbed by some logical operation on the qubits. Though I think that papers call the union of the two the logical error rate.
Comment: this ambiguity is what motivated the question. I see "logical error rate" plots everywhere in papers but I can't find a definitive reference where it's exactly defined
Comment: i've accepted your answer because you put a fair amount of effort into it and brought out possible ambiguities in papers...thanks for your response

how is logical error rate calculated?


Workflow to update library

Question: I have two SharePoint libraries, library 1 is open to all users, library 2  has unique permissions.
Library 1 and library 2 should be identical, - so when a document is updated in library 1, i need it to automatically updates the same document in library 2.
Has anyone created a workflow, for  a similar scenario?
Answer: The approach has a fundamental problem. The workflow run on the current user context so If the logged in user don't have permission to the Library2 then it will fail.
Other than that the approach should work using below logic

Workflow should start of new/update event
Check if file exists on destination
If exists do an update list item action and update the fields
Else copy to destination and update list item
Comment: Thanks for your reply. I will try your suggestion

I was wondering if there was another approach.
What if all documents are stored within a specific folder in library 1, and the complete folder was copied to library 2 periodically.
A requirement of this would be th the docs in library 2 would need to be overwritten to avoid duplication.
Should have mentioned before, my experience of workflows is mainly using SP Designer, however I could use Nintex if required.
Comment: Creating a job is the best approach. There you will have access to the SharePoint Object Model which is much easier to implement.

Workflow to update library


Committing a sin by eating animal's flesh

Question: According to the Holy Bible, are we committing a sin by eating animal's  flesh?
If No, Why?
Answer: Paul deals with exactly this matter in his first epistle to the young minister, Timothy :

Now the Spirit speaketh expressly, that in the latter times some shall depart from the faith, giving heed to seducing spirits, and doctrines of devils; Speaking lies in hypocrisy; having their conscience seared with a hot iron; Forbidding to marry, and commanding to abstain from meats, which God hath created to be received with thanksgiving of them which believe and know the truth. For every creature of God is good, and nothing to be refused, if it be received with thanksgiving:

[I Timothy 4:4 KJV]

I think there is no need for me to add any further words.
I have simply highlighted what is most relevant to the question.
Comment: It would be good if you could add from Matthew 15:11-20 or Mark 7:15.
Answer: According to the Holy Bible, are we committing a sin by eating animal's flesh?
The simple answer is no, because God made it quite clear himself.
Apparently, Adam and Eve did not eat of the flesh of animals.

29 Then God said, "I give you every seed-bearing plant on the face of the whole earth and every tree that has fruit with seed in it. They will be yours for food. 30 And to all the beasts of the earth and all the birds in the sky and all the creatures that move along the ground—everything that has the breath of life in it—I give every green plant for food." And it was so. - Genesis 1:29-30

However things changed after the flood with Noah. After the biblical flood, God gave man permission to eat the flesh of animals.

9 And God blessed Noah and his sons, and said unto them, Be fruitful, and multiply, and replenish the earth.
2 And the fear of you and the dread of you shall be upon every beast of the earth, and upon every fowl of the air, upon all that moveth upon the earth, and upon all the fishes of the sea; into your hand are they delivered.
3 Every moving thing that liveth shall be meat for you; even as the green herb have I given you all things.
4 But flesh with the life thereof, which is the blood thereof, shall ye not eat.
5 And surely your blood of your lives will I require; at the hand of every beast will I require it, and at the hand of man; at the hand of every man's brother will I require the life of man. - Genesis 9:1-5

Let us not forget the great vision of a sheet with animals of St. Peter the Apostle, as mentioned in the Book of Acts.

4 But Peter explained it to them in order from the beginning, saying: 5 "I was in the city of Joppa praying; and in a trance I saw a vision, an object descending like a great sheet, let down from heaven by four corners; and it came to me. 6 When I observed it intently and considered, I saw four-footed animals of the earth, wild beasts, creeping things, and birds of the air. 7 And I heard a voice saying to me, 'Rise, Peter; kill and eat.' 8 But I said, 'Not so, Lord! For nothing common or unclean has at any time entered my mouth.' 9 But the voice answered me again from heaven, 'What God has cleansed you must not call common.' - Acts 11:4-9

As for the interpretation of this last text here is what Wikipedia has to say:

Simon J. Kistemaker suggests that the lesson God taught Peter in this vision is that "God has removed the barriers he once erected to separate his people from the surrounding nations.": 378 Kistemaker argues that it means Peter has to accept Gentile believers as full members of the Christian Church, but also that God has made all animals clean, so that "Peter with his fellow Jewish Christians can disregard the food laws that have been observed since the days of Moses.": 380 Albert Mohler, President of Southern Seminary, writes:

As the Book of Acts makes clear, Christians are not obligated to follow this holiness code. This is made clear in Peter's vision in Acts 10:15. Peter is told, 'What God has made clean, do not call common.' In other words, there is no kosher code for Christians. Christians are not concerned with eating kosher foods and avoiding all others. That part of the law is no longer binding, and Christians can enjoy shrimp and pork with no injury to conscience.

Luke Timothy Johnson and Daniel J. Harrington write that this episode heralds a radical change in Peter's "identity as a member of God's people,": 187– but also that "the implication is that all things God created are declared clean by him, and are not affected by human discriminations.": 184.
On the other hand, the United Church of God (a group following the teachings of Herbert W. Armstrong) calls this an "often-misunderstood section of the Bible", arguing that Peter's statement in verse 28 indicates that the divine disclosure reflected only a teaching about people, and not one about food. The UCG argues that Peter realised "the puzzling vision could not be annulling God's instructions." The Seventh-day Adventist Church has a similar view of this passage. - Peter's vision of a sheet with animals


Catching SQL Injection and other Malicious Web Requests

Question: I am looking for a tool that can detect malicious requests (such as obvious SQL injection gets or posts) and will immediately ban the IP address of the requester/add to a blacklist. I am aware that in an ideal world our code should be able to handle such requests and treat them accordingly, but there is a lot of value in such a tool even when the site is safe from these kinds of attacks, as it can lead to saving bandwidth, preventing bloat of analytics, etc.
Ideally, I'm looking for a cross-platform (LAMP/.NET) solution that sits at a higher level than the technology stack; perhaps at the web-server or hardware level. I'm not sure if this exists, though.
Either way, I'd like to hear the community's feedback so that I can see what my options might be with regard to implementation and approach.
Answer: Your almost looking at it the wrong way, no 3party tool that is not aware of your application methods/naming/data/domain is going to going to be able to perfectly protect you.
Something like SQL injection prevention is something that has to be in the code, and best written by the people that wrote the SQL, because they are the ones that will know what should/shouldnt be in those fields (unless your project has very good docs)
Your right, this all has been done before. You dont quite have to reinvent the wheel, but you do have to carve a new one because of a differences in everyone's axle diameters.
This is not a drop-in and run problem, you really do have to be familiar with what exactly SQL injection is before you can prevent it. It is a sneaky problem, so it takes equally sneaky protections.
These 2 links taught me far more then the basics on the subject to get started, and helped me better phrase my future lookups on specific questions that weren't answered.

SQL injection
SQL Injection Attacks by Example

And while this one isnt quite a 100% finder, it will "show you the light" on existing  problem in your existing code, but like with webstandards, dont stop coding once you pass this test.

Exploit-Me
Answer: The problem with a generic tool is that it is very difficult to come up with a set of rules that will only match against a genuine attack.
SQL keywords are all English words, and don't forget that the string
 DROP TABLE users;

is perfectly valid in a form field that, for example, contains an answer to a programming question.
The only sensible option is to sanitise the input before ever passing it to your database but pass it on nonetheless.  Otherwise lots of perfectly normal, non-malicious users are going to get banned from your site.
Answer: One method that might work for some cases would be to take the sql string that would run if you naively used the form data and pass it to some code that counts the number of statements that would actually be executed.  If it is greater than the number expected, then there is a decent chance that an injection was attempted, especially for fields that are unlikely to include control characters such as username.
Something like a normal text box would be a bit harder since this method would be a lot more likely to return false positives, but this would be a start, at least.
Answer: One little thing to keep in mind: In some countries (i.e. most of Europe), people do not have static IP Addresses, so blacklisting should not be forever.
Answer: Oracle has got an online tutorial about SQL Injection.  Even though you want a ready-made solution, this might give you some hints on how to use it better to defend yourself.
Answer: Now that I think about it, a Bayesian filter similar to the ones used to block spam might work decently too.  If you got together a set of normal text for each field and a set of sql injections, you might be able to train it to flag injection attacks.
Answer: One of my sites was recently hacked through SQL Injection.  It added a link to a virus for every text field in the db!  The fix was to add some code looking for SQL keywords.  Fortunately, I've developed in ColdFiusion, so the code sits in my Application.cfm file which is run at the beginning of every webpage & it looks at all the URL variables.  Wikipedia has some good links to help too.
Answer: Interesting how this is being implemented years later by google and them removing the URL all together in order to prevent XSS attacks and other malicious acitivites


Proof of particular solution to a DE in the form of $y''+a_1y'+a_2y = A\cos (bx) + B\sin (bx)$

Question: In the book "Differential Equations and Linear Algebra" by Stephen W. Goode (2nd edition), he presents a theorem 2.4.1 (pg 128) where in part 1 he states that the DE
$$y''+a_1y'+a_2y = A\cos (bx) + B\sin (bx)$$
where $a_1$, $a_2$, $A$, $B$, and $b$ are constants, has a particular solution of the form
$$y_p(x)=A_0\cos(bx)+B_0\sin(bx)$$
if $r=ib$ is not a root of the auxiliary equation. Goode leaves the proof of this theorem as an exercise to the reader so I started with the simple substitution of the $y_p$ into the DE as such
$$-b^2(A_0\cos(bx)+B_0\sin(bx))+a_1b(-A_0\sin(bx)+B_0\cos(bx))+a_2(A_0\cos(bx)+B_0\sin(bx))=A\cos(bx)+B\sin(bx)$$
but I cannot figure out how to manipulate this equation to prove that $y_p$ is a solution if $P(-ib)\not=0$
Answer: Let $r_1,r_2$ be the solutions of $r^2+a_1r+a_2=0\iff r^2-(r_1+r_2)r+r_1r_2=0$
You can rewrite your equation as a system of two first order equations:
$y''-(r_1+r_2)y'+r_1r_2y=\overbrace{(y''-r_1y')}^{u'}-r_2\overbrace{(y'-r_1y)}^u=f(x)$
$\begin{cases}y'-r_1y=u\\u'-r_2u=f(x)\end{cases}$
So the homegeneous solution of $u$ is $u_h=Ce^{r_2x}$ that you can also rewrite in sincos form when $r_2$ is a complex root.
From there it all depends whether $b$ is equal to $r_2$ or not. When applying the variation of the constant (i.e. $C$) method to find a particular solution. It'll be $A_0\cos(bx)+B_0\sin(bx)$ in the case $b\neq r_2$, else you will have linear coefficients, not constant ones.
The same applies then when you solve the second equation $y'-r_1y=u=u_h+u_p$, this time we need $b\neq r_1$ and $r_1\neq r_2$ to keep the particular solution in the same form.

Edit:
Let try to find a particular solution to RHS $f(x)=A\cos(bx)+B\sin(bx)$.

method 1: variation of the constant

$\require{cancel}u=Ce^{rx}\implies u'-ru=\cancel{Cre^{rx}}+C'e^{rx}-\cancel{Cre^{rx}}=f(x)=\frac{A-iB}2e^{ibx}+\frac{A+iB}2e^{-ibx}$
So you get $$C'=\frac{A-iB}2e^{(ib-r)x}+\frac{A+iB}2e^{-(ib+r)x}$$
You can see your discussion about $r\neq\pm ib$ appearing because we converted back $\sin$ and $\cos$ to their respective exponential expression.
From there in the case $r\neq\pm ib$ we can integrate $e^{(ib-r)x}$ to $\frac{e^{(ib-r)x}}{ib-r}$ and same for the other term. When you remultiply by $e^{rx}$ to get back $u_p=Ce^{rx}$ you are left only with constant coefficients and $e^{\pm ibx}$ which in turn can be converted to $\cos(bx)$ and $\sin(bx)$.
Though the coefficients in question being complex, the calculation is really tedious because you need to rationalize the denominator, then convert back to sincos, this is a lot of work.
So instead we consider this step as the theoretical justification that we will end up with $A_0\cos(bx)+B_0\sin(bx)$ and we prefer to use direct identification below.

method 2: direct identification

The theoretical justification above lead to this more general formulation

your homogeneous equation has root $b$ with multiplicity $m$ (convention $m=0$ if $b$ is not a root)
the full equation has a RHS of the form $P(x)e^{bx}$ with $P$ polynomial.

 Then you need to search for a particular solution in the form
$Q(x)e^{bx}$ with $Q$ polynomial and $$\deg(Q)=\deg(P)+m$$
Although since the homogeneous solution will already have vanishing
terms $(C_0+C_1x+\cdots+C_{m-1}x^{m-1})e^{bx}$, you can ignore them in
the polynomial Q.
In case of a linear combination of such terms in the RHS, you can also
search for a linear combination of particular solutions for each.
Note: in the special case of $RHS = P(x)$, consider the root $b=0$ since $e^{0x}=1$, and the same rule applies.

Therefore since we need to find only $1$ particular solution, we can just apply this recipe and go for identification:
$u_p=A_0\cos(bx)+B_0\sin(bx)$
$u_p'-ru_p=(B_0b-A_0r)\cos(bx)-(A_0b+B_0r)\sin(bx)$
And you get to solve $\begin{cases}B_0b-A_0r = A\\A_0b-B_0r = -B\end{cases}$
The final result is as below:
$$\overbrace{-\frac{Ar+Bb}{r^2+b^2}}^{A_0}\cos(bx)+\overbrace{\frac{Ab-Br}{r^2+b^2}}^{B_0}\sin(bx)$$

We have done it with the system of ODE of first order to illustrate, but the general formulation above works of course directly for the higher order linear ODE with constant coefficients.
So having $y''+a_1y'+a_2y=A\cos(bx)+B\sin(bx)$
You set the characteristic equation $r^2+a_1r+a_2=0$ find roots $r_1,r_2$, compare them to $\pm ib$ (the exponential form of sincos) and determine the $m$ above.
In our case $r\neq\pm ib\implies m=0$ and we get to search for a particular solution of the same degree (i.e. constant coefficients) than the initial RHS.
i.e. $RHS=A\cos(bx)+B\sin(bx)\implies u_p=A_0\cos(bx)+B_0\sin(bx)$
Comment: Thanks for the answer @zwim and sorry for the late reply (I've been trying to work the problem out with your help), I follow you up to the homogenous solution, but I tried to find the particular solution of it using variation of the constant and I just can't seem to get $A_0\cos(bx)+B_0\sin(bx)$. Do you think you can elaborate a bit more and show how you were able to do it?
Comment: Detailled that part. But as you can see the variation of the constant method is only for the theoretical justification. Conducting the calculation to the end is too tedious, we prefer to establish the result then proceed by identification.
Comment: Thanks for the clarification and illuminating the process by which people prefer to obtain results, your help is truly appreciated.


How to recover a folder deleted in Notes app?

Question: My saved Notes on my iPad  were accidentally deleted.  I tried to find a folder for the "recently deleted" and there is none listed, how do I find it?
Answer: I like to go to a computer and sign in to iCloud directly.
Much easier to see what's deleted and diagnose if an iPad or iPhone is behind in syncing up to the cloud. If one device lags, I like to power it off while it's in an area where WiFi works and plug into charge.
That wakes the device and I unlock it only long enough to verify the WiFi reconnected. Let it sit an hour or overnight and most iCloud sync issues fix themselves.
Answer: It'll be on the left hand side under your normal notes.

Note that this only works with iCloud notes. If your notes were stored on your Gmail or other email account, they are gone.
If they were indeed stored on iCloud, I'd do as bmike recommends, and wait it out on desktop.


How to encrypt a 192 bit plaintext using AES-192?

Question: Can we use AES-192 bit algorithm for 192 bit plaintext? If yes, what are the changes we have to do?
Comment: AES always works on 128 bit blocks, AES-192 denotes the key length.
As Thomas already mentioned, the process anything longer than 128b you'd like to use [any mode  of operation](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation)
Comment: @gusto2 That looks an awful lot like an answer
Comment: You have to use a mode of operation
Comment: While AES is only defined for 128-bit blocks, Rijndael algorithm supports more block sizes, including 192-bit blocks, and many implementations of Rijndael support multiple block sizes. You still should use a proper mode of operation in most scenarios.
Answer: Strange as it may sound, you should not directly use any block cipher directly as a means to provide confidentiality. A block cipher can only handle a statically sized plaintext, which in the case of AES is always 128 bits; it's not 192 bits, that's just the key size.
More importantly a block cipher will always output the same ciphertext if the key and input block remain the same. That means that if you input two 128 bit messages, for instance the ASCII representation of "affirmative, sir", then the ciphertext will be identical. If this message is the answer of two separate questions then an adversary can immediately detect that the answer of two questions is identical as well. This breaks the security of a cipher as it leaks information about the plaintext.
In the strongest semantic security that a cipher can obtain, IND_CPA, the ciphertext output should not leak any information even if the adversary may input as many input messages as he likes.

The simplest mode of operation is ECB mode; it just splits the plaintext into multiple blocks, and then encrypts each block in turn, possibly padding the last block so that the input to the block cipher always receives 128 bits. This solves the first part of the cipher only handling 128 bits, but it does nothing for the security mentioned in the previous sections.
Fortunately there are many modes of operation that do provide such security. AES-CBC is used a lot, but it requires padding - which in itself can be a security risk - as well as a unpredictable IV. This IV or initialization vector is used to change the ciphertext independently of the plaintext. AES-CTR (AES in counter mode) is also used a lot and doesn't require the padding and only a unique nonce (number-used-once) instead of the unpredictable IV.
Currently authenticating ciphers such as GCM are becoming more commonplace as they do not just protect the confidentiality but also the authenticity and integrity of the message. They are generally build using AES-CTR internally.

Note that the size of the plaintext is not automatically protected by AES using any of the modes of operation. This is one of many side channels that may leak information to the attacker. You cannot just encrypt "Yes" to 3 bytes ciphertext and expect that an adversary cannot distinguish it from the 2 bytes required for "No".

When you read about AES-192 is being used to protect your data then you should ask yourself how it is used to do this. To a seasoned cryptographer the use of AES, as the most common unbroken block cipher, only means that a small part of a system is possibly secure.

If you want to encrypt fully random data (such as an AES key) then you could right-pad your data using 64 bits set to zero. Then you could use ECB mode encryption (encrypt two blocks of 64 bits) and encrypt the two blocks of 128 bits. This process is called key wrapping. This is only secure for completely random data though and it is probably better to use more modern techniques such as AES in SIV mode.
Comment: There are probably more answers like this, but I've tried to make this as readable as possible to anyone that only *heard about* AES and isn't prepared to follow a complete course on the subject.
Answer: 192 bits is 24 bytes, so the software implemented will most likely pad the message to be 32 bytes, a multiple of 16 byes (this is the 128 bit block size of AES).
Comment: OK, I already included this as final option in my large answer, but I'll humor you and upvote as it is at least easier accessible as a one liner.
Answer: My answer has the purpose to prolong @Maarten Bodewes's answer by adding some interesting details that might go off the scope of the question but adds a few points that I consider important when understanding the context of what was written in his answer.
Usually, ciphers are still considered semantically secure even if the attacker can obtain some information about their length. Here I give the example of the OTP cipher, that is perfectly secure if the same key is never used twice even though it leak information about the length.
For my understanding when Maarten states at the end of the second paragraph:

This breaks the security of a cipher as it leaks information about the plaintext.

what he really meant was: This breaks the security against chosen plaintext attack.
That said, I think it's worth to point that, in fact, any deterministic cipher (using the same key) will not be secure against a chosen plaintext attack.
If the reader wants to go into more detail, to prove CPA (chosen plaintext attack) security one must define an Attack Game between an adversary that can query a challenger i times with two messages (m1 and m2) per query, with the objective to distinguish if all ciphertexts returned by the challenger were generated from the first or second message of each query. Note that for all queries the challenger will encrypt mb for b = {1,2}.
Now, if one used a semantically secure cipher to encrypt all his files under different, independently generated key for each file, then we can state this configuration is also CPA secure. This is also called multi-key semantic security.
Saying that no deterministic cipher can possibly satisfy the definition of CPA security there is a generic approach to get a CPA secure cipher out of a semantically secure cipher and an appropriate PRF - pseudorandom function. Alternatively one can transform a secure PRF (say AES, that is also a secure PRP - pseudorandom permutation) into a CPA secure cipher. This last approach uses, most of the times, the counter mode or the CBC mode, where the first one has several benefits over the second, such as parallelism (because of its architecture) and shorter ciphertext length (because of its return ciphertext format).
If one wants to dive into CPA security I recommend reading the 5th chapter from A Graduate Course in Applied Cryptography. In fact, most of what I've written here is based on this book.


heat pump condenser fan not running in winter

Question: it is -5 degrees outside. Our thermostat is set at 70 degrees and the house heat is 58 degrees. the fan blade on the unit outside is not moving. the hvac system inside has a sticker on the unit. the empty box says unit has electric resistance. the checked box says 'may install' electric resistance. I see no mention of auxillary heat on the thermostat. Last summer hvac man was here and he said our thermostat is the correct one for the system.
is everything ok and we just need an auxillary heat, or is something broken?
Comment: Often people will disconnect the resistance heat to save money. I'd remove the thermostat cover and check to see if there is a loose wire. (It's probably white.) Then, CAREFULLY take the wire and poke it into the socket that also has a white wire. Reset the thermostat (turn it off for a minute or so and then back on.) The outside compressor fan probably won't come on, but the resistance heater can work without the outside unit working. Also, you may have tripped the circuit breaker. Turn it off and back on.
Comment: I know in my area some people do not install heat strips saving on the install cost because it rarely gets below 0. I believe the last split system I installed was rated at -15 but several prior to that were -5, if this low temp is unusual you may not have the aux / emergency heat.
Comment: Resistance (auxiliary) heating can kick in way before the temperature reaches 0, or even 10 deg F.  While the heat pump may be able to pull some heat out of the environment at those temperatures, it's probably not enough to maintain the house set-point temperature, say 68 deg.  My resistance heating starts to kick in above 30 deg F, at least according to the "aux heat" display on the thermostat (control panel).
Answer: -5 (I assume °F) is a too low temperature for heat pump to work properly (usually those stops working at -15°C [+5°F]), so outer unit is simply 'locked due to excessive cold'. Auxiliary heat, in some units, is controlled directly by the HVAC controller and not by room T-STAT.
Anyway, check if auxiliary heat is connected BOTH on HVAC unit and Tstat, if it's connected only at unit side, connect it to the t-stat, if it's not connected, probably auxiliary heat is not present on your machine (if it was ECU controlled you won't have that cold in your house).
For now, you can just buy a couple of kerosene heaters and use those in case of emergency, look for 'zibro kamin' (I suggest a model that can work in case of power failure).
Comment: **Do NOT buy a couple of kerosene heaters**. Kerosene (or similar) heaters should never be used inside. If you must use supplemental heaters inside, get electric heaters. Even with an electric heater you need to be very careful that you don't overload a circuit and that you keep the heating elements away from flammable items such as curtains and also be very careful if you have small children or pets. But at least you don't have to worry about carbon monoxide.
Answer: Heat pumps work by removing heat from the environment and exchanging it "elsewhere." In the summer, the heat is removed from the environment inside your house and ejected outside.
For the cold seasons, the air outside has heat removed from it and transferred to the inside of your house. This works great until temperatures reach 20-25° F, at which point, the efficiency drops below that of the equivalent elecrical consumption of a resistance heater.
It would appear, based on your description, that you are in need of that additional device for your system.
There is some variance regarding temperature balance, with lower figures attributed to higher performing, more efficient heat pumps.
Some information located here:
Heat pump explanation


Can I do a Meta-Analysis for Odds Ratio's for continuous predictor (age) with Binary outcome (Affliction, yes or no) in R?

Question: I'm looking for a way to conduct a Meta-analysis on Odds Ratio's from several studies/article's. The thing is that my OR's are based on logistic regression's with continuous predictors (outcome is binary, affliction or not). So they are not based on frequencies of hits in experimental en control group. Can I do this analysis with the package metafor in R? And what kind of additional information, such as sample size (n), regression weights and CI's do I need to have R calculate standard errors to estimate the overall effect (OR) and make funnelplots? Hope any one can help me out!
Answer: You need the coefficient from the logistic regression (in its logged version) with its standard error. You may have to back-calculate it from the confidence interval for the odds ratio which would involve taking logs first. One think to beware of is that if the other variables in the logistic regression are not the same then the coefficients are not estimating the same quantity.
Comment: Thank you! Makes sense, is your last comment because of unstandardised regression weights or because of individual or partial contribution of age (due to the other covariates?


Will an IIS reset force cached items to be resent?

Question: I'm trying to develop a strategy to handle cached javascript files, css, images, etc when we release an update to our site. Before I get into implementing version numbers on the javascript files I was wondering if an IIS reset after each release would effectively cause cached files to be resent.
Answer: When you do an IISReset the IIS cache will be cleared and then will start to be rebuilt after it starts back up as client requests come in.  If you update a file then the older cached file will become stale and IIS will serve the updated file and update the cache with the new file.
IISReset (although harsh) will clear the IIS cache but it won't do anything with local caches in proxies or clients.  Maybe you've just got the terminology mixed up a bit, but there isn't any concept of "resent" when it comes to caching.  It's all request based.  If a client requests something and it's found in a cache then it'll get served from the cache.  You'll need to force content expiration on your files if you will be maintaining the same filenames.
Comment: Thanks for the help. Please forgive my ignorance in this area ... I'm getting confused between the client and IIS cache. The term 'resent' was to refer to the server sending the content rather than it being pulled from the client's cache.
Comment: @Dave no worries at all, glad it helped! One additional bit, if a file is located in a client cache or an upstream proxy cache then the server won't even receive the request unless the cached item is stale and there's a newer version available from the server.
Answer: No, client caching is based on content expiration time.
Answer: When you modify one javascript file, you need ALL clients what are running the web application to get the new file, it is clear to me the "recent".
For each client to get from the server the new file, you only need to include in the include/script of your javascript in the web page the "?version=1".
It is only necessary one parameter could be ?blue=hello or ?v=1234155 it is like you want. The importance is use a different value each time you change the javascript. "?version=1" for first change, "?version=2" for second change, it is practical and single to know the next value. Also you can use a GUID if you want : "?version=4747b320-62ce-11cf-a5d6-28db04c10777" or you can use the date and time "?version=20130220175025" for 2013/02/20 17:50:25.
Example #1

Example #2


lead and lag times

Question: in the Project Management framework I am developing http://www.lowcoupling.com I have defined a Domain Specific Language enabling a declarative description of schedules and plans. Like
<code>   Project project1 {

        Activity activity1 {
        starts '31/08/2013' ;
        ends '20/9/2013';
        completeness 20 % ;
        }

       /*
        * activity2 description
       */
       Activity activity2 {
        after project1.activity1 offset 1;
        duration 30;
        completeness 0%;
        dependsOn project1.activity1;
       }
  }
</code>
As you can see you can define the starting date of an activity, its end date or its duration.

Alternatively you can express you want an activity to start after (the end of) another with an offset (in days). As you can see the keyword to that is 'offset' and it can be either positive or negative (days before the end of the related activity).
My question is: Do you think it would be more appropriate (and maybe elegant) to use the keywords 'lead' and 'lag' instead of 'offset'?
Answer: My two cents: It is clearest if you use "Offset".

lead and lag times


F1 Cherry Tomato Plant Temperature

Question: I am growing F1 Cherry tomato (Sweet Aperitif,Sweet Million, Sun Gold), they set flowers, and some flowers drop and start to get fruits, the weather is clear and between 23C to 30C most days, but yesterday and today the weather was 40C all the morning, I know that the high temp more than 40C degree is reducing fruit set , but is this true for my case which is just 2 days of high temp?
Answer: That is quite hot, but in my experience they can handle a few hot days (with adequate water).
Proper Nighttime temp is critical for fruit set - if nights are too hot they just won't set fruit and flowers will drop.
This article has good details
http://edis.ifas.ufl.edu/m/#publication?id=HS1195
The article specifies that

Tomato flowers must be pollinated within approximately 50 hours or they will abort and drop off.

And also that

If nighttime temperatures fall below 55°F or rise above 70°F, or if daytime temperatures rise above 85°F, the pollen becomes tacky and nonviable, preventing pollination from occurring and causing the blossom to dry and drop

So 2 days at 40c is pretty close to that 50 hours, so very possible.
They also note that very high temps can directly cause blossoms to drop

Temperatures over 104°F for only 4 hours can cause the flowers to abort.

So overall I would say yes the two days at 40c are likely responsible, but that depending on the strain and the growing environment it's possible for tomatoes to withstand some pretty high daytime temps provided nighttime temps drop to an appropriate level.
Comment: Thanks, but you didn't answer my question, Is this applied in case if just 2 hot days ?
Comment: Fair enough, added some more details from the article.

F1 Cherry Tomato Plant Temperature


Who to contact to identify source of and address excessive humidity in house?

Question: My house, a 1947 cape in Massachusetts, is always much more humid that outside, in all seasons.  Even when running the dehumidifier, one in the basement, and one on each of the two main levels, it rarely falls below 50%, even when outside is only in the teens or 20s.  I've had a few outbreaks of mold, when I failed to run the dehumidifier regularly.  This is an issue that is too big for me to address.  So, I'd like to bring in an expert to assess and address the situation.  Yet, I haven't been able to find one.  Who should I call in a situation like this?  Thanks!
Comment: You probably need to address water (vapor, at least) getting in through the basement and perhaps also address an upgraded dehumidification system covering the whole house. Which is likely 2 if not 3 contractors, I don't know of a likely one-call solution. *i.e.* you may need to address water on the outside of/below the foundation (drainage;) sealing the basement walls/floor; and if the problem persists, moving to a whole-house dehumidification system (if you have not already done so, I recommend setting up your presumably portable dehumidifiers to run to a piped drain.)
Comment: In addition, you should check that you do not have venting issues with any appliances that might be down there like a furnace or water heater. Some models generate a lot of moisture.
Comment: I agree with the piped dehumidifier the smaller models you have to empty or they overflow/ shutdown we were able to use a floor drain on our home with the most moisture that model did a great job but cost close to 40$ per month, that was a lot back then but it ran all the time prior to coating the floor.
Comment: Ecnerwal: That is a great comment and think you should convert it to an answer.
Answer: I had a home in Ohio with a basement that had high humidity a large dehumidifier running 24-7 pulled an amazing amount of moisture out of the air. Late in the summer we epoxy painted the floor with a 2 part epoxy and this alone greatly reduced the moisture in the house.
We had taped plastic down in 5 places in the basement for 24 hours  to see if there were places that were worse (the front of the house was very wet, we had to wait until summer for the moisture to be low enough to paint (according to the directions) after that we did not need the big dehumidifier coating the floor but we still did use a much smaller model , I have coated quite a few basement floors since then all with similar results so you may give this a try.
Comment: I did find the 2 part epoxy for garage floors by rustolium was the best , the first time I used it I only read the application instructions not all the warnings , I used it on the house basement and it really stank for several days. I later found it was not recommended for living spaces unless they could be vented for 48-72 hours. That basement took 4 gallons but after it cured it changed the comfort of the whole house , we no longer had mold growing on basement windows and the smaller dehumidifier probably paid for the coating. That was in the early 80's there may be better but I still use it
Comment: Did you find a brand that you felt offered better results than the others?


How to remove this black spots in texture

Question: I have made the model and textured it. I did not get where im getting this black spots on it. I have attach my model.
Comment: your uv mapping seems to be close to the edge
Answer: You UV mapping is mapping a transparent part of your texture.

You can shift it a bit or map it a different way. You can also use another texture for that part of the mesh. There are lot of options to fix it.
Answer: The cause it that your texture fits the original mesh too precisely and not your subdivided mesh. For a quick fix, you should edit your UV map so that there are some margin between the uv and the texture (make the border of the uv map a little inset than the border of the texture)
If you made your texture by baking, find a method to add a margin.


Axis-Aligned Bounding Box- once rotated

Question: Creating an AABB is simple. But, if the 3d model has become rotated, how do you update the AABB to become accurate? Or is the AABB supposed to be in local space?
Answer: Axis Aligned Bounding Box means the box itself is always on the same orientation.
To update the AABB you will need to recreate it each time the model rotates, and move it if the models positions changes.
The box will change shape and size depending on the rotation and the model you use.
If you want to have a rotating collision box than that matches up with the model, then that is completely different than an AABB, and you will need to look into the physics of your engine for that.
Edit:
If you want to update the AABB quickly, but with less accuracy, just pass the points of the original bounding box instead of the entire model.
The bounding box won't be perfectly tight, but it is guaranteed to have the entire model inside of it. Here is an article describing how to achieve this.
One thing I would like to add that is not in the article would be to create a few fully calculated bounding boxes at 10 rotations and when recalculating, use the bounding box that is closest to the current rotation, that should improve the tightness of the bounding box a lot without creating that much more overhead.
Comment: ..Or, if you want to skip all this updating, use bounding spheres instead. =)
Comment: I was more looking for algorithms to update the AABB. I'd rather not project every vertex into world space, and then compute the AABB from that.
Comment: I updated the answer with details on how to compute a less precise bounding box that is more efficient than parsing all the vertexes of the model.
Comment: @Dave O There made it more readable.
Comment: @DeadMG There's no way of "updating the AABB" in the sense you want it. By definition, the aabb has to completely enclose the model and if the model changes, you're pretty much forced to process all vertices. Hobo's on the spot.
Answer: From wikipedia:

A bounding box is a cuboid, or in 2-D a rectangle, containing the object. In dynamical simulation, bounding boxes are preferred to other shapes of bounding volume such as bounding spheres or cylinders for objects that are roughly cuboid in shape when the intersection test needs to be fairly accurate. The benefit is obvious, for example, for objects that rest upon other, such as a car resting on the ground: a bounding sphere would show the car as possibly intersecting with the ground, which then would need to be rejected by a more expensive test of the actual model of the car; a bounding box immediately shows the car as not intersecting with the ground, saving the more expensive test.

If your model can be at any rotation, perhaps a bounding sphere is in fact a better bounding volume to be using?  Bounding spheres are typically cheaper checks and many systems use several bounding volumes in preference order e.g. always check sphere, if that passes then check AABB, if that passes then ...

Axis-Aligned Bounding Box- once rotated


Making a nav controller work the same in iOS 6 and iOS 7

Question: How can a navigation bar be supported in both iOS 6 and iOS 7 with a UIContainerView via a storyboard?
I am updating an iOS 6 app to iOS 7, but want to continue to support iOS 6.  I have a main top level view that is embedded within a UINavigationController.  The view within the navigation controller has a container view in it.  I am using a storyboard to lay out the view.
On iOS 7 the navigation controller uses the entire screen, and I've set it up to put the container view content below the navigation bar.  In iOS 6 the content of the view does not go under the navigation bar, so I have a blank gap below the nav bar.
Normally I would just reset the origin of the offending view on iOS6 (in ViewDidLoad or somesuch) and go on my way.  However since my content is in a UIContainerView, I can't seem to change the frame after it loads.  (I have tried this in prepareForSegue: when loading the UIContainerView.  I'm open to having done this wrong?  heh)
The closest I have found is using the following code under iOS 7 to make the nav bar opaque and keep the content out from under it, then using the entire space for my UIContainerView.
<code>  // tell the view to not extend below this nav bar
  if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;
</code>
This solution works but has the side effect of showing the status bar as black (since it's more or less "blank" under the status bar).  Alternatively, if I put the top edge of the container view below the status bar, on iOS 6 I have a big gap below the navigation bar.
I can eliminate the use of a navigation controller, but that seems a bit heavy handed in this situation and I'd like to use that as a last resort.
Answer: I've found the solution to this.
You need to set the barTintColor in iOS 7, which also seems to color the main status bar, as well as setting the nav bar to not be transparent like this:
<code>mainController.navigationBar.barTintColor = [SRPRTabletHelpers customUserColor];
mainController.navigationBar.translucent = NO;
</code>
The non-transparency was the key, while setting the color sets not only the regular nav bar, but the color beneath the status bar as well.
I also needed to change my containerView top edge to be the full height of my view contained within the navigation controller, now that it is not transparent, and it works the same on both iOS6 and iOS 7.
Answer: While you mention to have already solved this, your method seems to require a lot of manual code and if checks. The iOS 7 UI Transition guide, in the Supporting iOS 6 chapter mentions another way: first design your interface for iOS7 as you have done, with your view extending below the navigation bar.
Then, in the interface builder open the size inspector for UI elements and modify the iOS 6/7 deltas. These values are applied when the storyboard is not run on iOS 7. For example, in your case you can select all your visual elements, then set the Y delta to -44, which is the standard navigation height. That will make the UI go up on iOS6, compensating the fact that the view doesn't go under the navigation bar.


Should I lock out my hips while locking out my kness, or after, during a clean deadlift?

Question: In the starting deadlift form, we have to hinges : the one at knees and one at hips. I noticed in my lifts, that I unfold the knees and then separately unfold at the hips.
Answer: "Early knees" is a common cue.
"Early knees" is a common cue used among powerlifters, referring to locking your knees as early as possible in the deadlift. It's more often used for the sumo deadlift, but I've seen it used for conventional ad well, and the principle applies just the same. It isn't essential, but can be helpful if you have trouble locking out your hips before you've locked your knees. There is, of course, going to be a lot of individual variation here. Personally, I struggle tremendously to lockout my hips if I locked out my knees yet.
An example of an accomplished lifter with an often exaggerated early knee lockout is Yangsu Ren aka Deadlift_Panda. In this video you can see how early he locks out at the knee prior to locking it out at the top. So it isn't "wrong" to lockout your knees early, unless it's wrong for Yangsu Ren to do it while deadlifting over 360 kg at a body weight of 80 kg.
Like I said, there will be a lot of individual variation, and you've got to figure out what works for you. But early knees is not necessarily wrong or poor form.
Comment: General mechanical question: isn't it mainly a difference between longer force exposure to vasti vs. glutes and hamstrings, ie. naturally, the higher the weight, the earlier the knees lock compared to hips because the latter can tolerate it better, generally?
Comment: @PhilipKlöcking I'm not sure load has much to do with it, but it might. In my experience, I have a pretty consistent technique with all loads, and failure to lock knees early enough is a common failure mode for me with circamaximal loads on conventional deadlift.


How can I make treasure ships appear?

Question: What are the requirements to make the white "treasure" ships (which lead to airship levels full of coins) appear in Super Mario Bros 3?  Can I make them appear intentionally?
Comment: good god I had no idea any of this was possible! curse you SE:Gaming! NOW I HAVE TO TRY!
Answer: To make a Hammer Bros. turn into a coin ship:

Ensure there's a Hammer Bros. left on the world map
Start a level and finish with:

A multiple of 11 coins (11, 22, 33, etc.)
A score ending in 10 (2010, 3410, etc.)

Each second left on the clock gives you 50 points.  That means you should end with an even number of seconds left on the clock if you have a score ending in 10.  If you have a score ending in 60 you should finish with an odd number of seconds on the clock.  Anything else and you're out of luck!
There are also white mushroom houses that appear if you get every coin on a particular level in each of the first 7 worlds:
1–4: 44 coins
2-2: 30 coins
3–8: 41 coins
4–2: 22 coins
5–5: 28 coins
6–7: 78 coins
7–2: 41 coins
Answer: I am assuming you mean turning a wandering Hammer Bro into a white treasure ship. From Gamespot:

Morph a wandering hammer brother into a treasure ship.
  To turn a wandering hammer brother (the ones that walk about on the world map) into a white ship full of coins, collect a number of coins that is a multiple of 11. Make the tens digit in your score match the multiple of 11. Stop the timer at the end of the stage that you are playing in on an even number.One combination would be: 11 coins, 9,310 as your score, and the timer at 104. This only works in worlds 1, 3, 5, and 6.
Answer: You can have any multiple of 11, so 11, 22, 33, 44, 55, 66, 77, and 88. Then you need to make sure your score has a tens digit of the same number as your coin multiple. Example: if you have 11 coins your score will need to look like this 01000[1]0. As long at the second to the last digit (the tens digit/ the digit I put in brackets) is the same as your coin multiple you will get the treasure ship. It will only work on world 1, 3, 5 and 6. There must be a hammer bro on the map and you must stop the timer on an even number by hitting the goal block when the timer changes to an even number.
Comment: Your answer does not add anything that the other two answers from ~4 years ago state. Duplicate answers are frowned upon here and may be subject to deletion.
Answer: The answers here are only half true.
It works on worlds 1, 3, 5, and 6. There must be a live Hammer Brother to be turned into the ship.
You can get the treasure ship by ending a level with a number of coins that are multiple of 11 (11, 22, 33, 44, 55, 66, 77, 88). Then you have to match the tens digits of your score to ONE of the following rules:
a) the tens digits is equal to your coin digits (i.e: you have 33 coins, the tens digits is 3): finish the level with an even number of seconds, or
b) the tens digits is equal to your coins digits + 5 (i.e: you have 66 coins, the tens digits is 6 + 5 = 11, then it is 1): finish the level with an odd number of seconds.
The second rule here (b) is often omitted in these answers, but it works.

How can I make treasure ships appear?


What is the best defense for a multi-layered attack: Spoofing, MiTM, Login CSRF?

Question: How would one go about defending against this sort of attack to best protect a sloppy user? There can be obvious signs of a spoofing attack, such as not using SSL, slightly different domain, etc, but I am assuming Tristed.com (the malicious site) has completely fooled the user. The only mitigation that comes to mind is having automation prevention built in, like Captcha. I don't know if I am completely missing something here, so apologies in advance. I have abstracted a lot of detail for the sake of keeping the diagram simple.
Answer: A good security measure for this is having a navigation proxy in place that block suspicious websites.
In this case maybe tristed.com have been created recently or is unclassified or directly suspicious and a navigation proxy may block or alert against it.
Similarly may be a DNS solution may find the URL suspicious and block it by resolving to a sinkhole IP.
Comment: In the case that the generic http client (from tristed.com) would first route requests through a trusted proxy before hitting trusted.com, would there be any additional methods for prevention?
Answer: What you are describing is basically a user that enters his credentials on a malicious site that appears to be a trusted site. Those credentials are used afterwards to compromise the account of the user.
You are totally out of the loop until the credentials are misused, so there is no direct technical measure you can set. Even the CAPTCHA you proposed to protect against automated misuse afterwards does not work, because this CAPTCHA can be forwarded to the tricked user as well.
This means your best approach is educating your users, how to identify malicious sites. One good measure to suggest is bookmarking the site instead of searching for it. This would eliminate future mistakes, as long as the bookmark is used.
In addition, you can monitor to identify fraud scenarios and react fast to mitigate damage. In case the attacker is sloppy and uses a single IP address to access the real site, you can detect many different users coming from the same IP, which might be an indicator of such an attack. Please note that a larger network behind a NAT would look the same, so be careful with countermeasures.
If you have control over the user environment (e.g. they are clients on your corporate network), you can enforce client side protection mechanisms. I assume you are talking about outside users though, because they use a search engine to find the site, so I won't go into details concerning client side measures.
Comment: Unfortunately 2FA does not work in this scenario as well, because Tristed.com can interact in real time with Trusted.com. So if Trusted.com requires a second factor, Tristed.com will see this during the login process and asks the user to provide this information as well. Whatever Trusted.com is asking can be fetched by Tristed.com and passed on to the user.
Comment: Thank you for the answer. Before I accept it, I would like to get your opinion on how effective 2FA would be in deterring this type of attack. It just came to me that 2FA might be the only direct mitigation for this scenario, and in addition, all of the prevention strategies you mentioned in your answer.
Answer: You can use webauthn in order to get different responses to a challenge from tristed.com, which could not be used on trusted.com.
This is however linked to a specific device or OS account. You thus need the user to either have a compatible hardware component, or have them be able to only use the account on linked OS accounts (though I have only used the hardware device so don't know how easy to use the system is without one).


the ring of dual numbers over a field $k$

Question: Suppose $k$ is a field,then the quotient ring $k[\epsilon]/\epsilon^2$ is called the ring of dual numbers over $k$. I learn this from Hartshorne. I wonder why it has this name(maybe this question is a bit soft,or senseless). Are there any interesting things about this ring?Would someone be kind enough to say something about it?Thank you very much!
Answer: Well, one interesting fact about the dual numbers of $\mathbb{R}$: consider its polynomial ring, and specifically identify an object $f(x) = \sum_{i=0}^n a_ix^i , a_i \in \mathbb{R}[\epsilon]/\epsilon^2$.  Now evaluating $f(a + b\epsilon), a,b \in \mathbb{R}$ will yield $f(a) + bf'(a)\epsilon$ (hint: binomial theorem) which allows for automatic differentiation and an interesting approach for non-standard analysis.
Working in a more general $k[\epsilon]/\epsilon^2$, since $(a + b\epsilon)(a^{-1} - ba^{-2}\epsilon) = 1,$ we see that for all nonzero $a$, $a + b\epsilon$ is a unit.  So our ring of dual numbers over $k$ has a unique maximal ideal $(\epsilon)$ and the ring is local.
On a note more relating to Hartshorne: let $f: X \rightarrow S$ be a morphism of schemes.  Using the ring of dual numbers, one can construct the pointed tangent space of $X$ over $S$, but I'm in no means qualified to talk about that.
Comment: @use Since this does not explicitly explain why they are called "dual numbers", I'm quite puzzled why you have accepted it. Doing so may well prevent others from giving the real answer.
Comment: If I had to guess, I'd say they're called the ring of dual numbers due to the aforementioned relation to pointed tangent spaces.  I'd love to hear an actual explanation behind the name, in any case.
Comment: Thank you very much for the explanatin!
Comment: @Bill Dubuque:The above partially answered my question:the interestng properties of the ring.
Answer: The "dual" in "ring of dual numbers" is obscure. However, something possibly worth noting is this. The exterior algebra of a finite dimensional vector space over the field k is a self dual (graded) Hopf algebra: that is to say, the multiplication is dual to the comultplication, the unit is dual to the counit, etc. This seems to have been grasped by Grassmann himself though the notation of his time defeated his attempts to formulate this beautiful duality in a coherent fashion. Now note that the ring of dual numbers over k is isomorphic to the exterior algebra over the 1-dimensional vector space k. So it is a self dual Hopf algebra. Could this have a bearing on the terminology? Note also that the Hopf structure illuminates the spectrum: it is "like" a one-dimensional affine group, the single generating vector being "short". A generic tangent.
Comment: While I think it is a good idea to think of the ring of dual numbers as the exterior algebra of a one dimensional vector space, I now think that the origin of the term "dual" does not lie in the complicated duality of exterior Hopf algebras but rather in the fact that there are two parts to each element, namely the two gradings, 0, and 1.


Why we should not discuss new theories?

Question: I heard recently that we should not discuss new theories here. Why we should not discuss new theories when they are very closely resembling the existing accepted theories but with slight modification. After all even if we fail with new theory, we end up learing the old established theory in a better way.
Comment: Try the associated chat room for this site. Not sure if any other forums exist, but _usually_ when someone claims to have a "new theory" and is looking to the internet first (as opposed to physicists who discuss with collaborators/etc), the theory is not really a sound one and most sites don't want people to promote fringe theories so they disallow "I have a new theory" posts.
Comment: New published theories are OK. See [Is non mainstream physics appropriate here?](http://meta.physics.stackexchange.com/questions/4538/is-non-mainstream-physics-appropriate-for-this-site) for more information.
Comment: @Manishearth : For example are these type of questions okay, say we  modify the schrodinger equation a bit like this and change the born rule a bit like this and see the new predictions and discuss them. I mean the question will self contained and within the scope of reader who knows QM, are these questions welcome?
Comment: If you are working within the realm of established theory/formulism it is OK. However, if you want to propose a newish theory and discuss the validity, that is not.
Comment: @Manishearth :  just wonder, is  there any physics forum to discuss new theories.
Answer: I'd say the key point emerges in your comment above:

is there any physics forum to discuss new theories

This is not a discussion forum - it is a question and answer site. It's hard to see how you could ask a question about a new theory without it turning into a discussion. That doesn't mean we hate and revile speculation, just that this isn't the place for it.
I must admit I'm a bit uncomfortable with the phrase "non-mainstream physics" because I'm sure that's how Pope Urban VIII would have described Galileo. Actually I think the wording on the vote to close dialog is pretty good when it says:

Questions about the general correctness of unpublished personal theories are off topic, although specific questions evaluating new theories in the context of established science are usually allowed.

Why we should not discuss new theories?


Decide what ads to show myself rather than having AdSense choose for me

Question: In order to show relevant ads to a user I just put Google code on my site and they target the ads based on their knowledge of that user. Is there anyway I can use AdSense or any other advertising company to decide myself what ads to show to the user from their pool? i.e. I will decide to show him a "technology" related ads?
Comment: Annoyingly my question (http://webmasters.stackexchange.com/questions/8811) was closed as an exact duplicate of this one.  So I am forced to hijack this.  I'm looking for ad services for publishers that allow the publishers to choose which ads are relevant to each page's content (NOT the user). Thanks.
Answer: Search API for Shopping
 can let you search and display ads from Google Affiliate network, and the products offered from merchants. Google Affiliate let you choose Merchants of your choice and you can add emended id links in any kind you ads you like, you can put your own designed Ads and add you publisher link in it, they have hardware/software, telecommunication etc like categories where you can choose Merchants of you choice.
Adsense and its api won't going to help you i guess, as adsense api is for revenue sharing etc. you can't edit or choose ads either.
Answer: AFAIK, Google's AdSense ads don't target specific users. They display ads on Gmail like that, but all other ads are based on the content of the page not the user.
If you want to show more relevant ads to your users, you can do audience profiling and segmentation through companies like Rapleaf, Quantcast, Full Circle Studies (ScorecardResearch), Brilig, and I think Alexa also offers marketing analytics.
The only company I know of that does user-specific targeting is Rapleaf, which has an API that lets you query user information based on email addresses to deliver advertising targeted at that specific user or to personalize their user experience.
Answer: I don't think that this has to do with ad type. Advertising companies shows ads based on user history.
I don't think that you can do that because not every ad has the same CPC and if this can be done everyone will chose to show only ads with high CPC.
Comment: "I don't think that this has to do with ad type." - this would seem to be what the OP is asking, _how_ to display ads of a particular type/subject?
Comment: I know that you cant do that with Google Ads but there are to many other advertising companie outside that let u chose between one camping or other, or u can choose just a single banner by your choice.