text:
Q: How can I change the MTU of a Cisco Anyconnect VPN? On my macOS 10.15 I have to use the Cisco AnyConnect Secure Mobility Client 4.8 to connect to the VPN of my university.
The connection is much slower than usual, probably because the MTU of 1300 is set too low.
Using the command ifconfig, i get this information about the connection:
utun2: flags=80d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1300
    inet ###.###.##.## --> ###.###.##.## netmask 0xfffffe00
    inet6 ###::####:###:###:###%utun2 prefixlen 64 scopeid 0x10
    inet6 ###:####:#:#::### prefixlen 128
    nd6 options=201<PERFORMNUD,DAD>

(IP addresses have been anynomized with #)
How can I change this? I found nothing in the settings of the Cisco Client, not even in the configuration files.
A change in the system settings is of no use, via the terminal I tried the following:
sudo ifconfig utun2 mtu 1470
The correct value is then displayed using the ifconfig command, but the connection itself does not change (neither the speed, nor the MTU value displayed here https://www.speedguide.net/analyzer.php). After reconnecting, the MTU is again registered at 1300.
How can I change the MTU effectively and permanently?

A: Since VPN encapsulation adds additional overhead to packets, reducing Maximum Transfer Units below the standard 1500 byte ethernet frame MTU helps to ensure that encapsulated packets are not fragmented.
To check for packet fragmentation, ping with the "do not fragment" switch can be used.
On my version of ping, MacOS High Sierra, I can specify a sweep size with the following options:
nevin% ping -g 1200 -G 1500 -D <remote host>
This gives a result:

1472 bytes from x.x.x.x: icmp_seq=64 ttl=48 time=108.894 ms
556 bytes from 192.168.2.1: frag needed and DF set (MTU 1492)
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  5  00 d505 f712   0 0000  40  01 2739 192.168.2.111  x.x.x.x

My en0 MTU is 1500, but the response above is that my router has an MTU of 1492.
"Path MTU Discovery" will attempt to keep packet sizes below the  fragmentation threshold of any link between two hosts, though this works best when ICMP is not being blocked along the way.  (If you just begin to lose packets without any error messages, then ICMP is being blocked at some upstream point, and this might be the cause of your slow speeds:  The remote host might be sending packets > than your local MTU, but not getting errors to tell it to scale back.
In short, trying to increase the size of MTU will not improve your performance.


text:
Q: Inline Images are Broken I'm trying to send an email with an inline image.  I've set the Content-ID and added a  to my html.  The image arrives properly as an attachment, but mail clients show a broken image.
What am I doing wrong?  The full source of the message is below:
Return-Path: <igal@lucee.org>
Received: from 128.149.80.230
        by smtp.googlemail.com with ESMTPSA id i7sm9313707paf.9.2016.09.01.11.15.59
        for <igal@lucee.org>
        (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
        Thu, 01 Sep 2016 11:15:59 -0700 (PDT)
Date: Thu, 1 Sep 2016 11:15:54 -0700 (PDT)
From: igal@lucee.org
To: igal@lucee.org
Message-ID: <489410968.5.1472753755600.JavaMail.Admin@IS16>
Subject: [Test] LDEV-545 html 5.0.0.200
MIME-Version: 1.0
Content-Type: multipart/mixed;
    boundary="----=_Part_4_247149912.1472753754816"
X-Mailer: Lucee Mail

------=_Part_4_247149912.1472753754816
Content-Type: multipart/alternative;
    boundary="----=_Part_3_913848408.1472753754815"

------=_Part_3_913848408.1472753754815
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Text Message

------=_Part_3_913848408.1472753754815
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

Inline Image:

------=_Part_3_913848408.1472753754815--

------=_Part_4_247149912.1472753754816
Content-Type: image/jpeg; name=test-image.jpg
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename=test-image.jpg
Content-ID: image1@myemail

/9j/4AAQSkZJRgABAQEAYABgAAD/4QBoRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUA
AAABAAAARgEoAAMAAAABAAIAAAExAAIAAAARAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQu
bmV0IDQuMC4xMAAA/9sAQwAKBwcJBwYKCQgJCwsKDA8ZEA8ODg8eFhcSGSQgJiUjICMiKC05MCgq
NisiIzJEMjY7PUBAQCYwRktFPko5P0A9/9sAQwELCwsPDQ8dEBAdPSkjKT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09/8AAEQgAIgBDAwEiAAIRAQMRAf/E
AB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAE
EQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZH
SElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1
tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEB
AQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXET
IjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFla
Y2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXG
x8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A9mooqvNfQW95bWsj
kTXO7ylwfm2jJ57cU0m9gLFFUdK1qx1uGWXT5xMkUhif5SpDDtggetGnazY6sbkWM4l+yymGUgEB
WHXk9fqKt0pxveL038hcyL1FUdL1ix1mxN5YTrLbhmUvgjBHXrVaHxRpk80aRSzMkjiOOf7PJ5Ls
TgASbdpyenPNP2NS7XK9N9Ng5l3NeisuPxFZTXr2sK3cskc3kOyWkrIr9wXC7RjPXNalTKEofErA
mnsFFFFQMKwtX/5Gvw/9bj/0XW7RWlOfI7+TX3poTVzzLSGutB0y3uLBCzawJbUYHC3PnP5bn22s
2fZBV4xto9l4g03TR/pEs9vY22TglmgRdxPrjcxPtXfUV3SzDmk5OO++u+qav6JWMlSsrXOANlf2
iavpC2cdl/aViWtIYp/MG+NAjAHaOSu38iauyeI0a50eHSNRjRZJooJdOMI82Nf4s55XAGOldlij
AznHPrUPGRl8cP6tbqn2XnvrqP2bWzOK0C+trfXtTim1xLd31SULYsYx5pOADyN3J9D2rtqTFLXP
XrKrLmSt/Xoi4x5VYKKKKwKCiiigAooooAKKKKACiiigAooooA//2Q==
------=_Part_4_247149912.1472753754816--

A: I found the problem.  It is missing Content-Type: multipart/related;

redpajama_set_name: RedPajamaStackExchange


text:
Q: bibliography error when submitting to Scientific Reports journal I am submitting an article to Scientific Reports. I used overleaf to write the manuscript, with the SR template. Everything worked great. However, when I upload the main.tex file and the biblio.bib files to the platform, the bibliography does not show.
I am aware they are changing their submission system, but I must re-submit in the old one.
I do not have access to the compilation errors, since it is a submission platform that builds the pdf.
I was hoping someone had similar trouble and knows how to solve this problem.

A: I simply had to copy the contents of the .bbl file into the .tex file.


text:
Q: Case_when issue using sum to classify data - R/dplyr solution I'm probably doing something stupid here but would appreciate some help. I'm trying to classify some data that has been incorrectly filled in.
df <- data.frame(ID = c("A", "A", "A","A", "A", "B", "B", "B", "B", "B"),
                 headache_y_n = c("Yes", "Yes", "Yes", "No", "Yes", "No", "No", "No", "Yes", "No"),
                 headache_days =c("2", "2", "2", "2", "2", "1", "1", "1", "1", "1"))

I want to be able to say, if headache_y_n is yes more than 3 times, per ID, then it meets criteria of "prolonged", else it should be "short".
Therefore, I want the following output:
output <- data.frame(ID = c("A", "A", "A","A", "A", "B", "B", "B", "B", "B"),
                 headache_y_n = c("Yes", "Yes", "Yes", "No", "Yes", "No", "No", "No", "Yes", "No"),
                 headache_days =c("2", "2", "2", "2", "2", "1", "1", "1", "1", "1"),
                 criteria =c("prolonged", "prolonged", "prolonged", "prolonged", "prolonged", "short", "short", "short", "short", "short"))

My code is as follows:
library(dplyr)
df %>% group_by(ID) %>% mutate(criteria=case_when(
    sum(any(headache_y_n=="Yes") >= 3) ~ "prolonged",
    TRUE ~ "short"
))

Unfortunately it doesn't work and I get the following error:
Error: Problem with `mutate()` input `criteria`.
x LHS of case 1 (`sum(any(headache_y_n == "Yes") >= 3)`) must be a logical vector, not an integer vector.
ℹ Input `criteria` is `case_when(...)`.
ℹ The error occurred in group 1: ID = "A".

I'm not smart enough to figure out where I'm going wrong, hence why I'm asking kindly for your help!
Thanks!

A: The any and sum should be switched i.e. after grouping by 'ID', we are counting the number of 'Yes' i.e. the sum of logical expression (headache_y_n == 'Yes'), then create a second expression after the sum >=3, wrap it with any to match (probably not needed here as the sum is only a single value)
library(dplyr)
df %>%
     group_by(ID) %>%
     mutate(criteria=case_when(
        any(sum(headache_y_n=="Yes") >= 3) ~ "prolonged",
         TRUE ~ "short"
    ))

i.e. even if remove the any, it returns the same
df %>%
      group_by(ID) %>%
      mutate(criteria=case_when(
         sum(headache_y_n=="Yes") >= 3 ~ "prolonged",
          TRUE ~ "short"
     ))
# A tibble: 10 x 4
# Groups:   ID [2]
#   ID    headache_y_n headache_days criteria
#   <chr> <chr>        <chr>         <chr>
# 1 A     Yes          2             prolonged
# 2 A     Yes          2             prolonged
# 3 A     Yes          2             prolonged
# 4 A     No           2             prolonged
# 5 A     Yes          2             prolonged
# 6 B     No           1             short
# 7 B     No           1             short
# 8 B     No           1             short
# 9 B     Yes          1             short
#10 B     No           1             short


text:
Q: Kubernetes kubeconfig inside pod I am trying to create a deployment which is deployed on K8S instance on which it does migration of services. This needs kubeconfig as part of the code right now. We do not have access to create service accounts. We also have kubectl binary inside the container which does some operations. Whats the best way to take kubeconfig as input ?

A: Volume mount the kubeconfig that is in a Secret, and then point the KUBECONFIG environment variable at the path in which the Secret is mounted
kind: Secret
metadata:
  name: my-k-config
stringData:
  my-kubeconfig: |
     clusters:
     - ... etc etc
---
kind: Pod
spec:
  containers:
  - name: sample
    command: ["kubectl", "get", "namespaces"]
    env:
    - name: KUBECONFIG
      value: /k-cfg/my-kubeconfig
    volumeMounts:
    - name: k-config
      mountPath: /k-cfg
  volumes:
  - name: k-config
    secret:
      secretName: my-k-config


text:
Q: Text expansion in Diablo III fullscreen on OS X My usual text expander, Typinator, doesn't work when Diablo III is in fullscreen. How can I expand text in D3—is there anything built-in, or should another OS X text expansion utility work?

A: I've tried the trial version of TextExpander and it seems to work in StarCraft II in fullscreen.  I don't have Diablo III beta access so I can't truly say if it'll work… but since they're both Blizzard games, the chances are high.


text:
Q: Is it possible to alter the order of Controls being looped through in WinForms The following code loops through all controls in the current form and handles null values perfectly. My gripe with it is that it seems to follow the reserve of the tab order of the controls i.e. it starts with the last control and works it's way back to the first.
foreach (Control C in this.Controls)
{
    if (C.GetType() == typeof(System.Windows.Forms.TextBox))
    {
        if (C.Text == null || C.Text == string.Empty || C.Text == "")
        {
            setControlErrors(C, "This field cannot be empty, you must enter a value");
            return false;
        }
        else
        {
            errorProvider1.SetError(C, "");
        }
    }
    if (C.GetType() == typeof(System.Windows.Forms.ComboBox))
    {
        if(C.Text == null || C.Text == string.Empty || C.Text == "")
        {
            setControlErrors(C, "This field cannot be empty, you must select a value");
            return false;
        }
        else
        {
            errorProvider1.SetError(C, "");
        }
    }
}

How can I reverse this order easily? It seems weird to see validation errors in reverse order of the form layout. Changing the tab-index seems even worse than this.
Is there a better way to do this?

A: You can sort the controls by tab index like this
foreach (Control control in this.Controls.Cast<Control>()
                                         .OrderBy(c => c.TabIndex))
{
    //..
}

A: You can achieve using following code
        var controls = this.Controls.Cast<Control>()
                           .OrderByDescending(x => x.TabIndex);

        foreach (var control in controls)
        {
        }

A: How about this solution?
foreach (Control C in this.Controls.Cast<Control>().OrderBy(ctr => ctr.TabIndex))


text:
Q: Test Session for pallet Is there a way of testing pallet crates?  I am trying to build an elasticsearch crate but each time I want to test something is working I need to start a machine and wait for everything to install etc.  Possibly a way to just see what commands would be sent to the machine would be useful to start with and would provide a lot of insight.

A: I'm discussing this topic currently also. As I'm right, pallet translates config-actions from clojure to bash - right?
So the clojure part should be testable in the normal clojure way - I found these options valid:

*

*http://blog.jayfields.com/2010/08/clojuretest-introduction.html

*https://github.com/marick/Midje and

*a discussion comparing these
options: How do Midje and Speclj compare?
The translation to bash itself should be well tested in pallet project - so all units are covered.
But anyway I expect there many integration-test problems left - and at this point I haven't any good idea yet.
Okay - your comment made me find an example for testing in pallet (would be interested in your experience ;-)

*

*https://github.com/pallet/pallet/tree/develop/test/pallet/crate


text:
Q: How can I iterate over directories in the Windows command prompt? The Windows command prompt (cmd.exe) provides the FOR command. It can be used to do an operation for any file in a directory. Example:
\> dir
28.05.2012  18:25                69 buildall.bat
28.05.2012  07:48    <DIR>          include
28.05.2012  18:23    <DIR>          sub-607

\> for %d in (*.bat) echo %d

How can I do the same thing (non-recursively) with all subdirectories in a given directory? The idea is:
for %d in (sub-*) do (
  cd %d
  dosomething
  cd ..
)

The for statement above does not find sub-607 becauses it's not a file.

A: The for command can take the /D switch to iterate over subdirectories, rather than files.
for /D %d in (sub-*) do ...

See here for more information: http://ss64.com/nt/for_d.html


text:
Q: How to avoid overlap in widget inside GridView? The widget inside the gridView overlap each other , the bottom portion of the widget is overlapped by another widget , How to avoid overlap in  widget inside GridView?I want to avoid the overlap amoung the widget.
Here is my codes
It contain a gridview builder containing the widget, the widget is made by stack , position.fill
// ignore_for_file: prefer_const_constructors, prefer_const_literals_to_create_immutables

import 'package:flutter/material.dart';
import 'package:iconsax/iconsax.dart';

class WorkshopsCloseToYouPage extends StatelessWidget {
  const WorkshopsCloseToYouPage({super.key});

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: GridView.builder(
          itemCount: 6,
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 2, crossAxisSpacing: 4.0, mainAxisSpacing: 4.0),
          itemBuilder: (BuildContext context, int index) {
            return workshopCard();
          },
        ),
      ),
    );
  }

  Stack workshopCard() {
    return Stack(
      clipBehavior: Clip.none,
      children: [
        Container(
          width: 200,
          height: 200,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(20.0),
            image: DecorationImage(
              image: AssetImage('assets/workshop_image.png'),
              fit: BoxFit.cover,
            ),
          ),
        ),
        Positioned.fill(
          bottom: -100,
          child: Align(
            alignment: Alignment.bottomCenter,
            child: Card(
                margin: const EdgeInsets.all(5),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(16.0),
                ),
                child: Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: Column(
                    mainAxisSize: MainAxisSize.min,
                    children: [
                      Text(
                        "Pottery Throwing Taster Class",
                        style: TextStyle(fontWeight: FontWeight.bold),
                      ),
                      SizedBox(
                        height: 5,
                      ),
                      Row(
                        children: [
                          SizedBox(
                            width: 100,
                            child: Column(
                              children: [
                                Row(
                                  children: [
                                    Icon(
                                      Iconsax.location5,
                                      size: 16,
                                      color: Color(0xFF083AA9),
                                    ),
                                    SizedBox(
                                      width: 2,
                                    ),
                                    Text(
                                      "Honslow",
                                      // style: TextStyle(fontSize: 8),
                                    )
                                  ],
                                ),
                                SizedBox(
                                  height: 5,
                                ),
                                Row(
                                  children: [
                                    Icon(
                                      Iconsax.profile_2user,
                                      size: 16,
                                      color: Color(0xFF083AA9),
                                    ),
                                    SizedBox(
                                      width: 2,
                                    ),
                                    Text("1 to 15")
                                  ],
                                ),
                                SizedBox(
                                  height: 5,
                                ),
                                Row(
                                  children: [
                                    Icon(
                                      Iconsax.tag_right,
                                      size: 16,
                                      color: Color(0xFF083AA9),
                                    ),
                                    SizedBox(
                                      width: 2,
                                    ),
                                    Text("1 to 15")
                                  ],
                                ),
                                SizedBox(
                                  height: 5,
                                ),
                                Row(
                                  children: [
                                    Icon(
                                      Iconsax.star,
                                      size: 16,
                                      color: Color(0xFF083AA9),
                                    ),
                                    SizedBox(
                                      width: 2,
                                    ),
                                    Text("5(37)")
                                  ],
                                ),
                              ],
                            ),
                          ),
                          ElevatedButton(
                              onPressed: () {},
                              style: TextButton.styleFrom(
                                  minimumSize: const Size(70, 35),
                                  maximumSize: const Size(70, 35),
                                  backgroundColor: Color(0xFF0c3cac),
                                  foregroundColor: Colors.white,
                                  shape: RoundedRectangleBorder(
                                      borderRadius: BorderRadius.circular(20))),
                              child: Row(
                                children: [
                                  Padding(
                                    padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
                                    child: Text(
                                      "Join",
                                      style: TextStyle(
                                        color: Colors.white,
                                        fontSize: 12,
                                      ),
                                    ),
                                  ),
                                  Icon(size: 5, Icons.arrow_forward_ios),
                                  Icon(
                                      color: Color.fromARGB(255, 231, 227, 227),
                                      size: 5,
                                      Icons.arrow_forward_ios),
                                  Icon(
                                      color: Color.fromARGB(255, 181, 180, 180),
                                      size: 5,
                                      Icons.arrow_forward_ios),
                                ],
                              )),
                        ],
                      ),
                    ],
                  ),
                )),
          ),
        )
      ],
    );
  }
}

