text:
Q: Activity Indicator not working on a button Click in IOS I have a form in which there are some textfields and dropdown after the selection when user hit a search button a new tableviewcontroller opens . In this table view controller it loads a function which brings data from service. the data loads with some time , now i want to use activity indicator between this time period when the data loads in table view i have used indicator ,but it not works . My code is,
    -(void)loadCustomerRecords

{

    _City = nil;

    _Title=nil;

    _Price=nil;

    _LandArea=nil;
    _Phone=nil;
    _Image1=nil;
    _location=nil;
    _name=nil;
    _email=nil;
    _descrip=nil;
    _type=nil;
    _rooms=nil;
    _washroom=nil;
    _floor=nil;
    _Id=nil;
    _status=nil;

    NSUserDefaults *string = [NSUserDefaults standardUserDefaults];

    NSString *string1 = [string stringForKey:@"country"];

    NSString *string2 = [string stringForKey:@"city"];

    NSString *string3 = [string stringForKey:@"proptype"];

    NSString *string4 = [string stringForKey:@"propstatus"];

    NSString *string5 = [string stringForKey:@"proparea"];

    NSString *string6 = [string stringForKey:@"area"];

    NSString *string7 = [string stringForKey:@"min"];

    NSString *string8 = [string stringForKey:@"max"];

    if ([string4 isEqualToString:@"Property Status"]) {

        string4 = @"";
    }

    if ([string3 isEqualToString:@"Property Type"]) {

        string3 = @"";
    }

    if([string5 isEqualToString:@"Property Area"]){

        string5 = @"";

    }
    else{

        //concatenating strings
    NSString *strappend=[NSString stringWithFormat:@"%@ %@",string6,string5];

    string5 = strappend;
    }

    if ([string7 isEqualToString:@""] && [string8 isEqualToString:@""]) {

        string7 = @"";
        string8 = @"";
    }

    NSLog(@"AREA : %@", string5);

    NSLog(@"country %@",string1);

    NSLog(@"city %@",string2);

    NSLog(@"property_type %@",string3);

    NSLog(@"propertystatus %@",string4);

    NSLog(@"propertyarea %@",string5);

    NSLog(@"area %@",string6);

    NSLog(@"min %@",string7);

    NSLog(@"max %@",string8);

    CustomTableViewCell *check=[[CustomTableViewCell alloc]init];

    check.indicator.hidden=NO;

    [check.indicator startAnimating];

    NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration

defaultSessionConfiguration];

    NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration:

 defaultConfigObject delegate: nil delegateQueue: [NSOperationQueue mainQueue]];

    NSString *urlLinkA=@"My URL";

    NSURL * url = [NSURL URLWithString:urlLinkA];

    NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:url];

    NSString *parameters = [NSString

stringWithFormat:@"country=%@&city=%@&propertytype=%@&propertstatus=%@&propertyare

a=%@",string1,string2,string3,string4,string5];

    NSLog(@"parameter %@",parameters);

    [urlRequest setHTTPMethod:@"POST"];

    [urlRequest setHTTPBody:[parameters dataUsingEncoding:NSUTF8StringEncoding]];

    NSURLSessionDataTask * dataTask =[defaultSession

dataTaskWithRequest:urlRequest
                                                       completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                                                           [check.indicator stopAnimating];

                                                           NSLog(@"Response:%@ %@\n", response, error);
                                                           if(error == nil)
                                                           {

                                                               NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];

                                                               NSLog(@"MY Response %@ ", dictionary);

                                                               NSArray *results = [dictionary objectForKey:@"property_data"];
                                                               NSLog(@"RESULT %@ ", results);

                                                               _City = [NSMutableArray array];
                                                               _Phone = [NSMutableArray array];
                                                               _LandArea = [NSMutableArray array];
                                                               _location = [NSMutableArray array];
                                                               _name = [NSMutableArray array];
                                                               _email = [NSMutableArray array];
                                                               _descrip = [NSMutableArray array];
                                                               _type = [NSMutableArray array];
                                                               _rooms = [NSMutableArray array];
                                                               _washroom = [NSMutableArray array];
                                                               _floor = [NSMutableArray array];
                                                               _Id = [NSMutableArray array];
                                                               _Price = [NSMutableArray array];
                                                               _Title = [NSMutableArray array];

                                                               for (NSDictionary * oneCustomer in results)
                                                               {
                                                                   // Create a new Customer record

                                                                   StringData * newCustomer = [[StringData alloc] init];

                                                                   newCustomer.title1 = [oneCustomer objectForKey:@"property_title"];
                                                                   NSLog(@"ID: %@ ", newCustomer.title1);
                                                                   newCustomer.Area = [oneCustomer objectForKey:@"land_area"];
                                                                   NSLog(@"Country: %@ ", newCustomer.Area);
                                                                   newCustomer.images = [oneCustomer objectForKey:@"images"];

                                                                   NSLog(@"IMAGE: %@ ", newCustomer.images);

                                                                   newCustomer.City = [oneCustomer objectForKey:@"city"];
                                                                   NSLog(@"CITY: %@ ", newCustomer.City);

                                                                   newCustomer.phoneno = [oneCustomer objectForKey:@"dealer_phone"];
                                                                   NSLog(@"ID: %@ ", newCustomer.phoneno);

                                                                   newCustomer.location = [oneCustomer objectForKey:@"location"];
                                                                   NSLog(@"ID: %@ ", newCustomer.location);

                                                                   newCustomer.property_description = [oneCustomer objectForKey:@"property_description"];
                                                                   NSLog(@"ID: %@ ", newCustomer.property_description);

                                                                   newCustomer.property_type = [oneCustomer objectForKey:@"property_type"];
                                                                   NSLog(@"ID: %@ ", newCustomer.property_type);

                                                                   newCustomer.property_id = [oneCustomer objectForKey:@"property_id"];
                                                                   NSLog(@"ID: %@ ", newCustomer.property_id);

                                                                   newCustomer.status_property = [oneCustomer objectForKey:@"status_property"];
                                                                   NSLog(@"ID: %@ ", newCustomer.status_property);

                                                                   newCustomer.status = [oneCustomer objectForKey:@"status"];
                                                                   NSLog(@"ID: %@ ", newCustomer.status);

                                                                   newCustomer.dealer_email = [oneCustomer objectForKey:@"dealer_email"];
                                                                   NSLog(@"ID: %@ ", newCustomer.phoneno);

                                                                   newCustomer.dealer_name = [oneCustomer objectForKey:@"dealer_name"];
                                                                   NSLog(@"ID: %@ ", newCustomer.dealer_name);

                                                                   newCustomer.bath = [oneCustomer objectForKey:@"bathrooms"];
                                                                   NSLog(@"ID: %@ ", newCustomer.bath);

                                                                   newCustomer.rooms = [oneCustomer objectForKey:@"rooms"];
                                                                   NSLog(@"ID: %@ ", newCustomer.rooms);

                                                                   newCustomer.floors = [oneCustomer objectForKey:@"floors"];
                                                                   NSLog(@"ID: %@ ", newCustomer.floors);

                                                                   newCustomer.country = [oneCustomer objectForKey:@"country"];
                                                                   NSLog(@"ID: %@ ", newCustomer.country);

                                                                   newCustomer.Price = [oneCustomer objectForKey:@"price"];
                                                                   NSLog(@"ID: %@ ", newCustomer.Price);

                                                                   // Add our new Customer record to our NSMutableArray
                                                                   [_Title addObject:newCustomer];

                                                                   NSString *imageURL = @"http://www.pk.house/frontend/propertyimages/";

                                                                   NSString *string3 = [imageURL stringByAppendingString:newCustomer.images];

                                                                   newCustomer.images = string3;

                                                                   NSLog(@"Image URL %@",string3);

                                                                   // addObject:[oneCustomer objectForKey:@"property_title"]];
                                                                  // NSLog(@"TET %@",_Title);

                                                                   [_Price addObject:[oneCustomer objectForKey:@"price"]];
                                                                   NSLog(@"TET %@",_Price);

                                                                   [_Image1 addObject:[oneCustomer objectForKey:@"images"]];
                                                                   NSLog(@"TET %@",_Image1);

                                                                   [_City addObject:[oneCustomer objectForKey:@"city"]];
                                                                   NSLog(@"TET %@",_City);

                                                                   [_Phone addObject:[oneCustomer objectForKey:@"dealer_phone"]];
                                                                   NSLog(@"TET %@",_Phone);

                                                                   [_name addObject:[oneCustomer objectForKey:@"dealer_name"]];
                                                                   NSLog(@"TET %@",_name);

                                                                   [_email addObject:[oneCustomer objectForKey:@"dealer_email"]];
                                                                   NSLog(@"TET %@",_email);

                                                                   [_rooms addObject:[oneCustomer objectForKey:@"rooms"]];
                                                                   NSLog(@"TET %@",_rooms);

                                                                   [_washroom addObject:[oneCustomer objectForKey:@"bathrooms"]];
                                                                   NSLog(@"TET %@",_washroom);

                                                                   [_floor addObject:[oneCustomer objectForKey:@"floors"]];
                                                                   NSLog(@"TET %@",_floor);

                                                                   [_type addObject:[oneCustomer objectForKey:@"price"]];
                                                                   NSLog(@"TET %@",_type);

                                                                   [_descrip addObject:[oneCustomer objectForKey:@"property_description"]];
                                                                   NSLog(@"TET %@",_descrip);

                                                                   [_LandArea addObject:[oneCustomer objectForKey:@"land_area"]];
                                                                   NSLog(@"TET %@",_LandArea);

                                                                   [_Id addObject:[oneCustomer objectForKey:@"property_id"]];
                                                                   NSLog(@"TET %@",_Id);

                                                                   [_location addObject:[oneCustomer objectForKey:@"location"]];
                                                                   NSLog(@"TET %@",_location);

                                                                                }
                                                               dispatch_async(dispatch_get_main_queue(), ^{
                                                                   // This code will run once the JSON-loading section above has completed.

                                                                   [self.tableView reloadData];
                                                               });

                                                               NSString *status=[dictionary valueForKey:@"property_data"];
                                                               NSLog(@"Status:%@",status);

                                                                                }
                                                           else{
                                                               NSLog(@"network error:");

                                                           }

                                                       }];
    [dataTask resume];

}

A: Try this-
  dispatch_async(dispatch_get_main_queue(), ^{
         // This block will be executed asynchronously on the main thread.
            [check.indicator stopAnimating];
       });

