text:
Q: The saved animated plot keeps looping although Matplotlib FuncAnimation(...,repeat=False) I'd like to make an animation using matplotlib for a powerpoint presentation. The animation should only play once.
In my code, the argument repeat of FuncAnimation() was set to false.
Because I need to import the figure into powerpoint, I saved it using ani.save('test.gif').
The problem is when I open the saved figure which is test.gif, the lineplot keeps looping.
All the searches on Stackoverflow suggest repeat=False, or using PillowWriter. Both solutions are not working for me, so I have two questions:

*

*why does the saved figure ignores repeat=False?

*how can I solve this issue?

Thank you in advance for helping me out.
Please, find my code below:
import pandas as pd

import matplotlib.pyplot as plt

# import matplotlib.animation as animation
from matplotlib.animation import FuncAnimation, PillowWriter

df = pd.DataFrame(
    {
        "x": {
            0: 0,
            1: 1,
            2: 2,
            3: 3,
            4: 4,
            5: 5,
            6: 6,
            7: 7,
            8: 8,
            9: 9,
            10: 10,
            11: 11,
            12: 12,
            13: 13,
            14: 14,
            15: 15,
            16: 16,
            17: 17,
            18: 18,
            19: 19,
            20: 20,
            21: 21,
            22: 22,
            23: 23,
            24: 24,
            25: 25,
            26: 26,
            27: 27,
            28: 28,
            29: 29,
            30: 30,
            31: 31,
            32: 32,
            33: 33,
            34: 34,
            35: 35,
            36: 36,
            37: 37,
            38: 38,
            39: 39,
            40: 40,
            41: 41,
            42: 42,
            43: 43,
            44: 44,
            45: 45,
            46: 46,
            47: 47,
            48: 48,
            49: 49,
            50: 50,
        },
        "y": {
            0: 0.7695,
            1: 0.7983,
            2: 0.7958,
            3: 0.7975,
            4: 0.7983,
            5: 0.7966,
            6: 0.7971,
            7: 0.7962,
            8: 0.7962,
            9: 0.7975,
            10: 0.7983,
            11: 0.7987,
            12: 0.7996,
            13: 0.7992,
            14: 0.7967,
            15: 0.7983,
            16: 0.7971,
            17: 0.7987,
            18: 0.7979,
            19: 0.7983,
            20: 0.7983,
            21: 0.7921,
            22: 0.7975,
            23: 0.7962,
            24: 0.7975,
            25: 0.7979,
            26: 0.7983,
            27: 0.7992,
            28: 0.7983,
            29: 0.7983,
            30: 0.7987,
            31: 0.7983,
            32: 0.7983,
            33: 0.7983,
            34: 0.7992,
            35: 0.7975,
            36: 0.7996,
            37: 0.7992,
            38: 0.7979,
            39: 0.7987,
            40: 0.7983,
            41: 0.7983,
            42: 0.7987,
            43: 0.7987,
            44: 0.7992,
            45: 0.7992,
            46: 0.7979,
            47: 0.7996,
            48: 0.7992,
            49: 0.7987,
            50: 0.7992,
        },
    }
)

x = df["x"]
y = df["y"]
fig, ax = plt.subplots()
line, = ax.plot(x, y, color="b")

def update(num, x, y, line):
    line.set_data(x[:num], y[:num])
    return (line,)

ani = FuncAnimation(
    fig, update, len(x), fargs=[x, y, line], interval=15, blit=True, repeat=False
)

# ani.save('test.gif')
ani.save("test2.gif", dpi=80, writer=PillowWriter(fps=5))

plt.show()

A: Use ImageMagickWriter:
ani.save("test2.gif", dpi=80, writer=ImageMagickWriter(fps=5, extra_args=['-loop', '1']))

I spent a lot of time looking into this. Its a little bit of a hack as '-loop 0' is passed to the movie writer (convert) and the extra_args are appended but override. Here is a GIF I created using extra_args=['-loop', '1']:

NB: Open image in a new tab to see it play.
I never got PillowWriter to work even when overriding the hard coded loop=0 in the finish() method:
class PillowWriterNG(PillowWriter):
    def finish(self):
            self._frames[0].save(
                self.outfile, save_all=True, append_images=self._frames[1:],
                duration=int(1000 / self.fps), loop=1)

Changing the loop parameter from 0 to 1 stops the infinite looping but it still runs twice!


text:
Q: Kali disconnect from WiFi when tools are used My kail linux (desktop dual boot, not vm) disconnects from WiFi whenever I do something with the given tools. It works fine with the browser and even other terminal procedures like vim. However, when I try to use a tool like wifite, arimon-ng or airodump-ng, it disconnects. After it disconnects, the adapter can no longer find any networks.

A: -Hello! this ends up happening just because unfortunately the use of some tools mainly airmon-ng or other tools that make use of the network device is this very thing, why they need access to a network device "card" even to create addresses the virtual items of the tools in use, so the fall of the internet connection is normal, if you want to continue to have access, use the internet access during this process you need to have another network device to do it! or reset the changes that you have made it like, mac-address changing, and others...

A: I've had this problem many times when it comes to using wifite, airo*-ng, fluxion, where it will disconnect my wlan0 (connected to regular AP serving inet) when the apps are launched.. I'm working on a definite fix.  But for now, experiment with this method:
Get famliar with the CLI tools iw, iwconfig, ifconfig, wpa_supplicant, wpa_passphrase.
Get unfamliar with nm-applet (the wifi gui connection app in top task bar)
This has worked for me in the past:
Prior to starting wifite or any of the haxing tools above:
service network-manager stop
killall wpa_supplicant
killall dhclient
ps guax | grep wpa   # verify there are no other rogue wpa_* proc. running

start your attack (in your lab of course) with wifite or fluxion
one that is initiated, manually connect to your AP:
in another term:
wpa_passphrase <SSID> <PW>  > /etc/wpa_ssid.conf
ifconfig wlan0 up
wpa_supplicant -i wlan0  -c /etc/wpa_ssid.conf
<in another term once that connects>

verify your associated with iwconfig wlan0
if so:
dhclient wlan0

redpajama_set_name: RedPajamaStackExchange


text: Q: Fixed point method- show a fixed pt One of my HW questions is consider the equation $x^2+cos(x)-10x=0$ for some x in 0,1 closed. Show that a solution of this equation is a fixed point of $g(x)=\frac{x^2+cos(x)}{10}$. I'm not sure how to start this question because I don't understand how to use knowing that we have a root to show a fixed point. I would appreciate a small push in the right direction so I can figure out how to start this question!


text:
Q: Android activity crashes on resume This is the error i get:
03-13 22:27:28.156: E/AndroidRuntime(1166): FATAL EXCEPTION: main
03-13 22:27:28.156: E/AndroidRuntime(1166): java.lang.RuntimeException: Unable to resume activity {com.androidpoiservice/com.androidpoiservice.ViewMapActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2575)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2603)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2089)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.os.Looper.loop(Looper.java:137)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.ActivityThread.main(ActivityThread.java:4745)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at java.lang.reflect.Method.invokeNative(Native Method)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at java.lang.reflect.Method.invoke(Method.java:511)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at dalvik.system.NativeStart.main(Native Method)
03-13 22:27:28.156: E/AndroidRuntime(1166): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class fragment
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.Activity.setContentView(Activity.java:1867)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at com.androidpoiservice.ViewMapActivity.onResume(ViewMapActivity.java:67)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1184)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.Activity.performResume(Activity.java:5082)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2565)
03-13 22:27:28.156: E/AndroidRuntime(1166):     ... 12 more
03-13 22:27:28.156: E/AndroidRuntime(1166): Caused by: java.lang.IllegalArgumentException: Binary XML file line #8: Duplicate id 0x7f050012, tag null, or parent id 0xffffffff with another fragment for com.google.android.gms.maps.MapFragment
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.app.Activity.onCreateView(Activity.java:4669)
03-13 22:27:28.156: E/AndroidRuntime(1166):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
03-13 22:27:28.156: E/AndroidRuntime(1166):     ... 22 more

