text:
Q: Capture system volume changes in Swift Reading the following advices about getting and setting system volume in osX, I use the ISSoundAdditions which works great:
Change Volume on Mac programmatically
and
Set OS X volume in OS X 10.11 using Swift without using the deprecated AudioHardwareServiceSetPropertyData API
I can directly manage the system sound volume with a NSSlider (with bindings).
My question is: how can I capture the volume changed as an event (for exemple when the volume up and down keys in the keyboard ? In theses cases, my slider doesn't react.
I experimented :
self.addObserver(self, forKeyPath: "volume.systemVolume", options: NSKeyValueObservingOptions.New, context: &volumeContext)

But then I get an exception:

Cannot update for observer XX for the key path "volume.systemVolume",
  most likely because the value for the key "volume" has changed without
  an appropriate KVO notification being sent. Check the KVO-compliance
  of the class.

BTW, systemVolume property is a class property, if it matters?
Many thanks for your help
Joshua

A: I used (Swift 4):
DistributedNotificationCenter.default.addObserver(self,
                                           selector: #selector(eventFunction(_:)),
                                           name: NSNotification.Name(rawValue: "com.apple.sound.settingsChangedNotification"),
                                           object: nil)

Where the function is defined like:
@objc func volumeChangeEvent(_ evt: NSEvent) { }


text:
Q: Exoplayer - Widevine and MPEG DASH I am trying to implement Android app for playing widevine-protected video. I build my application on Exoplayer and I have issue with MediaDrm.
android.media.MediaDrm$MediaDrmStateException: Failed to get key request: DRM vendor-defined error: -2998
            at android.media.MediaDrm.getKeyRequest(Native Method)
            at com.google.android.exoplayer.drm.StreamingDrmSessionManager.postKeyRequest(StreamingDrmSessionManager.java:370)
            at com.google.android.exoplayer.drm.StreamingDrmSessionManager.openInternal(StreamingDrmSessionManager.java:314)
            at com.google.android.exoplayer.drm.StreamingDrmSessionManager.open(StreamingDrmSessionManager.java:284)
            at com.google.android.exoplayer.MediaCodecTrackRenderer.maybeInitCodec(MediaCodecTrackRenderer.java:325)
            at com.google.android.exoplayer.MediaCodecTrackRenderer.onInputFormatChanged(MediaCodecTrackRenderer.java:739)
            at com.google.android.exoplayer.MediaCodecTrackRenderer.readFormat(MediaCodecTrackRenderer.java:511)
            at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:492)
            at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:417)
            at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:205)

I have this exception. I found that this exception is thrown at this line of code:
keyRequest = mediaDrm.getKeyRequest(sessionId, schemeData, mimeType, MediaDrm.KEY_TYPE_STREAMING, params);

All parameters of method are set correctly, but calling of this method fails and thrown exception above.
Do you know how can I solve it? Thanks for any help.

A: I finally solved it. The problem was with device, which I was using for testing. This device is Samsung Galaxy S4 with Android 5.0.1. When I tried my code on different device (Nexus 5, some Samsung tablet, etc.), it worked fine. So probably there is some bug or missing support of Widevine Modular in Galaxy S4.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Combine multiple data files into np.arrays, which are stored in dictionaries I'm attempting to load a large data set. I have ~8k day files, each with arrays of hundreds of measurements. I can load a single day file into a set of numpy arrays, which I store in a dictionary. To load all the day files, I initialize a dictionary with the desired keys. Then I loop through the list of files, loading one, and attempt to store them in the larger dictionary.
    all_measurements = np.asarray([get_n_measurements(directory, name) for name in files])

    error_files = []

    temp = np.full(all_measurements.sum()
    all_data = {key: temp.copy(),
                     fill_value, dtype=np.float64) for key in sample_file}

    start_index = 0
    for data_file, n_measurements in zip(file_list, all_measurements):

        file_data = one_file(data_file) # Load one data file into a dict.

        for key, value in file_data.iteritems(): # I've tried .items(), .viewitems() as well.

            try:

                all_data[key][start_index : start_index + n_measurements] = file_data[key]

            except ValueError, msg:

                error_files.append((data_file, msg))

            finally:

                start_index += n_measurements

I've inspected the results of one_file() and I know that it properly loads the data. However, the combined all_data behaves as if every value is identical across key:value pairs.
Here is an example of the data structures:
all_data  = {'a': array([ 0.76290858,  0.83449302,  ...,  0.06186873]),
             'b': array([ 0.32939997,  0.00111448,  ..., 0.72303435])}

file_data = {'a': array([ 0.00915347,  0.39020354]),
             'b': array([ 0.8992421 ,  0.18964702])}

In each iteration of the for loop, I attempt to insert the file_data into all_data at the indices [start_index : start_index + n_measurements].

A: If I interpreted your code well, and in the case if n_measurement serves to provide the number of total measurements, you rather meant to do something like this:
all_measurements = np.array(
                           [len(n_measurements)
                           for n_measurements in file_list]
                           )

Or how could serves all_measurements.sum() as the shape of your new initializable np.array?

A: Turns out everything was going into the same container. The above code has been edited with the issue corrected.


text:
Q: Php md5 Passwords on C# Client I'm trying to make a login system. All accounts on a Mybb forum system. I want the login to client using the mybb_users database. But passwords md5. And there is a colon by name: "salt". How can I encrypt the passwords on checking password?
This is my codes(If email and password is true)
 int count = 0;
            while (myReader.Read())
            {
                count = count + 1;

            }
if (count == 1) // IF Ok.
                {
                    userLabel.Text = myReader[0].ToString();
                    loginSuccessTimer1.Enabled = true;
                    LoginFormSuccessBG loginSuccess = new LoginFormSuccessBG();
                    loginSuccess.Show();
                }

A: As your passwords are stored in a MyBB-database they will follow this form:
md5(password + md5(salt))

In other words first get the md5 hash of the salt, then add that to the password and then create the md5 hash of that. The resulting string is what will be stored in the MyBB-database.
I believe you want to do something like this:
string salt = // get salt from db
string password = // get password from user
MD5 md5 = new MD5CryptoServiceProvider();

// Create md5 hash of salt
byte[] saltBytes = Encoding.Default.GetBytes(salt);
byte[] saltHashBytes = md5.ComputeHash(salt);
string saltHash = System.BitConverter.ToString(saltHashBytes);

// Create your md5(password + md5(salt)) hash
byte[] passwordBytes = Encoding.Default.GetBytes(password + saltHash);
byte[] passwordHashBytes = md5.ComputeHash(salt);
string passwordHash = System.BitConverter.ToString(passwordHashBytes);


text: Q: Сбор информации о вступивших пользователях группу ВК Какое api или какой алгоритм нужно использовать, что бы собирать данные о вступивших пользователях в определенную группу ВК. (В этой группе я не являюсь администратором). Нужно узнать ID вступивших в группу с определённого момента (Раз в день).


text:
Q: Why won't my lines plot in R when using the points statement with an existing graph? I'm working through a book, The R Student Companion, and in the first chapter I've run across a problem. I'm trying to plot a graph using R but the "points" statement isn't plotting my line onto the graph.
Here is what I've got going on. I'm defining some list variables and plotting them as so.
moose.density=c(.17,.23,.23,.26,.37,.41,.66,.80,1.11,1.30,1.37,1.41,1.73,2.49)
kill.rate=c(.37,.47,1.9,2.04,1.12,1.74,2.78,1.85,1.88,1.96,1.8,2.44,2.81,3.75)
plot(moose.density,kill.rate,type="p")

As a result, I get this graph:
.
Then I add these values and use the "points" statement to plot the line.
m=2.5*(0:100)/100
a=3.37
b=0.47
k=b*m/(a+m)
points(m,k,type="p")

This is the expected graph from the book, but nothing changes on mine. Am I doing something wrong? Is the points statement depreciated? I followed the book line-by-line.

I thought it might have something to do with my R installation on Manjaro, but tried it on a Windows machine and got the same result.

A: It appears that someone has already solved one part of the problem. Next, you should change points(m,k,type="p") to lines(m, k).

A: From the comments discussion, it appears that the code in this book contains several errors on certain pages, but not others.
The most relevant error is that:
k = b * m / (a + m)

generates values that are too small to appear on the plot. It should be:
k = a * m / (b + m)


text:
Q: Drop-in replacement for MICO Corba? We are currently using MICO to establish the communication between a server and a client, where the client is a simulator written in C++ and the server is a java program displaying an animation of what happens in the simulation. It seems that the developemt of MICO has slowed down to an almost halt and bugs that only allow us to hack around them (as we don't have the time to first figure out which parts of MICO are responsible for codegeneration and so on) keep us from making real progress.
So, does any one of you know of a good drop-in replacement? We would like to have the following:

*

*The compiler can generate both C++ and Java-Code from the idl.

*The project should still show considerable support.

*The implementation should be open-sourced (GPL or BSD, or something alike), as we use our programs to teach students as well.

*The migration from MICO should be as easy as possible. (This is not a hard requirement, but would be a good thing)

I found some other CORBA implementations, e.g. TAO, but I didn't find any of which I could
say that they are still supported. Correct me if I am wrong here.

A: The Free CORBA® Downloads page might be of interest to you.

A: Just naming:

*

*orbit2 1, also pyorbit etc.

*omniORB

*TAO (has already been mentioned)
1 On my Ubuntu box, apt-rdepends -r liborbit2 returns 5530 lines...

A: I don't know where CORBA or MICO in particular has gone in the last 5 years, but back then a drop in replacement was not really possible, since differences between vendors where still there.
Not necessarily API differences (POA, etc.) but

*

*in implementation behavior,

*in custom extensions which were required to make it work in a real-world environment (threading, load balancing, security, etc.),

*in how the development tools worked

*and also about the whole deployment or runtime story.

We had Orbix ASP/2000/Whatever and ORBacus which were interchangeable having a small compatibility layer, some Makefile framework to hide differences in tools (e.g. the IDL compiler) and some scripts for wrapping ORB specific processes.
Unfortunately, ORBacus has long been bought by (then) IONA, which already make Orbix. IONA itself has been bought by someone else (I forgot). The original authors of ORBacus, plus some devs from IONA Orbix, changed their ways somewhat and produced Ice, which is not CORBA but somewhat alike - of course without the glitches ;-)
Concerning TOA, I think it would be the "best" choice concerning still being developed as it is driven by research on the Washington University. But last time I looked, they didn't have Java implementation but people seemed to use JacORB.
Maybe all this helps you little, unless it brings even more confusion :-)

