text:
Q: "ValueError: 'c' argument has 28 elements, which is not acceptable for use with 'x' with size 33, 'y' with size 33" with Networkx k-partite graph I am getting the following errors when I am trying to apply different colors to the different node-sets or Ks in my k-partite graph.
 G = nx.Graph()
G.add_nodes_from(emc["entity"], bipartite=0)
G.add_nodes_from(set(EMM_unique["keys"]).symmetric_difference(set(emc["entity"])), bipartite=1)
G.add_nodes_from(EMM["id"], bipartite=2)
G.add_edges_from(list(emc.itertuples(index=False)), color='red')
G.add_edges_from(list(EMM.itertuples(index=False)))

nodes = G.nodes()
# for each of the parts create a set
nodes_0  = set([n for n in nodes if  G.nodes[n]['bipartite']==0])
nodes_1  = set([n for n in nodes if  G.nodes[n]['bipartite']==1])
nodes_2  = set([n for n in nodes if  G.nodes[n]['bipartite']==2])

    # set the location of the nodes for each set
pos = dict()
pos.update( (n, (1, i)) for i, n in enumerate(nodes_0) ) # put nodes from X at x=1
pos.update( (n, (2, i)) for i, n in enumerate(nodes_1) ) # put nodes from Y at x=2
pos.update( (n, (3, i)) for i, n in enumerate(nodes_2) ) # put nodes from X at x=1

# To apply colors to different node-sets
color_map = []
for node in G:
    if node in emc["entity"].values:
        print(node)
        color_map.append('red')
    elif node in EMM["id"].values:
        color_map.append('green')

#nx.draw_networkx_nodes(G,pos, node_color=color_map)
nx.draw(G, pos, node_color=color_map, width= 2, with_labels=True, with_arrows=True)

plt.show()

If I don't use color_map code then it runs fine. With color_map code I am getting the following error message
    Traceback (most recent call last):
  File "C:\Python\lib\site-packages\matplotlib\axes\_axes.py", line 4291, in _parse_scatter_color_args
    raise ValueError
ValueError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2019.2.5\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/Pawandeep/Desktop/CVS1/dev/AnnotationBexis.py", line 287, in <module>
    nx.draw(G, pos, node_color=color_map, width= 2, with_labels=True, with_arrows=True)
  File "C:\Python\lib\site-packages\networkx\drawing\nx_pylab.py", line 128, in draw
    draw_networkx(G, pos=pos, ax=ax, **kwds)
  File "C:\Python\lib\site-packages\networkx\drawing\nx_pylab.py", line 279, in draw_networkx
    node_collection = draw_networkx_nodes(G, pos, **kwds)
  File "C:\Python\lib\site-packages\networkx\drawing\nx_pylab.py", line 416, in draw_networkx_nodes
    label=label)
  File "C:\Python\lib\site-packages\matplotlib\__init__.py", line 1601, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "C:\Python\lib\site-packages\matplotlib\axes\_axes.py", line 4454, in scatter
    get_next_color_func=self._get_patches_for_fill.get_next_color)
  File "C:\Python\lib\site-packages\matplotlib\axes\_axes.py", line 4298, in _parse_scatter_color_args
    .format(nc=n_elem, xs=xsize, ys=ysize)
ValueError: 'c' argument has 28 elements, which is not acceptable for use with 'x' with size 33, 'y' with size 33.

I have already tried adding the nodes separately with the color through this code but getting the similar error
nx.draw_networkx_nodes(G,pos, node_color=color_map)

My requirement is to have different colors for different node-set. It would be very helpful if I can get some assistance with that.
Solution:
As per the suggestion from the accepted answer, I have added condition for all three node sets so now
for node in G:
    if node in emc["entity"].values:
       color_map.append("red")
    elif node in EMM["id"].values:
        color_map.append("green")
    else:
        color_map.append("blue") # solution

A: In these lines:
color_map = []
for node in G:
    if node in emc["entity"].values:
        print(node)
        color_map.append('red')
    elif node in EMM["id"].values:
        color_map.append('green')

you assign a color to a node only if it is in emc["entity"].values or EMM["id"].values.  I think you have some nodes that are in neither.  So when you try to draw it, the list of nodes is longer than the list of colors.
Anytime you use an elif you need to allow for the possibility that there are some things that satisfy neither condition.  Otherwise you should use else.


text:
Q: Regex for log fields not always in order I hope someone will be able to help me on that headache.
I am a bit stuck on a regex/grok/logstash syntax.
I am trying to parse kibana logs, but fields in logs not always comes in the same order.
Here are 3 logs as exemple.
{"name":"Kibana","hostname":"22e1923b59f3","pid":1,"level":30,"req":{"method":"POST","url":"/elasticsearch/_msearch?timeout=0&ignore_unavailable=true&preference=1438549037831","headers":{"host":"192.168.33.10:5601","connection":"keep-alive","content-length":"779","accept":"application/json, text/plain, */*","origin":"http://192.168.33.10:5601","user-agent":"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36","content-type":"application/json;charset=UTF-8","referer":"http://192.168.33.10:5601/","accept-encoding":"gzip, deflate","accept-language":"en-US,en;q=0.8,fr;q=0.6","cookie":"PHPSESSID=nhbu44n9jce33312je8346gm43; fastcoinlang=en; csrftoken=RAI1SVRsAGPmE490nhObxX9M1WYFuFjn"},"remoteAddress":"192.168.33.1","remotePort":56797},"res":{"statusCode":200,"responseTime":180,"contentLength":158203},"msg":"POST /_msearch?timeout=0&ignore_unavailable=true&preference=1438549037831 200 - 180ms","time":"2015-08-02T21:02:50.359Z","v":0}

{"name":"Kibana","hostname":"22e1923b59f3","pid":1,"level":30,"req":{"method":"GET","url":"/worker-json.js","headers":{"host":"192.168.33.10:5601","connection":"keep-alive","user-agent":"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36","accept":"*/*","referer":"http://192.168.33.10:5601/","accept-encoding":"gzip, deflate, sdch","accept-language":"en-US,en;q=0.8,fr;q=0.6","cookie":"PHPSESSID=nhbu44n9jce33312je8346gm43; fastcoinlang=en; csrftoken=RAI1SVRsAGPmE490nhObxX9M1WYFuFjn","if-none-match":"W/\"10ca1-14e40807fc0\"","if-modified-since":"Mon, 29 Jun 2015 18:07:20 GMT"},"remoteAddress":"192.168.33.1","remotePort":56797},"res":{"statusCode":304,"responseTime":1,"contentLength":0},"msg":"GET /worker-json.js 304 - 1ms","time":"2015-08-02T21:02:59.102Z","v":0}

{"name":"Kibana","hostname":"a274fbd7485b","pid":1,"level":30,"req":{"method":"GET","url":"/bower_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.2.0","headers":{"host":"192.168.33.10:5601","connection":"keep-alive","cache-control":"max-age=0","if-none-match":"W/\"ffac-14e40807bd8\"","if-modified-since":"Mon, 29 Jun 2015 18:07:19 GMT","user-agent":"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36","accept":"*/*","referer":"http://192.168.33.10:5601/","accept-encoding":"gzip, deflate, sdch","accept-language":"en-US,en;q=0.8,fr;q=0.6","cookie":"PHPSESSID=nhbu44n9jce33312je8346gm43; fastcoinlang=en; csrftoken=RAI1SVRsAGPmE490nhObxX9M1WYFuFjn"},"remoteAddress":"192.168.33.1","remotePort":59999},"res":{"statusCode":304,"responseTime":2,"contentLength":0},"msg":"GET /bower_components/font-awesome/fonts/fontawesome-webfont.woff?v=4.2.0 304 - 2ms","time":"2015-08-02T22:55:19.190Z","v":0}

