text:
Q: Why isn't Gradle adding the SQLite JAR files to my Java project? First of all, I'm pretty new to Gradle. My problem is that Gradle isn't adding the SQLite JAR files to my project even though I included them in my build.gradle file and the project was built correctly.
I followed the following tutorial in order to build my Java project with Gradle:
Building Java Applications Sample
Then I added the following code to my build.gradle file:
plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    id 'application'
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral()
}

dependencies {
    // This dependency is used by the application.
    implementation 'com.google.guava:guava:31.1-jre'
    implementation 'com.toedter:jcalendar:1.4'
    implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.40.0.0'
}

testing {
    suites {
        // Configure the built-in test suite
        test {
            // Use JUnit Jupiter test framework
            useJUnitJupiter('5.9.1')
        }
    }
}

application {
    // Define the main class for the application.
    mainClass = 'myApp.App'
}

Notice that I've also used the JCalendar library, which works just fine.
Despite being able to build the project succesfully and using the JCalendar library, when I check if the SQLite library is available I can't find nor use it. Also, when I execute the following code:
public static void main( String args[] ) {
        Connection c = null;
        try {
            Class.forName("org.sqlite.JDBC");
            c = DriverManager.getConnection("jdbc:sqlite:database.db");
        } catch ( Exception e ) {
            System.err.println( e.getClass().getName() + ": " + e.getMessage() );
            System.exit(0);
        }
        System.out.println("Opened database successfully");
    }

I get the following error:
java.lang.ClassNotFoundException: org.sqlite.JDBC
Any suggestions?


text:
Q: How to access remote file in GGIR package in R? I a using GGIR package for accelerometer data analysis. My data is onedrive folder which takes a long time to download. Is there a way I can access the onedrive files directly without downloading to my local machine?

A: My guess would be that this is not possible. If you're working with Azure there are tools available to connect to OneDrive and download/upload the data which is then processed on a separate instance. I'm guessing the same applies to your local machine, but I'm not intimately familiar with Microsoft's services to be sure.
For example:

By using Azure Logic Apps and the OneDrive connector, you can create automated tasks and workflows to manage your files, including upload, get, delete files, and more. With OneDrive, you can perform these tasks:

*

*Build your workflow by storing files in OneDrive, or update existing files in OneDrive.

*Use triggers to start your workflow when a file is created or updated within your OneDrive.

*Use actions to create a file, delete a file, and more. For example, when a new Office 365 email is received with an attachment (a trigger), create a new file in OneDrive (an action).

https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-onedrive

redpajama_set_name: RedPajamaStackExchange


text:
Q: What is the Perl equivalent of PHP's proc_open(), proc_close(), etc.? Using PHP's proc_open(), I can start a process, read from STDOUT and STDERR (separately) an arbitrary number of bytes at a time using fread() while the process is running, detect when the process is done using feof() on the STDOUT and STDERR pipes, and then use proc_close() to get the exit code of the process. I've done all of this in PHP. It works well, and gives me a lot of control.
Is there a way to do all of these things in Perl? To summarize, I need to be able to do the following:

*

*start an external process

*read STDOUT and STDERR separately

*read STDOUT and STDERR an arbitrary number of bytes at a time while the process is running (i.e. without having to wait for the process to finish)

*detect when the process is finished

*get the exit code of the process

Thanks in advance for your answers.

A: You could roll your own solution using Perl's system call interface, but it's easier to use the built-in module IPC::Open3.  As for your list:
Start an external process:
use IPC::Open3;
use IO::Handle;
use strict;

my $stdout = IO::Handle->new;
my $stderr = IO::Handle->new;
my $pid = open3(undef, $stdout, $stderr, 'my-command', 'arg1', 'arg2');

Read STDOUT and STDERR separately, an arbitrary number of bytes at a time:
my $line = <$stdout>;
# Or
sysread $stderr, my $buffer, 1024;

Detect when the process is finished:
use POSIX qw(sys_wait_h);

waitpid $pid, 0;  # Waits for process to terminate
waitpid $pid, WNOHANG;  # Checks if the process has terminated

Get the exit code of the process:
my $status = $?;  # After waitpid indicates the process has exited

Be sure to read the IPC::Open3 documentation; as it warns, it's easy to get yourself deadlocked when you have separate stdout and stderr pipes, if you're not careful.  If the child process fills either pipe, it will block, and if the parent process reads the other pipe, it will block.

A: You want this module: IPC::Open3

A: You want IPC::Run, it captures the IO and returns the exit value


text:
Q: QML sorting in tableview is very slowly I use QML TableView + own QAbstractTableModel and QSortFilterProxyModel. I've implemented sorting, but it works slowly. I've used these models without QML, but with QTableView - it worked perfectly. 30 000 items sort less then 1 secs.
Can anybody help? Where problem is?

A: I've supposed that QML repaint all items while Model is sorting data (in every iteration). I've found solution, for sorting you have to:

*

*Turn off model in QML

*Sorting items (use model)

*Return back model.

For example
onSortIndicatorOrderChanged: {
    model = null
    MyModel.Sort(...)
    model = MyModel
}

More details https://forum.qt.io/topic/52026/solved-sorting-qml-tableview-is-slow/4


text:
Q: How to handle caching and data-store sync in GAE I am writing a small appengine application and I want to start using Datastore.
My app has some users and each user is a complicated JAVA class.
Users might swap some "point" objects between them, so I need the data to be available and fast.
My question is quite generic:
How should I handle the data caching?
Storing the data entirely in the Datastore and fetching it in every call sounds slow in runtime.
On the other hand, holding the data in a static JAVA class sounds tricky, because every now and then the server resets and data is erased.
If I had a main loop, like in a regular console application I would've probably saved the data twice-three times a day on predefined hours of the day.
How should I manage my code in such a way that it would save the status in the datastore every now and then and this way will not loose any data.

A: if the number of write operations are less than read operations,
it is good to try "Write-through caching" with memcache module.
https://developers.google.com/appengine/docs/java/memcache/
basically the write-through caching works like this:

*

*for every write operations, program update the datastore, then backup the data to memcache

*for every read operations, program will try to read from memcache. if it can found required data, then it returns, otherwise it will fetch the data from datastore and backup the results to memcache.

A: As @lucemia noted, you should use memcache.
If you use objectify, you can set-up caching declaratively, without writing and cache handling code.


text:
Q: Puma web server (ROR) and connection timeout i have a custom setup of Ruby on rails and using puma as a web server (backed by Nginx - socket)
The database I am connection to is a rds medium (so 296 connections limit). My puma setup is threads 1:32 and 4 workers. With a connection pool of 128.
I have a high load 300 requests/sec and every lets say 1000 requests a longer calculation is made that takes about 3 seconds (getting all the events, making some calculations and updating them).
I am getting the error
ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.016 seconds)

But if I look at the rds database only 43 connections are opened. My memory is like 2000 MB out of 7000 MB (the 2 core processors are at 100%) I am wondering why do I get a connection timeout even if all my connections are not opened (and of course is the puma configuration ok)?
Thank for your help!
EDIT:
In my puma.rb I have:
on_worker_boot do
  ActiveRecord::Base.connection_pool.disconnect!

  ActiveSupport.on_load(:active_record) do
    config = Rails.application.config.database_configuration[Rails.env]
    config['reaping_frequency'] = ENV['DB_REAP_FREQ'] || 10 # seconds
    config['pool']              = ENV['DB_POOL'] || 128
    ActiveRecord::Base.establish_connection
  end
end

A: As mentioned here in the rails configuration guide about database pooling, when all the db connections are exhausted, ActiveRecord will wait for one to free up, I assume the number you increased is the http connection limit, not the db connection limit,
You could edit your database.yml and increase you connection limit to say 296 which is the limit of the rds instance
production:
  adapter: mysql2
  database: /path/to/sock
  pool: 296
  # username, password, etc


text:
Q: Website shows blank white screen solely on Windows IE11 www.relius.de works fine in any browser as far as I know. Windows IE11 however shows a blank white page. I have no idea what the problem could be. Can somebody help?

*

*IE11 Addons deactivated

*IE11 reset

*Tried different sub-sites, not only home

*Problem shows on different computers at different locations (Tried 3 totally different users, in totally different cities)

A: I try to check the site and find that your site is showing an error in the console and keep trying to loading.

I try to search regarding this error and find that in 2016 there is some issue with the IE 11. Microsoft had confirmed the issue and informed users to install the MS16-104: Security update for Internet Explorer: September 13, 2016

Reference:
"Permission Denied" script error in Internet Explorer 11
But this is the old update. so if you are using any older version than you can try to install this update to see whether it fix the issue or not.
If you are using the latest updates for your Windows OS and IE browser than it can be possible that issue is something else.
If you are not the developer of this site than you need to contact the developers of this site and inform them about this issue. They can try to look in to it to see what is causing this issue.
We need the problematic code. Without code, we are not able to guess what is causing this issue.


text:
Q: Why UIButton removeTarget:action:forControlEvents: has removed all targets? I have added multiple target to a UIButton. I'd like to remove one of these targets, but got nil after removeTarget:action:forControlEvents:.
import UIKit

