text:
Q: Esto soluciona el salto de línea ¿Habría otra forma de hacerlo? Tengo un código que permite quitar el salto de línea de una string a otro por ejemplo:
Tenia un String así :

"Nuestro sistema de dos" & vbCrLf & "cámaras más avanzado." & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf & vbCrLf &
"Resistente de arriba abajo." & vbCrLf & "Y de un borde a otro." & vbCrLf & "Un chip superrápido" & vbCrLf & "que deja atrás" & vbCrLf & "a la competencia."

Dim str3 As String = ""

            For lPos As Integer = 0 To texto.Count - 1
                Dim letra As String = texto.Chars(lPos)
                'Si la posicion del texto es menor que el contenido de cantidad del texto -1 entonces
                If (lPos + 2) < texto.Count - 1 Then
                    'Si letra = vbCr y el caracter el texto(posicion+1) = vbLf y caracter del texto(posicion+2) = vbcr
                    If letra = vbCr And texto.Chars(lPos + 1) = vbLf And texto.Chars(lPos + 2) = vbCr Then
                        'posicion = posicion+1
                        lPos = lPos + 1
                    Else
                        'Concatena las letras
                        str3 = str3 + letra
                    End If
                Else
                    'Concatena las ultimas letras
                    str3 = str3 + letra
                End If

            Next

            Return str3

Con esto le había solucionado

A: Podrías remplazar los saltos de línea con el Objeto Strings y la función Replace , algo de hacer-lo así
Texto = Strings.Replace(Texto, vbCrLf , Space(1), -1, CompareMethod.Binary )


text:
Q: need return from callback function I have looked through other post, but couldn't figure this out.  I am getting an array of values from JQuery.  I have to call a function which makes an ajax request for each item in the array.  I need the total score for each item to be return so I can push it to an array. I am having trouble setting up my callback function and keep getting undefined.
$('#btnSave').click(function() {
  //creates array of id's
  var checkedValues = $('.checkedbox:checked').map(function() {
    return this.id;
  }).get();
  var scoreArr = []
  for (i = 0; i < checkedValues.length; i++) {
    //calls function with array
    printEvaluation(checkedValues[i], 'cb')

    console.log(totalEvalScore) //gives me UNDEFINED
    scoreArr.push(totalEvalScore)
  }
})

