text:
Q: Resolving .net standard 2.0 with unity (DI) in .NET 4.7.2 We are currently working with a large solution that contains a WCF project (.NET Framework 4.7.2) along with multiple .NET Standard 2.0 libraries.
We're trying to register these libraries with Unity (DI). Loading the libraries in the container works fine. However resolving these classes in a constructor fails.
Unity.Exceptions.ResolutionFailedException: 'Resolution of the dependency
failed, type = 'PROJECTNAME.Service.ITypeDependentonDbContext', name = '(none)'.
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The current type,
PROJECTNAME.DAL.Repositories.Interfaces.IDbContext, is an interface
and cannot be constructed. Are you missing a type mapping?

More specifically, each library has a ModuleInit class where we register types on the ModuleRegistrar (for MEF2) like so:
 public void Initialize(IModuleRegistrar registrar)
    {
        registrar.RegisterType<IDbContext, DbContext>();
        // etc
    }

Then, in our .NET Framework project, we register types to the Unity Container:
   protected override void ConfigureContainer(IUnityContainer container)
        {
            container
               .RegisterType<ISomeService, SomeService>()
               .RegisterType<ITypeDependentonDbContext, TypeDependentonDbContext>();
                //etc
             ModuleLoader.LoadContainer(container, ".\\bin", "*.*.dll");
        }

Finally, in a class in the .NET Framework project, we have
public class SomeService : ISomeService
{
    private readonly ITypeDependentonDbContext _typeDependentonDbContext;

    /// <summary>
    /// constructor
    /// </summary>
    /// <param name="typeDependentonDbContext"></param>
    public SomeService(ITypeDependentonDbContext typeDependentonDbContext)
    {
        _typeDependentonDbContext = typeDependentonDbContext ?? throw new ArgumentNullException(nameof(typeDependentonDbContext));
    }
}

The weird thing is that the exception is not thrown if we register ALL types that we depend on directly in the container. This is in contrast to an existing .NET framework solution where we register each type in the moduleInit class of that project, exactly as presented here. However this doesn't seem to work with .NET standard 2.0 projects.
Additionally, while debugging it seems that the classes seem to be registered just fine in the container - each interface is mapped to the correct implementation class. Things only seem to go wrong when we actually wish to resolve the dependecy in a constructor.
Does anyone have any ideas as to why this may occur?


text:
Q: Is the sash title on a WKUserNotificationInterfaceController always all-caps? I'm building an app for a client that includes lightweight support for Watchkit.
It uses a WKUserNotificationInterfaceController to display local notifications to the user. I have defined both a static and a custom "long look" interface.
I notice that the "Sash" title on the notification is the app display name, forced to all caps.  (This is the colored bar at the top of the notification that has the app icon and app title displayed on it.)
The client's app name is a mix of upper and lower case that is part of their branding. They want the sash name to honor that mixed upper/lower case.
Does anybody know of a way to change the text that's displayed in the notification sash, or are we stuck with an upper-case version of the app display name?

A: i noticed it too, and currently there is no  way to change it, It seems it's managed by Apple and even the title is kinda hidden to be changed.

redpajama_set_name: RedPajamaStackExchange


text:
Q: WD Black NVMe SSD 2018 is not working under Linux / Ubuntu I've bought a new Western Digital (WD) Black NVMe SSD 2018, but can't install Linux on it. System freezes. And the only live image that will run is Lubuntu 18.04.  Ubuntu and Mate live image (and Fedora 28) will freeze after 30 seconds or so.
Clevo n130wu, Intel 8550u, iGPU.
SSD is listed under /dev/nvme0, but nvme list will freeze the system.
If I boot with acpi=off the disk is not under /dev/nvme*
According to this support page it should work under Linux, although I'm not sure if this relates to the 2018 model. Anandtech seems to have tested it with kernel 4.14.
UPDATE
SSD Dashboard utility is Windows only and doesn't run under wine.


text:
Q: How to build the URL for sentiment140 request? How to build the URL for sentiment140 request? For the following JSON data,
{"data": [{"text": "I love Titanic."},
         {"text": "I hate Titanic."}]}

I have built the following URLs:
http://www.sentiment140.com/api/bulkClassifyJson?appid=me@gmail.com&text=I+love+Titanic.
and
http://www.sentiment140.com/api/bulkClassifyJson?appid=me@gmail.com&text=I+hate+Titanic.
Both POST requests return a blank. Any suggestions would be of great help. Thanks

A: Are you sure that you are POST'ing?  The above urls look like GETs.

<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>405 HTTP method GET is not supported by this URL</title>

Error: HTTP method GET is not supported by this URL

A: As per the API documentation you are supposed to pass the JSON data as the request body of a POST method, not as URL parameters.
So it should look something like this:
String data = "{\"data\": [{\"text\": \"I love Titanic.\"}, {\"text\": \"I hate Titanic.\"}]}";

URL url = new URL("http://www.sentiment140.com/api/bulkClassifyJson?appid=me@gmail.com");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");

// write the request body
connection.getOutputStream().write(data.getBytes("UTF8"));

// get the response and read it
InputStream in = connection.getInputStream();


text:
Q: jQuery - Add a string to textbox if more than one checkbox is checked and for each checkbox I have over 25 check-boxes. So far I have it when an item is check the value goes inside a textbox.  What I am trying to do is... After the first check box is check and it is value is then entered in a textbox below... Everything else checked needs to add a string of " AND " before each value that is checked. My script is below...
    <script>
        $(document).ready(function(){
            var lastChecked;
            var $checks = $('input:checkbox').click(function(e) {
                var numChecked = $checks.filter(':checked').length;
                    if (numChecked > 1 ) {
                        $(":checkbox:checked").each(function(){
                            var text = $('#text_query');
                            text.val(' AND' + text.val());
                    });
                }
                lastChecked = this;
            });
        });
    </script>

The problem that I am having is all the "And"s are all showing up in front of all products and I am recieving an extra "AND" from the first product I checked inside a text box.    Example
AND AND AND Product_1 Product_2 Product_3
It should look like this...
Product_1 AND Product_2 AND Product_3
So what Am I missing.  Any help is appreciated.

A: You had some incorrect logic dealing with your AND appending. Take a look below.