class IndexViewController: UIViewController {
    lazy var sndBtn = UIButton(type: .system)

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)

        view.addSubview(sndBtn)
        sndBtn.setTitle("Hi", for: .normal)

        sndBtn.addTarget(self, action: #selector(IndexViewController.onClick1(_:)), for: .touchUpInside)
        sndBtn.addTarget(self, action: #selector(IndexViewController.onClick2(_:)), for: .touchUpInside)
        print(sndBtn.actions(forTarget: self, forControlEvent: .touchUpInside) as Any)

        sndBtn.removeTarget(self, action: #selector(IndexViewController.onClick1(_:)), for: .touchUpInside)
        print(sndBtn.actions(forTarget: self, forControlEvent: .touchUpInside) as Any)
    }

    @objc
    func onClick1(_ btn: UIButton) {
        print("Method1")
    }

    @objc
    func onClick2(_ btn: UIButton) {
        print("Method2")
    }
}

And the result just shows:
Optional(["onClick1:", "onClick2:"])

nil

A: As per Apple Docs:

the action parameter is not considered when stopping the delivery of events


text:
Q: Why the votes to close? I'm mystified by the 3 votes to close that this question has received (as of now).
All the votes are under the "not constructive" heading:

not constructive
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

I'm wracking my brain trying to figure out how this question fits the "not constructive" description.
How can I improve it to make it acceptable?

A: The question is still too broad after the revision. A full and complete answer would go on for pages and pages of detailed explanation. (Quite aside from the fact that no 'git plumbing' command will be the equivalent of editing something with vim.)
I would recommend splitting this question into several questions. After you do the basic reading on the mapping from garden-variety to plumbing commands, post one or more questions that ask one question.

A: The first revision of your question asks

does anyone know of a git tutorial that uses only plumbing commands?

Stack Overflow is not a platform for such requests. As a matter of fact, link-only answers are actively removed. And with a request for tutorials or other resources, it's exactly those answers you invite. Usually that will see such questions closed as "not constructive".
While your question is broader than that, and has now been revised, that to me is a far more likely explanation than users hunting for badges.


text:
Q: Json parser http get error? Hi I have problem with my application. I use android studio. My EditProductActivity.java class looks like:
package com.example.androidhive;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class EditProductActivity extends Activity {

    EditText txtName;
    EditText txtPrice;
    EditText txtDesc;
    EditText txtCreatedAt;
    Button btnSave;
    Button btnDelete;

    String pid;

    // Progress Dialog
    private ProgressDialog pDialog;

    // JSON parser class
    JSONParser jsonParser = new JSONParser();

    // single product url
    private static final String url_product_detials = "http://fastfix.net.pl/777/get_product_details.php";

    // url to update product
    private static final String url_update_product = "http://fastfix.net.pl/777/update_product.php";

    // url to delete product
    private static final String url_delete_product = "http://fastfix.net.pl/777/delete_product.php";

    // JSON Node names
    private static final String TAG_SUCCESS = "success";
    private static final String TAG_PRODUCT = "product";
    private static final String TAG_PID = "pid";
    private static final String TAG_NAME = "name";
    private static final String TAG_PRICE = "price";
    private static final String TAG_DESCRIPTION = "description";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.edit_product);

        // save button
        btnSave = (Button) findViewById(R.id.btnSave);
        btnDelete = (Button) findViewById(R.id.btnDelete);

        // getting product details from intent
        Intent i = getIntent();

        // getting product id (pid) from intent
        pid = i.getStringExtra(TAG_PID);

        // Getting complete product details in background thread
        new GetProductDetails().execute();

        // save button click event
        btnSave.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // starting background task to update product
                new SaveProductDetails().execute();
            }
        });

        // Delete button click event
        btnDelete.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // deleting product in background thread
                new DeleteProduct().execute();
            }
        });

    }

    /**
     * Background Async Task to Get complete product details
     * */
    class GetProductDetails extends AsyncTask<String, String, String> {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(EditProductActivity.this);
            pDialog.setMessage("Loading product details. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }

        /**
         * Getting product details in background thread
         * */
        protected String doInBackground(String... params) {

            // updating UI from Background Thread
            runOnUiThread(new Runnable() {
                public void run() {
                    // Check for success tag
                    int success;
                    try {
                        // Building Parameters
                        List<NameValuePair> params = new ArrayList<NameValuePair>();
                        params.add(new BasicNameValuePair("pid", pid));

                        // getting product details by making HTTP request
                        // Note that product details url will use GET request
                        JSONObject json = jsonParser.makeHttpRequest(
                                url_product_detials, "GET", params);

                        // check your log for json response
                        Log.d("Single Product Details", json.toString());

                        // json success tag
                        success = json.getInt(TAG_SUCCESS);
                        if (success == 1) {
                            // successfully received product details
                            JSONArray productObj = json
                                    .getJSONArray(TAG_PRODUCT); // JSON Array

                            // get first product object from JSON Array
                            JSONObject product = productObj.getJSONObject(0);

                            // product with this pid found
                            // Edit Text
                            txtName = (EditText) findViewById(R.id.inputName);
                            txtPrice = (EditText) findViewById(R.id.inputPrice);
                            txtDesc = (EditText) findViewById(R.id.inputDesc);

                            // display product data in EditText
                            txtName.setText(product.getString(TAG_NAME));
                            txtPrice.setText(product.getString(TAG_PRICE));
                            txtDesc.setText(product.getString(TAG_DESCRIPTION));

                        }else{
                            // product with pid not found
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }
            });

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog once got all details
            pDialog.dismiss();
        }
    }

    /**
     * Background Async Task to  Save product Details
     * */
    class SaveProductDetails extends AsyncTask<String, String, String> {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(EditProductActivity.this);
            pDialog.setMessage("Saving product ...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }

        /**
         * Saving product
         * */
        protected String doInBackground(String... args) {

            // getting updated data from EditTexts
            String name = txtName.getText().toString();
            String price = txtPrice.getText().toString();
            String description = txtDesc.getText().toString();

            // Building Parameters
            List<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair(TAG_PID, pid));
            params.add(new BasicNameValuePair(TAG_NAME, name));
            params.add(new BasicNameValuePair(TAG_PRICE, price));
            params.add(new BasicNameValuePair(TAG_DESCRIPTION, description));

            // sending modified data through http request
            // Notice that update product url accepts POST method
            JSONObject json = jsonParser.makeHttpRequest(url_update_product,
                    "POST", params);

            // check json success tag
            try {
                int success = json.getInt(TAG_SUCCESS);

                if (success == 1) {
                    // successfully updated
                    Intent i = getIntent();
                    // send result code 100 to notify about product update
                    setResult(100, i);
                    finish();
                } else {
                    // failed to update product
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog once product uupdated
            pDialog.dismiss();
        }
    }

    /*****************************************************************
     * Background Async Task to Delete Product
     * */
    class DeleteProduct extends AsyncTask<String, String, String> {

        /**
         * Before starting background thread Show Progress Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pDialog = new ProgressDialog(EditProductActivity.this);
            pDialog.setMessage("Deleting Product...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();
        }

        /**
         * Deleting product
         * */
        protected String doInBackground(String... args) {

            // Check for success tag
            int success;
            try {
                // Building Parameters
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("pid", pid));

                // getting product details by making HTTP request
                JSONObject json = jsonParser.makeHttpRequest(
                        url_delete_product, "POST", params);

                // check your log for json response
                Log.d("Delete Product", json.toString());

                // json success tag
                success = json.getInt(TAG_SUCCESS);
                if (success == 1) {
                    // product successfully deleted
                    // notify previous activity by sending code 100
                    Intent i = getIntent();
                    // send result code 100 to notify about product deletion
                    setResult(100, i);
                    finish();
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        /**
         * After completing background task Dismiss the progress dialog
         * **/
        protected void onPostExecute(String file_url) {
            // dismiss the dialog once product deleted
            pDialog.dismiss();

        }

    }
}

And error log show's:
03-17 14:20:17.782  11003-11003/com.example.androidhive E/AndroidRuntime﹕ FATAL EXCEPTION: main
    android.os.NetworkOnMainThreadException
            at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java)
            at java.net.InetAddress.lookupHostByName(InetAddress.java)
            at java.net.InetAddress.getAllByNameImpl(InetAddress.java)
            at java.net.InetAddress.getAllByName(InetAddress.java)
            at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java)
            at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java)
            at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java)
            at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java)
            at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java)
            at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java)
            at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java)
            at com.example.androidhive.JSONParser.makeHttpRequest(JSONParser.java:62)
            at com.example.androidhive.EditProductActivity$GetProductDetails$1.run(EditProductActivity.java:131)
            at android.os.Handler.handleCallback(Handler.java)
            at android.os.Handler.dispatchMessage(Handler.java)
            at android.os.Looper.loop(Looper.java)
            at android.app.ActivityThread.main(ActivityThread.java)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
            at dalvik.system.NativeStart.main(Native Method)
03-17 14:20:17.797      520-551/? E/EmbeddedLogger﹕ App crashed! Process: com.example.androidhive
03-17 14:20:17.797      520-551/? E/EmbeddedLogger﹕ App crashed! Package: com.example.androidhive v1 (1.0)
03-17 14:20:17.797      520-551/? E/EmbeddedLogger﹕ Application Label: My Application

Please help me what I must add to code. I know where is error but i don't have to know how to resolve that problem.

A: You need to establish your connections in an async thread. Main Thread is commonly for handling your UI tasks, not your background tasks.

A: Android would be really happy If you write following block of code in onCreate or in onPreExcecute but not in doInBackground. ( doInBackground gets called in non-ui thread.)
                            // product with this pid found
                            // Edit Text
                            txtName = (EditText) findViewById(R.id.inputName);
                            txtPrice = (EditText) findViewById(R.id.inputPrice);
                            txtDesc = (EditText) findViewById(R.id.inputDesc);

                            // display product data in EditText
                            txtName.setText(product.getString(TAG_NAME));
                            txtPrice.setText(product.getString(TAG_PRICE));
                            txtDesc.setText(product.getString(TAG_DESCRIPTION));

A: you should get json data on anathor thread like this:
you can open another class like this:
public class web_api_get  extends AsyncTask<Object, Object, String> {

     @Override
    public String doInBackground(Object... params) {
        StringBuilder builder = new StringBuilder();

        HttpParams params2 = new BasicHttpParams();
        HttpProtocolParams.setVersion(params2, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params2, "UTF-8");
        params2.setBooleanParameter("http.protocol.expect-continue", false);

        HttpClient client = new DefaultHttpClient(params2);
        HttpGet httpGet = new HttpGet(params[0]+"");
        try {
          HttpResponse response = client.execute(httpGet);
          StatusLine statusLine = response.getStatusLine();
          int statusCode = statusLine.getStatusCode();
          if (statusCode == 200) {
             HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();
            BufferedReader reader = new BufferedReader(new InputStreamReader(content));
            String line;
            while ((line = reader.readLine()) != null) {
              builder.append(line);
            }
          } else {
           // Log.e(ParseJSON.class.toString(), "Failed to download file");
          }

            } catch (Exception e) {
            }

        return builder.toString();
    }

}

and then you can call like this on mainactivity;
String return_json=new web_api_get().execute("your_url").get() ;

keep me what is going on


text:
Q: How to use the downloaded bootstrap files I download the files from the bootstrap site. I then moved the files into my project css and js folders. I linked them and it doesn't work. I tried it with the cdn and it works fine with that.
Here is my code:
<link href="/css/bootstrap.min.css" media="all" rel="stylesheet">

A: I believe the problem lies in the fact that u use:
/css/bootstrap.min.css

The first / indicates the root folder of your current drive, which I believe does not contain the css directory.
More particularly:

*

*/ means the root of the current drive;

*./ means the current directory;

*../ means the parent of the current directory.
You should link to the correct path (absolute or relatively) of your css file. It would be a lot more probable that you need to use ../css/bootstrap.min.css or css/bootstrap.min.css, depending on your directory structure.

A: You can use Twitter Bootstrap with the Asset-Pipeline. The steps are...

*

*Create the directory grails-app/assets/bootstrap

*Copy the Twitter Bootstrap css, fonts, and js directories into the directory created in step 1. You should have a path like this, for example: grails-app/assets/bootstrap/css/bootstrap.min.css