function printEvaluation(id, callback) {
  //some code here

  $.ajax({
    url: queryURL,
    method: 'GET'
  }).done(function(res) {

    //response and some more code
    //score is calculated
    var totalEvalScore = calculatedscore

    function cb() {
      return totalEvalScore
    }

    cb()
  })
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: OpenCV c++ findHomography not returning same results I am stitching three images. Now I wanted to implement warp perspective on the left side (image A and B) and right side (image B an C). I am able to compute both H matrices, but with some wierd behaving.
When I am computing A + B + C. It will do firstly B + C, then A + B. Here the H matric for AB is incorrect, but I dont know why!
When I will do only  A+B then I will recieved "correct values". I tried everything, so I came here. It seems like there is some junk behind after computing B+C, but even I tried .clear() and .release() everything, still same behaving, I also tried to use .clone() everywhere - didnt help. I also checked if correct images are feeded in, yes they are.
I will try to simplify my code as much I can do:
    // Stitcher variables
    std::vector<std::pair<Mat, Mat>> images_toCalc;
    std::vector<Mat> images;
    std::vector<Mat> Hs;

    //MAIN
    images[2] = imread("E:/JOB/StitchingProject/StitchingApp/x64/Debug/i/left.jpg");
    images[1] = imread("E:/JOB/StitchingProject/StitchingApp/x64/Debug/i/mid.jpg");
    images[0] = imread("E:/JOB/StitchingProject/StitchingApp/x64/Debug/i/right.jpg");
    stitcher->setImages(images, 3);
    stitcher->runStitching2(false);

    // runStitching2
    for (int i = 0; i < this->images.size() - 1; i++) {
        Mat image1 = this->images.at(i).clone();
        Mat image2 = this->images.at(i + 1).clone();
        //if (true) {
        if (!isHalfAlready(i)) {
            flip(image1, image1, 1);
            flip(image2, image2, 1);
            this->images_toCalc.push_back(std::make_pair(image2.clone(), image1.clone()));
        }
        else {
            this->images_toCalc.push_back(std::make_pair(image1.clone(), image2.clone()));
        }
    }
    for (int i = 0; i < images_toCalc.size(); i++) {
        Mat H;
        H = this->calcH(images_toCalc.at(i).first, images_toCalc.at(i).second);
        this->Hs.push_back(H);
        H.release();
        if (this->debugLevel[3]) cout << "[" << i << "] H" << endl << Hs.at(i) << endl;
    }

Now the buggy part
    // this->calcH
    Mat heStitcher::calcH(Mat& image1_toCalc, Mat& image2_toCalc) {
    std::vector< KeyPoint > keypointsObject, keypointsScene;
    Mat descriptorsObject, descriptorsScene;
    Mat image1, image2;
    image1 = image1_toCalc.clone();
    image2 = image2_toCalc.clone();

    if (greyCalc) {
        cv::cvtColor(image1, image1, cv::COLOR_BGR2GRAY);
        cv::cvtColor(image2, image2, cv::COLOR_BGR2GRAY);
    }

    Ptr<SURF> detector = SURF::create();
    detector->detectAndCompute(image1, Mat(), keypointsObject, descriptorsObject);
    detector->detectAndCompute(image2, Mat(), keypointsScene, descriptorsScene);
    detector->clear();

    vector<std::vector<DMatch>> matches;

    Ptr<FlannBasedMatcher> matcher = cv::FlannBasedMatcher::create();
    matcher->knnMatch(descriptorsObject, descriptorsScene, matches, 2);
    matcher->clear();

    double min_dist = 100;
    double max_dist = 0;

    std::vector< DMatch > goodMatches;

    for (size_t i = 0; i < matches.size(); i++) {
        if (matches[i][0].distance < 0.75f * matches[i][1].distance) {
            goodMatches.push_back(matches[i][0]);
        }
    }

    std::vector< Point2f > obj;
    std::vector< Point2f > scene;

    for (int i = 0; i < goodMatches.size(); i++) {
        obj.push_back(keypointsObject[goodMatches[i].queryIdx].pt);
        scene.push_back(keypointsScene[goodMatches[i].trainIdx].pt);
    }

    cv::Mat H;
    cv::Mat H2;
    if (obj.size() < 4) {
        if (this->debugLevel[2]) cout << endl << "!!!!!! not enough similarities (less than 4) !!!!!!" << endl;
    }
    else {
        H = findHomography(obj, scene, RANSAC);
    }
    image1.release();
    image2.release();
    descriptorsObject.release();
    descriptorsScene.release();
    keypointsObject.clear();
    keypointsScene.clear();
    obj.clear();
    scene.clear();
    goodMatches.clear();
    matches.clear();
    H2 = H.clone();
    H.release();
    return H2;
}

After this warpPerspective, border cutting etc, results with matrices in picture 1 a 2. (from where obviously matrices are incorrect). I cannot understant, why when using same script, with same procedure, I am getting different ressults.


text:
Q: create hashtags inside the android ediitext I want to display hashtags in the android Edit-text when user types the keyword, and then hits "Space" then Edit-text takes that keyword automatically. here i have attached one screen shot. i need that kind of functionality.User can also remove the hashtag individually and all the hashtags by clicking cancel button.
Need functionality exactly same like when we entering the tags in the stackoverflow when asking a question.

A: Check this library - it provides basically the same functionality as you requested.


text:
Q: Bootstrap Navbar align few links to right (non collapsible) I want to align the contact info on the right side of navbar but I do not want it to collapse on mobile phone resolution.
Would be perfect if it could realign in the center on mobile phones.
Currently, it looks like this:

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    Toggle Navigation

                </button>

Pagrindinis

Galerija

vytas.velick@gmail.com

52521624

FACEBOOK


text:
Q: Trying to get all li tags inside ul using beautifulsoup I'm trying to get all the urls of the popular articles on Forbes. Each url is inside li tag and all the li tags are inside one ul tag. I tried everything I found online but couldn't get what I wanted. Can someone advise me what to do?

A: First, find ul:
ul = soup.find()

Then, get all li:
ul.findAll()


text:
Q: how do you minimize a Silverlight full-screen out of browser app? How do you minimize a Silverlight out of browser app that is running full screen with no border? I can't find any documentation on this. I know it's possible, because the Flickr Windows 7 app (which is a OOB SL app) can do it (http://www.flickr.com/Windows7).
The Host or Host.Content properties in the Application doesn't appear to have anything available to solve this. Nor do the Page or UserControl classes.
Any thoughts?

A: Application.Current.MainWindow.WindowState = WindowState.Minimized;
Should work.
Says that it requires it to be done in response to a user action or there's a security error, just like going full screen.


text:
Q: How can I restrict user from modifying file in a document library but be able to change the meta-data for the file How can I restrict user from modifying file in a document library but be able to change the meta-data for the file.

A: If you use content types, you can restrict the choices available in metadata editing, but otherwise, I think the permission levels on the document and it's metadata are the same.

A: I can suggest a solution that might work. You can create an event handler, calculate a checksum for a file on ItemAdded event and save it in the hidden field in the same list item. Then on the ItemUpdating event you can compute a checksum for a new file, compare with the saved one and cancel the update if they are not equal.


text:
Q: read XML from PHP to pass in to JavaScript Can I pass an xml file to JavaScript by PHP like this:
     <?php
        $xmlDoc = new DOMDocument('1.0');
        $xmlDoc->formatOutput = true;
        $xmlDoc->load("customer.xml");
        echo $xmlDoc->saveXML();
        $strXml = $xmlDoc->saveXML();
        return $strXml;
        ?>

when I try to do this I get null in the server response in this line in JavaScript
var serverResponse = xHRObject.responseXML;

but,
     var spantag = document.getElementById("example").innerHTML =
        xHRObject.responseText;

will print out the information and also prompt(spantag); will prompt the whole xml document. But I want to use the tag names. So that I need to use
var header = serverResponse.getElementsByTagName("book");

but this gives me an error since the xHRObject.responseXML is null. Please tell me what I'm doing wrong?
var xHRObject = false;
if (window.XMLHttpRequest)
{xHRObject = new XMLHttpRequest();}
else if (window.ActiveXObject)
{xHRObject = new ActiveXObject("Microsoft.XMLHTTP");}
function validate(){
    xHRObject.open("GET", "login.php", true);
    xHRObject.onreadystatechange =test;
    xHRObject.send(null); }
function test(){
    if ((xHRObject.readyState == 4) &&(xHRObject.status == 200))
        {var serverResponse = xHRObject.responseXML;
        var header = serverResponse.getElementsByTagName("customer");
        var spantag = document.getElementById("err")= xHRObject.responseText;}}

I can output via the prompt the span tag it'll give me a xml file but when I output serverResponse it'll give a null. that means responseText have a value but response xml doesn't.
Customer.xml has customers as the main tag and then I have added two customers in a customer tag. then firstname surname email tags are there.

A: Try using echo $xmlDoc instead of a simple return, which doesn't actually generate any content. Passing it VIA an ajax call (which I'm assuming you are) requires that you echo or print some content on the called page.

A: Unfortunately I can't use jQuery for this.
I found the answer to the question. Actually some one taught me the problem was in my php file. I had to add the header text to that:
header('Content-Type: text/xml');


text:
Q: Copy & Paste items from one view to another within storyboard without referencing outlets? When I copy and paste, (cmd-c, cmd-v) items from one view to another in Storyboard it also copies and pastes the items referencing outlets.
Obviously, it's achievable by going in and deleting the referencing outlets one by one. Which is what I want to avoid.
I'm looking for something akin to (dare I say it) Excel's 'paste special' command.
UPDATE
Nope, doesn't work in xcode 5.1 either, see image below, hopefully it succinctly shows you what is going on.

The image shows a view at the top, Add Expense View Controller, another view at the bottom, the name's beside the point, I've copied my cells from Add Expense View Controller, lo & behold it's got the old references in there. You can also see I'm using xcode 5.1...
So - how do you, or is it simply not possible, copy and paste without these references?
Interestingly there is a paste special option in the Edit menu, but in Xcode's menu definitions in the documentation there is no definition for "Paste Special"...

A: Seems like they fixed it on Xcode 5.1. Both copy/paste and option+drag doesn't copy the referencing outlets.


text:
Q: Vlookup function generating duplicate values, how can I fix this please? Hy Every Body, I have two excel sheets name as "Blotter" and "Opportunity", I want to use "Vlookup" Function in Opportunity so that I can find out which opportunity is available in the blotter sheet. Please take a look at the Blotter sheet as under

In the Column B the Opportunities are available.
Now please look at the opportunity sheet.

In the opportunity sheet I am using this function.

=IF(D2 = "","",VLOOKUP(D2,blotter,10,0))

It working fine with first five rows but later it start duplicate the same value multiple time, because behind these cell on the blotter sheet the column B has Piad/place status instead of opportunity. So it duplicate the next opportunity. I have tried many tricks like match, index, but in vain.
I know it can be fixed. I have google it and also try to find it via youtube but unable to fix it.

A: I don't think it can be done without an intermediate column.  The position of the next value in the lookup key depends on where the position of the last successful lookup was, so in a way the lookup chain is path dependent and I don't think you can build path dependency with any ease inside an Excel formula.
In the below example you get something akin to what I think you want by calculating how many spaces there are to the next valid lookup key in Column C, and then doing an Offset in column D. In column C I use an indirect which generates path dependency based on the sum of the cells above itself.  You would need to apply similar principles to your example, should only need a single equivalent of my column C.
Formulas as follows:
Column C: =MATCH("OPP",INDIRECT("A"&SUM($C$1:C1)+2&":A50"),0)
Column D: =OFFSET($B$1,SUM($C$1:C2),0)


text:
Q: How are the standard errors computed for the fitted values from a logistic regression? When you predict a fitted value from a logistic regression model, how are standard errors computed?  I mean for the fitted values, not for the coefficients (which involves Fishers information matrix).
I only found out how to get the numbers with R (e.g., here on r-help, or here on Stack Overflow), but I cannot find the formula.
pred <- predict(y.glm, newdata= something, se.fit=TRUE)

If you could provide online source (preferably on a university website), that would be fantastic.

A: The prediction is just a linear combination of the estimated coefficients.  The coefficients are asymptotically normal so a linear combination of those coefficients will be asymptotically normal as well.  So if we can obtain the covariance matrix for the parameter estimates we can obtain the standard error for  a linear combination of those estimates easily.  If I denote the covariance matrix as $\Sigma$ and and write the coefficients for my linear combination in a vector as $C$ then the standard error is just $\sqrt{C' \Sigma C}$
# Making fake data and fitting the model and getting a prediction
set.seed(500)
dat <- data.frame(x = runif(20), y = rbinom(20, 1, .5))
o <- glm(y ~ x, data = dat)
pred <- predict(o, newdata = data.frame(x=1.5), se.fit = TRUE)

# To obtain a prediction for x=1.5 I'm really
# asking for yhat = b0 + 1.5*b1 so my
# C = c(1, 1.5)
# and vcov applied to the glm object gives me
# the covariance matrix for the estimates
C <- c(1, 1.5)
std.er <- sqrt(t(C) %*% vcov(o) %*% C)

> pred$se.fit
[1] 0.4246289
> std.er
          [,1]
[1,] 0.4246289

We see that the 'by hand' method I show gives the same standard error as reported via predict


text:
Q: Importing a file (MultipartFile) and the process - Java/Grails So I am trying to do, what I thought, was a simple file read and import. So the way my code works now is that I have a file stored in a folder on the server, select it, and import it. I select the file through a multipartfile:
    <g:form method="post"  enctype="multipart/form-data" controller="fileManager">
        Company Name:<input id="cname" type="text" name="cname" />

        Select a CSV file to upload: <input type="file" id="newFile" name="newFile" />
        <g:actionSubmit action="importContactsFromFile" value="Import" />
    </g:form>

So what I want to do is to:

*

*Have user select a file

*Download the file to a directory on the server (input/output stream?)

*Read the file contents (CSVReader) and import into DB (this works)

*Possibly clean up file after

So I have a massive headache with that second step. I pull the file into a def variable:
def newFile = request.getFile('newFile')

How do I bridge this gap? Slamming my head over this! Thanks!

A: Do you need to save the file as an intermediate step before parsing it?  Most CSV parsers (OpenCSV for example) will read from a Reader or InputStream directly.  So you can do something like:
def newFile = request.getFile('newFile')
def csv = new CSVReader(newFile.inputStream.newReader())
...

If you want to save the file, you can use the transferTo method:
def newFile = request.getFile('newFile')
newFile.transferTo(new File('newFile.csv'))
def csv = new CSVReader(new File('newFile.csv').newReader())

In that case, you'll have to ensure two requests don't overwrite each other by ensuring unique a file name.
You can find more information in the grails manual: http://grails.org/doc/latest/guide/theWebLayer.html#6.1.9%20Uploading%20Files

A: // Import statement
import org.springframework.web.multipart.commons.CommonsMultipartFile;

in your controller method :
CommonsMultipartFile f = params['newFile'];
if (f != null) {
   BufferedInputStream bis = new BufferedInputStream (f.getInputStream())
   // Do whatever you like.
}

A: Take a look at Grails documentation uploadingFiles
Try this :
def upload() {
def f = request.getFile('myFile')
f.transferTo(new File('/some/local/dir/myfile.txt'))
response.sendError(200, 'Done')

}
hope this helps


text:
Q: Lasso, glmnet, preprocessing of the data Im trying to use the glmnet package to fit a lasso (L1 penalty) on a model with a binary outcome (a logit). My predictors are all binary (they're 1/0 not ordered, ~4000) except for one continuous variable.
I need to convert the predictors into a sparse matrix, since it takes forever and a day otherwise.
My question is: it seems that people are using sparse.model.matrix rather than just converting their matrix into a sparse matrix. Why is that? and do I need to do this here? Outcome is a little different for both methods.
Also, do my factors need to be coded as factors (when it comes to both the outcome and the predictors) or is it sufficient to use the sparse matrix and specify in the glmnet model that the outcome is binomial?
Here's what im doing so far
#Create a random dataset, y is outcome, x_d is all the dummies (10 here for simplicity) and x_c  is the  cont variable
y<- sample(c(1:0), 200, replace = TRUE)
x_d<- matrix(data= sample(c(1:0), 2000, replace = TRUE), nrow=200, ncol=10)
x_c<- sample(60:90, 200, replace = TRUE)

#FIRST: scale that one cont variable.
scaled<-scale(x_c,center=TRUE, scale=TRUE)

#then predictors together
x<- cbind(x_d, scaled)

#HERE'S MY MAIN QUESTION: What i currently do is:
xt<-Matrix(x ,  sparse = TRUE)

#then run the cross validation...
cv_lasso_1<-cv.glmnet(xt, y, family="binomial", standardize=FALSE)

#which gives slightly different results from (here the outcome variable is in the x matrix too)
xt<-sparse.model.matrix(data=x, y~.)

#then run CV.

So to sum up my 2 questions are:
1-Do i need to use sparse.model.matrix even if my factors are just binary and not ordered? [and if yes what does it actually do differently from just converting the matrix to a sparse matrix]
2- Do i need to code the binary variables as factors?
the reason i ask that is my dataset is huge. it saves a lot of time to just do it without coding as factors.

A: I don't think you need a sparse.model.matrix, as all that it really gives you above a regular matrix is expansion of factor terms, and if you're binary already that won't give you anything. You certainly don't need to code as factors, I frequently use glmnet on a regular (non-model) sparse matrix with only 1's. At the end of the day glmnet is a numerical method, so a factor will get converted to a number in the end regardless.


text:
Q: How can I show the footer only when I reach to the end of a page after scrolling down with ScrollMagic?
It looks like there are several questions on StackOverflow similar to
  this question. However, I tried several methods and nothing worked for
  me. :(

Hello!

*

*I'm currently using a MVC model in PHP.

*I'm using GSAP & ScrollMagic for this webpage.

When I scroll down the page, images show up in an order.
By the way, when the trigger reaches the second image, I see the footer behind the second image.

My folder structure is the following:
-- controller
   -- backend
   -- frontend
      -- 0_header_and_footer.php
-- model
-- public
   -- css
   -- images
   -- js
      -- backend
      -- frontend
         -- 0_header_and_footer
         -- 1_work
         -- 2_writings
         -- 3_about
            -- personality.js
-- view
   personality.php
   -- backend
   -- frontend
         -- 0_header_and_footer
         -- 1_work
         -- 2_writings
         -- 3_about
            -- personality.php
index.php

view / template.php
<!DOCTYPE html>

    <?php require("view/frontend/0_header_and_footer/header.php");?>
    <?=$content?>
    <?php require("view/frontend/0_header_and_footer/footer.php");?>

view / frontend / 3_about / personality.php
<?php $title='Account'; ?>

<?php ob_start(); ?>

Personality / Interests

<?php $content = ob_get_clean(); ?>
<?php require('view/template.php') ?>

The following code shows the problem:

*

*I changed the footer background to orange to show the footer more clearly.

*This doesn't include the MVC model, though.

Please check out this CodePen to see what happens:
  https://codepen.io/hlim18/pen/MRWjbp.

I tried several methods to solve the problem:
[FIRST TRY]
After reading this StackOverflow question, I added the following code that I got from this CodePen.
.page-wrap {
  min-height: 100%;
  /* equal to footer height */
    margin-bottom: -80px;
}
.page-wrap:after {
  content: "";
  display: block;
}
.site-footer, .page-wrap:after {
  /* .push must be the same height as footer */
    height: 80px;
}

However, that didn't solve my problem.
[SECOND TRY]
Accepted answer of this StackOverflow question suggested fixing the footer at the bottom.
-- This is NOT what I want. I want to show the footer at the bottom only when a user finishes scrolling to the bottom.
[THIRD TRY]
This CSS-Tricks article showed five ways for making a sticky footer:

*

*3 ways of requiring fixed height footers including my first try

*1 way of using flexbox

*1 way of using grid.
I tried the grid method.
HTML

...

...

...

CSS
body {
  min-height: 100%;
  display: grid;
  grid-template-rows: 1fr auto;
}
footer {
  grid-row-start: 2;
  grid-row-end: 3;
  height: 80px;
}

This didn't work either: https://codepen.io/hlim18/pen/LvYNaZ :(
[FOURTH TRY]
I tried the accepted answer of this StackOverflow question.
footer {
    position:absolute;
    right:0;
    left:0;
}

It didn't work either: https://codepen.io/hlim18/pen/eoYdpW :(
How could I solve this problem? I'd greatly appreciate any help. Thank you!

A: As in doc use the code below to set the footer in the end of the page
var scene2 = new ScrollMagic.Scene({
    triggerElement: "#footer",
    duration: 1000,
     triggerHook: 3
  })
  .setPin("#footer")
  .addTo(controller);

See full code:

var controller = new ScrollMagic.Controller();

var project_left = document.querySelectorAll('.project_left');

project_left.forEach((element) => {
  var pic_overlay = element.children[0].children[1],
    project_info = element.children[1],
    small_title = element.children[1].children[0],
    h4_test = element.children[1].children[1],
    project_link = element.children[1].children[2];

  var animate_in = new TimelineMax();

  animate_in
    .fromTo(pic_overlay, 2, {
      skewX: 10,
      scale: 1.5
    }, {
      skewX: 0,
      xPercent: 100,
      transformOrigin: "0% 100%",
      ease: Power2.easeOut
    })
    .from(project_info, 1, {
      scaleY: 0,
      transformOrigin: 'bottom left'
    }, '-=1.5')
    .from(small_title, 0.3, {
      autoAlpha: 0,
      y: 30,
      ease: Power4.easeOut
    }, '-=0.8')
    .from(project_link, 0.2, {
      autoAlpha: 0,
      y: 30,
      ease: Power4.easeOut
    }, '-=0.8')
    .from(h4_test, 0.2, {
      autoAlpha: 0,
      y: 30,
      ease: Power4.easeOut
    }, '-=0.8');

  // Make a ScrollMagic scene
  var scene = new ScrollMagic.Scene({
      triggerElement: element
    })
    .addIndicators()
    .setTween(animate_in).addTo(controller);
});

var project_right = document.querySelectorAll('.project_right');

project_right.forEach((element) => {
  var pic_overlay = element.children[0].children[1],
    project_info = element.children[1],
    small_title = element.children[1].children[0],
    h4_test = element.children[1].children[1],
    project_link = element.children[1].children[2];

  var animate_in = new TimelineMax();

  animate_in
    .fromTo(pic_overlay, 2, {
      skewX: 10,
      scale: 1.5
    }, {
      skewX: 0,
      xPercent: 100,
      transformOrigin: "0% 100%",
      ease: Power2.easeOut
    })
    .from(project_info, 1, {
      scaleY: 0,
      transformOrigin: 'bottom left'
    }, '-=1.5')
    .from(small_title, 0.3, {
      autoAlpha: 0,
      y: 30,
      ease: Power4.easeOut
    }, '-=0.8')
    .from(project_link, 0.2, {
      autoAlpha: 0,
      y: 30,
      ease: Power4.easeOut
    }, '-=0.8')
    .from(h4_test, 0.2, {
      autoAlpha: 0,
      y: 30,
      ease: Power4.easeOut
    }, '-=0.8');

  // Make a ScrollMagic scene
  var scene = new ScrollMagic.Scene({
      triggerElement: element
    })
    .addIndicators()
    .setTween(animate_in).addTo(controller);

    var scene2 = new ScrollMagic.Scene({
        triggerElement: "#footer",
        duration: 1000,
         triggerHook: 3
      })
      .setPin("#footer")
      .addTo(controller);

});
.h1_test {
  font-weight: 600;
  font-size: 48px;
  color: red;
  margin: 0;
  line-height: 1.3;
  letter-spacing: 0.0001em;
}

.h4_test {
  font-weight: 600;
  font-size: 28px;
  color: #666;
  margin: 0;
  line-height: 1.3;
  letter-spacing: 0.0001em;
}

p.top_titles {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.small_title {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.project_link {
  text-decoration: none;
  border-bottom: 2px solid #b00f24;
  padding: 5px 0;
  font-size: 1.5rem;
}

.section_test {
  height: 90vh;
  width: 100vw;
}

.grid_test {
  display: grid;
  height: 100%;
  align-content: center;
  justify-content: center;
  text-align: center;
}

.project_div {
  display: grid;
  position: relative;
  grid-template-columns: repeat(12, 1fr);
}

.project_left .box_test {
  position: relative;
  overflow: hidden;
  height: 90vh;
  grid-row: 1/span 3;
  width: 100%;
}

.project_left .project_info {
  position: absolute;
  height: 200px;
  width: 400px;
  top: 20%;
  background: lightgoldenrodyellow;
  padding: 20px;
}

.project_left .box_test {
  grid-column: 2/span 7;
}

.project_left .project_info {
  left: 5%;
}

.project_right .box_test {
  position: relative;
  overflow: hidden;
  height: 90vh;
  grid-row: 1/span 3;
  width: 100%;
}

.project_right .project_info {
  position: absolute;
  height: 200px;
  width: 400px;
  top: 20%;
  background: lightgoldenrodyellow;
  padding: 20px;
}

.project_right .box_test {
  grid-column: 5/span 7;
}

.project_right .project_info {
  right: 5%;
}

.img_test {
  width: 100%;
}

.overlay_test {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  background: white;
  width: 100%;
  height: 100%;
}

footer {
  display: flex;
  margin-top: 10px;
  padding-top: 7px;
  justify-content: space-between;
  height: 80px;
  background-color: orange;
}

#footer_left {
  display: flex;
  flex-direction: row;
  padding-left: 2vw;
  width: 100%;
}

#footer_left #input_icon_footer {
  position: absolute;
  left: 10px;
  width: 24px;
  height: 24px;
  top: 10px;
}

#footer_left #search_input {
  text-indent: 40px;
  margin: 10px 0;
  width: 100%;
  background-color: #e0e2e5;
  text-indent: 40px;
  margin-top: 0px;
  width: 150px;
  background-color: #e0e2e5;
  box-sizing: border-box;
}

#footer_left #search_input:focus {
  outline: none !important;
  border: 2px solid #0b82dc;
  padding: 5px 0;
}

#footer_left #search_input:focus {
  box-sizing: border-box;
  width: 300px;
  transition: width 0.7s cubic-bezier(0.47, 0, 0.75, 0.72);
}

#footer_left #search_input:focus::-webkit-input-placeholder {
  color: #e0e2e5;
}