A: You can use below code:
[self startYourAnimation];
[self performSelector:@selector(loadCustomerRecords) withObject:nil afterDelay:0.3];

It will help you show the animation when you try to load or process rest of things.


text:
Q: mysql C ssl connection what cipher to use? Hello i am using C to connect to a mysql database. The database runs on an server which runs apache. I already have a working connection from my device to the server and the mysql database. Now I have to encrypt the mysql data stream by using ssl.
I found in the mysql C API the function mysql_set_ssl(). I have found some examples for the function but I am a bit confused, because in some examples there is the cipher set NULL and some other have a cipher.
My question is what is the difference between the them and what cipher should I use?

A: From the documentation:

*

*cipher is a list of permissible ciphers to use for SSL encryption.

Any unused SSL parameters may be given as NULL.

This would suggest that passing NULL as the ciphers means 'just use any cipher'. If you would like to specify the allowed ciphers (for example because some are not safe to use), you may pass the list of permitted ciphers. Information on what they might be can be obtained here.
Also, as more documentation states:

To determine which ciphers a given server supports, use the following statement to check the value of the Ssl_cipher_list status variable:
SHOW SESSION STATUS LIKE 'Ssl_cipher_list';

The same doc also says you can

SHOW SESSION STATUS LIKE 'Ssl_cipher';

to see if the connection is encypted and how. You may try NULL as an argument and see if that automatically selects the strongest common available cipher as I suspect it to do.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there a way to handle exceptions but only from a specific library? I am using a package (foo) and am calling a method in a class (Foo) within that package.  Let's say that package has its own exceptions defined:
exception foo.exceptions.FooEx_1
exception foo.exceptions.FooEx_2
...
exception foo.exceptions.FooEx_n

I'd prefer not to write a generic exception handler:
try:
except:
  # Process any exception here

I just want to catch only exceptions raised in the foo library/package.  Is there a way to do that?  Like:
try:
except foo.exceptions.*

A: If all of the exceptions in foo.exceptions subclass some base foo.exceptions.BaseFooException class, you can catch it:
>>> assert issubclass(NotImplementedError, RuntimeError)
>>>
>>> try:
...     raise NotImplementedError()
... except RuntimeError:
...     print('Caught it')
...
Caught it

Otherwise, you will have to extract all of the exceptions from the module:
all_exceptions = tuple(getattr(foo.exceptions, e) for e in dir(foo.exceptions) if e.startswith('FooEx'))

And filter on them:
try:
    ...
except all_exceptions as e:
    # We caught it


text:
Q: Unable to configure zoho invoice/books app in my admin account Today, I am facing issue to configure zoho invoice and books app
Note : Zoho Service Communication (ZSC) Key Generated by following this article
What i did :

*

*Login in CRM

*Click Setup

*Apps & Add-ons

*Click on Zoho Invoice/Zoho Books

*Two buttons display configure Zoho invoce and configure Zoho books

*After select any of them asking for email address and ZSC key

Here is the issue, when i put my email and zsc key, it show the error Internal Process Error
Please help me i m new in zoho, guide me if something miss-configured.

A: If you are in Zoho CRM app, enter the ZSC Key of Zoho Invoice or Zoho Books in the integration setup page. To generate the ZSC Key of Zoho Invoice/Zoho Books, kindly follow the steps mentioned below.

*

*Login to either Zoho Invoice/Zoho Books.

*Go to Integrations by clicking Settings icon in the top right corner.

*Click on 'Zoho Invoice ZSC key' or 'Zoho Books ZSC Key'

*If there is no key, click on 'Generate Now'.

*Then copy the key and email address and enter the same in Zoho CRM account.

Then you can configure the Contacts sync and Products sync between Zoho CRM and Zoho Books/Zoho Invoice. Kindly refer this link to more details.


text:
Q: Laravel 8.x - 403 Invalid Signature while running behind Cloudflare and Load Balancer I am running a Laravel 8.x app behind a Nginx load balancer. I have 2 app servers where the laravel app resides and another server for mysql database.
The problem here is when my app is proxied on Cloudflare (orange cloud), the user gets 403 | Invalid Signature error when verifying their email address.
I used laravel-cloudflare package and replace use Fideloper\Proxy\TrustProxies as Middleware; with use Monicahq\Cloudflare\Http\Middleware\TrustProxies as Middleware on app/Http/Middleware/TrustProxies.php so I can add Cloudflare's IP address as trusted proxy.
I also address the IP address of my load balancer on protected $proxies = ['lb-ip-address'];.
My app was able to get the correct user IP address and also correct generated URL.
There's no problem verifying email address if I turn off Cloudflare proxy and use letsencrypt ssl on my load balancer. But if Cloudflare proxy is on our user received 403 Invalid signature error.

A: I fixed the issue by changing the APP_URL to match the domain the request is coming in on, obviously you need to config:cache etc.

A: if you use load balance you must force https with URL::forceScheme('https');.
Laravel include all URL whene add the sign but the real url in the pod is in http.
I resolved in this mode:
$signed = URL::signedRoute(
    'ROUTE_NAME', // for example /foo/bar
    [
        'PARAM' => 'VALUE',
    ],
    false
); // generate: /foo/bar/VALUE?signed=hash
$ur = URL::to($signed); // generate: https://www.example.com/foo/bar/VALUE?signed=hash
};

in the route file:
Route::middleware('signed:relative')->get(
    'foo/bar/{PARAM}',
    [Controller::class, 'function']
)->name('ROUTE_NAME');


text:
Q: How to pass data from Fragment to Activity? I'm new at Android. I want to pass data from a fragment to another Activity. This fragment is displayed on MainActivity and I need to pass data to  DetalleActividadActivity.
This is my fragment's code:
public final static String EXTRA_PARAMETER = "com.example.arc3labswtm_android.customs.PARAMETER";

@Override
public void onActivityCreated(Bundle savedInstanceState)
{
    super.onActivityCreated(savedInstanceState);

    mAdapter = new ActivitiesAdapter(getActivity(), R.layout.act_itemlist);
      ListView listViewToDo = (ListView) getView().findViewById(R.id.activities_fragment_list);
      listViewToDo.setAdapter(mAdapter);
      listViewToDo.setOnItemClickListener(new OnItemClickListener(){
            public void onItemClick(AdapterView<?> parent, View view, int position,long id)
            {

                final Activities currentItem = mAdapter.getItem(position);
                String pid = currentItem.getId();
                Intent newActivity = new Intent(view.getContext(), DetalleActividadActivity.class);
                startActivity(newActivity);
                newActivity.putExtra(EXTRA_PARAMETER, pid);
            }
        });
      refreshItemsFromTable();
}

This is my Activity's code:
public class DetalleActividadActivity extends ActionBarActivity
{
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_detalle_actividad);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);

        Intent intent = getIntent();
        String parameter = intent.getStringExtra(ActivitiesFragment.EXTRA_PARAMETER);

    }
}

Any ideas? I don't know if this has something to do but my Activities are in this package:
com.example.arc3labswtm_android
And my fragment is in this:
com.example.arc3labswtm_android.customs
I don't know if that is why EXTRA_PARAMETER does not work.
When I get to the DetalleActividadActivity the parameter is always  null.
Please help!.

A: The problem is , you have put the EXTRA_PARAMETER to the IntentExtras after the Activity start
You need to put the Extras to the intent before you start the activity.
You can pass the data through intent when you start the Activity from Fragment like this
 Intent newActivity = new Intent(getActivity(), DetalleActividadActivity.class);
 newActivity.putExtra(EXTRA_PARAMETER, pid);
 startActivity(newActivity);

When the Activity is Created , you can retrieve the data like this
 String parameter = getIntent().getStringExtra(ActivitiesFragment.EXTRA_PARAMETER);


text:
Q: Getting odd results from a for loop inside a filter function I'm looping inside a filter. I want to get the values from my vals array plus the keys(name, description) for my filter.
When I iterate through my vals array, I keep getting returned the name but not the key.
Ideally I would like the return method to give me key and value.
return x[this.searchValues[i]].includes('phil')
to be
return x.name.includes('phil')
   return x.decription.includes('phil')
  const vals = ['name', 'decription']

  const arr =[{
    name: 'joe',
    decription: 'is a guy who likes beer'
   },
   name: 'phil',
    decription: 'is a super hero'
   }]

  this.result = arr.filter((x) => {
    for(let i = 0; i< vals.length; i++){
       return x[this.searchValues[i]].includes('phil');
    }
  })

A:

const vals = ['name', 'decription']

const arr =[{
  name: 'joe',
  decription: 'is a guy who likes beer'
 },{
 name: 'phil',
  decription: 'is a super hero'
 }]

 let result = arr.filter(e => vals.some(n => e[n].includes('phil')))

 console.log(result)

A: Not sure what you're trying to achieve, you need to clearly state what is your goal in the question.
But if the goal is to get an object with name 'phil' from arr, then this could be done like this:
this.result = arr.filter(x => x.name === 'phil')

if you need to get objects where any property equals 'phil' then:
this.result = arr.filter(x => Object.keys(x).every(k => k === 'phil'))


text:
Q: Rails nested attributes with simple form I have a households model and the household can have many visits to my agency. I have a new visit view (listed as a view under visits) that has the following code to enter the information about the visits. Below is just a snippet that has the nested attributes for the visit.
I am using strong parameters and in the households model I have the visits_attributes set (and it was working properly when I had something similar set up when I had the view listed under households)
= simple_form_for household do |h|
  - @visit = household.visit.new
  = h.simple_fields_for @visit do |h|

Unpermitted parameters: visit
Unpermitted parameters: visit

Obviously it is not working because visit is not permitted - visit is apparently the @visit instance variable I put in simple form to create a blank form
This isn't right how should I set this up?


text:
Q: how to show 2 lines with different range on nvd3 graph I am plotting a line graph using nvd3 library, it plots two lines but there is huge difference in both line values, one line (line 1) have values close to 500 and second line (line 2) have values between 0-1 because of range difference line 2 which have values in 0-1 is shown as flat line close to x-axis though its values are changing.
If I hide line 1 than i see the line 2 properly with variations, how can I show this kind of graph, here is the code and some snap shots :
nv.addGraph(function() {
      var chart = nv.models.lineChart()
                    .width(800).height(420)
                    .margin({left: 100,right:100})  //Adjust chart margins to give the x-axis some breathing room.
                    .useInteractiveGuideline(true)  //We want nice looking tooltips and a guideline!
                    .transitionDuration(350)  //how fast do you want the lines to transition?
                    .showLegend(true)       //Show the legend, allowing users to turn on/off line series.
                    .showYAxis(true)        //Show the y-axis
                    .showXAxis(true)        //Show the x-axis
      ;

  chart.xAxis     //Chart x-axis settings
      .axisLabel('X-axis');

  chart.yAxis     //Chart y-axis settings
      .axisLabel('')
      .tickFormat(d3.format('.02f'));

  d3.select('#graph-chart svg')    //Select the <svg> element you want to render the chart in.
      .datum(data)        //Populate the <svg> element with chart data...
      .call(chart);          //Finally, render the chart!

  //Update the chart when window resizes.
  nv.utils.windowResize(function() { chart.update(); });
  return chart;
});

