text:
Q: Are columDefs and columns mutually exclusive? I want to make a table from JSON data formatted as arrays. Within that table, the column titles are dynamic (they're week numbers) but the rendering function for a specific column isn't. So I wanted to use the columns options for the title and the columnDefs for the rendering function.
Here's what I have so far:
var messagesDataRaw = {
    data: [
        ["03", "129", "129", "77.36%"],
        ["40", "172", "396", "10.32%"],
        ["41", "614", "180", "10.29%"],
        ["43", "155", "221", "9.30%"]
],
    columns: [
        { title: 'team' },
        { title: '32' },
        { title: '33' },
        { title: 'rate' }
    ]};
var messagesData = messagesDataRaw.data;
var messagesCol = messagesDataRaw.columns;

var renderExceptionFct = function(data, type, row, meta) {
    return '' + data + '';
};

$('#messages_datatable').DataTable( {
    data: messagesData,
    columns: messagesCol,
    paging: false,
    ordering: false,
    searching: false,
    info: false,
    columnDefs: [{
        target: 0,
        type: "display",
        render: renderExceptionFct
    }
]});

However, this doesn't work. I might resort to using only the column option but this would imply sending the render function every time and i'd rather avoid that.

A: No, both options columns and columnDefs can be used at the same time. See official documentation for more details.
Problem with your code not working is that you've a typo in your initialization code, it should be columnDefs.targets and not columnDefs.target, see below:
columnDefs: [{
    targets: 0,
    type: "display",
    render: renderExceptionFct
}


text:
Q: Bracing fraction numerator or denominator to the left or right I have a fraction with further fractions in both the numerator and denominator. I wish to label the fractions in the numerator and denominator with braces to the right. I would like these braces to span the full height of the fractions but I would not like them to extend the fraction line any further.
I have tried \frac{a}{\left.\frac{b}{c}\right}} which achieves the former but not the latter and I have tried \frac{a}{\frac{b}{c}\mathrlap{\}}} which achieves the latter but not the former, since I can't put one half of the \left \right pair inside \mathrlap and the other half outside.

A: Perhaps what you are looking for is a combination of \mathrlap and \smash which is what is incorporated in the \BraceRight and \BraceLeft macros.

However, as HendrikVogt pointed out,
this requires that there be manual spacing added afterwards if there is text that follows it.
To alleviate this issue I have defined two more macros \FracBraceBottomRight and \FracBraceBottomLeft which also add the approriate \hptantom after or before the fraction.