#footer_middle {
  padding-left: 0;
  margin-top: 22px;
  color: #6c6e70;
  width: 450px;
  text-align: center;
}

#footer_middle>li {
  list-style-type: none;
}

#footer_right {
  padding-left: 0px;
  padding-right: 2vw;
  width: 100%;
  justify-content: flex-end;
  display: flex;
  flex-direction: row;
}

#footer_right>li {
  list-style-type: none;
  padding-right: 15px;
  padding-top: 10px;
}

#footer_right>li>a>i {
  color: #6c6e70;
}

#footer_right>li>a>i:hover {
  color: #0b82dc;
}

#footer_right>li:last-child {
  padding-right: 0px;
}

<?php $title='Account'; ?>

<?php ob_start(); ?>

Personality / Interests

StrengthsQuest!

scroll down

Identity // Website // Print

This is the first project

        See case study

Identity // Website // Print

This is the first project

        See case study

Identity // Website // Print

This is the first project

        See case study

    <form action="" action="view/frontend/4_acct/footer_searchbar.php" method="POST">

        search
        <input id="search_input" class="acct_input" name="search" type="text" placeholder="search">

    </form>

Copyright © 2019 Jen Lim


text:
Q: PMD error: AccessorMethodGeneration when overriding some method in Lombok Builder I have the following class that should be built with Lombok @Builder:
import lombok.Builder;
import lombok.Getter;

@Getter
@Builder(toBuilder = true)
public class Foo {
    private String myName;
    private int myAge;

    public static class FooBuilder {