*Create the file grails-app/assets/bootstrap/bootstrap.css with the contents:
+/*
+*= require css/bootstrap.min
+*= require css/bootstrap-theme.min
+*/

*Create the file app/grails-app/assets/bootstrap/bootstrap.js with the contents:
+//= require js/bootstrap.min

*Add the follwing to app/grails-app/assets/javascripts/application.js
//= require bootstrap

*Add the following to app/grails-app/assets/stylesheets/application.css
*= require bootstrap

*Make sure your GSP or the layout it uses pulls in the assets using the asset:stylesheet and asset:javascript tags. (This step may already done):

A: try this one..
<link href="css/bootstrap.css" media="all" type="text/css" rel="stylesheet">

its worked for me

A: I wasn't using the gsp way of finding a file path.
It's supposed to look like this:
<link rel="stylesheet" href="${resource(dir: 'css', file: 'bootstrap.min.css')}" type="text/css">

A: Include path before /bootstrap.min.css and /bootstrap.min.js
Like this
In My case:
<link href="D:/ZIA/Semester 6b/bootstrap-5.0.2-dist/css/bootstrap.min.css" media="all" rel="stylesheet" >
     <script src="D:/ZIA/Semester 6b/bootstrap-5.0.2-dist/js/bootstrap.min.js" ></script>


text:
Q: reload TableView with data Basically i have a view with just a table view on it and on another tab you can add to this table view. but when you click the tab with the table view in it isnt updating it self, so how would i reload the data in the table view i have tried :
- (void) viewWillAppear: (BOOL) animated
{
[ThirdViewController.tableView reloadData];
}

with no success as i get error Expected ':' before '.' token.
all of the cells are added via
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

Any help would be great

A: Looks like ThirdViewController is the name of a class, not an object.
Try just
[tableView reloadData];

A: You can modify your app in the following way
1 Take a segmentation control above the table view.
2 When the user taps on any of the segment,take separate View Controller which is pushed onto the stack.
Cheers


text:
Q: Angular JS select menu item appearing twice I have a select menu populated from an array of objects:
$scope.regionMenu = [
    {
      label: 'Show All',
      value: ''
    },
    {
      label: 'EU',
      value: 'Europe'
    },
    {
      label: 'Dest via Air US OB',
      value: 'Dest via Air US OB'
    },
    {
      label: 'Dest via Air UK OB',
      value: 'Dest via Air UK OB'
    },
    {
      label: 'Supplements',
      value: 'Supplements'
    },
    {
      label: 'Used Items',
      value: 'Used Items'
    },
    {
      label: 'YOIHIMBE',
      value: 'YOIHIMBE'
    }
  ];

And the menu itself:
<select ng-model="regionFilter.region" ng-options="s.value as s.label for s in regionMenu track by s.value"></select>

But for some reason I can't figure out, I have a blank menu item at top and "show all" is in there twice:

Why is this?
UPDATE Code generated in the html:
<select ng-model="regionFilter.region" ng-options="s.value as s.label for s in regionMenu track by s.value" class="form-control input-xs ng-pristine ng-valid ng-touched" xxx-ng-change="updateRegion()">
<option value="?" selected="selected"></option>
<option label="Show All" value="">Show All</option>
<option label="Show All" value="">Show All</option>
<option label="EU" value="Europe">EU</option>
<option label="Dest via Air US OB" value="Dest via Air US OB">Dest via Air US OB</option>
<option label="Dest via Air UK OB" value="Dest via Air UK OB">Dest via Air UK OB</option>
<option label="Supplements" value="Supplements">Supplements</option>
<option label="Used Items" value="Used Items">Used Items</option>
<option label="YOIHIMBE" value="YOIHIMBE">YOIHIMBE</option>

UPDATE 2
We did the filter this way to have both a text field and the menu filter:
<input type="text" id="countrySearch" placeholder="Country" ng-model="regionFilter.$" size="15">

A: Here in AngularJS Documentation about Track By

If you do need to repeat duplicate items, you can substitute the default tracking behavior with your own using the track by expression.

That's because you're using track by and associating to it's value, but it's label seems to be what identifies your menu.
Here's an example
https://jsfiddle.net/nhkk98qf/2/

A: It has been my experience that this is caused by including the Bootstrap JS into your app. Remove the Bootstrap and you'll remove your duplicate. Also, the blank option is created by Angular because you do not have a default value for your ng-model. Set that and your blank option will go away.

A: You might like to do it as follow in HTML -
<select ng-model="regionFilter.region" ng-options="s.value as s.label for s in regionMenu track by s.value">
            <option hidden value="">Show All</option>
</select>

and remove 'Show All' item from array in JS.

A: Would you check this Plunker is that what you need?
<!DOCTYPE html>
<html ng-app="plunker">

  <head>
    <meta charset="utf-8" />
    <title>AngularJS Plunker</title>
    <script>document.write('<base href="' + document.location + '" />');</script>
    <link rel="stylesheet" href="style.css" />
    <script data-require="angular.js@1.4.x" src="https://code.angularjs.org/1.4.9/angular.js" data-semver="1.4.9"></script>
    <script src="app.js"></script>
  </head>

  <body ng-controller="MainCtrl">
    <select ng-model="regionFilter.region" ng-options="s.value as s.label for s in regionMenu track by s.label"></select>
  </body>

</html>

I just updated your example. if you can share your regionFilter.region.
you can also check this example


text:
Q: How to get all my database table values in a listbox with the for statement C# As a beginner in C# I am having some problems with getting all my values (and only the values - not the field names) out of my database table and list them in my listbox.
I did some research and found out that I could get all the field names of a specific table with the following code:
try
 {
   connection.Open();
   OleDbCommand command = new OleDbCommand();
    command.Connection = connection;
   string query = "select * from MyTable where Month='January'";

   command.CommandText = query;
   OleDbDataReader reader = command.ExecuteReader();
   var columns = listBox5;

   for (int i = 0; i < reader.FieldCount; i++)
   {
      if (reader.GetName(i) != "Month" && reader.GetName(i) != "Id")
      {
                        columns.Items.Add(reader.GetName(i));
      }
   }

   connection.Close();
}
catch (Exception ex)
{
     MessageBox.Show("Error" + ex);
}

This works perfectly for listing the field names (and not the field names Month and ID). Though now I also need to list all my values (that match with the corresponding field names). At first I thought to add them at the same time with the field names (above code) but this was to complicated for me. So then I try'd to list the values in another listbox with kinda the same code, but instead of using the GetName I used the GetValue. See code below:
try
{
   connection.Open();
   OleDbCommand command = new OleDbCommand();
   command.Connection = connection;
   string query = "select * from MyTable";

   command.CommandText = query;
   OleDbDataReader reader = command.ExecuteReader();

   var columns2 = listBox6;
   for (int i = 0; i < reader.FieldCount; i++)
   {
      columns2.Items.Add(reader.GetValue(i).ToString());
   }
   connection.Close();
}
catch (Exception ex)
{
  MessageBox.Show("Error" + ex);
}

This doesn't work though. I am getting the following error:

ErrorSystem.InvalidOperationException: Data doesn't exist for the row/column at line ...

On this line:
columns2.Items.Add(reader.GetValue(i).ToString());

A: You need to call Read() on your reader before you can read records:
var columns2 = listBox6;

while (reader.Read())
{
    for (int i = 0; i < reader.FieldCount; i++)
    {
        columns2.Items.Add(reader.GetValue(i).ToString());
    }
}

From MSDN:

Advances the SqlDataReader to the next record. The default position of the SqlDataReader is before the first record. Therefore, you must call Read to begin accessing any data.


text:
Q: Need to capture user entry into jquery chosen input There is no id for the input where the user search text is typed.  I want to capture this and not populate the chosen dropdown until I have three characters entered into that box.
I don't need help with the later, just the former.

A: There are several options, but it really depends on the exact markup of your input element. You could select by class, name, or really anything else for that matter, if you are crafty enough.
If any one of the following attributes are present:
<input id="someId" class="someClass" name="someName" value="someValue" />

Id Selector
$('input#someId')

Class Selector
$('input.someClass')

Attribute selector
Name
$('input[name="someName"]')

Value
$('input[value="someValue"]')

There are other ways, but they wouldn't be as flexible or practical.

A: Assuming that there is SOME way to identify which input you are selecting. Here's the best fiddle I could come up with: http://jsfiddle.net/6xX6v/1/
var keyCount = 0;
var inputLength;

$("input").keypress(function() {
    inputLength = $(this).val().length + 1;
    keyCount = inputLength;

    if (keyCount === 3) {
        $("#popthree").append("<option>What are you talking about</option>");
    }
});


text:
Q: Finding the Checked state of checkbox in a custom listview Hai i'm trying to develop an app where by i can send sms and email to a particular group of people..
I have a listview showing the contacts which are in my group.Each row is of the form
TextView(Name)TextView(phone) Checkbox(sms)
TextView(email id) Checkbox(mail)
I have used custom adapter to display the contact details to the listview.ihave set the onitemclick listener to find the position of the row..
I have to send sms and email to those contacts for which checkboxes have been set as true.how can i find the state of each of the checkboxes.
Please help me..lotz of thanx in advance..
I hav added below the custom adapetr i hv created..
public class ContactInfoAdapter  extends ArrayAdapter{
private ArrayList<Boolean> mChecked_sms,mChecked_email;

Context context;
int layoutResourceId;
ContactInfo data[] = null;

public ContactInfoAdapter(Context context, int layoutResourceId, ContactInfo[] data) {
    super(context, layoutResourceId, data);
    this.layoutResourceId   = layoutResourceId;
    this.context            = context;
    this.data               = data;
    mChecked_sms = new ArrayList<Boolean>();
    mChecked_email = new ArrayList<Boolean>();
    for (int i = 0; i < this.getCount(); i++) {
        mChecked_sms.add(i, false);
        mChecked_email.add(i,false);
    }

}

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    final ContactHolder holder;
    View row            = convertView;

    if(row == null)
    {
        LayoutInflater inflater = ((Activity)context).getLayoutInflater();
        row                     = inflater.inflate(layoutResourceId, parent, false);

        holder          = new ContactHolder();

        holder.txtName  = (TextView)row.findViewById(R.id.textViewName);
        holder.txtPhone = (TextView) row.findViewById(R.id.textViewPhone);
        holder.txtEmail = (TextView) row.findViewById(R.id.textViewEmail);
        holder.cb_sms_state = (CheckBox) row.findViewById(R.id.checkBox1);
        holder.cb_email_state = (CheckBox) row.findViewById(R.id.checkBox2);
        row.setTag(holder);
    }
    else
    {
        holder  = (ContactHolder)row.getTag();
    }

