text:
Q: JwtSecurityTokenHandler says signature of JWT valid after changing 1 char We are trying to validate the ID Token (IDT) presented to a .NET client application by an OpenID Connect Provider (OP). The IDT is what you would expect. Nothing unusual going on there.
To verify the signature of the IDT, we can get the exponent and modulus from the OP by calling a public endpoint. These can be used to create a public key that corresponds to the private one used by the OP to sign the IDT. With these, we create a RSACryptoServiceProvider object to do the signature verification. To help with this, we are are passing the crypto service provider as a token validation parameter to a JwtSecurityTokenHandler.
This works fine. We thought we were done and ready for the weekend. However, we found that we can change the last character in the signature and the JwtSecurityTokenHandler will still tell us the JWT is valid. We cannot find an explanation for this and are wondering if:

*

*It is a problem with the way we are creating the signing key which is causing it to improperly validate JWTs.

*There is a bug in the JwtSecurityTokenHandler.

*We are not understanding the spec completely and this small alteration is allowed because the last character in the signature part of the JWT is actually not pertinent for verification.

*Something else

We are using System.IdentityModel.Tokens.JwtSecurityTokenHandler from System.IdentityModel.Tokens.Jwt.dll v4.0.30319.
A very simple sample of our code is below.
Program.cs
using System;
using System.Configuration;
using System.IdentityModel.Tokens;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.eyJzdWIiOiJ1c2VyMSIsImF1ZCI6ImNsaWVudDEiLCJqdGkiOiJKcUFDVVFiTlRQR201U0ZJRXY3MWR0IiwiaXNzIjoiaHR0cHM6XC9cL2xvY2FsaG9zdDo5MDMxIiwiaWF0IjoxNDEzNTcwNjEyLCJleHAiOjE0MTM1NzA5MTJ9.Z3P4Rt_w7d0oP8x6zfaot8PIxpEJHUw43Z_4VkOzv59nRz1dWopGUXw51DJd5cLjeM_zc14durs5NhJE27WmcKaEuE8-WZ0ubxM_bzykZfmAPa1WVk9KctPKiUH7QZg4OCLaqIX6usi5kkuICiPVdoJPkHmojMkm5nCqeBIbYteasysMTQGq93VtoBGUQomF89ZaFMBlUy0ofH7SEKJEW_4vgy7Umu0h7kNKkh6Aw4x9Bw1AkG1D6H_scsuH2uSxQ7QV-3G60DcjLZ31_R1ZxaUg2WS2ajemb6swKM4LIOR9_mK6ScUVVBxBL4Oh9g6EA93lMg_1GRZi780v_3TR8Q";

            var tokenValidator = new TokenValidator(new CacheProvider(), new DebugOpenIdConnectProviderClient(),
                ConfigurationManager.AppSettings["AUDIENCE"], ConfigurationManager.AppSettings["ISSUER"]);
            SecurityToken securityToken;
            var principal = tokenValidator.Validate(token, out securityToken);

            if (principal != null)
            {
                Console.Out.WriteLine("Security token is valid");
            }

            foreach (var claim in principal.Claims)
            {
                Console.Out.WriteLine("{0} = {1}", claim.Type, claim.Value);
            }

            Console.ReadLine();
        }
    }
}

TokenValidator.cs
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens;
using System.Security.Claims;
using System.Security.Cryptography;
using Newtonsoft.Json;

namespace ConsoleApplication1
{
    public class TokenValidator
    {
        private readonly CacheProvider cacheProvider;
        private readonly IOpenIdConnectProviderClient openIdConnectProviderClient;
        private readonly string audience;
        private readonly string issuer;

        public TokenValidator(CacheProvider cacheProvider, IOpenIdConnectProviderClient openIdConnectProviderClient, string audience, string issuer)
        {
            this.cacheProvider = cacheProvider;
            this.openIdConnectProviderClient = openIdConnectProviderClient;
            this.audience = audience;
            this.issuer = issuer;
        }

        public ClaimsPrincipal Validate(string tokenString, out SecurityToken securityToken)
        {
            var jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
            var jwt = jwtSecurityTokenHandler.ReadToken(tokenString) as JwtSecurityToken;
            var publicKey = GetPublicKey(jwt.Header.SigningKeyIdentifier[0].Id);
            var rsaPublicKey = CreatePublicKey(publicKey.n, publicKey.e);

            return jwtSecurityTokenHandler.ValidateToken(tokenString, new TokenValidationParameters()
            {
                IssuerSigningToken = new RsaSecurityToken(rsaPublicKey, publicKey.kid),
                IssuerSigningKeyResolver = (token, securityToken2, keyIdentifier, validationParameters) => {
                    return new RsaSecurityKey(rsaPublicKey);
                },
#if DEBUG
                ClockSkew = new TimeSpan(0, 30, 0),
#endif
                ValidIssuer = issuer,
                ValidAudience = audience,
            }, out securityToken);
        }

        public static RSACryptoServiceProvider CreatePublicKey(string modulus, string exponent)
        {
            var cryptoProvider = new RSACryptoServiceProvider();

            cryptoProvider.ImportParameters(new RSAParameters()
            {
                Exponent = Base64UrlEncoder.DecodeBytes(exponent),
                Modulus = Base64UrlEncoder.DecodeBytes(modulus),
            });

            return cryptoProvider;
        }

        private PublicKeyData GetPublicKey(string kid)
        {
            var keys = cacheProvider["PUBLIC_KEYS"] as Dictionary<string, PublicKeyData>;

            if (keys == null)
            {
                keys = GetPublicKeysFromPingFederate();

                cacheProvider["PUBLIC_KEYS"] = keys;
            }

            var currentKey = keys[kid];

            if (currentKey != null)
            {
                return currentKey;
            }

            throw new Exception("Could not find public key for kid: " + kid);
        }

        private Dictionary<string, PublicKeyData> GetPublicKeysFromPingFederate()
        {
            var keyString = openIdConnectProviderClient.Execute();
            var keys = JsonConvert.DeserializeObject<PublicKeysJsonResult>(keyString);
            var result = new Dictionary<string, PublicKeyData>();

            foreach (var key in keys.Keys)
            {
                result[key.kid] = key;
            }

            return result;
        }
    }
}

A: This seems to be happening in the decoding of the Base64Url encoded signature. I can't tell you exactly why, but try this out:
Go to: http://kjur.github.io/jsjws/tool_b64udec.html
Decode your signature in the JWT in your post above:
Z3P4Rt_w7d0oP8x6zfaot8PIxpEJHUw43Z_4VkOzv59nRz1dWopGUXw51DJd5cLjeM_zc14durs5NhJE27WmcKaEuE8-WZ0ubxM_bzykZfmAPa1WVk9KctPKiUH7QZg4OCLaqIX6usi5kkuICiPVdoJPkHmojMkm5nCqeBIbYteasysMTQGq93VtoBGUQomF89ZaFMBlUy0ofH7SEKJEW_4vgy7Umu0h7kNKkh6Aw4x9Bw1AkG1D6H_scsuH2uSxQ7QV-3G60DcjLZ31_R1ZxaUg2WS2ajemb6swKM4LIOR9_mK6ScUVVBxBL4Oh9g6EA93lMg_1GRZi780v_3TR8Q

This will yield this HEX output:
6773f846dc3b774a0ff31eb37daa2df0f231a44247530e376785643b3bf9f67473d5d5a8a46517c39d4325de5c2e378ccdcd7876eaece4d849136ed699c29a12e13c599d2e6f131bcf29197e600f6b559593d29cb4f2a2507ed0660e0e08b6aa217eaeb22e6492e20288f55da093e41e6a233249b99c2a9e0486d8b5e6accac313406abddd5b68046510a2617cf59685301954cb4a1f1fb484289116e2f832ed49aed21ee434a921e80c38c7d070d40906d43e87b1cb2e1f6b92c50ed05771bad037232d9df5475671694836592d9a8de99beacc0a3382c8391f662ba49c515541c412f83a1f60e8403dde5320d464598bbf34bf74d1f1

Changing the last character of the Base64Url Encoded signature will actually not always change the signature value in hex. That is because only the first two bits of the last Base64 character (Q = 16 = 010000) in the string are significant. The last four bits are thrown out since they do not form a complete byte. So, you can actually use all these characters QRSTUVQXYZabcdef (binary 010000 - 011111), they will all produce the same hex value f1 in the end since the two first bits for all those characters are 01.
To conclude, you have not actually tampered with the signature, merely with the encoding of it. You are still validating using the valid key.


text:
Q: Office Store rejects Outlook Module extension Add-in. How to submit only Module extension add-in We have created a outlook Module extension Add-in. it works in outlook 2016 onward as per following link https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/extension-module-outlook-add-ins . We want to submit this add-in in office store. We have submit it to the office store but store rejects the Add-in on below grounds-

*

*The add-in does not appear on Outlook 2013.

*The add-in does not appear on Outlook 2016 for Mac.

*The add-in does not appear on Outlook 2016 on Chrome browser.

*The add-in does not appear on Outlook on Safari browser (Version: 13.1 15609.1.20.111.8)).

Add-in can't be work inside these environment since Module extensions are only supported by Outlook 2016 or later on Windows.
Can somebody help me how i can submit my module add-in which can pass these features?

redpajama_set_name: RedPajamaStackExchange


