text:
Q: Unhandled Runtime Error TypeError: posts.map is not a function I am learning nextjs and decides to follow the [build reddit clone tutorial] I found on Youtube, however I kept on running into
posts.map is not a function

please help me out.
Thanks in advance.
(I'm a complete noob in frontend so please teach me like I'm a kid & please let me know what other things I should put here)
the video:
https://youtu.be/W8IK3MeJ5H0?t=6319
Problem
import Post from '../common/Post'
import Vote from './Vote'

const Feed = ({posts}) => {
    return (

            {posts.map((post, id) => ( //<----this is the prob
                 <Post {...post} key={id} />
            ))}

    )
}

And this is Post.js:
import Vote from '../feed/Vote'
import Actions from '../feed/Actions'
import Info from '../feed/Info'

const style = {
  post: 'flex flex-col space-y-1 cursor-pointer',
  wrapper: 'flex space-x-3 rounded bg-[#1a1a1b]/80 p-2 border border-[#343536]',
  postTitle: 'text-lg font-medium text-[#D7DADC]',
  postContent: 'text-sm font-light text-[#D7DADC]/80 '
}

const Post = ({id, title, author, content, upvotes, downvotes}) => {

  console.log({upvotes})

  return (

      <Vote upvotes={upvotes} downvotes={downvotes} />

        <Info author={author}/>

{title}

{content}

        <Actions/>

  )
}

export default Post

Error
Error message:
Unhandled Runtime Error
TypeError: posts.map is not a function

Error Message Image: https://i.stack.imgur.com/HvINN.png
Attempt Fix 1:
I tried using Object.keys, even though the page could load there will be no data presented. The data should be send from supabase.
const Feed = ({posts}) => {
    return (

            {Object.keys(posts).map((post, id) => (
                 <Post {...post} key={id} />
            ))}

    )
}

Error Image: https://i.stack.imgur.com/1NlJd.png
Possible Fix but not sure:
I saw some posts from stackoverflow saying the first step is to initialise posts as an array and should be set as
const [posts, setPosts] = useState([]);

I don't really know where to place it and if that works the same if the data is exported externally. (and if the data is in a array)
The post: (Cannot fix "Uncaught TypeError: posts.map is not a function" error)
This is my data in supabase:
https://i.stack.imgur.com/BdOaG.png
This is what I'm expecting to render:
https://i.stack.imgur.com/TuCRQ.png
(I know following tutorials is bad but I use it to learn a few tricks and the correct usage of it, I'm already 4 hours in so I'm trying to resolve this error)
Edit

Index.tsx: this is where Feed is used

const Home: NextPage = () => {

  const {currentUser,fetcher} = useContext(RedditContext)

  const [myPosts, setMyPosts] = useState([])

  const {data,error} = useSWR('/api/get-posts',fetcher, {refreshInterval: 200})

  //update or inset new
  const saveAndUpdateUser = async() =>{
    if (!currentUser) return

    await supabase.from ('users').upsert({ //add to database update that user
      email: currentUser.user_metadata.email,
      name: currentUser.user_metadata.full_name,
      profileImage: currentUser.user_metadata.avatar_url,
    })
  }

  useEffect(()=>{
    if (!data) return

    setMyPosts(data.data)
  },[data])

  useEffect(()=>{
    saveAndUpdateUser()
    console.log('save user')
  },[currentUser])

  return (
  <>
    {currentUser? <HomePage myPosts={myPosts}/> : <Login/>}
    {/* if login cool lets see post if not go login */}
    </>
    )
  }

const HomePage = (myPosts) => {
return(

  <Banner />

      <CreatePost />
      <Feed posts={myPosts} /> //<--this is where Feed is used

      <About />

)

}
export default Home

A: The issue is due to const HomePage = (myPosts). Component functions accept the  object usually called props, which contains data passed as an attributes. So in your case myPosts is the object that looks like {myPosts: [...]} instead of what you are expecting, the plain array.
To fix an issue you need either to rename myPosts to props (naming convention) and call <Feed posts={props.myPosts} /> (<Feed posts={myPosts.myPosts} /> without renaming), either to use destructuring and use const HomePage = ({myPosts}).


text:
Q: Rails: how to redirect to a url (as a query string param) with query string Say id = 1, redirect_url = www.example.com?a=1&b=2&c=3
And I want to append these two to a path /index
And when I perform a get request to index, I would want to perform some checks and ultimately redirect to the redirect_url.
However, a problem with this is the appended path is :/index?id=1&redirect_url=www.example.com?a=1&b=2&c=3
And there is no way for Rails to tell if a, b, c is a query string of the redirect_url.
Is there any smart way to do it so that a,b,c automatically becomes the query string of the redirect_url?

A: If a, b and c are query string params and Id is URL id, you can pass like this
example_path(your_id, :a => params[:a], :b => params[:b], :c => params[:c])

becomes
/example/your_id?a=1&b=2&c=3

redpajama_set_name: RedPajamaStackExchange


text:
Q: Call generic method for std::variant There are two classes with methods f() under the same name and signature:
struct A {
    void f() {}
};
struct B {
    void f() {}
};

Is it possible having a std::variant<A, B> v to call this method with a single expression instead of std::visit?
Like v->f()?
Note: the question is specifically about std::variant. NOT about how to solve this particular task with without it (e.g. inheritance).

A: You seem to be worried about the number of characters you have to type. Minimizing typing is not a design goal of the language. std::visit is the way to do what you want. And because this is the way there is no reason to provide a different way that would achieve the same.
If you want the same with less typing you can always write a custom function:
void f(auto& v) {
     std::visit( [](auto& x) { x.f(); },v );
}

Then you can call it via f(v);. Its not exactly the desired v->f(); but actually it has less characters to type.

PS: If this is for code golf, I want to refer you to this answer I wrote https://codegolf.stackexchange.com/a/251154/114229. It is discussing the trade off between adding some code to make certain expressions shorter (the answer is specifically about using #define but the same considerations apply to writing a function).
PPS: If this is not for code golf, I want to remind you that code is written only once, but read many times. Everybody can read std::visit(...) and there is plenty of documentation on how it works and what it does. There is zero documentation for the function f above and it has a really poor name. Readability is more important than faster typing.


text:
Q: UIImagePickerController image nil for .mov files I am using an UIImagePickerController, which is working fine for images made with the iPhone camera, but info[UIImagePickerControllerOriginalImage] is always nil for movies (.mov) also created with the iPhone camera.
The picker is presented here:
self.imagePicker.sourceType = .photoLibrary
if let mediaTypes = UIImagePickerController.availableMediaTypes(for: .photoLibrary) {
    self.imagePicker.mediaTypes = mediaTypes
}
self.present(self.imagePicker, animated: true, completion: nil)

