text:
Q: https and http combined .htaccess (different issue) OK. Hopefully someone can help me with a suggestion-

*

*I have a WordPress multisite using subfolders

*I am using WooCommerce

*I have a std Ubuntu 12.04/LAMP server with a GoDaddy Certificate installed

If it turn on SSL, it affects my entire domain (obviously) so my primary site ends up as:
'https://main-sitename.com'
My multisite blogs also come up as:
https://main-sitename.com/blogname-1
https://main-sitename.com/blogname-2
and so on. ALL of my menu links are also https which disables outside links because the urls all get prepended with https. :-/
What I am trying to do is get this:
http://main-sitename.com
http://main-sitename.com/blogname-1
http://main-sitename.com/blogname-2
https://main-sitename.com/shop/ (WooCommerce will force HTTPS on checkout and then un-enforce it when done).

*

*So, Anyone have any ideas on how I can remedy this? On an interesting note, when I had the EXACT same site on Rackspace Cloud Sites everything worked fine. When I moved to a self managed Cloudserver this happened. Is there something I missed?

A: It sounds like SSLRequireSSL has been set for the entire server. Since you only want to enforce HTTPS on /shop/ directory. Add a .htaccess file in that directory that contains:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

This will force anyone connecting to your shop with http:// to be redirected to the same URI, but on https://
EDIT 2
This works for me (with www.myserver.com changed to my real server name). I'm using date and name permalinks in WP. As soon as I go to http://www.myserver.com/shop/ I'm redirected to https. It preserves the URI.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# Addition to force redirect to https when they visit the shop!
RewriteBase /
RewriteCond %{HTTPS} !on
RewriteRule (shop/.*$) https://www.myserver.com/$1 [R=301,L]
# Back to WordPress changes
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


text:
Q: Jacobi method to solve linear systems in MATLAB How would you code this in MATLAB?
This is what I've tried, but it doesn't work quite right.
function x = my_jacobi(A,b, tot_it)
%Inputs:
%A: Matrix
%b: Vector
%tot_it: Number of iterations
%Output:
%:x The solution after tot_it iterations
    n = length(A);
    x = zeros(n,1);
    for k = 1:tot_it
      for j = 1:n
        for i = 1:n
            if (j ~= i)
                x(i) = -((A(i,j)/A(i,i)) * x(j) + (b(i)/A(i,i)));

            else
                continue;
            end
          end
      end
  end
end

A: j is an iterator of a sum over each i, so you need to change their order. Also the formula has a sum and in your code you're not adding anything so that's another thing to consider. The last thing I see that you're omitting is that you should save the previous state of xbecause the right side of the formula needs it. You should try something like this:
function x = my_jacobi(A,b, tot_it)
  %Inputs:
  %A: Matrix
  %b: Vector
  %tot_it: Number of iterations
  %Output:
  %:x The solution after tot_it iterations
  n = length(A);
  x = zeros(n,1);
  s = 0; %Auxiliar var to store the sum.
  xold = x
  for k = 1:tot_it
    for i = 1:n
      for j = 1:n
        if (j ~= i)
          s = s + (A(i,j)/A(i,i)) * xold(j);
        else
          continue;
        end
      end
      x(i) = -s + b(i)/A(i,i);
      s = 0;
    end
    xold = x;
  end
end

redpajama_set_name: RedPajamaStackExchange


text:
Q: Equivalent ways of representing a cycle I was reading a text about permutations and cycles. At a certain point, the author says that

Let $n,k \in \mathbb{N},$ $X = \{a_1,a_2,\dots,a_n\}$ and $\gamma \in S_{n}$ such that $\gamma = \begin{pmatrix}a_1 & a_2 & \dots & a_k \end{pmatrix}.$ Observe that $ \gamma = \begin{pmatrix}a_1 & a_2 & \dots & a_k \end{pmatrix} = \begin{pmatrix}a_2 & a_3 & \dots & a_k & a_1 \end{pmatrix} = \dots = \begin{pmatrix}a_k & a_1 & a_2 & \dots & a_{k-1} \end{pmatrix}.$

This seemed pretty intuitive but the proof of this equality is omitted.
I tried to prove this fact, but I'm really uncertain of the validity of my proof, so I'm gonna share with you what I have worked and I am really looking for a feedback of what needs to be improved.

Let $n,k \in \mathbb{N}$, such that $k \leq n$, $X = \{a_1,a_2,\dots,a_n\}$ and $\gamma \in S_n$ such that $\gamma = \begin{pmatrix}a_1 & a_2 & \dots & a_k \end{pmatrix}.$
Let $i \in \mathbb{N}$ such that $1 < i \leq k$ and consider $\pi \in S_n$ such that $\pi = \begin{pmatrix}a_i & \dots & a_k & a_1 & \dots & a_{i-1} \end{pmatrix}.$ We want to prove that $\pi = \gamma.$
Since $\gamma$ is a cycle (of length $k$), we know that $\gamma : X \to X$ is such that $\gamma(a_j) = a_{j+1}$ for any $j \in \mathbb{N}$ such that $j < k-1$ and $\gamma(a_k) = a_1.$
Now, we note that, as well, $\pi:X \to X$ is such that $\pi(a_{i}) = a_{i+1}, \dots \pi(a_{k}) = a_1, \dots, \pi(a_{i-2}) = a_{i-1}$ and $\pi(a_{i-1}) = a_{i}.$ Then, $\pi$ is such that $\pi(a_{j}) = a_{j+1}$ for every $j \in \mathbb{N}$ such that $1 < j \leq k-1$ and $\pi(a_k) = a_1.$
Then, we have that $\pi(x) = \gamma(x)$ for every $x \in \{a_1,a_2\dots,a_k\}.$
Since, $\gamma$ and $\pi$ are both cycles, we also know that $\gamma(y)=y$ and $\pi(y)=y$ for any $y \in X \setminus \{a_1,a_2,\dots,a_k\}.$
Hence, $\gamma(x) = \pi(x),$ for every $x \in X.$ Therefore, $\gamma = \pi. \quad \square$

My doubt is that this proof seems so simple and comes really straightforward from the definition that it made me feel uncomfortable.
What do you think? Any suggestions? Thank you for your attention.

A: Your proof is fine.
The key is, as you have explained, to keep track of where the cycles in question send the elements of the underlying set, then demonstrate that the cycles do the same thing to each of them. It really is that simple.
Well done.


text:
Q: Ubuntu freezes randomly with audio playing in the background I am hardcore Windows user and recently moved to Ubuntu to try Linux, I can see how Linux is better, I am loving it.
However, I have been experiencing problems with Ubuntu going unresponsive. Basically everything freezes and I can only move the mouse and I can hear the music still playing in the background. I have noticed that problem happens with either watching videos on YouTube, VLC or browsing in the Spotify app or Microsoft teams app.
I tried restarting GNOME via Alt+F2+r but nothing happens. Also tried killall -3 gnome-shell from the console but doesn't help. My only way out is to reboot the computer. I have been troubleshooting this issue for few months already, I end up reinstalling Ubuntu 18.04 a couple of times, also installed the latest version of Ubuntu 20.04, but the issue is still there.
I got an Dell Precision Tower 5810
My graphics card is:
lspci -k | grep -EA2 'VGA|3D'
03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde GL [FirePro W4100]
Subsystem: Dell Cape Verde GL [FirePro W4100]
Kernel driver in use: radeon

My Ubuntu version is:
Ubuntu 20.04 LTS
Release: 20.04
Codename: focal

Kernel version: 5.4.0-33-generic
More hardware info.
r2@r2-Dell-5810:/var/log$ free -h
       total      used     free      shared  buff/cache   available
Mem:   15Gi       2.4Gi    10Gi       185Mi       2.7Gi        12Gi
Swap:  2.0Gi      0B       2.0Gi

r2@r2-Dell-5810:/var/log$ sysctl vm.swappiness
vm.swappiness = 60

r2@r2-Dell-5810:/var/log$ sudo dmidecode -s bios-version
A14

r2@r2-Dell-5810:/var/log$ sudo lshw -C memory
  *-firmware
       description: BIOS
       vendor: Dell Inc.
       physical id: 0
       version: A14
       date: 07/01/2016
       size: 64KiB
       capacity: 16MiB
       capabilities: pci pnp upgrade shadowing cdboot bootselect edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification uefi
  *-cache:0
       description: L1 cache
       physical id: 75
       slot: CPU Internal L1
       size: 256KiB
       capacity: 256KiB
       capabilities: internal write-back
       configuration: level=1
  *-cache:1
       description: L2 cache
       physical id: 7a
       slot: CPU Internal L2
       size: 1MiB
       capacity: 1MiB
       capabilities: internal write-back unified
       configuration: level=2
  *-cache:2
       description: L3 cache
       physical id: 7f
       slot: CPU Internal L3
       size: 10MiB
       capacity: 10MiB
       capabilities: internal write-back unified
       configuration: level=3
  *-memory
       description: System Memory
       physical id: 2f
       slot: System board or motherboard
       size: 16GiB
       capabilities: ecc
       configuration: errordetection=multi-bit-ecc
     *-bank:0
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous 2400 MHz (0.4 ns)
          product: 9ASF51272PZ-2G3B1
          vendor: Micron
          physical id: 0
          serial: 133F18DB
          slot: DIMM1
          size: 4GiB
          width: 64 bits
          clock: 2400MHz (0.4ns)
     *-bank:1
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous [empty]
          product: DIMM5_PartNumber
          vendor: DIMM5_Manufacturer1
          physical id: 1
          serial: DIMM5_SerNum
          slot: DIMM5
     *-bank:2
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous 2400 MHz (0.4 ns)
          product: 9ASF51272PZ-2G3B1
          vendor: Micron
          physical id: 2
          serial: 133F18AF
          slot: DIMM3
          size: 4GiB
          width: 64 bits
          clock: 2400MHz (0.4ns)
     *-bank:3
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous [empty]
          product: DIMM7_PartNumber
          vendor: DIMM7_Manufacturer1
          physical id: 3
          serial: DIMM7_SerNum
          slot: DIMM7
     *-bank:4
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous 2400 MHz (0.4 ns)
          product: 9ASF51272PZ-2G3B1
          vendor: Micron
          physical id: 4
          serial: 133F2662
          slot: DIMM2
          size: 4GiB
          width: 64 bits
          clock: 2400MHz (0.4ns)
     *-bank:5
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous [empty]
          product: DIMM6_PartNumber
          vendor: DIMM6_Manufacturer1
          physical id: 5
          serial: DIMM6_SerNum
          slot: DIMM6
     *-bank:6
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous 2400 MHz (0.4 ns)
          product: 9ASF51272PZ-2G3B1
          vendor: Micron
          physical id: 6
          serial: 133F26E0
          slot: DIMM4
          size: 4GiB
          width: 64 bits
          clock: 2400MHz (0.4ns)
     *-bank:7
          description: RIMMProject-Id-Version: lshwReport-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>PO-Revision-Date: 2012-02-05 00:26+0000Last-Translator: Andi Chandler <Unknown>Language-Team: English (United Kingdom) <en_GB@li.org>MIME-Version: 1.0Content-Type: text/plain; charset=UTF-8Content-Transfer-Encoding: 8bitX-Launchpad-Export-Date: 2020-04-16 17:42+0000X-Generator: Launchpad (build 2e26c9bbd21cdca248baaea29aeffb920afcc32a) Synchronous [empty]
          product: DIMM8_PartNumber
          vendor: DIMM8_Manufacturer1
          physical id: 7
          serial: DIMM8_SerNum
          slot: DIMM8