Graph with both values here beta is shown as flat line :

Graph only with beta :

Edit :
Testing data
 {
    "key": "key1",
    "values": [
        [
            1697000000,
            19024000000
        ],
        [
            1764000000,
            19764000000
        ],
        [
            1829000000,
            21496000000
        ],
        [
            2122000000,
            20559000000
        ]
    ]
},
{
    "key": "key2",
    "values": [
        [
            1697000000,
            13530000
        ],
        [
            1764000000,
            41790000
        ],
        [
            1829000000,
            29280000
        ],
        [
            2122000000,
            11050000
        ]
    ]
}

A: You may want to use a multiChart type, which has two Y axis.
There seems to be no documentation on the nvd3 website, but you can see a live example here: http://goo.gl/DnLU6S
Also, if you're using AngularJS, check this out:
http://krispo.github.io/angular-nvd3/#/multiChart

A: With nvd3 you may use a log scale for the Y axis. Useful for such kind of series.

A: found some thing, normalize all the data you have on y-axis using any one :
a'(i) = a(i)/mean(a)

or
a'(i) = (a(i) - mean(a))/std_dev(a)

a is data array.
Then plot the data and denormalize it back using formatter on y - axis while plotting :
a(i) = a'(i) * mean(a)    or   a(i) = a'(i) * std_dev(a) + mean(a)

chart.yAxis     //Chart y-axis settings
          .axisLabel('')
          .tickFormat(formatter);


text:
Q: harddisk of 1 tb with exfat not detected in macbook pro el capitan My 1 Tb HDD is formatted in EXFAT so it could be detected both in Windows and MacOS. However, the hdd has power blinking but it is not detected in MacOS. It is working well in Windows though. On Mac, I tried different settings in disk-utility, but no luck.
Anyone has any idea on what could be the problem? How may I solve it?


text:
Q: Kubernetes kuberadm not using proxy I am using kubeadm with proxychain like this:
 proxychains4 kubeadm init --ignore-preflight-errors=all

But when it wants to pull image from k8s.gcr.io/coredns, it was not using the proxy and connect directly to k8s.gcr.io
What should I do to force kubeadm to use a proxy for pulling images

A: Can you set https_proxy and http_proxy environment variables and try.


text:
Q: ggplot2: how to read the scale transformation from a plot object I'm trying to extract information about the limits and transform of an existing ggplot object.  I'm getting close, but need some help.  Here's my code
data = data.frame(x=c(1,10,100),y=(c(1,10,100)))
p    = ggplot(data=data,aes(x=x,y=y)) + geom_point()
p    = p + scale_y_log10()
q    = ggplot_build(p)
r    = q$panel$y_scales
trans.y = (q$panel$y_scales)[[1]]$trans$name
range.y = (q$panel$y_scales)[[1]]$rang

print(trans.y) gives me exactly what I want
[1] "log-10"

But range.y is a funky S4 object (see below).
> print(range.y)
Reference class object of class "Continuous"
Field "range":
[1] 0 2
> unclass(range.y)
<S4 Type Object>
attr(,".xData")
<environment: 0x11c9a0630>

I don't really understand S4 objects or how to query their attributes and methods.  Or, if I'm just going down the wrong rabbit hole here, a better solution would be great :)  In Matlab, I could just use the commands "get(gca,'YScale')" and "get(gca,'YLim')", so I wonder if I'm making this harder than it needs to be.

A: As @MikeWise points out in the comments, this all becomes a lot easier if you update ggplot to v2.0. It now uses ggproto objects instead of proto, and these are more convenient to get info from.
It's easy to find now what you need. Just printing ggplot_build(p) gives you a nice list of all that's there.
ggplot_build(p)$panel$y_scales[[1]]$range here gives you a ggproto object. You can see that contains several parts, one of which is range (again), which contains the data range. All the way down, you end up with:
ggplot_build(p)$panel$y_scales[[1]]$range$range

# [1] 0 2

Where 0 is 10^0 = 1 and 2 is 10^2 = 100.
Another way might be to just look it up in $data part like this:
apply(ggplot_build(p)$data[[1]][1:2], 2, range)

#   y   x
# 1 0   1
# 2 1  10
# 3 2 100

You can also get the actual range of the plotting window with:
ggplot_build(p)$panel$ranges[[1]]$y.range

[1] -0.1  2.1


text:
Q: Fatal error: Unsupported operand types in /var/www/mysite/includes/theme.inc on line 637 The error occurred when I am trying to customized my own login page in drupal, according to this source: tutorial on how to customize and overriding login pages in drupal
And then I've been using drush cc all to clear the cache and somehow it appeared. I haven't done anything in the codes, since it is still working when I'm trying to apply it, and just to be sure, I traced back my edits and nothing seems wrong about it.
The line in 637 in mysite/includes/theme.inc
 // Merge the newly created theme hooks into the existing cache.
$cache = $result + $cache;

A: It simply states that $result , $cache are not having same datatype. that's why you are facing problem. try to var_dump() both value and check there datatype.
As you stated in your comment based on that you need to do like below:-
if(isset($result) && !empty($result)){$cache = $result + $cache;}


text:
Q: SQL join query and with emtpy fields or with fields containing a text im trying to build a select query with fields from two tables and also other fields which do not exist in my DB. E.g. emtpy fields or fields with particular text like 'not available'
for example my query looks like this:
select
Product.id,
Product.component_number,
Product_discount.price,
from Product
left join Product_discount ON Product_discount.id = Product.id
where
Product.deleted = 0

Now in the same query I want to add fields that do not exist like:
Codenumber >> should always be emtpy
Factor >> should always contain the text 'Yes' for every row
idea is to build a query that is identical to an import file
Thanks...

A: You can try this:
select
       Product.id,
       Product.component_number,
       Product_discount.price,
       ''    as Codenumber,
       'Yes' as Factor
  from Product
  left join Product_discount ON Product_discount.id = Product.id
 where Product.deleted = 0;

Thank you


text:
Q: Xamarin Forms stacklayout TapGestureRecognizer command not called I have added a command on StackLayout using TapGestureRecognizer but it didn't called on viewmodel class.
Here is xaml code:
<StackLayout Padding="10" Spacing="0">
    <Image Source="edit_black" WidthRequest="20" />
    <StackLayout.GestureRecognizers>
        <TapGestureRecognizer Command="{Binding EditServiceCommand}" CommandParameter="{Binding .}" />
    </StackLayout.GestureRecognizers>
</StackLayout>

ViewModel class Command method:
public ICommand EditServiceCommand
        {
            get => new Command((item) => { _popupNavigation.PushAsync(new AddServicePopup("edit"), true); });
        }

A: Please update your view model command code to the following
 private ICommand _EditServiceCommand;
 public ICommand EditServiceCommand => _EditServiceCommand ?? (_EditServiceCommand = new Command((item) =>
    {
        _popupNavigation.PushAsync(new AddServicePopup("edit"), true);
    }));

A: you need to tell the command what type item is.
public ICommand EditServiceCommand
{
     get => new Command<CommandParameterType>((item) => { _popupNavigation.PushAsync(new AddServicePopup("edit"), true); });
}

But in your code you're not using item so you can call the command without a CommandParameter.
get => new Command(() => _popupNavigation.PushAsync(new AddServicePopup("edit"), true));


text:
Q: Pircbotx channel setMode() not working in main() method I'm trying to set mode to an IRC channel but PircBotX doesn't seems to execute the command when called in the main method. The command executes when I send the message (!setRModePlus) that I have set up in the code. Where am I wrong with my code?
import org.pircbotx.Channel;
import org.pircbotx.Configuration;
import org.pircbotx.PircBotX;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.types.GenericMessageEvent;