        // I'm overriding this method to add some validation logic
        public FooBuilder myName(String myName) {
            // some simple logic to validate "myName"

            this.myName= myName;
            return this;
        }
    }
}

I'd like to add some simple logic to validate myName field before setting it. But I don't want to do that for myAge. So myAge field's builder and the FooBuilder constructor will be generated by Lombok.
This makes PMD throw an error:

Rule:AccessorMethodGeneration Priority:3 Avoid autogenerated methods
to access private fields and methods of inner / outer classes.

Should I suppress this error or is there a better way to achieve what I want?

A: The rules AccessorClassGeneration and AccessorMethodGeneration were created to help Android (!) development, when there was a limitation with the DEX format. These generated classes/methods counted towards the total classes/methods (64k) that were possible back then.
If you are not developing old Android apps, then you can probably remove these rules completely from your ruleset. E.g. today there is Multidex possible which allows to use more than 64k methods in your app.
Also, since Java 11, the java compiler doesn't generate those accessor classes and methods anymore, see JEP 181: Nest-Based Access Control.


text:
Q: Comparison always false when adding two random numbers and comparing the sum with user input What I am trying to do is to randomize and assign two numbers to variables and add them while displaying the variables to the user. User enters the sum of the two variables and if the input and the sum is the same, user wins. Though, when I compare, the result is always false when I used console.log to see the Boolean value.
I am using html and JavaScript. Here is my code:

<title>
Game A
</title>

Click the button to calculate x.

<input id="demo"></input>
<button onclick="myFunction()">Try it</button>

A: You need to use:document.getElementById("demo").value to get the value from the input field.Do not change the value of z inside the function by reassigning the new value to it.Try this:

<title>
Game A
</title>

Click the button to calculate x.

<input id="demo"></input>
<button onclick="myFunction()">Try it</button>


text:
Q: Java: When can I get away with String concatenation? I'm a Java newbie (started seriously learning 1-2 months ago). I've read that string concatenation often has terrible performance in Java, and that if you need to repeatedly concatenate a string, it's better to use a StringBuilder. But are there some cases where ordinary string concatenation is OK?
I'm particularly thinking of cases like:
String url = "http://example.com/"+ path + "?param1=" + param1 + "&param2="
       + param2 + "&param3=" + param3;

There are two things that I think might be true of cases like this:

*

*Java will go through successively producing the strings "http://example.com/about", "http://example.com/about/?param1=", etc., but doing so isn't so bad unless performance is really at a premium because you're only doing this ~a half-dozen times (whereas doing it a thousand times would be bad).

*Java is smart enough to not do the thing described in (1), and just makes one big string directly, because this code is all on one line. Therefore using StringBuilder here is totally unnecessary even if performance is at a premium.

Which is true?


text:
Q: App Crashed while passing data using Intent on Pressing Next Button (getStringExtra) I want to move all data 5 (EditText) from activity  1 to 2
public class MainActivity extends Activity
 private EditText fName_ET;
    private EditText lName_ET;
    private EditText phoneNum_ET;
    private EditText eMail_ET;
    private EditText deviceModel_ET;
    private EditText nameDevice_ET;
    private Button nextPage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);

       fName_ET = (EditText)findViewById(R.id.fName_ET);
       lName_ET = (EditText)findViewById(R.id.lName_ET);
       phoneNum_ET = (EditText)findViewById(R.id.phone_ET);
       eMail_ET = (EditText)findViewById(R.id.mail_ET);
       nameDevice_ET = (EditText)findViewById(R.id.name_device);
       deviceModel_ET = (EditText)findViewById(R.id.model_device);
       nextPage = (Button)findViewById(R.id.next_btn);

        nextPage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MainActivity.this, Main2Activity.class);
                String fName =  fName_ET.getText().toString().trim();
                String lName =  lName_ET.getText().toString().trim();
                String email = eMail_ET.getText().toString().trim();
                String phone = phoneNum_ET.getText().toString().trim();
                String nameDevice = nameDevice_ET.getText().toString().trim();
                String modelDevice =deviceModel_ET.getText().toString().trim();
                intent.putExtra("modelDevice",modelDevice);
                intent.putExtra("fName", fName);
                intent.putExtra("lName", lName);
                intent.putExtra("phone", phone);
                intent.putExtra("email", email);
                intent.putExtra("nameDevice", nameDevice);
                startActivity(intent);
            }
        });

public class Main2Activity extends Activity
{

 package com.example.eranp.cp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;

import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main2Activity extends Activity {

    private EditText pro_device_det;
    private Button saveDataBase;
    private DatabaseReference databaseCustomer, databaseDevice, databaseProblem;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main3);

        databaseCustomer = FirebaseDatabase.getInstance().getReference("customers");
        databaseDevice = FirebaseDatabase.getInstance().getReference("device");
        databaseProblem = FirebaseDatabase.getInstance().getReference("problem");
        saveDataBase = (Button) findViewById(R.id.save_btn);

        pro_device_det = (EditText) findViewById(R.id.pro_device_det);
        Intent intent = getIntent();
        final String fName = intent.getStringExtra("fName");
        final String lName = intent.getStringExtra("lName");
        final String phone = intent.getStringExtra("phone");
        final String email = intent.getStringExtra("email");
        final String modelDevice = intent.getStringExtra("modelDevice");
        final String nameDevice = intent.getStringExtra("nameDevice");

        saveDataBase.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String proDeviceDet = pro_device_det.getText().toString().trim();
                String shortProDeviceDet = string3Words(proDeviceDet);
                DateFormat df = new SimpleDateFormat("d MMM yyyy, HH:mm");
                String date = df.format(Calendar.getInstance().getTime());
                if (!TextUtils.isEmpty(proDeviceDet)) {
                    String id = databaseCustomer.push().getKey();
                    Customer customer = new Customer(id, fName, lName, email, phone);
                    databaseCustomer.child(id).setValue(customer);
                    Device device = new Device(id, nameDevice, modelDevice);
                    databaseDevice.child(id).setValue(device);
                    Problem problem = new Problem(id, date, proDeviceDet, 0, shortProDeviceDet);

                    //  Toast.makeText(this , "Customer added", Toast.LENGTH_LONG).show();
                } else {
                    //  Toast.makeText(this, "Please write on an empty cell", Toast.LENGTH_LONG).show();
                }

            }
        });

    }

    private String string3Words(String s) {
        String[] splitted = s.split("\\s+");
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < splitted.length; i++) {
            sb.append(splitted[i]);
            if (i == 3) {
                break;
            }
        }
        String newS = sb.toString();
        return newS;
    }
}

log when I press:

down VM 03-09 14:47:16.903 3476-3476/com.example.eranp.clientpage
  E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              Process: com.example.eranp.clientpage, PID: 3476
                                                                              java.lang.RuntimeException: Unable to start activity
  ComponentInfo{com.example.eranp.clientpage/com.example.eranp.clientpage.Main2Activity}:
  java.lang.NullPointerException: Attempt to invoke virtual method 'void
  android.widget.Button.setOnClickListener(android.view.View$OnClickListener)'
  on a null object reference
                                                                                at
  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2924)
                                                                                at
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
                                                                                at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                                                at
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:154)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:6692)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
                                                                               Caused by: java.lang.NullPointerException: Attempt to invoke virtual
  method 'void
  android.widget.Button.setOnClickListener(android.view.View$OnClickListener)'
  on a null object reference
                                                                                at
  com.example.eranp.clientpage.Main2Activity.onCreate(Main2Activity.java:50)
                                                                                at android.app.Activity.performCreate(Activity.java:6912)
                                                                                at
  android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
                                                                                at
  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877)
                                                                                at
  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
                                                                                at android.app.ActivityThread.-wrap14(ActivityThread.java)
                                                                                at
  android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                at android.os.Looper.loop(Looper.java:154)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:6692)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at
  com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

Why when I press the next button the app crashing?
Thank you for helping!

A: You are trying to set a click listener on a button in Main2Activity. Most likely the button can't be inflated from the second activity's layout because it doesn't exist.

android.widget.Button.setOnClickListener(android.view.View$OnClickListener)'
  on a null object reference at
  com.example.eranp.clientpage.Main2Activity.onCreate(Main2Activity.java:50)
  at

A: As per your error log you are getting error because of this

Attempt to invoke virtual method 'void
  android.widget.Button.setOnClickListener(android.view.View$OnClickListener)'
  on a null object reference at com.example.eranp.clientpage.Main2Activity.onCreate(Main2Activity.java:50)

saveDataBase = (Button) findViewById(R.id.save_btn);
saveDataBase.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
             // code...
            }
});

Check weather button id is correct and is in same layout of the activity or not.


text:
Q: Exception while running a Spring MVC Hello World Example:org.springframework.beans.factory.CannotLoadBeanClassException I tried to start the development on Spring MVC, just a little project, but getting the following exception :
Cannot find class [controller.HelloController] for bean with name '/hello.ds' defined in ServletContext resource [/WEB-INF/helloWorld-servlet.xml]; nested exception is java.lang.ClassNotFoundException: controller.HelloController
(My HelloController.java class is under src->controller package)
This is my index.jsp

HelloWorld

<form action="./hello.ds">
Name:<input type="text" name="name">
<input type="submit" value="sayHello">
</form>

This is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>MVC First Project</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>helloWorld</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloWorld</servlet-name>
<url-pattern>*.ds</url-pattern>
</servlet-mapping>
</web-app>

This is my helloWorld-servlet.xml
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean name="/hello.ds" class="controller.HelloController"></bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
</beans>

This is my controller:Hello Controller.java
package controller;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
public class HelloController implements Controller {
@Override
public ModelAndView handleRequest(HttpServletRequest req,
HttpServletResponse res) throws Exception {
// TODO Auto-generated method stub
String name=req.getParameter("name");
Map m=new HashMap();
m.put("msg","hello.." +name);
ModelAndView mav=new ModelAndView("success",m);
return mav;
}
}

This is my success.jsp
${msg}

jars added:
com.springsource.org.apache.commons.logging-1.1.1
com.springsource.org.apache.log4j-1.2.15
jmxtools-1.2.1
org.springframework.asm-3.0.1.RELEASE-A
org.springframework.beans-3.0.1.RELEASE-A
org.springframework.context-3.0.1.RELEASE-A
org.springframework.core-3.0.1.RELEASE-A
org.springframework.expression-3.0.1.RELEASE-A
org.springframework.web-3.0.1.RELEASE-A
org.springframework.web.servlet-3.0.1.RELEASE-A


