How to pass a Flag field's value to a Rules Component triggered by the flag?

Question: Assume a flag (created using the Flag module) which triggers a rule, using Rules Event "When something is flagged" (with this flag). And assume that this flag has 2 fields defined for it also, i.e.:

"Date from", with machine name field_flag_a_group_date_from.
"Date to", with machine name field_flag_a_group_date_to.

When such rule is triggered, assume it performs a Rules Component, which contains a Rules Action to "Send an eMail".
Question: How to pass the values of those Flag fields to that Rules Component, so that they can be used in the message body of that eMail?
Answer: Step 1 - Add parameters to the Rules Component
Make the "Date from" and "Date to" available as extra parameters to the Rules Component. Here is an example of such Rules Component (in Rules Export format, if you have the Rules UI enabled you can import it in your own site).
{ "rules_send_email_to_all_members_of_a_group" : {
    "LABEL" : "Send eMail to all members of a Group",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "TAGS" : [ "group" ],
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : {
      "group" : { "label" : "Group", "type" : "group" },
      "flag_from_date" : { "label" : "Flag from date", "type" : "date" },
      "flag_to_date" : { "label" : "Flag to date", "type" : "date" }
    },
    "ACTION SET" : [
      { "entity_query" : {
          "USING" : {
            "type" : "group_membership",
            "property" : "group",
            "value" : [ "group" ]
          },
          "PROVIDE" : { "entity_fetched" : { "group_members" : "Group members" } }
        }
      },
      { "LOOP" : {
          "USING" : { "list" : [ "group-members" ] },
          "ITEM" : { "member_of_group" : "Member of group" },
          "DO" : [
            { "drupal_message" : { "message" : "Group member named \u0022[member-of-group:user:name]\u0022 and eMail \u0022[member-of-group:user:mail]\u0022 will receive an eMail because of flagging this \u0022[group:group-type]\u0022 group titled \u0022[group:title]\u0022 and id \u0022[group:gid]\u0022 (with Date from = [flag-from-date:value] and Date to = [flag-to-date:value])." } },
            { "mail" : {
                "to" : "[member-of-group:user:mail]",
                "subject" : "eMail notification to group [group:title]",
                "message" : "Hello [member-of-group:user:name],\r\n\r\nyou are a member of the group [group:title] (which is of type [group:group-type]).\r\n\r\nYou are receiving this eMail since user [site:current-user] just flagged this group.\r\n\r\nFYI: the \u0022From date\u0022 (from the flag) is [flag-from-date:value] and the \u0022To date\u0022 (from the flag) is [flag-to-date:value] ...\r\n\r\nGreetings,\r\n\r\nPS: contact the site admin by eMail (via [site:mail]) for more details if needed",
                "language" : [ "" ]
              }
            }
          ]
        }
      }
    ]
  }
}

The above Rules Component uses these 2 parameters (together with some other parameter "Group"):

"Flag from date" (label), with machine name flag_from_date, and data type "Date".
"Flag to date" (label), with machine name flag_to_date, and data type "Date".

Note how both parameters are shown within "USES VARIABLES" (that's where they are 'defined'). But also note how within the message body of the eMail both parameters are used (referenced), with any "_" in the machine name replaced by "-".
Step 2 - Make the Flag fields available in the Rule
Before you can use the "tokens" related to the Flag fields in a Rules Action (as in Step 3 below), the Rule needs to be made aware about those Flag fields. To do so, simply add those 2 Rules Conditions in the rule that is triggered by Rules Event "When something is flagged" (with this flag):

Entity has field, whereas the Data selector for the entity is "flagging", and the value of the field to check for is field_flag_a_group_date_from.
Entity has field, whereas the Data selector for the entity is "flagging", and the value of the field to check for is field_flag_a_group_date_to.

Step 3 - Pass the Flag fields values from the Rule to the Rules Component
After you completed Step 1, Rules "knows" that for any Rules Action that performs the Rules Component, it is required that a value is specified for those 2 parameters that the Rules Component needs (expects).
So if you add a Rules Action like "perform the Rules Component" (from Step 1) to your Rule (not Rules Component!), you will be prompted to specify a Data Selector for each of the 2 parameters (labelled "Flag from date" and "Flag to date"). Here is the trick to complete the rule (puzzle?): if you first completed Step 2 (and only then!), you will be able to:

use flagging:field-flag-a-group-date-from as the Data selector for the "Flag from date".
use flagging:field-flag-a-group-date-to as the Data selector for the "Flag to date".

Here is an example of such rule, which passes the values of those Flag fields to the Rules Component that is performed in the Rules Action (in Rules Export format):
{ "rules_send_a_group_notification_by_flagging_a_group" : {
    "LABEL" : "Send a group notification by flagging a group",
    "PLUGIN" : "reaction rule",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "flag" ],
    "ON" : { "flag_flagged_flag_a_group" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "flagging" ], "field" : "field_flag_a_group_date_from" } },
      { "entity_has_field" : { "entity" : [ "flagging" ], "field" : "field_flag_a_group_date_to" } }
    ],
    "DO" : [
      { "component_rules_send_email_to_all_members_of_a_group" : {
          "group" : [ "flagged-group" ],
          "flag_from_date" : [ "flagging:field-flag-a-group-date-from" ],
          "flag_to_date" : [ "flagging:field-flag-a-group-date-to" ]
        }
      }
    ]
  }
}

If you have the Rules UI enabled you can import this rule in your own site (after you adapted the machine names of the flag fields to fit yours).
Note the 2 Rules Conditions that were added in the above rule (as detailed in Step 2). And how those fields are then also used within the Rules Action that performs the Rules Component (from Step 1).
Comment: @Mathieu : Merci for your feedback! Question suivant peut-ëtre?


Properly handle Select with angular

Question: I am new to angular. I have the select declared as such (jade syntax)
select(ng-model="projectData.ProjectStatus" ng-options="c.name for c in statuses")

and statuses are initialised as
$scope.statuses = [
  {name:'Active', value:1},
  {name:'Not active', value: 0}
];

In resulting select, nothing is selected and it is rendered as
<select
  ng-model="projectData.ProjectStatus"
  ng-options="c.name for c in statuses"
  class="ng-pristine ng-valid">
    <option value="?" selected="selected"></option>
    <option value="0">Active</option>
    <option value="1">Not active</option>
</select>

How I can specify which option I need to have selected, and how to avoid rendering of first option with "?" so I simply have a select where "Not active" or "active" is already chosen?
Note that $scope.projectData.ProjectStatus IS sent to 1 but it does not seem to be in effect here...
Comment: Maybe I think create currentSelection variable on $scope and use it.
Answer: You should not manually use options tag instead try the below code to make it working

   <select ng-model="projectData.ProjectStatus" ng-options="c.value as c.name for c in data"></select>

Answer: You can set default value for select by setting model value in your controller:

$scope.projectData.ProjectStatus = $scope.statuses[0];

Also, note that option values rendered in html are actually indexes of array you pass in ng-options.
More info in API Doc.

Properly handle Select with angular


Android Studio gradle build cannot add dependencies on old build gradle file

Question: I have just imported the old gradle project from ADT to Android Studio. All SDK, Repository .. updated. How ever I can't add the dependencies to my project. It always says could not find. If i create a new project, All fine.
Here is my gradle build file:
<code>buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}
android {
    buildToolsVersion "19.1.0"
    compileSdkVersion 19

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 21
        multiDexEnabled true
    }
    dexOptions {
        preDexLibraries = false
        javaMaxHeapSize '2g'
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        instrumentTest.setRoot('tests')
    }
    compileOptions {
        encoding "UTF-8"
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}
dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:support-v4:22.0.0'
    compile project(':core')
    compile 'org.slf4j:slf4j-android:1.7.7'
    compile 'com.google.android.gms:play-services:+'
    compile files('libs/App42MultiPlayerGamingSDK.jar')
    compile files('libs/google-play-services.jar')
    compile project(':facebook')
    //compile('com.android.support:appcompat-v7:21.0.3')
}
// needed to add JNI shared libraries to APK when compiling on CLI
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
    pkgTask.jniFolders = new HashSet<File>()
    pkgTask.jniFolders.add(new File(projectDir, 'libs'))
}

// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives() {
    file("libs/armeabi/").mkdirs();
    file("libs/armeabi-v7a/").mkdirs();
    file("libs/x86/").mkdirs();

    configurations.natives.files.each { jar ->
        def outputDir = null
        if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
        if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
        if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
        if(outputDir != null) {
            copy {
                from zipTree(jar)
                into outputDir
                include "*.so"
            }
        }
    }
}

task run(type: Exec) {
    def path
    def localProperties = project.file("../local.properties")
    if (localProperties.exists()) {
        Properties properties = new Properties()
        localProperties.withInputStream { instr ->
            properties.load(instr)
        }
        def sdkDir = properties.getProperty('sdk.dir')
        if (sdkDir) {
            path = sdkDir
        } else {
            path = "$System.env.ANDROID_HOME"
        }
    } else {
        path = "$System.env.ANDROID_HOME"
    }

    def adb = path + "/platform-tools/adb"
    commandLine "$adb", 'shell', 'am', 'start', '-n', 'jangkoo.game.shadowfiend.android/jangkoo.game.shadowfiend.android.AndroidLauncher'
}

// sets up the Android Eclipse project, using the old Ant based build.
eclipse {
    // need to specify Java source sets explicitely, SpringSource Gradle Eclipse plugin
    // ignores any nodes added in classpath.file.withXml
    sourceSets {
        main {
            java.srcDirs "src", 'gen'
        }
    }

    jdt {
        sourceCompatibility = 1.6
        targetCompatibility = 1.6
    }

    classpath {
        plusConfigurations += project.configurations.compile
        containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
    }

    project {
        name = appName + "-android"
        natures 'com.android.ide.eclipse.adt.AndroidNature'
        buildCommands.clear();
        buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
        buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
        buildCommand "org.eclipse.jdt.core.javabuilder"
        buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
    }
}

// sets up the Android Idea project, using the old Ant based build.
idea {
    module {
        sourceDirs += file("src");
        scopes = [ COMPILE: [plus:[project.configurations.compile]]]

        iml {
            withXml {
                def node = it.asNode()
                def builder = NodeBuilder.newInstance();
                builder.current = node;
                builder.component(name: "FacetManager") {
                    facet(type: "android", name: "Android") {
                        configuration {
                            option(name: "UPDATE_PROPERTY_FILES", value:"true")
                        }
                    }
                }
            }
        }
    }
}
</code>
I have searched for few days, but i couldn't find out how to use.
Can anyone tell me where's wrong with my gradle file? It's from libGdx build.
Any solution on this? I can add jar file but not those google libraries.
Comment: Have you tried specifiying the version: `compile 'com.google.android.gms:play-services:7.5.0'` as detailed here https://developers.google.com/android/guides/setup
Comment: Can't add any dependencies? What is the exact error message?
Comment: Error:Could not find any version that matches com.google.android.gms:play-services:+.
Searched in the following locations:
    https://repo1.maven.org/maven2/com/google/android/gms/play-services/maven-metadata.xml ......