    ContactInfo contact     = data[position];
    holder.txtName.setText(contact.name);
    holder.cb_sms_state.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (holder.cb_sms_state.isChecked()) {
                mChecked_sms.set(position, true);
                Toast.makeText(getContext(), "checked", 2).show();
            } else {
                mChecked_sms.set(position, false);
            }
        }

    });
    holder.cb_sms_state.setChecked(mChecked_sms.get(position));

    holder.cb_email_state.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            if (holder.cb_email_state.isChecked()) {
                mChecked_email.set(position, true);
                Toast.makeText(getContext(), "checked", 2).show();
            } else {
                mChecked_email.set(position, false);
            }
        }

    });
    holder.cb_email_state.setChecked(mChecked_email.get(position));

    holder.txtPhone.setText(contact.number);
    holder.txtEmail.setText(contact.email);

    return row;
}
static class ContactHolder
{

    TextView txtName;
    TextView txtPhone;
    TextView txtEmail;
    CheckBox cb_sms_state;
    CheckBox cb_email_state;
}

}
The ContactInfo class is :
public class ContactInfo {
public String name;
public String number;
public String email;
public boolean sms_state;
public boolean email_state;
public ContactInfo(){
    super();
}

public ContactInfo(String name,String number,String email,boolean sms_state,boolean email_state) {
    super();

    this.name   = name;
    this.number = number;
    this.email  = email;
    this.sms_state = sms_state;
    this.email_state = email_state;
}
public void setName(String name) {
    this.name = name;
}

public String getName() {
    return name;
}

public void setNUmber(String number) {
    this.number = number;
}

public String getNumber() {
    return number;
}

public void setEmail(String email) {
    this.email = email;
}

public String getEmail() {
    return email;
}
public void setSms_state(Boolean sms_state)
{
    this.sms_state = sms_state;
}
public Boolean getSms_state(){
    return sms_state;
}
public void setEmail_state(Boolean email_state)
{
    this.email_state = email_state;
}
public Boolean getEmail_state(){
    return email_state;
}

A: Inside the getView() method, you have to implement a OnCheckedChangeListener for the CheckBox.
Here is a listener code, say for example:
ChkBx.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
    {
        if ( isChecked )
        {
            // perform logic
        }

    }
});

A: See the doc.
I think you need :

checkbox.isChecked()

A: Here's a simple sample:
mContactListView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long arg3) {

            CheckBox chkContact = (CheckBox) view.findViewById(R.id.listrow_contact_chkContact);
            if (chkContact.isChecked()) {
                ...
            }
});

A: I've had this problem with my app Hasta La Vista I've create a with custom listview with checked items and I needed to get checked items this was the solution:
    ListView lv = getListView(); //ver listview
    if(lv != null){
        final SparseBooleanArray checkedItems = lv.getCheckedItemPositions(); //get checked items
        if (checkedItems == null) {
            return;
        }

        final int checkedItemsCount = checkedItems.size();
        for (int i = 0; i < checkedItemsCount; ++i) {
            // This tells us the item position we are looking at
            final int position = checkedItems.keyAt(i);
            // This tells us the item status at the above position
            final boolean isChecked = checkedItems.valueAt(i);

            if(isChecked){
                                    //get item from list and do something
                lv.getAdapter().getItem(position);

            }
        }

    }

A: As ListView views are recycled, you can not rely  on  listening on particular instance, you will have to store "checked" state in your data model. You will also need custom list adapter, where you create  and populate individual entries.  Following shall be done:
   - in overriden getView(), either create new view ( in case no convertView was supplied ) or inflate new one
   - populate viewv fields from you data model
   - remove old onclick listener, and set new one ( can be anonymous inner class ) modifying  your data model
PS: recycling views is important if your list is big


text:
Q: Need to cut part of a string in shell scripting I have a string example.123.ytu.tar.gz
I want to have example.123.ytu.tar how can i get in shell scripting
I tried with
echo example.123.ytu.tar | cut -d "." -f3, But it is giving only tar

A: I would use basename for this.
$ basename --suffix ".gz" example.123.ytu.tar.gz
example.123.ytu.tar

You can find out more about it via man basename

A: echo example.123.ytu.tar.gz | cut -d "." -f1-4
example.123.ytu.tar

The -f option takes any comma separated list of fields and/or field ranges (with '-'). Eg
echo example.123.ytu.tar.gz | cut -d "." -f1,2,3,4
example.123.ytu.tar

gives the same output.

A: You could simply use grep
echo example.123.ytu.tar | grep -Eo '.*tar'

output: example.123.ytu.tar
The -E option enables extended regular expression mode and the -o option makes grep print only the part of the word that matched the regex.


text:
Q: Бот в дискорде - как в конце кода при вводе "Да" запустить код заново? import discord
from discord.ext import commands
import random
from random import randint, choice
import time
import os

bot = commands.Bot(command_prefix='$')

@bot.command('go')
# в start не указал ctx в скобках
async def start(ctx):
    result = 0
    result_bot = 0
    choice = True
    diler = True

    while diler:
        result_bot += randint(1, 10)
        await ctx.send(f'--У дилера выпало {result_bot}--')
        diler = False
    while choice:
        result += randint(1, 10)
        time.sleep(1)
        await ctx.send(f'_У вас {result} очков')
        time.sleep(0.6)
        if result > 21:
            await ctx.send('Вы проиграли')
            result = 0
            result_bot = 0
            choice = False
        else:
            await ctx.send('продолжать?(Go/stop)')
            answ = await bot.wait_for('message')
            if answ.content == 'stop':
                if result == 21:
                    await ctx.send('Вы выйграли')
                    result = 0
                    result_bot = 0
                    choice = False
                else:
                    while True:
                        result_bot += randint(1, 10)
                        await ctx.send(f'--У дилера выпало {result_bot}--')
                        time.sleep(1)
                        if result_bot > result and result_bot < 21 and result_bot != 21:
                            await ctx.send('Вы проиграли')
                            result = 0
                            result_bot = 0
                            choice = False
                            break
                        if result_bot > 21:
                            await ctx.send('Вы выйграли!')
                            result = 0
                            result_bot = 0
                            choice = False
                            break

        await ctx.send('Ещё раз?(Дa/Нет)')
        again = await bot.wait_for('message')
        again = again.content.lower()
        if again == "да":
            diler = True
            choice = True
        #Здесь код должен запуститься заново
        else:
            await ctx.send('Ладно')

A: Прикладывать нужно только минимальный пример кода, а не весь. Поэтому ответ будет с минимальным примером.
Как вариант, можно вынести основную логику игры в отдельную функцию и вызывать ее при вызове команды:
# функция игры
async def game(ctx):
   . . .

@bot.command()
async def go(ctx):
   await game(ctx)

И при вводе "Да" из функции game() вызвать саму себя:
# функция игры
async def game(ctx):
   . . .
    await ctx.send('Ещё раз?(Дa/Нет)')
        again = await bot.wait_for('message')
        again = again.content.lower()
        if again == "да":
            await game(ctx)
   . . .

И не забудьте сменить токен — это не та вещь, которую следует выкладывать в общий доступ, т.к. к вашему боту может получить доступ любой человек.


text:
Q: Rails routes for self nested models In my rails app I have a Task model.
In my app, my tasks can have substasks and so on. Since my subtasks are tasks with only a parent task, I did a self-nested model such as
class Task < ActiveRecord::Base
  ## Self Join
  has_many :subtasks, class_name: "Task",
  foreign_key: "parent_task_id"

  belongs_to :parent_task, class_name: "Task"
  ##
end

I have now a trouble making routes for this model.
I naively thought that it would be that simple. Here it is:
resources :tasks do
  resources :tasks
end

The result I try to acheive is by going to this url : "/tasks/1/tasks" is that I can render (by the way, in all my controllers I curently render in JSON not using views) the tasks that have as parent_task_id 1.
Hope you understand my request.
Thanks in advance ;)


text:
Q: Swipe tab fragment with mvvmcross I want to use swipe to switch tab in the Fragments tutorial. I cannot find an example of this. Is this part of mvvmcross?

A: I've find this for you : Tabs in the actionbar with mvvmcross
Try searching for "mvvmcross tab fragment" on here and hopefully you will find quite a few helpful questions https://stackoverflow.com/search?q=%5Bmvvmcross%5D+tab+fragment


text:
Q: Unable to access dockerized .net core 6 application using IP here is my Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 5000

ENV ASPNETCORE_URLS=http://+:5000

RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

FROM base AS final
WORKDIR /app
COPY . .
ENTRYPOINT ["dotnet", "DockerTest.dll"]

I'm running the container using this command
docker run -d --restart=always -p 0.0.0.0:5055:5000  testcommand
I'm getting Connected to localhost. when run telnet localhost 5055
in server but from browser not getting any response.


text:
Q: doctrine 2 cascade persist saving too much so this is my prePersist on EventListener
public function prePersist(LifecycleEventArgs $args)
    {
        //the first entity will have the PMP, so we catch it and continue to skip this if after this
        if ($this->pmp == null) {
            $this->pmp = $args->getEntity()->getPmp();
        }

        $taxonomicClass = $args->getEntity();

        if($taxonomicClass instanceof TaxonomicClass){

            if(is_null($taxonomicClass->getId())){
                //here it says that i have created a new entity, need to persist it via cascade={"persist"}
                $taxonomicClass->setPmp($this->pmp);
            }
        }
    }

that's fine, i had added the annotation on it:
 /**
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Pmp", cascade={"persist"})
     * @ORM\JoinColumn(name="pmp_id", referencedColumnName="id", nullable=false)
     **/
    private $pmp;

and it saves everything from my hierarchy, even a new PMP, an object that already exist in the database!
what i want is that everything that im saving from my hierarchy needs to be related to the PMP that i passed, but when i set $taxonomicClass->setPmp($this->pmp); doctrine thinks that i created a new instance of PMP, since im not, i just want to this guy have an associaton with the PMP.
i tried put merge on the cascade option, but it only works with persist, how to make doctrine dont create a new instance, and instead use the one that i passed?

A: noticed my problem, i was assigning an attribute from memory, i should retrive him from database to doctrine understand.
public function prePersist(LifecycleEventArgs $args)
{
    if ($this->pmp == null) {
            $this->pmp = $args->getEntity()->getPmp();
    }

    $taxonomicClass = $args->getEntity();

    if($taxonomicClass instanceof TaxonomicClass){

        if(is_null($taxonomicClass->getId())){
            //this solved the problem
            $pmp = $args->getEntityManager()->getRepository("AppBundle:Pmp")->find($this->pmp->getId());
            $taxonomicClass->setPmp($pmp);
        }
    }
}

i will keep in mind now that when a new entity is created, but it doesn't need to be saved, you must retrieve it from db, cascade={"persist"} wasn't even necessary