This is the code:
public class ViewMapActivity extends Activity {

private static String TAG = "View Map";

private String username;
private String password;
private String name;
private String type;

private String SOAP_ACTION;
private String METHOD_NAME;
private String NAMESPACE;
private String URL;

private double latitude;
private double longitude;

private static LatLng Point = new LatLng(21 , 57);

private GoogleMap googleMap;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_view_map);
   }

    @Override
    protected void onResume() {
        super.onResume();
        setContentView(R.layout.activity_view_map);
        Log.e(TAG,"Here");
        SOAP_ACTION = getString(R.string.server)+"POIWebServer/POIWebService/getMapData";
        METHOD_NAME = "getMapData";
        NAMESPACE =  getString(R.string.server)+"POIWebServer/POIWebService";
        URL = getString(R.string.server)+"POIWebServer/POIWebService/POIWebService?WSDL";

        LoginInfo log = new LoginInfo();
        username=log.username;
        password=log.password;

        getLocation();

        Thread networkThread = new Thread(){
            @Override
           public void run(){
               try {

                   SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
                   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                   envelope.setOutputSoapObject(request);
                   String temp=username+"#"+password;
                   request.addProperty("unpass",temp);
                   temp=String.valueOf(latitude)+","+String.valueOf(longitude);
                   request.addProperty("pos",temp);
                   HttpTransportSE ht = new HttpTransportSE(URL);
                   ht.call(SOAP_ACTION, envelope);
                   final SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
                   final String responseStr = response.toString();
                   runOnUiThread (new Runnable(){
                      public void run(){
                         // try {
                         //   if (googleMap == null) {
                         //      googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
                          //  }
                         //   googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
                           String[] pois = responseStr.split("\\$");
                              for(int i=0;i<pois.length;i++){
                                String part=pois[i];
                                String[] poiData=part.split("#");
                                double poiX=Double.parseDouble(poiData[0]);
                                double poiY=Double.parseDouble(poiData[1]);
                                String type=poiData[2];
                                String name=poiData[3];
                                Log.e(TAG,part);
                                Point = new LatLng(poiX , poiY);
                            //  Marker TP = googleMap.addMarker(new MarkerOptions().position(Point).title(name));
                              }

                         // } catch (Exception e) {
                        //    e.printStackTrace();
                         // }

                      }
                   });
               } catch(Exception e){
                   e.printStackTrace();
               }
           }
        };
        networkThread.start();

    }

    private void getLocation() {
        // Get the location manager
        LocationManager locationManager = (LocationManager)
                getSystemService(LOCATION_SERVICE);
        Criteria criteria = new Criteria();
        String bestProvider = locationManager.getBestProvider(criteria, false);
        Location location = locationManager.getLastKnownLocation(bestProvider);
        LocationListener loc_listener = new LocationListener() {

            public void onLocationChanged(Location l) {}

            public void onProviderEnabled(String p) {}

            public void onProviderDisabled(String p) {}

            public void onStatusChanged(String p, int status, Bundle extras) {}
        };
        locationManager.requestLocationUpdates(bestProvider, 0, 0, loc_listener);
        location = locationManager.getLastKnownLocation(bestProvider);
        try {
            latitude = location.getLatitude();
            longitude = location.getLongitude();
        } catch (NullPointerException e) {
            latitude = -1.0;
            longitude = -1.0;
        }
    }

}
And this is the layout.xml
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#0099cc"
    tools:context="com.androidpoiservice.ViewMapActivity" >

   <fragment
      android:id="@+id/map"
      android:name="com.google.android.gms.maps.MapFragment"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

</RelativeLayout>

I can't find out what is wrong please help me

A: I don't think you are supposed to set the content view in onResume(). Remove it from there. You anyways already do it in onCreate(). That's where it belongs.


text:
Q: Trigger with two tables I have a flight database with several tables. I'm attempting to make a trigger to deny an insert or update on a flight that has a maintenance request. If the plane is requested for maintenance, there shouldn't be a flight between these times. I get the error message just fine, but it seems I always get it. How come? Thanks in advance, I always appreciate the help.
alter trigger DateMaintenanceTrigger
on Flight
after update, insert
as
    select
        m.StartDate, m.TargetEndDate, f.DepartureDateID
    from
        Maintenance.MaintenanceRequest as m
    inner join
        Flight as f on f.PlaneID = m.PlaneID
    where
        f.DepartureDateID < m.TargetEndDate
        and f.DepartureDateID > m.StartDate

    begin
        raiserror ('Flight cannot take place on this maintentance date, plane not ready.', 16,1);
        rollback transaction;
        return
    end;
    go

insert into Flight
values (304, 3, 1, 200192, 1, '20160916 09:00:00 AM');

A: The above issue is happening because you are missing the IF clause and also you are joining with the complete flight table, i.e. if atlease one flight matches yours criteria you will be getting the error. for the correct implementation you need to join with the inserted.PlaneID  instead as I have shown below
alter trigger DateMaintenanceTrigger on Flight
after update, insert
as
IF EXISTS (
select m.StartDate, m.TargetEndDate, f.DepartureDateID
from Maintenance.MaintenanceRequest as m
JOIN inserted as i
ON i.PlaneID = m.PlaneID
and i.DepartureDateID < m.TargetEndDate and i.DepartureDateID > m.StartDate
)
    begin
        raiserror ('Flight cannot take place on this maintentance date, plane not ready.', 16,1);
        rollback transaction;
        return
    end;
    go

insert into Flight values (304, 3, 1, 200192, 1, '20160916 09:00:00 AM');

A: I hope you solved it by now but if not I can try to help. Try to do it like this, i tried it locally just with  a true/false query and it should work as long as your query is ok, i'm not so sure where it's most correct to put the rollback by the way, now i put it in the catch function but perhaps it's better before the raiserror().
alter trigger DateMaintenanceTrigger
on Flight
after update, insert
as

BEGIN TRY
    IF EXISTS(
        select
            m.StartDate, m.TargetEndDate, f.DepartureDateID
        from
            Maintenance.MaintenanceRequest as m
        inner join
            Flight as f on f.PlaneID = m.PlaneID
        where
            f.DepartureDateID < m.TargetEndDate
            and f.DepartureDateID > m.StartDate
    )
    BEGIN
        raiserror ('Flight cannot take place on this maintentance date, plane not ready.', 16,1);
    END
    ELSE
    BEGIN
        insert into Flight values (304, 3, 1, 200192, 1, '20160916 09:00:00 AM');
    END
END TRY
BEGIN CATCH
    DECLARE @ErrorMessage NVARCHAR(4000);
    DECLARE @ErrorSeverity INT;
    DECLARE @ErrorState INT;

    SET @ErrorMessage = ERROR_MESSAGE();
    SET @ErrorSeverity = ERROR_SEVERITY();
    SET @ErrorState = ERROR_STATE();

    rollback transaction;

    RAISERROR (@ErrorMessage,
               @ErrorSeverity,
               @ErrorState
               );
END CATCH;


text:
Q: Internal data post [Kohana 3.1] In Kohana 3.1.x framework.
What are the benefits to send data with internal requests like this
$post = Request::factory('module/data')
        ->method(Request::POST)
        ->post(array('some' => 'random data'))
        ->execute()
        ->response;

if you could simply send data like this
Module::instance()->data(array('some' => 'random data'));

In this example Module is a random module and data is some random method.
I'll call this Module via ajax and internal requests. I'm planning to design RESTful API.
QUESTION IS: Why use HMVC instead of just directly using an internal class API

A: Because they're internal requests, there is no additional HTTP request being made.
You might want to take a look at Request_Client_Internal and compare it to Request_Client_External. After that you should feel enlightened :)
Edit:
You should know that AJAX requests aren't the only "external HTTP requests". cURL, PECL HTTP, file_get_contents() and other PHP functions will also send an external HTTP request (imho you should read the RFC 2616 to understand how HTTP actually works).

A: With HMVC calls you can use the same controller for both Ajax and internal requests. Also, it can handle a standard (non-ajax) http-requests, form submits for example. All-in-one solution, single entry point.
If you dont want HMVC calls, you will require one call for internal request (somewhere in base controller) and another one - in a special Ajax controller. Also you may have a problems with a data rendering (usually HMVC and ajax calls are using different templates). Its not DRY.

A: I would comment on the above, what biakaveron said, but I can't yet, so I put it as an answer.
@stacknoob: Could you use Module::instance()->data(array(...)) as controller's action? You could - with some extra code.
Instead, what biakaveron already said, you can keep your code logic and have the action return the same result for AJAX and HMVC requests. In one place. DRY + KISS.


text:
Q: CSS Floating expandable menu to display content Please by kind to me as I'm a noob. I've created a page in html but now I need to do something I think html can't do. On the left hand side I'm looking to create a floating menu that expands. This would be vertical. When you click on the 1st option, it would expand with instructions, then you can close it. Then one might jump down to the 4th. All the while, there will be a main html map (which is already done) in the middle where they can try what is in the instructions. I'm COMPLETELY new to CSS. I've found something similar to what I want, but not quite.

Home

One

TWo

Three

    <map name="map">

    </map>

I might be completely off on this. I'm starting to study CSS so I can understand this more. Any and all suggestions would be great. Thank you in advance.

A: I think what you are looking for is an accordion menu.
If you want to use pure CSS, you need to use CSS transitions. Did a quick Google search and found a simple example:
http://bradsknutson.com/blog/css-only-accordion/
If you don't mind using a bit of Javascript then jQuery UI has a quick and easy to use accordion menu, you can choose different options(e.g. sortable menu etc). You might have to learn the jQuery setup basics if you haven't used jQuery UI before.
https://jqueryui.com/accordion/#sortable