text:
Q: javascript quiz how to give the answer array a default value? I'm creating a quiz that requires every answer to be answered. The problem is that you should be able to skip questions if you don't have an answer. I'm trying to set a default answer everytime I press next so when I try to skip one I don't have to answer for it to have a value. The default value I want is each time the last value of my array.
next and previous question
        SetQuestion(question) {

            if (this.questionNumber >= 0) {
                let oldAnswerButton = document.querySelectorAll('.filter_anwser');

                // Deletes old question when the next question is clicked
                for (let answerButton of oldAnswerButton) {
                    answerButton.style.display = 'none';
                }
            }

            this.questionNumber = question;

            let q = this.quiz[question];
            // Check if your at the last question so the next button will stop being displayed.
            if (this.questionNumber === Quiz.length - 1) {
                this.nextbtn.style.display = 'none';
                this.prevbtn.style.display = 'block';
                this.resultbtn.style.display = 'grid';
            } else if (this.questionNumber === 0) {
                this.nextbtn.style.display = 'block';
                this.prevbtn.style.display = 'none';
                this.resultbtn.style.display = 'none';
            } else {
                this.nextbtn.style.display = 'block';
                this.prevbtn.style.display = 'block';
                this.resultbtn.style.display = 'none';
            }

            // Displays Question
            this.questionName.textContent = q.questionText;
            this.questionName.id = "questionID";

            return q;
            console.log(this.getLink())
            console.log(this.tmp)

        }

        IntoArray() {
            const UrlVar = new URLSearchParams(this.getLink())
            this.UrlArray = [...UrlVar.entries()].map(([key, values]) => (
                    {[key]: values.split(",")}
                )
            );
        }

        NextQuestion() {
            // let quizUrl = this.url[this.questionNumber];
            let question = this.SetQuestion(this.questionNumber + 1);
            let pre = question.prefix;
            let prefixEqual = pre.replace('=', '');
            let UrlArr = this.UrlArray;
            let UrlKeys = UrlArr.flatMap(Object.keys)
            let answers = question.chosenAnswer.slice(0, -1);

            this.clicked = true;

            // Displays answers of the questions
            for (let y = 0; y < answers.length; y++) {
                let item = answers[y];

                // Display answer buttons
                if (UrlKeys.includes(prefixEqual)) {
                    console.log("exists");
                    let btn = document.querySelector('button[value="' + item.id + '"]');
                    btn.style.display = 'block';
                } else {
                    let btn = document.createElement('button');
                    btn.value = item.id;
                    btn.classList.add("filter_anwser", pre)
                    btn.id = 'answerbtn';
                    btn.textContent = item.name;
                    this.button.appendChild(btn);
                }

                // let quizUrl = control.url[control.questionNumber];
                // // console.log(this.tmp);
                // if (quizUrl === undefined) {
                //     quizUrl.push(question.prefix[y] + '');
                // }

                // if (quizUrl === undefined){
                //     this.tmp.push('');
                // }
            }

            this.IntoArray();
        }

        PrevQuestion() {
            let question = this.SetQuestion(this.questionNumber - 1);
            let answers = question.chosenAnswer.slice(0, -1);

            // Displays answers of the questions
            for (let y = 0; y < answers.length; y++) {
                let item = answers[y];

                // Display answer buttons
                let btn = document.querySelector('button[value="' + item.id + '"]');
                btn.style.display = 'block';
            }
            this.IntoArray();
        }

Link creator:
        /**
         * Returns the parameters for the URL.
         *
         * @returns {string}
         */
        getLink() {
            this.tmp = [];
            for (let i = 0; i < this.url.length; i++) {
                // Check if question is from the same quiz part and adds a , between chosen answers and add the right prefix at the beginning
                if (this.url[i].length > 0) {
                    this.tmp.push("" + Quiz[i].prefix + this.url[i].join(","))
                    // console.log(this.url)
                }
                if (this.url[i].length === 0) {
                    this.tmp.push("");
                }
            }
            /// If answers are from different quiz parts add a & between answers.
            return "" + this.tmp.join("&");
            // console.log(this.url[i].prefix);
        };

Answer click event
    control.button.addEventListener("click", function (e) {
        const tgt = e.target;
        control.clicked = true;

        // clear the url array if there's nothing clicked
        if (control.url.length === control.questionNumber) {
            control.url.push([]);
        }

        let quizUrl = control.url[control.questionNumber];

        // Check if a button is clicked. Changes color and adds value to the url array.
        if (quizUrl.indexOf(tgt.value) === -1) {
            quizUrl.push(tgt.value);
            e.target.style.backgroundColor = "orange";
            // Check if a button is clicked again. If clicked again changes color back and deletes value in the url array.
        } else {
            quizUrl.splice(quizUrl.indexOf(tgt.value), 1);
            e.target.style.backgroundColor = "white";
        }

        console.log(control.getLink());
        console.log(quizUrl)

    })

array:
    class QuizPart {
        constructor(questionText, chosenAnswer, prefix, questionDescription) {
            this.questionText = questionText;
            this.chosenAnswer = chosenAnswer;
            this.prefix = prefix;
            this.questionDescription = questionDescription;
        }
    }

    class ChosenAnswer {
        constructor(id, name) {
            this.id = id;
            this.name = name;
        }
    }

    let Quiz = [
        new QuizPart('Whats your size?', [
                new ChosenAnswer('6595', '41'),
                new ChosenAnswer('6598', '42'),
                new ChosenAnswer('6601', '43'),
                new ChosenAnswer('', ''),
            ], 'bd_shoe_size_ids=',
            'The size of your shoes is very important. If you have the wrong size, they wont fit.'),

        new QuizPart('What color would you like?', [
                new ChosenAnswer('6053', 'Red'),
                new ChosenAnswer('6044', 'Blue'),
                new ChosenAnswer('6056', 'Yellow'),
                new ChosenAnswer('6048', 'Green'),
                new ChosenAnswer('', ''),
            ], 'color_ids=',
            'Color isn t that important, It looks good tho.'),

        new QuizPart('What brand would you like?', [
                new ChosenAnswer('5805', 'Adidas'),
                new ChosenAnswer('5866', 'Nike'),
                new ChosenAnswer('5875', 'Puma'),
                new ChosenAnswer('', ''),
            ], 'manufacturer_ids=',
            'Brand is less important. Its just your own preference'),
    ]

I tried giving the array's in link creator and my eventlistener a default value and replacing it when I get and actual value from one of my buttons, but it just doesn't work. Can anybody help me?

A: I understand, that it might be a bit far from what you expect for an answer - but why don't you have a look at a reactive tool, like Vue? It has all the tools that you might need for such a task, and maybe more:

*

*the whole quiz can be abstracted to a simple array of objects (the questions)

*next, prev, set default answer becomes a breeze

*easy to extend (with questions)

*simple to update (template, features, etc.)

Vue.component('QuizQuestion', {
  props: ['data', 'selected'],
  computed: {
    valSelected: {
      get() {
        return this.selected
      },
      set(val) {
        this.$emit('update:selected', val)
      }
    },
  },
  template: `

      {{ data.text }}

      {{ data.description }}

          <input
            type="radio"
            :name="data.text"
            :value="val"
            v-model="valSelected"
          />
          {{ val[1] }}

  `
})
new Vue({
  el: "#app",
  computed: {
    currentQuestion() {
      return this.questions[this.current]
    },
    hasPrev() {
      return !!this.current
    },
    hasNext() {
      return this.current < this.questions.length - 1
    },
  },
  data() {
    return {
      current: 0,
      questions: [{
        text: 'Whats your size?',
        description: 'The size of your shoes is very important. If you have the wrong size, they wont fit.',
        options: [
          ['6595', '41'],
          ['6598', '42'],
          ['6601', '43'],
          ['', ''],
        ],
        selected: null,
      }, {
        text: 'What color would you like?',
        description: 'Color isn\'t that important, It looks good tho.',
        options: [
          ['6053', 'Red'],
          ['6044', 'Blue'],
          ['6056', 'Yellow'],
          ['6048', 'Green'],
          ['', ''],
        ],
        selected: null,
      }, {
        text: 'What brand would you like?',
        description: 'Brand is less important. Its just your own preference',
        options: [
          ['5805', 'Adidas'],
          ['5866', 'Nike'],
          ['5875', 'Puma'],
          ['', ''],
        ],
        selected: null,
      }, ],
    }
  },
  methods: {
    selectDefault() {
      this.questions[this.current] = {
        ...this.questions[this.current],
        selected: this.questions[this.current].options.slice(-1)[0],
      }
    },
    getPrev() {
      if (this.hasPrev) {
        if (!this.currentQuestion.selected) {
          this.selectDefault()
        }
        this.current -= 1
      }
    },
    getNext() {
      if (this.hasNext) {
        if (!this.currentQuestion.selected) {
          this.selectDefault()
        }
        this.current += 1
      }
    },
  },
  template: `

      <quiz-question
        :data="currentQuestion"
        :selected.sync="currentQuestion.selected"
      />

      <button v-if="hasPrev" @click="getPrev">PREV</button>
      <button v-if="hasNext" @click="getNext">NEXT</button>
      <button v-if="!hasNext">RESULT</button>

  `
})
.quiz-options {
  display: flex;
  flex-direction: column;
}

EDIT
But, if frameworks/libraries are not to be used, here's a more OOP approach:

class Quiz {
  constructor(questions) {
    this._current = 0
    this._questions = questions
  }
  get current() {
    return this._current
  }
  set current(val) {
    this._current = val
  }
  get hasNext() {
    return this.current < this.questions.length - 1
  }
  get hasPrev() {
    return !!this.current
  }
  get questions() {
    return this._questions
  }
  get next() {
    this.current = this.hasNext ? this.current + 1 : this.current
    return this.currentQuestion
  }
  get prev() {
    this.current = this.hasPrev ? this.current - 1 : this.current
    return this.currentQuestion
  }
  get currentQuestion() {
    return this.questions[this.current]
  }
}

class Question {
  constructor({
    text,
    description,
    options,
    prefix,
  }) {
    this.text = text
    this.desc = description
    this.prefix = prefix
    this._options = options.map(([key, val]) => ({
      id: key,
      value: [key, val],
      selected: false,
    }))
  }
  get options() {
    return this._options
  }
  set options(newOptions) {
    this._options = newOptions
  }
  get selected() {
    return this.options.find(({
      selected
    }) => !!selected)
  }
  set selected(selectedVal) {
    this.options = [...this.options.map(({
      value: [key, val],
      selected,
      ...rest
    }) => {
      return {
        ...rest,
        value: [key, val],
        selected: key === selectedVal
      }
    })]
  }
  get lastOption() {
    return this.options.slice(-1)[0]
  }
  setDefault() {
    if (!this.selected) {
      this.selected = this.lastOption.id
    }
  }
}