Here the simple UIImagePickerControllerDelegate implementation:
extension MyTableViewController: UIImagePickerControllerDelegate {
    public func imagePickerController(_ picker: UIImagePickerController,
                                      didFinishPickingMediaWithInfo info: [String: Any]) {
        // ...
        print(info[UIImagePickerControllerEditedImage])
            // prints nil
        print(info[UIImagePickerControllerOriginalImage])
            // prints nil for .mov files
        print(info[UIImagePickerControllerMediaURL])
            // prints the correct file url in file://var/.../*.mov
}

I am on a real device, iOS11.2.


text:
Q: List Property Setter When implementing a setter for a List property (in C#) is it a bad thing to write is as:
    private List<string> _TheList = new List<string>();
    public List<string> TheList
    {
        get { return _TheList; }
        set { _TheList = value; }
    }

Should it not be written as:
    private List<string> _TheList = new List<string>();
    public List<string> TheList
    {
        get { return _TheList; }
        set { _TheList = new List<string>(value); }
    }

Up until today I have typically used the former, but I recently found some code that was using the latter and it seemed that this is probably the correct way to implement this.
Won't using the former cause the TheList property to be changed when changes are made to the external list that gets assigned to it. For example:
List<string> list = new List<string>();
list.Add("Hello");

var c = new someClass();
c.TheList = list;

Using the former won't the following code break the encapsulation of TheList:
list.Clear();

Now c.TheList is also empty, which may not be what we wanted. However, using the latter approach, c.TheList would not be cleared.

A: Collection properties should be readonly.
Your property should expose a Collection<T>, not a List<T>.
EDIT: Explanations:
If other code copies a reference to the list (eg, var list = Thingy.TheList), it can get messed up if you set the property to a different list.  (It will end up holding an orphan)
In general, there are very few reasons to allow people to make a property point to a different collection instance.
Using Collection<T> instead of List<T> allows you to intercept changes to the collection and add validation or maintain parent fields.  (by inheriting Collection<T> and overriding InsertItem and other methods) You can even add such logic after shippinga library without breaking calling code.

A: I believe since a list is a reference object, all you need to do is get the reference.  So:
   private List<string> _TheList = new List<string>();
public List<string> TheList
{
    get { return _TheList; }
}

Once you have the reference, and make changes to the collection, you're changing _TheList

A: It completely depends on how you want your property to operate. If you want a copy, make a copy. Otherwise, don't. Often times properties like that won't expose a setter at all, since replacing the entire list isn't a desired action for that case.
Of course, using your second method is potentially a performance pitfall, since the property syntax hides the fact that you're completely copying and creating a new list every time you use the setter.

A: First off, both are somewhat incorrect. Public properties should really be exposed as IList since List is implementation specific (fxcop will actually warn you when using List as a public property).
Second, if possible I would have the setter be private.  Using the getter a user can still Add/Remove/Clear/etc. but simplifies the issues you raised in your question.

A: I do not think there is a universal answer to your question. The behavior you describe may or may not be what you want.
In general I agree with SLaks that it is cleaner to keep the collections properties read-only but it all depends

A: I am not sure I understood correctly. But i am doing it like that:
c.TheList = list.ToArray().ToList();


text:
Q: Gaussian Density Function with features that may have zero standard deviation I am trying to create an anomaly detection code using features that sometimes have constant values and therefore do not fall in a normal distribution curve.  For example, if I am looking at tcp traffic coming from a particular port . If my sample observed only collects tcp traffic for the same port , though the sample size is large enough , my std deviation is 0.  Is it ok to ignore such feature while calculating the Gaussian density function ?.  How does it effect the other precision of the algorithm ?. when the model is used against a live traffic feed which has random distribution of port number, how would it behave?
thanks a lot for your help here.

A: *

*Features not being normally distributed should not be an issue.

*"features with zero standard deviation" = "constants"; their effect will either be perfectly captured by the constant term in the model or equivalently of no use if you're already sweeping out means. i.e. not only can they be ignored, they should be ignored.


text:
Q: Update Parent when Children/Parent change state I have a class TourEditor that is children and parent of a tourEditor class that processes the form when submitted. I would like the parent tourEditor to update the compoment object whenever the function updateFiles(files) is called in the children but unfortunately it is only saving the initial state of the children and not updating the state. Any ideas on how can this be solved?
TourEditor.js
export default class TourEditor extends React.Component {

  constructor(props){
    super(props);
    this.state = {"files": []};
    this.updateFiles = this.updateFiles.bind(this);
  }

  componentDidMount() {
    tourEditor({ component: this });
  }

  updateFiles(files) {
      this.setState({
          files: files
      });
  }

  render() {
    const { tour } = this.props;
    return (<form
      ref={ form => (this.tourEditorForm = form) }
      onSubmit={ event => event.preventDefault() }
    >
      <FormGroup>
       //....
      </FormGroup>
    </form>);
  }
}

tourEditor.js
export default function tourEditor(options) {
  console.log(options);
  component = options.component;
  validate();
}

A: I think you need matb33:collection-hooks
This package runs on the server, and allows you to perform actions either before or after database updates. So, for example, you could update the parent when a child record is updated.
Here is an example where I recalculate the number of photos in an album when any of the photos change:
var photoUpdate = function(userId,doc) {
    // console.log("Updating photo counts for album "+doc.albumid);
    var photoCount = Photos.find({
        albumid: doc.albumid
    }).count();
    Albums.update({_id: doc.albumid},{
        $set:{
            photoCnt: photoCount
        }
    });
}

Photos.after.insert(function (userId, doc) {
    photoUpdate(userId,doc);
})

Photos.after.update(function (userId, doc) {
    photoUpdate(userId,doc);
})

Photos.after.remove(function (userId, doc) {
    photoUpdate(userId,doc);
})


text:
Q: Year Dropdown do I have wrong datatype? Why is it not picking up the items I want from the table in the DB instead its putting YEAR as the item in the column of the table.
enter image description hereBudget Year:enter image description here

    <?php

    echo "<select name= 'Budget_Year' class='form-control selectpicker' onChange='getState(this.value)' Required>";
    $default = "year";
    $time = array('year'=>"2018-2019");

    foreach($time as $key=>$val)
    {
    echo ($key == $default) ? "<option selected=\"selected\" value=\"$key\">$val</option>":"<option value=\"$key\">$val</option>";
    }
    $sql = "SELECT budget_year FROM Budget_Year";
    $query = sqlsrv_query($conn,$sql);
            $query_display = sqlsrv_query($conn,$sql);
    while($row=sqlsrv_fetch_array($query_display,SQLSRV_FETCH_ASSOC))
    {
    echo '<option value=" '. $row['budget_year'].' ">'.$row['budget_year']. '</option>';
    continue;
    }

    ?>

</td>

A: I'm not sure what you're trying to do.
Here in your code (as in your database) the only thing which is submitted through the form and store in your DB, will be the string "year".
When you make a $time = array('year'=>"2018-2019"); "year" is the key, and "2018-2019" is the value.
If you write:
$default = "year";
$time = array('year'=>"2018-2019");

foreach($time as $key=>$val)
{
echo ($key == $default) ? "<option selected=\"selected\" value=\"$key\">$val</option>":"<option value=\"$key\">$val</option>";
}

as there is only one pair of key/value in your array, the code above it's striclty the same as just writing:
echo "<option selected=\"selected\" value=\"year\">2018-2019</option>";

And then, after this listing your DB results. And as there is only records in the DB with "year" in the column Budget_Year, your select list will result in:
<select name= 'Budget_Year' class='form-control selectpicker' onChange='getState(this.value)' Required>
    <option selected="selected" value="year">2018-2019</option>
    <option value="year">year</option>
    <option value="year">year</option>
    <option value="year">year</option>
</select>

When storing the result with the form for adding a new entry, you should consider using $val in the value arg of your option, not $key:
<option selected=\"selected\" value=\"$val\">


text:
Q: Is it possible to restrict/require certain capabilities in a Stream parameter? I'm writing an application that creates catalogs of files. Currently the catalog information is stored in an XML file, but I'm trying to abstract the interface to a catalog to allow for other future storage mechanisms such as a single ZIP file, SQL server, or HTTP server. So rather than returning a file path the abstract Catalog class returns files as byte Streams. Thus allowing the source of a file to be a disk, but also for files coming from a database or a web server. See my previous related question.
However, the root Stream class includes Streams with different capabilities. Some streams can only be read, others can only be written to. Still some streams support seeking, while other streams do not.
Is there anyway to restrict the capabilities of the stream returns by a property or method? For example my Catalog class looks something like this.
public abstract class Catalog
{
    ...
    public abstract Stream File
    {
        get;
    }
    ...
}

Is there someway to ensure that File will always return a readable stream that supports seeking?

A: Well, you can check the CanRead, CanWrite and CanSeek properties of the stream.
I'm not sure I understand your question correctly, though... What are you trying to do exactly ?
Some streams will never be seekable (for instance NetworkStream, GZipStream...), so if you're working on those types of stream, there is no way to force them to seek.
If you just want to restrict the functionality of a stream (for instance, prevent writing to a stream that is normally writable), you can create a wrapper that delegates its implementation to the underlying stream, but throws an exception for "disabled" methods.

A: howabout abstracting the underlying persistance mechanism.  What do your callers need?  If they all need the same behaviour from your 'File', can you not create an interface which all your potential stores to implement, rather than have them all return 'Stream' classes?


text:
Q: Update the application property in Java My java application has following properties defined in my  application.property file.
spring.datasource.url=jdbc:jtds:sqlserver://**mysystemName**/;instance=mydb;domain=DHC;trusted=true;

Is it  possible to read the machine name and add it in the spring.data source.url? The mysystemName should be dynamically loaded.
Any method for reading and updating value run time? I am looking for something like below.
spring.datasource.url=jdbc:jtds:sqlserver://${someMachineNameFromCode}/;instance=mydb;domain=DHC;trusted=true;

I don't want to read the properties and format and write back. I am looking for some expressions which I can use directly inside application.properties.

A: There are a few different ways of changing Spring properties during runtime. EnvironmentPostProcessor and ApplicationListener are among them. Here, I am going to include an example of EnvironmentPostProcessor.

*

*Create a custom EnvironmentPostProcessor as shown below.

*The CustomEnvironmentPostProcessor class looks up application configuration properties.

*If it finds any property with a value which contains a substring pattern matching "%%mysystemName%%", it replaces it with the server hostname.

*The modified properties are stored in a placeholder.

*If the modified properties placed holder is not empty, it is added at the beginning of all other properties.

*You also have to register the class in META-INF/spring.factories.

spring.factories
org.springframework.boot.env.EnvironmentPostProcessor=\
  com.basaki.config.CustomEnvironmentPostProcessor

application.yml
spring:
  datasource:
    url: jdbc:jtds:sqlserver://%%mysystemName%%/;instance=mydb;domain=DHC;trusted=true;

CustomEnvironmentPostProcessor.java
public class CustomEnvironmentPostProcessor implements EnvironmentPostProcessor {

    private static final String APPLICATION_CONFIGURATION_PROPERTIES =
            "applicationConfigurationProperties";

    private static final String SYSTEM_PATTERN = "%%mysystemName%%";

    @Override
    public void postProcessEnvironment(
            ConfigurableEnvironment environment,
            SpringApplication springApplication) {

        MutablePropertySources sources = environment.getPropertySources();
        Properties modifiedProps = new Properties();

        if (sources.contains(APPLICATION_CONFIGURATION_PROPERTIES)) {
            PropertySource<?> source = sources.get(
                    APPLICATION_CONFIGURATION_PROPERTIES);
            if (source instanceof EnumerablePropertySource) {
                EnumerablePropertySource target =
                        (EnumerablePropertySource) source;
                for (String name : target.getPropertyNames()) {
                    Object value = target.getProperty(name);
                    if (value instanceof String) {
                        if (((String) value).contains(SYSTEM_PATTERN)) {
                            try {
                                String newValue = ((String) value).replaceAll(SYSTEM_PATTERN,
                                        hostname());
                                modifiedProps.put(name, newValue);
                            } catch (UnknownHostException e) {
                                //do nothing
                            }
                        }
                    }
                }
            }
        }

        if (!modifiedProps.isEmpty()) {
            sources.addFirst(new PropertiesPropertySource("customAppProperties",
                    modifiedProps));
        }
    }

    public String hostname() throws UnknownHostException {
        String hostName = InetAddress.getLocalHost().getHostName();
        int index = hostName.indexOf(".local");
        hostName = (index > 0) ? hostName.substring(0, index) : hostName;
        return hostName;
    }
}


text:
Q: Scheduling multiple spark streaming jobs and its dependency management I have a requirement where I need to support adhoc runnable task which are spark streaming jobs.
This is job scheduling mechanism should support orchestrating , monitoring , rescheduling and cancelling operations of these stream jobs. Error handling such as stream complete notifications , steam error notification is also one of the area that it is expected to support.
I tried to explore Airflow. Owning to limited knowledge on Airflow, I am not able to find anything that can help me to orchestra this sparked streaming jobs.Airflow seems supporting scheduling but with batch and intervals.
Could you please suggest any libraries or any mechanism using open-source technology that can help me achieve this particular requirement.References to enterprise solutions are also welcome.


text:
Q: remove checkmark from menuitem c# I have a menuitem with ischeckable and it comes with a checkmark. i wish to remove the checkmark that comes with it. I have a packicon but it doesnt overwrite the checkmark also. Any help please!
<MenuItem Header="Save Trace" Command="{Binding SaveXML}"
                              IsCheckable="True"
                              IsChecked="{Binding SavingTrace,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                              IsEnabled="{Binding StartTraceEnable}" >
                              <MenuItem.Icon>
                                    <materialDesign:PackIcon Kind="Restore" />
                              </MenuItem>


text:
Q: Partition of the Set of Subests of A induced by R $A$ is a non-empty set and $B$ is a fixed subset of A. The relation R on
the set of subsets of A as follows.
Relation is defined by:
$R = \{(X,Y) | X \cap B = Y \cap B\}$
where $X$ and $Y$ are subsets of $A$.
I can show that this relation is an equivalence relation. However, the question also asks me the following:
If $A = \{1,2,3\}$ and $B = \{1,2\}$ find the partition of the set of subsets of $A$
induced by $R$.
I could not really understand the expression. Textbook says that equivalence classes of $R$ form a partition of $S$. Should I check every subset of $A$ and find their equivalence classes?

A: Yes your idea is the good one. Take any subset of $ X \subseteq A$ (there is only 8 of those) and compute $X \cap B$ (easy!). Then look at the values of $X \cap B$ to find the equivalence classes.
You'll find
$\overline{\{1\}}=\{\{1\}, \{1,3\}\}$, $\overline{\{2\}}=\{\{2\}, \{2,3\}\}$, $\overline{\emptyset}=\{\emptyset, \{3\}\}$, $\overline{\{1,2\}}=\{\{1,2\}, \{1,2,3\}\}$


text:
Q: How can I determine the value of this limit? $\lim\limits_{t \to -\sqrt{8}} \frac{t + 2\sqrt{2}}{3t^2 - 24}.$ Evaluate the following limit:
$$\lim_{t \to -\sqrt{8}} \frac{t + 2\sqrt{2}}{3t^2 - 24}.$$

A: $$\frac{t+2\sqrt 2}{3t^2-24}=\frac{t+\sqrt 8}{3(t+\sqrt 8)(t-\sqrt 8)}=\frac{1}{3(t-\sqrt 8)}$$Now apply the limit.

A: Hint: $3t^2-24=3(t^2-8)=3(t+2\sqrt{2})(t-2\sqrt{2})$
Remark: Since you are familiar with L'Hospital's Rule, there is a more mechanical approach. First note that the Rule applies, top and bottom are approaching $0$. The derivative of the top is $1$, the derivative of the bottom is $6t$. And the limit of $\frac{1}{6t}$ as $t$ approaches $-2\sqrt{2}$ is clear.

A: $$\lim_{t \to -2\sqrt{2}} \frac{t + 2\sqrt{2}}{3t^2 - 24} = \lim_{t \to -2\sqrt{2}} \frac{t + 2\sqrt{2}}{3(t^2 - 8)} =\lim_{t\to -2\sqrt 2} \frac{t + 2\sqrt 2}{3(t+ 2\sqrt 2)(t-2\sqrt 2)}$$
Cancel, and evaluate.


text:
Q: Using lapply to create a conditional sum of column values over a list of data.frames I have data that looks like the sample below:
[[1]]
           KRW.LOW.1 KRW.LOW.1.1 KRW.50D   KRW.LOW.1.2
2014-08-11        -1          1       1    5
2014-08-12        -1          1       1    10

[[2]]]
           EUR.CLOSE EUR.CLOSE.1 EUR.50D   EUR.CLOSE.2
2014-08-29        -1          -1       1    3
2014-09-01        -1           1       1    1
2014-09-02         0          -1       0    2

This is a list of dataframes. And I want to sum the elements in the 4th row (VAR.CLOSE.2) based on a condition for the first three columns. The conditions are:

*

*Column 1 has nonnegative values OR

*Column 2 is strictly greater than zero OR

*Column 3 is nonnegative

In other words, as an illustrative example, if I was just examining a single dataframe, I'd want something like sum(x[which(x[,1]!=0 | x[,2]>0 | x[,3]!=0]), 4)
So in the given example above, I'd like to get the following calculations:
[[1]]
              KRW
ReturnSum     15

[[2]]
              EUR
ReturnSum     5

Where we get 5 for EUR from summing the only first 2 rows because the last row doesn't fulfill any of the 3 conditions. In particular, the conditionsData[[2]][3,1] != 0 Data[[2]][3,3] != 0 both fail and so does Data[[2]][3,2]>0
I've tried achieving this with
i <- 1:length(FlaggingTrend)
SumReturns <- lapply(FlaggingTrend[[i]], function(x) sum(x[which(x[,2]!=0|x[,3]>0|x[,4]!=0),4]))

Where FlaggingTrend corresponds to the data posted above. However, this returns a list of zeroes.
I'll be attaching a sample dput of the data below:
list(structure(list(EUR.CLOSE = c(-1, -1, -1, 0, 1, 0, 0, -1,
0, 1), EUR.CLOSE.1 = c(1, -1, -1, 1, 1, 1, 1, -1, -1, -1), EUR.50D = c(-1,
-1, -1, -1, -1, -1, -1, -1, -1, -1), EUR.CLOSE.2 = c(-0.0011268664916733,
-0.00423709498833686, -0.00188893142678216, 0.00217196364717242,
0.00686254162079234, -0.00544858088184653, -0.000188412624203348,
-0.00737591996472312, 0.00208590196044455, 0.00227057808051545
)), .Names = c("EUR.CLOSE", "EUR.CLOSE.1", "EUR.50D", "EUR.CLOSE.2"
), row.names = c("2017-02-10", "2017-02-13", "2017-02-14", "2017-02-15",
"2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21", "2017-02-22",
"2017-02-23"), class = "data.frame"), structure(list(JPY.CLOSE = c(0,
0, 1, 0, -1, -1, 0, 1, 0, -1), JPY.CLOSE.1 = c(-1, -1, -1, -1,
-1, -1, -1, -1, -1, -1), JPY.50D = c(1, 1, 1, 1, 1, 1, 1, 1,
1, 1), JPY.CLOSE.2 = c(-0.000264935754629825, 0.00458231327013969,
0.00456141141766331, -0.000875580127735809, -0.00809151292488242,
-0.00353857410990255, 0.00230149698827908, 0.00511510066677001,
-0.00326005839636956, -0.00619690368354142)), .Names = c("JPY.CLOSE",
"JPY.CLOSE.1", "JPY.50D", "JPY.CLOSE.2"), row.names = c("2017-02-10",
"2017-02-13", "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17",
"2017-02-20", "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(GBP.CLOSE = c(0, 1, 0, 0, 1, -1, 0, 0, 0,
    1), GBP.CLOSE.1 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), GBP.50D = c(-1,
    -1, -1, -1, -1, -1, -1, -1, -1, -1), GBP.CLOSE.2 = c(-0.00048023051987453,
    0.00279809911944895, -0.00464112219813048, -0.000561594944360089,
    0.0022444899202175, -0.00618451029481418, 0.00410050825810596,
    0.000802053299332334, -0.00184568523285542, 0.00847801606899046
    )), .Names = c("GBP.CLOSE", "GBP.CLOSE.1", "GBP.50D", "GBP.CLOSE.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        CHF.OPEN = c(1, 0, 0, 0, -1, 0, 0, 1, 0, -1), CHF.OPEN.1 = c(-1,
        -1, -1, -1, -1, -1, -1, -1, 1, -1), CHF50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), CHF.OPEN.2 = c(0.000698567964139939,
        0.00328669186857626, 0.00049704260678339, -0.000695928844511353,
        -0.00838914337795957, 0.00550083899465574, 0.000199461454735274,
        0.00685716972613716, 0.000594059423411153, -0.00396707849439904
        )), .Names = c("CHF.OPEN", "CHF.OPEN.1", "CHF50D", "CHF.OPEN.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        AUD.CLOSE = c(1, 0, 0, 1, 0, -1, 0, 0, 1, 0), AUD.CLOSE.1 = c(1,
        1, 1, 1, 1, 1, 1, 1, 1, 1), AUD.50D = c(-1, -1, -1, -1,
        -1, -1, -1, -1, -1, -1), AUD.CLOSE.2 = c(0.00640566933128534,
        -0.00444038864633145, 0.00300594880983807, 0.0061146355869709,
        -0.00207738324513479, -0.00390676366154397, 0.00312663099943206,
        -0.00169237819473061, 0.00364156989756792, 0.00155662244429539
        )), .Names = c("AUD.CLOSE", "AUD.CLOSE.1", "AUD.50D",
    "AUD.CLOSE.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(CAD.CLOSE = c(-1, 0, 0, 0, 0, 1, 0, 1, 0,
    -1), CAD.CLOSE.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1), CAD.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CAD.CLOSE.2 = c(-0.00472778065310547,
    -0.000917641725324381, 0.000382453058549392, 0.000305857167088586,
    -0.000688310225637978, 0.00191080426541917, 0.000763300548471235,
    0.00266697304419594, 0.00174871741959248, -0.00449199430572389
    )), .Names = c("CAD.CLOSE", "CAD.CLOSE.1", "CAD.50D", "CAD.CLOSE.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        NZD.CLOSE = c(0, 0, 0, 1, 0, -1, 0, -1, 0, 1), NZD.CLOSE.1 = c(1,
        1, 1, 1, 1, 1, 1, 1, 1, 1), NZD.50D = c(-1, -1, -1, -1,
        -1, -1, -1, -1, -1, -1), NZD.CLOSE.2 = c(0.00041733324664972,
        -0.00208841008727045, -0.000836586774949688, 0.00750420419797471,
        -0.00180142777185216, -0.00389105549296664, 0.00111327592906424,
        -0.00404153570815258, 0.00390244397693174, 0.00568695616893883
        )), .Names = c("NZD.CLOSE", "NZD.CLOSE.1", "NZD.50D",
    "NZD.CLOSE.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(SEK.OPEN = c(1, 1, 0, 0, -1, 0, 1, 1, 0, 0
    ), SEK.OPEN.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1, 1),
        SEK.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), SEK.OPEN.2 = c(0.00163829609003363,
        0.0023181988913219, -0.000716164076936199, -0.00145628918509555,
        -0.00677152707834994, 0.00582941106111079, 0.00270059947077783,
        0.00455540960162004, -0.000256248852460228, 0.00199255363165785
        )), .Names = c("SEK.OPEN", "SEK.OPEN.1", "SEK.50D", "SEK.OPEN.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        NOK.CLOSE = c(1, 0, 0, -1, -1, 0, 0, 1, 0, 0), NOK.CLOSE.1 = c(-1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1), NOK.50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), NOK.CLOSE.2 = c(0.00323283885094217,
        0.00303175214315887, 0.000941075635438882, -0.00716968871997281,
        -0.00617111408142934, 0.00665069589528811, -0.000467589464977269,
        0.00246736261239189, 0.000837040274633605, -0.00324444329976892
        )), .Names = c("NOK.CLOSE", "NOK.CLOSE.1", "NOK.50D",
    "NOK.CLOSE.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(CZK.CLOSE = c(1, 1, 1, 0, -1, 0, 0, 1, 0,
    -1), CZK.CLOSE.1 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), CZK.50D = c(1,
    1, 1, -1, -1, 1, -1, 1, -1, -1), CZK.CLOSE.2 = c(0.00144601789180365,
    0.00379617459269976, 0.00202579528819546, -0.00220231606416821,
    -0.00688897736863447, 0.00560532297819627, 0.000184602212216056,
    0.00710284457208665, -0.00197121312914339, -0.00224919172846905
    )), .Names = c("CZK.CLOSE", "CZK.CLOSE.1", "CZK.50D", "CZK.CLOSE.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        HUF.LOW.1 = c(0, 1, 1, 0, -1, 0, 0, 1, 0, 0), HUF.LOW.1.1 = c(-1,
        -1, -1, -1, -1, -1, -1, 1, -1, 1), HUF.50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), HUF.LOW.1.2 = c(0.0013470806658562,
        0.00413351833762921, 0.000927691660614904, -0.00161542594720476,
        -0.00908798735735505, 0.00843420139734707, -0.00110208028787984,
        0.00632043873779775, -0.00133632598823841, 0.000719782039952932
        )), .Names = c("HUF.LOW.1", "HUF.LOW.1.1", "HUF.50D",
    "HUF.LOW.1.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(ILS.LOW.1 = c(0, 0, 0, -1, -1, -1, 0, 0, 0,
    0), ILS.LOW.1.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
    ), ILS.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ILS.LOW.1.2 = c(0.000933818987030266,
    0.000959590648321962, -0.00159982969276018, -0.00296644925366696,
    -0.00509821862018822, -0.00393531505179312, 0.00242770943578163,
    -0.00285991992901691, -0.000567559913074556, 0.00091874516690349
    )), .Names = c("ILS.LOW.1", "ILS.LOW.1.1", "ILS.50D", "ILS.LOW.1.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        PLN.LOW.1 = c(0, 1, 0, 0, -1, 1, 0, 0, 0, 0), PLN.LOW.1.1 = c(-1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1), PLN.50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), PLN.LOW.1.2 = c(-0.00274633685326608,
        0.00755279414139087, 0.000417931735706034, -0.000491702529882065,
        -0.00490565626173578, 0.00929781633628868, -0.00365469691428677,
        0.00186580959045224, -0.00137446945036213, -0.00149934278232444
        )), .Names = c("PLN.LOW.1", "PLN.LOW.1.1", "PLN.50D",
    "PLN.LOW.1.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(RUB.LOW.1 = c(-1, -1, -1, -1, 0, 0, 1, 0,
    -1, 1), RUB.LOW.1.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1), RUB.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), RUB.LOW.1.2 = c(-0.00446008580014645,
    -0.0121748200414373, -0.00422818336649922, -0.0153488129381678,
    0.0022241309795028, 0.00590173583792808, 0.014758577509606,
    -0.00824954514944221, -0.00941636498473652, 0.0111898627811513
    )), .Names = c("RUB.LOW.1", "RUB.LOW.1.1", "RUB.50D", "RUB.LOW.1.2"
    ), row.names = c("2017-02-09", "2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22"), class = "data.frame"), structure(list(
        TRY.HIGH.1 = c(0, 0, -1, 0, 0, -1, -1, 0, -1, -1), TRY.HIGH.1.1 = c(1,
        1, 1, 1, 1, -1, -1, -1, -1, -1), TRY.50D = c(-1, -1,
        -1, -1, -1, -1, -1, -1, -1, -1), TRY.HIGH.1.2 = c(0.00417356089701015,
        -0.00686579177053992, -0.00568012668941198, 0.00229778255761226,
        0.00204713949728741, -0.0100024127023963, -0.00176420367173535,
        -0.00113183078791668, -0.011249649909296, -0.00307744199905646
        )), .Names = c("TRY.HIGH.1", "TRY.HIGH.1.1", "TRY.50D",
    "TRY.HIGH.1.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(ZAR.LOW.1 = c(-1, 0, -1, -1, 0, 0, 0, 0, -1,
    -1), ZAR.LOW.1.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1), ZAR.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), ZAR.LOW.1.2 = c(-0.0050112296343281,
    -0.000119978703923884, -0.0173679300039469, -0.0145343910929765,
    0.00897924634581271, 0.000421926368602055, 0.000521408427958114,
    0.00716476609655059, -0.0126608692527035, -0.00785440574245699
    )), .Names = c("ZAR.LOW.1", "ZAR.LOW.1.1", "ZAR.50D", "ZAR.LOW.1.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        BRL.LOW.1 = c(0, 0, -1, -1, 0, 1, 0, 0, -1, -1), BRL.LOW.1.1 = c(-1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1), BRL.50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), BRL.LOW.1.2 = c(-0.00371652356533581,
        -0.00160621962638552, -0.00832934597660584, -0.00902065874268554,
        0.010543197464703, 0.00316721872930192, -0.00362049854021018,
        0.00278119317749237, -0.0100617531753731, -0.0006199931673041
        )), .Names = c("BRL.LOW.1", "BRL.LOW.1.1", "BRL.50D",
    "BRL.LOW.1.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(CLP.LOW.1 = c(-1, 0, 0, 0, 0, 1, 0, 0, 0,
    0), CLP.LOW.1.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
    ), CLP.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CLP.LOW.1.2 = c(-0.00993671434599985,
    0.00456853190734918, -0.00172828592427443, -0.00404432121904819,
    -0.00048516719656444, 0.00933326604643625, -0.00561445365426927,
    0.00353409520664982, -0.00208469536279665, -0.00105956972687871
    )), .Names = c("CLP.LOW.1", "CLP.LOW.1.1", "CLP.50D", "CLP.LOW.1.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        COP.CLOSE = c(-1, 1, 0, 0, 0, 1, 0, 1, 0, -1), COP.CLOSE.1 = c(-1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1), COP.50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), COP.CLOSE.2 = c(-0.00197341552292052,
        0.00662211307234362, 0.000580874632634121, -0.00202234392720335,
        0.00204668459925017, 0.00543743450560008, -0.00266994190200176,
        0.00607751193077277, -0.00217715796204931, -0.00905605289811184
        )), .Names = c("COP.CLOSE", "COP.CLOSE.1", "COP.50D",
    "COP.CLOSE.2"), row.names = c("2017-02-10", "2017-02-13",
    "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(MXN.LOW.1 = c(0, 0, -1, 0, 0, 1, -1, -1, -1,
    -1), MXN.LOW.1.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1), MXN.50D = c(-1, -1, 1, 1, 1, 1, 1, 1, 1, 1), MXN.LOW.1.2 = c(-0.000211320384603475,
    -0.00314066280938086, -0.00107540683430729, 0.000705557901050646,
    0.00518510570127306, 0.00240140867288519, -0.00281365838425973,
    -0.0177295559643031, -0.00536567713104841, -0.0121193389083811
    )), .Names = c("MXN.LOW.1", "MXN.LOW.1.1", "MXN.50D", "MXN.LOW.1.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        PEN.HIGH.1 = c(-1, 0, -1, -1, 0, 1, -1, 0, -1, 0), PEN.HIGH.1.1 = c(-1,
        -1, -1, -1, -1, -1, -1, -1, -1, -1), PEN.50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), PEN.HIGH.1.2 = c(-0.00429316820091041,
        0.00214888801033619, -0.000859001157250239, -0.0038438522704316,
        0.00101621330746293, 0.00460618041489735, -0.00522194398115183,
        0, -0.000462071629322658, -0.000154071335332739)), .Names = c("PEN.HIGH.1",
    "PEN.HIGH.1.1", "PEN.50D", "PEN.HIGH.1.2"), row.names = c("2017-02-10",
    "2017-02-13", "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17",
    "2017-02-20", "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(CNY.CLOSE = c(1, 0, -1, 0, -1, 1, 1, 1, 0,
    -1), CNY.CLOSE.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1,
    -1), CNY.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), CNY.CLOSE.2 = c(0.00135295379134326,
    0.000247116371263401, -0.00184758230288495, 0.000524070878021865,
    -0.0026376972616271, 0.001968002384513, 0.00174608993071379,
    0.000799273430379666, -0.00090104498241117, -0.00170257391661588
    )), .Names = c("CNY.CLOSE", "CNY.CLOSE.1", "CNY.50D", "CNY.CLOSE.2"
    ), row.names = c("2017-02-10", "2017-02-13", "2017-02-14",
    "2017-02-15", "2017-02-16", "2017-02-17", "2017-02-20", "2017-02-21",
    "2017-02-22", "2017-02-23"), class = "data.frame"), structure(list(
        IDR.LOW.1 = c(-1, 0, 0, 0, 0, 0, 1, 1, 0, 0), IDR.LOW.1.1 = c(-1,
        -1, -1, -1, -1, -1, -1, 1, -1, -1), IDR.50D = c(1, 1,
        1, 1, 1, 1, 1, 1, 1, 1), IDR.LOW.1.2 = c(-0.00225360672301989,
        0.00142787383820853, 0.000750694427567922, 0.000375135991193432,
        -0.000825485019296579, 0.000975500021079156, 0.00157380030235466,
        0.00142178345498323, -0.000448765901323256, -0.00119769458137853
        )), .Names = c("IDR.LOW.1", "IDR.LOW.1.1", "IDR.50D",
    "IDR.LOW.1.2"), row.names = c("2017-02-09", "2017-02-10",
    "2017-02-13", "2017-02-14", "2017-02-16", "2017-02-17", "2017-02-20",
    "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"),
    structure(list(INR.LOW.1 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1
    ), INR.LOW.1.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1
    ), INR.50D = c(-1, -1, -1, -1, -1, -1, 0, -1, 0, -1), INR.LOW.1.2 = c(-0.000466530150061928,
    -0.000531550320954643, -0.000443420116883253, -0.000392023361358795,
    -0.000386278564721287, -0.000386427833512393, -0.000244913256195467,
    -0.000181510566847898, -0.000126929400856568, -0.000132850348706803
    )), .Names = c("INR.LOW.1", "INR.LOW.1.1", "INR.50D", "INR.LOW.1.2"
    ), row.names = c("2017-02-08", "2017-02-09", "2017-02-10",
    "2017-02-13", "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17",
    "2017-02-20", "2017-02-22"), class = "data.frame"), structure(list(
        KRW.LOW.1 = c(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
        KRW.LOW.1.1 = c(-1, -1, -1, -1, -1, -1, -1, 1, -1, -1
        ), KRW.50D = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1), KRW.LOW.1.2 = c(0.000517860571988438,
        0.000112542907102053, 0.00134952787013343, 0, -0.000337211266051574,
        0.00112359562382647, 0.000449084996881899, 0.000785413785115541,
        -0.00085276367906495, -0.000718681250895026)), .Names = c("KRW.LOW.1",
    "KRW.LOW.1.1", "KRW.50D", "KRW.LOW.1.2"), row.names = c("2017-02-10",
    "2017-02-13", "2017-02-14", "2017-02-15", "2017-02-16", "2017-02-17",
    "2017-02-20", "2017-02-21", "2017-02-22", "2017-02-23"), class = "data.frame"))