One downside of this this is that you need a different macro in case you desire further options (such as optional braces around either side of the numerator. This can be fixed with a better interface to enable/disable the appropriate brace, but I think that that is more of a question of coming up with the better UI.
References:

*

*The \BracKern is to adjust for the horizontal space inserted by the \left., \right. as per How to compute exact width added by \left. \right
Code:
\documentclass{article}
\usepackage{mathtools}

\newcommand*{\BraceRight}[1]{#1\mathrlap{\smash{\left.\vphantom{#1}\right\}}}}%
\newcommand*{\BraceLeft}[1]{\mathllap{\smash{\left\{\vphantom{#1}\right.}}#1}%

% https://tex.stackexchange.com/questions/54023/how-to-compute-exact-width-added-by-left-right
\newcommand{\BracKern}{\kern-\nulldelimiterspace}
\newcommand*{\FracBraceBottomRight}[2]{%
    \frac{#1}{#2\mathrlap{\smash{\left.\BracKern\vphantom{#2}\right\}}}}%
    \hphantom{\left.\vphantom{#2}\right\}}%
}%
\newcommand*{\FracBraceBottomLeft}[2]{%
    \hphantom{\left\{\vphantom{#2}\right.\BracKern}%
    \frac{#1}{\mathllap{\smash{\left\{\vphantom{#2}\right.}}#2}%
}%

\begin{document}
Requires manual spacing:

$\frac{a}{\frac{b}{c}}$\quad%
$\frac{a}{\BraceLeft{\frac{b}{c}}}$\quad%
$\frac{a}{\BraceRight{\frac{b}{c}}}$

\bigskip
Auto spacing with \verb|\hphantom|:

$\FracBraceBottomRight{a}{\frac{b}{c}}$%
$\FracBraceBottomRight{a}{\frac{b}{c}}$%
$\FracBraceBottomLeft{a}{\frac{b}{c}}$%
$\FracBraceBottomLeft{a}{\frac{b}{c}}$
\end{document}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can echo the string in PHP to output variable "$_GET" and "[ ]"? I have a script that read in a text file using foreach loop, but the string is unable to recognize "$_GET" or "[ ]" to display or to echo out the string. If the the echo works correctly then I can append the string output to another php file to execute, but I'm not able to make the string to echo appropriately. Please advice. Thx
<?php

$filename = "./client.txt";
echo $filename ."\n"."<br>" ;
$contents = file($filename);
foreach ($contents as $line) {
    $line = str_replace(PHP_EOL, '', $line);
    $str = " $$line=$_GET["$line"]; " ;
echo $str;
}

?>

 --------------------------------------
 Text file: client.txt
 DEPLOYMENT_ID
 CLINICAL_APP
 ZOO_MAX
 SVN_REPO

 ---------------------------------------
 Echo output should be:

 $DEPLOYMENT_ID=$_GET["DEPLOYMENT_ID"];
 $CLINICAL_APP=$_GET["CLINICAL_APP"];
 $ZOO_MAX=$_GET["ZOO_MAX"];
 $SVN_REPO=$_GET["SVN_REPO"];

A: If you just want to echoing it, use ' single quote inside GET :
$str = " $$line=$_GET['" . $line . "'] " ;

A: you can use sprintf
like sprintf("$%s=\$_GET['%s']",$line,$line);


text:
Q: Composer install using Homestead gives error "Your requirements could not be resolved to an installable set of packages" I am trying to install my composer packages using the following command:
composer install --no-dev --no-scripts

The  composer.json file looks like this (it's very similar to the standard Laravel composer file):
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.2.*",
        "doctrine/dbal": "^2.5",
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "symfony/css-selector": "2.8.*|3.0.*",
        "symfony/dom-crawler": "2.8.*|3.0.*",
        "laravel/homestead": "^5.2",
        "barryvdh/laravel-ide-helper": "^2.3"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

However when I try to install it on my production machine (which runs PHP on version v5.5.9 I get the following error:
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - laravel/homestead v5.4.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead v5.3.2 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead v5.3.1 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead v5.3.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead v5.2.4 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead v5.2.1 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead v5.2.0 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead 5.2.3 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - laravel/homestead 5.2.2 requires php ^5.6 || ^7.0 -> your PHP version (5.5.9) does not satisfy that requirement.
    - Installation request for laravel/homestead ^5.2 -> satisfiable by laravel/homestead[5.2.2, 5.2.3, v5.2.0, v5.2.1, v5.2.4, v5.3.0, v5.3.1, v5.3.2, v5.4.0].

So my questions is as follows:

*

*Why is homestead even being installed when I said --no-dev and homestead is a dev package?

*If I did want to install Homestead on my production machine, how can I solve the above problem?

A: --no-dev should not install the dev dependencies. Check your production build scripts (or whatever you are using to run this on production), that --no-dev is indeed added.
For the second part of your question, you can avoid the error by changing laravel/homestead package version to ~4.0 or 4.0.5 to be more precise to make it compatible with your php version.


text:
Q: A particular example of a non-reduced scheme (with a reduced ring of global sections)? I am searching for a scheme $X$ which can be obtained by gluing two affine schemes (along open subsets) such that:
 1) X is non-reduced;
 2) $\Gamma(X,\mathcal O_X)$ is a reduced ring.
Any ideas? Thanks in advance.

A: Hint:
Can you construct a ''fat'' projective line of some sort? Namely, remember that $\text{Spec } k[x]$ is the affine line and we get projective space by gluing together two affine lines. Can you do something similar by fattening up the lines you glue?
My example was the following.
Take $\text{Proj } k[x,y,z]/z^2$. I believe that working on affines, this should produce something with only $k$ as global sections. I haven't worked it out in detail however.


text:
Q: Issue with ToDO list app and list item length I'm working on a Q/A bare bones todolist app and notice that when a list item that is really long is added to the list, it pushes the button out.
Is there a way I can make the LI element larger when the textnode hits the button margin instead of pushing the button out of the LI element. Below is a screenshot. I'll post my source code below, but maybe this is a question that is a quick fix?

My source code can be found here - Issue with floating buttons right of my to do list

A: A) If I understood you well, you can easily fix it with CSS-Grid:
li {
  display: grid;
  grid-template-columns: 3fr 100px;
  grid-template-areas: 'text button';
}

li > span {
  grid-area: text;
}

li > button {
  grid-area: button;
  height: 30px;
}

https://jsfiddle.net/axqwhj29/
Play with the example linked above resizing the result area to check if that's what you are looking for.
B) Also, but I don't recommend you, if you really don't wanna change your li hight and you have a maximum text width (ex: 25 characters), you can clip parts of your message in a phone vertical view and if the user flips to horizontal show the whole text automatically.
https://jsfiddle.net/qfy3mz01/
Hope this help :)

A: Okay I have wrapped the text inside the li with span element and and added I add grid display to li and give every element inside the li a width and then I have added word-break: break-word; so the line will break when the text of the span reach the width limit and don't affect the delete button and I've deleted height from li so the li will grow with the lines on it

var addItemButton = document.getElementById('addItem')
var onEnter = document.getElementById('newNote')

//below event listener adds an item to the list on click
addItemButton.addEventListener('click', function() {
  let item = document.getElementById('newNote').value
  let node = document.createElement("li")
  let span = document.createElement("span")
  let textnode = document.createTextNode(item)

  span.appendChild(textnode)
  node.appendChild(span)
  if (item) {
    document.getElementById('list-body').appendChild(node)
  }

  let node2 = document.createElement('BUTTON')
  let textnode2 = document.createTextNode('Delete')
  node2.appendChild(textnode2)
  node.appendChild(node2)

  node2.addEventListener('click', function() {
    node2.parentNode.parentNode.removeChild(node)
  });

  document.getElementById('newNote').value = ''
});

onEnter.addEventListener('keyup', function(event) {
  if (event.keyCode === 13) {
    // Cancel the default action, if needed
    event.preventDefault();
    // Trigger the button element with a click
    addItemButton.click();
  }
})

function applyButton() { //onload for dummy data or data from db
  let getListObjects = document.querySelectorAll("li")

  for (let i = 0; i < getListObjects.length; i++) {

    let node2 = document.createElement('BUTTON')
    let textnode2 = document.createTextNode('Delete')
    node2.appendChild(textnode2)

    getListObjects[i].appendChild(node2)

    let y = getListObjects[i].querySelector('button')
    y.addEventListener('click', function() {
      y.parentNode.parentNode.removeChild(getListObjects[i])
    });

  }
}
.container {
  height: 100%;
  width: 40%;
  margin: 0 auto;
}

.container2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  background-color: grey;
  border: 1px solid grey;
}

#main-grid {
  width: 100%;
}

#newNote {
  height: 25px;
}

#inputIdForGrid {
  justify-content: left;
  align-items: center;
  display: flex;
  padding-left: 0.3em;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

button {
  padding: 10px 18px;
  background-color: green;
  border: none;
  color: white;
  font-size: 14px;
  align-self: center;
  justify-self: end;
}

#addItem {
  margin-left: 1em;
  padding: 0.5em;
  color: white;
  font-size: 1.5em;
  float: right;
}

ul {
  list-style-type: none;
  padding: 0px;
  margin: 0px;
}

li {
  padding: 5px 15px;
  display: grid;
  grid-template-columns: 2.5fr .5fr;
}

span {
  word-break: break-word;
  grid-column: 1 / 2;
  display: flex;
  align-items: center;
}

li:nth-child(2n) {
  background-color: grey;
}

li>button {
  background-color: red;
}

h1 {
  text-align: center
}

Vanilla JS ToDo List - No Jquery, No Bootstrap

          <input type='text' placeholder="Enter List Items Here" id='newNote'>

          Hi

run all around town. walk all around town. drive all around town

Buy Apples

Hit Gym and Lift Bro

Stretch

P.S. I've edited your js code so it will generate span and add the text inside it


text:
Q: How to list all installed packages from a specific category (component) Is it possible to list all installed packages from a specific official repository component (Main, Restricted, Universe or Multiverse) using utilities like apt, apt-cache, aptitude?
I wrote a simple script for this purpose:
dpkg -l | grep ^ii | cut -f3 -d ' ' | while read -r pkg;
do
 status=`apt-cache show $pkg | grep -m1 "Section: multiverse"`
 if [ ! -z "$status" ]
 then
  echo $pkg
 fi
done;

It works, but it's really slow cause it's checking all packages one by one. Running the time command for this script will produce:
real    1m16.797s
user    0m57.008s
sys     0m8.260s

I already tried aptitude search patterns, and dpkg-query formating, but it seems they don't have the proper column/schema to create a query for this purpose.
I also had a look at vrms script to find out how it's works, because it's really fast in finding contrib/non-free packages, it's seems that vrms script scans the whole /var/lib/dpkg/status file, looking for things like 'Section: (contrib | non-free | restricted | multiverse | partner )', so it wasn't helpful either, because not all packages have this section.

A: Okay, I didn't found any solution to do this with standard utilities, however after having a look at vrms I came-up with a pretty better script to search for packages installed from a specific component.
The other script which I mentioned in my question was really time consuming.
However, the new script is available here: pkgs-from.sh
The usage is:
./pkgs-from.sh universe # or main, multiverse, backports

And the time command result for this one is:
real    0m4.367s
user    0m0.980s
sys     0m0.408s

Which is pretty good.
How it works?
The script will create a list of all packages related to the requested component from related files within the /var/lib/apt/lists/ directory, then starts to search throughout them instead of using apt-cache.

A: Adding a Python script for any who prefer that approach:
import apt

cache = apt.Cache()
package_count = 0

for package in cache:
    if (
        cache[package.name].is_installed
        and package.candidate.origins[0].origin == "Ubuntu"
        and package.candidate.origins[0].component == "universe"
    ):
        package_origin = package.candidate.origins[0]
        print(
            package.name,
            # See https://apt-team.pages.debian.net/python-apt/library/apt.package.html#apt.package.Origin
            # for further details on the meanings of the below
            package_origin.origin,  # The Origin, as set in the Release file
            package_origin.archive,  # The archive (eg. Ubuntu release name)
            package_origin.component,  # The component (eg. main/universe)
            # package_origin.site,  # The hostname of the site.
            # package_origin.label,  # The Label, as set in the Release file
            # package_origin.trusted,  # Origin trusted (Release file signed by key in apt keyring)
        )
        package_count += 1

print(package_count, "packages from Ubuntu universe")

Speed should be in seconds, rather than the minutes that piping the installed package list to apt-cache policy takes

A: Here my script to monitor installed packages for a given component
FILTER=non-free TMP_DIR=$(mktemp -d) && {
  dpkg -l | grep ^ii | cut -f 3 -d' ' | cut -f 1 -d : | sort | uniq > ${TMP_DIR}/pkg_installed.list
  cat /var/lib/apt/lists/*_${FILTER}_*Packages | grep "^Package:"  | sort | uniq | cut -d' ' -f2 > ${TMP_DIR}/pkg_filtered.list
  comm -12 ${TMP_DIR}/pkg_installed.list ${TMP_DIR}/pkg_filtered.list
}


text:
Q: How to restore Oracle DB with CA ArcServe Backup 16.5? I am trying to restore a table from Oracle DB (version 10.2). The Oracle DB is being backed up by using full + differential backups with CA ARCserve 16.5.
The problem is that I don't find an option in ARCserve to restore only a table or to restore the whole DB instance on an alternative location. It says the only possibility is to restore the DB in place. So the current data would be replaced. Of course, that is out of the question and it is not a suitable approach.
Can anyone help?

A: If you are trying to restore from Linux + Oracle.
Procedure
Every backup has a unique TAG which can be found by running a simple rman query
RMAN> list backup of database completed after 'SYSDATE -1';
This will list all the backups done today along with the TAG number as shown in the red box.

In the oracle agent restore options we can enter the TAG in the box RESTORE FROM BACKUP TAG as shown below

Submit the job and it will run the restore from the specific media as shown from the oragentd log in the figure below
![Jobstrong text][3]
The red box indicates that the restore used the backup with the TAG specified.


text:
Q: How to transfer Postgres localhost development database data to production database on server in Rails App? I have created the test, production and development databases on server manually but not able to figure out, how to transfer data from local myapp_development database to myapp_production database on the server ?
I searched and found this How to move Rails app + pgsql database from localhost to my server?, capistrano is giving me lot of errors and I am sure there must be a standard Rails way or postgres way to do this as exporting data as dump and again importing it though I may have to do it if I can't find anything better.

A: You can dump the database using pg_dump then scp the database dump up to the database and run it on the server using psql databse_name < database.dump

A: I use yaml_db gem. It can dump your data into a file and then load it back into the database. It's written using activerecord so it works with most databases.
URL: https://github.com/ludicast/yaml_db
rake db:data:dump   ->   Dump contents of Rails database to db/data.yml
rake db:data:load   ->   Load contents of db/data.yml into the database

Prefix the commands with RAILS_ENV=development or RAILS_ENV=production to choose target and destination scheme.


text:
Q: Get followers and following from twitter account in iOS Everybody..
How can I get all followers and following from a user's logged in twitter account in iOS?
Is there any api for that?
please help me..

A: Yes there is an API for that. see this.
I recommend using the JSON API as it is very easy to parse with the objective-c framework. Look at the fourth section on the page I linked to, under 'Friends and Followers' and you'll see there are requests you can make to access followers and following.
For example, this is how you get someone's followers:
http://api.twitter.com/1/followers/ids.json?id=myuser
This returns a JSON array of user IDs which you can use in conjunction with other APIs to get their user info.
Hope this helps you getting started


text:
Q: CSS - Repeating styled border around heading / HTML I've got the following code for my html section
only the first heading creates a border and the rest are all over the place, below is two photos of what it should look like, and what it does look like...
![enter image description here][1]
![enter image description here][2]
Any ideas? Thanks!

A: The code is a bit messy. But if this is what you want: http://jsfiddle.net/96z7U/3/
These are the changes:

Module Details

It had no class.
#moduleDetails {
    border-style: solid;
    /*border-width: 1px;*/
    padding: 5px;
}

I'm not sure if you intended that border.
And:
.titleBorder {
    padding-top: 10px;
    border-style: solid;
    border-width: 1px;
    margin:0 auto;
    float:left;
    width:100%;
}

Add float left and width 100%

A: The problem seems to be connected with the fact that the content below the heading have the style float:left which causes the issue. Try adding the following code before each heading with class 'titleBorder':


text:
Q: Python/Math Find Previous Value in Fibonacci Sequence with a Function/Equation This is slightly less code related...
I am making a function that calculates a Fibonacci number backwards.
Not just print it backwards but do the math itself backwards.
I did a little research using Phi and phi...
I think I mostly got it,
 but how do I calculate a previous number in the sequence?
I.E. F6 is 8 and F5 is 5. I need a function to find "5" (The previous number).
Any help?
Thanks in advance!

A:     def FingFactorial(n):
    if n == 1:
        return 1
    else:
        res = n * FingFactorial(n-1)
        return res
n=int(input("Factorial Of : "))
print("Factorial Of",n,"Is :",FingFactorial(n-1))

this code may give your desired result .. :) CLICK HERE THIS MAY HELP YOU

A: import math #Imports python math library

Phi = ((1 + math.sqrt(5))/2) # defines Phi, the golden ratio phi = ((1
- math.sqrt(5))/2)

def rfib(n): #Creates the function, short for Reverse Fibonacci
    for i in range(n):
        num = n - i #Counts backwards from n
        print(round(((Phi**num)-(phi**num))/math.sqrt(5))) #Prints equation.


text:
Q: Change template in angular directive dynamically I have a controller, that has some variables:
.controller('DataProvider', function($scope, $timeout, $mdSidenav, $mdDialog, $mdMedia, $mdToast, selectedData) {
    $scope.provider;
    $scope.providers = [{
        name: 'jsonProvider',
        displayNmae: "jsonProvider"
    }, {
        name: 'imageProvider',
        displayNmae: "imageProvider"
    }];
    $scope.props = {
        id:_guid(),
        provider:''
    }
    this.providerWasChange = function() {}
})

It is just little part of controller functions. $scope.props - is model from json data.
Also, there is directive that should take controller's selected provider and change template, and as possible bind all $scope.props to updated template.
There is my wrong attempt of creating directive:
.directive('provider', function([$compile, $templateCache, function($compile, $templateCache) {
    var getTemplate = function(data) {
        function templateId() {
            switch (data.name) {
                case 'jsonProvider':
                    return 'jsonProvider-template.html';
                case 'imageProvider':
                    return 'imageProvider-template.html';
            }
        }

        var template = $templateCache.get(templateId(data));
        return template;
    }

    return {
        templateUrl: '',
        transclude: true,
        scope: {
            provider: '@'
        },
        replace: true,
        restrict: 'E',
        require: '?NgModel',
        link: function(scope, element) {
            var template = getTemplate(scope.$parent.provider)
            element.html(template)
            $compile(element.contents())(scope)

            scope.$parent.$watch(function() {
                return scope.$parent.provider;
            }, function(newVal, oldVal, scope) {
                console.log(newVal)

                var template = getTemplate(scope.$parent.provider)
                element.html(template)
                $compile(element.contents())(scope)

            })
        }
    }
}]))

And there is html code:
<md-tab id='layerProviderWrapper'>
                            <md-tab-label>Provider data</md-tab-label>
                            <md-tab-body>

                                    <md-input-container style="width:90%">
                                        Chose provider data
                                        <md-select ng-model="provider" ng-change="providerWasChange()">
                                            <md-option>None</md-option>
                                            <md-option ng-repeat="provider in providers" ng-value="provider">
                                                {{provider.displayNmae}}
                                            </md-option>
                                        </md-select>
                                    </md-input-container>

              problems starts here:  <provider> </provider>

                            </md-tab-body>
                        </md-tab>

 template should take ng-models from 'DataProvider' controller.
I know on StackOverflow was several similar questions, but no one of them helps me....
https://jsfiddle.net/0jLt0u0L/2/
There is example, but I don't know how to create template there.... In template, for example, show selected provider from controller.

A: Here is a modification of your fiddle to make it work to some extent: https://jsfiddle.net/masa671/77z165uj/
The key modifications:

*

*Move angular.min.js on top.

*Move ng-appto body to make the templates effective (see HTML gear).

*Define the templates via

Once you get this working, it is easier to resolve, how to load them dynamically with $http, if that is what is needed.


text:
Q: Restore Purchase in iOS InApp Purchase I am developing a magazine app which has autorenewable subscription.I have implemented the purchase method and doin the validation using the receipt.My doubt are
1 .  How to know whether the subscription has expired or not from the receipt
2 .  How to restore the purchases or downloaded contents to another device .Currently my own server is providing the contents to download.So If I purchased some magazines in January and February, then if I try to restore the purchase  in another device in march,how could I restore the downloaded contents or check with my server to download the previously downloaded contents.The receipt contains only product ID and nothing related or unique to user , to handle users in server so that the downloads and restore can be handled from the server.
Thanks.Looking forward for expert help.

A: Each user's device can obtain a receipt and either hand that receipt to your server or decode it and hand the results to your server. Your server will then respond to that device by downloading whatever it is entitled to receive.  The receipt contains all of the purchases made under that account and the dates the purchases were made so you should be able to figure out the active time of the subscription.  You could also use the 'expires_date' if the question is only whether the subscription is currently active.
If a device needs to prove that its subscription is valid it first tells the user that it needs to check on its subscription and then it executes either a restoreCompletedTransactions or a SKReceiptRefreshRequest.


text:
Q: mysql_query() with simple query segfault I have this super simple code :
#include <winsock.h>
#include <mysql.h>

int main() {
    MYSQL mysql;
    mysql_init(&mysql);
    mysql_options(&mysql, MYSQL_READ_DEFAULT_GROUP, "option");
    if (mysql_real_connect(&mysql, "localhost", "root", "pass", "data", 0, NULL, 0)) {
        mysql_query(&mysql, "SELECT * FROM versions");
        mysql_close(&mysql);
    }

    else {
        return 1;
    }

    return 0;
}

When debugging, I get a segmentation fault on line 9 (mysql_query).
An idea ?

A: This code works :
#include <winsock.h>
#include <mysql.h>

int main() {
    MYSQL* mysql = new MYSQL;
    mysql_init(mysql);
    if (mysql_real_connect(mysql, "localhost", "root", "pass", "data", 0, NULL, 0)) {
        mysql_query(mysql, "SELECT * FROM versions");
        mysql_close(mysql);
    }

    else {
        return 1;
    }

    return 0;
}

*

*Use a pointer for the MYSQLobject

*Put the return of mysql_init(mysql) into mysql itself => Memory leaks

*Don't use mysql_options


text:
Q: How can I use serde_json to deserialize arbitrary JSON into a Value-like object of raw bytes? I'm writing a library to deserialize a subset of JSON into predefined Python types.
I want to deserialize arbitrary JSON into an object that quacks like serde-json's Value. However, I don't want it to deserialize into String's, Number's and Bool's - instead when the deserializer hits one of these I would prefer it simply keeps a reference to the respective byte string so I can efficiently (i.e. without the additional type conversion) parse the byte strings into the correct arbitrary Python types. Something like this:
use serde::Deserialize;
use serde_json::value::RawValue;
use serde_json::Map;

#[derive(Deserialize)]
pub enum MyValue<'a> {
    Null,
    Bytes(&'a RawValue),
    Array(Vec<MyValue<'a>>),
    Object(Map<String, MyValue<'a>>),
}

This will require writing a lot of traits so that it behaves like Value, and I'm not even sure if it won't just ignore deserializing the structural parts and put everything into a RawValue.
What is the cleanest way to do this?


text:
Q: Identifier uint8_t is undefined - Visual Studio 2017 I get an error with the type definitions.
I am working with Visual Studio 2017 and so I included stdint.h for the type definitions. But I still have the Problem that the identifier uint8_t is undefined.
What's the problem?

A: it is defined in "stdint.h", add that on the top of your cpp-file:
#include <stdint.h>


text:
Q: When editing a post with a custom meta box the values aren't displaying correctly I followed this tutorial to create a custom meta box with a simple two option drop down.
My code is below. The custom fields are saved when creating a post, and edit when I change the value and Update. But when I go to the edit post page the values aren't dynamic and displaying the correct drop down value based on the set meta value. So if I create a post and set the option to Yes, then I go edit to post it shows No but in the custom meta field it does show Yes so it's saving correctly. I know that the No and Yes values should be dynamic and check if any custom meta has been set to display it but not sure what the code is. Any help with the code is appreciated. Thanks
<?

add_action('admin_menu', 'my_post_options_box');

function my_post_options_box() {
    add_meta_box('post_info', 'Trade', 'custom_post_info', 'post', 'side', 'high');
}

//Adds the actual option box
function custom_post_info() {
    global $post;
?>
    <fieldset id="mycustom-div">

            Accept Trade?

            <select name="cpi_dropdown_options" id="cpi_dropdown_options">
                <option <?php selected( get_post_meta($post->ID, 'cpi_dropdown_options', true), 'Option 1' ); ?>>No</option>
                <option <?php selected( get_post_meta($post->ID, 'cpi_dropdown_options', true), 'Option 2' ); ?>>Yes</option>
            </select>

    </fieldset>
<?php
}

add_action('save_post', 'custom_add_save');

function custom_add_save($postID){

    // called after a post or page is saved
    if($parent_id = wp_is_post_revision($postID)) {
        $postID = $parent_id;
    }

    if ($_POST['cpi_dropdown_options']) {
        update_custom_meta($postID, $_POST['cpi_dropdown_options'], 'cpi_dropdown_options');
    }

    if ($_POST['cpi_text_option']) {
        update_custom_meta($postID, $_POST['cpi_text_option'], 'cpi_text_option');
    }
}

function update_custom_meta($postID, $newvalue, $field_name) {
    // To create new meta
    if(!get_post_meta($postID, $field_name)){
        add_post_meta($postID, $field_name, $newvalue);
    } else {
        // or to update existing meta
        update_post_meta($postID, $field_name, $newvalue);
    }
}
?>

A: I cannot be 100% sure since I can't test without installing and running you code but I think the problem is that you aren't echoing your selected markup.
<option <?php selected(
    get_post_meta($post->ID, 'cpi_dropdown_options', true),
    'Option 1',
    true
); ?>>No</option>

The last parameter tells selected to echo output.
Edit:
Your options aren't sending a value. Compare your code to this code from the Codex:
<option value="1" <?php selected( $options['foo'], 1 ); ?>>1</option>

Your code is missing the value= part. You claim that:

...if I create a post and set the option to Yes, then I go edit to
  post it shows No but in the custom meta field it does show Yes so it's
  saving correctly. I know that the No and Yes values should be dynamic
  and check if any custom meta has been set to display it but not sure
  what the code is.

That sounds as if you have verified that things are actually saving to the database as you want but without that value part I don't see how they could be. That is, without the value part your form is sending the option contents-- 'No', and 'Yes'. You can verify that with this little snippet:
<form>
  <select name="hi" method="get">
    <option>No</option>
    <option>Yes</option>
  </select>
  <input type="submit" value="go" />
</form>

However, you are looking for true values of "Option 1" and "Option 2". You can either add the value attribute to match what selected is looking for, which is probably best because you can then alter the outward appearance of the form without altering the function of the form, or you can check for "No" and "Yes" instead of "Option 1" and "Option 2".

A: Are you sure the output of the 'pi_dropdown_options' post_meta is actually in the form of 'Option 1' or 'Option 2'? If it's not seeing either of those values in the output of 'pi_dropdown_options' then you'd just see the first item in the dropdown selected. Have you tried just echoing out the 'pi_dropdown_options' custom field to see what it says? It will be case-sensitive matching too.
Another thing to note (as pointed out by s_ha_dum in a previous answer) is the the markup for the 'option' elements in your list are not setting a value:
<option<?php selected( get_post_meta($post->ID, 'cpi_dropdown_options', true), 'Option 1' ); ?>>No</option>

If I read that correctly it looks like if this was the selected option the markup would be:
<option selected="selected">No</option>

So, if you then saved the post the 'pi_dropdown_options' post_meta would likely be empty, it should have a 'value' attribute on each option like:
<option value="Option 1" selected>No</option>

So the PHP code would be something like:
<option value="Option 1" <?php selected( get_post_meta($post->ID, 'cpi_dropdown_options', true), 'Option 1' ); ?>>No</option>

Not sure if any of that helps! Alternatively you could try the alternative syntax for checking option selected state without using the 'selected' WordPress function:
<option value="Option 1" <?php if ( get_post_meta($post->ID, 'cpi_dropdown_options', true) == 'Option 1' ) echo 'selected="selected"'; ?>>No</option>


text:
Q: How do I add SecurityToken to webservice client call I am using a java client to create a Soap request to my web service running using Apache CXF. I have added UserNameToken to client message but Apache CXF fails to process it in AbstractUsernameTokenAuthenticatingInterceptor class because SecurityToken is missing.
How do I add SecurityToken to SoapHeader ?
I am using Java to create SoapMessage. SoapHeader coming into webservice looks like :
<S:Header><wsse:Security xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-.0.xsd"
SOAP-ENV:mustUnderstand="1">
<wsse:UsernameToken wsu:Id="UsernameToken-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">user</wsse:Username>
<wsse:Password xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
</wsse:UsernameToken></wsse:Security></S:Header>


text:
Q: primefaces 3.5 selectonemenu doesn't display data since two days I am facing strange issue with PrimeFaces 3.5 selectOneMenu object.
I am working in this architecture JPA + EJB + JAX-WS in an EJB project and I create a client from the JAX-WS service in a Web Project. The Web Service Client is then encapsulated in a ManagedBean to be bind with my PrimeFaces interface.
My ManagedBean is the following :
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Named;
import tg.moov.imereport.service.DownStream;
import tg.moov.imereport.service.DownStreamWSService;

@Named
@Stateless
public class DownStreamMBean {
    private DownStreamWSService service;

    public DownStreamMBean() {
        service = new DownStreamWSService();
    }

    public List<DownStream> getDownStreamsService() {
        return service.getDownStreamWSPort().getDownStreams();
    }

}

and the selectOneMenu code is the following :
<h:form>

    <f:selectItems value="#{downStreamMBean.downStreamsService}" var="item"
      itemValue="#{item.IDDownStream}" itemLabel="#{item.nom}"/>

</h:form>

Here is the DownStream class :
package tg.moov.imereport.service;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for downStream complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="downStream">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="IDDownStream" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="IPAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="login" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="nom" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="path" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "downStream", propOrder = {
    "idDownStream",
    "ipAddress",
    "login",
    "nom",
    "password",
    "path"
})
public class DownStream {

    @XmlElement(name = "IDDownStream")
    protected String idDownStream;
    @XmlElement(name = "IPAddress")
    protected String ipAddress;
    protected String login;
    protected String nom;
    protected String password;
    protected String path;

    /**
     * Gets the value of the idDownStream property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getIDDownStream() {
        return idDownStream;
    }

    /**
     * Sets the value of the idDownStream property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setIDDownStream(String value) {
        this.idDownStream = value;
    }

    /**
     * Gets the value of the ipAddress property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getIPAddress() {
        return ipAddress;
    }

    /**
     * Sets the value of the ipAddress property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setIPAddress(String value) {
        this.ipAddress = value;
    }

    /**
     * Gets the value of the login property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getLogin() {
        return login;
    }

    /**
     * Sets the value of the login property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setLogin(String value) {
        this.login = value;
    }

    /**
     * Gets the value of the nom property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getNom() {
        return nom;
    }

    /**
     * Sets the value of the nom property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setNom(String value) {
        this.nom = value;
    }

    /**
     * Gets the value of the password property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPassword() {
        return password;
    }

    /**
     * Sets the value of the password property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPassword(String value) {
        this.password = value;
    }

    /**
     * Gets the value of the path property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPath() {
        return path;
    }

    /**
     * Sets the value of the path property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPath(String value) {
        this.path = value;
    }

}

The web service is working correctly and display data, but the selectOneMenu does not show anything.
Please can some one help me. I can provide more information if needed.
Regards.

A: You need to use a converter for your custom class on the selectOneMenu.
See BalusC his explanation here objects in selectonemenu
in primefaces the
 has a converter=""  attribute which you can use to link the converter too instead of having to add it seperatly using <f:converter>


text:
Q: How to echo a string inside a category in a ini file with quotes I have an ini file like for example
[Admin Prefixes]
# Here you can add custom prefixes to specific players or flags that are shown when using $admin_prefix$.
# Syntax: "type" "info" "prefix" "[expiration date]"

#"name" "OciXCrom" "[Timed Prefix]" "31.12.2030"
#"name" "OciXCrom" "[Scripter]"
#"steam" "STEAM_0:0:50153248" "[CM Creator]"
#"ip" "127.0.0.1" "[BOT]"
#"flag" "l" "[Head Admin]"
#"flag" "d" "[Server Admin]"
#"flag" "e" "[Test Admin]"
#"flag" "mnp" "[Premium]"
#"flag" "b" "[VIP]"
"flag" "s" "&x06]~Moderator~["
"flag" "r" "&x07]~ADMIN~["
"flag" "d" "&x06]~ADMIN~["
"flag" "f" "&x04]~ADMIN~["

[Chat Colors]
# Here you can add different chat colors to specific players or flags that are shown when using $chat_color$.
# Syntax: "type" "info" "chat color" "[expiration date]"

"flag" "s" "&x07"
"flag" "r" "&x07"
"flag" "d" "&x06"
"flag" "f" "&x01"
"flag" "" "&x01"

[Name Customization]
# Here you can modify the name shown for certain players when using $custom_name$.
# Syntax: "type" "info" "custom name" "[expiration date]"

"name" "OciXCrom" "&x03Oci&x04XC&x03rom"

Like for example I want to insert an entry "steam" "STEAM_0:0:50153248" "[CM Creator]" into [Admin Prefixes] section
How can it be done ? As I want to make a bash script to automate this process
I am new to linux, can someone please help me on this :)

A: Echo is probably not the best tool for this. Establish where you want to insert the new line and then use the append option of sed. For example to append to the end of your file:
sed '$a "steam" "STEAM_0:0:50153248" "[CM Creator]"' your_ini_file

To append after line 15, replace $ by 15, or to append after a line that has a unique patter, replace $ by /PATTERN/

A: Using any awk you could just append the new text after the last non-empty line in the target section:
$ cat tst.awk
/^\[/ { prt() }
{ rec[++numLines] = $0 }
NF { lastPopulated = numLines }
END { prt() }

function prt(   i) {
    for ( i=1; i<=lastPopulated; i++ ) {
        print rec[i]
    }
    if ( rec[1] == tgtSect ) {
        print newText
    }
    for ( ; i<=numLines; i++ ) {
        print rec[i]
    }
    numLines = 0
}

$ awk -v tgtSect='[Admin Prefixes]' -v newText='"steam" "STEAM_0:0:50153248" "[CM Creator]"' -f tst.awk file
[Admin Prefixes]
# Here you can add custom prefixes to specific players or flags that are shown when using $admin_prefix$.
# Syntax: "type" "info" "prefix" "[expiration date]"

#"name" "OciXCrom" "[Timed Prefix]" "31.12.2030"
#"name" "OciXCrom" "[Scripter]"
#"steam" "STEAM_0:0:50153248" "[CM Creator]"
#"ip" "127.0.0.1" "[BOT]"
#"flag" "l" "[Head Admin]"
#"flag" "d" "[Server Admin]"
#"flag" "e" "[Test Admin]"
#"flag" "mnp" "[Premium]"
#"flag" "b" "[VIP]"
"flag" "s" "&x06]~Moderator~["
"flag" "r" "&x07]~ADMIN~["
"flag" "d" "&x06]~ADMIN~["
"flag" "f" "&x04]~ADMIN~["
"steam" "STEAM_0:0:50153248" "[CM Creator]"

[Chat Colors]
# Here you can add different chat colors to specific players or flags that are shown when using $chat_color$.
# Syntax: "type" "info" "chat color" "[expiration date]"

"flag" "s" "&x07"
"flag" "r" "&x07"
"flag" "d" "&x06"
"flag" "f" "&x01"
"flag" "" "&x01"

[Name Customization]
# Here you can modify the name shown for certain players when using $custom_name$.
# Syntax: "type" "info" "custom name" "[expiration date]"

"name" "OciXCrom" "&x03Oci&x04XC&x03rom"

or if, as in your case, the new text already exists commented out in your input file, you could just uncomment it (would still add it if not present):
$ cat tst.awk
/^\[/ { prt() }
{ rec[++numLines] = $0 }
NF { lastPopulated = numLines }
END { prt() }

function prt(   i,text) {
    for ( i=1; i<=lastPopulated; i++ ) {
        if ( rec[1] == tgtSect )  {
            text = rec[i]
            sub(/^[[:space:]]*#[[:space:]]*/,"",text)
            if ( text == newText ) {
                rec[i] = newText
                tgtSect = ""
            }
        }
        print rec[i]
    }
    if ( rec[1] == tgtSect ) {
        print newText
    }
    for ( ; i<=numLines; i++ ) {
        print rec[i]
    }
    numLines = 0
}

$ awk -v tgtSect='[Admin Prefixes]' -v newText='"steam" "STEAM_0:0:50153248" "[CM Creator]"' -f tst.awk file
[Admin Prefixes]
# Here you can add custom prefixes to specific players or flags that are shown when using $admin_prefix$.
# Syntax: "type" "info" "prefix" "[expiration date]"

#"name" "OciXCrom" "[Timed Prefix]" "31.12.2030"
#"name" "OciXCrom" "[Scripter]"
"steam" "STEAM_0:0:50153248" "[CM Creator]"
#"ip" "127.0.0.1" "[BOT]"
#"flag" "l" "[Head Admin]"
#"flag" "d" "[Server Admin]"
#"flag" "e" "[Test Admin]"
#"flag" "mnp" "[Premium]"
#"flag" "b" "[VIP]"
"flag" "s" "&x06]~Moderator~["
"flag" "r" "&x07]~ADMIN~["
"flag" "d" "&x06]~ADMIN~["
"flag" "f" "&x04]~ADMIN~["

[Chat Colors]
# Here you can add different chat colors to specific players or flags that are shown when using $chat_color$.
# Syntax: "type" "info" "chat color" "[expiration date]"

"flag" "s" "&x07"
"flag" "r" "&x07"
"flag" "d" "&x06"
"flag" "f" "&x01"
"flag" "" "&x01"

[Name Customization]
# Here you can modify the name shown for certain players when using $custom_name$.
# Syntax: "type" "info" "custom name" "[expiration date]"

"name" "OciXCrom" "&x03Oci&x04XC&x03rom"

Note the existing "steam"... line early in the target block has now been uncommented rather than an additional line added to the end of the block.
That second script would also mean the new text would not be added again if it was already present uncommented in the input file (e.g. if you had ran this script on it previously).
the second script relies on your awk supporting POSIX character classes, if that's not the case just change each [[:space:]] to [ \t].


text:
Q: php - adding wildcards to anagram solver I am sorry if I can't even provide what I have tried because I can't even figure out where to start.
I have this anagram solver which works great, the problem is that I want to be able to add the ability to allow the user to include a ? as a wildcard into the field.
For instance lets say the user puts in their letters fjsiem?. Obviously the ? means any letter. So the results will show words that match the letters in the field plus any other word that contains any additional letter.
I also would love to be able to point out the wildcard(letter) in every one of the words that contain the wildcard so I can change its color so the user knows which words have the wildcards.
Is there anyone who can take a look at my code and help me out?
The word file being called is combined.txt which simply contains words in every new line.
            <?
            if(!empty($_POST['l'])) {
                $time_start = microtime(true);
                $l = $_POST['l'];
                $l = strtolower($l);
                $len = strlen($l);

                $a = array('a' => 1, 'b' => 1, 'c' => 1, 'd' => 1, 'e' => 1, 'f' => 1, 'g' => 1, 'h' => 1, 'i' => 1, 'j' => 1, 'k' => 1, 'l' => 1, 'm' => 1, 'n' => 1, 'o' => 1, 'p' => 1, 'q' => 1, 'r' => 1, 's' => 1, 't' => 1, 'u' => 1, 'v' => 1, 'w' => 1, 'x' => 1, 'y' => 1, 'z' => 1);

                function contains($word) {
                    $wlen = strlen($word);
                    if($wlen < 2 || $wlen > 10) return FALSE;

                    for($i = 0; $i < $wlen; $i++) {
                        $w[$i] = $word[$i];
                    }

                    $b = $GLOBALS['b'];
                    foreach($b as $n => $c) {
                        foreach($w as $k => $v) {
                            if($v == $c) {
                                unset($w[$k]);
                                unset($b[$n]);
                                break;
                            }
                        }
                    }
                    if(count($w) > 0) return FALSE;
                    return TRUE;
                }

                for($i = 0; $i < $len; $i++) {
                    $b[$i] = $l[$i];
                    unset($a[$l[$i]]);
                }

                $e = 'cat combined.txt';
                while(list($k) = each($a)) {
                    if(!$e) {
                        $e = "grep -v $k combined.txt";
                    } else {
                        $e .= ' | grep -v '. $k;
                    }
                }

                exec($e, $o);

                settype($w, 'array');
                foreach($o as $v) {
                    if(contains($v)) {
                        $w[] = $v;
                    }
                }

                function mycmp($a, $b) {
                    $ca = strlen($a);
                    $cb = strlen($b);
                    if($ca == $cb) return 0;
                    if($ca > $cb) return 1;
                    return -1;
                }
                usort($w, 'mycmp');

                $wc = 0;
                foreach($w as $v) {
                    $c = strlen($v);
                    if($wc != $c) {
                        echo "
\n";
                        echo "$c letter words
";
                    }
                    $wc = $c;
                    echo "$v    ";
                }
            }
            ?>

A: If you want to be exceedingly lazy you could always solve fjsiem? by running your working code on fjsiema through fjsiemz.
If I'm reading your code right, you're finding the word list and only those with an f in them, then a j in them, then an s in them, then an i in them, then a e in them, then an m in them. So any and all words left which are 7 letters long, .{7} must match your criteria.


text:
Q: asp.net databind gridview with vertical scrollbar i have some long data in my gridview and need a scrollbar (to the gridview).
try few ways - non of them works.
i guess because the postback or the databind..
the asp.net code:
<asp:GridView ID="gvGuess" runat="server" AllowSorting="True" OnSorting="gridView_Sorting" OnRowCreated="GridView1_RowCreated" OnRowDataBound="gvGuess_RowDataBound" Style="top: 301px; left: 212px; direction: rtl; overflow:scroll; position: absolute; height: 176px; width: 359px" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="None">

 <AlternatingRowStyle BackColor="#F7F7F7" />
 <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
 <HeaderStyle BackColor="#4A3C8C" HorizontalAlign="Center" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<RowStyle BackColor="#E7E7FF" HorizontalAlign="Center" ForeColor="#4A3C8C" />
            <SelectedRowStyle BackColor="White" Font-Bold="True" ForeColor="#F7F7F7" />
            <SortedAscendingCellStyle BackColor="#F4F4FD" />
            <SortedAscendingHeaderStyle BackColor="#5A4C9D" />
            <SortedDescendingCellStyle BackColor="#D8D8F0" />
           <SortedDescendingHeaderStyle BackColor="#3E3277" />
        </asp:GridView>

and the c# code:
    protected void loadGuess()
    {
  noInfo.Visible = false;
  ds = dataFunk.getGuestsgrid(Convert.ToString(Session["orderNum"]),    Convert.ToString(Session["choice"]));
        gvGuess.AutoGenerateColumns = true;
        gvGuess.DataSource = ds;
        gvGuess.DataMember = dataFunk.getGuestsgrid(Convert.ToString(Session["orderNum"]), Convert.ToString(Session["choice"])).Tables[0].ToString();
            gvGuess.DataBind();}

thanks :)