Last freeze was on June 6 at 23:13 and I rebooted at 23:15. See below syslogs at the time.
Jun  6 23:03:21 r2-Dell-5810 snapd[875]: autorefresh.go:397: auto-refresh: all snaps are up-to-date
Jun  6 23:04:15 r2-Dell-5810 rtkit-daemon[1282]: Supervising 6 threads of 5 processes of 1 users.
Jun  6 23:04:15 r2-Dell-5810 rtkit-daemon[1282]: Supervising 6 threads of 5 processes of 1 users.
Jun  6 23:09:01 r2-Dell-5810 spotify_spotify.desktop[13705]: [2020/06/06 23:09:01:6244] ERR: getaddrinfo failed: -3
Jun  6 23:15:52 r2-Dell-5810 /usr/lib/gdm3/gdm-x-session[1962]: (**) Option "fd" "25"
Jun  6 23:15:52 r2-Dell-5810 /usr/lib/gdm3/gdm-x-session[1962]: (II) event1  - Power Button: device removed

Below is the Kern.log
Jun  6 23:02:49 r2-Dell-5810 kernel: [19473.745225] perf: interrupt took too long (2518 > 2500), lowering kernel.perf_event_max_sample_rate to 79250
Jun  6 23:15:53 r2-Dell-5810 kernel: [20257.714790] rfkill: input handler enabled
Jun  6 23:15:53 r2-Dell-5810 kernel: [20257.715018] audit: type=1107 audit(1591481753.163:6206): pid=840 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/NetworkManager" interface="org.freedesktop.NetworkManager" member="CheckPermissions" name=":1.11" mask="receive" pid=13705 label="snap.spotify.spotify" peer_pid=841 peer_label="unconfined"
Jun  6 23:15:53 r2-Dell-5810 kernel: [20257.715018]  exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'
Jun  6 23:15:53 r2-Dell-5810 kernel: [20257.716336] audit: type=1107 audit(1591481753.163:6207): pid=840 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_signal"  bus="system" path="/org/freedesktop/NetworkManager" interface="org.freedesktop.NetworkManager" member="CheckPermissions" name=":1.11" mask="receive" pid=13705 label="snap.spotify.spotify" peer_pid=841 peer_label="unconfined"
Jun  6 23:15:53 r2-Dell-5810 kernel: [20257.716336]  exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'

A: BIOS
Dell Precision Tower 5810
You have a very old BIOS, A14.
There's a newer BIOS available, A33, dated May 4, 2020, and can be downloaded from here.
Note: Verify that I've got the correct web page for your model #.
Note: Have good backups before updating the BIOS.
/swapfile
Let's increase your /swapfile from 2G to 4G.
Note: Incorrect use of the rm and dd commands can cause data loss. Suggest copy/paste.
In the terminal...
sudo swapoff -a           # turn off swap
sudo rm -i /swapfile      # remove old /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

sudo chmod 600 /swapfile  # set proper file protections
sudo mkswap /swapfile     # init /swapfile
sudo swapon /swapfile     # turn on swap
free -h                   # confirm 16G RAM and 4G swap

Edit /etc/fstab, using sudo -H gedit /etc/fstab or sudo pico /etc/fstab.
Confirm this /swapfile line in /etc/fstab... and confirm no other "swap" lines... use SPACES in this line... confirm NO TABS...
/swapfile  none  swap  sw  0  0

reboot                    # reboot and verify operation

A: Reinstalling the operating system does not fix the freezing problem seems to indicate that your computer has a hardware issue. The freezing video with audio still playing in the background is characteristic of a graphics processor problem. The Dell Precision Tower 5810 has an AMD FirePro W4100 graphics card. The graphics card may be faulty due to a lot of hard use or it may be malfunctioning due to overheating because the computer is overheating very quickly, but the usual culprit in situations like this one is the graphics card. Fortunately a discrete graphics card is easy to replace.
Overheating could be caused by:

*

*Dust and debris blocking the openings between the fins of the aluminum heat sink on the CPU.

*A worn out out fan.

*Cracked or otherwise worn out thermal paste between the CPU and the aluminum heat sink on the CPU.
If the CPU fan needs to be replaced, it may make sense to replace the CPU fan together with the aluminum cooling block as a single assembled unit, if the two parts are sold together as a single assembled unit, and solve all three problems at the same time.
While you're waiting to decide what to do about your computer's video freezing problem, you should install the Psensor (psensor) graphical temperature monitor application from the default Ubuntu repositories in order to provide real-time information about your computer's CPU and GPU temperatures. The Psensor icon is located in the notification area in the upper-right corner of the desktop. The Psensor icon looks like a little thermometer which you can click to show the fan speeds and the CPU & GPU temperatures. If the speed of a fan is slower than normal and that fan is spinning all the time, this is a good indication that the fan is starting to wear out due to friction on the bearings.
XSensors (xsensors) is another graphical temperature monitor application from the default Ubuntu repositories repositories. XSensors is similar to Psensor, but it has additional features and a more elaborate graphical user interface.

A: After more freezes I narrowed down to the below error.
DMAR: [INTR-REMAP] Request device [00:00.0] fault index 27 [fault reason 38] Blocked an interrupt request due to source-id verification failure.
Found the solution on the below question.
Ramdom freeze on ubuntu 16.04.02 with ATI HD 7850.
Thank you guys for your assistance.

A: It took me several months to solve why my older and slower Celeron computer would sometimes freeze for several minutes while the hard drive light remained on. To prevent the system from freezing for long extended periods while the hard drive swaps large file chunks, manage the swap setting
To see what value swappiness is set to...
 cat /proc/sys/vm/swappiness
if it is set to the default value of 60 then...
 sudo gedit /etc/sysctl.conf
add this to end of file
 vm.swappiness=10
My system no-longer freezes :-)


text:
Q: Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly I have Worker Services as Windows services which I am trying to install on a machine however it throws the below error when I try Installing it
Microsoft (R) .NET Framework Installation utility Version 4.8.3752.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Exception occurred while initializing the installation:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\JNyingi\source\repos\SeSPWS\SeSPWS\bin\Release\netcoreapp3.0\SeSPWS.exe' or one of its dependencies. The module was expected to contain an assembly manifest..

Below is the .csproj file content of the packages in use
<Project Sdk="Microsoft.NET.Sdk.Worker">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <UserSecretsId>dotnet-SeSPWS-00EEA7BA-8CD9-4E72-B073-FB0FB7B9192A</UserSecretsId>
    <ApplicationIcon />
    <OutputType>WinExe</OutputType>
    <StartupObject />
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="9.0.0" />
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
    <PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.1" />
    <PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.Http" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.Security" Version="4.4.*" />
  </ItemGroup>

  <ItemGroup>
    <WCFMetadata Include="Connected Services" />
  </ItemGroup>
</Project>

While looking at assembly binding log viewer I this error log.
** Assembly Binder Log Entry  (2/14/2020 @ 1:41:17 PM) ***

The operation failed.
Bind result: hr = 0x80131018. No description available.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Users\JNyingi\source\repos\SeSPWS\SeSPWS\bin\Release\netcoreapp3.0\SeSPWS.exe
LOG: Appbase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = InstallUtil.exe
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Users/JNyingi/source/repos/SeSPWS/SeSPWS/bin/Release/netcoreapp3.0/SeSPWS.exe.
LOG: Assembly download was successful. Attempting setup of file: C:\Users\JNyingi\source\repos\SeSPWS\SeSPWS\bin\Release\netcoreapp3.0\SeSPWS.exe
LOG: Entering run-from-source setup phase.
ERR: Error extracting manifest import from file (hr = 0x80131018).
ERR: Run-from-source setup phase failed with hr = 0x80131018.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.

I have installed the following runtime; .NET Core 3.0, ASP.NET Core 3.0 and Windows desktop 3.0. However, the service still fails to install even after upgrading to .NET Core 3.1 runtime.
Below is my build profile

I have built a similar worker service before which installed without any hustle; kindly I wish to resolve this error and deploy the service to the machine.
EDIT
Below is My Program Class
public class Program
    {
        public static void Main(string[] args)
        {
            var isService = !(Debugger.IsAttached || args.Contains("--console"));
            if (isService)
            {
                CreateWebHostBuilder(args).Build().RunAsService();
            }
            else
            {
                CreateWebHostBuilder(args).Build().Run();
            }
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseContentRoot(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName))
                .UseStartup<Startup>()
                .UseKestrel((context, serverOptions) =>
                {
                    serverOptions.ListenAnyIP(1042);
                    serverOptions.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(1.5);
                });
    }

EDIT2

These are the NuGet packages in use for the service

A: The error in majority of the cases is caused due to Incompatible bitness of your Application|Platform|Installutil|IIS
I've put together the various checks you can perform:

*

*Settings of your main project Project > Properties > Uncheck Prefer 32 bit

*Settings of your main project Project > Properties > /platform:AnyCpu or the BITness that you're targetting (x86) for 32bit

*If you are referencing additional DLL(s) in your project, ensure there is no BITness mismatch

*Validate your App.Config file and see if you have lines it it which specifies a different target runtime versus the one targetted by your app

*Verify the bitness set by IIS > AppPool > Enable 32 bit applications

*Unchecking "Use the 64 bit version of IIS Express for Web Sites and Projects" option under the Projects and Solutions

*Check the version of the InstallUtil that you are using to install the service

*Check the StartUp of your project and see if its the intended one

*Try to run InstallUtil is run as admin (As seen from another post)

*Uncheck 64 bit version of IIS from VS Navigate to Visual Studio – Tools – Options – Projects and Solutions – Web Projects

*Verify the bitness by viewing .CSProj file

*You can narrow down further by identifying the assembly that caused this exception by using FusionLogging OR DependencyWalker tool, you will be able to tell which dll failed to loadat runtime

Further Reading:
This Medium post explains the process of creating a Windows Service in .NetCore

    EDIT: Break down of the Root Cause based on OP's post below

*

*WebHostBuilder primarily allows us to configure and build a WebHost and is best suited for web apps.
But with .net core 2.1 a new option "generic" Host was introduced that enabled developers to create console app that can run background tasks, create services and handle messages.
See "Steve Gordons" article on Generic Host for Windows Services