A: TAO as C++ ORB is still actively supported and developed (see http://www.cs.wustl.edu/~schmidt/commercial-support.html). For Java I would propose JacORB.
On http://www.orbzone.org there is an overview of available corba implementations.


text:
Q: Notice: Trying to get property of non-object Facebook Array fetching image from object_id i have projects to retrieve data from social media, fb ig twit etc.
And now i'm trying to get one-element-array(picture) but it went wrong. and idk what is the problem with Undefined variable even if i used isset already, it should be defined well enough.
could somebody explain it to me and give me some good example to understand?
this is my code and the cencored image of the result.
$page_id =xx;
$access_token =xx;

$json_object = @file_get_contents('https://graph.facebook.com/'.$page_id.'/posts?limit=5&access_token='.$access_token);

$fbdata = json_decode($json_object);

foreach ($fbdata->data as $post ){
    if(isset($post->object_id) == true){
        $posts .= '
Object_id :' . $post->object_id . '
';
        $object_id= $post->object_id;
        $json_img = @file_get_contents('https://graph.facebook.com/'.$object_id.'?fields=images&access_token='.$access_token);
        $fbimg = json_decode($json_img);
        foreach ($fbimg as $imageList ){
            $posts .= $imageList[0] -> source;
        }
    }

    if(isset($post->story) == true){
        $posts .= '
link . '">' . $post->story . '
';
    }
    if(isset($post->created_time) == true){
    $created_time = "$post->created_time";
    $date_source = strtotime($created_time);
    $timestamp = date('Y-m-d H:i:s', $date_source);
        $posts .= '
' .$timestamp . '
';
    }
    if(isset($post->picture) == true){
        $posts .= 'picture . '">';
    }
    if(isset($post->message) == true){
        $posts .= '
' . $post->message . '
';
    }
    if(isset($post->link) == true){
        $posts .= '
' . $post->link . '
';
    }
}
$posts .= '
';
echo $posts ;

got this result

a little explain what this about, i succeed to retrieve picture from object_id and object_id it self but it shows some errors with message:

Notice: Trying to get property of non-object in

from this line
$posts .= $imageList[0] -> source;

and the other error message is

Notice: Undefined variable: posts

from this line
$posts .= '
Object_id :' . $post->object_id . '
';

actually i can set error_reporting(0); in top of the php. but i just want to know why, and could it slow me down to retrieving data from facebook?

A: i just know whats wrong with my code,
that just like this to end the pain.
$posts = '';
foreach ($fbdata->data as $post ){

if(isset($post->object_id) == true){
    $posts .= '
Object_id :' . $post->object_id . '
';
    $object_id= $post->object_id;
        $json_img = @file_get_contents('https://graph.facebook.com/'.$object_id.'?fields=images&access_token='.$access_token);
        $fbimg = json_decode($json_img);
        foreach ($fbimg as $imageList ){
            if(isset($imageList) ==  true){
                if(is_array($imageList) ){
                    $posts .= $imageList[0] -> source;
                    $facebookPicture = $imageList[0] -> source;
                }
            }
        }
}

to kill the question number 2, i just define the $posts into a empty
  variable to define who it is.

$posts = '';

to kill the question number 1, i'm doing is_array function to check
  the existance of array number of 'something' inside of the nested
  array


text:
Q: Can the WP e-Commerce Plugin Support a Large Number of Products? Is this plugin good to use on a large site with many products or should I look for another solution? I am concerned with the security as well the ability to scale. Anyone have any experience dealing with this plugin for sites with many products?

A: WP e-Commerce is probably the best you are going to get while still keeping within the confines of WordPress.  Keep in mind WordPress was designed originally for blogging, but it has expanded to do so much more.
For a really big store it is probably a good idea to go to dedicated store software like Magento or OS Commerce.  If you want to start out with WP e-Commerce it should not be all that hard to move to another store with all your products once you outgrow WP e-Commerce.
Edit
I came across this question that may be of interest to you:

*

*Scaling a WP eCommerce site?

A: Please see this Question as well: Scaling a WP eCommerce site.

A: Actually WP e-Commerce can handle as many products as WordPress can handle Blog posts. In other words thousands and thousands of products :)


text:
Q: What is the difference between "it's up to you" and "it's down to you"? I see both "It's up to you" and "It's down to you" in conversations.
So what's the difference?

A: I felt "It's up to you" means that you're the one responsible for the job, "It's down to you" means that nobody else is left who can do the job except you.
ADDING ON: I realized from the comment that what I wanted to imply wasn't completely clear. As ngmiceli says, "down to you" suggests that there were others who could do the job, but for some reason, they are not available to do so (because they may be dead/busy/out to lunch), leaving only you.

A: They can mean the same thing — 'the choice is yours' — but in some contexts I believe It's down to you can mean 'It's your fault.'

A: I'm not entirely comfortable with any answers given so far. In BE the meanings are quite distinct and different: it's up to you means the choice is yours whilst it's down to you means it's your responsibility or worse, it's your fault!

A: I would personally interpret It's up to you to be referring to a choice.

You can have cake or you can have ice cream. It's up to you.

It's down to you seems to refer more to an obligation

This project has to be finished by 5pm, its down to you to get it done.

If this seems like a weak attempt to understand the phrases, try reversing them. They sound very strange.

You can have cake or you can have ice cream. It's down to you.
This project has to be finished by 5pm, its up to you to get it done.

A: It's Up to you: It is your decision
It's Down to you: You are responsible

A: 'It's up to you' connotes some element of personal choice. 'It's down to you' has more of an implication of responsibility or duty.

A: *

*Up to you = Responsible for a decision

*Down to you = Responsible for an action

Examples

*

*What happens next is up to you

*The choice is yours, it's entirely up to you

*It's now down to you to impress the judges

*Everything that has gone wrong in my life is entirely down to you, you useless...

A: Though the two tend to have the same meaning, I hear them used in very different contexts.
"It's up to you!" This often used in a more generic context, where one often wishes to encourage someone who holds the key to success in whatever endeavor is being talked about.  It should also be noted that this phrase could simply imply, "the choice is yours."
On the other hand,"it's down to you" doesn't strike me personally as placing blame, though I certainly can see it being used that way.  The first context that comes to my mind is a situation's success still rests in "your" hands, but this implies that there was some elimination that brought the scenario to this point. For example, a group of four people are all trying to best the current chess champion. The first three each go up against him and are defeated. Finally, one says to the fourth man, "It's down to you".
I don't see "it's down to you" meaning "it's your choice"; that feels somewhat unnatural to me, unless everyone else opted not to have an opinion in which case you were the only one left to make a choice.

A: "It's up to you" implies (at least for me) initiative and a certain level of faith in 'you'.  As in, there is a problem, and it's up to you to fix it, since you are the best person for the job, it's your job to fix it, you have the tools to fix it, etc.  I don't know if the two phrases are technically linked, but I see a parallel with "I'm up for it".
"It's down to you" is a little more negative, implying that the problem was your fault, or that the reason you're being relied on to fix it is simply because there's no one else to do it.
There's also the other meaning of "it's up to you", which is what Barrie said: the choice is yours.  In this case, "it's down to you" implies generally the same thing, but I see it as carrying the extra meaning that everyone else has decided, and now it's time for you to make your choice (everyone else has gone, you're the only one left-- it's down to one, which is you).

A: *

*Be up to somebody
To be somebody's duty or responsibility; to be for somebody to decide
It's not up to you to tell me how to do my job.
Shall we eat out or stay in? It's up to you.

*Be down to somebody (informal)To be the responsibility of somebody
It's down to you to check the door.

A: The service is not processing inputs correctly so ignore the other post and let's try again here.
Both are mere idiomatic expressions. Up to you connotes an obligation and its tone is typically affirmative. Down to you, connotes an obligation, or usurpation (neither necessarily affirmative) of last, negative, deviant, or derelict resort. The expression, down to me, first came into (more less than more) vogue in the 1970s as a refrain in the lyric of the rock song, "Under My Thumb," sung by Mick Jagger, Rolling stones: also the song in progress at the Altamont Pass (California) concert, during which a killing perpetrated by individuals in the hell's angels motorcyle club took place.
Down to, as an alteration of up to, implies not fault or culpability but, rather, the absence or exhaustion, for good or ill, of all alternative choices. It's "down to you" because no one else was or remains available, as a matter of due course or of choice.

A: Longman English Dictionary says

*be down to somebody
if an action or decision is down to you, it is your responsibility:
It's down to me to make sure that everyone is happy.

*be up to somebody    (link)
a) used to say that someone can decide about something:
You can pay weekly or monthly - it's up to you.
b) used to say that someone is responsible for a particular duty:
It's up to the travel companies to warn customers of any possible dangers.
In the following gap fill exercise, Cambridge accepts both versions in their First certificate (level B2), Paper 3, Use of English  2008.

Your entry can take any form—a piece of writing, a picture, or even architectural plans. It is completely _________ to you.

Instinctively, I'd prefer up to you because candidates have the maximum freedom of choice; however, I can also see how down to you would imply they alone, and no one else, are responsible for that choice.


text:
Q: Arduino - Parsing GET String Hate to post this, but I am googled out and tried many different options with no success.
Basically I would like to GET a page with the status of 10 lights and turn on/off the corresponding lights. The Arduino is getting the results and posting the string in the serial monitor, but the string is not triggering my if statements. Not sure if I am using the wrong function to parse the string or my if statements are incorrect.
Here is the output of the GET, which posts in the serial monitor (printing readString):

Light1:1
  Light2:0
  Light3:0
  Light4:0
  Light5:0
  Light6:1
  Light7:0
  Light8:1
  Light9:0
  Light10:0

Here is the last thing I tried in the sketch, with an if statement for each light:
if (readString.indexOf("Light1:1">0))
{
    digitalWrite(light1, HIGH);
}
else
{
    digitalWrite(light1, LOW);
}

What function would you use? What am I doing wrong?
Restructuring the output of the page is also an option.

A: Possible typo... you've got your comparison inside the .indexOf() call. Did you mean
if (readString.indexOf("Light1:1") >= 0)

A: The string will start at position 0. Use >= 0


text:
Q: can use these printer motors to made CNC machine?
can i use this motor to make a cnc plottor ?
is there any way to make a stepper motor using this motor?

A: No. That is a simple motor. It cannot be changed into a stepper. To use a simple motor then you will need feedback, an encoder. You will be better off getting real stepper motors or servo motors.


text:
Q: Resolution of conical singularities have even-only cohomology? Considering a quotient singularity $\mathbb{C}^n/G,$ its crepant resolution $Y$ (i.e. having $c_1(Y)=0$) has rational cohomology supported in even degrees only. This holds for many other resolutions of singularities, in particular for symplectic resolutions of conic symplectic singularities.
I am wondering whether there is a general statement saying that resolution $Y$, satisfying $c_1(Y)=0$,
of a conic singular affine variety $X$ with isolated singularitity has $H^{odd}(Y,\mathbb{Q})=0$? Conic means that there is a $\mathbb{C}^*$-action on $X$ that contracts it to a point.
Potentially ask that $X$ is a complete intersection.