const urlParser = (quiz) => {
  return quiz.questions.map(({
    prefix,
    selected = {
      value: ['']
    }
  }) => {
    const s = selected.value[0] ? selected.value[0] : ''
    return `${prefix}${s}`
  }).join('&')
}

const qArr = [{
    text: 'text1',
    description: 'desc1',
    options: [
      ['1_1', '11'],
      ['1_2', '12'],
      ['1_3', '13'],
    ],
    prefix: 'prefix_1_',
  },
  {
    text: 'text2',
    description: 'desc2',
    options: [
      ['2_1', '21'],
      ['2_2', '22'],
      ['2_3', '23'],
    ],
    prefix: 'prefix_2_',
  },
  {
    text: 'text3',
    description: 'desc3',
    options: [
      ['3_1', '31'],
      ['3_2', '32'],
      ['3_3', '33'],
    ],
    prefix: 'prefix_3_',
  },
]

const getOptionsHtml = ({
  text,
  options
}) => {
  let html = ''
  options.forEach(({
    id,
    value,
    selected
  }, i) => {
    html += `

        <input
            class="question-input"
            type="radio"
          name="${text}"
          value="${value[0]}"
          ${selected ? 'checked' : ''}
        />
        ${value[1]}

    `
  })
  return html
}

const getSingleQuestionHtml = (q) => {
  const optionsHtml = getOptionsHtml({
    text: q.text,
    options: q.options
  })
  return `
    ${q.text}

    ${q.desc}

    ${optionsHtml}
  `
}

const registerEventHandlers = ({
  container,
  question
}) => {
  const radioBtns = document.querySelectorAll('.question-input')
  radioBtns.forEach((input, i) => {
    input.addEventListener('change', function(e) {
      question.selected = e.target.value
    })
  })
}

const updateHtml = ({
  container,
  question
}) => {
  container.innerHTML = getSingleQuestionHtml(question)
  registerEventHandlers({
    container,
    question
  })
};

const updateContainer = (container) => (question) => updateHtml({
  container,
  question
});

const setElDisplay = ({
  el,
  display
}) => {
  if (display) {
    el.classList.add("d-inline-block")
    el.classList.remove("d-none")
  } else {
    el.classList.remove("d-inline-block")
    el.classList.add("d-none")
  }
}

const updateBtnVisibility = ({
  btnNext,
  btnPrev,
  btnResult,
  quiz
}) => () => {
  setElDisplay({
    el: btnNext,
    display: quiz.hasNext
  })
  setElDisplay({
    el: btnResult,
    display: !quiz.hasNext
  })
  setElDisplay({
    el: btnPrev,
    display: quiz.hasPrev
  })
}

(function() {
  const quiz = new Quiz(qArr.map(q => new Question(q)))

  const container = document.getElementById('quiz-container')
  updateQuizContainer = updateContainer(container)
  updateQuizContainer(quiz.currentQuestion)

  const btnPrev = document.getElementById('btn-prev')
  const btnNext = document.getElementById('btn-next')
  const btnResult = document.getElementById('btn-result')

  const updateBtns = updateBtnVisibility({
    btnPrev,
    btnNext,
    btnResult,
    quiz
  })
  updateBtns()

  btnPrev.addEventListener('click', function() {
    if (quiz.hasPrev) {
      quiz.currentQuestion.setDefault()
    }
    updateQuizContainer(quiz.prev)
    updateBtns()
  })
  btnNext.addEventListener('click', () => {
    if (quiz.hasNext) {
      quiz.currentQuestion.setDefault()
    }
    updateQuizContainer(quiz.next)
    updateBtns()
  })
  btnResult.addEventListener('click', function() {
    quiz.currentQuestion.setDefault()
    console.log(urlParser(quiz))
  })
})();
.d-inline-block {
  display: inline-block;
}

.d-none {
  display: none;
}

  <button id="btn-prev" class="d-inline-block">
    PREV
  </button>
  <button id="btn-next" class="d-inline-block">
    NEXT
  </button>
  <button id="btn-result" class="d-none">
    RESULT
  </button>


text:
Q: Group By v Max() or MIN() For Parent Fields If I have a Parent Child Relationship, and I wish to get an Aggregate from the Child table, count(*), SUM(), doesn't really matter which one.
But I wish to return Multiple fields from the Parent Table too, I can either Group By All the Parent Fields or Group By the Primary Key of the Parent and use MIN() around the Parent Fields Not in the Primary Key.
Question is which is most efficient?
Group By all the Parent Fields Or Pulling them back as the Min(ParentFieldnnn) as ParentFieldnnn ?

A: Grouping by a single column should be a tad more efficient.  So group by the id and use aggregation functions such as min().
This will actually be even more efficient if you have an index on that key.
When you have a bunch of keys, the database is generally sorting or hashing on all the keys -- so all the data needs to be moved around.


text:
Q: how to add {author}, {tableofcontents} and {date} for each {chapter} or {section} I was composing a book (using xelatex) that each chapter comes from different author, is there any environments/packages that can put these message near each chapter/section instead of the heading pages of the book?

A: Check out the combine class (which also makes use of the packages combinet, combnat and combcite to achieve the results one would expect when preparing a volume composed of different articles by different authors).
I have never used it myself, but it seems to be good enough for the job.

A: Unfortunately, I will only able to advise you with tableofcontent for each chapter. I use the library minitoc for doing this. Please see to code below. In each chapter, you must add the command \minitoc. I usually also sets the counter tocdepth and secnumdepth. I hope it helps at least part of your problem
\documentclass[%
    ,fontsize=12pt      %
    ,b4paper, pagesize
    ,captions=nooneline
    ,DIV=11             % calculation of the typearea
    ,BCOR=12mm          % binding correction for the left/inner side
]{scrbook}

 \usepackage[x11names, dvipsnames, table]{xcolor}  % http://www.ctan.org/pkg/xcolor/
% ~~~~~~~~~~~ Hyperlinks ~~~~~~~~~~~~~~~~~~~~~~~~
\usepackage[xetex]{hyperref}
\hypersetup{pdfauthor={Athor name},
            pdftitle={Book name},
            pdfsubject={My study notes},
            pdfkeywords={linear algebra, math, electronics},
            pdfpagelayout={TwoPageLeft}, % Displays two pages, odd-numbered pages to the left
            pdfcreator={Xelatex}
            bookmarks={true},            %  A set of Acrobat bookmarks are written
            colorlinks={true},           %  Colors the text of links and anchors.
            linkcolor={NavyBlue},        %  Color for normal internal links.
            anchorcolor={black},         %  Color for anchor text.
            filecolor={cyan},            %  Color for URLs which open local files.
            menucolor={red},             %  Color for Acrobat menu items.
            runcolor={blue},             %  Color for run links (launch annotations).
            urlcolor={NavyBlue},         %  Color for linked URLs.
            citecolor={CornflowerBlue}
           }
\usepackage{lipsum}
\usepackage[nohints]{minitoc}              % Control the fonts and formatting used in the table of
                                            % contents.

\begin{document}
% =============================== TOC =============================================================
% this sets the depth to which things are listed in the table of contents
% (Chapters =0, Sections =1, etc)
\setcounter{tocdepth}{1} %
\setcounter{secnumdepth}{4}
\dominitoc
\tableofcontents
% =============================== BOOK ============================================================
  \chapter{chapter 1}
    \minitoc
      \section {chap 1 sec 1}
        \lipsum[1]
    \section {chap 1 sec 2}
    \section {chap 1 sec 3}
  \chapter{chapter 2}
    \minitoc
    \section {chap 1 sec 1}
    \section {chap 1 sec 2}
    \section {chap 1 sec 3}
\end{document}

Result:


text:
Q: Howto get user information from a selfhosting webserver usering owin I created a selfhosting webapp  (Microsoft.AspNetCore.Owin) as recommended in stackoverflow by @Anouar.
It works as expected. But I can't get user information from the context. There doesn't seem to be any Claim in HttpContext.Users.Claims (nrOfClaims = 0).
public class SayHi : ControllerBase
{
    [Route("sayhi/{name}")]
    public IActionResult Get(string name)
    {
        var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;

        var nrOfClaims = HttpContext.User.Claims.Count();

Is it possible to get the username and the user-domainname via HttpContext here?
I searched various sites. I tried IHttpContextAccessor stackoverflow via constructor dependency injection. But the HttpContextAccessor seems to be the same as HttpContext itself.


text:
Q: Number of observations falling in a given criteria if mean and standard deviation are given. This is a question from an entrance test.  I was trying to solve it but now,  i am stuck in it. Question is :

If a data set is approximately normal with sample mean of 75 and standard deviation of 5, how many observations fall with 75 +
  or - 5?

The answer options were available in percentage.

A: Hint:
The key is knowing that the distribution is normal.
For the specific solution see, for instance: 68–95–99.7 rule.


text:
Q: Setting style based on existence of an ancestor type I have 2 sets of TextBlocks some of them are in an ItemControl and some of them are not.
I want to make a style (just based on type) which sets the background of the TextBlock if its ancestor is an ItemControl.
I can do it using the following code but my problem is that on the log (and output window) a data biding error message is displayed because of the TextBlocks which do not have ItemControl as their ancestor.
Is there a better way to do this task and avoid this error message?
<Grid>
    <Grid.Resources>
        <local:HasAncestorConverter x:Key="HasAncestorConverter" />
        <Style TargetType="TextBlock">
            <Style.Triggers>
                <DataTrigger
                    Binding="{Binding RelativeSource={RelativeSource
                    AncestorType={x:Type ItemsControl}},
                    Converter={StaticResource HasAncestorConverter}}" Value="True">
                    <Setter Property="Background"
                            Value="{Binding Tag,
                            RelativeSource={RelativeSource
                            AncestorType={x:Type ItemsControl}}}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Grid.Resources>
    <StackPanel>
        <TextBlock Text="Out of ItemControl" />
        <ItemsControl Tag="Blue" >
            <TextBlock Text="Inside of ItemControl" />
        </ItemsControl>
    </StackPanel>