Output page showing the widget overlap


text:
Q: If $ E \rightarrow X $ is a covering, then $ |\pi_1 (X)|$ divides to $ \chi (E) $ I want to prove that no finite group acts free in $ \mathbb{R}^n $ in the process I found the following doubt:

How can you prove that: If $ E \rightarrow X $ is a covering, then $ |\pi_1 (X)|$ divides to $ \chi (E) $?


text:
Q: Copy just permissions and ownership from one tar file to another I have two tar files which are basically backups of my /data folder on android. The problem is the permissions and ownership of the files inside latest back-up is messed up. However the permissions in older tar is perfect.
I want a way to read permissions from old.tar and copy over the changes to latest.tar.
I tried extracting files to my own system using -p and --same-owner flag but the ownership changes to root instead of system because my computer doesn't have a user or group called system but my android phone does. I thought I'd extract the files, and write a script which uses stat and grep to read permissions and ownership and sets the permissions and ownerships of the files in latest.tar. But it doesn't seem to work that way. Can anyone give me some help on this issue.

A: I'm not sure Tar can do that.  It should be possible, though, to untar both backups (to different directories), then use something along the lines of
cd /mnt/oldbackup ;
find ./ -exec getfacl {} | setfacl /mnt/newbackup/{}

as the output of getfacl can be used as stdin for setfacl according to the manpage.