text:
Q: Get record between two date from multiple tables in SQL server I am looking to get records from following two tables
if there does not exist a record in Eligibility for the Participant SSN and EIN in the Transaction where ServiceDate of Transaction is within  BenefitEffectiveDate and GracePeriodEndDate.
there can be multiple  records for same participant in eligibility table with different plan period for a given Participant SSN and EIN .
for example in below script there are two records for participantSSN = 645075498 in eligibility table and both record has different BenefitEffectiveDate and GracePeriodEndDate, from this table we have to take minimum BenefitEffectiveDate and maximum GracePeriodEndDate. that means for this participant minimum date is 2015-01-01 and maximum date is 2018-01-01
Now in transaction table I have same participantSSN = 645075498 which has has transaction date is 2016-02-10 which is fall between minimum BenefitEffectiveDate and maximum GracePeriodEndDate in eligibility table for participantSSN = 645075498
I want to get record in my output for participantSSN = 645075498
How can I achieve it? so far I have written below query which is not giving me participantSSN = 645075498 in output result.
This is my expected result
| Tid |  TPAId  |  EIN  | ParticipantSSN | ParticipantFirstName | ParticipantLastName | TPAParentTransactionId | TPATransactionId | ServiceDate | TransactionDate | Amt |

| 118 | PayFlex | 54401 |      852258852 | GABRIEL              | BRYANT              |               45758201 |         55277801 | 2016-01-01  | 2016-01-02      |  15 |
| 124 | PayFlex | 54407 |      420145857 | CAROLYN              | WOMAC               |               45758207 |         55277807 | 2016-03-15  | 2016-03-15      |  60 |
| 125 | PayFlex | 54408 |      345658570 | THOMAS               | FAVELA              |               45758208 |         55277808 | 2016-03-16  | 2016-03-18      |  60 |
| 126 | PayFlex | 54409 |      541575015 | BETTY                | DAVIS               |               45758209 |         55277809 | 2016-03-17  | 2016-03-20      |  60 |
| 127 | PayFlex | 54410 |      541575015 | BETTY                | DAVIS               |               45758209 |         55277809 | 2016-03-17  | 2016-03-20      |  60 |
| 128 | PayFlex | 54409 |      541575015 | BETTY                | DAVIS               |               45758210 |         55277809 | 2016-03-17  | 2016-03-20      |  60 |
| 129 | PayFlex | 54409 |      541575016 | MANDY                | THOMPSON            |               45758211 |         55277810 | 2016-03-18  | 2016-03-20      |  80 |
| 130 | PayFlex | 54409 |      541575018 | FRANCIS              | GRAYER              |               45758212 |         55277811 | 2016-03-19  | 2016-03-22      |  79 |
| 122 | PayFlex | 54405 |      645075498 | MARY                 | WILSON              |               45758205 |         55277805 | 2016-02-07  | 2016-02-10      | 100 |

My Current SQL query
SELECT ParticipantFirstName, ServiceDate, *
FROM DebitCardTransaction d
WHERE   NOT EXISTS
(
   SELECT 1
   FROM Eligibility e
   WHERE e.TPAId = d.TPAId
      AND e.EIN = d.EIN
      AND e.ParticipantSSN = d.ParticipantSSN
    AND d.ServiceDate BETWEEN BenefitEffectiveDate AND GracePeriodEndDate
 )

Above it my current query and below is sample create table and insert sample data script
CREATE TABLE Eligibility(
EligibilityId        INTEGER  PRIMARY KEY
,TPAId                VARCHAR(7)
,EIN                  INTEGER
,SubscriberId         INTEGER
,ParticipantFirstName  VARCHAR(9)
,ParticipantLastName   VARCHAR(9)
,ParticipantSSN        INTEGER
,BenefitEffectiveDate DATE
,GracePeriodEndDate   DATE
);

INSERT INTO Eligibility(EligibilityId,TPAId,EIN,SubscriberId,ParticipantFirstName,ParticipantLastName,ParticipantSSN,BenefitEffectiveDate,GracePeriodEndDate) VALUES (227,'PayFlex',54406,15857506,'TIM','HOPE',138764141,'1/1/2016','2/2/2017');
INSERT INTO Eligibility(EligibilityId,TPAId,EIN,SubscriberId,ParticipantFirstName,ParticipantLastName,ParticipantSSN,BenefitEffectiveDate,GracePeriodEndDate) VALUES (228,'PayFlex',54401,15857501,'BRIEL','BRYANT',852258851,'1/1/2016','2/2/2017');
INSERT INTO Eligibility(EligibilityId,TPAId,EIN,SubscriberId,ParticipantFirstName,ParticipantLastName,ParticipantSSN,BenefitEffectiveDate,GracePeriodEndDate) VALUES (229,'PayFlex',54402,15857502,'LISA','PEREZ',292225757,'1/1/2016','2/2/2017');
INSERT INTO Eligibility(EligibilityId,TPAId,EIN,SubscriberId,ParticipantFirstName,ParticipantLastName,ParticipantSSN,BenefitEffectiveDate,GracePeriodEndDate) VALUES (230,'PayFlex',54403,15857503,'ALEXANDER','JEFFERSON',643035714,'1/1/2016','2/2/2017');
INSERT INTO Eligibility(EligibilityId,TPAId,EIN,SubscriberId,ParticipantFirstName,ParticipantLastName,ParticipantSSN,BenefitEffectiveDate,GracePeriodEndDate) VALUES (231,'PayFlex',54404,15857504,'SHIRLEY','PEREZ',458250578,'1/1/2016','2/2/2017');
INSERT INTO Eligibility(EligibilityId,TPAId,EIN,SubscriberId,ParticipantFirstName,ParticipantLastName,ParticipantSSN,BenefitEffectiveDate,GracePeriodEndDate) VALUES (232,'PayFlex',54405,15857505,'MARY','WILSON',645075498,'1/1/2015','2/2/2016');
INSERT INTO Eligibility(EligibilityId,TPAId,EIN,SubscriberId,ParticipantFirstName,ParticipantLastName,ParticipantSSN,BenefitEffectiveDate,GracePeriodEndDate) VALUES (233,'PayFlex',54405,15857505,'MARY','WILSON',645075498,'1/1/2016','2/2/2018');

CREATE TABLE DebitCardTransaction(
Tid                    INTEGER  PRIMARY KEY
,TPAId                  VARCHAR(7)
,EIN                    INTEGER
,ParticipantSSN         INTEGER
,ParticipantFirstName   VARCHAR(9)
,ParticipantLastName    VARCHAR(9)
,TPAParentTransactionId INTEGER
,TPATransactionId       INTEGER
,ServiceDate            DATE
,TransactionDate        DATE
,Amt                    INTEGER
);

INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (118,'PayFlex',54401,852258852,'GABRIEL','BRYANT',45758201,55277801,'1/1/2016','1/2/2016',15);
 INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (119,'PayFlex',54402,292225757,'LISA','PEREZ',45758202,55277802,'2/1/2016','2/2/2016',50);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (120,'PayFlex',54403,643035714,'ALEXANDER','JEFFERSON',45758203,55277803,'2/2/2016','2/3/2016',50);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (121,'PayFlex',54404,458250578,'SHIRLEY','PEREZ',45758204,55277804,'2/3/2016','2/5/2016',50);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (122,'PayFlex',54405,645075498,'MARY','WILSON',45758205,55277805,'2/7/2016','2/10/2016',100);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (123,'PayFlex',54406,138764141,'TIM','HOPE',45758206,55277806,'2/10/2016','2/11/2016',110);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (124,'PayFlex',54407,420145857,'CAROLYN','WOMAC',45758207,55277807,'3/15/2016','3/15/2016',60);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (125,'PayFlex',54408,345658570,'THOMAS','FAVELA',45758208,55277808,'3/16/2016','3/18/2016',60);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (126,'PayFlex',54409,541575015,'BETTY','DAVIS',45758209,55277809,'3/17/2016','3/20/2016',60);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (127,'PayFlex',54410,541575015,'BETTY','DAVIS',45758209,55277809,'3/17/2016','3/20/2016',60);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (128,'PayFlex',54409,541575015,'BETTY','DAVIS',45758210,55277809,'3/17/2016','3/20/2016',60);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (129,'PayFlex',54409,541575016,'MANDY','THOMPSON',45758211,55277810,'3/18/2016','3/20/2016',80);
INSERT INTO DebitCardTransaction(Tid,TPAId,EIN,ParticipantSSN,ParticipantFirstName,ParticipantLastName,TPAParentTransactionId,TPATransactionId,ServiceDate,TransactionDate,Amt) VALUES (130,'PayFlex',54409,541575018,'FRANCIS','GRAYER',45758212,55277811,'3/19/2016','3/22/2016',79);