public class MyListener extends ListenerAdapter {

static Channel channel = null;
static PircBotX bot = null;

@Override
public void onGenericMessage(GenericMessageEvent event) {

   if (event.getMessage().startsWith("!setRModePlus")) {
         channel = bot.getUserChannelDao().getChannel("#mychannel");
         channel.send().setMode("+R");
    }
    if (event.getMessage().startsWith("!setRModeMinus")) {
         channel = bot.getUserChannelDao().getChannel("#mychannel");
         channel.send().setMode("-R");
    }
}

public static void main(String[] args) throws Exception {
    //Configure the bot
    Configuration configuration = new Configuration.Builder()
            .setName("myname")
            .addServer("myserver")
            .setNickservPassword("mypassword")
            .addAutoJoinChannel("#mychannel")
            .addListener(new MyListener())
            .buildConfiguration();

    //Create  bot with the configuration
    bot = new PircBotX(configuration);
    bot.startBot();
    channel = bot.getUserChannelDao().getChannel("#mychannel");
    channel.send().setMode("+R");

}

Thank you for any help you can offer.
Sorry for my English.

A: Problem solved now. I added onConnect method and send the command like this
 public void onConnect(ConnectEvent event) {

        event.getBot().send().mode("#mychannel", "+R");
        event.getBot().send().mode("#mychannel", "-R");

}


text:
Q: Quicksort vs Median asymptotic behavior Quicksort and Median use the same method (Divide and concuer), why is it then that they have different asymptotic behavior?
Is it that quicksort may not use the proper pivot?

A: When you use method partition in Quicksort (see method in the link) to find the median, the method return index of element which have correct position, based on this position, you only need to check for selected parts which contains the median.
For example array length is 5, so median is 3. The partition method return 2, so you only need to check the upper part of the array from 2 to 5, not the whole array as Quicksort.

A: If you use Hoare's original select algorithm, you can get the same sort of poor worst case performance that you can from Quicksort.
If you use the median of medians, then you limit the worst case, at the expense of being slower in most typical cases.
You could use the median of medians to find a pivot for Quicksort, which would have roughly the same effect--limit the worst case, at the expense of being slower in most cases.
Of course, for the sort (in general) each partition operation is O(N), and you expect to do about log(N) partition operations, so you get approximately O(N log N) overall complexity.
With median finding, you also expect to do approximately O(log N) steps, but you only consider the partition from the previous step that can include the median (or quartile, etc. that you care about). You expect the sizes of those partitions to divide by (approximately) two at every step, rather than always having to partition the entire input, so you end up with approximately O(N) complexity instead of O(N log N) overall.
[Note that throughout this, I'm sort of abusing big-O notation to represent expected complexity whereas big-O is really supposed to represent the upper-bound (i.e., worst-case) complexity.]


text:
Q: Did Microsoft eliminate the PnP Template Gallery or has it moved? I found this post from 2016:
https://developer.microsoft.com/en-us/office/blogs/pnp-templates-gallery-open-source-provisioning-templates/
"At Microsoft Ignite 2016, in Atlanta, we proudly announced the availability of the new "PnP Templates Gallery" portal, which is available at the following URL: https://templates-gallery.sharepointpnp.com."
"The basic idea around this new portal, is to have a public and shared repository for PnP provisioning templates, which anybody can download and use for free. Moreover, we hope that many community members will like to share their own templates with the community. In the following figure, you can see the home page of the PnP Templates Gallery."
Sooo why is it a dead link now? Did it get moved? Is Microsoft moving away from PnP Templates?

A: I haven't seen any official deprecation messages (maybe I missed something). But it looks like they decided to transform it into something more solid and supported.
At the end of 2018 a SharePoint Online Provisioning Service (in beta as of now) was introduced:

You can use this service (when released) to provision different kind of sites and site collections to your tenant.

Under the hood, it uses PnP templates.
To see it in action check out this youtube video


text:
Q: CS cart addon development, do specific task after each order placed, extra store data, custom URL for specific task inside addon I am trying to develop a new add-on for cs cart.
I need some help for following matters:

*

*I want to use a hook that will run my code from my addon for my own task. I want to use a hook that will be triggered each time when a new order is placed, using either cash or paypal payment. Which hook should I use so that no order will miss this hook? I want to send order details to a third party API when order placed by customer. For cash order, instantly, and for paypal, order when IPN comes.

*For multi store license, how can I put store specific custom settings/configuration in my addon? I mean each store will have different custom settings to identify by my addon.

*I need a URL that will trigger/run some code from my addon that will do some db update and send notification only. How could I do that in my addon?
Please, if anyone could help me. At least if you could give me some link of documentation or tutorial, then it will be enough because I am not seeing these things in cs cart documentation.

A: Well I can answer 2 of the 3 questions.
So you have multi store licenses, each store has its own ID, therefore you could use the hook company_id.

*

*Just add {if} and after that your code. (or you just apply this to the necessary locations of your code. (you can also use {foreach} to make it somewhat "automated".

About the URL,

*

*you could setup a custom cron Job, please visit the cscart documentation for this.


text:
Q: I cannot fill the lines with color. It simply makes them black I am trying to make a draw simulation, but it is not working. I made sure that colors[penColorsIndex] is right and I am not getting any errors. Can anyone help? When I call drawLines(lineArray), the color is black. So, it then shows only black lines instead of red, green, or yellow lines.
var lineObj = {
        px: pmouseX,
        py: pmouseY,
        x: mouseX,
        y: mouseY,
        c: colors[penColorsIndex],
        size: penSizes[penSizesIndex]
    };
lines.push(lineObj);

function drawLines(lineArray) {
    for (var i = 0; i < lineArray.length; i++) {
         fill(lineArray[i].c);
         strokeWeight(lineArray[i].size)
         line(lineArray[i].px, lineArray[i].py, lineArray[i].x, lineArray[i].y);
    }

};

A: I think you show use stroke() instead of fill().
stroke(lineArray[i].c);
strokeWeight(lineArray[i].size)
line(lineArray[i].px, lineArray[i].py, lineArray[i].x, lineArray[i].y);

stroke is for the border, fill is for the background.


text:
Q: How to use Validating String Parameter Plugin in the Jenkins declarative pipeline code? I'm curious as to if it is possible to define the String Validator Plugin in a Jenkins declarative pipeline code? I already have a working setup defined via job UI, but my intention is to put everything in the pipeline defined as:
string(name='', ......).

Unfortunately, all examples on the web are explaining how to set up the validation in the UI, which I already have. Or is it one of those plugins that is not supported in a pipeline model?

A: This plugin can be used as a validatingString parameter in the declarative pipeline code.
pipeline {
    agent any

    parameters {
        validatingString(name: "test", defaultValue: "", regex: /^abc-[0-9]+$/, failedValidationMessage: "Validation failed!", description: "ABC")
    }

    stages {
        stage("Test") {
            steps {
                echo "${params.test}"
            }
        }
    }
}

Keep in mind, that the first time you will run your pipeline after adding this code, the parameter won't show up - it will be added during the first run of the pipeline. After that you will see the parameter in the pipeline UI:

And when you run the parameterized pipeline, the validation will be applied:

A: I am not sure why, but when I wrapped each of my arguments into a named key, I was able to bypass this error I received:
So this will give you javaposse.jobdsl.dsl.helpers.BuildParametersContext.validatingString() is applicable for argument types Error:
            validatingString (
                "EMAIL_VALIDATED"
                'defaultEmail'
                'someregex',
                'somevalidationfailuremessage',
                'Use your email'
            )

However, this worked:
            validatingString {
                name("EMAIL_VALIDATED")
                defaultValue('defaultEmail')
                regex('someregex')
                failedValidationMessage('somevalidationfailuremessage')
                description('Use your email')
            }


text:
Q: RAML API Designer Mock Service: HATEOAS response with absolute URLs? I created REST API mock using RAML tool. How can I return in my JSON object response hypermedia links with absolute paths?
Is there a way to include baseUri into my sample JSON object in order to create absolute path?
Right now I have relative path "/users/ff33c2a1-b877-4415-9e62-115b8239c787" in my JSON object:
{
"name": "John Smith",
"email": "john.smith@sample.com",
"status": "pending",
"_links": [
  {
    "rel": "self",
    "href": "/users/ff33c2a1-b877-4415-9e62-115b8239c787"
  }
]}

And actually I wanna have absolute path where root is taken from my baseUri value.
E.g. path should be something like "http://mocksvc.mulesoft.com/mocks/a2683439-a5dc-409c-801a-c771042970fb/mocks/31e46658-b4ce-4f40-cc91-c4fd50f7a2d8/v1/users/ff33c2a1-b877-4415-9e62-115b8239c787"
I tried using something like:
"href": "{baseUri}/users/ff33c2a1-b877-4415-9e62-115b8239c787"
or without quotes
"href": {baseUri}/users/ff33c2a1-b877-4415-9e62-115b8239c787
but none of the above worked.
I am using RAML 0.8.


text:
Q: Unable to change the values of the mapping data in text field I have my data in array format inside the object.
Here is the JSON data:
[
  {
    "id": "1",
    "details": [
      { "id": "12wer1", "name": "ABC", "age": 15 },
      { "id": "78hbg5", "name": "FRE", "age": 21 }
    ]
  },
  {
    "id": "2",
    "details": [
      { "id": "po78u9", "name": "TER", "age": 18 },
      { "id": "dre87u", "name": "YUN", "age": 30 }
    ]
  }
]

I want to change the name and age with respective of the "id". It should not get change for another "id". For Example: if i want to change name = "ABC" then it should not change for the Name="FRE". But couldn't able to do that.
Can anyone help me in writing proper onChange funtion for this and validation for text field?
Here is the sample code:
{this.state.Data.map((i) => (
          <>
            {i.details.map((y) => (
              <Grid container justify="center" spacing={2}>
                <Grid item xs={3}>
                  <TextField label="Name" variant="outlined" value={y.name} />
                </Grid>
                <Grid item xs={3}>
                  <TextField label="Age" variant="outlined" value={y.age} />
                </Grid>
              </Grid>
            ))}{" "}
          </>
        ))}
      </>

Here is the working code

A: Create an onChange handler that consumes the outer and inner array indices, and onChange event and map the old state to the new state using the map index to match the object you want to update.
handleChange = (dataIndex, detailIndex) => (e) => {
  const { id, value } = e.target;
  this.setState(({ Data }) => ({
    Data: Data.map((dataItem, data_index) =>
      data_index === dataIndex
        ? {
            ...dataItem,
            details: dataItem.details.map((item, index) =>
              index === detailIndex
                ? {
                    ...item,
                    [id]: value
                  }
                : item
            )
          }
        : dataItem
    )
  }));
};

Provide the id attributes for the inputs to pass in the event object.
{this.state.Data.map((i, dataIndex) => ( // <-- data index
  <>
    {i.details.map((y, detailIndex) => ( // <-- detail index
      <Grid container justify="center" spacing={2}>
        <Grid item xs={3}>
          <TextField
            label="Name"
            id="name" // <-- id name attribute
            variant="outlined"
            value={y.name}
            onChange={this.handleChange(dataIndex, detailIndex)} // <-- onChange callback
          />
        </Grid>
        <Grid item xs={3}>
          <TextField
            label="Age"
            id="age" // <-- id age attribute
            variant="outlined"
            value={y.age}
            onChange={this.handleChange(dataIndex, detailIndex)} // <-- onChange callback
          />
        </Grid>
      </Grid>
    ))}{" "}
  </>
))}

A: you need to create an onChange handler and pass to TextField to proper see your value being updated, otherwise it will remain static. Given each object in array has an id you can use it to filter the target object. Make sure to create copies to avoid mutate state directly:
  onChange = (e, itemId, detailId) => {
    const { name, value } = e.target;
    const Data = [...this.state.Data]; // copy Data into new array
    const itemIndex = Data.findIndex((item) => item.id === itemId);

    if (itemIndex === -1) return; // return if item not found
    const item = { ...Data[itemIndex] }; // copy item object
    const detailsIndex = item.details.findIndex(
      (detail) => detail.id === detailId
    );

    if (detailsIndex === -1) return; // return if detail not found
    item.details[detailsIndex] = {
      ...item.details[detailsIndex],
      [name]: value
    };
    Data[itemIndex] = item; // pass new item
    this.setState({ Data });
  };

At TextField pass name attribute, so you can extract e.target.name above. your TextField becomes:
<Grid item xs={3}>
  <TextField
    label="Name"
    name="name"
    variant="outlined"
    value={y.name}
    onChange={(e) => this.onChange(e, i.id, y.id)}
  />
</Grid>
<Grid item xs={3}>
  <TextField
    label="Age"
    name="age"
    variant="outlined"
    value={y.age}
    onChange={(e) => this.onChange(e, i.id, y.id)}
  />
</Grid>


text:
Q: How to create complex .Net objects from json(javascript) in Asp.Net WebApi using RequestCommand I have succeded in creating simple objects as follows.
The json on the client side js is as follows.
{"Page":1, "Take":10, "SortOrder":"Asc", "PropName":"Id"}

On the webapi side, I have the following class
public class PaginatedRequestCommand
{

    public int Page { get; set; }

    public int Take { get; set; }

    public string PropName { get; set; }

    public string SortOrder { get; set; }
}

And the WebApiConfig class is as follows
public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { id = RouteParameter.Optional }
        );

    // skiped many other lines as they are not relevant

        config.ParameterBindingRules.Insert(0, typeof(PaginatedRequestCommand),
            x => x.BindWithAttribute(new FromUriAttribute()));

    }
}

And so in Wep Api controller I have the following action method.
    [HttpPost]
    [HttpGet]
    public PaginatedList<PatientCategory> PatCat(PaginatedRequestCommand cmd)
    {
    //......
}

So here I have PaginatedRequestCommand object correctly constructed and the properties Page, Take etc are
correctly available. The Angularjs ajax call on the browser is
$http({
            method: 'GET',
            url: this.callParams.uri, // The URI
            params: this.callParams.paginationOptions, // This is where the JSON that showed earlier goes.
            headers: { 'Content-Type': 'application/Json' }
})

Every thing so far so good.
Now I want to pass in some more parameters. I want to include an array in the JSON as follows.
{"Page":1,"Take":10,"SortOrder":"Asc","PropName":"Id",
    "wherePredicateParams":
[{"propName":"Name","val":"s"},
 {"propName":"Description","val":"h"}
]
}

So you see that the "wherePredicateParams" is the additional object that I want to pass. Its an array.
What modifications do I have to do on the WebApi side?
I have tried adding the one more property to the PaginatedRequestCommand class, public string[] wherePredicateParams { get; set; }
so the full class is as follows.
public class PaginatedRequestCommand
{