Comment: yes, same. I tried with new module all fine, just with this config, don't know what's wrong. It's generated by libgdx.
Answer: I solved my problem by getting nightly builds of Libgdx, create a new project and copy the source from old project. Then import the Android libraries by Android Studio. I think it's because of new Gradle version.


HP MicroServer Gen 8 RAM

Question: So my MicroServer currently have 1x4gb RAM installed in it.
I would like to get this upgraded to the maximum supported, 16GB.
DDR3 ECC 2x8gb is rather expensive. Would the server be happy with non ecc memory so I can get cheaper off-brand RAM?
Answer: From what I know the G8 will work just fine with some of non-ECC Home Server Show thread about it I got an N36L (ye older gen) with 1x8GB and 1x4GB generic RAM and it works for like 6 months now without any hiccups.

HP MicroServer Gen 8 RAM


Uncertainty propagation in linear interpolation

Question: How do I calculate the uncertainties in linearly interpolated values from a given tabulated function?

I am just coming back into the fold after a bit of a hiatus, and am having trouble jumpstarting my brain.
I have a tabulated function $(x_i, y_i, e_i)$, where $x_i$ is on an irregular grid and $e_i$ is the uncertainty in the value of the $y_i$. The datapoints a uncorrelated.
For various reasons, I need to carry out a linear interpolation to put these values onto a regular grid. I have no problems in calculating the interpolated values, but I can't seem to find a way to calculate the uncertainty in the interpolated value. The methods I remember fail to reproduce the tabulated uncertainties (if $x=x_i$), and seem generally clunky.
So, my question:
How do I calculate the uncertainties in linearly interpolated values from a given tabulated function?
Bonus: How to calculate covariances too...
(If you need it to illustrate your point) Some sample data:
xi   yi  ei      x   y  e
1.0  7.0 2       1.0
1.9  8.1 3       2.0
3.1  9.0 4  -->  3.0
4.0 10.3 5       4.0
4.9 11.0 6       5.0
6.2 12.5 7       6.0