A: I think this is what you're after;
SELECT
d.Tid
,d.TPAId
,d.EIN
,d.ParticipantSSN
,d.ParticipantFirstName
,d.ParticipantLastName
,d.TPAParentTransactionId
,d.TPATransactionId
FROM DebitCardTransaction d
LEFT JOIN (SELECT ParticipantSSN, MIN(BenefitEffectiveDate) BenefitEffectiveDate, MAX(GracePeriodEndDate) GracePeriodEndDate FROM #Eligibility GROUP BY ParticipantSSN) e
ON d.ParticipantSSN = e.ParticipantSSN
AND d.TransactionDate BETWEEN e.BenefitEffectiveDate AND e.GracePeriodEndDate
WHERE e.ParticipantSSN IS NULL OR d.ParticipantSSN = 645075498
ORDER BY d.Tid

It gives the result set that you've asked except for Tid 122 (Mary Wilson), which doesn't meet the criteria as I understand them.


text:
Q: Comentarios en JSON ¿Existe la posibilidad de poner comentarios en JSON?
El IDE me permite ponerlos, pero avisa que no se puede poner estos comentarios. ¿Hay otra manera de poder indicar aclaraciones?
Muchas gracias !!

A: Lamentablemente Json no puede contener comentarios, al menos ajenos a la estructura que lo compone.
Podrías usar un elemento para tal uso y excluirlo en tu modelo al serializar/deserializar.


text:
Q: canvas is not merging and resulting in showing only background image I have create 2 canvas, load two differnt image and I want to merge both canvas and then display it as image in

 tag.
Here is my code:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>canvas to image</title>

    <canvas id="card_canvas" width="800" height="500"></canvas>
    <canvas id="card_canvas2" width="800" height="500"></canvas>

<button onclick="canvasToImage()">canvas to image</button>

Here is img1.jpg:

Here is img2.jpg:

This code ends up in displaying only background image:

I am expecting:

A: This can be achieve by simply setting following style on canvas2:
<canvas id="card_canvas2" style="position:absolute; left:0px; top:0px;"></canvas>

https://jsfiddle.net/jkjqd7gz/

A: I've been fiddling with your code a bit, and I think I've figured out the issue. javascript has a funny execution order at times that most people aren't aware of. Your onload lambda function is causing some of the issues your experiencing. Basically, you need to move your ctx1.drawImage(canvass2, 0, 0); line inside your lambda function just after ctx2.drawImage(cuimg, 7, 92); To understand what I mean open your code and hit the canvas to image button twice. The first time populates both canvasses, the second time puts the contents of canvass2 onto canvass1. I could probably explain exactly what's happening in terms of order of execution, but the explanation involves some difficult to understand concepts regarding parallelism, swap buffers, and race conditions.
To put it in a nutshell, whatever function you call ctx2.drawImage in, you need to then follow it with ctx1.drawImage. Honestly though, the best way to make composite images is to create a sprite class that stores an image, its postion, and layer information if desired. Then use a dynamic array to store the sprites. Always clear the canvas every time before you draw on it and loop through the contents of your arrays drawing each sprite in layer order on its respective canvass. Finally, I would use one set of functions to populate the canvas and a second to merge them.
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>canvas to image</title>

    <canvas id="card_canvas" width="800" height="500"></canvas>
    <canvas id="card_canvas2" width="800" height="500"></canvas>

<button onclick="popCanvas()">Populate Canvasses</button>
<button onclick="canvasToImage()">Canvas Combine</button>


text:
Q: Ubuntu Bind9 Zones I have a quick question. I just setup DNS on one of our Ubuntu servers using Bind9. Now my question is do we need to setup a "zone" for every domain name? Or is there another option? What are the best practices for setting up different domains in Bind9?
Thanks for your time.

A: You need a zone file for each top level root zone.
See this for an explanation: http://webcache.googleusercontent.com/search?q=cache:ZVsbIZMfxPoJ:ubuntuforums.org/showthread.php%3Ft%3D699931+configure+multiple+domains+in+bind9&cd=4&hl=en&ct=clnk&gl=us&source=www.google.com


text:
Q: correct word order I'd like to ask if it is correct to say "I'm interested in architecture so the most I'd like to visit places such as Westminster Abbey and the Tower Bridge." I mean if the most goes before the subject and the predicate, is it wrong word order?

A: The word order in your original sentence is wrong.  A more idiomatic way to phrase it is

I'm interested in architecture, so the places I'd most like to visit are...

This emphasizes the places that you want to visit more than any others - of all places, these are the ones you most want to visit.
Another way to phrase it would be

I'm interested in architecture, so I'd most like to visit places such as...

This changes the focus of the sentence a little - of all things, what you would most like is visiting these places.


text:
Q: Django Bootstrap card-deck if forloop divisibleby I'm trying to use bootstrap cards. But I have problem.
When I adding new post to be display as a card, and i display more then 5 they starting to squize.
I'm was try to use forloop counter to start new line every time when it display more then 5 cards.
But Im doing something wrong. I read everything and everywhere is the same thing. But I'm for sure doing this wrong.

    {% for post in post_list %}
    {% if forloop.counter0|divisibleby:3 %}

Header

{{ post.title }}

{{post.content|slice:":200" }}

   {% endif %}

  {% endfor %}

Reference image

A: Now you're only seeing every third card (because of the "divisibleby:3"). I'm not exactly sure what you want to achieve, but if you want to show all cards, there are several options. Two of them are card groups (https://getbootstrap.com/docs/4.0/components/card/#card-groups) and card decks (https://getbootstrap.com/docs/4.0/components/card/#card-decks), but they indeed get messy when the number of cards is getting larger. A solution I have used with success is using Bootstrap's grid. The cards will automatically wrap to the next row when the viewport is smaller or the number of cards larger. The code below should work (haven't tested it):
div class="container-fluid">

        {% for post in post_list %}

                        Header

{{ post.title }}

{{ post.content|slice:":200" }}

        {% endfor %}


text:
Q: Alternative to FindAncestor RelativeSource in Silverlight 4 to bind to a property of the page FindAncestor RelativeSource only supports 'Self' and 'TemplatedParent',
but I have to bind the width of a popup to the width of the page.
Giving the page a name causes problems because sometimes it will
throw exceptions saying a control with that name is already present in the visual tree.
<Popup IsOpen="True"
       Width="{Binding ElementName=BordPage, Path=Width}"
       Height="{Binding ElementName=BordPage, Path=Height}">

Background information:
I'm using a SL4 navigation based application here. BordPage is a navigation page,
which I'm using multiple times within the application. So giving it a name in the page itself is not really a good idea,
but I don't know how else I can bind to the width and height of the page.
What I'm trying to do is have a black border (with opacity 0.8) cover the entire screen,
(including the controls of the MainPage). Then on top of that I want to display some other controls.
Since the application is touch controlled, providing the user with a ComboBox to select a value doesn't really work wel. Instead I want to show this black overlay window with a listbox taking up most of the screen so the user can simply touch the value he wants with a single click.
Update: I just realized I can use the ChildWindow class to do this.
But my original question remains.

A: My general solution for this problem is by writing a custom behavior.  It's not a pure XAML solution but it gives you a lot more flexibility.
Create a behavior that searches up the VisualTree to find the right item and then have it set the width of the Popup correctly.
It may be a little more complicated than a straight binding but it avoids all the naming issues.

A: Put the following in the constructor of your control so you can avoid naming it:
DataContext = this;


text:
Q: Selecting rows where a numeric column value change sign through openpyxl I'm learning Python and openpyxl for data analysis on a large xlsx workbook. I have a for loop that can iterate down an entire column. Here's some example data:
ROW:  VALUE:
1      1
2      2
3      3
4      4
5     -4
6     -1
7     -6
8      2
9      3
10    -3

I want to print out the row in which the value changes from positive to negative, and vice versa. So in the above example, row number 5, 8, and 10 would print in the console. How can I use an if statement within a for loop to iterate through a column on openpyxl?
So far I can print all of the cells in a column:
import openpyxl
wb = openpyxl.load_workbook('ngt_log.xlsx')
sheet = wb.get_sheet_by_name('sheet1')
for i in range(1, 10508, 1):   # 10508 is the length of the column
    print(i, sheet.cell(row=i, column=6).value)

My idea was to just add an if statement inside of the for loop:
for i in range(1, 10508, 1):   # 10508 is the length of the column
    if(( i > 0 and (i+1) < 0) or (i < 0 and (i+1) > 0)):
        print((i+1), sheet.cell(row=i, column=6).value)

But that doesn't work. Am I formulating the if statement correctly?

A: It looks to me as though your statement is contradicting itself
for i in range(1, 10508, 1):   # 10508 is the length of the column
if(( i greater than 0 and (i+1) less than 0) or (i less than 0 and (i+1) greater than
0)):
    print((i+1), sheet.cell(row=i, column=6).value)

I wrote the > and < symbols in plain English but if i is greater than 0 then i + 1 is never less than 0 and vise versa so they will never work as both cannot be true

A: You need to get the sheet.cell values first, and then do the comparisons:
end_range = 10508
for i in range(1, end_range):
    current, next = sheet.cell(row=i, column=6).value, sheet.cell(row=i+1, column=6).value
    if current > 0 and next < 0 or current < 0 and next > 0:
        print(i+1, next)

I am pretty sure there's a sign() function in the math library, but kinda overkill. You may also want to figure out what you want to do if the values are 0.

A: You can write the rules to select the rows where the sign has changed and put them in a generator expression without using extra memory, like this:
pos = lambda x: x>=0
keep = lambda s, c, i, v: pos(s[c][x].value)!=pos(v.value)
gen = (x+1 for x, y in enumerate(sheet['f']) if x>0 and keep(sheet, 'f', x-1, y))

Then, when you need to know the rows where the sign has changed, you just iterate on gen as below:
for row in gen:
   # here you use row

A: You can use a flag to check for positive and negative.
ws = wb['sheet1'] # why people persist in using long deprecated syntax is beyond me
flag = None

for row in ws.iter_rows(max_row=10508, min_col=6, max_col=6):
    cell = row[0]
    sign = cell.value > 0 and "positive" or "negative"
    if flag is not None and sign != flag:
        print(cell.row)
flag = sign


text:
Q: ActiveModel::ForbiddenAttributesError using update_attributes having created params hash myself I'm trying to edit/update a model record using simple_form, but the form is not going to directly change a model field.  Instead, I offer a couple of check_box_tag fields that tell update what fields need changed.  As a result, update is not receiving a params[:device] hash that I can use to update the attributes.  I am attempting to create this hash, but am getting ForbiddenAttributesError when I issue the @device.update_attributes(params[:device]).
I believe my strong parameters list is correct.  If I allow one model field (name) to be processed in the edit view, I receive the expected params[:device] hash and everything works.  If I disable that field, because I don't want it to be changed, then I need to create that hash myself and I receive the error.  When I look at the hash I created, it looks to me as equivalent to the one passed by the view.  I don't understand why it is failing.
Environment is Ruby 2.0.0, Rails 4.1 on Windows 8.1 with RubyMine 6.3.
The form is:  <... needs correct formatting once working ...>
<%= simple_form_for @device do |f| %>
      <legend><%= controller.action_name.capitalize %> Device:</legend>
      <%= f.input :name, disabled: true %>
      <%= check_box_tag(:is_admin, 0, @device.admin?) %>
      <%= label_tag(:is_admin, "Make admin?") %>
      <%= check_box_tag(:chg_pwd) %>
      <%= label_tag(:chg_pwd, "Change password?") %>
      <%= f.button :submit %>
<% end %>

The params[:device] that I receive when I sent f.input :name, disabled: false and allow the view to generate params[:device] is:
ActionController::Parameters (3 element(s))
"{"name"=>"D105", "password"=>"D105Dvgr", "password_confirmation"=>"D105Dvgr"}"

And, everything works.
The params[:device] that I create is:
ActionController::Parameters (3 element(s))
"{"name"=>"D106", "password"=>"D106VdAd", "password_confirmation"=>"D106VdAd"}"

And, I receive Forbidden Attribute Error, even though I see no difference between the two.
The update is:  <... Code needs refactored, once it is working...>
class DevicesController < ApplicationController
  before_filter :authenticate_device!

... other methods removed here ...

  def edit
    @device = Device.find(params[:id])
    # my_page = render_to_string controller: 'devices', action: 'edit', layout: "application"
  end

  def update
    authorize! :update, @device, :message => 'Not authorized as an administrator.'
    @device = Device.find(params[:id])
    pwd_msg = ""
    if params[:chg_pwd]
      pwd_gen = @device.device + SecureRandom.urlsafe_base64(15).tr('lIO0=_\-', 'sxyzEUM').first(4)
      params[:device] = {name: @device.name} if params[:device].nil?
      params[:device][:password] = pwd_gen
      params[:device][:password_confirmation] = pwd_gen
      pwd_msg = ", new password is #{pwd_gen}"
    end
    if @device.update_attributes(params[:device])
      params[:is_admin] ? @device.add_role(:admin) : @device.remove_role(:admin)
      flash[:notice] = ["Device updated" + pwd_msg]
      redirect_to devices_path
    else
      @device.errors.messages.each do |key, value|
        flash[:alert] = ["Unable to update device"]
        @device.errors.messages.each do |key, value|
          flash[:alert] << key.to_s.capitalize + " " + value[0]
        end
      end
      redirect_to devices_path
    end
  end

  private

  def device_params
    params.require(:device).permit(:device, :name, :email, :password, :password_confirmation, :encrypted_password, :salt, :role_ids, :is_admin, :chg_pwd)  # TODO minimize when update is working
  end

end

The model is:
class Device < ActiveRecord::Base

  rolify
  devise :database_authenticatable, :rememberable, :trackable, :validatable

  validates :device,
            presence: true,
            length: {minimum: 4 },
            uniqueness: {case_sensitive: false }
  validates :name,
            presence: true

  def remember_me
    true unless self.admin?
  end

  def admin
    self.add_role :admin
  end

  def not_admin
    self.remove_role :admin
  end

  def admin?
    self.has_role? :admin
  end
  def device?
    self.has_role? :device
  end
  def vip?
    self.has_role? :vip
  end

  def login=(login)
    @login = login
  end
  def login
    @login || self.device || self.email
  end

  def self.find_first_by_auth_conditions(warden_conditions)
    conditions = warden_conditions.dup
    if login = conditions.delete(:login)  # Note one equal sign.  Strange but true.
      where(conditions).where(["lower(device) = :value OR lower(email) = :value", { :value => login.downcase }]).first
    else
      where(conditions).first
    end
  end

end

NEW INFORMATION:  I neglected to provide information I have in the ApplicationController.  This fix from Anton Trapp handles strong parameters for gems that aren't yet fully Rails 4 compatible:
  before_filter do
    resource = controller_name.singularize.to_sym
    method = "#{resource}_params"
    params[resource] &&= send(method) if respond_to?(method, true)
  end

I have found that using the proposed solution of:
@device.update_attributes(device_params)

does not work if a model field is updated.  The result is "param not found: device".  It does work if no model field is update.  So, the whole issue begs the question of what is truly wrong.

A: In DevicesController#update action, change
@device.update_attributes(params[:device])

To
@device.update_attributes(device_params)

As you are using Rails 4.1, you need to whitelist the attributes which you would like to be inserted/updated in database. As you passed the attributes directly to update_attributes method without permitting them you received ActiveModel::ForbiddenAttributesError
UPDATE
To resolve param not found: device:
  def device_params
    if params[:device]
      params.require(:device).permit(:device, :name, :email, :password, :password_confirmation, :encrypted_password, :salt, :role_ids, :is_admin, :chg_pwd)  # TODO minimize when update is working
    end
  end

A: The fix was to add the fields as attr_accessor to the model, but not the database, so that it could be used correctly within the form.
  attr_accessor :is_admin, :chg_pwd

And then modify the view to:
<%= simple_form_for @device do |f| %>
    <legend><%= controller.action_name.capitalize %> Device:</legend>
    <%= f.input :name, disabled: true %>
    <%= f.input :is_admin, as: :boolean, checked_value: true, unchecked_value: false %>
    <%= f.input :chg_pwd, as: :boolean, checked_value: true, unchecked_value: false %>
    <%= f.button :submit %>
<% end %>

Then, due to the Application Controller code from Anton Trapp:
  before_filter do
    resource = controller_name.singularize.to_sym
    method = "#{resource}_params"
    params[resource] &&= send(method) if respond_to?(method, true)
  end

I was able to update the fields in Device Controller as follows:
@device.update_attributes(params[:device])


text:
Q: issue while adding glide dependencies I wrote a program in android with java, when I add the Glide dependencies
implementation 'com.github.bumptech.glide:glide:4.9.0'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
my android studio begins to give me this error:
"ERROR: Failed to resolve: support-fragment
Affected Modules: app
ERROR: Failed to resolve: animated-vector-drawable
Affected Modules: app"
this is my app bulid.gradle with the error shown

I looked for any similar answer past week and try them all but I wasn't able to solve this problem,
when I remove the Glide dependencies, everything comes back to normal again.
this is my app module build.gradle:
    apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.mohammad.kahgle"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.github.armcha:ElasticView:0.1.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.nightonke:boommenu:2.1.1'
implementation 'com.ramotion.foldingcell:folding-cell:1.2.2'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

A: I got this problem. if you don't use animated vector drawable with glide use this code to exclude useless dependencies :
implementation ("com.github.bumptech.glide:glide:4.9.0"){
    exclude group: 'androidx.vectordrawable', module: 'vectordrawable-animated'
}

happy coding :)

A: solving this problem in minsdkversion 21 and targetsdkversion 29 with below libraries:
add these to dependencies:
implementation 'androidx.fragment:fragment:1.2.0-rc04'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'

and downgrade the glide version to 4.8.0
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

A: Add this to your build.gradle file. for details see download section of  Glide
repositories {
  mavenCentral()
  google()
}

A: In your app module enable vectorDrawables useSupportLibrary
android {
    compileSdkVersion 27
    defaultConfig {
        ....
        vectorDrawables.useSupportLibrary = true
    }
}

Then add this in dependencies
dependencies {
    implementation 'com.android.support:support-vector-drawable:27.1.1'
}

A: use this :
 implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation group: 'androidx.fragment', name: 'fragment', version: '1.1.0'
implementation group: 'androidx.vectordrawable', name: 'vectordrawable-animated', version: '1.1.0'

A: The solution is to delete the caches folder inside ~/.gradle and download the dependencies again.
Add:
 implementation 'androidx.fragment:fragment:1.2.0-alpha04'
 implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
 implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'

to app/gradle


text:
Q: HTML5 canvas display image i would like to command my image.
Basically i have this code already;
But how to i move my image to its desired location?
Like a little bit on left, more to right, i mean the coordinates... where should i put it here?
  if(document.getElementById('fig1').checked){
        var canvas = document.getElementById('displaycake_sketch');
      var context = canvas.getContext('2d');
      var imageObj = new Image();

      imageObj.onload = function() {
        context.drawImage(imageObj, 10, 10);
      };
      imageObj.src = 'http://lh3.googleusercontent.com/-fsFMyfNLNG8/TuZs45U0dZI/AAAAAAAAg38/QIjqug0MnAo/Ic42/barbie6.png';

      }

Thank you in advance!

A: The drawImage() method of canvas has two coordinates (x and y). If you look at the documentation, you'll see, the second and third parameters of drawImage() method represents the x-coordinates and y-coordinates of the image respectively. So, you can move around the image to its desired location by changing those coordinates.
context.drawImage(imageObj, 10, 10)
                             ^   ^

DEMO

var canvas = document.getElementById('displaycake_sketch');
var context = canvas.getContext('2d');
var context2 = document.getElementById('displaycake_sketch_2').getContext('2d');
var imageObj = new Image();
imageObj.src = 'http://lh3.googleusercontent.com/-fsFMyfNLNG8/TuZs45U0dZI/AAAAAAAAg38/QIjqug0MnAo/Ic42/barbie6.png';
imageObj.onload = function() {
  context.drawImage(imageObj, 10, 10);
  context2.drawImage(imageObj, 25, 85);
};
#displaycake_sketch, #displaycake_sketch_2 {
  background-color: pink;
}
<canvas width="298" height="397" id="displaycake_sketch"></canvas>
<canvas width="298" height="397" id="displaycake_sketch_2"></canvas>

