text:
Q: Multi Map Ravendb find documents based on documents present in another collection I have 2 collections in Ravendb. IdentifiedDupEmployees contain the duplicate employee information along with count of how many duplicate documents.
Employee contains the entire employee documents. I basically need to find the employee documents from employee collection based on firstname, lastname,DateofBirth,address1 present in IdentifiedDupEmployees.
I have written a multi map index. Please help me tweak it. Since currently it is returning everything present in Employee collection, I want only those documents returned from employee collection whose employee details present in IdentifiedDupEmployees collection
public class IdentifiedDupemployees {
            public string FirstName { get; set; }
            public string LastName { get; set; }
            public string DateOfBirth { get; set; }
            public string address1 { get; set; }
            public int count {get; set;}
}

Public class employee
{
           public string Ids {get; set;}
            public string FirstName { get; set; }
            public string LastName { get; set; }
            public string DateOfBirth { get; set; }
            public string address1 { get; set; }
}

namespace DuplicatePatient.Storage.Indexes
{
    class DupFindPatientId: AbstractMultiMapIndexCreationTask<DupFindPatientId.Result>
    {

        public class Result
        {

            public string Ids { get; set; }
            public string FirstName { get; set; }
            public string LastName { get; set; }
            public string DateOfBirth { get; set; }

            public string address1 { get; set; }
        }
        public DupFindPatientId()
        {

            AddMap<IdentifiedDupPatients>(entities => from a in entities

                                                      select new
                                                      {
                                                          Ids = (string)null,
                                                          FirstName = a.FirstName,
                                                          LastName = a.LastName,
                                                          DateOfBirth = a.DOB,
                                                          address1 = a.address1
                                                      });

            AddMap<Patient>(entities => from b in entities
                                        //from c in b.FirstName
                                        select new
                                        {
                                            Ids = b.Id,
                                            FirstName = b.FirstName,
                                            LastName = b.LastName,
                                            DateOfBirth = b.DateOfBirth,
                                            address1 = b.Address1
                                        });

            Reduce = results => from result in results
                                group result by new
                                {
                                    result.FirstName,
                                    result.LastName,
                                    result.DateOfBirth,
                                    result.address1

                                   }
                                    into g

                                    select new
                                    {
                                        Ids = g.Select(x => x.Ids).Where(x => x != null).First(),
                                        FirstName = g.Key.FirstName,
                                        LastName = g.Key.LastName,
                                        DateOfBirth = g.Key.DateOfBirth,
                                        address1 = g.Key.address1

                                    };
        }

A: I changed the index to include a Duplicate flag, and you can filter on that during query
public class IdentifiedDupemployees {
            public string FirstName { get; set; }
            public string LastName { get; set; }
            public string DateOfBirth { get; set; }
            public string address1 { get; set; }
            public int count {get; set;}
}

Public class employee
{
           public string Ids {get; set;}
            public string FirstName { get; set; }
            public string LastName { get; set; }
            public string DateOfBirth { get; set; }
            public string address1 { get; set; }
}

namespace DuplicatePatient.Storage.Indexes
{
    class DupFindPatientId: AbstractMultiMapIndexCreationTask<DupFindPatientId.Result>
    {

        public class Result
        {

            public string Ids { get; set; }
            public string FirstName { get; set; }
            public string LastName { get; set; }
            public string DateOfBirth { get; set; }