Edit: The real data and analysis:
I have x-ray diffraction patterns collected from the same sample with the detector in two (or more) positions, and as such, the irregular x grid for both datasets is different.
I want to add the two (or more) patterns together. The purpose of the addition is to obtain higher intensity, and thus, a higher confidence in the final intensities. The data will then be modelled by the Rietveld method.
In each dataset, there is ~20000 points, of which I've reproduced an indicative subset.
What would be the best method to put all datasets onto a common grid to enable the intensities to be added (taking into account the measurement uncertainties)?
Note:
Most (all) implementations of the Rietveld method assume that the intensities are uncorrelated, which is why I'd also like to be able to calculate the correlations that I'm introducing. At this point in time, I'm going to ignore intensity correlation in my analyses, but I would like to minimise it if possible.
x1             y1            e1              x2         y2           e2           x        y         e
26.699982   257.611938  16.819771       26.699972   206.448425  15.027238       26.7
26.703737   220.754547  15.610549       26.703726   231.364349  15.949701       26.70375
26.707493   222.360214  15.620609       26.707479   246.007446  16.460543       26.7075
26.711248   237.475983  16.173454       26.711233   228.180939  15.793293       26.71125
26.715004   240.830673  16.305054       26.714987   232.759888  16.082907       26.715
26.71876    223.493912  15.632176       26.718739   261.551666  17.050766       26.71875
26.722515   262.328674  17.005249       26.722492   225.026382  15.707023       26.7225
26.726271   228.291 15.732837       26.726246   231.585678  16.034586       26.72625
26.730026   248.281403  16.418236       26.73   241.725464  16.333258       26.73
26.733782   231.120026  15.864223       26.733753   231.883682  16.055712       26.73375
26.737537   239.188919  16.191217       26.737507   242.005142  16.454927       26.7375
26.741293   239.229172  15.99611        26.741261   255.124924  16.882158       26.74125
26.745049   202.675842  14.854559       26.745012   262.2164    17.161072       26.745
26.748804   239.148224  16.121639       26.748766   244.202606  16.573368       26.74875
26.752562   191.03067   14.338655       26.75252    254.840759  16.829659       26.7525
26.756317   236.928757  16.135286       26.756273   232.351868  16.019405       26.75625
26.760073   220.250137  15.574051       26.760027   255.123459  16.750168       26.76
26.763828   237.463058  16.071577       26.763781   232.629074  16.038975       26.76375
26.767584   226.210571  15.687851       26.767534   243.375717  16.346483       26.7675
26.771339   258.652649  16.857044       26.771288   225.64296   15.716341       26.77125
26.775095   254.923645  16.736721       26.775042   237.500946  16.209282       26.775
26.778852   278.621552  17.502522       26.778795   236.081726  16.144192       26.77875
26.782608   209.142868  15.011824       26.782549   247.611633  16.537083       26.7825
26.786364   258.206909  16.859592       26.786303   211.21933   15.235976       26.78625
26.790119   229.081314  15.720976       26.790056   246.538696  16.564161       26.79
26.793875   257.760193  16.797421       26.79381    234.845978  16.230515       26.79375
26.797632   233.179077  16.043262       26.797564   239.260361  16.297928       26.7975
26.801388   241.209442  16.297544       26.801317   262.272491  17.26512        26.80125
26.805143   240.669388  16.293869       26.805071   240.155869  16.292097       26.805
26.808899   287.645905  17.957613       26.808825   262.359009  16.943207       26.80875
26.812656   244.147873  16.433184       26.812578   259.774536  16.899658       26.8125
26.816412   255.581009  16.748405       26.816332   216.269989  15.321012       26.81625
26.820168   243.794861  16.375322       26.820087   238.458344  16.207962       26.82
26.823923   220.18042   15.498717       26.823841   216.359161  15.257962       26.82375
26.827681   238.572983  16.115116       26.827595   232.603851  16.037193       26.8275
26.831436   240.484207  16.147575       26.831348   264.862213  17.206285       26.83125
26.835192   261.019531  16.854525       26.835102   245.935654  16.422411       26.835
26.838949   232.71814   15.875105       26.838856   230.69754   16.041531       26.83875
26.842705   244.266739  16.374409       26.842609   245.167053  16.469751       26.8425
26.84646    270.787384  17.307497       26.846365   253.443481  16.735092       26.84625
26.850216   282.155518  17.636786       26.850119   277.531006  17.620699       26.85
26.853973   265.355927  17.173996       26.853872   259.03952   16.980762       26.85375
26.857729   257.106873  16.916601       26.857626   242.682373  16.365713       26.8575
26.861486   287.789215  17.998287       26.86138    255.16008   16.818199       26.86125
26.865242   261.124512  16.957371       26.865135   252.704788  16.718046       26.865
26.868998   257.830231  16.834381       26.868889   243.115891  16.262362       26.86875
26.872755   276.640381  17.562687       26.872643   253.842941  16.795219       26.8725
26.876511   262.03244   16.95348        26.876396   231.254578  15.941954       26.87625
26.880266   268.417633  17.215582       26.880152   234.510742  16.206791       26.88
26.884024   281.486755  17.655949       26.883905   272.454926  17.481216       26.88375
26.887779   235.749084  15.985992       26.887659   286.539307  17.886707       26.8875
26.891537   235.417145  15.996305       26.891413   249.974762  16.565758       26.89125
26.895292   242.421432  16.314156       26.895168   264.592438  17.155731       26.895
26.899048   263.415894  17.077515       26.898922   264.821533  17.236376       26.89875
26.902805   248.896179  16.558359       26.902676   287.547363  17.982763       26.9025
26.906561   254.223572  16.722179       26.906431   250.62146   16.74309        26.90625
26.910318   264.850677  17.205517       26.910185   252.432877  16.799511       26.91
26.914074   268.862457  17.212996       26.913939   288.753265  17.934757       26.91375
26.917831   284.015381  17.787331       26.917694   266.463898  17.182816       26.9175
26.921587   285.391663  17.782124       26.921448   262.388794  17.172642       26.92125
26.925344   256.088654  16.847933       26.925203   282.458008  17.656187       26.925
26.9291 278.193542  17.568636       26.928957   264.536438  17.119614       26.92875
26.932858   261.607147  16.925268       26.932711   273.392395  17.510523       26.9325
26.936613   293.501556  18.081835       26.936466   241.179169  16.363207       26.93625
26.940371   281.078217  17.598589       26.94022    296.551788  18.337276       26.94
26.944126   277.295685  17.448036       26.943975   264.610352  17.222281       26.94375
26.947884   275.656372  17.435543       26.947729   268.674225  17.29664        26.9475
26.951639   280.630981  17.632053       26.951485   267.253937  17.170872       26.95125
26.955397   310.859436  18.560068       26.955238   295.029663  18.20949        26.955
26.959152   309.720245  18.579161       26.958992   284.24057   17.89658        26.95875
26.96291    254.522202  16.709709       26.962748   319.454041  18.907776       26.9625
26.966667   328.244995  19.204264       26.966501   272.877869  17.509052       26.96625
26.970423   301.559174  18.193857       26.970257   292.79657   18.161213       26.97
26.97418    286.889801  17.815968       26.97401    311.167603  18.728683       26.97375
26.977936   340.261688  19.487011       26.977766   299.764618  18.262012       26.9775
26.981693   296.298218  18.075247       26.98152    344.325958  19.784254       26.98125
26.985451   301.822418  18.299801       26.985275   322.565887  19.127018       26.985
26.989206   304.588318  18.381588       26.989031   288.446136  18.008892       26.98875
26.992964   302.583008  18.287107       26.992785   292.30899   18.098988       26.9925
26.996719   309.682159  18.487858       26.99654    310.9328    18.74452        26.99625
27.000477   296.918793  18.144386       27.000294   290.236755  18.092058       27
27.004234   328.477325  19.130945       27.004049   341.49704   19.674849       27.00375
27.00799    305.255676  18.363239       27.007803   324.09375   19.100769       27.0075
27.011747   331.636841  19.262068       27.011559   349.302277  19.932892       27.01125
27.015505   298.813782  18.232843       27.015314   340.791534  19.633039       27.015
27.01926    377.82962   20.703222       27.019068   333.971771  19.401537       27.01875
27.023018   337.940399  19.406948       27.022823   321.540894  18.975531       27.0225
27.026775   315.944 18.782553       27.026579   351.45636   19.887695       27.02625
27.030531   329.575897  19.110327       27.030333   332.281525  19.417547       27.03
27.034288   395.013153  21.12104        27.034088   354.798248  20.02552        27.03375
27.038046   376.693756  20.584587       27.037844   355.299011  20.054609       27.0375
27.041801   377.918793  20.545406       27.041597   371.191742  20.603811       27.04125
27.045559   379.556 20.583424       27.045353   378.1474    20.748695       27.045
27.049316   353.320923  19.883623       27.049109   359.688446  20.224152       27.04875
27.053074   384.733154  20.791872       27.052862   367.917542  20.361286       27.0525
27.056829   381.299683  20.57424        27.056618   381.987885  20.719294       27.05625
27.060587   394.974365  21.1723     27.060373   396.737946  21.296721       27.06
27.064344   410.550293  21.496117       27.064127   367.995148  20.421124       27.06375
27.068102   398.530121  21.26141        27.067883   382.928436  20.908066       27.0675
27.071857   432.425446  22.100449       27.071638   421.565887  22.011845       27.07125
27.075615   467.759308  23.259808       27.075394   462.320862  23.155806       27.075
27.079372   455.897797  22.65077        27.079149   435.147186  22.45047        27.07875
27.08313    450.400574  22.790157       27.082903   429.493591  22.332462       27.0825
27.086887   452.224335  22.708344       27.086658   487.865631  23.960541       27.08625
27.090643   457.796967  22.896755       27.090414   466.144714  23.226973       27.09
27.0944 525.631104  24.670202       27.09417    475.891571  23.476278       27.09375
27.098158   503.192535  24.212145       27.097923   507.236694  24.462635       27.0975
27.101915   517.572388  24.4188     27.101679   488.699615  23.682343       27.10125
27.105673   496.762482  23.964514       27.105434   486.923187  23.739136       27.105
27.109428   532.518188  24.957394       27.10919    541.927673  25.270697       27.10875
27.113186   533.502869  24.934303       27.112946   509.530853  24.190039       27.1125
27.116943   628.999268  27.041285       27.116701   575.867737  26.024132       27.11625
27.120701   587.537964  26.205851       27.120457   573.836609  25.906281       27.12
27.124458   641.46051   27.382612       27.12421    622.094727  27.276428       27.12375
27.128216   598.144653  26.295834       27.127966   594.514221  26.573986       27.1275
27.131973   646.872864  27.515984       27.131721   682.880066  28.333942       27.13125
27.135731   685.346069  28.378246       27.135477   715.428162  29.170425       27.135
27.139486   705.060852  28.710655       27.139233   701.500671  29.095297       27.13875
27.143244   742.444946  29.799131       27.142988   743.038147  29.763405       27.1425
27.147001   739.384155  29.611042       27.146744   742.684509  29.910776       27.14625
27.150759   756.785889  30.014313       27.150499   813.66803   31.310173       27.15
27.154516   811.989807  31.013382       27.154255   857.058044  32.132923       27.15375
27.158274   862.963013  32.065449       27.15801    805.47345   31.155424       27.1575
27.162031   859.406433  32.093735       27.161766   875.511963  32.665203       27.16125
27.165789   895.645935  32.995667       27.165522   915.463867  33.07769        27.165
27.169546   969.672363  34.077866       27.169277   996.215515  34.755962       27.16875
27.173304   1032.02478  35.365906       27.173033   996.287354  34.484081       27.1725
27.177061   1101.285034 36.482513       27.176788   1097.823242 36.574898       27.17625
27.180819   1089.692505 36.372944       27.180544   1172.005981 38.15443        27.18
27.184576   1233.372925 39.165882       27.184299   1213.508423 38.770805       27.18375
27.188334   1286.500488 40.216381       27.188055   1316.095947 40.561798       27.1875
27.192091   1351.022949 41.322506       27.191811   1444.984009 42.750305       27.19125
27.195848   1410.998779 42.263809       27.195566   1474.066528 43.096645       27.195
27.199606   1605.868286 45.268463       27.199322   1485.535522 43.290718       27.19875
27.203363   1670.843506 46.438526       27.203077   1600.005127 44.899033       27.2025
27.207121   1852.570068 48.931038       27.206833   1712.454712 46.573402       27.20625
27.210878   1949.015503 50.506145       27.210588   1849.947876 48.792233       27.21
27.214636   1991.649902 51.212296       27.214344   2024.669678 51.460781       27.21375
27.218393   2165.216553 53.421818       27.2181 2088.17041  51.730793       27.2175
27.222151   2337.598877 55.876877       27.221855   2346.668457 55.977787       27.22125
27.225908   2473.485596 57.56147        27.225611   2412.149414 56.592995       27.225
27.229666   2797.586426 61.769291       27.229368   2696.092773 60.324032       27.22875
27.233423   2991.792969 64.599525       27.233124   2909.843506 63.37001        27.2325
27.237181   3118.806885 65.786011       27.236879   3074.491699 65.597015       27.23625
27.240938   3504.134521 70.3414     27.240635   3375.719727 68.693611       27.24
27.244696   3891.235352 75.364098       27.24439    3758.651611 73.219566       27.24375
27.248453   4244.597168 79.501091       27.248146   4025.467773 76.340263       27.2475
27.252211   4531.950195 82.043549       27.251902   4374.370605 80.199883       27.25125
27.255968   4912.705566 85.931183       27.255659   4829.439941 84.864685       27.255
27.259726   5583.304688 93.659035       27.259415   5185.368652 88.253494       27.25875
27.263483   5801.212402 94.912148       27.26317    5837.462402 95.271805       27.2625
27.267242   6527.44873  101.581688      27.266926   6164.637207 97.746201       27.26625
27.271  7149.898438 107.501686      27.270681   6996.065918 105.987755      27.27
27.274757   8024.799805 115.727562      27.274439   7717.926758 113.278625      27.27375
27.278515   8782.509766 122.771156      27.278194   8513.098633 120.068474      27.2775
27.282272   9776.30957  130.636856      27.28195    9582.835938 129.320023      27.28125
27.28603    10684.06055 138.121933      27.285706   10629.82422 138.458023      27.285
27.289787   12160.97461 150.254181      27.289463   11498.96484 145.095963      27.28875
27.293545   13230.85352 159.008743      27.293219   13194.12207 157.515976      27.2925
27.297304   14882.88086 170.719299      27.296974   14356.03418 166.620728      27.29625
27.301062   16311.61523 180.528198      27.30073    15988.86719 178.297455      27.3
27.304819   18470.22266 196.541138      27.304487   17430.61523 188.006866      27.30375
27.308577   18905.74023 199.37529       27.308243   18763.6582  196.852402      27.3075
27.312334   19843.95898 206.008362      27.311998   19107.41602 199.18042       27.31125
27.316092   19446.24805 202.544922      27.315756   19581.70898 202.482391      27.315
27.319851   18449.27148 195.371994      27.319511   18548.38477 196.500046      27.31875
27.323608   17099.03516 185.706924      27.323267   17395.10156 188.679016      27.3225
27.327366   15468.32129 174.745087      27.327023   15864.07031 177.236633      27.32625
27.331123   13734.60449 161.846298      27.33078    14618.6084  169.099823      27.33
27.334881   12631.53125 152.229172      27.334536   12794.08008 155.524338      27.33375
27.33864    11271.24707 142.581253      27.338293   11787.24023 148.055161      27.3375
27.342398   10512.77539 136.916977      27.342049   10371.50879 135.465714      27.34125
27.346155   9237.021484 126.318268      27.345804   9684.5  129.716415      27.345
27.349913   8405.818359 119.341942      27.349562   8767.294922 122.610458      27.34875
27.353672   7818.925781 113.856117      27.353317   8091.36377  115.909096      27.3525
27.35743    7115.508301 108.37809       27.357073   7147.862305 107.73645       27.35625
27.361187   6415.062012 100.436485      27.36083    6645.275391 103.097359      27.36
27.364944   5803.602051 95.109955       27.364586   5926.142578 95.61367        27.36375
27.368704   5287.605957 89.370728       27.368343   5482.560059 91.383064       27.3675
27.372461   4909.004395 85.33609        27.372099   4844.45459  85.257843       27.37125
27.376219   4367.385742 79.370476       27.375854   4488.047852 81.663086       27.375
27.379976   3993.688721 75.518738       27.379612   4184.442383 78.276047       27.37875
27.383736   3681.97876  72.029762       27.383368   3660.422119 72.288017       27.3825
27.387493   3425.320801 69.451126       27.387125   3500.459961 70.925537       27.38625
27.391251   3095.907471 65.610405       27.390881   3144.00415  66.149261       27.39
27.39501    2904.301758 63.035709       27.394638   2957.160156 64.107269       27.39375
27.398767   2597.830811 59.3172     27.398394   2628.188721 59.741573       27.3975
27.402525   2454.955566 57.157295       27.402151   2406.833252 56.985153       27.40125
27.406284   2210.20874  54.052696       27.405907   2295.345947 55.378689       27.405
27.410042   2074.173096 52.329163       27.409664   2135.306641 52.890289       27.40875
27.413799   1886.714233 49.559029       27.41342    1919.739868 50.086132       27.4125
27.417559   1770.544434 47.881283       27.417177   1816.12146  48.338406       27.41625
27.421316   1557.283813 44.360882       27.420933   1684.497192 46.274689       27.42
27.425074   1503.644043 43.386501       27.42469    1542.882446 44.166553       27.42375
27.428833   1377.763306 41.332214       27.428446   1567.353882 44.635925       27.4275
27.43259    1353.757812 40.70454        27.432203   1396.887451 41.758747       27.43125
27.436348   1170.140991 37.721062       27.435959   1336.477661 40.869045       27.435
27.440107   1180.836548 38.067421       27.439716   1239.929199 39.100754       27.43875
27.443865   1147.78894  37.471424       27.443474   1160.866455 37.903599       27.4425
27.447622   1058.838013 35.651024       27.447229   1054.965942 35.629913       27.44625
27.451382   1044.922241 35.50663        27.450987   1013.544983 35.041023       27.45
27.455139   981.188721  34.571899       27.454742   927.535461  33.372013       27.45375
27.458899   875.704956  32.246819       27.4585 905.684937  32.86861        27.4575
27.462656   865.433899  32.310036       27.462257   917.381287  33.185966       27.46125
27.466413   885.555725  32.773746       27.466013   823.479797  31.281075       27.465
27.470173   834.432922  31.544697       27.46977    781.178345  30.347902       27.46875
27.47393    731.929443  29.260817       27.473526   759.411682  29.847685       27.4725
27.47769    698.259766  28.603771       27.477283   708.03717   28.836737       27.47625
27.481447   687.848328  28.403528       27.481041   705.581177  28.773079       27.48
27.485207   678.07135   28.106058       27.484797   652.00238   27.51049        27.48375
27.488964   610.292725  26.522755       27.488554   651.322815  27.606476       27.4875
27.492722   631.037537  27.175158       27.492311   624.520813  26.990871       27.49125
27.496481   523.445618  24.470995       27.496067   583.280762  26.098219       27.495
27.500238   582.989319  25.97337        27.499825   522.271545  24.460474       27.49875
27.503998   552.380798  25.282471       27.503582   555.14447   25.34499        27.5025
27.507755   547.555786  25.190542       27.507338   488.443329  23.549656       27.50625
27.511515   517.328491  24.430441       27.511095   532.32251   24.760672       27.51
27.515272   575.333679  25.930967       27.514853   497.951385  23.879543       27.51375
27.519032   512.204834  24.226938       27.518608   512.114502  24.152409       27.5175
27.522789   495.360992  23.918774       27.522366   456.453064  22.703745       27.52125
27.526548   466.525665  23.121805       27.526123   510.131897  24.172394       27.525
27.530306   457.033813  22.80759        27.529881   466.042755  23.023245       27.52875
27.534065   459.896362  22.758112       27.533636   419.527649  21.644688       27.5325
27.537823   461.733063  22.827629       27.537394   447.970917  22.637915       27.53625
27.541582   452.128998  22.628756       27.541151   387.796875  20.855265       27.54
27.54534    412.326538  21.644251       27.544909   446.473572  22.585011       27.54375
27.549099   398.742493  21.326605       27.548664   415.603424  21.639071       27.5475
27.552856   424.974548  22.037888       27.552422   384.086853  20.945688       27.55125
27.556616   410.101379  21.549911       27.556179   393.997864  20.959766       27.555
27.560373   384.349487  20.824251       27.559937   414.126709  21.79455        27.55875
27.564133   406.186279  21.521414       27.563694   361.580261  20.164911       27.5625
27.56789    360.696869  20.141962       27.56745    374.833771  20.588844       27.56625
27.57165    360.720215  20.143303       27.571207   357.429138  20.093407       27.57
27.575407   351.623444  19.897425       27.574965   374.868317  20.701504       27.57375
27.579166   408.509186  21.463638       27.578722   371.973999  20.481779       27.5775
27.582924   335.177002  19.386414       27.582479   334.185669  19.414314       27.58125
27.586683   342.521362  19.56319        27.586235   366.800964  20.464724       27.585
27.590443   346.306213  19.587896       27.589993   331.174438  19.351027       27.58875
27.5942 331.486481  19.224245       27.59375    334.341888  19.308029       27.5925
27.59796    338.926971  19.40839        27.597507   349.915955  19.882914       27.59625
27.601717   291.329834  17.975086       27.601265   352.604065  19.898081       27.6
27.605476   358.433655  20.067392       27.605022   310.955994  18.565992       27.60375
27.609236   334.920197  19.429049       27.60878    303.003632  18.373362       27.6075
27.612993   287.238342  17.838184       27.612537   323.746307  19.020924       27.61125
27.616753   306.155426  18.448715       27.616293   319.403442  18.8167     27.615
27.62051    313.259705  18.827635       27.62005    305.238556  18.543093       27.61875
27.624269   298.106781  18.218935       27.623808   326.727875  19.142216       27.6225
27.628029   336.71228   19.448822       27.627565   308.32016   18.582729       27.62625
27.631786   325.233154  18.965395       27.631323   286.17688   17.770529       27.63
27.635546   311.634796  18.637335       27.63508    294.259491  18.037977       27.63375
27.639303   304.706024  18.388884       27.638838   295.109406  18.122005       27.6375
27.643063   305.301941  18.395889       27.642595   277.055817  17.6217     27.64125
27.646822   313.338776  18.772058       27.646353   289.719177  17.842659       27.645
27.650579   298.848236  18.174519       27.65011    310.301422  18.55541        27.64875
27.654339   265.391693  16.953909       27.653868   267.216339  17.073452       27.6525
27.658098   272.78064   17.280085       27.657625   304.284027  18.332893       27.65625
27.661856   305.482086  18.407038       27.661383   275.859741  17.511847       27.66
27.665615   296.386871  18.080801       27.66514    272.589233  17.457758       27.66375
27.669374   260.02832   16.916584       27.668898   271.612976  17.425808       27.6675
27.673132   310.00769   18.44916        27.672655   284.807159  17.838223       27.67125
27.676891   293.63327   17.998568       27.676413   282.919739  17.716915       27.675
27.680651   295.854095  18.017424       27.68017    301.875092  18.394066       27.67875
27.684408   272.622864  17.36412        27.683928   276.695435  17.471575       27.6825
27.688168   276.579803  17.340225       27.687685   276.434875  17.517595       27.68625
27.691927   270.084076  17.135855       27.691442   283.377045  17.777632       27.69
27.695684   254.886475  16.669485       27.6952 265.695068  17.099983       27.69375
27.699444   265.606781  17.094158       27.698957   263.489441  17.05014        27.6975
27.703203   281.023895  17.533472       27.702715   252.295532  16.62472        27.70125
27.706961   285.609985  17.703798       27.706472   277.086731  17.465652       27.705
27.71072    298.809174  18.112206       27.71023    280.543213  17.689232       27.70875
27.714479   260.353058  16.87396        27.713987   250.574188  16.573614       27.7125
27.718237   276.885193  17.45262        27.717745   259.199097  16.861282       27.71625
27.721996   236.178192  16.015791       27.721502   301.490356  18.400581       27.72
27.725756   247.770172  16.481607       27.72526    261.563324  17.117252       27.72375
27.729515   276.269745  17.475348       27.729017   262.837189  17.039047       27.7275
27.733273   240.565948  16.153196       27.732775   259.085907  16.885988       27.73125
27.737032   281.739594  17.579294       27.736532   313.839417  18.863436       27.735
27.740791   273.610931  17.302837       27.74029    260.170776  16.926085       27.73875
27.744551   268.404846  17.246708       27.744049   283.201477  17.642088       27.7425
27.748308   254.902618  16.767962       27.747807   245.388168  16.384956       27.74625
27.752068   268.374359  17.212734       27.751564   274.828735  17.444706       27.75
27.755827   282.476166  17.657354       27.755322   235.657654  16.148746       27.75375
27.759586   257.19696   16.759798       27.759079   264.412659  17.079205       27.7575
27.763344   253.514648  16.641918       27.762836   287.414459  17.849409       27.76125
27.767103   285.195831  17.738724       27.766594   265.933838  17.179968       27.765
27.770863   272.149536  17.270281       27.770351   246.45018   16.558067       27.76875
27.774622   220.818451  15.475125       27.774111   261.313141  17.002283       27.7725
27.778379   258.381226  16.838909       27.777868   240.765503  16.233316       27.77625
27.782139   225.21434   15.685786       27.781626   256.711212  16.857025       27.78
27.785898   231.654419  15.935867       27.785383   265.196808  17.131144       27.78375
27.789658   234.376343  16.058842       27.789141   292.645447  18.058426       27.7875
27.793417   261.384705  16.942513       27.792898   246.895554  16.454943       27.79125
27.797174   251.88031   16.629318       27.796658   233.284836  15.94837        27.795
27.800934   244.516464  16.358343       27.800415   225.843765  15.661814       27.79875
27.804693   263.893402  17.044815       27.804173   233.660446  16.008617       27.8025
27.808453   247.052444  16.432692       27.80793    220.580353  15.527525       27.80625
27.812212   236.569031  16.07646        27.811687   245.471848  16.292435       27.81
27.815969   253.395264  16.601618       27.815447   241.774445  16.269558       27.81375
27.819729   263.030884  16.892704       27.819204   263.268127  17.067692       27.8175
27.823488   223.847458  15.520136       27.822962   260.296112  16.966854       27.82125
27.827248   211.959488  15.183031       27.826719   268.057983  17.255955       27.825
27.831007   247.711182  16.510641       27.830479   253.73201   16.721733       27.82875
27.834764   217.858749  15.366168       27.834236   237.723114  16.293709       27.8325
27.838524   244.396072  16.350092       27.837994   244.308258  16.311089       27.83625
27.842283   234.730118  16.015654       27.841751   242.190506  16.331738       27.84
27.846043   227.770309  15.7642     27.84551    230.195328  15.799245       27.84375
27.849802   228.575867  15.821275       27.849268   240.061096  16.118477       27.8475
27.853561   263.276672  17.068258       27.853025   206.348511  14.841624       27.85125
27.857321   250.560776  16.572704       27.856783   206.536362  14.8906     27.855
27.861078   239.218353  16.159765       27.860542   235.019913  15.935363       27.85875
27.864838   247.305298  16.384516       27.8643 236.672928  16.083691       27.8625
27.868597   252.726212  16.524702       27.868057   261.304108  16.969328       27.86625
27.872356   235.50386   15.968966       27.871817   231.001572  15.855899       27.87
27.876116   215.917114  15.295437       27.875574   247.365158  16.487011       27.87375
27.879875   213.492035  15.25972        27.879332   245.987518  16.360123       27.8775
27.883635   229.914215  15.745885       27.883091   253.841843  16.696445       27.88125
27.887392   229.421692  15.846799       27.886848   213.708725  15.311213       27.885
27.891151   236.662079  16.150654       27.890606   241.196442  16.296644       27.88875
27.894911   213.46492   15.187263       27.894365   239.802856  16.267569       27.8925
27.89867    237.516998  16.176313       27.898123   220.771957  15.506441       27.89625
27.90243    234.038055  16.001099       27.90188    242.23735   16.235064       27.9
27.906189   220.551498  15.560532       27.90564    206.81221   14.946399       27.90375
27.909948   250.02037   16.568855       27.909397   247.377335  16.324753       27.9075
27.913708   243.975861  16.354435       27.913155   228.919266  15.743267       27.91125
27.917467   239.123169  16.220346       27.916914   249.639938  16.543022       27.915
27.921225   243.559311  16.292747       27.920671   238.668793  16.155157       27.91875
27.924984   235.045685  16.003975       27.924429   244.874649  16.2843     27.9225
27.928743   235.891724  15.962676       27.928188   214.899094  15.256536       27.92625
27.932503   219.885284  15.408209       27.931946   254.30809   16.793606       27.93
27.936262   260.085693  16.952793       27.935705   211.037003  15.115447       27.93375
27.940022   242.985474  16.353039       27.939463   219.61763   15.5637     27.9375
27.943781   239.24585   16.262785       27.94322    211.325806  15.280083       27.94125
27.94754    231.566666  15.963982       27.94698    220.791534  15.542738       27.945
27.9513 260.656036  16.990906       27.950737   231.810532  15.878859       27.94875
27.955059   262.265228  17.098459       27.954496   227.132797  15.75332        27.9525
27.958818   215.683334  15.313498       27.958254   231.602097  15.932183       27.95625
27.962578   220.570541  15.561907       27.962013   264.902496  17.04768        27.96
27.966337   254.470688  16.804611       27.965771   232.680267  15.906054       27.96375
27.970097   244.5896    16.264879       27.969528   230.648224  15.933537       27.9675
27.973854   245.162506  16.36952        27.973288   225.606033  15.679212       27.97125
27.977613   234.010452  15.999166       27.977045   256.237213  16.792482       27.975
27.981373   213.115234  15.127      27.980804   228.330688  15.838371       27.97875
27.985132   219.218826  15.570371       27.984562   248.798157  16.584879       27.9825
27.988892   210.154175  15.121605       27.988321   208.729065  15.124132       27.98625
27.992651   197.702744  14.699856       27.992079   220.896011  15.620786       27.99
27.99641    234.040497  16.069506       27.995838   227.315704  15.766306       27.99375
28.00017    211.508118  15.221255       27.999596   224.617126  15.747621       27.9975
                28.003355   236.759277  16.157446       28.00125