A: There is no way to put new meta data into a tar archive, but there is a way to extract just the meta data from a tar archive to the filesystem. Just call:
star -xp -meta < archive.tar

This will not create new files or overwrite file content but just restore the meta data from the archive to the files in the local filesystem. You most likely need -U in addition (see star man page) for "do it even though the file in the archive is not newer than the file on the filesystem".

A: The preferred answer doesn't work anymore (find -exec has changed syntax, and setfacl needs restore= parameter), and the use of find is no longer necessary.
You should do:
cd /mnt/oldbackup
getfacl -R . >/tmp/permissions
cd /mnt/newbackup
setfacl --restore=/tmp/permissions


text:
Q: JAVA how to find the target file path that a symbolic link points to? I'm trying to find a way in Java to figure out the file path that a symbolic link is pointing to.
We have a system that monitors a symbolic link folder, does some stuff based on the file name, deletes that symbolic link file.
What I need to do is figure out where each symbolic link file is pointing to so I can delete that file as well when the symbolic link.
This is using Java on a RHEL system.
Any guidance to API topics would be greatly appreciated. I'm hitting a wall on my searches.

A: https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#toRealPath-java.nio.file.LinkOption...-

Path toRealPath(LinkOption... options)
           throws IOException Returns the real path of an existing file. The precise definition of this method is implementation dependent but
  in general it derives from this path, an absolute path that locates
  the same file as this path, but with name elements that represent the
  actual name of the directories and the file. For example, where
  filename comparisons on a file system are case insensitive then the
  name elements represent the names in their actual case. Additionally,
  the resulting path has redundant name elements removed.
If this path is relative then its absolute path is first obtained, as
  if by invoking the toAbsolutePath method.
The options array may be used to indicate how symbolic links are
  handled. By default, symbolic links are resolved to their final
  target. If the option NOFOLLOW_LINKS is present then this method does
  not resolve symbolic links. Some implementations allow special names
  such as ".." to refer to the parent directory. When deriving the real
  path, and a ".." (or equivalent) is preceded by a non-".." name then
  an implementation will typically cause both names to be removed. When
  not resolving symbolic links and the preceding name is a symbolic link
  then the names are only removed if it guaranteed that the resulting
  path will locate the same file as this path.
Parameters: options - options indicating how symbolic links are
  handled Returns: an absolute path represent the real path of the file
  located by this object Throws: IOException - if the file does not
  exist or an I/O error occurs SecurityException - In the case of the
  default provider, and a security manager is installed, its checkRead
  method is invoked to check read access to the file, and where this
  path is not absolute, its checkPropertyAccess method is invoked to
  check access to the system property user.dir

Use the toRealPath() method from nio. The NO_FOLLOW_LINKS LinkOption does the opposite of what you are trying to do, so don't use it.
Path realPath = aFile.toPath().toRealPath()

Path realPath = aPath().toRealPath()

One gotcha with this, is that, unlike toAbsolutePath, toRealPath throws an IOException since it actually has to interact with the file system to find the real path.

A: java.nio.file.Files.readSymbolicLink might be what you need.


text:
Q: master page across multiple site collections I've got a branding feature, deployed in multiple site collections, including the master and system master pages.
The goal is that if a power user does some changes to one of these master pages, these changes are propagated throughout all site collections.
I've read some suggestions about using a module to deploy the pages centrally, but that still doesn't meet my requirements because file is unghosted when edited with SPD, and changes are not propagated.
Anyone has any deployment strategy suggestion to cater for this requirement?

A: The best approach is to use main master page (with only test pages attached) placed in a document library, and track changes to the file made using SPD and if any changes are made -  update ghosted master page in file system accordingly, all other master pages are deployed via modules and are ghosted versions of one in files system. After changing file system master page you need to make recycle of app pools to apply changes to all master pages.
Tracking changes can be implemented via event receiver. Making it a little configurable, you can use this approach with several master pages.

A: Just an idea... Maybe you could create a webpart that you deploy on central admin. This webpart has for example a combobox where you can select the masterpage. And when selected a new one, you change all sites in all sitecollections of the selected web application (or farm) to the selected masterpage.


text:
Q: Updated icon image won't show in document tab I just found DockPanel Suite and am learning to use it.
I downloaded v2.9 and am using it with C# in VS2013. I created a simple Windows Forms MDI app. It has one type of child form which is a simple form with only a rich text box control in it. I loaded a few of these as documents. I added an icon to the document's tab to indicate whether the rich text box text has been saved or not.
I change the tab icon anytime the user types in the rich text box through the use of the text_Changed event:
private void txtCode_TextChanged(object sender, EventArgs e)
    {
        //The text has changed, set the warning icon.
        this.Icon = MyApp.Properties.Resources.Warning;
    }

The problem I have is that the icon does not update when running at full speed. It updates fine when I am single stepping through the above event. It also updates fine when I load a file within the form's Load event;
private void frmCode_Load(object sender, EventArgs e)
    {
        //Get the full file path.
        string sFile = Path.Combine(cCoCoIDE.CodeBaseRootFolder, Path.GetFileNameWithoutExtension(cCoCoIDE.CodeBaseFile), this.Text);

        //Load the source file into the code window.
        //A few validations.
        //Make sure the file exists.
        if (File.Exists(sFile))
        {
            //File is there. Is it empty? Load only if not empty.
            if (new FileInfo(sFile).Length > 0)
            {
                txtCode.LoadFile(sFile);
                //I had to add the following because the text changed
                //event fires when I load the file and I need to start
                //off with the green checkmark icon.
                this.Icon = CoCoIDE.Properties.Resources.GreenChk;
            }
        }

    }

I tried the following after I change the icon (in the Text Changed event):
            this.ShowIcon = true;
            this.Refresh();
            this.Update();

Note: I tried these one at a time. The above is just a list of methods.
Can anyone help me with this? Thank you! SgarciaV

A: I found the solution. See here:
Dockpanel Suite: Image not updating


text:
Q: Azure virtual network for WebSite and VM I have a VM hosted in an azure and i use "Manage Acl" to filter the IP addresses that are allowed for access.
I need to allow a website hosted in the same azure account, and the same location (West Europe) to acces the VM.
I created a Virtual network, added the dns for the VM and the Website, which gives the VM this IP 10.0.0.5 and the Website this one 10.0.0.4 in the subnet 10.0.0.0/11.
Back to "Manage Acl" i gave access to the subnet and to the website like this :

The problem: The Website still can't access the VM ! am I doing something wrong ?
Thanks.

A: If the VM is still blocking the traffic from the website, it is possible that either your VM firewall is on the way or you are accessing the VM using its Public IP Address. If you want to achieve ACLs in the Virtual Network, the better feature to use is Network Security Groups.


text:
Q: facebook->getUser returns 0 I have a Facebook fan page and I want to check if the user visiting the page LIKES the page in order to show the content. It works when I am logged in as the administrator but when another account visits the page the facebook->getUser() always return 0
require 'src/facebook.php';

$facebook = new Facebook(array(
  'appId' => 'ID',
  'secret' => 'HASH',
  'cookie' => true,
));

$user = $facebook->getUser();

//Page id

$page = '215010578537112';

$likeID = $facebook->api(array( 'method' => 'fql.query', 'query' =>
'SELECT uid  FROM page_fan WHERE uid =' . $user . 'AND page_id =' .$page ));

if ( $likeID ) {

}else{

}

A: Try this version, you shouldn't need anything special to check if they like your page:
// find out if the user likes the page or not
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);

