text:
Q: Program that determines if random number is divisible by user input The user may only enter a number between 1 and 15, so if the input is out of
range, output an error and 'return' out of the function. If the input is good,
then proceed.
Create a loop that generates 10 random numbers between 1 and 100.
I know my javascript is incorrect, I'm stuck atm.

<title></title>

Loop Practice

<form>

Enter a number

<input type="text" id="usernum" />

<input type="button" value="Go For It!" onClick="loopNums()" />

</form>

A: Take a look at YOUR UPDATED FIDDLE:
function loopNums() {
    var usernum = parseInt(document.getElementById("usernum").value);
    var msg = ""; // "" is the NULL string
    var sum = 0;

    if (usernum < 1 || usernum > 15) {
        msg = "Enter a number between 1 and 15";
    } else {
        for (var i = 0; i < 10; i++) {
            var rdnNumber = Math.floor(Math.random() * ( 1 + 100 - usernum )) + usernum;

            if (rdnNumber % usernum === 0)
                msg += "
Number generated: " + rdnNumber + ". It is divisible by " + usernum + "!
";
            else
                msg += "
Number generated: " + rdnNumber + ". It is not divisible by " + usernum + "!
";
        }
    }

    document.getElementById("results").innerHTML = msg;
}


text:
Q: How to add a CGImageRef to a NSDictionary? I have a CGImageRef variable and a CGRect (so no pointers) and I need to add it to an NSDictionary. Like an NSArray, NSDictionary-s only accept pointers. How can you add an CGImageRef or an CGRect anyway?

A: CGImageRef is already a pointer, but it's not (AFAIK) a pointer to a valid Cocoa object. You can turn a CGImage into a Cocoa NSBitmapImageRep with [[NSBitmapImageRep alloc] initWithCGImage:someimageref]. And NSValue is there to wrap primitive types like CGRect.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I run runsnakerun on Mac OS X inside a conda environment? I've created a conda environment so I can use runsnakerun on my Mac as follows:
conda create -n runsnake wxPython
source activate runsnake
pip install runsnakerun

However, when I now attempt to use runsnake I get:
$ runsnake
This program needs access to the screen.
Please run with a Framework build of python, and only when you are
logged in on the main display of your Mac.

How can I get runsnake to work?

A: The problem is that conda's python is not a "framework python" on Mac, their decision is that you have to use pythonw instead. Unfortunately, pip builds entry point scripts using python not pythonw and, to make matters worse, RunSnakeRun does a horrible subprocess dance to launch itself in 32-bit mode on 64-bit macs.
The upshot is that the only hacky workaround I can think of to launch runsnake is as follows:
VERSIONER_PYTHON_PREFER_32_BIT=yes pythonw `which runsnake32`

I'm not actually sure that environment variable is even needed anymore, but the above does what the entry point appears to be trying to do and does at least start the RunSnakeRun gui.


text:
Q: Add filenames from Directory to Object I am trying to add filenames from a directory with sub-directories to an object.
My folders are structured as the following image shows:

Every time I run my code, only filenames (here commands) in the Top Folder are added to my object.
async function getCommands() {
   let commands = {};

   //get all enteties from folder
   let commandFiles = await fs.promises.readdir("./commands/", (err, elements) => {
       if (err) return console.log(err);
   });

   commandFiles.forEach(file => { //loop through all elements in folder "commands"
      const element_in_folder = fs.statSync(`./commands/${file}`)
      if (element_in_folder.isDirectory() == true) { //check if element in folder is a subfolder
         const sub_directory = `./commands/${file}/`;
         addCommandsFromSubFolder(commands, sub_directory);
      } else {
         //add command to object
         commands[Object.keys(commands).length] = {
            "command": file
         }
      }
   });
   return commands; //return full object with all commands
}

function addCommandsFromSubFolder(commands, sub_directory) {
   //loop through all files in subfolders
   fs.readdir(sub_directory, (err, files) => {
      if (err) return console.log(err);
      let commandsInSubFolder = files.values();
      //add files from subfolder to the object
      for (const command of commandsInSubFolder ) {
         commands[Object.keys(commands).length] = {
            "command": command
         }
      }
   });
}

If I log commands in addCommandsFromSubFolder, I can still see, that the files from all subfolders are still added, but node won't wait for them to be added.

A: you should await on function call for subfolder
async function getCommands() {
   let commands = {};

   //get all enteties from folder
   let commandFiles = await fs.promises.readdir("./commands/", (err, elements) => {
       if (err) return console.log(err);
   });

   for (const file of commandFiles) {
      const element_in_folder = fs.statSync(`./commands/${file}`)
      if (element_in_folder.isDirectory() == true) { //check if element in folder is a subfolder
         const sub_directory = `./commands/${file}/`;
         await addCommandsFromSubFolder(commands, sub_directory);
      } else {
         //add command to object
         commands[Object.keys(commands).length] = {
            "command": file
         }
      }
   }

   return commands; //return full object with all commands
}

async function addCommandsFromSubFolder(commands, sub_directory) {
    try {
        files = await fs.promises.readdir(sub_directory);
        for (const command of commandsInSubFolder ) {
            commands[Object.keys(commands).length] = {
                "command": command
            }
        }
    } catch (e) {
        console.log('e', e);
    }
}

only you should attention to require fs like this (only node > 10):
const { promises: fs } = require("fs");

for node < 10 you should use promise to await


