text:
Q: 2x10Gb network : Transfer Huge files with NFS limitied to 6 Gbps I'm transferring big files (78GB) through network, with NFS, but the transfer is finally limited to 6 Gbps (on a 2x10Gb NIC). I cannot find the bottleneck for now. Here my setup:
1 Server

*

*MB: Supermicro X10DRH-C (pcie 3.0), only one cpu

*NIC: 2 x 10Gb (intel X710-T2L)

*64GB of DDR4 (2400Mhz)

*HBA: LSI 9311-8i => 2 mini SAS hd connected to SAS 12Gb backplane

*12 HDD: consumer grade, SATA. Toshiba MG09 18TB (So SAS is limited to 6 Gbps per line)

NFS /etc/exports : xxx(rw,async,fsid=0,no_subtree_check,crossmnt).
24 threads for nfsd
I tried to dd big files into all the disks, no slow down, they all write at 200MB/s
2 Clients
NFS configuration: async.
MTU: 9000.

*

*threadripper 3970X, 192GB of ram, copy from a RAID0 of 4 NVME gen 3

*2 xeon E5, 512GB of ram, copy from a RAID0 of 4 ssd

Clients are directly connected to the server (no switch), on their own network (10.1.0.0/24 and 10.1.2.0/24).
I tried to play with ring buffer and flow control with ethtool, but it doesn't change anything.
No high CPU load.
I'm generally copying 6-8 files at the same time, onto 6-8 different disks => so I'm expecting an average of 9-12Gbps transfer rate. The network spikes sometime to more than 9 Gbps on one interface, for a few seconds, but finally stabilize around 3Gbps on both interfaces. I guess it's due to caching in server ram
I need some help to find the bottleneck please.

Edit: iperf result:

iperf -w 2m result:

A: Diagnosing such network issues can be tricky. Please start with the following steps (ideally done one at a time):

*

*set Linux power governor to performance;

*enable jumbo frames on both clients and server (from your post I see MTU at 9000 for clients, but it is not specified for the server);

*try copying only the first 8 GB of a single file, at least two times in a row. If successive copies are fast, this means your limit is total disk latency/IOPs (network and NFS add some overhead, so this can impact your total delivered IOPs);

*try switching between NFS 3 and 4.1, or consider using pNFS;

*increase NFS rsize and wsize (see here)

A: What are you using to copy data?  I found standard tools such as cp, mv, rsync don't scale very well and will use bbcp for such transfers.  Even though the project is unfortunately abandoned, it's still better.  The best I can do is between our nfs v4.0 mounts over shared 10 Gb/s Ethernet line but at night when it's unused I've seen it saturated at 1.2 GB/s before.
bbcp is at https://www.slac.stanford.edu/~abh/bbcp/
last I checked there were forks on Github but they were abandoned as well.Sometimes the Stanford git doesn't work but if you retry throughout the day you should be able to grab v17.12.00.00.0 from there...
If not, I keep a clean copy of the repo so I can put it on new machines.  I just archived it for you with git archive -o bbcp-17.12.00.00.0.tar master then gzip'd it and put it here: https://ava.genome.arizona.edu/pub/bbcp-17.12.00.00.0.tar.gz
Best,


text:
Q: How to persist a computed property SwiftUI 2.0 Xcode 12.3 I am trying to update and persist subtotal in my app when the user increments using a stepper
Current App flow:

*

*The user enters data in form data gets saved to core data.

*an @FetchRequest gets the data from core data.

*In a list, the core data entities are iterated over and data is passed to a view

*In the view, a computed property gets and updates the subtotal locally in view only.

*The user by tapping a stepper can increment or decrement and subtotal gets displayed
Question: How to constantly update subtotal and persist so I can access in another view to total all subtotals and reset each instance of the subtotal
What I have tried:
import SwiftUI

struct testView: View {
    @Environment(\.managedObjectContext) private var viewContext
    @FetchRequest(entity: WindowCounter.entity(), sortDescriptors: [

        NSSortDescriptor(
            keyPath: \WindowCounter.userOrder,
            ascending: true),
        NSSortDescriptor(
            keyPath:\WindowCounter.subtotal,
            ascending: true )
    ]) var windows: FetchedResults<WindowCounter>
    @Environment(\.colorScheme) var colorScheme
    @ObservedObject var estimatorData: EstimatorViewModel

    var id: UUID
    @State var price: Double
    @State var qty: Int
    @State var subtotal: Double

    var getSubtotal: String {
        let result = (Double(qty) * price)
        return String(format: " %.2f", result)
    }

    var body: some View {
        VStack {
            //.....
            HStack {
                // ....
                Text("Subtotal $ \(getSubtotal)")
                    .foregroundColor(Color("Primary"))
                    .onChange(of: getSubtotal) { newValue in
                        updateSubtotal(newSubTotal: getSubtotal)
                    }
                //....
            }

        }
    }
    // This I think after some comments I received
// is the wrong approach might be better to persist in another way.

    func updateSubtotal(newSubTotal: String) {
        print(newSubTotal)
     // Updated subtotal is in newSubtotal

        for window in windows {
            window.subtotal = Double(newSubTotal) ?? 0.00
        }
        do {
            try viewContext.save()
        }
        catch {
            print(error.localizedDescription)
        }
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I access a controller's data in another controller in Angular js? var app = angular.module("myApp",[]);

app.controller("CTRL1", function($scope){
    $scope.data = [{'name':'Prateek'},{'name':'Agarwal'},{'name': 'Ketan'}];
})

app.controller("CTRL2", function($scope){
    $scope.data = [{'name':'Hari'}];
})

I have two controllers - CTRL1 and CTRL2. How can I access data from one controller in another?

A: You can use $emit and $on functions for this, These will send data in any controll on spectfic event named.
<div ng-app="myApp" ng-controller="myCtrl">

    <button ng-click="sendData();"></button>

</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
    function sendData($scope) {
        var arrayData = [1,2,3];
        $scope.$emit('someEvent', arrayData);
    }

});
app.controller('yourCtrl', function($scope, $http) {
    $scope.$on('someEvent', function(event, data) {
        console.log(data);
    });
});
</script>


text:
Q: JAMMA Arcade: How to properly wire audio I'm trying to wire build a Jamma arcade cabinet from scratch. I have a question on how to properly wire audio. The Jamma standard have two pins related to audio (+/-). I have connected + to a phobo plug middle and - to the phono shield. The phono is connected to my OSSC upscaler via a phono to jack adapter. This setup causes weird behavior and restarts.
If I just connect the middle and leave the - disconnected everything seems to work ok. I suspect this only works because the devices share a common ground in the power supply. I want to make a system where I also have the option to connect my home theater amp, so the outer jacket needs to be terminated properly.
Have access to both Neo Geo and CPS/CPS2 jamma games. Problem applies to all of them.
Any suggestions/real knowhow on how this is supposed to be wired? Should the jamma - pin be left out and connect the outer phono jacket to ground instead? Do I need to add any components like resistors or similar?

A: Actually the audio output pins at L/10 output amplified audio signals which are meant to directly power an unpowered speaker, usually located in the arcade. Your capture card is probably expecting line out which is preamp signal levels (less than 1 pp V). I suspect this may overwelm the input of OSSC causing it to restart.
From Arcade Otaku:

Speaker +/- "10/L" is mono. It does not need an external amp. The speaker +/- is for post-amp output directly to the speaker. Audio +/- "11/M" is for pre-amp outputs but is hardly ever used.

The solution is to use a line level converter that can reduce the power of your signal. You could build one yourself to with a voltage divider if you have the resistors that can give you the correct gain.


text:
Q: Group By Date With Empty Groups I have a loginAudit table and I am trying to get a count for all logins for each day.  What I'd like to do is have days where there are no logins return their day and a login count of 0.  Currently no row is returned for days with no logins.
Could be this isn't possible and have to fill in empty groups in the app after query results returned?
  SELECT DATEADD(day, DATEDIFF(day,0,LoginAudit.LoginDateTime), 0) as LoginDate,
         COUNT(DISTINCT LoginAudit.LoginAuditID) AS Logins
    FROM LoginAudit
GROUP BY DATEADD(day, DATEDIFF(day,0,LoginAudit.LoginDateTime), 0)
ORDER BY 1

A: Essentially what you're asking is to join your table to a "table" of dates.  The date table would have no gaps and you would group on the date value.  So how to create a table of dates?
In SQL for Smarties, it's suggested that you keep a table of integers around for cases when you need a gapless sequence to join to. Then you can select whatever sequence you need by joining your table to it.
So if you had an integer table with values going as many days back from NOW() as required you might do the following:
SELECT DATE_SUB(CURDATE(), INTERVAL i.intvalue DAY) AS thedate,
       COUNT(DISTINCT LoginAudit.LoginAuditID) AS logins
FROM i LEFT JOIN dual ON (DATE_SUB(NOW(), INTERVAL i.intvalue DAY)= day)
GROUP BY DATE_SUB(CURDATE(), INTERVAL i.intvalue DAY)
ORDER BY i DESC;

ETA, for mysql:
//create an integer table
create table i(i integer not null primary key);
insert into i values (0),(1),(2) ... (9);

if I need 0-99 consecutive numbers:
SELECT 10*t.i + u.i AS number
  FROM i AS u
CROSS JOIN
  i AS t
ORDER BY number;

if I need consecutive dates:
SELECT date_sub(curdate(), interval (10*t.i + u.i) DAY) as thedate
  FROM i AS u
CROSS JOIN
  i AS t
ORDER BY thedate;

