text:
Q: paper.js, SVG and Opera browser While using SVG images in paperjs found paperjs's importSvg() fails under Opera with strange error.
So I made a workaround. Import SVG in other browser first and then export paperjs object's to JSON. Convert my few SVG's to JSON by hands. And now just importing them by importJson() and have no worries....
But! importJson() is implemented only in nightly build of paperjs, which as I figured out later, with some functions fails under Opera!!
So... I dunno ))) Any ideas?
May be someone of Opera or paperjs crew will come around here someday...

A: The line in paper.js that Opera has a problem with:
'stop-color': function(item, value) {
    item.setColor(value);
},

If the item.setColor line is commented out your example works as it should.


text:
Q: EXCEL: STDEV of a subset of data generated by mean I have five values
643.8,
644.7,
632.4,
630.8,
627.9

of which the mean is 635.9
I would like to get the three closest values to the mean, how do I do this with an excel formula?

A: Here is a solution with two helper columns:

*

*in "diff to mean" enter this formula:
=ABS(A2-AVERAGE($A$2:$A$6))

*and this for "rank":
=RANK.EQ(ABS(A2-AVERAGE($A$2:$A$6)),$B$2:$B$6,1)
Now use this to get closest values:
=INDEX($A$2:$A$6,MATCH(E2,$C$2:$C$6,0))

redpajama_set_name: RedPajamaStackExchange


text:
Q: Maven missing project required libraries after cloning repo A team member has shared his project with me on bitbucket and he used maven to manage his dependencies. After cloning the repo (using mercurial) into my workspace (Eclipse) and downloading maven, m2e and all the other required set up files i was able to get all of the project libraries except for 4.
After downloading the project, i ran several mvn commands to clean, install and hopefully download these missing jars. When i ran mvn -e command i get this long error that does nothing to help. Do i have to find and download these 4 jars and put them in my maven repo?
Command output: mvn -e
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.769s
[INFO] Finished at: Mon Apr 09 17:42:17 CDT 2012
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Dugsi_Manager: Could not resolve depen
dencies for project org.bixin.dugsi:Dugsi_Manager:war:0.1.0.BUILD-SNAPSHOT: The
following artifacts could not be resolved: org.eclipse.persistence:eclipselink:j
ar:2.2.0, org.eclipse.persistence:javax.persistence:jar:2.0.3, org.vaadin:icepus
h-gwt:jar:0.1.2, org.jqurantree:jquran:jar:1.0.0: Could not find artifact org.ec
lipse.persistence:eclipselink:jar:2.2.0 in spring-maven-release (http://maven.sp
ringframework.org/release) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]

EDIT:
I just need to share my local repository with all other team members that clone my project. External jars that dont use maven have to be manually installed into my local repo, this creates a problem because i cant share my local repo? Any ideas

A: You can either install these JARs in your local repository, or setup an own (possibly private) maven repository for you to share with your team. Sonatype provides with Nexus OSS an open-source based software to easily set up a repository (which also proxies remote ones if you like).


text:
Q: How to Read all the information in a Microsoft WindowsInstaller Transform File Using C# Code? Can somebody help me getting a sample code for getting all the information in a Transform File? Things I need to fetch is ,

*

*Check whether the given Table is present in the mst

*If Present, Check whether there is any records in the table.

*Get only the changes in the MST and write them in a log file writing their corresponding Table name, Column name and the Value.

*Is there any way to get all the information in the MST including the MSI table records?

*How to accomplish this using Microsoft.Deployment.WindowsInstaller; ?

*How to Use using or Dispose or IDisposable in this context?
Am using,
Visual Studio 2010 C# .net Windows Forms Application.

Note: I am trying to create a new msi or mst. Am just want to validate a MSI or MST which was already available.
Give me a sample code since am so new to c#

A: At the C/C++ level, I would recommend MsiDatabaseApplyTransform with an included flag in iErrorConditions of MSITRANSFORM_ERROR_VIEWTRANSFORM. This places all the information you need in the _TransformView table. I'll leave it up to you to figure out how this API is exposed in the language or library you're using.
Note that some parts of what you ask are not really valid; MST files do not seem to contain tables or table records per se. At the very least, there are no APIs that expose them other than the approach I referenced above.


text:
Q: fp-ts how to curry option.fold with function I want to create function with this shape to fold an option
(option<A>) => ( fun: (<A>) => <B> ) => <B>

The code currently looks like this, but I have the feeling there's more idiomatic way to achieve the same
const stepIntrD = fu.pipe(
    lectureInteractionStats.children,
    option.fromNullable,
    option.chain(readonlyArray.findFirst<InteractionStatsData>((lis) => lis.id == step.id)),
    (v) => (fun: (_: InteractionStatsData) => boolean) => option.fold(() => false, fun)(v)
);

const wazVisited = stepIntrD(wasVisited);

A: Here are some other more idiomatic ways to write your code:
const stepIntrD = (fun: (_: InteractionStatsData) => boolean): boolean => fu.pipe(
    lectureInteractionStats.children,
    option.fromNullable,
    option.chain(readonlyArray.findFirst<InteractionStatsData>((lis) => lis.id == step.id)),
    option.fold(() => false, fun)
);

// This version evaluates interactionStatsData once, which is closer to your original code,
// whereas the version above evaluates that code every time stepIntrD is run
const interactionStatsData = fu.pipe(
    lectureInteractionStats.children,
    option.fromNullable,
    option.chain(readonlyArray.findFirst<InteractionStatsData>((lis) => lis.id == step.id))
);
const stepIntrD = (fun: (_: InteractionStatsData) => boolean): boolean => fu.pipe(
    interactionStatsData,
    option.fold(() => false, fun)
);


text:
Q: jQuery AJAX callback not executed when debugging via Firebug This is a frequently observed behavior. jQuery asynchronous AJAX calls work flawlessly while running without opening Firebug. However, when Firebug is opened and I am debugging by putting some breakpoints in some other part of the code, the AJAX callback event doesn't fire.
My assumption is that, since I am already debugging step-by-step in another unrelated part of code, the AJAX response callback event is getting escaped. Is this assumption right?  If yes, how do I ensure that callback fires always? If not, what am I doing wrong?

A:
My assumption is that, since I am already debugging step-by-step in
  another unrelated part of code, the ajax response callback event is
  getting escaped. Is this assumption right?

Yes, in Firebug 1.x. Though that's fixed in Firebug 2.0 (at the time of writing this answer in beta phase).
E.g. check out the following code:
<script type="text/javascript">
function makeRequest()
{
    var xhr = new XMLHttpRequest();
    xhr.open("GET", "test.php");

    xhr.onreadystatechange = function()
    {
        if (xhr.readyState === XMLHttpRequest.DONE)
            console.log("Request finished");
    }

    xhr.send(null);
    debugger;
}
</script>
<button onclick="makeRequest()">Make request</button>

When you click the Make request button you'd expect Request finished to be logged to the console.
In Firebug up to 1.12.8 the output doesn't appear in the console, while it does in 2.0.
This is because Firebug 2.0 adapts new debugger APIs exposed by Firefox, which fixed this problem.
Though note that the asynchronous call to onreadystatechange will not be deferred. That means it will still be executed even when you're stopped at the debugger keyword. So a breakpoint at console.log("Request finished") will not be hit.
This is a difference to the JavaScript engines of Chrome, Opera and Internet Explorer, where the execution of asynchronous functions is waiting for the debugger to continue the script execution.


text:
Q: Slide-Menu + multiple ViewControllers (Swift) http://www.raywenderlich.com/87268/3d-effect-taasky-swift
I implemented into my project but I have some questions , as I am relatively new to Swift.
With this kind of arrangement how can I present different ViewControllers after a different MenuItem is pressed ?
I cant perform a segue , because it covers the entire screen and I want to keep the Menu-Detail.
I tried with .hidden Views , but it seems the wrong way to go.
Thx in advance


text:
Q: Possibiliy to display results SQL query in windows (monitoring purposes) Case (one example) #1:
Our business application processes documents in the background. Using MS SQL Management Studio I can create/run a query to display results. For example the current queue of documents to print. I can (as administrator) run that query but how can i make this possible that "normal"users can view these results also?
I am thinking to create a monitor screen on the department so everyone can see from a distance what the queue length is. Perhaps i want to add extra information like performance graphs etc, but that's future work.
Does anyone knows a product that makes this possible? The logic behind it is very simple, but i can't find a product that creates this kind of view. I hope someone can point me in a good direction.
Thanks !

A: Possibly the easiest solution would be running some program or script of your own. It's tricky and requires coding knowledge, but it also allows you to do the most customization as well.
For example, utilizing a simple PHP page (ran on a web server), it wouldn't be that complicated (and you could lookup everything from documentation). This is just a made up example and I don't have any server to test it right now though:
<?php
    $connection = mssql_connect('servername', 'username', 'password');
    mssql_select_db('database', $connection);

    $result = mssql_query('select count(*) as count from printer_queue;', $connection);
    $data = mssql_fetch_array($result);

    echo 'There are currently ' . $data[count] . 'document(s) in the printer queue.';
?>

Of course, the whole formatting etc. could be put into a full fledged/branded HTML page. You could create graphs, etc. it just requires some more programming knowledge.
While this creates a static webpage, you could make it refresh itself once every x minutes (or seconds). Then just show it in a web browser while in fullscreen and you're done.


text:
Q: Keeping and maintaing a password list
Possible Duplicate:
Company Password Management
How Do You Manage Your Passwords

Not sure if this question suits this site but here goes.
What recommendations can you give to centralize and maintain a list of passwords (PCs, hosting, ssh, server ...) inside a small software dev. company?
The aim is to avoid problems if someone forgets a password or goes missing. Obviously such a list should not fall into the hands of an outsider.
P.S: If it's important, the company server is running Linux.
Edit: I'm also interested in any policies concerning the form of passwords and a recommended recurring time interval within which they should be changed.

A: I always do this with a flat text file, encrypted to all the relevant admins' GPG keys, under source control.
This has several advantages.  Firstly, it makes you make all your admins install GPG, use it, and generate, and exchange, keypairs.  This has a lot of knock-on benefits in security terms (eg, admins can authenticate requests from each other, which makes social-engineering attacks much harder).
Secondly, the security's not in some centralised application, but in the individuals' key management.  You can hack the server that stores the encrypted file all you like, all you'll get is ciphertext.  You can keep a local copy of this file on any device that suits you without endangering anyone's security, and without having to install any application other than GPG (which anyone working with security should have around anyway, see above).
Thirdly, because of the source control, you can always step back to find out what the company-wide desktop root password was three years ago, when someone digs a machine out of the basement and insists it needs to be resuscitated right now.  You encrypt the current version of the document only to the keys of the currently-serving admins, but you can always add an escrow key for emergencies (passphrase and private key stored in a secured, tamper-proofed medium, and only ever used once - generate a new escrow key if the current one ever has to be used).

A: KeePass is a password manager I find very usefull, it's cross platform, has features like generating passwords and maintining expiration dates etc.
But it is a single user tool so i'm not sure it fits your needs unless you disallow your users to change their passwords and instead do that centrally.  Whether or not that is feasible/acceptable will depend on your security policies.
It's probably best (in turns of policies and the like) to have each user maintain his/her own password and use admin privileges to reset the password of a user who has forgotten his/hers.