    public int Page { get; set; }

    public int Take { get; set; }

    public string PropName { get; set; }

    public string SortOrder { get; set; }

    public string[] wherePredicateParams { get; set; }
}

This is actually working, in the sense that the property wherePredicateParams of PaginatedRequestCommand object created by the api inside the action method of the above controller
is providing me with {"propName":"Name","val":"s"} and {"propName":"Description","val":"h"}. But the problem is I have to parse it my self and use. Is there a better way.
Then I have tried changing string[] to whereParam[] and defined a class
public class whereParam
{
    public string propName { get; set; }
    public string val { get; set; }
}

So you see the propName and val are null? What am I missing?

A: After quite a struggle, I found the answer. The problem is not on the webApi side. Its on the client side. I am using AngularJS for the ajax call. So thats where the problem is. Here I describe it.
Please note I have changed the class names during the coarse of the investigation, so the class name PaginatedRequestCommand would now be PaginatedRequest. Similarly there would be some other changes. I shall post all the details here again, to avoid any confusion.
Earlier it was
$http({
            method: 'GET',
            url: this.callParams.uri,
            params: this.callParams.paginationOptions,
            headers: { 'Content-Type': 'application/Json' }
})

You see the this.callParams.paginationOptions. That javascript object would look something like this.
{"Page":1,"Take":10,"SortOrder":"Asc","PropName":"Id","whereParams":
[{"FilterPropName":"Name","FilterPropValue":"jk"}]}

And this.callParams.uri would be something like this.
'/api/PatientCategoryApi/PatCat'

Here PatientCategoryApi is the WebApi controller, and PatCat is the action method on the WebApi side. The action method with the following signature would be needed.
    [HttpPost]
    [HttpGet]
    public PaginatedList<PatientCategory> PatCat(PaginatedRequest rqst)

The PaginatedRequest class is as follows.
public class PaginatedRequest
{
    public int Page { get; set; } // Page Index
    public int Take { get; set; } // Page Size
    public string PropName { get; set; } // Property Name for sorting.
    public string SortOrder { get; set; }  // Sort Direction Asc or Desc
    public List<WhereParam> whereParams { get; set; }
}

And WhereParam class is as follows
public class WhereParam
{
    public string FilterPropName { get; set; }
    public string FilterPropValue { get; set; }
}

Configure parameter binding rules in webApiConfig as follows.
config.ParameterBindingRules.Insert(0, typeof(PaginatedRequest),
    x => x.BindWithAttribute(new FromUriAttribute()));

This is all to it. Had I used JQuery, this would work. But with AngularJS, the serialization is different. So the trick is to add
paramSerializer: '$httpParamSerializerJQLike',

to the ajax call. I found in this so question AngularJS GET ajax call with Array parameters.
So the entire call would now look like the following.
$http({
            method: 'GET',
            url: this.callParams.uri,
            paramSerializer: '$httpParamSerializerJQLike',
            params: this.callParams.paginationOptions,
            headers: { 'Content-Type': 'application/Json' }
})

This now ensures the serialization would be the way WebApi understands. And the binding on the WebApi side happens correctly.
If you wish, you can also the change the action method signature as follows to separate List property into a param. In this case the binding is no longer a complex object, but one simple object and an array(or list).
[HttpPost]
[HttpGet]
public PaginatedList<PatientCategory> PatCat(PaginatedRequest rqst,
List<WhereParam> whereParams){...}

In such a case PaginatedRequest would not have the WhereParam list as a property.
public class PaginatedRequest
{
    public int Page { get; set; } // Page Index
    public int Take { get; set; } // Page Size
    public string PropName { get; set; } // Property Name for sorting.
    public string SortOrder { get; set; }  // Sort Direction Asc or Desc
    // You dont want this here in this approach.
    //public List<WhereParam> whereParams { get; set; }
}

And in the webApiConfig class you need to add the following additionally.
        config.ParameterBindingRules.Insert(0, typeof(List<WhereParam>),
            x => x.BindWithAttribute(new FromUriAttribute()));

And there is no other change needed on the client side. This should work.
Overall, in any case, the key is as I mentioned,
paramSerializer: '$httpParamSerializerJQLike',

A: The property wherePredicateParams is a string[] not a whereParam[] so this make that the serializer dont serialize this properties, but I suggest you to use Json.NET you can get it here http://www.newtonsoft.com/json, this lib allows that you use Attributes on your properties that map your json schema to a class/type.
You can do something like the example:
public class WhereParam
{
    [JsonProperty("propName")]
    public string PropName { get; set; }
    [JsonProperty("val")]
    public string Val { get; set; }
}


text:
Q: PayPal IPN unique identifier I always assumed that txn_id sent with IPN message is unique. PayPal guidelines seem to support this idea - https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro

Avoid duplicate IPN messages. Check that you have not already processed the transaction identified by the transaction ID returned in the IPN message. You may need to store transaction IDs returned by IPN messages in a file or database so that you can check for duplicates. If the transaction ID sent by PayPal is a duplicate, you should not process it again.

However I found that PayPal's eCheck payment IPN is sent twice with the same transaction ID. Once during initial payment with payment_status as "Pending" and again after couple days when eCheck is actually processes with payment_status as "Completed".
I want to store both transactions, but still would like to avoid storing duplicates. There is another field in IPN called ipn_track_id and it's different for both transactions, but I can't find documentation for it, except this vague description:

Internal; only for use by MTS and DTS

Anyone else is using ipn_track_id to uniquely identify IPN messages?

A: ipn_track_id is not unique for recurring payments. At least for installment plan it's not.
When customer create the installment plan and if your plan have a first payment at checkout you will receive 2 IPN messages with the same ipn_track_id (Example bellow).
First notification "recurring_payment_profile_created" the the first payment "recurring_payment"
Plan created IPN
 [txn_type] => recurring_payment_profile_created
 [recurring_payment_id] => I-57UAPHFJ3SBY
 [product_name] => Risk-Free Trial
 [time_created] => 06:24:39 Aug 15, 2013 PDT
 [ipn_track_id] => bdd94fdee935a

First Payment IPN
 [txn_type] => recurring_payment
 [mc_gross] => 10.95
 [shipping] => 0.00
 [product_type] => 1
 [time_created] => 06:24:39 Aug 15, 2013 PDT
 [ipn_track_id] => bdd94fdee935a

A: ipn_track_id shouldn't be used; mainly because this is for internal use only as stated, and because it's unique for every IPN message.
The txn_id is unique for each transaction, not each IPN message.
What this means is; one transaction can have multiple IPN messages. eCheck, for example, where it will go in a 'Pending' state by default, and 'Complete' once the eCheck has cleared.
But you may also see reversals, canceled reversals, cases opened and refunds against the same txn_id.
Pseudo code:
If not empty txn_id and txn_type = web_accept and payment_status = Completed
    // New payment received; completed. May have been a transaction which was pending earlier.
    Update database set payment_status = Completed and txn_id = $_POST['txn_id']

If not empty txn_id and txn_type = web_accept and payment_status = Pending
    // New payment received; completed
    Update database set payment_status = Pending and payment_reason = $_POST['pending_reason'] and txn_id = $_POST['txn_id']

You can find a lot more IPN variables listed on https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id08CTB0S055Z
Basically; PayPal will generate a unique seller transaction ID. This tranaction ID may go through various stages before it's 'Completed', so you'll need to be able to handle these exceptions.
As for PayPal's note in the documentation: PayPal may resend individual IPN mesages if it encounters errors during delivery. For example, it's required for your script to return a proper HTTP/1.1 200 OK HTTP status response whenever PayPal POST's the IPN data to it.
If you don't return a HTTP/1.1 200 OK response, PayPal will reattempt sending the same data up to 16 times per indiviudal IPN message.
Note: A seller's transaction ID is different from a buyer's transction ID, since they're two different actions (one debit, one credit).

A: Not all IPN messages contain a $_POST['txn_id'], so if you solely check for a txn_id, you may intermittently not log IPN messages where they don't contain this key.

A: In my PHP API call, i use these fields and store them in my database:
custom=xxxx

(or  invoice=ZZZZZZ)
then, when your page receives IPN, it should check (from database) if the custom=xxxx or etc...

A: IPN transactions are unique, also and transactions that change the payment will generate a new txn_id. For example refunds, so its a good idea to store all txn_id related to a single purchase. As of yet I don't know what transactions other than refunds generate a new txn_id, possibly reversals do too.


text:
Q: Can't see dropout in Tensorboard graph I am applying dropout to the first layer in the following way :
out = layers.fully_connected(X, num_outputs=hidden[0], activation_fn=None)
out1 = tf.nn.relu(out)
drop_out = tf.nn.dropout(out1, keep_prob) #keep_prob = 0.5

out2 = layers.fully_connected(drop_out, num_outputs=hidden[1], activation_fn=None)
out2 = tf.nn.relu(out2)

out3 = layers.fully_connected(out4, num_outputs=num_actions, activation_fn=None)

But I cannot see dropout in tensorboard computational graph. Do I need to explicitly write a command in the summary to include Dropout layer ?
Tensorboard graph for the above model


text:
Q: thingsboard send multiple data to device with http api with curl in cmd i am trying to send two number to thingsboard iot platform.
send one data is like this :
curl -v POST --data "{"photoresistor":10}" https://thingsboard.cloud/api/v1/nIjlT58Xo81AdU2Pwymm/telemetry --header "Content-Type:application/json"
but i do not know how to send two data to thingsboard .
in my search i saw this
curl -v -X POST --data "{"temperature":42,"humidity":73}" https://demo.thingsboard.io/api/v1/ABC123/telemetry --header "Content-Type:application/json"
form https://thingsboard.io/docs/reference/http-api/
but any device should have one $ACCESS_TOKEN . and  i can not use above command with two data "{"temperature":42,"humidity":73}" .
because every device need one ACCESS_TOKEN.
please help me to solve this problem.
thanks.

A: If you're using Thingsboard CE then you will need to get creative if you don't want to use access tokens. Possibly look at AWS lambda functions to act as a middle-man to forward messages.
If you're using Thingsboard PE then instead of posting to the device directly using it's ACCESS_TOKEN, you can use Integrations & Data Converters.

A: There is also a way to achieve this with ThingsBoard CE. You could use the MQTT Gateway API:
"Gateway API provides the ability to exchange data between multiple devices and the platform using single MQTT connection."
https://thingsboard.io/docs/reference/gateway-mqtt-api/#:~:text=Gateway%20API%20provides%20the%20ability%20to%20exchange%20data,below%20is%20used%20by%20ThingsBoard%20open-source%20IoT%20Gateway.
Still ACCESS_TOKEN is needed, but only one for the Gateway. You can publish messages of multiple devices in a single connection. Each device is identified by it's name. Also not existing devices are created automatically.


text:
Q: GCE 8 GPU instance randomnly reboots while training is running I have an 8 GPU GCE instance that randomnly reboots in the middle of a training routine. This happened a couple of times. The instance also appears to stay down for quite a while before it comes back up. I found some traces in the kernel log of a dump that looks like it might be the cause (?). Any ideas what I can do about this?
The configuration is pretty ordinary : An ubuntu instance running a python 3 Tensorflow App that's training on images and the Nvidia drivers are installed with the cuda toolkit.
The log is shown below. The last few lines indicating the system is booting up but nearly after 10 hours it appears
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749736] Call Trace:
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749737]  <IRQ>  [<ffffffff813f8dd3>] dump_stack+0x63/0x90
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749746]  [<ffffffff810ddd33>] __report_bad_irq+0x33/0xc0
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749747]  [<ffffffff810de0c7>] note_interrupt+0x247/0x290
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749749]  [<ffffffff810db277>] handle_irq_event_percpu+0x167/0x1d0
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749750]  [<ffffffff810db31e>] handle_irq_event+0x3e/0x60
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749752]  [<ffffffff810de639>] handle_fasteoi_irq+0x99/0x150
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749756]  [<ffffffff8103119d>] handle_irq+0x1d/0x30
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749758]  [<ffffffff8184341b>] do_IRQ+0x4b/0xd0
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749761]  [<ffffffff81841502>] common_interrupt+0x82/0x82
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749764]  [<ffffffff81085d5e>] ? __do_softirq+0x7e/0x290
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749766]  [<ffffffff810860e3>] irq_exit+0xa3/0xb0
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749767]  [<ffffffff818434e2>] smp_apic_timer_interrupt+0x42/0x50
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749769]  [<ffffffff818417a2>] apic_timer_interrupt+0x82/0x90
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749770]  <EOI>  [<ffffffff81064606>] ? native_safe_halt+0x6/0x10
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749775]  [<ffffffff81038e1e>] default_idle+0x1e/0xe0
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749776]  [<ffffffff8103962f>] arch_cpu_idle+0xf/0x20
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749780]  [<ffffffff810c454a>] default_idle_call+0x2a/0x40
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749781]  [<ffffffff810c48b1>] cpu_startup_entry+0x2f1/0x350
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749798]  [<ffffffff810517c4>] start_secondary+0x154/0x190
Jun  7 19:23:59 gpu-8-2 kernel: [62064.749799] handlers:
Jun  7 19:23:59 gpu-8-2 kernel: [62064.752277] [<ffffffffc2b034e0>] nvidia_isr [nvidia] threaded [<ffffffffc2b03eb0>] nvidia_isr_kthread_bh [nvidia]
Jun  7 19:23:59 gpu-8-2 kernel: [62064.762984] [<ffffffffc2b034e0>] nvidia_isr [nvidia] threaded [<ffffffffc2b03eb0>] nvidia_isr_kthread_bh [nvidia]
Jun  7 19:23:59 gpu-8-2 kernel: [62064.773705] [<ffffffffc2b034e0>] nvidia_isr [nvidia] threaded [<ffffffffc2b03eb0>] nvidia_isr_kthread_bh [nvidia]
Jun  7 19:23:59 gpu-8-2 kernel: [62064.784444] [<ffffffffc2b034e0>] nvidia_isr [nvidia] threaded [<ffffffffc2b03eb0>] nvidia_isr_kthread_bh [nvidia]
Jun  7 19:23:59 gpu-8-2 kernel: [62064.795096] Disabling IRQ #10
Jun  8 05:27:43 gpu-8-2 kernel: [    0.000000] Initializing cgroup subsys cpuset
Jun  8 05:27:43 gpu-8-2 kernel: [    0.000000] Initializing cgroup subsys cpu
Jun  8 05:27:43 gpu-8-2 kernel: [    0.000000] Initializing cgroup subsys cpuacct
Jun  8 05:27:43 gpu-8-2 kernel: [    0.000000] Linux version 4.4.0-79-generic (buildd@lcy01-30) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #100-Ubuntu SMP Wed May
17 19:58:14 UTC 2017 (Ubuntu 4.4.0-79.100-generic 4.4.67)