</Grid>

Convertor:
class HasAncestorConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter,
        System.Globalization.CultureInfo culture)
    {
        return value != null;
    }
    public object ConvertBack(object value, Type targetType, object parameter,
        System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

Error message:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=; DataItem=null; target element is 'TextBlock' (Name=''); target property is 'NoTarget' (type 'Object')

A: I think @Xameli solution is what you are actually looking for...
but if you simply must do it in a style then you can achieve it using VisualTreeHelper like that:
<Style.Triggers>
            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}, Converter={StaticResource HasAncestorConverter}}" Value="True">
                <Setter Property="Background"
                        Value="{Binding Tag,RelativeSource={RelativeSource Self}}" />

            </DataTrigger>
        </Style.Triggers>

the converter:
class HasAncestorConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        //you probably will have to look a few levels up
        var parent = VisualTreeHelper.GetParent(value) as ItemsControl;
        return item != null;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

A: According to @makc's response I solved the problem this way:
<Grid>
    <Grid.Resources>
        <local:HasAncestorConverter x:Key="HasAncestorConverter" />
        <Style TargetType="TextBlock">
            <Style.Triggers>
                <DataTrigger
                    Binding="{Binding RelativeSource={RelativeSource
                    AncestorType={x:Type ItemsControl}},
                    Converter={StaticResource HasAncestorConverter}}" Value="True">
                    <Setter Property="Background"
                            Value="{Binding Tag,
                            RelativeSource={RelativeSource
                            AncestorType={x:Type ItemsControl}}}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </Grid.Resources>
    <StackPanel>
        <TextBlock Text="Out of ItemControl" />
        <ItemsControl Tag="Blue" >
            <TextBlock Text="Inside of ItemControl" />
        </ItemsControl>
    </StackPanel>
</Grid>

Converter:
class HasAncestorConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter
        , System.Globalization.CultureInfo culture)
    {
        object parent = null;
        if (value != null && parameter != null &&
            parameter is Type && value is DependencyObject)
        {
            var control = value as DependencyObject;
            Type t = parameter as Type;
            parent = ParentFinder.FindParent(control, t);
        }
        return parent != null;
    }

    public object ConvertBack(object value, Type targetType, object parameter
        , System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

Helper class for finding the parent of specific type:
Note: This helper find any kind of parent in logical or visual tree. for example in my case ItemsControl is a parent in the logical tree, and it can be a grandparent.
class ParentFinder
{
    public static object FindParent(DependencyObject child, Type parentType)
    {
        object parent = null;
        var logicalParent = LogicalTreeHelper.GetParent(child);
        var visualParent = VisualTreeHelper.GetParent(child);

        if (!(logicalParent == null && visualParent == null))
        {
            if (logicalParent != null && logicalParent.GetType() == parentType)
                parent = logicalParent;
            else if (visualParent != null && visualParent.GetType() == parentType)
                parent = visualParent;
            else
            {
                if (visualParent != null)
                    parent = FindParent(visualParent, parentType);
                if (parent == null && logicalParent != null)
                    parent = FindParent(logicalParent, parentType);
            }
        }
        return parent;
    }
}

A: Use DataTemplate for the items in ItemsControl.
<ItemsControl ....
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding }"
                       Background="{Binding Tag,
                                            RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
    <sys:String>Inside of ItemControl</String>
</ItemsControl>

Keep the style that you have if you need it for other setters, just remove the trigger.

A: You can work with FallbackValue or TargetNullValue
Check this link out:
http://dontcodetired.com/blog/post/FallbackValue-TargetNullValue-StringFormat-in-Silverlight-4.aspx


text:
Q: Meaning of the word "cajoling" when applied to dairy cattle? I am a German scientist and I read the term cajoling in a scientific paper. It is meant to be a sign for oestrus in dairy cattle, but I am not able to find a suitable translation or explanation. So what is the cow doing if she is cajoling?
The sentence I read was:

Cajoling, although seen more often in dioestrus than during oestrus, had a high frequency during oestrus. It is therefore still relevant.

— Van Eerdenburg FJCM, Loeffler HS, van Vliet JH (1996): Detection of oestrus in dairy cows: a new approach to an old problem. The Veterinary Quarterly 18, 52 – 54

A: Well, this is a nice detective puzzle.
First clue: the article referenced in OP tells us that:

cajoling is difficult to distinguish from  other types of behavior
  that are unrelated to oestrus (e.g., sniffing for fresh air in the air
  inlets)

Next step: Google search for veterinary cajole sniff.
On page 5 of the results, we find another article where the same table we saw in the original article is reproduced -  with one difference: the word cajoling is now followed by an explanatory term in parentheses:

So now we know that cajoling is flehmen - and flehmen has not only a dictionary entry:

flehmen - a mammalian behavior (as of horses or cats) in which the animal
  inhales with the mouth open and upper lip curled to facilitate
  exposure of the vomeronasal organ to a scent or pheromone
http://www.merriam-webster.com/dictionary/flehmen

which agrees nicely with our first clue, but also a Wikipedia article that teaches us that:

The flehmen response (/ˈfleɪmən/; German: [ˈfleːmən]), also called
  the flehmen position, flehmen reaction, flehming, or
  flehmening, is a behavior in which an animal curls back its upper lip exposing its front teeth, inhales with the nostrils usually closed
  and then often holds this position for several seconds.

Confirmation:

El flehmen es difícil de distinguir de otros tipos de conductas que no
  están relacionados al estro, como la inhalación de aire fresco del
  medio por lo que puede ser considerado de menor importancia para
  determinar si una vaca está en celo o no (Van Eerdenburg y col 1996).
  http://jairoserrano.com/2016/02/comportamiento-y-reproduccion-eficiente/

A: If the cow is in a state of estrus then "cajoling" here is likely to mean that she is doing what all cows do when they want to attract the attention of a bull and arouse his sexual interest leading to coitus, etc. I don't have any further and better details on this aspect except to refer the OP to the lyrics of Cole Porter's delightful song, Let's do it. Let's fall in love. (1928)
cajoling: (verb) To persuade someone to do something or to give you something by making promises or saying nice things. (Merriam-Webster)
I would suggest that the cow and bull are likely to interact in a bovine form of cajoling leading to consensual coitus.


text:
Q: Cron expression for running rake task first Thursday of every month I have written following ruby code in rails application :
every '20 8 1-7 * 4' do
  rake 'data_import:check_for_presence_of_file'
end

But above rake task is running ever day at 8:20 am GMT. Is there something wrong with expression ? I have searched internet for cron expression but I have seen conflicting information. Please help.

A: I'm not sure there is a way with cron.
'20 8 1-7 * 4' means the first seven days of the month and on thursdays. Instead perhaps do it the first seven days of the month and in rails check if its thursday:
every '20 8 1-7 * *' do
  rake 'data_import:check_for_presence_of_file' if Date.today.thursday?
end

A: This is correct cron schedule for a Tuesday weekly:
20 8 * * 2

Here are more details:
https://crontab.guru/#20_8___2
In your sample you are using 1-7 which means every day.


text:
Q: Custom number format comparison operator issue I would like to get all values equal an above 80 to be in green, and zeros between 1 and 79 to be on red and all values that are 0 to be blank or color white (either is ok).
I've tried the following ones but zeros are keep showing in red since I cant insert if =0 or something like that.

A: use:
[=0][white]0; [<80][red]0"▼"; [color 50]0"▲"


text:
Q: what is difference between '%[^0-9.-]%' and '%[^0-9]%' in regular expression Can someone please explain for what reason we use .- in the regular expression and what is difference between '%[^0-9.-]%' and '%[^0-9]%'

A: %[^0-9.-]% will include period '.' and dash '-' characters, while %[^0-9]% will not


text:
Q: Rails - Don't want to create a database with only one field, but don't know any other methods So I'm trying to have an "address" input field on one of my view page, and i want to use that "address" as one of my parameters in my API call.
I am not sure if I should create a whole new controller/model just for this one address field, and I am sure there are definitely better ways to do this.
The idea came from Postmates Website, where on the homepage you can enter your address and Postmates will give you a list of available delivery services. I am looking for something similar to this.
Thanks in advance.

A: Create a form who's method points to one of your controller actions and then use the data from the form in that action.
So:
<form action="route/that/handles/delivery/address" method="get">
  <input name="address">
  <input type="submit">
</form>

Then in your controller action:
def handle_address
  params[:address] // do stuff with this
end

A: Why do you need just one field on the table?
I agree it might be better to just send and update the parameter you want to change by modifying the controller instead.