A: As said above KeePass + i use Dropbox to sync the kdbx over multiple devices (PC, Notebook, Android smartphone, it's everywhere).
You can even set password expiration dates there to remind you.
That's pretty much the best tool on the market right now.
As for password policies i think you should find what's the best for your company yourself, just use common sense or google for the best practices, ex. MIT policies.

A: There is also an online password manager called LastPass with sharing capabilities. They also provide LastPass Enterprise adding functionality useful for organizations.
You should read about technoligy behing LastPass as it states that encryption/decription is done locally on your PC, so only encrypted data passes over the wire and is stored in LastPass data centers.
The other important thing is that you can export LastPass data if it happends that LastPass goes out of bussines, your passwords won't

A: We are currently evaluating http://www.teampass.net/ as tool to manage passwords in our team. So far it seems to work well and can even import KeePass-exported entries.

A: Since cpm is not mentioned, I'll write a few sentences about it.
cpm is a simple tool based on a ncurses ui. It stores your password database in a GPG-encrypted file which can be distributed out or stored in a git-repository if you want. The data is stored as XML, so it is easy to grab the data and use it in other programs as well.


text:
Q: scroll table row on keydown I have added active class to table row on scroll by keypress. however now I want to add the scroll function when ever it is fired.
    if (event.code === 'ArrowDown' && this.selectedIndex < (this.products.length - 1)) {
        event.preventDefault();
        this.selectedIndex++;
        this.scrollToBottom();
    }
    ....
    scrollToBottom(): void {
      try {
          console.log("I am scrolled");
          this.myScrollContainer.nativeElement.scrollTop = ... + 24;
      } catch(err) { }
    }

<table class="table" id="tableSearch" #scrollMe>

Console log is ok and no error at all, but table doesnt scroll. What I am missing here?


text:
Q: Activate directive in an input from another element - AngularJS In the following span I have a calendar icon and an input field. However what I am trying to do is to trigger the jqdatepicker directive when the user is clicking the calendar icon as well. But if I call the directive in any other element, as expected, it will trigger the calendar to show but when a date is selected the input field will not get updated. Is there any way to solve this?
This is how my html looks like:

  <input  data-ng-model="finish" type="text" jqdatepicker data-ng-blur="update()">

directive:
.directive('jqdatetimepicker', function() {
    return {
      restrict: 'A',
      link: function (scope, element) {
        element.datetimepicker({
          lang:'de',
          i18n:{
            en:{
               months: [
                "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
              ],
              dayOfWeek: [
                "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
              ]
             }
          },
          timepicker:true,
          format:'d.m.Y H:i'
        });
      }
    };
  })

A: The reason the field is not updating is because jquery is not synced with angular.
I'm not sure which jquery plugin you're using but usually they expose an onSelect event (or something of sort) and you can use it to update the input:
//this is pseudo code of course, but the idea would be same for any method
onSelect: function(data){
   scope.finish = data;
   //this is how you tell angular that somthing changed and it needs to run the digest cycle
   scope.$apply();
}


text:
Q: Lazy once_cell causes stack overflow The code:
use once_cell::sync::Lazy;

fn main() {
    const TEST: Lazy<[[u64; 64]; 512]> = Lazy::new(|| unimplemented!());

    TEST[0];
}

Results in the output:
thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\chess_ai.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)

Weirdly enough only on windows. On Linux (WSL Debian GNU/Linux 9), the output is the expected:
    Finished dev [unoptimized + debuginfo] target(s) in 23.38s
     Running `target/debug/chess_ai`
thread 'main' panicked at 'not implemented', src/main.rs:4:56
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Am I being a banana, lol? I don't understand at all what's going on here. This is also a pretty hard roadblock for me right now, so I really appreciate responses!
Playground version works as expected.
Versions

*

*once_cell: "1.12.0"

*rustc (both windows and Linux): "1.61.0"

A: So after some testing it seems like the stack is just not big enough to contain my variable, since this, plain, piece of code also results in a stackoverflow:
fn main() {
    let test: [[u64; 64]; 3000] = [[0; 64]; 3000];

    test[0];
}

Given that the const in the question is not really "generated"/"created" (lazy initialization) at compile time, it happens inside a stack-frame and most likely causes the stackoverflow.
Moving the data to the heap fixes the issue:
use once_cell::sync::Lazy;

fn main() {
    static TEST: Lazy<Box<[[u64; 64]; 512]>> = Lazy::new(|| unimplemented!());

    TEST[0];
}

Seems like windows and Linux versions have different stack sizes, or the code is optimized differently.


text:
Q: Riemann Zeta Function for $\Re(s)=0$ All the sources I have read talk about continuation from $Re(s)>1$ to $Re(s)>0$ then $Re(s)<0$ $(s\neq 1)$. What about $Re(s)=0$? Where does that go?