text:
Q: how to shuffle data (4-D Tensor {can't use sklearn}) and label without disturbing their order I converted images to tensors(4-D) now I want to shuffle it wothout disturbing the order.
I tried
idx = np.random.permutation(len(data))
x,y = data[idx], classes[idx]

but got error:
TypeError: Only integers, slices (`:`), ellipsis (`...`), tf.newaxis (`None`) and scalar tf.int32/tf.int64 tensors are valid indices, got array([135,  80, 178, ..., 253, 103])

A: If data and classes are tensors, you can do this
data = tf.constant([[i, i] for i in range(10)])
classes = tf.constant([i for i in range(10)])

idx = np.random.permutation(len(data))
x = tf.gather(data, idx)
y = tf.gather(classes, idx)

See also shuffling two tensors in the same order

A: shuffling two tensors in the same order
indices = tf.range(start=0, limit=tf.shape(X)[0], dtype=tf.int32)
shuffled_indices = tf.random.shuffle(indices)

shuffled_X = tf.gather(X, shuffled_indices)
shuffled_y = tf.gather(y, shuffled_indices)

print('before')
print('X', X.numpy())
print('y', y.numpy())

print('after')
print('X', shuffled_X.numpy())
print('y', shuffled_y.numpy())


text:
Q: element within ranges and distance between two points I have a 53534x3 matrix with x, y and z coordinates.
I want to find the element of matrix within ranges as follows:
% coordinate range;
x1(x<-25|x>0);
x2(x<0|x>25);
y1(y<-40|y>0);
y2(y<0|y>40);
z1(z<45|z>17);
z2(z<17|z>82);

and insert them into a new matrix, so that it become
point1=[x1, y1, z1];
point2=[x2, y2, z2];

I need to find the distance between the two points.
% define points;
xd=x2-x1;
yd=y2-y1;
zd=z2-z1;
Distance=sqrt(xd*xd+yd*yd+zd*zd);

Is loop preferrably efficient?

A: You don't need loop. MATLAB very efficiently works with vectors and matrices as whole.
If your matrix is a:
point1 = a( (a(:,1)<-25 | a(:,1)>0) & ...
            (a(:,2)<-40 | a(:,2)>0) & ...
            (a(:,3)< 45 | a(:,3)>17) ,:);

point2 = a( (a(:,1)< 0 | a(:,1)>25) & ...
            (a(:,2)< 0 | a(:,2)>40) & ...
            (a(:,3)<17 | a(:,3)>82) ,:);

If number of points in point1 and point2 is equal and you need distance between points in order they appear in the matrix, you can do:
xd = point2(:,1)-point1(:,1);
yd = point2(:,2)-point1(:,2);
zd = point2(:,3)-point1(:,3);
Distance=sqrt(xd.^2+yd.^2+zd.^2);

In general case if you need distances between all points in point1 and point2 you can use PDIST2 function:
Distance = pdist2(point1, point2, 'euclidean');


text:
Q: If $M$ is an $R$-module, when is $A\mapsto Aut(M\otimes_{R}A)$ a representable functor? Let $R$ be a ring (unitary, commutative, associative) and $M$ an $R$-module. Is the functor
\begin{eqnarray*}
    F & : & {R}\mathbf{-Alg} & \longrightarrow & \mathbf{Grp}\\
       & & A                & \longmapsto     & \operatorname{Aut}(M\otimes_{R}A)
\end{eqnarray*}
representable? I know this is true if $M=R^{n}$ for some $n\in\mathbb{N}$, for then it is represented by the ring
\begin{equation*}
    A[x_{11},...,x_{nn},y]/(\det(x_{ij})y-1)\text{.}
\end{equation*}
I guess (although this is no more than a gut feeling) this should be true at least if $M$ is finitely generated and flat, but I might be wrong.
As usual, a literature reference might also be helpful.

A: If $M$ is finitely presented and flat, then $F$ is representable; indeed this follows pretty easily from the finitely generated free case.  If $M$ is finitely presented and flat, then it is projective, so it is a direct summand of $R^n$ for some $n$.  This direct sum decomposition can be represented by an idempotent matrix $e\in M_n(R)$.  Then, the group of automorphisms of $M$ can be described as the set of $a\in GL_n(R)$ such that $ea(1-e)=(1-e)ae=0$ and $(1-e)a(1-e)=1-e$ (this just means that the matrix representation of $a$ with respect to the direct sum decomposition $R^n\cong M\oplus N$ has the form $\begin{pmatrix}b & 0 \\ 0 & 1_N\end{pmatrix}$ for some invertible $b$).  This description is still valid after base-changing, so the functor $\operatorname{Aut}(M\otimes-)$ is represented by the quotient of $R[a_{11},\dots,a_{nn},\det^{-1}]$ that imposes the relations $ea(1-e)=(1-e)ae=0$ and $(1-e)a(1-e)=1-e$.
A simple necessary condition for $F$ to be representable is that it must preserve monics.  For instance, this means that if $R$ is a domain and $M$ is a nonzero torsion module then $F$ cannot be representable, by considering what $F$ does to the inclusion from $R$ into its fraction field.
Here is another necessary condition that is a sort of finiteness condition (for instance, it implies $F$ cannot be representable if $R$ is nonzero and $M$ is free of infinite rank).  Suppose $F$ is representable.  Then for each $R$-algebra $A$ and each $m\in M\otimes A$, there must be a finitely generated submodule of $M\otimes A$ that contains the images of $m$ under all the automorphisms of $M\otimes A$.  To prove this, note that by base-changing to $A$, we may assume $A=R$. Let $S=\operatorname{Aut}(M)$ and consider $F(R^S)$.  Since $F$ is representable, it preserves products, so there is an automorphism $\alpha$ of $M\otimes R^S$ which becomes $s$ after applying the $s$th projection $R^S\to R$, for each $s\in S$.  This means that if we write $\alpha(m\otimes 1)$ as a sum $\sum x_i\otimes y_i$ of elementary tensors, we have $s(m)=\sum y_i(s)x_i$ for each $s\in S$.  Thus, all of these images $s(m)$ are contained in the submodule of $M$ generated by the finitely many elements $x_i$.

A: If $R$ is noetherian and $M$ is finitely generated then the automorphism sheaf is representable if and only if $M$ is projective, see here.


text:
Q: ECDSA host key for my IP has changed - why? Attempting to SSH into my server, I got the "SOMEONE DOING SOMETHING NASTY" message. First time.
The message states, "It is also possible that a host key has just been changed."
I am not clear about the meaning of "just".
Does it mean "has recently changed" or does it mean "no big deal, the key has changed".
Either way, I want to know WHY would the key change? I am not aware of anything I did that would cause it to change.
My IP address has not changed. I am working with this server on various ports and everything is normal.
All of the questions about this problem recommend to remove the old key in my known_hosts file, and I have done that.
Is this dramatic error message meant to be basically ignored, or could there really be someone doing something nasty?

A: SSH keys change under the following conditions:

*

*Someone intentionally re-generated the SSH keys

*SSH service (sshd) was uninstalled and re-installed

*Server OS was re-installed (rebuilt)


text:
Q: find difference between adjacent rows without using the 'lag' keyword I have some data as follows
ID,TimeStamp,Score
975191,9/26/2015 23:24,38
975191,9/26/2015 23:24,38
975191,9/26/2015 23:24,38
975191,9/26/2015 23:29,37
975191,9/27/2015 0:21,21
975191,9/27/2015 0:21,16
975191,9/27/2015 0:25,16
975191,9/27/2015 0:25,21
975191,9/27/2015 0:51,35
975191,9/27/2015 0:51,71
975191,9/27/2015 19:01,16
975191,9/27/2015 19:01,21
975191,9/27/2015 19:11,35
975191,9/27/2015 19:11,71
975191,9/28/2015 22:12,38

I would like to find the difference between adjacent rows in TimeStamp as well as Score so that the output looks as follows
ID,TimeStamp,Score,Aging,Delta
975191,9/26/2015 23:24,38,1014527,-38
975191,9/26/2015 23:24,38,0,0
975191,9/26/2015 23:24,38,0,0
975191,9/26/2015 23:29,37,0,1
975191,9/27/2015 0:21,21,1,16
975191,9/27/2015 0:21,16,0,5
975191,9/27/2015 0:25,16,0,0
975191,9/27/2015 0:25,21,0,-5
975191,9/27/2015 0:51,35,0,-14
975191,9/27/2015 0:51,71,0,-36
975191,9/27/2015 19:01,16,19,55
975191,9/27/2015 19:01,21,0,-5
975191,9/27/2015 19:11,35,0,-14
975191,9/27/2015 19:11,71,0,-36
975191,9/28/2015 22:12,38,27,33

This is the query I have written
SELECT
ID,
TimeStamp,
Score,
datediff(hour,ISNULL(convert(datetime, lag(TimeStamp) over(partition by ID order by Timestamp)), 0),TimeStamp) as Aging,
ISNULL(convert(int, lag(Score) over(partition by ID order by Timestamp)), 0) - Score as Delta
FROM TableName
order by TimeStamp asc

So far so good,
However I would like to get the same output without using the lag keyword because using the lag keyword on SQL Azure gives me
Keyword or statement option 'lag' is not supported in this version of SQL Server.

A: Based on Giorgos suggestion:
;With x AS (
  SELECT
  ROW_NUMBER() over (PARTITION BY ID ORDER BY TimeStamp) as RN,
  ID,
  TimeStamp,
  Score
  FROM TableName
  )

SELECT
X.ID,
X.TimeStamp,
X.Score,
datediff(hour,ISNULL(convert(datetime, Y.TimeStamp), 0),X.TimeStamp) as Aging,
ISNULL(convert(int, Y.Score), 0) - X.Score as Delta

FROM X
LEFT JOIN X as Y on X.ID = Y.ID and X.RN = Y.RN + 1

ORDER BY X.RN

A: SQL Azure still has ROW_NUMBER and this was how I did it before Microsoft added LAG in SQL Server 2012:
;WITH cte AS (
        SELECT
            ID,
            TimeStamp,
            Score,
            rn = row_number() over (parition by ID order by Timestamp)
        FROM TableName
    )

SELECT      c1.Id,
            c1.TimeStamp,
            c1.Score,
            datediff(hour,ISNULL(convert(datetime, c2.TimeStamp), 0), c1.TimeStamp) as Aging,
            ISNULL(convert(int, c2.Score), 0) - c1.Score AS DeltaScore
FROM        cte c1
LEFT JOIN   cte c2      ON c1.ID = c2.ID
                        AND c1.rn = c2.rn + 1
order by    c1.TimeStamp asc

A: One way to approximate lag() is to use outer apply.  This can have much better performance than methods using row_number():
select s.*, sprev.*
from scores s outer apply
     (select top 1 s2.*
      from scores s2
      where s2.id = s.id and
            s2.timestamp < s.timestamp
      order by timestamp desc
     ) sprev;

For performance, you want an index on scores(id, timestamp).
Note:  your first three timestamps appear to all be the same.  This version (similar to lag()) can produce unstable results.  You should include a unique id in the order by, if one is available.


text:
Q: Custom Field URL + description I'm trying to make some post with has many URLs with descriptions attached to it, the ACF has the URL module wich is fine, I can add many URLs as needed but I need to add a description to each of this field (vinculated, not a separated text field), how can I do that?
Thanks.


text:
Q: Swift PHAsset image request issue I'm having an issue when requesting PHAsset/PHImageManager
Initially I'm fetching the image assets via PHAsset.fetchAssets, appending them to an UIImage array and loading them into a collectionView. This works with no issues. The request image size is smaller enough to not cause any loading delays.
Next, when I select the collectionView cell in the didSelectItemAt delegate function, I'm attempting to re-request the PHAsset, with a larger image size (quality) and append the larger images into another UIImage array.
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

    /* Store the selected image into a variable */
    let selectedImage = images[indexPath.item]

    /* Request a larger quality image */
    if let index = self.images.index(of: selectedImage) {
        let selectedAsset = self.assets[index]

        let imageManager = PHImageManager.default()
        let targetSize = CGSize(width: 600, height: 600)

        imageManager.requestImage(for: selectedAsset, targetSize: targetSize, contentMode: .default, options: nil) { (image, info) in

            if let image = image {
                self.selectedImages.append(image)
            }
        }
    }
print(selectedImages.count)
}

Two issues I'm facing:
1) when printing the count of the array, I get odd numbers (1, 3, 5, 7 etc) instead of the incremental count (1,2,3,4 etc). No idea why this is happening? Causing my 'selectedImages' array to increase abnormally.
2) This error occurs when selecting the 2nd cell (index 1) of the collectionView:

2019-02-12 21:12:40.029686-0800 ModularX[15837:4640133] [ImageManager]
  FigPhotoDecompressionContainerDecodeImageForIndexAsync
  -[PLFigPreheatItem startPreheatRequestWithCompletionHandler:]_block_invoke_2 returned
  -16074 from /var/mobile/Media/DCIM/102APPLE/IMG_2427.JPG 2019-02-12 21:12:40.041596-0800 ModularX[15837:4640145] [ImageManager]
  PFFigCreateCGImageFromImageData UIImage
  *PLCreateImageFromDataWithFormat(NSData *, BOOL, PLPhotoImageFormatID, NSString *, BOOL, CFDictionaryRef *, NSDictionary *) returned -16074

Any idea where I'm going wrong?
Thank you


text:
Q: Most optimal way to detect multiple timers / countdowns hitting 0? I am writing to see what everyone's way of doing this is.
Example:
I have multiple timers with a start time of potentially anything. E.G, One timer could be 30 seconds, the second could be 10 minutes, the third could be 3mins 32seconds, and so on... You can create infinite timer countdowns.
Now, the question is... What's the best way to detect when a timer hits 0? Java does have a runnable class and I was going to run an async task to check every second but this sounds really inefficient to me.
Are there any other ways to do it? Thanks!


text:
Q: Jackson doesn't serialize field defined by `def` Following the approach in Easy JSON (un)marshalling in Scala with Jackson, I have defined a JsonUtil class:
import com.fasterxml.jackson.databind.{DeserializationFeature, JsonNode, ObjectMapper}
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper

object JsonUtil {
  val mapper = new ObjectMapper() with ScalaObjectMapper
  mapper.registerModule(DefaultScalaModule)
  mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
  mapper.enable(DeserializationFeature.USE_LONG_FOR_INTS)

  def toJsonNode[T](elem: T): JsonNode = mapper.valueToTree(elem)
}

And now I want to serialize a class containing an Int and another Int with double the value:
import JsonUtil.toJsonNode

trait X {
  def x: Int
  def doubleX: Int = x * 2
}

case class Three() extends X {
  val x = 3
}

println(toJsonNode(Three()))
// {"x":3}
println(Three().doubleX)
// 6

I realize that Jackson might not recognize a field defined by def. However, defining doubleX by def instead of val ensures that its value is always correct. Any workaround to make def and Jackson compatible?

A: def doesn't define a field, it's a method. Just annotate the def with @JsonProperty and Jackson should consider it as a getter for a "logical property".


text:
Q: How to display info on phpMyAdmin So I have managed to sort out my connection with XAMPP and sql server in my previous question. I am sorry I am new to programming and working and studying at the same time so most of this I have to self teach with very little guidance.
My next question is when I type in data, for example, my email on the webpage I am creating, it doesn't display on phpMyAdmin? Is there some sort of connection I am missing or something I'm not understanding?
I have created a database called maxipakdb, and within that, I created a table to show data called maxipaktable in phpMyAdmin.
My code is shown below.
<?php
/* Database config */
$db_host        = 'localhost';
$db_user        = 'root';
$db_pass        = '';
$db_database    = 'maxipakdb';
/* End config */

$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_database);

/* check connection */
if (mysqli_connect_errno()) {printf("Connect failed: %s\n",      mysqli_connect_error());}

$email = $_POST['email'];

// Perform queries

mysqli_query("INSERT INTO maxipaktable (`id`,`email`)
VALUES (NULL,'&email')");

header('Location: success.php');

echo $email;
?>


text:
Q: Unable to build project after adding facebook ads in react native I have used both react-native-fbads and react-native-ads-facebook . I also followed all the steps for installation (added react-native-fbsdk etc.) , but whenever I build the project I get the following error.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not resolve project :react-native-ads-facebook.
     Required by:
         project :app
      > Unable to find a matching configuration of project :react-native-ads-facebook:
          - None of the consumable configurations have attributes.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 36s

How can I use Facebook ads with react native?.
My react-native version is 0.62.2
Settings.gradle
rootProject.name = 'example1'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
include ':react-native-fbsdk'
project(':react-native-fbsdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk/android')

build.gradle
apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation. If none specified and
 *   // "index.android.js" exists, it will be used. Otherwise "index.js" is
 *   // default. Can be overridden with ENTRY_FILE environment variable.
 *   entryFile: "index.android.js",
 *
 *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    enableHermes: false,  // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = true

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = true

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
def jscFlavor = 'org.webkit:android-jsc:+'

/**
 * Whether to enable the Hermes VM.
 *
 * This should be set on project.ext.react and mirrored here.  If it is not set
 * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
 * and the benefits of using Hermes will therefore be sharply reduced.
 */
def enableHermes = project.ext.react.get("enableHermes", false);

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.designorchard.openinchat"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 0001
        versionName "1"
         multiDexEnabled true

    }
        dexOptions {
        javaMaxHeapSize "4g"
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk true // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    signingConfigs {
            release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }}
        debug {
            storeFile file('****')
            storePassword '****'
            keyAlias '****'
            keyPassword '****'
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://facebook.github.io/react-native/docs/signed-apk-android.
            signingConfig signingConfigs.debug
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    packagingOptions {
        pickFirst "lib/armeabi-v7a/libc++_shared.so"
        pickFirst "lib/arm64-v8a/libc++_shared.so"
        pickFirst "lib/x86/libc++_shared.so"
        pickFirst "lib/x86_64/libc++_shared.so"
    }

    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // https://developer.android.com/studio/build/configure-apk-splits.html
            def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    implementation 'com.facebook.android:facebook-android-sdk:[5,6)'

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)


text:
Q: Trouble installing OpenCOBOL When I run ./configure, I get this error:
configure: error: libdb is required

I signed up for an Oracle account (yak shaving), downloaded Berkeley DB, untarred and unzipped, wrestled with the unhelpful README, successfully configured, maked, and make installed.  But the OpenCOBOL configure script still doesn't see the library.

A: The configure script cannot find Berkeley DB; you have to tell it where libdb is.
$ ./configure CPPFLAGS="-I/usr/local/BerkeleyDB.5.2/include/" LDFLAGS="-L/usr/local/BerkeleyDB.5.2/lib/"
$ make
$ make install

Updated README


text:
Q: Showing mathematically why non-zero complex eigenvalues lead to oscillations? I am trying to show mathematically why an ODE system's equilibrium exhibits oscillatory behavior if its eigenvalues have non-zero imaginary parts. What is the best/most general way to show this?

A: They key is to investigate the complex exponential function
$$C\exp((a+ib)t) = C\exp(at)\cdot \exp(ibt)$$
The real part corresponds to exponential decay and imaginary part corresponds to frequency of a sine&cosine couple. The only complex exponential that does not oscillate is the one which has frequency $b=0$.
Maybe you can use Euler formula $\exp(ibt) = \cos(bt) + i\sin(bt)$