A: some time ago i stuck at same. I tried a work around and it work for me.
Wrap your gridview in a div and give dive a definite height with overflow-y:scroll
something like this

 // Your GridView

this will work like sliding Gridview. you can give max-height as you like.

A: For vertical and horizontal scroll bar with height

your GridView


text:
Q: Merge list of list on sublist level I am given two list of lists. I would like to merge the list on the sublist Level. As an example, I am given
L1 <- list(list("a"=1,"b"=2),list("a"=10,"b"=20))
L2 <- list(list("c"=3,"d"=4),list("c"=5,"d"=6))

I would like to create a total list looking as follows:
Ltot<-list(list("a"=1,"b"=2,"c"=3,"d"=4),list("a"=10,"b"=20,"c"=5,"d"=6))

A: You can use Map, i.e.
Map(`c`, L1, L2)

identical(Map(`c`, L1, L2), Ltot)
#[1] TRUE

A: We can use map2 from purrr
library(purrr)
map2(L1, L2, c)


text:
Q: Retrieving Version Name from Google Play Developer API Is there a way to resolve the VersionName of a specific release of an app using the VersionCode?
Everything I found on the Google Play Developer API is using to VersionCodes. I'm trying to build a listing of releases including VersionNames of various applications.

A: I don't believe so, but I may be wrong. There is versionCode which is used by Google Play for the formal release number, which must be incremented with each release, then you have versionName, which is a string and can be anything. So, there is an inherrent disconnect between the two, and therefore no enforced relationship.