A: Thanks to @Yosemite Stan, we have a counterexample, and actually many of them:
Pick a projective variety $Z$ with some odd-cohomology such that
$$c_1(\omega_Z)=-m c_1(H), \text{ for some } m>0,$$
where $H$ is the bundle by which $Z$ embeds to $\mathbb{P}^n,$
and $\omega_Z$ is the canonical bundle.
In other words, we have $c_1(Z)=-c_1(\omega_Z)=m c_1(i^*\mathcal{O}(1)),$ where $i:Z \hookrightarrow \mathbb{P}^n$ is the embedding given by $H.$
In particular, a degree $d$-hypersurface in $\mathbb{P}^n$ having some odd cohomology works, with $m = n+1-d$ (due to adjunction formula).
Denoting by $\widetilde{Z}$ its image via the Veronese map
$\mathbb{P}^n\rightarrow\mathbb{P^{\binom{n+m}{m}-1}}$, define $X\subset \mathbb{C}^{\binom{n+m}{m}}$ to be the cone over $\widetilde{Z}$.
There is a natural resolution $Y$ of $X$ given by the $Y=\overline{\pi^{-1}(X\setminus 0)},$ where $\pi$
is the blow-up at ${0}\subset \mathbb{C}^{\binom{n+m}{m}}.$
As the blow-up at $0$ is $\mathcal{O}(-1)\rightarrow \mathbb{P^{\binom{n+m}{m}-1}},$ we have
$$Y=\mathcal{O}(-1)|_\widetilde{Z} \cong \mathcal{O}(-m)|_Z,$$ hence it has
$$c_1(Y)=c_1(i^*\mathcal{O}(-m))+c_1(Z)=-mc_1(i^*\mathcal{O}(1)+c_1(Z)=0,$$ and cohomology equal to $Z,$ hence not supported in even degrees only.
In particular, choosing the quartic 3-fold $Z_4\subset \mathbb{P}^4$, we have $b_3(Z_4)=60$ and $m=(4+1)-4=1,$
so $X=V(z_0^4+\dots+z_4^4)$ is an isolated singularity and (trivially) a complete intersection as well, and its resolution given by the blow up of $\mathbb{C}^5$ at the origin yields a counterexample.


text:
Q: Artemis : Slave will be live as per the configured time (in millisecond) Current implementation of master/slave is if master goes down the slave will start immediately. I am looking for option to run slave (Backup server as live) as per the given time if master goes down

A: ActiveMQ Artemis doesn't support any delay for the activation of the slave when its master goes down.


text:
Q: Trouble creating the quickstart application I am working through the Digital Asset quickstart guide and I am unable to run:
da new quickstart-java quickstart

I get the following output:
getting-started Built-in template for version: 0.10.9-SDK
example-bond-trading Built-in template for version: 0.0.7
example-collateral Built-in template for version: 1.0.6
example-ping-pong-grpc-java Built-in template for version: 2.2.0
example-ping-pong-reactive-components-java Built-in template for version: 2.2.0
example-ping-pong-reactive-java Built-in template for version: 2.2.0
example-repo-market Built-in template for version: 0.0.5
example-upgrade Built-in template for version: 0.0.6

It seems "quickstart-java" is not an available template. Is there a way for me to install it?
I tried running it with 'getting-started' instead of 'quickstart-java' but it's not the same thing.

A: Can you confirm which version of the SDK you have? Do da list at a terminal prompt and look for the active and default version. From the output, it looks like you have version 0.10.9. You'll need to upgrade to 0.11.X - latest is 0.11.3
Here's the output on my terminal:
paul:da (master)$ da list
Installed SDK releases:
  0.10.0
  0.10.2
  0.10.3
  0.10.6
  0.10.8
  0.10.9
  0.10.12
  0.10.13
  0.11.0
  0.11.1
  0.11.2
  0.11.3 (active, default)
paul:da (master)$

You can use the command da use 0.11.3 once you have upgraded to set the default SDK version for new projects.


text:
Q: .Obj в массив полигонов С++ без Open GL я пишу свой 3d движок на С++. Столкнулся с необходимостью загружать обьекты в проект, выбрал формат obj.Но в интернете я не нашел парсинга его в массив полигонов(Без Open GL).Поэтому задаю вопрос есть ли какие-то либы или функции для загрузки файла Obj?

A: Есть большая-большая библиотека Assimp, и здесь есть описание. Да, это сайт о OpenGl, но загрузка модели никак не завязана на сам OpenGl.
Я в своем маленьком проекте использовал описание, которое нашел здесь и используя код оттудова, написал свой парсер. Опять же, это сайт о OpenGL, но код там точно не требует ничего OpenGL зависимого.
Ну как не добавить ссылку на полное описание формата http://paulbourke.net/dataformats/obj/ - сам формат текстовый, так что просмотр в блокноте очень помогает.
Замечу, что в большинстве случае на выходе получаются треугольники, хотя сам формат obj допускает и многоугольники.


text:
Q: Ionic 3 Error bind m3u8 from API I'm trying to bind a url in video from API, but I'm taking this error below, I tried DomSanitizer and others but dosent work.
Error
Failed to load resource: net::ERR_FILE_NOT_FOUND
My last try
 load() {
        this.liveProvider.load().then((data) => {
          this.urlStrean = "http://evcv.mm.uol.com.br:1935/band/terraviva/playlist.m3u8";//this.getSafeUrl(data.result.url);
          this.getSafeUrl(this.urlStrean);
          console.log(this.urlStrean);
        }).catch((error) => {
          console.log(error);
        })
      }

   getSafeUrl(url) {
        return this.sanitizer.bypassSecurityTrustUrl(url);
      }

and in my view:
 <video width="100%" controls autoplay>
     <source [src]="urlStrean" type="application/x-mpegURL">
  </video>

A: I solved problem with this code below:
constructor(public navCtrl: NavController, private liveProvider: LiveProvider, public sanitizer: DomSanitizer) {
    this.liveProvider.load().then((data) => {
      this.obj = sanitizer.bypassSecurityTrustResourceUrl(data.result.url);
      // this.obj = sanitizer.bypassSecurityTrustResourceUrl("http://evcv.mm.uol.com.br:1935/band/terraviva/playlist.m3u8");
      this.trustedUrl = this.obj;
    }).catch((error) => {
      console.log(error);
    })


text:
Q: Slack desktop sometimes very sluggish and slow I am using Slack for Linux (Beta) 4.16 on Ubuntu 20.04 and experience very slow and sluggish typing sometimes (not always, hard to reproduce). I have 40GB of RAM and quite a powerful laptop, and it happens even when my CPU is barely working and I still have like 80% of RAM free.
Disabling the spell checker as some have suggested doesn't help. Does anybody else have this problem?

A: Try to disable the hardware acceleration:
File -> Preferences -> Advanced -> Other options -> Disable hardware acceleration
That should help.


text:
Q: Find duplicate images in iCloud Photo Library in Yosemite I moved to Photos and iCloud Photo Library, and I am happy so far. Because of previous imports, crashes and re-imports, several thousand duplicates (identical pictures - not of the same photo) in my library. Now I would like to identify these and delete them.
I have upgraded my Duplicate Annihilator from Aperture to Photos but my 56000 photos seem to be to much for it, because they claim that it is Photos API which is causing problems and slowness.
Is there an other way of finding duplicates and deleting them from my iCloud Library?

A: I had the same problem as you. Here's what I did to remove the duplicates quickly and easily.

*

*Export your entire photo library to a folder.

*Close photos and create a new photos library. (No deleting until you know it worked)

*Open that new empty library in photos and drag everything (using CMD+a in finder) in that exported folder to the Photos.app window.

*During the import you will be prompted to choose what you want to have done for duplicate photos and it will show you the first two identical photos that it has found, select "skip" and "apply to all".

*There you have a full library of purely unique photos.

Notes: Since you mentioned you have 5000 photos, the Mac will potentially become a little unresponsive while you're dragging them into the window. Be patient with it and let it do it's thing but it is working. (4,3000 photos was a little stuttery on my 2012 Mac mini i5 but it did work after being patient)
Photos may not be able to detect if it already has those photos in the library yet but doing it during the import has proven to be a reliable solution so just be prepared to do a massive import for now.

A: Export and import didn't worked for me. Actually worked but duplicates were not detected. dupeGuru Photo Edition (http://www.hardcoded.net/dupeguru/) helped, recommend it, it's free.

A: Duplicate Annihilator worked great for iPhoto and Aperture, but it looks like their Photos support is still lacking. It may not be feasible to do a good job until a new version of Photos is released with a proper API. I checked and I don't see any alternatives yet.
But I'm sure they'll be coming. So, unless you want to run Duplicate Annihilator on iPhoto and then reimport, I would just wait for it to improve.


text:
Q: Rendering a partial handlebars (HBS) after page load Is there any method to render a certain partial after page load?
I have the following code:

   {{> document_whiteBox column="6" public_source="true" title="Título do Documento" author="João Dezembro" data="10 de maio de 2018" content="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad runt mollit anim id est laborum."}}

There is the partial document_whiteBox that receives some aruments. This document loads dynamically, that is, the more I scroll, the more documents it loads (like the facebook feed)
I would like to retrieve the server information via API and render this document_whiteBox during the scroll.
It's possible?

A: I'm afraid that's not possible. Your template processing is over then.
What you can do is to put an even on scroll that will display the next event by reexecuting the code on the right data.
Otherwise another solution (but more costly) is to return all data to the client and hide the parts until the user scrolls.

A: I was able to solve it like this:
I render a template without any content with the display: none when I retrieve the content, I use JQUERY to create an element based on this hidden template
Hidden div with templates

  {{> document_whiteBox column="3" public_source="false" title="" author="" data="" content=""}}
  {{> block_container_list}}

Code to generate an element based on a template:
this.$template_document = $("#templates").find(".doc_whitebox").prop('outerHTML')
this.$template_block = $("#templates").find(".block_container_list").prop('outerHTML')

let el = $.parseHTML(this.$template_document)
$(el).find(".title_whiteBox_archive").find("span").text(doc_version.title)
(...)


text:
Q: Decoding a binary raster GIS file: Vertical Mapper .grd Does anyone know of a method to decode this sort binary file. It should have a quite simple structure, a couple of lines of headers and then just grid data. I have the Vertical Mapper software but I want to cut out a step in my modelling process and do everything in matlab??
Any tips are appreciated.
Thanks
Alex

A: You'll need the Mapping Toolbox for that.


text:
Q: TKinter scrollbar not scrolling all the way down I have managed to get a scrollbar working in TKinter. However, it does not scroll down all the way down to the contents of the page. Here is a MWE of what I have
from tkinter import *
from tkinter import ttk
import tkinter.font as font
from tkinter import Tk

fontcolor = '#3a346f'

class SecurityProperties(Frame):
    def __init__(self, master, *args, **kwargs):
        super().__init__(master, *args, **kwargs)

        # Set up scroll bar
        self.main_frame = Frame(self, bg = "white")
        self.main_frame.pack(fill=BOTH, expand=1)

        self.my_canvas = Canvas(self.main_frame, bg = "white")
        self.my_canvas.pack(side=LEFT, fill=BOTH, expand=1)

        self.my_scrollbar=ttk.Scrollbar(self.main_frame, orient=VERTICAL, command=self.my_canvas.yview)
        self.my_scrollbar.pack(side=RIGHT, fill=Y)

        self.my_canvas.configure(yscrollcommand=self.my_scrollbar.set)
        self.my_canvas.bind('<Configure>', lambda e: self.my_canvas.configure(scrollregion = self.my_canvas.bbox("all")))

        self.second_frame = Frame(self.my_canvas, width=1000, height=500, bg = "white")
        self.my_canvas.create_window((0,0), window=self.second_frame, anchor= "nw")

        helv15 = font.Font(family="Helvetica",size=15,weight="bold")
        helv10 = font.Font(family="Helvetica",size=10,weight="bold")

        self.UpperTextBox = Label(self.second_frame, bg = "white", relief = GROOVE, text = "Information on channel characteristics and security of finite keys", font = helv15, fg = fontcolor)
        self.UpperTextBox.place(relheight = 0.15, relwidth = 0.8, relx = 0.1, rely = 0.1)

        # Output values - Row 1
        self.row1 = Label(self.second_frame, bg = "white", relief = GROOVE, text = "Row1", font = helv10, fg = fontcolor)
        self.row1.place(relheight = 0.15, relwidth = 0.2, relx = 0.1, rely = 0.35)

        # Row 2
        self.row2 = Label(self.second_frame, bg = "white", relief = GROOVE, text = "Row2", font = helv10, fg = fontcolor)
        self.row2.place(relheight = 0.15, relwidth = 0.2, relx = 0.1, rely = 0.6)

        # Row 3
        self.row3 = Label(self.second_frame, bg = "white", relief = GROOVE, text = "Row3", font = helv10, fg = fontcolor)
        self.row3.place(relheight = 0.15, relwidth = 0.2, relx = 0.1, rely = 0.85)

        # Row 4
        self.row4 = Label(self.second_frame, bg = "white", relief = GROOVE, text = "Row4", font = helv10, fg = fontcolor)
        self.row4.place(relheight = 0.15, relwidth = 0.2, relx = 0.1, rely = 1.1)

What is the mistake here to be able to see the row4 Label?


text:
Q: How to make reference to a codebox? I am using the clrscode3e package to typeset pseudocode and I want to make reference to the procedures in codeboxes to produce something like "Procedure InsertionSort". How to do that?
For example, if I want to make reference to a chapter, I can easily write:
\label{chap:foo} and \nameref{chap:foo}, then I get the chapter name.
How can I get the procedure name (defined by \proc{} in codebox environment) by just make reference to it (that is, I can just define \label{proc:InsertionSort} in codebox then use \nameref{proc:InsertionSort} to get the name of the procedure somewhere else)?

A: Since a procedure \Procname under the codeblock environment from clrscode3e does not have a number associated with it, only \nameref would make sense.
The following modification to the \Procname macro in clrscode3e updates the hyperlink target as well as the "name to be referenced":

\documentclass{article}

\usepackage{clrscode3e,etoolbox}
\usepackage{hyperref}
\robustify{\proc}

\makeatletter
\renewcommand{\Procname}[1]{%
  \global\def\saveprocname{#1}%
  \global\procnametrue%
  \let\@currentlabelname\saveprocname
  \phantomsection}
\makeatother

\begin{document}

\section{A section}
See \nameref{proc:insertion-sort}.

\begin{codebox}
  \Procname{$\proc{Insertion-Sort}(A)$}\label{proc:insertion-sort}
    \li \For $j \gets 2$ \To $\attrib{A}{length}$
      \li \Do
      $\id{key} \gets A[j]$
      \li \Comment Insert $A[j]$ into the sorted sequence
      $A[1 \twodots j-1]$.
      \li $i \gets j-1$
      \li \While $i > 0$ and $A[i] > \id{key}$
        \li \Do
        $A[i+1] \gets A[i]$
        \li $i \gets i-1$
        \End
      \li $A[i+1] \gets \id{key}$
    \End
\end{codebox}

\end{document}


text:
Q: login with error 'Call to a member function prepare() on null' Laravel makes me crazy showing the next following error:

The error happens when login controller is triggered.
public function login(Request $request)
    {
        $this->validateLogin($request);
        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        $throttles = $this->isUsingThrottlesLoginsTrait();

        if ($throttles && $lockedOut = $this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        $credentials = $this->getCredentials($request);
       // $credentials['type']=1;
       // return $credentials;die;
        if (Auth::guard($this->getGuard())->attempt($credentials, $request->has('remember'))) {
            return $this->handleUserWasAuthenticated($request, $throttles);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        if ($throttles && ! $lockedOut) {
            $this->incrementLoginAttempts($request);
        }

        return $this->sendFailedLoginResponse($request);
    }

Seems like is an error related to the database though the login service is managed by an API that works well. I don't know why this error happens. I'm really newbie to Laravel so if anyone can guide me I will thank.
User Model
namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password','phone','photo','first_name', 'contact_name', 'address', 'phone_number', 'fiscal_number', 'about_us',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function subscription()
    {
        return $this->hasMany('App\Models\EmployerSubscription','employer_id','_id');
    }
    public function jobseekers()
    {
        return $this->hasOne('App\Models\JobSeekers');
    }

    public function experience()
    {
        return $this->hasMany('App\Models\Experience')->where('status',true);
    }

}

A: The default User model is extending Illuminate\Database\Eloquent\Model, where it has to extend Jenssegers\Mongodb\Eloquent\Model to work with MongoDB. By changing the User model in app/User.php, this can be resolved. Change your user model to following-
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
class User extends \Jenssegers\Mongodb\Eloquent\Model implements
AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract
{
    use Authenticatable, Authorizable, CanResetPassword, Notifiable;

   /**
    * The attributes that are mass assignable.
    *
    * @var array
    */
    protected $fillable = [
        'name', 'email', 'password',
    ];

   /**
    * The attributes that should be hidden for arrays.
    *
    * @var array
    */
   protected $fillable = [
       'name', 'email', 'password','phone','photo','first_name', 'contact_name', 'address', 'phone_number', 'fiscal_number', 'about_us',
    ];

   /**
    * The attributes that should be hidden for arrays.
    *
    * @var array
    */
   protected $hidden = [
       'password', 'remember_token',
   ];

   public function subscription()
   {
       return $this->hasMany('App\Models\EmployerSubscription','employer_id','_id');
   }
   public function jobseekers()
   {
       return $this->hasOne('App\Models\JobSeekers');
   }

   public function experience()
   {
       return $this->hasMany('App\Models\Experience')->where('status',true);
   }
}

A: As you are saying that login service is managed by API, but as i can see you have used laravel Auth service provider for authentication. Please check database settings in your project .env file. if issue still persist kindly follow below steps.

*

*composer dump-autoload

*php artisan cache:clear

*php artisan view:clear

*php artisan config:clear

and restart your server. Hope that will work.

A: Go to User model and add the following;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;

class User extends Eloquent implements AuthenticatableContract,


text:
Q: Get longitude and latitude values to post into url - Android I am creating an Android app that pulls XML data. I want to be able to use the longitude and latitude values to post into the web link to get specific XML data for the users current location.
Here is my code so far, which does not work:
public class GeoSplashActivity extends Activity {
    LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
    Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    double longitude = location.getLongitude();
    double latitude = location.getLatitude();
    private String GEORSSFEEDURL = "http://www.socialalertme.com/mobilealerts.xml?lat="+latitude+"lng="+longitude+"&distance=20";
    GeoRSSFeed feed3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash2);
        ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        if (conMgr.getActiveNetworkInfo() == null
                && !conMgr.getActiveNetworkInfo().isConnected()
                && !conMgr.getActiveNetworkInfo().isAvailable()) {
            // No connectivity - Show alert
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setMessage(
                    "Unable to reach server, \nPlease check your connectivity.")
                    .setTitle("TD RSS Reader")
                    .setCancelable(false)
                    .setPositiveButton("Exit",
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog,
                                                    int id) {
                                    finish();
                                }
                            });
            AlertDialog alert = builder.create();
            alert.show();
        } else {
            // Connected - Start parsing
            new AsyncLoadXMLFeed().execute();
        }
    }

    private class AsyncLoadXMLFeed extends AsyncTask<Void, Void, Void> {

        @Override
        protected Void doInBackground(Void... params) {
            // Obtain feed
            GeoDOMParser myParser = new GeoDOMParser();
            feed3 = myParser.parseXml(GEORSSFEEDURL);
            return null;
        }
        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);

            Bundle bundle = new Bundle();
            bundle.putSerializable("feed", feed3);

            // launch List activity
            Intent intent = new Intent(GeoSplashActivity.this, GeoListActivity.class);
            intent.putExtras(bundle);
            startActivity(intent);

            // kill this activity
            finish();
        }

    }

}