A: You could try working with purrr:
map_df(FlaggingTrend, function(x) {
co <- stringr::str_extract(names(x)[1], "\\w+")
names(x) <- c(names(x[[1]]))
x %>%
    filter(EUR.CLOSE != 0, EUR.50D > 0, EUR.CLOSE.1 != 0) %>%
    mutate(co = co) %>%
    group_by(co) %>%
    summarize(Sum_Var = sum(EUR.CLOSE.2))
})

Every data frame in the list has it's columns renamed to the first one. This does not return the values in your example, but the filtering should work just fine.


text:
Q: How can we use custom setpoints in CEP I want to create a dashboard or maybe widgets where a user can add custom setpoints.
These setpoints should be stored for later use creating streaming analytics with CEP.
What would be the (best) approach for this?
Thanks

A: If these setpoints are related to a device a good approach would be to store them in the device object.
Maybe have a dedicated fragment in the device that is managed by your dashboard widget that will allow the configuration of these setpoints.
From CEP you then can check those fragments by querying the device


text:
Q: Rooms are not removed after everyone leaves As far i read from the doc
that Rooms are left automatically upon disconnection and they are automatically removed when everyone leaves. But this is not the case of my actual code:
io.on('connection', function(socket) {

  socket.join(MainRoom);
  io.sockets.adapter.rooms[socket.id].owner = socket.username;

   //send the list of available rooms on connection
    socket.to(MainRoom).emit('updateList',io.sockets.adapter.rooms);

    socket.on('getUpdateList',function()  {
        io.to(MainRoom).emit('updateList',io.sockets.adapter.rooms);
    });

    socket.on('msg', function(msg) {
        io.to(MainRoom).emit('msgFront',msg);
      });

    socket.on('disconnect', function() {
        console.log('leaving '+socket.id);
        io.to(MainRoom).emit('updateList',io.sockets.adapter.rooms);

      });

});