A: the functional equation is proven first for $Re(s) \in \ ]0,1[$, but then by analytic continuation it is valid everywhere (except at $s=1$ or $s=0$ of course).
you can also analytically continuate $\zeta(s)$ from $$\Gamma(s) \zeta(s) = \int_0^1 \left(\frac{x}{e^x-1}-\sum_{k=0}^K \frac{B_k}{k!} x^k\right)x^{s-2}dx + \int_1^\infty \frac{x^{s-1}}{e^x-1}dx + \sum_{k=0}^K \frac{B_k}{k!} \frac{1}{s+k-1}$$
valid for every $Re(s) > - K$ and not a negative integer (with $B_k$ the Bernouilli numbers)
and don't forget that in complex analysis, we don't consider functions but analytic continuation of functions.


text:
Q: After changing grub timeout , to boot the PC doesnt reflects the changes done in the grub I have installed Ubuntu 20.04 I am not using windows anymore. I have been trying to change the grub timeout with success and update the grub afterwards. But when restarting the OS again , the time out is still 30 seconds when I have written 2 s.
I have tried also using the grub-customizer and still not helping.


text:
Q: How to debug programs using signals? #include <stdio.h>
#include <signal.h>

static volatile sig_atomic_t being_debugged = 1;
static void int3_handler(int signo) { being_debugged = 0; }

int main()
{
        signal(SIGTRAP, int3_handler);
        __asm__ __volatile__("int3");
        if (being_debugged) {
        puts("No, I don't want to serve you.");
                while (1) {
            /* endless loop */ ;
        }
        }
        puts("Yes, real routines go here.");
        return 0;
}

The above will give different output when run inside/outside gdb,because gdb captures the sigtrap signal.
How to make my program behaves the same in gdb?

A: GDB will stop the inferior (being debugged) program when the inferior receives any signal.
If you simply continue from GDB, the signal will be "swallowed", which is not what you want.
You can ask GDB to continue the program and send it a signal with signal SIGTRAP.
You can also ask GDB to pass a given signal directly to the inferior, and not stop at all with handle SIGTRAP nostop noprint pass GDB command. You'll need to do that before you hit the first SIGTRAP.


text:
Q: Symfony custom channel / logger I am trying to add a simple logger channel "brp" with the following SF6.2-DEV environment:
monolog:
    channels:
        - deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
        - brp
            type: stream
            path: "%kernel.logs_dir%/%kernel.environment%.log"
            level: info
            channels: ["!event","!doctrine","!console"]

Few things, I need this one channel to log to the database into a table I specify, also I am only interested in info, warning and errors captured in the "brp" channel.
I've managed to get access to that channel with a simplified config:
monolog:
    channels:
        - deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
        - brp

But this logs to a file, and includes all the errors levels, and so on.
TIA

A: You need to do someting like this, according to the official doc here :
monolog:
    channels: [deprecation,brp]
    handlers:
       deprecation:
          type: stream
          channels: [deprecation]
          level: error
          path: '%kernel.logs_dir%/deprecated.log'
       brp:
          type: stream
          path: "%kernel.logs_dir%/%kernel.environment%.log"
          level: info
          channels: ["!event","!doctrine","!console"]


text:
Q: Visualizing Strahler-Order bigger than a specific value I try to visualize the Strahler-Order bigger than 8 using raster calculator.
I changed the style of the raster by changing the render type to singleband pseudocolor and, in the colors selector, I did not find boolean sentences. So, I created a new color map and classified it into two classes between 0 and 1 values.
However, it shows me just one small part of my raster (see Figure). The size of the data is as big as the original file. So, I assume that the calculation was properly carried out.
Any suggestions??


text:
Q: Salesforce Maintenance Page Issue I have created a community and it working fine for me with this url:
https://sandbox-saleycommuni-developer-edition.cs114.force.com/test/
But when I am trying short this URL like this:
https://sandbox-saleycommuni-developer-edition.cs114.force.com
Then it is showing me standard maintenance page instead of my custom page.

I am completely unknown to this and could not find any  document about it.


text:
Q: Xively arduino get and put return take too long I wonder why it took so long to get the return from xively? I m using the arduino API from Xively. And Arduino mega adk + gsm shield
put : 17sec
get : 7 sec
as it will jam up the whole arduino code for too long, user input (buttons) will be ignored in this case.
anyone got the idea?

A: It probably takes a long time since your GSM shield is likely using GPRS for data which is what you probably know as 2G cell network connection.
The speed of this GPRS connection is very slow, probably on the order of 50 or 60 kbps. GPRS and cell connections in general often also have quite high latency.
The only thing to try is to decrease your payload size, perhaps try CSV format if you are using JSON or XML.


text:
Q: python migrate virtualenv to another server then can not work I develop my project on the development environment with python2.7 and virtualenv.
I install python2.7 because of the default python is python2.6 on my development environment and I create virtualenv with:
virtualenv -p python2.7 ums_env

It is work until I finish my job.
Then I copy this folder(ums_env) to another server which has no python2.7 only python2.6 and start with:
. ums_env/bin/activate

It seems like the python virtualenv(ums_env) do not work well.
What is wrong with this? If I forget some steps to migrate virtual env from one server to anthor server?
Thanks!


text:
Q: Ember set subtraction with PromiseArrays I have two PromiseArray objects, from within a controller, e.g. this.get('content.skills') and this.get('allSkills').
I'd like to do what is essentially set subtraction. For example:
[1, 2, 3] - [2, 3] // => [1]

Is there a straightforward to do this? There's an alias for doing intersections. My guess is that it will use rejectBy somehow, but I'm not quite sure how.

A: You can use http://emberjs.com/api/classes/Ember.MutableArray.html#method_removeObjects with the Promise's content as long as they are fulfilled.
P1.removeObjects(P2.toArray());


text:
Q: how to change my hostname? My hostname is localhost, reported by hostname command, and terminal prompt root@localhost:~#.
How can i change it to mismis.com with mismis alias? and what is the proper configuration.
I confused after reading some articles on web.
My /etc/hosts:
127.0.0.1       localhost
127.0.1.1       srv345.myweb.com      srv345
178.162.231.61  janstone.mismis.com    janstone
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

A: Try running the following command in a terminal.
sudo sysctl kernel.hostname=mismis.com

/etc/hosts:
127.0.0.1       localhost
127.0.1.1       mismis.com mismis srv345.myweb.com srv345
178.162.231.61  janstone.mismis.com    janstone

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

A: The system hostname is configured in /etc/hostname. A change made to this file will take effect after reboot.
At boot time the string in /etc/hostname is loaded into the kernel using the hostname command. If you edit /etc/hostname then you should also set the system hostname manually using the hostname command.
sudo hostname mismis

Note that in Debian and Ubuntu the system hostname is the short hostname, not a fully qualified domain name.
If the machine has a static external IP address ADRS then this address and the hostname should appear on a line in /etc/hosts, as follows.
ADRS <hostname>

If the machine has a static fully-qualified domain name then this should appear first after the IP address on the line and the short hostname should follow it.
ADRS <fully-qualified-hostname> <short-hostname>

In the present case, assuming that the external IP address is 178.162.231.61 and the desired canonical hostname is "mismis.com", the /etc/hosts line should look like the following.
178.162.231.61 mismis.com mismis

If the machine has no static external IP address, but gets assigned addresses dynamically via DHCP, for example, then 127.0.1.1 should be used instead.
127.0.1.1 mismis.com mismis

or
127.0.1.1 mismis

In /etc/hosts, any IP address should appear on at most ONE line. On that line the first domain name that follows the IP address is the canonical hostname associated with that IP address, and any subsequent domain names are aliases for the canonical hostname.


text:
Q: How do I copy all files recursively to a flat directory in Ruby? I would like to traverse several directories, recursively, and copy all the files to single directory (non-recursive).
So basically, copy:
dir1/subdir1/file1.txt
dir2/subdir1/file2.txt
dir3/subdir1/subsubdir2/file3.txt
dir4/subdir1/subsubdir2/file4.txt
dir5/subdir1/subsubdir2/subsubdir1/file5.txt

All to:
dir6/file1.txt
dir6/file2.txt
dir6/file3.txt
dir6/file4.txt
dir6/file5.txt

As far as I can tell, there isn't a way to do this, either with a method, or even building an array of the filenames with Dir.glob() and iterating through that.
If there is a way to do this in Bash, I would be happy to know it.

A: ruby:
target = 'dir6/'
%w|dir1 dir2 dir3|.each do |dir|
  Dir["#{dir}/**/*.txt"].each do |file|
    FileUtils.cp file, target
  end
end

A: bash:
for dir in dir1 dir2 dir3
do
  for i in `find "$dir" -type f`
  do
    cp "$i" dir6
  done
done

A: You can try something like this:
def traverse (from, to)
  Dir.chdir(from)
  files = Dir.glob('*').select { |fn| File.file?(fn)}
  FileUtils.cp files, to
  subdirs = Dir.glob('*/')
  subdirs.each do |subdir|
    traverse subdir, to
  end
  Dir.chdir('..')
end


text:
Q: Can I use vue packages in nuxtjs? Now I am working on a Nuxt project. Currently, there are many useful packages that make vue more enjoyable to use. But I've managed to find Nuxt packages. So I am wondering if there is any good way to use Vue packages in Nuxt projects. For example, vue has good packages related to google map including vue-google-maps. It would be great if I can use it in Nuxt.

A: vue-google-maps documentation has an example of how to add the package as a nuxt plugin. Add a js file (eg, google-maps.js) in your /plugins directory:
import Vue from 'vue'
import * as VueGoogleMaps from 'vue2-google-maps'

Vue.use(VueGoogleMaps, {
  // your config here
}

And then, in your nuxt.config.js:
  plugins: [
    { src: '~/plugins/google-maps' },
  ],

Most Vue packages should work just fine in Nuxt after these steps.


text:
Q: canonical-livepatch, how does it work? When I try to update/upgrade my system (apt-get full-upgrade):
The following NEW packages will be installed:
  linux-headers-4.4.0-85 linux-headers-4.4.0-85-generic linux-image-4.4.0-85-generic linux-image-extra-4.4.0-85-generic

And after update I got, version of linux kernel by itself:
$ uname -a
Linux xubuntu 4.4.0-81-generic #104-Ubuntu SMP Wed Jun 14 08:17:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

But Canonical Livepatch is working:
$ canonical-livepatch status --verbose
client-version: "7.21"
machine-id: xxx
machine-token: xxx
architecture: x86_64
cpu-model: Intel(R) Core(TM)2 Quad  CPU   Q9550  @ 2.83GHz
last-check: 2017-07-04T10:17:04.377940173+03:00
boot-time: 2017-06-27T12:14:24+03:00
uptime: 166h21m9s
status:
- kernel: 4.4.0-81.104-generic
  running: true
  livepatch:
    checkState: checked
    patchState: applied
    version: "25.1"
    fixes: |-
      * CVE-2016-0758 LP: #158120 and others

Why uname is showing 4.4.0-81, not 4.4.0-85?
If canonical can update only the same kernel, is there any option to switch kernel without rebooting?

A: Quoting http://blog.dustinkirkland.com/2016/10/canonical-livepatch.html:

The Canonical Livepatch Service is intended to address high and
  critical severity Linux kernel security vulnerabilities

Normal updates (those you get using apt) still require system reboot to apply new kernels.


text:
Q: System.Collections.Generic.List MVC Error I want to view the table in Edit.cshtml
I was using the Html.Action to get the table from SurveyQuestionController but it shows the error as below:

The model item passed into the dictionary is of type 'System.Collections.Generic.List``1[System.String]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[SurveyTool.Models.SurveyQuestionModel]'.

Anything that i'm wrong??
Edit.cshtml:
@model SurveyTool.Models.SurveyModel

Link

    @Html.Action("QuestionLink", "SurveyQuestion", new { id = Model.SurveyID })

SurveyQuestionController.cs:
public ActionResult QuestionLink(string SurveyID)
{
    var query = (from r in db.SurveyQuestionModels
                 where r.SurveyId == SurveyID
                 select r.QuestionLink).Distinct();

    return PartialView(query.ToList());
}

QuestionLink.cshtml :
 @model IEnumerable<SurveyTool.Models.SurveyQuestionModel>

     @foreach (var item in Model)
     {

             @Html.DisplayFor(modelitem => item.QuestionLink)

     }

SurveyQuestionModel.cs :
namespace SurveyTool.Models
{
    public class SurveyQuestionModel
    {
        public int Id { get; set; }
        public string QuestionLink { get; set; }
    }
}

A: You query is selecting only the QuestionLink property of SurveyQuestionModel (by you use select r.QuestionLink) which is typeof string, hence your returning List<string> to the view, when the view expects List<SurveyQuestionModel>
Change the query to return a collection of SurveyQuestionModel
public ActionResult QuestionLink(string SurveyID)
{
    var query = (from r in db.SurveyQuestionModels
                 where r.SurveyId == SurveyID
                 select r);

    return PartialView(query.ToList());
}

or change the view so the model is List<string>
@model List<string>

@foreach (var item in Model)
{
    @Html.DisplayFor(modelitem => item)
}


text:
Q: How to escape %% I am trying to write a very simple batch script which echos onto another batch file in order to keep things organised. Whilst doing this, I noticed that if I did something like:
@echo if %cd%==C:\Users\whoever\Desktop msg * success

then it would echo the current directory, since I put in "%cd%". How would I escape this so that it instead echos %cd%, rather then: C:\Users\whoever\desktop\file
Thanks for all the help!

A: escaping can be a bit un-intuitive.
within batchfiles, % are escaped with another %: echo %%cd%%
on command line you can't really escape them but "fake-escaping" them with a caret: echo ^%cd^% does the trick, because cmd shows %varName%, if varname isn't defined, so trying to show the non-defined variable cd^ shows %cd% instead (the parser swallows the caret). The starting caret is not really needed, but makes the "fake-escaping" more consistent.
C:>@echo if ^%cd^%==C:\Users\whoever\Desktop msg * success
if %cd%==C:\Users\whoever\Desktop msg * success
C:>type t.bat
@echo if %%cd%%==C:\Users\whoever\Desktop msg * success
C:>t
if %cd%==C:\Users\whoever\Desktop msg * success
C:>

A: I don't know of an elegant one-liner, but the following will work:
@echo off
set "random=cd"
echo %%%random%%% = "%cd%"
set "random="

Output:
%cd% = "C:\Users\whoever\desktop\file"

Note that the temporary variable does not need to be named random, only since it's a reserved name chances are lower that it would overwrite some other defined variable.

[ EDIT ] An alternative, in case the construct is used repeatedly, would be the following (at the expense of using a dedicated environment variable pct):
@echo off
set "pct=%%"
echo %pct%cd%pct% = "%cd%"


text:
Q: Accessing rust reference after its scope has ended I am learning rust, I am trying to understand references.
As per the rust's book -> https://doc.rust-lang.org/nightly/book/ch04-02-references-and-borrowing.html
It says
Note that a reference's scope starts from where it is introduced
and continues through the last time that reference is used.

And goes on showing (from the book):
    let mut s = String::from("hello");

    let r1 = &s; // no problem
    let r2 = &s; // no problem
    println!("{} and {}", r1, r2);
    // variables r1 and r2 will not be used after this point !! ... okay..?

BUT when I try to reproduce this, I get no error
My example (no error)
fn valid() {
    let s = String::from("hi");

    let r1 = &s; // valid immutable reference
    let r2 = &s; // valid immutable reference
    println!("{}, {}", r1, r2);
    println!("{}", r1); // Why am I able to use r1 again here??
}

A: Because you have now changed when the "last use" of r1 is to be at the second print.
You decide when the reference should end and you do so by not using it after a given point. If you add a later use, then you have clearly decided on a new "last use" and so the compiler obliges.

A: I think you misunderstood what you read. I'm assuming you're referencing this bit of code in the linked resource:
let mut s = String::from("hello");

let r1 = &s; // no problem
let r2 = &s; // no problem
println!("{} and {}", r1, r2);
// variables r1 and r2 will not be used after this point

let r3 = &mut s; // no problem
println!("{}", r3);

The point of the code is that since there is no further use of the shared references r1 and r2 it's okay to take the mutable reference r3. If you try to use one of them after doing so you'll get an error:
let mut s = String::from("hello");

let r1 = &s;
let r2 = &s;
println!("{} and {}", r1, r2);

let r3 = &mut s; // ERROR, no longer after last use of r1
println!("{}", r1);

The point of the example isn't that you can't use r1 and r2 after that line, it's that you cannot take a mutable reference &mut while something is still holding on to a shared reference &.
Playground


text:
Q: Too many appcompat_v7 versions in workspace I noticed a lot of these appcompat_v7 versions in my workspace, are they really necessary and can i delete them?

A: You should be able to safely delete all of them but one. Keep the latest one.


text:
Q: progress bar stroke color I have a progress that has a different stroke color depending on the percentage. now i wanted to have the whole progress bar stroke to have a stroke color different from the percentage.
Here is the fiddle i want the other 50% to be on red and the other is orange. i cant seem to find how can I add a color on it.
HTML:

CSS:
#container, #container1 {
    width: 100px;
    height: 100px;
}

#container > svg, #container1 > svg {
    width: 100%;
    display: block;
}

JS:
var circle = new ProgressBar.Circle('#container', {
    color: '#FCB03C',
    strokeWidth: 5,
    trailWidth: 1,
    duration: 1500,
    text: {
        value: '0'
    },
    step: function(state, bar) {
        bar.setText((bar.value() * 100).toFixed(0));
    }
});

circle.animate(.5);  // Number from 0.0 to 1.0