A: I thought I'd searched for solutions fairly thoroughly, but of course right after posting my question I found this link:
SQL group by day, show orders for each day
dooh!

A: What DBMS are you using?
If Oracle, you might try selecting your dates in a sub-query, like so:
SELECT TRUNC(SYSDATE) + 1 - LEVEL AS today,
       TRUNC(SYSDATE) + 2 - LEVEL AS tomorrow
FROM DUAL
CONNECT BY LEVEL <= 30 /* Last 30 days */

Then you might do:
SELECT today as LoginDate,
       COUNT(DISTINCT LoginAudit.LoginAuditID) AS Logins
FROM (
       SELECT TRUNC(SYSDATE) + 1 - LEVEL AS today,
              TRUNC(SYSDATE) + 2 - LEVEL AS tomorrow
       FROM DUAL
       CONNECT BY LEVEL <= 30 /* Last 30 days */
     ),
     LoginAudit
WHERE LoginAudit.LoginDateTime BETWEEN today AND tomorrow
GROUP BY today
ORDER BY 1


text:
Q: Hierarchical POCO objects & Repositories Suppose I have a domain model that has 1:1 correspondence to the physical model. Also:

*

*all the tables in the physical model has the column name 'Id' as a primary key

*Many of the tables have 'LastChanged' timestamp column

*Some of the tables contain localized data

Objective: create domain model classes (POCO) and appropriate repositories. Tools - VS2010, EF4.1
The most obvious approach to take is to generate EF model from the DB and then run T4 POCO Generator over it. The output is a set of POCO classes.
//POCO classes
public class Country
{
    public int Id { get; set; }
    public string Name { get; set; }
    public DateTime LastModified { get; set; }
    ...
}

public class User
{
    public int Id { get; set; }
    public string FirtsName { get; set; }
    public DateTime LastModified { get; set; }
    ...
}

So far so good but we come across some code duplications when implementing repositories. Both on the interface definition level:
public interface ICountryRepository
{
    IEnumerable<Country> FindAll();

    Country FindById(int id);

    void Add(Country country);

    void Delete(Country country);
}

//Here the ONLY difference is the type of the entity
public interface IUserRepository
{
    IEnumerable<User> FindAll();

    User FindById(int id);

    void Add(User user);

    void Delete(User user);
}

And on the implementation level:
class CountryRepository : ICountryRepository
{
    IEnumerable<Country> FindAll()
    {
        //implementation
    }

    Country FindById(int id)
    {
        //find by id logic
    }

    void Add(Country country)
    {
        //logic
    }

    void Delete(Country country)
    {
        //logic
    }
}

class UserRepository : IUserRepository
{
    IEnumerable<User> FindAll()
    {
        //the only difference in the implementation
        //is the type of returned entity
    }

    User FindById(int id)
    {
        //the only difference in the implementation
        //is the type of returned entity
    }

    void Add(User user)
    {
        //the only difference in the implementation
        //is the type of returned entity
    }

    void Delete(User user)
    {
        //the only difference in the implementation
        //is the type of returned entity
    }
}

Taking into account that most of the code above can be written more generically, we can also take the following approach.
Create a POCO objects hierarchy:
public class  EntityBase
{
    public int Id { get; set; }
}

public class TrackableEntity : EntityBase
{
    public DateTime LastChanged { get; set; }
}

public class LocalizedEntity : TrackableEntity
{
    public int ResourceId { get; set; }
}

public class Country : LocalizedEntity
{
}

And then repository hierarchy with a base implemetation:
public interface IRepository<TEntity> where TEntity : EntityBase
{
    IEnumerable<TEntity> FindAll();

    TEntity FindById(int id);

    void Add(TEntity entity);

    void Delete(TEntity entity);
}

public interface ILocalizedRepository<TEntity> : IRepository<TEntity> where TEntity : LocalizedEntity
{
    IEnumerable<TEntity> FindByCultureIso2(string cultureIso2);
}

public interface ICountryRepository : ILocalizedRepository<Country>
{
}

internal class RepositoryBase<TEntity> : IRepository<TEntity> where TEntity : EntityBase
{
    private readonly IObjectSet<TEntity> _objectSet;

    public RepositoryBase(ObjectContext database)
    {
        _objectSet = database.CreateObjectSet<TEntity>();
    }

    protected virtual IQueryable<TEntity> All()
    {
        return _objectSet;
    }

    public virtual IEnumerable<TEntity> FindAll()
    {
        return All().ToList();
    }

    public virtual TEntity FindById(int id)
    {
        return All().Where(entity => entity.Id == id).SingleOrDefault();
    }

    public virtual void Add(TEntity entity)
    {
        _objectSet.AddObject(entity);
    }

    public virtual void Delete(TEntity entity)
    {
        _objectSet.DeleteObject(entity);
    }
}

internal class LocalizedRepositoryBase<TEntity> : RepositoryBase<TEntity>, ILocalizedRepository<TEntity> where TEntity : LocalizedEntity
{
    public LocalizedRepositoryBase(ObjectContext database) : base(database)
    {
    }

    protected override IQueryable<TEntity> All()
    {
        return (base.All() as ObjectSet<TEntity>).Include("Resource.LocalizedResources.Culture");
    }

    public IEnumerable<TEntity> FindByCultureIso2(string cultureIso2)
    {
        IEnumerable<TEntity> entities = All().Where(...);

        return entities.ToList();
    }
}

internal class CountryRepository : LocalizedRepositoryBase<Country>, ICountryRepository
{
    public CountryRepository(ObjectContext database) : base(database)
    {
    }
}

The compelling advantage of the latter approach is that the code is much more structured which allows to avoid code duplication.
But this scenario is hardly amenable to T4 code gen which opens up a surface for a large amount of manual work.
I would appreciate if you let me know you thinking on the following:

*

*How do you think, is the beauty of the code really worth the trouble of implementing it manually?

*Is there any other ways to get rid of the code duplication?

A: If your biggest concern is manual implementation of POCOs use interfaces to define shared features instead of base classes:
public interface IEntityBase
{
    int Id { get; set; }
}

public interface ITrackableEntity : IEntityBase
{
    DateTime LastChanged { get; set; }
}

public interface ILocalizedEntity : ITrackableEntity
{
    int ResourceId { get; set; }
}

Now you don't need to implement POCOs manually. Generator will create entities for you and you will only need to define your partial part for each entity to define which interfaces it implements.
public partial class Country : ILocalizedEntity
{ }

If you are happy with T4 modification you can even add interface resolution directly to T4 and you will not need to define those partial parts.

A: If you are generating code it's ok to duplicate, just don't touch generated code and you'll be just fine.


text: Q: Sending a Vector in Winsock I am trying to send a full vector from the server  to a client using Winsock. Up to now I have been working, sending chars with the function send, defined by Winsock in the example they provide(https://msdn.microsoft.com/en-us/library/windows/desktop/ms737593(v=vs.85).aspx). The thing is that I have entered in the definition of send and obviously is only defined to send chars. So my question is if there is any way of sending a vector from the server to the client. If there is, how would you implement it?


text:
Q: I'm getting std class vector has no member error for all my vector methods My professor sent me the code and most of it works but this part is having problems. All the methods from vector class are showing error. I don't have much experience with c++ but I need to run the code. He was running the same code and it was working just fine.
error is: class "std::vector<int, std::allocator >" has no member "begin"
almost same for all other methods as well
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

#include "State.h"
#include "SearchNode.h"
#include "Game.h"

vector<int> input() {
    vector<int> input;

    cout << "Input nine different numbers from 0 to 8. " << endl;
    cout << "For instance, put in 7, 0, 5, 1, 3, 8, 4, 6, 2" << endl;

    do {
        int num;
        cin >> num;
        if (num < 0 || num > 8
                || std::find(input.**begin()**, input.**end()**, num) != input.**end()**) {
            cout << "Invalid input. Try again." << endl;
            continue;
        }

        input.**push_back(num)**;

        if (input.**size()** < 9)
            cout << "Input " << (9 - input.**size()**) << " more numbers." << endl;
    } while (input.**size()** < 9);

    return input;
}

another part of a header file is also having the same error but it's too long to post here:
        State currentState = *initialState;
        std::priority_queue<State> searchQueue;

        std::stack<State> searchedList;

        cout << "Initial state: " << endl;
        currentState.printBoard();
        cout << "Best first search starts ... " << endl;

        searchQueue.push(currentState);

        while (!currentState.isGoalAchieved() && stepsLeft > 0
                && !searchQueue.empty()) {
            std::vector<State> stateList = nextStates(currentState);
            for (int i = 0; i < stateList.**size()**; i++) {
                if (!checkExist(searchedList, stateList[i])) {
                    searchQueue.push(stateList[i]);
                }
            }

            if (!searchQueue.empty()) {
                currentState = searchQueue.top();
                searchQueue.pop();
            }

            cout << endl;
            currentState.printBoard();
            searchedList.push(currentState);

            cout << "Number of states visited up to now " << searchedList.size()
                    << ". " << endl;

            stepsLeft--;
        }
    }

A: I was missing windows sdk. Installing them worked.
https://developercommunity.visualstudio.com/content/problem/958134/error-c1083-yvalsh-unable-to-include-crtdbgh.html


text:
Q: activity indicator and CLLocation Distance In my application i load at startup the distance between user location and a known point;
I want to show at startup an activity indicator with a label "Loading" that then disappears to show the distance. How can I do?

A: If you build your views programmatically then this is how you instantiate the activity indicator view:
UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];