text:
Q: Android app crashes on emulator - logCat shows no errors I have just added the SherlockActionBar library to my android project. After some small changes (FragmentActivity -> SherlockFragmentActivity, getActionBar() -> getSupportActionBar(), imports) it all compiled nicely. After I run the app, however, the debugger stops, as though it had encountered an exception. However, there are no errors shown in the LogCat output. I just can't wrap my head around what's going on.
Here is the logCat output after I terminate the app.
10-02 14:11:19.227: I/SystemUpdateService(174): UpdateTask at time 1349187079227
10-02 14:11:19.237: I/ActivityThread(328): Pub com.android.email.attachmentprovider: com.android.email.provider.AttachmentProvider
10-02 14:11:19.687: I/dalvikvm(81): Jit: resizing JitTable from 512 to 1024
10-02 14:11:19.809: D/MediaScannerService(150): start scanning volume internal: [/system/media]
10-02 14:11:20.047: V/AlarmClock(239): AlarmInitReceiver finished
10-02 14:11:20.087: I/ActivityManager(81): Start proc com.android.quicksearchbox for broadcast com.android.quicksearchbox/.SearchWidgetProvider: pid=346 uid=10012 gids={3003}
10-02 14:11:20.127: D/ExchangeService(320): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false
10-02 14:11:20.427: I/ActivityThread(346): Pub com.android.quicksearchbox.google: com.android.quicksearchbox.google.GoogleSuggestionProvider
10-02 14:11:20.497: I/ActivityThread(346): Pub com.android.quicksearchbox.shortcuts: com.android.quicksearchbox.ShortcutsProvider
10-02 14:11:20.657: I/ActivityManager(81): Start proc com.android.music for broadcast com.android.music/.MediaAppWidgetProvider: pid=358 uid=10028 gids={3003, 1015}
10-02 14:11:20.927: D/ExchangeService(320): !!! EAS ExchangeService, onCreate
10-02 14:11:20.967: D/dalvikvm(260): GC_CONCURRENT freed 213K, 6% free 6409K/6791K, paused 5ms+101ms
10-02 14:11:21.077: D/ExchangeService(320): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
10-02 14:11:21.567: D/GTalkService(174): [ReonnectMgr] ### report Inet condition: status=false, networkType=0
10-02 14:11:21.587: D/ConnectivityService(81): reportNetworkCondition(0, 0)
10-02 14:11:21.597: D/ConnectivityService(81): Inet connectivity change, net=0, condition=0,mActiveDefaultNetwork=0
10-02 14:11:21.597: D/ConnectivityService(81): starting a change hold
10-02 14:11:21.697: D/GTalkService(174): [RawStanzaProvidersMgr] ##### searchProvidersFromIntent
10-02 14:11:21.697: D/GTalkService(174): [RawStanzaProvidersMgr] no intent receivers found
10-02 14:11:21.847: I/SystemUpdateService(174): cancelUpdate (empty URL)
10-02 14:11:21.847: E/TelephonyManager(174): Hidden constructor called more than once per process!
10-02 14:11:21.867: D/dalvikvm(174): GC_CONCURRENT freed 337K, 7% free 6561K/7047K, paused 5ms+4ms
10-02 14:11:21.917: D/GTalkService(174): [ReonnectMgr] ### report Inet condition: status=false, networkType=0
10-02 14:11:21.917: D/ConnectivityService(81): reportNetworkCondition(0, 0)
10-02 14:11:21.917: D/ConnectivityService(81): Inet connectivity change, net=0, condition=0,mActiveDefaultNetwork=0
10-02 14:11:21.917: D/ConnectivityService(81): currently in hold - not setting new end evt
10-02 14:11:21.990: E/TelephonyManager(174): Original: com.google.android.location, new: com.google.android.gsf
10-02 14:11:22.027: I/SystemUpdateService(174): removeAllDownloads (cancelUpdate)
10-02 14:11:22.127: D/dalvikvm(328): GC_CONCURRENT freed 205K, 6% free 6506K/6855K, paused 660ms+3ms
10-02 14:11:22.197: D/Eas Debug(320): Logging:
10-02 14:11:22.319: D/dalvikvm(81): GREF has increased to 401
10-02 14:11:22.947: D/ExchangeService(320): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
10-02 14:11:23.130: D/Eas Debug(320): Logging:
10-02 14:11:23.307: I//system/bin/fsck_msdos(29): Attempting to allocate 2044 KB for FAT
10-02 14:11:23.560: I/ActivityManager(81): Starting: Intent { flg=0x10000000 cmp=com.google.android.gsf/.update.SystemUpdateInstallDialog } from pid 174
10-02 14:11:23.587: I/ActivityManager(81): Starting: Intent { flg=0x10000000 cmp=com.google.android.gsf/.update.SystemUpdateDownloadDialog } from pid 174
10-02 14:11:24.087: W/ActivityManager(81): Activity pause timeout for ActivityRecord{407c7320 com.android.launcher/com.android.launcher2.Launcher}
10-02 14:11:24.237: E/TelephonyManager(174): Hidden constructor called more than once per process!
10-02 14:11:24.237: E/TelephonyManager(174): Original: com.google.android.location, new: com.google.android.gsf
10-02 14:11:24.507: D/dalvikvm(174): GC_EXPLICIT freed 231K, 7% free 6596K/7047K, paused 4ms+6ms
10-02 14:11:24.607: D/ConnectivityService(81): Inet hold end, net=0, condition =0, published condition =0
10-02 14:11:24.607: D/ConnectivityService(81): no change in condition - aborting
10-02 14:11:24.707: D/dalvikvm(174): GC_EXPLICIT freed 17K, 7% free 6579K/7047K, paused 4ms+4ms
10-02 14:11:24.947: I//system/bin/fsck_msdos(29): ** Phase 2 - Check Cluster Chains
10-02 14:11:25.117: I//system/bin/fsck_msdos(29): ** Phase 3 - Checking Directories
10-02 14:11:25.128: I//system/bin/fsck_msdos(29): ** Phase 4 - Checking for Lost Files
10-02 14:11:25.167: I//system/bin/fsck_msdos(29): 12 files, 1044448 free (522224 clusters)
10-02 14:11:25.227: I/Vold(29): Filesystem check completed OK
10-02 14:11:25.227: I/Vold(29): Device /dev/block/vold/179:0, target /mnt/sdcard mounted @ /mnt/secure/staging
10-02 14:11:25.237: D/Vold(29): Volume sdcard state changing 3 (Checking) -> 4 (Mounted)
10-02 14:11:25.257: I/PackageManager(81): Updating external media status from unmounted to mounted
10-02 14:11:25.457: D/dalvikvm(303): GC_EXPLICIT freed 35K, 6% free 6242K/6595K, paused 3ms+312ms
10-02 14:11:25.987: D/ExchangeService(320): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
10-02 14:11:26.157: D/MediaScanner(150):  prescan time: 2905ms
10-02 14:11:26.167: D/MediaScanner(150):     scan time: 148ms
10-02 14:11:26.167: D/MediaScanner(150): postscan time: 2ms
10-02 14:11:26.167: D/MediaScanner(150):    total time: 3055ms
10-02 14:11:26.197: D/MediaScannerService(150): done scanning volume internal
10-02 14:11:26.237: D/MediaScannerService(150): start scanning volume external: [/mnt/sdcard]
10-02 14:11:26.497: D/dalvikvm(143): GC_EXPLICIT freed 234K, 8% free 7735K/8327K, paused 3ms+5ms
10-02 14:11:27.180: D/dalvikvm(143): GC_CONCURRENT freed 150K, 4% free 8004K/8327K, paused 7ms+3ms
10-02 14:11:27.397: D/dalvikvm(143): GC_FOR_ALLOC freed 96K, 6% free 8310K/8775K, paused 76ms
10-02 14:11:27.580: D/dalvikvm(143): GC_FOR_ALLOC freed 515K, 11% free 8135K/9095K, paused 79ms
10-02 14:11:27.829: D/dalvikvm(143): GC_CONCURRENT freed 3K, 5% free 8694K/9095K, paused 7ms+6ms
10-02 14:11:28.137: V/TLINE(143): new: android.text.TextLine@4065b280
10-02 14:11:28.527: D/dalvikvm(143): GC_CONCURRENT freed 729K, 10% free 8764K/9671K, paused 5ms+13ms
10-02 14:11:28.677: D/dalvikvm(143): GC_FOR_ALLOC freed 152K, 11% free 8683K/9671K, paused 99ms
10-02 14:11:28.717: I/dalvikvm-heap(143): Grow heap (frag case) to 11.434MB for 2975968-byte allocation
10-02 14:11:28.807: D/dalvikvm(143): GC_FOR_ALLOC freed 0K, 9% free 11589K/12615K, paused 84ms
10-02 14:11:29.159: D/dalvikvm(143): GC_CONCURRENT freed 197K, 7% free 12195K/12999K, paused 8ms+6ms
10-02 14:11:29.647: D/dalvikvm(143): GC_EXPLICIT freed 351K, 6% free 12790K/13511K, paused 8ms+17ms
10-02 14:11:29.717: I/SurfaceFlinger(32): Boot is finished (70768 ms)
10-02 14:11:29.877: I/ARMAssembler(32): generated scanline__00000177:03010104_00000002_00000000 [ 44 ipp] (66 ins) at [0x407c7290:0x407c7398] in 990662 ns
10-02 14:11:29.907: I/ARMAssembler(32): generated scanline__00000177:03515104_00000001_00000000 [ 73 ipp] (95 ins) at [0x407c73a0:0x407c751c] in 989381 ns
10-02 14:11:30.287: D/dalvikvm(174): GC_EXPLICIT freed 25K, 8% free 6554K/7047K, paused 4ms+32ms
10-02 14:11:30.380: D/dalvikvm(143): GC_EXPLICIT freed 349K, 6% free 13124K/13895K, paused 5ms+25ms
10-02 14:11:30.957: D/dalvikvm(143): GC_FOR_ALLOC freed 1069K, 10% free 13860K/15239K, paused 81ms
10-02 14:11:32.177: D/dalvikvm(150): GC_CONCURRENT freed 183K, 6% free 6438K/6791K, paused 5ms+4ms
10-02 14:11:32.187: W/ActivityManager(81): No content provider found for:
10-02 14:11:32.607: V/MediaScanner(150): pruneDeadThumbnailFiles... android.database.sqlite.SQLiteCursor@406724a8
10-02 14:11:32.617: V/MediaScanner(150): /pruneDeadThumbnailFiles... android.database.sqlite.SQLiteCursor@406724a8
10-02 14:11:32.640: W/ActivityManager(81): No content provider found for:
10-02 14:11:32.640: D/VoldCmdListener(29): asec list
10-02 14:11:32.647: I/PackageManager(81): No secure containers on sdcard
10-02 14:11:32.667: D/MediaScanner(150):  prescan time: 107ms
10-02 14:11:32.667: D/MediaScanner(150):     scan time: 89ms
10-02 14:11:32.667: D/MediaScanner(150): postscan time: 61ms
10-02 14:11:32.667: D/MediaScanner(150):    total time: 257ms
10-02 14:11:32.697: W/PackageManager(81): Unknown permission android.permission.ADD_SYSTEM_SERVICE in package com.android.phone
10-02 14:11:32.707: W/PackageManager(81): Unknown permission com.android.smspush.WAPPUSH_MANAGER_BIND in package com.android.phone
10-02 14:11:32.737: W/PackageManager(81): Not granting permission android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS to package com.android.browser (protectionLevel=2 flags=0x9be45)
10-02 14:11:32.737: W/PackageManager(81): Not granting permission android.permission.BIND_APPWIDGET to package com.android.widgetpreview (protectionLevel=3 flags=0x28be44)
10-02 14:11:32.767: W/PackageManager(81): Unknown permission android.permission.READ_OWNER_DATA in package com.android.exchange
10-02 14:11:32.778: W/PackageManager(81): Unknown permission android.permission.READ_OWNER_DATA in package com.android.email
10-02 14:11:32.788: W/PackageManager(81): Unknown permission com.android.providers.im.permission.READ_ONLY in package com.google.android.apps.maps
10-02 14:11:32.797: W/PackageManager(81): Not granting permission android.permission.DEVICE_POWER to package com.android.deskclock (protectionLevel=2 flags=0x8be45)
10-02 14:11:33.137: D/MediaScannerService(150): done scanning volume external
10-02 14:11:33.197: D/PackageParser(81): Scanning package: /data/app/vmdl257911298.tmp
10-02 14:11:33.837: I/InputReader(81): Device reconfigured: id=0, name='qwerty2', surface size is now 1024x800
10-02 14:11:34.097: D/dalvikvm(81): GC_CONCURRENT freed 12185K, 47% free 13966K/26311K, paused 8ms+23ms
10-02 14:11:36.798: I/TabletStatusBar(124): DISABLE_CLOCK: no
10-02 14:11:36.798: I/TabletStatusBar(124): DISABLE_NAVIGATION: no
10-02 14:11:37.348: I/ARMAssembler(32): generated scanline__00000177:03515104_00001001_00000000 [ 91 ipp] (114 ins) at [0x407c7520:0x407c76e8] in 919320 ns
10-02 14:11:37.598: I/TabletStatusBar(124): DISABLE_BACK: no
10-02 14:11:37.710: I/ActivityManager(81): Displayed com.android.launcher/com.android.launcher2.Launcher: +46s212ms
10-02 14:11:38.817: D/dalvikvm(143): GC_CONCURRENT freed 969K, 8% free 14867K/16007K, paused 4ms+10ms
10-02 14:11:39.437: I/dalvikvm(81): Jit: resizing JitTable from 1024 to 2048
10-02 14:11:40.267: D/dalvikvm(143): GC_FOR_ALLOC freed 2357K, 16% free 14395K/17031K, paused 80ms
10-02 14:11:40.717: D/dalvikvm(143): GC_EXPLICIT freed 742K, 16% free 14358K/17031K, paused 8ms+4ms
10-02 14:11:41.617: D/dalvikvm(81): GC_CONCURRENT freed 1955K, 48% free 13869K/26311K, paused 9ms+10ms
10-02 14:11:42.559: D/dalvikvm(81): GC_CONCURRENT freed 1830K, 48% free 13881K/26311K, paused 9ms+9ms
10-02 14:11:42.758: I/PackageManager(81): Removing non-system package:cz.trilimi.sfaui
10-02 14:11:42.758: I/ActivityManager(81): Force stopping package cz.trilimi.sfaui uid=10036
10-02 14:11:42.967: D/PackageManager(81): Scanning package cz.trilimi.sfaui
10-02 14:11:42.967: I/PackageManager(81): Package cz.trilimi.sfaui codePath changed from /data/app/cz.trilimi.sfaui-1.apk to /data/app/cz.trilimi.sfaui-2.apk; Retaining data and using new
10-02 14:11:42.967: I/PackageManager(81): Unpacking native libraries for /data/app/cz.trilimi.sfaui-2.apk
10-02 14:11:43.097: D/installd(35): DexInv: --- BEGIN '/data/app/cz.trilimi.sfaui-2.apk' ---
10-02 14:11:45.317: D/dalvikvm(391): DexOpt: load 434ms, verify+opt 1260ms
10-02 14:11:45.407: D/installd(35): DexInv: --- END '/data/app/cz.trilimi.sfaui-2.apk' (success) ---
10-02 14:11:45.407: W/PackageManager(81): Code path for pkg : cz.trilimi.sfaui changing from /data/app/cz.trilimi.sfaui-1.apk to /data/app/cz.trilimi.sfaui-2.apk
10-02 14:11:45.407: W/PackageManager(81): Resource path for pkg : cz.trilimi.sfaui changing from /data/app/cz.trilimi.sfaui-1.apk to /data/app/cz.trilimi.sfaui-2.apk
10-02 14:11:45.407: D/PackageManager(81):   Activities: cz.trilimi.sfaui.ItemListActivity cz.trilimi.sfaui.ItemDetailActivity
10-02 14:11:45.427: I/ActivityManager(81): Force stopping package cz.trilimi.sfaui uid=10036
10-02 14:11:45.657: I/installd(35): move /data/dalvik-cache/data@app@cz.trilimi.sfaui-2.apk@classes.dex -> /data/dalvik-cache/data@app@cz.trilimi.sfaui-2.apk@classes.dex
10-02 14:11:45.657: D/PackageManager(81): New package installed in /data/app/cz.trilimi.sfaui-2.apk
10-02 14:11:45.997: I/ActivityManager(81): Force stopping package cz.trilimi.sfaui uid=10036
10-02 14:11:46.147: D/dalvikvm(143): GC_EXPLICIT freed 3K, 16% free 14356K/17031K, paused 10ms+9ms
10-02 14:11:46.237: D/PackageManager(81): generateServicesMap(android.accounts.AccountAuthenticator): 3 services unchanged
10-02 14:11:46.277: D/PackageManager(81): generateServicesMap(android.content.SyncAdapter): 5 services unchanged
10-02 14:11:46.337: D/PackageManager(81): generateServicesMap(android.accounts.AccountAuthenticator): 3 services unchanged
10-02 14:11:46.347: D/PackageManager(81): generateServicesMap(android.content.SyncAdapter): 5 services unchanged
10-02 14:11:46.437: D/dalvikvm(208): GC_EXPLICIT freed 258K, 7% free 6488K/6919K, paused 3ms+5ms
10-02 14:11:46.477: W/RecognitionManagerService(81): no available voice recognition services found
10-02 14:11:46.897: I/ActivityManager(81): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=398 uid=10006 gids={}
10-02 14:11:47.087: I/ActivityThread(398): Pub com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider
10-02 14:11:47.138: D/GTalkService(174): [GTalkService.1] handlePackageInstalled: re-initialize providers
10-02 14:11:47.147: D/GTalkService(174): [RawStanzaProvidersMgr] ##### searchProvidersFromIntent
10-02 14:11:47.147: D/GTalkService(174): [RawStanzaProvidersMgr] no intent receivers found
10-02 14:11:47.718: I/AccountTypeManager(208): Loaded meta-data for 1 account types, 0 accounts in 186ms
10-02 14:11:48.377: D/dalvikvm(143): GC_CONCURRENT freed 1865K, 15% free 14513K/17031K, paused 7ms+4ms
10-02 14:11:48.917: D/dalvikvm(208): GC_CONCURRENT freed 219K, 6% free 6788K/7175K, paused 7ms+73ms
10-02 14:11:49.207: D/dalvikvm(143): GC_FOR_ALLOC freed 4558K, 31% free 11866K/17031K, paused 89ms
10-02 14:11:49.587: D/dalvikvm(143): GC_CONCURRENT freed 713K, 24% free 13010K/17031K, paused 5ms+4ms
10-02 14:11:49.967: D/dalvikvm(143): GC_CONCURRENT freed 1046K, 19% free 13922K/17031K, paused 5ms+4ms
10-02 14:11:50.437: D/dalvikvm(81): GC_EXPLICIT freed 898K, 47% free 13955K/26311K, paused 6ms+39ms
10-02 14:11:50.467: I/installd(35): unlink /data/dalvik-cache/data@app@cz.trilimi.sfaui-1.apk@classes.dex
10-02 14:11:50.477: D/AndroidRuntime(227): Shutting down VM
10-02 14:11:50.507: D/dalvikvm(227): GC_CONCURRENT freed 97K, 84% free 331K/2048K, paused 1ms+2ms
10-02 14:11:50.507: I/AndroidRuntime(227): NOTE: attach of thread 'Binder Thread #3' failed
10-02 14:11:50.517: D/jdwp(227): adbd disconnected
10-02 14:11:51.177: D/AndroidRuntime(410): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
10-02 14:11:51.177: D/AndroidRuntime(410): CheckJNI is ON
10-02 14:11:51.897: D/AndroidRuntime(410): Calling main entry com.android.commands.am.Am
10-02 14:11:51.937: I/ActivityManager(81): Force stopping package cz.trilimi.sfaui uid=10036
10-02 14:11:51.937: I/ActivityManager(81): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=cz.trilimi.sfaui/.ItemListActivity } from pid 410
10-02 14:11:51.968: W/WindowManager(81): Failure taking screenshot for (230x179) to layer 21005
10-02 14:11:51.997: I/ActivityManager(81): Start proc cz.trilimi.sfaui for activity cz.trilimi.sfaui/.ItemListActivity: pid=418 uid=10036 gids={}
10-02 14:11:52.007: D/AndroidRuntime(410): Shutting down VM
10-02 14:11:52.057: I/AndroidRuntime(410): NOTE: attach of thread 'Binder Thread #3' failed
10-02 14:11:52.097: D/dalvikvm(410): GC_CONCURRENT freed 98K, 83% free 360K/2048K, paused 1ms+0ms
10-02 14:11:52.097: D/jdwp(410): adbd disconnected
10-02 14:11:53.147: W/ActivityThread(418): Application cz.trilimi.sfaui is waiting for the debugger on port 8100...
10-02 14:11:53.207: I/System.out(418): Sending WAIT chunk
10-02 14:11:53.217: I/dalvikvm(418): Debugger is active
10-02 14:11:53.447: I/System.out(418): Debugger has connected
10-02 14:11:53.457: I/System.out(418): waiting for debugger to settle...
10-02 14:11:53.637: I/ARMAssembler(32): generated scanline__00000177:03515104_00001002_00000000 [ 87 ipp] (110 ins) at [0x407c76f0:0x407c78a8] in 598498 ns
10-02 14:11:53.660: I/System.out(418): waiting for debugger to settle...
10-02 14:11:53.857: I/System.out(418): waiting for debugger to settle...
10-02 14:11:54.057: I/System.out(418): waiting for debugger to settle...
10-02 14:11:54.257: I/System.out(418): waiting for debugger to settle...
10-02 14:11:54.317: V/TLINE(81): new: android.text.TextLine@4155dde8
10-02 14:11:54.467: I/System.out(418): waiting for debugger to settle...
10-02 14:11:54.667: I/System.out(418): waiting for debugger to settle...
10-02 14:11:54.870: I/System.out(418): waiting for debugger to settle...
10-02 14:11:55.027: D/dalvikvm(143): GC_EXPLICIT freed 900K, 16% free 14420K/17031K, paused 7ms+4ms
10-02 14:11:55.067: I/System.out(418): waiting for debugger to settle...
10-02 14:11:55.292: I/System.out(418): debugger has settled (1315)
10-02 14:12:02.008: W/ActivityManager(81): Launch timeout has expired, giving up wake lock!
10-02 14:12:02.971: W/ActivityManager(81): Activity idle timeout for ActivityRecord{4078c6b0 cz.trilimi.sfaui/.ItemListActivity}
10-02 14:12:08.359: D/ExchangeService(320): Received deviceId from Email app: androidc259148960
10-02 14:12:08.507: D/ExchangeService(320): Reconciling accounts...
10-02 14:16:11.437: D/SntpClient(81): request time failed: java.net.SocketException: Address family not supported by protocol
10-02 14:17:21.573: W/jdwp(418): Debugger is telling the VM to exit with code=1
10-02 14:17:21.573: I/dalvikvm(418): GC lifetime allocation: 8642 bytes
10-02 14:17:21.637: D/Zygote(33): Process 418 exited cleanly (1)
10-02 14:17:21.651: I/ActivityManager(81): Process cz.trilimi.sfaui (pid 418) has died.
10-02 14:17:21.847: D/dalvikvm(143): GC_EXPLICIT freed <1K, 16% free 14420K/17031K, paused 7ms+7ms
10-02 14:17:21.917: W/InputManagerService(81): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40bfbf28