var circle = new ProgressBar.Circle('#container1', {
    color: '#FCB03C',
    strokeWidth: 5,
    trailWidth: 1,
    duration: 1500,
    text: {
        value: '0'
    },
    step: function(state, bar) {
        bar.setText((bar.value() * 100).toFixed(0));
    }
});

circle.animate(.7);  // Number from 0.0 to 1.0

On the Fiddle here. it is posibble on the 2nd circle to have the blue an animation same as the orange one? rather than appearing in an instant

A: try this:-
var circle = new ProgressBar.Circle('#container', {
color: '#FCB03C',
strokeWidth: 5,
trailWidth: 1,
text: {
    value: '0'
},
step: function(state, bar) {
    bar.setText((bar.value() * 100).toFixed(0));
 }
});
 circle.animate(.5,function(){
  $('#container path:first-child').attr('stroke','#4679BD').attr('stroke-width',5);
 });

Demo


text:
Q: The string1 outlet from the OptionalListViewController to the UILabel is invalid. Outlets can not be connected to repeating content Help with the error "The string1 outlet from the OptionalListViewController to the UILabel is invalid. Outlets can not be connected to repeating content."
Code:
@IBOutlet var string1: UILabel!

@IBOutlet var string2: UILabel!

@IBOutlet var string3: UILabel!

@IBOutlet var string4: UILabel!

@IBOutlet var string5: UILabel!

override func tableView(tableView: UITableView,
    cellForRowAtIndexPath indexPath:
    NSIndexPath) -> UITableViewCell {

        let cell:UITableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)

        let dic:NSDictionary = _items.objectAtIndex(indexPath.row) as! NSDictionary
        print(" Plist:\(dic)")

        let str0:NSString = dic["0"]! as! NSString
        let str1:NSString = dic["1"]! as! NSString
        let str2:NSString = dic["2"]! as! NSString
        let str3:NSString = dic["3"]! as! NSString
        let str4:NSString = dic["4"]! as! NSString
        let str5:NSString = dic["5"]! as! NSString
        let str6:NSString = dic["6"]! as! NSString
        let str7:NSString = dic["7"]! as! NSString
        let str8:NSString = dic["8"]! as! NSString

        string1.text = (str0 as String) + (str1 as String)
        string2.text = (str2 as String) + (str3 as String)
        string3.text = (str4 as String) + (str5 as String)
        string4.text = (str6 as String) + (str7 as String)
        string5.text = (str4 as String) + (str8 as String)

        return cell
}

I do not understand how to fix..

A: You can't connect an IBOutlet to a cell in a tableView on the storyboard like you have. You need to instead create a new UITableViewCell subclass and design your cell if you want to connect outlets. Make sure to check the option to create a .xib file

You can add your labels to this xib just like your view controller storyboard, and connect them to the custom cell code, rather than your view controller code (xib is an interface builder file).Here's what it looks like.. very similar to your view controller storyboard:

Then, you can use your custom cell just like you would a normal cell, you just use your custom class instead of UITableViewCell.
override func tableView(tableView: UITableView,
    cellForRowAtIndexPath indexPath:
    NSIndexPath) -> MyTableViewCell {

        let cell:MyTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)

        let dic:NSDictionary = _items.objectAtIndex(indexPath.row) as! NSDictionary
        print(" Plist:\(dic)")

        let str0:NSString = dic["0"]! as! NSString
        let str1:NSString = dic["1"]! as! NSString
        let str2:NSString = dic["2"]! as! NSString
        let str3:NSString = dic["3"]! as! NSString
        let str4:NSString = dic["4"]! as! NSString
        let str5:NSString = dic["5"]! as! NSString
        let str6:NSString = dic["6"]! as! NSString
        let str7:NSString = dic["7"]! as! NSString
        let str8:NSString = dic["8"]! as! NSString

        string1.text = (str0 as String) + (str1 as String)
        string2.text = (str2 as String) + (str3 as String)
        string3.text = (str4 as String) + (str5 as String)
        string4.text = (str6 as String) + (str7 as String)
        string5.text = (str4 as String) + (str8 as String)

        return cell
}

A: Use dynamic cell types:
In your storyboard tableview, choose dynamic prototype cells and add at least one prototype cell depending on how many you need to customize.

Now your tableview should go from 0 cells in your tableview to at least one prototype cell.
 What you have done here is told the tableview to keep dequeueing a version of this cell for each call to cellForRowAtIndexPath instead of just using static cells for which you would define each and eat bunch of memory in a large tableview list.
Now select that prototype cell and give it a reuse identifier.

Design it. You can see mine has a couple simple image views and labels
Create a subclass for it in code with the iboutlets and connect them to your designed cell outlets. The key here, and I think the real answer to your whole question is to select the prototype cell, go to the outlet tab, and drag and drop where you see the properties listed to the cell instead of your view controller or tableview:

Select the prototype cell (Currently a UITableViewCell) and set its class to your UITableViewCell subclass.

Make sure you dequeue the correct cell in the cellForRow method.

Before all of this make sure you have thought up a good data structure for your tableview because you will need to be able to maintain its state everytime the tableview is scrolled and dequeues a cell.


text:
Q: ios change UIButton image at runtime more than one time I am using storyboard and i want to do a 3 stars priority button, at the first view the stars will appear off (not shining and that is means priority =0), when you first press this button the image of the three not shining stars with change to one star shining, when you press this button again (which is the button with the 3 stars image background) one star will be shining and that means priority = 1 (the image changes), and the press # 2 two stars will be shining, and pressing again make the three stars shining, and in the next press it starts from beginning (none of the stars is shining).
I used this code to implement the button but i do not know how to change the image. any help ?
UIButton *btnTwo = [UIButton buttonWithType:UIButtonTypeRoundedRect];

UIImage *btnImage = [UIImage imageNamed:@"3star.png"];
[btnTwo setImage:btnImage forState:UIControlStateNormal];

btnTwo.frame = CGRectMake(40, 140, 240, 30);

[self.view addSubview:btnTwo];

A: Create a method which will be called when the button is pressed:
[btnTwo addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside];

and if you don't want to make a property declaration for the button add a tag identifier
btnTwo.tag = 3; //for ex.

in the method you created
-(void) buttonPressed{

   UIButton *button = (UIButton*)[self.view viewWithTag:3];

   [button setImage:[UIImage imageNamed:@"newImage.png"] forState:UIControlStateNormal];

}

In this method you could then provide logic to assign the correct image based on the number of times pressed.


text:
Q: For loop for summation in R Suppose I have the following summation.
[summation image].
How do I write a for loop such that I can store the values into a vector for j = 1 all the way through j = m.
I tried the following
theta1 <- 1
theta2 <- 2

z = c()
for(i in 1:j){
 z[i] <- sum(exp[(theta1 * j + theta2 * j)
}

However, I get a vector of length j with only the same outputs

A: Looking at the equation, this might be what you are looking for.
First, you began with an empty vector z:
z = c()

Using your equation terms, let's call the index, j. You may then want a for loop from 1 to m (make sure to define m). Each element could then be computed as follows:
for (j in 1:m) {
  z[j] <- exp((theta1 * j) + (theta2 * (j ^ 2)))
}

The final sum of the vector elements would be:
sum(z)

Since exp is vectorized, you could consider the following alternative, instead of using a for loop:
j <- 1:m
sum(exp((theta1 * j) + (theta2 * (j ^ 2))))

This should provide the same answer.


text:
Q: JList displaying String[] text cut off I'm trying to populate a JList with items from an ArrayList<String[]>.  Each String[] is of the form ["I","am","an","example"] and there's nothing I can do about the input form - its from a third party.  What I'd like is simply a JList with each String[] expanded out on a different line.  When I use the following code, though, the first few characters are cut off the left side of the JList - its cutting off mid character so its an issue with pixels not characters.
The class below is set as the content pane on a JFrame elsewhere in the program, I didn't think it was necessary to copy that over here but if it would be useful then I can trim it down and put it up for viewing.
public class BookScreen extends JPanel{
ListSelectionModel lsm;
ArrayList <String> atList;
JList atBox;
MainForm mf;

public BookScreen (MainForm mf){
    //I'm aware this bit is clunky, it was a quick and dirty to test it displays
    //properly before I cleaned it up
    ArrayList<String[]> books= mf.getWorld().getBooks();
    atList=new ArrayList();
    for (String[] s:books){
        atList.add(Arrays.toString(s));
    }
    //end clunky
    atBox = new JList(atList.toArray());
    lsm = atBox.getSelectionModel();
    lsm.addListSelectionListener(new BookScreen.AtListSelectionHandler());
    atBox.setVisibleRowCount(-1);
    atBox.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    atBox.setLocation(0, 0);
    atBox.setVisible(true);
    this.add(atBox);
    this.setVisible(true);
}
class AtListSelectionHandler implements ListSelectionListener{
    @Override
    public void valueChanged(ListSelectionEvent e){
    }
}
}

Screenshot of problem:

A: The problem is that you don't set a layout manager on the panel, which means that the default FlowLayout will be used. If there's only one component this layout places it centered on the container; if the component is wider than the container its edges are trimmed.
To solve the problem simply set a different layout manager, for example BorderLayout:
this.setLayout(new BorderLayout());
this.add(atBox);

More information: Creating a GUI With JFC/Swing: Using layout managers.


text:
Q: jQuery scroll jumps to embedded videos in horizontal scrolling website on Firefox I've created a horizontal scrolling site that navigates using jQuery. It works fine in Chrome and Safari. However, when I use Firefox, the site jumps to the page before a page with Captivate videos embedded in iframes. When I remove the iframe or change the iframe URL, everything works fine.
Any ideas what could be causing this? Could jQuery be jumping to the top-most element in Firefox perhaps?

A: May or may not be the answer in your case, but Captivate's standard embed code tries to focus() the SWF. This could cause a long page to jump to the section containing the Captivate SWF.
Remove the focus() commands in the Captivate files and see if it helps.


text:
Q: Unable to tap on Apple ID in app store iphone 5s I am using iPhone 5s. I checked on various site on how to sign out of apple id in app store, but I am unable to select the apple Id since it is coming in grey color (normally it is shown in blue). I also have my restriction off in general settings. Because of this error, I am also not able to download anything from app store in my iPhone. My apple Id account is already verified and I have checked it twice on net.

A: Trying to reset all settings works.
I don't know why it worked.


text:
Q: How to handle missing rows in a dependent table I have two Sql Server tables accessed through Entity Framework 4. They are joined by a single key with 0 to 1 rows on the dependent side of the join. Here is my linq query.
     var typeDtoList = from type in typeList
                       select (new DxStudioTypeDto(parent,
                                                   isChildrenLoadOnDemand,
                                                   businessFacade,
                                                   server,
                                                   database,
                                                   type.typeGuid,
                                                   type.typeName,
                                                   type.writerName,
                                                   type.managerName,
                                                   type.Reporting_Type.MRef_Status,
                                                   type.Reporting_Type.Exists_In_Drop));

Obviously, if the Reporting_Type returns zero rows, the linq expression throws a null reference exception on the last two parameters of the DxStudioTypeDto constructor:
type.Reporting_Type.MRef_Status,
type.Reporting_Type.Exists_In_Drop));

Is there a way to detect the absence of a Reporting_Type row and substitute a default string? DxStudioTypeDto is an immutable type, so I need all the parameters available when I instanciate a new object. Any other strategies for this situation?