// content to show if they don't like the page
if (empty($data["page"]["liked"])) {
?>

Not a fan

<?php
// content to show if they do like the page
} else {

Is a fan

A: Since this is a fan page, you don't need to call an FQL query, since an FQL query requires that the user has first authorized your application.  Facebook will send a signed_request post parameter to your iframe fan page.  See this answer on how to decode that signed_request parameter and check to see if they are a fan of your page or not.


text:
Q: $\sum _{n=1}^{\infty } \frac{1}{n (n+1) (n+2)}$ Understand the representation $$\sum _{n=1}^{\infty } \frac{1}{n (n+1) (n+2)}$$=$$\frac{1}{2} \left(-\frac{2}{n+1}+\frac{1}{n+2}+\frac{1}{n}\right)$$
$$s_n=\frac{1}{2} \left(\left(\frac{1}{n+2}+\frac{1}{n}-\frac{2}{n+1}\right)+\left(\frac{1}{n-1}-\frac{2}{n}+\frac{1}{n+1}\right)+\ldots +\left(1 \frac{1}{1}-\frac{2}{2}+\frac{1}{3}\right)+\left(\frac{1}{2}-\frac{2}{3}+\frac{1}{4}\right)+\left(\frac{1}{3}-\frac{1}{2}+\frac{1}{5}\right)+\left(\frac{1}{4}-\frac{2}{5}+\frac{1}{6}\right)+\left(\frac{1}{5}-\frac{1}{3}+\frac{1}{7}\right)+\left(\frac{1}{6}-\frac{2}{7}+\frac{1}{8}\right)\right)$$
Im sorry for not being able to get the term in right order, but as you can see the first two terms in the parenthesis should be the last for a accurate representation.
$$\left(
\begin{array}{cc}
 1 & 1-1+\frac{1}{3} \\
 2 & \frac{1}{2}-\frac{2}{3}+\frac{1}{4} \\
 3 & \frac{1}{3}-\frac{1}{2}+\frac{1}{5} \\
 4 & \frac{1}{4}-\frac{2}{5}+\frac{1}{6} \\
 5 & \frac{1}{5}-\frac{1}{3}+\frac{1}{7} \\
 6 & \frac{1}{6}-\frac{2}{7}+\frac{1}{8} \\
\end{array}
\right)$$
I think that my pure understanding of the representation is what makes me confused. From the table I see that a pattern in the denominators emerge, when n=1, then (1-2+3), when n=2 then, 2-3+4. However given the part of sn where $$\frac{1}{n-1}-\frac{2}{n}+\frac{1}{n+1}$$ I fail to see how the first part of expression right above  is not undefined when n=1.
I am convinced that it is my lack of knowledge of what the representation actually means. And I am also struggling to see what cancels to give$$\frac{1}{2} \left(\frac{1}{n+2}-\frac{1}{n+1}+\frac{1}{2}\right)$$
However given that this is true I am able to understand that the answer is (1/4). But as I said it is the representation I do not get. Could someone help me as this would be very useful for my next chapter in my textbook!

A: Hint: We are finding
$$\sum_1^\infty \frac{1}{2}\left(\left(\frac{1}{n}-\frac{1}{n+1}\right)-\left(\frac{1}{n+1}-\frac{1}{n+2}\right)               \right).$$

A: Your diagram is perfect. All these cancel.. It's a telescoping sum

A: You should write: (define $s_n$ as the sequence of partial sums of the series)
$s_n=\sum _{k=1}^{n} \frac{1}{k (k+1) (k+2)}$
$=\sum _{k=1}^{n} {\frac{1}{2} \left(-\frac{2}{k+1}+\frac{1}{k+2}+\frac{1}{k}\right)}$
$=\frac{1}{2}\left(-2\sum_{k=1}^{n}\frac{1}{k+1}+\sum_{k=1}^{n}\frac{1}{k+2}+\sum_{k=1}^{n}\frac{1}{k}\right)$ because the sums are finite. Observe then that the three sums overlap on most terms.
$=\frac{1}{2}\left(-2\sum_{k=2}^{n+1}\frac{1}{k}+\sum_{k=3}^{n+2}\frac{1}{k}+\sum_{k=1}^{n}\frac{1}{k}\right)$ by just rewriting the sum.
$=\frac{1}{2}\left(\left(-2\sum_{k=3}^{n}\frac{1}{k}-2\cdot\frac{1}{2}-2\frac{1}{n+1}\right)+\left(\sum_{k=3}^{n}\frac{1}{k}+\frac{1}{n+1}+\frac{1}{n+2}\right)+\left(\sum_{k=3}^{n}\frac{1}{k}+\frac{1}{1}+\frac{1}{2}\right)\right)$ by just rewriting the sum again.
$=\frac{1}{2}\left(-2\cdot\frac{1}{2}-2\frac{1}{n+1}+\frac{1}{n+1}+\frac{1}{n+2}+\frac{1}{1}+\frac{1}{2}\right)$ by cancelling terms.
$=\frac{1}{2}\left(-\frac{1}{n+1}+\frac{1}{n+2}+\frac{1}{2}\right)$ by cancelling terms.
Then only now, can you consider taking the limit $n\to\infty$.
Maybe you are not understanding the $\sum$ operator.
$\sum_{k=1}^{n} \frac{1}{k(k+1)(k+2)}$ is exactly $\frac{1}{\underline{1}(\underline{1}+1)(\underline{1}+2)}+\frac{1}{\underline{2}(\underline{2}+1)(\underline{2}+2)}+\dots+\frac{1}{\underline{n}(\underline{n}+1)(\underline{n}+2)}$ by definition.
And $\sum_{k=1}^{\infty} \frac{1}{k(k+1)(k+2)}$ is exactly $\lim_{n\to\infty} \sum_{k=1}^{n} \frac{1}{k(k+1)(k+2)}$ by definition.
More Examples
$$\sum_{k=1}^n a_{k+1}=a_2+a_3+\dots+a_{n+1}=\sum_{k=2}^{n+1} a_k \quad (Eq1)$$
In general, we have $\sum_{x\in S} f(x)$, which means "take all the distinct values in a finite set $S$, apply $f$ to each of them, and sum the results up". Note the results may not be distinct.
Now we can write $\sum_{k=1}^n f(k)=\sum_{k\in\mathbb{Z}\cap[1,n]} f(k)$.
If $g$ is an injective function on $S$ (distinct inputs give distinct outputs), then
$$\sum_{x\in S} f(x)=\sum_{y\in g(S)} f(g^{-1}(y))\quad\text{, also}\quad\sum_{x\in S} f(g(x))=\sum_{y\in g(S)} f(y)$$
where $g(S)$ are all the outputs of $g$ given inputs in $S$, and $g^{-1}$ is the function which takes as input an output of $g$ and returns the input which gave that output (this is the inverse function).
So in (Eq1), we are taking $g$ to be $k\mapsto k+1$, and $S=\mathbb{Z}\cap[1,n]$. Hence $g(S)=\mathbb{Z}\cap[2,n+1]$.
Of course, you have the distributive rule: $\sum_{x\in S}af(x)=a\sum_{x\in S}f(x)$ (use induction).

A: $\dfrac{1}{n(n+1)(n+2)} = \dfrac{1}{2n(n+1)} - \dfrac{1}{2(n+1)(n+2)}$
therefore,
$$\sum_{n = 1}^{\infty} \dfrac{1}{n(n+1)(n+2)} = \dfrac{1}{2*1*2} = \dfrac{1}{4}$$
we used the telescoping series formula $\sum_{n=1}^\infty (f(n) - f(n+1)) = f(1) - \lim_{n \to \infty} f(n)$


text:
Q: Cannot execute procedure in oracle 10g says Table or View does not exist I have an Oracle database which was already created and designed by someone else previously, in my company. My problem is that some procedures are not executing. I'm getting the error:

Table  or procedure or view does not exist

But, I can see those procedures from Toad. I already tried to grant some privileges from sysdba, the result is the same; I get the same error.
Any help would be highly appreciated.


text:
Q: Liouville function and perfect square Let $n \in \mathbb{Z}$ with $n > 0$. Let $F(n) = \sum_{d \mid n} \lambda(d)$. Prove that $$F(n) = \begin{cases}1, \quad \text{if }n \text{ is a perfect square}\\ 0, \quad \text{otherwise} \end{cases} $$
By the Fundamental Theorem of Arithmetic, all $d$'s admit a prime factorization $d=p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k}$ for primes $p_i$ and nonnegative integers $a_i$. So $\lambda(d)=\lambda(p_1^{a_1}p_2^{a_2}\cdots p_k^{a_k})$. Now the idea is that all the divisors will cancel in pairs of $1$ and $-1$ when $n$ is a perfect square, except the divisor $1$, and so the sum will total $1$. How do I prove this rigorously? If I just choose a generic divisor and write it's prime factorization I don't find anything I can generalize. Can you help?

A: You can prove it using "multiplicative" property and it's simple but I just solved it without it and I believe that it's much more beautiful.
Consider $$n=p_{1}^{a_1}  p_2^{a_2} ... p_k^{a_k}$$
So $\Omega(n)=\sum a_i$ and $\lambda(n)=(-1)^{\Omega(n)}$
Now $$\sum_{d|n}\lambda(d)=\sum_{d|n}(-1)^{\Omega(d)}$$
So it's suffices to calculate $D$; the difference of the number of divisor with even $\Omega$ and odd $\Omega.$
Now consider $f(x)=(1+x+x^2+...+x^{a_1})(1+x+x^2+...+x^{a_2})...(1+x+x^2+...+x^{a_k}) $
The coefficient of $x^r$ in above expansion is equal to the number of solutions of this equation:
$$x_1+x_2+...+x_k=r $$
$$0 \le x_i \le a_i$$
which is the number of divisors of $n$ with $\Omega$ equals to $r$.
Hence, $f(-1)=D.$
But $f(-1)$ is $0$ if at least one of $a_i$ is odd and $f(-1)=1$ if $n$ is a perfect square. $Q.E.D$

As a second solution:
It's easy to check $\lambda=1_{Sq}*\mu $
$[$ Actually the summation has only one term.$]$
Now convolve both sides with the $1$ function [which is inverse of $\mu$]
$$ \lambda * 1=1_{Sq}*\mu*1=1_{Sq} $$
.


text:
Q: Intermittent Validation Problems using ServiceSttack I'm using ServiceStack to build an API and at the same time, I'm using the plugin that allows Razor views to return html to browsers.
I have validation set up and configured correctly. I know this because I get the validation messages on the corresponding Razor view and the messages are accurate. However, if I modify the Razor view at all (and by "at all" I mean something as simple as adding a line break and then immediately deleting it), I get a 500 error accompanied by a blank page.
Other times, while in the process of simply refreshing the page to review styling of the Razor view, the validation simply returns a blank page with the same non-useful 500 error. And of course, if I remove the validation, the Razor view renders just fine 100% of the time.
What must I do to have validation working at all times? My code is straight forward and matches everything that I've been able to read in the Docs. Namely, both the response and the requests are in the same namespace and the validator is coded to the request.
Here is the request DTO
namespace MyServer.DTO
{
    [Validator(typeof(SignUpValidator))]
    [Route("SignUp")]
    public class SignUp : IReturn<SignUpResponse>
    {
        public string UserName { get; set; }
        public string Email { get; set; }
        public string EmailConfirm { get; set; }
        public string Password { get; set; }
        public string PasswordConfirm { get; set; }
        public int UserId { get; set; }
    }
}

Here is the corresponding validator
namespace MyServer.DTO
{
    public class SignUpValidator : AbstractValidator<SignUp>
    {
        public SignUpValidator()
        {
            RuleSet(ApplyTo.Post, () =>
                {
                    RuleFor(e => e.UserName).NotEmpty();
                    RuleFor(e => e.Email).NotEmpty();
                    RuleFor(e => e.EmailConfirm).NotEmpty();
                    RuleFor(e => e.Password).NotEmpty();
                    RuleFor(e => e.PasswordConfirm).NotEmpty();
                }
            );
        }
    }
}

Here is the response
namespace MyServer.DTO
{
    public class SignUpResponse
    {
        bool DidSucceed { get; set; }
        int NewUserId { get; set; }
        public ResponseStatus ResponseStatus { get; set; }
    }
}

And lastly, here is the code that configures the validation plugin
        Plugins.Add(new ValidationFeature());
        Container.RegisterValidators(typeof(SignUpService).Assembly);

As you can see, everything is pretty vanilla and by the book, but this setup is very fragile for some reason. Any modification to the corresponding Razor view and I get the aforementioned errors. Then I have to recompile repeatedly until it works again.
I should also mention that, if I use the REST Console (google chrome extension thingy) to test this, I get the following results when posting to the exact same URI:

*

*Content-Type set to : application/json - Everything works as intended. 400 Response with the errors listed in the response body.

*Content-Type set to : application/html - Consistently breaks. 500 Response with no data in the response body.

There must be something that I'm missing.
Thanks so much for your time and I would appreciate any help.
Thanks again.


text:
Q: Dual Monitors - One Graphics card vs Two I have a Dell Optiplex 790 with two Radeon HD 5450 cards (512MB Dedicated Memory) installed. Currently, I'm running two monitors off a single card.
Card 1-->HDMI Splitter-->Monitor 1
                    |---> Monitor 2
Card 2-->*Empty*

Looking in the machine itself, I cannot see any Crossfire bridge cable (I'm expecting an additional cable between the two cards), nor even ports on the cards to allow crossfire to be hooked up. Also, in the Catalyst Control Center I cannot see any checkboxes that allow enable/disabling of Crossfire (something I've read should be present when the cards are capable of being crossfired).
On that basis, I suppose I have two queries:

*

*First - Am I reading this correct that the cards are not Crossfired?

*Second - Is it more beneficial to run my two monitors from a card each, or is there no difference from running them both off the same card?

A:
First - Am I reading this correct that the cards are not Crossfired?

To establish if you are using CrossFire, you should be able to do this from within the Catalyst Control Center, as you state yourself. Without that, you can safely assume that CrossFire isn't available at the moment, regardless of why.

Second - Is it more beneficial to run my two monitors from a card each, or is there no difference from running them both off the same card?

There's no noticeable difference, although in some cases with, say SLI, you'll be forced to setup a certain configuration of connected displays to actually use said technologies. For instance, with SLI (and CrossFireX), and a seperate-displays configuration, you connect your monitors to one card. That one card can be considered the "master", whilst the other card will participate in the rendering of frames and calculations - like PhysX-related computations.
It is worthwhile to mention a few of the typical requirements here:

*

*Amount of memory should be the same on all GPUs

*

*Anything above the lowest denominator will not be used, as the memory is shared between all cards.

*All displays must be connected to the "master" card

*

*This means that your secondary card - unless you're perhaps using NVIDIA Surround - will not have any displays connected. If displays connected to your secondary card work, then SLI/CrossFireX is not enabled.

*[SLI] The same GPU-series must be used, as it is dependent on the same architecture

*The data bus for your PCI express lane will be a deciding factor, so make sure you don't throttle your secondary card, as it'll reduce the performance.

Then, if you use NVIDIA Surround with SLI, you might be forced to employ a configuration like this.

Basically, depending on what features you use, the configurations you can employ will wary. To repeat regarding your question, I don't have accurate information on whether or not it could be, but whenever you're using CrossFireX or SLI, it is not possible to connect your displays to your secondary card, basically.


text:
Q: HTML entities inside script tag not converted?
First

Second

Third: <span>blah<span>

Demo: http://jsfiddle.net/LPYTZ/
Why is the first result different? Are


text:
Q: PHP function/method returning boolean result and a status message I have a class with methods that need to return their result status (true|false) and also return a status message ("It worked/did not work because of x...").
Here are the two approaches I've tried...
Approach # 1: Return boolean and pass message by reference
Example of function:
function do_something ($arg1, $arg2, &$message) {

  ... do stuff resulting success...

  // Give an explanation for why it succeeded... reasons could be varied:
  $message = 'It succeeded and here are your instructions for celebrating: ...';
  $success = true;

  ... do stuff resulting in failure...

  // Give an explanation for why it failed... reasons could be varied:
  $message = 'it failed because of so and so...';
  $success = false;

  return $success;
}

Example of call:
$message = '';
if ( do_something($arg1, $arg2, $message) ) {
  echo "It succeeded because $message.";
} else {
  echo "It failed because $message."
}

Approach # 2: Return a Result object
Example of function:
function do_something ($arg1, $arg2) {

  ... do stuff...

  // Give an explanation for why it succeeded... reasons could be varied:
  $message = 'It succeeded and here are your instructions for celebrating: ...';
  $success = true;

  ... do stuff...

  // Give an explanation for why it failed... reasons could be varied:
  $message = 'it failed because of so and so...';
  $success = false;

  return new Result($success, $message);
}

You can imagine what the class definition of Result would like like, so I'll spare the example.
Example of call:
$message = '';
$DoSomething = do_something($arg1, $arg2, $message);
if ( $DoSomething->success ) {
  echo "It succeeded because ". $DoSomething->message;
} else {
  echo "It failed because ". $DoSomething->message;
}

What is the best approach and why?

A: I would go with returning an associative array with two elements:
return array('result' => true, 'message' => 'The operation executed fine!')

or
return array('result' => false, 'message' => 'The operation failed because...')

This way client code would access the values this way:
$retval = do_something();
if($retval['result']){
    //...
}
else{
echo 'Ooups: ', $retval['message'];
}

Or, if you need these result values throughout many modules of your code I would go with approach #2 "Return a Result object", because by using this approach the data is more encapsulated.
Personal opinion:
I definitely wouldn't use references in PHP, I just don't feel them in this language.

A: If you want to really do OOP here is what you should use
class Test
{
    private static $err;

    public static function do_something ($arg1, $arg2)
    {
        $bool = rand(0,1); //Just for testing

        self::$err = $bool ? 'It succeeded and here are your instructions for celebrating: ...' : 'it failed because of so and so...';

        return $bool;
    }

    public static function get_error ()
    {
        return self::$err;
    }
}

Test::do_something(0, 0);
printf(Test::get_error());


text:
Q: App hangs while calculating the duration of media file I am trying to calculate the duration of a media file and updating the list upon retrieval.
I am using asyncTask for calculating the duration.
But app hangs for the duration till it is calculating the size. Why is it happening? Is there a better approach?
My async task is:-
    ew LongOperation().execute(mFileMang.getCurrentDir()+"/" + mDataSource.get(position));
 private class LongOperation extends AsyncTask<String, Void, String> {

     @Override
     protected String doInBackground(String... params) {

            MediaPlayer mp = MediaPlayer.create(mContext,  Uri.parse(params[0]));
            long duration = mp.getDuration();
            mp.reset();
            mp.release();

               String finalTimerString = "";
               String secondsString = "";
               String minutesString = "";
               // Convert total duration into time
               int hours = (int)( duration / (1000*60*60));
               int minutes = (int)(duration % (1000*60*60)) / (1000*60);
               int seconds = (int) ((duration % (1000*60*60)) % (1000*60) / 1000);
               // Add hours if there
               if(hours > 0){
               finalTimerString = hours + ":";
               }

               // Prepending 0 to seconds if it is one digit
               if(seconds < 10){
               secondsString = "0" + seconds;
               }else{
               secondsString = "" + seconds;}

               if(minutes < 10){
                   minutesString = "0" + minutes;
               }else{
                   minutesString = "" + minutes;}

               duration_video = finalTimerString = finalTimerString + minutesString + ":" + secondsString;

               return null;
     }

     @Override
     protected void onPostExecute(String result) {

           //might want to change "executed" for the returned string passed into onPostExecute() but that is upto you
     }

     @Override
     protected void onPreExecute() {
     }

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

}

A: AsyncTask should not be used for long operations (no more then 2 to 3 seconds).
I don't know if this is the case but since you called your task LongOperation I assume it is running longer.
You can find more info about it Here


text:
Q: symfony 2 number and date format I am developing a multi country multi language application and one of the issues I have are the decimal point separator and the date format. I am aware of the setLocale method, but the only changes I have seen are in translations. Do I have to use PHP's built in setlocale method to format the number and date correctly or is there another way?
Also, numbers (money) are stored in database MySQL, should I use a datatransformer at the form fields with using the locale or will they be handled automatically by symfony?

A: Check out the Twig International extension
For number format there is number_format however you may have to build your own extension to use NumberFormatter

A: I recommend to create custom Twig Extension with PHP intl. You can take a look into my answer to similar question.
namespace Acme\Bundle\DemoBundle\Twig;

class IntlExtension extends \Twig_Extension
{

    public function getFilters()
    {
        return array(
            new \Twig_SimpleFilter('intl_day', array($this, 'intlDay')),
            new \Twig_SimpleFilter('intl_number', array($this, 'intlNumber')),
        );
    }

    // Other methods…

    /**
     * NULL locale cause load locale from php.ini
     */
    public function intlNumber($number, $locale = NULL)
    {
        $fmt = new \NumberFormatter($locale, \NumberFormatter::DECIMAL);
        return $fmt->format($number);
    }

    public function getName()
    {
        return 'intl_extension';
    }
}

Then in your Twig template you can use:
{{ entity.number_value|intl_number(app.request.locale) }}

or if you use Symfony < 2.1 app.session.locale

A: Numbers and Money in forms
For numbers and money in form fields symfony has already a number and a money form type which handles the decimal point and grouping depending on the locale.
Number and Date formatting on output
Normally you format a date (in twig) with the date filter like mydate|date("m/d/Y") But you can set it for the complete twig environment, so you only have to call mydate|date. But this is only recommended, if the locale requirements are static for the complete application and not dynamically based on the users locale. For this you should consider a twig extension which @jkucharovic and @Kris have posted.


text:
Q: How to merge external audio track with internal audio track from video file using FFmpeg We have this multimedia files:

*

*a video video.mp4

*

*video track 0

*audio track 0 is audio we don't want

*audio track 1 is audio we want

*an audio audio.mp3 track

How to use ffmpeg with this video and

*

*just put there audio.mp3

*and mix it with audio track 1 of this video, because we don't want audio track 0 of this video

And in final to have output.mp4 where:

*

*Video is video.mp4

*audio track 1 from video.mp4 + audio.mp3. Audio as one track, merged, mixed.

A: Use
ffmpeg -i video -i audio -filter_complex "[0:a:1][1:a]amix[a]" -map 0:v -c:v copy -map "[a]" -c:a aac output.mp4

The amix filter will mix the 2nd audio track of the video with the audio of the 2nd input. Duration of audio will be same as duration of the longer audio track in the mix.


text:
Q: addEventListener click is immediately disappearing after KeyPress For some reason I can not get it to work, after clicking enter on the keyboard the new input shows up for less than a millisecond and then disappears
 <!DOCTYPE html>

        <title>Simple Register Form with JavaScript</title>

        <form>
            <input type="text" class="regFname" placeholder="First name: ">
            <button>Register</button>
        </form>

Current Users

and here is the JavaScript
var inputFname = document.querySelector(".regFname");
var button = document.querySelector("button");
var ul = document.querySelector("ul");

function inputLength() {
    return inputFname.value.length;
}
function add() {
    var li = document.createElement("li");
    li.appendChild(document.createTextNode(inputFname.value));
    ul.appendChild(li);
    inputFname.value = "";
}
function addUserAfterClick() {
    if (inputLength() > 0) {
        add();
    }
}
function addUserAfterKeyPress(event) {
    if (inputLength() > 0 && event.keyCode === 13) {
        add();
    }
}
button.addEventListener("click", addUserAfterClick);
inputFname.addEventListener("keypress", addUserAfterKeyPress);

A: Just add type="button" in your html. If not specified it behaves as type="submit"

var inputFname = document.querySelector(".regFname");
var button = document.querySelector("button");
var ul = document.querySelector("ul");

function inputLength() {
  return inputFname.value.length;
}

function addUser() {
  if (inputLength() > 0) {
    var li = document.createElement("li");
    li.appendChild(document.createTextNode(inputFname.value));
    ul.appendChild(li);
    inputFname.value = "";
  }
}
button.addEventListener("click", addUser);
<form>
  <input type="text" class="regFname" placeholder="First name: ">
  <button type="button">Register</button>
</form>

Current Users


text:
Q: Page factory initiation is not working returns java.lang.IllegalStateException: Unable to load cache item in appium When I try to access my page objects I'm getting below error.
My AbstractRepo.java class:
public static WebDriver driver;

    public AbstractRepositary(WebDriver driver) {
        this.driver = driver;
        //PageFactory.initElements(driver, this);
      PageFactory.initElements(new AppiumFieldDecorator(driver), this);
    }

**
 - *Enumerator.java*
**
public class Enumerator extends  AbstractRepositary{
    public static Enumerator enumerator = null;
    public Enumerator(WebDriver driver) {
        super(driver);
        PageFactory.initElements(new AppiumFieldDecorator(driver), this);
    }

Output exception are :
    java.lang.IllegalStateException: Unable to load cache item
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:372)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:380)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:376)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:376)
    at net.sf.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:376)
    at net.sf.cglib.proxy.Enhancer.getMethods(Enhancer.java:540)

