text:
Q: A general rule for L'Hôpital's Rule In my text there are as many as $11$ theorems dealings with the different cases of L'Hôpital's Rule and due to the quantitative heaviness I often forget rules during problem session. Isn't there a general rule for L'Hôpital's Rule which is easy to remind so that I won't need to spend useless time recalling result?

A: A more general approach would be where
$$
\lim_{n\to \infty} \frac{f(x)}{g(x)} = \lim_{n\to \infty} \frac{\frac{d}{dx} f(x)}{\frac{d}{dx} g(x)}
$$
Or to 0 of course
$$
\lim_{n\to 0} \frac{f(x)}{g(x)} = \lim_{n\to 0} \frac{\frac{d}{dx} f(x)}{\frac{d}{dx} g(x)}
$$
Only when $\lim_{n\to \infty/0} f(x) = \lim_{n\to \infty/0} g(x)$ tend towards the same thing ($\infty_{+/-}, 0$)
A good example being
$$
\lim_{x->0} \frac{sin(x)}{x} = \lim_{x\to 0} \frac{cos(x)}{1} = 1
$$

A: I think of it as a sort of "algorithm". Let's say you want to calculate the limit of
$$\lim _{x \to \infty} \frac{f(x)}{g(x)}$$
If this limit tends to either $\frac{0}{0}$ or $\pm\frac{\infty}{\infty}$, then we apply the rule and differentiate $f$ and $g$ on their own. By this, I mean you don't use the quotient rule, but you just do $\frac{f'(x)}{g'(x)}$. Now, you calculate the limit of this. Again, if you get the same thing, you differentiate again.
Let's consider an example:

Evaluate
$$\lim_{x \to 0} {\frac{2\sin (x) -\sin (2x)}{x-\sin (x)}}.$$

Here, we have $f(x) = 2 \sin(x) - \sin(2x)$ and $g(x) = x - \sin (x)$. Straight away, you notice that as $x \to 0$, we get the fraction tending to $\frac{0}{0}$. So we apply L'Hopitals rule:
$$f'(x) = 2\cos (x) -2\cos (2x)$$
$$g'(x) = 1-\cos (x)$$
So now, we are calculating
$$\lim_{x\to 0}{\frac{2\cos (x) -2\cos (2x)}{1-\cos (x)}}$$
again, this goes to
$$\frac{2 - 2}{1 - 1} \to \frac{0}{0}$$
and so we apply L'Hopitals again. Now we have:
$$f''(x) = -2\sin (x) +4\sin (2x)$$
$$g''(x) = \sin (x)$$
Now, calulating the limit gives
$$ \lim_{x\to 0}{\frac{-2\sin (x) +4\sin (2x)}{\sin (x)}} \to \frac{0}{0}$$
and so AGAIN, we apply the rule. Differetiating the third time gives us
$$f'''(x) = -2\cos (x) +8\cos (2x)$$
$$g'''(x) = \cos (x)$$
So now taking the limit gives
$$ \lim_{x\to 0}{\frac{-2\cos (x) +8\cos (2x)}{\cos (x)}} \to {\frac{-2 +8}{1}} \to 6.$$


text:
Q: How can I do grouping in my case using SQL Server? I wants to calculate sum of quantity based on Quantity value
For Example
ItemNo    Quantity
------------------
111       5
111       -2
111       3
112       10

I want to do grouping by ItemNo and calculate like below
ItemNo    Quantity    Positive   Negative
-----------------------------------------
111       6            8           -2
112       10           10          0

I tried like this
SELECT
    ItemNo,
    Sum(Quantity),
    Case when Quantity >= 0 then sum(quantity) else 0 end POSITIVE,
    Case when Quantity < 0 then sum(quantity) else 0 end Negative
From
    Sales
Group By
    ItemNo,
    Quantity

I know this grouping is wrong. How my query should be?
thanks

A: Just put the SUM() around your CASE() statement:
SELECT
    ItemNo,
    Sum(Quantity),
    SUM(Case when Quantity >= 0 then quantity else 0 end) POSITIVE,
    SUM(Case when Quantity < 0 then quantity else 0 end) Negative
From
    Sales
Group By
    ItemNo;

Also, remove Quantity from your GROUP BY. You are aggregating quantity with a sum() so it's nonsense to GROUP BY it as well.

A: I would leave this as a comment to JNevill's answer if I had the reputation, but you would also want to give the quantity sum an alias to get the results in the question. For example: SELECT
    ItemNo,
    Sum(Quantity) Quantity,
    SUM(Case when Quantity >= 0 then Quantity else 0 end) Positive,
    SUM(Case when Quantity < 0 then Quantity else 0 end) Negative
From
    Sales
Group By
    ItemNo;

redpajama_set_name: RedPajamaStackExchange


text:
Q: Alert - offset icon, header and body text I am trying to create a system alert message that was mocked up (only grahpically) to looks like this:

However, I have not been able to do so as I am not much of a front-end developer/UX person, so I am reaching out to the community for input.
HTML:

                Header

Message

View

CSS:
.apparent-message {
    height: 75px;
    width: 75%;
    border-style: solid;
    border-width: 1px;
    margin-bottom: 50px;

    .apparent-message-icon {
        font-size: 3em;
        color: #fff;
        padding: 15px 0px 0px 0px;
        .fa-2x{
            box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.45);
        }
        text-shadow: 1px 1px 10px #000;
        width: 100%;
        height: 100%;
    }
}

.message-container {
    > div {
        display: inline-block;
    }
    .icon-col {
        width: 7%;
    }
    .content-container {
        width: 92.4%;
        height: 98%;
        padding-left: 15px;
        background-color: #fff;
        text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.45);
        .message-header {
            margin-top: 10px;
            font-size: 20px;
        }
        .message-body {
            margin-top: 10px;
            font-size: 14px;
            color: #515151;
        }
        .message-action {
            position: absolute;
            right: 30px;
            bottom: 10px;
        }
    }
}

.warning-message {
    background-color:#f39b0e;
    border-color: #f39b0e;
}

.info-message {
    background-color:#3598db;
    border-color: #3598db;
}

.success-message {
    background-color:#43a046;
    border-color: #43a046;
}

.error-message {
    background-color:#e1374c;
    border-color: #e1374c;
}

Here is an accompanying JSFiddle with an attempt to accomplish this.
https://jsfiddle.net/latchkostov/dLL1r1ap/

A: hey @blgrnboy here the fiddle with working demo

@import url('https://fonts.googleapis.com/css?family=Open+Sans');
* {
  box-sizing: border-box;
  margin:0;
  padding:0;
}
body {
  padding: 50px;
    font-family: 'Open Sans', sans-serif;
}

.apparent-message {
  width: 100%;
  border-style: solid;
  border-width: 2px;
  margin-bottom: 50px;
}
.apparent-message .apparent-message-icon {
  flex: 0 0 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  text-shadow: 1px 1px 10px #000;
}
.apparent-message .apparent-message-icon .fa-2x {
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.45);
}

.message-container {
  display: flex;
}
.message-container .content-container {
  flex-basis: 0;
  flex-grow: 1;
  max-width: 100%;
  display: flex;
  justify-content: center;
  flex-direction: column;
  height: 75px;
  padding-left: 15px;
  background-color: #fff;

  position: relative;
}
.message-container .content-container .message-header {
  font-size: 20px;
}
.message-container .content-container .message-body {
  margin-top: 10px;
  font-size: 14px;
  color: #515151;
}
.message-container .content-container .message-action {
  position: absolute;
  bottom: 10px;
  right: 30px;
}

.warning-message {
  background-color: #f39b0e;
  border-color: #f39b0e;
}

.warning-message .message-action,
.warning-message .message-header{
  color: #f39b0e;
}

.info-message {
  background-color: #3598db;
  border-color: #3598db;
}

.info-message .message-action,
.info-message .message-header{
  color: #3598db;
}

.success-message {
  background-color: #43a046;
  border-color: #43a046;
}

.success-message .message-action,
.success-message .message-header{
  color: #43a046;
}

.error-message {
  background-color: #e1374c;
  border-color: #e1374c;
}

.error-message .message-action,
.error-message .message-header{
  color: #e1374c;
}
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

                Header

Message

View

A: Hi You can do that using HTML 5 only. please find the example below.

var close = document.getElementsByClassName("closebtn");
var i;

for (i = 0; i < close.length; i++) {
    close[i].onclick = function(){
        var div = this.parentElement;
        div.style.opacity = "0";
        setTimeout(function(){ div.style.display = "none"; }, 600);
    }
}
.alert {
    padding: 20px;
    background-color: #f44336;
    color: white;
    opacity: 1;
    transition: opacity 0.6s;
    margin-bottom: 15px;
}

.alert.success {background-color: #4CAF50;}
.alert.info {background-color: #2196F3;}
.alert.warning {background-color: #ff9800;}

.closebtn {
    margin-left: 15px;
    color: white;
    font-weight: bold;
    float: right;
    font-size: 22px;
    line-height: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.closebtn:hover {
    color: black;
}
<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1">

Alert Messages

Click on the "x" symbol to close the alert message.

  ×
  Danger! Indicates a dangerous or potentially negative action.

  ×
  Success! Indicates a successful or positive action.

  ×
  Info! Indicates a neutral informative change or action.

  ×
  Warning! Indicates a warning that might need attention.

A: Try this, Make change according to your need

.warning-box{float:left;width:100%;position:relative;border:1px solid yellow;margin-bottom:15px;}
info{border:1px solid blue;}
.icon{float:left;width:100px;background:yellow;height:100px;text-align:center;position:relative;overflow:hidden;}
.info .icon{background:blue;}
.icon span{position:absolute;top:auto;margin:33% auto;left:0;right:0;bottom:auto}
.text{float:left;width:calc(100% - 220px);width:-webkit-calc(100% - 200px);padding:5px;}
.view{float:left;width:90px;text-align:center;position:relative;height:100px}
.view span{position:absolute;bottom:10px;left:10px;}

⚠

Lorem ipsum dolor sit amet, case discere concludaturque in mel, omnis aliquid offendit ut usu, ea minim partiendo vix

View

❕

Lorem ipsum dolor sit amet, case discere concludaturque in mel, omnis aliquid offendit ut usu, ea minim partiendo vix

View


text:
Q: Jmeter:Able to get the required value from XML,using the JSR223 PostProcessor.Need to Store it in a variable,so that I can be used across threads 1)  I get response in a XML format.
2)  I'm able to process the XML format using JSR223 PostProcessor.
3)  Also able to get the required value from XML response.
How do I store this value in a variable, so that it can be used across threads?
NOTE:
1)  Log.info is working correctly in JSR223 PostProcessor i.e the value gets printed correctly in the jmeter.log file , but when I use ${__setProperty(storeid, ${storeid})}; this is not working.
2)  I have added BeanShell Assertion too but still its not working.
Am I missing anything here?