I have never used the location stuff before, so I'm not entirely sure what I'm doing here. If anyone could give some pointers, I'd really appreciate it!

A: Hopefully you are not forgetting
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>

in your manifest file. This tutorial can help you to get better understanding.
Edit
Google already have provided Training to get current Location.

A: //Get coordinates if available:
LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Location loc;
double latitude=0,longitude=0;
if (  ( loc=lm.getLastKnownLocation(LocationManager.GPS_PROVIDER) )!=null  ){
        latitude = loc.getLatitude();
    longitude = loc.getLongitude();
}else if( ( loc=lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER) )!=null  ){
    latitude = loc.getLatitude();
    longitude = loc.getLongitude();
}
//If any coordinate value is recieved, use it.
if(latitude!=0 || longitude!=0){
    String latitude = String.valueOf(latitude);
        String longitude = String.valueOf(longitude);
        //TODO post into url
}

A: You should move initialization of location variables to the onCreate method. Also you should also check if location != null:
lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
    longitude = location.getLongitude();
    latitude = location.getLatitude();
    GEORSSFEEDURL = "http://www.socialalertme.com/mobilealerts.xml?lat="+latitude+"lng="+longitude+"&distance=20";
} else {
    ...
}

A: I am doing the same thing, and this works for me!
But, the server I am requestiong is a node.js server, and the data is in JSON.
public class GetWeatherDataRest extends AsyncTask<Void, Void, String> {
private static final String TAG = "GetWeatherDataRest";

// get lat and long from main activity
double lat = MyActivity.lat;
double lng = MyActivity.lng;

// the url
String url = "http://ThisIsTheAddress/weather/5days?lat="+lat+"&lng="+lng;
public MyActivity context;
private List<Weather> posts;

public GetWeatherDataRest(MyActivity activity){
    this.context = activity;
}

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

    try {
        //Create an HTTP client
        HttpClient client = new DefaultHttpClient();
        HttpGet get = new HttpGet(url);

        //Perform the request and check the status code
        HttpResponse response = client.execute(get);
        StatusLine statusLine = response.getStatusLine();
        if(statusLine.getStatusCode() == 200) {
            HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();

            try {
                //Read the server response and attempt to parse it as JSON
                Reader reader = new InputStreamReader(content);
                GsonBuilder gsonBuilder = new GsonBuilder();
                gsonBuilder.setDateFormat("M/d/yy hh:mm a");
                Gson gson = gsonBuilder.create();
                posts = new ArrayList<Weather>();
                posts = Arrays.asList(gson.fromJson(reader, Weather[].class));
                content.close();
            } catch (Exception ex) {
                Log.e(TAG, "Failed to parse JSON due to: " + ex);
            }
        } else {
            Log.e(TAG, "Server responded with status code: " + statusLine.getStatusCode());
        }
    } catch(Exception ex) {
        Log.e(TAG, "Failed to send HTTP POST request due to: " + ex);
    }
    return null;
}