Notice that I'm using a MainRoom where all client are forced to join it just to make sure that everyone can talk to each other.
By default Each Socket in Socket.IO is identified by a random, unguessable, unique identifier Socket#id. For your convenience, each socket automatically joins a room identified by this id.
My problem is that after closing/refreshing the browser tab, all previously joined rooms are still there, and the number of rooms is incremented(on connection the socket join new rooms automatically..)
Anyone can explain this behavior ?

A: Solved:
The problem is that i extended the rooms object bu adding owner attribute :
  io.sockets.adapter.rooms[socket.id].owner = socket.username;

So that the extended room can't be removed. the solution that i found is to store owner attribute outside within an associative array, that's it.


text:
Q: Automake Libtool 'No rule to make target' I've been trying to build to GLTools library that accompanies The OpenGL SuperBible into a libtool library with automake.
I've set up autoconf and automake but when it comes to actually build the library I get:
$ make
make: *** No rule to make target `GLBatch.lo', needed by `libgltools.la'.  Stop.

I've searched google as much as my sanity will let me and come up with nothing, I'm new to automake so I'm not quite sure what to be searching for. I'm sure it's either a tiny mistake or I've missed something fundamental.
Here is my Makefile.am:
ACLOCAL_AMFLAGS = -I m4

lib_LTLIBRARIES = libgltools.la
libgltools_la_SOURCES = GLBatch.cpp GLShaderManager.cpp GLTriangeBatch.cpp GLTools.cpp math3d.cpp glew.c
#libgltools_la_CFLAGS =
libgltools_la_LIBADD = -lX11 -lglut -lGL -lGLU -lm

include_HEADERS = GLBatchBase.h GLBatch.h GLFrame.h GLFrustum.h GLGeometryTransform.h GLMatrixStack.h GLShaderManager.h GLTools.h GLTriangleBatch.h math3d.h StopWatch.h GL/glew.h GL/glxew.h GL/wglew.h

EXTRA_DIST = autogen.sh

