text:
Q: ggplot facet_grid now switches left strip and tick marks I am using ggplot to illustrate results for a panel of plots. Some months ago, when I first made my figures (and before the latest upgrade of ggplot) I was able to make this:

However, now that I have to remake my figures for resubmission, and now that I have updated to the latest version of ggplot, this is what the exact same code will produce:

For reference, this is the code I am using
#################### Set ggplot theme

themebar = theme(axis.text.x = element_text(face="bold", color="black", size=rel(1), angle=0),
             axis.title.x = element_text(size = rel(1.1), angle = 0, face="bold"),
             axis.text.y = element_text(face="bold", color="black", size=rel(1), angle=0),
             axis.title.y = element_text(size = rel(1.1), angle = 90, face="bold"),
             panel.border = element_rect(linetype = "solid", colour = "black", fill=NA),
             legend.text = element_text(size = rel(0.7), face = "bold", lineheight=0.8),
             legend.position = "bottom",
             legend.box = "vertical",
             legend.background = element_rect(fill=NA, size=0.25, linetype="solid", colour ="black"),
             legend.title = element_blank(),
             panel.grid.major = element_line(colour="gray", linetype = "dotted"),
             panel.background = element_rect(fill = NA),
             strip.background = element_rect(fill = NA),
             strip.text = element_text(size=rel(1), face="bold")) # , strip.text = element_blank()

## labeller
alt_sites = c(`Kolkata` = "A",  `Delhi` = "B", `Dong Thap` = "C", `Kibera` = "D", `Lwak` = "E")

ggplot(dat_2ceac_main, aes(x=wtpdol, y=prob, group=Intervention, colour=factor(Intervention))) + #
 geom_line(size=1) +
 geom_vline(aes(xintercept = 0), size=0.75, linetype=c("dotted"), show.legend=F) +
 geom_vline(aes(xintercept = vce), data=threshold, linetype=c("dashed"), show.legend=F) +
 geom_vline(aes(xintercept = ce), data=threshold, linetype=c("dotdash"), show.legend=F) +
 facet_grid(site~., switch="y", labeller=labeller(site=as_labeller(alt_sites))) +
 themebar + theme(strip.text.y = element_text(angle = 180, vjust=1), strip.switch.pad.grid=) +
 scale_colour_manual(values=Set0, labels=c("No intervention", "Routine")) + # scale_colour_hue(c=120,l=45) +
 scale_x_continuous(limits=c(0, 20000), labels=comma) +
 scale_y_continuous(limits=c(0, 1)) +
 guides(colour = guide_legend(nrow = 1, byrow=F)) + # title = "Intervention", title.position = "top",
 ylab("Probability Cost-Effective") +
 xlab("Willingness-to-pay per \ndisability-adjusted life-year averted, I$")

A: Difficult to debug without seeing example data, but try adding this to the end of themebar:
+ strip.placement = "outside"


text:
Q: Why It shows Undefined when I try Access object in array in Next js I'm trying to display sub Products of the main product so what I have tried is to get the product code from the URL and try to fetch sub-products that match the main product code
 List of Products and Sub products
const data ={
 product:[
   {
   title:'Product1',
   slug:'001',
   category:'shirt',
   image:'./../../public/image1.jpg',
   },
   {
   title:'Product2',
   slug:'002',
   category:'shirt',
   image:'./../../public/image2.jpg',
   },
],
subProduct:[
   {
   title:'subProduct1',
   slug:'001',
   image:'./../../public/image01.jpg',
   price:70
   },
   {
   title:'subProduct2',
   slug:'001',
   image:'./../../public/image02.jpg',
   price:200
   },
   {
   title:'subProduct3',
   slug:'002',
   image:'./../../public/image03.jpg',
   price:170
   },
   {
   title:'subProduct4',
   slug:'002',
   image:'./../../public/image04.jpg',
   price:150
   },

],

}

  const  slug  = '001';
  const product = data.product.find(x => x.slug === slug);
  const subProducts =  data.subProduct.filter(function(x) {
  return x.slug == slug;});

  console.log(subProducts.title)[enter image description here][1]

the issue is it shows Undefined when I try implement like {subProducts.title}
but when I console.log(subProducts) I get Array of subProducts that match with the slug of the Main Product