@Override
protected void onPostExecute(String result) {

    context.updateFields(posts);

}

}
Okey! This is my GpsFragment, where I get the lng and lat!
I am not done with this yet, so It might not look like much, but it works, also it gives an address from the lng & lat using geocoder
You should implement the LocationListener.
public class GpsFragment extends Fragment implements LocationListener{

public Location location;
LocationManager locationManager;
String provider;

List<Address> mAddresses;

TextView mAddress1;
TextView mAddress2;

public static double lat;
public static double lng;

private static final String TAG = "MyGps";

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View myInflatedView = inflater.inflate(R.layout.gps_fragment, container,false);

    mAddress1 = (TextView) myInflatedView.findViewById(R.id.address_text);
    mAddress2 = (TextView) myInflatedView.findViewById(R.id.address_text2);

    locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
    Criteria criteria = new Criteria();
    provider = locationManager.getBestProvider(criteria, false);
    Location location = locationManager.getLastKnownLocation(provider);
    locationManager.requestLocationUpdates(provider, 100, 1, this);

    if(location != null){
        onLocationChanged(location);
        Log.v(TAG, "Location available!");
    }
    else{
        mAddress1.setText("No location");
        Log.e(TAG, "Location not available!");
    }

    return myInflatedView;

}

// So i think this is what you need! the 'onLocationChanged'
@Override
public void onLocationChanged(Location location) {
    this.location = location;
    lat = location.getLatitude();
    lng = location.getLongitude();

    Geocoder mLocation = new Geocoder(getActivity().getApplicationContext(), Locale.getDefault());
    try {
        mAddresses = mLocation.getFromLocation(lat, lng, 1);

        if(mAddresses != null) {
            Address returnedAddress = mAddresses.get(0);
            StringBuilder strReturnedAddress = new StringBuilder("Address:\n");
            for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
                strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");
            }
            // mAddress.setText(strReturnedAddress.toString());

            //mAddress1.setText("lat"+lat);
            //mAddress2.setText("lng"+lng);

             mAddress1.setText("Address: "+returnedAddress.getAddressLine(0).toString());
             mAddress2.setText("City: "+returnedAddress.getAddressLine(1).toString());
        }
        else{
            // mAddress.setText("No Address returned!");
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        //mAddress.setText("Cannot get Address!");
    }

    ((MyActivity)getActivity()).fetchData();
}

@Override
public void onStatusChanged(String s, int i, Bundle bundle) {

}

@Override
public void onProviderEnabled(String s) {

}

@Override
public void onProviderDisabled(String s) {

}

}


text:
Q: Percona XtraDB Cluster (5.6.28-76.1-56-log) - random OOM events We have a multi-node (each of 64G RAM) cluster. The main (the one we use for mutating data) node randomly just OOMs, this happens both in peak times and in extremely quiet times.
What we've noticed just before the OOM event is usually a bunch of transactions waiting for locks on the main node. MySQL tuner suggests that the max possible usage of mysql is 59G, but when this starts to buildup it exhausts ALL the resources on the box and OOM event happens. There is nothing else running on that box.
The last occurrence of the event was on a quiet period, where there were very small amount of connections (less than 150), with even less actively doing anything.
Can I get any pointers on what may be causing MySQL to go over what is supposed be its maximum in terms of memory?
our my.cnf (sanitised a bit)
[mysqld]
datadir                         = /var/lib/mysql
long_query_time                 = 5
slow_query_log                  = 1
slow_query_log_file             = /var/log/mysql/slow_query.log
log_bin                         = mysql-bin
log_error                       = /var/log/mysql/error.log
tmpdir                          = /var/lib/mysql/.tmpdir
binlog_format                   = ROW
default_storage_engine          = InnoDB

expire_logs_days                = 28
ft_min_word_len                 = 1
ft_stopword_file                = ''
join_buffer_size                = 16M
key_buffer_size                 = 24M
lc-messages-dir                 = /usr/share/mysql
lower_case_table_names          = 0
max_allowed_packet              = 512M
max_connections                 = 400
max_heap_table_size             = 6G
memlock                         = 0
myisam-recover                  = BACKUP
query_cache_limit               = 4M
query_cache_size                = 64M
query_cache_type                = 1
read_buffer_size                = 2M
read_rnd_buffer_size            = 16M
skip-external-locking
skip_name_resolve
sort_buffer_size                = 10M
sysdate_is_now                  = 1
table_open_cache                = 1024
thread_cache_size               = 512
thread_stack                    = 192K
tmp_table_size                  = 6G

explicit_defaults_for_timestamp = 1

innodb_autoinc_lock_mode        = 2
innodb_buffer_pool_instances    = 8
innodb_buffer_pool_size         = 32G
innodb_doublewrite              = 1
innodb_file_per_table           = 1
innodb_flush_log_at_trx_commit  = 2
innodb_flush_method             = O_DIRECT
innodb_io_capacity              = 200
innodb_log_buffer_size          = 96M
innodb_log_files_in_group       = 2
innodb_log_file_size            = 1024M
innodb_read_io_threads          = 4
innodb_thread_concurrency       = 0
innodb_locks_unsafe_for_binlog  = 1
innodb_write_io_threads         = 4

innodb_ft_min_token_size        = 0
innodb_stats_on_metadata        = 0

Additional information as requested:
number of threads = 16 per node
uses provisioned 1024 iops (aws) with 1024G storage per node
show global status: https://pastebin.com/kpiWrERR
show global variables: https://pastebin.com/x3uXrvJs
mysqltuner output: https://pastebin.com/7uGHQsGy (we've already been through a few iterations of it)
there are various other system processes the run on that box, but none of them are using more than normal and their memory usage is accounted for, im afraid thats all i can share on that.

A: Rate Per Second = RPS
Suggestions to consider for your AWS Parameters group
max_connections=300  # from 400 because max_used_connections was 197
innodb_flush_neighbors=2  # from 1 to reduce 95,455 innodb_buffer_pool_pages_dirty faster
innodb_io_capacity=900  # from 200 to use more of your IOPS available
read_buffer_size=262144  # from 2M to reduce handler_read_next RPS of 2,416,022
read_rnd_buffer_size=196608  # from 16M to reduce handler_read_rnd_next RPS of 965,300

to reduce MySQL RAM footprint and reduce CPU busy with performance improvement.
Please view my profile, Network profile for free downloadable Utility Scripts to improve performance and contact info.

A: I found a few serious issues:
Observations:

*

*Version: 5.6.28-76.1-56-log

*64 GB of RAM

*Uptime = 1d 16:08:17

*You are not running on Windows.

*Running 64-bit version

*You appear to be running entirely (or mostly) InnoDB.