$(document).ready(function() {
  var lastChecked;
  var $checks = $('input:checkbox').click(function(e) {
    var numChecked = $checks.filter(':checked').length;
    var text = $('#text_query');
    text.val('');
    $(":checkbox:checked").each(function() {
      console.log($(this).val());
      text.val($(this).val() + ' AND ' + text.val());
    });
    var str = text.val();
    text.val(str.substring(0, str.length - 4));
    lastChecked = this;
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="checkbox" value="1">
<input type="checkbox" value="2">
<input type="checkbox" value="3">
<input type="checkbox" value="4">
<input type="checkbox" value="5">
<input type="checkbox" value="6">
<input type="checkbox" value="7">
<input type="checkbox" value="8">
<input type="checkbox" value="9">
<br/>
<input type="text" id="text_query">

A: Try this
    var text = $('#text_query');
     text.val(text.val('AND'));


text:
Q: Sub navigation in IE9 is pushed above the navigation I read some posts on this and for the life of me I cannot figure out my issue with ie9. On my navigation, when I hover over services, my sub nav is some how being pushed up above the navigation. I have tried making changes to some of the propeties and nothing has worked. The link to the site is www.colossalpoint.com also in ie 8 my site is completely off some one please help!

A: to fix menu use position relative instead of static

instead of

and better do it with stylesheet file, not inline


text:
Q: how to extract rows from file1 based on matching information of its/file1 (only)first column with file2 in linux? I  have two files that look like this:
file 1:
HO840F3000336240 HOUSAM129901651 HOUSAF132871174 F 20060607 Yes
HO840F3000336251 HOUSAM129800008 HOUSAF135774690 F 20060718 Yes
HO840F3000336254 HOUSAM129901651 HOUSAF135357862 F 20060724 Yes
HO840F3000487279 HOUSAM131520543 HOUSAF135761935 F 20061226 Yes
HOUSAM55967108 HOUSAM53557280 HOUSAF53557285 M 20091129 Yes
HOUSAF55969445 HOUSAM55967108 HOUSAF53579684 F 20120103 Yes

file 2:
HO840F3000336251
HO840F3000487279
HOUSAF135761935
HOUSAM55967108

What I would like to do is to extract those rows from File 1 where  first column is common with the first column in  File 2. So, based on this example, the output should be :
file3:

HO840F3000336251 HOUSAM129800008 HOUSAF135774690 F 20060718 Yes
HO840F3000487279 HOUSAM131520543 HOUSAF135761935 F 20061226 Yes
HOUSAM55967108 HOUSAM53557280 HOUSAF53557285 M 20091129 Yes

any suggestion?

A: UPDATE:
This command will create file3 with the desired output. Tested and works:
cat file1 | grep -f file2 > file3
Output:
HO840F3000336251 HOUSAM129800008 HOUSAF135774690 F 20060718 Yes
HO840F3000487279 HOUSAM131520543 HOUSAF135761935 F 20061226 Yes

It uses the -f switch in grep which takes a file name with one pattern per line. As per man grep:
    -f FILE, --file=FILE
Obtain patterns from FILE, one per line.  The empty file contains zero patterns,
and therefore enter code here`matches nothing.  (-f is  specified by POSIX.)

A: The answer is using join command instead of grep.
after sorting both files based on first column:
join File1 file2 > file3


text:
Q: Canceling Support for old app Lets assume that I have apps that I have on offer on the Apple App Store. Again, lets assume that I no longer want to support an app and that I am removing the app from the app store.
If my app no longer works or functions correctly after dropping support, is there a way I can suggest deleting the app or are their penalties for having apps that behave this way?

A: You should sign into your Apple Developer Account and review the License Agreements there.

License Agreements
The license agreements of the iOS Developer Program and Mac Developer Program detail your obligations and responsibilities as a member. The latest agreements can be reviewed in Member Center.
Sign in to Member Center

From the looks of it though, it is pretty generic protect Apple and Apple's Brand and Good Will. If you received any additional agreements when your app was approved to go on the App Store, then review them as well.
From the looks of it though, and from wha articles in trade publications indicate, many developers just walk away from their apps.
As it sounds like you are trying to do the right thing, hypothetically of course, I do recall that one app that I had, Catch Notes, did post a notice to their landing page on the App Store that their product was no longer going to be supported. If you are able to make updates or adds to the page, then that is likely the place to do it. Also Catch Notes no longer appears on the App Store, so there is some process for removal.
Here are some news reports that made the tech sites.
Engadget
CNET
Techcrunch
Check with an Apple representative. There may be a way that the app can be frozen from future downloads, to allow sufficient time for the app's page to be seen by the current user base without expanding it. It is also possible that they are able to message your user base through their records of the App Store purchases. If there is security risk and you feel that the users should completely remove the app, then this is the right thing to do.

A: OneNote by Microsoft did something clever when they discontinued their iPad-only app: they changed the app icon to include an exclamation mark in an update and when you opened it it gave you a message that there was a new version, with a link.
So maybe you can change the app icon as well but instead of a new version link you can just suggest deletion.


text:
Q: "java.lang.ArrayIndexOutOfBoundsException: 3" using Weka OneClassClassifier I try to classify some instances of a test dataset by using Weka's OneClassClassifier class.
I trained the classifier by using a distinct training dataset. Both the test and training set (arff files) have the same structure of attributes but the test set doesn't contain any class values.
The used classifier options are -tcl myclass (to set my target class).
Running the distributionForInstance(Instance) method, I got the following Error:
  java.lang.ArrayIndexOutOfBoundsException: 3
  # weka.core.DenseInstance.value(weka/core/DenseInstance.java:332)
  # weka.core.AbstractInstance.isMissing(weka/core/AbstractInstance.java:315)
  # weka.filters.unsupervised.attribute.AddValues.input(weka/filters/
    unsupervised/attribute/AddValues.java:315)
  # weka.classifiers.meta.OneClassClassifier.distributionForInstance(weka/
    classifiers/meta/OneClassClassifier.java:1380)

Using other classifiers (e.g. trees.RandomForest, functions.Logistic) my routines are running successfully. What am I doing wrong?

A: I just found a solution:
Because of my test set doesn't have any class value assigned, there is no value to load when the 'outlier' class label is added via the unsupervised atrribute AddValues filter.
When I set the instances class value to missing with
instance.setClassMissing();

it works for me and the error disappears.


text:
Q: How to customise email transports As I understood Meteor internally uses nodemailer to send emails and creates the corresponding transport based on the defined MAIL_URL environment property.
We have implemented an EmailSenderService which creates several different nodemailer transports. It uses the account settings defined as settings for production mode and a hardcoded ethereal account for development mode.
I wonder if and how it is possible to change the internal Meteor email handling to use our application specific EmailSenderService to send all kind of emails especially the ones send via the account-password package (e.g. enrollment- and forgot-password-emails). My idea is to redirect the calls to the central Email.send function to our EmailSenderService instead of calling the Meteor internal logic.
Thank you for thinking along and any upcoming ideas and hints...

A: You've got a few options:
1. Monkeypatch Email.send
As @iiro says, you can just monkey patch the Email module by replacing the send method with your own.
Email.send = function (options) {
    return EmailSenderService.send(options);
}

2. Replace the email package with a local version
If Meteor finds a package of the same name in the packages/ directory of your project, it will use that one over it's own implementation. Documentation
3. Use undocumented features to hook into Email.send
EDIT: I didn't see that EmailTest isn't exported. So this only works by making a local copy like in option 2.
Looking at the source of the email package, there's a hook which is run at the start of Email.send and allows you to prevent the default execution by returning false. You could use this like so:
EmailTest.hookSend(function (options) {
   EmailSenderService.send(options)
   return false; // To stop default sending behaviour
});


text:
Q: A link doesn't work. Is it possible that Jquery 'toggle()' method causes this?

Callback

LoadCallBack

ChangeCallBack

beforeJobCallBack

afterJobCallBack

afterListCallBack

afterReadCallBack

tdClickCallBack

trClickCallBack

BlurCallBack

parentSetDefault

setValueCallBack

keyDownCallBack

afterNewCallBack

afterDeleteCallBack

===============================================================================
As above, you can see the first element 'a' with 'href' attribute.
Normally, it works fine, there's no reason for it not to work,
because it's a simple 'a' tag with href attribute.
But it gets a problem when I put toggle function on the element.
===============================================================================
$('#Left .Browsingtree02 li a').toggle(function() {
    $(this).addClass('Selected');
    $(this).parent().parent().find('.Browsingtree03').show(200);
}, function() {
    $(this).parent().parent().find('.Browsingtree03').hide(200);
    $(this).removeClass('Selected');
});

===============================================================================
If this code doesn't exist, the first 'a' with the attribute works just fine !!
But Browser can't get the link and doesn't move to the linked page at all...
Please help me out.

A: For some reasons, jQuery's toggle always prevents the default action. See source code :
// Make sure that clicks stop
event.preventDefault();

So I suggest to not use the toggle function but simply to do this :
$('#Left .Browsingtree02 li a').click(function(){
    var nbclicks = $(this).data('nbc')||0;
    $(this).data('nbc', ++nbclicks);
    if (nbclicks%2) {
        $(this).addClass('Selected');
        $(this).parent().parent().find('.Browsingtree03').show(200);
    } else {
        $(this).parent().parent().find('.Browsingtree03').hide(200);
        $(this).removeClass('Selected');
    }
});


text:
Q: Execute @Formula in merged value Hi all,
I faced with a problem that Formula is not executed in merged entity.
So I have Entity with one property marked with @Formula annotation. When I execute select of entity, the annotated property contains a proper value, but after merge returned persisted entity, the property is always null. Is it possible to trigger execution of the Formula after merge?
Thanks in advance.

A: You can try to call session.refresh(theEntity) after merge().
session.refresh() method to re-populate the entity with latest data available in database.
Haven't tried it though.


text:
Q: Null pointer error -- using array as parameter in constructor I am taking AP Comp Sci and working on the lab "elevens". All I'm trying to do is instantiate an object of the "Deck" class, and my constructor is throwing a NullPointerError. After doing a print check, I found that the first index is being found correctly, it's the second that's throwing the error. What do I need to change in either my Deck class or my main method to fix this issue?
public Card(String cardRank, String cardSuit, int cardPointValue)
{
    suit = cardSuit;
    rank = cardRank;
    pointValue = cardPointValue;
}

private ArrayList<Card> cards;

public Deck(String[] ranks, String[] suits, int[] values)
{
    for(int i =0; i < suits.length; i++)
    {
        cards.add(new Card(ranks[i], suits[i], values[i]));
        size++;
    }
}

public static void main(String[] args)
{
    String [] suits = new String [] {"Spades", "Hearts", "Diamonds"};
    String [] ranks = new String [] {"Queen", "King", "Ace"};
    int [] points = new int [] {10, 10, 11};
    Deck deck = new Deck(ranks, suits, points);
}

A: When you say private ArrayList<Card> cards;, it is equivalent to
private ArrayList<Card> cards = null;

which is why cards is null in your constructor. Change it to something like1
private List<Card> cards = new ArrayList<>();

Or, add a cards = new ArrayList<>(); before your for loop (in your constructor).
Also, you appear to be missing both clubs and jacks
String [] suits = {"Clubs", "Spades", "Hearts", "Diamonds"};
String [] ranks = {"Jack", "Queen", "King", "Ace"};

1And prefer programming to the List interface.

A: cards hasn't been instantiated, so it is still null, and will cause a NPE when you try to interact with it.
Simplest solution (given that we should minimise the prevalence of nulls in our code):
private ArrayList<Card> cards = new ArrayList<>();


text:
Q: Set selected value on select2 without loosing ajax I have this select2 code in my html (mvc with razor) page:
$('#QuickSearchState').select2({
            minimumInputLength: 3,
            width: 'resolve',
            ajax: {
                url: '@Url.Action("QuickSearchState", "DataCenter")',
                contentType: 'application/json',
                dataType: 'json',
                type: 'POST',
                traditional: true,
                quietMillis: 400,
                data: function(term, page) {
                    var data = {
                        term: term
                    };
                    return data;
                },
                results: function(data, page) {
                    return { results: data };
                }
            },
            initSelection: function(element, callback) {
                var data = { id: element.val(), text: element.val() };
                callback(data);
            },
            formatResult: function(format) {
                return format.label;
            },
            formatSelection: function(format) {
                //this is a knockout view model
                vmNewAddress.IdState(format.id);
                vmNewAddress.StateName(format.stateName);
                return format.label;
            },
            dropdownCssClass: "bigdrop",
            escapeMarkup: function(m) { return m; }
        });

But i have another select in my code that can set a state in this select, but i dont know how to set this value to that select.
In my html i have this:
<select class="width-xl" data-bind="options: vm.GivenLocationsForConnection, optionsText: 'DisplayFormat', value: SelectedLocation"></select> -> first select that can fill the second state search select with a state

@Html.Hidden("query", null, new { @id = "QuickSearchState", @class = "width-xl", placeholder = "Ej. Montevideo" }) -> second select, this is a search for states and selects a single state

A: I am not sure if this is what you want but if you only want to select a value in the select you can just do below
$("#QuickSearchState").select2("val", "<YOUR VALUE>");


text:
Q: How to display @ instead of being encoded as %40 (urlencode) in browser address bar? I've tried to use this line in Python3 (Flask) project, which is UTF-8 encoding:
@app.route('/@<username>', methods=['GET', 'POST'])

But in browser address bar, it always displays like:
http://example.com/%40username

How to display the original '@' in browser address bar? thanks!

A: Are you are using url_for from python code? One approach in such case is to call urllib.unquote on return value of url_for
Sample code:
from flask import Flask, url_for, redirect
import urllib
app = Flask(__name__)

@app.route("/")
def hello():
    return redirect(urllib.unquote(url_for('user', username='test')))

@app.route('/@<username>', methods=['GET', 'POST'])
def user(username):
    return "Hello %s" % (username)

if __name__ == "__main__":
    app.run()

Disabling character escaping is discussed here


text:
Q: Abelian von Neumann Algebras on non-separable Hilbert spaces Is there a classification of Abelian von Neumann algebras on non-separable Hilbert spaces? For a classification of Abelian von Neumann algebras on separable Hilbert spaces, see this link.

A: Every commutative von Neumann algebra $A$ is $^*$-isomorphic to $L_\infty(\Omega,\mu)$ for some locally compact Hausdorff space and positive measure $\mu$.
Idea of the proof is the following. Decompose
$$
A\cong\coprod\limits_{\nu\in\Lambda} A_\nu
$$
into the coproduct of commutative von Neumann algebras with cyclic vector. For every commutative von Neumann algebra $A_\nu$ with cyclic vector there exist compact Hausdorff space $\Omega_\nu$ and regular bounded Borel measure $\mu_\nu$, such that $A_\nu$ is $^*$-isomorphic to $L_\infty(\Omega_\nu,\mu_\nu)$. Then one can show that
$$
A\cong L_\infty\left(\coprod\limits_{\nu\in\Lambda} \Omega_\nu,\coprod\limits_{\nu\in\Lambda} \mu_\nu\right)
$$
See Theory of operator algebras Part I by M. Takesaki, chapter 3, theorem 1.18.


text:
Q: Android Error inflating class android.support.design.widget.CollapsingToolbarLayout In my application I want to use this support widgets but I get error:
Error inflating class android.support.design.widget.CollapsingToolbarLayout

After much more googlenig and search in SF, I can't find any solution to resolve that. I don't know why I get this error, because it like with other usage this feature
My layout:
<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.design.widget.CollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:contentScrim="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="65dp"
            android:background="@drawable/toolbar_background"
            android:titleTextColor="#ffffff"/>

        <com.sloydev.collapsingavatartoolbar.CollapsingAvatarToolbar
            android:id="@+id/stuff_container"
            android:layout_width="match_parent"
            android:layout_height="65dp">

        </com.sloydev.collapsingavatartoolbar.CollapsingAvatarToolbar>
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

</android.support.design.widget.CoordinatorLayout>

And my Gradle:
ext {
    supportLibVersion = '23.4.0'
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile ("com.android.support:support-v4:${supportLibVersion}"){
        force = true;
    }
    compile "com.android.support:design:${supportLibVersion}"
    compile "com.android.support:cardview-v7:${supportLibVersion}"
    compile "com.android.support:recyclerview-v7:${supportLibVersion}"
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.squareup.okhttp3:okhttp:3.3.1'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
    compile('io.socket:socket.io-client:0.7.0') {
        // excluding org.json which is provided by Android
        exclude group: "org.json", module: "json"
    }
    compile('com.squareup.retrofit2:retrofit:2.0.2') {
        exclude module: 'okhttp'
    }
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'com.squareup.okhttp3:okhttp:3.3.1'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.github.devlight.navigationtabbar:library:+'
    compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
    compile 'com.balysv:material-ripple:1.0.2'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.github.chyrta:AndroidOnboarder:+'
    compile 'com.jakewharton:butterknife:7.0.1'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.github.lamydev:android-notification:3.0'
    compile 'com.klinkerapps:sliding-activity:1.3.2'
    compile 'com.koushikdutta.ion:ion:2.+'
    compile 'com.bugsnag:bugsnag-android:+'
    compile 'com.github.liuguangqiang.swipeback:library:1.0.2@aar'
    compile 'com.github.justzak:dilatingdotsprogressbar:1.0.1'
    compile 'com.github.Kennyc1012:BottomSheet:2.1.2'
    compile 'com.yalantis:flipviewpager:1.0.0'
    compile 'com.github.techery:ProperRatingBar:0.+'
    compile 'com.wunderlist:sliding-layer:1.2.5'
    compile 'com.facebook.rebound:rebound:0.3.8'
    compile 'com.tumblr:backboard:0.1.0'
    compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
    compile 'com.makeramen:roundedimageview:2.2.1'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.easing:library:1.0.1@aar'
    compile 'com.daimajia.androidanimations:library:1.1.3@aar'
    compile 'com.jaredrummler:android-device-names:1.0.9'
    compile 'org.sufficientlysecure:html-textview:1.6'
    compile 'com.melnykov:floatingactionbutton:1.3.0'
    compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
    compile 'com.kogitune:pre-lollipop-activity-transition:1.3.0'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.flyco.roundview:FlycoRoundView_Lib:1.1.4@aar'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.squareup.picasso:picasso:2.3.2'
    compile 'com.mikhaellopez:circularimageview:3.0.2'
    compile 'com.github.traex.rippleeffect:library:1.3'
    compile 'com.alexvasilkov:foldable-layout:1.2.0'
    compile 'com.alexvasilkov:android-commons:1.2.4'
    compile 'com.mikhaellopez:circularfillableloaders:1.2.0'
    compile 'cat.ereza:customactivityoncrash:1.5.0'
    compile 'jp.wasabeef:glide-transformations:2.0.1'
    compile 'com.sloydev:collapsingavatartoolbar:1.0.0'
    compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
    compile 'com.github.hotchemi:permissionsdispatcher:2.0.7'
    apt 'com.github.hotchemi:permissionsdispatcher-processor:2.0.7'
    compile('de.keyboardsurfer.android.widget:crouton:1.8.5@aar') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
        transitive = true;
    }
    compile project(':lib-searchview')
}

Full Stack error:
07-22 09:22:01.206 15932-15932/ir.pishguy.signalpresentationproject E/CustomActivityOnCrash:App has crashed,executing CustomActivityOnCrash's UncaughtExceptionHandler
        java.lang.RuntimeException:Unable to start activity ComponentInfo{ir.pishguy.signalpresentationproject/ir.pishguy.signalpresentationproject.Activities.ActivityMain}:android.view.InflateException:Binary XML file line #21:Binary XML file line #7:Error inflating

class android.support.design.widget.CollapsingToolbarLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2464)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)
        at android.app.ActivityThread.access$900(ActivityThread.java:154)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:234)
        at android.app.ActivityThread.main(ActivityThread.java:5526)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
        Caused by:android.view.InflateException:Binary XML file line #21:Binary XML file line #7:Error inflating

class android.support.design.widget.CollapsingToolbarLayout
        at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at ir.pishguy.signalpresentationproject.Activities.ActivityMain.onCreate(ActivityMain.java:52)
        at android.app.Activity.performCreate(Activity.java:6285)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)
        at android.app.ActivityThread.access$900(ActivityThread.java:154)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:234)
        at android.app.ActivityThread.main(ActivityThread.java:5526)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
        Caused by:android.view.InflateException:Binary XML file line #7:Error inflating

class android.support.design.widget.CollapsingToolbarLayout
        at android.view.LayoutInflater.createView(LayoutInflater.java:645)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at ir.pishguy.signalpresentationproject.Activities.ActivityMain.onCreate(ActivityMain.java:52)
        at android.app.Activity.performCreate(Activity.java:6285)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)
        at android.app.ActivityThread.access$900(ActivityThread.java:154)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:234)
        at android.app.ActivityThread.main(ActivityThread.java:5526)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
        Caused by:java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at android.view.LayoutInflater.createView(LayoutInflater.java:619)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at ir.pishguy.signalpresentationproject.Activities.ActivityMain.onCreate(ActivityMain.java:52)
        at android.app.Activity.performCreate(Activity.java:6285)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)
        at android.app.ActivityThread.access$900(ActivityThread.java:154)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:234)
        at android.app.ActivityThread.main(ActivityThread.java:5526)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
        Caused by:java.lang.NoSuchMethodError:No static method setLayoutDirection(Landroid/graphics/drawable/Drawable;I)V in

class Landroid/support/v4/graphics/drawable/DrawableCompat;or its super classes(declaration of'android.support.v4.graphics.drawable.DrawableCompat' appears in/data/data/ir.pishguy.signalpresentationproject/files/instant-run/dex/slice-com.android.support-support-v4-24.0.0_4b43aba066322bf0426e63e87ab20c7abe086ec0-classes.dex)
        at android.support.design.widget.CollapsingToolbarLayout.setStatusBarScrim(CollapsingToolbarLayout.java:663)
        at android.support.design.widget.CollapsingToolbarLayout.<init>(CollapsingToolbarLayout.java:197)
        at android.support.design.widget.CollapsingToolbarLayout.<init>(CollapsingToolbarLayout.java:132)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at android.view.LayoutInflater.createView(LayoutInflater.java:619)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at ir.pishguy.signalpresentationproject.Activities.ActivityMain.onCreate(ActivityMain.java:52)
        at android.app.Activity.performCreate(Activity.java:6285)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524)
        at android.app.ActivityThread.access$900(ActivityThread.java:154)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:234)
        at android.app.ActivityThread.main(ActivityThread.java:5526)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

A: Try adding android:theme="@style/Theme.AppCompat.Light.NoActionBar" in your manifest.
The CollapsingToolbarLayout need appCompat v7 support


text:
Q: Join prime pseudovarieties A pseudovariety $\mathbf{V}$ of groups is join prime if for any pseudovarieties $\mathbf{V}_1, \mathbf{V}_2, \ldots,\mathbf{V}_m$, the implication $$\mathbf{V} \subseteq \mathbf{V}_1 \vee \mathbf{V}_2 \vee \cdots \vee \mathbf{V}_m \quad \Longrightarrow \quad \mathbf{V} \subseteq \mathbf{V}_i$$ holds for some $i$. A finite group is join prime if it generates a join prime pseudovariety.
It is known that all groups of order up to 7 are join prime. So it is natural to ask: is the dihedral group $D_4$ of order 8 join prime?

A: Yes, the pseudovariety generated by $D_4$ is join prime (and the argument
shows that the same is true for the pseudovariety generated by
$8$-element quaternion group).
The result follows from two observations:
(1) the class ${\mathbf P}$ of finite groups whose Sylow $2$-subgroups
are abelian forms a pseudovariety (i.e., this class is closed under finite products, the formation of subgroups and the formation of quotients), and
(2) any pseudovariety not contained in ${\mathbf P}$
contains $D_4$ (and $Q_8$).
Assuming Items (1) and (2), and the obvious fact that $D_4\not\in {\mathbf P}$, we argue as follows:
if ${\mathbf V}(D_4)\subseteq {\mathbf V}_1\vee \cdots \vee {\mathbf V}_m$,
then by Item (1) there is some $i$ such that
${\mathbf V}_i\not\subseteq {\mathbf P}$. By Item (2),
${\mathbf V}_i$ contains $D_4$, so ${\mathbf V}(D_4)\subseteq {\mathbf V}_i$.
I explain how to prove Item (2).
Assume ${\mathbf V}$ is a pseudovariety containing
some group $G$ with a nonabelian Sylow $2$-subgroup.
We may assume that $G$ is chosen with $|G|$ minimal,
and that ${\mathbf V}={\mathbf V}(G)$.
Necessarily $G$
is a nonabelian, subdirectly irreducible $2$-group
with monolith $M = \langle z\rangle\subseteq Z(G)$
where $z^2=1$, and $G/M$ is abelian.
In particular, $G$ is $2$-step nilpotent.
Since $G/M\models [x,y]\approx 1$ and $M\models x^2\approx 1$
we get that $G\models [x,y]^2\approx 1$.
It follows from commutator collection
that the set of laws of any finite $2$-step nilpotent group
may be axiomatized by: the group laws, the law
$[[x,y],z]\approx 1$, an exponent bound $x^m\approx 1$,
and an exponent bound on the commutator subgroup
$[x,y]^n\approx 1$. Thus, if the exponent of our group $G$
is $2^r$, then since $G$ is nonabelian and satisfies
$[x,y]^2\approx 1$ we get that ${\mathbf V}(G)$
is exactly the class of all finite, $2$-step nilpotent
$2$-groups satisfying $[x,y]^2\approx 1$ and $x^{2^r}\approx 1$. If $2^r\geq 4$,
this class contains $D_4$.
But we must have $2^r\geq 4$, since otherwise
$2^r\mid 2$ and $G\models x^2\approx 1$. This can't
happen since $G$ is nonabelian.


text:
Q: What would be a good way to encode 52 integers into a fewer amount? So for example, I have an array containing 52 shuffled integers between 0 and 52 - no repeated values.
How can I encode this array according to an algorithm such that it can be represented as less numbers, and then decode and again to reproduce the original values?
I was thinking I could create a big binary String and group grouping of 0's or 1's together as characters, and expand on that. Would that be the way to go? Thanks

A: There are 52! (that's fifty two factorial) different arrays like you describe. By the way they are called permutations. A single number between 0 and 52! uniquely represents such a permutation.  You need 226 bits to store such a number. Eight 32-bit integers would do just as well.
You can read about mapping numbers to permutations and back here.

A: you need a 6 bit var to store a values that is lower than 64.
Union is the key
union DATAPACK
{
    unsigned int code1 : 6;
    unsigned int code2 : 6;
    unsigned int code3 : 6;
    unsigned int code4 : 6;
   ....
} array1;

A: If your range is 0 to 52 then you only need 6 bits to store each number - so instead of 52 bytes (assuming you are using 1 byte per digit) you would only need 52 x 6/8 or 39 bytes.
Hardly seems worth saving though unless you have trillions of them to store.

A: What about partition the array in a quadtree or a spatial index and then use a space-filling-curve to reduce the complexity? Maybe a z-curve can do it or a hilbert-curve? Do you need a power of 2 2d array? It this your requirement?


text:
Q: Grid view with Datasource control Sir,
    Im doing a project in asp.net 4.0 with c#.I my project i want to display datas from the database to the grid view using Data Source Control. But while doing it im getting an eror called "The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource.  A control with ID 'System.Web.UI.WebControls.SqlDataSource' could not be found.".
 My code is also givren below.
SqlCommand cmd = new SqlCommand("SPS_LeaveBalanceReport_DSO", Connect.con());
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@ReportMonth", SqlDbType.NVarChar).Value =
    SelectMonthDropDown.SelectedValue.ToString();
cmd.Parameters.Add("@ReportYear", SqlDbType.NVarChar).Value =
    SelectYearDropDown.SelectedItem.Text.ToString();

SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "tab");

GridView1.DataSourceID = SqlDataSource1.ToString();
GridView1.DataBind();

Please help me with error.,thanks In Advance.,

A: change
GridView1.DataSourceID = SqlDataSource1.ToString();

to
GridView1.DataSourceID = SqlDataSource1.ID;

A: The problem is no where in your cod ejust replace the line
GridView1.DataSourceID = SqlDataSource1.ToString();

with
GridView1.DataSource=ds;

it will work


text:
Q: Definition of "Equals" for empty arrays and difference between .NET and .NET core I have written some unit tests yesterday that pass in .NET 4.6.1 but fail in .NET core 3.0 because the number of array instances that is generated during that test is different in both environments. After some investigation it turned out that the count of empty arrays created with LINQ is different. I was finally able to dump it down to this test:
    [Test]
    public void ArrayTest()
    {
        var numbers = Enumerable.Range(1, 5);

        int[] items1 = numbers.Where(i => i > 5).ToArray();
        int[] items2 = numbers.Where(i => i > 5).ToArray();

        Assert.IsFalse(items1 == items2);      // fails in .NET core 3 but passes in .NET 461
        Assert.IsFalse(items1.Equals(items2)); // fails in .NET core 3 but passes in .NET 461
    }

My question is: does anyone know where the implementation is different? Does ToArray() maybe return an Array.Empty<> singleton instance in .NET core but not in .NET if the collection has no elements?

A:
Does ToArray() maybe return an Array.Empty<> singleton instance in .NET core but not in .NET if the collection has no elements?

Yes. Linq was given a lot of speed optimizations in .NET Core.
In .NET Framework, Enumerable.ToArray() calls Buffer<TElement>.ToArray(), which returns a new TElement[0] if the buffer is empty.
In .NET Core, for your specific case of <array>.Where(...).ToArray(), Enumerable.ToArray() calls IIListProvider<TSource>.ToArray(), which is implemented by WhereArrayIterator<TSource>.ToArray(), which calls new LargeArrayBuilder<TSource>(_source.Length), which uses Array.Empty<T>.


text:
Q: Replace multiple occurences of a character with a single character in LibreOffice Calc In LiberOffice Calc, I would like to replace multiple occurences of a character with a single occurence. For example, abcd::::xyz should be replaced with abcd:xyz. How to do that? Thanks in advance.

A: Go to Edit > Find and Replace. Make sure Regular Expressions is checked.

*

*Find (.)\1+

*Replace $1
Explanation: (.) finds any character and remembers what it is. \1 refers to whatever character was found originally, and + requires 1 or more of them. $1 also refers to that same character.
Example: apple bannanna becomes aple banana
To change only semicolons, do this instead:

*

*Find (:){2,}

*Replace $1
Documentation: https://help.libreoffice.org/latest/en-US/text/shared/01/02100001.html

A: On your top menu, click on EDIT.
Then, select Find & Replace.
In the Find field, enter ::::
In the Replace field, enter :
Then, click Replace All.
Finally, click Done and then click Close


text:
Q: How do I collect historical weather data from Wunderground using R function? Can anyone help me fixing this code?
I used the script without issues last year, but now there is issues with the connection to the url.
How do I fix it?
What I want is to collect and arrange data from 2015-12-01 to 2016-04-15 from the weather station "EKAH" (Tirstrup, Aarhus Airport, Denmark).
    ############## 1) Run function --------------------

    wunder_station_daily <- function(station, date)
    {
      base_url <- 'https://www.wunderground.com/history/airport'

      # Example website: https://www.wunderground.com/history/airport/EKAH/2016/06/09/DailyHistory.html?&MR=1

      # parse date
      m <- as.integer(format(date, '%m'))
      d <- as.integer(format(date, '%d'))
      y <- format(date, '%Y')

      # compose final url
      final_url <- paste(base_url,
                         '/', station,
                         '/', y,
                         '/', m,
                         '/', d,
                         '/DailyHistory.html?&MR=1', sep='')

      # reading in as raw lines from the web server
      # contains
 tags on every other line

      #   u <- url(final_url)
      #   the_data <- readLines(u)
      #   close(u)

      the_data <- getURL(final_url, ssl.verifypeer=0L, followlocation=1L)

      # only keep records with more than 5 rows of data
      if(length(the_data) > 5 )
      {
        # remove the first and last lines
        the_data <- the_data[-c(1, length(the_data))]

        # remove odd numbers starting from 3 --> end
        the_data <- the_data[-seq(3, length(the_data), by=2)]

        # extract header and cleanup
        the_header <- the_data[1]
        the_header <- make.names(strsplit(the_header, ',')[[1]])

        # convert to CSV, without header
        tC <- textConnection(paste(the_data, collapse='\n'))
        the_data <- read.csv(tC, as.is=TRUE, row.names=NULL, header=FALSE, skip=1)
        close(tC)

        # remove the last column, created by trailing comma
        the_data <- the_data[, -ncol(the_data)]

        # assign column names
        names(the_data) <- the_header

        # convert Time column into properly encoded date time
        the_data$Time <- as.POSIXct(strptime(the_data$Time, format='%Y-%m-%d %H:%M:%S'))

        # remove UTC and software type columns
        the_data$DateUTC.br. <- NULL
        the_data$SoftwareType <- NULL

        # sort and fix rownames
        the_data <- the_data[order(the_data$Time), ]
        row.names(the_data) <- 1:nrow(the_data)

        # done
        return(the_data)
      }
    }

    ############## 2) Get data for a range of dates ------------------------------

    date.range <- seq.Date(from=as.Date('2015-12-01'), to=as.Date('2015-12-04'), by='1 day')
    station <- 'EKAH'

    # pre-allocate list
    l <- vector(mode='list', length=length(date.range))

    # loop over dates, and fetch data
    for(i in seq_along(date.range))
    {
      print(paste0("Fetching data: ", date.range[i]))
      l[[i]] <- wunder_station_daily('EKAH', date.range[i])
    }

    # stack elements of list into DF, filling missing columns with NA
    d <- ldply(l)

A: They changed the URL a bit and, while I think I could have just subbed out the bad URL for the new one, here's a modernized version of most of that code (I did 99% of the cleanup you did):
#' @param station station name
#' @param wx_date Date object or character string
#' @param fmt if wx_date is not a Date object and the character string
#'        is not in "%Y-%m-%d" format, then specify the format here
#' @return data.frame of redings
get_wx <- function(station="EKAH", wx_date=Sys.Date(), fmt="%Y-%m-%d") {

  require(httr)
  require(readr)

  if (inherits(wx_date, "character")) {
    wx_date <- as.Date(wx_date, fmt)
  }

  wx_base_url <- "https://www.wunderground.com/history/airport/%s/%s/DailyHistory.html"
  wx_url <- sprintf(wx_base_url, station, format(wx_date, "%Y/%m/%d"))

  res <- httr::GET(wx_url, query=list(MR=1, format=1))
  dat <- httr::content(res, as="text")

  dat <- gsub("
", "", dat)
  dat <- read.table(text=dat, sep=",", header=TRUE,
                    na.strings=c("-", "N/A", "NA"), stringsAsFactors=FALSE)

  # saner column names

  cols <- colnames(dat)

  # via http://stackoverflow.com/a/22528880/1457051
  cols <- gsub("([a-z])([A-Z])", "\\1_\\L\\2", cols, perl=TRUE)
  cols <- sub("^(_[a-z])", "\\L\\1", cols, perl=TRUE)
  cols <- tolower(gsub("\\.", "_", cols))

  readr::type_convert(setNames(dat, cols)) # more robust than type.convert()

}

tdy <- get_wx()

str(tdy)
## 'data.frame': 36 obs. of  14 variables:
##  $ time_cest            : chr  "12:00 AM" "12:20 AM" "12:50 AM" "1:00 AM" ...
##  $ temperature_f        : num  51 50 48.2 47 46.4 44.6 44 44.6 44.6 44 ...
##  $ dew_point_f          : num  41 41 39.2 39 39.2 39.2 38 39.2 39.2 38 ...
##  $ humidity             : int  60 71 71 67 76 81 71 81 81 73 ...
##  $ sea_level_pressure_in: num  30.1 30.1 30.1 30.1 30.1 ...
##  $ visibility_mph       : num  28 6.2 6.2 28 6.2 6.2 7 6.2 6.2 28 ...
##  $ wind_direction       : chr  "WNW" "West" "West" "West" ...
##  $ wind_speed_mph       : chr  "2.3" "2.3" "2.3" "2.3" ...
##  $ gust_speed_mph       : logi  NA NA NA NA NA NA ...
##  $ precipitation_in     : logi  NA NA NA NA NA NA ...
##  $ events               : logi  NA NA NA NA NA NA ...
##  $ conditions           : chr  NA "Unknown" "Unknown" NA ...
##  $ wind_dir_degrees     : int  300 270 270 270 270 270 270 280 280 270 ...
##  $ date_utc             : POSIXct, format: "2016-06-08 22:00:00" "2016-06-08 22:20:00" ...

a_yr_ago <- get_wx(wx_date="2015-06-09")

You can add "" to the na.strings vector if desired.
And, here's an alternate way to get readings for a range of dates into a data.frame:
library(purrr)

rng <- map_df(seq(as.Date("2015-12-01"), as.Date("2015-12-04"), "1 day"),
              function(x) { get_wx(wx_date=x) })


text:
Q: Get latest record for join result I have the following tables in my database:
ATable
a_id | a_name
1    | name1
2    | name2
...

BTable
a_id | b_id | b_name
1    | 1    | name1
1    | 2    | name2
2    | 3    | name1
...

CTable
b_id | c_id | c_name
1    | 1    | name1
1    | 2    | name2
2    | 3    | name1
...

ValueTable
b_id | c_id | value | date
1    | 1    | abcd  | 2018-01-19 03:14:07
1    | 1    | wxyz  | 2018-01-20 10:45:15
2    | 3    | abcd2 | 2018-02-05 10:11:12
1    | 2    | abcd3 | 2018-02-11 14:29:36

Object A has a list of object B. Object B has a list of object C.
For a given combination of b_id and c_id, there can be one or more values in ValueTable.
For valid combination of b_id and c_id under a given a_id, I want the latest inserted value in ValueTable.
For the above example, I want the following output:
b_id | c_id | value | date
1    | 1    | wxyz  | 2018-01-20 10:45:15
1    | 2    | abcd3 | 2018-02-11 14:29:36
2    | 3    | abcd2 | 2018-02-05 10:11:12

For now, what I'm doing is:
select c.c_id, b.b_id
from ATable a
    join BTable b on a.a_id = b.a_id
    join CTable c on b.b_id = c.b_id
where a.a_id=?

Then, for each pair of b_id and c_id in the result, I do:
select value, date
from ValueTable
where b_id=? and c_id=?
order by date desc limit 1

Is there a single query which do the job?
Example schema:
create table ATable (
    a_id int auto_increment,
    a_name varchar(20),
    primary key (a_id)
);
create table BTable (
    b_id int auto_increment,
    a_id int,
    b_name varchar(20),
    primary key (b_id),
    foreign key (a_id) references ATable(a_id)
);
create table CTable (
    c_id int auto_increment,
    b_id int,
    c_name varchar(20),
    primary key (c_id),
    foreign key (b_id) references BTable(b_id)
);
create table ValueTable (
    b_id int,
    c_id int,
    val varchar(20),
    created timestamp DEFAULT CURRENT_TIMESTAMP,
    foreign key (c_id) references CTable(c_id),
    foreign key (b_id) references BTable(b_id)
);

insert into ATable (a_name) values
('a1'),('a2');
insert into BTable (a_id, b_name) values
(1, 'b1_1'), (1, 'b1_2'), (2, 'b2');
insert into CTable (b_id, c_name) values
(1, 'c1_1'), (1, 'c1_2'), (1, 'c1_3'),
(2, 'c2_1'), (2, 'c2_2'), (3, 'c3');
insert into ValueTable (b_id, c_id, val) values
(1, 1, 'value1'),
(1, 2, 'value2'),
(1, 3, 'value3'),
(2, 4, 'value4'),
(2, 5, 'value5'),
(3, 6, 'value6');
insert into ValueTable (b_id, c_id, val) values
(1, 1, 'value7'),
(1, 2, 'value8'),
(1, 3, 'value9'),
(2, 4, 'value10'),
(2, 5, 'value12'),
(3, 6, 'value13');
insert into ValueTable (b_id, c_id, val) values
(1, 1, 'value14'),
(1, 2, 'value15'),
(1, 3, 'value16'),
(2, 4, 'value17'),
(2, 5, 'value18'),
(3, 6, 'value19');

After running the ValueTable inserts a few seconds apart, the output I want is:
a_id=1
b_id | c_id | value
1    | 1    | value14
1    | 2    | value15
1    | 3    | value16
2    | 4    | value17
2    | 5    | value18

A: The kernel of the problem can be solved as follows:
SELECT x.*
  FROM valuetable x
  JOIN
     ( SELECT b_id
            , c_id
            , MAX(created) created
         FROM valuetable
        GROUP
           BY b_id
            , c_id
     ) y
    ON y.b_id = x.b_id
   AND y.c_id = x.c_id
   AND y.created = x.created;
+------+------+---------+---------------------+
| b_id | c_id | val     | created             |
+------+------+---------+---------------------+
|    1 |    1 | value14 | 2018-03-20 10:13:14 |
|    1 |    2 | value15 | 2018-03-20 10:13:14 |
|    1 |    3 | value16 | 2018-03-20 10:13:14 |
|    2 |    4 | value17 | 2018-03-20 10:13:14 |
|    2 |    5 | value18 | 2018-03-20 10:13:14 |
|    3 |    6 | value19 | 2018-03-20 10:13:14 |
+------+------+---------+---------------------+

I'll leave the rest as an exercise for the reader


text:
Q: Python: Printing brackets around statements (class objects) based on conditions Just a heads up, this isn't homework, it's from a past paper i'm trying to do but we have no reference to how to 'actually' do it.
We've been given a task to implement '+' alongside 'Const' as set of classes, with the idea of working out whether to place brackets around the expression or not - for example:
eg1. Plus(Plus(Const(3),Const(4)),Const(5)) should print 3 + 4 + 5
eg2. Plus(Const(3),Plus(Const(4),Const(5))) should print 3 + (4 + 5)
So, I've come to the conclusion that I need something within my str method which checks if there is more than one 'value' in my self.l or self.r, and if so to print brackets around the self.l or self.r respectively. I believe this to be the case because in eg2, there is a 'plus' which applies to more than one constant. Please correct me if I am wrong.
I'm not looking for someone to give me the answer to this, but more of a hint of where to begin. I've recently began coding and am finding it difficult to be able to work out how to implement what I want to do.
class Expr :
    pass

class Plus(Expr) :
    def __init__(self,l,r) :
        self.l = l
        self.r = r

    def __str__(self):
        return str(self.l)+ "+" +str(self.r) #I believe here is where I need to implement.

class Const(Expr) :
    def __init__(self,v) :
        self.v = v

    def __str__(self):
        return str(self.v)

Any help would be greatly appreciated.

My Lecturer gave the answer, but i'm a little confused by the 'par' meaning - could anyone help me comprehend why bool values are used to differentiate?
class Expr :
    def __str__(self) :
        return self.str_aux(False)

class Plus(Expr) :
    def str_aux(self,par) :
        s =self.l.str_aux(False)+"+"+self.r.str_aux(True)
        if par :
            return "("+s+")"
        else :
            return s

class Const(Expr) :
    def __init__(self,v) :
        self.v = v

    def str_aux(self,par) :
        return str(self.v)

A: The rule is fairly straightforward: if the right hand side of a Plus is itself a Plus, then you want to add parentheses, otherwise you don't.
As for checking if self.l and self.r exist, you should use isinstance to differentiate between a Plus and a Const.
class Plus(Expr) :
    def __init__(self,l,r) :
        self.l = l
        self.r = r

    def __str__(self):
        if isinstance(self.r, Plus):
            return '{} + ({})'.format(self.l, self.r)
        else:
            return '{} + {}'.format(self.l, self.r)

Example
print(Plus(Const(3),Plus(Const(4),Const(5))))
print(Plus(Plus(Const(3),Const(4)),Const(5)))

Output
3 + (4 + 5)
3 + 4 + 5

About your lecturer solution
Your lecturer implemented the same solution as above but delegates the task to add parenthesis to the object being printed.
The method str_aux behaves similarly to __str__ except it also takes a boolean argument par that indicates whether or not parentheses should be printed.
Example
plus = Plus(Const(3), Const(4))
plus.str_aux(False) # "3+4"
plus.str_aux(True) # "(3+4)"

The base case is when printing a Const which str_aux ignores the par and does not print parentheses.


text:
Q: If $\text{Im}(S^*M)\subseteq \text{Im}(M)$, is $\text{Im}(SM)\subseteq \text{Im}(M)$? Let $F$ be a complex Hilbert space and $\mathcal{B}(F)$ the algebra of all bounded linear operators defined on $F$.

Assume that

*

*$M\in \mathcal{B}(F)^+$ (i.e. $\langle Mx\;, \;x\rangle\geq 0$ for all $x\in F$).

*$S\in\mathcal{B}(F)$ such that $\text{Im}(S^*M)\subseteq \text{Im}(M)$.
It is true that
$$\text{Im}(SM)\subseteq \text{Im}(M)\;?$$

A: No: $F = \mathbb C^2$,
$M= \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}$, $S= \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}$.


text:
Q: How to minimize additional code window in Visual Studio? Recently, due to changes in the hardware, I had to do full reinstall of my dev machine. After installing Visual Studio 2013 I noticed, that I no longer can minimize additional code windows residing on second display (the ones, which appear, when you "rip" a tab from the regular tab well). Also, these windows force stay on top of Visual Studio's main window.
How can I restore this behavior?
Note: You can RMB-click title of this window and choose "Minimize", but it minimizes in Windows 3.11-way - to small rectangle above the task bar. I want them to be regular additional windows visible on the taskbar as separate icons.

A: Found out. Resharper is guilty in this case.
Ref: http://blog.jetbrains.com/dotnet/2012/09/28/resharper-71-early-access-is-open/#comment-69976


text:
Q: Manipulate vertex attributes in batch for an igraph network I have an igraph network graph ig as follows.
library(igraph)

edges <- data.frame(from = c("X", "U", "V", "M", "G", "G1", "G2", "G3", "G4a", "G3", "G4b",
                             "G5b", "H", "R", "R1", "R2", "O", "O1", "O2", "H", "Y", "N",
                             "J", "K"),
                    to = c("G", "X", "U", "K", "G1", "G2", "G3", "G4a", "J", "G4b", "G5b",
                           "H", "R", "R1", "R2", "O", "O1", "O2", "O3", "F", "G", "K", "R",
                           "F"))

nodes <- data.frame(key = c("G", "X", "Y", "U", "V", "K", "M", "N", "G1", "G2", "G3", "G4a",
                            "J", "G4b", "G5b", "H", "R", "R1", "R2", "O", "O1", "O2", "O3",
                            "F"),
                    type = c("G", "D", "T", "D", "T", "G", "T", "T", "D", "D", "D", "D",
                             "D", "D", "D", "D", "G", "D", "D", "D", "D", "D", "D", "G"),
                    f1 = c("X", "U", NA, "V", NA, "M", NA, NA, "G", "G1", "G2", "G3",
                           "G4a", "G3", "G4b", "G5b", "H", "R", "R1", "R2", "O", "O1", "O2",
                           "H"),
                    f2 = c("Y", NA, NA, NA, NA, "N", NA, NA, NA, NA, NA, NA, NA, NA, NA,
                           NA, "J", NA, NA, NA, NA, NA, NA, "K"),
                    inter = c(0, 1, NA, 1, NA, 0, NA, NA, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1,
                              1, 1, 1, 1, 0))

ig <- graph_from_data_frame(d = edges, directed = TRUE, vertices = nodes)

In addition, I have a list of vertex paths (igraph.vs) as follows.
igpaths <- list(structure(c(V = 5L, U = 4L, X = 2L), class = "igraph.vs"),
                structure(21:23, .Names = c("O1", "O2", "O3"), class = "igraph.vs"),
                structure(c(G = 1L, G1 = 9L, G2 = 10L, G3 = 11L, G4a = 12L,
                            J = 13L), class = "igraph.vs"),
                structure(c(G = 1L, G1 = 9L, G2 = 10L, G3 = 11L, G4b = 14L,
                            G5b = 15L, H = 16L), class = "igraph.vs"),
                structure(17:20, .Names = c("R", "R1", "R2", "O"), class = "igraph.vs"))

igpaths
[[1]]
+ 3/? vertices, named (deleted):
[1] V U X

[[2]]
+ 3/? vertices, named (deleted):
[1] O1 O2 O3

[[3]]
+ 6/? vertices, named (deleted):
[1] G   G1  G2  G3  G4a J

[[4]]
+ 7/? vertices, named (deleted):
[1] G   G1  G2  G3  G4b G5b H

[[5]]
+ 4/? vertices, named (deleted):
[1] R  R1 R2 O

According to these igraph.vs objects, I would like to manipulate some of the vertex attributes in ig.
list.vertex.attributes(ig)
[1] "name"   "type"   "f1"     "f2"     "inter"  "retain"

vtosum <- c("inter")
vtocopy <- c("f1", "f2", "retain")

1. I want to copy the values of the attributes in vtocopy for the first node in igraph.vs to the last one in the same.
For example in igpaths[[1]], I want to copy the values of f1, f2 and retain from vertex V to X.
igpaths[[1]]
+ 3/? vertices, named (deleted):
[1] V U X

2. I want to replace the values of the attributes in vtosum for the last node in an igraph.vs with the sum of all the values of the same in that particular igraph.vs object.
For example in igpaths[[3]], the value of inter in vertex J should be 5.
igpaths[[3]]
+ 6/? vertices, named (deleted):
[1] G   G1  G2  G3  G4a J
sum(V(ig)$inter[which(names(V(ig)) %in% names(igpaths[[3]]), useNames = T)])
[1] 5

Is there a more elegant way to achieve this?


text:
Q: How to implement a promise code snippet in place of Mysql client in node.js My primitive purpose to ask for a solution was because, i want to use Observables because i want to obtain real-time data on angular UI. But here the issue is i get sql error --> Too many sql connections . So i need to close the connection everytime after the query hits the database. That is not happening in my code. So i searched for the codes available and found this -
https://codeburst.io/node-js-mysql-and-promises-4c3be599909b
nodejs code -
 const mysql = require( 'mysql' );
  class Database {
   constructor( config ) {
    this.connection = mysql.createConnection( config );
    }
   query( sql, args ) {
    return new Promise( ( resolve, reject ) => {
        this.connection.query( sql, args, ( err, rows ) => {
            if ( err )
                return reject( err );
            resolve( rows );
        } );
     } );
    }
   close() {
    return new Promise( ( resolve, reject ) => {
        this.connection.end( err => {
            if ( err )
                return reject( err );
            resolve();
        } );
    } );
    }
    }

Now i want to implement this above code in my nodejs file whose code is this -
[The http request from my angular hits the controller.js file first and then from there it hits the service.js file]
UPDATED
dashboard.controller.js
  var express = require('express');
  var router = express.Router();
  var dashboardService = require('../../services/SYSTEM
   /dashboard.service');
   var app = express();

    router.post('/abcEntireSuccess',abcEntireSuccess);

    module.exports = router;

  function abcEntireSuccess(req, res) {

    dashboardService.abcEntireSuccess(req.body)
          .then(function (result) {
          if (result.length > 0) {
            console.log("we get data in node :: " +
        Object.values(result));
            console.log(result.length + " record found  ");
            res.send(result);
           }
         else {
            result=[];
            res.send(result);
         }
       })
       .catch(function (err) {
        res.status(400).send(err);
        console.log("some error occured");
       });
       }

dashboard.service.js
    var mysql = require('mysql');
    var Q = require('q');
    var express = require('express');
    var service = {};
    var config = require('../../config.json');
    const async = require('async');

       service.abcEntireSuccess = abcEntireSuccess;

        module.exports = service;

 function abcEntireSuccess() {

  var sqlQuery = `select * from TRANSACTION_PAYLOAD where INTERFACE_NAME =
   'abc' AND (STATUS ='SUCCESS_RESPONSE')`

    var deferred = Q.defer();

    var host = config.host;
    var user = config.user;
    var password = config.password;
    var database = config.database;

     var con = mysql.createConnection({
     host: host,
     user: user,
     password: password,
     database: database
       });

      con.connect(function (err) {
       if (err) deferred.reject(err.name + ': ' + err.message);

       con.query(sqlQuery,
           function (err, result, fields) {
            if (err) deferred.reject(err.name + ': ' + err.message);

            console.log("my result => ",result);

            deferred.resolve(result);

        });

       })

     console.log(" deferred.promise; ");
    return deferred.promise;

  }

please help in the  implementation.
@skipperhoa
UPDATED
When i implement your code... i get this error in angular UI i.e. html ,
POST http://localhost:8096/dashboard/abcEntireSuccess/ 404 (Not Found)
Please help resolve

A: You can try the following after code

//dashboard.controller.js
var express = require('express')
var router = express.Router()
var dashboardService = require('./dashboard.service.js');

router.get('/test2',function(req,res){
  console.log(dashboardService.abcEntireSuccess());
});

module.exports = router

//dashboard.service.js
var mysql = require('mysql');
var express = require('express');
var config = require('../config/config.json');
var exports = module.exports = {};

exports.abcEntireSuccess = function() {
    const db = new Database(config);
    db.query( 'SELECT * FROM users' ).then( rows => {
        return rows;
    } );
db.close();
};

class Database {
    constructor( config ) {
        this.connection = mysql.createConnection( config.values);
    }
    query( sql, args ) {
        return new Promise( ( resolve, reject ) => {
            this.connection.query( sql, args, ( err, rows ) => {
                if ( err )
                    return reject( err );
                console.log(rows);
                resolve( rows );
            } );
        } );
    }
    close() {
        return new Promise( ( resolve, reject ) => {
            this.connection.end( err => {
                if ( err )
                    return reject( err );
                resolve();
            } );
        } );
    }
 }
//congfig/config.json
{
    "values" : {
        "host" : "localhost",
        "user" : "root",
        "password" : "",
        "database" : "demo"
    }
}


text:
Q: Only read only mode on partition other than root partition First of all, I am new to Linux environment.
Recently I decided to switch to Linux environment to become a computer geek :P. But need to have Windows also for some basic tasks like Office and for siblings.
My choice of Linux is Elementary OS dual booting with Windows.
I installed Windows 10 (free installation, old one was years old now) and then installed Linux so I wont get into any trouble with grub and stuff.
Used Elementary fine and Windows too, no issues. And then the problem arises:
Windows gave me an update, I updated my system. Previously, I didn't got any trouble with accessing files. I used to download torrents from both distro into the same folder which was NTFS(E: drive) btw but after the update all drives are still mounted in Linux and are read only now. Another thing I notice in Grub Loader, previously there were only two options to select Elementary or Windows, now it gives me 4-5 options saying boot from F:\efi or G:\efi (something like that it shows more than one location of efi. Don't know this stuff).
Problem is I am not able to write to any partition other than my linux partition(/), rest are mounted read-only.
Currently, three drives are installed in my PC:
1) Drive on which Windows is installed

2) Drive on which Linux is installed

3) External Drive for storage


text:
Q: How can I open webpage in new tab with javascript and middle click I have a anchor inside a list item

    description
    count

Using javascript, whenever the list item is clicked, the window opens the anchor's href.
I want to let the browser know that when it middle clicks it can treat the list item the same as the anchor, and open in a new tab.
I've looked around and seen that most people think this cannot be done, but I think my situation could be different. One way of looking at it would be not to explicitly tell the browser to open a new tab, rather tell the browser to do what is does when middle click is used.
What do you think?
EDIT: Updated html for a more accurate description. The anchor is not the only element in the list

A: Ok nay sayers :), I've figured out how to do it.
With JS/jQuery I can determine which button is pressed. Using this I can change the target value on the anchor to "_blank" only when the middle button is pressed.

A: You want the list item to function as a link. The simplest, most reliable way to do this is to get rid of the JavaScript and apply CSS to make the link fill the list item. Then any click on the list item will hit the link first. Listamatic has many examples.

A: Using jQuery 1.7
$('ul').on('click', 'li', function(e){
    if(e.which == 2){
        var newWindow = $(this).find('a').attr('href');
        window.open(newWindow, 'newWindow');
        e.preventDefault();
    }
});

That's it. jQuery normalizes the event.button to event.which so you can reliably detect middle clicks. Then just open a new window. Granted, whether or not it ends up in a new tab or a new windows entirely rests on the users' browser preferences.

A: _blank wasn't working for me in Chrome V92.
Instead - A workaround will be to create a "fake" <a tag that will work only for middle clicks, like this:

        Only clicks with middle buttons will work


text:
Q: Convert string representation of matrix to matrix I have a Python script which generates and outputs Mathematica matrices. I use RunProcess to run my Python script and I extract the StandardOutput which is the Mathematica matrix as a string.
What I would like to do is take that string and perform matrix operations on it, for example, compute its eigenvectors.
For example:
RunProcess[{"python", "myscript.py"}][[2]]

which outputs
{{0, 0, 1-r, 0, 0, 1-r},{1-r, 1-r, 0, 1-r, 0, 0},{0, 0, 0, 0, 1,
0},{0, 0, 0, 0, 0, 0},{0, 0, r, 0, 0, r},{r, r, 0, r, 0, 0}}

and I would like to have something like
MyMatrix[r_] := RunProcess[{"python", "myscript.py"}][[2]]

Which would give me the equivalent of:
MyMatrix[r_] := {{0, 0, 1-r, 0, 0, 1-r},{1-r, 1-r, 0, 1-r, 0, 0},{0, 0, 0, 0, 1,
0},{0, 0, 0, 0, 0, 0},{0, 0, r, 0, 0, r},{r, r, 0, r, 0, 0}}

which I can perform matrix operations on. The problem is, when I extract the standard out, the output is in a string format and it isn't converting to a symbolic matrix automatically. Is there some command I can use? Thanks.

A: You're looking for the function ToExpression.
ToExpression["{{1-r, 1-r, 0},{0, 0, 1},{r, r, 0}}"]

will transform the string "{{1-r, 1-r, 0},{0, 0, 1},{r, r, 0}}" into a 3x3 matrix.


text:
Q: Celery message queue vs AWS Lambda task processing Currently I'm developing a system to analyse and visualise textual data based on NLP.
The backend (Python+Flask+AWS EC2) handles the analysis, and uses an API to feed the result back to a frontend (FLASK+D3+Heroku) app that solely handles interactive visualisations.
Right now the analysis in the prototype is a basic python function which means on large files the analysis take longer and thus resulting a request timeout during the API data bridging to frontend. As well as the analysis of many files is done in a linear blocking queue.
So to scale this prototype, I need to modify the Analysis(text) function to be a background task so it does not block further execution and can do a callback once the function is done. The input text is fetched from AWS S3 and the output is a relatively large JSON format aiming to be stored in AWS S3 as well, so the API bridge will simply fetch this JSON that contains data for all the graphs in the frontend app. (I find S3 slightly easier to handle than creating a large relational database structure to store persistent data..)
I'm doing simple examples with Celery and find it fitting as a solution, however i just did some reading in AWS Lambda which on paper seems like a better solution in terms of scaling...
The Analysis(text) function uses a pre-built model and functions from relatively common NLP python packages. As my lack of experience in scaling a prototype I'd like to ask for your experiences and judgement of which solution would be most fitting for this scenario.
Thank you :)

A: I would like to share a personal experience. I moved my heavy-lifting tasks to AWS Lambda and I must admit that the ROI has been pretty good. For instance, one of my tasks was to generate monthly statements for the customers and then mail them to the customers as well. The data for each statement was fed into a Jinja template which gave me an HTML of the statement. Using Weasyprint, I converted the HTML to a Pdf file. And then mailing those pdf statements was the last step. I researched through various options for creating pdf files directly, but they didn't looked feasible for me.
That said, when the scale was low, i.e. for when the number of customers was small, celery was wonderful. However to mention, during this task, I observed CPU usages went high. I would add to the celery queue this task for each of the customers, from which the celery workers would pick up the tasks and execute it.
But when the scale went high, celery didn't turn out to be a robust option. CPU usages were pretty high(I don't blame celery for it, but that is what I observed). Celery is still good though. But do understand this, that with celery, you can face scaling issues. Vertical scaling may not help you. So you need horizontally scale as your backend grows to get get a good performance from celery. When there are a lot of tasks waiting in the queue, and the number of workers is limited, naturally a lot of tasks would have to wait.
So in my case, I moved this CPU-intensive task to AWS Lambda. So, I deployed a function that would generate the statement Pdf from the customer's statement data, and mail it afterward. Immediately, AWS Lambda solved our scaling issues. Secondly, since this was more of a period task, not a daily task - so we didn't need to run celery everyday. The Lambda would launch whenever needed - but won't run when not in use. Besides, this function was in NodeJS, since the npm package I found turned out to be more efficient the solution I had in Python. So Lambda is also advantageous because you can take advantages of various programming languages, yet your core may be unchanged. Also, I personally think that Lambda is quite cheap - since the free tier offers a lot of compute time per month(GB-seconds). Also, underlying servers on which your Lambdas are taken care to be updated to the latest security patches as and when available. As you can see, my maintenance cost has drastically dropped.
AWS Lambdas scale as per need. Plus, they can serve a good use case for tasks like real-time stream processing, or for heavy data-processing tasks, or for running tasks which could be very CPU intensive.


text:
Q: Node mcu get data unknown I am trying to find a way through which I can send get request to my local server .
Hear's my code
#include <ESP8266WiFi.h>

#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
const char* ssid     = "Jio-Fi 002";
const char* password = "password";

const char* host = "192.168.225.127";
int ledPin = 12;
int failPin = 14;

void setup() {

  pinMode(ledPin , OUTPUT);
  pinMode(failPin , OUTPUT);
  delay(10);
  digitalWrite(failPin , LOW);
  digitalWrite(ledPin , HIGH);
  // We start by connecting to a WiFi network

  delay(1000);

  WiFi.mode(WIFI_OFF);        //Prevents reconnection issue (taking too long to connect)
  delay(1000);
  WiFi.mode(WIFI_STA);        //This line hides the viewing of ESP as wifi hotspot

  WiFi.begin(ssid, password);     //Connect to your WiFi router

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    digitalWrite(failPin , HIGH);
    digitalWrite(ledPin , LOW);
  }
  digitalWrite(ledPin , HIGH);
  digitalWrite(failPin , LOW);
  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) { //works!
    digitalWrite(failPin , HIGH);
    digitalWrite(ledPin , LOW);

    return;

  }
   digitalWrite(ledPin , HIGH);
  digitalWrite(failPin , LOW);

  // We now create a URI for the request

  String url = "/Anet/Projects/Index.php";
  url += "?product_id=";
  url += "001";
  url += "&data=";
  url += "Some one is on the door !!";

  // This will send the request to the server
  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "Connection: close\r\n\r\n");

    ESP.deepSleep(0);
}
void loop () {

  }

I can't detect any error here .
The fail led glows when my server is offline , but when i start my server and try to send data through nodemcu , fail led dosent glows .
There is no error in my php code as I tried doing the same with browser , and it worked.
I am completely new to all this .
Sorry for any grammatical mistakes .
Thanks Alot !

A: You should have some code or function calling inside the loop.
The setup runs only one time when the NodeMCU is turned on.


text:
Q: How can I dynamically create class methods in Ruby? In Rails we can call "Person.find_by_attribute" where 'attribute' is dynamically placed by attributes in the 'Person' migration. I want to replicate this logic n my Person class without rails and call 'find_by_attribute' for the attributes. What I have so far:
class Person
  def attributes
    [
      { id: 1, nice_attribute: "something" },
      { id: 2, nice_attribute: "another thing" },
    ]
  end

  def find_by_id(id)
    attributes.select { |d| d[:id] == id }
  end

But defining a find_by like this could bloat the class quickly. How can I achieve dynamic def setting?

A: I'm reasonably sure this is not how Rails does this, but here is some implementation that might assist you:
What you have defined there is a Singleton class and you should be aware of how to dynamically define attribute records in such a class before committing to that design. It might be a good choice, but you should be feeding that class an access point to search through records defined elsewhere. Regardless, the below will get you started:
class Person
  @@attributes = { id: Integer, nice_attribute: String }

  # getter method
  def self.attribute_types
    @@attributes
  end

  attribute_types.keys.each do |attr|
    define_singleton_method :"find_by_#{attr}" do |value|
      # logic
    end
  end
end

Then you will be able to call Person.find_by_id or Person.find_by_nice_attribute
When you implement it may be better for you to have a PersonRecord module that collects records from a database and the Person class might be an instance like so:
class Person
  def initialise(opts ={})
    define_find_by_methods
  end

  def attribute_keys
    # stub method, but should be collecting this information dynamically
    [ :id, :nice_attribute ]
  end

  def define_find_by_methods
    attribute_keys.each do |attr|
      # no longer using define_singleton_method here and define_method is a class method you will have to send it to self.class
      self.class.send(:define_method, :"find_by_#{attr}") do |val|
        # logic
      end
    end
  end
end


text:
Q: Is annihilation a smooth process that requires time? There are a lot of questions on this site about annihilation and quantum processes (and whether they are instantaneous), but none of them specifically give a satisfactory answer to my question. None of these specifically take annihilation to be instantaneous or not, and none of them specifically address how to model the process smoothly.
Like this one:

We then talk about a tunneling event or an emission/absorption event, and we can attribute to them a characteristic time.

Are quantum events such as decay, emission, absorption and tunneling truly instantaneous or is there some small time period?
I have read this question:

But there is no clearly identifiable "particles" in the middle when the scattering reaction takes place, just a messy and evolving quantum state. We can track neither experimentally nor theoretically the identity of a particle in the input and point to any specific point in time when it "disappears". QFT allows us to compute the probabilities for certain inputs to lead to certain outputs, but it is not tractable to produce some sort of "live view" of the scattering process - it's like a black box, particles go in, particles come out.

At what point of approach in annihilation process the charges of antiparticles disappear? How is relevant to the electron-proton interaction?
Now I am not asking about the intermediate states or what is inbetween. I am simply asking, if nothing is inbetween, just a "black box", and electron-positron pair coming in, and two photons (or a photon near a nucleus, but let's not complicate it with this) going out, then is this process truly instantaneous?
The reason I am asking, is because as far as I understand, quantum mechanical processes always take time and are never instantaneous. The deeper reasoning behind this should have to do with the speed of light not being infinite, but my question is not about this. My favorite example of describing whether quantum processes are instantenous is my previous question about the electron's change of energy levels (in atoms).

In every reasonable interpretation of this question, the answer is no. But there are historical and sociological reasons why a lot of people say the answer is yes.
Consider an electron in a hydrogen atom which falls from the $2p$ state to the $1s$ state. The quantum state of the electron over time will be (assuming one can just trace out the environment without issue)
$$|\psi(t) \rangle = c_1(t) |2p \rangle + c_2(t) | 1s \rangle.$$
Over time, $c_1(t)$ smoothly decreases from one to zero, while $c_2(t)$ smoothly increases from zero to one. So everything happens continuously, and there are no jumps. (Meanwhile, the expected number of photons in the electromagnetic field also smoothly increases from zero to one, via continuous superpositions of zero-photon and one-photon states.)
The wavefunction $\psi(\mathbf{r}, t)$ evolves perfectly continuously in time during this process, and there is no point when one can say a jump has "instantly" occurred.

Do electrons really perform instantaneous quantum leaps?
Now this in knzhou's perfect answer is really naively understandable, the quantum state smoothly changes with the expectation values of the first state and the second state changing smoothly. This is understandable, because we are talking about a probability distribution of the electron around the nucleus.
However, when I try to use this for the process of annihilation, it does not seem to work. The good thing about the electron jump example is that the probability distribution describes the electron's position around the nucleus with co-existing multiple states already at certain probabilities. From there, applying the smooth change is understandable.
Though, this is where it becomes hard to apply for the annihilation, because the particle's type itself is not like that. The particle's type itself is in a definite state (as far as I understand), and does not evolve (without interaction), does not change, and an electron is always an electron. I could not say that the electron's type is described by the wavefunction in a way where the particle is at certain probabilities co-existing as an electron and as a photon at the same time.
But with annihilation, something like that should happen. The quantum state before annihilation describes the electron-positron pair's state as a definite, the type of particles are just that (before annihilation, the electron is 100% electron, and the positron is 100% positron, and after annihilation, the photons are a 100% photons). After the annihilation, though, the particle's type changes instantaneously, to two photons. There is no smooth change, no probabilities.
In other words, can we somehow smoothly model the annihilation process with the similar method (electronic transition) in knzhou's answer, or is it just an abrupt (instantaneous) change?
Question:

*

*Is annihilation a smooth process that requires time?

A: I would say your second quote answers your question just fine. No, of course the process of annihilation is not instantaneous. You start with some state of the electron field and photon field that you can interpret as "1 electron, 1 positron, 0 photons" and it evolves smoothly into some state (or superposition of states) of those fields that you can interpret as "no electrons or positrons, 2 (or more) photons." If you probe the state during the annihilation, you will not see either the input state or the output state, but a messy and random field configuration, just as your second quote says. Though it's not tractable to compute this smoothly evolving intermediate state, its existence answers your question.
You may be running into issues because the idea of "an electron" or "a photon" is in itself problematic. In QFT, the fields are reality, and we name/interpret certain configurations of those fields as containing "particles" for our convenience. But the particles don't have physical reality outside of describing the fields, and if the fields evolve in a way that seems discontinuous in your particle model, then that's just because the particle model has broken down and not because the fields are actually doing anything discontinuous. (I.e. the field state has strayed sufficiently far away from any state we can easily describe by listing particles.)
Also, you can definitely construct (mathematically, if not practically—but of course you could physically realize it if you really wanted to) a quantum state that is a superposition between "there is an electron here" and "there is a photon here". This state will quickly evolve to a superposition between "there is an electron here" and "there is a photon way over there," so it's not particularly useful for calculations, but it exists. We do see something like this in neutrinos. The Sun creates electron neutrinos via nuclear reactions, but excitations of the electron neutrino field oscillate smoothly into excitations of the tau and muon neutrino fields (and back) as they travel. The first neutrino detectors on Earth thus only detected a fraction of the expected number of solar neutrinos, since they were only looking for electron neutrinos, spawning the (now-resolved) solar neutrino problem. Or contemplate the superposition $K_L=\frac1{\sqrt2}(K^0+\bar K\vphantom K^0)$ of two kaon types that lies in the resolution of the tau-theta puzzle (this is analogous to a superposition of an electron and a positron).

A:
can we somehow smoothly model the annihilation process?

The answer is no and yes.
No, because there is no established theory about it. As long as electric and magnetic fields are represented as continuous and steady functions and as long as photons with their electric and magnetic field are treated as structureless, there will be no description of the transition of two particles to pure energy.
Yes, because there is a structural description of me. In it, a Theses about the inner structure of physical fields with only two particles is presented that can represent both the annihilation process and the termination of this process when the electron approaches the proton. The charm of the theory is therefore not so much in annihilation processes, but much more in the description of why the proton-electron interaction leads to photon emission, but this process does not end in annihilation.


text:
Q: Does tensorflow support online training? I try to feed the data sample-by-sample. The result is either completely wrong or very approximate (25-50% absolute error) on different datasets. The result is fine for all datasets, if training in one go.
import itertools as itools
import numpy as np
import tensorflow as tf
from sklearn import preprocessing

class Test:
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self._i = 0

    def do_test(self):
        x_col = tf.contrib.layers.real_valued_column("x", dimension=1)
        model = tf.contrib.learn.LinearRegressor(feature_columns=[x_col])
        print("Fitting")
        max_steps = 80
        for _ in range(0, len(self.x)):
            model.fit(input_fn=self.input_split, steps=max_steps)
        print("Predicting")
        scaled_out = model.predict(input_fn=self.eval_fn)
        print(self._inverse_y(list(itools.islice(scaled_out, self.eval_len))))

    def input_split(self):
        if 0 == self._i:
            self.x_std, self.y_std = self._transform(self.x, self.y)
        if len(self.x_std) == self._i:
            raise StopIteration
        x = self.x_std[self._i]
        y = self.y_std[self._i]
        self._i += 1
        feature_cols = {"x": tf.constant([x], dtype=tf.float32),
                        }
        print(x, y)
        label = tf.constant([y], dtype=tf.float32)
        return feature_cols, label

    def eval_fn(self):
        x = [0, 1, 5, 10]
        y = np.zeros(len(x))

        self.eval_len = len(x)

        x_std, y_std = self._transform(x, y)
        feature_cols = {"x": tf.constant(x_std, dtype=tf.float32),
                 }
        label = tf.constant(y_std, dtype=tf.float32)
        return feature_cols, label

    def _transform(self, x_in, y_in):
        if not hasattr(self, "x_scaler"):
            self.x_scaler = preprocessing.StandardScaler().fit(x_in)
            self.y_scaler = preprocessing.StandardScaler().fit(y_in)
        x_std = self.x_scaler.transform(x_in)
        y_std = self.y_scaler.transform(y_in)
        return x_std, y_std

    def _inverse_y(self, y_std):
       return self.y_scaler.inverse_transform(y_std)

P.S. fit and partial_fit are the same according to the source

A: This looks like learning_rate and/or optimization. Please try with them as follows:
model = tf.contrib.learn.LinearRegressor(..., optimizer=tf.train.YOUR_OPTIMIZER(YOUR_LEARNING_RATE)))


text:
Q: How to initialiaze an object and assign different variables javascript I have created an object where i need to assign some variables(parameters) and when the object is called, the variables(parameters) change. Here is my code:
var Modal = {

    init: function () {

        contact1: "";
        contact2: "";
        aboutus1: "";
        aboutus2: "";
        privacy1: "";
        privacy2: "";
        terms1:   "";
        terms2:   "";

        $(".modaltrigger").removeAttr("target");

        $(".modaltrigger").click(function () {

            if ($(this).is("#contact")) {

                $('#primary_url').attr('href', contact1);
                $('#secondary_url').attr('href', contact2);

            } else if ($(this).is("#aboutus")) {

                $('#primary_url').attr('href', aboutus1);
                $('#secondary_url').attr('href', aboutus2);

            } else if ($(this).is("#termsconditions")) {

                $('#primary_url').attr('href', terms1);
                $('#secondary_url').attr('href', terms2);

            } else if ($(this).is("#privacy")) {

                $('#primary_url').attr('href', privacy1);
                $('#secondary_url').attr('href', privacy2);
            }
        });
    }
};

I am trying to initialize the object above, and it does not work:
    Modal.init(

        contact1: "http:www.test1.com";
        contact2: "http:www.test2.com";
        aboutus1: "http:www.test3.com";
        aboutus2: "http:www.test4.com";
        privacy1: "http:www.test5.com";
        privacy2: "http:www.test6.com";
        terms1:   "http:www.test7.com";
        terms2:   "http:www.test8.com"

    );

A: it is Done like this way,
i Guess this is what you want to do.
var Modal = {

    init: function (args) {

              //then access your values like this
            contact1=   args.contact1;
            contact2 = args.contact2;
            ..........
            .........
            .........
         }
}

And to initiate this method you have write as
Modal.init({
contact1:"contact str",
contact2:"contact str",
.....
.....
lastitem : "last str"
});