text:
Q: A specific example of pushforward measure The definition of pushforward measure is:
Let $(X,\mathcal{F},\mu)$ be a measure space, and let $f : X \to Y$
be a function between sets. Define
$$f_{\#}(\mathcal{F}):=\left\{B \subset Y: f^{-1}(B) \in \mathcal{F}\right\}, \quad\left[f_{\#} \mu\right](B):=\mu\left(f^{-1}(B)\right) \text { for } B \in f_{\#}(\mathcal{F}).$$
We all know $\left(Y, f_{\#}(\mathcal{F}), f_{\#} \mu\right)$ is a measure space.Now let $Y=\mathbb{R}$ and $(X, \mathcal{F}, \mu)$ be $\left(\mathbb{R}, \mathfrak{B}(\mathbb{R}), \mathcal{L}^{1}\right)$, the Borel $\sigma$-algebra and the Lebesgue
measure. There are two specific example:
1.$f(x)=\tan x$  if $\cos x \neq 0$,and $f(x)=0$ if  $\cos x=0$,
2.$f(x)=\arctan x$.

How can I determine their $\left(\mathbb{R}, f_{\#}(\mathcal{F}), f_{\#} \mu\right)$?


text:
Q: Such as the Dart iscroll to implement scrolling would like to know what to do. Such as the Dart iscroll to implement scrolling would like to know what to do.
Darts scrolling in the editor, but the packages are supported by
I do not know how to use the module for that.
I hope you'll tell you how to scroll.


text:
Q: Using ngrok with IISExpress on windows I'm used to using a Mac, and ngrok is a breeze; all you need to do is specify a port, but I'm new to IISExpress, and I can't figure out how to use ngrok and/or IIS correctly. To be clear, I've inherited a Windows machine from a coworker (who has left the company) and the set up works great locally.
The local url is similar to:
thing.somedomain.com

In the bindings section of IIS, I've got:
Type    Host Name               Port   IP Address
http    thing.somedomain.com    80     *

I've used this page for reference: https://www.twilio.com/blog/2014/03/configure-windows-for-local-webhook-testing-using-ngrok.html
The instructions seem reasonable, but they don't work for me. These instructions indicate that the file applicationhost.config needs to be altered for IIS. I have found this file, and found the correct section for the site I need to ngrok. The binding info does not match what's in the IIS gui though:
<binding protocol="http" bindingInformation="*:4085:localhost" />

As per the instructions, I have added:
<binding protocol="http" bindingInformation="*:4085:whatever.ngrok.io" />

(Here every time I run ngrok on windows I get ngrok.io instead of ngrok.com, which seems odd. I've tried accessing both ways with no luck.)
I have restarted the site on IIS (in the actions menu). When I try to access the ngrok url from a remote machine, ngrok returns 502 bad gateway, and the remote machine shows:
Failed to complete tunnel connection

The connection to http://whatever.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:4085.

Make sure that a web service is running on localhost:4085 and that it is a valid address.

The error encountered was: dial tcp 127.0.0.1:4085: ConnectEx tcp: No connection could be made because the target machine actively refused it.

When I try to go to localhost:4085 locally, I get "This webpage is not available". When I try to go to localhost:80, I get a redirect to a different site the IIS is serving. When I try 127.0.0.1:80, I get a 404 error.
I have tried using netstat -a -b, and have tried all of the ports associated with 127.0.0.1, and nothing turns up the correct site (yet still thing.somedomain.com still works correctly).
I'm completely mystified, and don't know what to try next, or where the problem lies (in how I'm starting ngrok, in how I'm accessing ngrok, in how the bindings are mapped, in how IIS restarts, a firewall issue, or some other voodoo). This should be bloody simple!

A: There is a way to make it easier. Let's say your IISExpress website is http://localhost:63254
Just start ngrok like this:
ngrok http --host-header=rewrite localhost:63254

A: So it turns out that there was nothing to change in the ApplicationHost.config file, AND I was looking at the wrong ApplicationHost.config file (the real file is normally hidden from view in C:/Windows/System32/inetsrv/Config, but you can open it in Notepad from a Command Prompt that has elevated privileges (Run as Administrator)). The actual binding info was:
<binding protocol="http" bindingInformation="*:80:thing.somedomain.com" />

Which is what matched what IIS was showing. That said, what I needed to change was how I invoked ngrok:
ngrok http -host-header=thing.somedomain.com:80

And that was it. I also allowed external traffic to the hostname with this:
netsh http add urlacl url=http://thing.somedomain.com/ user=everyone


text:
Q: 'identity' requires Google Chrome trunk channel or newer, and this is the canary channel I'm trying to play with Packaged Apps and the Identity API on latest Google Canary (Mac), however, when loading my app I get the following error: "'identity' requires Google Chrome trunk channel or newer, and this is the canary channel."

A: Have you enabled "Experimental Extension APIs" in chrome://flags? That's what http://developer.chrome.com/apps/experimental.html says to do.


text:
Q: Aligning side-by-side DIV elements with auto height and floating on even/odd I am trying to achieve a "side-by-side" box where two divs are inside a container side by side (floating left and right). However, I want the divs to change from right to left and left to right per every box, while still maintaining the height on both divs as the content grows.
My HTML is static. I cannot change this. You will see that the left divs contain text, and the right divs contain a background image and some text:
This is my HTML:

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

Right

            This is some content

Right

            This is some content

            This is some content

            This is some content

Right

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

Right

            This is some content

            This is some content

            This is some content

Right

I initially tried the following CSS (without the comments):

Which resulted in this:

Which is almost there, except the picture is not showing because theres nothing telling the .image div to grow as the text grows in the .text div so then I added the flex CSS (remove the comments in the above CSS) and it resulted in this:

Now the image shows (which is what I want) but the floats are not working.
Heres a FIDDLE. Please let me know if anyone knows what Im missing.
PS: No Javascript is allowed
Thanks.

A: You don't need floats if you use flexbox.
Just reverse the order every odd box with flex-flow: row-reverse;

#boxes {
        width: 500px;
        margin: 0 auto;
    }

    .box {
        margin: 5px;
        border: 1px solid black;
        display: flex;
        width: 100%;
    }

    .box .text {
        width: 50%;
        background-color: #ccc;
        flex: 1;
    }

    .box .image {
        width: 50%;
        background-color: #eee;
        flex: 1;
        background-image: url(http://lorempixel.com/400/200/sports/1/);
    }

    .box:nth-child(odd) {
        flex-flow:row-reverse;
    }

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

Right

            This is some content

Right

            This is some content

            This is some content

            This is some content

Right

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

            This is some content

Right

            This is some content

            This is some content

            This is some content

Right

A: How about something like this? https://jsfiddle.net/jameson5555/oj2qv81m/1/
I switched to absolute positioning for the images, and then adjusted even images like this:
.box:nth-child(even) .image {
  left: 50%;
  right: 0;
}

A: Oh yeah you're close. You're simply missing
flex-direction: row-reverse
Add it to your even boxes instead of relying on floats.
.box:nth-child(2n+1) {
    flex-direction: row-reverse;
}

https://jsfiddle.net/o5rypunn/


text:
Q: How to get the SessionStateBehavior for a request? I know that the SessionState attribute can be used to set the SessionStateBehavior for requests to a particular MVC controller. My question is, how can I determine the current request's SessionStateBehavior programatically? I see that HttpContext has an internal property for this, but is there any way to get at this publicly?
In particular, I'd like to know whether the session state behavior was disabled.

A: HttpContext.Current.Session == null will check for a disabled session
HttpContext.Current.Session.IsReadOnly will check for a read-only session

A: Looking into this further, it seems like the only surefire solution to the exact problem posted above is to access the internal SessionStateBehavior property using reflection:
var behavior = (SessionStateBehavior)typeof(HttpContext)
    .GetProperty("SessionStateBehavior", BindingFlags.Instance | BindingFlags.NonPublic)
    .GetValue(HttpContext.Current);

However, for the specific case of checking whether session state has been disabled, in most scenarios a simple null check against HttpContext.Current.Session should suffice. I'm basing this on the reasons listed in this question for why that property may be null.


text:
Q: jquery mobile - enterprise scalable solution? We are creating a user interface that functions on a wide variety of platforms with minimal loss of function. The idea is to code an intuitive design using the lowest common denominator - in this case, the device with the lowest functionality. Using the iPhone as an example (compared to the larger screen size of the iPad or desktop), we have elected to use jquery mobile as our platform of choice. Jquery mobile allows keeping separate CSS markup tags so the underlying data structures can remain the same while the presentation on screen can be tailored to different screen sizes.
My question is will this approach continue to be tenable as the number of users and types of devices continue to change? Is it easier to simply create a separate mobile site, even though this will lead to different user interfaces over time and generate confusion with end users?

A: What makes jQuery mobile great for your particular scenario is that sites created using jquery mobile (in my experience) run beautifully on both desktop and mobile browsers. Their purpose is to make cross-platform web sites/apps so they will most likely grow with the devices that come on the market. It may take a bit of tweaking to work the way you like it, but the end result (for me at least) was stellar.


text:
Q: AWS Lambda S3 event infinite loop I want to use S3 events to publish to AWS Lambda whenever a video file (.mp4) gets uploaded, so that it can be compressed. The problem is that the path to the video file is stored in RDS, so I want the path to remain the same after compression. From what I've read, replacing the file will again call the Object Created event leading to an infinite loop.
Is there any way to replace the file without triggering any event? What are my options?

A: You are correct that you cannot completely distinguish. From the documentation the following events are supported:

*

*s3:ObjectCreated:Put – An object was created by an HTTP PUT operation.

*s3:ObjectCreated:Post – An object was created by HTTP POST operation.

*s3:ObjectCreated:Copy – An object was created an S3 copy operation.

*s3:ObjectCreated:CompleteMultipartUpload – An object was created by the completion of a S3 multi-part upload.

*s3:ObjectCreated:* – An object was created by one of the event types listed above or by a similar object creation event added in the future.

*s3:ReducedRedundancyObjectLost – An S3 object stored with Reduced Redundancy has been lost.

The architecture that I would generally see for this type of problem is having 2 S3 buckets

*

*1 S3 Bucket stores the source material without any modification, this would trigger the Lambda event.

*1 S3 Bucket stores the processed artifact, from the compressed output.

By doing this you can store the original, and rerun if needed to autocorrect.

A: There is an ungraceful solution to this problem, which is not documented anywhere.
The event parameter in the Lambda function contains a userIdentity dict which contains principalId. For an event which originated because of AWS Lambda (like updating S3 object as mentioned in question), this principalId contains the name of the lambda function appended at the end.
Therefore, by checking the principalId one can deduce whether the event came from Lambda or not, and accordingly compress or not.


text:
Q: What is a subatomic particle? I am curious as to what a subatomic particle is and have done a bit of research but have turned up with nothing of any help.

A: In physics we have to be careful asking what is really happening e.g. what are particles really. The best physicists can do is construct a theory, i.e. a mathematical model, that describes how particles behave. To what extend you choose to interpret the model as physically real is up to you.
With particles the closest we have to an experimentally tested theory is quantum field theory. In QFT we consider a mathematical object called a quantum field that fills all of space and all of time. Like any object this field has quantised states. It has a ground state that we conventionally take as the zero energy then it has an infinite number of states with increasing energy.
There is no analytic solution for the states of a general quantum field, and we have to resort to techniques like perturbation theory to do calculations. However in the limit where the interactions of the field are vanishingly weak we can solve the equations of the field analytically, and the resulting field states are the Fock states.
Roughly speaking, a single Fock state describes particles of a specified energy and momentum. It behaves a bit like a quantised simple harmonic oscillator. The ground state corresponds to no particles present, the first excited state corresponds to one particle present, the second excited state to two particles and so on.
So an elementary particle is the object described by an excitation of a Fock state. I say described by because a Fock state is a mathematical object just like a wavefunction. The state certainly describes the particles, but whether you choose to believe the Fock states are the particles is philosophy rather than physics.
This all sounds a bit surreal, and I imagine you're thinking that it hasn't helped you understand what a particle really is. I sympathise, but I don't think asking what a particle really is has any meaning. Quantum field theory is a remarkable accurate description of how particles behave. Notoriously it is the most accurate theory every constructed so even though it seems weird it certainly works.
It also explains some puzzling things about particles e.g. how can energy turn into new particles in colliders like the LHC, and how can particles turn into energy and disappear in phenomena like annihilation. The answer is that quantum fields can exchange energy and momentum with each other. So if a Fock state loses energy that means the particle(s) described by that Fock state disappear, and when that energy goes to a different Fock state that creates the new particles described by the new state.


text:
Q: Using an if statment onto an EditText I have an alert box with an EditText.
It doesn't go through the "if" when I try to compare it to the user input.
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AlertDialog.Builder alert = new AlertDialog.Builder(this);

    alert.setTitle("Number of players: ");

     final EditText input = new EditText(this);
    alert.setView(input);

    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {

        }
    });

    alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            // Canceled.
        }
    });

    alert.show();

it doesn't work from here on:
String newString = input.getText().toString();

if(newString.equals("2"))

    {
        System.out.print("lol");

    }

Thanks for any help!

A: You have to put the code of your second listing in the OnClickListener of one of your buttons (I guess you want it to be executed after the Ok button is pressed):
...
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int whichButton) {
        String newString = input.getText().toString();
        if(newString.equals("2")) {
            System.out.print("lol");
        }
    }
});
...