The More Important Issues:
max_heap_table_size and tmp_table_size are 6G.  For your 64G machine, don't set them above 600M (1% of RAM).  What may be happening is that multiple big queries are building temp tables (more evidence of that below) and chewing up lots of RAM.  It is better to have a temp table spill to disk than lead to swapping or OOM.  Also, looking at the slowlog will help identify these naughty queries.
The Query Cache should probably be turned off.  It is doing a lot of prunes.  The QC is rarely practical in Production systems because every INSERT causes all items in the QC for the relevant table(s) to be purged.  This costly.  A compromise is to use it selectively (cf DEMAND) and use SQL_CACHE or SQL_NO_CACHE on SELECTs.
Assuming you have SSDs, you should increase innodb_io_capacity (to 1000) and perhaps a few similar settings.
32G buffer_pool, but Innodb_buffer_pool_reads = 344/second -- Sounds like a lot of queries that do table scans.  Also 119 temp tables /second; 34 on disk.  Use the slowlog to track them down.
Why so many ROLLBACKs?
Why SHOW ENGINE STATUS so often?  (once a second!)
Are you monitoring deadlocks?  Suggest innodb_print_all_deadlocks = ON
Some other SHOW commands are quite frequent.  Keep in mind that they take a toll on performance.  Perhaps run them less frequently.
I rarely find REPLACE to be practical; check your usage.
If you are using FULLTEXT indexes, I suspect that innodb_ft_min_token_size = 0 is "wrong".
If you are using PARTITIONed tables, please provide SHOW CREATE TABLE for a critique.
6-node cluster? -- How far apart are the nodes?  Is the network saturated?  (Each node talks to each of the other 5 on each write.)
Consider turning on wsrep_log_conflicts .
Details and other observations:
( Key_reads + Key_writes + Innodb_pages_read + Innodb_pages_written + Innodb_dblwr_writes + Innodb_buffer_pool_pages_flushed ) = (340 + 0 + 53517294 + 5637805 + 714833 + 5637805) / 144497 = 453 /sec -- IOPs?
-- If the hardware can handle it, set innodb_io_capacity (now 200) to about this value.
( ( Key_reads + Key_writes + Innodb_pages_read + Innodb_pages_written + Innodb_dblwr_writes + Innodb_buffer_pool_pages_flushed ) / innodb_io_capacity / Uptime ) = ( 340 + 0 + 53517294 + 5637805 + 714833 + 5637805 ) / 200 / 144497 = 226.7% -- This may be a metric indicating what innodb_io_capacity is set reasonably.
-- Increase innodb_io_capacity (now 200) if the hardware can handle it.
( innodb_buffer_pool_size / innodb_buffer_pool_instances ) = 32768M / 8 = 4096MB -- Size of each buffer_pool instance.
-- An instance should be at least 1GB. In very large RAM, have 16 instances.
( innodb_lru_scan_depth ) = 1,024
-- "InnoDB: page_cleaner: 1000ms intended loop took ..." may be fixed by lowering lru_scan_depth
( innodb_io_capacity_max / innodb_io_capacity ) = 2,000 / 200 = 10 -- Capacity: max/plain
-- Recommend 2. Max should be about equal to the IOPs your I/O subsystem can handle. (If the drive type is unknown 2000/200 may be a reasonable pair.)
( Innodb_buffer_pool_reads ) = 49,797,223 / 144497 = 344 /sec -- Cache misses in the buffer_pool.
-- Increase innodb_buffer_pool_size (now 34359738368)? (~100 is limit for HDD, ~1000 is limit for SSDs.)
( (Innodb_buffer_pool_reads + Innodb_buffer_pool_pages_flushed) ) = ((49797223 + 5637805) ) / 144497 = 383 /sec -- InnoDB I/O
-- Increase innodb_buffer_pool_size (now 34359738368)?
( Innodb_log_writes ) = 7,403,188 / 144497 = 51 /sec
( Com_rollback ) = 2,211,653 / 144497 = 15 /sec -- ROLLBACKs in InnoDB.
-- An excessive frequency of rollbacks may indicate inefficient app logic.
( Handler_rollback ) = 4,550,132 / 144497 = 31 /sec
-- Why so many rollbacks?
( Innodb_row_lock_waits ) = 20,978 / 144497 = 0.15 /sec -- How often there is a delay in getting a row lock.
-- May be caused by complex queries that could be optimized.
( Innodb_deadlocks ) = 1 / 144497 = 0.025 /HR -- Deadlocks
-- SHOW ENGINE INNODB STATUS; to see the latest pair of queries that deadlocked.
( innodb_flush_neighbors ) = 1 -- A minor optimization when writing blocks to disk.
-- Use 0 for SSD drives; 1 for HDD.
( ( Innodb_pages_read + Innodb_pages_written ) / Uptime / innodb_io_capacity ) = ( 53517294 + 5637805 ) / 144497 / 200 = 204.7% -- If > 100%, need more io_capacity.
-- Increase innodb_io_capacity (now 200) if the drives can handle it.
( innodb_io_capacity ) = 200 -- I/O ops per second capable on disk . 100 for slow drives; 200 for spinning drives; 1000-2000 for SSDs; multiply by RAID factor.
( expand_fast_index_creation ) = expand_fast_index_creation = OFF -- ALTER and OPTIMIZE may be greatly sped up by using ON.
-- Probably better to be ON.
( sync_binlog ) = 0 -- Use 1 for added security, at some cost of I/O =1 may lead to lots of "query end"; =0 may lead to "binlog at impossible position" and lose transactions in a crash, but is faster.
( innodb_print_all_deadlocks ) = innodb_print_all_deadlocks = OFF -- Whether to log all Deadlocks.
-- If you are plagued with Deadlocks, turn this on. Caution: If you have lots of deadlocks, this may write a lot to disk.
( min( tmp_table_size, max_heap_table_size ) ) = (min( 6144M, 6144M )) / 65536M = 9.4% -- Percent of RAM to allocate when needing MEMORY table (per table), or temp table inside a SELECT (per temp table per some SELECTs). Too high may lead to swapping.
-- Decrease tmp_table_size (now 6442450944) and max_heap_table_size (now 6442450944) to, say, 1% of ram.
( innodb_buffer_pool_populate ) = OFF = 0 -- NUMA control
( character_set_server ) = character_set_server = latin1
-- Charset problems may be helped by setting character_set_server (now latin1) to utf8mb4. That is the future default.
( local_infile ) = local_infile = ON
-- local_infile (now ON) = ON is a potential security issue
( Qcache_lowmem_prunes ) = 80,501,088 / 144497 = 557 /sec -- Running out of room in QC
-- increase query_cache_size (now 67108864)
( Qcache_lowmem_prunes/Qcache_inserts ) = 80,501,088/141879824 = 56.7% -- Removal Ratio (frequency of needing to prune due to not enough memory)
( Qcache_not_cached ) = 40,419,444 / 144497 = 279 /sec -- SQL_CACHE attempted, but ignored
-- Rethink caching; tune qcache
( Qcache_inserts - Qcache_queries_in_cache ) = (141879824 - 16616) / 144497 = 981 /sec -- Invalidations/sec.
( (query_cache_size - Qcache_free_memory) / Qcache_queries_in_cache / query_alloc_block_size ) = (64M - 24496808) / 16616 / 8192 = 0.313 -- query_alloc_block_size vs formula
-- Adjust query_alloc_block_size (now 8192)
( Questions ) = 632,680,020 / 144497 = 4378 /sec -- Queries (outside SP) -- "qps"
-- >2000 may be stressing server
( Queries ) = 634,675,672 / 144497 = 4392 /sec -- Queries (including inside SP)
-- >3000 may be stressing server
( Created_tmp_tables ) = 17,211,890 / 144497 = 119 /sec -- Frequency of creating "temp" tables as part of complex SELECTs.
( Created_tmp_disk_tables ) = 4,880,505 / 144497 = 34 /sec -- Frequency of creating disk "temp" tables as part of complex SELECTs
-- increase tmp_table_size (now 6442450944) and max_heap_table_size (now 6442450944).
Check the rules for temp tables on when MEMORY is used instead of MyISAM. Perhaps minor schema or query changes can avoid MyISAM.
Better indexes and reformulation of queries are more likely to help.
( tmp_table_size ) = 6144M -- Limit on size of MEMORY temp tables used to support a SELECT
-- Decrease tmp_table_size (now 6442450944) to avoid running out of RAM. Perhaps no more than 64M.
( Com_rollback / (Com_commit + Com_rollback) ) = 2,211,653 / (5878741 + 2211653) = 27.3% -- Rollback : Commit ratio
-- Rollbacks are costly; change app logic
( Select_full_join ) = 1,238,385 / 144497 = 8.6 /sec -- joins without index
-- Add suitable index(es) to tables used in JOINs.
( Select_range_check ) = 369,822 / 144497 = 2.6 /sec -- no good index
-- Find slow queries; check indexes.
( Select_scan ) = 10,971,747 / 144497 = 76 /sec -- full table scans
-- Add indexes / optimize queries (unless they are tiny tables)
( Select_scan / Com_select ) = 10,971,747 / 182457623 = 6.0% -- % of selects doing full table scan. (May be fooled by Stored Routines.)
-- Add indexes / optimize queries
( sort_buffer_size ) = 10M -- One per thread, malloced at full size until 5.6.4, so keep low; after that bigger is ok.
-- This may be eating into available RAM; recommend no more than 2M.
( Com_insert + Com_delete + Com_delete_multi + Com_replace + Com_update + Com_update_multi ) = (15287078 + 413037 + 137592 + 2417207 + 40196282 + 118467) / 144497 = 405 /sec -- writes/sec
-- 50 writes/sec + log flushes will probably max out I/O write capacity of normal drives
( Com_replace ) = 2,417,207 / 144497 = 17 /sec
-- Consider changing to INSERT ... ON DUPLICATE KEY UPDATE.
( binlog_error_action ) = binlog_error_action = IGNORE_ERROR -- What to do if the binlog cannot be written.
-- IGNORE_ERROR is the default for backwards compatibility, but ABORT_SERVER is recommended.
( long_query_time ) = 5 -- Cutoff (Seconds) for defining a "slow" query.
-- Suggest 2
( log_slow_slave_statements ) = log_slow_slave_statements = OFF -- (5.6.11, 5.7.1) By default, replicated statements won't show up in the slowlog; this causes them to show.
-- It can be helpful in the slowlog to see writes that could be interfering with Slave reads.
( Connections ) = 4,437,295 / 144497 = 31 /sec -- Connections
-- Increase wait_timeout (now 28800); use pooling?
( thread_cache_size / Max_used_connections ) = 512 / 197 = 259.9%
-- There is no advantage in having the thread cache bigger than your likely number of connections. Wasting space is the disadvantage.
Abnormally small:
Innodb_master_thread_idle_loops = 5
innodb_ft_min_token_size = 0

Abnormally large:
Bytes_received = 1623600 /sec
Bytes_sent = 7156640 /sec
Com_begin = 57 /sec
Com_delete_multi = 0.95 /sec
Com_kill = 0.35 /HR
Com_rename_table = 3.9 /HR
Com_show_binlogs = 12 /HR
Com_show_engine_status = 0.99 /sec
Com_show_keys = 0.073 /sec
Com_show_processlist = 0.99 /sec
Com_show_slave_hosts = 0.075 /HR
Com_show_slave_status_nolock = 24 /HR
Com_show_status = 1.2 /sec
Com_show_storage_engines = 12 /HR
Com_update = 278 /sec
Com_update_multi = 0.82 /sec
Handler_commit = 3457 /sec
Handler_external_lock = 4188 /sec
Handler_prepare = 379 /sec
Handler_read_key = 124114 /sec
Handler_read_last = 2.2 /sec
Handler_read_next = 2416004 /sec
Handler_read_prev = 37046 /sec
Handler_read_rnd = 66035 /sec
Handler_update = 1951 /sec
Innodb_buffer_pool_pages_dirty = 95,455
Innodb_buffer_pool_pages_made_not_young = 11177 /sec
Innodb_buffer_pool_pages_made_young = 323 /sec
Innodb_buffer_pool_pages_misc = 149,890
Innodb_buffer_pool_read_requests = 2506430 /sec
Innodb_data_read = 6068079 /sec
Innodb_data_reads = 370 /sec
Innodb_ibuf_free_list = 156,712
Innodb_ibuf_merged_deletes = 1.6 /sec
Innodb_ibuf_merged_inserts = 15 /sec
Innodb_ibuf_merges = 11 /sec
Innodb_ibuf_segment_size = 156,845
Innodb_ibuf_size = 132
Innodb_rows_read = 3497480 /sec
Innodb_s_lock_spin_rounds = 3604 /sec
Innodb_s_lock_spin_waits = 1130 /sec
Key_write_requests = 331 /sec
Qcache_hits = 2538 /sec
Qcache_inserts = 981 /sec
Select_full_range_join = 17 /sec
Select_full_range_join / Com_select = 1.3%
Select_range = 100 /sec
Sort_range = 151 /sec
Sort_rows = 15547 /sec
Sort_scan = 65 /sec
Table_locks_immediate = 2076 /sec
Threads_cached = 127
auto_increment_offset = 5
max_heap_table_size = 6144MB
min(max_heap_table_size, tmp_table_size) = 6144MB
wsrep_cluster_size = 6
wsrep_slave_threads = 8

Abnormal strings:
Compression = ON
ft_min_word_len = 1
ft_stopword_file =
innodb_fast_shutdown = 1
innodb_locks_unsafe_for_binlog = ON
optimizer_trace = enabled=off,one_line=off
optimizer_trace_features = greedy_search=on, range_optimizer=on, dynamic_range=on, repeated_subselect=on
slave_rows_search_algorithms = TABLE_SCAN,INDEX_SCAN
wsrep_cluster_status = Primary
wsrep_connected = ON
wsrep_provider = /usr/lib64/galera3/libgalera_smm.so
wsrep_provider_name = Galera
wsrep_provider_vendor = Codership Oy
wsrep_provider_version = 3.14(r53b88eb)
wsrep_sst_method = xtrabackup-v2

Slowlog
http://mysql.rjweb.org/doc.php/mysql_analysis#slow_queries_and_slowlog


text:
Q: how can i map lat and lng to geo_point type in elasticsearch Im using elasticsearch 7 and nest 6.7 .
I have index that has any type like coordinate .
in any way im mapping geo_type i have problem .
 client.CreateIndex("staging2", c => c.Mappings(m => m.Map<VenueIndex>(mm => mm.AutoMap())));

this is my nest code and this is som part of my poko class :
     public object Promotion { get; set; }
    public object Checkin { get; set; }
    public Featured Featured { get; set; }
    public int BinaryType { get; set; }
    public List<WorkingHour> WorkingHours { get; set; }
    [GeoPoint(Name = "location", IgnoreMalformed = true)]
    public Geoloc _geoloc { get; set; }
    public string Neighbourhood { get; set; }
    public List<int> MealTimes { get; set; }
    public string objectID { get; set; }

    public class Geoloc
{

    [Number(NumberType.Double, Name = "lat")]
    public double lat { get; set; }
    [Number(NumberType.Double, Name = "lon")]
    public double lon { get; set; }
}

in this way GeoLoc type is float
other way when i user post man still have this problem .
my json object is somthing like this :
{
  "isClubMember": false,
 "rating": 0.0,
 "binaryType": 2,
 "location": {
 "lat":"32.11",
 "lon":"-34.22"
 },
   "neighbourhood": "شهرک والفجر,امیر آباد",
   "mealTimes": [],
   "objectID": "188dc91e-8088-4099-9eb8-00aa73653192"}