text:
Q: AggregateException: Some services are not able to be constructed I have a project in .NET 5.0, everything worked fine - build, execute, just work - until 10th April.
Now I have a lot of error with registering services.
Unhandled exception. System.AggregateException: Some services are not able to be constructed
(Error while validating the service descriptor 'ServiceType: AService.DataAccess.MyDbContext
Lifetime: Scoped ImplementationType: AService.DataAccess.MyDbContext': Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbSet`1[AService.Domain.Entities.B.B]' while
attempting to activate 'AService.DataAccess.MyDbContext'.) (Error while validating the
service descriptor 'ServiceType:
MediatR.IRequestHandler`2[AService.Api.Queries.B.GetAllQuery,
System.Collections.Generic.IEnumerable`1[AService.Api.Queries.B.Dtos.BDto]]
Lifetime: Transient ImplementationType:
AService.Queries.B.GetAllQueryHandler': Unable to resolve service for type
'Microsoft.EntityFrameworkCore.DbSet`1[AService.Domain.Entities.B.B]' while
attempting to activate 'AService.DataAccess.MyDbContext'.)

I short - every repository, every service, everything that needs to be registered and IS registered in Startup.cs as below:
public void ConfigureServices(IServiceCollection services)
{
    services.AddControllers().AddNewtonsoftJson(options =>
        options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);

    services.AddDbContext<MyDbContext>();

    services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>((options) =>
        Configuration.GetSection("Redis").Get<RedisConfiguration>());

    services.AddMediatR(Assembly.GetExecutingAssembly());

    services.AddTransient<IARepository, ARepository>();
    services.AddTransient<IBRepository, BRepository>();
    services.AddTransient<ICRepository, CRepository>();

    services.AddSwaggerGen(c =>
    {
        c.SwaggerDoc("v1", new OpenApiInfo {Title = "Service API", Version = "v1.0"});
    });

}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }

    app.UseStaticFiles();
    app.UseRouting();
    app.UseCors();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
    });

    app.UseSwagger();

    app.UseSwaggerUI(c =>
    {
        c.SwaggerEndpoint("/swagger/v1/swagger.json", "Menu Service API v1.0");
    });
}