text:
Q: How to display multiple notifications in android I am receiving only one notification and if there comes another notification, it replaces the previous one and here is my code
private static void generateNotification(Context context, String message,
        String key) {
    int icon = R.drawable.ic_launcher;
    long when = System.currentTimeMillis();
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, when);

    String title = context.getString(R.string.app_name);

    Intent notificationIntent = new Intent(context,
            FragmentOpenActivity.class);
    notificationIntent.putExtra(key, key);
    // set intent so it does not start a new activity
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
            | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent intent = PendingIntent.getActivity(context, 0,
            notificationIntent, 0);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;

    notification.defaults |= Notification.DEFAULT_SOUND;

    // notification.sound = Uri.parse("android.resource://" +
    // context.getPackageName() + "your_sound_file_name.mp3");
    notification.defaults |= Notification.DEFAULT_VIBRATE;
    notificationManager.notify(0, notification);

}

A: Simple notification_id needs to be changable.
Just create random number for notification_id.
    Random random = new Random();
    int m = random.nextInt(9999 - 1000) + 1000;

or you can use this method for creating random number as told by tieorange (this will never get repeated):
    int m = (int) ((new Date().getTime() / 1000L) % Integer.MAX_VALUE);

and replace this line to add parameter for notification id as to generate random number
    notificationManager.notify(m, notification);

A: i guess this will help someone..
in below code "not_nu"  is an random int..   PendingIntent and Notification have the same ID .. so that on each notification click the intent will direct to different activity..
private void sendNotification(String message,String title,JSONObject extras) throws JSONException {
   String id = extras.getString("actionParam");
    Log.e("gcm","id  = "+id);
    Intent intent = new Intent(this, OrderDetailActivty.class);
    intent.putExtra("id", id);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    final int not_nu=generateRandom();
    PendingIntent pendingIntent = PendingIntent.getActivity(this, not_nu /* Request code */, intent,
            PendingIntent.FLAG_ONE_SHOT);

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setSmallIcon(R.mipmap.ic_cart_red)
            .setContentTitle(title)
            .setContentText(message)
            .setAutoCancel(true)
            .setSound(defaultSoundUri)
            .setContentIntent(pendingIntent);

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(not_nu /* ID of notification */, notificationBuilder.build());
}
public int generateRandom(){
    Random random = new Random();
    return random.nextInt(9999 - 1000) + 1000;
}

A: At the place of uniqueIntNo put unique integer number like this:
mNotificationManager.notify(uniqueIntNo, builder.build());

A: notificationManager.notify(0, notification);

Put this code instead of 0
new Random().nextInt()

Like below it works for me
notificationManager.notify(new Random().nextInt(), notification);

A: You need to add a unique ID to each of the notifications so that they do not combine with each other. You can use this link for your reference :
https://github.com/sanathe06/AndroidGuide/tree/master/ExampleCompatNotificationBuilder