text:
Q: Perform counting for number of occurrence in SQL Is it common and convenient for SQL to perform such data manipulation, capturing only results in columns satisfying the conditions, and perform counting for number of occurrence? How to write SQL code to generate the desired output (if feasible).
Name is presented only when the conditions (Cond1 to Cond5) are yes.
Desired Input
ID Cond1 Cond2 Cond3 Cond4 Cond5 Name1   Name2   Name3   Name4    Name5
1  No    Yes   No    No    Yes   (null)  Result1 n/a     (null)   Result2
2  Yes   No    Yes   No    Yes   Result3 n/a     Result4 (null)   Result5

Desired Output
ID Counting Name
1  1        Result1
1  2        Result2
2  1        Result3
2  2        Result4
2  3        Result5

A: This can be done with union all and row_number():
select id,  row_number() over(partition by id order by seq) couting, name
from (
    select id, name1 name, 1 seq from mytable where cond1 = 'Yes'
    union all select id, name2, 2 from mytable where cond2 = 'Yes'
    union all select id, name3, 3 from mytable where cond3 = 'Yes'
    union all select id, name4, 4 from mytable where cond4 = 'Yes'
    union all select id, name5, 5 from mytable where cond5 = 'Yes'
) x
order by id, rn

A: You can use UNPIVOT with pairs of columns and then filter on the Yes rows and use the ROW_NUMBER analytic function to get the incremental index of the result:
Query:
SELECT id,
       ROW_NUMBER() OVER ( PARTITION BY id ORDER BY value ) AS "COUNT",
       name
FROM   table_name
UNPIVOT  ( ( cond, name ) FOR value IN (
    ( Cond1, Name1 ) AS 'V1',
    ( Cond2, Name2 ) AS 'V2',
    ( Cond3, Name3 ) AS 'V3',
    ( Cond4, Name4 ) AS 'V4',
    ( Cond5, Name5 ) AS 'V5'
  ) )
WHERE cond = 'Yes'

Test Data:
CREATE TABLE table_name (
  ID    NUMBER(10,0) PRIMARY KEY,
  Cond1 VARCHAR2(3) CHECK ( Cond1 IN ( 'Yes', 'No' ) ),
  Cond2 VARCHAR2(3) CHECK ( Cond2 IN ( 'Yes', 'No' ) ),
  Cond3 VARCHAR2(3) CHECK ( Cond3 IN ( 'Yes', 'No' ) ),
  Cond4 VARCHAR2(3) CHECK ( Cond4 IN ( 'Yes', 'No' ) ),
  Cond5 VARCHAR2(3) CHECK ( Cond5 IN ( 'Yes', 'No' ) ),
  Name1 VARCHAR2(10),
  Name2 VARCHAR2(10),
  Name3 VARCHAR2(10),
  Name4 VARCHAR2(10),
  Name5 VARCHAR2(10),
  CHECK ( ( Cond1 = 'Yes' AND Name1 IS NOT NULL ) OR ( Cond1 = 'No' AND ( Name1 IS NULL OR Name1 = 'n/a' ) ) ),
  CHECK ( ( Cond2 = 'Yes' AND Name2 IS NOT NULL ) OR ( Cond2 = 'No' AND ( Name2 IS NULL OR Name2 = 'n/a' ) ) ),
  CHECK ( ( Cond3 = 'Yes' AND Name3 IS NOT NULL ) OR ( Cond3 = 'No' AND ( Name3 IS NULL OR Name3 = 'n/a' ) ) ),
  CHECK ( ( Cond4 = 'Yes' AND Name4 IS NOT NULL ) OR ( Cond4 = 'No' AND ( Name4 IS NULL OR Name4 = 'n/a' ) ) ),
  CHECK ( ( Cond5 = 'Yes' AND Name5 IS NOT NULL ) OR ( Cond5 = 'No' AND ( Name5 IS NULL OR Name5 = 'n/a' ) ) )
);

INSERT INTO table_name ( ID, Cond1, Cond2, Cond3, Cond4, Cond5, Name1, Name2, Name3, Name4, Name5 )
SELECT 1, 'No',  'Yes', 'No',  'No', 'Yes', null,      'Result1', 'n/a',     null, 'Result2' FROM DUAL UNION ALL
SELECT 2, 'Yes', 'No',  'Yes', 'No', 'Yes', 'Result3', 'n/a',     'Result4', null, 'Result5' FROM DUAL;

Output:

ID | COUNT | NAME
-: | ----: | :------
 1 |     1 | Result1
 1 |     2 | Result2
 2 |     1 | Result3
 2 |     2 | Result4
 2 |     3 | Result5

db<>fiddle here

A: You can use CONNECT BY LEVEL for achieving the desired result as following:
SELECT
    ID,
    ROW_NUMBER() OVER(PARTITION BY ID ORDER BY LVL) AS "Counting",
    NAME_   AS "Name"
FROM
    (SELECT
            T.ID,
            DECODE(LVL, 1, COND1, 2, COND2, 3, COND3, 4, COND4, 5, COND5) AS COND,
            DECODE(LVL, 1, NAME1, 2, NAME2, 3, NAME3, 4, NAME4, 5, NAME5) AS NAME_,
            LVL   AS LVL
        FROM
            YOUR_TABLE T join
       (Select level as lvl from dual CONNECT BY  LEVEL <= 5) on (1=1)
     )
WHERE COND = 'Yes';

Cheers!!

A: Another option:
SQL> with
  2  test (id, cond1, cond2, cond3, cond4, cond5, name1, name2, name3, name4, name5) as
  3    -- your sample data
  4    (select 1, 'no' , 'yes', 'no' , 'no', 'yes', null     , 'result1', 'n/a'    , null, 'result2' from dual union all
  5     select 2, 'yes', 'no' , 'yes', 'no', 'yes', 'result3', 'n/a'    , 'result4', null, 'result5' from dual
  6    ),
  7  temp as
  8    -- values whose COND column is 'yes'
  9    (select id,
 10       decode(cond1, 'yes', name1) n1,
 11       decode(cond2, 'yes', name2) n2,
 12       decode(cond3, 'yes', name3) n3,
 13       decode(cond4, 'yes', name4) n4,
 14       decode(cond5, 'yes', name5) n5
 15     from test
 16    ),
 17  up as
 18    -- unpivot data
 19    (select *
 20     from temp
 21     unpivot (c_name for pc in (n1, n2, n3, n4, n5))
 22    )
 23    -- final result
 24  select id,
 25         row_number() over (partition by id order by c_name) counting,
 26         c_name as name
 27  from up
 28  order by id;

        ID   COUNTING NAME
---------- ---------- -------
         1          1 result1
         1          2 result2
         2          1 result3
         2          2 result4
         2          3 result5

SQL>

A: Here is another option using UNPIVOT.
create table mytab(id number,
                   cond1 varchar2(3),
                   cond2 varchar2(3),
                   cond3 varchar2(3),
                   cond4 varchar2(3),
                   cond5 varchar2(3),
                   Name1 varchar2(7),
                   Name2 varchar2(7),
                   Name3 varchar2(7),
                   Name4 varchar2(7),
                   Name5 varchar2(7));

insert into mytab values(1,'No','Yes','No','No','Yes',null,'Result1','n/a',null,'Result2');

insert into mytab values(2,'Yes','No','Yes','No','Yes','Result3','n/a','Result4',null,'Result5');

commit;

select * from mytab;

Output:
ID COND1 COND2 COND3 COND4 COND5 NAME1   NAME2   NAME3   NAME4    NAME5
1  No    Yes   No    No    Yes   (null)  Result1 n/a     (null)   Result2
2  Yes   No    Yes   No    Yes   Result3 n/a     Result4 (null)   Result5

UNPIVOT based solution.
with ns as (
select id,
       n,
       names
  from mytab
unpivot(names for n in (name1 as 'n1',
                        name2 as 'n2',
                        name3 as 'n3',
                        name4 as 'n4',
                        name5 as 'n5'))),
cs as (
select id,
       n,
       condns
  from mytab
unpivot(condns for n in (cond1 as 'n1',
                         cond2 as 'n2',
                         cond3 as 'n3',
                         cond4 as 'n4',
                         cond5 as 'n5')))
select ns.id,
       row_number() over(partition by ns.id order by ns.n) counting,
       ns.names
  from ns inner join cs
    on ns.id = cs.id
   and ns.n = cs.n
   and cs.condns = 'Yes'
 order by 1,2;

Output:
ID COUNTING NAMES
1  1        Result1
1  2        Result2
2  1        Result3
2  2        Result4
2  3        Result5


text:
Q: Connection timed out for netcat after opening port in router So, my situation is that I have one Windows PC and one PC with Kali Linux. On Windows PC I've opened a netcat listener on port 4444. Then on my router I've opened port 4444.
Finally when I go on kali and, using my mobile data hotspot, I want to connect to my Windows. But when I try it doesn't work, and when I check ports using:
nc -vn HOSTNAME PORT

it says:

Connection timed out.

Could anyone help me please? I've already tried using netcat between the two PCs in the same network and it works perfectly, so I thinks it's a network problem. My router is an Asus DSL-N12E_C1.

A:
On Windows PC I've opened a netcat listener on port 4444.

Make sure your netcat binds and listens on all IP addresses, not only on localhost, e.g.
nc -v -l 0.0.0.0 4444

See: Netcat for Windows.
Then make sure you can connect to that port on the same machine. Then try remotely.

Then on my router I've opened port 4444.

Apart of opening the port, make sure that you've also forwarding that port into the right host like:

*

*PUBLIC_ROUTER_IP:4444 <-> INTERNAL_WINDOWS_IP:4444

To connect to the remote port, run:
nc -v example.com 80

or use telnet command, e.g.
telnet PUBLICIP PORT

See also: Why is "nc -l xxxx" not opening a port?


text:
Q: xamarin.forms Share directly to platform Sharing in Xamarin.Forms usually goes something like:
public async Task ShareUri(string uri)
{
    await Share.RequestAsync(new ShareTextRequest
        {
            Uri = uri,
            Title = "Share Web Link"
        });
}

But this will just open the share interface. If I already have an interface set up to this, how can I share to a specific platform directly and cut out the middle man?
Any ideas?
Than you!