where is my mistake ?

A: Model:
    public class TestClass
    {
        public object Promotion { get; set; }
        public object Checkin { get; set; }
        [GeoPoint(Name = "location", IgnoreMalformed = true)]
        public Geoloc _geoloc { get; set; }
        public string Neighbourhood { get; set; }
        public List<int> MealTimes { get; set; }
        public string objectID { get; set; }
    }
    public class Geoloc
    {
        [Number(NumberType.Double, Name = "lat")]
        public double lat { get; set; }
        [Number(NumberType.Double, Name = "lon")]
        public double lon { get; set; }
    }

Code to create mapping using NEST
var url = "http://localhost:9200";
            var settings = new ConnectionSettings(new Uri(url));
            EsClient = new ElasticClient(settings);

            if (!EsClient.IndexExists("gcheck").Exists)
            {
                var resp = EsClient.CreateIndex("gcheck", c => c
                 .Map<TestClass>(mp => mp
                 .Properties(
                     ps => ps
                 ).AutoMap()
                ));
            }

Output mapping:
 "gcheck" : {
    "mappings" : {
      "properties" : {
        "binaryType" : {
          "type" : "long"
        },
        "checkin" : {
          "type" : "object"
        },
        "isClubMember" : {
          "type" : "boolean"
        },
        "location" : {
          "type" : "geo_point",
          "ignore_malformed" : true
        },
        "mealTimes" : {
          "type" : "integer"
        },
        "neighbourhood" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "objectID" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "promotion" : {
          "type" : "object"
        },
        "rating" : {
          "type" : "long"
        }
      }
    }
  }


text:
Q: Populating a ListBox with List I am using LINQ to Entites in my WindowsForm application.
I am trying to populate a Lisbox with the result of a query:
So my datasource is a List where User is a table in my database and a EntityType in my model.
The problem is I want the Displaymember to bea concat of 3 different Columns. (User.Firstname + " " + user.LastName + " - " + user.userCode)
and ValueMember to be user.ID;
I could just create a struct of a userItem with the 4 items, iterate through the list of User's and add them to another List. But this seems like double processing.

A: You can extend the Entity in the partial class with a custom property like this:
public partial class User
{
    public string Description
    {
        get
        {
             return string.Format("{0} {1} - {2}", FirstName, LastName, UserCode);
        }
    }
}

If you don't want to add the property you can also use a Linq Projection to create a custom list with the computed property:
var listdata = (from u in Users
                select new
                {
                   Description = string.Format("{0} {1} - {2}", u.FirstName, u.LastName, u.UserCode).
                   Id = u.Id;
                }.ToList();

Then you can bind listdata to your listbox.

A: Why don't you just create a property in your model which returns the concatenated value from three columns/properties. Then set the DisplayMemeber equal to that property
Another way could be to add a Computed Columns in your table. Combine the value of rest of the columns through expression


text:
Q: TPL Dataflow how to synchronize with "global" data I'm actually learning about TPL Dataflows. Whenever I read something about it, I think ok sounds great, but then I often ask myself: "Ok, and what if I have kind of a manager, handling different sessions. These sessions can be updated by certain messages. In case of a complex TPL dataflow mesh I've to build-in synchronization mechanism for accessing the manager, which will slow down or block the mesh."
Using a management object for TPL dataflows feels kind of wrong.
Can anybody give me some hints (links, books, examples ...) to the "right" direction, how to solve above example.

A: Kind of very broad question without some code. But usually you either passing some "state" objects with Tuples or some DTO, which I personally consider as leaking design, or you can inject some blocks into your pipeline.
For example, you can create a WriteOnceBlock with providing it a session value, unique for each pipeline, and simply notifying it's value with new events happened during execution. This may be an option for you if you create a pipeline for different session, but if you have one big pipeline, you need another way.
For example, you have a BufferBlock, an ActionBlock, which performs a session update, and an TransformBlock, which simply continues your normal pipeline execution. The thing you can do in this case is to introduce a BroadcastBlock, link it with action block and transform block. Now you link your buffer to broadcast block with a predicate, and after that you link buffer to transform block directly.
The idea here is that if your message is filtered (so the session update needed), it will go to broadcast block, and, after that, to session update action and to your normal execution pipeline. If it does not match the predicate, it simply go over your normal workflow.
PS: if this is too complicated in words, I can provide some sample code for such scenario.
var linkOptions = new DataflowLinkOptions { PropagateCompletion = true };

var buffer = new BufferBlock<int>();
// broadcast do copy according lambda from constructor
// if you provide same reference for message, make sure that your access is thread-safe
var broadcast = new BroadcastBlock<int>(i => i);
buffer.LinkTo(broadcast, linkOptions);

// session update block
var sessionUpdate = new ActionBlock<int>(i =>
    {
        Thread.Sleep(new Random().Next(1000));
        Console.WriteLine($"Session update:{i}");
    }, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 4 });
// normal execution
var transform = new TransformBlock<int, int>(i =>
    {
        Thread.Sleep(new Random().Next(1000));
        Console.WriteLine($"Normal execution:{i}");
        return i;
    }, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 4 });
// do not complete the standalone session block
// message will be accepted only for multipliers of 3
broadcast.LinkTo(sessionUpdate, i => i % 3 == 0);
// normal pipeline with completion propagation
broadcast.LinkTo(transform, linkOptions);

for (var i = 0; i < 10; ++i)
{
    // async message
    await buffer.SendAsync(i);
}
buffer.Complete();
await transform.Completion;


text:
Q: How to update existing record using codeIgniter I have a table like this: id, image, user_id.
The user_id is saved from the session. The same user wants to update his profile picture means, how it will update?
This Is Controller Function
public function save() {

   $session_data = $this->session->userdata('logged_in');
   $uid= $session_data['id'];

   //print_r($uid);exit;

   $url = $this->do_upload();
   $this->load->model('user_model');
   $this->user_model->save($url,$uid);

   echo '<script>alert("You Have Successfully Uploaded your Profile Picture!");</script>';

   redirect('/home/');
}

This Is Model
public function save($url, $uid){
    $this->db->set('image', $url);
    $this->db->set('user_id', $uid);
    $this->db->insert('tbl');
    return true;
}

How can I update this query?

A: You can do something like the following:
$upd_data = array(
   'image' = $url,
);

$this->db->where('user_id', $uid)
         ->update('tbl', $upd_data);


text:
Q: Write to properties file on Wildfly which is loaded by ClassLoader I am loading properties on an Wildfly application server like this:
public String getPropertyValue(String propertyName) throws IOException {
    InputStream inputStream;
    Properties properties = new Properties();

    inputStream = getClass().getClassLoader().getResourceAsStream(propertyFileName);

    if (inputStream != null) {
        properties.load(inputStream);
    } else {
        throw new FileNotFoundException("property file '" + propertyFileName + "' not found in the classpath");
    }

    inputStream.close();
    String property = properties.getProperty(propertyName);
    LOG.debug("Property {} with value {} loaded.", propertyName, property);
    return property;
}

Now I want to write to that very same file. How do I do that correctly? I tried around with new File(configurationFileName), but that creates a new File in a different directory, and I tried around with URL/URI of file from classloader, but that doesn't seem to work either. What is the correct way to do this?
Thx for help!

A: You can't and you shouldn't. I would use a database table to store and load properties. Or if it shall be a properties-file, then store it somewhere external via a file path, but not via the class path.

A: try (FileOutputStream out = new FileOutputStream(new File( getClass().getClassLoader().getResource(propertyName).toURI()))){
    properties.store(out,"My Comments);
}

A: Raoul Duke is actually right, doing the properties via file raises a lot of problems. I will soon switch to DB for keeping those. In the mean time I did this: When I write properties, they are written to a newly created file. When I read properties, I load the "old" ones, and then create a new properties object with the old ones as defaults, in which I then load the new file.
private Properties loadProperties() throws IOException {
    InputStream inputStream;
    Properties defaultProperties = new Properties();
    inputStream = getClass().getClassLoader().getResourceAsStream(defaultPropertyFileName);
    if (inputStream != null) {
        defaultProperties.load(inputStream);
    } else {
        throw new FileNotFoundException("Property file '" + defaultPropertyFileName + "' not found in the classpath");
    }
    inputStream.close();
    Properties allProps = new Properties(defaultProperties);
    try {
        allProps.load(new FileInputStream(new File(updatedPropertyFileName)));
    } catch (IOException ex) {
        LOG.error("Error loading properties: {}", ex.toString());
        return defaultProperties;
    }
    return allProps;
}

I marked his answer right, since I am technically not writing to the file I wanted to, plus this is only a workaround and his solution is way better and cleaner.


text:
Q: ibus(unicode vietnamese) not working with skype i install ibus (unicode vietnamese) in ubuntu 16.04 but only skype not working. chrome or facebook it ok. Please help me!

A: Some snap apps (Slack, Skype, Rocket.Chat+, Telegram) from Ubuntu Software seems can't type Vietnamese by ibus, while other may (Viber, Postman, PHP Storm, Chromium).
I reported this issue at https://bugs.launchpad.net/ubuntu/+source/ibus-unikey/+bug/1803270
Following Olivier Tilloy (osomon), maybe these apps (the snap apps can't type Vietnamese) do not use the desktop helper.
A temporary solution is download Skype deb packet from Skype official website and you can type Vietnamese in this by ibus.

A: I think you should install skype by .deb file from web, not from ubuntu software center. This is link:
https://www.skype.com/en/get-skype/
I can use ibus-unikey to type Vietnamese on this version.


text:
Q: JavaFX packages not found I am trying to make a project with combined Swing and JavaFX components but JavaFX packages are not found by my IDE (tried with Netbeans and Eclipse).
import javafx.embed.swing.JFXPanel;

says package javafx.embed.swing.JFXPanel does not exist, same for any other fx packages.
This happens when I create project using new project > java application, but if I try to create JavaFX sample, it works...
I have no idea what am I missing here. Here are some background information and steps I have tried:

*

*I am using win7 and jdk7 (in which java FX should be included)

*My project in Netbeans (version 8) has JDK 1.7 selected as a deafult library

*I updated my path: JAVA_HOME: C:\Program Files\Java\jre7

*And also system Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\DMIX;C:\Program Files\Java\jdk1.7.0_17\jre\bin;C:\Dev\ant\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.7.0_17\jre\lib\jfxrt.jar
What else should I do to make JavaFX work? Thanks for any troubleshooting... All the information about setting JavaFX so far seem to be very outdated.

A: You must include in the Project in your IDE the jfxrt.jar otherwise it will not be included as this was the default behavior prior to Java 8.
Then depending on your system and the way your build your jar for your project, and it also must be there for running the jar. So make your project also export the required libraries.


text:
Q: subversion command in antscript pass argument as variable how can i pass variable in the command instead of hard coding it.  I am running this subversion command in ant script to checkout latest code and I want to pass the destination folder and username and password as variables.  Is it possible?
<exec executable="svn">
    <arg line="co -r HEAD http://10.208.72.62/svn/test/trunk
c:\CruiseControl\projects\svnTest\svn --username admin --password admin" />
</exec>

A: Use a property for each parameter, either inline your antscript:
<!-- also possible to use property name=... location=... -->
<property name="destdir" value="c:/CruiseControl/projects/svnTest/svn"/>
<property name="username" value="admin"/>
<property name="pass" value="admin"/>

or create some propertyfile foo.properties with the lines :
:: use path separator unix style '/', java(ant) will handle it correctly
:: no need to use '\\'
destdir=c:/CruiseControl/projects/svnTest/svn
username=admin
pass=admin

and load it into your antscript via :
<property file="foo.properties"/>

then your exec task will look like :
<exec executable="svn">
 <arg line="co -r HEAD http://10.208.72.62/svn/test/trunk
${destdir} --username ${username} --password ${pass}" />
</exec>

see ant manual > property task for details.


text:
Q: Can i somehow use plink on web for SSH check? How i have SSH checker on PHP. It works with SSH2 and libssh2, but this modules work bad with some SSH. Plink works great with all SSH servers on Windows, but is there a way to run plink on linux? Or maybe i can use something else for WEB?

A: You can get plink for linux here:
http://pngu.mgh.harvard.edu/~purcell/plink/download.shtml
Generally you can do everything in ssh(1) that you can do with plink. If you can show us what you're trying to do, maybe we can give you a solution that uses ssh(1).


text:
Q: React Native: Android build - App.js: Cannot read property 'bindings' of null I'm trying to build my project, but it has tuned into a nightmare...
Now I'm facing this issue when I run ./gradlew assembleRelease
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:bundleReleaseJsAndAssets'.

And more specifically:
transform[stderr]: Trace: The node type SpreadProperty has been renamed to SpreadElement
transform[stderr]:     at Object.isSpreadProperty (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/types/lib/validators/generated/index.js:4208:11)
transform[stderr]:     at hasSpread (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-object-rest-spread/lib/index.js:38:13)
transform[stderr]:     at PluginPass.ObjectExpression (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-object-rest-spread/lib/index.js:234:14)
transform[stderr]:     at newFn (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/visitors.js:193:21)
transform[stderr]:     at NodePath._call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:53:20)
transform[stderr]:     at NodePath.call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:40:17)
transform[stderr]:     at NodePath.visit (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:88:12)
transform[stderr]:     at TraversalContext.visitQueue (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:118:16)
transform[stderr]:     at TraversalContext.visitSingle (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:90:19)
transform[stderr]:     at TraversalContext.visit (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:146:19)