            public string address1 { get; set; }
        }
        public DupFindPatientId()
        {

            AddMap<IdentifiedDupPatients>(entities => from a in entities

                                                      select new
                                                      {
                                                          Ids = (string)null,
                                                          FirstName = a.FirstName,
                                                          LastName = a.LastName,
                                                          DateOfBirth = a.DOB,
                                                          address1 = a.address1,
                                                          Duplicate = true
                                                      });

            AddMap<Patient>(entities => from b in entities
                                        //from c in b.FirstName
                                        select new
                                        {
                                            Ids = b.Id,
                                            FirstName = b.FirstName,
                                            LastName = b.LastName,
                                            DateOfBirth = b.DateOfBirth,
                                            address1 = b.Address1,
                                            Duplicate = false
                                        });

            Reduce = results => from result in results
                                group result by new
                                {
                                    result.FirstName,
                                    result.LastName,
                                    result.DateOfBirth,
                                    result.address1

                                   }
                                    into g

                                    select new
                                    {
                                        Ids = g.Select(x => x.Ids).Where(x => x != null).First(),
                                        FirstName = g.Key.FirstName,
                                        LastName = g.Key.LastName,
                                        DateOfBirth = g.Key.DateOfBirth,
                                        address1 = g.Key.address1,
                                        Duplicate = g.Any(x=>Duplicate)
                                    };
        }


text:
Q: Using lambdas to do nested functions What's everybody's opinion on using lambdas to do nested functions in C++?  For example, instead of this:
static void prepare_eggs()
{
   ...
}

static void prepare_ham()
{
   ...
}

static void prepare_cheese()
{
   ...
}

static fry_ingredients()
{
   ...
}

void make_omlette()
{
    prepare_eggs();
    prepare_ham();
    prepare_cheese();
    fry_ingredients();
}

You do this:
void make_omlette()
{
    auto prepare_eggs = [&]()
    {
       ...
    };

    auto prepare_ham = [&]()
    {
       ...
    };

    auto prepare_cheese = [&]()
    {
       ...
    };

    auto fry_ingredients = [&]()
    {
       ...
    };

    prepare_eggs();
    prepare_ham();
    prepare_cheese();
    fry_ingredients();
}

Having come from the generation that learned how to code by using Pascal, nested functions make perfect sense to me.  However, this usage seemed to confuse some of the less experienced developers in my group at work during a code review where I made use of lambdas in this way.

A: For any given piece of code, make it as visible as necessary and as hidden as possible:

*

*If the piece of code is used in only one place, write it there.

*If it is used in multiple places inside the same function, emulate nested functions through lambdas.

*If it is used by multiple functions, put it in a proper function.

A: You can already guess that you're doing something unorthodox by the comments you received. This is one of the reasons C++ has bad reputation, people never stop abusing it. Lambdas are mainly used as inline function objects for standard library algorithms and places that require some kind of callback mechanism. I think this covers 99% of use-cases, and it should stay that way!
As Bjarne said in one of his lectures: "Not everything should be a template, and not everything should be an object."
And not everything should be a lambda :) there is nothing wrong with a free standing function.

A: I don't see anything wrong with nested functions per se. I use lambdas for nested functions, but only if it meets some conditions:

*

*It is called in more than once place. (otherwise just write the code directly if it's not too long)

*It is really an internal function, so that that calling it in any other context would not make sense.

*It's short enough (maybe 10 lines max).

So in your example I would not use lambdas for reason number one.
Conceptually nested functions can be useful for the same reason why private methods in classes are useful. They enforce encapsulation and they make it easier to see the structure of the program. If a function is an implementation detail to some other function then why not make it explicitly so?
The biggest problem I see is with readability; it's more difficult to read code that has a lot of nesting and indenting. Also, people are not very comfortable with lambdas yet so resistance is expected.

A: It's a very limited use case. For starters, the functionality present in the local function must be needed at several spots inside the enclosing function such that the resulting local refactoring will be a win in readability. Otherwise I will write the functionality inline, perhaps putting it in a block if that helps.
But at the same time, the functionality must be local or specific enough that I don't have an incentive to refactor the functionality outside of the (not so) enclosing function, where I could perhaps reuse it entirely in another function at some point. It must also be short: otherwise I'm just going to move it out, perhaps putting it in an anonymous namespace (or namespace detail in a header) or some such. It doesn't take much for me to trade locality off in favour of compactness (long functions are a pain to review).
Note that the above is strictly language agnostic. I don't think C++ spins a particular spin on that. If there is one particular C++ advice I have to give on the topic however, it's that I would proscribe using a default by-reference capture ([&]). There'd be no way to tell if that particular lambda expression describe a closure or a local function without carefully reviewing the whole body. Which wouldn't be that bad (it's not that closures are 'scary') if not for the fact that that by-reference captures ([&], [&foo]) allow mutations even if the lambda is not marked mutable, and by-value captures ([=], [foo]) can make an undesirable copy, or even attempt an impossible copy for move-only types. All in all I'd rather not capture anything at all if it's possible (that's what parameters are for!), and use individual captures when needed. It's especially problematic
To sum up:
// foo is expensive to copy, but ubiquitous enough
// that capturing it rather than passing it as a parameter
// is acceptable
auto const& foo_view = foo;
auto do_quux = [&foo_view](arg_type0 arg0, arg_type1 arg1) -> quux_type
{
    auto b = baz(foo_view, arg0, arg1);
    b.frobnicate;
    return foo_view.quux(b);
};

// use do_quux several times later

A: In my opinion it's useless, but you can accomplish that using only C++03
void foo() {
  struct {
    void operator()() {}
  } bar;
  bar();
}

But once again, IMHO it's useless.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Adding Column on table row with JQuery I have searching and trying some code for adding cols on table rows, here is my full code:
<!doctype htlm>

<?php

for($x=0;$x<5;$x++){
echo '
column 1
        column 2
        column 3
    column 4
    column 5
    column 6
    column 7

';
}

?>

but when I check the display, every row have 5 (according to looping) col 8 (that I added).
Can someone tell me where is the code wrong?


text:
Q: rApache module in Apache error I'm using ubuntu 13.10 with Apache2 , PHP5 and MySQL
I'm trying to add rApache module in Apache to work as a server R.
I configured my rapache exactly how this turorial shows .
http://binfalse.de/2011/05/r-for-the-web/
One file is created /etc/apache2/mods-available/r.conf
In this file , and put
<Location /R>
  ROutputErrors
  SetHandler r-script
  RHandler sys.source
</Location>

<Location /RApacheInfo>
  SetHandler r-info
</Location>

I add another "location"
<Location /brew>
  SetHandler r-script
  RHandler brew::brew
</Location>

in /brew directory I created a file called plot.R with the code :
<%

args <- 'brew work'
print(args)

%>

localhost/brew/plot.R if I try to access the page is loading endlessly and program files /var/log/apache2/error.log displays the error :
 Error in library(brew) : there is no package called 'brew'
  From directive RHandler on line 3 of /etc/apache2/mods-enabled/r.conf.

I 've tried to install R in the brew package
 install.packages("brew","/usr/local/lib/R/library")

but my error keeps appearing and I can not run the script plot.R

A: You need to install package brew and restart Apache.
Mark that it is important to install the package at the library location of R which is used by RApache.
To see which .libPaths are used by RApache, you can go to localhost/RApacheInfo in your browser (the following screenshot shows mine). If you installed RApache in the default way, the libpaths are probably not the path of your own user (e.g. in my case this is /home/janw/R/x86_64-pc-linux-gnu-library/3.0) but of the system wide library (probably /usr/lib/R/library). So make sure you install the package there: install.packages("brew", lib="/usr/lib/R/library"). Or log in as root and install the package.
su root
R
> install.packages("brew")

And don't forget to restart RApache!
sudo /etc/init.d/apache2 restart


text:
Q: Ideal Varnish & nginx setup to ensure cache consistency across multiple instances Looking for the ideal setup involving nginx as our top layer load balancer that distributes load across multiple Varnish instances.
What is the best way to distribute this load?  One way would be to simply distribute it evenly across instances or another be to distribute the load based on the request URL pattern.  Is there a best practice for this?
Also--we have a situation where we'll need to manually (from the backend) purge specific items from our caches.  Is the most effective way to do this simply to issue a small HTTP "PURGE" request to each of our Varnish instances?

A:
What is the best way to distribute this load? One way would be to simply distribute it evenly across instances or another be to distribute the load based on the request URL pattern. Is there a best practice for this?

It depends.  Two reason you'd want to base distribution on something like a URL hash:

*

*Cache size.  If you're caching enough data overall that you'd fill the cache of a given backend, it would help to have a certain URL always hitting the same backend, to distribute the storage of cache data between backends instead of storing duplicates.

*Speed of a missed request/cache lifetime.  If client requests missing cache is a problem and you cache doesn't last long, you'll probably get fewer misses if a given piece of content will always hit a given Varnish server.

Also--we have a situation where we'll need to manually (from the backend) purge specific items from our caches. Is the most effective way to do this simply to issue a small HTTP "PURGE" request to each of our Varnish instances?

That works, but leaves the next requester of the content with a potentially slow cache miss.  An alternative is to use Varnish's req.hash_always_miss to force an update of a resource in cache instead of just invalidating it, so a request from outside won't be forced to miss.
So something like this in your vcl:
acl purge {
    "localhost";
}
sub vcl_recv {
    /* add this into your existing config: */
    if (req.http.X-Varnish-Nuke == "1" && client.ip ~ purge) {
        set req.hash_always_miss = true;
    }
}

Then a request with that header set will force a backend request to update the content in cache (with curl or wget, --header "X-Varnish-Nuke: 1").


text:
Q: How to remove codehaus.org dependency when building Mule Connector I am trying to build a Mule Connector, everything has been done but when i am trying to build the connector into jar file with the below command:
mvn package -Ddevkit.studio.package.skip=false

then there is error return saying that the connection to codehaus.org (which is somehow shutdown) is not available.

A: You need to declare the mirror.
To configure a mirror of a given repository, you provide it in your settings file settings.xml, giving the new repository its own id and url, and specify the mirrorOf setting that is the ID of the repository you are using a mirror of.
            <mirror>
              <id>Codehaus id</id>
              <mirrorOf>codehaus.org</mirrorOf>
              <name>Codehaus.org repo</name>
              <url>http://repo.maven.apache.org/maven2/org/codehaus/</url>
            </mirror>

This should solve your problem


text:
Q: Authentication role I test my Controller with Mockito.
test my method in controller:
@RequestMapping("/dispatcher")
    public String disp(final HttpServletRequest request) {
        if (request.isUserInRole("USER")) {
            return "hello";
        } else if (request.isUserInRole("ADMIN")) {
            return "redirect:listUsers.htm";
        }
        throw new RuntimeException("This role is not registrated");
    }

My test method:
@Test

    public void testDispatcher() throws Exception {
    User user = userDao.findByLogin("log1");
    TestingAuthenticationToken testingAuthenticationToken = new TestingAuthenticationToken(user, AuthorityUtils.createAuthorityList("USER"));
              SecurityContextHolder.getContext().setAuthentication(testingAuthenticationToken);
                System.out.println(testingAuthenticationToken);
                mockMvc.perform(post("/dispatcher")
                        .principal(testingAuthenticationToken))
                        .andExpect(status().isOk());
}

Error:
org.springframework.security.authentication.TestingAuthenticationToken@bf72b5bd: Principal: User [id=1, firstName=name1, lastName=surname1, login=log1, email=email1@gmail.com, password=psw1, birthDate=1980-01-01 00:00:00.0, role=[id=1, name=USER]]; Credentials: [PROTECTED]; Authenticated: false; Details: null; Not granted any authorities
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.RuntimeException: This role is not registrated
How i can set Role for method request.isUserInRole();
or maybe has another solution to my issue

A: change my Test with add GrandAuthorities , but isUserinRole also "false"
 @Test
        public void testDispatcher() throws Exception {
            User user = userDao.findByLogin("log1");
            String sRole = user.getRole().getName();
            List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
            authorities.add(new SimpleGrantedAuthority(sRole));
            UsernamePasswordAuthenticationToken userDetails =
                    new UsernamePasswordAuthenticationToken(user.getLogin(), user.getPassword(),authorities);
            TestingAuthenticationToken testingAuthenticationToken = new TestingAuthenticationToken(userDetails, null,authorities);
            SecurityContextHolder.getContext().setAuthentication(testingAuthenticationToken);
            mockMvc.perform(post("/dispatcher")
                    .principal(testingAuthenticationToken))
                    .andExpect(status().isOk());
        }


text:
Q: HashSet.contains misbehaves As part of a Hadoop Mapper, I have a HashSet<MySimpleObject> that contains instances of a very simple class with only two integer attributes.  As one should, I customised hashCode() and equals():
public class MySimpleObject {

  private int i1, i2;

  public set(int i1, int i2) {
    this.i1 = i1;
    this.i2 = i2;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + i1;
    result = prime * result + i2;
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) return false;
    if (this == obj) return true;
    if ( obj.getClass() != MySimpleObject.class ) return false;

    MySimpleObject other = (MySimpleObject)obj;
    return (this.i1 == other.i1) && (this.i2 == other.i2);
  }

Somehow, sometimes, calls to mySet.contains(aSimpleObj) return true though the set actually doesn't contain this value.
I understand how hashCode() is first used to  split instances into buckets and equals() only called to compare instances within a given bucket.
I tried to change the prime value in hasCode() to spread instances differently into the buckets, and saw that contains() still sometimes returned a wrong result, but not for the same previously failing value.
It also seems that this value was then correctly identified as being outwith the set; I therefore suspect something is wrong with the equality check rather than the hashing, but I may be wrong...
I'm at a total loss here, and out of ideas.  Can anyone shed light on this at all?
----- edit -----
some clarifications:

*

*i1 & i2 are never updated after construction for the instances that were added to the set (though they are sometimes updated, elsewhere in the code, for other instances of that same class);

*the set is potentially quite large (i.e. can reach nearly 15K entries) and I wonder if the issue could be linked to this (bucket overflow, e.g.?).

A: I bet you have trouble coming up with a concise reproduction of this bug.
Your code shown looks right.  I think the objects in your collection are being mutated and this fact is obscured to you by other code.
You could debug this by temporarily adding:

*

*Add boolean hashCodeCalled=false to your class

*When hashCode() is called, set hashCodeCalled=true

*When a setter is called, and that boolean is true, then throw an exception or log the current stack trace

Alternatively,  you could refactor your code such that these instances are immutable and I bet the problem disappears.


text:
Q: Follow symlinks inside Wordpress directory? I'm working with a website built on WordPress, it's a fairly standard setup in cPanel. I've developed new features for the website in Laravel. I now need to view the Laravel public directory to an accessible web address.
I've tried symlinking the public Laravel directory to a directory inside public_html (where WordPress is).
I'm getting a WP 404 error, rather than the symlinked folder (Laravel public).
/home/user/public_html/ (WordPress DIR)
/home/user/repositories/laravel-app/public (Laravel public)

I then ran:
ln -s /home/user/repositories/laravel-app/public/ /home/user/public_html/book-online

I was hopeful that when going to domain.com/book-online it would load the Laravel app but it doesn't appear to be the case.
Update
I've managed to move a little further, I've realised the directory is definitely being resolved, I can access assets, just not index.php. For example. I can go to URL:
domain.com/book-online/css/style.css

and it will load the Laravel stylesheet
domain.com/book-online/index.php

gives me WordPress 404.
This is my .htaccess in public Laravel folder.
    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews -Indexes
        </IfModule>

        RewriteEngine On

        # Handle Authorization Header
        RewriteCond %{HTTP:Authorization} .
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} (.+)/$
        RewriteRule ^ %1 [L,R=301]

        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ /index.php [L]
    </IfModule>

A: It looks like you're missing the /repositories folder in the symlink path "ln -s /home/user/laravel-app/public/"
Also make sure your DNS entry is set up to look for the url you need : domain.com/book-online in your cpanel

A: Setting proper permissions fixed the issue.
I needed to set permissions on the public folder to 755 and also the index.php file to 644.
For others who may land here with a similar problem: First, you must symlink the public folder (or rename the public folder and move it to a publically accessible location) and set the permissions as above.


text:
Q: Not authorized to use Google Cloud Datastore for this project As of today I'm unable to Query my own Datastore from the new App Engine Admin console. I'm stopped by an Datastore Error "You are not authorized to use Google Cloud Datastore for this project."
I'm the owner of the project and I've tried on other "owner" accounts but I get the same error. It was working fine last week.

A: I had the same problem (reported and fixed) few months ago, I guess it came back with the last admin console update last week.
It is not a decent workaround but if you really need to perform a query before they fixe the issue you can:

*

*open the datastore query page

*remove the error from the html

*select "Query using GQL" (this one is still working apparently)

A: Looks like it's been resolved as of Today. I'm now able to access the Datastore Query page.


text:
Q: YCM could not work after build YCM didn't work after build finish, although .vimrc is being set.
What did I do?
sudo apt-get install build-essential cmake
sudo apt-get install python-dev python3-dev
sudo apt-get install clang
cd ~/.vim/bundle/YouCompleteMe
git clone https://github.com/Valloric/YouCompleteMe.git
git submodule update --init --recursive
./install.py --clang-completer --system-libclang
cp third_party/ycmd/examples/.ycm_extra_conf.py  ~
cd ..
cd..
cd..
vim .vimrc

Here I added to .vimrc:
let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py

Then:
vim  test.c

But code complete function did not work!
Outputs
vim --version:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
-clientserver    +iconv           +packages        -toolbar
-clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             -perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            -ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xsmp
+emacs_tags      -mouseshape      +startuptime     -xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    -xpm
+extra_search    -mouse_jsbterm   +syntax

:YcmDebugInfo:
E492: Not an editor command: YcmDebugInfo

OS version, distribution, etc.:
Linux ubuntu 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Installation commands:
./install.py --clang-completer --system-libclang

clang --version:
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

ycm build log:
Searching Python 2.7 libraries...
Found Python library: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so
Found Python headers folder: /usr/include/python2.7
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonLibs: /usr/lib/python2.7/config-x86_64-linux-gnu/libpython2.7.so (found suitable version "2.7.12", minimum required is "2.6")
Using libclang to provide semantic completion for C/C++/ObjC
Using external libclang: /usr/lib/x86_64-linux-gnu/libclang-3.8.so.1
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/ycm_build_uuTb3r
Scanning dependencies of target BoostParts
[  1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/errors.cpp.o
[  2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/long.cpp.o
[  3%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/str.cpp.o
[  5%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object_protocol.cpp.o
[  6%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/slice.cpp.o
[  7%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/dict.cpp.o
[  9%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/from_python.cpp.o
[ 10%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/builtin_converters.cpp.o
[ 11%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/arg_to_python_base.cpp.o
[ 13%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/registry.cpp.o
[ 14%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/converter/type_id.cpp.o
[ 15%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/list.cpp.o
[ 17%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/tuple.cpp.o
[ 18%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object_operators.cpp.o
[ 19%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/import.cpp.o
[ 21%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/exec.cpp.o
[ 22%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/wrapper.cpp.o
[ 23%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/module.cpp.o
[ 25%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/function_doc_signature.cpp.o
[ 26%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/enum.cpp.o
[ 27%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/stl_iterator.cpp.o
[ 28%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/pickle_support.cpp.o
[ 30%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/inheritance.cpp.o
[ 31%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/function.cpp.o
[ 32%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/life_support.cpp.o
[ 34%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/class.cpp.o
[ 35%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/python/src/object/iterator.cpp.o
[ 36%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/w32_regex_traits.cpp.o
[ 38%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wide_posix_api.cpp.o
[ 39%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_raw_buffer.cpp.o
[ 40%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/instances.cpp.o
[ 42%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/wc_regex_traits.cpp.o
[ 43%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/winstances.cpp.o
[ 44%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/cpp_regex_traits.cpp.o
[ 46%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex.cpp.o
[ 47%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/cregex.cpp.o
[ 48%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/usinstances.cpp.o
[ 50%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/fileiter.cpp.o
[ 51%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_debug.cpp.o
[ 52%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/c_regex_traits.cpp.o
[ 53%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/posix_api.cpp.o
[ 55%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/static_mutex.cpp.o
[ 56%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/regex_traits_defaults.cpp.o
[ 57%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/icu.cpp.o
[ 59%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/codecvt_error_category.cpp.o
[ 60%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/portability.cpp.o
[ 61%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/utf8_codecvt_facet.cpp.o
[ 63%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path_traits.cpp.o
[ 64%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/windows_file_codecvt.cpp.o
[ 65%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/operations.cpp.o
[ 67%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/path.cpp.o
[ 68%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/filesystem/src/unique_path.cpp.o
[ 69%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/system/src/error_code.cpp.o
[ 71%] Linking CXX static library libBoostParts.a
[ 71%] Built target BoostParts
Scanning dependencies of target ycm_core
[ 72%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
[ 73%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNodeListMap.cpp.o
[ 75%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierCompleter.cpp.o
[ 76%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierUtils.cpp.o
[ 77%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Candidate.cpp.o
[ 78%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNode.cpp.o
[ 80%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[ 81%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangUtils.cpp.o
[ 82%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangHelpers.cpp.o
[ 84%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Range.cpp.o
[ 85%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompletionData.cpp.o
[ 86%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit.cpp.o
[ 88%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/CompilationDatabase.cpp.o
[ 89%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnitStore.cpp.o
[ 90%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/Documentation.cpp.o
[ 92%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/ClangCompleter.cpp.o
[ 93%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[ 94%] Building CXX object ycm/CMakeFiles/ycm_core.dir/IdentifierDatabase.cpp.o
[ 96%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/versioning.cpp.o
[ 98%] Building CXX object ycm/CMakeFiles/ycm_core.dir/PythonSupport.cpp.o
[100%] Linking CXX shared library /home/m/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
[100%] Built target ycm_core

when I finish build the YCM, and config .vimrc , the code complete function did not work for c file or cpp file~~~
does  anybody know why?


text:
Q: Editing word in skydrive with share function Me and my buddy are using skydrive and we are sharing a word document. We're both editing the document in Microsoft Office 2013. When we update our documents, the comments that we write in the word are duplicated, each time we update. We're currently at 100 duplicates for one comment alone.
Does anyone know how to 'stop' that or is that a bug?
thank you for your answers


text:
Q: How to load a saved model defined in a function in PyTorch in Colab? Here is a sample code of my training function(unnecessary parts are deleted):
I am trying to save my model data_gen in the torch.save(), and after running the train_dmc function, I can find the checkpoint file in the directory.
def train_dmc(loader,loss):

  data_gen = DataGenerator().to(device)

  data_gen_optimizer = optim.Rprop(para_list, lr=lrate)

  savepath='/content/drive/MyDrive/'+loss+'checkpoint.t7'
  state = {
            'epoch': epoch,
            'model_state_dict': data_gen.state_dict(),
            'optimizer_state_dict': data_gen_optimizer.state_dict(),
            'data loss': data_loss,
            'latent_loss':latent_loss
            }
  torch.save(state,savepath)

My question is that how to load the checkpoint file to continue training if Google Colab disconnects.
Should I load data_gen or train_dmc(), it is my first time using this and I am really confused because the data_gen is defined inside another function. Hope someone can help me with explanation
data_gen.load_state_dict(torch.load(PATH))
data_gen.eval()

#or

train_dmc.load_state_dict(torch.load(PATH))
train_dmc.eval()

A: As the state variable is a dictionary, So try saving it as:
with open('/content/checkpoint.t7', 'wb') as handle:
    pickle.dump(state, handle, protocol=pickle.HIGHEST_PROTOCOL)

Initiate your model class as data_gen = DataGenerator().to(device).
And load the checkpoint file as:
import pickle
file = open('/content/checkpoint.t7', 'rb')
loaded_state = pickle.load(file)

Then you can load the state_dict using data_gen = loaded_state['model_state_dict']. This will load the state_dict to the model class!


text:
Q: Arrayformula with Filter of Mulitple Columns I can't convert this formula into an arrayformula.
short version:
=filter(H2:AI2,H2:AI2<>"")
long version:
=if(H2<>"",H2,IF(I2<>"",I2,IF(J2<>"",J2,IF(K2<>"",K2,IF(L2<>"",L2,IF(M2<>"",M2,IF(N2<>"",N2,IF(O2<>"",O2,IF(P2<>"",P2,IF(Q2<>"",Q2,IF(R2<>"",R2,IF(S2<>"",S2,IF(T2<>"",T2,IF(U2<>"",U2,IF(V2<>"",V2,IF(W2<>"",W2,IF(X2<>"",X2,IF(Y2<>"",Y2,IF(Z2<>"",Z2,IF(AB2<>"",AB2,IF(AC2<>"",AC2,IF(AD2<>"",AD2,IF(AE2<>"",AE2,IF(AF2<>"",AF2,IF(AG2<>"",AG2,IF(AH2<>"",AH2,IF(AI2<>"",AI2,"")))))))))))))))))))))))))))
Neither returns an array effect. Dragging down the formula will work until a form is submitted. The cell in that row loses its formula.
SAMPLE1
SAMPLE2

A: If each column has just one cell filled then problem is simple:
You take ALL the cells in the table and join together (I use # as separator) using textjoin.
Then I split them (which gives me a row of cells).
To have it as a column I use transpose at the end.
=TRANSPOSE(split(textjoin("#",1,A1:E10),"#"))

If there is more content in each row - it will be solved in a totally different way.


text:
Q: Modify code to wrap whole words & make it non case sensitive function filterSearchWords() {
    var query = $("#searchquery").val();

    go(query);
    function go(query) {
        $(".search-result p:contains(" + query + ")").html(function (_, html) {
            return html.replace(query, "$&", 'gi');
        });
        $(".search-result h2 a:contains(" + query + ")").html(function (_, html) {
            return html.replace(query, "$&", 'gi');
        });
        console.log(query);
    }
}

This is my attempt. It adds the span alright, but only to words or part of words that includes the string. Lets say the string is Pie, it adds the span to all "Pie" and wraps "Pie" in Piechart, however I want it to wrap all Piechart, and pie with no capitals.
Can anyone modify my code to help me?
Thanks
My attemption to use the regex "gi" does not seem to be working :/
UPDATE
Almost there...
function filterSearchWords() {
    var query = $("#searchquery").val();

    go(query);
    function go(query) {
        $.extend($.expr[':'], {
            'containsi': function (elem, i, match, array) {
                return (elem.textContent || elem.innerText || '').toLowerCase()
                .indexOf((match[3] || "").toLowerCase()) >= 0;
            }
        });

        $(".search-result p:containsi(" + query + ")").html(function (_, html) {
            return html.replace(new RegExp(query,  "gi"), "$&");
        });
        $(".search-result h2 a:containsi(" + query + ")").html(function (_, html) {
            return html.replace(new RegExp(query, "gi"), "$&");
        });
        console.log(query);
    }
}

This is my last question. I have succeeded to remove the casesensitive part, but it does not match the entire words.

A: A note on the third flags parameter from MDN:

Note: The flags argument does not work in v8 Core (Chrome and Node.js)

You should use a RegExp object instead:
return html.replace(new RegExp(query, "gi"), "$&");


text:
Q: How to upgrade the Existing node js application? Currently we are using node Js version 8, if I switch that to node Js 16, application is not working, and it shows lot of errors.
How to upgrade the existing node js application to latest version of node? what are steps we need to follow?
Error:
 { inspect: [Function: inspect] }
[2022-04-18 11:18:27.085] [ERROR] app - Could not load adapter sails-db2 try npm install sails-db2
[2022-04-18 11:18:27.097] [INFO] app - Running ORM initialization, please wait...
C:\Chanel\Existing\chanel-reinvent-ui-db2\node_modules\waterline\lib\waterline\connections\index.js:62
      throw new Error(msg);
      ^

Error: Unknown adapter "sails-db2" for connection `default`.  You should double-check that the connection's `adapter` property matches the name of one of your adapters.  Or perhaps you forgot to include your "sails-db2" adapter when you called `waterline.initialize()`...


text:
Q: How to enable Shutter selection option in ubuntu 21.04 I have installed shutter by using this command in ubuntu 21.04
sudo add-apt-repository ppa:linuxuprising/shutter
sudo apt-get update
sudo apt install shutter

or
sudo snap install shutter

shutter installed but the selection option to take screenshot of something specific is disabled.

I have used it earlier with ubuntu 18.04 and 20.04 but it does not work in 21.04


text:
Q: Создание изображения платежного чека из таблицы JTable Имеется таблица с информацией (данные получаются из базы sql), имеется ли возможность создавать динамические чеки (в зависимости от выбранной строки в таблице) и выводить их в формате png / pdf? Чек вида:

Благодарю!

A: IText - сила. Прекрасно все реализуется посредством подключения данного модуля (ccылка)


text:
Q: multi-platform native libraries in C# nuspec We have a C# project (.net Core) which is cross-platform. It uses native libraries (C++), which are different for each platform.
We know that you can specify different frameworks in a single nuspec file, but this case is different:

*

*There will be a single C# DLL file

*There will be different native libraries (like a.linux.so and a.windows.dll)

We want be able to install only the libraries that are pertinent to a specific OS.
What is the recommended mechanism?

A: First, make sure you are using SDK-based projects to ensure you get correct dependency trimming for target frameworks like netstandard* (instead of using a .nuspec file).
The goal is to separate your native runtime assets into a runtimes subfolder inside your NuGet folder so that the layout is:
\lib\YourManagedCode.dll
\runtimes\win-x86\native\some.dll
\runtimes\win-x64\native\some.dll
\runtimes\linux-x64\native\libsome.so
\runtimes\osx-x64\native\some.dylib

An example project file could look like this, assuming you already have runtimes folder:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <None Update="runtimes\**" Pack="true" PackagePath="runtimes" />
  </ItemGroup>
</Project>

If you need to test locally, you can also add CopyToOutputDirectory="PreserveNewest" to ensure the files are copied to the output. .NET Core should be able to resolve files located in runtimes directories for methods annotated with [DllImport("some")].
The resulting NuGet package can be referenced from both .NET Core and .NET Framework projects. If some "RID-fallback" (e.g. win10-x64 => win-x64) does not work on .NET Framework projects, make sure this project also references a recent version of the Microsoft.NETCore.Platforms package (it provides NuGet with a graph of known values, has nothing much to do with .NET Core itself..).


text:
Q: doctrine regenerating models from yml only the base models? I am wondering if there is a way to handle this more elegantly.
After generating the "main" models and base models from yml files the first time I have to add at the very leased an include for the base model to the "main" model like so:
include_once 'generated/BaseBlog.php';

At the moment before I regenerate the models I move my changed main models, which is mostly way more then just the include path, in to a tmp folder then I delete all the models.
And after regenerating I move my modified models back overwriting the generated main models.
isn't there a way to just create the base models and not touch the main models?
Or how do you guys handle this?

A: Doctrine only overwrites the models in the generated/ folder, it doesn't touch the models that derive from the Base* models.
And if you use conservative loading of models, you don't need to worry about including the base models in your own models at all (and you really should use conservative loading of models).
You can use conservative autoloading like this:
Doctrine_Core::loadModels(APPLICATION_PATH . '/models', Doctrine_Core::MODEL_LOADING_CONSERVATIVE);

It should work with aggressive loading too, but at the moment on some operating systems Doctrine tries to load the child classes before the base classes, and that results in errors.


text:
Q: How to kill chromium command line over ssh? I have a chromium running on a raspberry pi showing some monitor stats. Sometimes, the startup fails opening the relevant tabs and hence I want to restart chromium. Yet running:
killall chromium-browser

only kills the tabs, showing me the "oh snap" information. I want the entire chromium to shutdown.
Running the same command again yields in:
killall chromium-browser
chromium-browser: no process found

even though I see the oh snap tab.

A: pkill chromium

did the trick .

A: To exit Chromium gracefully use the following command:
pkill -o chromium

If you do not specify the "-o" ("--oldest") flag you might see the "Chromium didn't shut down correctly" pop-up next time you start Chromium. Because signal will be received by all chromium processes instead of just the main one.
Based on this answer.


text:
Q: Python: Change all instance attributes to properties Say we have 10 attributes:
class test(object):
  def __init__(self,a,b,c,d,e,f,g,h,i,j):
    self._a = a
    #the same with the rest of variables

Is it possible to make them all properties?:
@property
def a(self):
  return self.a
@a.setter
def a(self,a_new):
  #invoke other functions doing other stuff when attribute values change
  self._a = a_new

If I need the same functions to run when any instance attribute is changed, do I have to type the above code for each attribute? Is it possible to write the code once then use it as a custom decorator or something similar?
If the custom decorator is the way to go, can I afterwards override the setter function for some attributes?

A: If you really want all of your instance attributes to be properties you can implement __setattr__ and __getattribute__ methods. Here's a short demo:
class Test(object):
    attr_names = {'a', 'b', 'c', 'd'}

    def __init__(self, a, b, c, d):
        self.a = a
        self.b = b
        self.c = c
        self.d = d

    def __repr__(self):
        return 'Test({}, {}, {}, {})'.format(self.a, self.b, self.c, self.d)

    def __setattr__(self, name, value):
        if name in Test.attr_names:
            print('Setting {} to {}'.format(name, value))
            super().__setattr__(name, value)
        else:
            raise AttributeError("Can't set unknown attribute: " + name)

    def __getattribute__(self, name):
        if name in Test.attr_names:
            print('Getting {}'.format(name))
            return super().__getattribute__(name)
        else:
            raise AttributeError("Can't get unknown attribute: " + name)

t = Test(1, 2, 3, 4)
print(t)
t.b = 7
print(t)

try:
    t.e = 42
except AttributeError as err:
    print(err)

output
Setting a to 1
Setting b to 2
Setting c to 3
Setting d to 4
Getting a
Getting b
Getting c
Getting d
Test(1, 2, 3, 4)
Setting b to 7
Getting a
Getting b
Getting c
Getting d
Test(1, 7, 3, 4)
Can't set unknown attribute: e

This code is for Python 3. In Python 2 you will need to pass appropriate args to super:
super(Test, self)

eg,
super(Test, self).__setattr__(name, value)

Please see the data model docs for more information about these methods.


text:
Q: Is there a way to make a herald rule only trigger based on an action not on a state? I am trying to make a herald rule that triggers when someone removes a tag from a task. The way that I came up with was to have a herald rule that asserts that the task has the other traits that I want, then have another herald rule that uses the first herald rule as a condition, then check that the tag is missing as the other condition. So I have
Herald Rule A - Checks that a task has other traits I want to the issue to still have
Herald Rule B - Checks that Rule A is true, but also that the tag I want removed is missing.
So this only protects me from the case where someone makes a new task that both matches the conditions of A and B. This is because the task hasn't been made yet, so it never matches A (even though the task will match A after it has been made. I should say the conditions of A are themselves set by a third different herald rule and that's why that is true), so in that case, it doesn't match B and doesn't do the action in B.
And I thought I was so clever. But then if you made a task that matched A, but also already matched B, it would pass B anytime you make ANY change to that task, not just if you had removed the tag so that it would start matching B. I don't want that.
I only want my herald rule to pass when it matches A and ONLY when the tag is removed so that it wasn't matching B before and then starts matching B. If Herald operated on actions and not just states, this would be a lot easier. How can I describe the state to include the state of both before and after whatever action happens that triggers the herald rule?

A: When creating a global maniphest task herald rule, you should be able to select that the actions are performed only if the rule did not match the last time it was evaluated. This should allow you to have the rule not match if the project has the tag, and then match later on once the project is removed.


text:
Q: Why Blazor component raises CancellationTokenSource has been disposed exception? I come accross to following code:
[Parameter]
public PrinterVM Printer { get; set; }

private string StatusBackground { get; set; }
private string StatusText { get; set; }
private string IconText { get; set; }

private CancellationTokenSource cancellationTokenSource;
private PrinterStatusVM PrinterStatus;
private bool isDisposed = false;
private bool dialogIsOpen = false;

protected override async Task OnInitializedAsync()
{
    cancellationTokenSource = new CancellationTokenSource();

    if (PrinterStatus == null)
        await RunTimer(cancellationTokenSource.Token);
}

private async Task RunTimer(CancellationToken cancellationToken)
{
    await Task.Factory.StartNew(async () =>
    {
        while (!cancellationToken.IsCancellationRequested)
        {
            await UpdateStatus();
            await InvokeAsync(() => this.StateHasChanged());
            Thread.Sleep(5000);// <= Should this be here???
        }
    });
}

private async Task UpdateStatus()
{
    PrinterStatus = await TpsService.GetPrinterStatus(Printer.Id);
    (StatusBackground, StatusText, IconText) = PrinterStatus.PrinterState
        switch {
            PrinterStatusType.ERROR => ("red darken-4", "ERROR", "error"),
            PrinterStatusType.WARNING => ("yellow darken-2", "WARNING", "warning"),
            PrinterStatusType.IDLE => ("grey darken-2", "IDLE", ""),
            _ => ("", "RUNNING", "")
        };
}

public void Dispose()
{
    if (!isDisposed)
    {
        isDisposed = true;
        cancellationTokenSource?.Cancel();
        cancellationTokenSource.Dispose();
    }
}

And from time to time I am getting CancellationTokenSource has been disposed error. What I am thinking about this Blazor code that problem may be in RunTimer method and Thread.Sleep() method.
Any idea how this code can be improved and what could go wrong with this code?


text:
Q: How to customise EKEventEditViewController I am using default EKEventEditViewController in my App and I want to customize it, currently it shows all fields that came in default EKEventEditViewController, but I don't want to show URL field and also want to add  Timezone field. Can I do that and if yes then pleas let me know how can I do this?

A: you can use this excerpt:
1) make your viewcontroller the delegate of your EKEventEditViewController
EKEventEditViewController *addController = [[EKEventEditViewController alloc] init];
addController.delegate = self;

2) then implement this on your view controller:
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    if ([viewController isKindOfClass:[UITableViewController class]]) {
        UITableView *tableView = ((UITableViewController *)viewController).tableView;

    for (NSInteger j = 0; j < [tableView numberOfSections]; ++j)
    {
        for (NSInteger i = 0; i < [tableView numberOfRowsInSection:j]; ++i)
        {
            UITableViewCell *cell = [tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:j]];

            NSLog(@"cell => %@, row => %d, section => %d", cell.textLabel.text, i, j);

            if([cell.textLabel.text isEqualToString:@"Calendar"]) {
                [cell removeFromSuperview];
            } else if(j == 5) { // If URL Field
                [cell removeFromSuperview];
            }
        }
    }
}

}
Note: I found this in another Stackoverflow answer before and implemented it on my project. I forgot the link. Hope this helps and thanks to the original answer where I got this.


text:
Q: How to figure out primary/secondary IDE channel via sysfs (if possible) Though I've got quite a good basic understanding of sysfs meanwhile, there are still things I cannot solve on my own.
For a starter, I'd like to figure out via sysfs (later by scripting of course) which channel a block device (HDD, DVD...) is connected to.
The funny thing about it is that it is possible for me how to figure out master or slave! There is an internal ID deeply rooted in the sysfs tree which gives this away: so 9:0:1 will mean that the device is connected to a (primary OR secondary) slave channel. (master when last digit 0; slave when last digit is 1)
OK, but this will still not tell me whether it's the primary or secondary channel.
While doing some research about this, I found a Linux 2.6-related post in LKML: https://lkml.org/lkml/2006/3/25/20 revealing a sample path like ../../../devices/pci0000:00/0000:00:04.0/ide0/0.0/.
Well this is EXACTLY what I need!
Unfortunately though, the ideX is nowhere to find in sysfs as of Linux 3.x. Maybe it was removed for good in kernel version 3?

A: Things have been reorganised.
Now, ATA devices (old IDE PATA — parallel — and newer SATA — serial) are all under the /sys/devices/pcixxxx:xx/xxxx:xx:xx.x/atax path (where x represents numbers), for instance /sys/devices/pci0000:00/0000:00:11.0/ata1/link1 for the first device on the first controller.


text:
Q: Patch installation SUPEE-10570 In the website, all patch installed manually without ssh,
Can we skip SUPEE-10497 patch and install directly SUPEE-10570 because we have already installed SUPEE-10415, SUPEE-10266
Website magento version is 1.9.2.4
Refer screenshot:- https://prnt.sc/j6as6l
Thanks,


text:
Q: Help with integrating latest Delphi Web Script (DWS) with SynEdit I decided to have a concerted effort to get the excellent DWScript (Delph Web Script DWS) integrated into a simple IDE using SynEdit. DWScript is currently being agressively developed and has a number of advantages over other Pascal Script libraries, however it does not contain an editor or any IDE example beyond a simple memo control to prove execution capability. It does contain a number of hooks for editor / debugger integration and in fact when DWS was reawakened a while ago, releases did contain an example of a SynEdit / DWS2 (as it was then) integration. An example can be found in the file dws2src20-20030907.zip in the \dws2rel\dwstools\idedialog\source where there is a 'mini-IDE' with editor window, call stack, breakpoint window etc. Really nice. I did get this working some months ago using an old SynEdit and the DWS2 that was included in this file.
So, I have now tried achieve this (or a similar) ide using the latest SynEdit (downloaded from SVN) and the latest DWScript (also from the SVN). Both libraries are installed fine into XE and their demos run fine. I then tried taking the ide example from the old "\dws2rel\dwstools\idedialog\source" and updating the code but much has changed. Frustratingly, not so much has changed that I gave up quickly - I tried searching for the various 'old' type definitions in old source and matching them up with 'new' definitions. Finally though, after several hours mired in code I decided that someone, somewhere must surely have been down this route?
Has anyone got an example of a DWScript - SynEdit integration using recent DWScript code please? I'm very happy with something simple that I can learn / build upon.
Thanks

A: SynEdit component has received little maintenance, and even some projects as Inno Setup have changed to Scintilla, Inno Setup is not using DWS but the code can serve you as a basis for new IDE

A: Dws have a editor on the demos with debuger and remote debuger just download all versions of dws one


text:
Q: the debugging finish without completing the debug I debug my code as usual , and put set of break points but i note that the debugging finish without completing the cycle !!
and this is happened in a dummy manner . How to fix this problem ?

A: When I have problems with the break points I go and delete the .suo file that is a hidden file with the same name as the project on the same directory with the project and keeps among other information's, the debug break points.
Always make a backup first.

A: How about trying this
1.) Run-> type inetmgr
2.) From the Application Pools, select the name of the application pool that you are working on.
3.) Right click and select Advance Settings
4.) Under Process Model, increase the value of "Ping Maximum Response Time" to say for example 9000
5.) Also try increasing the value of the "Ping Period"
Hope this helps. :)

A: Is it skipping the breakpoints? If so, I had this problem on Visual Studio 2008, and had to apply this patch:
http://archive.msdn.microsoft.com/KB957912/Release/ProjectReleases.aspx?ReleaseId=1796


text:
Q: "School Students" — what, like there's any other kind of student? I think this might be a Pennsylvania thing: every so often, you'll see a van or small bus labeled, not "School Bus" or anything sane normal like that, but "School Students".

Whenever I see a van like that, I find myself wondering, school students? Is that as opposed to... ... uh... nursing home students? Courthouse students? Bacon students? I mean, what other kind of student is there?
Can anyone shed some light on this tautology? Is it a tautology? Does it sound normal to anyone who didn't grow up in Pennsylvania?
[Aside: Lord help me, I'm using the meaning tag...]

A: Yes, this sounds weird. You can come up with a lot of different kinds of students and stretch it to say they aren't technically in schools ("a martial arts studio isn't a school!" Or the abstract route: "I'm a student of life!"). But the underlying truth is that "School Students" isn't a specific enough category to actually give you any sensible amount of information. You don't know what kind of students they are, how old they are, why you need to know they're in the car...
Others have mentioned that it could be because if it only said "Students" you would assume the car was being driven by a student driver. Well... For one thing, I'm still not sure the car isn't being driven by a student driver. What reason do I have to believe that "School Students" can't be a shortened version of "Driving School Students"? There clearly isn't much room left on the sign. Also, even if you do assume that is what it means, I'm still not sure what the makers of the sign want you to do with that information. "There are students of an undetermined type in this car, but they're not student drivers!" What am I going to do differently with this extremely vague piece of information? I don't know if these are preschoolers, college students, kindergarteners... Literally the only thing you know, under this assumption, is that they aren't student drivers. Well, if the car hadn't had a sign at all, I'd probably have assumed that it statistically wasn't being driven by a student driver. So what is this sign telling me that actually helps anything?
Assuming the only logical intent anyone's come up with, which is that the car has young children inside and they are urging you to be careful, I don't think the sign accomplishes that goal. "Elementary School Students" would probably be too hard to read, especially while moving on the road. But you could easily go with other messages, like "Children Inside!" or "Watch Out For Kids!". Or honestly, you could go the most easily-recognizable route and just write "School Bus" on the sign. Yes, it is clearly a car and not a bus. But if a car says "School Bus" on a school-bus-yellow sign, I'm going to assume there are kids in a car and it's being used like a bus. It's not really a huge leap.
So, I agree with you that this is a weird and ineffectual way to get across...well...whatever message it is they think they're getting across. Because clearly we can't agree on what it's supposed to mean. I'm not 100% sure it's a tautology, but in the general sense I do agree it's unneeded. If it simply said "Students", the same (vague and unuseful) message would be conveyed. So it's definitely not necessary in this situation, at least.

A: If the sign only said "Students," I for one would assume that it meant student drivers. If it says "School students," I assume just the opposite: that it has a professional driver, with children on board. The latter lets me know to expect stops, and for children to get on and off.

A: I don't think it's a tautology unless you connote student with school. I know all school students go to school, but not all students do; lots of learning takes place in other institutions.
Nursing students have the choice of attending programs in hospitals vs. colleges/university. I don't think of medical students as school students (even though they're in Med School) because they're essentially adults in a very specialized training program with little diversification (which is crap if you're a dental student, who often has to do two years of med school.) Likewise, though grad students are in grad school, it's hardly a school, and they are hardly your typical students. Student of the Arts. Student of Philosophy. A student of Blake. A student of History/Linguistics. A student of dance. A student of concern.
I guess having gone through so many different kinds of schools, and the need for lifelong continuing education to retain Board certification, has given me a different mindset regarding the words student, studies and school. So, to me, it's not a tautology.
As to why those signs are used, I think KnightofNi is correct. PA probably has that sign on non-buses carrying small groups of school students because it looks like the yellow and black school buses, and alerts other drivers to a similar level of respect that we have for the buses.

A: I don't associate student with school exclusively. And neither do any definitions I can find. The ones I list below are from the American Heritage Dictionary but more can be found in this link.

from The American Heritage® Dictionary of the English Language, 4th Edition
n. One who is enrolled or attends classes at a school, college, or university.
n. One who studies something: a student of contemporary dance.
n. An attentive observer: a student of world affairs.

One can be a student of human nature or a student of someone else or a lifelong student or a violin student or whatever. None of these imply a schoolkid to me.
My personal understanding of the word (which is supported by every definition I checked) is that student simply means one who is in the process of learning. It makes no suggestion about what institution, if indeed any, this learning is taking place in.
I should also admit that I speak an idiosyncratic dialect which may be influenced by my Philadelphia-born father but I have never even visited the place, let alone lived there.
Finally, the etymological approach also confirms my usage. Student derives from the Latin studiare via the Old French estudiant. The original meaning of the verb study was:

From c.1300 as "apply oneself to the acquisition of learning, pursue a formal course of study," also "read a book or writings intently or meditatively." From mid-14c. as "reflect, muse, think, ponder." Meaning "regard attentively" is from 1660s. Related: Studied; studying.

Again, nothing here restricts its meaning to schools.

A:
what other kind of student is there?

College students. Private students. Home-schooled students. Student drivers.
As Keshlam noted in a comment:
It says "school students" because if it just said 'students" many of us would indeed translate it as "student drivers." Which is a somewhat different kind of hazard. A car full of school students isn't likely to suddenly swerve into your lane. A car full of student drivers isn't likely to have one of them get out and run across the road.

A: I'll propose a blend of the other answers: Since the question mentions Pennsylvania, I'm answering in terms of American English (the only dialect I know ;-)
I guess that the author of that sign was trying to communicate, within a specific shape, a group or category for which we lack a conveniently short term.  We have the broad category of 'student' but as Medica and others point out, that's a very broad term (with fuzzy boundaries) that covers a lot of people who, for safety and legal purposes, are not like the passengers of these particular cars and vans.
Keep in mind that as the text of the sign gets longer, the font has to get either narrower, or smaller, both of which reduce legibility at a distance. One of the constraints at work here (I speculate) was wanting to keep the text short enough that the letters could use the full height of the signboard.
We have nice two-word terms for "college student", "nursing student", "student driver", etc., but we don't have a shorter equivalent of "elementary or secondary school student", which I suppose is the underlying category.  So, the sign's author made something up that (a) tries to narrow the category of student by excluding all the other common one- and two-word possibilities, while (b) effectively filling the available space on a sign that, if I know anything about bureaucrats, they had already chosen the size of.

A: The sign probably isn't meant to make it more clear what kind of students they are, (I think) it's trying to emphasize to drivers that there are children aboard, and that the drivers should be careful. Think: "students" doesn't really raise too many red flags in your head ("what are these students doing? what are they students of?"). "School students," for whatever reason, makes me think "danger! small children!"

A: I realise that in your part of the world, "school" can also include higher education. However, it doesn't in other parts. Here in the UK, for example, "school" means "primary and secondary education".

school
Pronunciation: /skuːl
NOUN

*

*An institution for educating children: Ryder's children did not go to school at all

There are a number of other definitions on that page. I believe the one that is confusing you is this one:

2.1 North American • informal  another term for university. Harvard is certainly not a loafer's school.

Note that this specifically says that it is both North American and informal. In the rest of the world, talking about "going to school" or "school students" means the education system for children.
It's also worth noting that here in the UK at least, if you just said "students" you would be referring to university students. We don't tend to refer to schoolchildren as students at all - if we did, we'd specifically say school students to avoid confusion. Saying schoolchildren or pupils is much more common.
The following conversation I overheard a few years ago illustrates the confusion that using "student" to mean "school student" can bring.
(Cultural context: A-levels are qualifications gained at the end of secondary education, at age 18. You take 3-4 of them. Whilst you can do a degree in more than one subject, if you did it would be "Maths with Chemistry" or similar, not just a list; we don't "major" and "minor" in subjects.)

"What do you do?"
  "I'm a student."
  "Oh, right. What are you studying?"
  "Maths, Chemistry, English and French."
  "Oh, you mean you're an A-level student!"

(I'd wager the reason the second speaker even said "I'm a student" instead of "I'm still at school" to begin with was probably because "What do you do?" suggests the first speaker was expecting a job as a reply and second speaker was probably a little self-conscious about saying, "I'm still at school.")

A: I don't live in the US and I've never seen a similar vehicle in the UK, but after thinking about it for a bit, I believe nobody has understood the function of that large vivid yellow sign with school and students written on it. It is acting as a sign post, a visible form of identification for those "students" who need to be picked up and taken to school or back home.
I'd imagine there are agreed stops for those students, both children and teenagers, who cannot travel on buses (for whatever reason). Think of yellow cabs with Taxi written on a roof sign which can be illuminated.  Like the numbers written on a bus, they inform the person/student who is waiting that they have arrived.
For the different and possible types of students this vehicle could carry, see @Jon Hanna's answer
EDIT
In Connecticut, school bus signs say:

Whilst in Ohio signs will say, SCHOOL TRANSPORTATION, in Quebec: ECOLIERS, and yes, SCHOOL STUDENTS is a Pennsylvania thing. Source

A: Merriam-Webster consider a student to be someone who studies something.  I consider myself to be a Student.  So I do not consider the phrase to be a tautology.

A: Since it's Pennsylvania, the seeming redundancy is likely a heritage of the strong German influences in the region. German likes everything made explicit so there are a lot of phrases like "school student" in the language. The word ordering is also likely from German.


text:
Q: Checking if the sequence converges or not While exploring the function $y = x^{x^{x^{.^.}}}$, I tweaked it a little bit to result in $y = x^{{1/x}^{x^{{1/x}^{x^{{1/x}^{.^.}}}}}}$. It can be easily shown that the second function can be maximized using the equation $y = x^{{1/x}^y}$. This can also be verified using the plot. The maximum value occurs near $x = 2$ and is approximately $1.32$.
Now, if I form a sequence with the general term defined like below:
$$a_n = 2^{1/2^{3^{{1/3}^{.^{.^{n^{1/n}}}}}}}$$, then how can I show if it converges or not (along with finding the possible limit). I've tried computing the terms of this sequence and does seems to approach a limit though (to approx. $1.32$) (link).
What might be the possible approach to show the convergence? Is it possible that the sequence might be oscillating (even though with a diminishing amplitude)?


text:
Q: Optionality of argument of child one function depend on optionality of argument of other function typescript I am creating a function example, which takes function fn1 as an argument and returns function fn2;
type Values<T> = (values: T) => Promise<void>;  //function with argument
type NoValues = () => Promise<void>;    //function without arguments
type Func1<T> = Values<T> | NoValues;

let example = function <T, R extends Func1<T> = Func1<T>>(fn1: R) {
    const fn2 = async (values: R extends Values<T> ? T : void) => {
        await fn1(values);
    }
    return fn2;
}

fn1 should take one optional argument. Depending on whether fn1 has optional argument, fn2 also should have it. So if fn1 DOES NOT have any arguments, then fn2 should also not have them and vice-versa.
I tried to write such restrictions with many ways, but still can not succeed. I would be glad if someone helps me.
interface IExample {
    whatever: string;
}
const test1_fn1 = async () => console.log("");
const test1_fn2 = example<IExample>(test1_fn1);
test1_fn2() //Should work, but does not. Expected 1 argument. Not intended

const test2_fn1 = async (values: IExample) => console.log(values);
const test2_fn2 = example<IExample>(test2_fn1);
test2_fn2() //Should not work, does not work, as intended
test2_fn2({whatever: ""}) //Should work, works, as intended

TS version: 3.8.3.
Here is playground

A: Probably easiest with overloading:
type Values<T> = (values: T) => Promise<void>;  //function with argument
type NoValues = () => Promise<void>;    //function without arguments
type Func1<T> = Values<T> | NoValues;

function makeFn2<T>(fn1: NoValues): NoValues;
function makeFn2<T>(fn1: Values<T>): Values<T>;
function makeFn2<T>(fn1: Func1<T>): Func1<T> {
    return async (...values: [T?]) => {
        await (fn1 as any)(...values);
    }
}

declare const argFunc: Values<string>;
const argFunc2=makeFn2(argFunc);
argFunc2("s");
argFunc2();  // error

declare const noArgFunc: NoValues;
const noArgFunc2=makeFn2(noArgFunc);
noArgFunc2();
noArgFunc2("asd");  // error

It should be correct both in compilation and in runtime, i.e. fn1 is called with an argument only if fn2 was called with it.


text:
Q: Enabling Weblogic for remote JMX access now makes it unable to connect locally I have an app deployed to my local WebLogic instance (10.3.6) on my Win7 laptop.  It's creating Beans through Spring and registering them in the local MBeanServer.  I can open up VisualVM, see the "WebLogic" process and see the mbeans that I've registered.  This works fine.
I then wanted to set up my JVM for remote JMX access.  I took the simple-minded approach for now and set the following properties:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true
I made sure the "jmxremote.access" and "jmxremote.password" file in my JRE was set appropriately.
I started it up, then opened up VisualVM on my Linux box and created a remote host entry for the IP address of my laptop, then a JMX connect to port 8888, and specified the name:pwd pair I set in the jmxremote.access and jmxremote.password files.  This all worked fine.  I could see all the same registered mbeans.
Then, I went back to my laptop and looked my local VisualVM, and I saw that there was no "WebLogic" process.  It appears that enabling my JVM for remote JMX access has disabled local access.  Is this supposed to happen?  Is there a way to configure this?  This isn't necessarily a big problem, I just need to understand it.


text:
Q: IIS external access by IP address Can's seem to get this to work. Tried various combinations in Site Bindings. I can view default web page using the internal IP address as well as machine name from any computer on my network, but when it comes to accessing via public IP, which I got from whatismyip.com, browser keeps on waiting and waiting and eventually craps out..
Also, I've disabled Firewall (temporarily), but no luck. I've never done this kind of setup before so, I'm struggling a bit.
My ISP doesn't block traffic on port 80.
All entries in bindings screenshot represent various combinations I've tried either all together or separately..

Cheers!

A: Here are some thoughts I have on configuring the resources on your network.
Configuration Notes
It looks like you have a router, so it is your router that is bound to the external IP, not your computer. In that case your computer does not have the external IP (75.75.75.75). It only has the internal IP (10.0.0.6). You should set up your router to forward port 80 to your computer's internal IP address. You should bind IIS to the internal IP as well.
I should note that given your screen shots above, that you are close to already doing this. The only thing I would remove from your configuration above is the IIS binding to the external IP (75.75.75.75).
Testing
When testing your site, a potential issue is with the router itself. Generally a router will not let an internal machine access an internal resource (e.g. IIS) via an external IP. So for example, if you try to browse from inside your network to 75.75.75.75, the router will not let it happen. That may be why you are seeing the browser hang. What you should do to test the web site is to access the external IP from outside of your network. Have a friend or relative (outside your network) try to connect to the external IP and see if it works.
So how should you access the site from inside your network? Use the internal address only (10.0.0.6).


text:
Q: How to draw a decision tree in R I want to present (draw) a flow of decisions starting from root continue decision nodes up to 6 layers.
The decision root (R) will splits into 2 decision options X1 and X2, each of these Xs then divided into 3 new branches of Y1, Y2, and Y3,
then Ys divided into 3 branches Z1, Z2, and Z3, and so on.
Please note that I am not going to classify or doing recursive analysis.
Any help please?

A: You could use rpart.plot package in R which is used to plot Classification and Regression Trees. One such example is

 This link would be helpful for examples.


text:
Q: minimum graph coloring using backtracking I am working an m_coloring problem wherein I have to determine the chromatic number m of an undirected graph using backtracking. The (java) solution I have thus far is increment m, try the m_Coloring method, and then repeat if a solution is not found. However, for the larger files, if m is over 6, the computation takes forever. I have been told that the algorithm we were given to use does not have pruning incorporated, so I am trying to figure out how to put it in and am having no luck after a week of searching.
vColor = new int[nodes+1];
vColor[1] = 1;
while(unsolved)
{
    m++;
    mColoring(1);
}

static void mColoring(int i)
{
    int color;
    if (promising(i))
    {
        if (i==nodes)
        {
            unsolved = false;
        }
        else
        {
            for(color = 1; color<=m; color++)
            {
                if(unsolved)
                {
                    vColor[i+1] = color;
                    mColoring(i+1);
                }
            }
        }
    }
}

static public boolean promising (int i)
{
    int j=1;
    boolean promise = true;

    while(j<i && promise)
    {
        if(adjMatrix[i][j] && vColor[i] == vColor[j])
        {
            promise = false;
        }
        j++;
    }
    return promise;
}

A: A simple, efficient and well known exact algorithm uses Brélaz minimum degree of saturation heuristic DSATUR (i.e. choose as new candidate vertex the one with less available colors, alias with more different colored neighbors) for branching inside a full enumeration scheme.
The basic pruning strategy is implicit: every candidate vertex can only have at most as many colors as used in the preceding vertices + 1 (the new color, assigned if it is saturated). This means that the search can be pruned along any branch which backtracks on a vertex whose last assignment was a new color.
I am sorry I can give you no reference to a Java implementation of an exact DSATUR-based algorithm but I can give C, C++ refs if you are interested.


text:
Q: Elasticsearch CompositeAggregation.aggregateAfter usage is unclear to me this is my code, where I want to gain pagination ability, for not getting the whole bucket list and not to overload RAM memory. But anyway, it's  unclear to me:

*

*what is this actually 'afterKey' for, and what is the use case. Yeah I understand that here, as a key of that 'aggregateAfter' map should be set  the field, on which it's going to be aggregated the results, but what about the value of that map, what to set there, this is what I don't understand at all. Please have a look on this code, and introduce the changes that should be done here, in order the pagination works for me.

*Am I thinking correct way, that here the response(searchResponse) should contain only the paginated results, or I should do more from here to gain that miracle.

public BucketList getListOfBucket(final BucketListInfo bucketListInfo, int from, int size) {
            final SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            for (final String aggrField : bucketListInfo.getAggrFieldList()) {
                CompositeAggregationBuilder aggregationBuilder = AggregationBuilders
                        .composite(aggrField, List.of(new TermsValuesSourceBuilder(aggrField).field(aggrField)))
                        .aggregateAfter(Map.of(aggrField, aggrField))
                        .size(bucketListInfo.getTopResultsCount());
                searchSourceBuilder
                        .from(from)
                        .size(size)
                        .aggregation(aggregationBuilder);
            }
            final SearchRequest searchRequest = new SearchRequest(bucketListInfo.getIndexName())
                    .source(searchSourceBuilder);
            try {
                final SearchResponse response = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
// here with the response all buckets are coming, instead of only the specified amount(as pagination 'size', and 'from') of buckets to come
                return extractBucketsFromResponse(bucketListInfo, response);
            } catch (Exception e) {
                log.error(e.getMessage(), e);
                return null;
            }
        }


text:
Q: Quiero ocultar inputs según lo que se seleccione en el combobox Tengo una pregunta con un combobox que tienen 2 opciones, ejemplo
CONDICIÓN DEL estudiante con 2 opciones como respuesta
1.EGRESADO
2. NO EGRESADO
  <select name="pregunta[0].ope_id" id="pregunta[0].ope_id" class="form-control selectinput valid">
            <option value="44" data_arreglo="33,34,35">EGRESADO</option>
            <option value="45" data_arreglo="32">NO EGRESADO</option>

En el campo data_arreglo guardo los id de las preguntas que dependen de la respuesta que elijo y que quiero ocultar.
Acá esta una de las preguntas que quiero ocultar.
<input type="hidden" name="pregunta[2].pre_id" id="pregunta[2].pre_id" value="33" data_padre="31">

quiero utilizar una función que obtenga el evento y oculte las preguntas.
Gracias de antemano.
Actualmente solo he logrado esto, pero no sirve a mi propósito

var preguntas = document.querySelectorAll('[data-trigger]');
preguntas = [].slice.apply(preguntas);
preguntas.forEach(function(item, i){
 var _trigger = item.attributes['data-trigger'].nodeValue;
  if(_trigger === "true"){
   document.getElementById(item.attributes['id'].nodeValue).addEventListener("change", Disparar);
  }

});

function Disparar(e){
  console.log(e.target.type);
 var id = e.target.attributes['id'].nodeValue;
  switch(e.target.type){
   case 'select-one' : ss_selectOne(id); break;
    default: break;
  }

}

function ss_selectOne(id){
  var hijos = document.querySelectorAll('[data-padre]');
  hijos = [].slice.apply(hijos);
  hijos = hijos.filter(function(item){
   return item.attributes['data-padre'].nodeValue === id;
  });
  hijos.forEach(function(item, i){
   document.getElementById(item.attributes['id'].nodeValue).removeAttribute("disabled");
  });
  var element = document.getElementById(id);
  var arreglo = element.options[element.selectedIndex].attributes['data-arreglo'].nodeValue.split(',');
  arreglo.forEach(function(item, i){
    if(item !== ""){
     document.getElementById(item).setAttribute("disabled","disabled");
    }
  });

}
 <select id="31" data-trigger="true">
 <option value="" data-arreglo="">Seleccione</option>
  <option value="1" data-arreglo="33">Egresado</option>
  <option value="2" data-arreglo="32">No Egresado</option>
</select>

<select id="33" data-trigger="false" data-padre="31">
 <option value="" data-arreglo="">Fecha de Egreso</option>
  <option value="1">Fecha de Egreso</option>
</select>
<select id="32" data-trigger="false" data-padre="31">
 <option value="" data-arreglo="">Seleccione</option>
  <option value="1">Motivo por el cual no ingreso</option>
</select>
<br>

A: Recomiendo hacerlo con jquery y clases. Asi podria quedar el código:
<select name="pregunta[0].ope_id" id="pregunta[0].ope_id" class="form-control selectinput valid" onchange="cambia_visibles()>
    <option value="44" data_class="egresado">EGRESADO</option>
    <option value="45" data_class="no_egresado">NO EGRESADO</option>
</select>

Los inputs:
<input type="text" name="pregunta[2].pre_id" id="pregunta[2].pre_id" value="33" data_padre="31" class="mostrar egresado">
<input type="text" name="pregunta[2].pre_id" id="pregunta[2].pre_id" value="34" data_padre="31" class="mostrar egresado">
<input type="text" name="pregunta[2].pre_id" id="pregunta[2].pre_id" value="35" data_padre="31" class="mostrar egresado">
<input type="text" name="pregunta[2].pre_id" id="pregunta[2].pre_id" value="36" data_padre="31" class="mostrar no_egresado">

y la funcion que los oculta:
function cambia_visibles() {
    valor = $("#pregunta[0].ope_id")..attr("data_class");
    $(".mostrar").show();
    $("."+valor).hide();
}

A: Para que se respete tu código es necesario agregar el onchange="cambia_visibles();":
<select name="pregunta[0].ope_id" id="pregunta[0].ope_id" class="form-control selectinput valid" onchange="cambia_visibles();">
    <option value="44" data_arreglo="33,34,35">EGRESADO</option>
    <option value="45" data_arreglo="32">NO EGRESADO</option>
</select>

Prueba la siguiente funcion:
function cambia_visibles() {
    var valores = $('option:selected', this).attr('data_arreglo');
    var valores_array = valores.split(',');
    $(".mostrar").show();
    $("."+valor).hide();
    for(var i = 0; i < valores_array.length; i++) {
        var select_input = "input[value="+valores_array[i]+"]"
        $(select_input).closest('input').hide();
    }
}

Los inputs deben ir como text:
<input type="text" name="pregunta[2].pre_id" id="pregunta[2].pre_id" value="33" data_padre="31">

A: He aquí una manera, aparatosa cuanto menos, de llegar al select que deseas y añadir el evento change sin hacerlo explícitamente en el html:
window.onload = function(){
                var selects = document.getElementsByTagName("select");
                for (var i = 0; i < selects.length; i++) {
                    var element = selects[i];
                    if(element.getElementsByTagName("option")[0].value == "44"){
                       element.addEventListener("change",function(){
                            //aqui ocultas los inputs :)
                       });
                    }
                }
            }

A:   function funcionlogicapreguntas(selc,preid) {
        @{
            foreach (var hr in logica)
            {
                var hcont = hr.pre_id_sec_id_Habilita.Split(',');
                var classnameocult = hr.tipo_sec_pre.GetValueOrDefault() ? ".divnamepregunta" : ".divnameseccion";
                var classnamecontent = "";
                foreach (var h in hcont)
                {
                    if (classnamecontent == string.Empty)
                    {
                        classnamecontent = classnamecontent + classnameocult + h;
                    }
                    else
                    {
                        classnamecontent = classnamecontent +","+ classnameocult + h;
                    }
                }
                @:if (preid == "@hr.pre_id" && $(selc).val()=="@hr.ope_id"){
                @:$("@classnamecontent").show();
                @:} else {
                @:$("@classnamecontent").hide();
                @:}
            }
        }


text:
Q: Credentials are changed from other device I am newbie to Android. I am working on an application where user is supposed to login to use the application and application can run on different devices (like multiple phones) simultaneously. There is a feature where user can changes his password. How to know if user has changed his login credentials on a device from another device, so that user will be automatically logged out from all the devices. It is same as Gmail. How to achieve it in a optimal/feasible way. Can it be implemented using sync adapter or account authenticator. If yes, please let me know.
Any tutorial or snippet is appreciated.
Thanks in advance.


text:
Q: How to reject a call programatically android Is it possible to reject a call by code in android
please help i have gone through some tutorials but they are not working for me.

A: yes dude it it possible try this http://androidsourcecode.blogspot.in/2010/10/blocking-incoming-call-android.html it is working i tried

A: No, AFAIK and AFAITried this is not possible... This was possible in 2.2 and before. after 2.2 they change some security permission or library i dont know. You will find many links saying "its doable and i have tried and its working" and they may be right but it will be before 2.2.... Hope i answer ur question.


text:
Q: How do I run rsync in exec from php? I'm running Ubuntu Server 16.04.
I can run this command in Terminal without any problem at all:
rsync -rtv source user@ip:/dest/

But when I try to run the same command with exec in PHP it doesn't work.
exec('rsync -rtv source user@ip:/dest/');

I have tried several tutorials this weekend but I can't get it to work, I think that the problem is that the apache user don't have the permission to run rsync but I can be wrong here.
This is one of the tutorials that I have tried that I think is my problem but I don't understand what to do:
https://serverfault.com/questions/248979/php-rsync-with-exec-not-working

A: I think your problem is that the user that is running php has no rights to the folder.
Find out which the user is and set it as owner if possible.


text:
Q: How to prove that $f(x,y) = \frac{2x^3+3y^2}{x^2y+xy^2}$ is not homogeneous? How to prove that the following function is not homogeneous?

$f(x,y) = \frac{2x^3+3y^2}{x^2y+xy^2}$

Definition:

A function $F(x,y)$ of the variables $x$ and $y$ is called homogeneous of degree $n$ if for any parameter $t$
$F(tx, ty) = t^n F(x,y)$.

So in this function, it is not possible to write the expression in the form $t^n F(x,y)$. How do I prove that this function is not homogeneous?

A: Just compute $f(tx,ty)$:
$$f(tx,ty) = \frac{2(tx)^3 + 3(ty)^2}{(tx)^2 (ty) + (tx)(ty)^2}.$$
Now, can you factor out $t$ to get $f(tx,ty) = t^n f(x,y)$? If not, then your function is not homogenous. (I have left you a little bit of work to do.)

A: $$f(x,y) = \frac{2x^3+3y^2}{x^2y+xy^2}$$
Let's fix a $t \ne 0$
$$f(tx,ty) = \frac{2x^3+3t^{-1}y^2}{x^2y+xy^2}$$
$$t^n f(x,y) = t^n\frac{2x^3+3y^2}{x^2y+xy^2}$$
So we could not find any $n$ to make $f(tx,ty)=t^nf(x,y)$ for all $x,y$


text:
Q: Removing catalog/layer/view.phtml gives wrong search results I'm having an issue with search results. I was switching my search results page over to a one column layout and removed the sidebar in catalogsearch.xml by taking out
    <reference name="left">
        <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
    </reference>

When I removed that, the search results that were returned were incorrect, but when I leave it in, the search results are correct. The page successfully got switched over to a 1column layout, so overall, the problem is solved, however it would be nice to know why I need that in the xml to return proper results and it would be nice to remove unneeded code. I'm not seeing anything in that file that should effect the collection that gets returned.

A: The key to the fact that the layer block needs to be there can be found in Mage_CatalogSearch_Block_Layer in the construct.
/**
 * Internal constructor
 */
protected function _construct()
{
    parent::_construct();
    Mage::register('current_layer', $this->getLayer(), true);
}

The second line is the key: Mage::register('current_layer', $this->getLayer(), true); without this line none of the search results will display correctly. What this does is tell the system what the current state of the search is.
This will set the current layer as type Mage_CatalogSearch_Model_Layer but if this line is not run then later on the layer gets set as type Mage_Catalog_Model_Layer. The two models have two similar but different prepareCollection functions.
Mage_CatalogSearch_Model_Layer
Has an important call to addSearchFilter
public function prepareProductCollection($collection)
{
    $collection
        ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
        ->addSearchFilter(Mage::helper('catalogsearch')->getQuery()->getQueryText())
        ->setStore(Mage::app()->getStore())
        ->addMinimalPrice()
        ->addFinalPrice()
        ->addTaxPercents()
        ->addStoreFilter()
        ->addUrlRewrite();

    Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
    Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);

    return $this;
}

Mage_Catalog_Model_Layer
Has no addition of addSearchFilter and does not set or filter on the store.
public function prepareProductCollection($collection)
{
    $collection
        ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
        ->addMinimalPrice()
        ->addFinalPrice()
        ->addTaxPercents()
        ->addUrlRewrite($this->getCurrentCategory()->getId());

    Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
    Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);

    return $this;
}

A: For catalog or catalogsearch layout */layer is required block.
If you no need display this block, just set empty template (template="")
In you case, you can set empty template and move block to center.
  <reference name="content">
        <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template=""/>
    </reference>

A: Finally! Thank you alex! Been fiddling with this for hours. Anyone else having issues disabling the SM_SHOPBY module, use this fix.

*

*Turn off SM_Shopby

*Go to Catalog>Manage Categories>Custom Design

*Choose the layout you want to affect i.e. 2 columns left

*Paste this:
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">