text:
Q: Android App S3 upload not working. No error I am working on building an android app that takes a picture and uploads that to Amazon S3. My code seems to be running fine, in that it is actually running (confirmed via debug breakpoints), however it is not uploading. I get no error messages, and log.d messages that I put into the app do not appear in the logcat.
I am using this amazon tutorial: http://docs.aws.amazon.com/mobile-hub/latest/developerguide/add-aws-mobile-user-data-storage.html#add-aws-mobile-user-data-storage-app
The first time I ran the code, I got an error complaining that TransferUtility.builder() didnt have .s3Client So I put that in.
Offending code:

private void uploadImage(){
        AWSConfiguration awsConfig =
                new AWSConfiguration(getActivity().getApplicationContext());
        AmazonS3Client s3Client = new AmazonS3Client(IdentityManager.getDefaultIdentityManager()
                .getCredentialsProvider().getCredentials());

        TransferUtility transferUtility =
                TransferUtility.builder()
                        .context(getActivity().getApplicationContext())
                        .awsConfiguration(awsConfig)
                        .s3Client(s3Client)
                        .build();

        TransferObserver uploadObserver =
                transferUtility.upload(
                        "sniffer-gps-app/UserDogPhotos/"+userId+photoFile.getName(),
                        photoFile);

        uploadObserver.setTransferListener(new TransferListener() {

            @Override
            public void onStateChanged(int id, TransferState state) {
                if (TransferState.COMPLETED == state) {
                    //todo something here
                    Log.d("S3", "done");
                    nextFragment();
                }

            }

            @Override
            public void onProgressChanged(
                    int id, long bytesCurrent, long bytesTotal) {
                Log.d("S3", "ID: "+id+"\r\nBytesCurrent: "+bytesCurrent+"\r\nBytesTotal: "+bytesTotal);
                // TODO Auto-generated method stub

            }

            @Override
            public void onError(int id, Exception ex) {
                Log.d("S3", ex.toString());
                Integer ID = id;
                Log.d("S3", ID.toString());
            }

        });
    }

photoFile is a File object.
sniffer-gps-app is the bucket name
UserDogPhotos is a folder in the bucket

A: The service tag in my manifest was outside of my application tag.


text:
Q: What is the thing called in GNOME 3 that appears when you press the super key? When using Ubuntu 16.04 with the GNOME desktop and pressing the super key it causes an overlay to appear that displays Workspaces, overview of Applications, Application Launcher on the left, and search at the top.
I'm wondering what this feature is called?

A: It's generally called the "(Activities) Overview":

Activities Overview
This is a separate view designed to enable users to get an overview of
their current activities and to enable effective focus switching (in
this regard, the overview is a facilitator and a mediator, not a
destination). The top bar continues to be displayed in the overview in
order to provide a familiar landmark and visual anchor.

It's composed of:

*

*the dash,

*the window picker,

*the application picker,

*the search,

*the workspace switcher, etc.
We also have a tag for it: activities-overview

redpajama_set_name: RedPajamaStackExchange


text:
Q: A question about 3D Trigonometry
The questions I am stumped on are parts c) and d).
I am bewildered as to which triangles I am meant to use. For context, I have got an answer of 54.7 for part b and this is correct.
Solutions to c and d are below:
Solutions
c) 35 degrees
d) 24 degrees
I would really appreciate any help about where I am going wrong here. Thank you.

A: In cross section through points A, F and M by a plane containing these points, is triangle AMF which gives first angle $\alpha$:
$\tan (\alpha)=\frac{15}{10}=1.4\Rightarrow \alpha=56.3$
In cross section through points A, B and M by a plane containing these points, is triangle AMB which gives first angle $\beta$:
$\tan (\beta)=\frac{15}{\sqrt{10^2+10^2}}=1.06 \Rightarrow \beta= 46.7$
Second question:
a):
$AG=\sqrt{AB^2+BC^2+CG^2}=\sqrt{4^2+4^2+8^2}=9.7$
b):Consider a plane contanig vertices A,C,E and G. we have right angled triangles AGC and AGE.
$tan(\gamma)=\frac8{\sqrt{4^2+4^2}}=1.41\Rightarrow \gamma=54.7$
c):Angle between AG and EFGH is equale to angle between AG and ABCD:
$\theta=\gamma=54.7$
d):
$AH^2=AE^2+EH^2=4^2+8^2=80 \Rightarrow AH=4\sqrt 5$
$\tan (\alpha)=\frac 4{4\sqrt 5}=0.447\Rightarrow \alpha= 24^o$