A: This issue got resolved but removing selenium-client from pom.xml as java-client internally calls Selenium.'
Refer: https://github.com/appium/java-client/issues/949


text:
Q: How to get values from different table and pass it to a trigger? i have 3 tables:
event:
---------------------
event_id | uid | date
---------------------

event_invitees
----------------------
invitees_id | event_id
----------------------

notification
-----------------
uid | invitees_id
-----------------

i have created one trigger which will insert into 'notification' table after insert on 'event_invitees'
delimiter |
create trigger eventNotificationTrigger after insert on event_invitees
for each row
begin
declare id int(12);
set id = (select uid from event where event_id=new.event_id);
insert into notification (invitees_id,uid) select invitees_id,@id from event_invitees where event_id=new.event_id;
end;
|

But it is not able to fetch uid from the event table. So how to fetch different values from different tables and insert them to one table in trigger?

A: Remove the @
insert into notification (invitees_id,uid)
select invitees_id, @id from event_invitees where ...
                    ^-------------------------------------here

Variables you create with declare won't be referenced with @. Only the one's you create with set. Example:
declare id int(12);
select 1 into id;
select id;

set @id = (select 1);
select @id;


text:
Q: TypeError: Cannot read property 'jwtoken' of undefined at Authenticate I am trying to authenticate the user using jwt and found this error. This is a MERN project and I had to verify the user whose data I have stored in MongoDb before showing a secret page.
Other errors which VSCode is highlighting are:
1.When I hover on ._id (authentication.js)
const rootUser=await User.findOne({_id:verifyToken._id,"tokens.token":token})