A: Did you try this?
((type.Reporting_Type == null) ? "some default value" : type.Reporting_Type.MRef_Status)

I know sometimes the EF engine returns a "the provider does not support this operation" for this kind of thing, but it's worth a try.


text:
Q: Examine the convergence of a sequence ${a_{n}}$: $a_{n+1}=a_{n}-\sin(a_{n}),0\le a_{1}<\pi$ ${a_{n}}$: $a_{n+1}=a_{n}-\sin(a_{n}),0\le a_{1}<\pi$
One way to do it is to show that the sequence is bounded and monotonous.
How to show that it is bounded?
If
$$-1\le \sin(a_{n})\le 1$$
then
$$0\le a_{n}<2\pi$$
Is it right that then
$$0\le a_{n+1}\le 2\pi$$
and the sequence is bounded (below and above)?
From
$$a_{n+1}-a_{n}=a_{n}-\sin(a_{n})-a_{n}=-\sin(a_{n}),a_{n}\in[0,2\pi]$$
the sequence is monotonous and non-increasing.
Can someone check this problem?

A: Your first implication does not hold. A counterexample would be $a_n=100$. Its sine is certainly between $-1$ and $1$, but $100$ itself is not between $0$ and $2\pi$.
I think it would be easier to say that if $a_n\in[0,\pi]$ then $a_{n+1}\in[0,\pi]$ because $0\le\sin x\le x$ when $x\in[0,\pi]$. Then, by induction, every $a_n$ is in this interval.
It is also true that if $a_n\in[0,2\pi)$ then $a_{n+1}\in[0,2\pi)$, but on one hand it is more work to argue that (because $\sin a_n$ can then be both positive or negative), and on the other hand it doesn't tell you enough that you can argue that the sequence is monotonic. For that you need to know that the $a_n$s stay within the range where the sine is nonnegative.

A: This problem can be solved in a more generic manner.
Let $g(x) = x - \sin(x)$. The key observation is

*

*$g'(x) = 1 - \cos x \ge 0 $ for all $x$, so $g(x)$ is increasing over whole $\mathbb{R}$.

*$g'(x) = 0$ at and only at isolated points $2n\pi$ for $n \in \mathbb{Z}$,
this implies $g(x)$ is strictly increasing.

In other words, $g$ is order preserving!
Start from any real number $b$, one can construct a sequence $( b_n )_{n\in\mathbb{Z}}$ by
$$b_n = \begin{cases} b, & n = 1\\ g(b_{n-1}), & n > 1\end{cases}$$
There are three possibilities:

*

*$b_2 = g(b_1) = b$ : we will have $b_n = b$ for all $n$.

*$b_2 = g(b_1) > b$ : we will have
$$b_2 > b_1 \implies b_3 = g(b_2) > g(b_1) = b_2 \implies b_4 > b_3 \implies \ldots$$
i.e. $b_n$ will be an increasing sequence.

*$b_2 = g(b_1) < b$ : we will have
$$b_2 < b_1 \implies b_3 = g(b_2) < g(b_1) = b_2 \implies b_4 < b_3 \implies
\ldots$$
i.e. $b_n$ will be an decreasing sequence.
Furthermore, if $m, M$ are any pair of successive fixed points of $g(x)$, then
for any $b \in (m, M)$,
$$ m < b_1 < M \implies m = g(m) < b_2 = g_(b_2) < M = g(M)\\ \implies
m < b_3 < M \implies m < b_4 < M \implies \ldots$$
i.e. the whole sequences $b_n$ will falls inside $(m,M)$. Being a bounded monotonic sequence, $b_n$ will converge to some numbers $b_\infty \in [m,M]$. Since $g(x)$ is continuous, $g(b_\infty) = b_\infty$. This implies $b_\infty \ne (m,M)$ and hence $b_\infty = m$ or $M$.
For those cases where $g(x)$

*

*has a largest fixed points $m'$ and $b$ falls between $(m',\infty)$

*or a smallest fixed points $M'$ and $b$ falls between $(-\infty,M')$,

the analysis will be similar. In general, we will have
$$b_{\infty} \stackrel{def}{=} \lim_{n\to\infty} b_n = \begin{cases}
+\infty,& \text{ if } g(b) > b, b \in (m', \infty)\\
m',& \text{ if } g(b) < b, b \in (m', \infty)\\
M,& \text{ if } g(b) > b, b \in (m, M)\\
m,& \text{ if } g(b) < b, b \in (m, M)\\
M',& \text{ if } g(b) > b, b \in (-\infty,M')\\
-\infty,& \text{ if } g(b) < b, b \in (-\infty, M')
\end{cases}
$$
Apply this to our function $g(x) = x - \sin(x)$. Notice the fixed points of our $g(x)$ are located at $n\pi$ with $n \in \mathbb{Z}$. Over the two successive fixed points $0$ and $\pi$,
$$g(x) = x - \sin(x) < x, \quad\text{ for } x \in (0,\pi)$$
By above argument, we find $\;\lim\limits_{n\to\infty} a_n = 0$.
As one can see, what we really need from $g(x)$ is the properties that it is continuous and strictly increasing. If you generate a sequence by functional iteration of a strictly increasing continuous function, the sequences converges
to either one of its nearby fixed points or $\pm \infty$. Which fixed point
to converge is controlled by the sign of $b_2 - b_1$.

A: Hint: It suffices to show $0 \leq \sin a_n < a_n$ for $a_n$ in your range between $0$ and $\pi$.

A: First of all, the sine of any number is in $[-1,1]$, not only of numbers in $[0,2\pi)$. But that does not interest us.
To show this is monotonic, we will show that $\sin(a_n)\geq0$ for all $n$. For $a_1$, this is easy, since the sine is positive in $[0,\pi]$. $a_2$ is still in that interval since it is bounded by $a_1-0$ and $a_1-1$ which are both there. So $\sin(a_2)\geq0$. If $a_n\in[0,\pi]$ for all $n$, we are done. But it is easy to show $x-\sin x\geq0$ for $x\geq0$, since if you draw a unit circle and choose a point at angle $x$ from the positive $x$-axis, the $y$ of that point is $\sin x$ and the arc is $x$ in length since the radius is 1, and the arc is clearly longer than the segment. This proves our claim for $x\in[0,\frac{\pi}{2}]$, and after that $x\geq\frac{\pi}{2}>1\geq\sin x$. This means our sequence is bounded by 0, and therefore cannot ever escape $[0,\pi]$, thus the sines are all positive, and the sequence is monotonic nonincreasing.
While proving monotony, we found a lower bound, 0.
Lower bound plus nonincreasing monotony implies convergence, thus $a_n$ converges to some limit, probably 0.


text:
Q: Não estou conseguindo consultar API Como eu posso fazer para buscar uma informação dentro da api e exibir na tela? Parece que o react não reconhece a minha função fetch
import React, { Component } from 'react'

class InputeAPI extends Component{
    constructor(){
        super()
        this.state={valor:'Seach for a country', buscaapi:[]}

        //agora consumiremos a API
        var isto=fetch('https://restcountries.eu/rest/v2/all').then(f=>f.json()).then(funcaoapi=>{console.log(funcaoapi)})

        this.consumir=this.consumir.bind(this)
    }

    consumir(){
        window.alert(this.state.valor)
        this.setState({buscaapi:this.funcaoapi})
        console.log(this.state.buscaapi)
    }
    render(){
        return(
            <div>
                <input id='inpu' onChange={(estado)=>this.setState({valor:estado.target.value})} type="text"value={this.state.valor}/>
                <button onClick={this.consumir}> procurar</button>
            </div>
        )
    }
}

export default InputeAPI

A: Tente fazer um método próprio para a consumação da api, não se usa fetch/axios dentro do constructor do react.


text:
Q: Extracting part of the string using Ansible regex_search and save the output as a variable I'm having a content like below inside a file.
dataDir=/var/lib/zookeeper
4lw.commands.whitelist=mntr,conf,ruok,stat
syncLimit=2

I wanted to read the value for dataDir using Ansible and set it to a variable. I have written following code but regular expression and storing the variable both have some issues.
  - name: Read zoo.cfg content
    shell:
      cmd: cat zoo.cfg
    register: zoo_config_content

  - set_fact:
      my_var: "{{ zoo_config_content.stdout | regex_search('dataDir.*')}}"

  - name: Print
    debug:
      var: my_var

Q1.) How can I improve the regular expression to get only /var/lib/zookeeper ?
Q2.) How can I store that extracted value to use in another task?

A: You need to add a group to your regex and a second parameter that specifies which group to return:
- set_fact:
    my_var: "{{ zoo_config_content.stdout | regex_search('dataDir=(.+)', '\\1') | first }}"

This would return an array with a single element, so I added | first to get only one element directly as a string.
Result:
ok: [localhost] => {
    "my_var": "/var/lib/zookeeper"
}

If the config file resides on the Ansible machine you can make it even easier using a lookup:
- set_fact:
    my_var: "{{ lookup('file', 'zoo.cfg') | regex_search('dataDir=(.+)', '\\1') | first }}"


text:
Q: Is it safe to modify the content of a string variable through a pointer? Consider I have a procedure with Str parameter passed by reference, and I want to modify content of the given variable through the procedure, e.g.
procedure Replace(var Str: string);
var
  PStr: PChar;
  i: Integer;
begin
  PStr := @Str[1];
  for i := 1 to Length(Str) do begin
    PStr^ := 'x';
    Inc(PStr);
  end;
end;

Is it an acceptable pointer usage? I'm not sure whether it has a memory leak.
What really happen in PStr := @Str[1], does compiler make a copy of Str internally, or what?
Is this kind of code optimization worth?

A:
Is it an acceptable pointer usage?

You need to make sure that you don't call
PStr := @Str[1];

for an empty string, as that would crash. The easiest way to do that is to replace that line with
PStr := PChar(Str);

so that the compiler will make sure that either a pointer to the first char of the string, or a pointer to  #0 is returned. As Ken correctly pointed out in a comment there is no call to UniqueString() in this case, so you would need to do it yourself.

I'm not sure whether it has a memory leak.

No, there is no memory leak. Obtaining a pointer to a string character will call UniqueString() internally, but that will happen for write access to a string character too, so there's nothing special about the character pointer.

What really happen in PStr := @Str[1], does compiler make a copy of Str internally, or what?

No, it just makes sure that the string is unique (so that write access through the pointer does not change the contents of any other string that shares the same data). Afterwards it returns a pointer to that character in the string, which you can then treat as any other PChar variable, pass it to API functions, increment it and so on.

Is this kind of code optimization worth?

It is not only worth it, it is necessary to really achieve good performance for large strings. The reason for this is that the compiler is not smart enough to only call UniqueString() once, but it will insert calls to it for each write access to a character in the string. So if you process a large string character by character you will have a big overhead from all these calls.

A: Yes, it's safe, as long as you don't go beyond the bounds of the string.  The string has metadata attached that tells how long it is, and if you write beyond the length of the string, you won't leak memory, but you could corrupt it.

A: If Str is passed by reference, why would you need another pointer to the string? Apart from that, there should be no memory leak: PStr is initialized with the adress of the first element of the string and then incremented, so it will always point to one of the characters in your string.
The compile does not make a copy of Str internally. One of the uses for pointers is to avoid making copies. When you say
PStr := @Str[1]