Comment: If the "uncertainties" are really larger than differences among the $y_i$--as illustrated here--then it may be better to fit a simple model to the data rather than interpolating linearly. The interpolation makes sense when the uncertainties are relatively small. However, please be aware that the uncertainties of the interpolated values will then be *autocorrelated*; whether or not you have to deal with that depends on what follow-up calculations are done on the grid. Might I suggest you tell us what you *ultimately* want to do with these data so we can provide advice that's suitable?
Comment: Actually (@Mike) we can migrate it there, if we decide it is off topic here. If you think that's the case, just vote to close it.
Comment: I didn't know they existed! If you're able to migrate it, go for it.
Comment: If you interpolate y for values of x and y that are in the table and propagate the uncertainty you will not get the the value of e in the table. For example, if you interpolate the value of y for x = 1.9 you will get y = 8.1 but you will get something larger than 3 as the uncertainty.
Comment: @whuber I've added some more info and some real data for you. This is my first real attempt at a strict analysis at the implications of my data manipulation, so any help is most appreciated.
Comment: Thanks (+1). Because your table is unusual, let's check its interpretation. It contains *three* datasets: the columns (x1, y1, e1) are one dataset where (a) the values of `x1` were *set by the experimenter* (and should not be treated as uncertain), (b) the values of `y1` are observations associated with the `x1` values, and (c) the values of `e1` are estimated *standard deviations* of `y1`. Columns (x2, y2, e2) are another *independent* dataset. Column `x` is a regular grid of values for which the interpolated sum of `y1` and `y2` is desired. Please correct anything wrong in these statements.
Comment: It would also be useful to know (a) how the "uncertainties" are obtained and (b) what the supports of the observations are. (Presumably a detector has some spatio-temporal extent, whence it records some weighted average value within its space-time window, or "support." How big are those windows compared to the spacing in the $x$ direction?)
Comment: @whuber All of your assumptions are correct. To answer your questions: I don't know. I don't know how the uncertainties are generated in the first place. I don't know what the physical size of the detector elements are with respect to their spacing.