Property '_id' does not exist on type 'string | JwtPayload'.
2.When I hover on req.rootUser(app.js)
res.send(req.rootUser)

Property 'rootUser' does not exist on type 'Request<{}, any, any, ParsedQs, Record<string, any>>
My code looks as follows:
app.js
const mongoose = require('mongoose')
const dotenv = require('dotenv')
const bcrypt = require('bcryptjs')
const jwt=require('jsonwebtoken')
const app = express()
const router = express.Router();
const port = 5000
const authenticate=require("./middleware/authenticate")

dotenv.config({ path: './config.env' })
const DB = process.env.DATABASE;
app.use(express.json());
const User = require('./model/userSchema')

mongoose
  .connect(DB, {
    useUnifiedTopology: true,
    useNewUrlParser: true,

  })
  .then(() => console.log('Database connected.'))
  .catch(err => console.log(err));

app.get('/', (req, res) => {
  res.send('Hello World!')
  console.log("hey")
})
app.post('/register', async (req, res) => {
  const { name, email, work, phone, password, cpassword } = req.body;
  if (!name || !email || !work || !phone || !password || !cpassword) {
    return res.status(422).json({ error: "Form Not Properly Filled" });
  }
  try {
    const userExist = await User.findOne({ email: email })
    if (userExist) {
      return res.status(422).json({ error: "Email ALready Exists" })
    }
    else if (password != cpassword) {
      return res.status(422).json({ error: "Password does not match" })
    }
    else {
      const user = new User({ name, email, work, phone, password, cpassword })
      await user.save()
      res.status(201).json({ message: "user registered successfully" })
    }

  } catch (error) {
    console.log(error);
  }

})

//login route
app.post('/signin', async (req, res) => {
  try {

    let token;

    const { email, password } = req.body;
    if (!email || !password) {
      return res.status(400).json({ error: "Please fill the data correctly" })
    }
    const userLogin = await User.findOne({ email: email })
    console.log(userLogin);

    if (userLogin) {
      const isMatch = await bcrypt.compare(password, userLogin.password)
      token = await userLogin.generateAuthToken();
      console.log(token)

      res.cookie("jwtoken",token,{
        expires:new Date(Date.now()+25892000000),
        httpOnly:true

      })
      if (!isMatch) {
        res.status(400).json({ error: "Invalid Credentials" })
      }
      else {
        res.status(200).json({ message: "Login Success" })
      }
    }
    else {
      res.status(400).json({ error: "Invalid Credentials" })
    }

  } catch (error) {
    console.log(error)
  }
})

//about page request

app.get('/about',authenticate,  (req, res) => {
  console.log("About")
  res.send(req.rootUser)
})
app.get('/forget', (req, res) => {
  res.cookie("harsh","test")
  res.send('Forget World!')
})

app.listen(port, () => {
  console.log(`Example app listening at http://localhost:${port}`)
})

authenticate.js
const User=require("../model/userSchema")

const Authenticate=async (req,res,next)=>{
try {
    console.log(req.cookies)
    const token=req.cookies.jwtoken;
    console.log("below")
    const verifyToken =jwt.verify(token,process.env.SECRET_KEY)
    console.log(verifyToken)
    const rootUser=await User.findOne({_id:verifyToken._id,"tokens.token":token})
    if(!rootUser){
        throw new Error("User Not Found")
    }
    req.token=token;
    req.rootUser=rootUser;
    req.userID=rootUser._id;
    next();
} catch (error) {
    res.status(401).send('Unauthorized : No token provided')
    console.log(error)
}
}
module.exports=Authenticate;

userSchema.js
const mongoose=require('mongoose')
const bcrypt=require('bcryptjs')
const jwt=require('jsonwebtoken')

const userSchema=new mongoose.Schema({
     name:{
         type:String,
         required:true,
     },
     email:{
        type:String,
        required:true,
    },
    phone:{
        type:String,
        required:true,
    },
    work:{
        type:String,
        required:true,
    },
    password:{
        type:String,
        required:true,
    },
    cpassword:{
        type:String,
        required:true,
    },
    tokens:[
        {
            token:{
                type:String,
                required:true,
            }
        }
    ]
})

userSchema.pre('save' , async function(next){
    console.log("inside hash")
    if(this.isModified('password')){
        this.password=await bcrypt.hash(this.password,12)
        this.cpassword=await bcrypt.hash(this.cpassword,12)
    }
    next();
})

userSchema.methods.generateAuthToken = async function(){
    try {
        let token =jwt.sign({_id:this._id},process.env.SECRET_KEY)
        this.tokens=this.tokens.concat({token : token})
        await this.save();
        return token
    } catch (error) {
        console.log(error)
    }
}

const User=mongoose.model('USER',userSchema);
module.exports=User;

A: 1. GENERATE JWT TOKEN WHEN USER LOGIN
Generate Token and Send this token with a response...
    router.post("/login", async (req, res) => {
      try {
        // checking username
        const user = await User.findOne({ email: req.body.email });
        !user && res.status(401).json("Wrong Username");

        // checking password
        const bytes = CryptoJS.AES.decrypt(user.password, process.env.SECRET_KEY);
        const originalPassword = bytes.toString(CryptoJS.enc.Utf8);

        // If password not match return respond
        originalPassword !== req.body.password &&
          res.status(401).json("Wrong Password");

        // Creating Json Web Token

        const accessToken = jwt.sign(
          { id: user._id, isAdmin: user.isAdmin },
          process.env.SECRET_KEY,
          { expiresIn: "5d" }
        );

        // stop sending password to respond
        const { password, ...info } = user._doc;

        // Returning User(info) , also sending accessToken
        res.status(200).json({ ...info, accessToken });
      } catch (err) {
        res.status(500).json(err);
      }
    });