A: I solved my problem like this...
/**
     * Issues a notification to inform the user that server has sent a message.
     */
    private static void generateNotification(Context context, String message,
            String keys, String msgId, String branchId) {
        int icon = R.drawable.ic_launcher;
        long when = System.currentTimeMillis();
        NotificationCompat.Builder nBuilder;
        Uri alarmSound = RingtoneManager
                .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        nBuilder = new NotificationCompat.Builder(context)
                .setSmallIcon(R.drawable.ic_launcher)
                .setContentTitle("Smart Share - " + keys)
                .setLights(Color.BLUE, 500, 500).setContentText(message)
                .setAutoCancel(true).setTicker("Notification from smartshare")
                .setVibrate(new long[] { 100, 250, 100, 250, 100, 250 })
                .setSound(alarmSound);
        String consumerid = null;
        Integer position = null;
        Intent resultIntent = null;
        if (consumerid != null) {
            if (msgId != null && !msgId.equalsIgnoreCase("")) {
                if (key != null && key.equalsIgnoreCase("Yo! Matter")) {
                    ViewYoDataBase db_yo = new ViewYoDataBase(context);
                    position = db_yo.getPosition(msgId);
                    if (position != null) {
                        resultIntent = new Intent(context,
                                YoDetailActivity.class);
                        resultIntent.putExtra("id", Integer.parseInt(msgId));
                        resultIntent.putExtra("position", position);
                        resultIntent.putExtra("notRefresh", "notRefresh");
                    } else {
                        resultIntent = new Intent(context,
                                FragmentChangeActivity.class);
                        resultIntent.putExtra(key, key);
                    }
                } else if (key != null && key.equalsIgnoreCase("Message")) {
                    resultIntent = new Intent(context,
                            FragmentChangeActivity.class);
                    resultIntent.putExtra(key, key);
                }.
.
.
.
.
.
            } else {
                resultIntent = new Intent(context, FragmentChangeActivity.class);
                resultIntent.putExtra(key, key);
            }
        } else {
            resultIntent = new Intent(context, MainLoginSignUpActivity.class);
        }
        PendingIntent resultPendingIntent = PendingIntent.getActivity(context,
                notify_no, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
        if (notify_no < 9) {
            notify_no = notify_no + 1;
        } else {
            notify_no = 0;
        }
        nBuilder.setContentIntent(resultPendingIntent);
        NotificationManager nNotifyMgr = (NotificationManager) context
                .getSystemService(context.NOTIFICATION_SERVICE);
        nNotifyMgr.notify(notify_no + 2, nBuilder.build());
    }

A: Another way of doing it is take the current date convert it into long just take the last 4 digits. There is a high probability that the number will be unique.
    long time = new Date().getTime();
    String tmpStr = String.valueOf(time);
    String last4Str = tmpStr.substring(tmpStr.length() -5);
    int notificationId = Integer.valueOf(last4Str);

A: You just need to change your one-line from notificationManager.notify(0, notification); to  notificationManager.notify((int) System.currentTimeMillis(), notification);...
This will change the id of notification whenever the new notification will appear

A: Using Shared Preferences worked for me
SharedPreferences prefs = getSharedPreferences(Activity.class.getSimpleName(), Context.MODE_PRIVATE);
int notificationNumber = prefs.getInt("notificationNumber", 0);
...

notificationManager.notify(notificationNumber , notification);
SharedPreferences.Editor editor = prefs.edit();
notificationNumber++;
editor.putInt("notificationNumber", notificationNumber);
editor.commit();

A: just replace your line with this
 notificationManager.notify(Unique_Integer_Number, notification);

hope it will help you.

A: Replace your line with this.
notificationManager.notify((int) ((new Date().getTime() / 1000L) % Integer.MAX_VALUE), notification);

A: The problem is with your notificationId. Think it as an array index. Each time you update your notification, the notificationId is the place it takes to store value. As you are not incrementing your int value (in this case, your notificationId), this always replaces the previous one. The best solution I guess is to increment it just after you update a notification. And if you want to keep it persistent, then you can store the value of your notificationId in sharedPreferences. Whenever you come back, you can just grab the last integer value (notificationId stored in sharedPreferences) and use it.

A: Below is the code for pass unique notification id:
//"CommonUtilities.getValudeFromOreference" is the method created by me to get value from savedPreferences.
String notificationId = CommonUtilities.getValueFromPreference(context, Global.NOTIFICATION_ID, "0");
int notificationIdinInt = Integer.parseInt(notificationId);

notificationManager.notify(notificationIdinInt, notification);

// will increment notification id for uniqueness
notificationIdinInt = notificationIdinInt + 1;
CommonUtilities.saveValueToPreference(context, Global.NOTIFICATION_ID, notificationIdinInt + "");
//Above "CommonUtilities.saveValueToPreference" is the method created by me to save new value in savePreferences.

Reset notificationId in savedPreferences at specific range like I have did it at 1000. So it will not create any issues in future.
Let me know if you need more detail information or any query. :)

A: Use the following method in your code.
Method call :-
notificationManager.notify(getCurrentNotificationId(getApplicationContext()), notification);

Method:-
  *Returns a unique notification id.
         */

        public static int getCurrentNotificationId(Context iContext){

            NOTIFICATION_ID_UPPER_LIMIT = 30000; // Arbitrary number.

            NOTIFICATION_ID_LOWER_LIMIT = 0;
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(iContext);
        int previousTokenId= sharedPreferences.getInt("currentNotificationTokenId", 0);

        int currentTokenId= previousTokenId+1;

        SharedPreferences.Editor editor= sharedPreferences.edit();

        if(currentTokenId<NOTIFICATION_ID_UPPER_LIMIT) {

            editor.putInt("currentNotificationTokenId", currentTokenId); // }
        }else{
            //If reaches the limit reset to lower limit..
            editor.putInt("currentNotificationTokenId", NOTIFICATION_ID_LOWER_LIMIT);
        }

        editor.commit();

        return currentTokenId;
    }

A: For Kotlin.

 notificationManager.notify(Calendar.getInstance().timeInMillis.toInt(),notificationBuilder.build())

A: A simple counter may solve your problem.
private Integer notificationId = 0;

private Integer incrementNotificationId() {
   return notificationId++;
}

NotificationManager.notify(incrementNotificationId, notification);

A: declare class member
static int i = 0;

mNotificationManager.notify(++i, mBuilder.build());

A: val notifyIdLong = ((Date().time / 1000L) % Integer.MAX_VALUE)
var notifyIdInteger = notifyIdLong.toInt()
if (notifyIdInteger < 0) notifyIdInteger = -1  * notifyIdInteger // if it's -ve change to positive
notificationManager.notify(notifyIdInteger, mBuilder.build())
log.d(TAG,"notifyId = $notifyIdInteger")

A: val notificationId = System.currentTimeMillis().toInt()
val i = Intent(applicationContext, HomeActivity::class.java)
val pendingIntent =
    PendingIntent.getActivity(this, notificationId, i, PendingIntent.FLAG_CANCEL_CURRENT)
//put notification id in pending intent and for notify manager.

mNotificationManager.notify(num, notificationnn)


text:
Q: .htaccess password requested twice when redirected, not requested/site Unauthorized on mobile I'm trying to user .htaccess for both SSL redirects and Password authentication.

*

*when requesting http://example.com, user is asked to login, is then redirected to https://example.com, and asked to login again. How can I prevent this double authentication?

*on iphone, the user is not asked for a password at all but merely served a 401 "Unauthorized" error. Why is ios not giving user opportunity to enter password?
ErrorDocument 401 default
AuthType Basic
AuthName "Please enter password to proceed"
AuthUserFile /home/example/public_html/.htpasswd
require valid-user
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www.)?example.com
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R]
Thank you for your time!


text:
Q: JavaScript function from class extension not recognized I'm playing around with classes ES6 and encountered behaviour with below code.
Error I'm getting is bob.personName is not a function.
Both class and it extension has constructor defined but still I can't get it working. I added comments under lines that I think might be the issue. Thanks for help!
class Person {
  constructor(canSpeak) {
    this.canSpeak = true;
  }
}

class Hello extends Person {
  constructor(name) {
  this.name = name;
  }

  personName() { //am I missing a parameter?
    if (this.canSpeak) {
      return `Name is: ${this.name}, can speak? ${this.canSpeak}`;
        }
    };
};

const bob = new Person('Bob'); //should I call Hello extension instead?
console.log(bob.personName());

A: Since the method exists on Hello.prototype, not on Person.prototype, you need the instance to be of a Hello.
You also can't reference this until calling super inside a subclass's constructor, so do that before assigning to this.name:

class Person {
  constructor(canSpeak) {
    this.canSpeak = true;
  }
}

class Hello extends Person {
  constructor(name) {
    super();
    this.name = name;
  }

  personName() { //am I missing a parameter?
    if (this.canSpeak) {
      return `Name is: ${this.name}, can speak? ${this.canSpeak}`;
    }
  };
};

const bob = new Hello('Bob'); //should I call Hello extension instead?
console.log(bob.personName());


text:
Q: Biber - "cite" macro fails at second compilation, while entry is found in the bibliography I am trying to set up a bibliography with BibLatex. Even a single \cite{} statement causes an error upon second compilation with pdflatex after running biber.
The sequence of running the commands is as follows:
pdflatex mwe.tex
biber mwe (optionally multiply by 2 and/or add a bcf extension)
pdflatex mwe.tex

After running biber and trying to run pdflatex for the second time the engine errors at \cite{aa} and no bibliography gets printed.
Here is the minimal (not yet) working example:
\documentclass{article}
\usepackage[backend=biber, date=short, style=apa]{biblatex}
\title{some title}
\author{Authorov A. A.}
\date{\today}
\addbibresource{references.bib}
\begin{filecontents}{references.bib}
@misc{aa,
  author = {Some Author A.},
  title = {Some title},
  year = {2016}
}
\end{filecontents}
\begin{document}
\maketitle
Some sentence\cite{aa}

\printbibliography
\end{document}

Blg file output:
[0] Config.pm:354> INFO - This is Biber 2.7
[1] Config.pm:357> INFO - Logfile is 'mwe.blg'
[28] biber-MSWIN64:303> INFO - ===
[51] Biber.pm:359> INFO - Reading 'mwe.bcf'
[136] Biber.pm:835> INFO - Found 1 citekeys in bib section 0
[149] Biber.pm:3670> INFO - Processing section 0
[168] Biber.pm:3840> INFO - Looking for bibtex format file 'references.bib' for section 0
[171] bibtex.pm:1435> INFO - Decoding LaTeX character macros into UTF-8
[176] bibtex.pm:1292> INFO - Found BibTeX data source 'references.bib'
[187] UCollate.pm:68> INFO - Overriding locale 'en-US' defaults 'variable = shifted' with 'variable = non-ignorable'
[187] UCollate.pm:68> INFO - Overriding locale 'en-US' defaults 'normalization = NFD' with 'normalization = prenormalized'
[188] Biber.pm:3499> INFO - Sorting list 'apa/global/' of type 'entry' with scheme 'apa' and locale 'en-US'
[189] Biber.pm:3505> INFO - No sort tailoring available for locale 'en-US'
[191] bbl.pm:608> INFO - Writing 'mwe.bbl' with encoding 'ascii'
[192] bbl.pm:712> INFO - Output to mwe.bbl

I am running MikTex 2.9 (64-bit), Biber 2.7 and Windows 10.
Having had a look through similar questions, they either do not use Biber or the problem seems to have a different root. Would appreciate any hints and tips. Thank you in advance!