is that PStr will now store the adress of Str[1], that is, the adress of the first char in the string.

A: I am sure this will work for AnsiString and PAnsiChar, but will it still work for unicode strings in Delphi 2009 and above? I think it should, because both, a char of a string (str[i]) and the char pointed to by PChar, should be 2 bytes in size.
Could somebody with more experience with unicode strings please confirm this?

A: As in D2010, looks like codegen employs copy-on-write on such construct
Unit9.pas.34: S := 'abcd';
004B32EF 8D45F4           lea eax,[ebp-$0c]
004B32F2 BA98334B00       mov edx,$004b3398
004B32F7 E89C35F5FF       call @UStrLAsg
Unit9.pas.35: P := @S[1];
004B32FC 8D45F4           lea eax,[ebp-$0c]
004B32FF E8343FF5FF       call @UniqueStringU    ; <== here you are
004B3304 8945F0           mov [ebp-$10],eax
Unit9.pas.36: Exit;
004B3307 EB61             jmp $004b336a

by the way, generic referencing P := @S does not emit UniqueString.
As conclusion, i do not recommend to count on codegen's internals and use recommended PChar(S) construct (emits one xStrToPxChar call as overhead)


text:
Q: Player score update with PHP MySQL I have a users table where I want to update the scores each time a user finishes the game. Unityscript part is working fine but after I post the score to the database it appears doubled or tripled. I post the score as int and also the table column is of int format. My PHP looks like this:
try {

   $db = new PDO("mysql:host=$host;dbname=$dbname", $db_user, $db_pass);
   $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

   $data = array(
       ':username' => $_POST['username'],
       ':score' => $_POST['score']);

   $statement = $db -> prepare ("UPDATE users SET score = score + :score
                                 WHERE username = :username");
   $statement->execute($data);
}
catch(PDOException $e) {
   echo $e->getMessage();
}

Any help or advice is appreciated.

A: You are using prepared statements, but you are still allowing injection by directly implementing the $score variable. Do the same thing with score that you did with username.
What do you mean by double or triple? Do you mean that the number is two or three times bigger? If so, try using a SELECT statement to fetch the score and do the math in PHP. Then, UPDATE the users table.
Doing this will allow you to better understand what you are doing wrong. Have you tried echoing the value of score within your try and catch to see if the value repeats? The code may be running more than once.

A: $statement = $db -> prepare ("UPDATE users SET score = :score
                             WHERE username = :username");

use this, i think it will work


text:
Q: one example of LDA and max number of features as i read the following post:
Sources' seeming disagreement on linear, quadratic and Fisher's discriminant analysis
and see the following note:

any where on google we see number of reduction is number of classes minus one. but here how this value reached? i.e: $X-1$
Important: $X << P $ in this example.
Update 1: I think the answer is # of classes minus one but at most we can use as much as training samples in LDA (no restriction up to $X-1$).

Update 2: I see in this Strange Link In a nutshell, the goal of a
LDA is often to project a feature space (a dataset $n$-dimensional
samples) into a smaller subspace $k$ (where $k \leq n-1 $))...

Update 3:
In Page 27 of this book tell us $n$ classes and $k$ features we get $k-1$ features by LDA.

A: About linear discriminant analysis
A classical example of least discriminant analysis is R.A. Fisher's 1936 article "The use of multiple measurements in taxonomic problems". This is based on the iris dataset and easily plotted.
### load library
### with Edgar Anderson's Iris data set
### and the lda function
library(MASS)

### Perform lda
lda <- lda(Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width  , data = iris)

### Compute the discriminant
predict(lda)

### Plot histogram with result from first discriminant
plot(lda, dimen=1, breaks = seq(-10,10,0.5))

### Plot histogram with only one variable
layout(matrix(1:3,3))
hist(iris$Sepal.Length[iris$Species == "setosa"], breaks = seq(3,9,0.25),
     main = "", xlab = "group setosa", freq = 0)
hist(iris$Sepal.Length[iris$Species == "versicolor"], breaks = seq(3,9,0.25),
     main = "", xlab = "group versicolor", freq = 0)
hist(iris$Sepal.Length[iris$Species == "virginica"], breaks = seq(3,9,0.25),
     main = "", xlab = "group virginica", freq = 0)

Result from first linear discriminant

Result from a single variable (sepal length)

The idea from Fisher was to use a linear combination of the variables such that the distance between the classes is larger. This distance is considered relative to the variance of the groups. (To see more about this, consider this question: When is MANOVA most useful )
When parameters > samples
So, the intuition behind LDA is to find a linear combination of parameters for which the in-between distance/variance of the groups is larger than the within distance/variance of the groups.
When you have more parameters than the sample size, then you will be able to find a perfect linear combination. One for which the within distance is zero.
This linear combination can be found by finding the linear combination of parameters for which the linear combination in one class equals zero and in the other class equals one.
This relates to solving a linear regression problem
$$Y = \beta X$$
Where $Y$ is a column with ones and zeros depending on the class, $X$ is a matrix with the features, and $\beta$ are coeffients to be found.
This problem is overdetermined when the number of features is larger than the number of samples. This means that you will be able to find many linear functions of the features for which the one class equals zero and the other class equals one (as long as there are no different class members with the exact same features).
The number of features that you need is similar to the number of features that you need to fit exactly a regression problem. Which is $X-1$. For example, if you have two data points then a straight line, a function of only one feature (and a function of two parameters, because besides the slope the intercept is included as well), will fit perfectly through the points.
So $x-1$ features will be sufficient to find a perfect solution to the LDA problem
Regularization
So, when the number of features is larger than the sample, then the problem is similar to a regression problem.
For this over-determined case, you can say that $X-1$ features are sufficient, but it is not the only solution. The exact answer will be dependent on how you weigh the different solutions. You can do this in several ways. Regularization is one way to do it. In the case that the problem is solved with Lasso regression or stepwise regression (which add regressors/features in steps, building up a solution starting with zero regressors), then I can imagine that the limit is $x-1$ features. In the case that the problem is solved with ridge regression (which uses all regressors/features from the start) then this is not the case.


text:
Q: Current amplifier for a PLC Analogue Output I am looking to amplify the 0-20mA (or -10V~+10V) analogue output from a Siemens PLC module (Siemens S7-1200 SM1232) into 0-165mA @ 24VDC proportional solenoid that continuously controls gas flow in a PID loop (SMC PVQ31-5G-16-01-F).  I measure 102 ohm across the unloaded solenoid coil.  Obviously a single 24VDC rail is available for power.
It's a relatively low power consumption, so a single 8.25x current gain stage would be a great solution if possible.
Can anyone point me towards a suitable schematic and ideally a suitable transistor?
Input 0-20mA (or -10V ~+10V)  //
Output 0-165mA @ 24VDC  //
0-24VDC Voltage Rail
https://sg.misumi-ec.com/vona2/detail/221300030360/
https://mall.industry.siemens.com/mall/en/ww/catalog/product/6es7232-4hd32-0xb0

A: According to the Linear Tech LT1010 and LT1012 datasheets, something like the following should be possible:

Note that a -5V rail is needed to bias these for zero input to equal zero output.
Such a design should also be able to power cabling with significant capacitance at a decent slew rate without oscillating, thanks to the LT1010 unity-gain buffer.


text:
Q: Proving Equipotence of Sets
*

*Let $A, B$ and $C$ be sets. Show that $\left(A^B \right)^C \thickapprox A^{B \times C}$, that is, these are equipotent.

Let $F: \left(A^B \right)^C \to A^{B \times C}$ be given by $f \mapsto g$, where $f: C \to A^B$ and $g : B \times C \to A$. We need to show that $F$ is bijective.
Assume that there exists $f_1,f_2 \in \left(A^B \right)^C$ and $g \in A^{B \times C}$ such that, $F(f_1) = g = F(f_2)$. How do we proceed?

A: Let $g \in \left( A^B\right)^C$ and $g_c = g(c) : B \to A$. $h \in A^{B \times C}$ and $h_c = h(\,\cdot\,, c) : B \to A$ such that $h_c = g_c$. Define $P: A^{B \times C} \to \left(A^B \right)^C$ given by $h \mapsto P(h)$ with $P(h)(c) = h_c$.
Injectivity: $\;$Suppose that $P(h) = P(h')$, then $P(h)(c) = P(h')(c)$ $\Rightarrow$ $h_c = h'_c$. Consider now, $h_c(b) = h'_c(b)$ $\Rightarrow$ $h(b,c) = h'(b,c)$. Therefore, $h = h'$.
Surjectivity: $\;$Let there be $g \in \left(A^B \right)^C$, such that $g = P(h)$ for some $h \in A^{B \times C}$. We have, $P(h)(c) = h_c = g_c$ $\Rightarrow$ $h_c(b) = g_c(b)$, that is, $h(b,c) = g_c(b)$, which is the same as $\left(P(h)(c) \right)(b) = h(b,c) = g_c(b)$. Therefore, for any $g \in \left(A^B \right)^C$ there is a $h \in A^{B \times C}$ such that $P(h) = g$.
Thus, there is a bijection between the sets, that is, $\left(A^B \right)^C \thickapprox A^{B \times C}$.

Ironically, after finishing the argument, I realized that this question is a duplicate of Let $X,Y,Z$ be nonempty sets. Then $|(X^Y)^Z|=|X^{Y\times Z}|$. Sorry for the inconvenience and thanks for the help!


text:
Q: How to sort members in VSCode (java)? In Eclipse there is an option that sorts the code automatically source > sort members > all members.

Be careful not to be confused with refactoring. I am not looking to indent the code but to reorder the methods.
Does anyone know how I can do the same in VSCode?

A: This feature is not supported at the moment.
https://github.com/redhat-developer/vscode-java/issues/2274


text:
Q: Returning boolean value if two sets share numbers I want to write a function that returns true if two sets share some numbers and false (obviously) if they don't.
Here's what I have so far:
def contains(set1, set2):

    set1 = [5,2,9,1,3]
    set2 = [3,8,9,1,4]

    set_of_nums1, set_of_nums2 = set(set1), set(set2)

    for i in set1:
        if i in set2:
            return True

        return False

contains (set([5,2,9,1,3]), set([3,8,9,1,4]))

Should be working but I get no return. How come?

A: It's just your indentation that's wrong. Your code right now only returns True if you have the first number of set1 in set 2, as it returns True in the first iteration of the loop if i is not in set2. Just fix it like this:
def contains(set1, set2):

    set1 = [5,2,9,1,3]
    set2 = [3,8,9,1,4]

    for i in set1:
        if i in set2:
            return True

    return False

however, as pointed out in the comments, this is not the most practical way to do it
It does make no sense, though, that you take 2 inputs and then completely override the values that they come with. Either you should declare the function like this:  def contains(): and take no inputs, or you should remove those 2 lines changing the values of set1 and set2 before even using the ones passed as inputs.

A: for checking if sets share at least a single item could be, using built in method, as @jonrsharpe pointed out in in comments:
if set1.intersection(set2):
  # share an element

Or using intersection operator (&)
if set1 & set2:
  # share an element


text:
Q: Pattern to find specific text in PHP in given text I have trouble to find specific object with preg_match_all pattern. I have a text. A lot datas. But I would like to find just one specific
Like I have a string of text
    sadasdasd:{"website":["https://bitcoin.org/"]tatic/cloud/img/coinmarketcap_grey_1.svg?_=60ffd80');display:inline-block;background-position:center;background-repeat:no-repeat;background-size:contain;width:239px;height:41px;} .cqVqre.cmc-logo--size-large{width:263px;height:45px;}
/* sc-component-id: sc-2wt0ni-0 */

However I just need to find "website":["https://bitcoin.org/"]. Where website is dynamic data. Such as website can be a google "website":["https://google.com/"]
Right now I have something like this. That's just return a bulk of urls. I need just specific
$pattern = '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#';
preg_match_all($pattern, $parsePage, $matches);
print_r($matches[0]);

I am really bad in patterns and stuck on that

A: Loop through the array like this:
    for ($x = 0; $x <= count(json_decode($array, true)) - 1; $x++) {
        if ($array[$x] == "your search criteria") {
            echo $array[$x];
            break;
        }
    }


text:
Q: React Bootstrap Navbar in 2 rows I'm trying to achieve something like this using react-bootstrap.
Desktop View:
---------------------------------
Logo - Site Name
Link1 Link2 Link3 Link4
---------------------------------

Mobile View:
---------------------------------
Logo - Site Name       Hamburger
---------------------------------

Example code given by react-bootstrap:
<Navbar bg="light" expand="lg">
  <Container>
    <Navbar.Brand href="#home">React-Bootstrap</Navbar.Brand>
    <Navbar.Toggle aria-controls="basic-navbar-nav" />
    <Navbar.Collapse id="basic-navbar-nav">
      <Nav className="me-auto">
        <Nav.Link href="#home">Home</Nav.Link>
        <Nav.Link href="#link">Link</Nav.Link>
        <NavDropdown title="Dropdown" id="basic-nav-dropdown">
          <NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
          <NavDropdown.Item href="#action/3.2">Another action</NavDropdown.Item>
          <NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item>
          <NavDropdown.Divider />
          <NavDropdown.Item href="#action/3.4">Separated link</NavDropdown.Item>
        </NavDropdown>
      </Nav>
    </Navbar.Collapse>
  </Container>
</Navbar>

I've tried adding flex column, Row, br etc, in between the Brand and Toggle, but none of them gave me the desired output. Either menu comes to the second line, or it doesn't expand when stayed in the first line.
Anyone has any suggestions to achieve this?


text:
Q: Get Response body from play.api.mvc.Action[AnyContent] in Play framework (Scala) I have the following Play (Scala) code:
object Experiment extends Controller {

 //routes file directs /genki here
 def genki(name: String) = Action(pipeline(name))

 def pipeline(name: String) = {
   req:play.api.mvc.RequestHeader => {
      val template = views.html.genki(name)
      Experiment.Status(200).apply(template).as("text/html")
   }
 }

 def simple = Action {
   SimpleResult(
      header = ResponseHeader(200, Map(CONTENT_TYPE -> "text/plain")),
      body = Enumerator("Hello World!".getBytes())
   )
 }

}

This compiles fine and works as expected.
Using the scala REPL how can I display the actual html?
I have:
 scala> val action = simple
 action: play.api.mvc.Action[play.api.mvc.AnyContent] = Action(parser=BodyParser(anyContent))

which I take to mean that now the value reference 'action' in the REPL is an Action object which is type-constrained for AnyContent (is that correct way to say it?).
how can I now use this Action to print out the Http Response html content?
Many thanks

A: Rather than the manual result extraction vptheron describes, you can use play.api.test.Helpers:
import play.api.test.Helpers._
val result: Future[SimpleResult] = …
val bodyAsBytes: Array[Byte] = contentAsBytes(result)

There's also contentAsString etc.

A: Building on the answer by Huw, here is the full working code:
import play.api.test._
def getStringFromAction(action:Action[AnyContent]):String = {
  val request = new FakeRequest("fakeMethod", "fakeUrl", new FakeHeaders, "fakeBody")
  val result = action.apply(request).run
  import scala.concurrent.duration._
  Helpers.contentAsString(result)(1000 millis)
}

You will need to include the following libraries (not included by default in Play): play-test_2.11.jar, selenium-java.jar, selenium-api.jar, selenium-chrome-driver.jar, selenium-firefox-driver.jar, selenium-remote-driver.jar, selenium-htmlunit-driver.jar, fluentlenium-core.jar, htmlunit-core-js.jar and htmlunit.jar. These are available in the Play or Activator distribution. You can also add a dependency in build.sbt as explained here.

A: Action does not have a content since it's an object that you can use to apply a Request and get a result.
val request: Request[A] = ... // create a request instance
val resultFuture: Future[SimpleResult] = simple(request)

val bodyAsBytes: Array[Byte] = Await.result(Await.result(resultFuture, timeout.duration).body |>>> Iteratee.consume[Array[Byte]](), timeout.duration)

Note that for your example an empty request is enough since you don't use it.
Also, notice that body from SimpleResult is an Enumerator, you need to apply an Iteratee to it, here I'm just applying a consumer to get the whole list. The 2 Await.result are used:

*

*to wait for the Future[SimpleResult] to be complete

*to wait for the Enumerator to be done sending data to the Iteratee.


text:
Q: SVG file showing incomplete up in IE9 when embedded in other SVG Trying to embed the file map.svg in another svg file using this code:
<svg version="1.2"  xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <image height="800" width="800" x="0" y="0"  xlink:href="map.svg"/>
</svg>

Works fine except in IE9 where parts of the map is missing. I can see the missing parts are defined in the last part of the rather big map.svg file.
If I directly open map.svg in IE9 there is no problem - only when it is embedded in another svg.
Is there a limit for the file size in IE9 or simply some kind of bug?
The file is here:

*

*http://byogtrafik.ramboll.dk/SandBox/QGIS_svg/Svg_in_svg.svg
EDIT: I can add that same problem occurs when embedding map.svg in html. Using "object" tag shows the complete map while using "img" tag shows map with missing parts in IE9. Take a look here (be patient - big svg file): http://byogtrafik.ramboll.dk/SandBox/QGIS_svg/Svg_in_object_and_img.html

A: Try giving the root svg the width and height values:
<svg version="1.2" width="800" height="800" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <image height="800" width="800" x="0" y="0"  xlink:href="map.svg"/>
</svg>

A: According to Wikipedia IE9 only support basic SVG features. Your best shot would be to adjust the SVG file in such a way that it only uses basic features.  IE9 has not yet implemented the following set of features: SVG Animation (SMIL), Filters or Fonts. For more details see Microsoft website


text:
Q: How to fix a problem with dynamic date templates? I have a problem with dynamic date tampletes
I'm using ElasticSearch 6.2.4
My steps:
1) Create index with next settings:
PUT /test1
{
    "settings": {
        "index":{
            "number_of_shards" : 9,
            "number_of_replicas" : 0,
            "max_rescore_window" : 2000000000,
            "max_result_window" : 2000000000
        }
    },
    "mappings": {
        "files": {
            "properties": {
                "Дата добавления в БД": {
                    "type": "date"
                }
            },
            "numeric_detection": true,
            "dynamic_templates": [
                {
                    "integers": {
                        "match_mapping_type": "long",
                        "mapping": {
                            "type": "long"
                        }
                    }
                },
                {
                    "strings": {
                        "match_mapping_type": "string",
                        "mapping": {
                            "type": "keyword"
                        }
                    }
                },
                {
                    "dates": {
                        "match_mapping_type": "date",
                        "mapping": {
                            "format": "yyyy-MM-dd HH:mm:ss||yyyy/MM/dd HH:mm:ss||yyyyMMdd_HH:mm:ss",
                            "type": "date"
                        }
                    }
                }
            ]
        }
    }
}

2) Try to put new records (I have only one)
POST /test1/files/_bulk
{"create":{"_index":"test1","_type":"files","_id":"0"}}
{"Дата добавления в БД":"2019/04/12 11:42:21"}