*When we create worker service template, we need a reference to Microsoft.Extensions.Hosting.WindowsServices from nuget
Now with this we can use IHostBuilder.UseWindowsService()
There are 2 ways of using this (see details next point): Background worker service(uses Microsoft.Net.Sdk.Worker), Web App(Microsoft.NET.Sdk.Web) service sample, the difference being Microsoft.Extensions.Hosting package is referenced explicitily in the former one
MSDN article that explains this

*

*<Project Sdk="Microsoft.NET.Sdk.Web">
Now here you can use IWebHostBuilder
But be sure to use this for a web app-based service that uses the Razor Pages or MVC frameworks. A Good example

*<Project Sdk="Microsoft.NET.Sdk.Worker">
This type suits the majority of the requirements for windows service creation where the service needs to executes background tasks

*<RuntimeIdentifier> elements are used with Self Contained deployment and are used by .NET packages to represent platform-specific assets in NuGet packages

A: So after much frustrating dead ends, our Lady showed me how to resolve the error. It's really simple, I made three main changes to my application.
.csproj was updated to;
<Project Sdk="Microsoft.NET.Sdk.Worker">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <IsTransformWebConfigDisabled>true</IsTransformWebConfigDisabled>
    <UserSecretsId>dotnet-SeSPWS-00EEA7BA-8CD9-4E72-B073-FB0FB7B9192A</UserSecretsId>
    <ApplicationIcon />
    <OutputType>WinExe</OutputType>
    <StartupObject />
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
    <Platforms>AnyCPU;x64</Platforms>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="9.0.0" />
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
    <PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
    <PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="3.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.1" />
    <PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="3.0.0" />
    <PackageReference Include="System.ServiceModel.Duplex" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.Http" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.NetTcp" Version="4.4.*" />
    <PackageReference Include="System.ServiceModel.Security" Version="4.4.*" />
  </ItemGroup>

  <ItemGroup>
    <WCFMetadata Include="Connected Services" />
  </ItemGroup>
</Project>

I also changed my program.cs and changed from IWebHostBuilder to IHostBuilder as shown below;
public class Program
    {
        public static void Main(string[] args)
        {
            var isService = !(Debugger.IsAttached || args.Contains("--console"));
            if (isService)
            {
                CreateHostBuilder(args).Build().Run();//.RunAsService();
            }
            else
            {
                CreateHostBuilder(args).Build().Run();
            }
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .UseContentRoot(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName))
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                    webBuilder.UseKestrel((context, serverOptions) =>
                    {
                        serverOptions.ListenAnyIP(1042);
                        serverOptions.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(1.5);
                    });
                }).UseWindowsService();
    }

Just to make sure that the service builds with a specific version of .Net Core SDK I added the following global.json
{
  "sdk": {
    "version": "3.0.100",
    "rollForward": "disable"
  }
}

I then  built and published.
NOTE : I have also noted InstallUtil does not work with ASP.NET Worker Service. So, you have to change and use SC to install your service.Like so;
SC {SERVICENAME} binpath="{path-to-exe}"


text:
Q: How to use BLAS functions in Fortran mex files I've tried to use BLAS functions in my Fortran mex file, but it didn't work. Here's an example of one of my code that uses DGEMM:
#include "fintrf.h"

C     Gateway subroutine
  subroutine mexfunction(nlhs, plhs, nrhs, prhs)

C     Declarations
  implicit none

C     mexFunction arguments:
  mwPointer plhs(*), prhs(*)
  integer nlhs, nrhs

C     Function declarations:
  mwPointer mxGetPr
  mwPointer mxCreateDoubleMatrix
  mwsize    mxGetM,mxGetN

C     Pointers to input/output mxArrays:
  mwPointer pr_A, pr_B, pr_C
  mwSize :: sizea,sizeb

C     Array information:

  real*8, allocatable :: A(:,:),B(:,:),C(:,:)

C     Get the size of the input array.
  sizea = mxGetM(prhs(1))
  sizeb = mxGetN(prhs(2))

  allocate(A(sizea,sizea),B(sizea,sizeb),C(sizea,sizeb))

C     Create Fortran array from the input argument.
  pr_A = mxGetPr(prhs(1))
  pr_B = mxGetPr(prhs(2))

  call mxCopyPtrToReal8( pr_A, A, sizea**2 )
  call mxCopyPtrToReal8( pr_B, B, sizea*sizeb )

  call MUL(A,B,C,sizea,sizeb)

C     Create matrix for the return argument.
  plhs(1) = mxCreateDoubleMatrix(sizea, sizeb, 0)

  pr_C = mxGetPr(plhs(1))

  call mxCopyReal8ToPtr(C , pr_C, sizea*sizeb )

  return
  end

  subroutine MUL(A,B,C,sizea,sizeb)

  implicit none

  mwSize :: sizea,sizeb
  real*8 :: A(sizea,sizea),B(sizea,sizeb),C(sizea,sizeb),alpha,beta
  integer*4 :: M,N,K
  character ch1, ch2

  ch1 = 'N'
  ch2 = 'N'
  M=size(A,1)
  N=size(B,2)
  K=size(A,2)
  Alpha=1.
  Beta=0.

  CALL DGEMM(ch1,ch2,M,N,K,ALPHA,A,M,B,K,BETA,C,M)

  return
  end subroutine MUL

I use the following line to create a mex file:
mex -lmwblas Test.F

The mex file builds without any error, but when I try to use the function, matlab closes without any error message.  I'm using Matlab R2016a with Intel Visual Fortran Composer XE 2013 with Microsoft Visual Studio 2012.

A: You do not call DGEMM correctly.  All of your arguments are real*8 but many of them are supposed to be integers.
Check thoroughly the documentation of DGEMM  and check your call argument after argument to follow the interface exactly. I am pretty convinced passing the value of 1 instead of the sizea for K is wrong as well. But really, you have to check each and every argument.
I suggest to test your subroutines in pure Fortran and only after they work correctly use them from Matlab.

A: here's the solution:
#include "fintrf.h"

C     Gateway subroutine
  subroutine mexfunction(nlhs, plhs, nrhs, prhs)

C     Declarations
  implicit none

C     mexFunction arguments:
  mwPointer plhs(*), prhs(*)
  integer nlhs, nrhs

C     Function declarations:
  mwPointer mxGetPr
  mwPointer mxCreateDoubleMatrix
  mwsize    mxGetM,mxGetN

C     Pointers to input/output mxArrays:
  mwPointer pr_A, pr_B, pr_C
  mwSignedIndex :: sizea,sizeb

C     Array information:

  real*8, allocatable :: A(:,:),B(:,:),C(:,:)

C     Get the size of the input array.
  sizea = mxGetM(prhs(1))
  sizeb = mxGetN(prhs(2))

  allocate(A(sizea,sizea),B(sizea,sizeb),C(sizea,sizeb))

C     Create Fortran array from the input argument.
  pr_A = mxGetPr(prhs(1))
  pr_B = mxGetPr(prhs(2))

  call mxCopyPtrToReal8( pr_A, A, sizea**2 )
  call mxCopyPtrToReal8( pr_B, B, sizea*sizeb )

  call MUL(A,B,C,sizea,sizeb)

C     Create matrix for the return argument.
  plhs(1) = mxCreateDoubleMatrix(sizea, sizeb, 0)

  pr_C = mxGetPr(plhs(1))

  call mxCopyReal8ToPtr(C , pr_C, sizea*sizeb )

  return
  end

  subroutine MUL(A,B,C,sizea,sizeb)

  implicit none

  mwSignedIndex :: sizea,sizeb
  real*8 :: A(sizea,sizea),B(sizea,sizeb),C(sizea,sizeb),alpha,beta
  mwSignedIndex :: M,N,K
  character ch1, ch2

  ch1 = 'N'
  ch2 = 'N'
  M=size(A,1)
  N=size(B,2)
  K=size(A,2)
  Alpha=1.0
  Beta=0.0
  CALL DGEMM(ch1,ch2,M,N,K,ALPHA,A,M,B,K,BETA,C,M)

  return
  end subroutine MUL

and to build the mex file use
mex -largeArrayDims -lmwblas Test.F


text:
Q: SSRS - Opening a File location with Javascript in Action (Go to URL) expression for a new tab drops forward slashes I am attempting to create a Click Here link in my report and have it open an image (file) in a new tab instead of replacing the report page in the browser.
=Fields!ManufacturerDataPlatePhoto.Value