text:
Q: How to estimate a wide row's size (1000 columns) in MySQL InnoDB? My particular problem that I'd like to solve is a table with very wide column (sometimes > 1000 columns) which requires me to split the table. In order to do so smartly, I'd like to split right before I get Row size too large (> 8126) or The maximum row size for the used table type, not counting BLOBs, is 65535..
For that purpose, I'm trying to find the actual size for each columns. Some are easy (like BOOLEAN, INT, DATE, TEXT, etc). I'm trying to figure out VARCHAR. Hence the experiment of creating tables with many VARCHAR columns.
However, I cannot really make sense of it. I tried experimenting with a table containing only VARCHAR(217), I was able to create 100 columns. The next column (101th) maximum size is VARCHAR(78).
CREATE TABLE IF NOT EXISTS test
(
col1    VARCHAR(14) NOT NULL,
col2    VARCHAR(14) NOT NULL,
...
col100  VARCHAR(217) NOT NULL,
col101  VARCHAR(78) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

I figured out that the reasoning is as below:

*

*2 bytes for storage of length value and NOT NULL

*217x3 = 651 bytes for off-page storage

*So 100 columns = 2x100 + 651x100 = 65300

*Max is 65535 - 65300 = 235 bytes

*Therefore, we can fit 1 more column of maximum (235 - 2) / 3 = 77.666666666666667 … or VARCHAR(78)

Applying the above for VARCHAR(128), I expect 65535 / (128x3+2) or 169 columns with the last column can fit VARCHAR(99). And it is indeed, true. This works:
CREATE TABLE IF NOT EXISTS test
(
col1    VARCHAR(128) NOT NULL,
col2    VARCHAR(128) NOT NULL,
...
col169  VARCHAR(128) NOT NULL,
col170  VARCHAR(99) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

Applying the same logic for VARCHAR(64) doesn't work, however. Applying the same logic above, I would expect 337 columns. However, I can only get 197 columns. Anything more than that, I got Row size too large (> 8126) error.
CREATE TABLE IF NOT EXISTS test
(
col1    VARCHAR(64) NOT NULL,
col2    VARCHAR(64) NOT NULL,
...
col196  VARCHAR(64) NOT NULL,
col197  VARCHAR(64) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

The same thing is for VARCHAR(14). I can also create 197 columns max before hitting Row size too large (> 8126) error. I experienced further and discovered that up to VARCHAR(109), I would get Row size too large (> 8126) error. However for VARCHAR(110), I would get a different error The maximum row size for the used table type, not counting BLOBs, is 65535..
MySQL documentation says

When a table is created with ROW_FORMAT=DYNAMIC, InnoDB can store long variable-length column values (for VARCHAR, VARBINARY, and BLOB and TEXT types) fully off-page, with the clustered index record containing only a 20-byte pointer to the overflow page.

which I suspect is what's going on here where InnoDB would store some values fully off page because there's no way 197 of 64-length utf8 strings can fit in 8126. If all of the 64-length utf8 strings are stored in-line, I would expect 41 columns maximum ( 8126 / (64x3+2) ).
Any help appreciated. I'm using MySQL 5.7.26-29, Barracuda file format and 16K page size.

A: Even when InnoDB stores a varchar/blob/text column "fully" off-page, there is still a 20-byte pointer on the main page. So it's not like you can make a table with an infinite number of columns. Or even 1000 columns.
Also there's a limit to the row size imposed by the metadata file (.frm). It's pretty complicated. See https://www.percona.com/blog/2013/04/08/understanding-the-maximum-number-of-columns-in-a-mysql-table/
And this is completely changed in MySQL 8.0, because the .frm file has been replaced by a new data dictionary implementation. I haven't looked into this enough to know the limits.
All that said, you haven't described why you have a table with so many varchar columns, but I think any table that has hundreds of columns is a Code Smell. That is, it's not guaranteed to be a bad design, but it sure smells like one. It's like when your IDE complains at you when you write a single code method that is 1000+ lines long. Is it possible that a method might need to be that long? Sure. Is it usually a bad idea? Definitely.
Another software engineering metaphor you should be aware of is an XY Problem. Don't let yourself get so fixated on making one solution work that you overlook alternative solutions that might be much easier.

A: The max is just over 8KB on-record.
What ROW_FORMAT is being used?
Long strings may be split between the 8KB limit and a virtually unlimited "off-record" storage.
VARCHARs, TEXTs, VARBINARYs, and BLOBs are allocated in one of these ways:

*

*Entirely on-record.  This applies to strings < 40 bytes.  (I think this applies to all row_formats.)

*Up to 767 bytes in the record; the rest in an "overflow block".  This applies to row_format=COMPACT.

*Entirely in an overflow block.  This applies for DYNAMIC and COMPRESSED.  It leaves behind a 20-byte "pointer".  So count it as 20 bytes.

I don't know:

*

*Whether I am off by the "2" that you mentioned.

*What happens in the cases not mentioned.

As for doing the 'vertical partitioning', I have these thoughts:

*

*Do not have an "array" of things spread across columns.  Instead spread them across rows in another table.

*Split your wide table into more than just 2 tables.

*Split it based on related information.

*Split out columns that are mostly NULL.  Then use LEFT JOIN when tying them back together since there could be missing rows in the new table.

*Normalize repeated strings.  Eg: 2-letter country_code for country.  (But don't normalize short strings.)

*Where practical, do use smaller column types of non-string columns (eg 1-byte TINYTINT versus 8-byte BIGINT)

*Consider 'compressing' large text columns in the client and storing them in a BLOB.  Typical text shrinks 3:1.  This shrinkage helps with disk space, your row size limit, and perhaps performance.

*ROW_FORMAT=COMPRESSED shrinks about 2:1, but has a lot of overhead and may not actually help with your question.

*The CHARACTER SET probably has no impact (not even the 3x you mention) if all the text is using only English characters.

*Would it work to have a few columns that are used for searching/sorting, plus one large JSON column?  That JSON column could be gigabytes in size, landing mostly in the off-record storage.  That would quickly solve the 8KB limit.

*I have seen no one actually change the blocksize.  But, in theory, a 32KB block (for all tables on your server) would give you a 16KB max per record.  There is also a 64KB option, but it also limits the row size to 16KB.

More on sizes:

*

*I think a NULL column takes 3 bytes.

*A row has about 20-30 bytes of overhead.

*A block is not filled more than 15/16th full (in hopes of allowing one extra row to be added).  (I have quibbles with the logic.)


text:
Q: Mapbox not returning voice instructions, causing Android app to crash We are seeing a spike in Android users who are getting this error which crashes the app:
Attempt to invoke virtual method 'java.lang.String com.mapbox.navigator.VoiceInstruction.getSsmlAnnouncement()' on a null object reference
I think this is due to the Mapbox API not sending voice instructions.
It looks like this first started happening yesterday (19th August from 22:30 UTC to 23:36 UTC) and then again today (20th August since 07:44 UTC).

A: Thank you for reporting this issue. We've tracked it down to a change in the Directions API on the server side that was rolled back around 05:00 UTC on August 20th: https://status.mapbox.com/incidents/v43rj0fm0hkj . Can you please confirm that you're no longer experiencing the issue?
Kayla Bauhaus-Ness
(Mapbox Support)


text:
Q: How to implement long scrolling behaviour So I'm creating a portfolio of my work and I wanted to implement some form of long scrolling similar to this: https://blocksphere.co/#home
I've been reading some articles on how to get this behaviour right and come across CSS snap scrolling but this just seems to guide the user to the nearest container rather than snap and pause.
I need a simple example of how to implement this behaviour as I'm a bit stumped as to whether this behaviour is achieved by JS or pure CSS.
Thanks in advance.
Sources: https://css-tricks.com/introducing-css-scroll-snap-points/

A: This is a pure CSS solution, as outlined in the codepen that is presented on the link you provided. The browser support for this method of scrolling is not the greatest in older/legacy browser so they "Polyfill" it for those browser using JavaScript code. Polyfilling means that you forcefully implement a modern behaviour/feature that is not natively implemented in the browser.


text:
Q: error: cannot pass objects of non-trivially-copyable type 'class boost::filesystem::path' through '...' Errors:

init.cpp: In function 'bool AppInit2()':
init.cpp:608:83: error: cannot pass objects of non-trivially-copyable type 'class boost::filesystem::path' through '...'
printf("Creating backup of %s -> %s\n", sourceFile, backupFile);
init.cpp:608:83: error: cannot pass objects of non-trivially-copyable type 'class boost::filesystem::path' through '...'
init.cpp:643:76: error: cannot convert 'boost::filesystem::path' to 'const char*' for argument '2' to 'int sprintf(char*, const char*, ...)'
sprintf("Old backup deleted: %s\n", file.second);
make: *** [obj/init.o] Error 1
filesystem::path backupDir = GetDataDir() / "backups";
if (!filesystem::exists(backupDir))
{
    // Always create backup folder to not confuse the operating system's file browser
    filesystem::create_directories(backupDir);
}
nWalletBackups = GetArg("-createwalletbackups", 10);
nWalletBackups = std::max(0, std::min(10, nWalletBackups));
if(nWalletBackups > 0)
{
    if (filesystem::exists(backupDir))
    {
        // Create backup of the wallet
        std::string dateTimeStr = DateTimeStrFormat(".%Y-%m-%d-%H.%M", GetTime());
        std::string backupPathStr = backupDir.string();
        backupPathStr += "/" + strWalletFileName;
        std::string sourcePathStr = GetDataDir().string();
        sourcePathStr += "/" + strWalletFileName;
        boost::filesystem::path sourceFile = sourcePathStr;
        boost::filesystem::path backupFile = backupPathStr + dateTimeStr;
        sourceFile.make_preferred();
        backupFile.make_preferred();
        try {
            boost::filesystem::copy_file(sourceFile, backupFile);
            printf("Creating backup of %s -> %s\n", sourceFile, backupFile);
        } catch(boost::filesystem::filesystem_error &error) {
            printf("Failed to create backup %s\n", error.what());
        }
        // Keep only the last 10 backups, including the new one of course
        typedef std::multimap<std::time_t, boost::filesystem::path> folder_set_t;
        folder_set_t folder_set;
        boost::filesystem::directory_iterator end_iter;
        boost::filesystem::path backupFolder = backupDir.string();
        backupFolder.make_preferred();
        // Build map of backup files for current(!) wallet sorted by last write time
        boost::filesystem::path currentFile;
        for (boost::filesystem::directory_iterator dir_iter(backupFolder); dir_iter != end_iter; ++dir_iter)
        {
            // Only check regular files
            if ( boost::filesystem::is_regular_file(dir_iter->status()))
            {
                currentFile = dir_iter->path().filename();
                // Only add the backups for the current wallet, e.g. wallet.dat.*
                if(currentFile.string().find(strWalletFileName) != string::npos)
                {
                    folder_set.insert(folder_set_t::value_type(boost::filesystem::last_write_time(dir_iter->path()),

*dir_iter));
                      }
                  }
              }
              // Loop backward through backup files and keep the N newest ones (1 <= N <= 10)
              int counter = 0;
              BOOST_REVERSE_FOREACH(PAIRTYPE(const std::time_t, boost::filesystem::path) file, folder_set)
              {
                  counter++;
                  if (counter > nWalletBackups)
                  {
                      // More than nWalletBackups backups: delete oldest one(s)
                      try {
                          boost::filesystem::remove(file.second);
                          sprintf("Old backup deleted: %s\n", file.second);
                      } catch(boost::filesystem::filesystem_error &error) {
                          sprintf("Failed to delete backup %s\n", error.what());
                      }
                  }
              }
          }
      }

A: Friend's @πάνταῥεῖ  answer solved my problem!
std::cout << "Creating backup of" << sourceFile << "->" << backupFile << '\n';

std::cout << "Old backup deleted:" << file.second << '\n';

Thank you very much!


text:
Q: How to reduce repetitve "and" in a title? So I've been told to avoid repeating the same connective word in a title but I just can't seem to put together something that would make sense. My example title is below

Maternal age is correlated with decreased infant gut microbial diversity and changes in eating behaviour and infant weight

My attempts to remove the double usage of the word "and" have been as follows
A) "Maternal age is correlated with decreased infant gut microbial diversity, changes in eating behaviour and infant weight"
B) "Maternal age is correlated with a decrease in infant's gut microbial diversity, changes in eating behaviour amongst infants and infant weight"
C) "Maternal age is correlated with decreased gut microbial diversity, changes in eating behaviour and weight in infants"
D) "Maternal age is correlated with decreased infant gut microbial diversity along with changes in eating behaviour and infant weight"
So of these 4 which would be grammatically better than the original in your opinion? Or is there a much better way of going about this?
For clarification's sake, the variable maternal age was found to be correlated with decreased infant gut microbial diversity. It was also found to correlate with changes in eating behaviour amongst infants. Lastly, it was also found to correlate with infant weight.
tldr: Supervisor doesn't want to see the word "and" used twice in the title.

A: First of all, there is nothing wrong with using the word "and" twice in a title. Sometimes avoiding such use makes writing stronger, but not always. However, if a supervisor demands this, one must normally comply.
All of the suggested alternatives, A) through D) are grammatically valid, and a fluent user of English might write any of them. All except D) form a three-item list, and I would use a serial comma before the final "and". But that is a matter of style, such a comma may be freely included or omitted.
I, personally, would not favor C), because by moving 'infants'" to the end, it makes the reader wait to understand whose "gut microbial diversity" is being discussed. So I would favor A) or B), but again, any of the four would be acceptable.

A: As another answer notes, there is nothing wrong in general with using "and" multiple times. However, your original title is ambiguous for several reasons:

*

*It is unclear whether "decreased" modifies only the microbial diversity or both the microbial diversity and the changes.

*It is unclear whether the changes are only in eating behavior or are also in infant weight.

*It is unclear whether the eating behaviour is the mother's or the infant's.
Your options A, B, and C suggest that the changes are only in eating behavior, your option B suggests that the eating behavior belongs to the infants, and your option D suggests that the decrease is only in microbial diversity. (By the way, your option B is ungrammatical because "infant" would require a determiner.) Assuming that that is correct, something like this would resolve all of the ambiguities:

Maternal age is correlated with infant weight, changes in infant eating behaviour, and decreased infant gut microbial diversity

A: This works: Maternal age is correlated with decreased infant gut microbial diversity as well as with changes in eating behaviour and infant weight
Of your four proposed revisions, only D is grammatically correct. (I say this as a copy editor and writer with almost 40 years' experience; I mean no disrespect to the others who responded to you, but A, B, and C are incorrect.)
Let's simplify this sentence to understand why two conjunctions -- two "ands," or one "and" and one synonym -- are needed.
Age is correlated with decreased X ==and== changes
BUT, we're talking about two types of changes, so that become
Age is correlated with decreased X ==and== changes to One ==and== Two
The "and" that links One and Two CANNOT do double duty as the "and" that links "decreased X and changes."
So. Altering the conjunction and that links the two types of changes would be little clunky (changes in ___ as well as in ___), so let's alter that first conjunction. Here's the simplified version, to help you see the sentence structure: Age is correlated with X as well as with changes to One and Two.
PS: If you want to make your supervisor's head explode, show her that multiple ands are sometimes necessary:
We ate mac and cheese, ham and eggs, and peaches and cream.


text:
Q: How to read Json responce in to DataGridView using RestSharp in C# windows Application {
  "success": 1,
  "items": [
    {
      "ItemID": "13",
      "ItemName": "Diamond (50 Kg PP)",
      "ItemDesc": "",
      "MRP": "0",
      "Rate": "0",
      "Unit": "",
      "Weight": "50",
      "ItemGroup": ""
    },
    {
      "ItemID": "8",
      "ItemName": "Extra Milk (59 Kg Jute)",
      "ItemDesc": "",
      "MRP": "0",
      "Rate": "0",
      "Unit": "",
      "Weight": "59",
      "ItemGroup": ""
    },
    {
      "ItemID": "19",
      "ItemName": "Extra Milk (59 Kg PP)",
      "ItemDesc": "",
      "MRP": "0",
      "Rate": "0",
      "Unit": "",
      "Weight": "59",
      "ItemGroup": ""
    },
    {
      "ItemID": "23",
      "ItemName": "Test222",
      "ItemDesc": "",
      "MRP": "0",
      "Rate": "0",
      "Unit": "",
      "Weight": "50",
      "ItemGroup": ""
    }
  ]
}

my code
public  async void myweb()
{
    string vJ = "";
    string url = "https://crmscf.vidyasystems.com/api/gen/items.php";
    var client = new RestClient(url);
    var request = new RestRequest();

    var responce = client.Get(request);
    // Console.WriteLine(responce.Content.ToString());
    // txtJson.Text = responce.Content.ToString();

    vJ =  responce.Content.ToString();
    DataTable dataTable = (DataTable)JsonConvert.DeserializeObject(@vJ, (typeof(DataTable)));
    dgvXml.DataSource = dataTable;
}