Program.cs
public class Program
{
    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}

I don't know is it a problem with Rider version (I program on macos). When I debug I have the following error message:

An IL variable is not available at the current native IP. (0x80131304). The error code is CORDBG_E_IL_VAR_NOT_AVAILABLE, or 0x80131304.

Have anybody an idea what can cause that error? As I said at the beginning, everything worked fine few days before.
EDIT - added MyDbContext:
public class MyDbContext : DbContext
{
    public MyDbContext(DbSet<A> a, DbSet<B> b, DbSet<C> c)
    {
        As = a;
        Bs = b;
        Cs = c;
    }

    public DbSet<A> As { get; }
    public DbSet<B> Bs { get; }
    public DbSet<C> Cs { get; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer(@"Server=localhost;Database=my-db;User=user;Password=password");
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<B>()
            .HasOne(mi => mi.A)
            .WithMany(m => m.Bs)
            .HasForeignKey(mi => mi.AId);

        modelBuilder.Entity<B>()
            .Property(mi => mi.Xs)
            .HasConversion(
                a => string.Join(',', a),
                a => a.Split(',', StringSplitOptions.RemoveEmptyEntries));
    }
}

A: Remove the constructor and add setters to DbSet properties:
public class MyDbContext : DbContext
{
    public DbSet<A> As { get; private set; } // or public setters
    public DbSet<B> Bs { get; private set; }
    public DbSet<C> Cs { get; private set; }
    .....
}

DI container uses constructors to do it's magic and tries to resolve and inject all constructor parameters. Since you haven't (and you should not) registered DbSet's - they can not be resolved.

A: Check the constructor for the service class in question and remove any string values


text:
Q: Buffer Thread Pool in Java? Is there a way to buffer thread pools in java?
example:
I have a "BufferedThreadPool" with max size of 3.
Now I execute 5 threads.
The first 3 threads execute. Now the pool is full. Thread 4-5 get buffered
After one thread is executed it will execute thread 4, after the next thread is done it will execute thread 5, etc.

A: Executors.newFixedThreadPool looks like what you are looking for: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool-int-

A: I guess you need something like this:
// initialization of your threads
Runnable[] runnables = new Runnable[5];
for (int i=0; i<5; i++) {
    runnables[i] = new MyRunnable(i);
}

// initialization of thread pool with fixed size 3
ExecutorService executor = Executors.newFixedThreadPool(3);
// passing the threads to the execution threads pool
for (Runnable a: runnables) {
    executor.execute(a);
}

I hope this helps.


text:
Q: How to pad/zero extend a string to fit into this time format? (hh:mm:ss) I created this time calculator that adds up the sum of two different times in the following time format, hh:mm:ss. The user is only allowed to enter their times using this format.
How does one have it that if the user for example inputs a hh + hh value of 04 and 01, it would output as 05? As of right now, it would only output a 5, which does not follow the time format I want it displayed as (hh:mm:ss). Obviously if the user has a hh + hh value that returns a value of xx as opposed to just x, I would not have any issues.
These are the relevant lines of code:
first_time = input("Enter time: ")
second_time = input("Enter time: ")