A: Somehow I managed to fix it, I don't precisely know what fixed it. Either restarting Eclipse and emulator and LogCat or resetting the debug configuration or maybe even something else.
LogCat then showed an error: missing the Sherlock.theme
So that might have been the actual cause of the crashes (but it also might have not).


text:
Q: ValueError: Cannot convert *.csv stuff* to excel I am batch-coverting .csv files to .xlsx files using a quick python script:
import csv
import glob
import openpyxl
import os

for csv_file in glob.glob(os.path.join('.', '*.csv')):
    wb = openpyxl.Workbook()
    ws = wb.active
    with open(csv_file, 'rU') as f:
        reader = csv.reader(f)
        for r, row in enumerate(reader, start=1):
            for c, val in enumerate(reader, start=1):
                ws.cell(row=r,column=c).value = val
    wb.save(os.path.splitext(csv_file)[0] + '.xlsx')

And the .csv files look like so:
.csv files
I am getting this error from the command line and I am unsure what is going wrong, can anyone help?
ValueError: Cannot convert ['1', '82', '1', 'Mar 31', 'MIN', '@', 'CHW', 'L3-
5', 'CG', '3', '3', '2', '2', '1', '0', '0', '0', '0', '0', '1', '0', '0',
'0', '0', '0', '0', '0', '.667', '.667', '1.000', '1.667', '8', '1.20',
'0.092', '0.99', 'CF'] to Excel