I'll see what I can find out.
Comment: Just a note for those that come to this later. Many Rietveld implementations assume that the data is on a regular grid for historical reasons.
Answer: Typically the uncertainties from counting measurements are made using Poisson statistics. The standard deviation of such a distribution is just the square root of the counts. I am not sure why your uncertainties are slightly off from this.
Why do you need to interpolate the data at all? I am not too familiar with Reitveld refinement, but why don't you just merge the datasets? You gain no statistical power by adding together two data points. For example, even if you had two independent measurements at the same x value, there is nothing gained by averaging the counts other than making prettier plots of the diffraction data.
Finally, are the x positions actually different? I assume you ran the same scan twice. The slight differences in the x values in the data are either from the instrument having higher accuracy in measuring position than in its motors or it is just a result in always writing out the data to a precision higher than merited. Either way, treating the x-values as the same introduces very little affect on your uncertainties. If you treat the range of x-values as the uncertainty in the x-position and estimate this contribution to uncertainty in y by looking at the local slope, you'll see that it is ~3 orders of magnitude lower than the counting uncertainty.
Were I do this, I would merge the data and just have twice the data points. If for some reason you cannot do this, I would just take the average x-value as doing so introduces negligible error.


Magento's cron.php: Persistent or not? Why putting it into cron?

Question: I have a question regarding Magento.
Apparently, to perform scheduled tasks within Magento, it needs to run a script called cron.php. Originally the script was triggered by an on-server crontab using the line wget -O /dev/null http://www.example.com/cron12345.php.
Unfortunately, due to some problems, we need to limit the life of the PHP FPM child processes to 300 seconds... and that murdered the PHP process running cron.php.
I tried running cron.php from CLI using the command php -c /etc/php5/fpm/php.ini cron.php and it seemed to work... but there were no output and the script just keeps running...
So my questions:

Is cron.php a one-shot script, or does it run until completion and needs to be invoked again?
If it needs to be regularly invoked (via cron), can I just add a crontab like the following:

*/15 * * * * cd /var/www/website && php -c /etc/php5/fpm/php.ini cron.php

Thank you for your kind assistance.
Answer:
It should finish, it can take some time especially if you didn't run it in a while.
But generally it will finish. If it doesn't you'll need to check what is going on.
Yes, that is how this is generally done, see:
http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job
Comment: Omigosh, apparently I accidentally added "-d" before `cron.php` ... no wonder it seems to be just stuck there --__--  ... thank you for the answer!
Answer: In the above code, you have declared the version of our module and the model class. The important part is the  element. I use it to configure the cron job. here you will find the full guide: https://www.cloudways.com/blog/setup-magento-cron-job/
Comment: Welcome to Server Fault! Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.


Rank of Linear Operators Applied to Polynomial

Question: Let $F$ be a field and $V$ be a finite dimensional vector space. Suppose $T,S:V \longrightarrow V$ are two linear maps that are conjugate. Now consider some $f(x) \in F[x]$. I want to show that the rank of the maps $f(T),f(S): V \longrightarrow V$ are the same. First, we note that by the Rank-Nullity theorem,
$dim(Ker(f(T))) + dim(Im(f(T))) = dim(Ker(f(S))) + dim(Im(f(S)))$
and thus, $rnk(f(T)) = rnk(f(S))$ if and only if $null(f(T)) = null(f(S))$. Therefore, I am trying to show that the kernel of $f(T)$ is equal to the kernel of $f(S)$.
I begin with the fact that $Ker(f(T)) = \{v \in V | f(T)(v) = 0\}$. Similarly for $Ker(f(S))$. Not sure how to proceed.
Comment: Hint: You know that $T$ and $S$ are conjugate. What about $f(T)$ and $f(S)$?
Comment: When you write conjugate, do you mean $\langle Ax, y \rangle = \langle x, A^\ast y \rangle$ like [this](http://en.wikipedia.org/wiki/Hermitian_adjoint)?
Comment: @MattN. what the heck is $A$?
Comment: @froggie $f(T)$ and $f(S)$ would be conjugate as well...but how would this help with rank?
Comment: @MattN. when I say conjugate, I mean there exists an invertible linear map $R$ such that $T=RSR^{-1}$
Comment: @afedder Oh! Right. Sorry for the confusion. $A$ in what I wrote was supposed to denote $T$.
Answer: As you said in the comments, $f(S)$ and $f(T)$ are conjugate linear transformations. So the problem boils down to proving the following statement:

Suppose $A$ and $B$ are linear maps $V\to V$ that are conjugate, say $B = RAR^{-1}$. Then the rank of $A$ and $B$ are the same.

To prove this, we must show that the rank of $A$ and $RAR^{-1}$ are the same. Since $R^{-1}$ is invertible, it is surjective. Therefore the image of $AR^{-1}$ is the same as the image of $A$. We can then conclude that the image of $RAR^{-1}$ is $R(Im(A))$. But since $R$ is invertible, the dimension of $R(Im(A))$ is the same as the dimension of $Im(A)$. This proves that the rank of $RAR^{-1}$ is the same as the rank of $A$.


Cannot install hiredis on heroku

Question: I'm unable to install hiredis on heroku, although I use a custom build pack to install hiredis beforehand (https://github.com/keiko713/heroku-buildpack-hiredis). How can I fix that?
Here is part of my log when I do git push:
<code>       Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/bin/ruby extconf.rb
   cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings true  net.c
   cc: error: true: No such file or directory
   make: *** [net.o] Error 1
   *** extconf.rb failed ***
   Could not create Makefile due to some reason, probably lack of necessary
   libraries and/or headers.  Check the mkmf.log file for more details.  You may
   need configuration options.

   Provided configuration options:
   --with-opt-dir
   --without-opt-dir
   --with-opt-include
   --without-opt-include=${opt-dir}/include
   --with-opt-lib
   --without-opt-lib=${opt-dir}/lib
   --with-make-prog
   --without-make-prog
   --srcdir=.
   --curdir
   --ruby=/tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/bin/ruby
   extconf.rb:25:in `block in <main>': Building hiredis failed (RuntimeError)
   from extconf.rb:23:in `chdir'
   from extconf.rb:23:in `<main>'

   extconf failed, exit code 1

   Gem files will remain installed in /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/hiredis-0.5.2 for inspection.
   Results logged to /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/hiredis-0.5.2/gem_make.out
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in `block in build'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/tempfile.rb:324:in `open'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/installer.rb:677:in `build_extensions'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/ruby-2.1.5/lib/ruby/2.1.0/rubygems/installer.rb:232:in `install'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/source/rubygems.rb:112:in `block in install'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/rubygems_integration.rb:130:in `preserve_paths'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/source/rubygems.rb:105:in `install'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:104:in `block in install_gem_from_spec'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/rubygems_integration.rb:162:in `with_build_args'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:103:in `install_gem_from_spec'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:282:in `block in install_in_parallel'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:42:in `call'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:42:in `block (2 levels) in prepare_workers'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:35:in `fork'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:35:in `block in prepare_workers'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `times'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `each'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `map'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `prepare_workers'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/worker.rb:20:in `initialize'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:20:in `initialize'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers.rb:14:in `new'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers.rb:14:in `worker_pool'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:280:in `install_in_parallel'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:88:in `run'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:18:in `install'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/cli/install.rb:79:in `run'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/cli.rb:145:in `install'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor/command.rb:27:in `run'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor.rb:363:in `dispatch'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor/base.rb:440:in `start'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/cli.rb:9:in `start'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/bin/bundle:20:in `block in <top (required)>'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/bin/bundle:18:in `<top (required)>'
   vendor/bundle/ruby/2.1.0/bin/bundle:19:in `load'
   vendor/bundle/ruby/2.1.0/bin/bundle:19:in `<main>'
   Installing multi_json 1.10.1
   2:  multi_json (1.10.1) from /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/specifications/multi_json-1.10.1.gemspec
   Installing msgpack 0.5.8
   0:  msgpack (0.5.8) from /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/specifications/msgpack-0.5.8.gemspec
   An error occurred while installing hiredis (0.5.2), and Bundler cannot continue.
   Make sure that `gem install hiredis -v '0.5.2'` succeeds before bundling.
   Bundler::InstallError: An error occurred while installing hiredis (0.5.2), and Bundler cannot continue.
   Make sure that `gem install hiredis -v '0.5.2'` succeeds before bundling.
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:139:in `rescue in install_gem_from_spec'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:99:in `install_gem_from_spec'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:282:in `block in install_in_parallel'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:42:in `call'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:42:in `block (2 levels) in prepare_workers'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:35:in `fork'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:35:in `block in prepare_workers'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `times'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `each'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `map'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:31:in `prepare_workers'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/worker.rb:20:in `initialize'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers/unix_worker.rb:20:in `initialize'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers.rb:14:in `new'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/parallel_workers.rb:14:in `worker_pool'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:280:in `install_in_parallel'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:88:in `run'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/installer.rb:18:in `install'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/cli/install.rb:79:in `run'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/cli.rb:145:in `install'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor/command.rb:27:in `run'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor.rb:363:in `dispatch'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/vendor/thor/base.rb:440:in `start'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/cli.rb:9:in `start'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/bin/bundle:20:in `block in <top (required)>'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
   /tmp/build_0abffd570b6a7e2e235d97d5906bfb5c/vendor/bundle/ruby/2.1.0/gems/bundler-1.7.12/bin/bundle:18:in `<top (required)>'
   vendor/bundle/ruby/2.1.0/bin/bundle:19:in `load'
   vendor/bundle/ruby/2.1.0/bin/bundle:19:in `<main>'
</code>
!
Answer: I have the same issue. I found in make file in hiredis exists lines
DEBUG?= -g -ggdb
REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG) $(ARCH)
in my env variable DEBUG was setted to true. And compile was performed with broken flat true.