A: subProducts is an array of objects. You're trying to get to title attribute of each item in that array but what you are actually doing with subProducts.title is that you're trying to reference a title property on an array, which yields undefined, because the array has no such attribute. The array contains objects as individual items and those are the ones that have the title attribute.
So in react (which is part of next.js) when you need to render an array, try something like this:
const Component(props) => {
  const subproducts = [{title: 'Foo'}, {title: 'Baz'}]

  return (

     {
      subproducts.map((subproduct) => (

{subproduct.title}

      ))
     }

}

The key tag is required by react. More on this here

redpajama_set_name: RedPajamaStackExchange


text:
Q: mysql jdbc: what is column size for BIGINT? mysql jdbc: what is column size for BIGINT?
jdbc:
id BIGINT(20)
ResultSet columns = databaseMetaData.getColumns("foo", "bar", "table", "id");
columns.next();
int columnSize = columns.getInt(7);

the columnSize is 19. Is it 19 bytes?

A: Q: What is column size for BIGINT?
The MySQL BIGINT datatype is a 64-byte signed integer. From a JDBC resultset, that can be handled in Java as a long.
With the unsigned variant, the MySQL BIGINT UNSIGNED dataype, that could be handled as java.math.BigInteger.  (The maximum value of MySQL BIGINT UNSIGNED exceeds the maximum value of Java long.)
Q: Is it 19 bytes?
The longest string value that MySQL will return for a BIGINT would be 20 characters. The lowest possible value for a MySQL BIGINT, represented as a character string is '-9223372036854775808'. (That's 19 digits, but an extra character is required for the minus sign.)
The largest value of BIGINT would have a string representation of 19 characters.
For the unsigned variant BIGINT UNSIGNED the largest value would be represented as 20 decimal digits, thus 20 characters.
In terms of storage in the MySQL database, the BIGINT datatype requires eight bytes.


text:
Q: How can you define the exponential and logarithmic integrals in terms of the incomplete gamma function? https://www.wolframalpha.com/input/?i=gamma(0,x)
https://en.wikipedia.org/wiki/Exponential_integral
https://en.wikipedia.org/wiki/Logarithmic_integral_function
For the Euler integral definition, it seems reasonable that $Ei(x)$ and $Li(x)$ can be expressed in terms of the incomplete gamma function, but the engine result shows a more complicated expression that just either of those functions. How can you express only $Ei(x)$ and $Li(x)$ in terms of just the incomplete gamma function?


text:
Q: OWA Addin code written gives a pane within the mail, but i need it to pop a window and display the webpage in default browser FormSettings>

Form xsi:type="ItemRead">

DesktopSettings>

SourceLocation DefaultValue="https://www.google.com"/>

RequestedWidth>800/RequestedWidth>

RequestedHeight>800/RequestedHeight>

/DesktopSettings>

/Form>

/FormSettings>

what has to be used in order to get a pop up browser on clicking that hyperlink

A: If you also want the task pane to open, you can start with an add-in command that only executes a JavaScript function. See an overview and an example.
Then either call the displayDialogAsync API to open a window that can communicate with the add-in (the kind of window depends on the client), or call window.open to open an external web page in the default browser.
When the add-in's JavaScript has finished executing, remember to call event.completed() per the first example to stop the add-in.


text:
Q: how to call back my app after open settings page from my app in iphone HI I am successfully open settings page from my iphone app but after that how  to come my app ? Is there any solution are manually open my app again,
Thanks In advance

A: Is the settings a bundle? (does it appear in the Settings app like Facebook, etc)
Or is this settings already in your app?
EASIEST WAY is to create a URL within your app and call that URL to bring your app.
Here is a good tutorial
http://mobiledevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html


text:
Q: iOS debugging/NSLog monitoring from C# I've been working with Android for a while, but now my company wants to provide the same solution for iOS as we do for android.  To do this I need to be able to get log messages from the phone to my c# application or something that can bridge between the two.  In android this was relatively simple, using adb monitor logcat output and send intents through the shell to the application, done.
From what I can tell there is no adb corollary for ios (of course, it's apple, right?).  So, does anyone know any way to monitor NSLog messages from and send messages to a physical IPhone via c# or anything that can easily communicate to/from c#?
I would like to have something very similar to adb or more preferably an API dll to reference, but again this is apple so from what I can tell most everything is embedded into their applications and not for public use.

A: By default, all NSLog statements get routed to Apple System Log (ASL), which is Apple's version of syslog. ASL can be queried using C functions (see asl_set_query, asl_search, and aslresponse_next).


text:
Q: Macro copies certains column from one sheet to other. Fine can't get it to paste from row 4 on sheet 2 instead of row 2 Macro copies certain columns from one sheet to other. I can't get it to paste from row 4 on sheet 2 instead of row 2.
Sub CopyPaste()
Dim lastrow As Integer, erow As Long, sheet1 As Worksheet, sheet2 As Worksheet
Set sheet1 = Worksheets("Sheet1")
Set sheet2 = Worksheets("Sheet2")
lastrow = sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
    erow = sheet2.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row
    sheet2.Cells(erow, 2) = sheet1.Cells(i, 3)
    sheet2.Cells(erow, 3) = sheet1.Cells(i, 4)
    sheet2.Cells(erow, 4) = sheet1.Cells(i, 9)
Next i
End Sub

A: skip the loop and assign the whole range as one:
Sub CopyPaste()
    Dim sheet1 As Worksheet
    Set sheet1 = Worksheets("Sheet1")

    Dim sheet2 As Worksheet
    Set sheet2 = Worksheets("Sheet2")

    Dim lastrow As Long
    lastrow = sheet1.Cells(Rows.Count, 1).End(xlUp).Row

    Dim erow As Long
    erow = sheet2.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).Row

    sheet2.Cells(erow, 2).Resize(lastrow - 1).Value = sheet1.Cells(2, 3).Resize(lastrow - 1).Value
    sheet2.Cells(erow, 3).Resize(lastrow - 1).Value = sheet1.Cells(2, 4).Resize(lastrow - 1).Value
    sheet2.Cells(erow, 4).Resize(lastrow - 1).Value = sheet1.Cells(2, 9).Resize(lastrow - 1).Value
End Sub


text:
Q: Numerical methods for Non linear ode with boundary conditions I have the non-linear ODE
$$\frac{d^2}{dx^2}y=a(y+y^3)$$
With the boundary conditions that
$\lim_{x\to \pm \infty} y(x) =0$
I found that it has an analytical solution of the form $\sqrt{\coth^2(\sqrt{a} x )-1 } $.
My main goal is to get this solution numerically.
The exact solution  has singularity at the origin so no numerical method will work for it but the singularity is of the order $1/x$ so I made the substitution $ u=x^2 y $ which eliminates the singularity at the origin.In the new equation numerical methods do apply. But now I am stuck I don't know which method is used for odes with infinite boundary conditions. The only idea that I have is that I make the solution close to 0 at the end points of my the discrete domain I choose but I am not aware of any numerical for solving this nonlinear odes of this form. .Also it would be great if someone could recommend a book that covers odes of this form.


text:
Q: Two links in bootstrap nav-tabs menu I am using Bootstrap 3.3.6
I have the following nav-tabs.

            [Edit]
            Tab1

It looks like this

I would like it to look like this:

When I change the li to inline-flex, it looks like two separate tabs.  No effect on any other display options.

A: Try

.nav-tabs {
  border: 1px solid #ddd;
  border-bottom: none !important;
  border-radius: 4px;
  border-bottom-right-radius: 0px;
  display: inline-block;
}

.nav-tabs a {
  border: none !important;
  margin-right: 0 !important;
  text-decoration: underline;
  font-weight: 500;
  text-decoration-thickness: 2px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

[Edit]

Tab1

A: This ended up working for me - simple.

      Tab title


text:
Q: Set a listener in react native in componentDidMount but dispatch to new screen not getting called I have the following problem. I have a class in react-native which more or less looks like this:
import {...};

const ReadyButton = props => (
  <View>
    <RoundButton
      width={175}
      text="..."
      onPress={props.onPress}
    />
  </View>
);

ReadyButton.propTypes = {
  onPress: PropTypes.func,
};

const ReadyButtonContainer = connect(null, dispatch => ({
  onPress: () => {
    dispatch(askIgnoreBatteryOptimizations(requestLocationPermissions));
  },
}))(ReadyButton);

export default class CalibrationWalkInstructions extends Component {
  componentDidMount() {
    listenToPermissionChanges();
  }

  render() {
    const enableBackgroundDataCollectionMessage = (Platform.OS === 'ios')
      ? '...'
      : '...';

    return (
      <ScreenWrapper>
        <CenterContent>
          <StandardWrapper spacing={15}>
            <FullWidthImage
              source={PhoneInPocketIconImage}
              width={300}
              height={380}
              scale={0.6}
            />
          </StandardWrapper>
          <StandardWrapper spacing={15}>
            <PrimaryText>
             ...
            </PrimaryText>
          </StandardWrapper>
          <StandardWrapper>
            <PrimaryText>
              {enableBackgroundDataCollectionMessage}
            </PrimaryText>
          </StandardWrapper>
          <ReadyButtonContainer />
        </CenterContent>
        <TutorialBottomProgress currentStep={2} stepName={'Walk'} align={'right'} />
      </ScreenWrapper>
    );
  }
};

Additionally I have a file called actions.js where all my functions are in. From here I want to call the following function which attaches a listener if the location permissions have been granted/changed in the iOS settings. The callback of the function will then directly lead the user to the next screen. My function in action.js looks like this so far:
export function listenToPermissionChanges() {
  console.log('FOOO listenToPermissionChanges called');
  return function(dispatch) {
    console.log('FOOO inside dispatch');
    listenToLocationPermissionChanges(function() {
      detachLocationPermissionChangeListener();
      console.log('FOOO dispatch now');
      dispatch({
        type: LOCATION_PERMISSION_GRANTED,
      });
      dispatch(goToWalkCalibration());
    });
  };
}

If I call this function in the componentDidMount() like above, I am able to reach to the first FOOO log statement but not further. My question is now, why does it not get further. Is there a problem that I can't call a dispatch call from the componentDidMount() function, am I missing a return statement or why doesn't it execute the rest but starts?
Thanks for the help / answers in advance.

A: Like the guy commented on the question. I solved it with listenToPermissionChanges()(dispatch)
Though it's somehow not possible to dispatch something in the componentDidMount() function. Therefore I just call the listenToPermissionChanges function on the ReadyButtonContainer. It looks like this now:
const ReadyButtonContainer = connect(null, dispatch => ({
  onPress: () => {
    dispatch(askIgnoreBatteryOptimizations(requestLocationPermissions));
    listenToPermissionChanges()(dispatch);
  },
}))(ReadyButton);


text:
Q: Expire a Session after Closing the Browser OR after 30 Minutes in Rails? How can I expire a session in Rails after a user closes the browser OR after 30 minutes? Whichever comes first?
I have tried in session_store.rb setting expire_after: nil || 30.minutes but doesn't work.
Rails 3.2

A: You can configure the application's session information in the initializer file config/initializers/session_store.rb
YourApp::Application.config.session_store :cookie_store,
  :key => '_my_session',
  :expire_after => 30.minutes

If you are using then Devise has a timeoutable module that you can use.
In your User model you would include :timeoutable with your devise models and in the devise.rb initializer you would configure it comparable to:
  # ==> Configuration for :timeoutable
  # The time you want to timeout the user session without activity. After this
  # time the user will be asked for credentials again. Default is 30 minutes.
  config.timeout_in = 30.minutes

You have to add expire_after key with nil value to the options:
Rails.application.config.session_store :cookie_store, key: '_app_session', expire_after: nil

After applying this change, the session will expire when user closes the browser. You can read more about cookies expiration here

A: Alright, so the issue was with caching. I had to restrict caching on the login page to avoid a lag displaying the home page as if the user was logged in.
In the application_controller.rb I set the following:
before_filter :set_cache_headers
def set_cache_headers
      expires_now
end

And in session_store.rb I set the session store to
expire_after: 30.minutes


text:
Q: Error with FCM + SNS Token on Android app I've followed AWS Mobile Hub push integration guide, and integrated AWS SNS push services in my app. When I open the app I get this error log:
E/AndroidRuntime: FATAL EXCEPTION: main
                                                             Process: com.intap.appme, PID: 23576
                                                             java.lang.RuntimeException: Unable to start activity ComponentInfo{com.intap.name/com.intap.name.MainActivity}: com.amazonaws.AmazonServiceException: 1 validation error detected: Value null at 'token' failed to satisfy constraint: Member must not be null (Service: AmazonSNS; Status Code: 400; Error Code: ValidationError; Request ID: 21d6a3b2-0459-513a-bf7a-f3c1d99d41ac)
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3253)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                                                                 at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                 at android.os.Looper.loop(Looper.java:158)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:7224)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
                                                              Caused by: com.amazonaws.AmazonServiceException: 1 validation error detected: Value null at 'token' failed to satisfy constraint: Member must not be null (Service: AmazonSNS; Status Code: 400; Error Code: ValidationError; Request ID: 21d6a3b2-0459-513a-bf7a-f3c1d99d41ac)
                                                                 at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:712)
                                                                 at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:388)
                                                                 at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:199)
                                                                 at com.amazonaws.services.sns.AmazonSNSClient.invoke(AmazonSNSClient.java:2262)
                                                                 at com.amazonaws.services.sns.AmazonSNSClient.createPlatformEndpoint(AmazonSNSClient.java:447)
                                                                 at com.amazonaws.mobile.push.PushManager.subscribeToTopic(PushManager.java:264)
                                                                 at com.intap.name.MainActivity.onCreate(MainActivity.java:50)
                                                                 at android.app.Activity.performCreate(Activity.java:6876)
                                                                 at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
                                                                 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
                                                                 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
                                                                 at android.app.ActivityThread.access$1100(ActivityThread.java:221)
                                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
                                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                 at android.os.Looper.loop(Looper.java:158)
                                                                 at android.app.ActivityThread.main(ActivityThread.java:7224)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

The code lines mentioned in the app are those lines:

PushManager.java:264 (The whole method)
public void subscribeToTopic(final SnsTopic topic) {
    final CreatePlatformEndpointRequest endpointRequest = new CreatePlatformEndpointRequest();
    endpointRequest.setPlatformApplicationArn(platformApplicationArn);
    try {
        endpointRequest.setToken(InstanceID.getInstance(context).getToken(sharedPreferences.getString("deviceToken", ""), GoogleCloudMessaging.INSTANCE_ID_SCOPE));
    } catch (IOException e) {
        Log.e("Error", e.getMessage());
    }
    /* This is line 264 -> */ final CreatePlatformEndpointResult endpointResult = sns.createPlatformEndpoint(endpointRequest);

    final SubscribeRequest request = new SubscribeRequest();
    request.setEndpoint(endpointResult.getEndpointArn());
    request.setTopicArn(topic.getTopicArn());
    request.setProtocol(SNS_PROTOCOL_APPLICATION);
    final SubscribeResult result = sns.subscribe(request);

    // update topic and save subscription in shared preferences
    final String subscriptionArn = result.getSubscriptionArn();
    topic.setSubscriptionArn(subscriptionArn);
    sharedPreferences.edit().putString(topic.getTopicArn(), subscriptionArn).apply();
}

MainActivity.java:50
pushManager.subscribeToTopic(pushManager.getDefaultTopic());

When I'm trying to send a push message through the online Firebase console, The device gets the push messages, and when I click on the message to open the app it keeps crashing.
When I'm trying to send a push message through the online SNS console, I don't get any push notfiications, which means the error is in the registration to SNS.
How can I solve it? I have no idea about it...

A: The token is coming back as null from Google's SDK.  The reason is due to this line:
endpointRequest.setToken(InstanceID.getInstance(context)
    .getToken(sharedPreferences.getString("deviceToken", ""),
       GoogleCloudMessaging.INSTANCE_ID_SCOPE));

The first parameter to getToken() should be the GCM Sender ID rather than the device token that is being passed as pulled from sharedPreferences. Changing your code to pass the sender ID as follows, should fix the issue:
endpointRequest.setToken(InstanceID.getInstance(context)
    .getToken(gcmSenderID, GoogleCloudMessaging.INSTANCE_ID_SCOPE));

Also, it appears that the code you pasted was modified from a Mobile Hub project that was generated in the fairly distant past. There have been improvements in the PushManager since then. The latest versions generated by the Mobile Hub would use the GCMTokenHelper class, which is not present in the code you pasted. Please try generating the sample app or SDK using the Mobile Hub again and updating your app to use the more recently generated code and report back if you are still experiencing issues.


text:
Q: Vector matrix vector multiplication derivative I came across the following derivation:
$$
\frac{\partial}{\partial\vec{u}}\left(\vec{u}^T\mathbf{A}^T\mathbf{A}\vec{u}\right) = 2\mathbf{A}^T\mathbf{A}\vec{u}
$$
where $\mathbf{A}$ is a 3 x n matrix and $\vec{u}$ a 1 x 3 vector.
I am aware that $\frac{\partial}{\partial\vec{u}}\left(\vec{u}^T\vec{u}\right) = 2\vec{u}$, but I cannot figure which trick is used to get the matrix out of the way since commutation does not apply. Thanks