3) So, I have next output:
{
    "took": 1,
    "errors": true,
    "items": [
        {
            "create": {
                "_index": "test1",
                "_type": "files",
                "_id": "0",
                "status": 400,
                "error": {
                    "type": "mapper_parsing_exception",
                    "reason": "failed to parse [Дата добавления в БД]",
                    "caused_by": {
                        "type": "illegal_argument_exception",
                        "reason": "Invalid format: \"2019/04/12 11:42:21\" is malformed at \"/04/12 11:42:21\""
                    }
                }
            }
        }
    ]
}

I can't understand where is my mistake??
I tried to find some information about this problem in Google, unfortunately, I have no solves of this problem. Maybe, this question is so stupid, but I've already broken my brain.
Please, help me...

A: I can't fully understand, but this option work:
{
    "settings": {
        "index":{
            "number_of_shards" : 9,
            "number_of_replicas" : 0,
            "max_rescore_window" : 2000000000,
            "max_result_window" : 2000000000
        }
    },
    "mappings": {
        "files": {
        "dynamic_date_formats": ["yyyy-MM-dd HH:mm:ss","yyyy/MM/dd HH:mm:ss", "yyyyMMdd_HH:mm:ss"],
            "numeric_detection": true,
            "date_detection": true,

            "dynamic_templates": [
                {
                    "integers": {
                        "match_mapping_type": "long",
                        "mapping": {
                            "type": "long"
                        }
                    }
                },
                {
                    "strings": {
                        "match_mapping_type": "string",
                        "mapping": {
                            "type": "keyword"
                        }
                    }
                }
            ]
        }
    }
}

Link to documentation:
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/dynamic-field-mapping.html
Thanks for attention :)


text:
Q: Formatting list of figures I'm fairly new to Tex and I don't know how to solve this simple problem. I have a section for my bibliography and I use subbibliography as header of my bibliographies. This works fine and looks the way I want. But now I added a list of figures and I want the header to look the same way as the headers of my other two bibliographies. How do I do that?
\section{Bibliography}
\printbibliography[type=inbook,title={Written sources},heading=subbibliography]
\printbibliography[type=article,title={Internet sources},heading=subbibliography]
\renewcommand{\listfigurename}{List of figures}
\listoffigures


text:
Q: Django: where is "contrib.auth.login" and "contrib.auth.logout" defined? In Django there's an "auth" module, and it apparently has "auth.login" and "auth.logout" functions.
But I can't find them defined anywhere?? Inside the auth folder (under the Python directory, Lib / site-packages / django / contrib ... etc) I looked through every py file.
Am I missing something here??

A: django/contrib/auth/__init__.py

A: From the Django documentation:
https://docs.djangoproject.com/en/dev/topics/auth/#how-to-log-a-user-out

To log out a user who has been logged in via
  django.contrib.auth.login(), use django.contrib.auth.logout() within
  your view. It takes an HttpRequest object and has no return value.

Example:
from django.contrib.auth import logout

def logout_view(request):
    logout(request)
    # Redirect to a success page.