#Seconds calculation
first_second = int(first_time[6:])
second_second = int(second_time[6:])

#Minutes calculation
first_minute = int(first_time[3:5])
second_minute = int(second_time[3:5])

#Hours calculation
first_hour = int(first_time[0:2])
second_hour = int(second_time[0:2])

seconds_remainder = total_seconds % 60
minutes_remainder = total_minutes % 60
total_hours = first_hour + second_hour + transfer_hours

format_seconds = str(seconds_remainder)
format_minutes = str(minutes_remainder)
format_hours = str(total_hours)

total_time = str(format_hours + ":" + format_minutes + ":" +
format_seconds)

Originally I just used rjust(2, '0') method which worked flawlessly, however my teacher wants us to employ string concatenation to fix this issue, so I can't use .rjust() as my score will be penalised.
edit: For this specific set of exercises we were not allowed to use if/else statements, loops, built-in functions like zfill or rjust, or format(). We had to demonstrate our understanding of what we were taught, things such as len() find/rfind and string concantenation
I'm a complete beginner at programming so please excuse my code.

A: Since you are not allowed to use if, loops, or other conditional expressions, you can use
format_seconds = '0' * (2 - len(format_seconds)) + format_seconds

The left operand of the + creates a string of zeros of the required length. Note that this string will be empty if 2 - len(format_seconds) is zero or negative.

A: To right-justify a string str to length lng using character pad_ch as padding, apply the following algorithm:
str = '1'
lng = 2  # desired length
pad_ch = '0'  # padding character
pad = pad_ch * lng  # '00'
temp = pad + str  # '00..'  use 'str + pad' for left-justify

# now slice the rightmost lng characters
# use temp[:lng] for left-justify
padded_result = temp[-lng:]  # '' -> '00', '1' -> '01', '12' -> '12'


text:
Q: jquery change button state on click I am working on Yii2 application which has one submit button, as below
<button id="next" class="btn btn-primary btn-submit " data-loading-text="Please wait, processing..." value="1" name="next" type="submit">

When I click the button, it is disabled and the text changes, as below
<button id="next" class="btn btn-primary btn-submit disabled" data-loading-text="Please wait, processing..." value="1" name="next" type="submit" disabled="disabled">Please wait, processing...</button>

Now I have added one text field with required attributes, as below
<input id="name" class="form-control" type="text"maxlength="255" required="required"  title="">

My issue is that when I click on the submit button when the text field is empty, it shows me that field is required but at he same time the button becomes disabled.
How do I return this button to its original enabled state if the text field is empty?

A: You should use both removeAttr('disabled') and removeClass('disabled')
Try the below approach.

$name = $('#name');
$next = $('#next');
$next.on('click', function() {
  $(this).addClass('disabled').attr('disabled', 'disabled').text($(this).data('loading-text'));

  // Your work here

})

$name.on('input', function() {
  changeState($(this));
})
changeState($name);