Cannot install hiredis on heroku


Finding the global maxima when 1st derivative has a singularity?

Question: Let $f$ be real function which is differentiable everywhere except at a finite set of singularity point $S$.
Assume that $\lim_{x\to \alpha} f(x) = -\infty$ for every $\alpha \in S$. Is it possible to prove that the global maxima is a local maxima? (i.e it can be found with the first and second derivative test?)
I'm not very strong in analysis so any help would be appreciated, thanks.
Answer: No. After the last singularity point, the function could increase so $\lim_{x\to\infty}f(x)=\infty$. Here, there would be no global maximum. If a global maximum exists, it occurs at a local maximum since this is true of all differentiable functions.
Comment: Thank you for answering. It just so happen that in the function I'm working with, there is the global maximum. I also think that it occurs at a local maximum. But I can't prove it.


Como configurar apache2 para python 3.5.2

Question: Tenho tentado estudar programação para web com Python, mas não consigo configurar o servidor no meu computador, alguém pode me ajudar? Seja me indicando como configurar ou me fornecendo um local para baixar já configurado (de preferência como configurar, não quero ficar dependente). Desde já agradeço.
Quando tento rodar o localhost para ver o resultado, aparece o seguinte código:
#!C:/Program Files/Python35
import cgitb
cgitb.enable()

# Print necessary headers.
print("Content-Type: text/html")
print()