If you use the IB then it is exactly like adding any other view...
In order to start animating use the [activityIndicatorView startAnimating]; method.
In order to stop - use the [activityIndicatorView stopAnimating];.
In order to hide the label and the activity indicator together just put the inside an additional view (it might be full-screen half transparent view) and show/hide this view instead of label and indicator view separately.
This way you will also disable all the touchable UI elements (actually, you will hide these by the half-transparent loading view).


text:
Q: Frown for a sex change, or, how do I unbork the "FacialGender" classifier in 11.2? The limits of machine learning.  I thought the new "FacialGender" option for Classifier would be an amusing thing to explore.

So far, so good. But that's me with bed-head. So let's try a picture after I'm a bit more cleaned up.

Oh.
It turns out you can confuse the classifier just by changing your facial expression. (Poking out your tongue is apparently male behaviour, by the way.)
I was interested in knowing if the classifier was picking out the more obvious facial differences between the sexes – the ones we can all subconsciously pick in a fraction of a second – or whether it was being bamboozled by mere gender presentation.  So I checked it on photos of Riley J Dennis, a transgender woman with a rather obvious Adam's apple who writes for Everyday Feminism, and Lea DeLaria, a self-described butch lesbian, known for playing Big Boo on Orange Is the New Black.  The classifier coded Riley as female and Lea as male. While some might argue the point on the former, the latter is clearly incorrect. (Lest you think I'm making a political statement here, I also tried a photo of Jon Bon Jovi in his 1987 big-hair days – the classifier says female!)
The classifier gets Ellen De Generes right, but is confused by Samira Wiley: the photo on her Wikipedia page gets classified as female, but this picture of her playing Poussey Washington from Orange Is the New Black codes as male. Here is that result along with the one for DeLaria.

At this point it became clear that the classifier has not been appropriately calibrated to detect sex. Since this is a Q&A site, I better phrase this as a question:
Is there a way to improve built-in classifiers, especially this one, with further training and feedback where it gets it wrong?
And when people mistakenly call me "Sir", do I just need to smile?
EDIT
Update for version 12.1
Someone's tuned the learning algorithm. It now gets me right – and the newer "FacialAge" classifier gets my age within 12 months!! – but the Jon Bon Jovi photo is still classified as female and the Samira Wiley as Poussey Washington photo is still classified as male.

A: Practically, is there anything you can do? Probably not within reason.
Maybe here's a manageable suggestion:
You've suggested in your example,that the classifier is picking up whether the face is smiling or not and this is informing its results (because for some reason one of the gender categories had more smiling in it). In that case you could explicitly try to debias for smiling. But this would really just be creating a classifier for smiling and then essentially penalizing predictions that went along with the bias by an amount proportional to the bias's strength. For example, we'd be interested in:
P(actualCategory =
   "female" | prediction = "female" && "face" = "smiling")
And we're worried about the fact that there's a bias because this:
P(prediction = "female" | "face" = "smiling")
isn't 50%.
If we can get an estimate for the bias and have a classifier for smiling, then we should just be able to update our result with Bayes' rule.

A:
Is there a way to improve built-in classifiers, especially this one, with further training and feedback where it gets it wrong?

Am I missing something? I didn't expect the answer to be so obvious: https://www.wolfram.com/language/11/external-services/train-a-classifier-function-with-images-from-the-w.html?product=mathematica

Edit:

Doesn't really answer the question - I don't want to train a new custom classifier. I want to know if we can unbork the built-in ones

I don't think it would be hard (for Wolfram) to implement a hint suggestion system. We can already train ImageIdentify via the "Image Identification Project" web site:
https://www.imageidentify.com/
The ability to train and fine tune AI is a good idea. However when it comes to generic things like Facial Expressions (7 billion people times an average of 21 facial expressions) training is going to take a long, long time. You'd need a really smart system to train the AI system... eg something crafty like a Captcha Phone Unlock facial recognition app that feeds the Image Identification Project.
Training specific Buildings/Houses would be far easier, faster and accurate. Mere mortals could do that and its why I recommend putting in a feature request to do the same for Classifier and its various options as we can for ImageIdentify:

An interesting quote from Stephen Wolfram that talks to this topic:

"Like many projects we tackle for the Wolfram Language, developing ImageIdentify required bringing many diverse things together. Large-scale curation of training images. Development of a general ontology of picturable objects, with mapping to standard Wolfram Language constructs. Analysis of the dynamics of neural networks using physics-like methods. Detailed optimization of parallel code. Even some searching in the style of A New Kind of Science for programs in the computational universe. And lots of judgement calls about how to create functionality that would actually be useful in practice."

REF: http://blog.stephenwolfram.com/2015/05/wolfram-language-artificial-intelligence-the-image-identification-project/

Ps Does this question remind anyone else of Silicon Valley S4 E3, where Erlich goes to Uni and gives students assignments to "classify" food types for their Seefood app? Very funny series if you haven't seen it.