text:
Q: Regression Analysis and Optimization in R I have the following table:
d <- read.table(textConnection("y x1 x2 x3 x4
                  40 5 10 8 2
                  60 9 19 9 9
                  75 18 27 19 5
                  80 15 36 25 20
                  115 25 45 39 30
                  120 35 48 58 19"), header=TRUE)

My goal is to find parameters which affect y and to find max(y).
I did linear regression analysis and got that x1,x3 and x4 are the most significant in my model:
Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept) 28.72819    0.55194  52.050   0.0122 *
x1           3.23213    0.09732  33.211   0.0192 *
x2          -0.25882    0.06863  -3.771   0.1650
x3          -0.61356    0.04154 -14.770   0.0430 *
x4           1.37197    0.05057  27.128   0.0235 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3601 on 1 degrees of freedom
  (2 observations deleted due to missingness)
Multiple R-squared:      1, Adjusted R-squared:  0.9999
F-statistic:  9316 on 4 and 1 DF,  p-value: 0.00777

Data set above is information for one month and my question is how can I maximize Y for next month, if parameters x1,x2,x3,x4 I can change and x1,x2,x3,x4>0
Should I perform a simulation or optimization?


text:
Q: php pdo code to search array of column Data present in database column are like below..
animationno = 300,301
animationdate  =  300 - 23-03-2015,   301- 23-04-2015
When user search 300 then it display output 300-23-03-2015 from animationdate
When user search 301 then it display output 301-23-04-2015 from animationdate.
I have no idea is this possible..or not...and if yes...i really no guesses how to achieve this...thanks for any help...to find solution
plz help to get solution for this..array search
<?php
$database= new PDO( "connection string goes here" );
$q = $_GET['q'];

$query=$database->prepare("SELECT animationdate FROM animationmaster WHERE animationno = :animationno");
$query->bindParam(':animationno', $q);
$query->execute();

$result = $query -> fetch();
echo json_encode($result);
?>

A: Try like this:
SELECT animationdate FROM animationmaster
WHERE animationno like '300%'

or
    $database= new PDO( "connection string goes here" );
    $q = $_GET['q'];
    $param = "'".$q."%'";

    $query=$database->prepare("SELECT animationdate FROM animationmaster WHERE animationno = :animationno");
    $query->bindParam(':animationno', $param);

$query->execute();

A: Try
$query= $database->prepare("
            SELECT animationdate
            FROM animationmaster
            WHERE animationno IN (:animationno)
        ");


text: Q: ASUS laptop WON'T stay OFF Plesae help. My ASUS laptop (gl502vm) wont stay off, after fully shut down unexpectedly starts. I try turn off "restart after crash", "fast startup", make new power plan and others tips from internet but nothing helps.


text:
Q: monetdbd: internal error while starting mserver I am following the MonetDB tutorial but after executing this command:
shell> mclient -u monetdb -d voc

and inserting the password I receive the following error
monetdbd: internal error while starting mserver

This is the error in the log file. How can I solve this? Thank a lot!!
2016-05-23 08:41:39 MSG voc[1060]: !IOException:mal_mapi.listen:operation failed: binding to UNIX socket file /vagrant/mydbfarm/voc/.mapi.sock failed: No such file or directory

2016-05-23 08:41:39 MSG merovingian[1054]: database 'voc' (1060) has exited with exit status 0

2016-05-23 08:41:39 MSG merovingian[1054]: database 'voc' has shut down

2016-05-23 08:41:39 ERR merovingian[1054]: client error: database 'voc' started up, but failed to open up a communication channel

A: try a mkdir -p /vagrant/mydbfarm/voc/ as the user who runs MonetDB perhaps?


text:
Q: Why "more severe are" is put in front of "its drawbacks"? I am learning English. I saw this sentence in a youtube video: Vampire has 4 stages. The higher your Vampire stage is, the stronger you become, but also more severe are its drawbacks. My question is why don't say "but also its drawbacks are more severe"?

A:
The higher your Vampire stage is, the stronger you become, but also more severe are its drawbacks.

This would be better as
The higher your Vampire stage is, the stronger you become, but also the more severe are its drawbacks.
This follows the pattern of
The + comparative + subject + verb, the + comparative + subject + verb. (The older we grow, the wiser we become.)
The construction is often followed by (i) a conclusion or (ii) contrast in the same form
(i) The older we grow, the wiser we become and the happier is our life.
(ii) The older we grow, the wiser we become but the less time we have. (You can also say "but the less time have we" as a form of parallelism.
(Have a look at the "Grammar Org" website for "The ... the.. " constructions)
The inversion is stylistic. You can begin a sentence with an adverb/adverbial or adjective/adjectival if you wish to add emphasis. If you do this then you could also invert the verb and subject:
"Hot(adj.) was the day, long(adj.) was the road, and dearly(adv.) did he wish to rest."
About 300 years ago, this sort of construction was relatively common, especially in literature. It has become less common in current Modern English but is sometimes found in particular constructions - "the...the" is one of them.


text:
Q: bootstrap carousel stretch image this is bootstrap carousel, i tried to use col-xs-12 or sm to make it smaller and fitted to smaller screens. but it seems becomes stretch images of my carousel how to make it in normal size?

A: try to call "col-xs-12 col-sm-12" these class in upper div of img tag. like
Ex:


text:
Q: inner panel height not 100% on overflow I have a panel with components inside and once the submit button is pressed, an overlay appears, but is not covering the entire parent panel (see picture) when I have scrolled all the way to the bottom. Also, the spinner need to be always in the center whether I am scrolling or not. I used position: fixed; but I don't know if that's the best practice.
CSS
.pay-storage-container {
  $inner-padding: 16px;
  height: 100vh;
  position: fixed;
  right: 0;
  top: 0;
  width: 325px;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  background-color: #fff;

     .loading-container {
        position: absolute;
        background-color: rgba(0, 0, 0, 0.2);
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;

        img {
          position: fixed;
          top: 50%;
          right: 18%;
          animation: spinner 1s linear infinite;
        }
      }
   }

HTML

Pay Storage

    <app-equipment-summary [equipmentSummary]='equipmentSummary'></app-equipment-summary>
    <app-credit-card #creditCardForm></app-credit-card>

    <button pButton type="button" label="Submit Payment" class="x-primary-green-400" [disabled]='isLoading' (click)="onSubmitPayment()"></button>

    <app-payment-success [paymentSuccess]="paymentSuccess" (close)="onToggleSideBar($event)"></app-payment-success>

A: I don't think that there is anything wrong with using position:fixed to keep your spinner in the center of the page.
Also, if you want to fully overlay your content then your loading-container needs to be at the very bottom of the content you want overlayed. This code below should just overlay pay-storage-container:

Pay Storage

    <app-equipment-summary [equipmentSummary]='equipmentSummary'></app-equipment-summary>
    <app-credit-card #creditCardForm></app-credit-card>

    <button pButton type="button" label="Submit Payment" class="x-primary-green-400" [disabled]='isLoading' (click)="onSubmitPayment()"></button>

    <app-payment-success [paymentSuccess]="paymentSuccess" (close)="onToggleSideBar($event)"></app-payment-success>

A: I am sharing a sample code snippet which centers overlay spinner for all dimensions. You can edit your CSS accordingly to achieve centered spinner with overlay.

/* Absolute Center Spinner */

.loading {
  position: fixed;
  z-index: 999;
  height: 2em;
  width: 2em;
  overflow: show;
  margin: auto;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

/* Transparent Overlay */

.loading:before {
  content: '';
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
}

/* :not(:required) hides these rules from IE9 and below */

.loading:not(:required) {
  /* hide "loading..." text */
  font: 0/0 a;
  color: transparent;
  text-shadow: none;
  background-color: transparent;
  border: 0;
}

.loading:not(:required):after {
  content: '';
  display: block;
  font-size: 10px;
  width: 1em;
  height: 1em;
  margin-top: -0.5em;
  -webkit-animation: spinner 1500ms infinite linear;
  -moz-animation: spinner 1500ms infinite linear;
  -ms-animation: spinner 1500ms infinite linear;
  -o-animation: spinner 1500ms infinite linear;
  animation: spinner 1500ms infinite linear;
  border-radius: 0.5em;
  -webkit-box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.5) -1.5em 0 0 0, rgba(0, 0, 0, 0.5) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
  box-shadow: rgba(0, 0, 0, 0.75) 1.5em 0 0 0, rgba(0, 0, 0, 0.75) 1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) 0 1.5em 0 0, rgba(0, 0, 0, 0.75) -1.1em 1.1em 0 0, rgba(0, 0, 0, 0.75) -1.5em 0 0 0, rgba(0, 0, 0, 0.75) -1.1em -1.1em 0 0, rgba(0, 0, 0, 0.75) 0 -1.5em 0 0, rgba(0, 0, 0, 0.75) 1.1em -1.1em 0 0;
}

/* Animation */

@-webkit-keyframes spinner {
  0% {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@-moz-keyframes spinner {
  0% {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@-o-keyframes spinner {
  0% {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes spinner {
  0% {
    -webkit-transform: rotate(0deg);
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -o-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -o-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

Loading…

`


text:
Q: Altering the Hive table partitions by reducing the number of partitions Create Statement:
CREATE EXTERNAL TABLE tab1(usr string)
                PARTITIONED BY (year string, month string, day string, hour string, min string)
                ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'
                LOCATION '/tmp/hive1';

Data:
select * from tab1;

jhon,2017,2,20,10,11
jhon,2017,2,20,10,12
jhon,2017,2,20,10,13

Now I need to alter tab1 table to have only 3 partitions (year string, month string, day string) without manually copying/modifying files. I have thousands of files, so I should alter only table defination without touching files?
Please let me know how to do this?

A: if this is something that you will do one time, I would suggest create a new table with the expected partitions and insert the table from the older table to the new one using dynamic partitioning. This will also avoid keep small files in your partitions. The other option is create a new table pointing to the old location with the expected partitions and use  the following properties
TBLPROPERTIES ("hive.input.dir.recursive" = "TRUE",
"hive.mapred.supports.subdirectories" = "TRUE",
"hive.supports.subdirectories" = "TRUE",
"mapred.input.dir.recursive" = "TRUE");

after that, you can run the msck repair table to recognize the partitions.


text:
Q: Cannot connect to a shared printer on local network; error 0x00004005 I have a shared printer, connected to computer in local network, model is HP Laser Jet 2420. I am trying to connect to it from another computer. I see it in network, when I type address of computer in windows explorer. But when I try to connect to it, I get error 0x00004005.
.
When I try to connect to it using a Local port (Control panel > Devices and Printers > add printer > add a local printer or network printer with manual settings > Create a new port :: Local port), I get such error:

I tried to set up GPEDIT.MSC > Administrative Templates > Printers > Point and Print Restrictions to Disabled and it did not help.
My computer and host computer are in same workgroup. Both computers use win 10. It was working before like charm, I was able to connect and print on that printer, but suddenly it stopped working.
How do I nicely share this printer?

A: Apparently it got fixed with recent updates of Windows. Also I have enabled all sharing on remote computer


text:
Q: Whats the difference between JS Number.MAX_SAFE_INTEGER and MAX_VALUE?
Number.MAX_SAFE_INTEGER
  9007199254740991
Number.MAX_VALUE
  1.7976931348623157e+308

I understand how MAX_SAFE_INTEGER is computed based on JavaScript's double precision floating point arithmetic, but where does this huge max value come from? Is it the number that comes about if you're using all 63 bits for the exponent instead of the safe 11 bits?

A: As you know the javascript have type Number, but not integer. Integer appears by ducktyping feature in javascript. So Number.MAX_SAFE_INTEGER < Number.MAX_VALUE.
They together with MIN_VALUE and MIN_SAFE_INTEGER set range of possible Number value, for double and int when you use parseFloat(X) && parseInt(X).

A: MAX_VALUE is in double (64 bit)
MAX_SAFE_INTEGER can use first 53 bit of a double(64 bit)
basically javascript doesn't support long. so for int number its uses
32 bit integer container. and for a numbers greater then 32 bit its keep the number in a double container which integer part is 53 bit and rest 11 bits are mantissa(keep the information of a floating point number).

A: Number.MAX_SAFE_INTEGER is the largest integer which can be used safely in calculations.
For example, Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2 is true — any integer larger than MAX_SAFE_INTEGER cannot always be represented in memory accurately. All bits are used to represent the digits of the number.
Number.MAX_VALUE on the other hand is the largest number possible to represent using a double precision floating point representation. Generally speaking, the larger the number the less accurate it will be.
More information double-precision floating point numbers on Wikipedia

A: JS numbers are internally 64-bits floats (IEEE 754-2008).
MAX_SAFE_INTEGER is the maximum integer that can be safely represented in that format, meaning that all the numbers below that value (and above MIN_SAFE_INTEGER) can be represented as integers.
MAX_VALUE comes from 2^1023 (11 bits mantissa minus mantissa sign), thats about 10^308.

Is it the number that comes about if you're using all 63 bits for the
  exponent instead of the safe 11 bits?

The mantissa (exponent) is always 11 bits, (not so) surprinsingly that's enough for up to 10^308.

A: Basically floating point numbers are represented as:
digits * 2 ** movement

digits (the mantissa) has 52 bits (and 1 "hidden bit"), movement has 11 bits, and both together form a 64bit number (with 1 sign bit). Through that, you can represent all kinds of different numbers as you can store very large numbers (large positive movement), very small numbers (large negative movement), and integers (digits).

What is Number.MAX_SAFE_INTEGER ?

Integers can just be represented with movement being set in a way that the mantissa is actually the number itself, then digits contains the 52 + 1 bit number, and that can hold up to 2 ** 53 - 1 numbers (which is Number.MAX_SAFE_INTEGER).
Now for larger numbers, you have to use movement, which basically means that you move the digits left or right, and therefore you lose accuracy.
(Imagine digits would just take 8 bits)
  number     >     digits | movement > result
  // savely represented
  11111111   >  11111111  | 0        > 11111111
  // lost the last 1
  111111111  >  11111111  | 1        > 111111110
  // lost the two last 1s
  1111111111 >  11111111  | 10       > 1111111100

What is Number.MAX_VALUE ?

If you set all bits of digits and all bits of movement, you get a number (2 ** 53 - 1) that is moved by 2 ** 10 - 1 to the left, and that is the largest number that can be stored in the 64 bit, everything that is larger is Infinity (which is represented as the movement being 2 ** 10 and the mantissa being 0).

A: MAX_SAFE_INTEGER has a value of 9007199254740991. The reasoning behind that number is that JavaScript uses double-precision floating-point format numbers as specified in IEEE 754. It returns the maximum safe integer value which can be represented as 2^53 - 1.
Safe refers to the ability to represent integers exactly and to correctly compare them.
Eg: Number.MAX_SAFE_INTEGER + 1 === Number.MAX_SAFE_INTEGER + 2 will evaluate to true
MAX_VALUE on the other hand, has a value of approximately 1.79E+308, or 2^1024. Values larger than MAX_VALUE are represented as Infinity.


text:
Q: Constant Score Query elasticsearch boosting My understanding of Constant Score Query in elasticsearch is that boost factor would be assigned as score for every matching query. The documentation says:

A query that wraps a filter or another query and simply returns a constant score equal to the query boost for every document in the filter.

However when I send this query:
"query": {
    "constant_score": {
        "filter": {
            "term": {
                "source": "BBC"
            }
        },
        "boost": 3
    }
},
"fields": ["title", "source"]

all the matching documents are given a score of 1?! I cannot figure out what I am doing wrong, and had also tried with query instead of filter in constant_score.

A: Scores are only meant to be relative to all other scores in a given result set, so a result set where everything has the score of 3 is the same as a result set where everything has the score of 1.

Really, the only purpose of the relevance _score is to sort the results of the current query in the correct order. You should not try to compare the relevance scores from different queries. - Elasticsearch Guide

Either the constant score is being ignored because it's not being combined with another query or it's being normalized. As @keety said, check to the output of explain to see exactly what's going on.

A: Constant score query gives equal score to any matching document irrespective any scoring factors like TF, IDF etc. This can be used when you don't care whether how much a doc matched but just if a doc matched or not and give a score too, unlike filter.
If you want score as 3 literally for all the matching documents for a particular query, then you should be using function score query, something like
"query": {
    "function_score": {
        "functions": [
            {
                "filter": { "term": { "source": "BBC" } },
                "weight": 3
            }
        ]
    }
    ...
}


text:
Q: Exporting separate files of streets from MID/MID which cover district I have MID/MIF that describes 80 streets of the district and I want to have separate pairs of MID/MID for each street from the original MID/MID.
I can save a copy of district MID/MID and delete all but one street and save it, but maybe it could be made automatically?
Here is original MID/MIF:

so I need separate MID/MIF for each table entry.


text:
Q: Sigma js. change background color how I can change the background color of the graph. I need it in Black. I think  anyone from settings, but I  found nothing in the repo . Any help is appreciated.
Thanks

A: According to the docs:

To change the background of sigma, you have to change the CSS rules of the container. Since the different layers are transparent (except of the drawn elements), the background of the container is the actual background of your display.


text:
Q: Unusual support vector using kernlab The following code should create a support vector classifier (SVM with linear kernel) using the ksvm function from the kernlab package:
library(kernlab)
set.seed(1)
x <- rbind(matrix(rnorm(10 * 2, mean = 0), ncol = 2),
           matrix(rnorm(10 * 2, mean = 2), ncol = 2))
y <- c(rep(-1, 10), rep(1, 10))
svc <- ksvm(x, y, type = "C-svc", kernel = "vanilladot")
plot(svc, data = x)

The resulting graph:

If my understanding is correct, the black shapes are the support vectors, which are the data points that lie inside or on the boundary of the margin.
So what's up with the topmost black dot? There are three open dots (so not support vectors) that are closer to the decision boundary. (Two are nearby and easy to see. The third is harder to see unless you zoom in on the picture, but it's the one furthest to the right.)
Either there is a bug in the implementation here or I'm missing something conceptual about the way this is supposed to work. Any insights?

A: There's nothing wrong with your results. The 6 support vectors are indeed closest to your decision surface (i.e. line in your case). I admit that the shading in the plot you're showing looks a bit odd. Could this be an optical artefact?
Let's reproduce your results using svm from the e1071 library (since I'm more familiar with e1071 than with kernlab).

*

*Here is your sample data.
# Sample data
set.seed(1)
x <- rbind(matrix(rnorm(10 * 2, mean = 0), ncol = 2),
           matrix(rnorm(10 * 2, mean = 2), ncol = 2))
y <- c(rep(-1, 10), rep(1, 10))
df <- data.frame(x = x, y = as.factor(y));

*Let's use svm as a classification machine using a linear kernel. scale = FALSE ensures that data are not scaled.
library(e1071);
fit <- svm(y ~ ., data = df, kernel = "linear", type = "C-classification", scale = FALSE);
fit;
#
#Call:
#svm(formula = y ~ ., data = df, kernel = "linear", type = "C-classification",
#    scale = FALSE)
#
#
#Parameters:
#   SVM-Type:  C-classification
# SVM-Kernel:  linear
#       cost:  1
#      gamma:  0.5
#
#Number of Support Vectors:  6

*We plot the decision surface and support vectors (SV).
plot(fit, df);

The SVs are marked by the x symbols. You can clearly see how the SVs are located nearest to the separating decision line.

*We can also extract the parameters of the decision line (i.e. its normal vector), and manually plot decision line and data:
# Normal vector and offset
w <- t(fit$coefs) %*% fit$SV
b <- fit$rho;

# Generate data for the decision line
x.1 <- seq(min(df[, 1]), max(df[, 1]), length.out = 20);
x.2 <- (b - w[1] * x.1) / w[2];
df.h <- data.frame(x.1 = x.1, x.2 = x.2);

# Plot
ggplot(df, aes(x.2, x.1)) +
    geom_point(aes(colour = y), size = 2) +
    geom_line(data = df.h, aes(x = x.2, y = x.1), linetype = 2)


text:
Q: Easiest way to "tail" the latest out file At work, I run many simulations from the command line, and I want to capture the output into a file, but also to continue to see the output in the command line. My current workflow is to run something like this:
run sim_0425 > sim_0425.log & tail -f sim_0425.log

This does exactly what I want, but the issue is that the logfile will be named something different each time depending on the simulation parameters (for example, here  it's "sim_0425"), and it's kinda kludgey to manually rename it in all locations each time. I'll often forget to rename it one of the locations, and then I'll rewrite a file somewhere.
I can't imagine that there isn't some built-in way to output to a file and to the std out stream simultaneously. Googling this is challenging because I'm basically searching for "> & tail" and that doesn't turn much up :/

A: You can use the tee command for this (if you have it installed, which is likely; it's part of the Posix standard). tee takes its standard input and writes (or appends) it to one or more files, and also sends it to stdout:
run sim_0425 | tee sim_0425.log | tail -f

If you want to append to the log file instead, use the -a option:
run sim_0425 | tee -a sim_0425.log | tail -f


text:
Q: Firefox 26 showing credentials in suggestion for form fields I'm using firefox 26. I have saved my credentials to my development site. And then i have used auto complete off feature. Following is my sample code
<form id="loginform" autocomplete="off">
<input name="username" type="text" autocomplete="off">
<input name="pwd" type="password" autocomplete="off">
</form>

Its worked fine for previous versions. After update to firefox 26, its not working. when i type first letter of my username, its showing saved credentials in suggestion. How to disable this?
Even i selected the suggested credentials, its auto fill the username and password field. But its not allowing to access site, showing login errors like enter password.

A: From: http://support.mozilla.org/en-US/kb/control-firefox-automatically-fills-in-forms#w_prevent-firefox-from-storing-form-entries
If you don't want Firefox to remember what you've entered into form fields, you can turn off the auto form fill feature:
On the menu bar, click on the Firefox menu and select Preferences...
.
Select the Privacy panel.
Set Firefox will: to Use custom settings for history.
Remove the check mark from the box that says Remember search and form history.
Close the Preferences window .
Disabling form history also prevents Firefox from storing search history for the Search bar in the Navigation Toolbar.
Clearing form history
If you want Firefox to forget all of your previous form entries:
On the menu bar, click on the History menu, and select Clear Recent History….
In the Time Range to clear: drop-down, select Everything.
Click the arrow next to Details to display the list of items that can be cleared.
Make sure only Form & Search History is check marked.
Click Clear Now. The dialog box will disappear and your form history will be erased.
Prevent Firefox from storing form entries

A: In some browsers you may need to activate an autocomplete function for this to work, or deactivate by unchecking its relative checkbox. (Look under "Preferences" in the browser's menu. This feature is in the control of user. At least in the current time.


text:
Q: Normal Distribution of Sums I have two normally distributed random variables $X$ and $Y$. Then I know that the sum $X-Y$ is also normally distributed (i).
However, I want to show (preferably by a counter example) that the opposite is not true (ii). If $X-Y$ is normally distributed, this does not mean that $X$ and $Y$ are normally distributed.
\begin{align}
X\sim N(\mu_x,\Sigma_x)\text{ and }Y\sim N(\mu_y,\Sigma_y) \underbrace{\overbrace{\stackrel{\Rightarrow}{\nLeftarrow}}^{(i)}}_{(ii)}Z=X-Y\sim N(\mu_z,\Sigma_z)
\end{align}

A: Let $W$ (for example) be a random variable which takes on values $0$ and $1$, each with probability $\frac{1}{2}$. let $Z$ be standard normal,  and suppose $W$ and $Z$ are independent. Let $X=W+Z$ and let $Y=W$. Then $X-Y$ is normally distributed, but neither $X$ nor $Y$ is normal.
Remark: Note that if $X$ and $Y$ are normal and not independent, then $X-Y$ need not be normal. For example, let $X$ be standard normal, and let $Y=RX$, where $R$ and $X$ are independent, and $R$ takes on values $-1$ and $1$ each with probability $1/2$. Then $X-Y$ is not normal.

A: Take some $Z$ following a normal distribution, and $X$ any other. Then set $Y=X-Z$.
$X-Y$ follows a normal distribution, while $X$ doesn't.


text:
Q: Why is it looking for String? Given the following code:
abstract class Field {
  type T
  val data: List[T]
  def sum: T = data(0) + data(1)
}

I get an error on the last line - def sum: T = data(0) + data(1):

types2.scala:6: error: type mismatch;
found   : Field.this.T
required: String
def sum: T = data(0) + data(1)
                     ^

That is, it expects data(1) to be a String.
I dont understand why... (scala 2.8.1)
Your explanation will be much appreciated!

A: As a complement to @missingfactor's answer, while in principle I would very much favor Semigroup, there is a trait Numeric in the standard library which would do the same. And on collections whose content is Numeric (where a "Numeric structure" exists for the elements' type), you can simply call collection.sum (should you want to sum all the elements rather than the two first ones).
I prefer Semigroup for two reasons. First Numeric is much more than what is needed here, second, what are the exact properties of a Numeric structure is not clear. On the other hand, even someone not familiar with basic algebra will have a reasonable understanding of what Numeric means.
So if you are afraid of scalaz and/or semigroups, you can replace Semigroup with Numeric and |+| with +. You must import Numeric.Implicits._ so that + is available.

A: The compiler doesn't know how to invoke + in your type T, because it knows nothing about T. The only solution to compile this + is then a pimped string concatenation (by means of the implicit Predef.any2stringadd), which expects a string as second argument — hence the error you're getting.

A: Since T does not support an addition operation, compiler assumes + to be a string concatenation operation. The following line I tried out at REPL indicates so:
scala> implicitly[Any => {def +(s: String): String}]
res16: (Any) => AnyRef{def +(s: String): String} = <function1>

What you can do is require that T  have a Semigroup algebra defined. (A type is a semigroup if it supports an associative append operation.)
scala> import scalaz._
import scalaz._

scala> import Scalaz._
import Scalaz._

scala> abstract class Field[A : Semigroup] {
     |   val data: IndexedSeq[A]
     |   def sum: A = data(0) |+| data(1)
     | }
defined class Field

scala> val f = new Field[Int] {
     |   val data = IndexedSeq(2, 3, 4)
     | }
f: Field[Int] = $anon$1@d1fd51

scala> f.sum
res12: Int = 5

I replaced abstract type by a type parameter simply because I do not know how to put a context bound on an abstract type. I also changed type of data from List[A] to IndexedSeq[A] because as the name indicates indexed sequences are more suitable for indexed access than lists (which is what you do in your sum method). And finally, |+| is the semigroup append operation. For numeric types it will perform addition. For sequences, concatenation etc.

A: After a lot of playing with this, I came up with a very simple solution.
Here is the full program
package manytypes

abstract class Field {
  type T
  val data: List[T]
  def add (a: T, b: T): T
}

abstract class FieldInt extends Field {
  type T = Int
  def add (a: T, b: T): T = a + b
}

abstract class FieldDouble extends Field {
  type T = Double
  def add (a: T, b: T): T = a + b
}

abstract class FieldString extends Field {
  type T = String
  def add (a: T, b: T): T = a + b
}

object A extends App {

  val ints: Field = new FieldInt { val data = List(1, 2, 3)}
  val doubles: Field = new FieldDouble { val data = List(1.2, 2.3, 3.4) }
  val strings: Field = new FieldString { val data = List("hello ", "this is ", "a list ")}

  val fields: List[Field] = List(ints, doubles, strings)

  for (field <- fields) println(field.data.reduceLeft(field.add(_, _)))
}


text:
Q: Spring Boot Common JPA repository class I have a number of JPA repositories classes and I want to create one common class where I will create a getter method of a respective repository and I will use that common class in the service layer.
So Can you please guide me with best practices that how can I achieve this?
Here I am sharing my idea by using sample code,
JPA repository
@Repository
public interface IConfigRepository extends JpaRepository<Config, Integer> {
}

public interface IBusinessRepository extends JpaRepository<Business, Integer> {
}

Repo Factory (Common Class for all repositories)
public class RepoFactory {
    @Autowired
    private IConfigRepository configRepo;

     @Autowired
    private IBusinessRepository businessRepo;

    public IConfigRepository getConfigRepository() {
        return configRepo;
    }

    public IBusinessRepository getBusinessRepository() {
        return businessRepo;
    }
}

Service Class
@Service
public class ServiceA {
  public final RepoFactory repoFactory;

   public ServiceA(RepoFactory repoFactory) {
       this.repoFactory = repoFactory
   }

   @Transactional(rollbackOn = Exception.class)
   public void saveOrUpdate(Config config) {
      repoFactory.getConfigRepository().save(config);
   }
}

@Service
public class ServiceB {
  public final RepoFactory repoFactory;

   public ServiceB(RepoFactory repoFactory) {
       this.repoFactory = repoFactory
   }

   @Transactional(rollbackOn = Exception.class)
   public void saveOrUpdate(Business reqBusiness) {
      repoFactory.getBusinessRepository().save(reqBusiness);
   }
}

Thanks, everyone for helping me in advance.

A: It looks like, you're trying to do something the @Profile annotation can help you with. If I were you, I would keep a common interface (not class) and make the IConfigRepository extend it. Then you can mark IConfigRepository with the @Profile annotation. If in the future, you have to write an analogue interface, you should also mark it with the @Profile annotation and you can switch between these interfaces anytime you want by setting the appropriate profile to active.
@Repository
@Profile("config")
public interface IConfigRepository extends CommonRepository, JpaRepository<Config,Integer> {
}

public interface CommonRepository {
}

@Service
public class ServiceA {
  public final CommonRepository commonRepository;

   public ServiceA(CommonRepository commonRepository) {
       this.commonRepository = commonRepository
   }

  ...
}


text:
Q: Uncaught Error: Syntax Error, unrecognized expression: a##toc0 Muy buenas,
Al pulsar en un hipervínculo, cuya función es mostrar datos en la parte superior de la web, me salta un error en consola relacionado con una expresión (a##toc0).
He buscado y probado varias soluciones que aparecen en la web, pero realmente sigo sin entender el por qué de este error y cual sería la posible solución.
Este es el error que aparece en la consola del navegador:
jquery.min.js?ver=3.6.0:2 Uncaught Error: Syntax error, unrecognized expression: a##toc0
at Function.se.error (jquery.min.js?ver=3.6.0:2)
at se.tokenize (jquery.min.js?ver=3.6.0:2)
at se.select (jquery.min.js?ver=3.6.0:2)
at Function.se (jquery.min.js?ver=3.6.0:2)
at Function.s.find (jquery-migrate.min.js?ver=3.3.2:2)
at S.fn.init.find (jquery.min.js?ver=3.6.0:2)
at s.fn.init.S.fn.init (jquery.min.js?ver=3.6.0:2)
at new s.fn.init (jquery-migrate.min.js?ver=3.3.2:2)
at S (jquery.min.js?ver=3.6.0:2)
at displaySection (jquery.toc.js?ver=5.8:26)

Y dónde he visto que aparece esa expresión, es en la siguiente línea de código:

function hideContainer() {
    $('div.mCSB_container').find('*').css({display:'none'});//, opacity:'0'}, 2000);
  }
  function displaySection(el)
{
        hideContainer();
        getAllBetween($('a#'+el.attr('href')),$('a#toc'+(parseInt(el.attr('href').split('toc')[1])+1)));
}

¿Alguien podría explicarme una posible solución a esta problema, por favor?
PD: Siento si no he estructurado bien el mensaje, pero soy novato en esta web.
¡Saludos!


text:
Q: Global variables confusion in python I have a global variables that I am using as a default variable.  Depending on what happens in my program I need the ability to change those defaults and have the changes persist through the remaining operation of my code.  I want them changed and defined everywhere hence I used a global variable.   Here is some test code that shows how I am trying to modify these variables.
When I do this I have the following problems...

*

*The program thinks that myGlobal hasn't been defined in main.  But
it has.  Why?

*When i call a subroutine after I have changed myGlobal.  I didn't want that to happen.

What is the proper way to accomplish what I am trying to do here?   Examples?
#!/usr/bin/python

import sys

myGlobal = "foo"

print "********************"
print "MyGlobal %s" % myGlobal
print "********************"

def main(argv):

   #UnboundLocalError: local variable 'myGlobal' referenced before assignment
   print '1. Printing the global again: ' + myGlobal

   myGlobal = "bar"
   print "2. Change the global and print again: " + myGlobal

   # now call a subroutine
   mySub()

# Checks for output file, if it doesn't exist creates one
def mySub():
   # Why isn't the global "bar" not "foo"?
   print '3. Printing the global again: ' + myGlobal

   myGlobal = "black sheep"
   print "4. Change the global and print again: " + myGlobal

if __name__ == "__main__":
   main(sys.argv[1:])

A: What you are looking for is the global statement in python. Insert global myGlobal before your codeblocks in main and mySub and there you have a predictable behavior. Having said that, if you have to pass state information between functions, use arguments to the function. That's much neater.

A: If you want to assign to, rather than read a module-global variable from within a function, you need the global keyword:
def main(argv):
  global myGlobal
  #...
  myGlobal = "bar"

Otherwise the assignment will just create a new local variable that shadows your global variable (so changes to it will not affect the global variable, like it is the case in your example).
That said, you could also use a class here to have your functions share state in a nicer way:
class MyApp(object):
  def main(self, argv):
    self.myVar = "bar"
    self.mySub()

  def mySub(self):
    print self.myVar

MyApp().main(sys.argv[1:])


text:
Q: Coarse-graining in numerical integrations I have been working recently in a coarse-graining problem I found when using NIntegrate:
I am trying to evaluate the function
$$f(a)=\int_0^{\infty}x\,e^{-(a^2+b^2)x^2}\text{d}x$$
numerically as a function of $a$, where $b=0.001$. To do so, I am writing the following code:

ListPlot[
   ParallelTable[
     {a,NIntegrate[x Exp[-(a^2 + 0.001^2) x^2], {x, 0, 8000}]},{a, 0.001, 1, 1/100}],
        Joined->True]]

Where the upper limit is just a cuttoff.
Here is the result of integration (in red), compared with the analytical form of the integral, $f(a)=\frac{1}{2(a^2+b^2)}$ (in blue).

As you can see, there is a coarse-graining problem starting in $a\sim0.86$. I also tried to split the integral in parts with the following function

SplitInt[f_, x_, xmin_, xmax_, div_] :=
 Sum[NIntegrate[f, {x, xmin + (xmax - xmin)/div i, xmin + (xmax - xmin)/div (i + 1)},
AccuracyGoal -> 9, MaxRecursion -> 22, Method -> "LocalAdaptive"], {i, 0, div - 1}]

And now

ListPlot[ParallelTable[{a,
  SplitInt[x Exp[-(a^2 + 0.001^2) x^2], x, 0, 8000,
   16]}, {a, 0.001, 0.9, 1/100}]]

moves the problem to another region, as seen below:

As before, the blue curve is the analytic integration and the red one is the numerical one.
I have tried also different integration strategies, namely GlobalAdaptive, LocalAdaptive and GaussKronrodRule, but none of them seem to fix the coarse-graining.
Is there any way I can attempt to fix this issue?
Thank you in advance.

A: To illustrate whats going on, your function is 0 at x=0, rises to a max and becomes essentially zero very quickly.
 With[{a = .9}, Plot[x Exp[-(a^2+.001^2) x^2], {x, 0, 3}]]

Now look at the values NIntegrate computes:
 res = Reap[With[{a = .9},
         NIntegrate[y = x Exp[-(a^2 + 0.001^2) x^2], {x, 0, 8000},
         EvaluationMonitor :> Sow[{x, y}]]]];
         Sort@Last@Last@res // MatrixForm

The lowest x it even tries is too large, so it sees essentially all zeros and concludes the result is zero.
You can 'brute force' fix this with MinRecursion->9 for example.
Now look at what happens with Michaels's extra values in the x list:
 res = Reap[With[{a = .9},
      NIntegrate[y = x Exp[-(a^2 + 0.001^2) x^2], {x, 0, 300, 8000},
      EvaluationMonitor :> Sow[{x, y}]]]];
             ListLogPlot[(Last@Last@res)[[All, 1]]]

now plot the evaluation x points in order of evaluation:
 ListLogPlot[(Last@Last@res)[[All, 1]]]

You see it forces eval at that point and evenly spaced points in each interval.
The nonzero part of the curve is picked up and the adaptive scheme takes over well.
Finally, note if you actually use Infinity as the upper limit, the initial sampling is spaced exponentially and you get the correct result with no fuss..
 res = Reap[
    With[{a = .9},
      NIntegrate[y = x Exp[-(a^2 + 0.001^2) x^2], {x, 0, Infinity},
         EvaluationMonitor :> Sow[{x, y}]]]];

A: Treat the maximum machine number as a singularity:
ListPlot[Table[{a,
   NIntegrate[x Exp[-(a^2 + 0.001^2) x^2],
 {x, 0, 0.5 Log[$MaxMachineNumber/(a^2 + 0.001^2)], 8000}]}, {a, 0.001, 1, 1/100}],
 Joined -> True

Update
[Forgive me, I actually have a job, and, while I could solve the problem quickly over breakfast, I could not compose a complete answer.]
The problem has to do with the sampling over the domain {x, 0, 8000}.  The exponential function decays rather quickly for larger values of a, to the point that it is nearly zero at all initial sample points. This makes NIntegrate think the integral is zero, whether the GlobalAdaptive or LocalAdaptive strategy is chosen. For instance, the maximum value is around x == 1/(Sqrt[2] a), which is extremely close to 0 compared to 8000, when a is close to 1.  The initial sampling for the Gauss-Kronrod rule is
8000 First@NIntegrate`GaussKronrodRuleData[5, MachinePrecision]
(*
  {63.6586, 375.281, 983.333, 1846.12, 2881.48, 4000.,
   5118.52, 6153.88, 7016.67, 7624.72, 7936.34}
*)

The trick is to get NIntegrate to sample nearer x == 0 than x == 63.6586.
The code
NIntegrate[f[x], {x, x0, x1, x2, ..., xn}]

effectively partitions the interval {x0, xn} into subintervals {x0, x1}, {x1, x2}, etc., each of which NIntegrate will sample independently according to the Gauss-Kronrod rule. This is one way to specify singularities, as it will ensure that NIntegrate finds the points x1, x2, etc. in calculating the integral; see tutorial/NIntegrateIntegrationStrategies for more.  In this case we can use to ensure sampling the region where the integrand has strong support.
I somewhat hastily chose 1/$MaxMachineNumber for the cut-off value of the function Exp[-(a^2 + 0.001^2) x^2] (i.e. x == 0.5 Log[$MaxMachineNumber/(a^2 + 0.001^2)]), since it is about 10^-308.  When I tested the code, this turned out to be a good choice.  But it's not the only choice. Any number between 1/10 and 10 times this number produces an accurate plot.
Given that the maximum of the integrand is around x == 1/(Sqrt[2] a) or 0.71 / a, a simpler choice, would be something like 1 / a, which would range in value from 1000 down to 1 over the range for a in the Table.  So the NIntegrate call would be the slightly simpler
NIntegrate[x Exp[-(a^2 + 0.001^2) x^2], {x, 0, 1/a, 8000}]

It can be hard to find a single approach that works for functions in general.  I suppose one guideline would be to make sure the maxima (of the absolute value) get sampled.  If these extrema occur at a1, a2, etc., then the following would ensure they are not missed:
NIntegrate[x Exp[-(a^2 + 0.001^2) x^2], {x, 0, a1, a2, ..., 8000}]

Alternatively, I often check a test calculation by bumping up the working precision to 20 or 30.  This not only uses arbitrary-precision numbers but also bumps up PrecisionGoal.  In fact, it fixes the plot in this case. The following produces the plot above:
ListPlot[Table[{a,
   NIntegrate[x Exp[-(a^2 + (0.001`20)^2) x^2], {x, 0, 8000},
    WorkingPrecision -> 20]}, {a, 0.001`20, 1, 1/100}],
 Joined -> True]


text:
Q: Swift - How does one sort an array by internal integer property in the most efficient way Swift 2.3
Alright folks. Assuming i have a Class named Post, and array of Posts, [Post].
class Posts
{
  var message : String?
  var scheduledTime : Int?
}
....
var myPosts = [Posts]()...(500 objects)

How can i, in the most efficient/performance wise way(let's assume i have 500 Post objects inside my array), to sort our [Post] array, by our scheduledTime(Int) property?
Was always curious on how to approach this kind of questions. Thanks!

A: Just use sort(_:) with a closure that compares the first argument's scheduledTime to the second's.
let sortedPosts = myPosts.sort{ $0.scheduledTime < $1.scheduledTime }


text:
Q: Weighted average of multiple points Let's say I have a triangle whose three corners are $$(x_1,y_1),(x_2,y_2),(x_3,y_3).$$ I have a weight assigned to each one as a percentage, so the first point might be $75\%$, the second $15\%$ and the third $10\%$.
How would I find the weighted centroid of this triangle?
If it helps, it's an equilateral triangle. I'm coding a visualization in JavaScript and I'm stuck on some of the math. Thanks!

A: Try the formula
$$(w_1x_1+w_2x_2+w_3x_3, w_1y_1+w_2y_2+w_3y_3)$$
where $w_1,w_2,w_3$ are positive weights adding up to $1$.


text:
Q: this class is not key value coding-compliant for the key authView When i run my app on simulator it runs well, when i try with device doesn't work and i get these errors:
NOTE: i didn't find any kind of class authView in my code
2011-02-24 12:04:14.472 TestP[473:307] *** Terminating app due to uncaught exception     'NSUnknownKeyException', reason: '[<TestP 0x19d2b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key authView.'
*** Call stack at first throw:
(
0   CoreFoundation                      0x33ac0987 __exceptionPreprocess + 114
1   libobjc.A.dylib                     0x3347b49d objc_exception_throw + 24
2   CoreFoundation                      0x33ac0705 -[NSException dealloc] + 0
3   Foundation                          0x3367db4f -[NSObject(NSKeyValueCoding)    setValue:forUndefinedKey:] + 182
4   Foundation                          0x3367d03b _NSSetUsingKeyValueSetter + 90
5   Foundation                          0x3367eda3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 194
6   Foundation                          0x33630b17 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 130
7   UIKit                               0x3224c60f -[UIRuntimeOutletConnection connect] + 66
8   CoreFoundation                      0x33a63fc7 -[NSObject(NSObject) performSelector:] + 18
9   CoreFoundation                      0x33a6cd51 -[NSArray makeObjectsPerformSelector:] + 388
10  UIKit                               0x3224b577 -[UINib instantiateWithOwner:options:] + 586
11  UIKit                               0x3224cb39 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
12  UIKit                               0x3209e871 -[UIApplication _loadMainNibFile] + 96
13  UIKit                               0x3209a1fd -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
14  UIKit                               0x3206648b -[UIApplication handleEvent:withNewEvent:] + 1114
15  UIKit                               0x32065ec9 -[UIApplication sendEvent:] + 44
16  UIKit                               0x32065907 _UIApplicationHandleEvent + 5090
17  GraphicsServices                    0x33b0ef03 PurpleEventCallback + 666
18  CoreFoundation                      0x33a556ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
19  CoreFoundation                      0x33a556c3 __CFRunLoopDoSource1 + 166
20  CoreFoundation                      0x33a47f7d __CFRunLoopRun + 520
21  CoreFoundation                      0x33a47c87 CFRunLoopRunSpecific + 230
22  CoreFoundation                      0x33a47b8f CFRunLoopRunInMode + 58
23  UIKit                               0x32099309 -[UIApplication _run] + 380
24  UIKit                               0x32096e93 UIApplicationMain + 670
25  TestP                               0x00002213 main + 98
26  TestP                               0x000021ac start + 40
)
terminate called after throwing an instance of 'NSException'

A: This is how I solved this problem.  I went into my 'Story Board' file and selected the view that was causing the problems.  I then clicked on the Connections Inspector tab and you will see connection(s) with exclamation points to the right instead of solid circles. Remove these and make adjustments if necessary. Save>Run your app and should work. Hope this helps :)

A: I think that one possible cause for raising that exception is when you have changed the name of some IBOutlet variable after the storyboard connections are already done. Thus the UI element in the storyboard is still referencing to the old variable name. I solved this for me by checking the XML representation of the storyboard (Right click on your .storyboard file and open it as Source Code) and deleting the old (unneeded) IBOutlet variable name.
For example let say you have one UITextField on the storyboard and have the corresponding property for it:
@property (retain, nonatomic) IBOutlet UItextField *myTextField;

You connect the UI element in the storyboard to that property and then you decide to rename somehow the variable. Now if you right click on your UITextField in the storyboard, you will notice that there exists two referencing outlets - the old one and the new one. You can delete the old one by clicking 'x' sign in the Connections Inspector or by editing the XML variant of the storyboard file.

A: something went wrong when in xcode 4 with some reference , cause i declared IBOutlet that reference authView then run and it worked!, then i removed the IBOutlet declaration and worked well

A: I just cleaned the project and deleted the app from the device and it worked again. Error was referencing a view that i had already removed.

A: You have probably created an IBOutlet, then deleted it, then linked a new one, but in the xib 'Inspector' you forgot to delete the link and now have a duplicate IBOutlet ref that the compiler cannot find.

A: i have found these errors arise mostly when you connect properties, edit them, and connect them again..  analyse your connection inspector for unexpected values, that remain from your previously created and destroyed connection.

A: In my case it was even more spooky. I had a XIB associated to the VC that I had removed completely as went for code-only. Run on Simulator nicely but would crash on Device systematically.
So I clean, rebuild, closed XCode, went for a snack and shout at the mac. Nothing, the compiler kept pointing to an inexistent button on an inexistent XIB.
Tried by changing the name of the class and that worked!

A: It seems that your Interface Builder did not work properly.
As suggested before, try by cleaning and rebuild. If it doesn´t work, I´d suggest you to re-create your xib interface. It worked for me in a similar occasion.

A: You've probably got your File's Owner stuff messed up in your xibs.  This exception is getting thrown during nib unarchiving (as evidenced by +[UINib...] in the backtrace).  It's attempting to hook up your IBOutlets that you defined.
One of your views is set up to be the authView of the the File's Owner.  However, when it's time to unarchive the nib, the owner doesn't have an authView property, so the unarchiving is failing.

A: @Dave DeLong pointed out right.
Workaround

*

*Find when the exception thrown, which viewController is being loaded.

*Then check the nib file of the viewController, there must be an IBOutlet attached in xib but might be missed in the viewController.h file or might be some control which was attached is missing in xib file.

Why running in Simulator? Sometimes it ends in messing up.
Just do the steps

*

*Build -> Clean

*Build -> Clean All Targets

Now it runs the real code, may be issue got resolve on device also or may be it start throwing exception on simulator also in case if there is really an issue. (I already have mentioned workaround)


text:
Q: Finding the first three terms of a geometric sequence, without the first term or common ratio.
Given a geometric sequence where the $5$th term $= 162$ and the $8$th term $= -4374$, determine the first three terms of the sequence.

I am unclear how to do this without being given the first term or the common ratio. please help!!

A: We have that $162 = a_{1}r^{4}$ and $-4374 = a_{1}r^{7}$ by the formula $a_{n} = a_{1}r^{n-1}$.
Then solving for $a_{1}$ in both equations and setting them equal to one another,
$$\frac{162}{r^{4}} = \frac{-4374}{r^{7}}$$
You can then solve for $r$ (your common ratio), and subsequently $a_{1}$ (your first term). You then have all of the information you need.

A: If $ar^4 = 162$ and $ar^7 = 4374$ then
$$
\frac{-4374}{162} = \frac{ar^7}{ar^4} = r^3
$$
so
$$
r^3 = \frac{-4374}{162} = -27.
$$
If you know $r^3=-27$ can you find $r$?  If you know $r$ and $ar^4$ can you find $a$?

A: I had a similar question and tried to solve it alone i used this way
since the initial value is f(1) so u use this equation f(n) = ar^n-1
since u have f(5) as initial value or actually (known value) then we have to change it to this
f(n) = a5 * r (n-5)  , so we know that the 8 th term f(8) = -4734
so :  f(8) = a5 * r(8-5)   and f(5)= 162
-4734 = 162 *r^3
-47324/162 = r^3
r^3 = -27 then calculate ......


text:
Q: Android HttpPost javax.net.ssl.SSLProtocolException unrecognized name I am trying to post some data to an api from an Android tablet, but I keep getting an SSLProtocolException and I can't figure out the problem.
This is the error I keep getting:
javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7bccbdc8: Failure in SSL library, usually a protocol error
error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 unrecognized name (external/openssl/ssl/s23_clnt.c:741 0x73d67718:0x00000000)
W/System.err﹕ at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:468)
W/System.err﹕ at com.android.org.conscrypt.OpenSSLSocketImpl$SSLInputStream.<init>(OpenSSLSocketImpl.java:717)
W/System.err﹕ at com.android.org.conscrypt.OpenSSLSocketImpl.getInputStream(OpenSSLSocketImpl.java:688)
W/System.err﹕ at org.apache.http.impl.io.SocketInputBuffer.<init>(SocketInputBuffer.java:70)
W/System.err﹕ at org.apache.http.impl.SocketHttpClientConnection.createSessionInputBuffer(SocketHttpClientConnection.java:83)
W/System.err﹕ at org.apache.http.impl.conn.DefaultClientConnection.createSessionInputBuffer(DefaultClientConnection.java:170)
W/System.err﹕ at org.apache.http.impl.SocketHttpClientConnection.bind(SocketHttpClientConnection.java:106)
W/System.err﹕ at org.apache.http.impl.conn.DefaultClientConnection.openCompleted(DefaultClientConnection.java:129)
W/System.err﹕ at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:221)
W/System.err﹕ at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:167)
W/System.err﹕ at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:125)
W/System.err﹕ at     org.apache.http.impl.client.DefaultRequestDirector.executeOriginal(DefaultRequestDirector.java:1227)
W/System.err﹕ at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:677)
W/System.err﹕ at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
W/System.err﹕ at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
W/System.err﹕ at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
W/System.err﹕ at com.example.casper.bilfinger.sendJSONdata.doInBackground(sendJSONdata.java:130)
W/System.err﹕ at com.example.casper.bilfinger.sendJSONdata.doInBackground(sendJSONdata.java:54)
W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err﹕ W/System.err﹕at java.lang.Thread.run(Thread.java:841)
W/System.err﹕ Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7bccbdc8: Failure in SSL library, usually a protocol error
W/System.err﹕ error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 unrecognized name (external/openssl/ssl/s23_clnt.c:741 0x73d67718:0x00000000)
W/System.err﹕ W/System.err﹕at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
W/System.err﹕ W/System.err﹕at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:425)
W/System.err﹕ ... 23 more

And this is the code I'm using.
public  class sendJSONdata extends AsyncTask<String, String, String>{

    String httpAuthUser=*username*;
    String httpAuthPassword=*password*;

    String Bedrijf;
    String Naam;
    String Functie;
    String Vestiging;
    String Telefoonnummer;
    String Email;
    String Opmerkingen;
    String GesprokenMet;
    Context context;

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    public sendJSONdata(String[] values,Context context)
    {
         Bedrijf= values[0];
         Naam= values[1];
         Functie= values[2];
         Vestiging= values[3];
         Telefoonnummer= values[4];
         Email= values[5];
         Opmerkingen= values[6];
         GesprokenMet= values[7];
        this.context=context;
        //System.setProperty("jsse.enableSNIExtension", "false");

    }

    protected String doInBackground(String... strings) {
        ///Build JSON object and fill with your data
        JSONObject subpostMessage = new JSONObject();
        try {
            subpostMessage.put("emailAdres", Email);
            subpostMessage.put("Naam", Naam);
            subpostMessage.put("Bedrijfsnaam", Bedrijf);
            subpostMessage.put("Telnummer", Telefoonnummer);
            subpostMessage.put("Functie", Functie);
            subpostMessage.put("Vestiging", Vestiging);
            subpostMessage.put("Opmerkingen", Opmerkingen);
            subpostMessage.put("GesprokenMet", GesprokenMet);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        //Connect to HttpClient with basic Aut
        HttpParams httpParameters = new BasicHttpParams();
        HttpClient httpclient = new MyHttpClient(httpParameters,context);//new DefaultHttpClient(httpParameters);//
        HttpPost httppost = new HttpPost(*Https to php file");
        String base64EncodedCredentials = "Basic " + Base64.encodeToString((httpAuthUser + ":" + httpAuthPassword).getBytes(), Base64.NO_WRAP);
        httppost.setHeader("Authorization", base64EncodedCredentials);

        String responseStr = null;
        try {
            // Add your data to te connection
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("postData", subpostMessage.toString()));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            Log.d("httpPost: ",httppost.getMethod());
            Log.d("ValuePairs- name: ",nameValuePairs.get(0).getName()+ " val: "+ nameValuePairs.get(0).getValue());

            // Execute HTTP Post Request
            HttpResponse response = httpclient.execute(httppost);

            //Recover result response
            responseStr = EntityUtils.toString(response.getEntity());

            Log.d("JSON ATTEMPT","Response: "+responseStr);
        } catch (ClientProtocolException e) {
            Log.d("JSON ATTEMPT","Response:CPerror "+e.toString());
        } catch (IOException e) {
            Log.d("JSON ATTEMPT","Response:IOerror "+e.toString());
        }
        return responseStr;
    }

    protected void onPostExecute(String result) {
        if (result == null) {
            //Request Failed
            return;
        }

        //System.out.println("RECEIVED RESPONSE: " + result);

        try {
            JSONObject jObj = new JSONObject(result);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void onProgressUpdate(String... values) {
    }

}

And the place where its called.
    void postJSONdata()
    {
        String[] values  = new String[8];
        values[0]=bnaam.getText().toString();
        values[1]=naam.getText().toString();
        values[2]=functie.getText().toString();
        values[3]=vestiging.getText().toString();
        values[4]=tele.getText().toString();
        values[5]=mail.getText().toString();
        values[6]=opmerking.getText().toString();
        values[7]=gesprokenmet.getText().toString();
        sendJSONdata task = new sendJSONdata(values,getApplicationContext());
        task.execute();
    }

This error is thrown on any jdk I try (6,7,8),
Most of the post I found suggested it had to do with SNI which was introduced in 7 but with 6 I still have the same error.

A: This problem is caused by the configuration of the server, combined with no or invalid support of SNI by the client. The server will return with the unrecognized_name alert if no SNI was used or if SNI was used with the wrong name. Thus you need to make sure that you use a Java version which supports SNI, enable it and also use the correct name to access the server.


text:
Q: NHibernate filter on property from many-to-one I'm trying to use an NHibernate filter to filter on a parent class's property, but I keep getting an error that the multi-part identifier "Parent.Active" could not be bound.  My filter-def is:
<filter-def name="useActive" />

My parent class has this in the mapping:
<property name="Active">
    <column name="ACTIVE" not-null="true" />
</property>
<bag name="Children" table="CHILDREN" inverse="true">
    <key>
        <column name="PARENT_ID_IN_CHILD" />
    </key>
    <one-to-many class="ChildType" />
</bag>

My child class has this in the mapping:
<many-to-one name="Parent" class="ParentTyle">
    <column name="PARENT_ID_IN_CHILD" />
</many-to-one>
<filter name="useActive" condition="Parent.Active = 1" />

How can I get NHibernate to check the parent column when filtering?
edit: I'm enabling the filter using mySession.EnableFilter("useActive");.  I'm also using LINQ-to-NHibernate, but I don't think that should matter.

A: The error you're receiving came from SQL Server that can't find the column "Active" on the table "Parent".
Keep in mind that when you're defining a filter the string that you put in the condition will simply be appended in the where condition of the select as is. If you want to filter for that field you must first identify the alias nHibernate use for your SQL query than put that alias instead of "Parent". it coube something like "mytable_0" or something like that.


text:
Q: A space is metrisable if and only if it admits a countable basis I have a topology question about metrisable and countable basis. Please indicate whether the argument below is true or not:

"A space is metrizable if and only if it admits a countable basis. " Determine and proof whether it's true for each of the following spaces:
(i) Let (X,T) be a Hausdorff space.
(ii) Let (X,T) be a regular space.
(iii) Let (X,T) be a normal space.

This is what I have right now:
i) False. Proof: For metrizable --> countable basis, let X be an uncountable space with discrete topology T, then X is metrizable but doesn't have a countable basis (the basis will be singletons). Since X is uncountable, basis is uncountable.
For metrizable <-- countable basis, consider real number R with lower limit topology, so the base is {[a,b) | a$<$b, a,b $\in$ Q}. The basis is countable, but it's not metrizable.
ii) False. Proof: For metrizable --> countable basis, let X be an uncountable space with discrete topology T, then X is normal and metrizable. Every normal space is regular space, so X is regular and metrizable, but its basis {{x} | x $\in$ X} is uncountable.
For metrizable <-- countable basis, it's true because of Urysohn's Metrization theorem.
iii) False. Proof: For metrizable --> countable basis, let X be an uncountable space with discrete topology T, then X is normal and metrizable, but its basis {{x} | x $\in$ X} is uncountable.
For metrizable <-- countable basis, it's true because of Urysohn's Metrization theorem.
Are my proof correct? If not, what is the correct approach? Any help is greatly appreciated!

A: You could stop at your first example: If $X$ is uncountable and discrete, then $X$ is Hausdorff, regular, and normal. It is metrisable (using the discrete metric $d(x,y) = 1$ for $x \neq y$) but it has a minimal base of size $|X|$, as all singletons sets $\{\{x\}: x \in X\}$ must be part of any base for $X$. So $X$ is not second countable.
So the equivalence is already proven false in all three classes of spaces. You could have stopped there, because an equivalence is already false when one implication is. But to go a bit deeper:
The reverse implication is even false for Hausdorff spaces: there are second countable Hausdorff spaces that are not metrisable. (Your example of $\mathbb{Q}$ in the lower limit subspace topology does not work, but look at $\pi$-base for examples, e.g.)
Urysohn's metrisation theorem says only that $X$ $T_3$ (regular and $T_1$) and second countable implies that $X$ is metrisable. It says nothing about the (as we saw, false) converse.
In the last case, if by normal is meant $T_4$ (normal and $T_1$) then Urysohn gives us one implication (as $T_4 \Rightarrow T_3$) but again not the reverse.
If however normal and regular allow for non-$T_1$ spaces, neither implication needs to hold, as indiscrete spaces are normal and regular and second countable but not metrisable unless $X$ is a singleton.
Within the class of $T_3$ spaces, the Bing-Nagata-Smirnov theorem gives us an equivalence:

*

*$X$ is metrisable.

*$X$ has a $\sigma$-locally finite base.

*$X$ has a $\sigma$-discrete base.

which properly generalises Urysohn (as a countable base is both).


text:
Q: How to perform a polymorphism explicit query on a Criteria query? I want to perform a criteria count query on my supertype Class which has its own HBM and not count the subclasses.
The query would then be a "non-polymorphic" query.
I tried by adding polymorphism="explicit" to my hbm and it works, but i'd like to do it only on one query and not on every queries.

A: I am not 100% what you are after, but you can specify the class type in a query like this:
select user from User as user where user.class=MyUserClass;

So in Hibernate, you can refer to "class" attribute to filter out results based on what class type the object has.


text:
Q: How to dynamically change UIStackView height based on content size? I have a view below that I'm trying to dynamically change the height of based on the heights of the subviews in the content view. Currently, I'm setting the scrollView and contentView's contentSize with a static height of "screenHeight + 1000". What steps can I take to dynamically update the height property?

import Foundation
import UIKit
import TinyConstraints

class ViewController: UIViewController {

    // MARK: - PROPERTIES
    let screenWidth = UIScreen.main.bounds.width
    let screenHeight = UIScreen.main.bounds.height
    var contentViewSize = CGSize(width: screenWidth, height: screenHeight + 1000)

    // MARK: - VIEW METHODS
    override func viewDidLoad() {
        super.viewDidLoad()

        addSubviews()
        constrainSubviews()
    }

    // MARK: - VIEW OBJECTS
    lazy var scrollView: UIScrollView = {
        let scrollView = UIScrollView(frame: .zero)
        scrollView.frame = view.bounds
        scrollView.contentSize = contentViewSize
        scrollView.autoresizingMask = .flexibleHeight
        scrollView.showsHorizontalScrollIndicator = true
        scrollView.bounces = true

        return scrollView
    }()

    lazy var contentView: UIView = {
        let contentView = UIView()
        contentView.frame.size = contentViewSize

        return contentView
    }()

    lazy var topView: UIStackView = { ... }()
    lazy var nutritionView: UIStackView = { ... }()
    lazy var ingredientsView: UIStackView = { ... }()
    lazy var instructionsView: UIStackView = { ... }()

    fileprivate func addSubviews() {
        view.addSubview(scrollView)
        scrollView.addSubview(contentView)

        contentView.addSubview(topView)
        contentView.addSubview(nutritionView)
        contentView.addSubview(ingredientsView)
        contentView.addSubview(instructionsView)
    }

    fileprivate func constrainSubviews() {
        let stack = [topView, nutritionView, ingredientsView, instructionsView]
        contentView.stack(stack, spacing: screenHeight * 0.03)
        contentView.centerXToSuperview()
        contentView.topToSuperview(offset: screenHeight * 0.04)
        contentView.width(screenWidth * 0.8)
    }
}

A: You should add a scroll view and inside that add and stackview, and inside the stack view add the views, and the scroll view will increase dynamically, like this code.

 class ViewController: UIViewController {

    let scrollView = UIScrollView()
    lazy var contentStackView = UIStackView(arrangedSubviews: [getView(height: 500, color: .red),
                                                               getView(height: 600, color: .blue),
                                                               getView(height: 70, color: .gray),
                                                               getView(height: 80,color: .yellow)])
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        self.view.backgroundColor = .white

        contentStackView.axis = .vertical
        setupConstraints()
    }

    func setupConstraints() {
        self.view.addSubview(scrollView)
        self.scrollView.addSubview(contentStackView)
        scrollView.translatesAutoresizingMaskIntoConstraints = false
        contentStackView.translatesAutoresizingMaskIntoConstraints = false
        NSLayoutConstraint.activate([
            scrollView.topAnchor.constraint(equalTo: self.view.topAnchor),
            scrollView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
            scrollView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
            scrollView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
            contentStackView.topAnchor.constraint(equalTo: self.scrollView.topAnchor),
            contentStackView.leadingAnchor.constraint(equalTo: self.scrollView.leadingAnchor),
            contentStackView.trailingAnchor.constraint(equalTo: self.scrollView.trailingAnchor),
            contentStackView.bottomAnchor.constraint(equalTo: self.scrollView.bottomAnchor),
            contentStackView.widthAnchor.constraint(equalTo: self.scrollView.widthAnchor)
        ])

    }

    func getView(height: Double, color: UIColor) -> UIView {
        let view = UIView()
        view.backgroundColor = color
        view.translatesAutoresizingMaskIntoConstraints = false
        view.heightAnchor.constraint(equalToConstant: height).isActive = true
        return view
    }

}


text:
Q: Spying of Sharepoint is very slow in Blue Prism I have a sharepoint and spying works well if records are record 100-200 in a list. As soon as records increase beyond 500, spying becomes slow and takes more than a minute to spy. I have tried using  spying with Path property with MatchIndex set to 1. I have so far tried in html mode and after seeing this , I am not confident on AA mode spying. Has anyone faced such challenges and what is the procedure adopted to speeden the spying, any inputs will help.

A: Two things right off the bat you can do to reduce the amount of time it takes to spy all these elements:

*

*Stick to HTML mode like you've said - it'll be faster than any other spy mode in the long run.

*Spy a single element of a particular type (say, a file in a list of files) and set the Path attribute dynamically from your object. Enumerate list items and tell Blue Prism which element to run actions on by the same Path attribute.
As an alternative to all this, code against whatever Sharepoint API is available to you. Ditch the UI automation and focus solely on leveraging whatever functionality is necessary using exposed back-end interactions. This eliminates your spying requirement entirely, as everything is handled on a code-level basis. It'll also eliminate a significant portion of your processing time by not having to traverse user interfaces.

A: I agree with esqew on the point of trying to avoid standard UI automation of SharePoint as much as possible. However, if you are not tech savvy enough to use APIs, an easier alternative is to use a database connection.
This can be achieved easily using Microsoft Access as an intermediary between the list and BluePrism. Here are some guides (video or article)
There are some limitations of course, but if you are interested in reading only then it may be a viable option for you.

A: The important setting should be done i.e

*

*You might have to do some administrative changes i.e You need to enable Ms  Access Engine on SP list

*We need to install MS Access engine so that SharePoint List  will get compress and just before starting the table you can able to see the Ms - Access logo.
Need to write the macro in MS - Access to fetch the data from SP List and Update/Refresh back to the SharePoint, by doing this you need not dependent importing SharePoint list data manually.
In Ms - Access, all the SP list will be created and stored in table. The macro will just refreshes the table data, you can query MS- Access Extractor file by using OLEDB and also you can use Insert/update/delete queries as well
While opening the Ms - Access File, you just need to launch the SharePoint default site (It is dependent on how coding is done in Ms - Access Macro to access the SP List).
And I would like to say that this is the best and reliable approach to work with SP List as per my knowledge.
Unfortunately, Currently I don't have the MS - Access Code :(. If i could have, I am happy to post it.


text:
Q: Importing Data from API-Website into QGIS I am trying to use the map data, found on this website
https://fixmyberlin.de/planungen
and import it to QGIS. Specifically I am looking for the bike paths shown there. I have contacted them and they sent me a link to the API version of their website:
https://api.fixmyberlin.de/api/projects?page_size=200
Since I am new to QGIS and that whole topic, I really don't know what to do further.

A: You can run the following in the QGIS Python console to write a GeoJSON
from urllib.request import urlopen
import json

url = "https://api.fixmyberlin.de/api/projects?page_size=200"
html = urlopen(url)
data = json.load(html)

geojson = {
  "type": "FeatureCollection",
  "features": [{
      "type": "Feature",
      "properties": {
        "id": bike_path['id'],
        "url": bike_path['url'],
        "project_key": bike_path['project_key'],
        "title": bike_path['title'],
        "description": bike_path['description'],
        "short_description": bike_path['short_description'],
        "category": bike_path['category'],
        "street_name": bike_path['street_name'],
        "borough": bike_path['borough'],
        "side": bike_path['side'],
        "costs": bike_path['costs'],
        "draft_submitted": bike_path['draft_submitted'],
        "construction_started": bike_path['construction_started'],
        "construction_completed": bike_path['construction_completed'],
        "phase": bike_path['phase'],
        "responsible": bike_path['responsible'],
        "external_url": bike_path['external_url'],
        "cross_section": bike_path['cross_section'],
        "faq": bike_path['faq'],
        "length": bike_path['length'],
        "photos": bike_path['photos'],
        "likes": bike_path['likes'],
        "liked_by_user": bike_path['liked_by_user']
      },
      "geometry": bike_path["geometry"]
    } for bike_path in data['results']]
}

with open('/tmp/my_geojson.geojson', 'w', encoding='utf-8') as outfile:
    json.dump(geojson, outfile)

PS: I do not manage the pagination here
You can change the path /tmp/my_geojson.geojson according to your need. Then, open the file as a vector layer in QGIS and it works.
An overview below with OSM background

A: your data seems to be JSON-format.  First you have to convert it to CSV and then load that CSV into QGIS.
This post describes in detail how to do it: https://gis.stackexchange.com/a/199408/7849


text:
Q: Preview website doesn't work in virtualmin on nginx I've just installed virtualmin on nginx (I wanted ISPconfig on nginx, but I didn't succeeded). OS is Centos 6.4.
Since DNS didn't propagate I want to preview a website I've created, through Virtualmin->Services->Preview Website . First it worked, but after I've added the following lines on /etc/nginx/nginx.conf file it didn't worked anymore.
    fastcgi_hide_header X-Powered-By;

# enforce NO www
if ($host ~* ^www\.(.*))
{
        set $host_without_www $1;
        rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
}

# unless the request is for a valid file, send to bootstrap
if (!-e $request_filename)
{
        rewrite ^(.+)$ /index.php?q=$1 last;
}

The code above is need  for making work permalinks on wordpress website.
What is wrong?

A: I'm not sure since I am not an expert, but, as per the official documentation,

Nginx does not support CGI, so any applications or Virtualmin scripts that use CGI will not work. Virtualmin should prevent the installation of scripts that require CGI, mod_perl or Apache-specific features.

And when I try to preview a website, it redirects to:
https ://MYHOSTNAME:10000/virtual-server/link.cgi/MYHOSTNAME/http ://website
So it would be actually a broken feature when using nginx in virtualmin, I guess.


text:
Q: QR Code for event that DTSTART is relative to today Is it possible to create a QR Code that sets up an event in the calendar with a date that is relative to the date the code is scanned?
Example: Scan code and 2 months from today, my phone shows an event or provides me with a reminder alert.

A: You can create a QR Code that's pointing an url where is located an .ics file. One time that the file is downloaded a pop-up appears on the device, setting up the event.
You can create custom .ics file, for example, here: http://www.pratie.com/lab/icalendar/
EDIT:
you can compile dynamically the DSTART variable in your code programming:
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20121121T090000
DTEND:20121121T100000
SUMMARY:fdsf
LOCATION:
DESCRIPTION:
PRIORITY:3
END:VEVENT
END:VCALENDAR

The format of variable DSTART is the following:
DSTART: <year><month><day>T<hour><minutes><seconds>
To use a relative "now" time you can use the multiple options that programming gives. (Time.now, timestamp), and then convert it to correct .ics output.

A: Icalendar spec (RFC5545) does not allow the DTSTART to be relative:
3.8.2.4.  Date-Time Start [...] The time value MUST be one of the forms defined for the DATE-TIME value type. The value type can be set to a DATE value type.

3.3.4.  Date [...] The textual format specifies a four-digit year, two-digit month, and two-digit day of the month.

3.3.5.  Date-Time [...] The "DATE-TIME" value type is used to identify values that contain
  a precise calendar date and time of day.

However the QRCODE could be a link to a url which would then dynamically generate a ical file with a DTSART which would be set to the date 2months in the future.


text:
Q: how to enable flavors dynamically in gradle in android I use android studio and gradle build my android app.
My app has three build types (debug , test , release ) and more than one hundred flavors .
When I build debug apk by studio or execute any gradle task.The gradle will take about 1 minute in configure step for configuring three hundreds build-variants.
It's terrible.
Is there a way to disable all flavors in develop and enable all flavors only when release in my ci server?
I tried this.
project.ext.enableFlavor = project.hasProperty('enableFlavor')
    if(project.ext.enableFalvor){
    android{
        productFlavors {
            wxy {
                manifestPlaceholders = [SCHOOL_URL: "wxy.wqapp.cn", SCHOOL_EDITION: "0"]
        }
        wxy001 {
            manifestPlaceholders = [SCHOOL_URL: "nnu.wqapp.cn", SCHOOL_EDITION: "1"]
        }
        wxy001 {
            manifestPlaceholders = [SCHOOL_URL: "nnu.wqapp.cn", SCHOOL_EDITION: "1"]
        }
        ...
    }
}

however , when I exec
gradlew clean assemble -PenableFlavor

I receives a error:
Cannot add task ':wxy:assembleTest' as a task with that name already exists.

Who can help me.Thasks.

A: It seems that my custom build type cann't be named "test" althought no flavor is named "test".
I change the build type "test" to "testp" and then it succeed.


text:
Q: How to apply EF Core migrations if you should not use MigrateAsync() for production environments? I created a new .Net 5 project and want to use EF Core. I autogenerated multiple migration.cs files using
dotnet ef migrations add MyMigration
and want to apply them (for development and production). I know about the MigrateAsync method so I read about how to call this method on startup
https://andrewlock.net/running-async-tasks-on-app-startup-in-asp-net-core-part-1/
but everywhere I read that this method should not be used for production since those migrations won't be executed in a single transaction (no rollback on errors).
Unfortunately there are not many resources on how to do it regardless of the environment, I found this article
https://www.thereformedprogrammer.net/handling-entity-framework-core-database-migrations-in-production-part-2
One option could be a console app calling the migrations
https://www.thereformedprogrammer.net/handling-entity-framework-core-database-migrations-in-production-part-2/#1b-calling-context-database-migrate-via-a-console-app-or-admin-command
but I wasn't able to understand the difference for this approach because it's not solving the transactional problem?
What are best practises to apply migrations during development/production?

*

*After autogenerating migrations I'm a big fan of simplicity, does dotnet ef database update the job and I don't need to work with additional tools?

*Create a console app, generate .sql files from the migrations, install DbUp and use it for the migration part?

A: What works best heavily depends on how deployment pipeline works - how many environments are there before production, release cycle, what parts of deployment are automated. There are no universal "best practices" - each way of handling migrations has its own set of tradeoff to be concious about. Pick upgrade procedure according to what your needs and expectations are.
When setting up EF Core migrations for a mid-sized project (around 70 tables), I tried out few potential approaches. My observations from the process and what worked out in the end:

*

*You want to get a migration SQL somewhere between changing your models and deploying to production, if only to look at it in case there are any breaking changes that may cause issues on rollback. We decided on having migrations directly in project with dbcontext, and have a migration script (using dotnet ef migrations script --idempotent) be generated for every build that can potentially be deployed to any environment - in our case, a CI step for each push to trunk or release branch.

*Putting migration SQL in version control and treating SQL as a source of truth in regards to database structure gives an ability to manually modify scripts when you want to keep some columns for backup or backwards compatibility purposes. Another option would be to consider your data model as a reference for database schema and treat migration SQL as intermediate step that is not preserved, which makes it easier to automate whole process, but requires you to handle special cases directly in your datamodel.

*Using --idempotent flag when generating migration script gives you a script you can reapply to a database schema regardless of what schema version it was at, having it execute only steps that were not yet executed. This means you can reapply same migration script to already migrated database without breaking schema. If you have different versions of your application running in parallel in separate environments (development, staging and production environment), it can save issues with tracking manually what migration scripts version you need to apply and in what order.

*When you have migration SQL, you can use native for your database tools in order to apply them to target environment - such as sqlcmd for SQL Server, psql for postgres. This also has a benefit of having separate user with higher privileges (schema modification) handle migrations, while your application works on limited privileges, that often can't touch the schema.

*Applying database migrations is part of application deployment, not application startup - if you have deployment automation of some sorts, it's probably the best place to put executing migrations against target database, again - database native client is a good alternative to DbUp, pick whichever you prefer. Separating migrations from application startup also gives you ability to run an application against mismatched, but still compatible database schema - which comes handy when e.g. you're doing rollout deployments.

*Most problems with schema upgrades come from breaking schema compatibility between versions - avoiding that requires being concious about backwards/forward compatibility when working on data model and splitting breaking changes into separate versions that keep at least single step of backwards/forwards compatibility - whether you need it depends on your project, it's something you should decide on. We run full integration test suite for previous version against current database schema and for current version against previous database schema to make sure no breaking changes are introduced between two subsequent versions - any deployment that moves multiple versions will roll out migrations one by one, with assumption that migration script or application startup can include data transformation from old to new model.

To sum up: generating migration SQL and using either native tools or DbUp on version deploy gives you a degree of manual control over migration process, and ease of use can be achieved by automating your deployment process. For development purposes, you may as well add automatic migrations on application startup, preferably applied only if environment is set to Development - as long as every person on a team has its own development database (local SQL, personal on a shared server, filedb if you use SQL) there are no conflicts to worry about.


text:
Q: How to get a queryset of foreign keys from a current queryset in django I have two models, Employee and Manager. The Employee model has a foreign key to Manager.
class Manager(models.Model):

    name = models.TextField()

class Employee(models.Model):

    name = models.TextField()

    manager = models.ForeignKey(
        Manager, on_delete=models.CASCADE, related_name="manager"
    )

Given an arbitrary queryset qs of Employee objects, I would like to get a queryset of their managers. This seems very simple but I can't find a way to do it. In naive python, I could get a list of these managers by doing something like:
qs = Employee.objects.filter(whatever)
managerlist = []
for emp in qs:
    managerlist.append(emp.manager)

and this would give me a list of managers corresponding to employees in my queryset. But instead of a list I would like a queryset. Is there a quick simple way to do this?

A: You can try this (only an example):
Manager.objects.filter(employee__in=qs).values('id', 'name').distinct()

It would give you a queryset of distinct Manager objects that have at least one related Employee object in the qs queryset, with only the id and name fields included.

A: First thing, the related_name should be something like related_name="employees" or related_name="employee_set" or whatever makes sense to you, remember "related_name is the name to be used for the relation from the related object back to the current one".
Now, if you really want to have a queryset of managers you can simply filter the managers you found in your previous query, for example:
employee_qs = Employee.objects.filter(...)
manager_ids = set(emp.manager_id for emp in employee_qs)
manager_qs =  Manager.objects.filter(id__in=manager_ids)

Notice that to create the manager_ids set, manager_id is being used instead of manager, it is because we just need Manager's IDs.

A: manager_ids = qs.filter(manager_id__isnull=False).values_list('manager_id', flat=True)
Manager.objects.filter(id__in=manager_ids)

This should gives you a clean Manager queryset for any Employee queryset


text:
Q: how to echo line breaks mysql row I have quotes in MySql Database which have line breaks like below.
First Line
Second Line

But its showing me in my page like this
First Line Second Line

My Code is like below
<?php echo $row['qu_text'];?>

What I am missing ?
Thanks

A: HTML doesn't render \n as a newline, try replacing with
 using this built in PHP function:
nl2br($text);

Or in your case:
echo nl2br($row['qu_text']);

See the PHP documentation on nl2br for more info


text:
Q: Make div within a link display inline with bootstrap 4? I have a series of links that I want to display inline.  For some reason this was working in Bootstrap 3 but since upgrading to Bootstrap 4 I can no longer get the links to display inline.  I've tried using floats and display:inline or display:inline-block on the various elements but I can't seem to get it to work.  Here is a code pen where I've been trying: https://codepen.io/xanabobana/pen/pobRxpx
And my code:
.speciesDiv {
    display: inline;
    margin: 0.3em;
}

.label-success {
    background-color: #5cb85c;
}
.label {
    padding: 0.2em 0.6em 0.3em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25em;
}

.scrolldown-click {
  display:inline;
  float:left;
}

Jump to:

Abies balsamea

Acer rubrum

Acer saccharum

A: Try adding the "list-inline" class:

Jump to:

Abies balsamea

Acer rubrum

Acer saccharum

A: You can use Flexbox to achieve it.
Add following CSS
.list-group {
  display: flex;
  flex-direction: row;
}

CodePen


text:
Q: STR instruction in ARM assembly doesn't work (using KEIL) I'm trying to store a value in memory. my code is here:
        TTL TEST
        global main

        AREA PROGRAM, CODE, READONLY
        ENTRY

main
        ADR     R0, DATA
        MOV     R1, #5
        STR     R1, [R0]

HALT        B       HALT

DATA    DCD     10

        END

I'm using KEIL uvision4, and my target is STM32F407VGT microprocessor. While debugging code, nothing changes in memory windows. What's wrong?

A: This is a piece of code I rewrote from some earlier code of mine. (I didn't test it again)
   PRESERVE8
   TTL TEST
   global main

   AREA asectionname, DATA, READWRITE
DATA DCD 10

   AREA PROGRAM, CODE, READONLY
   ENTRY

main
   ADR  R0, DATA
   MOV  R1, #5
   STR  R1, [R0]

HALT
   B    HALT
   END

By adding AREA asectionname, DATA, READWRITE the thereon following lines are going to be placed in a RAM area and is able to be read and written to. DATA DCD 10 declares a variable called DATA which is the size of 1 word with the initial value of 10. (DCD allocates a full word, DCB alloctes a byte)
Please take a look at this page for further pointers on what to do and how things work.