print("
Olá Mundo
")

Answer: Entendendo por que não se usa mais CGI
Essa configuração que você quer não é tão difícil - mas me reservo o direito de não responde-la de imediato (em uma atualização, adicionei essa informação ao final da resposta)
Quem está acostumado com PHP, ou acha documentação antiga - ou mesmo procura por programação Web na biblioteca padrão do Python, pode, como você, acabar achando que se usa Python com CGI ainda hoje.
Isso não é mais verdade. Há uns 8 anos, pelo menos. CGI é um modelo de aplicação pra Web que existe desde os primeiros tempos de dos servidores como o Apache - e a ideia é que em vez do servidor Web servir um arquivo estático do disco, ele executa um outro programa completo, e a saída desse programa (isso é, tudo o que ele imprime na saída padrão) é o conteúdo enviado na resposta à requisição HTTP. O custo (CPU, memória, acesso a disco, etc...) de se iniciar todo o runtime do Python num processo a parte, carregar o programa todo, para resposta a uma única página é algo completamente inaceitável - quase impensável, hoje em dia.
Com uma outra coisa que é bem diferente de hoje: cada programa se localiza fisicamente no sistema de arquivos na posição dada pela URL: ou seja, para um sistema com várias views diferentes, você teria um programa distinto para cada view.
Os conceitos - e alguns pacotes, usados hoje para Python para Web
Então o "jeito certo" de se programar Python para Web hoje em dia é usar um Framework já pronto. Em geral os Frameworks utilizam, internamente, um protocolo do Python chamado "WSGI" (Web Server Gateway Interface) - através desse protocolo se conecta a estrutura do Python com um servidor HTTP externo, se for desejado - como o apache ou o nginx.
Mas melhor ainda: para estudar e desenvolver o protótipo do seu sistema   - e mesmo para colcoar em produção em alguns casos, você não precisa configurar esse servidor externo.  Há projetos em Python puro, e outros em C que podem servir um projeto com WSGI diretamente na Web - como uWSGI, gUnicorn dentre outros - e a conexão final com o Apache, no caso, é feita com o Mod_WSGI.
Mas, voltando aos Frameworks: eles são projetos que provêm uma infraestrutura, bibliotecas, e várias utilidades, dentre funções e classes para permitir o desenvolvimento de uma aplicação Web moderna. Em Python existem dezenas de Frameworks -  e certamente mais de 10 em desenvolvimento ativo e mantidos atualizados.
Dentre os mais populares estão o Flask e o Django. Mas ha'outros como Web2py, Bottle, Pyramid, etc... cada um com alguams caracterpsiticas próprias.  Alguns, como o Flask e o Bottle são conhecidos como "microframeworks" por que trazem de forma rápida tudo o  que você precisa para começar um aplicação Web - mesmo que seja simples. Não obrigam ao uso de um banco de dados, nem suporte a login de usuários, etc... Mas todas essas coisas são "plugáveis" através de outros projetos bem mantidos e integrados.
Então, é algo bem subjetivo, mas dentre os vários existentes, eu diria que o Flask pode ser um jeito de começar a estudar Python para Web.
Passo a passo para um "alô mundo" Web - Python + Flask
Para criar um "Alô mundo" WEB com Flask siga esses passos (no Linux - Windows é mais chato para linha de comando - mas são os mesmos passos, adaptando-se os prefixos de diretórios, etc... (Pode ser C:\Python3\bin\Python, em vez de apenas python3, por exemplo):
1) Com o Python 3.5 ou posterior instalado, crie um virtualenv com o comando:
python3 -m venv alomundo. Em seguida, ative o seu ambiente virtual: cd alomundo, source bin/activate.  Pronto, agora você pode isntalar uma versão do Flask que fica independe da instalação do Python do seu sistema - permitindo que você trabalhe com projetos diferentes que usem versões distintas do Flask e de outros pacotes
2) Digite pip install flask - isso vai trazer o flask e todos os pacotes que são necessários para sua execução - inclusive um servidor web de teste -  o Waitress.
3) Digite o seu programa que pode ser algo como:
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello():
    return("
Alô mundo!
")

if __name__ == "__main__":
    app.run()

(Você vai ter que fazer o tutorial e estudar a documentação do Flask, mas uma grande diferença aqui para quem vem do PHP: O nome do seu arquivo é 100% independente do que aparece na URL - é no decorador que precede a função de view hello que eu coloco o caminho da URL ao qual essa view responderá)
Apesar de tudo - como configurar CGI no Apache
Você precisa editar algumas configurações no seu httpd.conf do apache  -
a forma mais simples é mandar carregar o mod_cgi e usar uma diretiva script-alias que transforma uma parte da URL num mapeamento para um diretório específico. Aí, todos os arquivos nesse diretório passam automaticamente a serem executados como scripts CGI, em vez de serem servidos diretamente.
No Windows, experimente colocar no seu httpd.conf as diretivas:
LoadModule cgi_module modules/mod_cgi.so

ScriptAlias "/cgi-bin/" "c:\meus_scripts\"

E colocar seus programas de teste na pasta "meus_scripts". Apesar de não ser  mais usado, conseguir fazer alguns exemplos direto em CGI pode ser muito didático em termos de entender como a Web funciona no nível do HTTP - por isso inclui essa configuração como você perguntou. O seu programa de "Hello World" deve funcionar normalmente.
Para ver a documentação completa de como configurar CGI no apache, veja:
http://httpd.apache.org/docs/current/howto/cgi.html
Executando CGI sem configurar o Apache
O Python também vem com um servidor HTTP de testes que suporta CGI - e você pode rodar o seu programa acima diretamente, sem precisar instalar mais nada (nem o apache). Para isso, copie-o para uma pasta chamada cgi-bin e, na pasta acima dessa, inicie o servidor de testes com o comando python3 -m http.server --cgi 8000 - Em seguida, acesse a página em http://localhost:8000/cgi-bin/<nome-do-script.py> .
(Usuários de Linux, não esqueçam de marcar os scripts CGI como executáveis (com o comando chmod ou pela interface gráfica))
Comment: +1 pelo simples fato de ignorar a pergunta original sobre CGI e ajudar a resolver o real problema da pessoa de uma forma muito melhor.
Comment: Muito obrigado cara, vou dar pesquisada sobre o Flask. Queria o CGI apenas por questão de aprendizado, mas ainda sou iniciante em programação web com qualquer linguagem, só domino bem HTML, CSS e js por enquanto e realmente não me familiarizo com PHP e sempre gostei de Python. Valeu a atenção.
Comment: A pessoa pode estar querendo apenas saber por hobby, por exemplo criando um IDE pessoal... fazendo testes, curiosidade científica.


How to cleanup Wordpress media tags after migration?

Question: After migrating from Wordpress to Drupal with the Wordpress Migrate and Migrate modules, content still contains media tags:
<code>[[{"type":"media","view_mode":"media_large","fid":"4202","attributes":[{"class":"media-image","typeof":"foaf:Image","style":"","width":"339","height":"305"}]}]]
</code>
What is the best way to strip them out?
Comment: I have *exactly this question*.  It is *not* too broad, but its formulation is sloppy.
Answer: Ah found the answer after some digging:

You have the Media module enabled, so the migration renders image references as media tags - you need to change your filter to interpret the tags

http://drupal.org/node/1859458#comment-6819442

You have the Media module enabled, correct? And you're saying when you view (not edit) the nodes you're seeing the media embeds ([[{"type":"media"," etc.) instead of the image itself? Please go to /admin/config/content/formats and make sure that the text format you've chosen for the imported bodies has "Convert Media tags to markup" enabled.

http://drupal.org/node/1642352#comment-6136596

http://drupal.org/project/media


C#: How to access SharePoint 365 Excel file with MFA enabled via unattended application?

Question: We have SharePoint 365 site with MFA enabled. One project folder on the SharePoint contains an Excel file that I want to read and process via my unattended C# application. Interactively I can open the file after going through the MFA process. I tried following 5 cases but each one throws an exception:
The URL of the file is:
string excelUrl = @"https://company.sharepoint.com/teams/Projects/DocCtrl/Project.xlsm";

For each of these 5 cases, the web client headers are (showing here to avoid repetitions in the subsequent code):
webClient.Headers[HttpRequestHeader.UserAgent] = "Other";
webClient.Headers["X-FORMS_BASED_AUTH_ACCEPTED"] = "f";

Case-1:
using (WebClient webClient = new WebClient())
{
    webClient.UseDefaultCredentials = true;
    using (MemoryStream memoryStream = new MemoryStream(webClient.DownloadData(excelUrl)))
        using (SpreadsheetDocument xlDocument = SpreadsheetDocument.Open(memoryStream, false))
            readAndProcess(xlDocument);
}

Exception on webClient.DownloadData(excelUrl):
The remote server returned an error: (401) Unauthorized.

Case-2:
I would like to avoid this becuase it needs password to be either hardcoded or managed in some configuration file.
using (WebClient webClient = new WebClient())
{
    webClient.Credentials = new NetworkCredential(@"firstname.lastname@example.com", @"Password", "Domain");
    using (MemoryStream memoryStream = new MemoryStream(webClient.DownloadData(excelUrl)))
        using (SpreadsheetDocument xlDocument = SpreadsheetDocument.Open(memoryStream, false))
            readAndProcess(xlDocument);
}

Exception on webClient.DownloadData(excelUrl):
The remote server returned an error: (401) Unauthorized.

Case-3:
I would like to avoid this becuase it needs password to be either hardcoded or managed in some configuration file.
using (WebClient webClient = new WebClient())
{
    SecureString securePwd = new SecureString();
    foreach (char chr in @"Password")
        securePwd.AppendChar(chr);
    webClient.Credentials = new SharePointOnlineCredentials(@"email@example.com", securePwd);
    using (MemoryStream memoryStream = new MemoryStream(webClient.DownloadData(excelUrl)))
        using (SpreadsheetDocument xlDocument = SpreadsheetDocument.Open(memoryStream, false))
            readAndProcess(xlDocument);
}

Exception on webClient.DownloadData(excelUrl):
The request was aborted: The request was canceled.
The partner returned a bad sign-in name or password error. For more information, see Federation Error-handling Scenarios.

Case-4:
This does prompt me for the user id, password, and MFA. I would like to avoid such solution because my application is running from unattended console.
using (WebClient webClient = new WebClient())
{
    var authManager = new OfficeDevPnP.Core.AuthenticationManager();
    ClientContext ctx = authManager.GetWebLoginClientContext(@"https://company.sharepoint.com");
    ctx.Load(ctx.Web, w => w.Title);
    ctx.ExecuteQuery();
    using (MemoryStream memoryStream = new MemoryStream(webClient.DownloadData(excelUrl)))
        using (SpreadsheetDocument xlDocument = SpreadsheetDocument.Open(memoryStream, false))
            readAndProcess(xlDocument);
}

Exception on webClient.DownloadData(excelUrl):
The remote server returned an error: (401) Unauthorized.

Case-5:
This also prompt me for the user id, password, and MFA, even though it is specified in the code. I would like to avoid such solution because my application is running from unattended console.
using (WebClient webClient = new WebClient())
{
    var authManager = new OfficeDevPnP.Core.AuthenticationManager();
    ClientContext ctx = authManager.GetWebLoginClientContext(@"https://company.sharepoint.com");
    SecureString securePwd = new SecureString();
    foreach (char chr in @"Password")
        securePwd.AppendChar(chr);
    ctx.Credentials = new SharePointOnlineCredentials(@"firstname.lastname@example.com", securePwd);
    ctx.Load(ctx.Web, w => w.Title);
    ctx.ExecuteQuery();
    using (MemoryStream memoryStream = new MemoryStream(webClient.DownloadData(excelUrl)))
        using (SpreadsheetDocument xlDocument = SpreadsheetDocument.Open(memoryStream, false))
            readAndProcess(xlDocument);
}

Exception on ctx.ExecuteQuery():
The partner returned a bad sign-in name or password error. For more information, see Federation Error-handling Scenarios.

Any suggestions on how to access an Excel from MFA enabled SharePoint 365 site from unattended C# application? Would app password help in such cases?
Answer: I'd like to discuss good practices beforehand. An unattended application should never use a user (licensed or not) as means of authentication, whether you consume the Graph API or SharePoint API. As the previous answer implies, you should use an Azure AD Application with Application authentication and rights, authentication with a Client ID and a Client Secret or Certificate.
On the second front, accounts with MFA may not be used by applications, not with their normal password at the very least. Account may define an "application password" to circumvent MFA for applications that do not implement MFA. This may be used for such use cases, but i'm not sure.
Answer: Have you already tried using Microsoft Graph API with certificate authentication. If not you can try this:

using Microsoft.Graph;
using Microsoft.Identity.Client;
using Microsoft.Identity.Client.Extensions.Msal;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using System.Net.Http.Headers;
using System;

// Define the SharePoint site URL and Excel file path
string siteUrl = "https://yourtenant.sharepoint.com/sites/your-site";
string filePath = "/Shared Documents/YourExcelFile.xlsx";

// Define the client ID of your Azure AD application
string clientId = "your-client-id";

// Define the thumbprint of the certificate used for app-only authentication
string certThumbprint = "your-certificate-thumbprint";

// Define the Azure AD tenant ID
string tenantId = "your-tenant-id";

// Load the certificate used for app-only authentication
X509Certificate2 cert = null;
using (X509Store store = new X509Store(StoreLocation.CurrentUser))
{
    store.Open(OpenFlags.ReadOnly);
    var certs = store.Certificates.Find(
        X509FindType.FindByThumbprint, certThumbprint, false);
    if (certs.Count == 1)
    {
        cert = certs[0];
    }
}

// Create a new instance of AuthenticationContext using the certificate
string authority = $"https://login.microsoftonline.com/{tenantId}";
var authContext = new AuthenticationContext(authority, false);
var certCred = new ClientAssertionCertificate(clientId, cert);
var authResult = await authContext.AcquireTokenAsync(
    "https://graph.microsoft.com", certCred);

// Create a new instance of GraphServiceClient using the access token
var graphClient = new GraphServiceClient(
    new DelegateAuthenticationProvider(requestMessage =>
    {
        requestMessage.Headers.Authorization =
            new AuthenticationHeaderValue("Bearer", authResult.AccessToken);

        return Task.FromResult(0);
    }));

// Get the Excel file from SharePoint using Microsoft Graph
DriveItem excelFile = await graphClient
    .Sites[siteUrl]
    .Drive
    .Root
    .ItemWithPath(filePath)
    .Request()
    .GetAsync();

// Read the contents of the Excel file into a byte array
byte[] excelContents = await graphClient
    .Sites[siteUrl]
    .Drives[excelFile.ParentReference.DriveId]
    .Items[excelFile.Id]
    .Content
    .Request()
    .GetAsync();

// Process the Excel file contents as needed
// For example, you can use the OpenXml SDK to read the Excel file
// See https://docs.microsoft.com/en-us/office/open-xml/ for more information


Nginx Proxy Manager proxy_pass not working

Question: On Nginx Proxy Manager I have this configuration (names redacted)
# ------------------------------------------------------------
# www.lab.myself.it
# ------------------------------------------------------------

server {
  set $forward_scheme http;
  set $server         "127.0.0.1";
  set $port           81;

  listen 80;
listen [::]:80;

  server_name www.lab.myself.it;

  access_log /data/logs/proxy-host-2_access.log proxy;
  error_log /data/logs/proxy-host-2_error.log warn;

  location /wiki/ {
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Scheme $scheme;
    proxy_set_header X-Forwarded-Proto  $scheme;
    proxy_set_header X-Forwarded-For    $remote_addr;
    proxy_set_header X-Real-IP          $remote_addr;
    proxy_pass       http://maersk.lab.myself.it:8181/;

  }

  location / {
    # Proxy!
    include conf.d/include/proxy.conf;
  }

  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}

Ideally I should be able to browse to http://www.lab.myself.it/wiki and Nginx should send me to http://maersk.lab.myself.it:8181.
The issue is that I get a simple webpage because the browser can't load CSS, JS or images.
When I try to click on a link on the wiki, it brings me to http://www.lab.myself.it/documentation <-- MISSING THE /WIKI/
Answer: You need to set up the base URL in your wiki application properly.


Congruences - proof problems

Question: 1) State what is meant by $a\equiv b \pmod n$.
2) Suppose that $a\equiv b \pmod n$ and $c\equiv d \pmod n$. Prove that

i) $a+c\equiv b+d \pmod n$
ii) $ac\equiv bd \pmod n$

For question 1, I would state that $n|(a-b)$
For part ii, I would simply use algebraic manipulation to get the desired result but i don't think I'm proving it.
Comment: For part ii, algebraic manipulation is fine.  If you want to show exactly what you did and where you are stuck, I'm sure someone will be able to help you.
Comment: For part 1, I would say $a = kn + b$ for some $k \in \Bbb Z$, and this should help in part 2.
Answer: Let $a = k_1n + b$ and $c = k_2n + d$, $k_1, k_2 \in \Bbb Z$. Then
$$
a+c = k_1n + b + k_2n + d = (k_1+k_2)n + (b+d)\\
ac = (k_1n+b)(k_2n+d) = (k_1k_2n+k_1d+k_2b)n+bd$$
Answer: If $m$ divides $a,b;m$  must divide $ax+by$ where $x,y$ are arbitrary integers
For the first, $$a+c-(b+d)=(a-b)+(c-d)$$
For the second, $$ac-bd=a(c-d)+d(a-b)$$
Answer: 1) is perfect.
For 2i) use your definition: if $n|a-b$ and $n|c-d$ then $n|(a-b) + (c-d) = (a+c)-(b+d)$.
For 2ii) you can very well try the same kind of proof. Can you try it yourself?
Comment: you are right. But I guess it is just a typo, as there is no $c$ in question 1.
Comment: just a typo there