A: try it with  pandas.read_csv() and pandas.to_excel()
happy coding


text:
Q: database query not matching second condition Seems like a stupid thing to get stuck on right now but I can't get a second condition to match my database column.  When I do it like this:
"SELECT * FROM comments WHERE article_id='$link'"

I get all the comments related to the article name.  But when I add a second condition, I get nothing:
"SELECT * FROM comments WHERE article_id='$link' AND show=1"

I tried doing show='1' also and that didn't work.  The last column in my database is an INT and default value is as defined:1.  How can I get my multi conditional query to work?  Thanks...

A: show is a keyword in mysql. The query must be failing. Use show with backticks like this `show`

A: Your error isn't in just condition. SHOW is in list of MySQL reserved words. So escape it:
SELECT * FROM comments WHERE article_id='$link' AND `show`=1

-or else, don't use reserved words for naming columns. Of course, be sure that rows with show=1 exist in table.

A: show is mysql reserved word, so you need wrap it with backtick `show`
"SELECT * FROM comments WHERE article_id='$link' AND `show`=1"


text:
Q: vb check if 2 strings have 2 not equal chars for example we have 2 Strings.
string1 = "abcdef"
string2 = "abvdtf"

How i can check now if more than 2 chars are different, it should return me false.

A: You could use the following function:-
Public Function Compare(s1 As String, s2 As String, errorlimit As Integer) As Boolean
    Dim ErrorCount As Integer = 0
    For x As Integer = 0 To s1.Length - 1
        If s1(x) <> s2(x) Then
            ErrorCount += 1
        End If
    Next
    If ErrorCount > errorlimit Then
        Return False
    Else
        Return True
    End If
End Function

A return value of true means that either the strings are identical or the number of different characters is less than the error limit specified. A return value of false means that the number of different characters exceeds the error limit specified.


text:
Q: Ffmpeg & PHP - Small Clip with Good Quality what are the best options to keep video in nearly good quality while converting it to flv and shrinking its size?
I use the followin code now:
exec("ffmpeg -i $faila -sameq -s 600x450  -ar 44100 $file_final");

A: Which codec do you intend to use? For smallest size use h.264. I don't know if ffmpeg supports this but if you're looking to retain as much of quality while shrinking size, it's the best option you got.
Note that it's hard to come up with a preset that will work best for all kinds of source material. It would help if you updated the question with some information on your source material, a typical use case perhaps.


text:
Q: What tables do I have to create in order to keep track of shipments? I have Suppliers, Clients and Items tables in my database. I need to keep track of shipments received from suppliers. Each shipment contain many items. I also need to keep track of damaged items from shipments and whether the damaged items are returned or not.
I'm planing to create two extra table called:

*

*Shipment (Shipment_id, supplier_id)

*Shipment-Tracking (Shipment_id, items_id, damage, returned)

Is there any better way to create this relationship?

A: Depending on the nature of your items, you might want to include a quantity in your Shipment-Tracking table.
You might also add some other information to your Shipment table, like the date of the shipment, and so on.
Otherwise, keeping a shipment header and a shipment detail table is a good design.  It is in third normal form, which is a good place to start in a transactional system.


text:
Q: WCF Protocol Error. What have I missed? I have constructed a WCF service that works fine with the standard settings but then I decided to try and implement a SOAP 1.2 binding. Since making the changes to the web.config and the client code I now find that I am getting a protocol exception and I have no idea why or what causes it. Please see my code below. The configuration looks correct to me so I can only guess there is a problem in the client code. Any ideas more than welcome:
The web.config
<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="Namespace.ServiceName" behaviorConfiguration="EToNServiceBehavior">
        <endpoint name="EToNSoap12" address=""
                  binding="customBinding" bindingConfiguration="soap12"
                  bindingNamespace="http://www.wrcplc.co.uk/Schemas/ETON"
                  contract="Namespace.IInterfaceName" />
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="EToNServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <customBinding>
        <binding name="soap12">
          <textMessageEncoding messageVersion="Soap12" />
          <httpTransport />
        </binding>
      </customBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
</configuration>

The Interface
namespace TheNamespace
{
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Web;

/// <summary>
/// An interface to describe the contract offered by a class of this type.
/// </summary>
[ServiceContract]
public interface IInterfaceName
    {
    /// <summary>
    /// A method to receive an EtoN notice
    /// </summary>
    /// <param name="message">The EtoN message</param>
    [OperationContract (Name = "StoreNotice")]
    [WebInvoke (Method = "POST", UriTemplate = "StoreNotice")]
    Message StoreNotice (Message message);
    }
}

The Client Code
public string CallPostMethod()
    {
        const string action = "StoreNotice";

        TestNotice testNotice = new TestNotice();

        const string url = "http://myIp:myPort/ServiceName.svc/StoreNotice";

        string contentType = String.Format("application/soap+xml; charset=utf-8; action=\"{0}\"", action);
        string xmlString = CreateSoapMessage(url, action, testNotice.NoticeText);

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

        ASCIIEncoding encoding = new ASCIIEncoding();

        byte[] bytesToSend = encoding.GetBytes(xmlString);

        request.Method = "POST";
        request.ContentLength = bytesToSend.Length;
        request.ContentType = contentType;

        using (Stream requestStream = request.GetRequestStream())
        {
            requestStream.Write(bytesToSend, 0, bytesToSend.Length);
            requestStream.Close();
        }

        string responseFromServer;

        try
        {
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            using (Stream dataStream = response.GetResponseStream())
        {
            using (StreamReader reader = new StreamReader(dataStream))
            {
                responseFromServer = reader.ReadToEnd();
            }
            dataStream.Close();
        }

        XDocument document = XDocument.Parse(responseFromServer);

            return document.ToString();
        }
        catch(WebException e)
            {
            throw e;
            }
    }

    protected string CreateSoapMessage(string url, string action, string messageContent)
    {
        return String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
        <soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""    xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">
            <soap12:Body>
            {0}
            </soap12:Body>
        </soap12:Envelope>", messageContent, action, url);
    }

EDIT
By using the trace viewer I have been presented with this information:

The message with To
  'http://localhost:56919/TmaNoticeToClusteredEntityWcfService.svc/StoreNotice'
  cannot be processed at the receiver, due to an AddressFilter mismatch
  at the EndpointDispatcher.  Check that the sender and receiver's
  EndpointAddresses agree.