text:
Q: Excel VBA - Merge specific columns from multiple files to one sheet I have hundreds of excel files that I want to combine into one file.  The problem is that these files contain hundreds of columns of extra data that I do not need. Further complicating things is that the column positions differ between workbooks and workbooks have differing number of columns. I want to create a macro that will go through and open each file, search for the columns I need, and then copy those columns of data and combine them into one master file.
The way the below code works is as follows:
place all the files you want to combine into one folder
Type the headers you want to search for and combine within those files on a new workbook.
If you have 4 columns in your files named: Name Date Product and Time
Then typing Date and Time in A1 and B1 in a new worksheet will search all the files and combine any columns found with matching headers to a compilation sheet.
Thanks to Ron DeBruin for most of the filesystem selection.
    'Option Explicit

    'takes worksheet and returns last row
    Private Function LastRowUsed(sh As Worksheet) As Long
        On Error Resume Next
        LastRowUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range("A1"), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByRows, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Row
        On Error GoTo 0
    End Function
    'takes worksheet and returns last column
    Private Function LastColUsed(sh As Worksheet) As Long
On Error Resume Next
LastColUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range("A1"), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByColumns, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Column
        On Error GoTo 0
    End Function

    Function GetFileListArray() As String()
Dim fileDialogBox As FileDialog
Dim SelectedFolder As Variant
Dim MYPATH As String
Dim MYFILES() As String
Dim FILESINPATH
Dim FNUM, i As Integer

        '''''
        Set fileDialogBox = Application.FileDialog(msoFileDialogFolderPicker)

         'Use a With...End With block to reference the FileDialog object.
         With fileDialogBox
             If .Show = -1 Then 'the user chose a folder
         For Each SelectedFolder In .SelectedItems
            MYPATH = SelectedFolder 'asign mypath to the selected folder name
           ' MsgBox "The path is: " & SelectedFolder 'display folder selected
         Next SelectedFolder
         'The user pressed Cancel.
         Else
            MsgBox "Cancel was pressed or Invalid folder chosen, ending macro"
            Exit Function
         End If
         End With
         'Set the file dialog object variable to Nothing to clear memory
         Set fileDialogBox = Nothing
           If Right(MYPATH, 1) <> "\" Then
             MYPATH = MYPATH & "\"
           End If
        FILESINPATH = Dir(MYPATH & "*.csV")
        If FILESINPATH = "" Then
           MsgBox "No files found"
          Exit Function
        End If

        'Fill the array(myFiles)with the list of Excel files in the folder
        FNUM = 0
        Do While FILESINPATH <> ""
          FNUM = FNUM + 1
          ReDim Preserve MYFILES(1 To FNUM)
          MYFILES(FNUM) = FILESINPATH
          FILESINPATH = Dir()
        Loop

GetFileListArray = MYFILES()
End Function
    Sub RFSSearchThenCombine()
'search first worksheet in files opened, change to search other worksheets
Const SHEET_TO_SEARCH = 1

Dim FileList() As String
Dim CurrentFolder As String
Dim openedWorkBook As Workbook, HeadingWorkbook As Workbook
Dim OpenedWorkSheet As Worksheet, HeadingWorkSheet As Worksheet
Dim i, counter, x As Integer
Dim LRowHeading, LRowOpenedBook, LColHeading, LColOpenedBook As Long
Dim dict As dictionary
Dim searchValue
'set original workbook with headings to retrieve
Set HeadingWorkbook = ActiveWorkbook
Set HeadingWorkSheet = HeadingWorkbook.Sheets(1)
'find last column on heading worksheet
LColHeading = LastColUsed(HeadingWorkSheet)
'create dictionary to link headers to position in heading worksheet

    Set dict = CreateObject("Scripting.Dictionary")
    For x = 1 To LColHeading
        dict.Add HeadingWorkSheet.Cells(1, x).Value, x
    Next x

FileList() = GetFileListArray()

For counter = 1 To UBound(FileList)
    Set openedWorkBook = Workbooks.Open(CurrentFolder & FileList(counter))
    Set OpenedWorkSheet = openedWorkBook.Sheets(SHEET_TO_SEARCH)
    LColOpenedBook = LastColUsed(openedWorkBook.Sheets(1))
    LRowOpenedBook = LastRowUsed(openedWorkBook.Sheets(1))
    LRowHeading = LastRowUsed(HeadingWorkSheet)

           For i = 1 To LColOpenedBook 'search headers from a1 to last header
                searchValue = OpenedWorkSheet.Cells(1, i).Value 'set search value to current header
                If dict.Exists(searchValue) Then
                      OpenedWorkSheet.Range(OpenedWorkSheet.Cells(1, i), _
                      OpenedWorkSheet.Cells(LRowOpenedBook, i)).Copy _
                      (HeadingWorkSheet.Cells(LRowHeading, dict.Item(searchValue)))
                End If
            Next
        openedWorkBook.Close (False)
Next ' move on to next file

    End Sub

A: Here's how you'd use a dictionary to store the name and column number of the columns of interest (based on an arbitrarily named "COMPILATION SHEET"). Remember you need to enable the reference to "Microsoft Scripting Runtime".
Sub InitiateDictionary()
Dim d As Dictionary
Set d = CreateObject("Scripting.Dictionary")

Dim wb As Workbook, ws As Worksheet
Set wb = ThisWorkbook
Set ws = wb.Sheets("COMPILATION SHEET")

lastCol = LastColUsed(ws)
For x = 1 To lastCol
    d.Add ws.Cells(1, x), x
Next x
End Sub

Private Function LastColUsed(sh As Worksheet)
On Error Resume Next
LastColUsed = sh.Cells.Find(What:="*", _
                        After:=sh.Range("A1"), _
                        LookAt:=xlPart, _
                        LookIn:=xlFormulas, _
                        SearchOrder:=xlByColumns, _
                        SearchDirection:=xlPrevious, _
                        MatchCase:=False).Column
On Error GoTo 0
End Function

All you need to do is elaborate a way to know if an element is contained by the dictionary (define the function DContains(dictionary, string)). There are examples on Google on how to do that. Once you know that the header is inside the dictionary, you can use that header name to know the column number it refers to. A bit like this :
colNumber = 0
headerToFind = "Header_A"
found = DContains(d, headerToFind)
if found then
    colNumber = d(headerToFind)
end if
if colNumber > 0 then
    'Perform copy to column "colNumber" !
end if

To determine how many entries are in the dictionary, simply use the .Count property.
And yes, in this case Cells(x,1) is the same as Cells(x,1).value.


text:
Q: Coordinates at a singularity Let $f: \mathbb{R}^2 \to \mathbb{R}$ be a smooth function. Let's assume that $f$ has a local minimum at $p \in \mathbb{R}^2$ and hence $| \nabla f|\ = 0$ at $p.$
Intuitively, one should be able to define a coordinate system around $p$ in the following way:
-one coordinate function is induced by the flow of the gradient vector field towards the singularity (call it $r$).
-the second coordinate is induced by moving perpendicularly along the level curves (call it $\theta.$).
This coordinate system should, moreover, look more or less like the polar coordinates. In particular, I would expect that this should be true up to local diffeomorphism.
Question(s): is this intuition correct? And is it easy to make rigorous? If this can be done, then I assume that this is a standard procedure, so references would be appreciated.
EDIT: Actually, I've just realized that this has no hope of being true unless we impose some more conditions. I think it would be enough to assume the Hessian is positive definite. But it should still be possible to construct these coordinates in some cases even when the Hessian vanishes I think (consider for instance $f=x^4+y^4,$ for which the usual polar coordinates do the trick.


text:
Q: Paste event not working as expected in a content editable I'm trying to remove line breaks in a contenteditable with a regular expresion when users paste text.
The problem is that the regex only works after the second time you paste something. I also the need keyup and keypress events for other things that aren't in the example (character count for limit).
What's wrong with my code?

$(document).on("keyup keypress paste", "#myContentEditable", function(e) {
  if (e.type === "paste") {
    $(this).html($(this).text().replace(/[\n\r]/g, ""));
  }

  if (e.which === 13) {
    e.preventDefault();
    return false;
  }
});
#myContentEditable {
  border: 1px solid lightblue;
}

This is content editable. Remove break lines of the pasted text only works at the second time

Try to paste this text:

Massa enim nec dui nunc mattis enim ut tellus elementum. Accumsan sit amet nulla facilisi morbi tempus iaculis urna id.

 Nunc lobortis mattis aliquam faucibus purus in massa.

A: The issue is because the paste event fires before the actual HTML of the contenteditable div has been updated.
You can fix this by using the input event instead:

$(document).on("input", "#myContentEditable", function(e) {
  $(this).html($(this).text().replace(/[\n\r]/g, ""));
});
#myContentEditable {
  border: 1px solid lightblue;
}

This is content editable. Remove break lines of the pasted text only works at the second time

Try to paste this text:

Massa enim nec dui nunc mattis enim ut tellus elementum. Accumsan sit amet nulla facilisi morbi tempus iaculis urna id.

 Nunc lobortis mattis aliquam faucibus purus in massa.


text:
Q: Remove adwares ( taboola, outbrain etc ) from Chrome/Firefox on Ubuntu How to remove "around the web" by outbrain or recommended by taboola from google chrome or firefox on ubuntu ?
I tried removing content of

rm -r ~/.config/google-chrome

install and re-install google-chrome but all in vain.

A: The (disgusting) "around the web" is added by websites themselves to make money off ads.
The only thing you can do is to install an ad-blocker.
I recommend the open source uBlock Origin (Chrome and Firefox; code at GitHub). Get uBlock Origin, not uBlock — that is a discontinued fork.

A: I had similar. the adware will be in your profile, so a browser re-install is useless.
A/ in chromium, do: 1/ settings/ advanced/ reset settings.  this worked for me.  2/ next, install extension "chrome adware removal". this ext seems best to block and strip adware before it infects.
B/ if you have a malware, you can try clamav, but I have found a wipe and system reinstall to be the only sure means to disinfect.

A: There is a simple solution for this. Within the browsers 'Notification Settings' you can control all websites permissions to send notifications. Not only you'll get a list of possible candidates you can also block them actively.
For Firefox

*

*Open top right (3 bar) application menu ->

*

*Settings ->

*

*Privacy and Security ->

*

*Permissions ->

*

*Notifications -> Settings -> block website

Either determine specifically the website which adds them by systematic enable/disable/restart or just disable all potential candidates for a quick fix.
Don't forget to Restart firefox. Notifications should be gone presumed you disable the right websites.


text:
Q: Solving Normal Distribution Problem I'm trying to solve (i), I keep on finding that the answer to the question is 0.72. Nonetheless correct answer is shown to be 0.288.

My workings:
$$P(\frac{-0.5}{1.4}<Z<\frac{0.5}{1.4}) = P(-0.357<Z<0.357)$$
Based on the Standard Normal distribution table (Right tail only) we have: $$0.36 = 0.1406$$
I then proceed to get the area under both tails:
$$ 0.1406 * 2 = 0.28$$
and substract that value from 1
in order to get the area in the middle ( between 0 and 1 ):
$$ 1-0.28 = 0.72$$

Could someone possible tell me why we should substract the value from 1 at the end?
Thank you very much in advance

A: I suspect that based on the table you find something like:$$P(Z\geq0.36)\approx0.1406$$Taking that twice gives: $$P(Z\leq-0.36\text{ or }Z\geq0.36)=P(Z\leq-0.36)+P(Z\geq0.36)=2P(Z\geq0.36)\approx0.28$$Then:$$P(-0.36<Z<0.36)=1-P(Z\leq-0.36\text{ or }Z\geq0.36)\approx0.72$$