A: There is a level of 'it depends' on what you can based on what exactly you plan to do with the sharing. If you are planning on adding the content (text, image, etc.) to the clipboard or you know the url scheme of the app you wish to share with then this will be entirely within your control (e.g. for copying just use Xamarin.Essentials.Clipboard or for opening another app just use Xamarin.Essentials.Launcher.
Note that the current approach you referred to Share.RequestAsync provides a lot of the heavy lifting around knowing which apps are on the device that will accept the content type you wish to share. This is managed by the operating system of the device and therefore uses it's built in UI to provide the sharing options. I do not believe there is a way to perform the actual sharing without using this and if you did manage to find a way you would want to double check that Apple and Google would accept such an approach when it comes to review time.


text:
Q: Classic ASP super newbie question OK, So I have recently moved into the world of Web development after spending quite a few years coding in a pretty simple proprietary language, and one of my first jobs is to tweak an old classic ASP page for one of our clients.
I'm using Visual Studio 2008 to try debug some problems I am having, but the page won't load at all. If I browse the site locally using IIS, then everything works without any trouble at all, so I am not sure what I am doing wrong.
Here's the error message I get;
Compiler Error Message: BC30451: Name 'VariableName' is not declared.

The way this is setup, is that file1.asp has an include for file2.asp
<!-- #include file=./includes/file2.asp -->

Then file2.asp has a form post for file3.asp
<FORM METHOD="POST" ACTION="/includes/file3.asp">

Inside file3.asp is where the variable is created.
So, when running this site via IIS, everything works, the variables look to be passed between files without any trouble, but when I try to debug the site using VS2008, I get the BC30451 error code.
Can anyone right my ship? I've been doing a lot of googling and reading of other websites that seem to deal with this issue, but a lot of it is going over my head.
If anyone could please take the time to explain what & why this is happening, as well as providing some kind of solution, or pointing me in the direction of somewhere that may be able to help, it would be more than greatly appreciated.
Cheers,
Pat.

A: You can debug classic ASP in Visual Studio 2008.  The way to do it involves attaching the debugger to the process that is running your ASP pages.  Keeping in mind that Classic ASP debugging only works with IIS; it does not work with the VS Development Web Server (Cassini).  Also, make sure that you have enabled ASP debugging in IIS:
IIS Home Directory Properties http://img4.imageshack.us/img4/6431/capturert.png

IIS Application Configuration http://img26.imageshack.us/img26/4802/capture2qr.png
Once you have the configuration in IIS as noted above, here is how to attach the debugger:

*

*Open the Classic ASP files in Visual Studio

*Set a breakpoint anywhere you want to break in the server-side code

*View the page in a web browser (ensures that the host process is running)

*In Visual Studio: Debug Menu -> Attach to Process

*Locate the IIS ASP worker process (w3wp.exe on IIS6, dllhost.exe on IIS5.1)

*Attach to the script code for the host process (see below for example)

Attach Debugger Dialog http://img43.imageshack.us/img43/2218/capturegb.png
At this point, the breakpoint should bind and you should be able to debug the Classic ASP pages.  (you may have to refresh the page in the web browser to get the code to execute again once the debugger has been attached)

A: I've never tried to run classic ASP in VS2008.  But it is not a compiled language, and I don't think you can run a debugger on it.  When I did ASP, I just did a bunch of Response.Write to debug.


text:
Q: ValueError: Must pass 2-d input when creating a pandas dataframe using for loop The neg_ctl_df dataframe contains negative control and the coding_gene_df contains my gene-of-interest.
I want to create a dataframe norm_df that stores the normalized output.
import pandas as pd

# Median of the NEGATIVE controls
neg_ctl_median = neg_ctl_df.iloc[:,-29:].median()

# Median of the POSITIVE controls
pos_ctl_median = pos_ctl_df.iloc[:,-29:].median()

# Mean of the PROBESET controls
probeset_norm = qnorm.quantile_normalize(probe_ctl_df.iloc[:,-29:], axis=1)

# Normalize the samples
i = []
for gene, sample in coding_gene_df.iloc[:,-29:].astype(float).iterrows():
  norm_val = sample - neg_ctl_median # Subtract the median of the NEGATIVE controls within the patient sample
  norm_val = norm_val / pos_ctl_median # Divide the median of the POSITIVE controls within the patient sample (replace sample value with the value that has already been normalized against negative control)
  norm_val = norm_val / probeset_norm # Probeset normalization (quantile normalization)
i.append(norm_val)
pd.DataFrame(i)

Traceback:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-63-85108013a3d8> in <module>()
     15   norm_val = norm_val / probeset_norm # Probeset normalization (quantile normalization)
     16 i.append(norm_val)
---> 17 pd.DataFrame(i)

2 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/internals/construction.py in _prep_ndarray(values, copy)
    553         values = values.reshape((values.shape[0], 1))
    554     elif values.ndim != 2:
--> 555         raise ValueError(f"Must pass 2-d input. shape={values.shape}")
    556
    557     return values

ValueError: Must pass 2-d input. shape=(1, 102, 29)

Samples:
coding_gene_df.iloc[1:10,-29:-27].to_dict()
{'12h_P1_T4_TimeC2_PIDC4_Non-Survivor': {'CNTN2': '6.35',
  'KCNA2': '5.29',
  'LOC79160': '5.99',
  'PTGIS': '5.66',
  'TTTY11': '3.91',
  'VPS4B': '9.68',
  'XRCC1': '9.09',
  'ZC3HC1': '7.19',
  'ZFAS1': '8.68'},
 '48h_P1_T6_TimeC3_PIDC1_Non-Survivor': {'CNTN2': '6.6',
  'KCNA2': '5.36',
  'LOC79160': '6.18',
  'PTGIS': '5.54',
  'TTTY11': '3.92',
  'VPS4B': '9.51',
  'XRCC1': '9.15',
  'ZC3HC1': '7.05',
  'ZFAS1': '8.46'}}

Negative controls:
neg_ctl_df.iloc[1:10,-29:-27].to_dict()
{'12h_P1_T4_TimeC2_PIDC4_Non-Survivor': {'---': '8.45'},
 '48h_P1_T6_TimeC3_PIDC1_Non-Survivor': {'---': '8.16'}}


text:
Q: SweetAlert delete errors in angular5 Working with angular5, I'm trying to use SweetAlert for delet option in my code, but I'm getting some error:

I'm using the same function as in the official  link
This is the code in .ts
import * as _swal from 'sweetalert';
import { SweetAlert } from 'sweetalert/typings/core';
const swal: SweetAlert = _swal as any;

@Component({
  selector: 'app-clients',
  templateUrl: './clients.component.html',
  styleUrls: ['./clients.component.scss']
})
export class ClientsComponent implements OnInit {

  pageClients:any;

   ngOnInit() {
    this.doSearch();
    this.getAllClientsList();
  }

  delete(p:Clients){

    swal({
          title: "Are you sure?",
          text: "Once deleted, you will not be able to recover this imaginary file!",
          icon: "warning",
          buttons: true,
          dangerMode: true,
        })
          .then((willDelete) => {
            if (willDelete) {
                  this.clientService.deleteClient(p.id)
                  .subscribe(data=>{
                  this.pageClients.content.splice(
                  this.pageClients.content.indexOf(p),1
                     );
                  },err=>{
                  console.log(err);
                   })
              swal("Poof! Your imaginary file has been deleted!", {
                icon: "success",
              });
            } else {
              swal("Your imaginary file is safe!");
            }
          });
    }
}

How to resolve this?
EDIT
delete(p:Clients){

    swal({
      title: "are you sur ?",
      text: " nce deleted, you will not be able to recover this imaginary file!!",
      type: 'warning',
      showConfirmButton: true,
      showCancelButton: true
    })
      .then((willDelete) => {

        if (willDelete) {

          this.clientService.deleteClient(p.id)
            .subscribe(data=>{
              this.pageClients.content.splice(
                this.pageClients.content.indexOf(p),1
              );
            },err=>{
              console.log(err);
            })

          swal({
           title: " great",
            type: 'success',
          });
        } else {
          swal("you have not deleted this client yet ");
        }
      });
  }

when this alert appears, I always get the 'great' alert, whenever I choose OK or cancel.
When I tried to print this, I understood that it's always executing the first one if(willDelete), so this client is deleted whether I choose ok or cancel.

A: When you are trying to use swal function you need provide just the properties available on a SweetAlertOptions Interface  It has a lot of properties but this properties doesn't exist
icon: "warning",
 buttons: true,
 dangerMode: true,

Instead this you can use:
type :'warning',
showConfirmButton: true,
showCancelButton: true,

FINAL CODE
swal({
  title: "Are you sure?",
  text: "Once deleted, you will not be able to recover this imaginary file!",
  type: 'warning',
  showConfirmButton: true,
  showCancelButton: true
})
.then((willDelete) => {
  if (willDelete) {
        this.clientService.deleteClient(p.id)
        .subscribe(data=>{
        this.pageClients.content.splice(
        this.pageClients.content.indexOf(p),1
           );
        },err=>{
        console.log(err);
         })
    swal({title:"Poof! Your imaginary file has been deleted!",
      type: "success",
    });
  } else {
    swal("Your imaginary file is safe!");
  }
});

Just to be sure
I'm using the following src ngx-sweetalert2
npm install --save sweetalert2 @toverux/ngx-sweetalert2

Stackblitz demo


text:
Q: Why is my simple RoutePrefix failing with Web API? I have the following:
 [RoutePrefix("api/UserProfile/{id}")]
    public class UserProfileController : ApiController
    {
        private IdentityContext db = new IdentityContext();

        public async Task<IHttpActionResult> GetMapData()
        {

I am calling this with the following call but it's returning not found.
GET /api/UserProfile/GetMapData HTTP/1.1

HTTP/1.1 404 Not Found

I followed the docs and set up:
config.MapHttpAttributeRoutes();

Can someone tell me what I am doing wrong ?

A: Add a "Route["GetMapData"]" attribute on the action in this case...RoutePrefix attribute doesn't add any routes to the route table and hence you are seeing this behavior...its only for supplying any prefix to any Route attributes present on the actions...

A: [RoutePrefix] adds a prefix to your routes.
So in your example, if you don't specify the [RoutePrefix] attribute, then by convention your route would be:
~/UserProfile/GetMapData

By adding the [RoutePrefix] attribute you are saying that the routes in this controller will be prefixed by the specified route.
i.e. you are effectively changing your route to:
~/api/UserProfile/{id}/UserProfile/GetMapData
  ^^^^^^^^^^^^^^^^^^^^^

If all you want to do is add the "api" prefix then change your prefix to:
[RoutePrefix("api")]

See more details about attribute routing here.


text:
Q: Download Zip file in php I want to download my zip file by a variable ($direccion) that I want to assign to it and when I try to do it, it comes out that the file is corrupted.
$file_name = basename('C:/xampp/htdocs/issv/upload/26908557.zip');

   header("Content-Type: application/Zip");
   header("Content-Disposition: attachment; filename=26908557.zip");
   header("Content-Length: " . filesize('C:/xampp/htdocs/issv/upload/26908557.zip'));

  readfile('C:/xampp/htdocs/issv/upload/26908557.zip');
   exit;

that's my code and it only works that way, but I want to put the $direccion path to it
$direccion='c:/xampp/htdocs/issv/upload/'.trim($cedula);

this is what my variable $cédula means    $cedula=$_POST['cedula'];

A: There many ways of zip file creation which are;
$zip_file = '(path)/filename.zip';$dir = plugin_dir_path( __FILE__ );
$zip_file = $dir . '/filename.zip';$zip = new ZipArchive();
if ( $zip->open($zip_file, ZipArchive::CREATE) !== TRUE) {
exit("message");
} $zip->addFile('full_path_of_the_file', 'custom_file_name); $download_file = file_get_contents( $file_url );
$zip->addFromString(basename($file_url),$download_file); $zip->close();

Or simply do this:
$url = "http://anysite.com/file.zip";$zip_file = "folder/downloadfile.zip";$zip_resource = fopen($zipFile, "w");$ch_start = curl_init();curl_setopt($ch_start, CURLOPT_URL, $url);curl_setopt($ch_start,CURLOPT_FAILONERROR, true);curl_setopt($ch_start,CURLOPT_HEADER, 0);curl_setopt($ch_start,CURLOPT_FOLLOWLOCATION, true);curl_setopt($ch_start,CURLOPT_AUTOREFERER, true);curl_setopt($ch_start,CURLOPT_BINARYTRANSFER,true);curl_setopt($ch_start,CURLOPT_TIMEOUT, 10);curl_setopt($ch_start,CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($ch_start,CURLOPT_SSL_VERIFYPEER, 0);curl_setopt($ch_start,CURLOPT_FILE,$zip_resource);$page =curl_exec($ch_start);if(!$page){echo "Error :- ".curl_error($ch_start);}curl_close($ch_start);$zip = new ZipArchive;$extractPath = "Download File Path";if($zip->open($zipFile) != "true"){echo "Error :- Unable to open the Zip File";}$zip->extractTo($extractPath);$zip->close();

A: class FileNotFound extends RuntimeException {}

$downloadUploadedZip = function(string $filename): void {
    $directory = 'C:/xampp/htdocs/issv/upload';

    if (dirname($filename) !== '.') {
        $directory = dirname($filename);
    }

    $filename = basename($filename);
    $filepath = sprintf('%s/%s', $directory, $filename);

    if (file_exists($filepath)) {
        header("Content-Type: application/zip");
        header(sprintf("Content-Disposition: attachment; filename=%s", $filename));
        header(sprintf("Content-Length: %d", filesize($filepath)));

        readfile($filepath);

        exit;
    }

    throw new FileNotFound(sprintf('File %s not found.', $filepath));
};

$downloadUploadedZip('26908557.zip');
$downloadUploadedZip('C:/xampp/htdocs/issv/upload/26908557.zip');


text:
Q: Парс JSON объектов Swift в список У меня есть jsoт полученный из URL,
Data =
  {
    "fName": "Chris",
    "country": "China",
  },
  {
    "fName": "Kate",
    "country": "Canada",
  },
  {
    "fName": "John",
    "country": "USA",
  }
Мне очень хочется сохранить его в список и сделать источником для пикера.
Для этого я создаю:
private let people: [String:String]
И пишу функцию для парса:
private func parseCompaniesList(data: Data) {
    do {
        let jsonObject = try JSONSerialization.jsonObject(with: data)
        let peopleObjects = json["url"] as? String

        guard
            let json = jsonObject as? [String: Any],
            let fName = json["fName"] as? String,
            let country = json["country"] as? String,

            else {
                print("! Invalid JSON format")
                return
        }
        DispatchQueue.main.async {
            self.people = (?)

        }
    } catch {
        print("! JSON parsing error: " + error.localizedDescription)
    }

нет конечного понимания как из json создать список.
за помощь заранее спасибо

A: update:
private func parseCompaniesList(data: Data) -> [String: String] {
    var newArray = [String: String]()
    do {
        let jsonObject = try JSONSerialization.jsonObject(with: data)
        guard
            let array = jsonObject as? [[String: Any]]
            else {
                print("! Invalid JSON format")
                return newArray
        }

        for i in 0..<array.count {
            newArray[array[i]["fName"] as! String] = array[i]["country"] as? String
        }
    } catch {
        print("! JSON parsing error: " + error.localizedDescription)
    }
    return newArray
}


text:
Q: what's the use if I am querying all the database before pagination in Django? as per below code I am doing the query for database then I am paginating the query result. so My question what's the use if we already hit the database for all result before pagination. Is this like Django pagination working or I am pretending something wrong?
I am getting the response as expected but had question querying the database before pagination.
Code:
class GetAllUserStoryListViewTest(APIView,LimitOffsetPagination):

    permission_classes = (IsAuthenticated,)

    def get_object(self,user_id):
        user = User.objects.filter(id = user_id).first()
        posts = Post.objects.filter(user = user)
        return posts

    def get(self,request,user_id):
        posts = self.get_object(user_id).order_by('-post_time_stamp')

        #setting the limit of this user post pagination
        LimitOffsetPagination.default_limit = settings.PAGE_SIZE
        posts = self.paginate_queryset(posts, request)
        serializer_context = {
            'request': request,
        }
        serializer = PostListSerializer(posts,many=True,context=serializer_context)
        # return Response(serializer.data)
        return self.get_paginated_response(serializer.data)

output:
{
    "count": 7,
    "next": "http://127.0.0.1:8000/api/list_all_story_test/27/?limit=2&offset=5",
    "previous": "http://127.0.0.1:8000/api/list_all_story_test/27/?limit=2&offset=1",
    "results": [
        {
            "id": 15,
            "file": "http://127.0.0.1:8000/media/user_27/post/IMG_20190331_144024.jpg",
            "post_info": "#cool",
            "post_time_stamp": "2020-05-10T10:21:10Z",
            "total_comment": 2,
            "liked_by": [
                "vipin"
            ],
            "user": {
                "id": 27,
                "username": "vipin",
                "email": "vipinks@xyz.edu",
                "status": true,
                "profile": {
                    "id": 24,
                    "full_name": "Vipin",
                    "mobile": 6732,
                    "background_picture": "http://127.0.0.1:8000/media/user_27/profile/pexels-photo-531880_0qSgRNx.jpeg",
                    "profile_picture": "http://127.0.0.1:8000/media/user_27/profile/IMG_20190331_144024.jpg",
                    "BioDescription": "xyz",
                    "date_of_birth": "1996-06-01",
                    "gender": "M",
                    "account_type": "Private",
                    "user": 27
                },
                "last_login": null,
                "is_superuser": false,
                "is_staff": false,
                "is_active": true,
                "date_joined": "2020-04-28T11:09:27.691478Z"
            },
            "comment_usr": [
                "xyz",
                26,
                "Cool Pic"
            ],
            "like_by_you": true
        },
        {
            "id": 13,
            "file": "http://127.0.0.1:8000/media/user_30/post/IMG_20190402_102248.jpg",
            "post_info": "#Awesome",
            "post_time_stamp": "2020-05-10T10:20:22Z",
            "total_comment": 8,
            "user": {
                "id": 30,
                "username": "xyz",
                "email": "xyz@gmail.com",
                "status": false,
                "profile": {
                    "id": 27,
                    "full_name": "XYZ",
                    "mobile": 123,
                    "background_picture": null,
                    "profile_picture": "http://127.0.0.1:8000/media/user_30/profile/demo.jpg",
                    "BioDescription": null,
                    "date_of_birth": null,
                    "gender": "F",
                    "account_type": "Private",
                    "user": 30
                },
                "last_login": null,
                "is_superuser": false,
                "is_staff": false,
                "is_active": true,
                "date_joined": "2020-04-28T11:13:58.030941Z"
            },
            "like_by_you": true
        }
    ]
}

A: The pagination hit the database with Count() method, to paginating the result.
And, in every page hit the database by slicing that is more efficient than
using a queryset with all() method and, hit the database with Iteration, which load all the results.
filter() or all() methods don't hit the database. See this to check when a QuerySet is evaluated.


text:
Q: Is the preimage of a nonreduced subscheme via a proper map nonreduced? Let $f\colon X \to Y$ a surjective proper map between smooth varieties over an algebraically closed field $k$ of characteristic zero. Let $Z\subset Y$ be a closed non-reduced subscheme. Is the preimage $f^{-1}(Z)$ nonreduced?
(The situation I am interested in is the resolution of an ideal sheaf, but I do not know if this hypothesis helps.)
Notes:
1- this is a refining of this question, asked by Shende and answered by Sawin. In the answer, $Z$ was supported on the singular locus of $Y$. In my question, I am adding smoothness and properness hypotheses.
2- The following I think is an important example. Let $f\colon X\to Y$ be the blow-up of a smooth point $p$ on a surface. Let $Z$ be isomorphic to $Spec(k[x]/x^2)$, supported at $p$, and $x$ goes to a tangent direction $v$. Then $f^{-1}(Z)$ is the exceptional divisor (with reduced scheme structure) union an embedded point at $v$, so it is indeed nonreduced. However, if you remove $v$, then the map is still surjective but $f^{-1}(Z)$ is reduced. So properness is important.

A: If $Z$ is not generically reduced, then its pullback is not reduced. (The argument can show that the pullback is not generically reduced, but not the way I wrote it.)
Lemma: To show that the pullback of $Z$ is not reduced, it suffices to check that there is a smooth curve $C$ mapping to  $Y$ such that the pullback of $\mathcal I_Z$ and $\sqrt{\mathcal  I_Z}$ to $C$ differ, where $\mathcal I_Z$ is the ideal sheaf of $Z$ and $\sqrt{\mathcal  I_Z}$ is its radical.
Proof: By the valuative criterion, you can map some ramified cover of $C$ to $X$, lifting the map to $Y$, and then pulling back to this ramified cover shows that $f^* \sqrt{\mathcal I_Z}\neq f^* \mathcal I_Z$. Now because $f^* \mathcal I_Z$ contains a power of $f^* \sqrt{\mathcal I_Z}$, it follows that $f^* \mathcal I_Z$ is not radical and thus $f^* Z$ is not reduced.
Now let's check that if $Z$ is generically non-reduced, there exists such a $C$. To do this, work locally near the generic point of $Z$, so that the radical just becomes the maximal ideal at this point. Since $Z$ is not reduced, the map from the ideal of $Z$ to the Zariski cotangent space at the generic point (i.e. generators of this maximal ideal) is not surjective, so there exists a nonzero vector in the Zariski tangent space which is perpendicular to the image of the ideal of $Z$.
Pick a smooth curve $C$ whose tangent vector is that nonzero vector. The pullback of the maximal ideal to $C$ will have multiplicity $1$ while the pullback of $I_Z$ will have multiplicity $>1$, so they will be distinct.

However, this approach (showing equality between $\mathcal I_Z$ and $\sqrt{\mathcal I_Z}$) will not work in general. Let $Z$ be the vanishing locus of $$x_1 x_3, x_2 x_4, (x_1 x_2  - x_2 x_3), (x_2 x_3 - x_3 x_4), (x_3 x_4 - x_1 x_4) $$
as well as $x_i x_j x_k$ for all triples $i,j,k$, not all equal. The point is that the induced reduced subscheme of $Z$ is the vanishing locus of $$x_1x_2,x_1x_3,x_1x_4, x_2x_3,x_2x_4, x_3,x_4$$ and $Z$ differs from this by an embedded point.
I claim the pullback of $Z$ and its induced reduced subscheme to the blowup of $\mathbb A^4$ at $0$ are equal (but neither is reduced since they each contain a double neighborhood of the exception divisor).
In a typical affine chart $x_1 =a_1 z, x_2 =a_2 z, x_3 =a_3 z, x_4 = z$, the pullback of the induced reduced is the vanishing locus of $z^2 (a_1,a_2,a_3)$ and the pullback of $Z$ is the vanishing locus of $$z^2 (a_1a_3, a_2, (a_1a_2-a_2a_3), (a_2a_3 - a_3), (a_3 -  a_1)) $$
which equals $z^2(a_1,a_2,a_3)$ since we can cancel $a_2a_3$ with $a_2$ and get $a_3$ then cancel $a_3$ and get $a_1$.
By the symmetry rotating the four variables, all the affine charts look like this, so the pullbacks are equal as ideal sheaves.


text:
Q: How to chain two separate camel routes together for throttling I have two separate routes running in an application and I want to control the total amount of work in flight across the entire path.
Route 1:  Gzipped file on SFTP --> unzip --> local directory
Route 2:  local directory --> process stuff --> Kafka

If route 2 has problems or falls behind in its work, I don't want route 1 to fill up the local directory. How can I limit the total number of files sitting in local dir waiting to be processed?
(if it was a single route I may be able to throttle() easier, but are there other options to look at the overall picture of multiple routes?)

A: You can implement a  custom RoutePolicy where you check the number of files in that directory and if its bigger than X then suspend the route, and resume it again if its lower than X.
See more details at the Camel docs: http://camel.apache.org/routepolicy.html
You can look at the existing ThrottlingInflightRoutePolicy how its implemented for inspiration.


text:
Q: Index Signature for manipulating objects If I want to manipulate an object, or an array of objects, do I have to setup the interface like this?
interface Products {
  [key: string]: string | number;
}

I've noticed that if I have a fixed set of properties, typescript complains about a missing property.  For example If I try to add a property, it complains that it doesn't exist and I cannot add it to the object
Initial Interface
interface Products {
  id: string;
  price: number;
  description: string;
}

Somewhere in my script I add the quantity to the object and I want the output to be:
{ id: "123abc", price: 5, description: "Large Ball", quantity: 1 };

A: Yes, you have to declare the possibility, that additional parameters are an option. There are several ways to tackle your problem. In your example i would recommend using records and replacing your mapped type like this:
Record<string, string | number>

and then use type intersection to combine your two types like this:
interface ProductBasics {
  id: string;
  price: number;
  description: string;
}

type Products = ProductBasics & Record<string, string | number>

Now you can put an arbitrary amount of keys into your object, that are either string or number, but also benefit from the explicit types for the keys id, price and description.
If you want a fixed amount of additional keys optional properties may could help:
interface Product {
  id: string;
  price: number;
  description: string;
  quantity?: number;
}


text:
Q: I am having trouble with the 'shimmer' CSS animation Here is my fiddle: https://jsfiddle.net/5r19aban/1/
Basically, I would like the square to have the 'shimmer' CSS effect, but when I make the tags span instead of div, the animation slows down. I really want the square to be in-line with the text beside it though.
Could anyone help me fix this problem? I can't use div because I don't want a line break afterwards!
Thank you!

.shimmer{
    /* styling stuff */
    font-size:36px;
    color: rgba(255,255,255,0.1);
}
.shimmer {
  /* the shimmer magic */
  background: -webkit-gradient(linear,left top,right top,from(#008000),to(#008000),color-stop(.5,#fff));
  background: -moz-gradient(linear,left top,right top,from(#008000),to(#008000),color-stop(.5,#fff));
  background: gradient(linear,left top,right top,from(#008000),to(#008000),color-stop(.5,#fff));
  -webkit-background-size: 25px 100%;
  -moz-background-size: 25px 100%;
  background-size: 25px 100%;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-animation-name: shimmer;
  -moz-animation-name: shimmer;
  -webkit-animation-name: shimmer;
  animation-name: shimmer;
  -webkit-animation-duration: 1s;
  -moz-animation-duration: 1s;
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-color: #006400;
}

@-moz-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@-webkit-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@-o-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@-ms-keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}

@keyframes shimmer {
  0% {
    background-position: top left;
  }

  100% {
    background-position: top right;
  }
}
mark.green {
color:#006400;
font-size:36px;
background: none;
}

mark.yellow {
color:#e6e600;
font-size:36px;
background: none;
}

mark.red {
color:#ff0000;
font-size:36px;
background: none;
}
∎ ILS

∎ PAC

∎  SIP2

∎  Cloud Library

A: You can use div, just set .shimmer's display property to be inline-block. You can also change *-animation-duration to make the animation faster or slower:

.shimmer {
  /* styling stuff */
  font-size: 36px;
  color: rgba(255, 255, 255, 0.1);
  display: inline-block;
}
.shimmer {
  /* the shimmer magic */
  background: -webkit-gradient(linear, left top, right top, from(#008000), to(#008000), color-stop(.5, #fff));
  background: -moz-gradient(linear, left top, right top, from(#008000), to(#008000), color-stop(.5, #fff));
  background: gradient(linear, left top, right top, from(#008000), to(#008000), color-stop(.5, #fff));
  -webkit-background-size: 25px 100%;
  -moz-background-size: 25px 100%;
  background-size: 25px 100%;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-animation-name: shimmer;
  -moz-animation-name: shimmer;
  -webkit-animation-name: shimmer;
  animation-name: shimmer;
  -webkit-animation-duration: .5s;
  -moz-animation-duration: .5s;
  -webkit-animation-duration: .5s;
  animation-duration: .5s;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-color: #006400;
}
@-moz-keyframes shimmer {
  0% {
    background-position: top left;
  }
  100% {
    background-position: top right;
  }
}
@-webkit-keyframes shimmer {
  0% {
    background-position: top left;
  }
  100% {
    background-position: top right;
  }
}
@-o-keyframes shimmer {
  0% {
    background-position: top left;
  }
  100% {
    background-position: top right;
  }
}
@-ms-keyframes shimmer {
  0% {
    background-position: top left;
  }
  100% {
    background-position: top right;
  }
}
@keyframes shimmer {
  0% {
    background-position: top left;
  }
  100% {
    background-position: top right;
  }
}
mark.green {
  color: #006400;
  font-size: 36px;
  background: none;
}
mark.yellow {
  color: #e6e600;
  font-size: 36px;
  background: none;
}
mark.red {
  color: #ff0000;
  font-size: 36px;
  background: none;
}

∎
ILS

∎
PAC

∎
SIP2

∎
Cloud Library

A: Difference between div and span is that div has default display style set to block. Span display is set to inline.
When you used div it took all row length and your gradient followed in 1s from left to right. The green square was kind of blinking.
With span your span element is as width as its green square. So gradient followed this maybe 20px in 1s. You can see it very clearly.
My fix of keyframe:
  0% {
    background-position: 0 top;
  }
  100% {
    background-position: 200px top;
  }

just told the gradient to go 200px from left in 1s.

.shimmer{
    /* styling stuff */
    font-size:36px;
    color: rgba(255,255,255,0.1);
}
.shimmer {
  /* the shimmer magic */
  background: -webkit-gradient(linear,left top,right top,from(#008000),to(#008000),color-stop(.5,#fff));
  background: -moz-gradient(linear,left top,right top,from(#008000),to(#008000),color-stop(.5,#fff));
  background: gradient(linear,left top,right top,from(#008000),to(#008000),color-stop(.5,#fff));
  -webkit-background-size: 25px 100%;
  -moz-background-size: 25px 100%;
  background-size: 25px 100%;
  -webkit-background-clip: text;
  -moz-background-clip: text;
  background-clip: text;
  -webkit-animation-name: shimmer;
  -moz-animation-name: shimmer;
  -webkit-animation-name: shimmer;
  animation-name: shimmer;
  -webkit-animation-duration: 1s;
  -moz-animation-duration: 1s;
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-iteration-count: infinite;
  -webkit-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-color: #006400;
}

@keyframes shimmer {
  0% {
    background-position: 0 top;
  }

  100% {
    background-position: 200px top;
  }
}

mark.green {
color:#006400;
font-size:36px;
background: none;
}

mark.yellow {
color:#e6e600;
font-size:36px;
background: none;
}

mark.red {
color:#ff0000;
font-size:36px;
background: none;
}
∎ ILS

∎ PAC

∎  SIP2

∎  Cloud Library


text:
Q: Term for an anti-theft/anti-loss feature seen on pens I suspect many people here have seen those pens in banks by the tellers, that have lines between them and the counter top, so users can't walk off with them. I am trying to find out what that kind of option is called generally, so that I can try and extend its use to other things intelligently.
UPDATE:
I am looking for the industry standard term for these things so I can search for a similarly accoutered pocket lighter. I have a cousin who is becoming senile and do not want him to lose his lighter, or have someone steal it.

A: Not all bank pens use this specific type of cord, but a lot do:

Office Depot sells the above pen under the name "chain pen", however the chain itself is often called either a "bead chain" (after the manufacturer?) or a "ball chain" (after a different manufacturer?) or a "ball bead chain" (splitting the difference?).
Any one of these expressions brings up different sites selling, for example, chains for dog tag necklaces, which you could attach to a lighter with a keychain.
It's also relevant to note that bead chain is in Merriam Webster:

a chain formed of small hollow metal spheres connected by short dumbbell-shaped metal links that is used especially in electric pull sockets and switches

A: A tethered pen would likely work.
tether  TFD

A rope, chain, cable, or other line for restraining or securing an
  object

A: I don't know about pens or lighters, but many electronic devices are equipped with a security slot (sometimes called security port or security anchor) to prevent their theft.

The system consists of a small, metal-reinforced hole found commonly
  on small or portable computers and electronics equipment such as
  laptops, computer monitors, desktop computers, gaming consoles, and
  video projectors, combined with a metal anchor attached to a
  rubberized metal cable secured with a key or combination lock. The end
  of the cable has a small loop that allows the cable to be looped
  around a permanent object, such as a heavy table or other similar
  equipment.
The hole is found in most laptops, although a lock for it is typically
  not included.