2. VERIFY TOKEN MIDDLEWARE
Create this verify token function use as a MIDDLEWARE in your routes...
const jwt = require("jsonwebtoken");

function verify(req, res, next) {
  const authHeader = req.headers.token;
  if (authHeader) {
    const token = authHeader.split(" ")[1];
    jwt.verify(token, process.env.SECRET_KEY, (err, user) => {
      if (err) res.status(403).json("Token is not valid");
      req.user = user;
      next();
    });
  } else {
    return res.status(402).json("You are not authorized");
  }
}

module.exports = verify;

3. VERIFY-IN ROUTES AS AN MIDDLEWARE
const verify = require("../verifyToken");

// CREATE
router.post("/", verify, async (req, res) => {
  if (req.user.isAdmin) {
    const newList = new List(req.body);
    try {
      const savedList = await newList.save();
      res.status(201).json(savedList);
    } catch (error) {
      res.status(500).json(err);
    }
  } else {
    res.status(403).json("You are not allowed!");
  }
});

// DELETE
router.delete("/:id", verify, async (req, res) => {
  if (req.user.isAdmin) {
    try {
      await List.findByIdAndDelete(req.params.id);
      res.status(201).json("The list has been deleted");
    } catch (err) {
      res.status(500).json(err);
    }
  } else {
    res.status(403).json("You are not allowed!");
  }
});

CONCLUSION:-

*

*Create a token with jwt.sign when user login...

*Create a verify function in the root directory export this function...

*Require this function in routes file use as a middleware...


text:
Q: Overriding @property declarations in Objective-C I often find that I know that a certain property of a base class will always be a certain type in a subclass.  For instance, in the example below, property obj will always be an NSString object in Derived.  However, I need this property to be the more generic id type in class Base.
@interface Base
@property (strong, nonatomic) id obj;
@end

@implementation Base
//@synthesize obj = obj_;
@dynamic obj;
@end

@interface Derived : Base
@property (strong, nonatomic) NSString *obj;
@end

@implementation Derived
@synthesize obj = obj_;
@end
Is this code correct?  I am concerned that @synthesize appears twice.  Is this creating two properties, or does the @synthesize declaration in Derived override the one in Base?
Edit: Changing @synthesize to @dynamic in Base makes more sense.
Edit: This requires iOS SDK 5.

A: Subclasses can change types associated with methods. In general, a subclass may specialize a return type, and may make argument types more generic. There's actually a name for this but I can't remember what it is. Anyway, here's the rational:
Return types
If I have a class
@interface A
- (id)foo;
@end

and another class
@interface B : A
- (NSString *)foo;
@end

And I have an instance B* b, I can cast it down to A* and still conform to the type signature of the method -[A foo], because any NSString* is also an id.
However, I cannot make this more generalized. If instead I have
@interface A
- (NSString *)foo;
@end

@interface B : A
- (id)foo;
@end

And I have an instance B* b and I cast it down to A*, then the type of [(A*)b foo] is NSString * and yet the actual value may be any id, because that's the type I declared -[B foo] to be. This is a violation of the type system.
Arguments
If I have a class
@interface A
- (void)foo:(NSString *)obj;
@end

and another class
@interface B : A
- (void)foo:(id)obj;
@end

And I have an instance B* b and I cast it down to A*, then any valid argument to [(A*)b foo:obj] also conforms to the type of -[B foo:], because any NSString * is also an id.
However if I have the following
@interface A
- (void)foo:(id)obj;
@end

@interface B : A
- (void)foo:(NSString *)obj;
@end

And I have an instance B* b and I cast it down to A*, then I could pass any id to [(A*)b foo:obj], but the underlying class B only expects NSString*s. And thus I've violated the type system.
Properties
Here is the sticky point. When you declare the type of a property, you're declaring both the return type of the getter and the argument type of the setter. According to the above rules, this means you cannot change the type of a property, because in one of the two cases you'll be violating the type system.

The above is the theory. In practice, I have no idea if GCC or Clang enforce these constraints. It's possible that they assume the programmer knows best, and improperly generalizing or specializing a type will silently break the type system behind your back. You'll have to experiment. But if the compiler is truly correct then it will disallow generalizing return types and specializing arguments. And that means it will disallow changing the type of a property.
Even if the compiler allows it, you probably shouldn't do it. Silently breaking the type system is a great way to introduce bugs, and an indicator of poor architecture.

A: You actually can't do that. For me I receive an error
property 'obj' attempting to use ivar 'obj_' declared in super class of 'Derived'

so I think It is obvious. And even if you not using @synthesize and defining functions yourself, then only Derived version is called (there is no such thing like function overloading or virtual functions in ObjC).
You have to review your class design.


text:
Q: How to combine two vectors in a data frame I am not able to combine two vectors like these
Height    Sex
178         M
167         M
183         M
...

Height    Sex
165         F
161         F
174         F
...

I would like to combine in a data frame like this
Height    Sex
178        M
161        M
174        M

Thanks

A: You should use dput() on your vectors so that we understand more about the code behind them. Currently your data looks like it is contained within two data frames each with two columns (height and sex), as opposed to two vectors.
If the data is indeed within two data frames, you can combine them using rbind() as per Alice's suggestion.