And my configure.ac if it matters:
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.67])
AC_INIT([libgltools.la], [0.1], [jon.hatchett@gmail.com])
AM_INIT_AUTOMAKE([libgltools.la], [0.1])
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/])
AC_CONFIG_HEADERS([include/config.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lGL':
AC_CHECK_LIB([GL], [main])
# FIXME: Replace `main' with a function in `-lGLU':
AC_CHECK_LIB([GLU], [main])
# FIXME: Replace `main' with a function in `-lX11':
AC_CHECK_LIB([X11], [main])
# FIXME: Replace `main' with a function in `-lglut':
AC_CHECK_LIB([glut], [main])
# FIXME: Replace `main' with a function in `-lm':
AC_CHECK_LIB([m], [main])

# Checks for header files.
AC_PATH_X
AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
AC_CHECK_TYPES([ptrdiff_t])

# Checks for library functions.
AC_HEADER_MAJOR
AC_FUNC_MALLOC
AC_CHECK_FUNCS([gettimeofday sqrt strchr strstr])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Thanks very much.

A: It's hard to say based on your description but I would wager that you need to put your Makefile.am in the src directory and then create a Makefile.am in the GLTools directory that looks like this:
SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4

It is also possible to do a non-recursive make but that requires some extra setup.
Here I did it for you:
https://github.com/msteinert/gltools

A: You should add somewhere in your configure.ac file:
LT_INIT
LT_LANG([C++])

Or alternatively, according to the docs:
LT_INIT
AC_PROG_CXX


text:
Q: What is $\pi$ doing here in Gaussian integral? During reading proof of Stirling's formula  $n! \sim \sqrt{2n\pi}\left(\frac ne\right)^n$, I started finding the reason of $\pi$'s presence in the expression; which led to Gaussian Integral, i.e. $\int^{\infty}_{-\infty}{e^{-x^2}}dx = \sqrt{\pi}$.
The main suspect according to me in its derivation is:
$$ \left(\int_{-\infty}^{\infty} e^{-x^{2}} \, dx\right)^{2}
= \int_{-\infty}^{\infty} e^{-x^{2}} \, dx \int_{-\infty}^{\infty} e^{-y^{2}} \, dy
= \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} e^{-(x^2+y^2)} \, dxdy. $$
This has that term $( x^2 + y^2 )$ which seems to be taking a sort of circle and consequently $\pi$ in the formula.
I am not finding any bigger picture of how exactly this arrival is taking place here.
Question:
How can I visualize the Gaussian integral to get the intuition for $\pi$'s presence in it? Also,
$$ \left(\int_{-\infty}^{\infty} e^{-x^{2}} \, dx\right)^{2} = \int_{-\infty}^{\infty} e^{-x^{2}} \, dx \int_{-\infty}^{\infty} e^{-y^{2}} \, dy $$
is quite confusing for me from perspective of $x$ and  $y$ axis' emergence out of area's square. (I know its correct mathematically, but this is something that has boggled the noggin of mine.)
Thanks.

A: One way to visualize this is to note that the integral
$$
I^2=\int_{-\infty}^\infty\int_\infty^\infty e^{-(x^2+y^2)}\,\mathrm{d}x\,\mathrm{d}y
$$
is the volume of the region between $z=e^{-(x^2+y^2)}=e^{-r^2}$ and the $xy$-plane.  So taking slices parallel to the $xy$-plane, we have
$$
I^2=\int_0^1 A(z)\,\mathrm{d}z
$$
where $A(z)$ is the area of the slice at height $z$ intersecting the region.  The slice is a disc of radius $r$ where $r^2=-\log z$.  So
$$
I^2=\int_0^1 -\pi\log z\,\mathrm{d}z
$$
and there is your $\pi$.  We must also check the integral doesn't end up cancelling this $\pi$ out:
$$
\frac{I^2}{\pi}=-\int_0^1\log z\,\mathrm{d}z=-\Big[z\log z-z\Big]_{z=0}^{z=1}=1+\underbrace{\lim_{z\to 0+} z\log z}_{=0}.
$$

A: I understand your frustration; the calculation tells us $\pi$ appears in the answer, but it seems to come from nowhere. What does exponentiation have to do with circles/rotation? Weirder still, why is it square-rooted?
Surprisingly, the best place to get an intuition for this isn't geometry; it's statistics.
One way to think of it is this. Since $r^2=x^2+y^2$, $\exp -r^2$ is separable in $x,\,y$ (meaning it's a function of $x$, times a function of $y$). Similarly, the Jacobian $r$ in $dxdy=rdrd\theta$ is separable (indeed, the "function of $\theta$" we'd use is constant, but that still counts). And where do separable functions famously come up? The "joint" distribution of independent random variables.
Now $2r\exp -r^2$ is a pdf on $[0,\,\infty)$, and $\frac{1}{2\pi}$ is a pdf on $[0,\,2\pi)$. Multiplying two expressions for $1$ to get another expression for $1$, we have a joint distribution for polar variables $r,\,\theta$ whereby they're also independent:
$$1=\int_{r\ge 0,\,0\le\theta\le2\pi}f(r,\,\theta)drd\theta,\,f:=\frac{1}{\pi}r\exp-r^2.$$But deliciously, this distribution also makes the Cartesian coordinates $x\leftrightarrow y$ independent! (In fact, you can show that, to within scaling, this is the only way for a distribution in the plane to satisfy both independence conditions.) Obviously we can rewrite the above integral as $$1=\int_{x,\,y\in\Bbb R}\frac{f(r,\,\theta)}{r}dxdy=\int_{x,\,y\in\Bbb R}\frac{1}{\pi}\exp\left(-x^2\right)\exp\left(-y^2\right)dxdy.$$The Cartesian formalism has the added beautiful consequence that the distributions of $x,\,y$ are identical. Indeed, $X$ has pdf $$\frac{1}{\sqrt{\pi}}\exp-x^2,$$which is equivalent to your original result. So in short, the reason $\sqrt{\pi}$ comes up is because of the very special way you can simultaneously make $x,\,y$ independent and $r,\,\theta$ independent.

A: First of all, this is not an area:
$$ \int _{-\infty}^\infty e^{-x^{2}}\,dx . $$
It is a definite integral that evaluates to a number. You might associate the number with an area, but only under specific interpretations of what the integral is for. (For example, if someone asks for the area of the region below the graph of the function $e^{-x^{2}}$ and above the $x$-axis, then this integral is how you compute that area.)
In this exercise the fact that there are such interpretations is mostly spurious and misleading.
Just to be clear, you really should not get hung up on having to imagine an area every time you see an integral. There are many applications
(for example, electromagnetism)
that are chock full of integrals, most of which are only related to any kind of "area" in the most abstract way.
So when you see
$$ \int_{-\infty}^\infty e^{-x^{2}}\,dx  \int_{-\infty}^\infty e^{-y^{2}}\,dy, $$
it's just the product of two numbers, nothing more.
Certainly not the product of two areas; that makes no sense (at least in this context).
The "two" numbers in fact are just one number:
$$ \int_{-\infty}^\infty e^{-x^{2}}\,dx = \int_{-\infty}^\infty e^{-y^{2}}\,dy.$$
Whether we write $x$ or $y$ or $\theta$ inside the integral really doesn't matter (yet).
It's when we write
$$ \int_{-\infty}^\infty \int_{-\infty}^\infty e^{-(x^2+y^2)}\,dx\,dy $$
that it finally makes sense to regard the $x$ and $y$ as $x$ and $y$ coordinates on a Cartesian plane, because that interpretation helps in visualizing the transformation to polar coordinates (if that's what comes next) or in reinterpreting the volume under $e^{-(x^2+y^2)}$ as a set of concentric shells or stacked disks.
So the progression is number, number times itself (i.e. number squared),
number times itself written slightly differently,
rearrange the order of integration so we have a double integral instead of two single ones, and then
reinterpret the double integral as a volume between a curved surface and the Cartesian plane.
The last step should be the first time we invoke any geometric intuition.
The step
$$ \int_{-\infty}^\infty e^{-x^2}\,dx  \int_{-\infty}^\infty e^{-y^2}\,dy =
\int_{-\infty}^\infty \int_{-\infty}^\infty e^{-(x^2+y^2)}\,dx\,dy $$
is admittedly a bit much to swallow all at once if you're not used to this sort of thing. Step by step, it can be done like this:
$$ \int_{-\infty}^\infty e^{-x^2}\,dx = K. $$
This requires that we know (or assume) the integral exists.
But if it exists, it's just a number, so we can call it $K.$
$$ \int_{-\infty}^\infty e^{-x^2}\,dx  \int_{-\infty}^\infty e^{-y^2}\,dy
= K \int_{-\infty}^\infty e^{-y^2}\,dy .$$
Simple substitution using the previous equation.
$$ K \int_{-\infty}^\infty e^{-y^2}\,dy = \int_{-\infty}^\infty Ke^{-y^2}\,dy.$$
Since $K$ is simply a fixed number (though we haven't computed it yet), we get the same result multiplying by it before or after integrating.
$$\int_{-\infty}^\infty Ke^{-y^2}\,dy =
\int_{-\infty}^\infty \left(\int_{-\infty}^\infty e^{-x^2}\,dx\right)e^{-y^2}\,dy.
$$
All we did here was reverse the substitution we did earlier.
Now we look at what is inside the $dy$ integral:
$$ \left(\int_{-\infty}^\infty e^{-x^2}\,dx\right)e^{-y^2}.$$
In this expression $e^{-y^2}$ is simply an (unknown) number that we are multiplying the integeral $\int_{-\infty}^\infty e^{-x^2}\,dx$ by, so again we can get the same result multiplying inside the integral as outside:
$$ e^{-y^2}\int_{-\infty}^\infty e^{-x^2}\,dx =
\int_{-\infty}^\infty e^{-y^2}e^{-x^2}\,dx.$$
Finally, $e^{-y^2}e^{-x^2} = e^{-(x^2+y^2)}.$
Putting it all together we get
$$
\int_{-\infty}^\infty \left(\int_{-\infty}^\infty e^{-x^2}\,dx\right)e^{-y^2}\,dy
= \int_{-\infty}^\infty \left(\int_{-\infty}^\infty e^{-(x^2+y^2)}\,dx\right)dy.
$$
And then Fubini's Theorem lets us treat
$$
\int_{-\infty}^\infty \left(\int_{-\infty}^\infty e^{-(x^2+y^2)}\,dx\right)dy
= \int_{-\infty}^\infty \int_{-\infty}^\infty e^{-(x^2+y^2)}\,dx\,dy
$$
as an integral over the combined $(x,y)$ coordinates of a Cartesian plane
instead of just one integral inside another,
which we need in order to find the circles in the shape of this integral.

Conceptually, the direction in which I would approach the calculation of the constant in the Gaussian distribution is exactly the opposite of the direction taken in the previous part of this answer.
That is, I would start by setting up a joint distribution of two iid Gaussian variables as a function over an $x,y$ Cartesian plane,
using an as-yet-unknown constant factor to make this a probability distribution.
That is, I would start with a distribution that is already two-dimensional.
Then I would show that the integral of that distribution can be written as the product of two integrals, which can be rewritten as the square of one integral.


text:
Q: pandas dropping of words in dataframe I have a sample dataframe that I wish to drop all words and keep the values.
Column1    Column2    Column3    Column4                     Column5
5FQ        1.047      S$55.3     UG44.2 as of 02/Jun/2016    S$8.2 mm

Is it possible to drop words and keep all the numbers? IE: to get the desired results below:
Column1    Column2    Column3    Column4    Column5
5          1.047      55.3       44.2       8.2

A: One way would be to do:
In [212]: df
Out[212]:
  Column1  Column2 Column3                   Column4   Column5
0     5FQ    1.047  S$55.3  UG44.2 as of 02/Jun/2016  S$8.2 mm

In [213]: df.apply(lambda x: x.astype(str).str.extract(r'(\d+\.?\d*)', expand=True).astype(np.float))
Out[213]:
   Column1  Column2  Column3  Column4  Column5
0      5.0    1.047     55.3     44.2      8.2

A: You can use pd.Series.extract:
In [28]: for c in df:
    df[c] = df[c].str.extract('(\d+\.?\d*)', expand=False)
   ....:

In [29]: df
Out[29]:
  Column1 Column2 Column3 Column4 Column5
0       5   1.047    55.3    44.2     8.2

Note that this is a bit brittle, as in Column4 it works because the date appeared after the quantity. Your question doesn't specify anything more precise, though.


text:
Q: linq not supported filter by the first element of a list? For business logic, the number of elements of a navigation propoerty that is a collection is one element, so I try to use this linq query to folter data:
myQuery = myQyuery.Where(c => c.MyEntity.ElementAt(0).MyBoolProperty == true);

But I get an exception that says more or less that linq is not compatible with ElementAt(), or that it is not recognize the function.
How could I do it?
Thanks.

A: Try this
myQuery= myQyuery.Where(c=>c.MyEntity.FirstOrDefault().MyBoolProperty== true);


text:
Q: Move part to bottom layer without mirroring in Eagle How can I move a SMD part in Eagle to the bottom layer without using mirror?
The resulting PCB should have the SMD pads on the bottom layer but mirrored (if you turn the PCB and look on it from top view) so that the SMD part does NOT fit on it.


text:
Q: Why finalizer is always called? I ran the following code and found that finalizer is always called. But many articles said that finalizer is non-desterministic.
class Test
{
    Test()
    {
        throw new Exception();
    }

    ~Test()
    {
        Console.WriteLine("Finalizer is called");
    }

    static void Main()
    {
        try
        {
            new Test();
        }
        catch { }
    }

A: It is still non-deterministic in your case. Non-deterministic means the amount of time it takes for something to happen cannot be pre-calculated. Note that being unable to correctly determine when something will happen does not necessarily mean random-time but in most cases they are roughly the same.
People who never have to control car brakes, industrial robots or the space shuttle generally should not care weather a piece of code is deterministic or not.
note: I have written code to control industrial robots so I sometimes need to care about my code being executed at the exact moment I want it to be.

A: The garbage collector calls the finalizer when it collects the object.  You can suppress the finalizer call by calling GC.SuppressFinalize(); Documentation
You could place this call inside Dispose() to stop the garbage collector from collecting the class after its resources have been disposed.

A: In your case, the finalizer is running as part of application shutdown.  From the docs:

During shutdown of an application
  domain, Finalize is automatically
  called on objects that are not exempt
  from finalization, even those that are
  still accessible.

Non-deterministic refers to when Finalize will be called.  But except in exceptional cases (like power being cut off or the process being abruptly killed), the finalizer will eventually be called.

A: There are cases when it may not be called; and cases where even if it is called, it may not be allowed to complete.

A: While there are certain occasions when the finalizer will not be called, it will typically be called. The big issue is when it is called, hence it is non-deterministic.
C# is garbage-collected and the garbage collector runs at unspecified intervals. Therefore, if the finalizer needs to do something time-sensitive, it is best to use Dispose instead of a finalizer. For example, you might want to close a database connection immediately instead of leaving it open while waiting for the garbage collector.

A: That code is so simple that the .NET Runtime can run the finalizer with out problems but in high load applications the Finalizers are only called when garbage collection runs.
There is here an extract of this article
http://msdn.microsoft.com/en-us/magazine/bb985010.aspx
Finalization
The garbage collector offers an additional feature that you may want to take advantage of: finalization. Finalization allows a resource to gracefully clean up after itself when it is being collected. By using finalization, a resource representing a file or network connection is able to clean itself up properly when the garbage collector decides to free the resource's memory.
Here is an oversimplification of what happens: when the garbage collector detects that an object is garbage, the garbage collector calls the object's Finalize method (if it exists) and then the object's memory is reclaimed. For example, let's say you have the following type (in C#):
public class BaseObj {
    BaseObj() {}

    protected override void Finalize() {
        // Perform resource cleanup code here...
        // Example: Close file/Close network connection
        Console.WriteLine("In Finalize.");
    }
}

Now you can create an instance of this object by calling:
BaseObj bo = new BaseObj();

Some time in the future, the garbage collector will determine that this object is garbage. When that happens, the garbage collector will see that the type has a Finalize method and will call the method, causing "In Finalize" to appear in the console window and reclaiming the memory block used by this object.


text:
Q: Problems with package tikZ I've switched to Ubuntu and the following code does not run, although it does on Mac OS. I have attached a screenshot with the logs.
This is the code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}
\begin{tabular}{ l | c | r }
    \sffamily
    &      A    &   B  \\ \hline
     1 & $\tikzmarknode{a11}{r_{1A}}$~ &   ~$\tikzmarknode{a12}{r_{1B}}$ \\ \hline
    2 & $\tikzmarknode{a21}{r_{2A}}$~  & ~$\tikzmarknode{a22}{r_{BA}}$ \\ \hline
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
\draw[stealth-stealth,blue] (a11.north east) -- (a12.north west)
node[midway,above,scale=0.4,black] (dAB) {$d_{AB}$};
\draw[-stealth,blue] (a21.south east) -- (a22.south west);
\draw[-stealth,blue] (dAB.south) to[out=0,in=80] (dAB.south|-a22);
\draw[stealth-stealth] (a11.east) -- (a21.east)
node[pos=0.5,above right,scale=0.4,black] (d12) {$d_{12}$};
\draw[-stealth] (d12.north) to[out=0,in=180] ([yshift=-1ex]a12.west);
\end{tikzpicture}
\end{document}


text:
Q: BigCommerce Stencil - Maximum Faceted Search Items? We are seeing an issue with the Cornerstone Light theme where the maximum number of facets available is 30 on a category page. Once the user clicks "Show More", the code only lists 30 facets. The client has over 100, so we need to have all of these available. I know Blueprint has the added functionality of the additional facets popup.
Are the additional facets not available currently in Stencil?
Does Stencil limit the facets to 30 options per type?
I would like to be 100% sure on this before I have to develop my own additional functionality to support more facets.
Thanks

A: Stencil does limit to 30 options per type, but Blueprint allows for 500. We will expand faceted search/stencil to allow for more options in the future.
Cornerstone 1.3 will offer support for this.


text:
Q: No backing instance variables in subclass I have a class that subclass from NSObject - Rectangle, and it subclass - Square.
In Rectangle.h i have properties:
@property int height, width;

Im implementation file i manually declare backing variables:
@implementation Rectangle
{
    int _width;
    int _height;
}

My question is: in my subclass Square that inherit directly from Rectangle - @interface Square : Rectangle, i want to use variables declared in superclass. However, i can't see them through _width or _height, but only calling getter method - self.width or [self setWidth:x] accordingly.
Yes, there is no problem using getter method, but why i can't use backing variables that are synthesised (in my case declared manually)? Is that somehow protected even from child class?

A: You're only declaring them in the header file. As far as your subclass is concerned, that header file represents its parent's interface. Officially, it doesn't know about the private instance variables, only the public properties.

A: Yes they are private and therefore can be removed/renamed which would break subclasses. Even though they are synthesized backing variables you still don't know what the exact implementation is.
You can create a seperate header and/or use @private if you really need to access them in a subclass.

A: If you wanted to be able to have your subclasses access variable directly (similar to public or protected in C++), you can declare them in the interface block:
@interface MyClass : NSObject {
    NSInteger _asdf;
}

Before the Objective-C non-fragile instance variables enhancement, the ability to declare instance variables was only available in the @interface block, and those variables were available everywhere.  It was possible to lock down the variables with the @private directive as well.
So, to answer your question: Declaring variables in the @interface block will allow you to access them directly, but I would exercise caution as the language is much better now that it is possible to hide implementation details.

A: If you want to use ivars that you create in your superclass in your subclass, then declare those ivars in your superclass's .h file (instead of properties). Also, you shouldn't "manually declare" the backing instance variables in your .m file since you get those automatically.
@interface Rectangle : NSObject {
    int height;
    int width;
}


text:
Q: Does $\sum_{n=2}^{\infty} \frac{1}{\ln(n)}\cdot{\sin(1/n)}$ converge? Does $\sum_{n=2}^{\infty} \frac{1}{\ln(n)}\cdot{\sin(1/n)}$ converge?
i know that $\sin(1/n) \le 1/n.\,\,\,$ but i can't find convergence test to prove it .

A: Hint: limit comparison test to $\sum \dfrac{1}{n \ln(n)}$, and integral test for that.

A: The series diverges. The bound $\sin(1/n)\le 1/n$ is not useful in this situation because the series $\sum(n\log n)^{-1}$ diverges. We need to bound $n\sin(1/n)$ from below. Since
$$
\frac{\sin(1/n)}{1/n}\to1
$$
as $n\to\infty$, for each $\varepsilon>0$ there exists $N(\varepsilon)$ such that $n\sin(1/n)>(1-\varepsilon)$ for $n>N(\varepsilon)$. We obtain
$$
\sum_{n=N(\varepsilon)+1}^\infty\frac{\sin(1/n)}{\ln n}=\sum_{n=N(\varepsilon)+1}^\infty\frac{n\sin(1/n)}{n\ln n}>(1-\varepsilon)\sum_{n=N(\varepsilon)+1}^\infty\frac1{n\ln n}.
$$
We have that
$$
\sum_{n=N(\varepsilon)+1}^\infty\frac1{n\ln n}\ge\int_{N(\varepsilon)+1}^\infty\frac1{x\ln x}dx=\lim_{m\to\infty}[\log\log x]_{N(\varepsilon+1)}^m=\infty.
$$
We conclude that the series diverges.


text:
Q: Run a ASP.Net 3.5 site with some pages written in classic ASP We have a site and a logged in section of the site that all was written in classic asp.  We are starting to convert the site pages to asp.net 3.5.  We are starting with the easiest pages (text mainly) first then we will rewrite the web application part of the site.
My question is - Is it possible to run the new asp.net 3.5 pages with classic asp pages?  Or will we need to rewrite everything before deploying?
Thanks

A: It will work fine. Be warned, however: Sessions are not automatically ported between Classic ASP and .NET.


text:
Q: How to rename a component in Angular CLI? Is there any shortcut to rename a component with the Angular CLI other than manually editing all the component files such as folder name, .css, .ts, spec.ts and app.module.ts?

A: Currently Angular CLI doesn't support the feature of renaming or refactoring code.
You can achieve such functionality with the help of some IDE.
Intellij, Eclipse, VSCode etc.. has default support the refactoring.
Nowadays VSCode is showing some uptrend,personally I'm a fan of this
Refactoring with VSCode
Determinig reference : -
VS Code help you find all references of a variable by selecting variable and pressing shortcut SHIFT + F12. This works incredibly well with Type Script.
Renaming all instances of reference :-
After finding all the references you can press F2 will open a popup and you can change the value and click enter this will update all the instances of reference.
Renaming files and imports
You can rename a file and its import references with a plugin. More details can be found here

With above steps after renaming the variables and files you can achieve the angular component renaming.

A: Yes!
Now there is.
There is an Extension for VS Code to do all of these steps for you. It's called Rename Angular Component.
I have hopes of porting it to WebStorm and a Schematic later.
Previously, it took at least three semi-automated steps in VS Code as a minimum. This Extension does all of them.
I realise this is promoting my own solution. But it is free, open source, and the complete answer. If it doesn't do everything you're looking for, you can post issues on the repo, and it will be improved.

A: While the OP asks for a CLI command, some of the answers focus on the IDEs. In this answer I just confirm, that the current WebStorm/IntelliJ does allow renaming the component. All that needs to be done is attempting to rename the class in the .ts file. You will be presented with:

and the rename will be performed in all relevant places.

A: No!
There is no command which will change the name of all files generated using the component create command. So created ts, html, css/scss, .spec.ts
 files need to be manually renamed/edited.
I am a frequent user of angular cli and I think this would be a nice-to-have command as some time we just create angular components and need to rename them. As this rename command is not there, deleting the created angular component, directive, etc and again running the command to create the component is really a pain.
Here is the discussion link to add this feature rename angular component

A: I personally have not found any command for the same. Just make a new component (renamed name) and copy paste  the previous component's html, css, and ts. In ts obviously the class name would be replaced. Its the safest method but does take a little time.

A: Here is a checklist I use to rename a component:
1.Rename the component class (VSCode Rename Symbol will update all the references)
<Old Name>Component => <New Name>Component

2.Rename @Component selector along with references (use VSCode's Replace in Files):
app-<old-name> => app-<new-name>

Result:
@Component({
  selector: 'app-<old-name>' => 'app-<new-name>',
  ...
})

<app-{old-name}></app-{old-name}> => <app-{new-name}></app-{new-name}>

3.Rename component folder (when renaming folder in VSCode, it will update references in module and other components)
src\app\<module>\<old-name> => src\app\<module>\<new-name>

4.Rename component files (renaming manually will be the fastest, but you can also use a terminal to rename all at once)
<old-name>.component.* => <new-name>.component.*

Bash:
find . -name "<old-name>.component.*" -exec rename 's/\/<old-name>\.component/\/<new-name>.component/' '{}' +

PowerShell:
Get-Item <old-name>.component.* | % { Rename-Item $_ <new-name>.component.$($_.Extension) }

Cmd:
rename <old-name>.component.* <new-name>.component.*

5.Replace file references in @Component (use VSCode's Replace in Files):
<old-name>.component => <new-name>.component

Result:
@Component({
  ...
  templateUrl: './<old-name>.component.html' => './<old-name>.component.html',
  styleUrls: ['./<old-name>.component.scss'] => ['./<new-name>.component.scss']
})

That should be sufficient

A: In WebStorm, you can right click → Refactor → Rename on the name of the component in the TypeScript file and it will change the name everywhere.

A: Just rename the files and components as you normally would think, then restart ng serve. Easy peasy.
Rename the files, paths, and references. The key is that you have to close your running server and start it again after everything is renamed.

A: As the first answer indicated, currently there is no way to rename components so we're all just talking about work-arounds!
This is what i do:

*

*Create the new component you liked.
ng generate component newName

*Use Visual studio code editor or whatever other editor to then  conveniently move code/pieces side by side!

*In Linux, use grep & sed (find & replace) to find/replaces references.
grep -ir "oldname"
cd your folder
sed -i 's/oldName/newName/g' *

A: If you are using VS Code, you can rename the .ts, .html, .css/.scss, .spec.ts files and the IDE will take care of the imports for you. Therefore there will be no complaints from the files that import files from your component (such as app.module.ts). However, you will still have to rename the component name everywhere it is being used.

A: There is no rename cli command yet. But the easiest way I have found to solve this problem is to generate a new component on the cli and copy the contents into the new component.
Then delete the original component and you will have one error for each spot in your codebase where you need to rename to the new component name. Once all the errors are dealt with you are done! :)
PS: Also you will have to delete the import statements for the old component.

A: To change the component name in Angular, you need to follow these steps:
Open the file containing the component that you want to rename.
Locate the @Component decorator above the component class definition.
Change the selector property in the @Component decorator to the new name that you want to give to your component.
For example, if you want to change the component name from my-old-component to my-new-component, you would do the following:
@Component({
  selector: 'my-new-component',
  ...
})

export class MyOldComponent {
  ...
}

Save the file.
That's it! You have successfully changed the component name in Angular.
Keep in mind that you may also need to update any references to the component in other parts of your application, such as in templates or in routing configurations.


text:
Q: The bash script using do while loop is executing infinitely Below is the bash script. Its executing infinitely. I want to execute the script only for 10 servers, which i have stored in servers.txt file. please help
#!/bin/bash
user=$1
pass=$2

if [ "$#" -ne 2 ];then
echo "Please run the script with userid and password as arguments"
fi

cat servers.txt | while read host

do {

 ./sandy_try.sh $user $host $pass

} < /dev/null; done

A: I would do something like
while read line; do
    echo do something fancy with "$line"
done < servers.txt


text:
Q: How to add an empty line in text file using shell script? This is my code; the "test.txt" file contains more empty lines and empty space apart from tab. I want to remove that empty space and empty lines as well but I need one empty line before starting st^. How to do it?
sed "s/^[ ]*//" -i  test.txt
cat $2 > /tmp/tt.txt
sed '/^$/d' test.txt > /tmp/tt.txt
echo " " >> test.txt
echo " " >>  /tmp/tt.txt
mv /tmp/tt.txt  test.txt

I am getting output like:
    st^flower
     p^rose
     p^jasmine
    st^animals
     p^bear
     p^elephant

I want output like:
    st^flower
     p^rose
     p^jasmine

    st^animals
     p^bear
     p^elephant

A: echo -e "\n"

With double quotes, it must work

A: To output empty line use this:
echo -en '\n'

e - interprets \n
n - outputs no empty line on the end, so there is no mess with double empty lines
Use single quotes to prevent shell from interpreting chars as end of line.

A: i've read your comment "it's giving each and every line space,but i want only before st^".
So you can insert new line before st^ with this code:
$cat /tmp/tt.txt | sed 's/^st\^/\n\0/g'

For example:
$ echo '
st^flower
 p^rose
 p^jasmine
 st^animals
 p^bear
 p^elephant' | sed 's/^st\^/\n\0/g'

Works fine for me.


text:
Q: Como utilizar TAnimate no Delphi Olá,
Estou querendo utilizar a ferramenta TAnimate, porem ela não tem nenhuma animação nela, onde eu pesquisei diz que já vem junto com a ferramenta. Sabem me dizer se tem que declarar algo junto? ou onde posso conseguir essas animações?
Elas consumem muita Thread só sistema também? ou usa uma independente da que o programa roda?

A: Amigo,
Eu utilizo o TRxGIFAnimator do pacote RxLib (http://www.micrel.cz/RxLib/) onde o mesmo é free....
Para isto vai precisar de um gif animado (tem um monte na intenet).
É só carregar o gif e para começar a animação dar um True na propriedade Animate...


text:
Q: retrieve individual documents from an envelope that has multiple instead of getting back combined I am using the rest API calling the envelope.Create() passing in a List of Byte arrays and filenames.
How can I retrieve each individual document separately after the signing ceremony?
The GetCompletedDocument sends me back the whole thing in one PDF. GetEnvelopeDocumentInfo just gets me names and URIs.
Using /restapi/v2

A: https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeDocuments/get/
That should give you an idea of how to grab individual documents.


text:
Q: How to query array which is present as string in postgres? I have a table called table with column called column with datatype text with values like '["1","2"]'.
I need to get all records which has "1" as one of the element.
select *
from table
where column.....?

How should the where clause be?

A: I think you can use ? operator on jsonb type:
select *
from (
    select '["1","2"]' union all
    select '["0"]'
) as a(data)
where
    a.data::jsonb ? '1'

In general, I'd consider storing your data as jsonb instead of string.
db<>fiddle example

A: Simply use LIKE. Keep the double quotes to pass 1, but avoid other numbers containing that digit.
select *
from table
where column like '%"1"%'


text:
Q: Can a normal approximation assumption justify itself? I am learning elementary statistics.
I found an exercise, which asks to compute the desired sample size for some interval for standard error.
The solution, in class slides, first assumes the sample size to be computed is big enough to be approximated by a normal distribution (central limit theorem), and uses it to get an answer that matches the assumption — the sample size is big enough.
Is this is a sound answer?  I don't think so; it may be a wrong assumption first, and that result deduced from it is not qualified to do any validation, is it?
If it is not the case, how can we prove that assumption first? Or put another way,if I want to compute a desirable sample size, is it that you can never allow using the central limit theorem on that answer/question?
*I have no teacher to ask because I'm self-studying.
edit I think the post is not quite clear, the C.T.L. is used upon a random variable that is the sum of all samples to be estimated.

A: The normal approximation is not some 'on/off' thing - it improves slowly as sample size increases and gets slowly worse as it decreases.
Which is to say, when you assume it, though it may lead you to a wrong sample size, if the sample size it leads you to is large enough*, the normal approximation at any nearby sample size should also be reasonable. If the sample size it leads you to is small, the normal approximation may be poor.
* I don't know that you would yet have a basis to conclude that in general; simulation will generally be a useful way to check
That is, if you're a little bit conservative about invoking the calculated sample size as a reason to use the normal-assumption value you calculated, it will usually work quite well.
When in doubt, you can sometimes use algebra or simulation to check how things work at the sample size you calculate; it depends on the exact details of the situation.
To my mind some of the other assumptions are more likely to cause you problems than that one.

A: In real life, although the actual distribution is unknown, there are some hints if the normal approximation ("the $t$-statistic is $t_n$-distributed as if the data were normally distributed") is reasonable at moderate sample sizes or not.
I assume you had to find the sample size $n$ for a $1-\alpha$-confidence interval for the parameter $E(X_i), i=1,\ldots,n$ that had to be $a\sqrt{E(X_i -E(X_i))^2}$ large.
If the true distribution is not much apart from the normal distribution (in particular quite symmetric) and $\alpha$ is large enough, you can proceed the way your textbook solution suggested. In this case the normal approximation is pretty fast. Just simulate some distributions and watch how far the actual coverage of $\mu$ is missed by the $t$-based CI. This is also statistician's experience.
If the true distribution is quite right-skewed, you can take the Berry-Esseen-Bound to adjust for possible liberalness due to nonormality and small sample size. Your conservative (i.e. $n$ may be too large, true coverage probability may be larger than $1-\alpha$) solution would then be the minimum integer $n$ solving
$$ 2 t_{n-1,1-\frac{\alpha}{2}+\frac{C\rho}{\sigma^3 n}}\leq a\sigma$$

A: It's only a problem if you got a sample size smaller than what is required to assume for normality.


text:
Q: Omnet++ UDP and beacon sending (inet/examples/wireless/lan80211) i have a problem with sending udp datagrams between host's connected to one AccessPoint. Below i show my ned and omnetpp.ini files i use example from inet/examples/wireless/lan80211.
All i want to do is to send beacon frames with some interval and also send UDP datagrams between hosts.
.ned file :
package inet.examples.wireless.lan80211;

import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;
import inet.nodes.inet.WirelessHost;
import inet.nodes.wireless.AccessPoint;
import inet.world.radio.ChannelControl;

network Lan80211
{
parameters:
    int numHosts;
submodules:
    host[numHosts]: WirelessHost {
        @display("r=,,#707070");

        wlan[*].mgmtType = "Ieee80211MgmtSTASimplified";
    }
    ap: AccessPoint {
        @display("p=213,174;r=,,#707070");

        wlan[*].mgmtType = "Ieee80211MgmtAP";
    }
    channelControl: ChannelControl {
        numChannels = 2;
        @display("p=61,46");
    }
    configurator: IPv4NetworkConfigurator {
        config=xml("<config><interface hosts='*' address='145.236.x.x'       netmask='255.255.0.0'/></config>");
        @display("p=140,50");
    }
}

Omnetpp.ini file:
[General]
network = Lan80211
#cmdenv-output-file = omnetpp.log
#debug-on-errors = true
tkenv-plugin-path = ../../../etc/plugins

**.constraintAreaMinX = 0m
**.constraintAreaMinY = 0m
**.constraintAreaMinZ = 0m
**.constraintAreaMaxX = 600m
**.constraintAreaMaxY = 400m
**.constraintAreaMaxZ = 0m

**.debug = true
**.coreDebug = false
**.channelNumber = 1

# channel physical parameters
*.channelControl.carrierFrequency = 2.4GHz
*.channelControl.pMax = 2.0mW
*.channelControl.sat = -110dBm
*.channelControl.alpha = 2

# access point
**.ap.wlan[*].mac.address = "10:00:00:00:00:00" #1=*
**.host[*].**.mgmt.accessPointAddress = "10:00:00:00:00:00"
**.mgmt.frameCapacity = 15
**.mgmt.beaconInterval = 0.04s

# UDP app (host[0] pinged by others)

**.numUdpApps = 2
**.udpApp[1].typename = "UDPBasicApp"
**.udpApp[0].typename = "UDPEchoApp"
**.udpApp[1].localPort = 1000
#**.udpApp[0].destAddresses = "host[0]"

#*Host[*].udpApp[0].typename = "UDPBasicApp"
**.host[0].udpApp[1].destPort = 1000
**.host[1].udpApp[1].destPort = 1000
**.host[0].udpApp[1].destAddresses = "host[1]"
**.host[1].udpApp[1].destAddresses = "host[0]"
**.host[*].udpApp[1].sendInterval = 10ms

# nic settings
**.wlan*.bitrate = 2Mbps

**.mac.address = "auto"
**.mac.maxQueueSize = 14
**.mac.rtsThresholdBytes = 3000B
**.wlan[*].mac.retryLimit = 7
**.wlan[*].mac.cwMinData = 7
**.wlan[*].mac.cwMinBroadcast = 31

**.radio.transmitterPower = 2.0mW
**.radio.carrierFrequency = 2.4GHz
**.radio.thermalNoise = -110dBm
**.radio.sensitivity = -85dBm
**.radio.pathLossAlpha = 2
**.radio.snirThreshold = 4dB

[Config Ping1]
description = "host1 pinging host0"
*.numHosts = 2

[Config Ping2] # __interactive__
description = "n hosts"

I find that when i change the line
wlan[*].mgmtType = "Ieee80211MgmtAP";

in .ned file the datagrams arived from one host to another but then beacon's sending doesn't work.
Also, i get some info from command window during simulation when udp datagram is pending:
** Event #320  T=0.02  Lan80211.host[0].udpApp[1] (UDPBasicApp, id=15), on selfmsg sendTimer' (cMessage, id=10)
** Event #321  T=0.02  Lan80211.host[1].udpApp[1] (UDPBasicApp, id=35), on selfmsgsendTimer' (cMessage, id=21)
** Event #322  T=0.02  Lan80211.host[0].udp (UDP, id=16), on UDPBasicAppData-2' (cPacket, id=304)
Sending app packet UDPBasicAppData-2 over IPv4.
** Event #323  T=0.02  Lan80211.host[1].udp (UDP, id=36), onUDPBasicAppData-2' (cPacket, id=305)
Sending app packet UDPBasicAppData-2 over IPv4.
** Event #324  T=0.02  Lan80211.host[0].networkLayer.ip (IPv4, id=18), on UDPBasicAppData-2' (UDPPacket, id=306)
Sending datagramUDPBasicAppData-2' with dest=145.236.0.2
Routing datagram UDPBasicAppData-2' with dest=145.236.0.2: output interface is wlan0, next-hop address: <unspec>
no next-hop address, using destination address 145.236.0.2 (proxy ARP)
Sending out packet to interface wlan0
** Event #325  T=0.02  Lan80211.host[1].networkLayer.ip (IPv4, id=38), onUDPBasicAppData-2' (UDPPacket, id=307)
Sending datagram UDPBasicAppData-2' with dest=145.236.0.1
Routing datagramUDPBasicAppData-2' with dest=145.236.0.1: output interface is wlan0, next-hop address:
no next-hop address, using destination address 145.236.0.1 (proxy ARP)
Sending out packet to interface wlan0
Any advices?
Thanks,
MB


text:
Q: Multiple Public IP's in One Network I have Internet connection from ISP and got Static IP pool of 8 IP's with 5 Useful IP's...
Now I want to establish following network
ISP -> Mikrotik Router -> Switch ===> Web Servers & LAN
Now My Web Servers Uses all four IP's and One Live IP will be configured in Mikrotik Router.
My Question is what is correct way of Making all Servers accessable via assigned static public IP's and also want to USE LAN with private IP's.
Should I go with NAT, PAT or PORT Forwarding or there is any other better technique and how to do it..

A: The "correct" solution is to configure your router with the public IP addresses and use 1:1 NAT so web traffic entering the network is properly translated to the private IP addresses of your web server.
The other "correct" way to do this is to place your web servers in a DMZ.


text:
Q: AWS ElasticBeanstalk using Babel to build distribution before application launch Currently I have a AWS EB stack setup using the default 64bit Amazon Linux 2016.03 v2.1.3 running Node.js AMI.
Our codebase is written in ES6 and we use Babel to transpile the code into ES5. Our current deployment process is running babel locally to build the /dist directory and commiting the dist into our git repository and using eb deploy to deploy the application to EB.
I would like to be able to remove the step of building the distribution locally and perform this operation on the EB server.
I have tried using .ebextensions with a command to execute npm run build which yields an error Return code: 127 Output: /bin/sh: npm: command not found.. I have also tried using files to insert the file into the appdeploy/pre which yields the same error. And I have tried using container_commands which also yields an error stating that npm is not available.
Which of the available deployment hooks that AWS EB provides would be the correct place to use npm run build?

A: You can use npm hooks.
For example:
Here I have a npm start command that fires my server but before it I have a babel . -d ./dist to compile the files on the dist directory. So I have a task called prestart ( using the npm hook pre naming convention ) that does that.


text:
Q: For var in object returns methods together with properties I've tried the following code and was surprised to discover that for var in object returns also objects methods.
I'm not sure why does it happen, are object methods essentially properties?
Is there any way to make it return only properties containing values?
var object = {p1: 1, p2: 2, p3: 3};

    object.funkcja = function() {
        for (var x in object) {document.getElementById("test").innerHTML += object[x] + "
";}
    };

example:

A: Checking like bellow should work.
for (var x in object) {
    if(object.hasOwnProperty(x)){
        document.getElementById("test").innerHTML += object[x] + "
";
    }

}

A: It's because JavaScript doesn't make difference between values and methods.
You'll have to filter the methods from the values yourself.
I suggest you use in your loop this function found here: How can I check if a javascript variable is function type?
for (var p in object){
    if(isFunctionA(p) == false){
        //Make your work on props here.
    }
}
function isFunctionA(object) {
 return object && getClass.call(object) == '[object Function]';
}

A: Yes, the methods of an object are simply properties which happen to be functions. You can test whether or not a property is a function using
 if(typeof object[x] === 'function')

or
 if(object[x] instanceof Function)

I believe the instanceof operator is slightly more efficient, but it can fail to work if you have multiple global contexts in effect (e.g. if you are passing objects between different frames).
It's also worth noting that the for in loop will return properties defined on the object's prototype as well as its instance properties. To avoid this, you can use
 if(object.hasOwnProperty(x))

A: I think this is the right way:
for (var x in object) {
    if(object.hasOwnProperty(x) && !(object[x] instanceof Function) ){
        document.getElementById("test").innerHTML += object[x] + "
";
    }
}


text:
Q: HQL com case, sum e max Estou com uma query que está dando problema, acredito que o problema ocorra por não permitir utilizar a função max, dentro da função sum, estou correto?
Como posso contornar isso? Pois preciso somar todos os valores com exceção da última row.
Segue a query:
"SELECT new project.domain.vo.MediaPagVo(" +
                    "a.nomeUsuario, " +
                    "a.cpfUsuario, " +
                    "a.cnpjUnidadeUsuario,        " +
                    "a.nomeUnidadeUsuario,        " +
                    "a.codigoGrupoUsuario,        " +
                    "a.grupo.id AS idGrupo,         " +
                    "CASE " +
                        "WHEN MAX(a.pre) - MIN(a.pre) > 0 " +
                        "THEN ((MAX(a.pre) - MIN(a.pre)) / SUM(CASE WHEN max(a.dtRequisicao) > a.dtRequisicao THEN a.valorTotal ELSE 0 END)) " +
                        "ELSE ((MAX(a.pos) - MIN(a.pos)) / SUM(CASE WHEN max(a.dtRequisicao) >= a.dtRequisicao THEN a.valorTotal ELSE 0 END)) " +
                    "END AS mediaConsumo, " +
                    "CASE " +
                        "WHEN MAX(a.pre) - MIN(a.pre) > 0 " +
                        "THEN " + Tipo.PRE.getValue() + " " +
                        "ELSE " + Tipo.POS.getValue() + " " +
                    "END AS tipoPag) " +
            "FROM " +
                    " Pagamento a " +
            "WHERE " +
                    "a.status = " + StatusPagamento.Concluido.getValue() + " AND " +
                    "a.dataRequisicao BETWEEN :inicio and :fim AND " +
                    "( :idGrupo IS NULL OR a.grupo.id = :idGrupo) " +
                   "GROUP BY " +
                    " a.nomeUsuario, a.cpfUsuario, a.cnpjUnidadeUsuario, a.nomeUnidadeUsuario, a.codigoGrupoUsuario, a.grupo.id, " +
            "HAVING (MAX(a.pos) - MIN(a.pos) > 0 OR MAX(a.pre) - MIN(a.pre) > 0) AND " +
                    "( :tipoConsumo IS NULL OR " +
                        ":tipoConsumo = " + Tipo.PRE.getValue() + " AND " +
                        "(MAX(a.pre) - MIN(a.pre) > 0) " +
                        "OR :tipoConsumo = " + Tipo.POS.getValue() + " AND " +
                        "(MAX(a.pos) - MIN(a.pos) > 0) ) ";

O erro começou a ocorrer depois que eu modifiquei este trecho, acrescentando o case dentro do sum:
"CASE WHEN MAX(a.pre) - MIN(a.pre) > 0 " +
                        "THEN ((MAX(a.pre) - MIN(a.pre)) / SUM(CASE WHEN max(a.dtRequisicao) > a.dtRequisicao THEN a.valorTotal ELSE 0 END)) " +
                        "ELSE ((MAX(a.pos) - MIN(a.pos)) / SUM(CASE WHEN max(a.dtRequisicao) >= a.dtRequisicao THEN a.valorTotal ELSE 0 END)) " +
                    "END AS mediaPag, "

O erro retornado pelo java:
Could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
Caused by: java.sql.SQLSyntaxErrorException: ORA-00937: não é uma função de grupo de grupo simples
Meu objetivo era somar todos os pagamentos daquele período, menos o último. Infelizmente, não poderia somente mexer no filtro, pois o max(a.pre), max(a.pos) podem ser do último pagamento.
Alguém tem alguma ideia?

A: Este erro refere-se ao próprio Oracle:

ORA-00937: não é uma função de grupo de grupo simples

Em inglês:

ORA-00937: not a single-group group function tips

Pelo que entendi, você adicionou os campos a.dtRequisicao e a.valorTotal dentro daquele SUM. O problema é que eles não estão declarados no GROUP BY e (pelo que entendo do erro) que também precisa ser declarados no seu SELECT
Sendo assim, a correção seria adicionar eles no GROUP BY:
"GROUP BY " + " a.nomeUsuario, a.cpfUsuario, a.cnpjUnidadeUsuario, a.nomeUnidadeUsuario, a.codigoGrupoUsuario, a.grupo.id, a.dtRequisicao, a.valorTotal" +

E no SELECT:
"SELECT new project.domain.vo.MediaPagVo(" +
                "a.nomeUsuario, " +
                "a.cpfUsuario, " +
                "a.cnpjUnidadeUsuario,        " +
                "a.nomeUnidadeUsuario,        " +
                "a.codigoGrupoUsuario,        " +
                "a.grupo.id AS idGrupo,         " +
                "a.dtRequisicao, a.valorTotal,         " +

Uma dica: tente não usar Train Wreck no JPQL/HQL, ainda mais repetindo ele em vários locais na mesma consulta. Exemplo: a.grupo.id. Muitas vezes o framework JPA cria consultas esquisitas por causa disto e, em alguns casos mais complexos, ocorrem até erros para gerar a consulta SQL. A solução é explicitar o JOIN:
JOIN a.grupo grupo

E usar grupo.id.


text:
Q: How can I present Menu (Not context menu) by using a Button in SwiftUI? struct MainMenuView: View {
var body: some View {
     Menu("Actions") {
         Button("Duplicate", action: duplicate)
         Button("Rename", action: rename)
         Button("Delete…", action: delete)
       }
   }
}

Button(action:{
   MainMenuView()
}, label: { Text("More") })

I have a "Menu" view it's just a menu, and I want to present it in another view using button action closure, so when tapping the button the menu pops up, anyone can help me with this, please.

A: Try this Using toolbar as an example
.toolbar{
       ToolbarItem(placement: .primaryAction) {
            Menu {
                Button(action: {//action}) {
                    Label("Bttn 1", systemImage: "text.badge.plus")
                }
                Button(action: {//action}) {
                    Label("Bttn 2", systemImage: "text.badge.plus")
                }
            }
            label: {
                Label("Add", systemImage: "plus")
                    .font(.title2)
                    .foregroundColor(.white)
            }
        }
    }