A: For any $n \times n$ matrix $M$ we have
$$
\vec{u}^T M \vec{u} = \sum_{i=1}^n \sum_{j=1}^n M_{i,j} u_i u_j.
$$
Thus, for some $k$ we find that
\begin{align}
\frac{\partial}{\partial u_k} \left(\vec{u}^T M \vec{u}\right) &=
\sum_{\substack{j=1 \\ j \neq k}}^n M_{k,j} u_j +
\sum_{\substack{i=1 \\ i \neq k}}^n M_{i,k} u_i + 2 M_{k,k} u_k \\
&= \sum_{j=1}^n M_{k,j} u_j +
\sum_{i=1}^n M_{i,k} u_i.
\end{align}
If we denote the $k$th row of $M$ as $\vec{r}_k^T$ and the $k$th column of $M$ as $\vec{c}_k$, then we have just shown that
$$
\frac{\partial}{\partial u_k} \left(\vec{u}^T M \vec{u}\right) = \vec{r}_k^T \vec{u} + \vec{c}_k^T \vec{u}.
$$
Going through all $k = 1, \dots, n$ we find that
$$
\frac{\partial}{\partial \vec{u}} \left(\vec{u}^T M \vec{u}\right) =
\begin{pmatrix}
\vec{r}_1^T \vec{u} \\ \vdots \\ \vec{r}_n^T \vec{u}
\end{pmatrix}
+
\begin{pmatrix}
\vec{c}_1^T \vec{u} \\ \vdots \\ \vec{c}_n^T \vec{u}
\end{pmatrix}
=
\begin{pmatrix}
\vec{r}_1^T \\ \vdots \\ \vec{r}_n^T
\end{pmatrix} \vec{u}
+
\begin{pmatrix}
\vec{c}_1^T \\ \vdots \\ \vec{c}_n^T
\end{pmatrix} \vec{u}
=
M \vec{u} + M^T \vec{u}.
$$
In your case, $M = A^T A$ is symmetric, and thus we find that
$$
\frac{\partial}{\partial \vec{u}} \left(\vec{u}^T A^T A \vec{u}\right) = 2 A^T A \vec{u}.
$$