I am getting error :

Newtonsoft.Json.JsonSerializationException: 'Unexpected JSON token when reading DataTable. Expected StartArray, got StartObject. Path '', line 1, position 1.'

A: The following uses a different method to read json. The models and helper class belong in their own files.

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Windows.Forms;
using Newtonsoft.Json;

namespace DemoApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void ReadJsonButton_Click(object sender, EventArgs e)
        {
            try
            {
                using (var wc = new WebClient())
                {
                    var json = wc.DownloadString("https://crmscf.vidyasystems.com/api/gen/items.php");
                    Container container = JsonConvert.DeserializeObject<Container>(json);
                    if (container != null && container.success == 1)
                    {
                        var dt = container.items.ToList().ToDataTable();
                    }
                    else
                    {
                        // deal with it
                    }
                }
            }
            catch (Exception ex)
            {
                // deal with error
            }

        }
    }

    public class Container
    {
        public int success { get; set; }
        public Item[] items { get; set; }
    }

    public class Item
    {
        public string ItemID { get; set; }
        public string ItemName { get; set; }
        public string ItemDesc { get; set; }
        public string MRP { get; set; }
        public string Rate { get; set; }
        public string Unit { get; set; }
        public string Weight { get; set; }
        public string ItemGroup { get; set; }
    }

    public static class Operations
    {
        public static DataTable ToDataTable<T>(this IList<T> list)
            => (DataTable)JsonConvert
                .DeserializeObject(JsonConvert.SerializeObject(list), (typeof(DataTable)));
    }

}


text:
Q: CondaHTTPError: HTTP 000 CONNECTION FAILED for url - Anaconda I have seen other post solving through ssl_verify making it false or adding the path of the certificate. I have done every one of them. I have installed and reinstalled several times the anaconda. I have disabled my antivirus program.
I have tried every option that I find online but nothing is working for me and I still get this error.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.

SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/main/win-64/current_repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

I'm not sure what I'm should be doing?

A: I strongly recommend to copy libcrypto-1_1-x64.* libssl-1_1-x64.* from .\Library in Anaconda folder to .\DLL in Anaconda folder. I'm 100% sure that your problem will be solved. Please don't crack your heads looking for solution on all the platforms.
Don't try editing .condarc file and face further issues. I am sure that problem will be solved after moving the above mentioned DLL files as directed.

A: I'm getting the same problem in Windows Subsystem for Linux (version 2) with "conda create -name sx python=3.7" the weird thing is "wget https://repo.anaconda.com/pkgs/main/linux-64/current_repodata.json" works fine, so I have no idea why conda is failing to fetch this file...

A: For me the issue gone after changing in c:\Users\user_xxx.condarc:
"ssl_verify: true" to "ssl_verify: false"

A: i had the same issue on win 10 and i resolved it by uninstalling the avast antivirus on my PC. I don't know if it's a good idea but i tried it and the issue was resolved.

A: in linux, conda config --set ssl_verify no resolves the issue.


text:
Q: unable to access all laravel routes I am not able to access other laravel routes when I am accessing the route through which I am reading about 100 files line by line and then comparing the lines one by one with a standard data set file to save the data in db. Once I run this route, which takes almost 30 minutes to complete, I am unable to access any other route. Once that is finished or I turn off the wamp server(MySQL service) then I can access all routes.
This is the function which reads the data from around 100 files and send to another function for comparison
public function readData(){
        $filename = public_path() . '/online/daraz/smartphones.txt';
        $onlineData = file_get_contents($filename);

        $di = new \RecursiveDirectoryIterator(public_path().'/scrap/');

        foreach (new \RecursiveIteratorIterator($di) as $filename => $file) {

            if($file->getExtension() == 'txt' && $file->isFile()){
                /*if(strtolower(explode(".", $file->getFileName())[0]) == $brandName){*/

                    try
                    {
                        $onlyFileName = strtolower(explode(".", $file->getFilename())[0]);
                        $gsmData = file_get_contents($filename);
                        //$this->saveData($gsmData, $onlyFileName);
                        $this->compareData($gsmData, $onlineData, $onlyFileName);

                    }
                    catch (FileNotFoundException $exception)
                    {
                        die("The file doesn't exist");
                    }
                //}
            }
            /*if(@is_array(getimagesize($file))){
                echo 'true';
            } else {
                echo 'false';
            }*/
        }

    }


text:
Q: How to use populate on saving new data on mongoose Hello their I am trying to populate postedBy field on creating a new comment.
When i create a comment i save it on mongodb and also I save comment._id on my feature model (as objectId)
then i am sending res.json(comment)
Can i populate before sending json response?
I also tried but nothing happened
My code-
exports.createComment = async (req, res) => {
  console.log("run?");
  const { featureId } = req.params;
  const { content } = req.body;
  const postedBy = req.auth._id;
  if (!content) {
    return res
      .status(400)
      .send({ error: "Please provide a content with your comment." });
  }
  const comment = new Comment({
    content,
    postedBy,
  });
  await comment.save();
  await comment.populate("postedBy", "_id username");
  Feature.findByIdAndUpdate(
    featureId,
    { $push: { comments: comment._id } },
    { new: true }
  ).exec((err, result) => {
    if (err) {
      return res.json({
        error: errorHandler(err),
      });
    }
  });
  return res.json(comment);
};```

A: exports.createComment = async (req, res) => {
console.log("run?");
const { featureId } = req.params;
const { content } = req.body;
const postedBy = req.auth._id;
if (!content) {
  return res
    .status(400)
    .send({ error: "Please provide a content with your comment." });
}
const comment = new Comment({
  content,
  postedBy,
});
await comment.save();

// One of the ways that I use.
let populatedData= await Comment.findById(comment._id).populate("postedBy", "_id username");
console.log(populatedData)

Feature.findByIdAndUpdate(
  featureId,
  { $push: { comments: comment._id } },
  { new: true }
).exec((err, result) => {
  if (err) {
    return res.json({
      error: errorHandler(err),
    });
  }
});
return res.json(comment);
};


text:
Q: NuGet package update - Package Manager found another package with same name I'm quite new to NuGet Package building and publishing so maybe there's something I'm doing wrong, but I can't figure out what is it.
I have a VS2022 solution which contains my reference projects. "Project A" is being published locally on my network as a NuGet package (not on nuget.org).
Another solution which I'm currently working on, uses that Project A package via NuGet. The problem is: on NuGet.org there's another package with the same name, so when I open Package Manager window the Update tab shows me an available update for that project - but that's not my package because it comes from nuget.org.
The "silly fix" is obviusly to change package source from the combobox, instead of "All" I set "local" and then the correct package is found.
What am I missing here?
Project A is set with "sign package" on properties, if that matters.

A: I think you can try to change the name of your Project A, it will be a good choice to solve this problem.
If you don't use the packages from nuget.org you can uncheck this source in Tools > Options > NuGet Package Manager > Package Source:

You can search the version of your package like this:


text:
Q: Angular 4.0.0 could not find bootstrap code Error : Tried to find bootstrap code, but Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options.
main.ts
getHttp().get('/assets/config.json').toPromise()
 .then((res: Response) => {
 let conf = res.json();
 platformBrowserDynamic().bootstrapModule(createAppModule(conf));
})

I am using angular-cli. With angular v2.3.1 this code was working fine.
I want to fetch json and pass it to  @Ngmodules providers
{ provide: Config, useValue: conf }

A: If the data you are fetching from config.json are just about a configuration of an application module and you are trying to create a Config service to store them, I think the best would be to assign it to the environment and read it in your Config service later. The environment is available in main.ts, so no hacking (createAppModule) needed.
import { environment } from './environments/environment';
import { AppModule } from './app/';

getHttp().get('/assets/config.json').toPromise()
   .then((res: Response) => {
       let conf = res.json();
       environment.settings = conf;
       platformBrowserDynamic().bootstrapModule(AppModule);
});

You must also declare all new properties of environment in your src/environments/environment.ts file.

A: The cli is attempting to use ahead of time compilation. Because of this, it needs to be able to find your main NgModule.
Usually the AOT compiler is able to do this statically just by looking for bootstrap calls. However you are not immediately bootstrapping, so the compiler needs you to explicitly tell it the name of your app module so it can compile it and all of it's components.
Solutions
ng eject and manually configure entryModule
The preferred solution is to tell the cli the name of your entryModule. This will allow AOT to work and give you all of it's benefits. However the cli does not currently support this(But there is a PR for adding an option #4077).
The current workaround is to use ng eject --aot to switch to a manual webpack based build. Then you can configure your entryModule directly.

*

*ng eject --aot

*Open webpack.config.js and search for new
AotPlugin

*

*Add the following and replace your AppModule name
entryModule: 'path/to/app.module#AppModule'
Skip AOT
You can entirely skip this issue by using the --no-aot flag if you just need to get a build working. This isn't recommended as your app will be much slower and larger than it normally would(it will have to compile components at runtime and you will have to ship the compilier which is large).
ng prod --no-aot

A: The accepted answer didn't work for me.
Extracting the bootstrapModule part will let Angular find the bootstrap code.
import { environment } from './environments/environment';
import { AppModule } from './app/';

const bootstrap = () => {
  platformBrowserDynamic().bootstrapModule(AppModule);
};

getHttp().get('/assets/config.json').toPromise()
    .then((res: Response) => {
       let conf = res.json();
       environment.settings = conf;
       bootstrap();
});


text:
Q: Kill a process with a specific "Command Line" from command line Is there a command line utility that kills all processes with a specific command line?
E.g. kill all processes named "java.exe" with a command line that contains "-jar selenium-server.jar". This is possible through process explorer.

A: If you are using a Windows version which has WMIC command in it. You can try this
wmic path win32_process Where "Caption Like '%java.exe%' AND CommandLine Like '%selenium.jar%'" get ProcessId|more +1

The more +1 removes first line containing the header and prints the PID alone. If there are more than one java process containing selenium.jar then this will return one PID per line.

A: Simple one-liner in powershell:
(Get-WmiObject win32_process -filter "Name='java.exe' AND CommandLine LIKE '%-jar selenium-server.jar%'").Terminate()

A: In Windows XP you can do this easily using WMIC, the WMI Console. From a command prompt, type the following:
wmic Path win32_process Where "CommandLine Like '%-jar selenium-server.jar%'" Call Terminate

Edit:
I replaced the alias 'process' by it full path ('path win32_process') as is Aviator's port. Note: This alias may not be declared on every OS.

A: I believe you could do this with PowerShell using Get-Process and the StartInfo.Arguments on the process you want.
$procs = Get-Process java
foreach($proc in $procs)
{
    if($proc.StartInfo.Arguments -contains "-jar selenium-server.jar")
    {
        kill $proc
    }
}

(I haven't tested that completely, but you should be able to tweak it to make it work)

A: Powershell:-
$oProcs = get-process explorer;foreach ($oProc in $oProcs){if ($oProc.Path.Contains('C:\Windows')) {Stop-Process $oProc.Id}}

A: I use a variation of Brien's PowerShell script.
This outputs command line and other info as well.
$processes = Get-WmiObject Win32_Process -Filter "name = 'java.exe'"
foreach($proc in $processes)
{
    if($proc.CommandLine.Contains("selenium-server.jar"))
    {
        Write-Host "stopping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..."
        Stop-Process -F $proc.ProcessId
    } else
    {
        Write-Host "skipping proccess $($proc.ProcessId) with $($proc.ThreadCount) threads; $($proc.CommandLine.Substring(0, 50))..."
    }
}

A: Another powershell variation.  It's basically the same, perhaps easier to type and remember. -match can actually take a regular expression.
get-wmiobject win32_process | where commandline -match selenium-server.jar
  | remove-wmiobject

A: Use the free PsKill:
pskill java.exe


text:
Q: Pass typed text inside vscode snippets After reading the snippets documentation I'm still searching a way to pass some text inside the snippet body by typing it after the snippet prefix.
Let's say I have a snippet with log prefix, I would like to transform the prefix in something like log(*+) to capture the text after.
If I type loganObject, the snipped should capture "anObject" and call my snippet to insert some text like console.log ("the value of anObject is: ", anObject);.
Is that possible?
I think that it is not possible because vscode should recognize that I'm still typing the prefix of the snippet and the text after the prefix should be captured and used inside the snippet body, but I hope they realized something like this.

A: Here is a keybinding that does what you want, but you have to select the text first Shift+Home and that is the only text on the line.
Using log.myTextHere as the matched text, i.e., log. at the beginning just to be clear.
In your keybindings.json:
{
  "key": "alt+l",                   // whatever keybinding you want
  "command": "editor.action.insertSnippet",
  "args": {
    // get the extra text into capture group 1
    "snippet": "console.log (\"${TM_SELECTED_TEXT/^log\\.(.*)/the value of $1 is: \", $1/});"
  }
}

Alternatively, and a little easier and more flexible, is to use an extension I wrote, Find and Transform, to do this.  Use this keybinding:
{
  "key": "alt+y",                   // whatever keybinding you want
  "command": "findInCurrentFile",
  "args": {
    "preCommands": "cursorHomeSelect",    // does the selection for you
    "replace": [
      "$${",
              // log. = 4
      "let myVar = '${selectedText}'.substring(4);",
      "return `console.log (\"the value of ${myVar} is: \", ${myVar});`",
      "}$$"
    ],
    "restrictFind": "line"
  }
}