Congruences - proof problems


Workbench sections - notify users in a section on state change

Question: I want to, for example, use rules to notify all users in a particular section that an item of content in their section is 'awaiting moderation'.
Is there a way in Rules to get access to a node's Workbench section?
I can get access to the workbench access term id/menu id, depending on the scheme I'm using, but how can you find the users in that section from there...
Answer: If you use workbench access with a taxonomy scheme you could try this
In rules, add an event After moderation transition.
Add the conditions (previous state moderation, current state moderation) according to yours states in workbench moderation
Add the condition Entity has field and then select the field of your workbench access section (field_section for example : should be the field of your taxonomy vocabulary)
Add an action : send an email.
Then in the field TO of the email , you could use this snippet php wich return the user's email wich have access to the section (specified in Editorial assignments by editor in Workbench Access) and have a specific role id. This snippet return too all the users who have been assigned by their role to the section by their role (Editorial assignments by role in Workbench Access)
<?php

$sections = $node->workbench_access;

$terms=taxonomy_term_load_multiple($sections);

foreach ($terms as $term) {

$parents=taxonomy_get_parents_all($term->tid);

  if (!empty($parents)) {

    foreach ($parents as $parent) {

    $tid=$parent->tid;

    $voc_name=$parent->vocabulary_machine_name;
      if (!in_array($tid, $sections)) {
        $sections[$tid]=$tid;
      }
    }

  $sections[$voc_name]="'".$voc_name."'";
  }
};

// Only the users who have the role id [ROLE_ID]
$role_id=[ROLE_ID];
$emails = array();

foreach ($sections as $section) {
$result = db_query("SELECT user.mail AS mail FROM users user, workbench_access_user workbench, users_roles roles WHERE roles.rid=$role_id AND user.uid=roles.uid AND user.uid=workbench.uid AND access_id=$section");

  foreach($result as $record) {
    $mail=$record->mail;
    if (!in_array($mail,$emails)) { $emails[] = $mail; }
  }
}

foreach ($sections as $section) {
$result = db_query("SELECT user.mail AS mail FROM users user, workbench_access_role workbench, users_roles roles WHERE user.uid=roles.uid AND roles.rid=workbench.rid AND access_id=$section");

  foreach($result as $record) {
    $mail=$record->mail;
    if (!in_array($mail,$emails)) { $emails[] = $mail; }
  }
}

print implode($emails, ",");

?>

And you complete the others email's field with the token available.
This sandbox project Workbench Notify implement this snippet
Answer: The query would be improved with joins.  My version:
SELECT u.mail AS mail
FROM users u
INNER JOIN workbench_access_user w
ON w.uid  = u.uid
INNER JOIN users_roles ur
ON ur.uid = u.uid
WHERE ur.rid = $role_id
AND access_id = $section;


Are these statements on open sets and limit points true or false?

Question:
If $D \subseteq \mathbb{R}^n$ contains an isolated point then $D$ is not open.

Let $D \subseteq \mathbb{R}^n$ and $a \in D$. If $a$ is a limit point of $D$ then there is some $\epsilon > 0$ such that $B_{\epsilon}(a) \subseteq D$.

For the first, by definition of isolated point, it must be in $D$ but not be a limit point of $D$. I have a feeling if $D = \mathbb{R}^n$ this could be a counter example, as it is a clopen set.
For the second, the consequent is the definition of open if I'm not mistaken, but I'm not sure how this relates to $a$ being a limit point of $D$.
Any help would be appreciated?
Answer: If $x$ is an isolated point of $D$, there is an $\epsilon_0>0$ such that $B(x,\epsilon_0)\cap D=\{x\}$. If $D$ were open, there would be an $\epsilon_1>0$ such that $B(x,\epsilon_1)\subseteq D$. Let $\epsilon=\min\{\epsilon_0,\epsilon_1)$; then on the one hand $$x\in B(x,\epsilon)\cap D\subseteq B(x,\epsilon_0)\cap D=\{x\}\,,$$ so $B(x,\epsilon)\cap D=\{x\}$, but on the other hand
$$B(x,\epsilon)\subseteq B(x,\epsilon_1)\subseteq D\,,$$
so $B(x,\epsilon)\cap D=B(x,\epsilon)$. Thus, $B(x,\epsilon)=\{x\}$, which is false in $\Bbb R^n$. This shows that $D$ cannot be open.
For the second question, let $n=1$, and let $D=(0,1)$; $0$ is a limit point of $D$, but there is no $\epsilon>0$ such that $(-\epsilon,\epsilon)\subseteq(0,1)$.


Question from non-musician: Is it possible to learn sight-singing without having learned an instrument?

Question: I'm trying to learn sight-singing sheet music. I understand the basics such as the length of a note, time signatures and so on. But the only insurmountable difficulty for me is that I don't remember the pitch of the notes on the staff. It takes me more than a few seconds after I see a note to figure out how high its pitch should be. I know that people who have learned a musical instrument such as the piano have instant reflexes when they see a note, because they have played those notes thousands of times. But I don't have this ability.
A lot of people claim it is possible to learn sight-singing sheet music without having learned an instrument, but I've grown ever suspicious, because I had once tried quite hard to remember the notes, with no success. I've learned where the notes are located on a keyboard, but again all I have done is learning theory, and I never managed to develop an ability to instantly recognize a note as shown on the staff.
So do you think it's a valid idea at all for me to try to learn sight-singing, before I have time to learn an instrument? I'm sorry this question is a little dumb for most people on this board.
Answer: First of all, are you trying to figure out the pitch of a note simply by seeing? As in seeing seeing a C# on the staff then being able to sing a C# exactly on pitch without an instrument? This ability is called perfect pitch, and most people, including myself, do not possess this ability. What most good musicians (including singers) have is good relative pitch, which is to be able to sing or hum a melody from sheet music after the starting note has been given. In any case, to be a good sight-singer requires some ear training, also known as aural training. You would start by learning to recognize intervals, i.e., the distance between notes, by ear. Combine this with the ability to recognize the intervals on the staff, and you should be able to, with practice, sight-sing fairly easily. Now, is it necessary to learn in instrument? I believe, with consistent practice, it is entirely possible to to learn to sight-sing well without learning an instrument. However, most people I know who are good sight-singers know at least one instrument, usually the piano.
Answer: I liked Daryl's answer, and would add that many of my students who don't play an instrument have found using solfege (do, re, mi) with a teacher helpful in learning to sight-sing.
Comment: Thanks all of you for answering! Actually I was taught solfege when I was young. So I recognize the relative pitches of the notes on a major scale (but not others). As a result I am able to read, e.g. sheet music without # and b signs, in C major. However, when there are lots of # and b signs, either to indicate a different major/minor scale, or sporadically occurring in the music itself, I get completely lost.
Comment: (Cont.) I reckon there are two ways of dealing with music that's not in C major. The first is to transpose "do, re, mi" to the proper location on the staff, which is different for every different scale. (The so called "movable Do".) The problem is that it's hard to remember the location for each single scale, and even more impossible to develop quick reflexes for each of them.
Comment: (cont.) The second approach is to read it the way I read C-major, but shift the tone by half when there's a # or b sign. This is even more problematic for me, since when I see C, I think of "Do" to get the correct pitch. When my ear is surrounded by music in D major, when I think of "Do" I would automatically sing the D note. So my system of reading music based on solfege is completely messed up.
Comment: @felix That is why I suggested that you learn to recognize intervals on the staff and by ear. That way, instead of seeing the notes and associating it with a solfege syllable, we see the distance between two notes and sing the correct interval. For example, in the key of D major, if we see the note D going to F# (major 3rd interval) then, using the solfege, we would be able to sing Do Mi simply by looking at the distance. A major third interval means that the notes are three notes away from each other on the scale. Meaning if the first note is Do, then we would count Do(1) Re(2) Mi(3).
Comment: (Cont.) With practice, you should be able to recognize the sound of the interval without having to count each syllable. Once you have learned the sound of each interval, then you can start from any note in any key and sing the melody based on the starting note and the distance between each note, even if you do not know the exact name of each note.
Answer: I am learning to sight sing too. The best thing is to contact your local Kodaly Academy as they run all sorts of courses that will help you internalise pitch, and give you exercises to help you take any key and accidentals in your stride. If you live in Britain or the States there's regular residentials, weekly lessons, etc. I've managed to go from nothing to intermediate level by doing this. They use solfa in a very good way.


How to include speech marks (double quotes) in HTTP request body

Question: I am trying to create some code that uses TSheets REST API. The documentation states that this is the format I should use to create timesheets.
var client = new RestClient("https://rest.tsheets.com/api/v1/timesheets");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <TOKEN>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "<REQUEST BODY>", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

and that this is what should go into the request body
{
 "data":
  [
    {
     "user_id":1242515,
     "type":"regular",
     "start":"2018-07-23T10:00:00-07:00",
     "end":"2018-07-23T13:10:23-07:00",
     "jobcode_id":"17288283",
     "notes":"This is a test of the emergency broadcast system",
     "customfields": {
      "19142":"Item 1",
      "19144":"Item 2"
     },
     "attached_files": [
      50692,
      44878
     ],
    },
  ]
}

My question is how can I get the speech marks (double quotes) into the request body section? is there an escape character I need to put with the speech mark
Answer: Use \" to represent ", A useful tool: https://www.freeformatter.com/json-escape.html