A: Move JMeter variable x to property y using props and vars
props.put("y", vars.get("x));

In your case both names are storeid


text:
Q: Spring MVC :How to do a GET request to another form on submit of a Form (POST)? I have a form that extends CancellableFormController. On submit of this form, I want to do some processing with the data submitted and then generate another form using the processed data.
I have defined successview of first form as the formViewof the SecondForm. When I submit my First Form it automatically goes to the Onsubmit of second form after onsubmit of first form, without generating the view of the second form.
Can somebody give me the basic idea of what all things I should define.


text:
Q: Quarkus CDI Bean is not injected / is null I have a simple quarkus backend application. I am using CDI dependency injection in many places. Normally it works fine. But in one case the dependant bean is not injected. Its null. Why?
The bean I am trying to inject is a very simple service class to load data from a MongoDB.
userService.java
@Singleton       // <= is this annotation correct? Or
public class UserService {

    @Inject    // <= this all works fine
    MongoClient mongoClient;

    @ConfigProperty(name = "liquido.db-name")
    String dbName;

    public Optional<UserModel> getUserById(String userId) {
        // ... code to fetch user form DB ...
    }

}

I have another class that implements org.mongodb.bson.CollectibleCodec. It decodes values from mongoDB to POJOs.
TeamCodec.java
@ApplicationScoped     // <= is this annotation correct?
public class TeamCodec implements CollectibleCodec<TeamModel> {

    @Inject
    UserService userService;     // <=== THIS IS ALWAYS NULL???

    @Override
    public TeamModel decode(BsonReader reader, DecoderContext decoderContext) {
        TeamModel teamModel = new TeamModel();
        reader.readStartDocument();

        userService.getUserById(...);  // <==== THIS FAILS
    }

}

Any hint or advice why some of my injections work, but others not?


text:
Q: Strong convergence and a.e. convergence in Bochner spaces Let $\Omega$ be an open bounded subset of $\mathbb{R}^N$.
Let $u_n \longrightarrow u$ strongly in $L^2(0,T;L^p(\Omega))$ for $1 \leq p < \infty$.
It is known that strong convergence in $L^2$ implies a.e. convergence along a subsequence.
Can I then imply that $u_{n_k}(\cdot, t) \longrightarrow u(\cdot,t) $ strongly in $L^p(\Omega)$ for a.e. $t \in \left[0,T\right]$?
Or are there any problems since I work in a Bochner space?


text:
Q: Apple HomeKit HMCharacteristics I'm currently working on a quite important study project.
I'm working on the topic of home automation. Therefore I would like to implement the HomeKit framework to control action modules.
My App is already able to search for Homes, Rooms, Accessories, Services and Characteristics. But I don't know how to properly handle all of the different characteristic types. Is there a way to get the characteristic type as real string (for example: HMCharacteristicTypePowerState).
I really don't know how to present the user just those characteristics that matter.
I would appreciate if someone could drop me a hint ;)

A: HMCharacteristic has a characteristicType property, which you can compare to the constants.
if characteristic.characteristicType == HMCharacteristicTypePowerState {
    // do something
}

Reference

A: HMCharacteristic has a localizedDescription property which returns a readable string, but if you want to select only certain characteristics it is better to use the the HMCharacteristicsType constants as suggested by Mark

A: if characteristic.characteristicType isEqualToString: HMCharacteristicTypePowerState {
    // do something
}


text:
Q: Alternative creation of new publishing page instance I have some custom content type and custom page layout from that content type. This content type has HTML rich text field. And all my contents are page instances of that custom page layout. I need some "Create new" button/web part on the default page of the site, to give the content authors ability to create new content without going to standard sharepoint page creation process.

A: I don't know which part is your problem so here is some helpers:
To security trim a bit of HTML use SPSecurityTrimmedControl
To make your page layout default (or only allowed) click 'Page layouts and site templates' in the 'Look and Feel' section of site settings
To launch the Create Page dialog use the following JavaScript:
SP.UI.ModalDialog.OpenPopUpPage(_spPageContextInfo.webServerRelativeUrl+'_layouts\u002fCreatePublishingPageDialog.aspx', null, 390)

To create a Publishing Page using code use PublishingWeb.AddPublishingPage


text:
Q: Increment by more than one number with jQuery.animate I have a script that animates from zero to its value. Is it possible to increment this number by more than one at a time?
e.g 1, 5, 10, 15...... 100

jQuery({ countNum: 0 }).animate({
  countNum: jQuery('.ticker').text()
}, {
  duration: 2000,
  easing: 'swing',
  step: function() {
    jQuery('.ticker').text((Math.floor(this.countNum)));
  },
  complete: function() {
    jQuery('.ticker').text((Math.floor(this.countNum)));
  },
});

100

A: You can do it like this:
HTML:

100

JS:
jQuery({ countNum: 0 }).animate(
  {
    countNum: jQuery(".ticker").text()/5
  },
  {
    duration: 4000,
    easing: "linear",
    step: function () {
      jQuery(".ticker").text(Math.floor(this.countNum)*5);
    },
    complete: function () {
      jQuery(".ticker").text(Math.floor(this.countNum)*5);
    }
  }
);


text:
Q: Angular Twitter Card and Facebook Post with dynamic routes and resources I'm working on an Angular 14 app and I trying to make twitter cards with dynamic routes. The case is the following:

*

*I have an online store that shows different products, obviously is the same route just changing the product info by a param in the route
{
  path: 'product/:id',
  component: ProductLayoutComponent,
  children: [{ path: '',  loadChildren: () => import('./pages/section-custom/modules/product/product.module').then(m => m.ProductComponent) },  ]
}

*This page has two buttons to share the link of the product on Facebook and Twitter, here is the code
productId: string;
constructor(public activatedRoute: ActivatedRoute) {
  this.activatedRoute.params.subscribe((params) => {   this.productId = params['id']; });
}

shareFacebook() {
  const facebookshare = 'https://www.facebook.com/sharer/sharer.php?u=' + this.productId;
  window.open(facebookshare, '_blank');
}

shareTwitter() {
  const facebookshare = 'https://twitter.com/intent/tweet?url=' + this.productId;
  window.open(facebookshare, '_blank');
}

*Every product has its own image, title and description to appear in the Twitter card and Facebook post, after many days of researching I understand that the social network crawler need to read some meta tags to show correctly the post and cards, so when I load the product I have this function:
 productId: string;
 constructor(public activatedRoute: ActivatedRoute: public http: HttpClient,  private metaService: Meta) {
     this.activatedRoute.params.subscribe((params) => {
       this.productId = params['id'];
       this.loadResources();
     });
 }

 loadResources() {
     this.http.get(`https://backend.demo.com/product/${this.productId}`).subscribe(data => {
         const shareLink = `${document.location.origin}/product/${this.productId}`;
         this.metaService.addTags([
             { name: 'twitter:card', content: 'summary_large_image' },
             { name: 'twitter:title', content: data.title },
             { name: 'twitter:description', content: data.description },
             { name: 'twitter:image', content: data.image },
             { name: 'twitter:domain', content: shareLink },
             { name: 'og:type', content: 'website' },
             { name: 'og:url', content: shareLink },
             { name: 'og:title', content: data.title },
             { name: 'og:description', content: data.description },
             { name: 'og:image', content: data.image },
         ]);
     });
 }

*I already know that the previous solution doesn't work because angular is a Single Page Application and the Crawlers do not execute JavaScript. So I implemented Angular Universal to use Server Side Rendering, but SSR doesn't work because the browser is still the tool to render the app and the Crowlers do not recognize the meta tags.

*So now I'm trying to implement the Pre-Render strategy, but for some reason, it seems not working for this case because Crawlers don't know there is a root with and specific code for example "https://www.myfakesite.com/product/AAE607" to get the specific image, title and description when the link is copied and pasted, even when I do the pre-render
I think that robots.txt and sitemap.xml could be involved but I don't know how. (The product database is created in another system, so as the product ID)
So my question is, how can I share the twitter card and Facebook post with dynamic image, title and description depending on a dynamic route in angular?

A: Most the steps you have performed are correct, In addition to above steps,
Check the following steps:

*

*Try to load the direct url "https://www.myfakesite.com/product/AAE607" in New tab, if you get 404 or 500 error, apply htaccess to directly load the page which will help the browser to consider it as a individual Page instead of S

If you are getting data loaded on the page, inspect the page and check if meta data is added on the page or not

*

*Also Change the title of each page using title service

*Add a canonical url

Here htaccess plays important role for redirection


text:
Q: r function to pmml success but not recognized in container Here is an example of R script using a couple of library
library(pmml)
library(pmmlTransformations)
data(iris)
irisBox <- WrapData(iris)
irisBox <- FunctionXform(irisBox,origFieldName="Sepal.Length",
           newFieldName="Sepal.Length.Transformed",
           formulaText="ifelse(Sepal.Length>5,Sepal.Length*1.2, Sepal.Length*.8)")
mod1 <- lm(Sepal.Length.Transformed ~ Petal.Length, irisBox$data)
pmml(mod1, transform = irisBox)

The function works fine and create a nice pmml output. However, the ifelse statement is not the recognizable function in pmml 4_3. Can anybody recommend an alternative to the above script to generate pmml workable command?
I recognize that DiscretizeXform is recommended in the pmmlTransformations package but it is very cumbersome so I am reluctant to use since it has to read breakpoints from outside files.

A: The pmmlTransformations package does not know how to handle the "ifelse" R function, and passes it through as-is. That's why the resulting PMML document contains Apply@function="ifelse" when it should be containing Apply@function="if".
The PMML "if" built-in function is perfectly able to represent if-else branching logic:

Implements IF-THEN-ELSE logic. The ELSE part is optional. If the ELSE part is absent and the boolean value is false then a missing value is returned.

As for a solution, then please consider switching to the r2pmml package, which lets you do feature engineering inside formulas (as opposed to "boxing" data.frame objects), including full support for the "ifelse" R function:
library("randomForest")
library("r2pmml")

iris.rf = randomForest(Species ~ ifelse(Sepal.Length>5,Sepal.Length*1.2, Sepal.Length*.8) + ., data = iris)

r2pmml(iris.rf, "iris.pmml")

A: It looks like a simple replacement would work.
irisBox <- WrapData(iris)
irisBox <- FunctionXform(irisBox,origFieldName="Sepal.Length",
       newFieldName="Sepal.Length.Transformed",
       formulaText="if(Sepal.Length>5) Sepal.Length*1.2 else Sepal.Length*.8")
mod1 <- lm(Sepal.Length.Transformed ~ Petal.Length, irisBox$data)
pmml(mod1, transform = irisBox)


text:
Q: StartingStepSize as a table in NDSolve I would like to solve a list of equation with NDSolve with each equation having a different StartingStepSize. When I tried naively to use a table in the option NDSolve gave me an error. The only workaround I found is the solution given in this thread.
However it would force me to rewrite a lot of my actual code. Does anyone know if it is possible to add a table in the options of NDSolve, or doing something equivalent?

A: You could use Map
step={0.001,0.01,.1}; (* starting stepsize *)
Map[NDSolve[{x'[t]==-x[t],x[0]==1},x,{t,0,10},StartingStepSize->#]&,step]

which gives you a list of solutions for a given ode  with different stepsize!
For a list of odes    MapThread[NDSolve[#1, StartingStepSize -> #2] &, {odes, step}] solves your problem.


text:
Q: Windows Server 2012 R2 Freezing in multiple boot modes We have a Dell R220 running Windows Server 2012 R2 Standard that has begun freezing during the boot process after doing a routine reboot. Specifically, once the Windows logo with the black background appears it freezes and won't move past that screen.
We've tried entering repair mode, safe mode, and even inserting an installation DVD and booting from that. In all modes of booting the system gets stuck at the same spot. The failure to boot from external media has me really perplexed and leads me to believe this might be a hardware issue.
What would be the next best step to narrow down the issue?

A: First try removing one of the RAM sticks or pairs and see if the machine is able to boot after that. Try swapping ram around to see if the machine boots.
Try removing all the hard drives from the machine.  Be careful to not enter the RAID configuration utility if prompted after rebooting the machine to prevent the controller from deleting the configuration.  Then boot to the Windows CD/flash drive and see if the machine boots.
Try removing any expansion cards that may be present in the machine that are not required for booting EX, network cards.
If that does not work, you could always as a last resort run the Dell Diagnostics to see if that points you in the correct direction.


text:
Q: how to show message response php Ajax I have a piece of code that sends a form in ajax. I want to receive the result as a message on the page.
    <script>
  $(document).ready(function () {
    $('.btn-primary').click(function (e) {
      e.preventDefault();
      var message = $('#message').val();
      $.ajax
        ({
          type: "POST",
          url: "<?=baseUrl()?>/page/contact",
          data: { "message": message },
          success: function (data) {
            $('#contactform')[0].reset();
          }
        });
    });
  });
</script>

This is my php code to receive the message and save it in the database
private function messageSend(){
                  $user_id = $_SESSION['user_id'];
                  $message = $_POST['message'];
                  if ($message == null) {
                        return json_encode(array(
                              'status' => false,
                              'message' => 'Please Enter Message'
                        ));
                  }
                  $sendTime = getCurrentDateTime();
                  NoteModel::contact_message($user_id, $message, $sendTime);
                  return json_encode(array(
                        'status' => true,
                        'message' => 'Message Send Success'
                  ));
            }

A: In your PHP, do not return the JSON encoded array. Do an echo.
echo json_encode(array(
           'status' => false,
           'message' => 'Please Enter Message'
       ));

And in your Javascript, the success function of AJAX should be like this.
success: function (data) {

    var response = JSON.parse(data);

    // now you can access the data as a JSON object
    var status = response.status;
    var message = response. message;

    $('#contactform')[0].reset();
}


text:
Q: Why do I need to delete the applet's package to delete my applet? I have an empty Javacard as below:
user@system$ java -jar gp.jar --list
ISD: A000000003000000 (OP_READY)
     Privs:    SecurityDomain, CardLock, CardTerminate, CardReset, CVMManagement

And I have installed a weird applet on it:
user@system$ java -jar gp.jar --install applet.cap
CAP loaded
user@system$

Well, the applet is installed successfully:
user@system$ java -jar gp.jar --list
ISD: A000000003000000 (OP_READY)
     Privs:    SecurityDomain, CardLock, CardTerminate, CardReset, CVMManagement

APP: 01020304050601(SELECTABLE)

PKG: 010203040506(LOADED)

user@system$

But when I am try to delete the applet I fail:
user@system$ java -jar gp.jar --delete 01020304050601 --debug --verbose

# Successful Mutual Authentication with Security Level = 01 (CMAC)

A>> 84F28002 0A 4F00<CMAC> 00
A<< E3114F08A0000000030000009F700101C5019E 9000

A>> 84F24002 0A 4F00<CMAC> 00
A<< E3104F07010203040506019F700107C50100 9000

A>> 84F21002 0A 4F00<CMAC> 00
A<< E30F4F060102030405069F700101C50100 9000

A>> 84F22002 0A 4F00<CMAC> 00
A<< E30C4F060102030405069F700101 9000

A>> 84E40000 11 4F0701020304050601<CMAC>
A<< 6985

Could not delete D3646467329901. Some app still active?

I have tried the following forms of delete command too:
user@system$ java -jar gp.jar --delete 01020304050601 --force  ==> Same result
user@system$ java -jar gp.jar --delete 010203040506  ==> Same result

The only successful form which I can use to delete the applet, is as below:
user@system$ java -jar gp.jar --delete 010203040506 --force

# Successful Mutual Authentication with Security Level = 01 (CMAC)

A>> 84F28002 0A 4F00<CMAC> 00
A<< E3114F08A0000000030000009F700101C5019E 9000

A>> 84F24002 0A 4F00<CMAC> 00
A<< E3104F07010203040506019F700107C50100 9000

A>> 84F21002 0A 4F00<CMAC> 00
A<< E30F4F060102030405069F700101C50100 9000

A>> 84F22002 0A 4F00<CMAC> 00
A<< E30C4F060102030405069F700101 9000

A>> 84E40080 10 4F06010203040506<CMAC>
A<< 9000

The applet and its packages is gone now:
user@system$ java -jar gp.jar --list
ISD: A000000003000000 (OP_READY)
     Privs:    SecurityDomain, CardLock, CardTerminate, CardReset, CVMManagement

Question: Why do I need to delete the package to delete the applet itself?
Note that this situation appears for a specific cap file only.
FYI: I have tried different tools (Including gpshell, pyapdu, etc.) and I got same results.

A: The uninstallation process of the applet does not run successfully, therfore the applet instance cannot be deleted alone, most probably you have static content like private static transient byte array declared in the applet code. In this case you must deinitialize any static objects to null by overriding Applet's uninstall method.  Check object ownership in the JCRE to understand the problem


text:
Q: First $_GET parameter dosn't work in .htaccess I'm using .htaccess on my dashboard and I'm using it to short and organize my URL so for that i try to add some $_GET parameters in .htaccess file and when i checked for the output parameters i get the second , third and forth parameter but not the first one
This is URL before using htaccess :
http://example.com/dashboard?param1=first&param2=second&param3=third&param4=forth
This is URL after using htaccess :
http://example.com/dashboard/first/second/third/forth
The output from printing $_GET :
array(4) { ["param1"]=> string(3) "php" ["param2"]=> string(6) "second" ["param3"]=> string(5) "third" ["param4"]=> string(5) "forth" }
I don't know why is first parameter is getting 'php' as a value instead of getting the value from URL
This is my .htaccess file :
RewriteEngine On
Options +FollowSymLinks
RewriteRule ([^\.]+)/$ index.php?param1=$1
RewriteRule ([^\.]+)/([^\.]+)$ index.php?param1=$1&param2=$2
RewriteRule ([^\.]+)/([^\.]+)/([^\.]+)$ index.php?param1=$1&param2=$2&param3=$3
RewriteRule ([^\.]+)/([^\.]+)/([^\.]+)/([^\.]+)$ index.php?param1=$1&param2=$2&param3=$3&param4=$4


text:
Q: Where can I find this paper by Bonsall? (Quaterly Journal of Mathematics, 1991) (atomic decomposition, Minkowski functional) I am searching for the paper Bonsall, F. F. (1991). A General Atomic Decomposition Theorem and Banach's Closed
Range Theorem. The Quarterly Journal of Mathematics, 42 9–14. for the proof of
$$
\inf\{t > 0: x \in t \text{conv}(A)\}
= \inf\left\{ \sum_{a \in A} c_a: x = \sum_{a \in A} c_a a, \ c_a \ge 0 \ \forall a \in A\right\},
$$
where $A \subset \mathbb R^p$ is a compact subset whose elements are the extreme points of conv$(A)$, i.e. $a \not\in \text{conv}(A \setminus \{a\})$ for all $a \in A$ and the centroid of conv$(A)$ is the origin. (This is from The Convex Geometry of Linear Inverse Problems by Venkat Chandrasekaran, Benjamin Recht, Pablo A. Parrilo, and Alan S. Willsky)
I know that by Caratheodory theorem, one can represent the convex hull of $A$ as convex combinations of elements in $A$ with at most $p + 1$ summands, so I can write
$$
\text{LHS} = \inf\left\{ r > 0: \frac{x}{r} = \sum_{k = 1}^{N} c_k a_k, \
    N \le p + 1, \begin{array}{c}
        (c_k)_{k = 1}^{N} \subset [0, 1], \\
        (a_k)_{k = 1}^{N} \subset A,
    \end{array} \sum_{k = 1}^{N} c_k = 1 \right\}
$$
And I know that the LHS is $\infty$ (per convention $\inf(\emptyset) = \infty$) if $x$ is not in the affine hull of conv$(A)$. As conv$(A)$ is convex, aff$($conv$(A)) = $span$(A)$.

A: To make the question answered I note that the paper is already found and sent to the asker via e-mail.


text:
Q: Can manually triggered cron jobs respect the concurrencyPolicy? So I've a cron job like this:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: my-cron-job
spec:
  schedule: "0 0 31 2 *"
  failedJobsHistoryLimit: 3
  successfulJobsHistoryLimit: 1
  concurrencyPolicy: "Forbid"
  startingDeadlineSeconds: 30
  jobTemplate:
    spec:
      backoffLimit: 0
      activeDeadlineSeconds: 120
...

Then i trigger the job manually like so:
kubectl create job my-job --namespace precompile --from=cronjob/my-cron-job

But it seams like I can trigger the job as often as I want and the concurrencyPolicy: "Forbid" is ignored.
Is there a way so that manually triggered jobs will respect this or do I have to check this manually?

A:
Note that concurrency policy only applies to the jobs created by the same cron job.

The concurrencyPolicy field only applies to jobs created by the same cron job, as stated in the documentation: https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#concurrency-policy
When executing $ kubectl create job my-job --namespace precompile --from=cronjob/my-cron-job you are essentially creating a one-time job on its own that uses the spec.jobTemplate field as a reference to create it. Since concurrencyPolicy is a cronjob field, it is not even being evaluated.
TL;DR
This actually is the expected behavior. Manually created jobs are not effected by concurrencyPolicy. There is no flag you could pass to change this behavior.


text:
Q: How to lookup data based on the next sunday of the week I need to lookup a row of data from MySQL based on the next Sunday of the week. Anyone know how?

A: you can determine the next sunday using PHP then pass it to your query..
$nextSunday = date("Y-m-d", strtotime('next sunday'));

if you need the next sunday from a certain date
$date = strtotime('2010-07-01');
$nextSunday = date("Y-m-d", strtotime('next sunday', $date));

The provide this date to your query
$result = mysql_query("SELECT * FROM table WHERE date = '$date'")


text:
Q: VBScript in Powershell? I have seen this type of line many places on the net. Should it be something different?
$VBScript = New-Object -ComObject MSScriptControl.ScriptControl

This happens under both PSVersion 5.0.10586.117 on Windows 7 and GitCommitId 6.0.0-alpha.10 on Windows 10.
PS C:\src\powershell> $VBScript = New-Object -ComObject MSScriptControl.ScriptControl
New-Object : Retrieving the COM class factory for component with CLSID {0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}
failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154
(REGDB_E_CLASSNOTREG)).
At line:1 char:13
+ $VBScript = New-Object -ComObject MSScriptControl.ScriptControl
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMException
    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand


text:
Q: Connect MS Access to remote DB2 database without installing DB2 locally I've found instructions on how to connect MS Access as a front-end to a DB2 database, but it appears that installing DB2 locally is a prerequisite (so that you have the DB2 ODBC driver). But I don't want to install locally. I want to connect to a remote DB2 database. I can't seem to figure out how I can get that driver installed without installing DB2. Anyone done this before?

A: You need to download and install the db2 client only.
Version 9.7 clients are here.


text:
Q: IOneWay SOAP Parameters and Void Return I'm having a couple of issues with getting a correct WSDL generated for a ServiceStack SOAP+REST service.
The main issue is that when I use AddServiceReference the generated IOneWay is populated and the methods all return void. Looking at the provided SOAP examples it looks like ISyncReply should be populated (currently no operations at all) and the response type should be one of the fields in the DTO + Response object. What am I doing wrong?

*

*The types and operations are distributed across multiple namespaces
but they are all referenced with a single ContractNamespace in AssemblyInfo

*The DTO + Response naming convention has been followed

*I thought it might be an issue with inherited Request/Response types, but even cutting them out completely doesn't change the situation, though apparently you can't inherit from a concrete type even from within a named namespace and have the operation parameters be generated properly

*Using explicit [DataContract]/[DataMember] annotations does not make a difference

*REST calls seem to be working as expected

*I'm using the latest ServiceStack binaries

*The WSDL does not have wsdl:output elements at all

*Applies both SOAP 1.1 and SOAP 1.2 wsdls

*And just to complicate the situation still further the metadata produced in http://*/metadata for each operation seems to be completely accurate!!

Let me know if there is any specific further information I can provide.


text:
Q: Javascript variables losing values during array.filter operation To whom it may concern
This post is actually an example of a kind of XY Problem.

The real issue ("X") of the person asking for help is obscured, because instead of asking directly about issue X, they ask how to solve a secondary issue ("Y") which they believe will allow them to resolve issue X.

My original problem was that the array (on line 127 in the pics) was becoming empty. While I was tracing down that problem, I was shocked to find that variables were becoming empty in the middle of execution. Even though that's what this post was about, had I been thinking, I wouldn't have needed to post.
The real problem? Look at line 131 of the images...
if (siblings[childitem].my.parents.length = 0) {

The single-equal results in an empty array.
The original question follows.

I discovered this thru the chrome dev tools.
Here's the before pic.

You can see in the local scope all the relevant info, plus it's echoed in the yellow text inline with the real-time code. All the values are appropriate.
Upon executing the Next Step in the execution. . .

You can see the reticle/cursor has moved to the right in the real-time code. The previous local variables have disappeared. old parents is now [], and children is undefined.
Is it a reference problem somehow? I got the filter syntax from this post here.
What the heck is going on?
Here's the code in text for those of you that need it.
selected.my.children.forEach (childitem => {
    // let parentindex = siblings[child].my.parents.indexOf(selected.my.place);
    let oldparents = siblings[childitem].my.parents;
    let newparents = oldparents.filter(e => {e != selected.my.place});
    siblings[childitem].my.parents = newparents;
    // if (parentindex > -1) {
    //  siblings[child].my.parents.splice(parentindex, 1)
    // }
    if (siblings[childitem].my.parents.length = 0) {
        siblings[childitem].faceup();
    }
    console.log(siblings[childitem].my);
});

A: Because you entered into a new function scope. That is the callback that you pass to filter function:
e => {e != selected.my.place} // <- this is a new scope, no local variables other than `e`

You can clearly see that there are no local variables other than e.
You can however find childitem, newparents etc. in parent scope. In your example it is Closure (click on Closure (tap))

A: ElementList is array like not array, you can not use the filter directly, you need transform it to array first:
let oldparents = [...siblings[childitem].my.parents];// or you can use Array.from
let newparents = oldparents.filter(e => e != selected.my.place); // here the arrow function also needs to be updated, remove the braces


text:
Q: Deletar uma classe inteira e tudo que está nela de um HTML carregado via ajax Tenho duas págias em HTML:
index.html:

       topo

          Essa é a home

noticia.html

       topo

          Essa é a notícia

Estou fazendo as trocas entre as páginas com AJAX. dessa forma:
$.ajax({
    type: "GET",
    url: "noticia.html",
    dataType: "html"
}).done(function(data) {
    $('#viewdata').html(data);
});

Mas eu queria pegar apenas tudo que está na classe 'conteudo' no arquivo noticia.html, e não todo o resto, porque da forma que estou fazendo o resultado está sendo esse:

       topo

          topo

             Essa é a notícia

Ou seja, o arquivo gerado fica com algumas classes duplicadas. Eu até poderia excluir o topo com replace, mas na prática a classe topo é gigante, assim como outras classes, ficaria inviável. Existe alguma solução?

A: Use o método .load() onde você pode buscar no arquivo requisitado um elemento específico:
$("#viewdata").load("noticia.html .conteudo");

O código acima irá substituir todo o HTML interno da div #viewdate pela div .conteudo vinda da página noticia.html.


text:
Q: Hyperlink screen tip causing workbook to need repairs I am using VBA to create hyperlinks to cells in different sheets in Excel and when I add a screen tip everything works fine until I close the workbook.
Upon reopening, Excel makes repairs and forces me to open read only. Getting rid of the screen tip solves the problem but having the screen tip is incredibly convenient.
Does anyone know what might cause this?
Hyperlinks.Add wb.Sheets("Summary").Cells(j, i + 2), "", "'" & i & "'!" & wb.Sheets(i + 1).Cells(3, col).Address, scrTip

Edit:
Here is the code I am using to create scrTip.
scrTip = ""

For indx = 0 To 4

      If TopCost(indx) <= 0 Then Exit For

      If indx > 0 Then scrTip = scrTip & vbCrLf
      scrTip = scrTip & strTopCost(indx) & " - " & Round(TopCost(indx))

Next indx

Array strTopCost contains descriptions that can have symbols like ",-,&,/, #, etc while the topcost array contains a number. The screen tip shows the location of the hyperlink when scrTip is empty.

A: Please give the following a try:
wb.Sheets("Summary").Hyperlinks.Add _
    AnchorAnchor:=Cells(j, i + 2), _
    Address:="", _
    SubAddress:="'" & i & "'!" & wb.Sheets(i + 1).Cells(3, col).Address, _
    ScreenTip:=scrTip

Also, make sure to delete any existing hyperlinks prior to creating new ones:
Dim hyp As Hyperlink
For Each hyp In ThisWorkbook.Sheets("Summary").Hyperlinks
    hyp.Delete
Next hyp

A: I found the issue. Some of the screen tips were too long so I limited their length to 25 characters and it worked fine afterwards.


text:
Q: How to change Eclipse Helios with Eclipse Kepler-SR1 I'm using Eclipse SDK version 3.6.2 Helios and want to change to Kepler SR1 for the sake of Installing IBM Worklight. I'm trying to do it with out removing Helios? Is it possible? Earlier I done when I changed from Galileo to Helios by using option 'Install New Software' under 'Help' menu in Eclipse and with some minor tweaks (like changing version number and all). I tried the same with using http://download.eclipse.org/releases/kepler and It's showing the available software's. But I guess all is from latest version of Kepler. I need Kepler SR1 only as IBM suggests. Or can I keep two separate Eclipse installations? Anybody have suggestions for helping me with this? Thanks in advance.

A:
can I keep two separate Eclipse installations? Anybody have suggestions for helping me with this?

This is the recommended approach, and even keep two separate Eclipse workspaces.
That means you have to import again your projects, but that allows you to easily go back to your previous Eclipse if the new one has any issue.
You can download a new Eclipse, and unzip it wherever you want: there is no setup, just an archive to uncompress.


text:
Q: What keeps quarks separate (strong force pulls, but what repels to equal out) We know that the strong force keeps quarks together, that is mediated by gluons (and their charge is called color charge).
We know that the residual strong force keeps neutrons and protons together in the nucleus (called the nuclear force), and that is mediated by Pions (quark and anti-quark).
We know that electric charge can repel (same charge) or pull (opposite charge).
But I do not see anywhere if color charge can repel, i only see that it can pull.
We know that protons and neutrons are stable together in a nucleus, because two forces equal out (nuclear force pulls and electric charge repels).
Questions:

*

*Since strong force (mediated by gluons) pulls quarks together, what keeps quarks separate from each other, meaning why are quarks not coming closer together and crush into each other? I only see the strong force pulling, but what is the other force, that repels here and equals out?

*I understand that in case of two Protons, two forces equal out, electric force repels, and nuclear force pulls. That is why two protons are stable in a nucleus and are not flying away and are not crushing into each other either. In case of a Neutron, there is no electric force to repel, but there is still nuclear force to pull, so a neutron is pulled together to another neutron or a proton, but what keeps the neutron from crushing into another neutron or proton?

A:
Since strong force (mediated by gluons) pulls quarks together, what keeps quarks separate from each other, meaning why are quarks not coming closer together and crush into each other? I only see the strong force pulling, but what is the other force, that repels here and equals out?

To start with quarks , in contrast to protons and neutrons, are not composite, they are elementary particles in the standard model of particle physics which describes the data up to now .
Here is an illustration that describes what is happening within the composite proton:

Quarks and antiquarks and gluons dance around and annihilate and pair produce  in a non stop manner, so they do "overlap" in the feynman diagrams of the individual interactions, and annihilate. The three valence quarks are lost in the soup, and in any case it is a matter of conservation of quantum numbers, there should be an excess of one down and two up for the proton.
So it is not a matter of repelling, it is just that overall the quarkness up and down should add up to the valence quarks of a proton, and the same holds for the neutron two down one up excess in the soup .

I understand that in case of two Protons, two forces equal out, electric force repels, and nuclear force pulls. That is why two protons are stable in a nucleus and are not flying away and are not crushing into each other either. In case of a Neutron, there is no electric force to repel, but there is still nuclear force to pull, so a neutron is pulled together to another neutron or a proton, but what keeps the neutron from crushing into another neutron or proton?

A neutron, as well as a proton, is a bound state of QCD. As bound as a hydrogen atom. For the same reason that if you hit two hydrogen atoms on each other at low energies they remain hydrogen atoms, hitting two neutrons at low energy on each other  they remain neutrons, a specific(complicated) bound state of quarks. At high energy they will create a lot of quark antiquark pairs, the same as the results seen in the LHC proton proton scatters, though baryon number conservation holds  in all elementary particle interactions.
In conclusion it is not about pushing and repelling but about conserved quantum numbers and/or bound states.
In lattice QCD they assume a potential and there they can approximately solve to find masses for pions and kaons, within the limits of the model.

A: *

*The strong force does pull quarks together, but it also gets weaker as the quarks get closer (i.e. it acts sort of like a spring), in a phenomenon known as "asymptotic freedom." In this way, the strong force is very different than electromagnetism, where the force gets stronger if the charges are closer together. As such, there's no reason to expect that quarks which are placed close together will immediately annihilate, as there's just not a lot of force on them in the first place.

*The force that holds nucleons together is described by the nucleon-nucleon (NN) potential, which looks like this (horizontal axis is $r$, vertical axis is $V$):

The NN potential is a residual interaction resulting from very long-range reactions between quarks in adjacent nucleons. Since the reaction is long-range, color charge (and therefore gluons) cannot be exchanged. As such, the mediators for this force are color-neutral, and consist of the lighter mesons (like $\pi$, $\rho$, and $\sigma$). Because of this, the nature of this residual interaction is completely different from the quark-level strong interaction. In particular, note the strong repulsion that happens at distances less than 1 fm (i.e. the diameter of a nucleon). This repulsion, mediated by vector-meson ($\rho$) exchange, is what keeps protons and neutrons apart.

A:
I only see the strong force pulling, but what is the other force, that repels here and equals out?

You have to understand that physics is built on a big pile of assumptions, and the cumulative set of assumptions matches up with experimental reality, at least in a statistical sense.
Electrical force is assumed to act the same at all sizes. This is because electrical force was invented before we knew anything about atoms. Calculus had been invented, and applying calculus to electric force automatically gave the assumption that it all works the same down to individual points.
When the atomic nucleus was invented in response to experimental evidence, it was assumed that the nucleus was a ball of protons and neutrons. Because protons and neutrons were found outside of nuclei, so it was natural to assume that's what nuclei were made of.
But protons were assumed to be little balls of charge that force the same in all directions at all times. That's the simplest assumption. Why didn't nuclei fly apart from repulsion? They assumed there was a strong force to hold them together.
Why didn't nuclei collapse into points? They assumed there was a force to push them apart, that acted only at short distances. (They assumed it didn't just act at short distances but that it got weaker fast at longer distances. This would mean the inverse square law did not quite apply close to atomic nuclei, because the repulsive force would be weakly repulsing there. It was an assumption that perhaps could be tested.)
Why not give the repulsive force a different name from the strong force that kept nuclei from exploding? Why have a second complicated force instead of two more simple forces? Historical accident. They invented something to solve two questions they had after they assumed that electric force acts the same on protons in a nucleus as it does on 1 cm pith balls, and they chose to think of one hypothetical force to solve two problems.
The assumptions are kind of arbitrary, but put them all together and they do fit the experimental evidence on average, in a statistical sense.


text: Q: Is the empty set "a set of points"? Obviously the empty set is a subset of the set of all points, and every element in the empty set is a point. Is there any logical/syntactic reason that an empty set could not be considered a "set of points" (i.e. does the statement imply that the empty set contains at least one point?)


text:
Q: checkbox only on condition vue I have these checkboxes which always stay checked but I only want to check them if the object they are associated with's property called include is set to true.

right now my issue is that all the boxes stay checked, then when I click them they uncheck and then exclude students. I need to make the boxes unchecked unless I check them.
I don't have a checked attribute set on the template so I don't know why they would be checked by default? I'm hoping someone can point out my mistake.
my absent students data:
absentStudents: [{
                    "id": 207,
                    "first_name": "Gabriel De Manuel",
                    "include": false,
                    "avatar": null,
                    "group_id": 24,
                    "full_name": ", Gabriel De Manuel",
                    "exclude": false ,
                    "isGrouped": false,
                }, {
                    "id": 208,
                    "first_name": "Francisco",
                    "include": false,
                    "avatar": null,
                    "group_id": 24,
                    "full_name": ", Francisco",
                    "exclude": false,
                    "isGrouped": false,
                }, {
                    "id": 209,
                    "first_name": "Rosa",
                    "include": false,
                    "avatar": null,
                    "group_id": 24,
                    "full_name": ", Rosa",
                    "exclude": false,
                    "isGrouped": false,
                }],
            excludeAbsent: false,

//my v-model is created by the following function
 created() {
                this.absentStudentsSelected = this.absentStudents.map(x => x.id);
            },

I have rendered these checkboxes for my list

                        <input type="checkbox" @click="check($event)" v-model="absentStudentsSelected" :value="absentStudent.id">
                        {{ absentStudent.first_name }}

check the boxes for each student as long as this.excludeAbsent is true
check: function(e){
                    if(this.excludeAbsent === true){ //if we want to include absent students

                    for(var i = 0; i< this.absentStudents.length; i++){
                        if(e.target.value == this.absentStudents[i].id){

                                this.absentStudents[i].include = true
                            }else{
                                this.absentStudents[i].include = false
                            }
                        }
                    }

A: absentStudentsSelected should be initialized as an empty array in your data option :

let app = new Vue({
  el: "#app",
  data() {
    return {
      absentStudents: [{
        "id": 207,
        "first_name": "Gabriel De Manuel",
        "include": false,
        "avatar": null,
        "group_id": 24,
        "full_name": ", Gabriel De Manuel",
        "exclude": false,
        "isGrouped": false,
      }, {
        "id": 208,
        "first_name": "Francisco",
        "include": false,
        "avatar": null,
        "group_id": 24,
        "full_name": ", Francisco",
        "exclude": false,
        "isGrouped": false,
      }, {
        "id": 209,
        "first_name": "Rosa",
        "include": false,
        "avatar": null,
        "group_id": 24,
        "full_name": ", Rosa",
        "exclude": false,
        "isGrouped": false,
      }],
      excludeAbsent: false,
      absentStudentsSelected: []
    }
  },
  methods: {
    check: function(e) {
      if (this.excludeAbsent === true) {
        for (var i = 0; i < this.absentStudents.length; i++) {
          if (e.target.value == this.absentStudents[i].id) {

            this.absentStudents[i].include = true
          } else {
            this.absentStudents[i].include = false
          }
        }
      }
    }
  }
})

      <input type="checkbox" @click="check($event)" v-model="absentStudentsSelected" :value="absentStudent.id"> {{ absentStudent.first_name }}

A: You should use the checked attributes on the input elements appropriately. Unfortunately, the WhatWG Html standard now says that boolean attributes evaluating to false must be omitted altogether. As vue does not have a mechanism to conditionally include attributes, you need to fall back to a seemingly redundant solution and conditionally render the element:

        <input
            v-if="excludeAbsent && absentStudent.include"
            type="checkbox"
            @click="check($event)"
            v-model="absentStudentsSelected"
            :value="absentStudent.id"
            checked
        />
        <input
            v-else
            type="checkbox"
            @click="check($event)"
            v-model="absentStudentsSelected"
            :value="absentStudent.id"
        />
        {{ absentStudent.first_name }}

You may have to adjust the expression in the v-if directive, I am not 100% sure about the condition on which you check or don't check the checkboxes.
As an alternative you could manipulate the dom directly in the click handler but that defies the declarative nature of frameworks like vue.


text:
Q: Search for files by content only in trunk subdirectories I think its a simple question, but the answer is probably a little more complicated :P
Edit: Actually, its not complicated at all!^^
So I have a directory with multiple svn projects and I would like to search through all recent files (in trunk folder) by content in all projects.
Here is somewhat the folders look like:
Projects
|
->Project1
|   |
|   ->tags
|   |
|   ->trunk
|
->Project2
|   |
|   ->tags
|   |
|   ->trunk
...

A: As suggested in comments above:
grep -l some-pattern ./Projects/*/trunk/*

or recursively if there are subdirs under each trunk (and your grep supports -r):
grep -lr some-pattern ./Projects/*/trunk/

A: find . -name .svn -prune -o -path '*/trunk/*' -type f -exec grep pattern {} +


text:
Q: How to isolate a selector usable in document.querySelector, from Xpath? There is an element I really want to select with document.querySelector. The problem is that the makers of the site I work on, didn't give any identifier to this element.
It's just one of about 600 spans in the webpage with a huge DOM and I've no desire (nor the spare time) to manually count all spans in the DOM to know what item reference span[n] // n == number to use as it would be a nightmare and there must be some other better way, at least to get the item reference via devtool.
Selection ways I tried so far
I tried to copy "Css path" or "Css selector" and put either inside my code:
let myEl = document.querySelector('CSS-PATH-FROM-DEVTOOL');
myEl.click();

let myEl = document.querySelector('CSS-SELECTOR-FROM-DEVTOOL');
myEl.click();

Yet the element wasn't selected in both cases and no click happened.
Selecting via textDocument isn't good because there are many spans with the same textDocument.
Utilizing Xpath for selection
I understand that in such a "special" case when an element has no IDs, classes, to make it unique and is just one tag of many of the same kind, and neither CSS path or CSS selector helps targeting, then I could use Xpath.
Well, when I copy the Xpath I get:
*[@id="js_30"]/div/ul/li[4]/a/span/span

My question
How could this be used to select the element with document.querySelector?
As I'm new to JS, I tried the following which didn't help, the element won't be clicked:
let myEl = document.querySelector(' *[@id="js_30"]/div/ul/li[4]/a/span/span ');
MyEl.click();

Is there a way to target to select only that particular element, directly?

A: Based on an answer by Utkanos, you can do this:
var elem,
    xpath = '*[@id="js_30"]/div/ul/li[4]/a/span/span',
    jq_sel = xpath
        .substr(14) // remove id part
        .replace(/\//g, ' > ')
        .replace(/\[(\d+)\]/g, function ($0, i) { return ':nth-child(' + i + ')'; });

// add id part: #js_30 > div > ul > li:nth-child(4) > a > span > span
jq_sel = '#js_30' + jq_sel;
 // query element
elem = document.querySelectorAll(jq_sel);
// simulate a mouse click
elem.click();

console.log("*");
console.log("xpath:", xpath);
console.log("jq_sel:", jq_sel);
console.log("elem:", elem);


text:
Q: Intersection with `any` type [EDIT] This question is indeed duplicate; see @jcalz's answer on the linked post :)
Related discussion on TS github: Allowing narrow from any

playground
When I do { a: any } & { a: number }, TypeScript resolves it to { a: any }. However, considering the meaning of intersection type, I think it should be { a: number }, as only values in number type are actually in the intersection of those two types. So I'm not sure about the rationale behind this behavior - maybe it's because any is treated specially?

A: Type intersection
When you intersect two types using T1 & T2, the resulting type has of all the properties in T1, as well as all of those in T2.
If you change your example slightly, to use string instead of any:
type AType = { a: string } & { a: number }

declare const a: AType
a.a // type: string & number

we see that a.a has the combination of the properties of string and number.
In your example, you might expect it to say that a.a was of type any & number, but that's just the same as any.
Type intersection with any
When a type (e.g. number) is intersected with any, any behaves as a subtype (a narrower type, with all the properties of number plus some more). You could say that any extends number. This leads us to the same behaviour as we see below:
type T1 = { a: number, b: number }
type T2 = { a: number }

type Intersection = T1 & T2 // T1 is a subtype of T2, so we get T1

Admittedly, this is unintuitive from the perspective that we expect any to be a wider (more permissive) type, rather than a narrower one. It is a special case.
You would see your expected behaviour if you used {} (the most permissive type) rather than any, because {} adds no properties to number.

A: It's because you are using any at first place which is supertype of number, what you using is type checking of any and number, so means it can be anything, which means it's any!
So any override the number type as it's supertype of number...
In typescript, always use specific type, if not sure about the type, use any...
So putting check for any is exactly like not putting any type check at all...
This is exact words from typescript team for any...

 Any We may need to describe the type of variables that we do
  not know when we are writing an application. These values may come
  from dynamic content, e.g. from the user or a 3rd party library. In
  these cases, we want to opt-out of type-checking and let the values
  pass through compile-time checks. To do so, we label these with the
  any type:

let notSure: any = 4;
notSure = "maybe a string instead";
notSure = false; // okay, definitely a boolean

The any type is a powerful way to work with existing JavaScript,
  allowing you to gradually opt-in and opt-out of type-checking during
  compilation. You might expect Object to play a similar role, as it
  does in other languages. But variables of type Object only allow you
  to assign any value to them - you can't call arbitrary methods on
  them, even ones that actually exist:

let notSure: any = 4;
notSure.ifItExists(); // okay, ifItExists might exist at runtime
notSure.toFixed(); // okay, toFixed exists (but the compiler doesn't check)

let prettySure: Object = 4;
prettySure.toFixed(); // Error: Property 'toFixed' doesn't exist on type 'Object'

The any type is also handy if you know some part of the type, but
  perhaps not all of it. For example, you may have an array but the
  array has a mix of different types:

let list: any[] = [1, true, "free"];

list[1] = 100;


text:
Q: Asp .net mvc 4 specific "select ...." command I am trying to make an ebank, for myself, so it is not that serious. This is my structure:

What I achieved so far: if a user logs in, and click on the Ebank actionlink, for him/her I display ALL of the data (I mean if logged in userId==1 I display all of the data with userId==2 too, this is what I want to change).
public ActionResult Index()
{

     var bankaccounts = db.BankAccounts.Include(b => b.Type).Include(b => b.Balance).Include(b => b.UserProfile);
     return View(bankaccounts.ToList());

}

This "var bankaccounts" row is what I have to change if I am right. If I put a breakpoint to the "return view(bankaccounts.ToList())" row I get the following data from the "bankaccounts":
    {
SELECT
    [Extent1].[BankAccountId] AS [BankAccountId],
    [Extent1].[UserId] AS [UserId],
    [Extent1].[AccountName] AS [AccountName],
    [Extent1].[AccountType] AS [AccountType],
    [Extent1].[AccountNumber] AS [AccountNumber],
    [Extent1].[AccountStatus] AS [AccountStatus],
    [Extent1].[AccountAvaiability] AS [AccountAvaiability],
    [Extent2].[AccountType] AS [AccountType1],
    [Extent2].[TypeName] AS [TypeName],
    [Extent3].[BalanceId] AS [BalanceId],
    [Extent3].[BalanceAmount] AS [BalanceAmount],
    [Extent3].[TrustAmount] AS [TrustAmount],
    [Extent4].[UserId] AS [UserId1],
    [Extent4].[UserName] AS [UserName]
    FROM    [dbo].[BankAccount] AS [Extent1]
    INNER JOIN [dbo].[Type] AS [Extent2] ON [Extent1].[AccountType] = [Extent2].[AccountType]
    LEFT OUTER JOIN [dbo].[Balance] AS [Extent3] ON [Extent1].[BankAccountId] = [Extent3].[BalanceId]
    INNER JOIN [dbo].[UserProfile] AS [Extent4] ON [Extent1].[UserId] = [Extent4].[UserId]}

Questions:
I cannot find any real sql command in the code(its auto generated by mvc), so If I am right

*

*does this "var bankaccounts" row do the sql select?

*If yes, how?

*Where can I read after this type of programming?

*I want to change this code to something like "select ... where userid == websecurity. CurrentUserId", can you help me with this please?

*Any more ideas, advices that I should take or read after? The more you say the more I can learn!

A: You are using a provider like Entity Framework which is providing the mapping from code to your database. Specifically:

*

*In your case, the Sql gets executed when you materialize the query with ToList(). Until the materialization step, var bankaccounts is an IQueryable.

*Entity Framework has a Query provider which knows how to parse the Expressions you give it to Sql statements, and similarly, to map result sets back to entities like BankAccount.

*Sites like MSDN will give you an overview

*Add a Where expression predicate:

var userBankaccounts = db.BankAccounts
                         .Where(ba => ba.UserId == websecurity.CurrentUserId);

The Sql you see is 'real' (sans the curly {} brackets) - once you look past the rather annoying aliasing of tables and derived tables as [Extentxxx], it will allow you to quickly check that your Linq expressions are performing the queries required.


text: Q: Atlys Spartan 6 is not recognized by PC I have a Digilent Atlys Spartan 6 FPGA board which i use to design a custom processor. When I connect the board to power and turn the power switch on, the power LED comes on but no other LED comes lighten up. And the board basically is not recognized by the PC. Does anyone have any idea of how to solve this problem i.e. there might be a mode selection in Atlys Spartan 6 board but I don't know anything about that. Please someone help me out on this phenomena. Thanks in advance :)


text:
Q: CPU Temperature sensor wrong? Everest Ultimate is suddenly telling me that the CPU temperature (and core temps) for my E6850 Core 2 Duo is 72 degrees Celsius. When I stress-test the machine, the temp goes up to 91 degrees and the CPU actually throttles. System remains stable though.
For over a year now, my CPU has run very cool (40's) with a large commercial copper heatsink/fan that I bought separately.
To top it off, I removed the cover of the box and felt the cpu heatsink and it wasn't even warm.
Is there such a thing as a CPU temp sensor showing the wrong readings?
Any tips would help.
UPDATE #1
Temp is also just as high in BIOS. So that leads me to believe it's a CPU seating issue (even though I used thermal paste to seat it two years ago when I built the machine)
UPDATE #2
Well. I removed the heatsink and cleaned off the original thermal paste (which was somewhat crusty). I polished the surface, re-applied some new paste, and reseated the heat sink. After powering it up, there was no noticeable change in the temp - ideling at 74. Ran the stress test and it went up to 94 degrees before being 100% throttled. I let it sit at 94 degrees for 20 minutes straight and the computer didn't even flinch. I then immediately shut it off and opened the case and felt around. The heatsink was completely cold to the touch. Even the copper rods were cold. The area near contact with the CPU was slightly warm but not hot to touch.
Then I ran REALTEMP, which is supposedly more accurate and it told me the CPU was at 104 degrees. (LOL)
At this point, I'm thinking no doubt the cpu's sensor is wrong. Sidenote: the BIOS has the latest version so no option to flash there. Reverting hasn't been known to help from what I've read.
What angers me is the false temps force the CPU to artificially throttle from 3GHz down to 2GHz and my CPU fan is cranking at full force all the time.
Should I call intel and tell them to send me another E6850?
SOLUTION UPDATE
I switched the processor out with another one and got the same obscene temperatures with the new processor followed by a heatsink that was cool to touch. My suspicion in the heatsink was suddenly renewed. I swapped it out with the stock heatsink/fan and lo and behold the temperatures returned to the normal 35C-50C. Even though the thermal paste was visibly flattened out every time I removed it, it looks like the heatsink was still not pressing hard enough on the CPU to effectively conduct the heat. The heatsink is a Masscool 8Wa741, which screws into a standard position on a mount on the back of the MOBO. Only thing I can surmise after 2 years of use was that, over time, the heatsink pressure on the CPU gave way until the heat began to be ineffectively conducted.
Lessons learned:

*

*Intel CPU's can run SUPER HOT (upwards of 95C) and still be stable.

*Heatsink's need to be VERY firmly pressed against the CPU to conduct heat.

A: It could be a bad sensor, but I wouldn't wager on it. Check layer of conduction paste, seems like that could be the problem.

A: I had same overheating problem with intel i5-661 and ASUS P7H55M mobo. This has a push-fit heatsink and fan and one of the push-fit posts had come loose. PC was switching off at 93 celsius. Fixed push-fit retaining post for fan and normal operation at 46 celsius resumed.

A: If the fan is very cool and the processor is reporting very hot, I would first suspect the connection between the fan/heatsink and the processor package. Make sure the heatsink is properly seated with thermal paste.
Let's get some terminology straight from Lavalys' KB:

*

*CPU Diode or Core temperature is the temperature measured across a temperature sensitive diode on the processor die. The most common implementation uses a temperature sensor part external to the processor with the CPU Thermal Diode Anode (+) and Cathode (-) connections to it.

*CPU Temperature is the temperature measured by a remote temperature sensors part on the motherboard near the CPU.

It is possible for these temperature sensors to fail although I haven't seen it personally.
Try installing a different processor and see if the readings are still incorrect. This can help point to where the problem lies. If the readings are OK, I would suspect your processor, if they are off as well, then suspect the parts on the board.
Unfortunately, if it isn't the heatsink, there is no easy user fix other than replacing the offending part.

A: I think your temperature sensor is wrong. As all third party software uses the same sensor of the board they all show the same result.
You already checked the heat sink and processor immediately after shutdown and found
it's cool. Check once again to assure it.
If the wrong sensor boosts up the speed of the processor fan, the fan noise becomes uncomfortable. You can overcome this by installing SpeedFan. It can reduce the speed. For this to work correctly you should disable the automatic fan speed control of your CPU from the BIOS setup. After disabling it, reboot again and run SpeedFan. Reduce the speed to 50%. This will put your PC in a silent state.
You can also check if the CPU temperature rises while you reduce speed to 50%. If not,
definitely the readings from the thermal sensors are wrong.

A: Once you have lm-sensors installed, make sure you run sensors-detect from command line, which will detect your sensors and give you a more thorough read out.
Another handy piece of code, is a coretemp script
function coretemp {

   /usr/bin/clear;

   while : ; do

      /usr/bin/sensors | /bin/grep ^Core | while read x; do

         /usr/bin/printf '% .23s\n' "$x";

done; /bin/sleep 1 && /usr/bin/clear; done; }

Then you just type 'coretemp' into your terminal and it gives you realtime stats on each of your cores.

A: while defective sensing components are not unheard of, they are certainly not common.  I'd be looking at the mechanical connection between the heatsink and the cpu.
is it possible that you have too much heat transfer agent installed?

A: If your temperature reading is immediately over 50C or 60C in the BIOS from a cold boot, a sensor is definately defective somewhere.  Even running without a heatsink from cold boot wouldn't get that hot that fast.


text:
Q: Accessing DOM elements in C# I am using the mshtml namespace to access DOM elements as returned by a COM Browser object.
My code is roughly as follows
object missing = Type.Missing;
ie.Navigate("http://website.com", ref missing, ref missing, ref missing, ref missing);
mshtml.HTMLDocument theDoc = (mshtml.HTMLDocument)ie.Document;
mshtml.HTMLDivElement myDiv = (mshtml.HTMLDivElement)theDoc.getElementById("divID");

Now, up to this point, myDiv is a DivElement.
But, the webpage itself contains more DIV's under "divID". That is, there are many layers of nested DIVs.
But the myDIV object is of type mshtml.HTMLDivElement, which provides me with no function to retrieve more DIVS as its children.
What can I do in this case? Assuming I have more DIV's I need to retrieve in a nested fashion?

A: You might have already figured this out, but just in case... You should be able to cast myDiv object to IHTMLElement interface and use its 'children' property to iterate myDiv's children.


text:
Q: Can't use jQuery to override inline style generated by jQuery? My code is forking this pen, I also include my code in the stack snippet under this post.
what I want to achieve are:

*

*When the cursor is not inside the body, the eyeball would move randomly ( achieved ).

*When the cursor enters the body, the eyeball follows the cursor ( achieved ).

*When the cursor leaves the body, the eyeball starts moving randomly again ( not achieved ).
I called the function which is used to move the eyeball randomly in on("mouseleave") event, and it does move to a random position but it will immediately go back to the last cursor position, rather than staying at the new position. Can anyone point me to the right direction to fix the problem?
Thanks!

var
 mouseOvering = false,
 pupil = $("#pupil"),
 eyeball = $("#iris"),
 eyeposx = 40,
 eyeposy = 20,
 r = $(pupil).width()/2,
 center = {
  x: $(eyeball).width()/2 - r,
  y: $(eyeball).height()/2 - r
 },
 distanceThreshold = $(eyeball).width()/2 - r,
 mouseX = 0,
 mouseY = 0;

$("body").ready( function(){
 if ( !mouseOvering ) {
  moveRandomly();
 }
});

$("body").on('mouseleave', function(){
 mouseOvering = false;
 moveRandomly();
 console.log("mouseleave");
});

$("body").on('mousemove', function(e){
 mouseOvering = true;
 console.log("mouseovering");
 followCursor(e);
});

function moveRandomly() {
 var loop = setInterval(function(){
   var xp = Math.floor(Math.random()*80);
    var yp = Math.floor(Math.random()*80);
  pupil.animate({left:xp, top:yp});
 }, 3500);
}

function followCursor(e) {
    var d = {
  x: e.pageX - r - eyeposx - center.x,
  y: e.pageY - r - eyeposy - center.y
    };
    var distance = Math.sqrt(d.x*d.x + d.y*d.y);
    if (distance < distanceThreshold) {
  mouseX = e.pageX - eyeposx - r;
  mouseY = e.pageY - eyeposy - r;
    } else {
  mouseX = d.x / distance * distanceThreshold + center.x;
  mouseY = d.y / distance * distanceThreshold + center.y;
    }
    var xp = 0, yp = 0;
 var loop = setInterval(function(){
  // change 1 to alter damping/momentum - higher is slower
  xp += (mouseX - xp) / 1;
  yp += (mouseY - yp) / 1;
  pupil.css({left:xp, top:yp});
 }, 2);
}
body {
  background-color: #D1D3CF;
}

#container {
  display: inline;
  height: 400px;
  width: 400px;
}

#eyeball {
  background: radial-gradient(circle at 100px 100px, #EEEEEE, #000);
  height: 300px;
  width: 300px;
  border-radius: 100%;
  position: relative;
}

#iris {
  top: 10%;
  left: 10%;
  background: radial-gradient(circle at 100px 100px, #4DC9EF, #000);
  height: 80%;
  width: 80%;
  border-radius: 100%;
  position: absolute;
}

#pupil {
  top: 10%;
  left: 10%;
  background: radial-gradient(circle at 100px 100px, #000000, #000);
  height: 55%;
  width: 55%;
  border-radius: 100%;
  position: absolute;
}

@keyframes move {
  50% {
    transform: translate(-50px, 50px);
  }
}

@keyframes move2 {
  50% {
    transform: translate(-20px, 20px);
  }
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <link rel="stylesheet" href="style.css">

A: With Javascript you can only track where the cursor is on the webpage. If you shift your cursor outside the body, it's not possible for your code to know where the cursor is.
This is the reason the eye tracking your cursor stops moving when you move your cursor outside the window.

A: The problem is that once the followcursor function was started it kept on moving back to the last known mouse position, even after the mouse had left the body. I just put a check on your mouseOvering variable inside your followcursor function:

var
 mouseOvering = false,
 pupil = $("#pupil"),
 eyeball = $("#iris"),
 eyeposx = 40,
 eyeposy = 20,
 r = $(pupil).width()/2,
 center = {
  x: $(eyeball).width()/2 - r,
  y: $(eyeball).height()/2 - r
 },
 distanceThreshold = $(eyeball).width()/2 - r,
 mouseX = 0,
 mouseY = 0;

$("body").ready( function(){
 if ( !mouseOvering ) {
  moveRandomly();
 }
});

$("body").on('mouseleave', function(){
 mouseOvering = false;
 console.log("mouseleave");
});

$("body").on('mousemove', function(e){
 mouseOvering = true;
 console.log("mouseovering");
 followCursor(e);
});

function moveRandomly() {
 var loop = setInterval(function(){

   var xp = Math.floor(Math.random()*80);
    var yp = Math.floor(Math.random()*80);
        if (!mouseOvering) {
     pupil.animate({left:xp, top:yp});
        }
 }, 3500);
}

function followCursor(e) {
    var d = {
  x: e.pageX - r - eyeposx - center.x,
  y: e.pageY - r - eyeposy - center.y
    };
    var distance = Math.sqrt(d.x*d.x + d.y*d.y);
    if (distance < distanceThreshold) {
  mouseX = e.pageX - eyeposx - r;
  mouseY = e.pageY - eyeposy - r;
    } else {
  mouseX = d.x / distance * distanceThreshold + center.x;
  mouseY = d.y / distance * distanceThreshold + center.y;
    }
    var xp = 0, yp = 0;
 var loop = setInterval(function(){
  // change 1 to alter damping/momentum - higher is slower
  xp += (mouseX - xp) / 1;
  yp += (mouseY - yp) / 1;
        if (mouseOvering) {
  pupil.css({left:xp, top:yp});
        }
 }, 2);
}
body {
  background-color: #D1D3CF;
}

#container {
  display: inline;
  height: 400px;
  width: 400px;
}

#eyeball {
  background: radial-gradient(circle at 100px 100px, #EEEEEE, #000);
  height: 300px;
  width: 300px;
  border-radius: 100%;
  position: relative;
}

#iris {
  top: 10%;
  left: 10%;
  background: radial-gradient(circle at 100px 100px, #4DC9EF, #000);
  height: 80%;
  width: 80%;
  border-radius: 100%;
  position: absolute;
}

#pupil {
  top: 10%;
  left: 10%;
  background: radial-gradient(circle at 100px 100px, #000000, #000);
  height: 55%;
  width: 55%;
  border-radius: 100%;
  position: absolute;
}

@keyframes move {
  50% {
    transform: translate(-50px, 50px);
  }
}

@keyframes move2 {
  50% {
    transform: translate(-20px, 20px);
  }
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <link rel="stylesheet" href="style.css">


text:
Q: Python 3.3.2 on Windows - MysqlDB & pymysql I'm on Windows 8 using Python 3.3.2 , trying to connect to mysql online via ssh(putty) already running
I tried installing mysqldb using
pip install MySQL-python

but i get this LOG
When I try to connect using pymyqslafter after installation with this code
conn = pymysql.connect(host='127.0.0.1', unix_socket='/tmp/mysql.sock', user='bitnami', passwd=None, db='extractor')
cur = conn.cursor()
cur.execute("SELECT * FROM eaexpress")
for response in cur:
    print(response)
cur.close()
conn.close()

I get this error:
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\pymysql\connections.py", line 780, in _connect
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
AttributeError: 'module' object has no attribute 'AF_UNIX'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Jonathan\Desktop\python.py", line 19, in <module>
    conn = pymysql.connect(host='127.0.0.1', unix_socket='/tmp/mysql.sock', user='bitnami', passwd=None, db='extractor')

File "C:\Python33\lib\site-packages\pymysql\__init__.py", line 88, in Connect
    return Connection(*args, **kwargs)

File "C:\Python33\lib\site-packages\pymysql\connections.py", line 634, in __init__
    self._connect()
File "C:\Python33\lib\site-packages\pymysql\connections.py", line 818, in _connect
    2003, "Can't connect to MySQL server on %r (%s)" % (self.host, e))
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' ('module' object has no attribute 'AF_UNIX')")
 >>>

I'm connected to myphpadmin via ssh , it does load well on browser. Unless there is a way for python to connect using openssh or ppk file without the need of ssh, that would be even better but before that. I would have to fix these issue in connection.
Any advice in connecting to mysql on my server?

A: There is the huge list of Unofficial Windows Binaries for Python Extension Packages which are extremely useful for Windows users.
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Go to the link and search for MySQL-python and install it and you are good to go.
Cheers !


text:
Q: ¿Cómo puedo copiar las propiedades de un objeto que se encuentra dentro de otro? Tengo un array de objetos ejemplo:
[{
 id: 123,
 name: 'test',
 description: 'this is a test product'
 cart: [
  {
   id: 124,
   price: 500,
   qty: 3
  },
  {
   id: 125,
   price: 500,
   qty: 3
  }
 ],
 image: '',
 subtotal: 'Aquí quiero poner la suma de los objetos hijos"
}];

Como podría recorrer ese array de objetos y el array de objetos que se encuentra interno para poder copiar la propiedades del objeto hijo pasarlas al objeto padre?
Este proceso lo hago en mi action de un module en vuex.
Edit:
Estoy intentando realizarlo de esta manera, no se si sea le mejor y la correcta de todas formas no me hace la operación.
for (let i = 0; i < data.length; i++) {
  const newObject = data[i]
  let total = 0

  for (let j = 0; j < newObject.cart.length; j++) {
    let op = newObject.cart[j]
    total += op.price * op.qty
  }

  data[i].subtotal = total
}

Muchas gracias por su ayuda.

A: Puedes probar con forEach para recorrer los arrays, en tu caso seria algo asi:

let arr=[{
    id: 123,
    name: 'test',
    description: 'this is a test product',
    cart: [
     {
      id: 124,
      price: 500,
      qty: 3
     },
     {
      id: 125,
      price: 500,
      qty: 3
     }
    ],
    image: '',
    subtotal: 'Aquí quiero poner la suma de los objetos hijos'
}];

arr.forEach(e=>{
  let subTotal=0;
  e.cart.forEach(p=>{
    subTotal+=p.price*p.qty;
  })
  e.subtotal=subTotal;
});
console.log(arr[0].subtotal);

Espero que te sirva, saludos.

A: Una opción usando map() y reduce():

const arr = [{"id":123,"name":"test","description":"this is a test product","cart":[{"id":124,"price":500,"qty":3},{"id":125,"price":500,"qty":3}],"image":"","subtotal":3000}];

const res = arr.map(e => {
  e.subtotal = e.cart.reduce((p, c) => p + (c.price * c.qty), 0)
  return e;
});

console.log(res);


text:
Q: Using Xcode 4 on multiple Macs with a git repository created by Xcode I have two Macs that I develop from, one an iMac and one a MacBook Air. I am starting to work more on both machines and I would like to easily share the code between the two.
My iMac is always on, and usually I am only coding at home anyways, so it depends on where I want to be if I am coding on the MacBook or iMac.
When setting up a new project in Xcode 4, it asks you if you want to create a git repository for your project. If I say yes (on my iMac) is there a way I can connect to this repo from my MacBook?
If so, how is this done? If I add a location, it will see my iMac, but im not sure what to set up after that. And do I have to do this for each project?
EDIT: When I try to add the remote repository in Xcode, while it says Host Reachable, I eventually get an error that access to the Repository is denied.

A: Make sure that "Remote Login" (ssh) is enabled in the "Sharing" section of your system preferences.
I suggest generating an SSH keypair as well, this will make the whole process smoother (as long as you understand the potential risk).

A: Would you be willing to do so outside of XCode 4? I don't think this is possible in Xcode 4, but from console, you can add a git remote to the MBA or iMac from each of them and pull and push between them as and when you desire. You can probably even set a post-commit hook in each of them to push to the other after every commit and that way you don't have to care about the sync. And why don't you start by copying over the project from one to the other rather than creating a new one?

A: I managed this quite easily by using normal file sharing under OS X.  After creating the repository on my iMac, I navigated to my iMac over the network from my MacBook, mounted my home directory by clicking on it.  Once the volume is mounted you can then refer to it from the route directory under the Volumes folder.  So in xCode, when asked for the repository location you can use /Volumes/etc/etc
This worked first time for me, no need to enable SSH or play around in Terminal, just make sure you have File Sharing enabled.


text:
Q: Active Record Setup Login this is what I have so far:
A Content class that belongs to the User class:
class Content < ActiveRecord::Base
  belongs_to :user
end

Here is what my User class looks like:
class User < ActiveRecord::Base
  has_many :contents
end

And here is what my schema.rb looks like:
ActiveRecord::Schema.define(version: 20150723165743) do

  create_table "contents", force: :cascade do |t|
    t.string   "content"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "user_id"
  end

  create_table "users", force: :cascade do |t|
    t.string  "username"
    t.string  "password"
    t.string  "email"
    t.integer "content_count"
  end

end

I have a for set up in html that sends a post request to the application_controller.rb and this is what it looks like:
HTML:
<form action="/login" method="post" accept-charset="utf-8">
  <input type="text" name="username" placeholder="Username"/>
  <input type="password" name="password" placeholder="Password"/>
  <!-- <input type="hidden" name="login" value="true"/> -->
  <button type="submit">Login</button>
</form>

application_controller.rb
post '/signup' do
    @password=params[:password]
    @confirm_password=params[:confirm_password]
    @error=""

    if @password!=@confirm_password
      @error="passwords do not match"
    # elsif username is already taken
      # @error="username already exists"
    else
      @user= User.new({:username => params[:username], :password => params[:password], :email => params[:email]})
    end
    erb :welcome
  end

  post '/login' do
    @username=params[:username]
    @password=params[:password]
    # if user credentials are correct
    erb :index
    # else error message
    erb :login_error

How would I make it so that it check that the username matches the password in the Users database.
This is what I found to put in the User class, but I do not know how to use it:
  def self.authenticate_safely_simply(user_name, password)
    where(user_name: user_name, password: password).first
  end

Secondly how would I make it return the user_id so that I can use it in the next page. I would like to make it so when the user creates new content it adds the user_id to the content the user create in the content table.
I hope I am clear enough. Please let me know if I am not.
Thank you very much.

A: Storing plain text passwords is insecure.You can use ActiveModel has_secure_password for secure authentication using password. In order to use it you need bcrypt-ruby gem in you Gemfile, and your users table need to have a field called password digest. You can find a complete example gist here
.


text:
Q: PHP Warning: Unknown: failed to open stream I edited the apache httpd.conf file recently for the mod_rewrite to work. I don't know if this problem originated from that or not, but i'm getting this problem from that day.
This is what I see on the frontend when I run the software -

Server error The website encountered
  an error while retrieving
  http://localhost/prestashop/. It may
  be down for maintenance or configured
  incorrectly.

There is no specific file that triggers this. But I saw that usually small programs that consists of 4-5 php files, runs fine, but softwares with a lot of files(like PrestaShop) don't.
I checked the logs and this is what I found.
[Wed Mar 16 19:33:39 2011] [error] [client ::1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Mar 16 19:33:39 2011] [error] [client ::1] PHP Fatal error:  Unknown: Failed opening required '/var/www/html/yomig/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
[Wed Mar 16 19:33:39 2011] [error] [client ::1] File does not exist: /var/www/html/favicon.ico
[Wed Mar 16 19:33:41 2011] [error] [client ::1] PHP Warning:  Unknown: failed to open stream: Permission denied in Unknown on line 0
[Wed Mar 16 19:33:41 2011] [error] [client ::1] PHP Fatal error:  Unknown: Failed opening required '/var/www/html/yomig/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0

A: It is a SELinux blocking issue, Linux prevented httpd access. Here is the solution:
# restorecon '/var/www/html/wiki/index.php'
# restorecon -R '/var/www/html/wiki/index.php'
# /sbin/restorecon '/var/www/html/wiki/index.php'

A: Here some guide how to fix it. Go to :
cd /var/www

sudo chown www-data:www-data * -R

sudo usermod -a -G www-data username

Change userneme with your username. I hope it help.

A: I got this problem when insert wrong file address into .htaccess
php_value auto_prepend_file "/home/user/wrong/address/config.php"

So if you use auto_prepend_file check your file path. It called from .htaccess so PHP can't determine error file and line.

A: In my mind true way is:
# add READ permission to all directories and files under your DocumentRoot
sudo chmod +r /path/to/DocumentRoot/ -R

# add EXECUTE permission to all DIRECTORIES under your DocumentRoot
find /path/to/DocumentRoot/ -type d -exec chmod +x {} \;

A: I just came across of this same problem and in my case it was caused by selinux. Disabling it solved the issue. And no, I don't need selinux on my workstation, thank you.

A: If you are running Fedora, make sure SELinux is not interfering.You fix this with this command:
    sudo /sbin/restorecon -R /var/www/

More info here: linuxquestions.org/questions/linux-server-73/

A: It happened to me today with /home/user/public_html/index.php and the solution was to do chmod o+x /home/user as this directory has to have the X as otherwise the apache server can't list files (i.e. do ls)

A: Experienced the same error, for me it was caused because on my Mac I have changed the DocumentRoot to my users Sites directory.
To fix it, I ran the recursive command to ensure that the Apache service has read permissions.
sudo chmod -R 755 ~/Sites

A: I had the same error and my problem was the file permissions were incorrect.
chmod 755 index.php

worked for me.

A: This also happens (and is particularly confounding) if you forgot that you created a Windows symlink to a different directory, and that other directory doesn't have appropriate permissions.

A: Just quote for above answer of user1992554
This one worked perfectly for me in Linux Mint, to get rid of Warning: failed to open stream: Permission denied
cd /var/www
sudo chown www-data:www-data * -R
sudo usermod -a -G www-data username

A: In Fedora 25, it turned out to be an SE Linux issue, and the notification gave this solution which worked for me.
setsebool -P httpd_read_user_content 1

A: In my case the group _www that apache uses was missing in the folder's access list, so first I had to add the missing group, like so:
sudo chown -R _www ~/path-to-folder

Change _www to whatever user or group that apache is running as.
Find out apache's user/group using apachectl -S
The output is huge, but look at the very end something like:
User: name="_www"
Group: name="_www"

A: This isn't a direct answer to the question, but I had the same problem. I installed VSFTPD on my Ubuntu Server VPS. I could upload files, but every file I uploaded didn't have execution permissions (all files had rights "600"). These posts explain explain exactly what you have to do to configure your VSFTPD to set default rights on your files:

*

*Default File Permissions Apache /var/www/

*vsFTPd default uploaded file permissions on Ubuntu not working

A: Once, this happens to me as well. and when I googled the matter, I got to know that this happens when the permissions on the file is wrongfully set to 000 (which means that no one can read, write, or execute that file). Then I just changed my file permission privilege into Read & Write and it's worked for me.
To change file permission settings on mac: Right click on the particular file and click on Get info from dropdown menu and refer to the sharing and permissions panel and change privilege settings into Read & Write
More: http://www.itoctopus.com/warning-unknown-failed-to-open-stream-permission-denied-in-unknown-on-line-0-error-in-joomla

A: Check dos and unix file format. This problem is seen on linux platforms if dos file format is used. Use doc2unix command like below and then retry it should work
dos2unix *.php
This solution for below problem
Wed Nov 12 07:50:19 2014] [error] [client IP1] PHP Warning: Unknown: failed to
    open stream: Permission denied in Unknown on line 0
[Wed Nov 12 07:50:19 2014] [error] [client IP1] PHP Fatal error: Unknown: Failed
    opening required '/var/www/html/index.php' (include_path='.:/usr/share/pear:
    /usr/share/php') in Unknown on line 0

A: Go to folder htdocs
cd htdocs
Execute
chmod -R 755 sites
No need to sudo !

A: Except the permissions, the problem can be open_basedir. If you are using it (and I suggest to use it) then check the settings at the VirtualHost :
 php_admin_value open_basedir <YOUR ROOT>