function changeState(elem) {
  if (elem.val().trim().length) {
    $next.removeClass('disabled').removeAttr('disabled');
  } else {
    $next.addClass('disabled').attr('disabled', 'disabled').text('Next');
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="name" class="form-control" type="text" maxlength="255" required="required" title="">
<button id="next" class="btn btn-primary btn-submit " data-loading-text="Please wait, processing..." value="1" name="next" type="submit">Next</button>


text:
Q: Can anyone explain why following series is absolutely convergent? If there exists $r \in \mathbb{R}$ with $r < 1, K \in \mathbb{N}$, such that $|X_n|^{1/n} < r$ for all $n > K$, then the series $X_n$ (Summation of $X_n$ from $n$ to $\infty$) is absolutely convergent.
We know that  $|X_n| < r^n$ for all $n > K$ so sum of all terms would be bounded by sum of finite terms up to $k-1$ and sum of geometric series. Thus, this is bounded above and increasing $\implies$ convergent.
However, How can I show that this is absolutely convergent by using Cauchy Criteria?

A: Wikipedia: Cauchy's Criterion
You have $|X_{n+1}+X_{n+2}+\cdots+X_{n+p}| \leq |X_{n+1}|+\cdots+|X_{n+p}| \leq r^{n+1}+\cdots+r^{n+p} = r^{n+1}(1+r+\cdots+r^{p-1}) = r^{n+1}\dfrac{1-r^p}{1-r} < \dfrac{r^{n+1}}{1-r}$
Choosing $N$ sufficiently large, we can guarantee that $\dfrac{r^{n+1}}{1-r} < \epsilon$ for any $n \geq N$.
Edit: Depending on your audience, you might be expected to actually specify $N$. If so, essentially solve $\dfrac{r^{N+1}}{1-r}=\epsilon$ for $N$.
We get: $\epsilon(1-r)=r^{N+1}$ so $\ln(\epsilon(1-r)) = (N+1)\ln(r)$ and so $N+1 = \dfrac{\ln(\epsilon(1-r))}{\ln(r)}$. So if you choose $N=\left\lceil{\dfrac{\ln(\epsilon(1-r))}{\ln(r)}}\right\rceil$, then $N$ will be large enough to make the inequalities work.

A: $\sum |X_n| \lt \sum r^n$.  If$\sum r^n$ converges then $\sum|X_n$| converges so $\sum X_n$ converges absolutely.
To show $\sum r^2n$ converge by the Cauchy Criteria we only have to show {$\sum_N r^n$} is a Cauchy sequence. As $\sum_N r^n - \sum_M r^n$ = $r^{M+1} + r^{M+2} +...+ r^N$ = $r^{M+1}(1 + r^2 + ... + r^{v = N - M - 1})$ = $r^{M+1}(1 - r^{v+1})/(1 - r) < r^{M+1}/(1 -r) < \epsilon$  for an appropriately epsilon and M, N large enough. So is a Cauchy sequence.
====
Okay so for epsilon what K do we choose that N,M > K lead to this?  0 < r < 1 so $r^n$ is decreasing so for $\epsilon$ < 0, there is a K such that $0 < e^K < \epsilon$.  Then if N > M > K our result will follow.


text:
Q: "Type Error occurred when creating object" persists I am getting the following error message:
main.CRITICAL: Type Error occurred when creating object: Vendor\CartUpdate\Plugin\Minicart\Image, Argument 1 passed to Vendor\CartUpdate\Plugin\Minicart\Image::__construct() must be an instance of Vendor\CartUpdate\Model\DynamicImage, instance of Vendor\CartInitial\Model\DynamicImage given, called in /home/coriolan/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 [] []
Indeed, Vendor/CartInitial was the initial module that was used, but I've changed it to Vendor/CartUpdate in the past few days. However, there is strange behavior related to it. When I run the CLI commands and use rm -rf generated/* it works, but after a few hours, it does not work anymore and I get the same error again.
What can I do to avoid this problem?

A: When you change the constructor of a file you should run a bin/magento setup:upgrade to avoid this kind of error.


text:
Q: Adding element data with Array_push to JSON file I want to add data to existing JSON file
JSON:
{
   "s1":[
      {
         "bID":"q4a4xs",
         "bName":"Package1",
         "bStep":"slast"
      },
      {
         "bID":"q4a4xs",
         "bName":"Package2",
         "bStep":"s2"
      }
   ],
   "s2":[
      {
         "bID":"q4a4xs",
         "bName":"Package15",
         "bStep":"slast"
      }
   ]
}

I want to create data for s3
What I did?
$newdata = ['bID' => 'O4bt2xs','bName' => 'Package91','bStep' => 's1'];

$newBox = 's3';

$encDexJSON = json_decode($json);
array_push($encDexJSON->{$newBox}->{$newdata}, $newdata);

Print:
  {
   "s1":[
      {
         "bID":"q4a4xs",
         "bName":"Package1",
         "bStep":"slast"
      },
      {
         "bID":"q4a4xs",
         "bName":"Package2",
         "bStep":"s2"
      }
   ],
   "s2":[
      {
         "bID":"q4a4xs",
         "bName":"Package15",
         "bStep":"slast"
      }
   ],
   "w3":{
      "Array":null
   }
}

Where is the problem?

A: To be fair, the code you provided along with the given data wouldn't even give that result. However, it's obvious that you are doing a great number of things wrong here.
For starter's you're trying to call an array on object property, which makes no sense $encDexJSON->{$newBox}->{$newdata}. That literally translates to $encDexJSON->s3->['bID' => 'O4bt2xs','bName' => 'Package91','bStep' => 's1'] which obviously makes no sense at all.
Furthermore, array_push does not do what you want here. array_push is for arrays. What you want to do is simply assign a value to a specific object property. So just do so.
$encDexJSON->$newBox = [$newdata];

Now if you wanted to simply push new objects into that array...
$encDexJSON->$newBox[] = $newdata; // this pushes value onto end of array

The array_push equivalent would be...
$encDexJSON->$newBox = [];
array_push($encDexJSON->$newBox, $newdata); // same result as above

The use of array_push tends to get in the way. It's usually cleaner just to stick to the syntax above.


text:
Q: context.log_url as href in airflow not working I do not want to use Slack. I 'm just using custom notification(on_failure_callback) function in args for my mailing function. I have used
def task_my_alert(context):
    task_id=context['task'].task_id
    dag_run = context.get('dag_run')
    log_url=context.get('task_instance').log_url
    default_html_content = (
             'Log: Link
'
             'Getback:CLICK FOR BACK
'

        )
sub=f"dag has errors"
send_email(to='my@email.com', subject=sub ,  html_content=default_html_content)

But the link[a href] is not working for me in my email. ie: I am not getting link in my email. What changes has to be made?

A: You might need to set the MIME type to text/html.


text:
Q: Accessing Google Spreadsheet feed during downtime I am wondering if there is any information on how the published feed of a spreadsheet may be affected by a temporary period of downtime to the Google Docs Spreadsheets service.
Would the feeds still be available during this period or downtime?
Are there any circumstances in which a feed may not be available?
I would assume that feeds are cached.

A: There are numerous circumstances here that make this a difficult question to answer, primarily because portions of Google Spreadsheets could be "down", even though the system is still usable.
For the most part, though:  If Google Spreadsheets were completely down, then yes, the Google Spreadsheets API would also be down.  The feeds are not cached.
Applications using the Google Spreadsheets API should implement local caching as a best practice.


text:
Q: How do I access a usercontrol instance in another usercontrol instance? I have two UserControls: Player and Playlist.
Player.cs
namespace Music_Player
{
    public partial class Player : UserControl
    {
        public int currentSongIndex = 0;
        public WindowsMediaPlayer player = new WindowsMediaPlayer();

        public Player()
        {
            InitializeComponent();
            player.settings.autoStart = false;
        }

        private void playButton_Click(object sender, EventArgs e)
        {
            if (playButton.Text == "Play")
            {
                Play();
            }
            else
            {
                Pause();
            }
        }

        public void Play()
        {
            if (CheckSongs()) { return; }
            playButton.Text = "Pause";
            player.controls.play();
        }
...

Playlist.cs
namespace Music_Player
{
    public partial class Playlist : UserControl
    {
        public Playlist()
        {
            InitializeComponent();
        }

        private void playlistTitle_Click(object sender, EventArgs e)
        {
            player.Play(); // THIS IS WHERE I WANT TO USE THE player INSTANCE OF Player()
        }
...

The UserControls are both children of another UC which is in my Form.
How can I use the player which is an instance of Player() inside Playlist?

A: You probably want to handle events in the form the controls are in, not within the control itself. The form would have a reference to both controls and likely whatever they are controlling. That's where things should be connected.

A: Suppose you have added a player1 and a playList1 to the form.
To call the method in another UserControl, you can define a property in Form.cs to access the player1 instance.
public Player PlayerInstance
{
    get { return player1; }
}

Then you can call Player.Play() in Playlist.cs via the code as followed.
private void playlistTitle_Click(object sender, EventArgs e)
{
    Form1 form1 = (Form1)this.FindForm();
    form1.PlayerInstance.Play();
}


text:
Q: Unable to install VS2019 software and throws 'Microsoft.VisualCpp.Redist.14' error I'm trying to install the newest visual studio 2019 version (yes, I have a license for it). However, during the installation process the window freezes with this warning:

If I press cancel, it continues installation and completes with a warning.
After that, when I try to open VS2019, I get a create window with empty/blank project template:

In addition, for every project a migration is required and afterwards there are problems with Nuget, as you can see here:
Error occurred while restoring NuGet packages: '' is not a valid version string.

By migrating cs.proj to VS2019 it adds several fields like OldToolsVersion, ToolsVersion and stops working
<Project Sdk="Microsoft.NET.Sdk.Web" ToolsVersion="Current">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <OldToolsVersion>2.0</OldToolsVersion>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <PlatformTarget>x64</PlatformTarget>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="YYY" Version="1.0.0-CI-20200211-095627" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\XXXX.csproj" />
  </ItemGroup>
  <ItemGroup>
    <None Update="Resources\DataStructure.txt">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>

In the end, I have a headache right now. I tried a lot - Reinstalling core, updating Nuget package.
Missing vc_runtimeminimum_x86.msi and installation won't work
NuGet Package Restore Not Working
Thanks for your help.

A: I assume your error about restoring nuget has something to do with the issue of VS installation.
1.For Error occurred while restoring NuGet packages: '' is not a valid version string. You can close VS, open cmd.exe => navigate to project folder where the xx.csproj exists and run command dotnet restore manually to restore packages for your project.
If the manual dotnet restore succeeds, then something wrong with VS IDE itself may cause the nuget restore issue. And if the dotnet restore command fails like in IDE, then i think there's something wrong with your project file itself. You should make sure you're using correct package version format, and the specified package with specified version is available in package source.
2.For the vs installation error, just try VS repair like zivkan suggest. Also, if there's any windows update available, install it to check if it makes any help.


text:
Q: Help passing reference to class subroutine in Perl I am trying to pass a routine to another subroutine within a Perl module. But when I pass the sub reference the passed in ref no longer has the object data. Maybe its not possible to do it this way. The line I have a question about is the "unless" lines below:
sub get_flag_end {
   my $self = shift;
   return ( -e "$self->{file}" );
}

sub wait_for_end {
   my $self = shift;
   my $timeout = shift;
   my $poll_interval = shift;

   # Is it even possible to pass the oject subroutine and retain the objects data?
   #unless ( $self->timeout( $timeout, $poll_interval, $self->get_flag_end ) ) { # does not work
   unless ( $self->timeout( $timeout, $poll_interval, \&get_flag_end ) ) {       # call happens but members are empty
      die "!!!ERROR!!! Timed out while waiting for wait_for_end: timeout=$timeout, poll_interval=$poll_interval \n";
   }
}

sub timeout {
   my $self = shift;
   my $timeout = shift;
   my $poll_interval = shift;
   my $test_condition = shift;
   until ($test_condition->() || $timeout <= 0) {
      $timeout -= $poll_interval;
      sleep $poll_interval;
   }
   return $timeout > 0; # condition was met before timeout
}

I know that I could change the "get_flag_end" routine to take the value as an argument to the subroutine but what if there was a bunch of stuff done in "get_flag_end" and I needed more members from the object. I simplified the code a bit to make it a little easier to follow.

A: Just make a closure and pass that in:
sub wait_for_end {
   my $self = shift;
   my $timeout = shift;
   my $poll_interval = shift;

   my $callback = sub { $self->get_flag_end() };

   unless ( $self->timeout( $timeout, $poll_interval, $callback ) ) {
      die "!!!ERROR!!! Timed out while waiting for wait_for_end: timeout=$timeout, poll_interval=$poll_interval \n";
   }
}

Update:
The other option is, since timeout is a method of the same class, pass in a method name.
sub wait_for_end {
   my $self = shift;
   my $timeout = shift;
   my $poll_interval = shift;

   my $callback = sub { $self->get_flag_end() };

   unless ( $self->timeout( $timeout, $poll_interval, 'get_flag_end' ) ) {
      die "!!!ERROR!!! Timed out while waiting for wait_for_end: timeout=$timeout, poll_interval=$poll_interval \n";
   }
}

sub timeout {
  my $self = shift;
  my $timeout = shift;
  my $poll_interval = shift;
  my $method = shift;

  # Do whatever

  # Now call your method.
  $self->$method();

}

A: In your $test_condition->() line, you are calling the subroutine but not passing it any arguments.  Chances are what you meant was $test_condition->($self) or perhaps as $self->$test_condition
Here is a refactor of your code, correcting a few other issues:
sub get_flag_end {
   my $self = shift;
   return -e $self->{file}; # no need to quote the variable
}

sub wait_for_end {
   my ($self, $timeout, $poll_interval) = @_;  # unpack many args at once

   unless ( $self->timeout( $timeout, $poll_interval, $self->can('get_flag_end') ) ) {
      die "!!!ERROR!!! Timed out while waiting for wait_for_end: timeout=$timeout, poll_interval=$poll_interval \n";
   }
}

sub timeout {
   my ($self, $timeout, $poll_interval, $test_condition) = @_;
   until ($self->$test_condition || $timeout <= 0) {
      $timeout -= $poll_interval;
      sleep $poll_interval;
   }
   return $timeout > 0; # condition was met before timeout
}

Depending on the rest of your implementation, creating a subroutine that knows its invocant might be better.  You can do this in Perl with a closure:
unless ( $self->timeout( $timeout, $poll_interval, sub {$self->get_flag_end} )){

Here a new subroutine is created, which remembers the value of $self.  You would call it without arguments $test_condition->()


text:
Q: How to set data fetched from database in Ckeditor? I use CKEditor to insert some content in 'wysiwyg' mode. I input "Hello World!" in the editor, and the real context inserted into database is
"
Hello World!
".

Now I load the data from database and set it into CKEditor:
String content = loadFromDb();
// -->
Hello, world!

CKEditor.instances['test'].setData(content);

But in the CKEditor, it shows:

Hello, world!

in 'wysiwyg' mode. When I click 'source' button, it shows:

 <p&rt;Hello, world!</p>

How can I set the data as html code, and I can see only "Hello, world!" in CKEditor on 'wysiwyg' mode?
Do I need to use some type of Html encoder?
PS: I have reposted this question because no one answered it in 2012 and it was very important for me to get the answer for this.

A: You could use the insertHtml function.
CKEDITOR.instances.editor1.insertHtml( '
Hello, world!
' );
The documentation can be found here


text:
Q: IP Address Assignment in ad hoc networks / MANETS I would like to use an ad hoc network inside my application and was wondering, if there are some existing techniques / libraries to do that. So far I found, that Zeroconf/AutoIP and JXTA seem to be promising for direct communication inside a ad hoc network.
However, it would be best, if IP address assignment would work in multi hop ad hoc networks. I found a lot of different research papers addressing the issue of IP assignment in MANETs/multi hop ad hoc networks, but I could not find any "ready to use" implementations. Are there simply no such implementations, even though most of these research papers are from the early 2000s?


text:
Q: Redux reducer gets string instead of object I am trying to update my state using redux, but for some reason the reducer only gets a string instead of an object.
// action
const switchTab = (activeTab) => { return { type: SWITCH_TAB, activeTab } }

//reducer
const appUIManagement = (state = initialState, action) => {
switch(action.type) {
    case SWITCH_TAB:
        return Object.assign({}, state, {activeTab: action.activeTab});
    default:
        return state;
}
}

Assuming my initial state is
{activeTab: 'lines'}

Now when I dispatch an action:
{ type:SWITCH_TAB, { activeTab: 'favorites' } },

the state parameter of my reducer is only 'lines' instead of the whole object and because of this my response looks something like
{
  activeTab: {
    '0': 'l',
    '1': 'i',
    '2': 'n',
    '3': 'e',
    '4': 's',
    activeTab: 'favorites'
  }
}

What am I doing wrong or what is it that I'm not getting about redux?
Thank you

A: You are passing the string action.activeTab into Object.assign

const state = {};
const action = { type: 'SWITCH_TAB', activeTab: 'lines' };
const newState = Object.assign({}, state, action.activeTab);
console.log(newState);

However, Object.assign expects objects as its arguments so you should pass the whole action or better yet the portion of the action that you need:

const state = {};
const action = { type: 'SWITCH_TAB', activeTab: 'lines' };
const newState = Object.assign({}, state, { activeTab: action.activeTab })
console.log(newState);


text:
Q: ORA-01036: illegal variable name/number when running query through C# I am trying to use ALTER USER query for Oracle database using OracleCommand in C# in the following code. It creates the query if the values for Username and password are not empty strings. But I get an error "ORA-01036: illegal variable name/number" when ExecuteNonQuery() is executed.
  string updateQuery = "ALTER USER :user IDENTIFIED BY :password";
  connection = new OracleConnection(LoginPage.connectionString);
  connection.Open();
  OracleCommand cmd = new OracleCommand(updateQuery, connection);
  cmd.Connection = connection;
  for(int i=0;i<usersList.Count;i++)
        {
            if (!(selectedUsersArray[i].Equals("")) && !passwordArray[i].Equals(""))
            {
                OracleParameter userName = new OracleParameter();
                userName.ParameterName = "user";
                userName.Value = selectedUsersArray[i];

                OracleParameter passwd = new OracleParameter();
                passwd.ParameterName = "password";
                passwd.Value = passwordArray[i];

                cmd.Parameters.Add(userName);
                cmd.Parameters.Add(passwd);

                cmd.Prepare();
                cmd.ExecuteNonQuery();

            }
        }

Could you please suggest what is wrong with my implementation?.

A: You defined one oracleCommand but used it in 'for'.
it means you are adding parameter with the same name to one OracleCommand.
you should use cmd.Parameters.clear() to refresh your parameters.
for(int i=0;i<usersList.Count;i++)
        {
            if (!(selectedUsersArray[i].Equals("")) && !passwordArray[i].Equals(""))
            {
                cmd.Parameters.clear();//Add this line
                OracleParameter userName = new OracleParameter();
                userName.ParameterName = "user";
                userName.Value = selectedUsersArray[i];

                OracleParameter passwd = new OracleParameter();
                passwd.ParameterName = "password";
                passwd.Value = passwordArray[i];

                cmd.Parameters.Add(userName);
                cmd.Parameters.Add(passwd);

                cmd.Prepare();
                cmd.ExecuteNonQuery();

            }
        }

A: The Oracle error ORA-01036 means that the query uses an undefined variable somewhere. From the query we can determine which variables are in use, namely all that start with @. However, if you're inputting this into an advanced query, it's important to confirm that all variables have a matching input parameter, including the same case as in the variable name, if your Oracle database is Case Sensitive.

A: The root cause
In Oracle you have three kinds of SQL statements (and additionally there are PL/SQL blocks):

*

*Statements in the Data Definiton Language (DDL). These statements modify the structure of the database. They begin usually with the verbs "ALTER" or "CREATE"

*Statements in the Data Modification Langugage (DML). There statements modify the content inside of tables, leaving the structure of each table unmodified. These statements usually begin with "INSERT", "MERGE" or "DELETE".

*Statements in what I call "query language" (there seems to be no canonical name for these). This statements start with the verb "SELECT".

Bind variables in Oracle are only allowed in some special places in DML and query statements. You are trying to use bind variables in a places where they are not allowed. Hence the error.
Solution
Build your statement without bind variables. Build the complete query string instead using string concatenation.
If you want to sanitize the input before concatenating the string, use the DBMS_ASSERT package.
Background
Bind variables can only be used when Oracle can build a query plan without knowing the value of the variable. For DDL statements, there is no query plan. Hence bind variables are not allowed.
In DML and query statements, bind variables are only allowed, when they are used inside a tuple (regarding the underlying set theory), i.e. when the value will be compared with the value in a table or when the value will be inserted in a table. They are not allowed to change the structure of the execution plan (e.g. to change the target table or to change the number of comparisons).

A: Just for others getting this error and looking for info on it, it is also thrown if you  happen to pass a binding parameter and then never use it. I couldn't really find that stated clearly anywhere but had to prove it through trial and error.

A: This error happens when you are also missing cmd.CommandType = System.Data.CommandType.StoredProcedure;

A:  cmd.Parameters.Add(new OracleParameter("GUSERID ", OracleType.VarChar)).Value = userId;

I was having eight parameters and one was with space at the end as shown in the above code for "GUSERID ".Removed the space and everything started working .

A: I just spent several days checking parameters because I have to pass 60 to a stored procedure.  It turns out that the one of the variable names (which I load into a list and pass to the Oracle Write method I created) had a space in the name at the end.  When comparing to the variables in the stored procedure they were the same, but in the editor I used to compare them, I didnt notice the extra space.  Drove me crazy for the last 4 days trying everything I could find, and changing even the .net Oracle driver.  Just wanted to throw that out here so it can help someone else.  We tend to concentrate on the characters and ignore the spaces. . .

A: You cannot pass user/table name to pl/sql with a parameter. You can create a procedure and build sql and then execute immediately to achieve that.

A: I was having the same problem in an application that I was maintaining, among all the adjustments to prepare the environment, I also spent almost an hour banging my head with this error "ORA-01036: illegal variable name / number" until I found out that the application connection was pointed to an outdated database, so the application passed two more parameters to the outdated database procedure causing the error.

A: I have faced same problem ... For the problem is like this, I am calling the PRC inside cpp program and my PRC taking 4 arguments but while calling I used only 1 arguments so this error came for me.
Begin Example_PRC(:1); End; // this cause the problem
Begin Example_PRC(:1,:2,:3,:4); End; // this is the solution

A: I had the same issue today when using Python module cx_Oracle.  In my case, the root cause was an invalid variable name.
Example: SELECT * FROM DATA WHERE KEY IN (:_0, :_1, ...)
When I changed _0 to var0, it worked fine.
From this blog post, I found these rules for variable names:

*

*Must start with a letter

*Maximum size is limited to 30 letters

*Cannot contain whitespace characters

*Can contain dollar sign ('$'), underscore ('_') and hash sign ('#')

*Is case-insensitive

A: I had the same problem, was learning connection to oracledb.
previous code-
SELECTALLCANDIDATES = "Select * from candidate_master";
data= await connection.execute(SELECTALLCANDIDATES, {autoCommit:true})

Removed the {autoCommit:true} and it started working fine.Correct code-
SELECTALLCANDIDATES = "Select * from candidate_master";
data= await connection.execute(SELECTALLCANDIDATES)

Still don't know why but it works.

A: Check your named variables match, I had the same problem, I had a spelling mistake/typo in one of my parameters


text:
Q: Log considerations for high volume data I am working on a design to log high volume of data.The data can be of a typical size of around 1Kb-10Kb.Also what I mean by high volume is it can be up to 10000 data points per second.So if I consider worst case for every hour data can be logged as much as 10000*10*60*60B or 360Mb.I can use log rotation so that it doesn't cross a threshold.But what can be other alternatives to make this number go down even more.I can try compression but then I should give up on log readability.Or I can only maintain a metadata for each data.What other techniques can I try and what will be the pros and cons?

A: We had a similar problem on a smart watch product few years back. Since the on device RAM was really low (typical for embedded systems) we resorted to the following techniques:-

*

*Save to file system - Write the data to the persistent file system whenever size grows beyond a threshold - this can even be done based on time since you are saying you have a predictability relationship of log size with time

*Upload to Cloud - If storage on device becomes a problem - you may as well consider posting the log data to a cloud server

*Optimize log data - This can be tricky - try to log as less as possible per cycle - meaning define a format to capture just data points instead of text. This would mean interpretation of the logs have to have a little parser as well - that's the trade off you will have to consider
Example consider this for a location based log:-
Lat:100.23; Lon:23.87; Height: 233; Time stamp: 1875340
This can well be reduced to:-
[100.23,23.87,233,1875340]
With such high volumes these small bits here and there will provide massive savings
All the best!


text:
Q: Creating a list with c:foreach and placing an onClick listener with a parameter on the items I'm trying to build a list of items in a jsp page in the following way:
I have a Spring Mvc controller which returns the results of a search in a model. I am able to access objects in this model via the following code in the jsp:
<c:forEach var="listItem" items="${poiList}">

                        <c:out value="${listItem.getName()}"/>
                        <c:out value="${listItem.getAddress()}"/>
                        <c:out value="${listItem.getType()}"/>
                        <c:out value="${listItem.getRating()}"/>

</c:forEach>

The list gets printed nicely. However, I would like each item to become clickable and redirect to a certain page (more like send another request to the controller) on click.
So far, I have tried jquery, but if I don't build the list there, I cannot access a listItem's ID, which would be needed for the request. It would be nice if I could somehow pass it as a parameter with the onClich property of the manageListItem div, but that does not seem possible.
I could also do the whole thing in jQuery, but this seems cleaner and also, I have no idea on how to access the Model's attributes in jQuery :)
What is the best method to achieve this functionality?

A: You can put an onclick listener on the row, and you can reference the item id using JSP EL as normal.  Have a look at this example:
<c:forEach var="listItem" items="${poiList}">

        <c:out value="${listItem.getName()}"/>
        <c:out value="${listItem.getAddress()}"/>
        <c:out value="${listItem.getType()}"/>
        <c:out value="${listItem.getRating()}"/>

</c:forEach>

You could always call another function, or have jQuery stuff in the onclick part; the main point is that you can use JSP EL to build the javascript code that can react to events.

A: $(document).on('click', '.manageListItem td', function(e){
    //i think the value is just the text in the TD, no?
    window.location = window.location.protocol + '//' + window.location.host + '?listItemId=' + $(this).text()
});

Using jQuery's .on() we can delegate event listening to a static element. For dynamic elements, this will ensure that they can still have events fire. .on() accepts 3 arguments: the event, the element we want to fire the event from, and of course, the callback function to run when the event has triggered.
Based on your markup above, I'm assuming that the value you print inside your td is your listItemId.
The line window.location = window.location.protocol + '//' + window.location.host + '?listItemId=' + $(this).text()
Will grab the protocol
http:

Then we concatenate the string with two // trailing forward slashes ( if there is no http/https, // before a url is still valid).
Then we grab the host location
stackoverflow.com

then we append a query string with the text that was inside of the TD.
?listItemId=8

If for instance, your c:out printed 8, then the wh ole url would look like
http://stackoverflow.com?listItemId=8

A: If you haven't mentioned what your browser requirements are, but most "modern" browsers will support the use of data- attributes.  In your case:
<c:forEach var="listItem" items="${poiList}">

                        <c:out value="${listItem.getName()}"/>
                        <c:out value="${listItem.getAddress()}"/>
                        <c:out value="${listItem.getType()}"/>
                        <c:out value="${listItem.getRating()}"/>

</c:forEach>

Now, its a simple matter of using the jquery data() method:
$('div.manageListItem').click(function(evt) {
     var id = $(this).data('itemId');
     alert('Huzzah, you clicked on ' + id);
});

FYI, if you create an element with an attribute called data-my-item-id, you need to retrieve it using jquery using myItemId.  Everything after the initial data- is converted into camelCase.

A: Thank you for all these ideas!
In the end, I found it easiest to write the redirect command right into the tag's onClick attribute:
<c:forEach var="listItem" items="${poiList}">

                        <c:out value="${listItem.getName()}"/>
                        <c:out value="${listItem.getAddress()}"/>
                        <c:out value="${listItem.getType()}"/>
                        <c:out value="${listItem.getRating()}"/>

        </c:forEach>

This way each of the listitems clicked send a request with their own ID and the controller handles that as expected.