You could change substring(4) if you just want to use log and not log..


text:
Q: I keep getting the error missing \begin{document}. \ProcessOptionsKV[p]{Gm}. It's compiling without producing a pdf. Additionally, it has been producing a page with just "chchchch" written on it.
Here's a MWE:
\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{  {Images/}{../Images/}   }

\usepackage[margin = 1inch]{geometry}
\geometry{letterpaper}

\usepackage{amsthm, amsfonts, amsmath,amssymb, siunitx, units, gensymb, array, titling, indentfirst, titlesec, setspace,  upgreek, newcent}
\usepackage[comma, super, sort&compress]{natbib}

\renewcommand\thesection{\arabic{section}}
\usepackage{subfiles}
\doublespacing

\begin{document}
\subfile{Others/cover}
\subfile{Sections/Introduction}
\end{document}

A: Your are using a wrong argument to the geometry package. It's margin = 1in, not margin = 1inch.


text:
Q: Asymptotic behavior of $n^2-n$ I recently became familiar with the Power of Wolfram.
As a part of the problem I'm working o, I need to  find which of the following is closer to $n^2-n$
$O(n \sqrt n)$ or $O(n \log n)$ or $O(n^2)$.
Maybe this is a very basic question, but I need to learn about it, and my challenge is how I can calculate it by using Wolfram Online?

A: Asymptotic[n^2 - n, n -> ∞]
(*    n^2    *)

From the documentation:

Asymptotic[expr, x->x0] computes the leading term in an asymptotic expansion for expr. Use SeriesTermGoal to specify more terms.

A: $Version

12.0.0
I have only AsymptoticEqual.
AsymptoticEqual[n^2 - n, n^2, n -> \[Infinity]]

(* True *)
The sign in front of the n does not matter for that truth. This built-in is new in 12.0.0 and newer.


text:
Q: AWS Serverless PCI-DSS Compliance I noticed recently that Amazon got API Gateway and Lambda PCI-DSS certified. I would be interested to know what that does imply regarding the isolated network consideration, specifically:

*

*Is Amazon Lambda execution considered to be an isolated network, protected by a firewall?

*Is Amazon Lambda fulfilling the server IP masking property?

In essence, I would:

*

*Open an API allowing credit card processing over HTTPS with API
Gateway

*Encrypt this data inside a Lambda function, using the Key
Management Service

*Store the encrypted cards at rest in DynamoDB

Could this architecture be considered PCI-DSS compliant?

A: I think using managed services is a great idea, it's more secure by default, and lets you focus on providing the functionality.
Lambda functions can be isolated in a VPC, so the firewall requirements are taken care of. Req 1.3 asks for a DMZ, where there is no direct connection into the private CDE. This is generally done with a NAT and public and private subnets (reference here). Using the API gateway may allow you to avoid that direct connection, but presumably you still need to call a payment processing gateway from your lambda function, in that case you still need the NAT anyway according to the AWS documentation:

When you add VPC configuration to a Lambda function, it can only access resources in that VPC. If a Lambda function needs to access both VPC resources and the public Internet, the VPC needs to have a Network Address Translation (NAT) instance inside the VPC.

I would also check that logging and code deployment are handled in a PCI compliant manner.
I'd also point out that the architecture, while important, is basically only 1/12th of becoming PCI compliant, so is not going to necessarily make a big difference in the scheme of things.


text:
Q: How can I obtain a sampling of all tweets from a specific time period? I want to gather samplings of all tweets from the past year.  Being able to request tweets from a specific date would be great, but I'll take what I can get.
I do not want to find tweets by a specific user or containing a specific term, just a sampling of all tweets. The Twitter search API claims that a query term is optional, but if I try an empty query like
http://search.twitter.com/search.atom

as opposed to giving a search term,
http://search.twitter.com/search.atom?q=twitter

the response is
<hash>
<error>
You must enter a query.
</error>
</hash>

If the API really doesn't provide any functionality for this type of query, how can I hack around it?  Are tweet ids roughly sequential by date and can I somehow use this info to grab bunches of tweets centered around an id of a tweet whose date I know?

A: You are referencing the obsolete documentation. If you read the current version you will find that a query is required.
You should also know that the Search API only provides results going back about two weeks. You might be able to find historical data from sites like infochimps.