What is wrong with my code that would produce this? It looks ok to me.

A: If client is a .Net application you can create service proxy to call it as below.
Proxy.ServiceClient client = new Proxy.ServiceClient();
client.StoreNotice(GetMessage());

Method GetMessage()
 public static Message GetMessage()
        {
            //create an XML reader from the input XML
            XmlReader reader = XmlReader.Create(new MemoryStream(Encoding.Default.GetBytes(CreateSoapMessage("http://localhost:8732/Design_Time_Addresses/WCFCustomEndpointService/Service1/", "http://tempuri.org/IService1/StoreNotice", "content"))));

            //create a WCF message from the XML reader
            Message inputMessge = Message.CreateMessage(MessageVersion.Soap12, "http://tempuri.org/IService1/StoreNotice", reader);

            return inputMessge;
        }

Copy of your method CreateSoapMessage
 protected static string CreateSoapMessage(string url, string action, string messageContent)
        {
            return String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?><soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope""><soap12:Body>{0}</soap12:Body></soap12:Envelope>", messageContent, action, url);
        }


text:
Q: Solr/Lucene "kit" to test searching? Is there a "code free" way to get SOLR/LUCENE (or something similar) pointed at a set of word docs to make them quickly searchable by a user?
I am prototyping, seeing if there is value in, a system to search through some homegrown news articles. Before I stand up code to handle search string input and document indexing, I wanted to see if it was even worth it before I starting trying to figure it all out.
Thanks,
Judd

A: Using the bin/post tool of Solr and the Tika handler (named the ExtractingRequestHandler), you should be able to get something up and running for prototyping rather quickly.
See the introduction of Uploading Data with Solr Cell using Apache Tika. Tika is used to process a wide range of different document types.
You can give the Solr post tool a directory or a list of files to submit to the index.

Automatically detect content types in a folder, and recursively scan it for documents for indexing into gettingstarted.
bin/post -c gettingstarted afolder/


text:
Q: Which statistical test to use? I am really confused. I have a research paper; I used two scales to measure marital adjustment and social roles.
I applied them to 150 people.
I would like say something about how males who got high scores on the social roles scale compare to women who also got high scores on marital adjustment scores, or vise versa.
The scores are both interval measures.
I'm confused what tests to use.
I want to test a hypothesis that if men get higher social role scores and women get higher on social role scores, then marital adjustment scores are also higher.

A: You could try a general linear model: the response is marital adjustement, the independent variables are gender and social role. You could also include an interaction term with gender and social role -- maybe social role improves marital adjustment for both men and women, but has a bigger impact on men. The interaction effect would allow you to test that possibility.
If the men and women are couples, then it's a whole other ball game. You would want a multivariate model of some kind.

A: Agreed with @Placidia.
response variable - marital adjustment score (continuous)
predictors - social role score and gender
Multivariate regression or MANCOVA can be used.


text:
Q: Spring application with embedded jetty can't find webdefault.xml if running from jar I have spring application which uses embedded Jetty instance.
project
   | src
      | controller
      | webapps
          | jsp
          | WEB-INF
              | web.xml
              | applicationContext.xml
              | spring-servlet.xml

my jar has the same tree structure but I keep getting
    d:\test>java -jar springtest.jar
2011-11-22 15:37:02.576:INFO::jetty-7.x.y-SNAPSHOT
2011-11-22 15:37:02.686:WARN::Failed startup of context o.e.j.w.WebAppContext{/,[file:/C:/Users/me/AppData/Local/Temp/jetty-0.0.0.0-8080-webapps-_-any-/webinf
/, jar:file:/d:/test/springtest.jar!/org/jcvi/webapps/]}
java.io.FileNotFoundException: d:\test\org\eclipse\jetty\webapp\webdefault.xml (The system cannot find
the path specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
        at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:653)
        at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
        at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:188)
        at org.eclipse.jetty.xml.XmlParser.parse(XmlParser.java:204)
        at org.eclipse.jetty.webapp.Descriptor.parse(Descriptor.java:60)
        at org.eclipse.jetty.webapp.WebDescriptor.parse(WebDescriptor.java:140)
        at org.eclipse.jetty.webapp.MetaData.setDefaults(MetaData.java:141)
        at org.eclipse.jetty.webapp.WebXmlConfiguration.preConfigure(WebXmlConfiguration.java:46)
        at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:412)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
        at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:89)
        at org.eclipse.jetty.server.Server.doStart(Server.java:258)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:58)
        at org.jcvi.ServerRunner.startServer(ServerRunner.java:83)
        at org.jcvi.MainServer.main(MainServer.java:18)
2011-11-22 15:37:02.748:INFO::Started SelectChannelConnector@0.0.0.0:8080 STARTING

I have following java class which runs jetty server instance
String webDir = this.getClass().getClassLoader().getResource("webapps").toExternalForm();
Server server = new Server(8080);

WebAppContext context = new WebAppContext();
context.setContextPath("/");
context.setResourceBase(webDir);
context.setParentLoaderPriority(true);
HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { context, new DefaultHandler() });
server.setHandler(context);
server.start();

my web.xml looks like
<welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <servlet>
        <servlet-name>spring</servlet-name>
            <servlet-class>
                org.springframework.web.servlet.DispatcherServlet
            </servlet-class>
        <load-on-startup>2</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

this application runs fine if I run inside IDE, but it fails with JAR.
How can I resolve this issue so that I can have single jar file which has the web application in it?

A: It seems that jetty's trying to parse the web.xml (descriptor) file, but thinks its in
.../...../...../webdefault.xml

or something like that.
You should explicitly set the web.xml path:
context.setDescriptor("WEB-INF/web.xml"); `

or, assuming that your jar really does include the aformentioned 'project' dir (which isn't standard jar intrernal layout):
context.setDescriptor("project/src/webapps/WEB-INF/web.xml");

A: I had a similar problem and I solve it with this main class implementation:
private static final int PORT = 8080;
private static final String WAR_LOCATION = "src/webapps"; //in your case I guess
private static final String CONTEXT_PATH = "/movence"; //change it if you want

public static void main(String[] args) throws Exception {
    Server server = new Server();
    WebAppContext context = new WebAppContext();
    SocketConnector connector = new SocketConnector();

    setupConnector(connector);
    setupContext(server, context);
    setupServer(server, context, connector);
    startServer(server);
}

private static void startServer(Server server) throws Exception, InterruptedException {
    server.start();
    server.join();
}

private static void setupServer(Server server, WebAppContext context, SocketConnector connector) {
    server.setConnectors(new Connector[] { connector });
    server.addHandler(context);
}

private static void setupConnector(SocketConnector connector) {
    connector.setPort(PORT);
}

private static void setupContext(Server server, WebAppContext context) {
    context.setServer(server);
    context.setContextPath(CONTEXT_PATH);
    context.setWar(WAR_LOCATION);
}

A: From @Trein's post, setting the WAR_LOCATION is important. I have seen jetty failing to deploy the web app when this is missing.
Assuming that you are using Jetty to test your app, if you are using Maven POM below is how I test my web app
pom.xml
 <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-servlet-tester</artifactId>
            <version>6.1.22</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <version>6.1.19</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>tomcat</id>
 <build>
        <plugins>
                    <plugin>
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>maven-jetty-plugin</artifactId>
                        <version>6.1.22</version>
                        <configuration>
                            <scanIntervalSeconds>10</scanIntervalSeconds>
                            <stopKey>foo</stopKey>
                            <stopPort>9999</stopPort>
                            <contextPath>/</contextPath>
                            <webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>
                            <systemProperties>
                                <systemProperty>
                                    <name>RESOURCE_PATH</name>
                                    <value>${project.build.outputDirectory}</value>
                                </systemProperty>
                            </systemProperties>
                            <connectors>
                                <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                                    <port>9090</port>
                                    <maxIdleTime>60000</maxIdleTime>
                                </connector>
                            </connectors>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>test-compile</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <scanIntervalSeconds>0</scanIntervalSeconds>
                                    <daemon>true</daemon>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop-jetty</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
</profiles>

To run the webapp you can either run mvn jetty:start or run mvn package. This starts the Jetty server on port 9090 and runs the tests (run your http based tests here) and shutdown the server/webapp.
If you want to run as standalone webapp, use mvn jetty:start and use your webapp just like any webapp container.
This all assumes you are using Maven. The code above provided by @Trein does the same programatically and the one I provided is the maven configuration equivalent of the above.
Note: You shouldn't worry about webdefault.xml as the default is already packaged in the jetty jar file. You should use your own webdefault.xml only when you need to extend/alter the defaults. There is either something wrong with your Jetty jar (if its reporting this or something to do with your CLASSPATH settings)

A: Found this github project :
https://github.com/steveliles/jetty-embedded-spring-mvc
This gives a basic startup template project based on maven. It embedded jetty with spring mvc.
Good place to start from scratch or to compare and debug what's wrong with current implementation.
The author has done a nice documentation here :
http://steveliles.github.io/setting_up_embedded_jetty_8_and_spring_mvc_with_maven.html

A: Probably a little bit out-dated. However I recently encountered this problem in the context of embedding Jetty in an Eclipse OSGi application using the version of Jetty packaged with Eclipse (Jetty 8.x).
The way I sorted this out is the following :

*

*Get the URL of the webdefault.xml relative to the org.eclipse.jetty.webapp bundle

*Pass this URL to the context default descriptor

Bundle bundle = FrameworkUtil.getBundle(WebAppContext.class);
Enumeration<URL> urls = bundle.findEntries("/", "webdefault.xml", true);
String webdefaultURL = urls.nextElement().toExternalForm(); // Should check returned value
mycontext.setDefaultsDescriptor(webdefaultURL);

Hope it helps
seb

A: Your webdefault.xml (Jetty) is missing:

java.io.FileNotFoundException: d:\test\org\eclipse\jetty\webapp\webdefault.xml

see "What is webdefault.xml?"
If you have a custom location, you need to add it:
context.setDefaultsDescriptor("/my/path/to/webdefault.xml");