(Returns
  file://cld-sql-01/1234/Web_live_FileUploads/iOS%20Applications/MyAssets/images/Live/20%20May%202019/asset70-13-RES8743.jpg)

This returns the image correctly, but on the same page as the report so the user would have to click back in her browser and rerun the report.
="javascript:void(window.open('file:///" & Fields!ManufacturerDataPlatePhoto.Value & "','_blank'))"

(Returns
  file://cld-sql-01%5C1234%5CSEG_Web_live_FileUploads%5CiOS%20Applications%5CMyAssets%5Cimages%5CLive%5C20%20May%202019%5Casset70-13-RES8743.jpg)

Opens a new tab, but with a broken link, because the forward slashes have been replaced with %5C.
Any ideas how I could put the forward slashes back in?

A: You need to do URL Encoding for your url, there's a good article that discuss the details on how you can do it in SSRS, here's the link

A: Ultimately any solution with JavaScript or VB Functions became too difficult because of all the ways different browsers and their versions display (or completely block) network file paths access.
It was necessary in the end to simply add a thumbnail image in the report using the image path I pulled from the DB and a note below the image to "Right-Click then Save Image".
This also provided an elegant way to provide the image automatically in Excel, Word, etc, and providing the path in the ToolTip added additional functionality to the report the client hadn't thought of as well.
Thank you Tholitz_Reloaded for your answer, I'm sorry I cannot upvote you now, but I do not have >15 reputation yet on this account yet.
Final solution results


text:
Q: Magento 2| How to add "Add to cart" Button functionality in jQuery? I am adding "Add to cart" button functionality in jQuery function for calculated product quantity. I have add simple button yet. I have doing it as:

My function is:
$(document).ready(function(){
    $("#inputalgolia").keyup(function(){
        $("input").css("background-color", "grey");
        index.search(this.value, function(err, content) {
            // console.log(content.hits);
            var dataobj = content.hits;
            var product='';
            $.each(dataobj, function () {
                product+='
'+
                '
' + this.name  +'
'+
                '
' + this.sku  +'
'+
                '
'+this.image_url  +'
'+
                //'
'+ this.objectID  +'
'+
                '<input id="algolia-qty-' + this.objectID + '" data-product="' + this.objectID + '" class="qty-triggered" type="number" name="quantity" min="1" max="5">'+
                '<button type="button">Add to Cart</button>
'+
                '<input id="algolia-sqm-' + this.objectID + '" data-product="' + this.objectID + '" class="sqm-triggered" type="number">'+ '<input id="algolia-width-' + this.objectID + '" data-product="' + this.objectID + '" value="150" type="hidden">' + '<input id="algolia-height-' + this.objectID + '" data-product="' + this.objectID + '" value="400" type="hidden">' +
                '
';
                $('#productsalgolia').html(product);
            });
        });
    });
});

Can anybody explain how to do it, Thanks.


text:
Q: Displaying crossover only in d3.js Slankey (Dynamic, Interactive) I am aiming to create a d3.js visualisation dashboard that shows the flow of mutual connections based on a selection for 'a', that provides a statistic for 'b', shaped like a Sankey/Parallel Set. For instance, if 'a' is the user selection, where they select 3 of 11 characteristics of people, then b would be a count of how many people in our sample have all three characteristics.
Think of this like a Sankey/Parallel Set diagram where on the left we see the characteristics (Happy, Loyal, Calm), flowing into one container (200/1000 (with characteristics selected/total population).
I am wondering if anyone knows a pre-established way to JUST displays the crossover that the user defines in a navbar pre-selection.
Thanks.
Data:
![It's a boolean array, with totals. It's like a permutations and combinations spreadsheet
]1

A: try this for a variety of sankey's,
https://observablehq.com/search?query=sankey

A: So if you're looking to make a crossover slankey like me, I recommend modelling here:
http://sankeymatic.com/build/
Once you get into it, it's very easy to label what the final node should be, and encourage output to flow to that node.
Hope this helps!


text:
Q: Mochimedia leaderboard on iOS I have ported a Flash game over iPhone and the game is working very well. Now the hard part is we would like to integrate mochimedia leaderboard. I googled and did not find answer to my requirements. I know we can not load external swf contains Action Script in flash running on iOS. But is there any other workaround to integrate mochimedia leaderboard or if they have any swc to be dropped in the project. I just post the question to make sure if its not possible.

A: I had a talk with Mochi media support and it is not possible.


text:
Q: Как сделать такую форму для секции? сколько себя помню всегда верстал такие секции след образом. Просто брал картинку в таком формате и ставил как background. Но заказчик хочет что бы в будущем имел возможность менять картинку а форма секции ( круглая ) всегда оставалось таким. Скажите пожалуйста по средствам css, html как сделать что бы при смене фона картинки, фон всегда оставался такой формой?

A: Вариант с SVG.
Сгенерировать подходящий SVG можно тут - https://smooth.ie/blogs/news/svg-wavey-transitions-between-sections

.bg {
  width: 100%;
  background-image: url(https://via.placeholder.com/150);
  background-repeat: repeat;
}

.svg-wave {
  position: relative;
  bottom: 0;
  width: 100%;
  height: 150px;
  overflow: hidden;
}

.svg-wave svg {
  height: 100%;
  width: 100%;
}

logo

We are the best company!

    <svg viewBox="0 0 500 150" preserveAspectRatio="none" style="">
        <path d="M0.00,49.98 C152.64,-50.81 270.03,253.13 500.00,49.98 L500.00,150.00 L0.00,150.00 Z" style="stroke: none; fill: #fff;"></path>
      </svg>

BREAK

    <svg viewBox="0 0 500 150" preserveAspectRatio="none" style="">
        <path d="M0.00,49.98 C152.64,-50.81 270.03,253.13 500.00,49.98 L500.00,150.00 L0.00,150.00 Z" style="stroke: none; fill: #fff;"></path>
      </svg>


text:
Q: Inverting a hypothesis test: nitpicky detail First timer here. I'm reviewing a section of Casella and Berger on inverting a hypothesis test to get a Confidence Interval (CI), and came across a proof which I believe is missing a tiny piece. Here's the statement of the theorem verbatim from CB:

Theorem: For each $\theta_0 \in \Theta$, let $A(\theta_0)$ be the acceptance region of a level $\alpha$ test of $H_0: \theta = \theta_0$. For each $\boldsymbol{x} \in \mathcal{X}$, define a set $C(\boldsymbol{x})$ in the parameter space by
$$C(\boldsymbol{x}) = \{\theta_0: \boldsymbol{x} \in A(\theta_0)\}$$
then the random set $C(\boldsymbol{X})$ is a $1-\alpha$ confidence set.
Proof: We want to show that the confidence coefficient is equal to $1-\alpha$. Fix some $\theta_0 \in \Theta$ and define $R(\theta_0)$ as the rejection region of the aforementioned level $\alpha$ test of $H_0: \theta = \theta_0$. Then:
\begin{align*}
P_{\theta_0}(\theta_0 \in C(\boldsymbol{X})) &= P_{\theta_0}(\boldsymbol{X} \in A(\theta_0))\\
&= 1 - P_{\theta_0}(\boldsymbol{X} \in R(\theta_0))\\
&\geq 1-\alpha
\end{align*}
Where the last step follows from the fact that the hypothesis test is level $\alpha$. This is true for any $\theta_0 \in \Theta$, so thus $C(\boldsymbol{X})$ is a $1-\alpha$ confidence set.

Qualm: My problem with this proof is that we have shown that all the coverage probabilities are $\geq 1-\alpha$, but we have not shown that the confidence coefficient is equal to $1-\alpha$ (confidence coefficient = infimum of the coverage probabilities). More precisely, the the definition of a $1-\alpha$ confidence set $C(\boldsymbol{X})$ is:
$$\inf_{\theta} P_{\theta}(\theta \in C(\boldsymbol{X})) = 1-\alpha$$
It appears to me that the conclusion of the proof only shows that
$$\inf_{\theta} P_{\theta}(\theta \in C(\boldsymbol{X})) \geq 1-\alpha$$
I suppose this is a "better" conclusion, but still.
This is a very nitpicky detail. Nevertheless I'm curious what I'm missing. CB don't mention anything else in their presentation, so I figure I'm just having a brain freeze. Any pointers?
ANSWERED: After some deliberation with MansT below, we found it to be a typo in Casella and Berger. The correct theorem statement should read:
$$\textrm{...then the random set } C(\boldsymbol{X}) \textrm{ has confidence coefficient } \geq 1-\alpha$$

A: First of all, welcome to the site!
As Glen_b pointed out in a comment, for discrete distributions $P_\theta(\theta\in C(\mathbf{X}))$ won't be exactly equal to $1-\alpha$ for all $\theta$. You are however correct in that the classic defintion of a confidence interval is that $\inf_{\theta\in\Theta}P_\theta(\theta\in C(\mathbf{X}))=1-\alpha$ and not just that $\inf_{\theta\in\Theta}P_\theta(\theta\in C(\mathbf{X}))\geq 1-\alpha$.
The tiny piece that is missing is the following. $R(\theta)$ is the rejection region of a level $\alpha$ test. This means that $$P_{\theta}(\mathbf{X}\in R(\theta))\leq \alpha\qquad\forall \theta\in\Theta,$$
a fact that is used in the proof. But, by definition, it also means that
$$\sup_{\theta\in\Theta} P_{\theta}(\mathbf{X}\in R(\theta))=\alpha.$$
Consequently, it follows that
$$\inf_{\theta\in\Theta}P_\theta(\theta\in C(\mathbf{X}))=\inf_{\theta\in\Theta}\Big(1- P_{\theta}(\mathbf{X}\in R(\theta))\Big)=1-\sup_{\theta\in\Theta} P_{\theta}(\mathbf{X}\in R(\theta))=1-\alpha,$$
just as we were hoping.


text:
Q: For random variables, $X_1, X_2$, what allows us to write: $P(X_1 = k, X_1+X_2 = N) = P(X_1 = k, X_2 = N-k)$? For random variables, $X_1, X_2$, an often used property is:
$$
P(X_1 = k, X_1+X_2 = N) = P(X_1 = k, X_2 = N-k)
$$
This is used most often when $X_1$ is independent of $X_2$, so that we can factor the probabilities apart. However, I am not completely clear why this is the case.
It seems that to get $X_2 = N-k$, we must use information from the entry before the comma, that is $X_1 = k$. I am not quite clear why letting information "slide" across is valid here. Is there another way to see this? Thanks.

A: $$
\Big[ X_1 = 13\ \&\ X_1+X_2 = 32\Big] \text{ if and only if } \Big[ X_1 = 13 \ \&\ X_2 = 32-13 \Big].
$$
Therefore
$$
\Pr \Big[ X_1 = 13\ \&\ X_1+X_2 = 32\Big] = \Pr \Big[ X_1 = 13 \ \&\ X_2 = 32-13 \Big].
$$
The probabilities are the same because the two events are the same.

A: There is no sequential order implied by the "," in a conditional probability.  The comma separates a list of terms in a conjunction.
This is \begin{align*}
    P( (X_1 = k) &\wedge (X_1 + X_2 = N) ) && \text{given/definition}  \\
    P( (X_1 = k) &\wedge (X_2 = N - X_1) ) && \text{algebra}  \\
    P( (X_1 = k) &\wedge (X_2 = N - k) ) && \text{*}  \\
\end{align*}
Where * is a property of equality (the substition property).  If we are working in first order logic, this is a schema: $x = y \iff \forall P, P(x) = P(y)$, where in this example we are using $P(x) = (X_2 = N - x)$


text:
Q: Brand new to Cassandra, having trouble understanding replication topology So I'm taking over our Cassandra cluster after the previous admin left so I'm busy trying to learn as much as I can about it.  I'm going through all the documentation on Datastax's site as we're using their product.
That said, on the replication factor part I'm having a bit of trouble understanding why I wouldn't have the replication factor set to the number of nodes I have.  I have four nodes currently and one datacenter, all nodes are located in the same physical location as well.
What, if any, benefit would there be to having a replication factor of less than 4?
I'm just thinking that it would be beneficial from a fault tolerance standpoint if each node had its own copy/replica of the data, not sure why I would want less replicas than the number of nodes I have.  Are there performance tradeoffs or other reasons?  Am I COMPLETELY missing the concept here (entirely possible)?

A: There are a few reasons why you might not want to increase your RF from 3 to 4:

*

*Increasing your RF effectively multiplies your original data volume
by that amount. Depending on your data volume and data density you
may not want to incur the additional storage hit. RF > number of nodes will help you scale beyond one node's capacity.

*Depending on your consistency level you could experience a performance hit. I.E. when writing with quorum consistency level (CL) to an RF of 3 you wait for 2 nodes to come back before confirming the write to the client. In RF of 4 you would be waiting for 3 nodes to come back.

*Regardless of the CL, every write will eventually be going to every node. This is more activity on your cluster and may not perform well if your nodes aren't scaled for that workload.
You mentioned fault tolerance. With an RF of 4 and reads on CL one, you can absorb up to 3 of your servers being down simultaneously and your app will still be up. From a fault tolerance perspective this is pretty impressive, but also unlikely. My guess would be if you have 3 nodes down at the same time in the same dc, the 4th is probably also down (natural disaster, flood, who knows...).
At the end of the day it all depends on your needs and C* is nothing if not configurable. An RF of 3 is very common among Cassandra implementations
Check out this deck by Joe Chu

A: The reason why your RF is often less than the number of nodes in the cluster is explained in the post: Cassandra column family bigger than nodes drive space. This post provides insight into this interesting aspect of Cassandra replication. Here's a summary of the post:

QUESTION: . .. every node has 2Tb drive space and column family is replicated on every node so every node contains a full copy of it . . . after some years that column family will exceed 2Tb . . .
Answer: RF can be less than the number of nodes and does not need to scale if you add more nodes.
For example, if you today had 3 nodes with RF 3, each node will
  contain a copy of all the data, as you say. But then if you add 3 more
  nodes and keep RF at 3, each node will have half the data. You can
  keep adding more nodes so each node contains a smaller and smaller
  proportion of the data . . . no limit in principle to
  how big your data can be.


text:
Q: Calculate Week of The Month with Straddling Weeks - Excel I am trying to calculate the weeks of the month, 1-4 or 1-5, where the calendar week that contains the first calendar day of the month is always week 1. So for example, February 1, 2018 falls on a Thursday so the dates Monday January 29 - Sunday February 4 would be week one of February.
I was using the formula =INT((DAY(D2)+6)/7) - which seemed to work until the week splits and crosses the calendar month. It counted the days the cross over from January as week 5 rather than week 1 of the next month.

A: Try this and see if it works:
=IF(MONTH(A2)=MONTH(A2+7-WEEKDAY(A2,2)),CEILING(((DAY(A2)+WEEKDAY(A2-DAY(A2)-1)))/7,1),1)-AND((WEEKDAY(A2-DAY(A2))=1),MONTH(A2)=MONTH(A2+7-WEEKDAY(A2,2)))

*

*Is the following Sunday in the same month as the Date (in A2)

*

*If False, Week = 1

*If True

*

*use last Sunday of preceding month as base for week count.

*Adjust if month starts on a Monday and we are in the first week (there's possibly a better way to do this adjustment)


text:
Q: Could omission of "^" when accessing a record pointer's members cause an access violation? In VirtualTreeview, I am storing my data in the PVirtualNodes. I have experienced several Access Violations (typically with "Read of adress 00000000") in my App, and they mostly (I'd actually dare to say Always) occur when I am doing something with my Node Data.
However, the thing is, I declare my stuff & use it like this:
// DUMMY CODE - Not written or tested in IDE
var
 MyNode : PVirtualNode;
 MyData : PMyNodeData;
Begin
 MyNode := VST.GetFirstSelected;

 if Assigned(MyNode) then
  Begin
   MyData := VST.GetNodeData(MyNode);
   if Assigned(MyData) then
   Begin
     MyData.DummyProperty := 'Test';
   End;
  End;
End;

As you probably noticed, I do not "dereference" (correct?) my "MyData" by doing MyData^! The reason I don't is that I have been told it was not necessary to add the caret to the pointer name, however I have a feeling that it has something to do with it. If I knew, I wouldn't be posting on here. ;)
So my question is: Is it in the end necessary to add the little ^ to MyData? And is it possible that by not doing that, I may provoke an Access Violation?

A: When you have a pointer to a record, then you can omit the ^.  The following are equivalent:
MyData.DummyProperty
MyData^.DummyProperty

This is also the case for the deprecated Turbo Pascal object. I would expect it to be so for Delphi classes, although I have never tried with them since they are already reference types.
Sadly, this is not the explanation for your AV.

A: Using ^ to dereference records is optionnal as it is assumed implicitly by the compiler.  When not using any hard typecast, any situation that would requires the "^" would not compile. But only 1 level of dereferencing is implicit.
type
  TMyRecord  = record
    MyField : Integer;
  end;
  PMyRecord = ^TMyRecord;
  PPMyRecord = ^PMyRecord;

procedure DoSomething;
var vMyField : PPMyRecord;
begin
  vMyField.MyField;  <---Won't compile
  vMyField^.MyField; <---Will compile
end;

As for your access violation, here's my best guess based on what you wrote... Assuming your exemple is representative (i.e. that is, crash on assigning a string), and assuming PMyNodeData points to a record.  I'd guess that PMyNodeData's memory was reserved with "GetMem" instead of "New", making the string field of the record uninitialized.

A: There is an exception where Data.xx and Data^.xx are not the same: when the field pointed at is of the same pointer type or the generic pointer type:
var
  x: PPointer;
  y: Pointer;
begin
  x := GetPPointer();
  y := x;
  y := x^;
end;

I consider it best practice to always add the operator ^ when the pointed value is used to avoid ambiguous situations like above.
Given your example: The problem is possibly memory corruption. Did you set NodeDataSize correctly?


text:
Q: Windows batch file, use the "|" (OR) character I'm trying to work on a batch script for windows (.bat) that executes some commands, and need to send the '|' character as a parameter. Here's an example:
echo hello|world

this will never return the hello|world string.. I tried to escape it using hello\|world, but still no success. How to fix this please ?

A: Try this:
echo hello^|world

In batch you can use carets or double quotes to escape special characters.

A: Never mind, I found the solution.
echo Hello^|World


text:
Q: Change number after dollar sign to 0 in string What I am trying to do is to change number that comes after $ sign into 0 in a string. I could do simple "find $ sign then change next thing after it into 0", but the problem is that number may have different number of digits. Another problem is that number might be non-integer like "2.5" so it has to tolerate comma, or negative numbers like "-2"
For example:
I have an equation which is string type: x^(-2) + 4x + 123 + 42.2 + 1
I write it as follows: x^($-2) + $4x + $123 + $42.2 + 1
Output that I am trying to get should be: x^(0) + 0x + 0 + 1
Do you have an idea how to do that?
For now I have came up with idea, but I don't know if such method exist in ruby.
x=0
while index('$',x+1) do
   x = index('$',x+1)
   #function that does translating
end

In the loop, there could be a function that trims every digit until it find non-numeric character (with exception of starting - and . imitating negative or floating point number) and then puts in that place "0".

A: r = /
    \$        # match '$'
    (?:       # begin a non-capture group
      -(?>\d) # match a hyphen followed by a digit in a positive lookahead
      |       # or
      [\d,.]+ # match one of the characters one or more times
    )         # end the non-capture group
    /x        # free-spacing regex definition mode

which is conventionally written as follows.
r = /\$(?:-(?>\d)|[\d,.]+)/

"x^($-2) + $4,000x + $123 + $42.2 + 1".gsub(r, '0')
  #=> "x^(0) + 0x + 0 + 0 + 1"
"x^($-2) + $4x + $-123- $42.2 + 1".gsub(r, '0')
  #=> "x^(0) + 0x + 023- 0 + 1"

A: You could use regex with String#gsub like follows:
"x^($-2) + $4,000x + $123 + $42.2 + 1".gsub(/\$-?\d+(\,\d+)*(\.\d+)?/,'0')
#=> "x^(0) + 0x + 0 + 0 + 1"


text:
Q: Import Git repository with submodules into a Subversion repository What is the best approach for importing a Git project with submodules into a Subversion repository?
Not sure if it matters, but the submodules are pointing to the Kohana core and module repositories on github. It would be nice if I could reference these external repositories in Subversion, but it's definitely not a requirement.
Thanks,
Mike

A: To import git to svn:

*

*Create a svn repo, in the standard format that you want imported into.

*Associate your git repo with the svn one:
git svn clone https://svn.com/new_svn_repo --stdlayout

*Checkout the trunck and merge the master
git checkout trunk
git merge master

*Send the objects to the svn
git svn dcommit

*Done!

I don't think there is a simple way to include submodules within this. You should probably manually add the svn repos svn externals

A: I would recommend to import the repository using SubGit. Look at this comment for instructions. Though it doesn't support submodules so far, I know no other tool that does. But it fits migration purposes better.


text:
Q: Implementing audio delay effects unit I am creating an audio delay unit. Essentially the incoming samples go into a circular buffer and get picked out from some read pointer that is a number of samples behind the write pointer. These pointers are incremented by one for each new sample.
Additionally, in order to allow for fractional delays I actually have two read pointers one sample apart and use bilinear interpolation to blend between them depending on the floating point delay parameter. (I could use sinc interpolation or something else but have not bothered with that yet.)
It all works fine when the delay is set to a particular value. But when the user varies the delay while sounds are playing, a crackling noise is also apparent due to the changing delay taps. Presumably it is picking off the signal at varying samples and introducing random step discontinuities in the audio waveform.
I was wondering if there are any DSP audio buffs out there who know how to work around this problem, because I know that I have played with delay boxes where this effect does not happen, but at present I can't think of a solution.

A: When you're changing the delay, there will always be some sort of distortion.  It's just a matter of picking what you want.
As you've found, if you just drop into a random spot, the sharp jump from one sample value to the next will often cause an audible pop.  One option is to simply mute the audio for a small period of time and start it again.  If this is still too abrupt, you could scale the values down to zero over a few milliseconds, and scale them back up on the new buffer position over a few milliseconds.  (Effectively turning the volume down quickly, and then back up once you're at the new position.)
Propellerhead's Reason actually simulates speeding up and slowing down the recording as if it were a tape delay, and you were moving the head.  This is pretty complicated... you are effectively re-sampling your buffer audio dynamically until you get to the new buffer location.

A:
When the user varies the delay while sounds are playing, a crackling
  noise is also apparent due to the changing delay taps. Presumably it
  is picking off the signal at varying samples and introducing random
  step discontinuities in the audio waveform.

Yep. That's exactly right. I think the most natural way around this is to smooth the change in delay time. For example, instead of jumping from 200 milliseconds delay to 500 milliseconds, your delay effect should smoothly change from 200ms to 500ms over some period of time. With this technique the delayed audio will will drop or rise depending on how quickly the delay time is changed.
This technique can introduce aliasing (as Bjorn Roche indicates in the comments). If that is a problem one solution is to use bandlimited interpolation.

A: I don't know how DSP units do it, but I suggest you apply a lowpass filter to the delay set by the user in order to smoooth out any abrupt changes.
Let set_delay[n] represent the delay set by the user at time sample n, and let filtered_delay[n] be the filtered delay. The simplest lowpass filter is a one-pole IIR filter:
filtered_delay[n] = (1-alpha)*filtered_delay[n-1] + alpha*set_delay[n]

The value alpha controls the time constant of the filter. It should be chosen as a tradeoff between responsiveness and smoothness.
For example, if the user suddenly changes the set_delay from 100 to 50 samples, the filtered_delay with alpha=0.1 will be: 95, 90.5, 86.45, ..., thus slowly decreasing from 100 to 50.

A: The solutiont that first came into my head was - because audio is always some sort of sine wave going up and down rapidly, you could always find a sample with value close to your previous value somewhere nearby. Thus increasing or decreasing the delay should land at the sample close enough by value somewhere in vicinity of desired sample count, but not strictly on the one requested, if it is largely off by value. And then it could gradually slide into place by automated finishing process, which increases or decreases the delay sample by sample, instead of large jumps, until desired (commanded) value is finally reached. If we are talking in terms of sample rate - even landing some 10 to 50 samples off could be decreased to 0 in some 50 to 250 samples, or 1-5ms at typical 48k. I guess that's quickly enough to be little perceivable. I don't know how it could sound like, nor I have hardware to test it off, but as an idea I guess it has a plausible reason to live. Drop me a line if anyone tries it out and finds being any good.


text:
Q: How to get request host in django? How to get request host in django ?
how will I get host URL/name from request
class StoreLocations(APIView):
    """
    GET     :  For fetching store locations
    Returns :  Store Locations
    ---------------
    json
    """
    permission_classes = []
    http_method_names = ["get"]

    def get(self, request, format=None):
            """
            Want to check from where request is coming from and allow requests coming from specific urls only
            """

A: Use HttpRequest.get_host(...)
class StoreLocations(APIView):
    def get(self, request, *args, **kwargs):
        host = request.get_host()

A: You can use the below code snippet to see which host is used.
print(request.environ.get("HTTP_ORIGIN"))

To see the additional details present in request.
print(request.__dict__)

A: django request have META dictionary:https://docs.djangoproject.com/en/4.0/ref/request-response/#django.http.HttpRequest.META
I think you search for:
request.META['REMOTE_ADDR'] # e.g. '1.1.1.1'
request.META['REMOTE_HOST'] # e.g. '1.1.1.1'
request.META['HTTP_REFERER'] # this show url from where was made request


text:
Q: How to get a custom value using Contact Form 7 - Dynamic Text Extension I have a $_SESSION array variable with post ids. Inside foreach loop, I would like to get the posts titles of these ids. Thus so far I have something like this:
sport_title = '';
foreach($_SESSION['sports_post_id'] as $sports_id {
    $sport_title = get_the_title($sport_id);
    $sports_titles .= $sport_title . "<br />";
}

Now, my problem is that I do not know how to pass it in a custom variable in Contact Form 7 - Dynamic Text Extension plugin.
I have inside my form this field (inside CF7):
[dynamichidden dynamic_sports readonly default:shortcode_attr]

and inside my custom page template php file:
echo do_shortcode('[contact-form-7 id="3561" "CF7_get_custom_field dynamic_sports=\'$sports_titles\'" title="Availability Form EN"]');

Thus, I would like to send these post titles in email.. How can I make it work? thanks in advance

A: ok I figure it out how to do it! If anyone wants more explanation:
Inside Contact Form 7 - Form tab, I have insert this code:
[dynamichidden dynamic_sports "CF7_GET key='sports_post_id'"]

where key is a standard word (could not change it).
Inside Email tab, you should have this code:
Sports: [dynamic_sports]

Now, inside my Custom template PHP file, I have this shortcode:
echo do_shortcode('[contact-form-7 id="3561" title="Availability Form EN"]');

I also have a form with a hidden input type, with a name sports_post_id and value the id of the current post:
<input type="hidden" value="<?php echo get_the_title( get_the_ID() ); ?>" name="sports_post_id" id="sports_post_id" />

EDITED
Another solution via plugin that extends the CF7, would be the following:

*

*Install Contact Form 7 - Dynamic Text Extension

*Copy and paste the form-tag code below and then add it inside the form code block
[dynamichidden page-title "CF7_get_post_var key='title'"]

The above code will add a hidden text input to the form which will pre-populate the page title. This is good to use when you are using the same contact form on multiple pages so you know where the user has submitted the form from. Alternatively, you can display the page URL or slug using one of the below shortcodes instead:
[dynamichidden page-url "CF7_bloginfo show='url'"]
[dynamichidden page-slug "CF7_bloginfo show='url'"]

Displaying the Hidden Dynamic Content Tag Variable in Contact Form 7
Finally, display the hidden dynamic content tag variable in Contact Form 7 form. While you are on the CF7 settings page, click on the "Email" tab and insert this:
[page-title]

If you are using the URL or Slug fields, you these instead:
[page-url]
[page-slug]

A: In your CF7 Form configuration > Email Tab, you only have to add the desired field between hooks [...]
[dynamic_sports]

This will print the dynamic field value in your email.


text:
Q: NullPointerException in android smsreceiver? i have the following code:
public class SmsReceiver extends BroadcastReceiver
{
    private DBOperations DataDBoperation;
    String str = "";
    String password;
    @Override
    public void onReceive(Context context, Intent intent)
    {
        //---get the SMS message passed in---
        Bundle bundle = intent.getExtras();
        SmsMessage[] msgs = null;

        if (bundle != null)
        {
            //---retrieve the SMS message received---
            Object[] pdus = (Object[]) bundle.get("pdus");
            msgs = new SmsMessage[pdus.length];
            for (int i=0; i<msgs.length; i++){
                msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
                str += msgs[i].getMessageBody().toString();
            }
            //---if incomming msg is equal to Msg pattern
            int triggerCommand = getMsgPattern(context);
            if(triggerCommand == 1 || triggerCommand == 2 || triggerCommand == 3 || triggerCommand == 4 || triggerCommand == 5 || triggerCommand == 6)
            {
                switch(triggerCommand)
                {
                case 1:
                {   ///// BACKUP
                    Intent i=new Intent(context,UploadContent.class);
                    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    context.startActivity(i);
                    break;
                }
                case 2:
                {
                    //// FORMAT
                    Intent j=new Intent(context,DeleteContent.class);
                    j.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    context.startActivity(j);
                    break;
                }
                }
                //-------- delete this sms here ----------
                abortBroadcast();
            }
        }

public int getMsgPattern(Context c)
    {
        DataDBoperation = new DBOperations(c);
        String[] valuesPassword = DataDBoperation.getUserPasswordsString();
        password = valuesPassword[0];
        String pattern1 = "BACKUP *" + password + "*";
        String pattern2 = "FORMAT *" + password + "*";
        String pattern3 = "LOCATE *" + password + "*";
        String pattern4 = "WIPE *" + password + "*";
        String pattern5 = "LOCK *" + password + "*";
        String pattern6 = "RESETPASSWORD *" + password + "*";

        if(pattern1.equalsIgnoreCase(str))
        {
            return 1;
        }
        else if(pattern2.equalsIgnoreCase(str))
        {
            return 2;
        }
return 0;
    }
    }

error log:
10-11 12:59:54.842: E/AndroidRuntime(18743): FATAL EXCEPTION: main
10-11 12:59:54.842: E/AndroidRuntime(18743): java.lang.RuntimeException: Unable to start receiver iiu.fyp.cdsr.SmsReceiver: java.lang.NullPointerException
10-11 12:59:54.842: E/AndroidRuntime(18743):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2379)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at android.app.ActivityThread.access$1500(ActivityThread.java:149)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1380)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at android.os.Looper.loop(Looper.java:153)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at android.app.ActivityThread.main(ActivityThread.java:5026)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at java.lang.reflect.Method.invokeNative(Native Method)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at java.lang.reflect.Method.invoke(Method.java:511)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at dalvik.system.NativeStart.main(Native Method)
10-11 12:59:54.842: E/AndroidRuntime(18743): Caused by: java.lang.NullPointerException
10-11 12:59:54.842: E/AndroidRuntime(18743):    at iiu.fyp.cdsr.DBOperations.getUserPasswordsString(DBOperations.java:149)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at iiu.fyp.cdsr.SmsReceiver.getMsgPattern(SmsReceiver.java:89)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at iiu.fyp.cdsr.SmsReceiver.onReceive(SmsReceiver.java:31)
10-11 12:59:54.842: E/AndroidRuntime(18743):    at android.app.ActivityThread.handleReceiver(ActivityThread.java:2372)
10-11 12:59:54.842: E/AndroidRuntime(18743):    ... 10 more

i need to call activity upon receiving certain sms and delete it from inbox after words ... for abortbroadcast() i have setup its priority higher then the sms service.. where is the actual problem? could someone please correct it?
EDIT:
Following is my DB code to retrieve password from sqlite:
    public String[] getUserPasswordsString() {
                List PasswordClass = new ArrayList();

                Cursor cursor = database.query(DataBaseWrapper.PasswordTable,
                        PASSWORD_TABLE_COLUMNS, null, null, null, null, null);

                cursor.moveToFirst();
                String[ ] password = new String[1] ;
                int i=0;
                while (!cursor.isAfterLast()) {
                    PasswordClass sim = parsePasswords(cursor);
                    password[i] = sim.getUserPassword().toString();
                    i++;
                    PasswordClass.add(sim);
                    cursor.moveToNext();
                }

                cursor.close();
                return password;
            }
private PasswordClass parsePasswords(Cursor cursor) {
            PasswordClass UserPassword = new PasswordClass();
            UserPassword.setUserPasswordId((cursor.getInt(0)));
            UserPassword.setUserPassword(cursor.getString(1));
            return UserPassword;
        }

A: There is an error on your
String[] valuesPassword = DataDBoperation.getUserPasswordsString();

The DataDBoperation.getUserPasswordsString() is null thats why it is throwing a NullPointerException.
I think your problem is on your DataDBoperation getUserPasswordsString() method.

A: Did you added permission in manifest. You should add
<uses-permission android:name="android.permission.RECEIVE_SMS">

Please follow the below link if any more problem
How To Receive SMS in Android


text:
Q: Vim autocompletion: "Pattern not found" I am using vim with snipmate and youcompleteme. I have configured it as follows:
imap hh <Plug>snipMateNextOrTrigger

" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger=""
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

All my snippets are located in ~/.vim/snippets/.... When I type in a snippet, I can see that vim recognizes it like this:

How ever, when I type hh to load the snippet I get this error:

What is wrong with my settings?
Many thanks


text:
Q: conflict between overlay and ifelse functions in r-raster I was running a code and found a weird behaviour when using an ifelse function inside an overlay in the raster package. In short, the function will report an error if the first 5 values of every raster is NA.
Why is that happening?
Below is a short code that mimics the problem I found using R 3.2.3 and raster version 2.5-2, and some temporary solutions that I'm thinking on using meanwhile.
Thanks
Carlos Albero
library(raster)
cob1d <- raster(matrix(1,nr=6,nc=6))
cob1 <- cob1d; cob2 <- cob1d; cob3 <- cob1d
overlay(cob1, cob2, cob3, fun=function(x1, x2, x3)  ifelse(x1 > 0, x1 + x2 + x3,  x3))

# class       : RasterLayer
# dimensions  : 6, 6, 36  (nrow, ncol, ncell)
# resolution  : 0.1666667, 0.1666667  (x, y)
# extent      : 0, 1, 0, 1  (xmin, xmax, ymin, ymax)
# coord. ref. : NA
# data source : in memory
# names       : layer
# values      : 3, 3  (min, max)

# Changing the first 5 values...

cob1[1:5] <- NA; cob2[1:5] <- NA; cob3[1:5] <- NA
overlay(cob1, cob2, cob3, fun=function(x1, x2, x3)  (x1 + x2 + x3))

gave the same result...
# but if I use `ifelse`, there is a problem:

overlay(cob1, cob2, cob3, fun=function(x1, x2, x3)  ifelse(x1 > 0, x1 + x2 + x3,  x3))
# Error in ifelse(x1, x1 + x2 + x3, x3) :
#  argument "x2" is missing, with no default

# Another way to solve it is adding a useless extra variable without `NA`.

cob4 <- cob1d
overlay(cob1, cob2, cob3, cob4, fun=function(x1, x2, x3, x4)  ifelse(x1 > 0, x1 + x2 + x3,  x3))
# same result as before...
# class       : RasterLayer
# dimensions  : 6, 6, 36  (nrow, ncol, ncell)
# resolution  : 0.1666667, 0.1666667  (x, y)
# extent      : 0, 1, 0, 1  (xmin, xmax, ymin, ymax)
# coord. ref. : NA
# data source : in memory
# names       : layer
# values      : 3, 3  (min, max)

# or just avoiding the use of the `ifelse` function...

overlay(cob1, cob2, cob3, cob4, fun=function(x1, x2, x3, x4)  (x1 > 0) * (x1 + x2 + x3) + (x1 <= 0)*x3)

A: This is an interesting case. overlay uses the first 5 cells to determine how to process the data (via apply or via do.call). The first test is to see if apply can be used. The function used can be run via apply if all values are NA
f <- function(x1, x2, x3)  ifelse(x1 > 0, x1 + x2 + x3,  x3)
m <- matrix(NA, 5, 3)
apply(m, 1, f)

Based on that test, apply is used for all cells. However, apply fails with this function when not all values are NA:
m[1] <- 1
apply(m, 1, f)

This fails, because only has one first argument x (not three arguments as f requires).
Whereas the opposite case is common (a function that fail when only NA values are supplied) this case is rare.
raster:::calc has the argument forcefun to avoid using apply, but this is not available in overlay. I have added that to future versions of raster (version >= 2.5-4), such that you can do:
f <- function(x1, x2, x3)  ifelse(x1 > 0, x1 + x2 + x3,  x3)
overlay(cob1, cob2, cob3, fun=f, forcefun=TRUE)

In any case, you can use calc as a work-around:
s <- stack(cob1, cob2, cob3)
r <- calc(s, fun=function(x)  ifelse(x[1] > 0, x[1] + x[2] + x[3],  x[3]))

Or another alternative, based on your alternative function:
r <- (cob1 > 0) * (cob1 + cob2 + cob3) + (cob1 <= 0)*cob3

A: Maybe you have to use every "x" in your function with a condition, e.g.
overlay(cob1, cob2, cob3, fun=function(x1, x2, x3)  ifelse(x1 > 0 & x2 >0 & x3 >0 , x1 + x2 + x3,  x3))

not only the condition for x1 (x1>0)


text:
Q: Sitecore 9: Make 'full name' field searchable from user manager (Solr) Sitecore user accounts have an out-the-box field added to asp membership user profiles called 'Full name'. This field is not searchable from the user manager in Sitecore (See pic).
How do we make this field searchable?


text:
Q: Error ORA-01779 al actualizar campo Estoy actualizando un campo de una tabla A con el valor de otra tabla B, al actualizar me genera el siguiente error, alguien sabe como podría solucionarlo?

ORA-01779: no se puede modificar una columna que se corresponde con una tabla no reservada por clave

> UPDATE (SELECT AA.PLAZA, BB.NOM
>     FROM TMP_IOP_AJUSTE_TRF_RCBD_PSTVS AA
>     INNER JOIN TMP_IOP_AJUSTE_TRF_RCBD2_TEST BB
>         ON AA.SEQ=BB.SEQ
>      WHERE AA.SEQ='696202662' AND AA.PLAZA IS NULL  ) t SET t.PLAZA    = t.NOM;

A: Estas armando una subquery compleja para hacer update, te aconsejaría simplificarla porque el optimizador de Oracle te va a tirar este error en la mayoría de los casos. Probaría algo como esto:
UPDATE TMP_IOP_AJUSTE_TRF_RCBD_PSTVS P
SET P.PLAZA = (SELECT T.NOM FROM TMP_IOP_AJUSTE_TRF_RCBD2_TEST T WHERE P.SEQ=P.SEQ)
WHERE P.SEQ='696202662' AND P.PLAZA IS NULL

A: No es precisamente tu caso. Pero yo lo solucioné cuando cambié el LEFT JOIN por el INNER JOIN. De esa manera Oracle no se queja de que pueden existir valores que no se correspondan. Quizás a alguien le sirva


text:
Q: Python - Read and append characters to the new write I have a file named "Strings.txt" which contains the following format
text = text

Small sample of Strings.txt:
Incoming calls = See the Preferences
Incoming message from %@ = Incoming message from %@
Enter Your Password =

I want to read this file in Python insert some character/strings and write it to other file like "Format.strings"
The out put will be :
/* No comment test. */
"Incoming calls" = "See the Preferences";

/* No comment test. */
"Incoming message from %@" = "Incoming message from %@";

/* No comment test. */
"Enter Your Password" = "";

Here is my Python code:
prefix = '"'
suffix = '";'
comment = '/* No comment test. */'

f = codecs.open('Strings.txt', encoding="utf-16")
o = codecs.open('temp.strings', 'w')

for line in f:
    o.write(line.replace(' = ', '\" = \"' ))
f.close()
o.close()

h = codecs.open('temp.strings', 'r')
t = codecs.open('Format.strings', 'w')
for l in h:
    t.write(comment + '\n')
    t.write('%s%s%s\n' % (prefix, l.rstrip('\n') , suffix))
    t.write("\n");

t.close()
h.close()

Is there a way to avoid using the "temp.strings" file(second reading and writing) and get the same result ?

A: Open the file t o read. Then replace the characters. Instead of writing to different file, write it to the Format.strings file!!
prefix = '"'
suffix = '";'
comment = '/* No comment test. */'

f = codecs.open('Strings.txt',"r")
t = codecs.open('Format.strings', 'w+')

for line in f.readlines():
    t.writelines(comment + '\n')
    line = line.replace(' = ', '\" = \"' )
    t.writelines('%s%s%s\n' % (prefix, line.rstrip('\n') , suffix))
    t.writelines("\n")
f.close()
t.close()

Output in Format.strings:
/* No comment test. */
"Incoming calls" = "See the Preferences";

/* No comment test. */
"Incoming message from %@" = "Incoming message from %@";

/* No comment test. */
"Enter Your Password" = "";

/* No comment test. */
"Dial Plans" = "Disable Calls";

/* No comment test. */
"Details not available" = "Call Button";


text:
Q: jQuery Plugin - How does it work? I have a little problem:
I don't knwo how to run this jQuery plugin:
http://plugins.jquery.com/project/sound
There's no demo available :(

A: Apparently the author thought this was documentation enough:
$("#sound").sound({swf: url});
$("#sound").load(url);
$("#sound").play();
$("#sound").pause();
$("#sound").stop();
$("#sound").volume(0-100);

Here's my interpretation: The element #sound is where you audio controller will be. The SWF URL is where on the site you saved the .swf file found in the .zip download. load() takes as an argument the URL of the sound file. play(), pause(), etc. should be self-explanatory. So call sound() first, then load(), then call play() when the time is right.
Try creating your own live demo using such a method, and submit as a bug report on the jQuery site that the plugin demo is down. (There is a link to submit an issue regarding the plugin once you log in.) Perhaps the demo URL will be changed to yours.

A: Try SoundManager 2, it's well documented, easy to use and doesn't even require jQuery.

A: i've released an audio player framework that leverages SoundManager2 + integrates w/ jQuery as a $.fn.  very simple to use and/or customize.. similar to jPlayer, but w/ additional features (eg RTMP streaming, full HTML5 support), examples, tests etc:
https://github.com/APMG/APMPlayer


text:
Q: How to select newest records How would I get the most recent records from a MySQL database?
My table looks like this:
NAME   AGE  COUNTRY   CREATED

JEMO  23    UK        2019-04-25 17:41:29
JET   27    USA       2019-05-05 18:21:20
KET   20    CA        2019-05-06 19:16:12

MySQL Query:
SELECT * FROM USER WHERE TIMESTAMP(CREATED) = NOW()

I want to select users who just created an account, like the most recently registered or newest users. How would I do this?

A: In mysql you could select the user with the most recent date CREATED this way
 select *
 FROM  USER
 order by CREATED DESC
 limit 1

OR select the matching date for max created
select *
FROM  USER
WHERE CREATED  = (
  select  max(CREATED) FROM USER
)


text:
Q: How to retain in same page after back button is pressed? Now I want to retain in the same page when I click back button on browser. If there  is any possible please guide me.
After login if I press back button on browser the page will not go to login page it have to retain/reload into the same page.
my program in php.

A: Try This one:
 $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  header("Location: ".$url);

Or
header('Location: '.$_SERVER['PHP_SELF']);


text:
Q: REGEX string extraction between underscore and file extension I have a series of string like the following one:
abc_8g_1980_312.tif
from which I would like to extract the string '312' i.e. everything between the 3rd underscore and the file extension'.tif' string.
I'm trying using this website https://regex101.com/
inserting this regular expression: (\d{3})(\.tif$)
but I'm not getting what I would like to have.
Any suggestions would be appreciated.

A: Assuming what you want to capture would always be the last underscore-separated term in your file name, you could use:
(?<=_)[^_]+(?=\.)

Demo

A: To get the last 3 digits after an underscore with extension .tif you can also use lookarounds asserting _ to the left, and .tif to the right at the end of the string.
(?<=_)\d{3}(?=\.tif$)

Regex demo


text:
Q: Counting new lines, tabs, and spaces I'm working my way through C++ Primer 5th edition to teach myself C++.  I came across a problem in the book that I don't know how to solve in Chapter 5 using the tools they have given me thus far.  I have previous programming experience and have solved this myself using noskipws.  I'm looking for help on how to solve this problem with minimal use of libraries, think the first 4-5 chapters of a beginner book.
The problem is to find and count all the vowels, spaces, tabs, and newline characters as they are read using if statements.  My solution to the problem is:
// Exercise 5.9
int main()
{
char c;
int aCount = 0;
int eCount = 0;
int iCount = 0;
int oCount = 0;
int uCount = 0;
int blankCount = 0;
int newLineCount = 0;
int tabCount = 0;
while (cin >> noskipws >> c)
{
    if( c == 'a' || c == 'A')
        aCount++;
    else if( c == 'e' || c == 'E')
        eCount++;
    else if( c == 'i' || c == 'I')
        iCount++;
    else if( c == 'o' || c == 'O')
        oCount++;
    else if( c == 'u' || c == 'U')
        uCount++;
    else if(c == ' ')
        blankCount++;
    else if(c == '\t')
        tabCount++;
    else if(c == '\n')
        newLineCount++;
}
cout << "The number of a's: " << aCount << endl;
cout << "The number of e's: " << eCount << endl;
cout << "The number of i's: " << iCount << endl;
cout << "The number of o's: " << oCount << endl;
cout << "The number of u's: " << uCount << endl;
cout << "The number of blanks: " << blankCount << endl;
cout << "The number of tabs: " << tabCount << endl;
cout << "The number of new lines: " << newLineCount << endl;
return 0;
}

The only other way I can think to solve this is using getline() and then counting the amount of times it loops to get the '/n' count and then step through each string to find the '/t' and ' '.
Thanks for the assistance in advance.

A: You can avoid noskipws by replacing this
while (cin >> noskipws >> c)

with
while ( cin.get(c) )

The extraction operator >> observes delimiter rules, including whitespace.
istream::get does not, and extracts the data verbatim.

A: Your code works perfectly fine:
Input:
This is a test or something
New line
12345
Test 21

Output:
The number of a's: 1
The number of e's: 5
The number of i's: 4
The number of o's: 2
The number of u's: 0
The number of blanks: 7
The number of tabs: 0
The number of new lines: 3

I'd recommend checking out the std::tolower() function, for testing upper and lowercase characters at the same time.
Also, to check for any kind of letter, look into the std::isalpha() std::isdigit(), std::isspace(), and similar functions.
Further, you could make the function not dependant on std::cin, and instead use std::cin to get a string, and pass the string into the function, that way the function could be used for any string, not just std::cin input.
To avoid using noskipws (which I personally think is fine), one option is to do this: (as an alternative option to the other solutions already offered)
std::string str;
//Continue grabbing text up until the first '#' is entered.
std::getline(cin, str, '#');
//Pass the string into your own custom function, to keep your function detached from the input.
countCharacters(str);

(See here for an example)


text:
Q: Why isn't "mingw32-make.exe" working in a makefile So I have these three files:
Linking.cpp:
#include "Liking.h"

int main()
{
    print();
}

Liking.h (I missed the "h" in the names of the files and I'm afraid to change it and got some problems):
#pragma once

void print();

liking2.cpp:
#include <iostream>
#include "Liking.h"
#include <string>

void print()
{
    std::string name;
    std::cout << "Insert your name: ";
    std::cin >> name;
    std::cout << "Your name is: " << name<< std::endl;
}

Now my question is about using makefile in order to link these .cpp files so I made one and it is this:
Linking: Linking.o liking2.o
    g++ Linking.o liking2.o -o Linking

Linking.o: Linking.cpp
    g++ -c Linking.cpp

Linking.o: liking2.cpp
    g++ -c liking2.cpp

clean:
    rm *.o Linking

But the problem comes (at least this is what I'm thinking I'm missing) when I try to use this beacuse I don't have any clues. The videos I've watched on youtube showed the "make" word but it doens't seem to work.  I've searched a lot and I found the "mingw32-make.exe" but when I open the make file in my Visual Studio code (By the way I'm also using windows) and use this command in the terminal I get this problem:
makefile:8: warning: overriding recipe for target 'Linking.o'
makefile:5: warning: ignoring old recipe for target 'Linking.o'
g++ -c liking2.cpp
g++ Linking.o liking2.o -o Linking
g++: error: Linking.o: No such file or directory
makefile:2: recipe for target 'Linking' failed
mingw32-make: *** [Linking] Error 1

Now I know that this kind of question is asked a lot (I know because I've searched) but the  only three question I saw that could clarify had all problems so they didn't help me at all:
Makefile --mingw32-make.exe
mingw32-make.exe : *** missing separator. Stop
mingw32-make.exe: *** [All] Error 2 - Codelite
If you guys could at least put me on the right path about what I'm missing that would be really helpful

A: Thanks to the explanations in the comments and also following their advice I'll post here the fixed code and I'll explain the differences:
Linking: Linking.o liking2.o
    g++ -o Linking Linking.o liking2.o

Linking.o: Linking.cpp
    g++ -c Linking.cpp

liking2.o: liking2.cpp
    g++ -c liking2.cpp

clean:
    rm *.o Linking

Now taking the answer from the question: makefile error no such file or directory I changed the second line of code where I moved the -o Linking to the beginning and also, as it was pointed out in the comments, I did a mistake in the seventh line where I used two recipes to the same target, don't do this with your makefile as well. These changes that I did were enough to make the makefile work and I hope that this answer will be able to help other people as well in the future and thank you for all for the help.


text:
Q: Can't compile because Visual Studio is using my DLL I have a rather large .NET 2.0 solution (151 projects) in Visual Studio 2008.  Often times when I do a build (even for just one project) in VS I get an error saying that it can't copy one of my DLL assemblies to the output directory because it is in use.  I don't have any other processes running in the background or existing debug sessions going that would be using this assembly.  If I open up Process Explorer and do a search for this assembly name Visual Studio (devenv.exe) comes up as the only result.  Looking at the results Visual Studio has my assembly loaded as a DLL for some reason.  Closing the solution and reopening it doesn't solve the problem.  I have to completely exit out of VS altogether to get around this issue which is quite disruptive.  Does anyone have any idea what is going on?  I'm running on Window 7, I don't think I saw this issue on Windows XP.
I am running Visual Studio 2008 Version 9.0.30729.1 SP.  I'm also running ReSharper 6 if that matters.

A:
Does anyone have any idea what is going on? I'm running on Window 7, I
  don't think I saw this issue on Windows XP.

I run into this problem all the time on Windows XP and its not even localized to Visual Studio 2008.  What always works for me is I simply clean all solutions, this gets rid of any file that might be in my system's memory, because of Visual Studio.
Visual Studio keeps any your references in memory, so when one of those references is updated, Visual Studio has to release it from memory.  If it really happens more then "once in awhile" then you might look at trying to reduce the number of solutions in your project.

A: Use the following command and place it in "Pre Build Events" of visual studio:
if exist "$(TargetPath).locked" del "$(TargetPath).locked"

Hope this would help you.

A: Try to disable the hosting process:
Open an executable project in Visual Studio. Projects that do not produce executables (for example, class library or service projects) do not have this option.

*

*On the Project menu, click Properties.

*Click the Debug tab.

*Clear the Enable the Visual Studio hosting process check box.

A: Kill process VBCSCompiler.exe and rebuild.

A: I would guess that the dll is being used by the (ProjectName).vshost.exe process. You might try killing that process and see if that works. Probably not the best thing to do, but it might be easier than restarting VS.

A: I would try the "Clean Solution" option before you build.  This can clean up any extraneous temp files that could be hanging around from a program crash.

A: I have no idea about why this works, but I had the same problem and when I changed the Starting Project to the project I wanted to build everything worked again.
When I change the Startup project again to the right one I cannot build the other project anymore due to the file being in use, so looks like a bug at the Visual Studio IDE.


text:
Q: How to include audio file in PDF How do I include audio file, or should I say, link to audio file in PDF?

*

*Audio should be playable "from
PDF directly", without opening
any additional window.

*Is it possible to attach audios to PDF
    then so I can manipulate only with
    that file, without being bothered
    with copying folders where those
    audio files would reside?

I saw that 1. is definitely doable (but don't know how) and I'm interested if second one is also possible (while compiling .tex file) since I know that some files (like graphs and tables) can be attached in PDF, but after it's generated.
 Button for playing audio from document that uses this trick.

A: Though suggested packages are very good, after quite of looking around, I've found attachfile the best for my purpose.

A: Try the multimedia package, which is part of the beamer distribution.  It's documented in Section 14.2 of the beamer 2.10 manual, and it does provide the ability to embed sound files into the pdf.  Not all sound formats are supported, and I'm sure not all pdf viewers can play sounds natively.  So YMMV.

A: The now obsolete movie15 package used to be a good choice. This package has been superseded by the media9 package. The manuals provide a variety of examples.


text:
Q: Representing a martingale as the conditional expectation w.r.t filtration?
Let $M_t$ be an $\mathcal{F}_t$ martingale such that $\sup_t E|M_t|^p < \infty$ for some $p>1$. Show there exists a $Y\in L^1(P)$ such that $M_t = E[Y|\mathcal{F}_t]$.

I am not sure how to answer this question.
The problem suggests using the result that: the condition in the problem implies the existence of a limiting random variable $M \in L^1(P)$ such that $M_t \to M$ almost surely and
$$\int |M_t - M|dP \to 0$$
as $t \to \infty$.
But I'm not sure how to represent $M_t = E[g(M)|\mathcal{F}_t]$ given the corollary doesn't tell us the relationship between $M_t$ and $M$ other than that they converge almost everywhere.

A: Since $(M_t)$ is a uniformly integrable martingale, it converges a.s. and in $L^1$ to some limit $M$. Then for any $F\in \mathcal{F}_t$ and $s>t$,
$$
\mathsf{E}[M_t1_F]=\mathsf{E}[M_s1_F]\to\mathsf{E}[M1_F].
$$
Therefore, $M_t=\mathsf{E}[M\mid \mathcal{F}_t]$ a.s.


text:
Q: push notification working in development profile but issue in distribution I have create two diffrent App id for development and distribution profile but facing an issue for get notification for distribution profile but its work on development profile. anyone give me check .pem file correct or not

A: I had issues with PEM´s without pass. Create them with a pass and try again.
If you have access to your server log, yo can check APNS server response, sometimes it gave clues on what is going on.
Also check if your devices´ tokens are correctly stored in server.

A: You need to check the following scenarios and execute.

*

*In the firewalls need to check the 2195, 2196 ports and also check gateway.sandbox.push.apple.com, gateway.push.apple.com

*Sign your application using distribution profiles and run the application in distribution mode. Make sure if you are running the application using distribution mode then in server side also should use distribution PEM files. I believe you are made the mistake in this scenario.


text:
Q: Can't change service folder name I am trying to rename a folder inside "inetpub/wwwroot/Services" folder. An error windows rises with message "the action cannot be completed because the file is open in another program". The insider program is executed only by a scheduled task which is active and ready but not running.
How to proceed?

A: Sorry. I resolved it. The folder was open by another user remotely connected to the computer.
Just got to close his session and Voilá!


text:
Q: Listview drag and drop has no visual highlight on the destination I'm new to a legacy win forms app. It has a list view with a files and folders structure. I want to allow the user to drag file/s to a folder. When I do it I want to find the destination (to do this I find the item at x and y) but to also give the user a visual representation that they are dropping it on a folder (like in windows explorer).

A: within private void myListView_DragOver(object sender, DragEventArgs e) I tweaked the code in your comment @HansPassant
var wPos = this.myListView.PointToClient(new Point(e.X, e.Y));
var targetItem = myListView.GetItemAt(wPos.X, wPos.Y);
if (targetItem != null)
{
      var targetNodeInfo = targetItem.Tag as WindowsExplorerModel;

      if (targetNodeInfo != null)               //if dropping on a target item
      {
           if (targetNodeInfo.isFile)
                e.Effect = DragDropEffects.None;//if IsFile
           else
           {
                foreach (ListViewItem listItem in myListView.SelectedItems)
                        listItem.Selected = false;

                targetItem.Selected = true;
                e.Effect = DragDropEffects.Copy;
            }
            return;
      }
}