A: Not useful for historical data, but in case someone stumbles across this question looking for a sampling of all current tweets, you want the streaming API.  (This is my first foray into Twitter and I hadn't noticed it.  I only saw the public timeline method in the normal API.)


text:
Q: Can I apply the sequential criterion of continuity here? Suppose that $f:D\subseteq\mathbb{R}\to\mathbb{R}$ is continuous, and $A\subseteq\mathbb{R}$ is a closed set in the reals. I need to prove or disprove: $f^{-1}(A)$ is closed.
I think since $f$ is continuous, we have $f^{-1}(A)$ is closed in $D\,$?
$$f^{-1}(A)=\{x\in D: f(x)\in A\}.$$
I was thinking how can I use the sequential criterion here. Should I take a sequence $f(x_n)$ in $A$ such that $f(x_n)\to y\in A$, and hence $x_n\to f^{-1}(y)\in f^{-1}(A)\in D\,$?
Thanks for helping.

A: We have $f:D\xrightarrow{\text{cts}}\mathbb{R}$, and $A$ closed with respect to $\mathbb{R}$. We show that
$$f^{-1}(A)=\{x\in D: f(x)\in A\}$$ is closed with respect to $D\subset\mathbb{R}$.
The sequential criterion (or definition) says $f$ is continuous at $a\in D$ iff:

$\lim_{n\to\infty} x_n=a\quad$ implies $\quad \lim_{n\to\infty} f(x_n)=f(a),\;\;$ for each sequence $x_1,x_2,\dots$ in $D$.

We need to show that every closure point (with respect to $D$) for $f^{-1}(A)$ belongs to $f^{-1}(A)$. By definition, if $t$ is such a $D$-closure point, then $t\in D$ and there is $t_n\to t$ (a convergent sequence) with each $t_n\in f^{-1}(A)$, so that each $f(t_n)\in A$.
Let $t_n$ be any such sequence. Since $f$ is continuous at $t$, $\;\; \lim_{n\to\infty} f(t_n)=f(t).$
But this shows that $f(t)$ is a closure point (with respect to $\mathbb{R}$) of $A$, which we can denote $f(t)\in \overline A$, where $\overline A$ is the set of all closure points, called the closure of $A$.
But $A$ is closed, which means $A=\overline A$. So finally $f(t)\in A$, and $t \in f^{-1}(A)$.

A: If you want to show a set is closed using sequences you need to start out with an (arbritrary) convergent sequence in the set in question, i.e. you have to look at $b_n\in f^{-1}(A)=:B$ such that $b_n\rightarrow b$ You then have to conclude that $b\in B$ in order to show $B$ is closed.
(Note: for relative closure (i.e. for the case where $D$ is open) you may assume $b\in D$)


text:
Q: Javascript help function to hide each listem independently Can someone please help me with a function to hide a list element, one by one, when clicking on it? I only got it to work but for one single element, I am not sure how it would go for all of them.
Suppose I have a list of 5 elements. When i click on element 1, it dissapears. If I click on element two, it also dissapears and so on.
I would like it to do on javascript vanilla only
This is that I've tried so far:
<!DOCTYPE html>

Coffee

Coffee 2

Coffee 3

A: You can simply do this by passing event parameter into a click handler function.
When you define your html like this onclick="onListItemClick(event)", Javascript automatically sends the event object into your function.
Event object has many properties inside of it. But all you are concerned with is the event.target which is the element that you clicked on.
Then you can easily manipulate any part of that html element.

function onListItemClick(event) {
  event.target.style.visibility = 'hidden';
}
<!DOCTYPE html>

Coffee 1

Coffee 2

Coffee 3

A: Don't use inline HTML event attributes. Best practice is delegation. Add a class to your ul so that you only need one eventListener.

document.querySelector(".unordered-list").addEventListener("click", function(e) {
  if (e.target.classList.contains("id1")) {
    e.target.style.opacity = 0;
  }
});

Coffee

Coffee 2

Coffee 3


text:
Q: How would I put strings into my object array? Here is what I am suppose to do in my project:

Here is what you do: create a class named MyRecord (MyRecord.java) with the
      variables firstname, lastname, email, idnumber, color and balance. Use the
      appropriate data type for each field.

So I created that class as follows:
public class MyRecord {

    String firstname, lastname, email, color;
    double idnumber, balance;
}

The next part of the project is to create a MyRecord object array in my main method, which I do as stated:
 MyRecord recarray[] = new MyRecord[ARRAYSIZE];
 //ARRAYSIZE is 10

Next step is to scan and READ from a file which contains 5 records such as:
String filename = "data.txt";
File fileobject = new File(filename);
Scanner input = new Scanner(fileobject);

The program works perfectly fine up until this point, and it's reading from the file just fine but now here's the problem: The project wants me to add those string records into the MyRecord array. I tried to do it like this:
for(int i = 0; i <= 5; i++) {
    recarray[i] = input.next();
}

But it throws out an error saying "Strings cannot be converted into MyRecord object array". I kinda figured it would throw that error but I'm not sure how to solve this problem. So how would I convert the strings into the object and put them into the array? Or is there another way?
Also, this is what the records are, the file from where it's being read from:
Mary, Jane, maryj@gmail.com, 7654321, blue, 27.54
John, Doe, jd@yahoo.com, 123456, green, 19.24
Curly, Howard, nyuknyuk@msn.com, 888765, purple, 0.0
Bart, Simpson, donthaveacow@hotmail.com, 457673, magenta, 432.23
Clark, Kent, superdude@dailyplanet.com, 976834, red, 11.10

Sorry, I am fairly new to Java. Thank you!

A: The error is because you are trying to resolve input.next(); (A String) to recarray[i] which is an MyRecord object. You need to access the individual fields. So something like:
recarray[i].firstname = input.next();

And then when you get to the double's you can do something like:
recarray[i].idnumber = Double.parseDouble(input.next());

A: GBlodgett's answer is correct. I'll just add a code example of how you could collect the information from the file and put it into an array. For example:
String[] array = new String[6];
for (int i = 0; i < numberOfLinesToRead; i++) {
    recarray[i] = new MyRecord(); // Make sure to initialize the object before accessing it
    array = scan.nextLine().replaceAll(" ", "").split(","); // The array object now contains each individual value of one line
    recarray[i].firstname = array[0];
    recarray[i].lastname = array[1];
    recarray[i].email = array[2];
    recarray[i].idnumber = Double.parseDouble(array[3]);
    recarray[i].color = array[4];
    recarray[i].balance = Double.parseDouble(array[5]);
}

This assumes that each data value for every line is read from the file in the same order (firstname, lastname, email, etc.).


text:
Q: List issue creation and resolved time I am trying to find out how I can list issues with their creation and resolved time. The changelog as shown below does not list the creation time for the issue and resolution time. How can i retrieve that data?
 #!/usr/bin/python
 import jira.client
 from jira.client import JIRA

jira = JIRA(options, basic_auth=(USERNAME, PASSWORD))

issue = jira.issue('FOO-100', expand='changelog')
changelog = issue.changelog

for history in changelog.histories:
    for item in history.items:
        if item.field == 'status':
            print 'Date:' + history.created + ' From:' + item.fromString + ' To:' + item.toString

Output:
Date:2012-10-23T09:49:41.197+0100 From:Open To:Queued
Date:2012-10-23T09:49:43.838+0100 From:Queued To:In Progress
Date:2012-10-23T09:49:45.390+0100 From:In Progress To:Blocked
Date:2012-10-29T16:06:36.733+0000 From:Blocked To:In Progress
Date:2012-10-31T16:47:40.191+0000 From:In Progress To:Peer Review
Date:2012-10-31T16:47:41.783+0000 From:Peer Review To:Customer Approval

A: You can get the creation and resolution date times from their fields within issue.fields
like so:
#!/usr/bin/python
import jira.client
from jira.client import JIRA

jira = JIRA(options, basic_auth=(USERNAME, PASSWORD))

issue = jira.issue('FOO-100', expand='changelog')

creation_time = issue.fields.created
#u'2016-06-09T15:54:28.157+0000'
resolved_time = issue.fields.resolutiondate
#u'2016-06-10T07:00:13.539+0000'

Note: resolutiondate will only exist if the issue has been resolved, so check before referencing it.


text:
Q: Discord JS V13 Can't Send Message to Guild Owner I'm trying to send a message to the guild owner when the bot joins a server:
client.on('guildCreate', guild => {
    const introembed = new MessageEmbed()
        .setTitle('Hiya!')
        .setColor('RANDOM')
        .setDescription(`Thank you for adding me to your server!\nRun \`${prefix}help\` to get my commands!\nThings to know: I am still under developement, and will have a few bugs, feel free to report them with \`${prefix}bugreport\`\nMy GitHub can be found here: https://github.com/*********/*****`)
        guild.fetchOwner().then(send({ embeds: [introembed]}).catch(console.error()))
})

This doesent work, and as of discord.js v13, I can no longer do guild.owner.send(). How do I do this in v13?

A: You're almost there. You just used the wrong syntax for your .then(). I'd recommend using async and await.
Try this:
client.on("guildCreate", async (guild) => {
  const owner = await guild.fetchOwner();
  owner.send("This is a test message to the owner of this guild!");
});

Or if you want to stick to the .then() syntax use this:
client.on("guildCreate", async (guild) => {
  guild.fetchOwner().then((owner) =>
    owner.send({
      embeds: [
        new MessageEmbed({
          title: "Hiya!",
          color: "RANDOM",
          description: "This is a test message to the owner of this guild!",
        }),
      ],
    })
  );
});

Whatever way you choose, when running the code you are going to receive a discord DM like this:


text:
Q: Correct way to poll an API every minute until a max in Java within a test framework I want to regular poll (not long poll) an API using TimerTask from inside an integration test. Basically, I want to poll every minute, and if 15 minutes have passed, I want to stop polling and fail my test.
I haven't done this before, so I'm looking into different ways of doing this. One simple idea I have is just doing a for loop 15 times. Each iteration, I call the API, check the response, and if it's not what I expect, wait 1 minute using Thread.sleep() Here is sample code for it:
@Test
public void testHappyPath() {
    SomeApiRequest request = ...;
    SomeApiResponse response;
    for (int attempt = 0; attempt < 15; attempt++) {

                response = client
                        .getResult(request);
                // perform conditional logic on response
                if (response.hasItemIWant()) {
                    Assert.assertTrue(<certain things about response>);
                    return;
                }
                Thread.sleep(60000);
    }
    Assert.fail("Did not receive the expected response within 15 minutes.");
}

What I'm concerned about here is that since I have multiple tests that will do similar logic and also have Thread.sleep(), I am not sure what if any byproducts of that there are. I am using TestNG as my framework, and I believe TestNG runs tests in parallel. If it does, I am hoping that doing Thread.sleep() only affects the thread for that specific test.
I have also looked into TimerTask. The problem I have found with this though is that it seems like if I want to have an upper limit on retries (like I have 15 in the above example), I will still need the loop anyway. Plus, it is not trivial to return a value from a timer task, so I would need to check the response within the TimerTask object itself. I can't declare the response object outside of the timer task and use it within the timer task unless response is a final or class variable, which doesn't work for my case. I was thinking of doing something like this:
@Test
public void testHappyPath() {
    SomeApiRequest request = ...;
    boolean allAssertionsPassed = false;
    Timer t = new Timer();
    TimerTask tt = TimerTask tt = new TimerTask() {
        @Override
        public void run() {
            SomeApiResponse response = client.getResult(request);
            if (response.hasItemIWant()) {
                Assert.assertTrue(<some things about response>);
                allAssertionsPassed = true;
                t.cancel();
            }
        };
    };
    for (int attempt = 0; attempt < 15; attempt++) {
        // fixed delay scheduling. run every minute but in case a call takes super long
        // for some reason multiple calls won't happen at the same time.
        t.schedule(tt, 0, 60000);
        if (allAssertionsPassed) {
            return;
        }
    }
    Assert.fail("Did not receive the expected response within 15 minutes.");
}

I'm not sure if the above code is correct, and again I don't quite know what would happen if these tests are run in parallel.
What is the correct way of doing this? I have not done this before so an example would be helpful.


text:
Q: ¿Cómo mezclar dos CLASS en una imagen? Tengo dos 'css' donde cada uno da una acción diferente a las imagenes, y lo que quiero es saber si se pueden unir las dos en una línea de código, o hacer otra 'class' donde las mezcle.
Una es zoom que la descargue de internet es de zoomy.css, esta 'class' hace que si le doy click a mi imagen aparezca el efecto lupa de la misma.
El otro efecto, no sé como llamarlo. Lo que hace es que tengo imagenes chicas y al darle click aparecera a la derecha una imagen de la misma mas grande.
Lo que quiero es mezclar los efectos, es decir, primero que aparezcan las imagenes pequeñas, lo doy click aparece la grande y en esa darle click y salga el efecto lupa

                        <?php echo ''; ?>

 <?php echo ''; ?>

Este mi código, la primera parte es de las imagenes pequeñas a la grande.
    <?php echo ''; ?>

Este es del zoom
Este es el código del estilo de las pequeñas a grandes:
                        #contenedor {
            width: 100%;
            margin: 0 auto; }

        li .min {
            width: 150px;
            height: 150px;
            padding: 6px 20px 20px 7px;
            }
        li .max{
            width: 350px;
            height: 350px;
            padding: 6px 20px 20px 70px;
        }
        .cat    {
            list-style-type: none;
            margin: 0 0 25px 10px; /* Eliminacion de vieta en IE6 */
            padding: 0px; /* Eliminacion de vieta en IE6 */
            float:left;
            }

        .max{
            visibility:hidden;
            position: absolute;
            top: 330px; /* Provoca la separacion del borde superior */
            left: 15%;  /* Separa la imagen grande de la pequea */
          margin-left: 0px;
            }

        a:focus .max    {
            visibility: visible;
            }