You cannot expect to get the user input immediately after the dialog is shown. The user simply does not have time to type anything.

A: I am sure the if is working correctly, you just don't see it. Using System.out.print(); in an android application is not advisable since there is no console to output to. Use Logcat instead.
More info on the topic


text:
Q: How do I use LINQ to XML to create a list of objects? I have some inbound XML that I am trying to read with LINQ to generate a list of objects:
<SCResponse>
<link href="http://192.168.6.126:8001/affiliate/account/81/notifications?startRow=2&limit=20" rel="next_page" title="Next"/>
<link href="http://192.168.6.126:8001/affiliate/account/81/notifications?startRow=1&limit=20" rel="previous_page" title="Previous"/>
<RecordLimit>20</RecordLimit>
<Notifications>
    <Notification href="http://192.168.6.126:8001/affiliate/account/81/notifications/24">
        <NotificationDate>2013-03-15T16:41:37-05:00</NotificationDate>
        <NotificationDetails>Notification details 1</NotificationDetails>
        <Status>New</Status>
        <NotificationTitle>Test notification 1</NotificationTitle>
    </Notification>
</Notifications>
<RecordsReturned>1</RecordsReturned>
<StartingRecord>1</StartingRecord>
<TotalRecords>1</TotalRecords>

And I've created a simple POCO object to represent a 'Notification':
public class Notification
{
    public System.DateTime notificationDate;

    public string notificationDetails;

    public string status;

    public string notificationTitle;

    public string href;
}

and I'd like to read the incoming XML and create a list of objects.
List<Notification> notificationList;