App.js: Cannot read property 'bindings' of null

TypeError: Cannot read property 'bindings' of null
    at Scope.moveBindingTo (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/scope/index.js:867:13)
    at BlockScoping.updateScopeInfo (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17)
    at BlockScoping.run (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12)
    at PluginPass.BlockStatementSwitchStatementProgram (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24)
    at newFn (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/visitors.js:193:21)
    at NodePath._call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:88:12)
    at TraversalContext.visitQueue (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:118:16)

I honestly have absolutely no idea what's wrong now, how can I debug this?
This is my package.json:
{
    "name": "my-app",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "@ptomasroos/react-native-multi-slider": "0.0.12",
        "firebase": "^5.1.0",
        "javascript-time-ago": "^1.0.30",
        "mobx": "^4.1.1",
        "mobx-react": "^5.0.0",
        "native-base": "^2.8.1",
        "prop-types": "^15.6.2",
        "protobufjs": "^6.8.8",
        "react": "16.2.0",
        "react-native": "^0.57.7",
        "react-native-actionsheet": "^2.3.0",
        "react-native-aws3": "0.0.8",
        "react-native-axios": "^0.17.1",
        "react-native-billing": "^2.9.1",
        "react-native-card-stack-swiper": "^1.0.5",
        "react-native-collapsible": "^0.10.0",
        "react-native-cookies": "^3.2.0",
        "react-native-datepicker": "^1.6.0",
        "react-native-dropdownalert": "^3.5.0",
        "react-native-elements": "^0.19.0",
        "react-native-event-listeners": "^1.0.3",
        "react-native-expandable-section-flatlist": "^1.0.3",
        "react-native-fbsdk": "^0.8.0",
        "react-native-fcm": "^16.0.0",
        "react-native-floating-action": "^1.10.1",
        "react-native-geocoding": "^0.3.0",
        "react-native-gifted-chat": "^0.4.3",
        "react-native-google-places-autocomplete": "^1.3.6",
        "react-native-hide-show-password-input": "^1.0.7",
        "react-native-image-crop-picker": "^0.19.3",
        "react-native-image-picker": "^0.26.10",
        "react-native-image-placeholder": "^1.0.14",
        "react-native-instagram-login": "^1.0.7",
        "react-native-keyboard-aware-scroll-view": "^0.4.4",
        "react-native-keyboard-aware-scrollview": "^2.0.0",
        "react-native-keyboard-spacer": "^0.4.1",
        "react-native-linear-gradient": "^2.4.0",
        "react-native-linkedin": "^1.3.1",
        "react-native-localization": "^2.0.0",
        "react-native-material-bottom-navigation": "^0.9.0",
        "react-native-modal-datetime-picker": "^6.0.0",
        "react-native-open-settings": "^1.0.1",
        "react-native-pages": "^0.7.0",
        "react-native-permissions": "^1.1.1",
        "react-native-picker-select": "^5.1.0",
        "react-native-popup-menu": "^0.12.4",
        "react-native-pulse": "^1.0.6",
        "react-native-scrollable-tab-view": "^0.8.0",
        "react-native-share": "^1.0.26",
        "react-native-simple-toast": "0.0.8",
        "react-native-snap-carousel": "^3.7.2",
        "react-native-splash-screen": "^3.1.1",
        "react-native-star-rating": "^1.0.9",
        "react-native-swipe-cards": "^0.1.1",
        "react-native-swipe-list-view": "^1.0.7",
        "react-native-swipeable-flat-list": "0.0.5",
        "react-native-swipeout": "^2.3.3",
        "react-native-switch": "^1.4.0",
        "react-native-twitter-signin": "https://github.com/GoldenOwlAsia/react-native-twitter-signin.git#master",
        "react-native-view-more-text": "^2.0.1",
        "react-native-viewpager": "^0.2.13",
        "react-navigation": "^1.0.3",
        "rn-viewpager": "^1.2.9"
    },
    "devDependencies": {
        "@babel/plugin-proposal-decorators": "^7.2.0",
        "babel-jest": "22.2.2",
        "babel-preset-react-native": "4.0.0",
        "jest": "22.2.2",
        "react-test-renderer": "16.2.0"
    },
    "jest": {
        "preset": "react-native",
        "transform": {
            "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
        }
    }
}

A: From https://www.npmjs.com/package/babel-preset-react-native

babel-preset-react-native has been replaced by
  metro-react-native-babel-preset, which now uses Babel 7.0.0. If you're
  using React Native v0.57 or later you should update your babel config
  to point to the metro-react-native-babel-preset preset.

A: I think this may be related to a particular issue with babel-core, you could try this solution https://github.com/babel/babel/issues/8263#issuecomment-402546923
Add to your package.json
"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3"

and then npm install


text:
Q: Find accuracy of DNNRegressor with tensorboard Is there a way to show the accuracy of this DNNRegression model after each iteration in tensorboard? The only way I have seen it is using the "session" method, not using tf.estimator. Also, is there is a way to find the final accuracy of the model without resorting to doing it by hand? I tried the evaluation method, but the dictionary it returns doesn't have an "accuracy" key.
import numpy as np
import tensorflow as tf
import _pickle as cPickle

with open("var_x.txt", "rb") as fp:   # Unpickling
    var_x = cPickle.load(fp)

with open("var_y.txt", "rb") as fp:   # Unpickling
    var_y = cPickle.load(fp)

with open("var_x_test.txt", "rb") as fp:   # Unpickling
    var_x_test = cPickle.load(fp)

with open("var_y_test.txt", "rb") as fp:   # Unpickling
    var_y_test = cPickle.load(fp)

test_set = tf.contrib.learn.datasets.base.load_csv_with_header(
        filename="test.csv",
        target_dtype=np.float64,
        features_dtype=np.float64)

feature_columns = [tf.feature_column.numeric_column("x", shape=[4])]

estimator = tf.estimator.DNNRegressor(feature_columns=feature_columns, hidden_units=[1024, 512, 256])

# define our data sets
x_train = np.array(var_x)
y_train = np.array(var_y)
x_test = np.array(var_x_test)
y_test = np.array(var_y_test)

input_fn = tf.estimator.inputs.numpy_input_fn(
    {"x": x_train}, y_train, batch_size=4, num_epochs=60, shuffle=True)

# train
estimator.train(input_fn=input_fn, steps=1000)

#TESTING
prediction_input_fn= tf.estimator.inputs.numpy_input_fn(
    x ={"x":x_test},
    num_epochs=1,
    shuffle=False
    )

predictions = list(estimator.predict(input_fn=prediction_input_fn))

s=0

for i in range(len(predictions)):
    print(str(int(abs(round(predictions[i]['predictions'][0]))))+"\n")
    if (int(abs(round(predictions[i]['predictions'][0]))) == y_test[i]):
        s+=1

print(s)

A: To see the final accuracy you need to call estimator.evaluate(..) which returns an evaluate matrics (loss, accuracy...)
check this link
https://www.tensorflow.org/versions/master/api_docs/python/tf/estimator/DNNRegressor


text:
Q: Long running task postpones execution of sequentially-previous code after event trigger I hope I described the problem correctly.
In the following code the drive.IsReady takes some time to complete. Prior to this is the command to print the text "Scanning drives..." in the textbox. The text though appears after the foreach() has completed.
Why is this happening and how can I notify the user prior to the long-running task?
public Form1()
{
    InitializeComponent();
    button1.Click += new System.EventHandler(this.Button1_Click);
}

private void Button1_Click(object sender, EventArgs e)
{
    richTextBox1.Text = "Scanning drives, please wait...";
    PopulateComboBox();
}

void PopulateComboBox()
{
    System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();

    foreach (System.IO.DriveInfo drive in drives)
    {
        if (drive.IsReady)
        {
            comboBox1.Items.Add(drive.Name + drive.VolumeLabel);
        }
        else
        {
            comboBox1.Items.Add(drive.Name);
        }
    }
}

A: These are the minimal changes required to make the slow part of your code (drive.IsReady) run asynchronously. It won't run faster, the intention is just to keep the UI responsive.
private async void Button1_Click(object sender, EventArgs e) // + async
{
    richTextBox1.Text = "Scanning drives, please wait...";
    await PopulateComboBox(); // + await
}

async Task PopulateComboBox() // async Task instead of void
{
    System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();

    foreach (System.IO.DriveInfo drive in drives)
    {
        if (await Task.Run(() => drive.IsReady)) // + await Task.Run(() => ...)
        {
            comboBox1.Items.Add(drive.Name + drive.VolumeLabel);
        }
        else
        {
            comboBox1.Items.Add(drive.Name);
        }
    }
}