A: context.drawImage(imageObj, 10, 10);

This is the line that controls the coordinates; the first 10 is the x value and the second 10 is the y value.

A: you can move the image using x,y coordinate with .drawImage(image,x,y) function
if(document.getElementById('fig1').checked){
      var canvas = document.getElementById('displaycake_sketch');
      var context = canvas.getContext('2d');
      var imageObj = new Image();

      imageObj.onload = function() {
        context.drawImage(imageObj, 20, 20);
      };
      imageObj.src = 'http://lh3.googleusercontent.com/-fsFMyfNLNG8/TuZs45U0dZI/AAAAAAAAg38/QIjqug0MnAo/Ic42/barbie6.png';
 }

Reference : https://www.w3schools.com/graphics/canvas_images.asp


text:
Q: Use rightclick to move/translate a feature in Openlayers 3 I'm rebuilding a working GoogleMaps Api v3 site to use Openlayers (3/4).
I want to make vector points (coming from a Postgis table) draggable by rightclicking them, so that they can be moved (translated) on the map to another position. The new position should then be updated in the database (by calling a php-script and passing the new position).
I want to use a rightclick instead of a singleclick or click to prevent users from changing positions accidentally while dragging around the map. As this could occur in the drag-features example. On our GoogleMaps site this works perfect and users feel fine with rightclicking to make features draggable.
I was looking around to find a solution, since Openlayers until now does not offer a rightclick event. The only good example for rightclicking that always appears is the ol3-contextmenu.
Is this really the only work around? I don't need and I don't want to use context menus.