text:
Q: How can My App Tweet the Contents a User Submits? Note: I am posting this because I don't even know what to Google search. I know we're all about thorough research before asking these questions. Any help would be appreciated.
Scenario: User writes a text post from my app and when they submit it, the content is added to a Parse.com class (I know how to do this) and simultaneously it is tweeted from a designated twitter account (that does not belong to the user) let's say @MyCoolAppThatTweets.
In other words, I don't want the user via my app to be permanently logged into @MyCoolAppThatTweets twitter account, but have one-time access to send a tweet from it.
Another way to phrase this question would be: How can my app log into a specific twitter account whose credentials I can "bake" into the app without compromising the security of that twitter account.
I am already aware that normally, users of an iOS app wouldn't automatically want their content being tweeted. For the project I'm making, this is not going to be a concern (it's a secret).
If you need more information or if I need to post this elsewhere, please let me know!

A: From your question I am not sure if you are familiar with "Twitter part" of Parse.com and Twitter REST API. If not please start by reading this https://www.parse.com/docs/ios/guide#users-twitter-users (or take a look on official Twitter way by using their plugin called Fabric: https://dev.twitter.com/)
Since you mentioned PFUser I will describe you how to achieve it by using Parse.com API.
First your user must be logged in to Twitter account.
I suppose that your user is already logged in into your app as a PFUser so best way to log him into some Twitter account is by linking Twitter account with existing PFUser - https://www.parse.com/docs/ios/guide#users-linking.
After that you can post tweets through user's Twitter account (if permission was granted). I recommend doing that using Parse.com Twitter API calls https://www.parse.com/docs/ios/guide#users-login-amp-signup. To create API requests you need official Twitter REST API which can be obtained here https://dev.twitter.com/docs/api.


text:
Q: Sortable List Populated With Dynamic Data I am having a bit of a problem getting JQuery-UI interactions working on a page of mine. I haven't used JQuery-UI before, so I started out by trying the sortable interaction with the hopes of making it drag-and-drop and sortable later on. However, I've been banging my head against the wall and been unable to even get the sortable working.
The content I am trying to sort is being loaded dynamically with ajax. Here is a representation of what the content looks like:

Education

General Information

Music / Movies / Television

Navigation

Retailers

Social Media

Web Results

This JQuery function loads the data:
// load all the engines in a category
$('#container').on("click", ".buttonclass", function() {
    $.get("/categories", {
      id : $(this).attr('data-id')
      }, function(data) {
          var pane = $("#categories").data('jsp');
          pane.getContentPane().html(data);
          pane.reinitialise();
      });
});

(the pane-related stuff is because this is scrollable by a JScrollPane). I try adding code to this function above to make the list elements sortable, but nothing works. Some things I've tried are:
$('.category').sortable();
...
$('.category'.each(function(){$(this).sortable()};
...
$("#category_list").sortable();
...
$('.category').sortable('refresh');
...
$('.category'.each(function(){$(this).sortable('refresh')};
...
$("#category_list").sortable('refresh');

I tried adding the code to on click handler both inside the callback function (of the $.get) and after it with no luck.
Static data hard-coded in the page (inside the JscrollPane) has no problems sorting. Just the dynamic content is causing trouble.
Any help would be greatly appreciated.

A: Take a look at this jquery-ui documentation and sorting and dragging for same element at jqfaq.com. Hope, this might help you.

A: Ideally it should be
$("#category_list").sortable();

If you have went through the Jquery UI Sortable docs .

A: Figured out the problem and it was the JScrollPane. Although the JScrollpane has no problems with static data and sortable/draggable/droppable it seems to cause problems when dynamically populating it.
Removed the JScrollPanes and all if fine using:
$("#category_list").sortable();


text:
Q: Is it possible to run an asynchronous function without making the main function as async? Is it possible to run an asynchronous function without making the main function as async?
function index() {
    console.log('1');
    aaa();
    console.log('3');
}

async function aaa() {
    return await bbb().then((value) => {
        console.log(value);
    });
}

async function bbb() {
    return await new Promise((resolve, reject) => {
        setTimeout(() => {
            resolve('2');
        }, 1000);
    });
}

index();

It is possible to display:

1

2

3

Without making the index function as async?

A: You need to do something to cause console.log('3') to run after the promise returned by aaa() has been resolved.
Making index async and using await is the approach that most people find easiest to write and maintain.
async function index() {
    console.log('1');
    await aaa();
    console.log('3');
}

You could use then() instead.
function index() {
    console.log('1');
    aaa().then(
        () => { console.log('3'); }
    );

}

A: Since aaa returns a Promise, you can always interact directly with that Promise instead of using await.  For example:
function index() {
  console.log('1');
  aaa().then(() => console.log('3'));
}

That way the code in the .then() callback won't execute until after the Promise returned by aaa() resolves.

For the most part, without peeking under the hood to the inner workings of JavaScript, async and await tends to just be a cleaner and simpler way of expressing this same thing.  For this simple example, there really shouldn't be a meaningful difference between this:
function index() {
  console.log('1');
  return aaa().then(() => console.log('3'));
}

And this:
async function index() {
  console.log('1');
  await aaa();
  console.log('3');
}

The main difference between these and the function at the top of this answer is that the one at the top doesn't advertise that it internally has asynchronous operations.  So it can't be awaited.  If that's not an issue for your needs, no big deal.  But even then, going with async and await still does the same thing and consuming code can simply choose not to await this function.


text:
Q: Best way to debug knockout data binding Could anyone recommend best ways to debug knockout.js data binding?
Its a bit time consuming to use console.log etc
What is current best practices in this area?
Thank you,
Pavel

A: Like the first comment suggests, the Chrome Dev Tools KnockoutJS Context Debugger is extremely useful.
You can also make custom binding handlers that dump out your view model (or parts of it) to JSON. The utility function ko.toJSON(viewmodel) can be of use in that regard


text:
Q: How to paint the region green? Please see the attachment ,i want to paint the region which covers R1 to be pink,
How can i paint it with polygon?
x = seq(-0.25, 2, by=0.01)
y1=x
y2=x^2
plot(x, y1,type="l",frame.plot=FALSE,axes=FALSE,xlab="",ylab="")
lines(x,y2,type="l",col="red")
xx1<-c(0,x[x<1  & x>0 ],1)
yy1<-c(0,x[x<1  & x>0 ],0)
polygon(xx1,yy1,col="yellow")
xx1<-c(0,x[x<1  & x>0 ],1)
yy2<-c(0,(x[x<1  & x>0 ])^2,0)
polygon(xx1,yy2,col="blue")
## write some text
text(1.1,1,labels="y=x",col="black")
text(0.8,1,labels="y=x^2",col="red")
text(0.7,0.2,labels="R3",col="black")
text(0.4,0.35,labels="R2",col="black")
text(0.2,0.5,labels="R1",col="black")
## draw axes lines with arrows
arrows(min(x), 0, max(x), 0)
arrows(0, min(x), 0, max(x))
## add axes ticks
axis(1,at=c(0,0.5,1,1.5),pos=0)
axis(2,at=c(0,0.5,1,1.5),pos=0)

A: Just colour in the triangle  (0, 0) -- (0, 1) -- (1, 1) ?
polygon(c(0, 0, 1), c(0, 1, 1), col='pink')


text:
Q: Apply multiple header styles in header "options" prop react native Here is my screen:

<Stack.Screen
    name="accountType"
    options={[({route} => {
    title: route.params.username,
    {headerStyle}

)]}>

As you  can see, I'm trying to include the route paramenter and my  headerStyle  variable together.
const headerStyle = {
    headerShown: true,
    headerTintColor: 'black',

    headerLeft: (props) => <BackArrow color={'black'} />,

    transitionSpec: {
      open: {
        animation: 'timing',
        config: {
          duration: 70,
        },
      },
      close: {
        animation: 'timing',
        config: {
          duration: 70,
        },
      },
    },
  };

Any idea how to make these work?

A: You can do like below, this will add the headerStyle along with the params
options={({ route }) => ({ title: route.params.username,...headerStyle })}

Full code would be like below
    <Stack.Screen
      name="accountType"
      component={AccountType}
      options={({ route }) => ({ title: route.params.username,...headerStyle })}
    />


text:
Q: AJAX loading strange error while submitting data Am using following code to create chat system and store data to txt file. it does what i need but there is a small error while submitting data, when i type text and hit enter AJAX loads data from file chatdata.txt for a second,
Index.html
<?php
session_start();
//Create a session of username and logging in the user to the chat room
if (filter_input(INPUT_POST, 'username')) {
    $_SESSION['username'] = filter_input(INPUT_POST, 'username');
}
//Unset session and logging out user from the chat room
if (isset($_GET['logout'])) {
    unset($_SESSION['username']);
    header('Location:index.php');
}
?>

        <title>Simple Chat Room</title>
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,400,300' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="css/style.css" />

                SIMPLE CHAT ROOM
                <?php // Adding the logout link only for logged in users   ?>
                <?php if (isset($_SESSION['username'])) { ?>
                    Logout
                <?php } ?>

            <?php //Check if the user is logged in or not  ?>
            <?php if (isset($_SESSION['username'])) { ?>

                    <form method="post" onsubmit="return submitchat();">
                        <input type='text' name='chat' id='chatbox' autocomplete="off" placeholder="ENTER CHAT HERE" />
                        <input type='submit' name='send' id='send' class='btn btn-send' value='Send' />
                        <input type='button' name='clear' class='btn btn-clear' id='clear' value='X' title="Clear Chat" />
                    </form>

                <?php } else { ?>

                        <form method="post">
                            <input type='text' class='input-user' placeholder="ENTER YOUR NAME HERE" name='username' />
                            <input type='submit' class='btn btn-user' value='START CHAT' />
                        </form>

                <?php } ?>

Chat.php
<?php
session_start();
$filename=$_SESSION['username'];
$nametxt= "$filename.txt";
$message='created successfully';

if (file_exists($nametxt)) {
  $fh = fopen($nametxt, 'a');
} else {
  $fh = fopen($nametxt, 'w');
  fwrite($fh, $message."\n");
}
fclose($fh);

if(filter_input(INPUT_POST, 'ajaxsend') && filter_input(INPUT_POST, 'ajaxsend')==true){
    // Code to save and send chat
    $chat = fopen($nametxt, "a");
    $data="".$_SESSION['username'].': '.filter_input(INPUT_POST, 'chat')."
";
    fwrite($chat,$data);
    fclose($chat);

    $chat = fopen("chatdata.txt", "r");
    echo fread($chat,filesize("$nametxt"));
    fclose($chat);
} else if(filter_input(INPUT_POST, 'ajaxget') && filter_input(INPUT_POST, 'ajaxget')==true){
    // Code to send chat history to the user
    $chat = fopen($nametxt, "r");
    echo fread($chat,filesize("$nametxt"));
    fclose($chat);
} else if(filter_input(INPUT_POST, 'ajaxclear') && filter_input(INPUT_POST, 'ajaxclear')==true){
    // Code to clear chat history
    $chat = fopen($nametxt, "w");
    $data="".$_SESSION['username'].' cleared chat
';
    fwrite($chat,$data);
    fclose($chat);
}

can someone help me sort error, why AJAX loads data from chatdata.txt while submitting data.

A: If you used index.html instead of index.php, this will not work!
Then after, You might have forgotten to change the "chatdata.txt" on line 22 to $nametxt.
I tried the change and it worked!!


text:
Q: plug-ins and shared object libraries I understand that plug-ins are components that are tasked with a specific function and loaded for use by an application.
Shared object libraries (.so) in linux and .dlls in windows are libraries that are loaded at run-time by an application.
I want to understand what if .dll / .so are always plug-ins. Are all plug-ins .dll / .sos?

A: Actually, .dll's and .so's are dynamic libraries. There are also other type libraries named static libraries. In Linux, their extension is .a.
Programmers tend to use libraries for maintaining their code easily. Also, if the library will be shared more than one application, shared library is chosen because of main memory usage.
You can apply this logic for a structure which contains plug-ins. If the code piece will be used only by your application's single process, you can use static library as your plug-in. However, if the code will be shared by multiple processes, you should use shared libraries, even if these process are instances of the same application.
When you use shared libraries as plug-ins, you must not include library as known methods and you must not link your executable directly to the library. Instead you must use libdl. Have a look at here and look for the dynamic loading.


text:
Q: Is there a way to get the Unity title bar behavior and NOTHING ELSE?
Possible Duplicate:
Is there a way to remove maximized window controls/title from top panel in Unity

I know how to get app menus in the panel. I like the fact that in Unity, the top panel effectively becomes the title bar for maximized windows. Apart from that, Unity is driving me up the pole. Is there a way to get the Unity window maximization behavior with Ubuntu "Classic"?

A: From a quick scout about it appears that unity isn't modular at present, so you can't have the globalmenu without unity.
But you can effectively remove the unity dock from your desktop.
Install CCSM apt-get install compizconfig-settings-manager
Under the Ubuntu Unity Plugin section make the following changes:

*

*Reveal Mode: Change this so that none of the edges are selected

*Set Hide Launcher to 'Auto-hide'

*Clear the short-cut keys

That will make the unity dock disappear immediately after launching.
You can then get your gnome-panels back by adding 'gnome-panel' to your start-up applications using the control centre.

A: You can always install just the globalmenu from here. It works in almost the same way as unity's - with the only difference being that it doesn't hide the menus when the mouse is far from the bar.
This way you can use the features classic has (more panels if you want to, applets on the panels etc) and have more space as well.
edit : i also found this which seems even easier than my first idea - simple 3-4 clicks at maximum


text:
Q: phpmailer taking 5 seconds.. yet php mail() taking less than 1 I am trying to send out mass emails and I am using phpmailer  class to send the emails and they are taking 5.2 seconds each to send!! Here is my code, any idea why its taking so long?
<?php

//============

        require '../includes/PHPMailer-master/PHPMailerAutoload.php';

        $time_start = microtime(true);

//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('support@site.com', 'site');
$mail->CharSet = 'UTF-8';
//Set an alternative reply-to address
$mail->addReplyTo('support@site.com', 'site');
//Set who the message is to be sent to
$mail->addAddress('email@gmail.com', 'Name');
//Set the subject line
$mail->Subject = 'subject ';
$mail->msgHTML('test');
//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}

            $time_end = microtime(true);
    $time = $time_end - $time_start;
    echo "Process Time 3: {$time} <br/>";
    // Process Time: 1.0000340938568

?>

A: To get a more accurate picture of what's going on, use a profiler - it will make it immediately obvious where the time is going. I recommend xdebug with qcachegrind, or PHPStorm.
You'll often find that SMTP to localhost is faster than you expect - when you call sendmail with postfix, the sendmail binary makes an SMTP connection to localhost anyway, so you can reduce overhead by using SMTP directly. See the postfix docs for more on that.
msgHTML() does various things you may not need - setting Body and AltBody directly will be faster.
As others have mentioned, if you want to send quantity, much of the overhead can (and should) be moved outside the sending loop, and you can gain from things like keepalive.
Make sure you're using the latest PHPMailer - there were some fairly big speedups in recent versions, especially in SMTP.

A: $mail->IsSMTP();

change it to:
$mail->IsMail();  // set mailer to use Mail


text:
Q: How to put indicator between yAxis values on yAxis chartJs? I have a line chart like below

As you can see there is a gap between 0-0.7.I want to put an indicator like below

So the expected one is this

to draw something on the chart ,ChartJs has annotations and I tried something like below but couldnt set interval to draw lines
   annotation: {
  annotations: [{
            drawTime: 'afterDraw', // overrides annotation.drawTime if set
            id: 'a-line-1', // optional
            type: 'line',
            mode: 'vertical',
            scaleID: 'y-axis-0',
    value: 0,
    borderColor: '#000',
            borderWidth: 2,
        }]
  }

There are no accepted values like yMax and yMin on line drawing so I couldnt figure it out how to do that.I'd be appreciate if someone could help me with this.
Fiddle link : http://jsfiddle.net/3du6ya1c/

A: The Plugin Core API offers a range of hooks that may be used for performing custom code. You can use the afterDraw hook to draw an image directly on the canvas using CanvasRenderingContext2D as follows.
plugins: [{
  afterDraw: chart => {
    var ctx = chart.chart.ctx;
    ctx.save();
    var xAxis = chart.scales['x-axis-0'];
    var yAxis = chart.scales['y-axis-0'];
    var image = new Image();
    image.src = 'https://i.stack.imgur.com/zyhEv.png',
    ctx.drawImage(image, xAxis.left - 11, yAxis.bottom - 16, 20, 10);
    ctx.restore();
  }
}],

Please take a look at the following runnable code and see how it works.

new Chart(document.getElementById("myChart"), {
  type: "line",
  plugins: [{
    afterDraw: chart => {
      var ctx = chart.chart.ctx;
      ctx.save();
      var xAxis = chart.scales['x-axis-0'];
      var yAxis = chart.scales['y-axis-0'];
      var image = new Image();
      image.src = 'https://i.stack.imgur.com/zyhEv.png',
      ctx.drawImage(image, xAxis.left - 10, yAxis.bottom - 16, 20, 10);
      ctx.restore();
    }
  }],
  data: {
    labels: ["January", "February", "March", "April", "May", "June", "July"],
    datasets: [{
      label: "APAC RE index",
      data: [0.7, 0.8, 0.9, 1, 0.9, 0.8, 0.7],
      fill: false,
      borderColor: "rgb(255, 0, 0)"
    }]
  },
  options: {
    legend: {
      display: false
    },
    scales: {
      yAxes: [{
        ticks: {
          min: 0.65,
          stepSize: 0.1,
          callback: (value, index, values) => index + 1 == values.length ? 0 : value
        }
      }]
    }
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<canvas id="myChart" height="90"></canvas>

~

A: try using box annotation and assign the y-axis and x-axis range to it.
annotation: {
      annotations: [{
        drawTime: 'afterDraw', // overrides annotation.drawTime if set
        id: 'a-line-1', // optional
        type: 'box',
        borderWidth: 10,
        borderColor: 'green',
        xScaleID: 'x-axis-0',
        yScaleID: 'y-axis-0',
        xMin: "January",
        xMax: "January",
        yMax: 0.7,
        yMin: 0.0,
      }]
    }

here is the fiddle


text:
Q: How do I change the line color of the tensorboard? After two training, I recorded the errors on the tensorboard.
The picture below is that.

Both lines are orange and difficult to distinguish.
The smaller of the two lines is the first experiment, the larger the error is the second experiment.
How can I set the line color differently each time I learn?
And if you look at the picture above, how do you get rid of a straight line?
Finally, if you look at the picture, there is a faint afterimage. I want to get rid of this.
Thanks you.

A: You have to write the results of each experiment to a different subdirectory, using a different writer. TensorBoard will present the logs from each subdirectory with different colors and with their names on the left.
The straight lines are for the same reason, TensorBoard thinks it's all a single experiment, so it jumps from step 60k to step 0 (because logs were written in that order).


text:
Q: How to take the average from one worksheet with variable number of rows and get it onto another? Looking to take the average of a column of data that has a variable number of rows from one sheet, and then paste that average onto another sheet within the same workbook. Any suggestions?
To add, I want to take the average of a variable number of rows with 33 different columns from one worksheet and put the average from each of those columns into one cell of another worksheet (C3 through C35).
For reference, this is the sheet that has 33 other columns of data like these. the number of rows is variable depending on how long the data was collected. I want to take the average of one column, and display that average in the corresponding cell like this. I have 33 columns, so that would give me 33 different averages to go into this other sheet.

A: You could consider passing the entire range of values in the column into a dynamic array, and then use the average worksheet function.
For example:
Sub Test()

    Dim x As Variant

    Worksheets(1).Select
    x = Range("A1", Range("A1").End(xlDown))
 'assuming your values are in column A and the first cell is A1, and that there are no blank rows

    Worksheets(2).Range("A1").Value = Application.WorksheetFunction.Average(x)
'assuming you want to paste the average value on cell A1 of the second worksheet

End Sub

A: You could also use dynamic ranges with the OFFSET function.
You'll have to create one dynamic range per column you want to average.
Go to Formulas tab -> Defined Ranges -> Name Manager -> New
In "Name:" add a name to you dynamic range to be used in other formulas. This name can be used in any sheet. In my example, I used RngToAverage`. Other ranges should have other names.
In "Refers to:" =OFFSET(Sheet1!$A$1;0;0;COUNT(Sheet1!$A:$A);1)

My example function will work only for column A, and the reference is the cell A1.
Reference for OFFSET use: https://exceljet.net/formula/dynamic-named-range-with-offset

A: This is a basic loop to insert the average of each column from the data worksheet into the second worksheet in Column C.  You will need to change the worksheet names as needed. It assumes that the data in the first worksheet starts at Column B and Row 2. Comments are provided within the code. If you have any questions, please ask.
 'Define the worksheet variables
Dim ws1 As Worksheet: Set ws1 = ThisWorkbook.Sheets("Sheet1") 'Change "Sheet1" to the name of the sheet with data
Dim ws2 As Worksheet: Set ws2 = ThisWorkbook.Sheets("Sheet2") 'Change "Sheet1" to the name of the sheet to put the averages

'This code assums that '"Compressor Discharge Press." is in Column B of the first worksheet and data starts on row 2 (clarify if the column and row are different)
'Loop through column C in the second worksheet, startting at row 2, and inserts the average for the corresponding column(with variable row counts) in the first worksheet

    For x = 2 To 34
        ws2.Cells(x, "C").Value = Application.WorksheetFunction.Average(ws1.Range(ws1.Cells(2, x), ws1.Cells(ws1.Rows.Count, x).End(xlUp)))
    Next x


text:
Q: Apache Oltu OAuthClient.accessToken() fails with timeout I'm trying to login users using Google OpenID.
When I try to authenticate a user, I always run into a timeout when trying to retrieve the AccessToken.
public class TestRun {
    public static void main(String args[]) throws OAuthSystemException, OAuthProblemException {
        OAuthClientRequest request = OAuthClientRequest
                .tokenProvider(OAuthProviderType.GOOGLE)
                .setGrantType(GrantType.AUTHORIZATION_CODE)
                .setCode("")
                .setRedirectURI(Env.REST_API_LOCATION+"/login")
                .setClientId(Env.CLIENT_ID)
                .setClientSecret(Env.CLIENT_SECRET)
                .buildQueryMessage();

        OAuthClient oac = new OAuthClient(new URLConnectionClient());
        OAuthAccessTokenResponse response = oac.accessToken(request);
        System.out.println(response.getAccessToken());
        System.out.println(response.getExpiresIn());
    }
}

I always run into a ConnectException (timeout) when oac.accessToken(request) is called and don't get any more info about what's happening.

A: So, the problem is simple. The system on which my software runs is accessible from the internet, but outbound traffic is forced to use a proxy. As the proxy isn't a transparent one, I had to write my own implementation of HttpClient which is able to deal with a proxy and replace URLConnectionClient with it.


text:
Q: Issue with date-picker duration There is some kind of "campaign duration" which means you are able to choose date between first and last day in month. If you choose date which is not between first and last day in month, for example some date from next month, the Backend API will return an "Input param error".
Current works like when I choose the last date inside date selector(30th day in month), the Backend API will return an "Input param error".
That means he count 30th day like 1st day in next month.
I should Change date selection with one day less.
Question is where in code I should subtract for 1-day that "endDate"-property?
HTML part of this modal in which is this date picker:
(You can see endDate there, I want to subtract that endDate for 1-day)
  <!-- startDate/endDate -->
        <div class="nano-f-r nano-f">
            <nano-date-picker [(startDate)]="campaignDto.dtoData.startDate"
                              [(endDate)]="campaignDto.dtoData.endDate"
                              [intervalMode]="campaignDto.id === 'new' ? dpIntervalFuture : dpIntervalBoth"
                              [maxIntervalDurationInMonths]="2"
                              style="height: 30px"></nano-date-picker>
        </div>
    </div>

nano-date-picker component:
   public isDaySelected(day: MonthDay): boolean {
    return this.isDateRange === true
        ? day.startDate === this.datePicker.startDate || day.endDate === this.datePicker.endDate
        : day.startDate === this.datePicker.startDate;
}

public ngOnChanges(): void {
    const startDate = this.startDate ? moment(this.startDate).format() : moment().startOf('day').format();
    const endDate = this.endDate ? moment(this.endDate).format() : moment(startDate).endOf('day').format();
    this.datePicker = new DatePicker(startDate, endDate);
    this.setDatePicker();

    if (this.continiousDatesValue !== null) {
        this.continiousDatesValueMoment = moment(this.continiousDatesValue);
    }
    if (this.previousDatesValue !== null) {
        this.previousDatesValueMoment = moment(this.previousDatesValue);
    }
}

private onDatesChange(): void {
    this.startDateChange.emit(this.datePicker.startDate);
    this.endDateChange.emit(this.datePicker.endDate);
    this.startEndDateChange.emit({startDate: this.datePicker.startDate, endDate: this.datePicker.endDate});
    this.isOpen = false;
}

public setRange(day: MonthDay): void {
    if (this.isDateRange === true) {
        this.datePicker.setRange(day, () => this.onDatesChange())
    } else {
        this.datePicker.setSingleDate(day, () => this.onDatesChange())
    }
}

Here is how looks that date picker:

A: You should subtract day in both ngOnChanges and in onDatesChange.
EDIT
You should subtract you date here:
this.datePicker = new DatePicker(startDate, endDate);

This end date need to be subtracted like this:
endDate.setDate(endDate.getDate() - 1);
this.datePicker = new DatePicker(startDate, endDate);


text:
Q: Sphinx documentation: split a python source into sections, using autodoc I'm using Sphinx with autodoc to document my sources.
Lets say I have a file pre_processing.py, containing 3 classes.
I would like to have section in the generated HTML files, like this
Main
====
Topic1
------
blabla
Here is included class1 and class2 doc

Topic2
------
blibli
Here is included class3 doc

However , all that I can manage so far is this:
Main
====
Topic1
------
blabla
Here is a link to  class1 and class2 doc

Topic2
------
blibli
Here is a link to class3 doc

Here is cdumped class1, class2 and class3

How can this be achieved please? Do I have to abandon autodoc, and fill my rst file manually ?

A: You can do that, by putting your outline (and accompanying text) into the docstring of the module itself. Let's say this is your pre_processing.py:
# yada yada license yada
"""
Main
====
Topic1
------
blabla

.. autoclass:: class1

.. autoclass:: class2

Topic2
------
blibli
Here is a link to class3 doc
"""

class class1(…):
    """
    docstring of class 1
    """

…

Then you can simply use .. automodule: in your .rst file:
.. automodule:: pre_processing

That will first read the docstring of the module and generate the documentation from there. Due to the autoclass directives in there, the classes are also documented.


text:
Q: Access a dictionary inside a script tag using beautiful soup from urllib.request import urlopen
from bs4 import BeautifulSoup
import lxml
import time #to add delay

url ='https://www.fundoodata.com/companies-detail/Banctec-Tps-India-Pvt-
Ltd/48600.html' #from where i need data
html = urlopen(url)
soup = BeautifulSoup(html, 'lxml')
type(soup)
links= soup.find('script')
print(links)

this gives-->
<script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "Organization",
        "address": {
        "@type": "PostalAddress",
        "addressLocality": "3rd Floor, Sharda Arcade, Pune Satara Road,
Bibvewadi",
        "postalCode": "411016 ",
        "streetAddress": " Pune/Maharashtra "
      },
      "name": "Banctec Tps India Pvt Ltd",
      "telephone": "(020) "
    }
    </script>

i need to print out the address dictionary which is inside a dictionary, i need to access the addressLocality, postal code, streetaddress.
tried differnt methods and failed.

A: String of JSON formatted data in Python, deserialize that with json.loads()
import json
links= soup.find('script')
print(links)

after this,
address = json.loads(links.text)['address']
print(address)

A: Use the json package:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import lxml
import time #to add dealay
import json

url ='https://www.fundoodata.com/companies-detail/Banctec-Tps-India-Pvt-Ltd/48600.html' #from where i need data
html = urlopen(url)
soup = BeautifulSoup(html, 'lxml')
type(soup)
links= soup.find_all('script')
print(links)

for script in links:
    if '@context' in script.text:
        jsonStr = script.string
        jsonObj = json.loads(jsonStr)

print (jsonObj['address'])

Output:
print (jsonObj['address'])
{'@type': 'PostalAddress', 'addressLocality': '3rd Floor, Sharda Arcade, Pune Satara Road, Bibvewadi', 'postalCode': '411016 ', 'streetAddress': ' Pune/Maharashtra '}

A: Use the string property to get the text of the element, then you can parse it as JSON.
links_dict = json.loads(links.string)
address = links_dict['address']

A: Often times script tags contain a lot of javascript fluff. You can use regex to isolate the dictionary:
scripts = s.findAll('script')
    for script in scripts:
        if '@context' in script.text:

            # Extra step to isolate the dictionary.
            jsonStr = re.search(r'\{.*\}', str(script)).group()
            # Create dictionary
            dct = json.loads(jsonStr)

print(dct['address'])


text:
Q: Program doesn't run in Eclipse I'm learning Java and one of the examples of the book runs perfectly from command line, but throws an error from Eclipse. The script is this:
    /**
     * This program displays a greeting from the authors.
     * @version 1.20 2004-02-28
     * @author Cay Horstmann
     */
    public class Welcome
    {
       public static void main(String[] args)
       {
          String[] greeting = new String[3];
          greeting[0] = "Welcome to Core Java";
          greeting[1] = "by Cay Horstmann";
          greeting[2] = "and Gary Cornell";

          for (String g : greeting)
          System.out.println(g);
       }
    }

The error I get in Eclipse is
'Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error, 'for each' statements are only available if source level is 1.5 or greater'
The book says I would get an error in that line (the for) if the JDK was too old, but then why does it run well from the command line?
Thanks

A: The reason is because your Eclipse instance uses a different version of Java compared to when run from the command line.
In order to check which java version is being used as default, type java -version on the command prompt
C:>java -version

java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) Client VM (build 20.45-b01, mixed mode, sharing)

In order to check the Java version that your eclipse instance uses, check out
Welcome Project-->Properties--> Java Build Path--> Libraries--> JRE System Library.

You can verify the Java version for your project from the package explorer as well.

A: Right click on your project --> properties and change version in below screen


text:
Q: Error in files[[i]] : subscript out of bounds It shows subscript out of bound and then error in tmp . How to resolve this

data <- list()
for (i in 1:length(files)) {
data[[i]] <- readRDS(files[[i]])
}
Error in files[[i]] : subscript out of bounds
names(data) <- names
for (i in 1:length(files)) {data[[i]][["sample"]] <- names[[i]]}
**Error in names[[i]] : subscript out of bounds
**> names(data) <- names
library(future)
plan("multicore", workers = 16)
options(future.globals.maxSize = 2000 * 1024^2)
library(ggplot2)
anchors <- FindIntegrationAnchors(object.list = data, dims = 1:20)
Computing 2000 integration features
Error in *tmp*[[ii]] :
attempt to select less than one element in integerOneIndex

I am running scRNASeq pipeline and got this error in the beginning steps


text:
Q: Weakly contractible cover in étale homotopy theory It is easy enough to construct the separable closure $k^{sep}$ of a field $k$, which then has $\pi_0(k^{sep}) = 0$ (profinite set of connected components), $\pi_1(k^{sep}) = 0$ (there are no nontrivial finite étale extensions of $k^{sep}$).
Let $B$ be a connected scheme. How do I construct a smooth (or formally smooth) map $E \rightarrow B$ such that $E$ has weakly contractible étale homotopy type?
This would be like a universal cover, but for the higher étale homotopy groups.


text:
Q: Compilation failed to complete:Program type already present: com.google.android.gms.internal.measurement.zzabn When compiling my project I get the following error message:
Program type already present: com.google.android.gms.internal.measurement.zzabn Message{kind=ERROR, text=Program type already present: com.google.android.gms.internal.measurement.zzabn, sources=[Unknown source file], tool name=Optional.of(D8)}

or
D8: Program type already present: com.google.android.gms.internal.measurement.zzabo

With the following stacktrace in the Gradle Log
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:212)\\nat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745) Caused by: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\0.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\4.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\6.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\7.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\8.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\9.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\10.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\12.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\13.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\14.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\17.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\18.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\19.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\20.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\21.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\22.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\23.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\24.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\25.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\26.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\27.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\28.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\29.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\30.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\31.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\32.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\34.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\39.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\40.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\44.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\45.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\46.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\47.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\48.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\49.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\51.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\52.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\53.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\55.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\56.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\57.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\58.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\59.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\83.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\84.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\85.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\86.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\87.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\88.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\89.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\90.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\91.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\92.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\93.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\94.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\95.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\96.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\97.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\100.jar, D:\Android\appName\app\build\intermediates\transforms\dexBuilder\debug\101.jar
at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:124)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:109)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:101)
at com.android.build.gradle.internal.transforms.ExternalLibsMergerTransform.transform(ExternalLibsMergerTransform.kt:123)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:221)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:217)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)   ... 48 more Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:76)
at com.android.tools.r8.utils.ExceptionUtils.withD8CompilationHandler(ExceptionUtils.java:45)
at com.android.tools.r8.D8.run(D8.java:67)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:107)  ... 53 more Caused by: com.android.tools.r8.utils.AbortException
at com.android.tools.r8.utils.Reporter.failIfPendingErrors(Reporter.java:77)
at com.android.tools.r8.utils.Reporter.fatalError(Reporter.java:58)
at com.android.tools.r8.utils.ExceptionUtils.withCompilationHandler(ExceptionUtils.java:67)     ... 56 more

A: For those who are facing this issue with the latest Firebase versions as today Nov 8th, 2018. I fixed the conflict by downgrading the firebase-ads library while keeping the rest using the latest versions.
I changed from:
googleImplementation "com.google.firebase:firebase-core:16.0.5"
googleImplementation "com.google.firebase:firebase-ads:17.0.0"  //CONFLICTING VERSION
googleImplementation "com.google.firebase:firebase-config:16.1.0"
googleImplementation "com.google.firebase:firebase-messaging:17.3.4"

To:
googleImplementation "com.google.firebase:firebase-core:16.0.5"
googleImplementation "com.google.firebase:firebase-ads:15.0.1"  //WORKING VERSION
googleImplementation "com.google.firebase:firebase-config:16.1.0"
googleImplementation "com.google.firebase:firebase-messaging:17.3.4"

Also, note that on the Project's root build.gradle I'm using the following google services version com.google.gms:google-services:4.2.0.
I tried a few approaches, analyzing the dependencies tree, excluding the modules with the mentioned program, but they ended up crashing on runtime. The safest solution I found was using the 15.0.1 for the firebase-ads

A: In my case problem is same.I followed below steps:
1.build.gradle(gradle)
change :
  classpath 'com.google.gms:google-services:3.2.0'

To :
  classpath 'com.google.gms:google-services:3.2.1'

2.build.gradle(module)
    implementation 'com.google.firebase:firebase-core:15.0.2'
    implementation 'com.google.firebase:firebase-messaging:15.0.2'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'

for google location and places :
  implementation 'com.google.android.gms:play-services-location:15.0.1'
  implementation 'com.google.android.gms:play-services-places:15.0.1'

A:
Latest Firebase SDK versions

Service                     Gradle dependency

Firebase Core               com.google.firebase:firebase-core:16.0.1
Ads                         com.google.firebase:firebase-ads:15.0.1
Analytics                   com.google.firebase:firebase-analytics:16.0.0
App Indexing                com.google.firebase:firebase-appindexing:16.0.1
Authentication              com.google.firebase:firebase-auth:16.0.2
Cloud Firestore             com.google.firebase:firebase-firestore:17.0.2
Cloud Functions             com.google.firebase:firebase-functions:16.0.1
Cloud Messaging             com.google.firebase:firebase-messaging:17.0.0
Cloud Storage               com.google.firebase:firebase-storage:16.0.1
Crash Reporting             com.google.firebase:firebase-crash:16.0.0
Crashlytics                 com.crashlytics.sdk.android:crashlytics:2.9.3
Invites                     com.google.firebase:firebase-invites:16.0.1
ML Kit: Model Interpreter   com.google.firebase:firebase-ml-model-interpreter:16.0.0
ML Kit: Vision              com.google.firebase:firebase-ml-vision:16.0.0
ML Kit: Image Labeling      com.google.firebase:firebase-ml-vision-image-label-model:15.0.0
Performance Monitoring      com.google.firebase:firebase-perf:16.0.0
Realtime Database           com.google.firebase:firebase-database:16.0.1
Remote Config               com.google.firebase:firebase-config:16.0.0

Update - June 21, 2018

Cloud Firestore version 17.0.2

gRPC requirement updated from 1.8.0 to 1.12.0. This allows quicker failover between Wi-Fi and cellular networks.

Invites version 16.0.1

Fixed incompatibility with firebase-core 16.0.1.

A: The problem is caused because Firebase started versioning the libraries separately. Updating everything to latest version solves the issue.
Update the google play gradle plugin version to latest version, currently 4.0.1.
In project level build.gradle file:
classpath 'com.google.gms:google-services:4.0.1'

Information about latest version of google gradle plugin is available at:
https://bintray.com/android/android-tools/com.google.gms.google-services/
And use the latest versions of individual libraries in app level build.gradle file:
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
implementation 'com.google.firebase:firebase-messaging:15.0.2'

Information about latest versions of individual libraries available at:
https://firebase.google.com/support/release-notes/android and
https://developers.google.com/android/guides/setup

A: The above error has appeared today after rebuilding application, as if the new update to classpath: 'com.google.gms:google-services:3.1.0'
to
classpath: 'com.google.gms:google-services:3.2.0'
has helped solving my problem.
In addition, other answers mentioned in this post may also help, it depends on the version of google com.google.firebase packages used, i tried to update firebase packages to their latest version.
Also you may refer to the following question and get help from the answers mentioned.
Also i have added the following to the project gradle file in the repositories section
maven{
url  "https://dl.bintray.com/android/android-tools"
}

A: Firebase did an update to the SDK:

Firebase Android SDKs now have independent version numbers, allowing for more frequent, flexible updates.

Update all your Firebase dependencies to use the latest version:
Firebase Core           com.google.firebase:firebase-core:15.0.2
Ads                     com.google.firebase:firebase-ads:15.0.0
Analytics               com.google.firebase:firebase-analytics:15.0.2
App Indexing            com.google.firebase:firebase-appindexing:15.0.0
Authentication          com.google.firebase:firebase-auth:15.1.0
Cloud Firestore         com.google.firebase:firebase-firestore:16.0.0
Cloud Functions         com.google.firebase:firebase-functions:15.0.0
Cloud Messaging         com.google.firebase:firebase-messaging:15.0.2
Cloud Storage           com.google.firebase:firebase-storage:15.0.2
Crash Reporting         com.google.firebase:firebase-crash:15.0.2
Crashlytics             com.crashlytics.sdk.android:crashlytics:2.9.1
Invites                 com.google.firebase:firebase-invites:15.0.1
Performance Monitoring  com.google.firebase:firebase-perf:15.1.0
Realtime Database       com.google.firebase:firebase-database:15.0.0
Remote Config           com.google.firebase:firebase-config:15.0.2

More information is here:
https://firebase.google.com/support/release-notes/android
Please also update google-services plugin:
classpath 'com.google.gms:google-services:3.3.1'

You can find the latest google-services clicking HERE
Also check this link to understand the changes and follow the steps listed in the article:
Announcing the new SDK Versioning
EDITED ON: 27 NOVEMBER 2019
As of today, the latest version for google-services Plugin is 4.3.3. So, your dependency would look like
classpath 'com.google.gms:google-services:4.3.3'

A: Please upgrade classpath of build gradle and google services as follows
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:3.3.0'

A: 1. Update google.gms version to latest version
At the time of answer latest is 4.1.0.
buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:4.1.0' // google-services plugin
    }
}

allprojects {
    // ...
    repositories {
        // ...
        google() // Google's Maven repository
    }
}

2. Update firebase dependencies to latest version
Update below dependency if you use any. Note that firebase has individual versions for every dependency now.
Use latest Firebase Libraries. At the time of answer latest versions are below.
Firebase Core                com.google.firebase:firebase-core:16.0.3
Ads                          com.google.firebase:firebase-ads:15.0.1
Analytics                    com.google.firebase:firebase-analytics:16.0.3
App Indexing                 com.google.firebase:firebase-appindexing:16.0.1
Authentication               com.google.firebase:firebase-auth:16.0.3
Cloud Firestore              com.google.firebase:firebase-firestore:17.1.0
Cloud Functions              com.google.firebase:firebase-functions:16.1.0
Cloud Messaging              com.google.firebase:firebase-messaging:17.3.2
Cloud Storage   c            om.google.firebase:firebase-storage:16.0.2
Crash Reporting              com.google.firebase:firebase-crash:16.2.0
Crashlytics                  com.crashlytics.sdk.android:crashlytics:2.9.5
Dynamic Links                com.google.firebase:firebase-dynamic-links:16.1.1
Invites                      com.google.firebase:firebase-invites:16.0.3
In-App Messaging             com.google.firebase:firebase-inappmessaging:17.0.1
In-App Messaging Display     com.google.firebase:firebase-inappmessaging-display:17.0.1
ML Kit: Model Interpreter    com.google.firebase:firebase-ml-model-interpreter:16.2.0
ML Kit: Vision               com.google.firebase:firebase-ml-vision:17.0.0
ML Kit: Image Labeling       com.google.firebase:firebase-ml-vision-image-label-model:15.0.0
Performance Monitoring       com.google.firebase:firebase-perf:16.1.0
Realtime Database            com.google.firebase:firebase-database:16.0.2
Remote Config                com.google.firebase:firebase-config:16.0.0

3. Don't forget google plugin
Also don't forget to add apply plugin: 'com.google.gms.google-services' at bottom of app level build.gradle.
Sync and Build...


text:
Q: Can we build RequestSpecification of io.restassured in step by step manner? I am forming io.restassured request/response in following manner
    Response response = RestAssured.given().headers("Authorization", "Bearer    token).contentType(ContentType.JSON).body(tempJsonString).post(MY_ENDPOINT).
    andReturn();

I want to create the request in step by step manner for e.g.,
    //Authorization
     RequestObject request = RestAssured.given().headers("Authorization", "Bearer"+token);
    //Adding body; tempJsonString is already defined
    request = request.body(tempJsonString);
    //Adding HTTP Verb; MY_ENDPOINT is already defined
    request = request.post(MY_ENDPOINT)
    //Finally
    Response response = request().andReturn();

Is it possible in io.restassured DSL?

A: You can use io.restassured.builder.RequestSpecBuilder class
RequestSpecBuilder requestBuilder = new RequestSpecBuilder();
requestBuilder.setBaseUri("http://www.example.com");
requestBuilder.setBasePath("/path");
requestBuilder.addHeader("Authorization", "Bearer" + token);
RequestSpecification request = RestAssured.given().spec(requestBuilder.build()).when();
Response response = request.post().andReturn();


text:
Q: Handler method in Spring Boot with Jersey not found in test Spring Boot / Jersey can not find a handler method when the application is startet and accessed from a test. If I start the application separately and access http://localhost:8080/demo with a browser everything is fine.
The log says: "Did not find handler method for [/demo]". The relevant logging output:
2018-06-18 17:04:31.071 DEBUG 7628 --- [nio-8080-exec-1] o.s.web.reactive.DispatcherHandler       : Processing GET request for [http://localhost:8080/demo]
2018-06-18 17:04:31.083 DEBUG 7628 --- [nio-8080-exec-1] s.w.r.r.m.a.RequestMappingHandlerMapping : Looking up handler method for path /demo
2018-06-18 17:04:31.085 DEBUG 7628 --- [nio-8080-exec-1] s.w.r.r.m.a.RequestMappingHandlerMapping : Did not find handler method for [/demo]
2018-06-18 17:04:31.087 DEBUG 7628 --- [nio-8080-exec-1] o.s.w.r.handler.SimpleUrlHandlerMapping  : Matching pattern for request [[path='/demo']] is /**

The application consists of the following classes (written in Kotlin):
Resource
import org.springframework.stereotype.Component
import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.core.Response

@Component
@Path("/")
class Resource {

    @GET
    @Path("demo")
    fun test() = Response.ok("Hi!").encoding("UTF-8").build()
}

JerseyConfig
import org.glassfish.jersey.server.ResourceConfig
import org.springframework.stereotype.Component

@Component
class JerseyConfig : ResourceConfig() {

    init {
        register(Resource::class.java)
    }
}

App:
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class App

fun main(args: Array<String>) {
    runApplication<App>(*args)
}

The failing test:
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.TestInstance
import org.junit.jupiter.api.extension.ExtendWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit.jupiter.SpringExtension
import org.springframework.test.web.reactive.server.WebTestClient

@ExtendWith(SpringExtension::class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
class ResourceTest {

    @Autowired
    lateinit var client: WebTestClient

    @Test
    fun getTest() {
        client.get().uri("demo").exchange().expectStatus().isOk
    }
}

I get the same error, if I use the Jersey client for testing:
@Test
fun testWithJersey() {
    val client = ClientBuilder.newClient()
    val response = client.target("http://localhost:8080/demo").request().get()
    assertThat(response.status).isEqualTo(200)
}

build.gradle:
buildscript {
    ext {
        kotlinVersion = '1.2.50'
        springBootVersion = '2.0.3.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
        classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
    }
}

apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

compileKotlin {
    kotlinOptions {
        freeCompilerArgs = ["-Xjsr305=strict"]
        jvmTarget = "1.8"
    }
}
compileTestKotlin {
    kotlinOptions {
        freeCompilerArgs = ["-Xjsr305=strict"]
        jvmTarget = "1.8"
    }
}

repositories {
    mavenCentral()
}

dependencies {
    compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    compile("org.jetbrains.kotlin:kotlin-reflect")
    compile('org.springframework.boot:spring-boot-starter-jersey')
    testCompile("org.springframework.boot:spring-boot-starter-test") {
        exclude group: "junit", module: "junit"
    }
    testCompile('org.springframework.boot:spring-boot-starter-webflux')
    testCompile("org.junit.jupiter:junit-jupiter-api")
    testRuntime("org.junit.jupiter:junit-jupiter-engine")
}

The test code itself seems to be ok, since when I replace the body of the test method with Thread.sleep(...) and then access the server from a browser, I get the same error (404 due to "Did not find handler method for [/demo]").
Why is the handler method not found in tests? What do I have to change?

A: Are you sure WebTestClient is a universal client (that makes actual network requests) and not only meant to be used with Spring MVC like MockMvc is? The error sounds like it is looking for a Spring MVC handler method. If it was a universal client, the error message wouldn't say anything about handler methods, but instead probable say something about the URL.
I would imagine that you need to make an actual network request with a real client. For instance if you used the Jersey client, you could do something like
@LocalServerPort
private int port;

private Client client = ClientBuilder.newClient();

@Test
public void testCustomerLocationOnPost() {
    URI resourceUri = UriBuilder.fromUri("http://localhost")
            .port(port).path("demo").build();

    Respons response = client.target(resourcrUri).request().get();

    assertThat(response.getStatus()).isEqualTo(200);

}

A: With the help of the amazing guys from Pivotal I've solved the problem: WebTestClient needs WebFlux as a dependency. But WebFlux brings not only a little test helper but a full blown web framework what gets automagically configured by Spring Boot and is in conflict with Jersey.
The solution is to remove WebFlux from the dependencies
dependencies {
    compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
    compile("org.jetbrains.kotlin:kotlin-reflect")
    compile('org.springframework.boot:spring-boot-starter-jersey')
    testCompile("org.springframework.boot:spring-boot-starter-test") {
        exclude group: "junit", module: "junit"
    }
    testCompile("org.junit.jupiter:junit-jupiter-api")
    testRuntime("org.junit.jupiter:junit-jupiter-engine")
}

and use, for example, the Jersey http client:
@ExtendWith(SpringExtension::class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
class ResourceTest {

    @Test
    fun testWithJerseyClient() {
        val client = ClientBuilder.newClient()
        val response = client.target("http://localhost:8080/demo").request().get()
        assertThat(response.status).isEqualTo(200)
    }
}

But any other http client will do as long as WebFlux is not a dependency.
Update: This is a bug in Spring Boot that will be fixed in Spring Boot 2.0.4! Then you can use WebFlux for testing along with Jersey on the server side.


text:
Q: I am getting these error a lot in django running on my ubuntu pc Though i stop the all server still i am getting these error
enter image description here

A: You have to run this command: python manage.py migrate.
If the port is already used then first kill process of that port and try again python manage.py runserver

A: To solve Error: That port is already in use, make sure that you have no other applications running that are using 127.0.0.1:8000.  If you need help doing that, please see this question.
If that doesn't solve the issue, you can try killing all python process by running killall python.
If that still doesn't work, you can run the server on a different port: python manage.py runserver 7069
(you also need to run python manage.py migrate to apply your migrations)


text:
Q: Gulp concat and minify with a watch task I'm trying to setup a some Gulp tasks. I want to concatenate some JS files, minify them to create 1 JS file, but I want this done each time a change has been made in the original JS files but I can't seem to get the 'watch' task running properly
This is my Gulpfile.js
gulp.task('minify', ['watch', 'scripts'], function(){
  gulp.src('themes/corp-fluid/js/dist/**/*.js')
          .pipe(minify({
            ext:{
              src:'-debug.js',
              min:'.js'
            },
            ignoreFiles: ['-min.js']
          }))
          .pipe(gulp.dest('themes/corp-fluid/js/dist'));
});

gulp.task('scripts', function(){
  return gulp.src(['themes/corp-fluid/js/slick.js', 'themes/corp-fluid/js/functions.js'])
          .pipe(concat('main.js'))
          .pipe(gulp.dest('themes/corp-fluid/js/dist'));
});

gulp.task('watch', function(){
  gulp.watch('themes/corp-fluid/js/**/*.js');
});

A: A couple of things.  You need to call something in your
'watch' task, so
gulp.task('watch', function(){
  gulp.watch('themes/corp-fluid/js/**/*.js', ['minify']);
});

and simplify the first line of your 'minify' task to
gulp.task('minify', ['scripts'], function(){

you don't need to call the 'watch' task again there.  And finally you would be running the whole thing with
gulp watch

A: Gulpfile with  sass, js concat, minify, and watch task.
You need change proxy domain name to yor domain name in browser-sync task, and change array of files in concat_js task.

var gulp = require('gulp')
var browserSync = require('browser-sync')
var sass = require('gulp-sass')
var concat = require('gulp-concat');
var minify = require('gulp-minify');

//Sass
gulp.task('sass', function () {
    return gulp.src('app/sass/**/*.scss')
            .pipe(sass())
            // pipe(gulp.dest('app/css'))
            .pipe(gulp.dest('app/css/'))
});

//browser reload
gulp.task('browser-sync', function () {
    browserSync({
        notify: false,
        proxy: "http://front-end" //Your domain name
    });
});

//concat
gulp.task('concat_js', function() {
  //An array of files is required for the correct order of contact
  return gulp.src(['app/js/_helpers.js',
                   'app/js/_cookie_notice.js']) //file array need for
    .pipe(concat('all.js'))
    .pipe(minify({
        ext:{
            src:'',
            min:'.min.js'
        },
        noSource: true}))
    .pipe(gulp.dest('app/js/'));
});

//watch
gulp.task('watch', ['browser-sync', 'sass'], function () {
    gulp.watch('app/sass/**/*.scss', ['sass']);
    gulp.watch('app/js/*.js', ['concat_js']);
    gulp.watch('app/**/*.*', browserSync.reload);
});

gulp.task('default', ['watch', 'sass', 'concat_js']);

Note: An array of files in task concat_js is required for the correct order of file contact.