XElement x = XElement.Load(new StringReader(result));
if (x != null && x.Element("Notifications") != null)
{
    notificationList = x.Element("Notifications")
                .Elements("Notification")
                .Select(e => new Notification()
                .ToList();
}

I'm really unclear about the 'e' part and how to initialize a new Notification object. Can ya help?

A: e is just a parameter name your passing to the lambda expression, new Notification(). You can use it like this:
notificationList = x.Element("Notifications")
                    .Elements("Notification")
                    .Select(e => new Notification()
                                 {
                                     href = (string)e.Attribute("href")
                                     notificationDetails = (DateTime)e.Element("NotificationDate")
                                     notificationDate = (string)e.Element("NotificationDetails")
                                     status = (string)e.Element("Status")
                                     notificationTitle = (string)e.Element("NotificationTitle")
                                 }
                    .ToList();

Or if you prefer query syntax
notificationList =
    (from e in x.Element("Notifications").Elements("Notification")
     select new Notification()
            {
                href = (string)e.Attribute("href")
                notificationDetails = (DateTime)e.Element("NotificationDate")
                notificationDate = (string)e.Element("NotificationDetails")
                status = (string)e.Element("Status")
                notificationTitle = (string)e.Element("NotificationTitle")
            })
    .ToList();

A: Use object initialization syntax:
notificationList = x.Element("Notifications")
            .Elements("Notification")
            .Select(e => new Notification()
                            {
                                href = (string)e.Attribute("href"),
                                notificationDate = (DateTime)e.Element("NotificationDate"),
                                notificationDetails = (string)e.Element("NotificationDetails"),
                                status = (string)e.Element("Status"),
                                notificationTitle = (string)e.Element("NotificationTitle")
                            })
            .ToList();

Remember, that you can easily cast objects like XElement and XAttribute into string, int, double, DateTime and more. Complete list can be found here: XElement Type Conversions

A: notificationList = x.Element("Notifications")
    .Elements("Notification")
    .Select(e => new Notification()
        {
            notificationDate = DateTime.Parse(e.Element("NotificationDate").Value),
            notificationDetails = e.Element("NotificationDetails").Value,
            status = e.Element("Status").Value,
            notificationTitle = e.Element("NotificationTitle").Value,
            href = e.Attribute("href").Value
        }
    .ToList();


text:
Q: Achieving a Github-like tooltip I'm trying to implement a tooltip, like GitHub avatar hover. When an avatar is mouseover (hover), a tooltip is presented over the avatar. For this, I'm using popper.js.

   DM

Show me when hovered

JavaScript:
import { createPopper } from '@popperjs/core';

// Event function for mouseover when avatar is mouseovered

showTooltip = (e) => {

    let tooltip = document.getElementById('tooltip');
    let avatar = document.getElementById('avatar');
    tooltip.classList.remove('hidden')

   // Use popper to position the tooltip over the avatar
   createPopper(avatar, tooltip)

}

This works as expected. When I move the cursor over the tooltip, the tooltip is removed:

let avatar = document.getElementById('avatar');
let tooltip = document.getElementById('tooltip');
avatar.addEventListener('mouseout', (e) => {
    if (!avatar.contains(e.target)) {
        // Hide tooltip
        tooltip.classList.add('hidden')
    }
})

The above would be ideal if I move my cursor left/right/bottom, away from the avatar. When I move the cursor up, into the tooltip container, the tooltip closes. I'm going "overkill" now:
[..]
// yarn add debounce
import debounce from 'debounce';

[..]

avatar.addEventListener('mouseout', debounce(function(e) {
    if (!avatar.contains(e.target)) {
        // Hide tooltip
        tooltip.classList.add('hidden')
    }
}, 300));

My code looks messy as it is. How to achieve a Github-like tooltip, with "vanilla" JavaScript?


text:
Q: How do I call a post actionresponse passing the selected dropdown item as a parameter from javascript within a view How do I call a post actionresponse passing the selected dropdown item as a parameter from javascript within a view within asp.net, razor, mvc
Basically, as I'm sure you can tell from the below code, I'm trying to accomplish the above without much success. What should I change to be successful? Thanks
<script type="text/javascript">
$(function() {
    $("#mydropdown").change(function() {
        var selectedItem = $(this).val();
        $.ajax({
            url: '@Url.Action("DoStuff", "MainController")',
            type: "Post",
            data: { name: selectedItem },
            success: function () {
                alert('success');
            }
        });

    });
});

    [HttpPost]
    public ActionResult DoStuff(String Selecteditem)
    {
        CIModel CIModellList = CILHelper.ImportFunc(Selecteditem);
        return View(CIModellList);
    }

As of now, nothing happens whem the dropdown is changed. Although if I remove the ajax function, and replace this with an alert. Then the alert in this case does appear.
At this point, both the actionresult and the controller appear as though they do not exist (red) within the project even though both do and are named as stated.
The c# seems to suggest neither the action or the controller actually exist, giving the errors "cannot resolve action" or "cannot resolve controller"

A: <html>
<head>
    <meta charset="utf-8">

    <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.9.1.js"></script>
    <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

</head>
<body>

    <select id="mydropdown">
        <option  value="a">a</option>
        <option  value="b">b</option>
        <option  value="c">c</option>
        <option  value="d">d</option>
    </select>

        <script type="text/javascript">
      $(function() {
          $("#mydropdown").change(function() {
              var selectedItem = $(this).val();
              $.ajax({
                  url: '@Url.Action("DoStuff", "MainController")',
                  type: "Post",
                  data: { name: selectedItem },
                  success: function () {
                      alert('success');
                  }
              });

          });
      });
    </script>

</body>
</html>

    [HttpPost]
    public ActionResult DoStuff(string name)
    {
    CIModel CIModellList = CILHelper.ImportFunc(name);
    return View(CIModellList);
    }

A: You must change your name of the parameter to SelectedItem that matches the parameter your action method and stringify your json data before passing like,
JSON.stringify({ SelectedItem :selectedItem })

See this for reference.


text:
Q: How can I justify the text in  in aframe? I want to justify the text rendered in the  tag of a-frame. Is there any way I can do it? align attribute allows only center, left, and right.

A: a-text is based on three-bmfont-text, which does not support justification. You might want to try aframe-troika-text instead.


text:
Q: missing grant_type parameter in google oauth api v2? I am doing this request:
POST request to
https://accounts.google.com/o/oauth2/token?
client_secret=xxxxx-x8U-tDOJbCPN3&
grant_type=authorization_code&
redirect_uri=[url]
client_id=xxxxxx-e4u1224f7uqjafv7m1lu2ek5ac01isi4.apps.googleusercontent.com&
code=xxxxxxlpdiZfd_LhYu167gK.QvJZYyoaoQAQ3oEBd8DOtNC9kGrnjwI

So, as doc says, i make that request with these headers:
"Accept-Encoding": "gzip"
"Content-Type": "application/x-www-form-urlencoded"

But when i do it i am getting a 400:
{"error":"invalid_request","error_description":"Required parameter is missing: grant_type"}

A: I have already solved this. The problem was that i was sending params in query string, and the correct way was sending them as x-www-form-urlencoded. So the correct request had to be like this:
POST /o/oauth2/token? HTTP/1.1
Host: accounts.google.com
Cache-Control: no-cache
Postman-Token: b38df5b3-b64f-338a-1374-220647ee05a0
Content-Type: application/x-www-form-urlencoded

client_secret=xxxxx-x8U-tDOJbCPN3%26&grant_type=authorization_code&redirect_uri=myredirecturi&client_id=xxxxxx-e4u1224f7uqjafv7m1lu2ek5ac01isi4.apps.googleusercontent.com&code=xxxxxxlpdiZfd_LhYu167gK.QvJZYyoaoQAQ3oEBd8DOtNC9kGrnjwI

Hope this helps

A: had a similar problem, but in my case it was postman leaving a stupid Content-Type:application/json in the header!
Hope this might avoid my struggling for someone having the same issue!


text:
Q: Error: Could not find the correct Provider above this friendsPage Widget This is my provider:
class FriendsProvider with ChangeNotifier {
  FriendsProvider() {
    loadCountries().then((countries) {
      _countries = countries;
      notifyListeners();
    });
  }

  List<MyUser> _countries = [];

  List<MyUser> get countries => _countries;

  Future loadCountries() async {
    final data = await rootBundle.loadString('assets/country_codes.json');
    final countriesJson = json.decode(data);

    return countriesJson.keys.map<MyUser>((code) {
      final json = countriesJson[code];
      final newJson = json..addAll({'code': code.toLowerCase()});

      return MyUser.fromJson(newJson);
    }).toList()
      ..sort(Utils.ascendingSort);
  }
}

And in the build method of another class I call it in this way
final provider = Provider.of<FriendsProvider>(context);

but I get the error in the title. What is wrong and how can I fix?

A: In Your main.dart file  Check You Register this Provider or not.
You have add your "FriendsProvider" provider.


text:
Q: MongoDB get all values of 1 field So I know that  in mongodb, I can get all values and then iterate through them but I was wondering if in mongodb there is an option to get only a certain field.
So for example suppose my collection is structured as follows:
{_id:
    {
    field1,field2,field3}
    }
{description:
    {
    field1,field2,field3,
    data:{
    field1,field2,field3
    }
    }
    }
{otherdata:
{field1,field2,field3}
}

Now, I need the value of description.data.field1 so any suggestions on how to do that?
So far I have tried using following commands:
db.module.collection.description.data.find()
db.module.collection.description.find({'data':1})
db.module.collection.find('description.data.data':1})

But obviously, they did not work.
Any suggestions?

A: First of all, the structure of your JSON isn't correct. The correct structure should be:
{
_id:{
    field1: "",
    field2: "",
    field3: ""
},
description:{
    field1: "",
    field2: "",
    field3: "",
    data:{
        field1: "",
        field2: "",
        field3: ""
    }
},
otherdata:{
    field1: "",
    field2: "",
    field3: ""
}
}

Now for what you need, you can use Projections
Something like this:
db.collection.find({}, {description.data.field1: 1})


text:
Q: "Where is FinderSyncAPIExtension?" (Google Drive) For the last week or so I have been periodically getting this dialog popping up, shown below. It would seem from googling around that this is related to Google Drive.
I have tried the recommendations on Apple Support Communities, specifically I have used the Browse button on the popup and selected FinderSyncAPIExtension by going to the finder and opening Google Drive > Show Package Contents > Contents and dragging FinderSyncAPIExtension.appex into the Browse window. That did not resolve the problem. I have also tried deleting Google Drive and installing it fresh from Google.
Currently, after I get this popup (and cancel it), GDrive stops syncing and I have to quit it and start it again to get it to start syncing again.

A: This may be of use:
https://forums.insynchq.com/t/mac-how-to-fix-issues-on-the-new-finder-sync-extension-file-icon-overlays-and-context-menu-in-os-x-10-10-above/3465
Basically it says to go to System Preferences>Extensions and make sure that not more than one cloud file system is set on Finder. Only one can do it at a time: so that's what causes FinderSyncAPIExtension to crash.

A: I located the Google Drive app (/Applications) and clicked that. GDrive then continued to sync without errors. I'm not sure if this is the correct solution, I only tried it once (just 2 minutes ago) but so far so good.

A: The google drive app seems to sync regardless of the pop up being satisfied. However, the pop up keeps popping up on my system such that I may have three or four of them splattered all over my computer screens, disabling my ability to see necessary program windows they insist on being atop of.  Ignoring the pop up is not really an option and there seems to be no way to show the pop up where the extension is since the browser can not be directed to the "hidden" folder in the google app.

A: I just installed Drive on a new Apple computer and saw that dialog for the first time. Found on the apple forum that it could be related to having Drive sync with multiple accounts. That's my situation, so could be indicative of where to look for solutions.

GolfHotel
  Feb 2, 2016 3:56 AM
  This typically occurs when you have google drive installed and more than one google drive identity. The conflict occurs when drive cant determine which files to synch when you are logged into more than one account.
https://discussions.apple.com/thread/6890881?start=0&tstart=0

A: the solution is very simple, just click on the browse button and select the Google Drive app Icon in your applications folder, and that's it! not pop-ups windows any more. enjoy!

A: I've had this issue for months. Today while staring yet again at the list of apps in the pop-up, I realized there were two Google Drive icons. One was listed under this path:
~/Library/Application Support/Google/Chrome/Default

and one under:
~/Library/Application Support/Google/Chrome/Profile 1

They were different versions. The Profile 1 turned out to be from when my daughter logged in to her account on my computer (using Chrome, she uses a Chromebook).
With the dialog still on the screen, I deleted Profile 1 and emptied the trash — the popup went away, as did the Google Drive menubar item. I opened Google Drive and got no popup. I logged out of the computer, then back in, and still no popup.
So, perhaps having logged into another account at some point in the past (using Chrome, on an account where the Drive app/plugin is active) installed a different version. That version never gets updated, because I haven't logged back into that account? So, maybe it is being found to be in conflict/out of date?

A: I followed jackoverflow's advice and it turned out it was actually Adobe Creative Cloud that was trying to use an extension in Finder and was getting killed by DropBox.  The checkbox had a blue dot next to it, so I checked it and then unchecked it and that seems to have stopped the popups.  I'd rather have the DropBox Finder extension active.

A: This helped me too: "I found that simply checking the box next to Google Drive (it wasn't checked) seems to have fixed this for me. – RedYeti".
Why the checkbox was cleared I don't know. Last thing I did was installing Adobe Acrobat Pro DC.
And for what it's worth I have three cloud systems set on Finder (Dropbox, Google and SwitchDrive).

A: Maybe the following will bring a solution, it did in my MacBook Pro (OS X El Capitan version 10.11.6):

*

*Open the app Terminal

*type the following command: chflags nohidden ~/Library
This will make the Library folder visible.

*Shut down your Mac (not restart, won't work)

*Start up your Mac

*Presto, the problem is over (at least in My MacBook it is)


text:
Q: How can I remove a symbol in a library(.lib) under ccs There are two library which contains one same symbol, this leads to a redefinition when linking the lib. How can I remove a specific symbol in a lib?
The developing environment is CCS3.3, the duplicated symbol is _sature which is defined in rst6740.lib.
Thanks in advance!

A: Good question !
In my opinion, you should rebuilt rst6740.lib.
You can find out the library code "rtssrc.zip" in folder that you setup the compiler.
Example : C:\ti\C6000_Code_Generation_Tools_7.3.7\lib.
That is code of library that will used to build the rts6740.lib,rts6400.lib...
Then you should remove the code of sature function and rebuilt the  rst6740.lib.
How to rebuild this lib you can search in Google.
Now i don't remember clearly step by step to rebuild it.


text:
Q: Is it best practice to use surrogate keys when creating foreign key constraints in SQL Server? I'm trying my best not to ask a leading question, but after a lot of searching I'm unable to find a similar answer or recommendation.
First, take a look at this question I asked on Stack Overflow last week: Why does inserting a row with a foreign key referencing a row by pk modified in another snapshot isolation transaction cause the transaction to hang?
In our database we have 4 tables. Two has a foreign key to One's primary clustered key. Four has a foreign key to Three via a surrogate key. In all cases, the keys are meaningless.

Imagine two scenarios:
In a snapshot transaction where a column is modified in One, another snapshot transaction begins where a row is simply inserted into Two, where the foreign key column has the value of the row being modified in One. The latter transaction will block until the former transaction is committed, and then the latter transaction will abort with a snapshot isolation error.
In a very similar situation, a snapshot transaction begins where a column is modified in Three, another snapshot transaction begins where a row is simply inserted into Four, where the foreign key column has the value of the row being modified in Three (via its surrogate key). The latter transaction will finish without issue before the former transaction is committed.
Despite the answer being rather simple, this is unintuitive to me. I almost want to consider this a bug in SQL Server. The first scenario's transaction doesn't have a legitimate reason to block, and it especially doesn't have a legitimate reason to roll back the transaction. It does so basically because of an implementation detail. But if you just use a surrogate foreign key, everything works as expected and nothing is blocked or conflicts.
Is it best practice to use surrogate keys when creating foreign key constraints in SQL Server?

A:
Despite the answer being rather simple, this is unintuitive to me. I almost want to consider this a bug in SQL Server. The first scenario's transaction doesn't have a legitimate reason to block, and it especially doesn't have a legitimate reason to roll back the transaction. It does so basically because of an implementation detail. But if you just use a surrogate foreign key, everything works as expected and nothing is blocked or conflicts.

It's not the surrogate key aspect that is important, it is whether a key-only nonclustered index is used for the foreign key validation, or the key-plus-data clustered index.
The SQL Server implementation always takes a shared lock when validating foreign keys on the parent side, to ensure the most recent committed data is read, and stays that way until that row's update is complete.
Under RCSI, this can lead to unexpected blocking, as you show. Under SI (snapshot isolation) it can result in an arguably-unnecessary update conflict error being reported.
In this case, RCSI blocks but continues after the blocking transaction commits or rolls back. Under SI, the blocked transaction aborts with an update conflict if the blocking transaction commits (but succeeds if it rolls back).
The index used to check a foreign key need not be the primary key, it can be any key for the relation. You may choose to enforce that key with a nonclustered or clustered unique index for a variety of reasons. It is not uncommon for the primary key to be nonclustered, and another candidate key to be clustered.
Snapshot isolation is most appropriate for read-mostly workloads, where update conflicts (real or imagined) will likely be rare.
More information in two of my articles:

*

*Foreign Keys, Blocking, and Update Conflicts (this specific issue)

*The SNAPSHOT Isolation Level (other surprises)


text:
Q: cvFindContours always returns 0 - OpenCV I'm calling the cvFindContours function inside a separate thread that I've created to handle all OpenCV work while another is kept for OpenGL stuff.
I noticed that my cvFindContours function always returns 0 when this code is executed inside a separate thread. It worked fine before, when executed in the main thread itself. I used breakpoints and Watches to evaluate value changes. everything else (variables) gets values except for contourCount (value: 0).
Any clue?
// header includes goes here
CvCapture* capture = NULL;
IplImage* frame =  NULL;
IplImage* image;
IplImage* gray;
IplImage* grayContour;
CvMemStorage *storage;
CvSeq *firstcontour=NULL;
CvSeq *polycontour=NULL;
int contourCount = 0;

DWORD WINAPI startOCV(LPVOID vpParam){

    capture = cvCaptureFromCAM(0); // NOTE 1
    capture = cvCaptureFromCAM(0);
    frame = cvQueryFrame(capture);
    image = cvCreateImage(cvGetSize(frame), IPL_DEPTH_8U,3);
    gray = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U,1);
    grayContour = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U,1);
    storage = cvCreateMemStorage (0);
    firstcontour=NULL;

    while(1){
            frame = cvQueryFrame(capture);
            cvCopy(frame,image);
            cvCvtColor(image,gray,CV_BGR2GRAY);
            cvSmooth(gray,gray,CV_GAUSSIAN,3);
            cvThreshold (gray, gray, 0, 255, CV_THRESH_BINARY | CV_THRESH_OTSU);
            cvNot(gray,gray);
            cvCopy(gray,grayContour);

            contourCount=cvFindContours (grayContour, storage, &firstcontour, sizeof (CvContour),
    CV_RETR_CCOMP);
                            polycontour=cvApproxPoly(firstcontour,sizeof(CvContour),storagepoly,CV_POLY_APPROX_DP,3,1); // Error starts here (Pls refer to stack trace)
    }
         // goes on...
}

int main(int argc, char** argv){

     DWORD qThreadID;
     HANDLE ocvThread = CreateThread(0,0,startOCV, NULL,0, &qThreadID);
     initGL(argc, argv); //some GL intitialization functions
     glutMainLoop(); // draw some 3D objects
     CloseHandle(ocvThread);
     return 0;
}

NOTE1: these lines had to be duplicated due to the error mentioned at How to avoid "Video Source -> Capture source" selection in OpenCV 2.3.0 - Visual C++ 2008
Environment:
OpenCV 2.3.0
Visual C++ 2008
EDIT
Traces

opencv_core230d.dll!cv::error(const cv::Exception & exc={...})  Line 431 C++
opencv_imgproc230d.dll!cvPointSeqFromMat(int seq_kind=20480, const void * arr=0x00000000, CvContour * contour_header=0x01a6f514, CvSeqBlock * block=0x01a6f4f4)  Line 47 + 0xbd bytes C++
opencv_imgproc230d.dll!cvApproxPoly(const void * array=0x00000000, int header_size=88, CvMemStorage * storage=0x017e7b40, int method=0, double parameter=3.0000000000000000, int parameter2=1)  Line 703 + 0x28 bytes C++
Project.exe!startOCV(void * vpParam=0x00000000)  Line 267 + 0x24 bytes    C++

All this stuff boils down to the function CV_Assert( arr != 0 && contour_header != 0 && block != 0 ) in cvPointSeqFromMat and it fails since arr it requires is empty.

A: Your variable contourCount is not doing what you think it's doing. From the contours.cpp source file:
/*F///////////////////////////////////////////////////////////////////////////////////////
//    Name: cvFindContours
//    Purpose:
//      Finds all the contours on the bi-level image.
//    Context:
//    Parameters:
//      img  - source image.
//             Non-zero pixels are considered as 1-pixels
//             and zero pixels as 0-pixels.
//      step - full width of source image in bytes.
//      size - width and height of the image in pixels
//      storage - pointer to storage where will the output contours be placed.
//      header_size - header size of resulting contours
//      mode - mode of contour retrieval.
//      method - method of approximation that is applied to contours
//      first_contour - pointer to first contour pointer
//    Returns:
//      CV_OK or error code
//    Notes:
//F*/

You are getting CV_OK == 0, which means it successfully ran. cvFindContours does not return the number of contours found to you. It merely lets you known if it failed or not. You should use the CvSeq* first_contour to figure out the number of contours detected.
Hope that helps!


text:
Q: How can I set the Name attribute of an input field using Jquery? Quick question... I was wondering how I can get this to happen.
Okay I have an input field like such:
<input type="text" id="input1" size="10" name="" value="" class="checked other_amount" onfocus="Toggle('radio1', 'input1');" />

I would like to click on a div with an ID of #resetPrompt and fill the empty name attr from the input with "other_amount"
I'm out of ideas its been a long day
Thanks guys,
Matt

A: $('#resetPrompt').click(function(){
    $('#input1').attr('name', 'other_amount');
});

A: This is for all the googlers out there:
It should be noted that Alex's proposal, though functional in most "real" browsers, does not work in ie 8 and below (jquery 1.6.2). When setting the "name" attribute of an input field, Microsoft, to address a bug, added a fictitious "submitName" attribute when dynamic input fields are attached to the DOM.
To workaround the problem in ie, either force your users to upgrade, use Firefox, Chrome, etc. or you'll need to add the input field manually:
$("#resetPrompt").click(function(){
   $("#input1").remove();
   $("#input_container").append('<input id="input1" name="' + other_amount + "' type="text" class="checked other_amount" onFocus="Toggle(\'radio1\', \'input1\');" />');
});

A: If "other_amount" is the ID of the other input, use attr and val as follows:
$("#resetPrompt").click(function(){
    var otherValue = $("#other_amount").val();
    $("#input1").attr("name", "someName");
}

A: Assuming that "other_amount" is the name, not id of the corresponding input.
$('#resetPrompt').click( function() {
   $('#input1').attr('name', $('[name=other_amount]').val());
});


text:
Q: If $f(x)=\begin {cases} x^a\sin (1/x) & x\not =0 \\ 0 & x =0 \end {cases}$ is continuous but not differentiable at $x=0$ find $a$ If $$f(x)=\begin {cases} x^a\sin (1/x) & x\not =0 \\ 0 & x=0 \end {cases}$$ is continuous but not differentiable at $x=0$ find $a$.
Since the function is continuous
$$\lim_{x\to 0} x^a \sin \left(\frac 1x\right) =0.$$
Function is not differentiable at $x=0$
$$\lim_{h\to 0} \frac {h^a \sin (\frac 1h)}{h}$$
$$=\lim_{h\to 0} h^{a-1} \sin \left(\frac 1h\right)$$ must not exist.
How do I find the interval of $a$ from these two results?

A: Hint: in general for
$$\lim_{x\to 0} x^a \sin \left(\frac 1x\right) =0,$$
we must have $a>0$ because $\sin(\frac{1}{x})$ has oscillatory nature as $x$ approaches zero. To remove this the power of $x$ must be $>0$ .
Thus from your continuity condition $a>0$ and for second limit not to exist $a\le1$ or $a\in(0,1]$.

A: Hint: Let $f$ be a bounded function, that is $ |f| \le M$, and let $g$ be a function with $\text{lim}_{x_0} g = 0$. What can you tell about the limit of $f\cdot g$ at $x_0$?

A: Continuity implies $a > 0$ because otherwise $x^a \sin \left(\frac 1x\right)$ would go to infinity.
Non-differentiable implies $a \leq 1$ because the function's derivative $f'(x) = x^{a-2}(ax\sin \left(\frac 1x\right)-\cos \left(\frac 1x\right))$ then goes to -infinity on the right and +infinity on the left of $x=0$, making the function non-differentiable.
I don't think your method of proving non-differentiable was the best.