text:
Q: foreach query from two tables I'm trying to get log info for a google chart from two tables. Both have time stamps. When I do I'm getting the correct columns but the data from one table is all the same. (ts, mfz_temp & mfz_hum)
Both tables update every minute with the current time, temperature and humidity. They may be a few seconds apart. The times do not need to match right to the second but should be within a minute or two of each other.
 foreach($db->query("SELECT mfz.ts, mfz.temp, mfz.hum, mcl.temp, mcl.hum
                     FROM mfz, mcl
                     WHERE mfz.ts >= DATE_SUB(NOW(),INTERVAL 2 HOUR)
                     ORDER BY mfz.ts")
                     as $row)

This is what I'm getting.
ts                  | mfz_temp | mfz_hum | mcl_temp | mcl_hum
--------------------------------------------------------------
2016-07-06 08:06:27 | 22       | 69      | 23       | 53

2016-07-06 08:06:27 | 22       | 69      | 26       | 49

2016-07-06 08:06:27 | 22       | 69      | 23       | 60

2016-07-06 08:06:27 | 22       | 69      | 25       | 51

2016-07-06 08:06:27 | 22       | 69      | 24       | 52

2016-07-06 08:06:27 | 22       | 69      | 26       | 46

2016-07-06 08:06:27 | 22       | 69      | 26       | 47

2016-07-06 08:06:27 | 22       | 69      | 25       | 49


text:
Q: Browser behavior with huge doms Can anyone speak to how the different browsers handle the following:
Picture an HTML document essentially rendering content of a static app with lots of data.

        ...

...

...

    ...

Imagine O(1000) such elements in the document.
What's the fastest way to assign a click event to all of these elements?

*

*

*$('.abundant_class').click(function(foo();));

*$('div').click(function(){if ($(this).hasClass('abundant_class')){foo();}

*something else?

I'm wondering specifically how much memory and CPU these choices incur.
Thanks in advance.
Trevor Mills

A: In cases like this use .live() or .delegate(), where you shift the load from initial binding to event bubbling (which happens anyway), like this:
$('div.abundant_class').live('click', function() {
  foo();
});

This binds one event handler to document and listens for the click event to bubble up and acts upon that, if the element the event bubbled from matches the selector.
As per the comment discussion, here's the very optimized version:
$(document.body).delegate('div.abundant_class', 'click', function() {
  foo();
});


text:
Q: Is there a connection between $\zeta(-1)$ and Ramanujan's calculation of the sum over $\mathbb{N}$? Let me elaborate a little on the matter that I've been mulling over for a little while. This essentially concerns the summation of $1+2+3+...$, how it equals $-1/12$ (in a certain sense, obviously not normal circumstances), and how this seems to strangely coincide with the Riemann zeta function at $s=-1$.
I'm essentially concerned over whether this is a coincidence, or if there's something deeper at play here. It would certainly strike me as one heck of a coincidence.
I'll elaborate a bit for those unfamiliar with these matters...

The Value of $\zeta(-1)$:
We know, for $s \in \mathbb{C}$, with $Re(s)>1$, we can define the Riemann zeta function by
$$\zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}$$
This can be analytically continued to the entirety of the complex plane, giving a definition of the function for $Re(s)<1, s\neq1$:
$$\zeta(s) = 2^s \pi^{s-1} \sin\left(\frac{\pi s}{2} \right) \Gamma (1-s) \zeta(1-s)$$
Through this and the known result $\zeta(2)=\pi^2/6$ we can see that
$$\zeta(-1) = 2^{-1} \pi^{-1-1} \sin\left(\frac{\pi (-1)}{2} \right) \Gamma (1-(-1)) \zeta(1-(-1)) = \frac{1}{2} \left( \frac{1}{\pi^2} \right)(-1)(1)\left(\frac{\pi^2}{6}\right)=\frac{-1}{12}$$
We also know that people - often mistakenly - claim $1+2+3+4+...=-1/12$ through this result, since the summation of the natural numbers appears if you plug in $s=-1$ into the original sum, $\sum n^{-s}$.
This obviously isn't true - mistake aside, at least in what we consider the "usual topology of $\mathbb{R}$", the summation $1+2+3+...$ doesn't converge in

*

*The limit of its partial sums (which are the triangle numbers)

*The limit of the averages of its partial sums (Cesaro summation)

*Through Abel summation (per Wikipedia - I don't really know of this myself)

...and apparently a number of other summation methods (again, according to Wikipedia; I'm only familiar with the first two methods). Yet, interestingly...

Ramanujan's Summation of $1+2+3+...$:
Now, we know that in, the usual sense, we cannot assign a value to an obviously divergent series. For example, we cannot say $\sum a_n = x$ if this summation is divergent, and then perform manipulations on that as if it had a value, and try to deduce whatever $x$ is.
This doesn't always have to hold, just in the sense of the usual topology of the real numbers. (At least, this is what I was told by Thomas Andrews in the comments of an semi-related question here - related in the sense that it dealt with an "obviously divergent" product. I honestly don't know much about topologies.) I take this to mean that we can assign values to these "obviously divergent in the usual sense" summations, but it changes the context, the framework in which we're working.
So Ramanujan was essentially doing that, in a certain sense - implicitly considering an alternate topology of the reals, in which the summation over the naturals could be assigned a value $c$, i.e.
$$c = \sum_{n=1}^\infty n = 1+2+3+4+...$$
and then manipulating $c$ to try and determine its value. (At least, that's what he might have been doing, I'm not sure. He could've just been ignoring the topologies altogether and just seeing what he could do. Either way...)
Subtracting $4c$ from $c$, he obtained
$$-3c = 1-2+3-4+5-6+...$$
This summation is the expansion of the power series for $(1+x)^{-2}$ and thus, taking $x=1$, Ramanujan obtains
$$-3c = \frac{1}{(1+1)^2} = \frac{1}{4} \;\;\; \Rightarrow \;\;\; c = \frac{-1}{12}$$

So, The Question, and What I've Found:
So, by using the zeta function, we can show that $\zeta(-1) = -1/12$. Erroneously, people claim this as the sum of the natural numbers, but interestingly enough, Ramanujan showed that, if you can assign the divergent sum of the naturals a value, then it coincidentally is $-1/12$.

So, is there a connection between the Riemann zeta function - in particular its value at $s=-1$ - and Ramanujan's method of summing over the naturals? Is a mere coincidence? And in particular, why does Ramanujan's summation yield the same result?

I'm not really sure where to begin looking into this. Ramanujan's summation introduces the notion of a different topology on the reals, but I've never had a proper introduction into topology so I'm a bit loathe to go into learning a whole subject to understand a connection that might not even exist.
I did find that a Wikiepdia article on the summation $1+2+3+...$ kinda touches on a possible connection but I don't really buy it. (In the section on zeta function regularization, it suddenly starts considering the Riemann zeta function instead of the summation which seems more like a "similar but related" thing than establishing a proper connection.)
I mean, I understand where we're coming from in zeta function regularization, and I can sort of see it. We consider the summation over the naturals as a special case of the Riemann zeta function, then associate the value of the summation with the value of the zeta function there, or its analytic continuation if applicable. I can get that.
But it doesn't answer what I feel is the heart of my question:

I think more than anything, my big question is... Ramanujan's method relied nothing on "regularization" or "zeta functions" or any of this higher level stuff. He just assumed the summation had a value, and manipulated the summation to find that value. Yes, it broke some assumptions about the topology of the reals - that I myself don't understand well - yet somehow got the same answer that this regularization and all that would. How is it right? What is the connection?

The "obviously wrong" method somehow got the right answer. I mean, sure, it's right in the sense of the topology of the reals in which these manipulations are valid, but it's wrong in the usual sense. Yet it achieves the right answer.
So I think my biggest question is why it's correct. Coincidence? Perhaps the zeta function relies on likewise assumptions of topology that I've just not known about? I'm not really sure where to go from here; as it is my research is already broaching topics I know little to nothing about.

A: Well, "Ramanujan summation" usually refers to something else entirely, so let's not use that phrase here. Alternate topologies on the real numbers are another red herring; they're not relevant to this discussion. We're not evaluating the limit of a sequence of partial sums in any topology. With that stuff out of the way...
There are multiple ways to compute $\zeta(-1)$. You've outlined using the functional equation to relate it to $\zeta(2)$. But the more relevant method is in the Wikipedia article:
$$-3\zeta(-1)=\eta(-1)=\lim_{x\to 1^-}\left(1-2x+3x^2-4x^3+\cdots\right)=\lim_{x\to 1^-}\frac{1}{(1+x)^2}=\frac14$$
where $\eta$ is the Dirichlet eta function, not to be confused with the unrelated and better-known Dedekind eta function.
This is a direct analogue to what Ramanujan wrote in his notebook:
$$-3c=1-2+3-4+\mathrm{\&c}=\frac{1}{(1+1)^2}=\frac14$$
Imagine, for the sake of argument, that Ramanujan's intention is in fact to compute $\zeta(-1)$. Then every single step in his computation of "$c$" corresponds to a step in the computation of $\zeta(-1)$, just with the variables $s$ and $x$ elided. And the computation of $\zeta(-1)$ is rigorous; each step is justified in the Wikipedia article, which I'll quote for completeness:

Where both Dirichlet series converge, one has the identities:
$$
\begin{alignat}{7}
\zeta(s)&{}={}&1^{-s}+2^{-s}&&{}+3^{-s}+4^{-s}&&{}+5^{-s}+6^{-s}+\cdots& \\
2\times2^{-s}\zeta(s)&{}={}&  2\times2^{-s}&&  {}+2\times4^{-s}&&{} +2\times6^{-s}+\cdots& \\
\left(1-2^{1-s}\right)\zeta(s)&{}={}&1^{-s}-2^{-s}&&{}+3^{-s}-4^{-s}&&{}+5^{-s}-6^{-s}+\cdots&=\eta(s) \\
\end{alignat}
$$
The identity $(1-2^{1-s})\zeta(s)=\eta(s)$ continues to hold when both functions are extended by analytic continuation to include values of $s$ for which the above series diverge. Substituting $s = −1$, one gets $−3\zeta(−1) = \eta(−1)$. Now, computing $\eta(−1)$ is an easier task, as the eta function is equal to the Abel sum of its defining series, which is a one-sided limit.

And that explains why Ramanujan's manipulation yields the same value as $\zeta(-1)$.
Perhaps the most obscure step in the argument is the usage of Abel summation to evaluate a Dirichlet series. The reference to Knopp justifies that step better than I would be able to. Beyond that, I'm not sure what else you're likely to object to. Feel free to ask about any particular step!


text:
Q: Custom alert for ReplayKit screen capture My App uses ReplayKit for screen recording. It shows the below permission alert when RPScreenRecorder.shared().startCapture() is called. Is it possible to change the text content in the alert?

Allow screen capture in <App_Name>?
This application will capture your screen and you will not have a chance to review it.


text:
Q: What does the following UDP connection mean? What does the following entry mean?
Is that mean someone has connected to the server from this IP or somthing else?
Nov 23 15:33:54 www-prod-2 snmpd[1573]: Connection from UDP: [66.151.147.194]:47011->[xxx.xxx.xxx.xxx]:161

A: This looks like a connection or connection attempt from ip 66.151.147.194 to the SNMP port of the Computer. SNMP uses Port 161 (TCP/UDP).

Simple Network Management Protocol (SNMP) is a popular protocol for
  network management. It is used for collecting information from, and
  configuring, network devices, such as servers, printers, hubs,
  switches, and routers on an Internet Protocol (IP) network.

https://technet.microsoft.com/en-us/library/cc776379%28v=ws.10%29.aspx
If you have no idea what it is, then you better check your server's configuration for SNMP service and make sure it is secured or properly configured.


text:
Q: Unable to sendEmail using firebase cloud function Unable to sendEmail after firestore document creation. I am trying to send a notification email to webapp admin's email once the document on firestore is created. However facing following issues.
index.js
const functions = require('firebase-functions');
const admin = require("firebase-admin")
const nodemailer = require('nodemailer');

admin.initializeApp()

//google account credentials used to send email
var transporter = nodemailer.createTransport({
    host: 'smtp.gmail.com',
    port: 465,
    secure: true,
    auth: {
        user: '*****@gmail.com',
        pass: '******'
    }
});

exports.sendEmail = functions.firestore
    .document('stories/{sId}')
    .onCreate((snap, context) => {

        const mailOptions = {
            from: `*******@gmail.com`,
            to: snap.data().email,
            subject: 'contact form message',
            html: `
Order Confirmation

                                   Email: ${snap.data().email}

`
        };

        return transporter.sendMail(mailOptions, (error, data) => {
            if (error) {
                return res.send(error.toString());
            }
            var data = JSON.stringify(data)
            return res.send(`Sent! ${data}`);
        });

    });

Firebase Functions logs
*sendEmail
Billing account not configured. External network is not accessible and quotas are severely limited. Configure billing account to remove these restrictions
sendEmail
Function returned undefined, expected Promise or value*
I am assuming it is safe to ignore the Billing message in logs as it is not mandatory to have a billing plan ?
Any help would be much appreciated.

A: The error message is telling you that your code returned something other than a promise or value as required.  The problem is the way you're using transporter.sendMail().  According to the nodemailer documentation, sendMail will only return a promise if you don't pass a callback method (which you are doing) otherwise it returns undefined.  So your function is returning undefined.
What you should do instead remove the callback parameter and instead handle the results from the returned promise.  You can also return the promise from the function.
    return transporter.sendMail(mailOptions)
    .then(data => {
        // decide what you want to do on success
    })
    .catch(err => {
        // decide what you want to do on failure
    });


text:
Q: App working as expected in API 29, but not in API 33 I've built a simple app that uses the Azure Communication Service to call the echo test account.
When I test the app in the emulator with virtual device using API 29, I can connect, hear a message, record my response, and hear it played back - all is good.
When I test the app in API 33, the app seem to connect to the service ok (I get status changes from the API from connecting, to ringing to connected), I can then see the mic icon show up briefly on the top right corner, but immediately closes and I don't hear anything on the "call"
I am struggling to find out what may be the cause or how to troubleshoot. looging at logcat, I can see the following (last message repeats continuously)-

I tried to look up the errors but couldn't find anything I understood. any thoughts on what it might be or how to troubleshoot further?
(this is my first time using Android Studio)

A: Following the helpful guidance from Morrison Chang in the comments I updated the Azure Communication Service SDK to version 2.2.0 and it now works on Android API 33 as well.