text:
Q: What can use instead CFReadStreamCreateForHTTPRequest? This method CFReadStreamCreateForHTTPRequest(...) was deprecated for IOS 9 and younger.
Docs of Apple suggests to use NSURLSession instead of this. But I don't understand how  I can reintegrate functionality which works with Live (I use stream) by NSURLSession.
I don't see any possibility for load "live" by NSURLSession.
What do you use for load live data by special url from server?


text:
Q: SystemVerilog Interface in a vertical hierarchy I'm implementing a system that uses an interface to connect two blocks that implements AXI4 lite functions.
Problem is the master and the slave blocks are inside other blocks.
The code above shows an example of what I'm trying to do:
interface bus
  logic [ADDR_WIDTH-1:0] wr_addr;   // Write address
  logic [DATA_WIDTH-1:0] wr_data;   // Write data
  logic [ADDR_WIDTH-1:0] rd_addr;   // Read address
  logic [DATA_WIDTH-1:0] rd_data;   // Read data

  modport master (
    output wr_addr,
    output wr_data,
    input  rd_addr,
    input  rd_data
  );

  modport slave (
    input   wr_addr,
    input   wr_data,
    output  rd_addr,
    output  rd_data
  );

endinterface

// innermost master block
module m0(bus.master bus_inst_m0);

  // write/ read data from/to master modport
  bus_inst_m0.wr_addr <= ...
  if(bus_inst_m0.rd_addr == ...

endmodule

// instance of m0 block connected
// to interface
module m1(bus.master bus_inst_m1);

  m0 m0_inst(.bus_inst_m0 (bus_inst_m1))

endmodule

// innermost slave block
module s0(bus.slave bus_inst_s0);

  // write/ read data from/to slave modport
  bus_inst_s0.rd_addr <= ...
  if(bus_inst_s0.wd_addr == ...

endmodule

// instance of ms block connected
// to interface
module s1(bus.slave bus_inst_s1);

  s0 s0_inst(.bus_inst_s0 (bus_inst_s1))

endmodule

// top module
module top();

  bus local_bus;

  m1 m1_inst (.bus_inst_m1 (local_bus));
  s1 s1_inst (.bus_inst_s1 (local_bus));

endmodule

In Cadence Incisive simulator, the code compiles, but it not works. Looking in the schematic I see that the top interface is connected, but the inner interfaces are just open.
I made a small test connecting directly the master and slave blocks and it worked fine.
I have tried other combinations of interface/modport too, like using modport just in the innermost blocks, but it didn't work.
I read the LRM and did not found any clue about what I'm doing wrong.
Can anyone help?
Thanks
Rods

A: First of all, you have a bunch of options to use.
You can use generic interfaces as module parameters to avoid type errors. In this case, as long as the connected interface has all the signals that the module use, you will be okay. (And if the tool finds the proper interface...) Eg.:
module mod_gen_inf(interface gen_if);
endmodule
...
module top();
  m_bus_if m_bus;
  m_1 slave_actor(.gen_if(m_bus.master));
endmodule: top

Secondly, you can, but you are not required to specify the modport (type) at the module declaration. You can use the interface's name, and connect the specific modport at the module instantiation. Eg.:
module slave_actor(m_bus m_bus_if);
endmodule
...
module top();
  m_bus_if m_bus;
  m_1 slave_actor(.m_bus_if(m_bus.slave));
endmodule: top

Think of this as the modport is a compatible type of the given interface.
Thus a corrected/shortened version of your code:
interface m_bus;
  logic [1:0] a;
  modport master(input a);
  modport slave (output a);
endinterface

module m1(m_bus.master bus_inst_m1);
  m2 m2_inst(.bus_inst_m2(bus_inst_m1));
endmodule

module m2 (m_bus.master bus_inst_m2);
endmodule

module s1(m_bus.slave bus_inst_s1);
endmodule

module top();
  m_bus local_bus();

  m1 m1_inst (.bus_inst_m1 (local_bus.master));
  s1 s1_inst (.bus_inst_s1 (local_bus.slave));
endmodule

This worked me fine in QuestaSim 10.5c.
If your code compiled but does not work, make sure that your innermost block sees the interface as well. (include the library that your IF is compiled into.)


text:
Q: View size of file in human readable format with no rounding in macOS bash In bash I'm able to use du -sh to view file sizes in human readable formats, and ls -lta to view the full size in bytes. Is there a way to view the human readable amount without rounding? Examples below.
du
~ du -sh test.txt
 26G    test.txt

ls
 ~ ls -lta test.txt
-rw-r--r--  1 username  staff  27992876444 Apr  2 10:53 test.txt

desired
 ~ some_command test.txt
26gb 72mb 89kb 412b


text:
Q: JavaScript loading multiple images using For Loop not working Here is the script. It only loads the last image for some reason. I know it is missing something simple but I just don't know where. I am a newbie to JS. Thanks guys.

img0

img1

img2

        <form action="" method="post" enctype="multipart/form-data">
            Select Image Files:
            <input type="file" name="image[]" onchange="onFileSelected(event)"  multiple />
            <input type="submit" name="submit" value="Upload">
        </form>

A: Your problem is back to FileReader function.FileReader is I/O process and have delay. if you want use FileReader you must use await/sync function.you can see this link and read this document about FileReaderSync .

A:

img0

img1

img2

    <form action="" method="post" enctype="multipart/form-data">
        Select Image Files:
        <input type="file" name="image[]" onchange="onFileSelected(this)" multiple />
        <input type="submit" name="submit" value="Upload">
    </form>

This should definitely work. Try to use let or const instead of var.


text:
Q: Apache Spark EC2 c4.2xlarge not launching When attempting to launch an EC2 cluster (c4.2xlarge) using the Apache Spark EC2 script I get the following error:
Don't recognize c4.2xlarge, assuming type is pvm
Spark AMI: ami-9a6e0daa
Launching instances...
ERROR:boto:400 Bad Request
ERROR:boto:<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error>InvalidParameterCombination<Message>Virtualization type 'hvm' is required for instances of type 'c4.2xlarge'.</Message></Error></Errors

Any fixes?

A: The instance type you are using isn't supported in the spark-ec2 script.
This is the list of the EC2 types you can use :
c1.medium, c1.xlarge,c3.2xlarge c3.4xlarge c3.8xlarge c3.large c3.xlarge cc1.4xlarge, cc2.8xlarge, cg1.4xlarge , cr1.8xlarge, hi1.4xlarge, hs1.8xlarge, i2.2xlarge, i2.4xlarge,  i2.8xlarge, i2.xlarge, m1.large, m1.medium, m1.small, m1.xlarge, m2.2xlarge, m2.4xlarge, m2.xlarge, m3.2xlarge, m3.large, m3.medium, m3.xlarge, r3.2xlarge, r3.4xlarge, r3.8xlarge, r3.large, r3.xlarge, t1.micro, t2.medium, t2.micro, t2.small
I invite you to read the script source code here.


text:
Q: Container overflows the page (React) New to React. I wish to make the page grow and scrollable as the container gets bigger. But now the container overflows at the top, although I can scroll to see the bottom part.
https://codesandbox.io/s/misty-haze-4dnb7?file=/src/App.js
In this sandbox, the back button at the top overflows the page. If I add one more {test}, the button will be gone. Is there a way to fix this?

A: If You trying to ask to fix the Back button on the top.
You can do that by giving your  row, a className
<Row className="pb-4 header">
            <Button className="mt-4 letter" variant="outline-light">
              {"< Back"}
            </Button>
          </Row>

and set its property to
.header{
position:fixed;
}


text:
Q: Optimized arithmetic methods in R The openssl package implements a bignum class with the corresponding methods for arithmetic and comparison to perform calculations on arbitrary sized integers.
In cryptography there is a common special case for the modular exponent x^p %% m which is used by e.g. rsa. For large p, calculating x^p is not feasible, but x^p %% m can be calculated efficiently which OpenSSL implements in BN_mod_exp().
Does R provide any mechanism to implement the  ^.bignum and %%.bignum methods such that when evaluating x^y %% z we can call this special case rather than actually calculating x^p?

A: Late to the party but yes, this is absolutely possible, and it's a moderately common programming technique in some languages, such as C++, where the technique is known as expression templates.
R, being weakly typed, cannot quite harness the pattern to the same extent. But a "light" version is still possible.
In a nutshell, you define your ^.bignum operator so that, instead or computing the result immediately, it returns a proxy object that signifies "exponentiation operation". This proxy object has a specially overridden %% method that invokes the ExpMod implementation (e.g. BM_mod_exp). It also defines a method that coerces it to a bignum by evaluating the actual x ^ y operation.
In code this may look as follows:
# Vectorisation left as an exercise for the reader.

`^.bignum` = function (x, y)
    structure(c(x, y), class = 'bignum_mod_exp_proxy')

eval_exp = function (x)
    call_actual_exp(x[1], x[2])

as.bignum = function (x)
    if (inherits(x, 'bignum_mod_exp_proxy'))
        eval_exp(x)
    else
        # … implement other coercions to bignum, e.g. from `numeric`.

`%%.bignum_mod_exp_proxy` = function (x, y)
    call_BN_mod_exp(x[1], x[2], y)

# Pretend that a `bignum_mod_exp_proxy` in all other contexts. E.g.:

print.bignum_mod_exp_proxy = function (x, ...)
    print(eval_exp(x))

# … etc., for the rest of the `bignum` operations.

In fact, you could even override =.bignum_mod_exp_proxy, <-.bignum_mod_exp_proxy and assign.bignum_mod_exp_proxy (converting assign into an S3 generic), so that assignments z = x ^ y are eagerly evaluated to a bignum. However, this is probably overkill and would incur an overhead for each assignment.