A: Here is a solution:
\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[backend=biber, date=short, style=apa]{biblatex}
\DeclareLanguageMapping{american}{american-apa}

\begin{filecontents}{\jobname.bib}
@misc{aa,
  author = {Some Author A.},
  title = {Some title},
  year = {2016}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\def\printdateextralabel{\printlabeldateextra}

\title{some title}
\author{Authorov A. A.}
\date{\today}

\begin{document}
\maketitle
Some sentence\cite{aa}

\printbibliography
\end{document}

I coopied code from here: https://tex.stackexchange.com/a/329497/120578
Posible duplicate with the above.


text:
Q: MVC create N dropdown box dynamically in Razor Page View I would create a View page that has initially a dropDownBox.
When the user will change the dropDownBox's initial value, the application will create a new dropdownbox with the same values.
How can i make it?


text:
Q: pthreads and signal handling C ending early This program is supposed to
The parent simply waits indefinitely for any child to return (hint, waitpid).
b. The child sets up two signal handlers (hint, signal) and goes to sleep for 5 minutes.
i. The first signal handler listens for the USR1 signal, and upon receiving it:
1. Creates a thread (hint, pthread_create).
a. Basically, all that the thread needs to do is "say hello" and sleep for 60
seconds.
ii. The second signal handler listens for the USR2 signal, and upon receiving it:
1. Destroys the thread (hint, pthread_cancel).
When this program receives the first signal to create the thread, it outputs
 "[thread] sleeping for 1 m[thread] sleeping for 1 minute"
and then ends, it never waits for the 2nd signal, what am i doing wrong?
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <pthread.h>
#include <signal.h>

pthread_t thread;

void* temp()
{
    printf("[thread] hello professor\n");
    printf("[thread] sleeping for 1 minute\n");
    sleep(60);
}
void handle_USR1(int x)
{
    int s;
    printf("[signal] creating the thread\n");
    s = pthread_create(&thread, NULL, &temp, NULL);
}

void handle_USR2(int x)
{
    int s;
    printf("[signal] destroying the thread\n");
    s = pthread_cancel(thread);
}

int main(void)
{
    int status = 0;

    if(fork() != 0)
    {
     printf("[parent] waiting.....\n");
     waitpid(-1, &status, 0);
    }
    else
    {
     printf("[child] to create the thread: kill -USR1 %d\n", getpid());
     printf("[child] to end the thread: kill -USR2 %d\n", getpid());
     printf("[child] setting up signal handlers\n");

     signal(SIGUSR1, handle_USR1);
     signal(SIGUSR2, handle_USR2);

     printf("[child] waiting for signals\n");
     sleep(300);
    }
    return (0);
}

A: As Charlie Burns pointed out, both processes eventually exit as a consequence of the signal, but for different reasons.
Child
During its sleep, the child is blocked in a system call (the actual system call is nanosleep, used to implement the sleep() function). When a process receives a signal while in a system call, the corresponding signal handler is executed and the system call returns an error, EINTR, which means it has been interrupted and couldn't fulfill its duty. You can then decide if you want to restart the system call or not. Upon receiving SIGUSR1, the nanosleep system call executed by the child is interrupted, the handler is executed and sleep() returns immediately. Notice what man 3 sleep says about the return value of sleep():
Zero if the requested time has elapsed, or the number of seconds left to sleep, if the call was interrupted by a signal handler.

The correct way would be for the child to check for the return value of sleep (number of seconds left to sleep), and sleep again for that duration.
Parent
Unlike what Charlie Burns pointed out, waitpid() in the parent does not return because of the child receiving a signal. It returns because of the child exiting. It would return because of the child IF the child did not handle the signal, and thus was killed by it (an unhandled signal causes the process to die). You can (and should) check that using the WIFEXITED macro and its companions as described in man 2 waitpid. The example at the bottom of this man page is very good:
do {
   w = waitpid(cpid, &status, WUNTRACED | WCONTINUED);
   if (w == -1) {
       perror("waitpid");
       exit(EXIT_FAILURE);
   }

   if (WIFEXITED(status)) {
       printf("exited, status=%d\n", WEXITSTATUS(status));
   } else if (WIFSIGNALED(status)) {
       printf("killed by signal %d\n", WTERMSIG(status));
   } else if (WIFSTOPPED(status)) {
       printf("stopped by signal %d\n", WSTOPSIG(status));
   } else if (WIFCONTINUED(status)) {
       printf("continued\n");
   }
} while (!WIFEXITED(status) && !WIFSIGNALED(status));

Basically, what this code does is wait on the child until it has exited normally or has exited because of an unhandled signal. In your case, it would be a good idea for the parent to check the status variable to make sure that waitpid returned because of the event it expects (a child exiting) and not something else.

A: Place a pthread_join after your pthread_create.

A: Ok, I see what is going on.
When you send a signal, without otherwise directing it to a particular thread by masking, any thread within a process can get it.  When SIGUSR1 gets delivered main in the child gets blown out of the sleep and the main thread terminates killing the thread created in the handler.
There are plenty of questions here covering how to direct signals to a single thread and/or using sigaction to restart a system call if that is also a direction you want to go in to resolve it.


text:
Q: Appending To Dynamically Added Elements I have a div that exists when the page is loaded.  I append a button and another  to it.  I then want to click the button and append things into .
So far the first part is working but I cannot append to any elements that were created dynamically.
$(document).ready(function () {

    // THIS WORKS
    $("#Value").change(function () {
        var value = $("#Value").val();
        $("#Question_Field").empty();
        for (var i = 1; i <= value; i++) {
            $("#Question_Field").append('<input type="button" id="button" />

');
        }
    });

    // THIS DOES NOT WORK
    $("#test").click(function () {
        console.log("Click");
        ("#test").append(STUFF);
    });
});

It's not even logging the click.

A: There are two main problems.

*

*When you're hooking the event, no #test element exists yet, and so nothing gets hooked up.

*You're creating multiple elements with the same id.
Also, your append call is missing a $ at the beginning.
You can fix the first using event delegation (and this code fixes the append as well):
$(document).on('click', '#test', function () {
    console.log("Click");
    $("#test").append(STUFF);
});

That tells jQuery to hook the click event on document, but only fire the handler if the event originated on or passed through an element matching the given selector (#test) as it bubbled up to the document.
To fix the second issue, multiple elements with the same id, you need to change your loop outputting the elements. It could well be that you want to be using a class rather than an id.

A: click can only handle elements that exist when it is called. You should check .live() http://api.jquery.com/live/ or .on() http://api.jquery.com/on/ depending on your jQuery version.


text:
Q: How to get a list matches, without groupings? In perl the following seems to return a list of matches AND matched groupings!
//g

Rule:

In list context, //g returns a list of matched groupings, or if there are no groupings, a list of matches to the whole regex

How can I get a list of matches WITHOUT groupings?
Update:
In perl regexp seems to return everything what is matched by regexp parts eclosed in () plus what is matched by the whole term.
For grouping (not capturing) purposes, e.g. to write match "cat" or "dog" use (?:cat|dog).
Using (cat|dog) and not (?:cat|dog) would add any occurence of "cat" or "dog" to the result list.
Matching parenthesis: ( )
"badcat and baddog" =~ /bad(cat|dog)/g

Results in: (badcat baddog cat dog)
Single cat and dog are added to results list, because they are enclosed in matching parentheises
Non matching parenthesis: (?: )
 "badcat and baddog" =~ /bad(?:cat|dog)/g

Results in: (badcat baddog)

A: If you have a regular expression that may have groupings in it, but you only want matches for the entire regular expression, do something like this:
my $regex = qr/some regex (with) (groupings)/;
my @matches;
while ($string =~ m/($regex)/g) { push(@matches, $1) }

Inside the while loop $1 is guaranteed to be the entire match of $regex.

A: If you need parens for other purposes, you can use non-capturing ones, (?: ... )


text:
Q: local minima in the accuracy of a deep neural netowk What suggestion will you give to improve accuracy of a deep neural network with exhibiting local minima in accuracy graph?

A: What you are observing are fluctuations in the accuracy of your model during training due to the fact that you are computing gradients with respect to each mini-batch. These are meant to approximate the gradient with respect to the whole training set, but they are not always accurate so sometimes you will observe your accuracy go down.
Some fluctuations can also be due to your loss function not being perfectly correlated with your accuracy metric.
The term "local minimum" is usually used to describe when a loss function has a local minimum that is different from its global minimum. I would not use it here to describe fluctuations the accuracy plot since it might cause confusion. After all you are trying to maximize accuracy.


text:
Q: Exception Handling in camel onWhen I am using Camel in the integration Project to connect it to the Http Endpoint.
Now I am trying to implement a scenario such as when ever there is an exception while connecting to the HTTP endpoint , I should use the status code to decide whether to try re-delivery or else continue  the route.
Here is how am I trying to implement
  onException(HttpOperationFailedException.class)
            .retryAttemptedLogLevel(LoggingLevel.DEBUG)
            .onWhen(new Predicate() {
                @Override
                public boolean matches(Exchange exchange) {

                    HttpOperationFailedException e = exchange.getProperty(
                            Exchange.EXCEPTION_CAUGHT,
                            HttpOperationFailedException.class);

                    if (e.getStatusCode() == 400)
                        return true;
                    return false;
                }
            }).continued(true).maximumRedeliveries(2);

The problem is when ever the Predicate return false the route is stop. what I am trying to achieve is to continue the route.

A: You can do what I do: define 2 onException(), with opposite onWhen() condition, while one is true and another is false. When true, continue(true); when false, retry.
onException(HttpFailedOperationException.class).onWhen(notFoundPredicate)
    .continue(true);

onException(HttpFailedOperationException.class).onWhen(otherSituationPredicate)
    .setMaximumRetry(3)
    ...

And you define 2 classes with same injection dependency, like NotFoundJudgementBean:
public class NotFoundPredicate implements Predicate {
    @Inject
    NotFoundJudgementBean bean;

    @Override
    public boolean match(Exchange exchange) {
        return bean.judge(exchange);
    }
}

And in the other predicate, return !bean.judge(exchange);.


text:
Q: Non-Negative Vs Positive Semi Definite A matrix is PSD if $$\langle Ax, x\rangle \ge 0,  \forall x \in H$$
Where, H is a hilbert space and A is a mapping $H \rightarrow H$. Is it the same as being Non-negative? I couldn't seem to find a specific definition for a non-negative operator.