Y este es del zoomy
            /*
        * Zoomy 2.0.0 - jQuery plugin
        * http://zoomy.me
        *
        * Copyright (c) 2010 Jacob Lowe (http://redeyeoperations.com)
        * Dual licensed under the MIT (MIT-LICENSE.txt)
        * and GPL (GPL-LICENSE.txt) licenses.
        *
        * Built for jQuery library
        * http://jquery.com
        *
        * Addition fixes and modifications done by Larry Battle ( blarry@bateru.com )
        * Code has been refactored and the logic has been corrected.
        *
        *Cusor fix from IE by Chris Pearson ( http://www.upland.co.uk )
        *
        */
        body{
            -webkit-touch-callout: none!important;
        }

        .parent-zoom{
            -webkit-user-select: none!important;
        }

        .parent-zoom img{
            -webkit-transition-property: opacity;
            -webkit-transition-duration: 200ms;
            -webkit-transition-timing-function: ease;
            cursor:  cell;
            cursor: -moz-zoom-in;
            cursor: -webkit-zoom-in;
            border: 0;
        }

        .zoomy{
            position: absolute;
            display: none;
            background-repeat: no-repeat;
            -webkit-box-shadow: 0px 5px 10px #000;
            -moz-box-shadow: 0px 5px 10px #000;
            -o-box-shadow: 0px 5px 10px #000;
            -ms-box-shadow: 0px 5px 10px #000;
            box-shadow: 0px 5px 10px #000;
            filter: progid:DXImageTransform.Microsoft.dropshadow(OffX=0, OffY=1, Color='#3333333', Positive='true');
            line-height: 100px;
            text-align: center;
            background-color: #fff;
            z-index: 999;
            overflow: hidden;
            cursor: url(./img/blank.cur), move;
            -webkit-transition-property: border-width, border-color, opacity;
            -webkit-transition-duration: 500ms, 1s, 500ms;
            -webkit-transition-timing-function: ease;
        }

        .zoomy span{
            display: block;
            margin: 5px auto;
            background: -moz-linear-gradient(top, rgba(255,255,255,.6) 0%, rgba(255,255,255,0) 100%); /* firefox */
            background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,.6)), color-stop(100%,rgba(255,255,255,0))); /* webkit */
            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#55FFFFFF, endColorstr=#00ffffff);
            -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#55FFFFFF, endColorstr=#00ffffff);
        }

        .zoomy a{
            color: #333;
            text-decoration: none;
            outline: 0;
        }

        .inactive img{
            opacity: 0.85!important;
            filter:alpha(opacity=85)!important;
        }

        .zoomy #tmp{
            max-width: none;
            max-height: none;
            top: -999999px;
            left: -999999px;
        }

        .zoomy.start{
                border-width: 2px;
                border-color: #444;
        }

        .zoomy-wrap{
            position: relative;
            margin: 0;
            padding: 0;
            z-index: 999;
        }

        .zoomy-btn{
            font-family: sans-serif;
            position: absolute;
            top: 50%;
            left: 50%;
            margin: -30px 0 0 -30px;
            border-radius: 50%;
            height: 60px;
            width : 60px;
            overflow: hidden;
            -webkit-box-shadow: 0px 1px 2px rgba(255,255,255,.8);
            box-shadow: 0px 1px 2px rgba(255,255,255,.8);
            background: rgba(0,0,0,.8);
            background-position: 0px 0px;
            -webkit-tap-highlight-color: rgba(255, 255, 255, 0);
            line-height: 100px;
            color: #fff;
        }

        .zoomy-btn svg{
            margin: 8px auto;
            display: block;
        }

        .active .zoomy-btn svg{
            display: none;
        }

        .active .zoomy-btn{
            width: 100%;
            height: 100%;
            background: none;
            -webkit-box-shadow: none;
            box-shadow: none;
            border: none;
            top: 0px;
            right: 0px;
            overflow: hidden;
            color: rgba(0,0,0,0);
        }

Quise ponerlo así, pero no sale, simplemente no sale la imagen GRANDE y si le cambio el 'href' tampoco me sale:

                        <?php echo ''; ?>
                         <?php echo '';  ?>

¿Cómo lo puedo mezclar para que me salga esa galería?

A: Por lo que he entendido lo que quieres es juntar los 2 estilos que tienes en las imágenes, en ese caso lo que tienes que hacer es dar el nombre de las 2 clases a las imágenes separados por un espacio, en tu ejemplo sería:

Y aquí tienes un ejemplo ejecutable para ver como quedaría:

.grande {font-size:40px;}
.rojo {color:red;}

Un párrafo grande y rojo


text:
Q: Azure route table not showing effective routes I have this Vnet and subnet and I created a route table and associated it to the subnet. However, under Effective routes, it is empty... I also have a VNet Gateway and it has a VPN to on-prem and the gateway is learning BGP routes but they are not listed here. I do have a NIC associated in the subnet as well. The NIC's menu shows all the routes. Why is that? Here is the screenshot of it. The route table is empty here

The route table is associated to this subnet

Here is the NIC in the subnet and it shows all the routes

Thanks!
Difan

A: I tried to reproduce the same in my environment. Its working fine this issue may cause of required permission and connection fails.
Go to Azure portal -> Your VM -> setting -> click networking -> select your network interface -> click effective routes

Named of effective routes as shown below:

Otherwise try to fix it via PowerShell
To Get the effective route table on a network interface
 Get-AzEffectiveRouteTable -NetworkInterfaceName "MyNetworkInterface" -ResourceGroupName "MyResourceGroup