text:
Q: select() set position If I have df like this
df <- read.table(text="
              id date       paid_at    binded_at
1            107 2016-12-16 2017-06-02 2017-06-07
2            107 2017-11-27 2017-06-02 2017-06-07
3            107 2017-11-28 2017-06-02 2017-06-07
4            109 2016-11-28 2017-01-01 2017-06-07
5            109 2017-11-29 2017-01-01 2017-06-07
6            110 2017-12-04 2018-01-01 2017-06-07", header=TRUE)

How can I easily move paid_at column to 1st place and column id before binded_at column? Im using for that select, but I don't want to write
select(paid_at, date, id, binded_at)

Because if I have df with dozens of columns, it is complicated.-

A: df %>%
  select(id, paid_at, everything())

You can just select id and paid_at, and then add everything() to select all other columns as well in their original order.

A: We can hardcode first three columns and then select the remaining ones with setdiff.
cols <- c("paid_at", "id", "binded_at")
df[c(cols, setdiff(names(df), cols))]

#     paid_at  id  binded_at       date
#1 2017-06-02 107 2017-06-07 2016-12-16
#2 2017-06-02 107 2017-06-07 2017-11-27
#3 2017-06-02 107 2017-06-07 2017-11-28
#4 2017-01-01 109 2017-06-07 2016-11-28
#5 2017-01-01 109 2017-06-07 2017-11-29
#6 2018-01-01 110 2017-06-07 2017-12-04

With select it can be similarly done
library(dplyr)
select(df, c(cols, setdiff(names(df), cols)))


text:
Q: Email claim overrides username in keycloak I've written a custom OIDC-Provider and connected it to keycloak.
After the first login in via my provider, the user gets asked to enter a username, email, first name and last name (first-broker-login-flow).
Usually the username is prefilled with what is in the 'sub' claim.
But when sending an 'email' claim, the username is prefilled with the email.
How can I prefill the username with something else than my email, while also sending an 'email' claim?
So far I've tried sending a 'name', a 'username' and a 'preferred_username' claim  -  no success.
I figured out that the IdpReviewProfileAuthenticator checks for isRegistrationEmailAsUsername().
So I've deactivated "Login with email" in my realm settings  -  no success.
Is there any way for keycloak to not use the 'email' claim for the username?

A: I figured out a work around. In keycloak I created an "Username Template Importer"-mapper for my oidc provider and set the template-value to ${CLAIM.sub}.
Not the nicest solution in my humble opinion.
But it works until i figured out a better way to do it...


text:
Q: When is the group of quadratic residues cyclic? If a and b are two quadratic residues of the prime p, then it is easily checked that ab is also a quadratic residue modulo p; if c is a quadratic residue modulo p, and $ {cd \equiv {1} \pmod{p} } $, then since 1 is a quadratic residue of p, d is a quadratic residue of p; so the set of all quadratic residues form a group, denoted by $ \mathfrak R $. And my question is:

When is $ \mathfrak R $ cyclic?

I am very sorry not able to provide more motivations for studying this question; I want to know out of pure curiosity; it will be appreciated if anyone provides some insight or hint, thanks very much.

A: The group of quadratic residues $\bmod p$ is always cyclic, since if $g$ is a primitive root then $g^2$ generates it. More generally, as Mariano says, every finite subgroup of the multiplicative group of a field is cyclic.

A: The original question has been answered (they are always a cyclic group). Perhaps slightly more interesting is:

Fix $m\gt 0$. Then the subset of the units modulo $m$ that are squares forms a subgroup of the invertible elements modulo $m$. When is this subgroup cyclic?

If there is a primitive root modulo $m$ (that is, if the group of units modulo $m$ is cyclic), then the property holds. This occurs when $m$ is a power of an odd prime, twice a power of an odd prime, $m=2$, or $m=4$.
It also holds if $m=8$, since then the only quadratic residue is $1$, so the group of quadratic residues is cyclic. In fact, it holds if $m=2^n$ is a power of $2$, the result holds: because the group of units modulo $2^n$ is isomorphic to $C_{2^{n-2}}\times C_2$ (where $C_k$ is the cyclic group of order $k$), so the group of squares is isomorphic to $C_{2^{n-3}}$, which is cyclic.
Other nontrivial examples include $m=3p^a$ or $m=6p^a$ where $p$ is an odd prime and $a\gt 0$, $m=35 = 5\times 7$ (or more generally, $m=5^a 7^b$); and many others.
To get the complete answer, factor $m$ into primes,
$$ m = p_1^{a_1}\cdots p_r^{a_r}$$
where $p_1\lt p_2\lt\cdots\lt p_r$ are primes, and $a_r\gt 0$. By the Chinese Remainder Theorem, the group of units modulo $m$ is
$$\left(\mathbb{Z}/m\mathbb{Z}\right)^* = \prod_{i=1}^r \left(\mathbb{Z}/p_i^{a_i}\mathbb{Z}\right)^*.$$
The group of units modulo $p_i^{a_i}$ is

*

*Cyclic of order $(p_i-1)p_i^{a_i-1}$ if $p_i$ is odd;

*Trivial if $p_i=2$ and $a_i = 1$;

*Isomorphic to $\displaystyle C_{2^{a_i-2}}\times C_2$ if $p_i=2$ and $a_i\gt 1$.

The group of squares of invertible elements modulo $m$ is then isomorphic to a product of groups of the form

*

*Cyclic of order $\frac{p_i-1}{2}(p_i^{a_i-1})$ if $p_i$ is odd;

*Trivial if $p_i=2$ and $a_i\leq 2$;

*Cyclic of order $2^{a_i-3}$ if $p_i=2$ and $a_i\geq 3$.

The product is cyclic if and only if the orders of the cyclic factors are pairwise relatively prime.
This gives:
Theorem. Let $m$ be a positive integer, and let $p_1,p_2,\ldots,p_r$ be the distinct prime divisors of $m$, $p_1\lt p_2\lt\cdots\lt p_r$. Let $\varphi$ be Euler's totient function. The subgroup of squares of the invertible elements modulo $m$ is cyclic if and only if:

*

*For $m$ odd,

*

*$\displaystyle\gcd\left(\frac{\varphi(p_i^{a_i})}{2},\frac{\varphi(p_j^{a_j})}{2}\right) = 1$ for all $1\leq i\lt j\leq r$.

*For $m$ even,

*

*$\displaystyle\gcd\left(\frac{\varphi(p_i^{a_i})}{2},\frac{\varphi(p_j^{a_j})}{2}\right) = 1$ for $1\lt i\lt j\leq r$; and

*if $2^a$ is the largest power of $2$ that divides $m$ and $a\gt 3$, then $p_i\equiv 3\pmod{4}$ for all $i\gt 1$.

It is straightforward now to show (e.g., using Dirichlet's theorem on primes in arithmetic sequences) that there are $m$ with arbitrarily many distinct prime divisors for which the subgroup of squares of the units modulo $m$ is cyclic.


text:
Q: Finite dimensional operator with zero trace is $0$ I am working in the book "A Hilbert space Problem book", written by Halmos.
There is a claim on page 109 stating that:

"On a finite dimensional space, every hyponormal operator is normal".

In which, "hyponormal operator" implies some operator $A$ with $A^*A \ge AA^*$.
In order to prove it, one assume that $A$ is hyponormal, then $\operatorname{tr} \left( A^*A- AA^* \right) = 0$.
They also claimed that every positive operator on finite dimensional vector space with trace $0$ is $0$ operator.
Could you please prove the last claim? I have no idea to verify it.

A: Suppose $tr(A)=0$, this implies that $A$ is nilpotent since the eigenvalues are positive. If $A\neq 0$, there exists $x$ such that $A(x)\neq 0$ and $A^2(x)=0$, for any integer $n$, $<x-nA(x),A(x-nA(x))>=<x,A(x)>-n<A(x),A(x)>$, for $n$ enough big, $<x,A(x)><n<A(x),A(x)>$ contradiction.

A: The finite dimensional version of the spectral theorem says that for any positive operator there's an orthogonal basis for which its matrix is diagonal with nonnegative entries on the diagonal. So if the trace (the sum of those entries) is zero, then so is the matrix.
For a basis-free proof, consider that if $V$ is an inner product space then $V^*\otimes V$ acquires an inner product by $<a\otimes b,c\otimes d>=<a,c><b,d>$. When $V$ is finite dimensional we have $\mathrm{Hom}(V,V)=V^*\otimes V$, and so we get an inner product on $\mathrm{Hom}(V,V)$. This is the Frobenius inner product, $A\bullet B = \mathrm{tr}(A^*B)$. Since this is an inner product we know that if $A\bullet A = 0$ then $A=0$.

A: Perhaps this will be considered killing a fly with a sledge-hammer, but here is another way of thinking about it. Letting $A =[a_{ij}] \in M_n$ denote the matrix representation of the operator, since $A$ is positive semi-definite (PSD), it is also a Gram matrix, which means there exists an inner product space $(V,\langle \cdot \rangle)$ and vectors $v_1,...,v_n \in V$ such that $a_{ij} = \langle v_i,v_j\rangle$. Thus, if $tr(A) =0$, $||v_i||=0$ and therefore $v_i=0$ for each $i$, whereby we conclude $a_{ij} = 0$ for every $i,j$.
That all PSD matrices are Gram, and vice-versa, is a useful little factoid to keep in mind (at least I think so).

A: Suppose $\{e_\alpha \}$ is an orthonormal basis of $H$, then
$\newcommand{\tr}{\operatorname{tr}}$
$$ \tr(u)=\sum_\alpha\langle ue_\alpha, e_\alpha\rangle, u\in B(H).$$
If $u$ is positive, then $\langle ue_\alpha, e_\alpha\rangle=\|u^{\frac{1}{2}}e_\alpha\|^2\geq 0$, thus $\tr(u)=0$ implies $u^{\frac{1}{2}}e_\alpha=0\forall \alpha,$ hence $u^{\frac{1}{2}}=0$ and $u=0$.


text:
Q: Unknown setter '_date_time' Carbon / Laravel 4 I have my installation of laravel 4 under HHVM, and i set up as a accessory on my eloquent an converter date from SQL date to human.
doing something like that:
public function getDateSpanAttribute($value)
{
      return $value = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s',$this->created_at)->diffForHumans();
}

This method work well under php5, no error just work. On HHVM this accessory throw me an exception saying,

{"error":{"type":"InvalidArgumentException","message":"Unknown setter
  '_date_time'","file":"/var/www/mynextmatch/vendor/nesbot/carbon/src/Carbon/Carbon.php","line":542}}

I saw the source of Carbon on that row and it is the magic method __get() to give this problem but i cannot figure out why it happening.
I will appreciate same help. Thanks

A: Not sure about the error on HHVM but one thing is for sure that an accessor method doesn't contain any argument, it should be (Manual):
public function getDateSpanAttribute()
{
      return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $this->created_at)->diffForHumans();
}

You just need to return the property not setting anything, if you want to set anything then it would be a setter/mutator method which acepts a value as argument.

A: I am having the same issue but think mine is tied to creating a session creation after logging in (
InvalidArgumentException Unknown setter '_date_time'). Mine is installed on HHVM 3.1 running on Ubuntu 14.04. I have the same set up using Ubuntu 12.04 and am not having this issue.
10. InvalidArgumentException
…/vendor/nesbot/carbon/src/Carbon/Carbon.php542
9. Carbon\Carbon __set
<#unknown>0
8. DateTime __sleep
<#unknown>0
7. serialize
…/vendor/laravel/framework/src/Illuminate/Session/Store.php222
6. Illuminate\Session\Store save
…/vendor/laravel/framework/src/Illuminate/Session/Middleware.php126


text:
Q: Generating Pythagorean triples I'm asked to generate Pythagorean triples from the polynomial identity:
$$(X^2-1)^2 + (2X)^2=(X^2+1)^2$$
By substituting rational numbers $\frac p q$ for $X$. However, Pythagorean triples are just as the name says, it, three numbers. If I would substitute this number I get:
$$(\left(\frac p q\right)^2-1)^2 + 4\left(\frac p q\right)^2=(\left(\frac p q\right)^2+1)^2$$
How would I get three integers from this? There are just two numbers involved, $p$ and $q$.

A: It should be
$$(p^2-q^2)^2+(2pq)^2=(p^2+q^2)^2,$$
where $p$ and $q$ are natural numbers such that $p>q$, $\gcd(p,q)=1$ and $p$ and $q$ have different parity.
Now, you can get all triples: $(d(p^2-q^2),d(2pq),d(p^2+q^2)),$ where $d$ is a natural number.

A: I don't see why you want to substitute in rationals.  If you substitute in whole numbers for $X$ you get a Pythagorean triple $X^2-1,2X,X^2+1$.  That is three numbers just like you are looking for.  If you multiply your last by $q^2$ you clear the fractions and get the same triple based on $p$.

A: If we take the equation asis, it is not true unless $x=0$ or$X=1$.
$$(x-1)^2+2x=(x+1)^2$$
$$(x^2-2X+1)+4X^2=(x^2+2X+1)$$
Subracting $x^2+2x+1$ from both sides we get
$$4X^2-4X=0\Rightarrow4x(X-1)=0$$
A variation of the identity will work for all $n$ in generating triples where $C-A)=2.$
$$\mathbf{A=4n^2-1}$$
$$\mathbf{B=4n}$$
$$\mathbf{C=4n^2+1}$$


text:
Q: How can I download the DESCRIPTION for fields in an access-web-app? In Access-Web-Apps, there's three columns to define for each field in a table: the name, the field type and an optional description. I would like to download the "DESCRIPTION" component of each field for a given table.
In R, using the command sqlColumns() from the package RODBC, I am able to obtain the structure of my table. The fields that it returns are:
sqlColumns(channel,"XXX") %>% dplyr::names
 [1] "TABLE_CAT"                            "TABLE_SCHEM"                          "TABLE_NAME"
 [4] "COLUMN_NAME"                          "DATA_TYPE"                            "TYPE_NAME"
 [7] "COLUMN_SIZE"                          "BUFFER_LENGTH"                        "DECIMAL_DIGITS"
[10] "NUM_PREC_RADIX"                       "NULLABLE"                             "REMARKS"
[13] "COLUMN_DEF"                           "SQL_DATA_TYPE"                        "SQL_DATETIME_SUB"
[16] "CHAR_OCTET_LENGTH"                    "ORDINAL_POSITION"                     "IS_NULLABLE"
[19] "SS_IS_SPARSE"                         "SS_IS_COLUMN_SET"                     "SS_IS_COMPUTED"
[22] "SS_IS_IDENTITY"                       "SS_UDT_CATALOG_NAME"                  "SS_UDT_SCHEMA_NAME"
[25] "SS_UDT_ASSEMBLY_TYPE_NAME"            "SS_XML_SCHEMACOLLECTION_CATALOG_NAME" "SS_XML_SCHEMACOLLECTION_SCHEMA_NAME"
[28] "SS_XML_SCHEMACOLLECTION_NAME"         "SS_DATA_TYPE"

But the I see that there is a REMARKS column, but nothing else resembling a description. The Remarks column is empty... is there any way to capture this information? (Using RODBC in R or any other software package).
Edit: Showing screenshots
Here is proof that a table has descriptions, but nothing is coming through in R. (Sorry for terrible screenshot, don't want to show too much of my structure).


text:
Q: Multiple rest operators not allowed in parameter list? function unshift(array, ...int) {
  return [...int].concat(array);
}

function unshift(...array, ...int) {
  return [...int, ...array];
}

The first function is fine but not the second one, so there's no such thing as multiple rest argument in function?

A: Correct.  Using the Rest operator on any parameter but the last results in a SyntaxError.
And it makes sense...
The Rest operator on the parameter tells the compiler to grab all remaining arguments.  If the first parameter had a rest operator, it would grab all the arguments, after which any subsequent parameters would be undefined.
For this reason, the Rest parameter can only be on the last parameter in the argument list.
Example in usage
function foo(bar, ...baz) {
  console.log(bar);
  console.log(baz);
}

foo(1, 2, 3, 4);
// 1
// [2, 3, 4]

If in some bizarre world, the Rest parameter could be on the first of many parameters, then we'd have something like this
// NOT VALID JS
function foo(...bar, baz) {
  console.log(bar);
  console.log(baz);
}

foo(1, 2, 3, 4);
// [1, 2, 3, 4]
// undefined

And what use would that be...?

A: Rest parameter must be last formal parameter
error:
function f(a, ...b, c) {
 // ...
}

right:
function f(a, b, ...c) {
 // ...
}


text:
Q: Could not open lock file /var/lib/dpkg/lock-frontend - open (2: No such file or directory) I am trying to run sudo apt-get upgrade but it is showing the below error message:
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (2: No such file or directory)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

Here are the solutions I have tried :

*

*I have tried, "sudo apt-get update"

*I have also tried to delete the locked files using the commands:
sudo rm -r /var/lib/dpkg/lock-frontend
sudo rm -rf /var/lib/dpkg/lock

but it is showing the error that "no so such file or directory".

*I tried to kill all the running process using the command:
ps aux | grep -i apt
sudo kill -9 <process id>
sudo killall apt apt-get

How can I solve this issue?

A: You most likely have another process that is using the package manager.
Close any other terminal instances and any GUI package managers. If you are not sure which process/program currently has those privileges, a reboot should fix the problem.

A: The right solution is pasted below, run the below commands and it should fix the problem.
sudo mkdir -p /var/lib/dpkg/{alternatives,info,parts,triggers,updates}

sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status

apt-get download dpkg

sudo dpkg -i dpkg*.deb

apt-get download base-files

sudo dpkg -i base-files*.deb

sudo apt-get update

sudo apt-get check


text:
Q: Js code skips first line after click event As per my following code "Processing" is not appending first instead it directly append "Saving". I tried solve this but not getting whats wrong in my code that it is not working and skipping first "Processing" line.
    $('#ac_submit,#save_as_draft').click(function (e) {

        $('#save_as_draft').append(' Processing');
        $('form').find('.invalid_field').removeClass('invalid_field');
        var  validation_status = 0;
        $('#mandate_field').empty();
        $('input,textarea,select').filter('[required]').each(function(){
            if($(this).filter('[required]').val() == ''){
//                console.log($(this).filter('[required]').attr('name'));
               $(this).closest('.form-group').addClass(' has-error has-danger');
               $('#ac_submit').removeClass('disabled');
               $('#save_as_draft').removeClass('disabled');
               if($(this).closest('.hide_devices').hasClass('show_panel') == true){
                   $('#panel').addClass('invalid_field');
                   var matched_li = $(this).closest('div[id^="tab_"]').attr('id');
                   $('li a[href="#'+matched_li+'"]').addClass('invalid_field');
               } else {
                   var divId = $(this).closest('.hide_devices').attr('id');
                   $('li a[div-id="'+divId+'"]').addClass('invalid_field')
                   var action_on_li = divId.replace(/\d+/g, '')
                   if(action_on_li == 'cloneModBusInput'){
                       $('#mod__bus').addClass('invalid_field')
                   }
                   if(action_on_li == 'cloneSensorInput'){
                       $('#sen__sor').addClass('invalid_field')
                   }
                   if(action_on_li == 'clonedRelayInput'){
                       $('#re__lay').addClass('invalid_field')
                   }
               }
               $('#mandate_field').empty().html('* Mandatory fields are missing');
               validation_status = 1;
                $(this).addClass('disabled');
                $(this).html(' '+$(this).text()+'');
               e.preventDefault();
            }
        });
        if(validation_status == 0){
            $('#mandate_field').empty();
            $(this).addClass('disabled');
            $(this).html(' Saving');
        } else {
            $(this).addClass('disabled');
            $(this).html(' '+$(this).text()+'');
        }
    });

please help me identify whats wrong in the above code.

A: Your code runs synchronously. What you do is append an element to a container, and several lines down replace the entire html content of the same element with new content. The result is what you describe to be getting.
If you want to see the previous content for half a second do the following:
var self = this;

setTimeout(function () {
    if (validation_status == 0) {
        $('#mandate_field').empty();
        $(self).addClass('disabled');
        $(self).html(' Saving');
    }
}, 500);

A: That's because you override your "Processing":
$('#save_as_draft').append(' Processing');

Here:
 $(this).html(' Saving');


text:
Q: Android SMS Provider I use this code to insert a new message into the sms provider:
ContentValues values = new ContentValues();
values.put("address", phoneNumber);
values.put("date", timer);
values.put("body", testo);
values.put("type", inbox);
values.put("read", read);
context.getContentResolver().insert(Uri.parse("content://sms"), values);

This works correctly when timer is greater than System.currentTimeMillis(), but when timer is less than System.currentTimeMillis(), I am finding an error. This image helps me to illustrate it:

The second message (New) came at the right time, but not the first (Old): It had to be at 8.02 and instead is at 10.04, which is the current time.
If I click on one of them and consult their details known, however, that they are correct. The second image helps me to explain.

How can I solve this problem? This appends both on android 2.3.x and on android 4.4.x.
Thank you to all.


text:
Q: JSONP Callback not working for Beats Music API I'm trying to use the API via JSONP - making a request like:
https://partner.api.beatsmusic.com/v1/api/search/federated?callback=beatsCallback&q=cats&client_id=XXXXX
But the response just comes back as pure json - not wrapped in a callback.  Are callbacks supported?

A: Beats Music supports CORS which allows javascript on a page to make requests to another domain, not the domain it originated from. Thus, you do not need to use JSONP and can access the json in a traditional manner.


text:
Q: How to allow user to codelessly mass-approve workflow items From the Workflow Tasks page, is there any way to allow a user to approve/reject an item without going into the item itself?  Preferably a way to do it without custom code.

A: Approval or rejection of items or files in lists or libraries must be done one at a time. You cannot approve or reject multiple items or files in one operation. There is no out of the box feature available for multiple approval.
There are multiple free 3rd party tools available for this. You just have to deploy the Wsp to your SharePoint environment.
https://approvemultipleitems.codeplex.com/
http://www.sharepointing2010.com/2013/11/approve-reject-multiple-task-items-at.html
http://ranaictiu-technicalblog.blogspot.in/2011/05/sharepoint-2010-approvereject-multiple.html

A: Or this one. This uses the default Approve/Reject form and saves for all selected items.
https://p3bulkapproval.codeplex.com/


text:
Q: Certbot: cannot config nginx to webroot I loosing all my hair now.
I'm trying to setup Certbot (letsencrypt) to my server. But I can't even make the url http://myapp.com/.well-known/acme-challenge/myfile available with:
namei -om /var/www/certbot/.well-known/acme-challenge/myfile
f: /var/www/certbot/.well-known/acme-challenge/myfile
 drwxr-xr-x 1000 1000 /
 drwxr-xr-x root root var
 drwxr-xr-x root root www
 drwxr-xr-x root root certbot
 drwxr-xr-x root root .well-known
 drwxr-xr-x root root acme-challenge
 -rw-r--r-- root root myfile

and the following nginx config:
upstream myapp {
  server                localhost:3000;
}

server {
  listen                80;
  server_name           myapp.com;

  location /.well-known/acme-challenge {
    default_type "text/plain";
    root /var/www/certbot;
  }

  location / {
    proxy_pass          http://myapp;
    proxy_read_timeout  90;
  }

}

But URL ain't available:
curl -I http://myapp.com/.well-known/acme-challenge/myfile
HTTP/1.1 404 Not Found
Server: nginx/1.6.2
Date: Tue, 31 May 2016 17:40:23 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 47
Connection: keep-alive
X-Powered-By: Express
X-Content-Type-Options: nosniff

What am I doing wrong ??? Please help me!

A: I think you should quote the location since it contains a dot. Like this:
location '/.well-known/acme-challenge/' {
   # ...
}

I'm not entirely sure about it but I've seen other people do this and it seems to work for me.

A: I finally found the solution:
The nginx config sites were in /etc/nginx/sites-available but not in /etc/nginx/sites-enabled.
I did create a link from the former to the later, but it was not a symlink (missing the -s option in ln /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled).
I still don't understand the use case of a link not symbolic but in my case that was the problem.


text:
Q: Endless-pagination stuck on show_more So I'm trying to implement Twitter-style pagination with ajax on my project, but it stucks when I click on show_more. It just changes to label "loading" and doesn't show any new entries.
views.py
def view_dates(request, check, template = 'dates.html',page_template = 'dates_table.html'):
    check = Check.objects.get(id = check)
    dates = Date.objects.filter(check_id = check).order_by('-date').select_related('check').annotate(status = Min('result__status'))
    context = {
    'dates': dates,
    'check': check,
    'page_template': page_template}
    if request.is_ajax():
        template = page_template
    return render_to_response(template, context, context_instance=RequestContext(request))

dates.html
{% paginate 16 dates %}

            Date
            Status

    {% include page_template %}

{% show_more %}

{% block js %}
  {{ block.super }}

{% endblock %}

page_template - dates_table.html
{% load date_extras %}
{% block table %}
        {% for date in dates %}

                    <button type="button" class="btn btn-link" onclick="location.href='/checks/{{ date.check_id }}/{{ date.id }}/results/'">
                        {{ date.date|format }}
                    </button>

                    {% if date.status == True %}

                        {% else %}

                    {% endif %}

        {% endfor %}

{% endblock %}

What is supposed to be the problem?

A: You should put show_more button in the page_template, not in the index template...


text:
Q: Java: How to run this code only once at this specified time? I'm trying to run a method once a week. For example, every Monday 8pm. I use this code:
    Timer timer = new Timer();

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
    calendar.set(Calendar.HOUR_OF_DAY, 20);
    calendar.set(Calendar.MINUTE, 00);
    calendar.set(Calendar.SECOND, 00);
    Date time = calendar.getTime();

    timer.schedule(new PrintTask(),
            time);

    // other code where variable gets increased

public class PrintTask extends TimerTask {
    public void run() {

          variable = 0;
    }
}

However, if I am right, the dosomething code is run continuously - as long as the calendar time has already passed. For example, now it has already been Monday, so the dosomething code is run all the time. A variabele gets increased, but it must be reset to 0 on Monday. The variable is now constantly 0, because it is reset again and again. If I use calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);, the variable is not reset, because it has not been Sunday yet. But as soon as it is Sunday 8pm, he will probably continue to reset the rest of that day.
I want the dosomething code to be executed only once at the one time specified. Can someone tell me how to adjust the code to achieve this?
Sorry for my English

A: Please look at this question here(How i can run my TimerTask everyday 2 PM).  It almost deals with same kind of problem.
Cancel the timer using the cancel api of Timer class, and reschedule the timer inside the run() method; this should prevent from updating the variable everytime.

A: The Timer class can be used to schedule things to run once, or multiple times. The way you are scheduling it at this moment will only make it once at the given time.
https://docs.oracle.com/javase/7/docs/api/java/util/Timer.html#schedule(java.util.TimerTask,%20java.util.Date)
There are better options if you want to schedule tasks, for example the ScheduledExecutorService:
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html
According to Java Concurrency in Practice:

*

*Timer can be sensitive to changes in the system clock, ScheduledThreadPoolExecutor isn't.

*Timer has only one execution thread, so long-running task can delay other tasks. ScheduledThreadPoolExecutor can be configured with
  any number of threads. Furthermore, you have full control over created
  threads, if you want (by providing ThreadFactory).

*Runtime exceptions thrown in TimerTask kill that one thread, thus making Timer dead :-( ... i.e. scheduled tasks will not run anymore.
  ScheduledThreadExecutor not only catches runtime exceptions, but it
  lets you handle them if you want (by overriding afterExecute method
  from ThreadPoolExecutor). Task which threw exception will be canceled,
  but other tasks will continue to run.

http://jcip.net/


text:
Q: Binding NSAttributedString and NSTextView I am trying to follow an example from a book where there is an NSTextView in the interface that should be bound to an NSAttributedString in the controller class. I have the string in an attribute called text and I bind the text view to the File Owner's self.text. As far as I can see, that is what the book tells me to do.

I get an error, though:
class Notes.Document
2019-05-29 11:49:02.433383+0200 Notes[3568:27704580] Cannot create attributed string from object <Notes.Document: 0x600002c30100> of class Notes.Document

I am completely clueless about what is happening. I would read this as the binding trying to convert the Document object (so self) to an attributed string, but I don't see how it would get that idea.


text:
Q: java serialize a custom linked list I didn't want to use the provided LinkedList Class so I made up a custom linked list. the problem is that i am worried of stack overflow problems that may occur when I serialize this object with the default read/write object fucntions
I saw from another SO post that you have to use custom serialization like below :
MyClass{

    transient Node header;

    private void writeObject(ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        for (Entry e = header.next; e != header; e = e.next)
        out.writeObject(e.element);
    }
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
    }

}

this is the node class
Node{
    transient Node next;
    transient Node prev;
    private void writeObject(ObjectOutputStream out) throws IOException {
        out.defaultWriteObject();
        for (Entry e = header.next; e != header; e = e.next)
        out.writeObject(e.element);
    }
    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();
    }

}

How ever I am wondering, because I made the header field transient, when i read the class wouldn't it be null? how do I make it refer to the header node...
same for the nodes , since next and prev fields are transient when I read the object the fields would be null how do I make them maintain the references to each other

A: Yes, you are right, they will be null.
You have to implement readObject in similar fashion you implemented write object:
while(elementsToRead()); // you need to know somehow how long you need to read
{
    add(inputStream.readObject());
}

I would suggest looking into implementations of read and write objects for lists in Java library.
Why you cannot use Java linked list? If something is missing, has you considered extending linkedLlist?
You can basically look into Linked List source code and see how the serialization is performed.


text:
Q: How to sort data in decreasing order of cgpa in structure with dynamic memory allocation? Structure and DMA. I want to retrieve all the inserted record in decreasing order of cgpa.
Without sorting it give the result as shown below image.

#include<iostream>
#include<string>
using namespace std;

struct student {
    string name;
    int age;
    float cgpa;
};
void main()
{
    student *ptr;
    int size;
    cout << "enter size \n";
    cin >> size;
    ptr = new student[size];
    for (int i = 0; i < size; i++)
    {
        cout << "enter student " << i + 1 << " name\n";
        cin >> ptr[i].name;
        cout << "enter student " << i + 1 << " age\n";
        cin >> ptr[i].age;
        cout << "enter student " << i + 1 << " cgpa\n";
        cin >> ptr[i].cgpa;
    }
    cout << "with out sorting \n";
    for (int i = 0; i < size; i++)
    {
        cout << " NAME\tAGE\tCGPA\n";
        cout << ptr[i].name << "\t" << ptr[i].age << "\t" << ptr[i].cgpa << endl;
    }
    system("pause");
}

  [1]: https://i.stack.imgur.com/whP8d.png

A: "Without sorting" is a bit unclear, but I take that to mean you cannot call std::sort directly or use another explicit sorting routine. That leaves you with choosing a container that stores object in sort order based on a compare function (or overload) you provide. Looking at the Microsoft C++ language conformance table for VS2015, it shows all core language features for C++11 supported -- which would include std::set.
std::set allows you to store a sorted set of unique objects. This means you can take input and store the results in a std::set based a Compare function you provide. Providing a Compare function that will compare the cgpa of each student will then automatically store your student objects based cgpa.
To make std::set available, you simply need to #include<set>. Writing the compare function that can be used to store students based on cgpa simply requires providing an overload for the < operator that takes two of your student objects as arguments and then returns true when the first argument sorts before the second, false otherwise. That can be as simple as:
/* overload of < comparing student by cgpa */
bool operator <(const student& a, const student& b) {
    return a.cgpa < b.cgpa;
}

A note: unless you are compiling for a micro-controller or embedded system with no Operating System (called a freestanding environment), void main() is wrong. A standard conforming invocation of main() is either int main(void) or int main (int argc, char **argv) where argc is the argument count and argv your argument vector (technically an array of pointers to null-terminated strings where the next pointer after the last argument is set to NULL as a sentinel) There are other non-standard extensions added by some compilers like char **envp providing a pointer to each of the environment variables.
To declare your set of student you need to provide the type student and the compare function to be used when inserting students into your set. Since you provide an overload for the less-than operator, you can use std::less<> providing one template argument, e.g.
int main(void)
{
    /* create std::set of students using std::less for compare */
    std::set<student, std::less<const student&>> students {};

And since you are using a container that provides automatic memory management for you, there is no need to know the size (or number of students to enter) before hand. You can simply enter as many students as you need and then press Ctrl+d on Linux or Ctrl+z on Windows to generate a manual EOF signifying your end of input. However you do need to validate every user input by checking the return (stream state) following each input. At minimum you can use:
        std::cout << "enter student " << i + 1 << " name\n";
        if (!(std::cin >> s.name))  /*  validate all input, ctrl + z to end input */
            break;

(note: the variable i is only needed to show the student number when you prompt for input, all containers provides the .size() member function that tell you how many objects are contained within.)
When done taking input, you can use a Range-based for loop to iterate over each student in your set outputting the desired information. For example:
    std::cout << "\nwith out sorting \n";
    for (auto& s : students) {      /* output in order of cgpa w/o sorting */
        std::cout << " NAME\tAGE\tCGPA\n"
                    << s.name << "\t" << s.age << "\t" << s.cgpa << '\n';
    }

Putting it altogether, you could do:
#include <iostream>
#include <string>
#include <set>

struct student {            /* struct student */
    std::string name;
    int age;
    float cgpa;
};

/* overload of < comparing student by cgpa */
bool operator <(const student& a, const student& b) {
    return a.cgpa < b.cgpa;
}

int main(void)
{
    /* create std::set of students using std::less for compare */
    std::set<student, std::less<const student&>> students {};

    for (int i = 0; ; i++) {
        student s {};       /* temporary struct to add to set */
        std::cout << "enter student " << i + 1 << " name\n";
        if (!(std::cin >> s.name))  /*  validate all input, ctrl + z to end input */
            break;
        std::cout << "enter student " << i + 1 << " age\n";
        if (!(std::cin >> s.age))
            break;
        std::cout << "enter student " << i + 1 << " cgpa\n";
        if (!(std::cin >> s.cgpa))
            break;
        students.insert(s); /* insert student in set */
    }
    std::cout << "\nwith out sorting \n";
    for (auto& s : students) {      /* output in order of cgpa w/o sorting */
        std::cout << " NAME\tAGE\tCGPA\n"
                    << s.name << "\t" << s.age << "\t" << s.cgpa << '\n';
    }
}

(note: Look at Why is "using namespace std;" considered bad practice?. Developing good habits early is a lot easier that trying to break bad ones later...)
(note 2: you might consider using getline(std::cin, s.name) to take input for the student name so you can handle names with spaces, like Firstname Lastname, e.g. Mickey Mouse, up to you)
Add system("pause"); back in to hold your terminal window open as needed.
Example Use/Output
Now just enter the student data for as many students as you like and then terminate input by generating a manual EOF as described above, e.g.
$ ./bin/set_student_grades
enter student 1 name
gates
enter student 1 age
20
enter student 1 cgpa
2.12
enter student 2 name
della
enter student 2 age
21
enter student 2 cgpa
2.00
enter student 3 name
jim
enter student 3 age
30
enter student 3 cgpa
3.12
enter student 4 name

with out sorting
 NAME   AGE     CGPA
della   21      2
 NAME   AGE     CGPA
gates   20      2.12
 NAME   AGE     CGPA
jim     30      3.12

This provides a way to store and provide the student data in order of cgpa without an explicit sort. Of course std::set does that for you, but if avoiding an explicit sort was the intent of your program, this is very good option. Let me know if you have further questions.

A: #include<iostream>
#include<string>
using namespace std;
struct student {
    string name;
    int age;
    float cgpa;
};
void main() {
    student *ptr;
    int size;
    cout << "enter size \n"; cin >> size;
    ptr = new student[size];
    for (int i = 0; i < size; i++)
    {
        cout << "enter student " << i + 1 << " name\n";
        cin >> ptr[i].name;
        cout << "enter student " << i + 1 << " age\n";
        cin >> ptr[i].age;
        cout << "enter student " << i + 1 << " cgpa\n";
        cin >> ptr[i].cgpa;
    }
    string temp1; int temp2;    float temp3;
    for (int i = 0; i < size; i++)
    {
        for (int j = 0; j < size; j++)
        {
            if (ptr[i].cgpa < ptr[j].cgpa)
            {
                temp1 = ptr[j].name;
                ptr[j].name = ptr[i].name;
                ptr[i].name = temp1;

                temp2 = ptr[j].age;
                ptr[j].age = ptr[i].age;
                ptr[i].age = temp2;

                temp3 = ptr[j].cgpa;
                ptr[j].cgpa = ptr[i].cgpa;
                ptr[i].cgpa = temp3;
            }
        }
    }
    for (int i = 0; i < size; i++) {
        cout << " NAME\tAGE\tCGPA\n";
        cout << ptr[i].name << "\t" << ptr[i].age << "\t" << ptr[i].cgpa << endl;
    }

    delete[] ptr;
    system("pause");
}


text:
Q: Symfony : how to get all user posts related with oneToMany relation I have two entity User and Booking which are related with oneToMany relationship, when a user ake a booking the user id is saved in the user_id column table of booking, I want in my controller to retrieve all the user's booking !
/**
 * @ORM\ManyToOne(targetEntity=User::class, inversedBy="bookings")
 * @JoinColumn(name="user_id", referencedColumnName="id")
 */
private $user;

    public function setUser(?User $user): self
    {
        $this->user = $user;

        return $this;
    }

/**
     * @ORM\OneToMany(targetEntity=Booking::class, mappedBy="user")
     */
    private $bookings;

/**
     * @return Collection|Booking[]
     */
    public function getBookings(): Collection
    {
        return $this->bookings;
    }

    public function addBooking(Booking $booking): self
    {
        if (!$this->bookings->contains($booking)) {
            $this->bookings[] = $booking;
            $booking->setUser($this);
        }

        return $this;
    }

/**
     * @Route("/user/profile/my-bookings", name="user.profile.bookings")
     */

    public function getUserBookings(){
        $user = $this->getUser()->getBookings();

        return $this->render('user/user.bookings.html.twig', [
            'user'=>$user
        ]);
    }

when trying to get the connected user and call getBookings() method it doesn't return any thing !
here what does $this->getUser return :

A: You can print it from twig by using
{% for booking in user.bookings %}
    {{booking}}
{% endfor %}

Or retrieve it into your controller with PHP:
foreach($user->getBookings() as $booking){
    echo $booking->getYourField();
}

A: I found the solution, I just forgot to add fetch EAGER to the OneToMany relationship  between User and Booking !


text:
Q: What function executes in VBA when changing a calendar event I have VBA code in Outlook that adds a calendar event in a google calendar when the event is added in Outlook.  The code is also able to delete an event in a google calendar when the event is deleted from Outlook.
I have this code at the top of the VBA code:
Dim WithEvents curCal As Items
Dim WithEvents DeletedItems As Items
Dim newCalFolder As Outlook.Folder

The private sub that adds an event looks like this:
Private Sub curCal_ItemAdd(ByVal Item As Object)
    Dim cAppt As AppointmentItem
    Dim moveCal As AppointmentItem
    ....
    Item.Save
End Sub

The code that deletes an event looks like this:
Private Sub DeletedItems_ItemAdd(ByVal Item As Object)
    ' only apply to appointments
    If Item.MessageClass <> "IPM.Appointment" Then Exit Sub
    ' if using a category on copied items, this may speed it up.
    If Item.Categories = "moved" Then Exit Sub
    ...
End Sub

Both of these functions work as expected.
Now I need to code a sub that will execute when the event is modified so I can send the modifications to google.
I assume I need to create Private Sub curCal_xxxxxxxxxxxxxxx(ByVal Item As Object) but I dont know what the xxxxxxxxxxxxxxx would be.
Anybody know what the sub name should be where I can place code that will execute after an Outlook calendar event has been changed?

A: You may consider using the ItemChange event which is fired when an item in the specified collection is changed:
Private Sub myOlItems_ItemChange(ByVal Item As Object)
 Dim prompt As String
 If VBA.Format(Item.Start, "h") >= "17" And Item.Sensitivity <> olPrivate Then
   prompt = "Appointment occurs after hours. Mark it private?"
   If MsgBox(prompt, vbYesNo + vbQuestion) = vbYes Then
     Item.Sensitivity = olPrivate
     Item.Display
   End If
 End If
End Sub

But there is no information what exactly has been changed, only the item changed is passed as a parameter.
For that reason you may consider handling the AppointmentItem.PropertyChange event which is fired when an explicit built-in property (for example, Subject) of an instance of the parent object is changed. In that case the name of the property that was changed is passed as a parameter.
Also you may find the MailItem.Write event helpful. It is fired when an object is saved, either explicitly (for example, using the Save or SaveAs methods) or implicitly (for example, in response to a prompt when closing the item's inspector).
Public WithEvents myItem As Outlook.MailItem

Private Sub myItem_Write(Cancel As Boolean)
 Dim myResult As Integer
 myItem = "The item is about to be saved. Do you wish to overwrite the existing item?"
 myResult = MsgBox(myItem, vbYesNo, "Save")
 If myResult = vbNo Then
   Cancel = True
 End If
End Sub

Public Sub Initialize_Handler()
 Const strCancelEvent = "Application-defined or object-defined error"

 On Error GoTo ErrHandler

   Set myItem = Application.ActiveInspector.CurrentItem
   myItem.Save
 Exit Sub

 ErrHandler:
   MsgBox Err.Description
 If Err.Description = strCancelEvent Then
   MsgBox "The event was cancelled."
 End If
End Sub


text:
Q: How can I clear a numeric editText in Android? On my Android App there is a EditText which is supposed to keep numeric values; that's why I defined it as
    <EditText android:layout_width="fill_parent" android:id="@+id/TextNumb"
android:layout_height="wrap_content" android:gravity="right|center" android:maxLines="1"
 android:maxLength="10" android:inputType="number|numberSigned|numberDecimal"/>

But at a certain point of my App I want to clear it, so in my Activity I call this EditText View and I write:
mEditView.setText("");

But I get a run-time error...how could I fix it? Is there a way to clean it?

A: You shan't get runtime error calling mEditView.setText("");. If you do, then you do something wrong outside this expression, and we need your code to tell what specifically. My guess would be  not initialized mEditView (NullPointerException) or calling setText on different thread than UI (java.lang.RuntimeException).

A: Have you tried setting it to null?
mEditView.setText(null);


text:
Q: Update the clipboard data before paste (not the 'paste' event) I have a requirement where a text copied onto the clipboard, has to be transformed into some other text before it gets pasted. E.g on button click I do a clipboard copy programmatically and some text like "Before Change" gets copied onto the clipboard. The paste event which I have tied to my editor cannot change the clipboard data and its always the data existing on the clipboard ("Before Change") that gets copied.
$("#Editor1").on("paste", createIncludedScriptPath);
function createIncludedScriptPath(e) {
    var pastedData = e.originalEvent.clipboardData.getData('text');
    var path = createPath(pastedData);
    textToCopy = "." + " " + "'" + path + "'";
    copyTextToClipboard(textToCopy);
}

Here, in the above code, I am trying to get the existing clipboard data, change it and copy the changed data on the clipboard. However, it is always the old data i.e. (in the pastedData variable) which gets pasted.
I learnt, that in the clipboard paste API, you cannot reset the clipboard.
How do I update the clipboard data, so that the updated data gets eventually pasted?

A: You could set the editor content directly and call e.preventDefault();
I think updating the clipboard data will not work.


text:
Q: Random passcode generator in python error I am attempting a random passcode generator, however we may only use certain special symbols, which I listed, but the code keeps non running into an error that I am unsure how to go about solving; TypeError: can only concatenate str (not "list") to str         .
This is the part of code that I am working on.
while True:
    import string

    a  = ["!", "$", "%", "^", "&", "*", "(", ")", "-", "_", "=", "+"]
    from random import *
    characters = string.ascii_letters + a + string.digits
    passcode =  "".join(choice(characters) for x in range(randint(8, 12)))
    print (passcode)

A: You should change a to be a str:
import string
import random

a  = "!$%^&*()-_=+"
characters = string.ascii_letters + a + string.digits
passcode =  "".join(random.choice(characters) for x in range(random.randint(8, 12)))
print(passcode)

Also, it is bad practice to import the entire random namespace using from random import *.
When your code is working, you should post on code review to get some tips and improvements.

A: You are concatenating  your list to your string. You need to make the following changes and it should work.
a  = "!$%^&*()-_=+"

A: You need to create a string using list a, "".join(a). and it will be better if you declare your list a outside the loop.
import string
import random
a  = ["!", "$", "%", "^", "&", "*", "(", ")", "-", "_", "=", "+"]

while True:

    characters = string.ascii_letters + "".join(a)  + string.digits

    passcode =  "".join(choice(characters) for x in range(randint(8, 12)))
    print (passcode)

A: Check types:
import string
a  = ["!", "$", "%", "^", "&", "*", "(", ")", "-", "_", "=", "+"]
print(type(string.ascii_letters))  # <class 'str'>
print(type(a))  # <class 'list'>
print(type(string.digits))  # <class 'str'>

You need to either convert all lists to str or all strs to list before concatenation that is you should do:
characters = string.ascii_letters + "".join(a) + string.digits

or
characters = list(string.ascii_letters) + a + list(string.digits)

in first case you get characters as str, in second as list - both are accepted by random.choice. As side note: do not import inside loop, it is enough to import once.


text:
Q: displaying information in a different HTML page from js We are working with the facebook api and have stored the data retrieved in a JSON format into an array. We would like to display this information in a different HTML page but are unable to do so, please help regarding this?

A: I am still a little confused by your question, but I am assuming that you want to know how to display the elements from an array onto your HTML page.
If this isn't what you are asking, then just expand on your question and I will see how I can help.
Explanation for code below

*

*You are accessing your JavaScript file in your HTML by adding the  reference.

*The JavaScript is creating a simple array called myArray. We then loop through our array and display content using the document.write(...); line.
HTML
<!DOCTYPE html>

JavaScript
var myArray = [1, 2, 3];

// for each loop
for (var i in myArray) {
  document.write(myArray[i]);
}


text:
Q: Does taking a log backup, truncating the log, and then deleting the tlog backup break the LSN chain? We have avamar tool taking backups in my environment. The backup plan avamar does is only taking trans backups once a day. I am convincing them to take the trans backup more frequent. But in the meanwhile, I have to deal with large log sizes because of this infrequent trans backups. Hence to reduce the log sizes, I am taking a quick trans backup followed by a truncate log size. Now I want to know if doing that breaks the log chain for avamar and it forces it to take full back up instead. Remember, I am deleting the trans backup file immediately after I truncate the log sizes. Does the fact that I deleted the trans backup file breaks the log chain for Avamar? Any input is appreciated.

A: If the avamar tool uses its own tracking method to know what log backup files it can restore, then it will fail.
If it uses SQL internal tables to know what log backup it needs, that is good, but if the file has been deleted, then it will fail.
Either way it will fail since you are deleting the files...so don't :)

A: Reading your question makes me wonder if you've actually attempted to restore these databases as proof of your backup strategy (either by naming the databases something different on the current server or restoring them to another server). You say Avamar handles the whole backup and recovery and yet, you're doing things (deleting transaction log backups) behind its back.  You also say that Avamar only takes transaction log backups once per day.  By deleting the transaction log backup file, you just made it impossible to recover to any point after that (unless you are taking additional FULL or DIFF backups).  When was the last time a FULL or DIFF backup was taken?  Even if you weren't deleting the transaction log backups you're taking, it would take you a VERY long time to restore your latest FULL backup (assuming you still have it) and DIFF and ALL of the transaction logs to get you close to where you want to be in a recovery situation.
The absolute FIRST thing you need to do is identify your Recovery Point Objective (RPO) and Recovery Time Objective (RTO).
RPO basically is, how much data could we 'possibly' lose should a bad problem happen? 5 minutes, 1 hour, 1 day, NONE?
RTO basically is the maximum time allowed to get things back to 'normal' or at least functioning. You would need to take into consideration small problems (server went down) to big problems (the building just exploded).
Since you are basically throwing away the transaction log backups you're taking, you are obviously not interested in being able to restore to a given point in time.  If that is the case, you should just change your recovery model to SIMPLE and then you won't need to worry about taking your transaction log backups.  Just bear in mind that under SIMPLE recovery, you will only be able to recover back to the last FULL or FULL/DIFF.
Check out The 9 Letters That Get DBAs Fired.
RPO, RTO and CYA

Right now, all of your users believe your RPO and RTO is zero.  They
  believe you've got everything under control, and that when disaster
  strikes, you're going to instantly bring up another server with no
  data loss whatsoever.

A:
I am taking a quick trans backup followed by a truncate log size.

I believe you want to say taking transaction log backup and shrinking ?, If not in full recovery model transaction log backup would truncate transaction logs subject to few restrictions. And please stop shrinking log file daily this is big performance killer. And shrinking transaction logs DO NOT break the log chain so you are safe.

Remember, I am deleting the trans backup file immediately after I truncate the log sizes.

Other blunder you are doing is deleting the files after backup, how are you going to recover database if disaster strikes. Please stop that as well. Please define proper RPO and RTO and make a backup retention policy after which you may delete the files which exceeds the retention date.
And NO taking log backup and deleting the files do not break log chain but you actually lost the ability to do point in time recovery as files which stored backup is deleted
Further to our conversation you asked whether taking manual backup would break the log chain and answer it yes. Even though you take and delete the files the changes are done to the LSN when you take manual backup.

A:
Does the fact that I deleted the trans backup file breaks the log
  chain for Avamar?

This script will query msdb.dbo.backupset and create a set of restore commands.
If you delete any of the transaction log files listed in the restore commands, then the backup chain is broken.
/* Generate the script for restoring a database and the transaction logs */

DECLARE @databaseName sysname
DECLARE @backupStartDate datetime
DECLARE @backup_set_id_start INT
DECLARE @backup_set_id_end INT

-- set database to be used
SET @databaseName = 'YourDatabaseNameHere'

SELECT @backup_set_id_start = MAX(backup_set_id)
FROM msdb.dbo.backupset
WHERE database_name = @databaseName AND type = 'D'

IF @backup_set_id_end IS NULL SET @backup_set_id_end = 999999999

-- Last Full and any Differentials
SELECT backup_set_id, 'RESTORE DATABASE ' + @databaseName + ' FROM DISK = '''
+ mf.physical_device_name + ''' WITH NORECOVERY'
FROM msdb.dbo.backupset b
INNER JOIN msdb.dbo.backupmediafamily mf
ON b.media_set_id = mf.media_set_id
WHERE B.type IN ('D', 'I')
AND b.database_name = @databaseName
AND b.backup_set_id >= @backup_set_id_start AND b.backup_set_id < @backup_set_id_end
UNION
-- Log Backups
SELECT backup_set_id, 'RESTORE LOG ' + @databaseName + ' FROM DISK = '''
+ mf.physical_device_name + ''' WITH NORECOVERY'
FROM msdb.dbo.backupset b
INNER JOIN msdb.dbo.backupmediafamily mf
ON b.media_set_id = mf.media_set_id
WHERE b.database_name = @databaseName
AND b.backup_set_id >= @backup_set_id_start AND b.backup_set_id < @backup_set_id_end
AND b.type = 'L'
UNION
SELECT 999999999 AS backup_set_id, '--RESTORE DATABASE ' + @databaseName + ' WITH RECOVERY'
ORDER BY backup_set_id

Replace 'YourDatabaseNameHere' with the name of your database.
For those databases that use the FULL recovery model it is suggested to take frequent LOG backups. I generally use 5-15 minute increments for LOG backups depending on how busy the database is.
Here is a TechNet Article on it: Working with Transaction Log Backups

A: (Update: My answer below only applies if Avamar uses SQL Server's backup mechanisms. SQL_Underworld's comment on your question led me to look a little at it, and it appears it may use a completely separate mechanism for differential backups [likely not log, and almost certainly not daily full].
So it's actually a possibility that Avamar will do it's job even if you set your database to Simple recovery model, which would solve your log growth issues. But you would need to confirm with Avamar that their software doesn't rely on a specific recovery model.
Or if you can't get confirmation on that, you can probably at least get confirmation as to whether or not it needs the log in order to take backups. If not, then you can take log backups as often as you need in order free log space for reuse. But Shanky is correct in that you should not normally shrink the file after log backup, as that will just make your system work harder than needed for regrowing the file.)
Original answer:
What you're doing is certainly breaking the log chain, meaning that if you have to restore, you will lose all data changes since the last log backup Avamar took before the first manual log backup you took after the last full/differential backup Avamar took. (Sorry, can't think of a clearer way to describe it accurately.)
As for whether or not Avamar will detect a broken log chain in its storage location and take a full backup, that's something only they can answer with certainty.
But assuming Avamar uses standard full and log backup methods, the following query (from Get last full backup and transaction log backup for each database) can tell you when the last full/differential backup was taken.
;with backup_cte as
(
    select
        database_name,
        backup_type =
            case type
                when 'D' then 'database'
                when 'L' then 'log'
                when 'I' then 'differential'
                else 'other'
            end,
        backup_finish_date,
        rownum =
            row_number() over
            (
                partition by database_name, type
                order by backup_finish_date desc
            )
    from msdb.dbo.backupset
)
select
    database_name,
    backup_type,
    backup_finish_date
from backup_cte
where rownum = 1
order by database_name;


text:
Q: KeepAlive in Apache 2.4 interfering with form submissions I have just upgraded a server to Debian Jessie, which includes Apache 2.4.10 (was 2.2), and PHP 5.6.
Now, SSL sites won't submit forms in some circumstances on IE11 and iPad Safari (not sure about desktop Safari). Firefox and Chrome are both OK. When it fails it produces a IE error page "This page can't be displayed" in IE. Just to stress: I can get to the site and see the form, it's the form submission that then fails.
This is related to KeepAlive and SSL in some way. If I turn KeepAlive off in the SSL VirtualHost, the problem goes away. (It's using SNI, though one of the sites showing the error is the first SSL one). I am using mpm-itk (and was before the upgrade).
In IE11 (on Windows 7), it happens with
* SSL (HTTPS)
* Apache KeepAlive On, KeepAliveTimeout 5 (the default)
* forms with file uploads (so enctype=multipart/form-data),
* only when a file is actually supplied (it's OK with no file with or with other fields; even a 1 byte file causes it to fail, not file size dependent).
* only if the upload is started within 60 seconds of displaying the form (i.e. it's OK if you
leave it 60 seconds before pressing Submit)
There are no clues as to what has failed. There's nothing in the server logs to show it contacted the server again. The error is immediate. There is nothing in the IE debugger other than that it says "(Aborted)" in the result column of the network page and "Navigation occurred: File: dnserror.htm" which I assume is just the page it is displaying, but despite the name there is no dns error as far as I can tell. Fiddler shows no network traffic when I press the submit button. There is nothing relevant in the Windows event viewer. This is the strangest thing about it - it doesn't even seem to try.
For Apache 2.4, I've set up SSL as recommended here: https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=apache-2.4.10&openssl=1.0.1k&hsts=no&profile=intermediate . CiperSuite is unchanged from my 2.2 set up, but OCSP staping is now on. The main 2.4 change is TLS1.2 (but Fidler downgrades this I believe, so it's unlikely to be that). HSTS is turned on, but was previously. SSLLabs gives the site an A+ rating and does not indicate any errors.
I have tried changing KeepAliveTimeout to 60; and also putting back in the old
  BrowserMatch ".MSIE." nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
and
  BrowserMatch ".MSIE." ssl-unclean-shutdown
as an experiment, and I think this does have some effect, namely that it then works after the first attempt. But the first access from a newly started browser still fails. Possibly this is because it can't determine browser until after the SSL negotiation by which time it is too late, but after that the browser has more information? It's also possible I can't go through this process in under 60 seconds so the second time is OK because of that anyway.
I have made a little test site that demonstrates the problem: https://iet.davidearl.uk . It has a self-signed certificate just for the test case, so there's a certificate warning on first going there, but that's not the case with the real sites that have the problem. All the server side does in the test case is echo the file name of the submitted file, otherwise the HTML source is all there is.
On iPad, the problem seems worse, if anything. It seems not to be able to submit forms at all (while displaying them fine; irrespective of whether they have file uploads). Sometimes it just hangs, sometimes it has an internally generated error page ("Safari cannot open the page because the network connection was lost"), depending how the form is constructed. Again, though, the common factor is if you wait 60 seconds and then press the submit button, it works. An old version of Safari for PC (5.1.7) works OK though.
IE9 on (a different copy of) Windows 7 behaves like iPad Safari - it just hangs unless you wait 60 seconds after displaying the form. Microsoft Edge on Windows 10 and IE on Surface RT tablet also seem to fail in the same way as IE11. I have also observed one case where a PHP "file_get_contents("https..." accessing the server consistently hangs for exactly 60 seconds before suceeding, which worked instantly previously.
I have tried http : // superuser.com/questions/516030/apache-2-4-on-windows-responds-slowly-hangs-when-serving-some-dynamic-pages  - no change
This perhaps is related, but in their case KeepAlive Off had no effect; and turning off server firewall temporarily makes no difference: http : // serverfault.com/questions/678009/windows-8-ie-10-tls-handshake-errors-to-apache-2-2-on-centos-6-6
I have tried re-ordering the SSLCipherSuite to put ECDHE-RSA-AES128-SHA256 higher up the list (e.g. as suggested here: http : // serverfault.com/questions/677338/why-is-internet-explorer-11-unable-to-connect-to-https-sites-when-tls-1-2-is-ena )
Clear SSL State on Internet Properties > Content makes no difference.
There's clearly a problem related to KeepAlive and SSL, that isn't common, but I'm mystified as to what it is, and there's no clues to help me find out. Extensive searching hasn't yielded anything helpful.

A: I encountered exactly the same issue (spent quite a few days pulling my hair on this one!).
Turns out it is a bug in mpm-itk (cf. http://lists.err.no/pipermail/mpm-itk/2015-September/thread.html). This bug is now corrected in the latest version released yesterday.
You can download this new version at http://mpm-itk.sesse.net/, but you will have to compile it yourself from source. It is pretty straightforward if you follow the instructions in the README file.

A: Thank you for the Q! And to cividesk for the answer. I, too use ITK (not sure why more people don't - gives v useful separation of privileges between virtualhosts).
I did not want to recompile stuff to get this bug squished, preferring to trust that one day it will make it into Jessie and apt-get will magically fix it. But my clients can't wait until then!
I noticed that certain versions of jQuery caused it to happen more than others, under IE. So I fixed half my problem by dropping back on the jQuery version used. But Safari was still an issue - sometimes it would work sometimes silently fail.
The way I got this working was in the Apache config setenvif.conf file which I edited to include:
BrowserMatch "Mac OS X" nokeepalive

(credit due elsewhere for this idea)
This way keepalive is turned off for Mac users. While I don't doubt that this slows things down for them a bit, it's better than killing the UX/not working IMO.


text:
Q: pass javascript variable to ruby on rails controller to send in api further I am having a google api map as index.html
<!DOCTYPE html>

<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">

I want to use the var=pos in ruby on rails controller i.e products controller
require 'rubygems'

    require 'httparty'

    class ProductsController < ApplicationController

def index

    @results = HTTParty.get("https://api.uber.com          /v1/products?server_token=xyz&latitude=37.7759792&longitude=-122.41823").parsed_response

   respond_to do |format|
   format.json { render :json => JSON.parse(@results) }
   format.html { render "index.html.erb" }
   end
   end
   end

and then pass seperate latitude and longitude in the api url so that it can take any latitude and longitude instead of giving it manually.
How can I do it ? Any suggestion would be appreciated.

A: As @max said, you have to make another request to a controller. If you use jQuery and want to make an AJAX request, it can be done like so:
$.ajax({
  method: "GET",
  url: "products/some_action",
  data: { lat: pos.lat, lng: pos.lng }
})
.done(function( msg ) {
  alert( "Done" );
});

see http://api.jquery.com/jquery.ajax/
and in your ProductsController add:
def some_action
  # do something with params[:lat] and params[:lng]
end

A: solved the problem asked above by passing params in windows.open javascript function and fetching that params in products controller
index.html:
<!DOCTYPE html>

<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">

products controller:
require 'rubygems'

    require 'httparty'

    class ProductsController < ApplicationController

def index
    lat = params[:lat].to_s
    long = params[:long].to_s
    @results = HTTParty.get("https://api.uber.com/v1/products?server_token=your_server_token&latitude="+lat+"&longitude="+long).parsed_response

   respond_to do |format|
   format.json { render :json => JSON.parse(@results) }
   format.html { render "index.html.erb" }
   end
   end
   end


text:
Q: Official Arduino code: Web Client example doesn't work for me I am trying to implement the official Arduino Web Client code from examples
which is resided here: https://www.arduino.cc/en/Tutorial/WebClient ,
but unfortunately it doesn't work form me.
What am I supposed to do after uploading this sketch???
This is the only line that I changed to:
IPAddress ip(192, 168, 1, 178);

What I do is going to the url:
192.168.1.178 (in my local network, other sketches work fine in this ip) and if I well understood the function of this code, we request a particular page from google's server, so the server responses and bring to us this page, via the get request we make inside our code. Unfortunately, it doesn't load any page.
If I am wrong to anything of what I've said, please let me know.

A: Is your ethernet controller wired perfectly?

The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus. It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet. Later models of the Ethernet shield also have an SD Card on board. Digital pin 4 is used to control the slave select pin on the SD card.

For help, here is the schematic of the shield: Schematics
Watch your serial. Does it say this?

Failed to configure Ethernet using DHCP

Or does it say this?

connecting...

Does your router use 192.168.1 instead of 192.168.0 or 192.168.2?
Is there any other device who has the same IP address?
If nothing works, try to replace this piece of code
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
}

With this
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // try to congifure using IP address instead of DHCP:
    if(Ethernet.begin(mac, ip) == 0) {
        Serial.println("Failed to configure Ethernet using IP address.
        Circuit hanged.");
        while(1){}
    }
}

If this code sais:

Failed to configure Ethernet using IP address. Circuit hanged.

Of course, if you are using a WiFi shield, this example won't work. Try the wifi shield's example which is included in it's library.