What I could parse so far:
{\"name\":%{QS:name},\"hostname\":%{QS:hostname},\"pid\":%{INT:pid},\"level\":%{INT:level},\"req\":{\"method\":%{QS:req_method},\"url\":%{QS:req_url},\"headers\":{\"host\":%{QS:headers_host},\"connection\":%{QS:headers_connection}(,\"content-length\":%{QS:headers_content_length}|)(,\"accept\":%{QS:headers_accept}|)(,\"cache-control\":%{QS:headers_cache_control}|)(,\"if-none-match\":%{QS:headers_if_none_match}|)(,\"if-modified-since\":%{QS:headers_if_modified_since}|)(,\"origin\":%{QS:headers_origin}|)(,\"user-agent\":%{QS:headers_user_agent}|)(,\"accept\":%{QS:headers_accept}|)(,\"content-type\":%{QS:headers_content_type}|)(,\"referer\":%{QS:headers_referer}|)(,\"accept-encoding\":%{QS:headers_accept_encoding}|)(,\"accept-language\":%{QS:headers_accept_language}|)(,\"cookie\":%{QS:headers_cookie}|)},\"remoteAddress\":%{QS:remoteaddress},\"remotePort\":%{INT:remoteport}},\"res\":{\"statusCode\":%{INT:res_statuscode},\"responseTime\":%{INT:res_responsetime},\"contentLength\":%{INT:res_contentlength}},\"msg\":%{QS:res_msg},\"time\":\"%{TIMESTAMP_ISO8601:time}\",\"v\":%{INT:v}}

With this I can take care if a field is missing, but not when one field comes before/after another one. How to capture without taking care of the field order?
If you have any tips on how to be more effective with the syntax I take it too!.

redpajama_set_name: RedPajamaStackExchange


text:
Q: I used Interactive Picture jQuery and how do I link the box? jQuery(document).ready(function(){
    $( "#iPicture6" ).iPicture({
        animation: true,
        animationBg: "bgblack",
        animationType: "ltr-slide",
        pictures: ["picture1","picture2","picture3","picture4","picture5"],
        button: "moreblack",
        moreInfos: {"picture1":[{"id":"tooltip1","descr":"Looking at Stars", "top":"200px","left":"103px"},{"id":"tooltip2","descr":"sofa: 199$","top":"346px","left":"483px"},{"id":"tooltip3","descr":"silver candle: 2.99$","top":"461px","left":"556px"}],

I have this code when I put in the javascript for INteractive picture jquery, I was wondering how can I go on about hyperlinking each button/box?
Thanks in advance

A: You could do something like this:
moreInfos: {
  "picture1": [
    {
      "id":"tooltip1",
      "descr":"furniture: 299$",
      "top":"185px",
      "left":"393px"
    }
    // And So on....

You'll see that you'll have a hyperlink in the description of your button/box.


text:
Q: Is there any dependance between magento version and magento-cloud configuration? This code in composer.json works for me:
"require": {
        "magento/product-enterprise-edition": "2.1.4", "magento/magento-cloud-configuration": "101.4.0-dev"
},

Should I care about magento-cloud-configuration property if I want to switch to magento 2.1.7 when it will be available and where to find the number of corresponding cloud configuration?

A: You should rely on magento/magento-cloud-metapackage as specified in the cloud template. The version of magento/magento-cloud-metapackage is identical to that of magento/product-enterprise-edition. Internally, the metapackage consists of magento/product-enterprise-edition as well as appropriate magento/magento-cloud-configuration (referred to as MCC) required, so you don't have to worry about which is the corresponding MCC. For example, for 2.1.4, magento/magento-cloud-metapackage is defined as:
{
     "name": "magento/magento-cloud-metapackage",
     "description": "eCommerce Platform for Growth (Cloud Enterprise Edition)",
     "version": "2.1.4",
     "type": "metapackage",
     "require": {
         "magento/product-enterprise-edition": "2.1.4",
         "magento/magento-cloud-configuration": "101.4.*"
     },
     "license": [
         "proprietary"
     ]
}

With this approach, if there is a cloud specific release (for example 101.4.1), you will be able to get it automatically via composer update.
To answer your original question (from soon to be published documentation)

There is a many-to-one relationship between MCC version and Magento EE
  versions. For Magento EE version 2.<X>.<Y>, this package will have
  versions matching: <100 + X>.<Y>.*. For example, Magento EE 2.3.4
  would be associated with MCC 103.4.0. Then, a new version of MCC could
  be released that corresponds to the same Magento EE version, and it
  would be 103.4.1. This could be to add a new patch or to improve the
  hooks.


text:
Q: Half day in jQuery ui Datepicker I am currently using the jQuery UI Datepicker script in order to display availability dates for a rental. I used the recommended way to feed the script am an array of disabled days but my problem is that the day rental ends should also be available as a start date for a new rental. The client asked for a red triangle on the first and last day to show it should be available. How can I achieve that with this plugin?
$(function() {
    <?php

    $date_range = array();
    $select = mysql_query("SELECT * FROM reservation WHERE cid='$chalet[id]' and status='1'");
    while ($r = mysql_fetch_array($select)) {
        $date_range1 = createDateRangeArray(date("Y-m-d", $r[arrive]), date("Y-m-d", $r[depart]));

        // How can i use those 2 arrays to detect the right triangle to display and make sure the day is selectable
        $first[] = reset($date_range1);
        $last[] = end($date_range1);

        $date_range = array_merge($date_range, $date_range1);
    }

    foreach ($date_range as $key => $values) {
        $dates .= '"' . $values . '", ';
    }
    if ($dates) {
        echo 'var disableddates = [' . substr($dates, 0, -2) . "];\n";
    } else {
        echo "var disableddates = [];\n";
    }

    ?>
    function DisableSpecificDates(date) {
        var string = jQuery.datepicker.formatDate('dd-mm-yy', date);
        return [disableddates.indexOf(string) == -1];
    }
    $( "#calendrier" ).datepicker({
        beforeShowDay: DisableSpecificDates
    });
});

The above code renders the following
:
I need it to look like this:

A: Hope u'll get the idea, pardon if there are any errors as its written straight from brain without any testing. This adds .arrival / .departure classes to given day.
PHP:
$arrivals = $departures = $disabledDates = array();
while ($r = mysql_fetch_array($select)) {
    $arrivals[] = $r['arrive'];
    $departures[] = $r['departure'];
    $disabledDates[] = ....

JS
var arrivals = <?=json_encode($arrivals)?>;
var departures = <?=json_encode($departures)?>;
var disabledDates = <?=json_encode($disabledDates)?>;

$( "#calendrier" ).datepicker({

    beforeShowDay: function(date){
        var myDate = jQuery.datepicker.formatDate('YYYY-mm-dd', date);

        if($.inArray(myDate, disabledDates))
            return [false];
        else if($.inArray(myDate, arrivals))
            return [true, 'arrival', 'Arrival day'];
        else if($.inArray(myDate, departures))
            return [true, 'departure', 'Departure day'];
        else
            return [true];
    }
}


text:
Q: Showing popover for the second time changes its position I have a function which creates popovers in my page, retrieving the content from an AJAX call. During the creation my function changes the popover position (it is page-wide, so I set to 0 the left attribute and move the arrow to point to my element). Everything works fine the first time, but if I move the mouse out and then in again the popover doesn't move from its default position (and neither does the arrow)
My code:
var last_opened_popover = null
jQuery(document).ready(function(){
    jQuery("*[data-poload]").mouseenter(function(){
        if (last_opened_popover != null){
            last_opened_popover.popover("destroy")
        }
        var element = jQuery(this)
        last_opened_popover = element
        var polId = element.data("poload")
        jQuery.ajax({
             url : my_url,
             type : "POST",
             data : {
                 //datas
         },
         success : function(result){
            var supporter_list = compose_supporter_list(result);
            var left = element.position().left + 75
            element.popover({
                content : supporter_list,
                html : true,
                placement : "bottom",
                template : '

'
            })
            element.popover("show")
            var popover = jQuery("#shown-popover")
            popover.css("left", 0)
            popover.find(".arrow").css("left", left)
         }
      })
    }).mouseleave(function(){
       jQuery(this).popover("destroy")
    })
})

A: The problem was that all the generated popover shared the same ID. Even if I destroied each one before creating another, the ID is somehow retained, so jQuery cannot access the new elements. The solution is to simply generate new IDs to make sure no popover share the same ID, I did it by simply using a counter:
var last_opened_popover = null
var popover_counter = 0
jQuery(document).ready(function(){
    jQuery("*[data-poload]").mouseenter(function(){
        if (last_opened_popover != null){
            last_opened_popover.popover("destroy")
        }
        var element = jQuery(this)
        last_opened_popover = element
        var polId = element.data("poload")
        jQuery.ajax({
             url : my_url,
             type : "POST",
             data : {
               //datas
             },
             success : function(result){
                var supporter_list = compose_supporter_list(result);
                var left = element.position().left + 75
                element.popover({
                    content : supporter_list,
                    html : true,
                    placement : "bottom",
                    template : '

'
               })
               element.popover("show")
               var popover = jQuery("#shown-popover-" + popover_counter)
               popover.css("left", 0)
               popover.find(".arrow").css("left", left)
               popover_counter++
            }
    })
})


text:
Q: Matlab surface plot (with unusual input) I wish to make a 3D plot in matlab using the following data:
x = [1,1,1,1,2,2,2,2,3,3,3,3];
y = [1,2,3,4,1,2,3,4,1,2,3,4];
F = [4,5,6,7,5,6,7,8,6,7,8,9]; % for example

where F=F(x,y) in a function of x and y. (Ie F(1,1) = 4, F(1,2) = 5, F(1,3) = 6, reading down each column.)
To give an idea of the plot I would like to make: If I knew the function F(x,y) analytically I would use the following code:
xvec = [1,2,3];
yvec = [1,2,3,4];
[X,Y] = meshgrid(xvec, yvec);
Fvalues = F(X,Y); % where F = @(x,y) ... has been defined
surf(X,Y,Fvalues);

A: You are missing a very simple trick here. You are getting 4x3 matrices - X and Y. You just have to arrange F in the proper format and then use surf command. Write your code as follows:
xvec = [1,2,3];
yvec = [1,2,3,4];
[X,Y] = meshgrid(xvec, yvec);

%reshaping F
F=reshape(F,4,3);

surf(X,Y,F);


text:
Q: PHPunit how to exclude all files in directory but not exclude subdirectories I have such problem. I want to exclude all files in SomeBundle\Entity but don't want to exclude SomeBundle\Entity\Repository and SomeBundle\Entity\Factory.
SomeBundle\Entity
SomeBundle\Entity\Repository
SomeBundle\Entity\Factory

SomeBundle\Entity\File1.php
SomeBundle\Entity\File2.php
SomeBundle\Entity\File3.php

I trying to do it with
    <filter>
        <whitelist>
            <directory>./../src/SomeBundle</directory>
            <exclude>
                <directory suffix=".php">./../src/SomeBundle/Entity</directory>
            </exclude>
        </whitelist>
    </filter>

but as a result, i exclude all in SomeBundle\Entity ...

A: <?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
    <testsuites>
        <testsuite name="Test Suite">
            <directory>SomeBundle</directory>
            <directory>SomeBundle/Entity/**</directory>
            <exclude>SomeBundle/Entity</exclude>
        </testsuite>
    </testsuites>
</phpunit>


text:
Q: How to handle "full" foreign-language date-strings in google-apps-script? Writing a JavaScript program in Google Apps Scripts, I'm encountering datetime strings  that look like 2nd line in
//German
März 1, 2013 @ 19:00 - 23:00
//"March 1, 2013 @ 19:00 - 23:00"

This needs to be parsed to two JS date objects (d1 = March 1, 2013  19:00; d2 = March 1, 2013 23:00)
 What is the best way to do this in the Google Apps Scripts environment?
For now I have written a custom function lookupMonth() to translate from German to English. I do this string.replace(monthGer, monthEng).
function monthLookup(str) {
    //str1 = str.substring(0, str.indexOf(" ")); //unicode blank!
    var pos = str.indexOf(/[0-9]/.exec(str)); //pos of first digit
    str1 = str.substring(0, pos  - 1 ).trim();

    var lookup = {
        "Januar": "January",
        "Februar": "February",
        "März": "March",
        "April": "April",
        "Mai": "May",
        "Juni": "June",
        "Juli": "July",
        "August": "August",
        "Spetember": "Septemper",
        "Oktober": "October",
        "November": "November",
        "Dezember": "December"
    };
    str = lookup[str1] + " " + str.substring(pos, 1000);
    return str;
}

This creates two new strings which can be to a Date() object, and then I could call Utilities.formatDate() Is there a better way?
Should I, for instance, call the translation service API (which would of course be much slower than calling an in-process JavaScript function?
Should I import a third-party library? If so, which one?


text:
Q: Indexer as part of the interface in C# In C#, what's the syntax for declaring an indexer as part of an interface? Is it still this[ ]? Something feels odd about using the this keyword in an interface.

A: It is - it's pretty odd syntax at other times if you ask me! But it works. You have to declare the get; and/or set; parts of it with no definition, just a semi-colon, exactly like ordinary properties in an interface.

A: I know what you mean but, yes, this is correct. Here are the docs.

A: public interface IYourList<T>
    {
        T this[int index] { get; set; }
    }


text:
Q: Make all cells in one row in DataGridView load bold during LoadDataRow? Hey all: I'm trying to highlight a row in a datagridview when a value in that row changes.
My code is abstracted below:
void fillTable(DataTable table, List<object> readings)
{
    foreach (object r in readings)
        LoadRow(table, r)
}

private void LoadRow(DataTable table, Object r)
{
    table.LoadDataRow(new Object[] { r.parameter1, r.parameter2, r.parameter3 }
    if (r.parameter3 == something)
        *make row bold*
}

What I want to do is make the entire row bolded if r.parameter3 is a certain value. I don't know what to put in that statement to make the row bolded (or highlighted, or whatever). I know that  once I have the datagridview populated, I can do something like
table.Rows[Index].DefaultCellStyle.Font = boldFont;

but I don't know the index when im loading the row (because its being called in a loop) and I'd rather not go back through once Im done building the datagridview.
Any help is greatly appreciated. Thanks!

A: What about this :-
table.Rows[Index].DefaultCellStyle.Font = new Font(Yourfont, FontStyle.Bold);

Hope this helps.


text:
Q: No property found for type after adding EntityGraphJpaSpecificationExecutor to repository I have an entity with a relation to another one:
public class MyEntity {
    @Id
    @GeneratedValue
    @Column(name = "id", nullable = false)
    private UUID id;

    @Column(name = "deleted", nullable = false)
    private Boolean deleted = false;

    @ManyToMany
    @JoinTable(name = "feature_assignment",
            joinColumns = @JoinColumn(name = "my_entity_id"),
            inverseJoinColumns = @JoinColumn(name = "feature_id"))
    private List<MyEntityFeature> myEntityFeatures;

and I have a perfectly working repository:
public interface MyEntityRepository extends JpaRepository<MyEntity, UUID>,
        JpaSpecificationExecutor<MyEntity> {
Optional<MyEntity> findByIdAndDeletedIsFalse(UUID id);
}

But when I extend EntityGraphJpaSpecificationExecutor in my repository, it seems like it can't recognize former repository methods without entity graphs, even though the repository is still implementing the findById method. I get the following exception:
Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract java.util.Optional com.cosium.spring.data.jpa.entity.graph.repository.EntityGraphJpaSpecificationExecutor.findOne(org.springframework.data.jpa.domain.Specification,com.cosium.spring.data.jpa.entity.graph.domain.EntityGraph)! No property findOne found for type MyEntity!
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:96) ~[spring-data-jpa-2.6.1.jar:2.6.1]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:113) ~[spring-data-jpa-2.6.1.jar:2.6.1]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:254) ~[spring-data-jpa-2.6.1.jar:2.6.1]
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:87) ~[spring-data-jpa-2.6.1.jar:2.6.1]
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:102) ~[spring-data-commons-2.6.1.jar:2.6.1]
    ... 57 common frames omitted
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property findOne found for type MyEntity!
    at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:90) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:437) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:413) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:366) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at java.base/java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:330) ~[na:na]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:348) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:331) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.repository.query.parser.Part.<init>(Part.java:81) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:249) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na]
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
    at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:250) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:383) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[na:na]
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
    at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:384) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:92) ~[spring-data-commons-2.6.1.jar:2.6.1]
    at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:89) ~[spring-data-jpa-2.6.1.jar:2.6.1]
    ... 61 common frames omitted

My pom.xml contains the following dependencies:
        <dependency>
            <groupId>com.cosium.spring.data</groupId>
            <artifactId>spring-data-jpa-entity-graph</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

Can anyone explain why this is happening? And how can I fix this error? Is it mandatory to override the findOne method after implementing EntityGraphJpaSpecificationExecutor?

A: I faced the same issue. I fixed it by adding factory to Jpa Repositories:
@EnableJpaRepositories(repositoryFactoryBeanClass = EntityGraphJpaRepositoryFactoryBean.class)


text:
Q: How to style Grid cell/row background without using classname generator I searched a lot, but every solution was to include some constant CSS class names into the page, and use the Column's ClassNameGenerator to set the proper classname on the cell/row.
Now this might be a good solution when the developer can decide on formatting a cell, however when a user can decide (especially with a script written as cell renderer) how a cell will look like, it is not possible to use the ClassNameGenerator.
So question is, how can I format the cell/row background programmatically, not using any CSS? I can provide custom component as cell value. So it's fine to render a label with icon, or just icon, or a checkbox, however coloring this rendered component is not enough, since this is smaller than the cell itself, making it look really ugly. I need to access the root element of the cell, and color it using getStyle().set("background", "xxxx"). How to achieve this?
Thanks!

A: You can use a TemplateRenderer.
For example:
Grid<Person> grid = new Grid<>();
grid.setItems(people);

grid.addColumn(TemplateRenderer
       .<Person>of("<b>[[item.name]]</b>")
       .withProperty("name", Person::getName)
).setHeader("Name");

Checkout this tutorial for more information: https://vaadin.com/docs/v14/flow/components/tutorial-flow-grid

A: OK, finally I solved. I use a template renderer with a proper template structure. I modified the cell style in a way, that my renderer DIV fills the entire cell (removed any padding/margin from the original cells)
<dom-module id="grid-style" theme-for="vaadin-grid">
  <template>
    <style>
    [part~='cell'] ::slotted(vaadin-grid-cell-content) {
        padding: 0px;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        --cellopa: 255;
      }

      [part~='cell'][aria-selected~="true"] ::slotted(vaadin-grid-cell-content) {
              --cellopa: 0;
      }
    </style>
  </template>
</dom-module>

I also added some simple CSS declarations to one of the main CSS:
    vaadin-grid-tree-toggle flow-component-renderer {
    width: 100%;
    height: 100%;
}

vaadin-grid-cell-content flow-component-renderer {
    width: 100%;
    height: 100%;
    flex-grow: 1;
}

This way the rendered DIV fills the whole cell and I can color it's background.
Now the problem comes with the selection, since the selection is not visible any more. For this you find the --cellopa variable set to 255 normally and set to 0 for selected cells.
Now when I define a background-color on the div, I use rgba and I set the alpha to the var(--cellopa) variable, like this for example rgba(255, 0, 0, var(--cellopa))
Now when the row is not selected, the cellopa is 255, so the background is visible, when I select the row the cellopa is set to 0, so the background of the DIV gets transparent, and the row selection color on the row is visible. This is super fast, and changing the selection does not cause any glitch, and also the previous coloring state is restored properly.
I also managed to get around with the treegrid and managed to color even the hierarchy column fully using a special template for the hierarchy column with some padding taking the level into account.


text:
Q: How can I set a reminder for every third item in a List in Android? I have a list which adds up item from another list through database in Android. But I need to set up a reminder for every third item, that is 3, 6, 9 , 12, etc. When I do like this
if( types.size() == 3 && types.size() == 6 && types.size() ==9)

my appliction closes unexpectedly. Below is my code. Its working when I only have one number, but I need it for all the third odd numbers. Any tips would be really valuable for me, Thank you
private List<AlcoholTypes> types = new ArrayList<AlcoholTypes>();
types = Database.getDataList(this);
if(types.size() == 3 ){
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);

            // set title
            alertDialogBuilder.setTitle("Water Reminder");

            // set dialog message
            alertDialogBuilder
                .setMessage("Drink one glass of water !")
                .setCancelable(false)
                .setPositiveButton("Okay",new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,int id) {
                        // if this button is clicked, close
                        // current activity
                        dialog.cancel();
                    }
                  })
                .setNegativeButton("No",new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog,int id) {
                        // if this button is clicked, just close
                        // the dialog box and do nothing
                        dialog.cancel();
                    }
                });

                // create alert dialog
                AlertDialog alertDialog = alertDialogBuilder.create();

                // show it
                alertDialog.show();
    }
    }

A: Change this:
if( types.size() == 3 && types.size() == 6 && types.size() ==9)

to this:
if(types.size() % 3 == 0)

This makes use of modulo, which checks divisability and returns 0 if it is divisable by that number. http://en.wikipedia.org/wiki/Modulo_operation

A: This should do it I guess:
   if( types.size() % 3 == 0) {
         // do something special
    } else {
         // do something normal
    }

A: You just check it size is divisible /3 or not that is enough


text:
Q: Can $f(x,y)$ be logically equivalent to $f(x)$? Let us say a Theorem is true for $f(x)$ where $f$ is a smooth function from the real numbers to the real numbers. Let us now say that $f(x,y)$ is a smooth function from $\mathbb{R}^{2}$ to the real numbers. Let us fix $y$, can we use $f(x,y)$ in the place of $f(x)$ in a proof? I see this done often in proofs regarding partial differential equations, but I don't really understand what it means to fix a variable ( I have a slight intuitive understanding) nor do I understand how these two can be logically equivalent in a proof situation, how do we know that adding an extra variable won't cause the proof to "blow up"? It is really annoying, since it is done a lot in textbooks.
I can understand for example if a property holds for a group, then it will hold for the additive subgroup of the ring but not the ring itself because the additive subgroup of the ring is indeed a group, and hence we can 'feed' it in the proof of the theorem about groups.
This relates back to my first question,
Question about Duhamel's principle..

A: So, let say you have a function $f : \mathbb R^2 \to \mathbb R$.  If you want to rigorously prove that you can use your theorem, you should proceed as follow.
Let $y\in\mathbb R$. Then we can define $g : \mathbb R\to \mathbb R$ by
$$
g(x) = f(x,y)
$$
You can now apply your theorem on the function  $g$. This implies for example that for any $x\in\mathbb R$, $g(x)$ verifies some property, and so $f(x,y)$ too.
Since $y$ was arbitrary, you deduce that this is true for any $y$. Therefore, for any $(x,y)\in\mathbb R^2$, $f(x,y)$ verifies the property.

A: Let $f(x,y)=x+y$. If you want to prove some property of the function $x+3$, you can fix $y$ and prove for $f(x,3)$. That's what it means.


text:
Q: Hide order product from woocommerce admin order details page I am looking for the way to hide the hidden product from the admin order details page. I value of order product is $0. So i want to remove this from the order details page. I am using this for show the shipping method with the conditional shipping plugin from the Woocommece so i dont want to show it for admin.
I did hide for cart,checkout, order details for customer and order email. So looking for the solution of admin order details page.
Here is some code snippet which i used for hide the product for cart,checkout, order details for customer and order email
add_filter( 'woocommerce_cart_item_visible', 'hide_ship_product_from_cart' , 10, 3 );
add_filter( 'woocommerce_widget_cart_item_visible', 'hide_ship_product_from_cart', 10, 3 );
add_filter( 'woocommerce_checkout_cart_item_visible', 'hide_ship_product_from_cart', 10, 3 );
add_filter( 'woocommerce_order_item_visible', 'hide_ship_product_from_order_details', 10, 2 );
function hide_ship_product_from_cart( $visible, $cart_item, $cart_item_key ) {
   $product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item,
                            $cart_item_key );
   if ( $product->get_shipping_class() == 'delivery'  || $product->get_shipping_class() == 'pickup' )
       {
          $visible = false;
       }
          return $visible;
   }

 function hide_ship_product_from_order_details( $visible, $order_item ) {
 $product = $order_item->get_product();
 if ( $product->get_shipping_class() == 'delivery' || $product->get_shipping_class() == 'pickup' ) {
       $visible = false;
   }
   return $visible;
  }

I want to hide the order item from the admin order page.
enter image description here


text:
Q: Installing Ruby 1.9.3 Troubles with Clang I am attempting to install Ruby 1.9.3 on Mac OS X Lion, same method as I discovered here:
Basically it's:
rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr

However, this time Clang throws an error on the --with-readline-dir option:
Larson:~ andrewjl$ rvm install 1.9.3 --with-gcc=clang --with-readline-dir=$rvm_path/usr
clang: error: unsupported option '--with-readline'
clang: error: unsupported option '--with-opt-dir=/Users/andrewjl/.rvm/usr'

Is this an issue with Clang? Does anybody know how to get around this?
EDIT
After trying Shigeya's answer I get this error:
Larson:~ andrewjl$ rvm install 1.9.3-p125 --patch xcode-debugopt-fix-r34840.diff --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-tcl-lib=/usr --with-tk-lib=/usr
Installing Ruby from source to: /Users/andrewjl/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...

ruby-1.9.3-p125 - #fetching
ruby-1.9.3-p125 - #downloading ruby-1.9.3-p125, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 9505k  100 9505k    0     0  52267      0  0:03:06  0:03:06 --:--:-- 50727
ruby-1.9.3-p125 - #extracting ruby-1.9.3-p125 to /Users/andrewjl/.rvm/src/ruby-1.9.3-p125
ruby-1.9.3-p125 - #extracted to /Users/andrewjl/.rvm/src/ruby-1.9.3-p125
Applying patch 'xcode-debugopt-fix-r34840.diff' (located at /Users/andrewjl/.rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-r34840.diff)
ruby-1.9.3-p125 - #autoreconf
Error running 'autoreconf', please read /Users/andrewjl/.rvm/log/ruby-1.9.3-p125/autoreconf.log
ruby-1.9.3-p125 - #configuring
Error running ' ./configure --prefix=/Users/andrewjl/.rvm/rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-readline --with-opt-dir=/Users/andrewjl/.rvm/usr --with-openssl --with-tcl-lib=/usr --with-tk-lib=/usr --with-libyaml --with-gcc=clang ', please read /Users/andrewjl/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the installation.

Here's the log file error:
/usr/local/include/fuse/fuse_compat.h:69:10: fatal error: 'sys/statfs.h' file not found
#include <sys/statfs.h>
         ^
clang: error: unable to execute command: Broken pipe: 13
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://developer.apple.com/bugreporter/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Error generating preprocessed source(s).
yes
checking for strip... strip
checking for prefix of external symbols... _
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for if make is GNU make... yes
checking for nroff... /usr/bin/nroff
.ext/include/x86_64-darwin11.4.0/ruby/config.h updated
ruby library version = 1.9.1
configure: creating ./config.status
config.status: creating Makefile
configure: WARNING: unrecognized options: --with-readline, --with-openssl, --with-tcl-lib, --with-tk-lib, --with-libyaml
In file included from <built-in>:143:
In file included from <command line>:1:
In file included from /usr/local/include/fuse/fuse.h:26:
/usr/local/include/fuse/fuse_common.h:32:2: error: #error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
#error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
 ^
In file included from <built-in>:143:
In file included from <command line>:1:
In file included from /usr/local/include/fuse/fuse.h:857:
/usr/local/include/fuse/fuse_compat.h:69:10: fatal error: 'sys/statfs.h' file not found
#include <sys/statfs.h>
         ^
clang: error: unable to execute command: Broken pipe: 13
clang: error: clang frontend command failed due to signal 2 (use -v to see invocation)
clang: note: diagnostic msg: Please submit a bug report to http://developer.apple.com/bugreporter/ and include command line arguments and all diagnostic information.
clang: note: diagnostic msg: Error generating preprocessed source(s).
configure: WARNING: unrecognized options: --with-readline, --with-openssl, --with-tcl-lib, --with-tk-lib, --with-libyaml
config.status: creating ruby-1.9.pc
./configure: line 18932: syntax error near unexpected token `('
./configure: line 18932: `      sed 's/{\$([^(){}]*)[^{}]*}//g' ${srcdir}/common.mk'

A: Refer to this answer.
Even though both ruby-1.9.3-p125 and ruby-1.9.3-p194 some support for clang, installing Ruby with clang is generally not recommended.
(Note: I had to accept edit proposal first, then edit. Thank you very much for contribution.)


text:
Q: how does not hide the search bar when scrolling ? SwiftUi IOS 15 added .searchable(text: $searchtext)
when I open my application, the search is hidden by default and only appears when scrolling the page, how can I open the application to immediately display the search?
SWIFTUI IOS 15

A: In SwiftUI we have to set placement parameter in searchable modifier to .navigationBarDrawer(displayMode: .always) it's makes always show search bar
.searchable(text: $searchtext, placement: .navigationBarDrawer(displayMode: .always)) {
    "your code"
}


text:
Q: Universal method for put y label at middle of y axis As the title suggests, I would like to know if there is a "universal" method to position the label of the ordinate axis horizontally to its left and vertically to its center.
In other words, place the label where "Here" is written (added through photo editing)

This is the original code
\begin{tikzpicture}
    \begin{axis}[
            legend pos=outer north east,
            legend cell align={left},
            grid, grid style=dashed,
            ymin=5,ymax=26,
            ytick={10,15,20,25},
            xtick={30,60,90,120,150},
            extra y ticks={5},            % <---
            xmax=180,xmin=0,
            extra x ticks={0},            % <---
            axis lines = middle,
            set layers,                   % <---
            x label style={at={(1,0)},right},
            x tick label style={/pgf/number format/.cd,
                fixed relative,
            },
            xlabel={$t$ (\unit{\min})},ylabel={$X$(\%)},
            style={thick}
        ]
        \addplot[
            domain = 10:150,
            samples = 200,
            smooth,
            thick,
            verde,
        ]
        {-0.000626382144*x^2+0.237470377288*x+3.475363466567};
        \addlegendentry{\textit{p}-cresolo};

        \addplot[mark=*,scatter,only marks]
        coordinates {
            (10,6.01) (30,9.74) (60,15.78) (90,18.71) (120,24.29) (150,24.49)
        };
    \end{axis}
\end{tikzpicture}

A: \documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=1,
ymin=0, ymax=1,
ylabel={Here},
y label style={rotate=-90, at={(ticklabel cs:0.5)}, font=\Huge},
]
\end{axis}
\end{tikzpicture}
\end{document}

You can also use (axis description cs:-0.1,0.5) or (yticklabel cs:0.5) or (yticklabel* cs:0.5, 20pt) - dependent on exactly how you want to align the label.

A: Try this code (partial...):
\documentclass[tikz, border=1cm]{standalone}

\begin{document}
\begin{tikzpicture}[scale=.3]
    \draw[gray!10] (-1,-1) grid (10,10);
    \draw[line width=1pt,-latex] (-1,0)--(10,0) node[pos=.9,yshift=-12pt] () {\tiny \bfseries $Time$};

     \draw[line width=1pt,-latex] (0,-1)--(0,10) node[magenta,pos=.5,xshift=-20pt] () {\tiny \bfseries $Space$};
    \foreach \i in {1,2,...,10}{%
        \draw (\i,.1)--(\i,-.1) node[below] () {\tiny \i};
        \draw (.1,\i)--(-.1,\i) node[left] () {\tiny \i};
    }
\end{tikzpicture}
\end{document}

Output:


text:
Q: Python closing multiple Threads I am using the example below from IBM website. I noticed that the threads for DatamineThread() and ThreadUrl() remain open because of the while-loops.
I am trying to terminate these threads and print text telling me so. I am not sure if I am going about this the correct way or even if the threads need to be terminated this way. The problem is when I set run = False in main() the while-loops are reading run = True.
Any help would be great... Thanks
import Queue
import threading
import urllib2
import time
from BeautifulSoup import BeautifulSoup

hosts = ["http://yahoo.com", "http://google.com", "http://amazon.com",
        "http://ibm.com", "http://apple.com"]

queue = Queue.Queue()
out_queue = Queue.Queue()
run = True

class ThreadUrl(threading.Thread):
    """Threaded Url Grab"""
    def __init__(self, queue, out_queue):
        threading.Thread.__init__(self)
        self.queue = queue
        self.out_queue = out_queue

    def run(self):
        global run
        while run:
            #grabs host from queue
            host = self.queue.get()

            #grabs urls of hosts and then grabs chunk of webpage
            url = urllib2.urlopen(host)
            chunk = url.read()

            #place chunk into out queue
            self.out_queue.put(chunk)

            #signals to queue job is done
            self.queue.task_done()

        print 'ThreadUrl finished...'

class DatamineThread(threading.Thread):
    """Threaded Url Grab"""
    def __init__(self, out_queue):
        threading.Thread.__init__(self)
        self.out_queue = out_queue

    def run(self):
        global run
        while run:
            #grabs host from queue
            chunk = self.out_queue.get()

            #parse the chunk
            soup = BeautifulSoup(chunk)
            print soup.findAll(['title'])

            #signals to queue job is done
            self.out_queue.task_done()

        print 'DatamineThread finished...'

start = time.time()
def main():
    global run
    #spawn a pool of threads, and pass them queue instance
    for i in range(5):
        t = ThreadUrl(queue, out_queue)
        t.setDaemon(True)
        t.start()

    #populate queue with data
    for host in hosts:
        queue.put(host)

    for i in range(5):
        dt = DatamineThread(out_queue)
        dt.setDaemon(True)
        dt.start()

    #wait on the queue until everything has been processed
    queue.join()
    out_queue.join()

    # try and break while-loops in threads
    run = False

    time.sleep(5)

main()
print "Elapsed Time: %s" % (time.time() - start)

A: I'm not personally a huge fan of global variables for thread conditions, in large part because I've seen what you're encountering before.  The reason comes from the python docs for Queue.get.

If optional args block is true and timeout is None (the default), block if necessary until an item is available.

Essentially, you're never seeing a second check against while run: because out_queue.get() has blocked indefinitely after the Queue empties out.
The better way to do this, IMHO, is to either use sentinel values in the Queues, or to use get_nowait and catch the exception to break the loop.  Examples:
Sentinels
class DatamineThread(threading.Thread):
    def run(self):
        while True:
            data = self.out_queue.get()
            if data == "time to quit": break
            # non-sentinel processing here.

Try / Except
class DatamineThread(threading.Thread):
    def run(self):
        while True:
            try:
                data = self.out_queue.get_nowait() # also, out_queue.get(False)
            except Queue.Empty: break
            # data processing here.

To ensure that all of your threads end, can do it a couple ways:
Add Sentinels for each Worker
for i in range(numWorkers):
  out_queue.put('time to quit')

out_queue.join()

Replace the Sentinel
class DatamineThread(threading.Thread):
    def run(self):
        while True:
            data = self.out_queue.get()
            if data == "time to quit":
                self.out_queue.put('time to quit')
                break
            # non-sentinel processing here.

Either way should work.  Which is preferred depends on how the out_queue is populated.  If it can be added to / removed from by worker threads the first approach is preferable.  Call join(), then add the sentinels, then call join() again.  The second approach is good if you don't want to remember how many worker threads you created - it only uses one sentinel value and doesn't clutter the Queue.


text:
Q: Where to find debug info about obsolete API in Android Studio? In AS version 3.3 we can now set in gradle.properties file the android.debug.obsoleteApi=true flag, which allows us to see API calls that are no longer supported.
According to the article on AS blog it can now provide more detailed information to help you determine where that API is being used
My question is, where can I find this kind of information? I looked into Build and Inspection Results window but I couldn't find any kind of information about obsolete API calls.

A: You can find it at the start of the gradle Build/Sync log in the Build window (Ctrl+Tab and B to open it).
Be sure to have updated com.android.tools.build:gradle to version 3.3.0.
With android.debug.obsoleteApi=false:
WARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getAssemble(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.

With android.debug.obsoleteApi=true:
WARNING: API 'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
REASON: It is currently called from the following trace:
java.lang.Thread.getStackTrace(Thread.java:1556)
com.android.build.gradle.internal.errors.DeprecationReporterImpl.reportDeprecatedApi(DeprecationReporterImpl.kt:79)
com.android.build.gradle.internal.api.BaseVariantImpl.getAssemble(BaseVariantImpl.java:571)
com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated.getAssemble(null:-1)
sun.reflect.GeneratedMethodAccessor113.invoke(null:-1)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
groovy.lang.MetaBeanProperty.getProperty(MetaBeanProperty.java:59)
org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.getProperty(BeanDynamicObject.java:228)
org.gradle.internal.metaobject.BeanDynamicObject.tryGetProperty(BeanDynamicObject.java:171)
org.gradle.internal.metaobject.CompositeDynamicObject.tryGetProperty(CompositeDynamicObject.java:55)
org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:59)
com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated.getProperty(null:-1)
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:299)
com.crashlytics.tools.gradle.CrashlyticsPlugin$_addPluginTasksToApplicationVariantsIn_closure2.doCall(CrashlyticsPlugin.groovy:93)
sun.reflect.GeneratedMethodAccessor112.invoke(null:-1)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
groovy.lang.Closure.call(Closure.java:418)
groovy.lang.Closure.call(Closure.java:434)
org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:155)
org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
org.gradle.util.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:167)
org.gradle.internal.ImmutableActionSet$SetWithFewActions.execute(ImmutableActionSet.java:285)
org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:244)
org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:233)
com.android.build.gradle.AppExtension.addVariant(AppExtension.java:87)
com.android.build.gradle.internal.ApiObjectFactory.create(ApiObjectFactory.java:134)
com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:777)
com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
com.android.build.gradle.BasePlugin.lambda$createTasks$4(BasePlugin.java:651)
com.android.build.gradle.internal.crash.CrashReporting$afterEvaluate$1.execute(crash_reporting.kt:37)
com.android.build.gradle.internal.crash.CrashReporting$afterEvaluate$1.execute(crash_reporting.kt:-1)
org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1$1.run(DefaultListenerBuildOperationDecorator.java:155)
org.gradle.configuration.internal.DefaultUserCodeApplicationContext.reapply(DefaultUserCodeApplicationContext.java:58)
org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1.run(DefaultListenerBuildOperationDecorator.java:152)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction.execute(DefaultListenerBuildOperationDecorator.java:149)
org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
com.sun.proxy.$Proxy34.afterEvaluate(null:-1)
org.gradle.configuration.project.LifecycleProjectEvaluator$NotifyAfterEvaluate$1.execute(LifecycleProjectEvaluator.java:187)
org.gradle.configuration.project.LifecycleProjectEvaluator$NotifyAfterEvaluate$1.execute(LifecycleProjectEvaluator.java:184)
org.gradle.api.internal.project.DefaultProject.stepEvaluationListener(DefaultProject.java:1418)
org.gradle.configuration.project.LifecycleProjectEvaluator$NotifyAfterEvaluate.run(LifecycleProjectEvaluator.java:193)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:110)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:68)
org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:687)
org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:140)
org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62)
org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:41)
org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:274)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:182)
org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:141)
org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:124)
org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:77)
org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:74)
org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:154)
org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:38)
org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:96)
org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:74)
org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:55)
org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.run(RunAsBuildOperationBuildActionRunner.java:50)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:44)
org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:79)
org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:44)
org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
org.gradle.util.Swapper.swap(Swapper.java:38)
org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
java.lang.Thread.run(Thread.java:745)

WARNING: Debugging obsolete API calls can take time during configuration. It's recommended to not keep it on at all times.


text:
Q: how to if image found on a region then press key i want to make this script to detect if an image on a region change image it press key
    if pyautogui.locateOnScreen(image=r'C:\Users\ether\Desktop\New folder (4)\saveimage.png')(region=(800,460,90,90), grayscale=True, confidence=0.5):
    elif pyautogui.locateOnScreen('yellow.png', confidence=0.8) !=None:
            keyboard.press_and_release('d')
    elif pyautogui.locateOnScreen('blue.png', confidence=0.8) !=None:
            keyboard.press_and_release('a')


text:
Q: MySQL subquery omits entire row when it matches no result I'm trying to include a sub-query in a MySQL SELECT statement to assemble a product link when the product ID associated with that link may no longer exist. When that product ID does not exist the sub-query finds no result and the entire row is omitted from the final result. I would like the row to be returned anyway (with NULL would be fine).
SELECT s.field_a, s.field_b, s.field_c,
    (SELECT CONCAT( '/', sma.name_link, '/', smo.name_link, '.html?pid=', spr.id )
        FROM sales_products AS spr, sales_sections AS see,
            sales_models AS smo, sales_manufacturers AS sma
        WHERE sse.id = spr.sales_section_id AND smo.id = sse.sales_model_id
            AND smo.sales_manufacturer_id = sma.id
            AND spr.id = s.sales_product_id
    ) AS product_link
    FROM sales_order_items AS s, sales_products AS p
    WHERE s.order_id = 100 AND p.id = s.sales_product_id
    ORDER BY shipment_id, sales_order_item_id

I've searched quite a while but I'm just not managing to piece this one together. I look forward to any kind of feedback or solution that can be offered.

A: I don't see a product_id column reference anywhere in your query, so I'm going to assume you are meaning that its the sales_product_id column is the one that has a value that doesn't match an id value in the sales_product table.
I don't think the issue of the "missing rows" has to do with the subquery in the SELECT list; I believe it has to do with the INNER JOIN to the sales_product table. I recommend you change that into a LEFT OUTER JOIN.
SELECT s.field_a
     , s.field_b
     , s.field_c
     , (SELECT CONCAT('/',sma.name_link,'/',smo.name_link,'.html?pid=',spr.id)
          FROM sales_products spr
          JOIN sales_sections see ON sse.id = spr.sales_section_id
          JOIN sales_models smo ON smo.id = sse.sales_model_id
          JOIN sales_manufacturers sma ON sma.id = smo.sales_manufacturer_id
         WHERE spr.id = s.sales_product_id
         ORDER BY 1 LIMIT 1
       ) AS product_link
  FROM sales_order_items s
  LEFT
  JOIN sales_products p ON p.id = s.sales_product_id
 WHERE s.order_id = 100
 ORDER BY shipment_id, sales_order_item_id

NOTE: The issue with that subquery in the SELECT list (aliased as product_link), is that the statement will throw an exception if (when?) that subquery returns more than one row.  Unless you have some sort of guarantee that it will never do that, at a minimum, you could slap an ORDER BY 1 LIMIT 1 on it, or slap a MAX aggregate around the CONCAT (so that it is deterministic.)
It's also a really good idea to qualify the column references in the ORDER BY clause with the table alias, as protection against potential "ambiguous column" exceptions. I see that all your column references are qualified, which is a really good thing.
You probably also notice that I re-formatted your original query, and I introduced the JOIN keyword (in place of the commas), and moved the join predicates from the WHERE clause to the ON clause. I find that this makes the statement MUCH easier to read, and much easier to debug. It also let's you specify an OUTER JOIN.

A: You might want to try using a UNION in your query or even use the IF sql condition to set NULL if value is empty.
Hope that helps.


text:
Q: Django Cannot install jdcal and et_xmlfile manually I need to install manually for jdcal and et_xmlfile (copy file/folders) and I download from here.
https://pypi.python.org/simple/jdcal/
But it doesn't have init.py file and I got "no module name" error. How shall I do?


text:
Q: Use .htaccess To Redirect Page Without Changing URL With 'mod_rewrite' I have a script on my page that checks the url for the word signing. If the word exists, it shows the signin form in a dropdown on page load. I'd like to avoid creating extra files on the server, so I was wondering how I could do this:
When the user is at either of these urls:
http://abramobile.com/signin
http://abramobile.com/sign-in
Then direct the page back to the homepage, but leave 'signin' or 'sign-in' in the URL so that the script on my page detects that it's in the URL.
What would the mod_rewrite be to put in my .htaccess file? Thanks!

A: This should do it. This matches against the URI being exactly /signin or /sign-in and internally rewrite the URI to / so that that gets served.
RewriteRule ^sign-?in$ / [L]


text:
Q: Assetic, image assets and caching I am working on integrating Assetic into an application that I am building. The application follows the MVC pattern but does not use any frameworks. Twig is used for templating.
I have read the documentation and have looked at a few helpful blog posts.
The application is structured like this:

*

*application

*

*twig_templates

*js

*css

*public_html

*

*js

*css

*images

The twig templates are rendered and then returned by the application, so that is quite straight forward. The js and css folders underneath the application folder would hold the raw javascript and css files.
My plan is that combined and minified js and css files would be stored in the js and css folders under the public_html folder.
Since I don't plan to optimize any images using assetic, they will be placed in the images folder underneath public_html directly.
Now the question:

*

*I understand that by using assetic from twig, combined and minified assets can be exported to my public_html directories:
{% stylesheets '/path/to/sass/main.sass' filter='sass,?yui_css' output='css/all.css' %}
    <link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
{% endstylesheets %}

In this case is the css/all.css file regenerated everytime that template is rendered?

*To make the application portable (it could be hosted using a virtual host, or perhaps even in a folder) and to ensure things work in a site with routed URLs like http://site.com/controller/action, does assetic provide anyway "rewrite" URLs for images into absolute ones (i.e. images/a.jpg into http://mysite.com/images/a.jpg)?

*Does assetic work when using nested templates?
parent.twig:
<!DOCTYPE html>
<html>
    <head>
        {% block head %}
            <link rel="stylesheet" href="mainstyle.css" />
            <title>{% block title %}{% endblock %} - My Webpage</title>
        {% endblock %}
    </head>
    <body>
    </body>
</html>

child.twig:
{% extends "parent.twig" %}

{% block title %}Index{% endblock %}
{% block head %}
    {{ parent() }}
    <link rel="stylesheet" href="childstyle.css" />
{% endblock %}

In this case, how can I let assetic know that it should combine childstyle.css and mainstyle.css and serve it as 1 file?

A: as for this answer it is not possible to combine inherited stylesheets from parent with child's
Combining Assetic Resources across inherited templates


text:
Q: calculate statistical sizes grouped by two columns In R I have data like that
> a
 ID    row   variant  size  weight
<dbl>  <chr> <chr>    <dbl> <dbl>
 1     7     1        22.5  0.00609
 2     7     1        23.5  0.00704
 3     7     2        22.5  0.00598
 4     8     1        22.5  0.00536
 5     8     2        35.5  0.04043

I would like to calculate statitical sizes (mean, median, sd) for each row and variant. E.g. for the column size, the mean should be calculated for each row-variant (7-1, 7-2, 8-1, 8-2, ...). So far I am doing this by adding another column RV
a$RV<-paste(a$row, a$variant, sep='.')

and using tapply()
> tapply(a$size,a$RV,median)
        5.1         5.2         5.3         6.1         6.2         6.3         7.1         7.2
0.010555175 0.010509383 0.010497835 0.010467480 0.010540752 0.010523763 0.009427733 0.010499771
        7.3
0.010504420

Is there another, better opportunity?

A: You can use group_by() and summarize(). Here's an example
library(tidyverse)
your_data %>%
group_by(row, variant) %>%
summarize(
mean = mean(size),
median = median(size),
sd = sd(size)
)


text:
Q: How to create get method inside javascript? I am searching how to combine many code inside a javascript file.
For example, I have 2 codes inside this js:
 First: --> code is for timer function,
 Second: -> for login action.

I need the First code this time, so I can write it like :
 <script src="javascript.js?action=timer"></script>

But I don't know how to do with GET method in js. It's very easy in PHP, but I don't know the method in JS. What can I do next? Thanks for helping....

A: That is a poor way to approach what you want, one of the better methods being something like:
<script src="javascript.js"></script>
<script>Application.init("timer");</script>

But you could do something like this in PHP:
<?php header("Content-type: application/javascript"); ?>

var action = <?php echo $_GET["action"]; ?>;
console.log(action);

With the embed code:
<script src="javascript.php?action=timer"></script>
                       ^^^^ Note we're looking at a PHP file.

If you're determined to have the .js? extension, you can create a rewrite rule to accommodate that.

A: You dont need to do like this
just import the js in your page and call the appropriate function.

A: Are you trying to create new functions inside the same file?  In that case, you can simply use the standard function keyword.
If you are trying to auto-run a function when you load the script, I'd have to ask why?  It is normal to manually run the function when you need it -- sometime after the script is loaded.
<script src="javascript.js"></script>
timer();  // invoke the function

A: Those GET parameters are not available in your JavaScript. You can separate the files into two distinct ones (quite easy) or you can process things on the server side so the correct stuff is returned (unnecessarily complicated). If you just want to pass in more parameters on load, try putting the code from those files into a function and then calling the function with some arguments when the page loads.


text:
Q: Java ArrayList> clear() on child clears parent I have 2 arraylists:
ArrayList<ArrayList<String>> res= new ArrayList();
ArrayList<String> data= new ArrayList();

After I add resultset into child and append child into parent I call .clear() on then data to reset indexes.
The problem is that .clear() drops both child and the parent.
Any ideas to why?
In the end from the entire resultset I just get final row duplicated 10 times.
public ArrayList<ArrayList<String>> getTemplateTableData() {
    ArrayList<ArrayList<String>> res = new ArrayList();
    ArrayList<String> data = new ArrayList();
    CDb cb = new CDb();
    OracleConnection conn = cb.getConn();
    OraclePreparedStatement ps = null;
    OracleResultSet rs = null;
    OracleResultSetMetaData rsm = null;
    try {
      ps = (OraclePreparedStatement)
              conn.prepareStatement("Select * From Va_User_Infos_V t Where t.User_Id = 1");
      ps.execute();
      rs = (OracleResultSet)ps.getResultSet();
      rsm = (OracleResultSetMetaData)rs.getMetaData();
      while(rs.next()) {
        int col = 2;
        data.clear();
        System.out.println(data);
        while(col < rsm.getColumnCount()) {
          col++;
          data.add(rs.getString(col));
        }
        res.add(data);
        System.out.println(data);
      }
      System.out.println(res);
    } catch(Exception e) {
      e.printStackTrace();
    } finally {
      cb.done(rs);
      cb.done(ps);
      cb.done(conn);
    }
    return res;
  }

Output:
[]
[1Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[2Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[3Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[4Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[5Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[6Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[7Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[8Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[9Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[]
[10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]
[[10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8],
 [10Col-1, Col-2, Col-3, Col-4, Col-5, Col-6, Col-7, Col-8]]

Final intention is to parse the parent list and add data into XWPF docx table.
Solution:
  while(rs.next()) {
    int col = 2;
    data.clear();
    while(col < rsm.getColumnCount()) {
      col++;
      data.add(rs.getString(col));
    }
    ArrayList clone = (ArrayList)data.clone();
    res.add(clone);
  }

A: What you are doing: putting a reference to the child list into the parent list.
You are not creating a copy of the child list. Just putting references to the same list in different places.
Surprise: when you now modify that child list (no matter what you do: adding, removing, clearing, sorting ...) all other references will show you the changed content!
Two solutions:

*

*create new child lists; and do not modify a list after adding it to the parent list

*"flatten" your parent list (make it a List<String> too); and use addAll() to add the contents of the child list!


text:
Q: DotNetCore NPOI AutoSizeColumn Too Narrow I'm using NPOI and C# and cannot seem to get AutoSizeColumn to size the columns appropriately. I've followed the suggestions I can find, set the font up front in the styles, added content after the styles are applied, auto-sized the columns before write (after all data is added) and still the columns are too narrow.  Below is a demonstration of the problem:
public void ShowBug()
{
    IWorkbook workbook;
    workbook = new XSSFWorkbook();

    // Create a base font
    IFont boldFont = workbook.CreateFont();
    boldFont.FontHeightInPoints = 11;
    boldFont.FontName = "Calibri";
    boldFont.Boldweight = (short)FontBoldWeight.Bold;

    // Create a base style
    ICellStyle boldStyle = workbook.CreateCellStyle();
    boldStyle.SetFont(boldFont);

    // Create a simple cell style using the base style
    ICellStyle simpleStyle = workbook.CreateCellStyle();
    simpleStyle.CloneStyleFrom(boldStyle);

    // Create a sheet in the workbook
    ISheet excelSheet = workbook.CreateSheet("Demo");

    // Create a single row
    IRow row = excelSheet.CreateRow(0);

    // Create a single cell inside the row
    ICell cell = row.CreateCell(0);
    cell.SetCellType(CellType.String);
    cell.CellStyle = simpleStyle;
    cell.SetCellValue("This is an icredibly long text value for this column - and apparently too long");

    // Autosize the column and create the file, after the output is produced
    using (var fs = new FileStream("BugReport.xlsx", FileMode.Create, FileAccess.Write))
    {
        excelSheet.AutoSizeColumn(0, true);
        workbook.Write(fs);
    }
}

This code shows up in Excel like this:
Result of Code
So, what am I missing? What am I doing wrong?

A: I am using this approach to auto size the column header
 XSSFSheet sheet = (XSSFSheet)workbook.CreateSheet("Demo");
 sheet.AutoSizeColumn("header1"); // Remove Boolean value which you are passing


text:
Q: Why wasn't Restricted Section of the library better protected? The Restricted Section of the library of Hogwarts contained dangerous books. Why wasn't it locked or protected by some kind of spell? Certainly, Filtch (or Madam  Pince,) wasn't a good protection against a rogue wizard who could easily stun or kill him before he could call skilled wizards.

A: *

*If you mean protection against a kid (like Harry) picking up a dangerous book - and doing some damage to themselves, like Harry did in the Christmas of First year - then it's the same reason there's no electric fence around Forbidden Forest, despite dangerous animals living there. All you got was Dumbledore's warning at the starting feast.
If someone is bound and determined to do damage to themselves in a Wizarding world, they easily can. This means that mollycoddling children and nannying them is beyond useless - you need to teach them to follow the rules if those rules are clear about the danger.
Also, remember that Wizarding society is modeled after late medieval/early modern Muggle society. Back then, kids were treated more like small adults than the way they are in modern societies.

*If you mean dangerous wizards outside school, the school has multiple wards. No stranger danger there. And if a dangerous skilled wizard enters the school, they probably are already at a level where needing some book from a school library is well beneath their knowledge.

A: This is a school library we're talking about, not the dungeons of the Ministry or Voldemort's private study. Although some of the books contain advanced spells (and in some cases dark magic spells) the books weren't kept under lock and key, they were simply restricted from junior wizards. The main reason seems to have been to prevent them from harming themselves or others through sheer youthful incompetence:

Harry wandered over to the Restricted Section. He had been wondering
  for a while if Flamel wasn't somewhere in there. Unfortunately, you
  needed a specially signed note from one of the teachers to look in any
  of the restricted books and he knew he'd never get one. These were the
  books containing powerful Dark Magic never taught at Hogwarts and only
  read by older students studying advanced Defence Against the Dark
  Arts. - Harry Potter and the Philosopher's Stone

Madam Pince seems happy enough to provide Harry with full access on the signature of Professor  Minerva McGonagall (in Goblet of Fire) and both Tom Riddle and Hermione Granger spend a considerable amount of time in the restricted section researching dark magic, specifically Horcruxes.
Note that in the books, the sole protection is a rope. It's clear that students aren't intended to be permanently removed from them, the barrier is largely symbolic:

The Restricted Section was right at the back of the library. Stepping
  carefully over the rope which separated these books from the rest of
  the library, he held up his lamp to read the titles.- Harry Potter and the Philosopher's Stone

A: In my opinion the restricted section of the library was already as protected as it should be
It was inside Hogwarts, which already makes it protected enough from outside wizards
Moreover, it is not the Department of Mysteries. Although they contained dangerous information, they were still books. To be actually able to cause any damage using their information, a student would have to be determined enough to break into the section, determined enough to learn the spells and powerful enough to actually use them to good effect
The library would probably come under the jurisdiction of Madam Pince the librarian, and although we do not have much information about her abilities, she was an actual witch with magical powers, and probably more qualified than Filch, which makes it more probable that she had put as much protections over the restricted section as practically feasible (from whatever mention we have seen of her in the books, we can get the feeling that she takes her job seriously)
To be fair, we do see the restricted section in the library being broken into, which itself shows that the protections were not enough, which does justify this question. However, we should also keep in mind that the break in (I am referring to Harry in book 1, their getting hands on Most Potente Potions in Book 2 was through the proper channels and has nothing to do with the security surrounding the Restricted Section) was a special case. Students were not allowed to be outside their dormitories after dark, and Harry was able to snoop around only because he had an invisibility cloak. From what we know of invisibility cloaks, a student in Hogwarts having one is a rare case in itself. Also, harry tends to do things that he thinks are right, regardless of whether there is any concrete proof of if they are or not. The only reason he broke into the restricted section was because he got a
feeling he would find Nicolas Flammel in one of the books, which may or may not have been true.
Thus all these special events came together to make the break-in possible. This was probably a sort of one-off incident, and the restricted section is protected enough for general cases.


text:
Q: EXC_BAD_ACCESS(Code=2,address=0x8) thread cause while runtime can any one help me in this error. i try lots but get same error each and every time.
NSMutableArray *temp_array;

- (void)viewDidLoad
{

//... other code
 NSArray *dataarray = [[[mydata objectAtIndex:0] objectForKey:@"concept"] componentsSeparatedByString:@";"];
    temp_array = [[dataarray mutableCopy] autorelease];
}

-(void) setTitle:(NSString *)design_no
{

    productLbl.text = [[NSString stringWithFormat:@"%@",[temp_array objectAtIndex:[design_no intValue]]] autorelease];

    // I got error at this place like EXC_BAD_ACCESS(Code=2,address=0x8) thread cause while runtime.

}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender{

    CGFloat pageWidth = sender.frame.size.width;
    int page = floor((sender.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
    if (page==previousPage_) {
        return;
    }

    //incase we are still in same page, ignore the swipe action

    [self setTitle:[NSString stringWithFormat:@"%i",page]];

}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollViewd;{
    CGFloat pageWidth = scrollViewd.frame.size.width;
    previousPage_ = floor((scrollViewd.contentOffset.x - pageWidth / 2) / pageWidth) + 1;

}

i just wont to change LABLE text when i scroll page in scrollview.

A: try replace
temp_array = [[dataarray mutableCopy] autorelease];

to
temp_array = [[NSMutableArray alloc] initWithArray: dataarray];

A: Add this to viewDidLoad: temp_array=[[NSMutableArray alloc]init] to initialise it.

A: The problem is because, you autorelease your [dataarray mutableCopy]. Use it like this:
temp_array = [dataarray mutableCopy];


text:
Q: coldfusion Hide/remove a name from a menu/list I have an insert form that I did in adobe coldfusion. This insert form inserts information from the men on my team into a databases table called squadreport.  After every insert into my squadreport table, I would like to remove the name of the person that I just inserted from the menu list of available names of those on my team who have not been inserted yet. This way I won't accidently reinsert their names. The menu list are generated from my  NAMES  tables. The name.foiid field from my NAMES table matches my squadreport.squfoiid field from my SQUADREPORT table.
Example:  If the squadreport.squfoiid is already recorded with the start date of '2012-11-18' and a end date of '2012-11-24', then I want to prevent the reinsertion of same person with the same dates etc.
My current syntax will generate a blank list.
Here's is what my current syntax look like:
<cfquery name="brother" datasource="master">
SELECT name.foiid, squadlt, squadlt.ltid, CONCAT(name.fname,'  ',name.lname) AS teammember
FROM name
LEFT JOIN  name  ON name.foiid = squadreport.squfoiid
LEFT JOIN squadlt ON ltid = squadreport.sqult
WHERE name.foiid is null
AND squweekbegin ='2012-11-18'
AND squweekend = '2012-11-24'
AND squadlt = '3'
AND ltid = '3'
AND CITY = 'sandiego'
AND STATUS <> 'd'
AND STATUS <> 'T'
AND Form4444Complete = 'yes'
ORDER BY teammember
</cfquery>

A: Assuming you're inserting the rows into SquadReport with matching foiid columns, you'd just need to exclude the foiid values which exist in the SquadReport table. If there are other conditions like the squad member has to have been activated, or deployed or something, just add it to the exclusion clause.
<cfquery name="brother" datasource="master">
SELECT name.foiid, squadlt, squadlt.ltid, CONCAT(name.fname,'  ',name.lname) AS teammember
FROM name
LEFT JOIN  name  ON name.foiid = squadreport.squfoiid
LEFT JOIN squadlt ON ltid = squadreport.sqult
WHERE name.foiid is null
AND squweekbegin ='2012-11-18'
AND squweekend = '2012-11-24'
AND squadlt = '3'
AND ltid = '3'
AND CITY = 'sandiego'
AND STATUS <> 'd'
AND STATUS <> 'T'
AND Form4444Complete = 'yes'
<!--- new code here --->
AND name.foiid NOT IN (SELECT foiid FROM SquadReport)
<!--- end new code --->
ORDER BY teammember
</cfquery>

A: So what you basically want to do is to display people not in the table squadreport?  Something like this should work:
select name.foiid
, CONCAT(name.fname,'  ',name.lname) AS teammember
from name
where not exists
(select 1
from squadreport
where squfoiid = name.foiid
and other constraints
)
and other constraints

I assume the code you posted is early development code.  Once you go to production you will wanting to use date objects instead of strings and query parameters for any variables.


text:
Q: How do I convert an array of Promises to a stream (of Observables?) Let's say I have an array of promises, itemsPromises. Some of them will fail, half of them will probably succeed.
If I try to get the responses like so:
const itemsPromises = raw.map(item =>
            axios({
                method:'get',
                url:`https://www.omdbapi.com/?apikey=${apikey}&i=${item.imdbID}`
            })
        )

const itemsResponses = await Promise.all(itemsPromises)
...I will need to wait a LONG time until the failing promises time out, eventually. I may get 5-6 successful reponses but won't have access to them untill ALL of the promises are resolved or rejected.
Can I convert this array of Promises to some iterable form of Observables, so that every time I get a successful response I can pass it on to my application and use it?

A: Merge operator lets you execute each http call simultaneously
Rx.Observable.merge(null,
raw.map(item =>
    Rx.Observable.fromPromise(axios({
        method: 'get',
        url: `https://www.omdbapi.com/?apikey=b54e8554&i=${item.imdbID}`
    })).catch(err=>Rx.Observable.of({err,item}))
)).subscribe()