To  gets the effective routes for a network interface
Get-AzEffectiveRouteTable `
  -NetworkInterfaceName myVMNic1 `
  -ResourceGroupName myResourceGroup `
  | Format-Table

For your Reference :
az network nic | Microsoft Docs


text:
Q: EaselJS Spritesheet and Bitmap ColorFilterMatrix I am loading spritesheets individually for each sprite on demand using PreloadJS with JSON files.  Now, I would like to apply a ColorMatrixFilter to the Sprites or Spritesheet.
After some research I found this snippet from Lanny http://jsfiddle.net/lannymcnie/NRH5X/ where the JSON SpriteSheet definition is within the Javascript code and a reference to the Bitmap cacheCanvas [bmp.cacheCanvas] is used to in the SpriteSheet creation.
Now, if I'm using JSON files to define the SpriteSheet, I can't reference the Bitmap cacheCanvas.  It would be nice if the SpriteSheet class had an optional parameter to attach a filter so that it would essential do the following but also supporting JSON file loading:
var bmp = new createjs.Bitmap(<"Image Defined in JSON SpriteSheet file">);
bmp.filters = [new createjs.BlurFilter(10,10,1)];
bmp.cache(0,0,img.width,img.height);

var data2 = new createjs.SpriteSheet({
    "images": [bmp.cacheCanvas], // Note we are using the bitmap's cache
    "frames": {"height": 292, "width": 165},
    "animations": {"run": [0, 25, "run", 2]}
});

So that something like this would work:
var spriteSheet = loaderQueue.getResult(spriteSheetId);

var spriteSheetNewColor = spriteSheet.filter(new createjs.BlurFilter(10,10,1))

Or can I get the SpriteSheet img so that I can recreate the SpriteSheet using the filter using the above technique?

A: You can directly manipulate the images array, and inject a filtered/cached image. It requires you to preload the images, filter them, and then replace the image in the SpriteSheet. You can also get a complete event from the SpriteSheet when all images in the array are loaded, and do the work there:
// pseudocode
spritesheet.on("complete", function(e) {
    for (var i=0; i<spritesheet._images.length; i++) {
        // Filter Code Here
        // Then
        spritesheet.images[i] = filteredBitmap.cacheCanvas;
    }
}

This approach could get messy if you use a filter that changes the image dimensions (like blur). You can see in my demo that you referenced that the blurred image gets offset because of this.
Its not an elegant solution, but your suggestion is a pretty specific request, and unlikely to be added to SpriteSheet. A better approach is to extend SpriteSheet yourself and add this behaviour, maybe in the _handleImageLoad method.
Hope that helps!


text:
Q: Cannot Print iFrame in Chrome Browser I'm having issues using the latest Chrome browser (As of today Version 57.0.2987.110 (64-bit)). I use an iframe on the website to retain position when using infinite scroll. The clicked page is an iframe that sits on top of the previous page and set up so that when you hit the back button or click on return to previous page it goes back to retaining the page position from where you scrolled.
When in Print Preview view in Chrome, the previous page sits below the iframe and it has a weird stack/overlay rendering look to it where you can see through the current page (iframe) that sits on top of the previous page. Also the current page (the iframe) is cutoff after the first page. I've tried every trick on the Stack Overflow page.
I would appreciate any help. Basically I'm trying to print the iframe page in print/print preview in the latest Chrome browser. It works fine on Safari and other browsers. Thank you for your help.

A: on Iframe :
function printMe() {
  window.print()
}

parent:
document.frame1.printMe()


text:
Q: Restlet createInboundRoot invoked when app run as Eclipse/J2SE but not as maven jetty:run-war I have a simple Restlet app that works fine when run as a J2SE application from Eclipse, but when packaged as a war and run with "mvn jetty:run-war" (jetty-maven-plugin), the Application.createInboundRoot method does not get invoked and thus no routes are configured.
The pertinent error message appears to be
WARNING: A filter was executed without a next Restlet attached to it.

You can see from the console output that in the J2SE case ModspaceRestletApplication.createInboundRoot is invoked and in the J2EE case that method is not invoked. Why not?
Run as J2SE (Eclipse->Run As->Java Application).
Test by hitting the URL:
http://localhost:8182/modspace/users/fred/entries

Correctly formed response is returned and console output is:
In ModspaceRestApplication.ctor
Mar 25, 2014 2:41:15 PM org.restlet.engine.http.connector.HttpServerHelper start
INFO: Starting the internal HTTP server on port 8182
In ModspaceRestApplication.createInboundRoot

Run as war from command line using 'mvn jetty:run-war".
Test by hitting URL:
http://localhost:8080/modspace/users/fred/entries

Browser sees
The server encountered an unexpected condition which prevented it from fulfilling the request

and console output is:
2014-03-25 14:42:27.125:INFO:oejs.Server:main: jetty-9.1.0.M0
2014-03-25 14:42:31.507:INFO:oejsh.ContextHandler:main: Started o.e.j.m.p.JettyWebAppContext@6307c51a{/,file:/Users/wilma/eclipse-workspace/modspace-rest/target/modspace-rest-0.0.1-SNAPSHOT/,AVAILABLE}{/Users/wilma/eclipse-workspace/modspace-rest/target/modspace-rest-0.0.1-SNAPSHOT.war}
2014-03-25 14:42:31.509:WARN:oejsh.RequestLogHandler:main: !RequestLog
2014-03-25 14:42:32.004:INFO:oejs.ServerConnector:main: Started ServerConnector@459c745a{HTTP/1.1}{0.0.0.0:8080}
[INFO] Started Jetty Server
In ModspaceRestApplication.ctor
2014-03-25 14:42:50.964:INFO:/:qtp721530251-44: RestletServlet: [Restlet] Attaching application: com.merck.modspace.rest.ModspaceRestletApplication@74e1d431 to URI: /modspace
Mar 25, 2014 2:42:50 PM org.restlet.routing.Filter doHandle
WARNING: A filter was executed without a next Restlet attached to it.
Mar 25, 2014 2:42:51 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2014-03-25    14:42:50    0:0:0:0:0:0:0:1 -   0:0:0:0:0:0:0:1 8080    GET  /modspace/users/fred/entries   -   500 365 -   20  http://localhost:8080     Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko)    Chrome/33.0.1750.152 Safari/537.36   -

Tools:
Apache Maven 3.0.5
Java version: 1.7.0_51

web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="ModspaceWS" version="2.4"
            xmlns="http://java.sun.com/xml/ns/j2ee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
   <display-name>Modspace RESTlet web service</display-name>

   <!-- Restlet adapter -->
   <servlet>
      <servlet-name>RestletServlet</servlet-name>
      <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
      <init-param>
            <!-- Application class name -->
            <param-name>org.restlet.application</param-name>
            <param-value>com.merck.modspace.rest.ModspaceRestletApplication</param-value>
      </init-param>
   </servlet>

   <!-- Catch all requests -->
   <servlet-mapping>
      <servlet-name>RestletServlet</servlet-name>
      <url-pattern>/modspace/*</url-pattern>
   </servlet-mapping>
</web-app>

pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.merck.modspace.rest</groupId>
  <artifactId>modspace-rest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>ModSpaceWebService</name>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <repositories>
    <repository>
      <id>maven-restlet</id>
      <name>Restlet framework repository</name>
      <url>http://maven.restlet.org</url>
    </repository>
    <repository>
      <id>mvnrepository</id>
      <url>https://mvnrepository.com//</url>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>org.restlet.jse</groupId>
      <artifactId>org.restlet</artifactId>
      <version>2.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.restlet.jee</groupId>
      <artifactId>org.restlet</artifactId>
      <version>2.0.0</version>
    </dependency>
    <dependency>
      <groupId>org.restlet</groupId>
      <artifactId>org.restlet.ext.servlet</artifactId>
      <version>2.0-M3</version>
    </dependency>
    <dependency>
      <groupId>com.oracle</groupId>
      <artifactId>ojdbc6</artifactId>
      <version>11.2.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
    </dependency>
  </dependencies>
  <build>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
          <compilerArgument>-Xlint:all</compilerArgument>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.1.0.M0</version>
      </plugin>
    </plugins>
  </build>
  <packaging>war</packaging>
</project>

Restlet Application class:
import org.restlet.Application;
import org.restlet.Component;
import org.restlet.Restlet;
import org.restlet.data.Protocol;
import org.restlet.routing.Router;

public class ModspaceRestletApplication extends Application {

    Router router;

    public ModspaceRestletApplication() {
        System.out.println("In ModspaceRestApplication.ctor");
        //this.setInboundRoot(this.createInboundRoot());
    }

    @Override
    public synchronized Restlet createInboundRoot() {
        // Create a root router
        router = new Router(getContext());

        System.out.println("In ModspaceRestApplication.createInboundRoot");

        // Attach the handlers to the root router
        router.attach("/users/{user}", UserResource.class);
        router.attach("/users/{user}/entries", ModelResource.class);

        return router;
    }

    /**
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {

        // Create a new Restlet component and add a HTTP server connector to it
        Component component = new Component();
        component.getServers().add(Protocol.HTTP, 8182);

        // Then attach it to the local host
        component.getDefaultHost().attach("/modspace", new ModspaceRestletApplication());

        // Now, let's start the component!
        // Note that the HTTP server connector is also automatically started.
        component.start();
    }
}

A: This now works. I believe the problem was due to:
<dependency>
  <groupId>org.restlet</groupId>
  <artifactId>org.restlet.ext.servlet</artifactId>
  <version>2.0-M3</version>
</dependency>

which should be:
<dependency>
  <groupId>org.restlet.jee</groupId>
  <artifactId>org.restlet.ext.servlet</artifactId>
  <version>2.2.0</version>
</dependency>

Notice groupID was wrong and version was old.


text:
Q: Spring Security - Differentiate between wrong username/password combination and unauthorised users In a Spring Boot + Spring Security application I have written my own AuthenticationProvider. It does authentication against another server, which holds information about usernames and their passwords.
So far, everything works fine - through the use of failureUrl(String)on the formLogin()in the Security-Configuration I can tell people that they have used invalid username/password combinations. Spring will also automatically redirect unauthorised requests to the login-Form.
However, there is the possibility that a user provides a valid username/password combination, but is simply not allowed to use the application anyway. Such user should, of course, not receive the same feedback of "wrong username/password", as that would be confusing to him. Is there any way in my AuthenticationProvideror maybe the Security-Configuration that I can somehow implement a case differentiation between these two? So far I can't see any way, returning null in the AuthenticationProvider makes Spring assume it's a "failure" and thus just redirects to the path specified in failureUrl(String).

A: I would suggest you differentiate between authentication and authorization. A user with valid credentials should always be authenticated. Access might still be denied due to missing authorization.
So how about granting the role "USER" for all users really allowed to use your app and configuring your app to require this role for specific requests like so:
protected void configure(HttpSecurity http) throws Exception {
    http
        .authorizeRequests()
        .antMatchers("/api/**").hasRole("USER")
        .anyRequest().authenticated()
        .and()
        // ...
        .httpBasic();
}

A: Spring Security supports this scenario using two different interfaces.
AuthenticationFailureHandler
Spring Security uses this API to determine how to deal with authentication failure (e.g. bad creds). It's quite common to want to redirect back to the login page, so this is what happens by default. However, you can customize it with
http
    .formLogin()
        .failureUrl(myUrl)

or
http
    .formLogin()
        .failureHandler(myFailureHandler)

for more sophisticated needs.
AccessDeniedHandler
Say that the user is logged in, though, but they are requesting a protected resource to which they do not have access.
By default, Spring Security returns a 403, but it can be configured to be an access denial page, too:
http
    .exceptionHandling()
        .accessDeniedPage(myAccessDeniedPage)

or
http
    .exceptionHandling()
        .accessDeniedHandler(myAccessDeniedHandler)

for more sophisticated needs.
Your AuthenticationProvider should just focus on authenticating the user -- you can throw an AuthenticationException to indicate failure. The UsernamePasswordAuthenticationFilter will take care of picking up the failure url and the ExceptionTranslationFilter will pick up the access denied page.

A: You can make a custom class for the case that the user is unauthorized:
public class UnauthorizedException extends AuthenticationException {

    public UnauthorizedException(String msg) {
        super(msg);
    }

}

The important is to extend Spring Security's AuthenticationException if you use it from your AuthenticationProvider implementation. Simply use it like:
throw new UnauthorizedException("Unauthorized to use this application.");

You may want to localize the message.
Such exception will be put in the session in an attribute named SPRING_SECURITY_LAST_EXCEPTION. If you for example use Thymeleaf you can print the message like this:
<p data-th-if="${param.error != null and session.SPRING_SECURITY_LAST_EXCEPTION != null}"
   data-th-text="${session.SPRING_SECURITY_LAST_EXCEPTION.message}">
</p>

A: Hope this will help you
    @RequestMapping(value = "/login")
public String getLoginPage(@RequestParam(name = "error", required = false) String error, Model model,
        @RequestParam(name = "logout", required = false) String logout) {
    if (error != null) {
        model.addAttribute("message", "Invalid Username or Password");
    }
    if (logout != null) {
        model.addAttribute("logout", "You have Successfully Logged Out");
    }

    return "login";
}

@RequestMapping(value = "/logout-user")
public String logout(HttpServletRequest request, HttpServletResponse response) {
    // fetch the authentication object
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null) {
        // logout and clear out the session and remove the authentication from the
        // security context
        new SecurityContextLogoutHandler().logout(request, response, auth);
    }
    return "redirect:/login?logout";
}

Spring-security configuration
<http>

    <intercept-url pattern="/**" access="permitAll" />
    <!-- navigate to login url -->
    <form-login login-page="/login" username-parameter="username"
        password-parameter="password" />
    <!-- access forbidden for unauthorized user -->
    <access-denied-handler error-page="/access-denied" />
    <csrf />
</http>


text:
Q: Having trouble with grid formating I'm trying to create an inline grid. I was able to set up the grid columns and such with no issue, but the divs that are supposed to assign each div to a certain area aren't. Most likely a problem with nesting, but not sure where. Also, please note that this is technically inside another grid but the problem persists even outside of the other grid.

    .galleryGrid {
      display: grid;
      height: 900px;
      margin: auto auto;
      padding-top: 150px;
      grid-template-columns: 150px 150px 150px;
      grid-template-rows: 150px 150px 150px 150px 150px 150px;
      grid-row: 3 / span 1;
      grid-column: 1 / span 1;
      grid-column-gap: 25px;
      grid-row-gap: 25px;
      text-align: center;
    }

    (hashtag)black {
      height: 150px;
      width: 150px;
    }

    .alexRowOne .alexColumnOne {
      grid-column: 1 / span 1;
      grid-row: 1 / span 1;
    }

    .alexRowOne .alexColumnTwo {
      grid-column: 2 / span 1;
      grid-row: 1 / span 1;
    }

    .alexRowOne .alexColumnThree {
      grid-column: 3 / span 1;
      grid-row: 1 / span 1;
    }

    .alexRowTwo .alexColumnOne {
      grid-column: 1 / span 1;
      grid-row: 2 / span 1;
    }

    .alexRowTwo .alexColumnTwo {
      grid-column: 2 / span 1;
      grid-row: 2 / span 1;
    }

    .alexRowTwo .alexColumnThree {
      grid-column: 3 / span 1;
      grid-row: 2 / span 1;
    }

    .alexRowThree.alexColumnOne {
      grid-column: 1 / span 1;
      grid-row: 3 / span 1;
    }

    .alexRowThree .alexColumnTwo {
      grid-column: 2 / span 1;
      grid-row: 3 / span 1;
    }

    .alexRowThree .alexColumnThree {
      grid-column: 3 / span 1;
      grid-row: 3 / span 1;
    }

    .alexRowFour .alexColumnOne {
      grid-column: 1 / span 1;
      grid-row: 4 / span 1;
    }

    .alexRowFour .alexColumnTwo {
      grid-column: 2 / span 1;
      grid-row: 4 / span 1;
    }

    .alexRowFour .alexColumnThree {
      grid-column: 3 / span 1;
      grid-row: 4 / span 1;
    }

    .alexRowFive .alexColumnOne {
      grid-column: 1 / span 1;
      grid-row: 5 / span 1;
    }

    .alexRowFive .alexColumnTwo {
      grid-column: 2 / span 1;
      grid-row: 5 / span 1;
    }

    .alexRowFive .alexColumnThree {
      grid-column: 3 / span 1;
      grid-row: 5 / span 1;
    }

    .alexRowSix .alexColumnOne {
      grid-column: 1 / span 1;
      grid-row: 6 / span 1;
    }

    .alexRowSix .alexColumnTwo {
      grid-column: 2 / span 1;
      grid-row: 6 / span 1;
    }

    .alexRowSix .alexColumnThree {
      grid-column: 3 / span 1;
      grid-row: 6 / span 1;
    }

    .alexRowOne {
      grid-row: 1 / span 1;
    }

    .alexRowTwo {
      grid-row: 2 / span 1;
    }

    .alexRowThree {
      grid-row: 3 / span 1;
    }

    .alexRowFour {
      grid-row: 4 / span 1;
    }

    .alexRowFive {
      grid-row: 5 / span 1;
    }

    .alexRowSix {
      grid-row: 6 / span 1;
    }

A: If I understand you correctly, you want tables and rows, essentially.  You have to make each row a grid and then the divs under that is where you put the grid-column-start property.
Change the css to this,
.alexRowOne{
  display:grid;
}

and then this,
 .alexRowOne .alexColumnOne {
          grid-column: 1 / span 1;
          grid-row: 1 / span 1;
        }


text:
Q: What is the most effiecient way to display a one-to-one relationship [Laravel] There are two tables with a one-to-one relationship: Products and Descriptions.
The controller returns the two tables in the blade view.
I use a foreach loop to display the Products table.
   @foreach($products as $product)
                  ...
          {{ $product->name }}
          {{ $product->price }}
                  ...
   @endforeach

I want to display the description for each product, too
   @foreach($products as $product)
                  ...
          {{ $product->name }}
          {{ $product->price }}
                  ...
          {{ $description}}
   @endforeach

where description->product_id == $product->id
I thought of using nested foreach loops or querying from the blade file on every loop but it doesn't seem efficient.
Is there a better way?
[NOTE: Not every Product has a Description]

A: I think you need to add the relationship in product model as:
use Description; // this is your Description model
class Product {
...
public function productDescription(){
  return $this->hasOne('Description','product_id','id');
// hasOne here because you want a one to one
}
...
}

And when you want to call products:
$products = Products::with('productDescription')->get()->toArray();

Now while iterating the products, get each product's description from product item as:
$description = $product->productDescription;

EDIT: For your html above,here is an example:
@foreach($products as $product)
  {{ $product->name }}
  {{ $product->price }}
  {{isset($product->productDescription->name) ? $product->productDescription->name : '' }}
  <!-- name key is just an example here -->
@endforeach

A: i used to work with twig but why don't you use something like
@if(isset($descriptions[$product->id]))
    {{ $descriptions[$product->id] }}
@endif

in the blade you can't?


text:
Q: how to loop through columns and then add them to a dataframe So the problem that I am working on requires me to go through a large data frame of actors/actresses and create a profile for them based on the movies that they have already acted in. I created this profile function which can be used for a single actor/actress, but I am having trouble looping it through the entire data frame to get a profile for all of the actors/actresses.
profile <- function(actor, df) {
   dftest <- subset(df, df$id.x == actor)
   fit <- rpart(name.y ~ id.x, method = "class", dftest)
   p <- predict(fit, dftest)
   return(colnames(p)[max.col(p,ties.method="first")][1])
  }

Here is the for loop that I have already, but I keep getting errors and am unsure if I am going about this method correctly.
for (k in c(1)) {
  user.frame <- data.frame()
  for (i in df2$id.x) { # df2$id.x is the column of actors names
    user.frame[i] <- data.frame(profile(i, df2))
  }
  df2final <- rbind(final, user.frame)
  View(df2fin)
}

** Edit **
This is the data that is going into the profile function
# A tibble: 278,361 x 7
   movie_id title   id.x name.x            id.y   id1 name.y
      <int> <chr>  <int> <chr>            <int> <int> <chr>
 1    19995 Avatar 65731 Sam Worthington  19995    28 Action
 2    19995 Avatar 65731 Sam Worthington  19995    12 Adventure
 3    19995 Avatar 65731 Sam Worthington  19995    14 Fantasy
 4    19995 Avatar 65731 Sam Worthington  19995   878 Science Fiction
 5    19995 Avatar  8691 Zoe Saldana      19995    28 Action
 6    19995 Avatar  8691 Zoe Saldana      19995    12 Adventure
 7    19995 Avatar  8691 Zoe Saldana      19995    14 Fantasy
 8    19995 Avatar  8691 Zoe Saldana      19995   878 Science Fiction
 9    19995 Avatar 10205 Sigourney Weaver 19995    28 Action
10    19995 Avatar 10205 Sigourney Weaver 19995    12 Adventure

Ideally, I would like the for loop to give me a data frame at the end that has the actor ID in one column and the profile genre next to it. The error I keep getting is this
Error in `[<-.data.frame`(`*tmp*`, i, value = list(profile.i..df2. = 1L)) :
  new columns would leave holes after existing columns

So i used your code and did this:
df <- data.frame(a = rep(df2$id.x))
df$b <- df2$name.y

actor.names <- unique(df$a)
result.file <- matrix(ncol = 2, nrow = length(actor.names))

for(i in 1:length(actor.names)){

  dftest  <- subset(df, a == actor.names[i])    #subset actor name
  fit     <- rpart::rpart(b ~ a, method = "class", dftest) #run model
  p       <- predict(fit, dftest) #predict genre
  temp    <- colnames(p)[max.col(p,ties.method="first")][1]

  result.file[i,1] <- actor.names[i]
  result.file[i,2] <- temp
}

It gave me this error:
Error in cbind(yval2, yprob, nodeprob) :
  number of rows of matrices must match (see arg 2)

But the results that I got were what i needed. Should i be worried?
result.file
     [,1]      [,2]
[1,] "65731"   "Action"
[2,] "8691"    "Action"
[3,] "10205"   "Comedy"
[4,] "32747"   "Action"
[5,] "17647"   "Action"
[6,] "1771"    "Drama"
[7,] "59231"   "Comedy"
[8,] "30485"   "Action"
[9,] "15853"   "Adventure"

[10,] "10964"   "Drama"
Here is the dput(head(df))
dput(head(df))
structure(list(a = c(65731L, 65731L, 65731L, 65731L, 8691L, 8691L
), b = c("Action", "Adventure", "Fantasy", "Science Fiction",
"Action", "Adventure")), .Names = c("a", "b"), row.names = c(NA,
6L), class = "data.frame")

A: I think you want something like this:
#generate data (4 actors, each with 2x Genre1 and 1x Genre3)
df <- data.frame(a = rep(c("Actor1","Actor2","Actor3","Actor4"),each=3),
                 b = rep(c("Genre1","Genre1","Genre3"),4),
                 stringsAsFactors = F)

#create a vector with actor names
actor.names <- unique(df$a)

#create a storage matrix for the results
result.file <- matrix(ncol = 2,
                      nrow = length(actor.names))

for(i in 1:length(actor.names)){

dftest  <- subset(df, a == actor.names[i])    #subset actor name
fit     <- rpart::rpart(b ~ a, method = "class", dftest) #run model
p       <- predict(fit, dftest) #predict genre
temp    <- colnames(p)[max.col(p,ties.method="first")][1]

result.file[i,1] <- actor.names[i]
result.file[i,2] <- temp
}

    result.file
     [,1]     [,2]
[1,] "Actor1" "Genre1"
[2,] "Actor2" "Genre1"
[3,] "Actor3" "Genre1"
[4,] "Actor4" "Genre1"


text:
Q: Supported Texture Formats in Direct3D9 I have a Direct3D 11 renderer that I'm implementing shared surfaces in to display content in a WPF application (which only uses Direct3D 9).
On the D3D11 side my back buffer is using the format DXGI_FORMAT_R8G8B8A8_UNORM and this works fine. According to this documentation DXGI_FORMAT_R8G8B8A8_UNORM maps to D3DFMT_A8B8G8R8 in D3D9. However, when I go to create the texture on the D3D9 side using that format it fails. I'm using Windows 10 and there's no D3D9 debug runtime so all I get is a D3DERR_INVALIDCALL as a result with no additional information.
This documentation seems to say that only the ARGB format is supported for back buffers in D3D9, with the ABGR format not listed under any section for support. Is this a mistake in the documentation or is this format completely unsupported?
If I instead use DXGI_FORMAT_B8G8R8A8_UNORM on the D3D11 side and D3DFMT_A8R8G8B8 on the D3D9 side texture creation succeeds.
For further confusion, this post implies that DXGI_FORMAT_R8G8B8A8_UNORM should be the more compatible format, yet it's the one I'm having trouble with.
I've also confirmed this behavior with the Microsoft WPF DirectX Interop sample on GitHub. Out of the box it's using DXGI_FORMAT_R8G8B8A8_UNORM and works fine, but if I change the back buffer to DXGI_FORMAT_B8G8R8A8_UNORM it breaks.
Why does a format that my video card supports work in one API and not the other? How do I know for sure which formats are supported in D3D9?

A: Stick with DXGI_FORMAT_B8G8R8A8_UNORM on the D3D11 side and D3DFMT_A8R8G8B8 in D3D9. Although DXGI_FORMAT_R8G8B8A8_UNORM is technically more compatible, if you don't require D3D10 support, it should be supported on all D3D11 devices.
How do I know for sure which formats are supported in D3D9?
You can get this (for your system) using the "DirectX Caps Viewer" (which comes with the Windows SDK - which comes with recent versions of Visual Studio). There is a section "Direct3D9 Devices". If you expand that for your adapter, and then D3D Device Types -> HAL -> Adapter Formats, there are sections for backbuffer formats, and which formats they support (screenshot from my system attached).

This same information is available at runtime via IDirect3D9::CheckDeviceFormat.
This documentation seems to say that only the ARGB format is supported for back buffers in D3D9, with the ABGR format not listed under any section for support. Is this a mistake in the documentation or is this format completely unsupported?
D3D9 did not support rendering to ABGR formats, but theoretically it was available as a format that could be sampled. However, it was not in common use, and looking through my current driver's caps, it's not supported. Best to stick to ARGB, which has universal (although, not actually guaranteed) support.

A: The BGRA (or ARGB) format is actually more compatible on most PCs, as that's the pixel format used by Windows GDI. At least NVidia built their GPUs with the Windows GDI pixel format in mind, so they recommend using BGRA instead of RGBA in order to bypass any costly format conversion: http://http.download.nvidia.com/developer/Papers/2005/Fast_Texture_Transfers/Fast_Texture_Transfers.pdf
If you had a Direct3D9 back buffer using D3DFMT_A8B8G8R8 (if Direct3D9 would support that), then on every call to IDirect3DDevice9::Present() the system (or GPU) would have to switch the bytes of each back buffer pixel around to match what Windows GDI expects, which is a very costly operation. This performance penalty is actually noticeable on OpenGL (which targets a hypothetical "perfect" GPU and allows for many incompatible format combinations by performing the necessary conversions on the CPU).