text:
Q: How to analyse a data set with more than 500 variables I have a data set with 1000 entities. For each entity, more than 500 dichotomous variables (0,1) are recorded. I have no idea how to analyse this data or how to get an overview.
My problem is not that any analysis I attempt takes too long to run on the system, but that the result is equally confusing.
My question is whether there are statistical methods to aggregate this data. Or to get an overview, e.g. of the correlation between variables.
Or in general, if there are special statistical methods to handle data sets with such a lot of variables in a way that the result is a bit more compact.
I don't even know how to start and would appreciate any suggestions.

A: Asking "how do I analyze this dataset" without reference to a research question is like asking "what do I do with this pile of wood." Well, you could turn it into a house, or a desk, or a chair, or an abstract sculpture. It depends on what you need, and there is no way for anyone to give you advice on what to do unless you tell them what you are trying to do.. That being said, once you have decided you want to build a chair, then there are some clear guidelines and best practices to help you build a GOOD chair (and avoid making a bad one).
Similarly, Data analysis is a process of using various mathematical tools (analogous to hammers and screwdrivers) to answer questions using data (the "raw material"). It doesn't matter if your dataset has 2 variables or 500 or a million, you can't coherently talk about "analyzing" it except in reference to a specific question or set of questions. Once you have a question then you can think about which variables in the dataset, and what analytic tools, could help you to answer that question.
So for example, a really common kind of question in data analysis involves trying to figure out whether a specific "dependent variable" is in some way associated with (or caused by?) one or more independent variables, after accounting for other confounding variables. This sort of question is often analyzed using tools like regression analysis, but setting up the model depends on what particular dependent and independent variables you are interested in. Does participating in the program make people more likely to get a job? Do Black patients get the same care as White patients? Are different kinds of diets effective at loosing weight?
Another type of question you might ask is whether a bunch of different questions all measure one or more underlying latent constructs. Do these 10 questions about "depression" all tap some underlying construct of "depression" and if so is there a way to aggregate this data together to create a single measure of "depression?" This kind of question of often answered with tools like factor analysis or principle components analysis.
But again, none of this has any meaning in the abstract. Data analysis is about asking and answering questions. Without a question, the data is just a pile of wood.

A: Pre-Analysis
I have had to do this for a lab in the past, so I can probably provide some guidance. First off, your very first resource for such an extensive dataset is the group of people who came up with it in the first place. If you can contact the people who made it, they can provide a lot of background information on what variables are important, what they mean, how they were devised, etc. They may even have a handbook or manual that outlines every variable, which would be extremely helpful. If that information is not accessible, you can also see if the dataset has been cited in articles already, and from there you can also derive some insights.
Finding What's Useful
For the actual data side of things, once you have established which variables are important, I recommend condensing or splitting the data into meaningful parts. For example, if you have 50 variables for Variable X and Variable Z, but you also have 450 nonsense variables that are dichotomous, you can use a code like this:
#### Load Data Wrangling Package ####
library(tidyverse)

#### Split Data Meaningfully ####
data.split <- data %>%
  select(contains("Variable_X"),
         contains("Variable_Y"))

Perhaps all of these dichotomous variables are in wide format (it sounds like it from what you explained) and you need to convert them to long format (for an explanation of what this means, there is a good article on this by Hadley Wickham. One example is R's relig_income dataset, which has many income brackets:
relig_income %>%
  head()

Which is messy:
# A tibble: 6 × 11
  religion  `<$10k` $10-2…¹ $20-3…² $30-4…³ $40-5…⁴ $50-7…⁵ $75-1…⁶
  <chr>       <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
1 Agnostic       27      34      60      81      76     137     122
2 Atheist        12      27      37      52      35      70      73
3 Buddhist       27      21      30      34      33      58      62
4 Catholic      418     617     732     670     638    1116     949
5 Don't kn…      15      14      15      11      10      35      21
6 Evangeli…     575     869    1064     982     881    1486     949
# … with 3 more variables: `$100-150k` <dbl>, `>150k` <dbl>,
#   `Don't know/refused` <dbl>, and abbreviated variable names
#   ¹`$10-20k`, ²`$20-30k`, ³`$30-40k`, ⁴`$40-50k`, ⁵`$50-75k`,
#   ⁶`$75-100k`

But is easier read in long format:
relig_income %>%
  pivot_longer(cols = 2:11,
               names_to = "Income_Bracket",
               values_to = "Amount") %>%
  head()

And now looks easier to read:
  religion Income_Bracket Amount
  <chr>    <chr>           <dbl>
1 Agnostic <$10k              27
2 Agnostic $10-20k            34
3 Agnostic $20-30k            60
4 Agnostic $30-40k            81
5 Agnostic $40-50k            76
6 Agnostic $50-75k           137

Visualization
There are also some visualization codes you can use to look at the data that you think is worth running. For example, the skimr package has a good quick look at how your data is distributed:
library(skimr)
skim(relig_income)

Which gives you this:

── Data Summary ────────────────────────
                           Values
Name                       relig_income
Number of rows             18
Number of columns          11
_______________________
Column type frequency:
  character                1
  numeric                  10
________________________
Group variables            None

── Variable type: character ───────────────────────────────────────
  skim_variable n_missing complete_rate min max empty n_unique
1 religion              0             1   5  23     0       18
  whitespace
1          0

── Variable type: numeric ─────────────────────────────────────────
   skim_variable      n_missing complete_rate mean   sd p0  p25
 1 <$10k                      0             1 107. 169.  1 12.2
 2 $10-20k                    0             1 154. 255.  2 14.8
 3 $20-30k                    0             1 186. 310.  3 17
 4 $30-40k                    0             1 183. 291.  4 15.8
 5 $40-50k                    0             1 171. 271.  2 15
 6 $50-75k                    0             1 288. 458.  7 34.2
 7 $75-100k                   0             1 222. 345.  3 25.2
 8 $100-150k                  0             1 178. 276.  4 22.5
 9 >150k                      0             1 145. 205.  4 23.8
10 Don't know/refused         0             1 340. 531.  8 41.2
    p50  p75 p100 hist
 1 20   170   575 ▇▁▁▁▁
 2 27   193   869 ▇▁▁▁▁
 3 33.5 192  1064 ▇▁▁▁▁
 4 40   199.  982 ▇▁▁▁▁
 5 34   167.  881 ▇▁▁▁▁
 6 66.5 202. 1486 ▇▁▁▁▁
 7 65.5 129.  949 ▇▁▁▁▂
 8 48.5 104.  792 ▇▁▁▁▂
 9 53.5 134.  634 ▇▁▁▁▁
10 74.5 295. 1529 ▇▁▁▁▂

Maybe you are only interested in the numeric data and you have a ton of uninteresting categorical variables. Using the starwars dataset, we can see that there are a lot of non-numeric values that we may not be interested in.
glimpse(starwars)

Which you can see:
Rows: 87
Columns: 14
$ name       <chr> "Luke Skywalker", "C-3PO", "R2-D2", "Darth Vade…
$ height     <int> 172, 167, 96, 202, 150, 178, 165, 97, 183, 182,…
$ mass       <dbl> 77.0, 75.0, 32.0, 136.0, 49.0, 120.0, 75.0, 32.…
$ hair_color <chr> "blond", NA, NA, "none", "brown", "brown, grey"…
$ skin_color <chr> "fair", "gold", "white, blue", "white", "light"…
$ eye_color  <chr> "blue", "yellow", "red", "yellow", "brown", "bl…
$ birth_year <dbl> 19.0, 112.0, 33.0, 41.9, 19.0, 52.0, 47.0, NA, …
$ sex        <chr> "male", "none", "none", "male", "female", "male…
$ gender     <chr> "masculine", "masculine", "masculine", "masculi…
$ homeworld  <chr> "Tatooine", "Tatooine", "Naboo", "Tatooine", "A…
$ species    <chr> "Human", "Droid", "Droid", "Human", "Human", "H…
$ films      <list> <"The Empire Strikes Back", "Revenge of the Si…
$ vehicles   <list> <"Snowspeeder", "Imperial Speeder Bike">, <>, …
$ starships  <list> <"X-wing", "Imperial shuttle">, <>, <>, "TIE A…

You can gather the data that's useful to you and visualize their distributions that way:
starwars %>%
  keep(is.numeric) %>%
  gather() %>%
  ggplot(aes(x=value))+
  geom_density(fill="green",
               alpha= .4)+
  facet_wrap(~key,
             scales = "free")+
  labs(title = "Star Wars Numeric Data",
       x="Value",
       y="Density")

There are probably a lot of other ways you can look at data. Something that may help is reading the book R for Data Science. I think it does a good job of explaining how to wrangle data, even if learning it for the first time can be frustratingly difficult as a beginner. Also, this guide may be helpful if you want something shorter. Though it is more focused on Python, the actual process of exploring and cleaning data is well explained there. Hope that is helpful and let me know if you have questions.
Analysis
As for the analysis part...it doesn't appear clear what you are actually trying to do with the data yet. This is common with people who first analyze large datasets, but the problem is largely alleviated when you know which direction to walk. I would first figure out what questions you are trying to answer with your data...are you trying to look at differences in height between genders? Are you looking to employ some form of machine learning to estimate what predicts hiring and firing in a corporation? It helps to have a solid preliminary reason for why you are even looking at the numbers in front of you. Additionally, if you have questions about a specific stats method, its better to ask about that rather than analysis in general, as that can be a years-long topic given the vast depth of statistical topics out there.


text:
Q: O que significam os termos CPU-time e Wall-clock-time? Algumas documentações (programação) se referem a estes termos quando há algum tipo de limitação quanto ao uso da CPU, por exemplo:

As tarefas em segundo plano são limitadas pela quantidade de tempo de
  uso do wall-clock.
Background tasks são limitadas a 30 segundos de uso do wall-clock.

Sem compreender o que exatamente este termos significam fica difícil adequar um software para que o mesmo não extrapole o uso da CPU recomendado.

A: CPU Time é o tempo que o processador gasta para executar uma tarefa. Wall Clock Time é o tempo todo passado para executar uma tarefa, então se houver interrupções na execução da atividade o wall clock não para de contar, mas o tempo de CPU não é considerado. A interrupção pode ocorrer porque o processador divide seu uso com outras threads ou porque precisa esperar um dispositivo externo ao CPU responder ou o algoritmo está em espera sem executar nada.
Isto é uma forma de diferenciar se o limite que pode usar adota um critério ou outro. Se o limite fosse pelo CPU time na verdade ele poderia rodar por minutos, horas ou até dias, desde que a maior parte do tempo não esteja executando nada.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unable to upload image clicked from camera to server I'm trying to upload an image to the server after clicking from the camera but the server returns
($_File) JSON Response after clicking the image from server and uploading
{
   "data":78,
   "status":true,
   "files":
   {
      "photo":
      {
         "name":"IMG_20191108_115642_5386652903586463966.jpg",
         "type":"",
         "tmp_name":"",
         "error":1,
         "size":0
      }
    }
  }

($_File) JSON Response after picking the image from Gallery and uploading
    {
     "data":79,
     "status":true,
     "files":
         {
           "photo":
              {
               "name":"Screenshot_20191108_081937_com.instagram.android.jpg",
               "type":"*\/*",
               "tmp_name":"C:\\xampp\\tmp\\php50A6.tmp",
               "error":0,
               "size":518164
              }
         }
   }

     override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_pharmacy)
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) !=
            PackageManager.PERMISSION_GRANTED &&
            ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) !=
            PackageManager.PERMISSION_GRANTED
        ) {
            ActivityCompat.requestPermissions(this, permission, REQUEST_PERMISSION)
        }
    next.setOnClickListener {

            if (prescriptionid == "") {
                Toast.makeText(
                    applicationContext,
                    "Select/Upload Prescription First",
                    Toast.LENGTH_LONG
                ).show()
            } else {
                intent = Intent(applicationContext, SelectAddressActivity::class.java)
                imageFilePath = ""
                imageView.setImageResource(R.drawable.ic_image)
                imagedisplay.visibility = View.GONE
                startActivity(intent)
            }
        }

        if (imageFilePath == "") {
            imagedisplay.visibility = View.GONE
        } else {
            imagedisplay.visibility = View.GONE
        }
     }

Camera Intent
private fun openCameraIntent() {
        val pictureIntent = Intent(
            MediaStore.ACTION_IMAGE_CAPTURE)
        if (pictureIntent.resolveActivity(getPackageManager()) != null)
        {
            try
            {
                photoFile = createImageFile()
            }
            catch (ex:IOException) {}// Error occurred while creating the File
            if (photoFile != null)
            {
                val photoURI = FileProvider.getUriForFile(this, packageName+".provider", photoFile)
                pictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,photoURI)
                startActivityForResult(pictureIntent,CAMERA_REQUEST_CODE)
            }
        }
    }

GalleryIntent
private fun pickFromGallery() {
        //Create an Intent with action as ACTION_PICK
        val intent = Intent(Intent.ACTION_PICK)
        // Sets the type as image/*. This ensures only components of type image are selected
        intent.type = "image/*"
        //We pass an extra array with the accepted mime types. This will ensure only components with these MIME types as targeted.
        val mimeTypes = arrayOf("image/jpeg", "image/png")
        intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes)
        // Launching the Intent
        startActivityForResult(intent, GALLERY_REQUEST_CODE)
    }

 override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        imagedisplay.visibility = View.VISIBLE
        when (requestCode) {
            CAMERA_REQUEST_CODE -> {
                if (resultCode == Activity.RESULT_OK) {
                    correct.visibility = View.VISIBLE
                    imageView.setImageBitmap(setScaledBitmap())
                }
            }
           GALLERY_REQUEST_CODE -> {
                //data.getData returns the content URI for the selected Image
                if (resultCode == Activity.RESULT_OK) {
                    correct.visibility = View.VISIBLE
                    var selectedImage = data!!.data as Uri
                    var filePathColumn = arrayOf(MediaStore.Images.Media.DATA)
                    // Get the cursor
                    var cursor = getContentResolver().query(
                        selectedImage,
                        filePathColumn, null, null, null
                    );
                    // Move to first row
                    cursor!!.moveToFirst();
                    //Get the column index of MediaStore.Images.Media.DATA
                    var columnIndex = cursor.getColumnIndex(filePathColumn[0])
                    //Gets the String value in the column
                    var imgDecodableString = cursor.getString(columnIndex)
                    cursor.close()
                    // Set the Image in ImageView after decoding the String
                    Log.i("filepath", imgDecodableString)
                    imageFilePath = imgDecodableString
                    imageView.setImageBitmap(BitmapFactory.decodeFile(imgDecodableString))

                }
            }
            else -> {
                Toast.makeText(this, "Unrecognized request code", Toast.LENGTH_SHORT).show()
            }
        }
    }

Code To Create image file

    @Throws(IOException::class)
    private fun createImageFile(): File {
        // Create an image file name
        val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
        val storageDir: File = getExternalFilesDir(Environment.DIRECTORY_PICTURES) as File
        return File.createTempFile(
            "IMG_${timeStamp}_", /* prefix */
            ".jpg", /* suffix */
            storageDir /* directory */
        ).apply {
            // Save a file: path for use with ACTION_VIEW intents
            imageFilePath = absolutePath
        }
    }

Code To Upload Image To Server

       val file = File(imageFilePath)
       //creating request body for file
       var requestBody = file.asRequestBody("*/*".toMediaTypeOrNull())
//        val requestFile = file.asRequestBody("*/*".toMediaTypeOrNull())
       var photo = MultipartBody.Part.createFormData("photo", file.name, requestBody)
//        RequestBody descBody = RequestBody.create(MediaType.parse("text/plain"), desc);
       Log.e("requestFile", imageFilePath)

       val uploadImage =
           RetrofitCall.provideRetrofit().create(uploadPrescriptionApi::class.java)

       uploadImage.uploadPrescription("Bearer ".plus(sharedPreference!!.token.toString()), photo)
           .enqueue(object : Callback<UploadPhototPOJO> {
               override fun onResponse(
                   call: Call<UploadPhototPOJO>,
                   response: Response<UploadPhototPOJO>
               ) {
                   if (response.body()!!.status!!) {
                       progressDialog!!.dismiss()
                       prescriptionid = response.body()!!.id.toString()
                       Log.i("id", prescriptionid.toString())
                   } else {
                       Toast.makeText(
                           applicationContext,
                           "Oops Something Went Wrong!! Try again",
                           Toast.LENGTH_LONG
                       ).show()
                       progressDialog!!.dismiss()
                   }
               }

               override fun onFailure(call: Call<UploadPhototPOJO>, t: Throwable) {
                   // handle execution failures like no internet connectivity
                   Log.i("Faliure", t.toString())
               }
           })

   }

A: The maximum allowed size for uploading files is 2Mb. As you mentioned in your comment the size of the photo being uploaded is 4Mb.
If you want to upload files greater than the size set, just open the php.ini file to increase the size.
Open C:/xampp/php/php.ini file in any one of your favorite text editors. Search for upload_max_filesize and change it the size. For example, 50Mb
upload_max_filesize = 50M

And also the maximum size of POST data that PHP will accept is 8Mb. If you want to extend it, search for post_max_size and increase the size.
Finally, don't forget to restart the Apache server.


text:
Q: Need to set class/id values on buttons in Extjs MessageBox Our testing team require IDs or class values to be set on the HTML elements in our message popup boxes. This is for their automated tests.
I can pass in a class value for the dialog panel by passing in a cls value like so:

                Ext.Msg.show({
                    title:'Reset Grid Layout',
                    msg: 'Are you sure that you want to reset the grid layout?',
                    cls:'Reset-Grid-Layout-Message',
                    buttons: Ext.Msg.YESNO,
                    fn: function (response) {
                        if (response == 'yes') {
                        }
                    },
                    icon: Ext.window.MessageBox.QUESTION
                });

Now we also need it on the buttons, and also on the text being displayed. Is there some way of getting a cls value onto the buttons?
I was thinking it may be possible to expand the button parameter into something like :
buttons : [{name:'but1', cls:'asdf'}, {name:'but2', cls:'asdf2'}]

But google is not giving me back anything useful.

A: If your testing team uses Selenium for their automated test, adding ids/classes in every component could be difficult for both of you.
Overriding components in Ext is a good solution, but I don't recommend this because it will affect all your components. Unless you know what you're doing.
I suggest, extend Ext.window.MessageBox and generate classes for your buttons based on your parent cls.
// Put this somewhere like /custom/messagebox.js
Ext.define('App.MyMessageBox', {
    extend: 'Ext.window.MessageBox'
    ,initConfig: function(config) {
        this.callParent(arguments);
    }
    ,makeButton: function(btnIdx) {
        var me = this;
        var btnId = me.buttonIds[btnIdx];

        return new Ext.button.Button({
            handler: me.btnCallback
            ,cls: me.cls + '-' + btnId
            ,itemId: btnId
            ,scope: me
            ,text: me.buttonText[btnId]
            ,minWidth: 75
        });
    }
});

To use:
App.Box = new App.MyMessageBox({
    cls:'reset-grid-layout'
}).show({
    title:'Reset Grid Layout'
    ,msg: 'Are you sure that you want to reset the grid layout?'
    ,buttons: Ext.Msg.YESNO
    ,icon: Ext.window.MessageBox.QUESTION
});

Your buttons will have reset-grid-layout-yes and reset-grid-layout-no class.
You can do the same with other components you have. Check out the Fiddle. https://fiddle.sencha.com/#fiddle/7qb

A: You should refer to the API

cls : String A CSS class string to apply to the button's main element.
Overrides: Ext.AbstractComponent.cls

You can also use the filter on right side (not the one in the right top corner). Just type cls and you will see all properties, methods and events containing cls (note that you see by default just public members, use the menu on  the right of this searchfield to extend this)
Edit
If you just need it for testing purpose I would recommend to override the responsible method. This should work (untested!)
Ext.window.MessageBox.override({
    buttonClasses: [
        'okCls', 'yesCls', 'noCls', 'cancelCls'
    ],

    makeButton: function(btnIdx) {
        var btnId = this.buttonIds[btnIdx];
        var btnCls = this.buttonClasses[btnIdx];
        return new Ext.button.Button({
            handler: this.btnCallback,
            cls: btnCls,
            itemId: btnId,
            scope: this,
            text: this.buttonText[btnId],
            minWidth: 75
        });
    }
});


text:
Q: Linear operator not bounded is not compact Let $B$ a banach space infinite dimensional, let X a normed space, and  $T: B \to X$ a linear operator such that $\|T(x)\|_{X}\geq  c \|x\|_{B}$ for all $x\in B$ and $c>0$ Then $T$ is not compact
This theorem perhaps extends the fact that a continuous function sends compacts into compacts and since $T$ is not bounded it is therefore not continuous
Can you help me?

A: The inequality you have stated is very different from the statement that $T$ is not bounded.
Suppose $\|x_n\| \leq 1$ for al $n$. If $T$ is compact then there is a subsequence $(Tx_{n_k})$ which is convergent, hence Cauchy. The given inequality shows that $(x_{n_k})$ is Cauchy. ($\|x_{n_k}-x_{n_j}\|\leq \frac 1  c \|T(x_{n_k})-T(x_{n_j})\| \to 0$). Since $B$ is a Banach space it follows that this sequence is convergent. We have proved that the closed unit ball of $B$ is (sequentially) compact and this implies that $B$ is finite dimensional.


text:
Q: Convert a cv::Mat (cv::UMat) from 8UC3 to 32FC3 is slow I have a cv::UMat of 8UC3 and I want to convert it to 32FC3.
I use the convertTo method offered by the cv::UMat class, but it is slow (I lose more or less 5 frame per second).
I know that it is due to the conversion uchar -> float, but I was wondering if there exists a method for speeding up such a conversion.


text:
Q: Serverless framework WarmUp plugin not being called I tried to integrate the WarmUp serverless plugin into my project. However, I believe that it is not working. I see no invocations from WarmUp in the lambda's CloudWatch log group, and lambda does need warmup time after being idle for a bit.
My configuration is below:
service: ${file(./${env:DEPLOY_FILE_NAME}):service}

provider:
  name: aws
  custom:
    roleName: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):roleName}
    profileName: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):profileName}
    bundle:
      ignorePackages:
        - pg-native
    warmup:
      enabled: true
      events:
        - schedule: rate(5 minutes)
      prewarm: true
  plugins:
    - pluginHandler
    - serverless-plugin-warmup
  runtime: nodejs12.x
  iamRoleStatements:
    - Effect: 'Allow'
      Action:
        - 'lambda:InvokeFunction'
      Resource:
      - Fn::Join:
        - ':'
        - - arn:aws:lambda
          - Ref: AWS::Region
          - Ref: AWS::AccountId
          - function:${self:service}-${opt:stage, self:provider.stage}-*
  cfLogs: true
  stage: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):stage}
  region: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):region}
  memorySize: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):memorySize}
  timeout: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):timeout}
  keepWarm: false
  useApigateway: true

package:
  exclude:
    ${file(./${env:DEPLOY_FILE_NAME}):exclude}

functions:
  lambdaHandler:
    handler: ${file(./${env:DEPLOY_FILE_NAME_STAGE}):handler}
    events:
      ${file(./${env:DEPLOY_FILE_NAME}):events}
    warmup:
      enabled: true

The lambda code:
const awsLambdaFastify = require('aws-lambda-fastify');
const app = require('./index');

const proxy = awsLambdaFastify(app);

const fastify = (event, context, callback) => {
  context.callbackWaitsForEmptyEventLoop = false;
  proxy(event, context, callback);
};

const warm = func => (event, context, callback) => {
  if (event.source === 'serverless-plugin-warmup') {
    return callback(null, 'Lambda is warm!');
  }

  return func(event, context, callback);
};

exports.handler = warm(fastify);

Is there something that I could check? Any suggestions/directions are greatly appreciated.
Thank you

A: First of all, please move out the plugins from provider
plugins:
    - serverless-plugin-warmup
provider:
    ...


text:
Q: Using SCSS scoped in Blade like Vue components I'm using Laravel 8 and Vue.js together. So I'm developing a website with Blade and Vue components.
I want something to add scss code in a specific Blade template. Exactly like a Vue component:
// Vue component example
<template>
...
</template>

I want something exactly like
@endpush

like this when specific.blade.php will load then only that css will load in layout which is same as vue scoped
ref link
https://laravel.com/docs/8.x/blade#stacks

A: I have been in a simular situation. I'm not aware of this being possible without a lot of work (on the blade compiler side). Having

</template>

More information can be found here:

*

*https://fluxfx.nl/vue-blocks/examples/index.html#/features/scoped-styles


text:
Q: Pivot on Spark dataframe returns unexpected nulls on only one of several columns I've pivoted a Spark dataframe, which works correctly for all columns except one, even though they're all almost exactly the same.
I have a dataframe which looks like this:
+-------+------------+---------+
|     id|       cf_id|    value|
+-------+------------+---------+
|3688634|300016666252|telephone|
|3688634|300019829932|    false|
|3688307|300016666252|    email|
|3688307|300019829932|    false|
|3688635|300016666252|telephone|
|3688635|300019829932|    false|

(there are 29 distinct cf_id values, but in this example only two)
when I run:
df.groupBy("id").pivot("cf_id").agg(first("value")).show

I'd expect to see:
+-------+------------+------------+
|     id|300016666252|300019829932|
+-------+------------+------------+
|3634121|       email|       false|
|3634192|       email|        true|
|3634216|       email|        true|
|3634319|       email|        true|
|3634423|       email|       false|
|3634749|       email|        true|
|3635192|   telephone|       false|

All columns work correctly except the final one displayed here (300019829932), which converts all values to null.
I've extracted the single problem column as a separate dataframe and ran the pivot function on it, which transforms all the values to null.
I ran the same function on another column, which works as expected.
Both columns have a single string for the data, and their names are strings of 12 digits (which are aliased later).
I presume it can't be due to the whole column name being digits as it works for all except one.
I've also tried collect_set as the pivot aggregate function, which returns an empty set.
Spark version 2.2.0.2.6.4.0-91
Scala version 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_77)
Am I missing something here? The titles & values are very similar across columns, and the functions applied to them are exactly the same, yet the column always returns null values.

A: It looks as though the problem was due to there being true/false/null values in the column.
Somewhere in the pivot function it wasn't handling the three values for a seemingly boolean type, and nulling everything.
So, (given a table with only boolean cf_id values), when casting the value as boolean it works.
val castdf = spark.sql("""select id, cf_id, cast(value as boolean) as value from df""")

castdf.groupBy($"id").pivot("cf_id").agg(first($"value")).show
+-------+------------+
|     id|360019829932|
+-------+------------+
|3663762|       false|
|3619941|        null|
|3667500|       false|
|3631088|        null|
|3668712|       false|
|3661298|        true|

I'm fairly new to spark and SQL, so I couldn't explain why.
But in conclusion:
If you're pivoting to a Spark dataframe which will have a string-type column containing true/false/null values, the column the values come from should be cast as boolean.
Thank you @rbcvl for your help


text:
Q: Invalid key hash Hi I'm very new to facebook login. I tried to generate a hash key for facebook android app. The first time it didn't asked for a password and gave me the hash key but now when I again tried to generate the hash key its asking for pass. When I enter "android" as pass, it gives me just DrNQ.
command used:
 keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Sam\.android\debug.keystore" | "C:\Openssl\bin\openssl" sha1 -binary | "C:\Openssl\bin\openssl" base64

A: you are using to much complex trick to get hash key of your application it's having lots of chance to get error.But I have one simple idea to generate your application hash key.
for generating hash key you must need to specify your package name and you are just putting following code while app is lunch and you are getting yout app hash key in Log.
 @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main2);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    try {
        PackageInfo info = getPackageManager().getPackageInfo(
                "com.example.chirag.maptesting",
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            Toast.makeText(Main2Activity.this, "Hash Key :"+Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_SHORT).show();
        }
    } catch (PackageManager.NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }
}

Note :
in Above code com.example.chirag.maptesting is my application package name but you must need to paste your package name here.
I hope your are clear with my idea.
Best Luck

A: Using below code snippet, you can get the hash code.
public static String printKeyHash(Activity context) {
    PackageInfo packageInfo;
    String key = null;
    try {
        //getting application package name, as defined in manifest
        String packageName = context.getApplicationContext().getPackageName();

        //Retriving package info
        packageInfo = context.getPackageManager().getPackageInfo(packageName,
                PackageManager.GET_SIGNATURES);

        Log.e("Package Name=", context.getApplicationContext().getPackageName());

        for (Signature signature : packageInfo.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            key = new String(Base64.encode(md.digest(), 0));

            // String key = new String(Base64.encodeBytes(md.digest()));
            Log.e("Key Hash=", key);
        }
    } catch (NameNotFoundException e1) {
        Log.e("Name not found", e1.toString());
    }
    catch (NoSuchAlgorithmException e) {
        Log.e("No such an algorithm", e.toString());
    } catch (Exception e) {
        Log.e("Exception", e.toString());
    }

    return key;
}


text:
Q: Difference between a similarity and a homothetic transformation Can someone explain to me the difference between similarities and homothetic transformations?
I understand that scalings are affine transformations of the plane that can be characterized by their factors $(r,s)$, and that if $r=s$, we have a similarity. In this case the scaling factor is the same in both directions of the axes of the plane. Isn't that a homothetic transformation?
Are similarities homothetic transformations?

A: In general affine spaces, homotheties are similarities,but the converse is not true. A homotheity is a specific kind of similarity. In older geometry books and papers, homotheties refer to the mappings in Euclidean spaces that in more modern jargon are called magnifications,scalings or stretches. A homotheity $h:V\rightarrow V$ where V is the affine space,is defined as the following linear transformation:
  g(x) = $x_0 + \lambda$(x-$x_0$)
where $\lambda\in\mathbb R$. $x_0$ is called the center of the space V and it is determined by a choice of coordinate system (i.e. a basis). The definition of a similarity, by comparison, only requires a distance function and is more general then a homothiety: A similarity f:$X \rightarrow X$ on a metric space X is defined for any $x,y\in X$ :
  d(f(x),f(y)) =  $\lambda$d(x,y)
So the transformation doesn't have to be a linear transformation-indeed, the space can be coordinate free. In a Euclidean space V , it's clear that any homothiety is a similarity in V.

A: In geometry, a homothety (homothetic transformation) is a special case of a similarity.  A similarity admits arbitrary translation and rotation; a homothety is a similarity with a homothetic center.


text:
Q: React .NET Enable CORS - No 'Access-Control-Allow-Origin' header is present on the requested resource Been attempting to integrate a React front-end with a .NET Framework backend and I am constantly coming into contact with CORS errors. The request I am sending to the server works on Postman. I extracted the code from Postman and put it into my react app (Fetch) and I receive the following error:
Access to fetch at 'http://localhost:33333/Token' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

However, on my .NET backend I added the following filter:
using System;
       using System.Web.Mvc;

       namespace TheFifth.Cors
       {
           public class AllowCrossSiteAttribute : ActionFilterAttribute
           {
               public override void OnActionExecuting(ActionExecutingContext filterContext)
               {
                   filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Origin",
   "*");
                   filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Headers",
   "*");
                   filterContext.RequestContext.HttpContext.Response.AddHeader("Access-Control-Allow-Credentials",
   "true");

                   base.OnActionExecuting(filterContext);
               }
           }
       }

Then referenced the Filter at the top of my Controller
[AllowCrossSite]
public class DA_Object
{
  //some code
 }

Does anyone know why my .NET backend or my React Frontend is preventing me from communicating across different ports - even though it works on Postman?
Additional Details
    var myHeaders = new Headers();
    myHeaders.append("Content-Type", "application/x-www-form-urlencoded");

    var urlencoded = new URLSearchParams();
    urlencoded.append("type", "x");
    urlencoded.append("username", "x@x.com");
    urlencoded.append("password", "x@");

    var requestOptions = {
      method: 'POST',
      headers: myHeaders,
      body: urlencoded,
      redirect: 'follow'
    };

    fetch("http://localhost:33333/api/Token", requestOptions)
      .then(response => response.text())
      .then(result => console.log(result))
      .catch(error => console.log('error', error));

A: In your startup.cs
in the ConfigureServices method you should have something like this, if you don't have then add it:
services.AddCors(options =>
        {
            options.AddPolicy(DefaultCorsPolicyName, builder =>
            {
                //App:CorsOrigins in appsettings.json can contain more than one address with splitted by comma.
                builder
                    .AllowAnyOrigin()
                    .SetIsOriginAllowedToAllowWildcardSubdomains()
                    .AllowAnyHeader()
                    .AllowAnyMethod();
            });
        });

And in your appsettings.json add http://0.0.0.0:80 like this:
 "App": {
...
"CorsOrigins": "http://*.mycompany.com,http://0.0.0.0:80",
...}

Another solution is to add a CORS extention in your browser and enable it, but it's not recommended


text:
Q: "SQL command not properly ended" by creating a sequence  CREATE SEQUENCE seq_mitarbeiterid
    INCREMENT BY 1
    START WITH 0
    MAX VALUE 9999
    NOCACHE
    NOCYCLE;

I can't see what's wrong with that statement or why I get that error message.
Thanks in advance.

A: From the error, it looks like you are using Oracle. If so, there is a syntax error near MAX VALUE - which should be MAXVALUE.
CREATE SEQUENCE seq_mitarbeiterid
INCREMENT BY 1
START WITH 0
MAXVALUE 9999    -- Here
NOCACHE
NOCYCLE;

A: As far as I know, MySQL does not support sequences.  These are usually used to provide incremental ids for tables.  If that is your purpose, then use auto_increment:
create table t (
    t_id int auto_increment primary key,
    . . .
);


text:
Q: Setting up BEMSimpleLineGraph Plot within UITableView While working on my app this evening I've come across a new situation. I'm attempting to load 2 different graphs [using BEMSimpleLineGraph] each into a different row of a UITableView. I've created a custom cell containing a UIView that inherits from BEMSimpleLineGraphView. My view controller naturally inherits from UIViewController, BEMSimpleLineGraphDelegate, BEMSimpleLineGraphDataSource, UITableViewDataSource, and UITableViewDelegate.
UITableViewDataSource and BEMSimpleLineGraphDataSource both have required methods but when I declare my table view's numberOfRowsInSection and cellForRowAtIndexPath methods, I can't place my numberOfPointsInLineGraph and valueForPointAtIndex methods inside of cellForRowAtIndexPath as this doesn't meet the requirements for BEMSimpleLineGraphDataSource.
Here is my current class:
import Foundation

class FlightsDetailViewController: UIViewController, BEMSimpleLineGraphDelegate, BEMSimpleLineGraphDataSource, UITableViewDataSource, UITableViewDelegate {

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 2
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    let cell: FlightsDetailCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as FlightsDetailCell

    cell.userInteractionEnabled = false

    cell.graphView.enableBezierCurve = true
    cell.graphView.enableReferenceYAxisLines = true
    cell.graphView.enableYAxisLabel = true
    cell.graphView.colorYaxisLabel = UIColor.whiteColor()

    cell.graphView.delegate = self
    cell.graphView.dataSource = self

    return cell

}

func lineGraph(graph: BEMSimpleLineGraphView!, valueForPointAtIndex index: Int) -> CGFloat {
    let data = [1.0,2.0,3.0,2.0,0.0]
    let data2 = [2.0,0.0,2.0,3.0,5.0]
    return CGFloat(data[index])
}

func numberOfPointsInLineGraph(graph: BEMSimpleLineGraphView!) -> Int {
    return 5
}
}

How would I for example have the first graph display the data from data and the second graph display data from data2. My graphs are displaying fine now but I can't figure out how to define independent data sets for each graph. How can this be done?

A: You need to check which instance of your graph is calling the datasource/delegate. You can find out by comparing the parameter lineGraph included in the datasource/delegate methods, to your instances of the graph.
I'm not familiar enough with swift, be here is how you can do it in Objective-C.
- (CGFloat)lineGraph:(BEMSimpleLineGraphView *)graph valueForPointAtIndex:(NSInteger)index
{
    if ([graph isEqual:self.myGraph1])
    {
        return data;
    }
    else
    {
        return data2;
    }
}


text:
Q: ASUS USB Crosslink cable filesharing I've purchased Asus USB Crosslink cable 2GB. I've read this answer:https://superuser.com/a/335822/108197
and I was hoping I could achieve similar behavior.
But after i connect two linux boxes together I get:
flash drive on (one machine), CD-ROM with some windows software(both machines), some writable but not persistent filesystem(both machines).
I cannot fileshare, sync or flashshare as is written on the box.
Anyone have any experince with this device.
Thanks in advance


text:
Q: In Oblivion is there a 1 to 1 relationship between skill advances and stats at level up? I know that how many point you can add to your attributes depends on how you leveled up your skills during that level but if I level up 5 strength skills will I get +5 to strength or is it not 1 to 1?

A: That's sort of how it works. From the Oblivion FAQ:

When you level you get to raise the values of three attributes. The amount you can raise an attribute by depends on how many skill points you have gained in skills governed by this attribute (major and minor).
0 skill points grants a +1 bonus
1-4 skill points grants a +2 bonus
5-7 skill points grants a +3 bonus
8-9 skill points grants a +4 bonus
10 or more skill points grants a +5 bonus
It is never possible to gain more than a +5 attribute bonus when leveling up. Attribute bonuses not used at one level (or surplus points past 10 in the skills governed by an attribute) do not roll over to the next level.
For example, say a character has the following major skills (seven in total, listed by attribute):
Agility: None
Endurance: Armorer
Intelligence: Conjuration; Mysticism
Personality: Illusion
Speed: None
Strength: Blade
Willpower: Destruction; Restoration
Since his previous level-up he has increased some skills (see below, increase in parenthesis after each skill). When he acquired the 10th increase in a major skill, he qualified for a level-up. The attributes offered to him would be as listed to the right in the examples below.
Example 1
Attribute Skill Increases Bonus
Agility Security (2) +2
Endurance None +1
Intelligence Alchemy (10), Conjuration (1), Mysticism (1) +5
Personality None +1
Speed Athletics (5), Acrobatics (5) +5
Strength Blade (4), Blunt (4) +4
Willpower Destruction (4) +2
For those concerned with over-leveling or skill management this is not a "perfect" level-up. An example of a 5/5/5 increase (as mentioned in Efficient Leveling) for this character could be:
Example 2
Attribute Skill Increases Bonus
Agility None +1
Endurance None +1
Intelligence None +1
Personality Illusion (6), Mercantile (4) +5
Speed Athletics (5), Acrobatics (3), Light Armor (2) +5
Strength None +1
Willpower Destruction (4), Alteration (6) +5
Here only 3 attributes have more than the minimum +1 modifier, and they all get the maximum +5. Illusion and Destruction are the only major skills that have been increased (4+6=10), along with a total of 20 minor skills. No skills have been over leveled. Note that the last one of the increased skills has to be a major skill.

A: It's not necessarily one-to-one. Check out the following, helpful Wiki page on the subject. It took me a while to understand it all, but it's pretty straightforward once you "get it".
http://www.uesp.net/wiki/Oblivion:Leveling


text:
Q: How to get rid of comma if no other value comes after the string I would like to not have a comma when there is a no value after string but I keep getting back a comma even if there is a value

  select
                company_no,
                company_name,
                concat(address_1
                         ,CASE WHEN NULLIF(address_1,'') <> ''  THEN ', '
                               ELSE ''
                          END) + concat(address_2
                         ,CASE WHEN NULLIF(address_2,'')<> ''  THEN ', '
                               ELSE ''
                          END) + concat(address_3
                         ,CASE WHEN NULLIF(address_3,'')<> '' THEN ', '

                               ELSE ''
                          END)+
                           concat(address_4
                         ,CASE WHEN NULLIF(address_4,'')<> ''  THEN ', '
                               ELSE ''
                          END)+
                           concat(address_5
                         ,CASE WHEN NULLIF(address_5,'')<> ''  THEN ' '
                               ELSE ''
                          END) as Address,
                code.code_desc as company_status

                from company_tbl company
                inner join code_tbl code on company.company_status = code.code and code.code_type = 'COM' and code_sub_type = 'CIR'

                where company_name like company_name +'%'
                and company_type = 'EOC'
                and address_3 is null

What I am getting :

*

*3050 LakedTest,, CityTest

*TBC,

*NULL

Desired output

*

*3050 LakedTest,CityTest

*TBC

*(Want this just to be blank)

Update : I had to add a the REPLACE function to get rid of commas that were in the String values.

A: Use STUFF function, or if your server version is 2017 or higher just use CONCAT_WS
DECLARE @Test TABLE (
    address_1   VARCHAR(10),
    address_2   VARCHAR(10),
    address_3   VARCHAR(10),
    address_4   VARCHAR(10),
    address_5   VARCHAR(10)
)

INSERT @Test
VALUES
('AAA', 'BBB', 'CCC', 'DDD', 'EEE'),
(NULL, 'BBB', 'CCC', 'DDD', 'EEE'),
(NULL, NULL, NULL, 'DDD', 'EEE'),
(NULL, NULL, NULL, NULL, NULL),
(NULL, NULL, NULL, NULL, 'EEE'),
('AAA', NULL, NULL, NULL, 'EEE'),
('AAA', NULL, NULL, NULL, NULL)

SELECT
ISNULL(
    STUFF(
        CONCAT (
            ', ' + NULLIF(REPLACE(address_1, ',', ''), ''),
            ', ' + NULLIF(REPLACE(address_2, ',', ''), ''),
            ', ' + NULLIF(REPLACE(address_3, ',', ''), ''),
            ', ' + NULLIF(REPLACE(address_4, ',', ''), ''),
            ', ' + NULLIF(REPLACE(address_5, ',', ''), '')
        ),
        1,
        2,
        ''
    ),
    ''
)
FROM @Test

A: select company_no,
       company_name,
       COALESCE(concat_ws(', ',
                          NULLIF(address_1,''),
                          NULLIF(address_2,''),
                          NULLIF(address_3,''),
                          NULLIF(address_4,''),
                          NULLIF(address_5,'')), '') as Address,
       code.code_desc as company_status

from company_tbl company
inner join code_tbl code on company.company_status = code.code
                        and code.code_type = 'COM'
                        and code_sub_type = 'CIR'

where company_name like company_name +'%' -- ???
  and company_type = 'EOC'
  and address_3 is null -- ???

company_name like company_name +'%' is extremely strange - it is always true except the case when company_name is NULL.
and address_3 is null is strange too - more precise it is strange why this field is nevertheless included into output expression.

A: Is this due to comparing NULL values? For instance, instead of saying
CASE WHEN NULLIF(address_2,'') <> '' THEN ', ' ELSE '' END

Would you rather say
CASE WHEN ISNULL(NULLIF(address_2,''),'1') <> '1' THEN ', ' ELSE '' END

Using ISNULL avoids the issue of comparing NULL values since you're now setting the expression equal to 1 if it's NULL, then comparing 1 to 1. SQL does not know how to compare NULL to NULL, and so any statement comparing NULLs will always evaluate to TRUE.
Edit: had the wrong comparison operator in the second statement, should be <>.


text:
Q: Why is didSet called twice on the TextField binding in SwiftUI? I have a very basic view that only shows a TextField:
View
struct ContentView: View {

    @StateObject var viewModel = ViewModel()

    var body: some View {
        TextField("Enter a string...", text: $viewModel.string)
    }

}

The TextField's text is bound to a string property on the view model:
ViewModel
class ViewModel: ObservableObject {

    @Published var string: String = "" {
        didSet {
            print("didSet string:", string)
        }
    }

}

I added a didSet property observer to perform a custom action whenever the string changes. For this simple example, I only print a string on the console.
Observation
When I run this code and enter the string "123" into the text field, this is the output I get:
didSet string: 1
didSet string: 1
didSet string: 12
didSet string: 12
didSet string: 123
didSet string: 123

Question:
Why?
Why is the didSet closure called twice for each character I type?
(I would expect it to be called once for each character.)
Is there anything wrong with the code or is this expected behavior somehow?

A: I'm seeing this issue on Xcode 14.2 RC and iOS 16.2 RC, but weirdly what fixes it is adding a .textFieldStyle(.plain) or .textFieldStyle(.roundedBorder).
I'm really not sure why having no textFieldStyle would affect this, but the binding calls set:{} twice when I have no textFieldStyle set, and as soon as I add one of those, it behaves normally and only calls set:{} once at a time.
I hope this helps someone!

A:  let binding = Binding<String>(get: {
                textvariable
            }, set: {
                viewModel.setText(query: $0) //add event inside setText
                // do whatever you want here
            })


text:
Q: primefaces tree drag,drop ajax event I have this error:

jan 03, 2014 6:43:56 PM com.sun.faces.context.PartialViewContextImpl
  processPartial INFO: java.lang.ClassCastException:
  javax.faces.event.ValueChangeEvent cannot be cast to
  javax.faces.event.AjaxBehaviorEvent java.lang.ClassCastException:
  javax.faces.event.ValueChangeEvent cannot be cast to
  javax.faces.event.AjaxBehaviorEvent

Tree in xhtml:
                <p:tree id="catTree"
                        value="#{listCatsRenderer.categoryTree}" var="ndt"
                        selectionMode="single"
                        selection="#{listCatsRenderer.selectedNode}"
                        draggable="true"
                        droppable="true"
                        animate="true" styleClass="tree_general"
                        propagateSelectionUp="false"
                        dynamic="true"
                        >

                    <p:ajax event="dragdrop" listener="#{listCatsRenderer.onDragDrop}" update=":main:catTree"/>

                    <p:treeNode>
                        <p:inplace event="dblclick" editor="true" >
                            <h:inputText value="#{ndt.name}"/>
                        </p:inplace>
                    </p:treeNode>
                </p:tree>

Loading from bean is here:
@Named
@SessionScoped
public class ListCatsRenderer extends ARenderer implements Serializable {
.
.
.
@Override
public TreeNode getCategoryTree() {
    if (categoryTree == null) {
        updateCategoryTree(); //DBS load
    }
    return categoryTree;
}

After any dragdrop event it throws exception. When I turn of condition above, it works without errors. Any idea why ?
Thank you.
//EDIT
Code for process event, however I thing it never gets there
public void onDragDrop(TreeDragDropEvent event) {
    System.out.println("dragged: " + event.getDragNode());
    System.out.println("dropped: " + event.getDropNode() + " > " + event.getDropIndex());
}

And full stacktrace, might help:

jan 05, 2014 11:50:28 AM
  com.sun.faces.lifecycle.ProcessValidationsPhase execute WARNING:
  java.lang.ClassCastException: javax.faces.event.ValueChangeEvent
  cannot be cast to javax.faces.event.AjaxBehaviorEvent
  javax.faces.FacesException: java.lang.ClassCastException:
  javax.faces.event.ValueChangeEvent cannot be cast to
  javax.faces.event.AjaxBehaviorEvent   at
  com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:270)
    at
  org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:57)
    at
  javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1193)
    at
  com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)    at
  com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:646)   at
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
  org.jboss.weld.servlet.ConversationFilter.doFilter(ConversationFilter.java:66)
    at
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
  org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at
  org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at
  org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at
  org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at
  org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at
  org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at
  org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at
  org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at
  org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at
  org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at
  org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at
  org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at
  org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at
  org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at
  java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at
  java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)  Caused by:
  java.lang.ClassCastException: javax.faces.event.ValueChangeEvent
  cannot be cast to javax.faces.event.AjaxBehaviorEvent      at
  org.primefaces.component.tree.Tree.queueEvent(Tree.java:308)  at
  javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:1057)
    at
  javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:1057)
    at
  javax.faces.component.UIComponentBase.queueEvent(UIComponentBase.java:1057)
    at javax.faces.component.UIInput.validate(UIInput.java:992)     at
  javax.faces.component.UIInput.executeValidate(UIInput.java:1249)  at
  javax.faces.component.UIInput.processValidators(UIInput.java:712)     at
  javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1261)
    at
  org.primefaces.component.inplace.Inplace.processValidators(Inplace.java:218)
    at
  org.primefaces.component.api.UITree.processColumnChildren(UITree.java:442)
    at org.primefaces.component.api.UITree.processNode(UITree.java:372)
    at org.primefaces.component.api.UITree.processNode(UITree.java:380)
    at org.primefaces.component.api.UITree.processNodes(UITree.java:365)
    at
  org.primefaces.component.api.UITree.processValidators(UITree.java:308)
    at
  org.primefaces.component.tree.Tree.processValidators(Tree.java:377)
    at
  com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:552)
    at
  com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
    at org.primefaces.component.api.UITree.visitTree(UITree.java:552)   at
  javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)    at
  javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)    at
  javax.faces.component.UIForm.visitTree(UIForm.java:371)   at
  javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)    at
  javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)    at
  com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:399)
    at
  com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:263)
    ... 28

A: Works for me with Mojarra 2.0.3 (FCS b03), PrimeFaces 4.0.
Please tell us more about the versions you use and provide the exact code for onDragDrop method of your backing bean. I guess it is related to your method that is not using the right parameter types (TreeDragDropEvent is expected, not ValueChangeEvent).
Should be something like :
public void onDragDrop(TreeDragDropEvent event) {
  ...
}


text:
Q: What is the difference between usri2_comment and usri2_usr_comment? In the Windows USER_INFO_2 structure there are two fields: usri2_comment and usri2_usr_comment. (Similarly, USER_INFO_3 has usri3_comment and usri3_usr_comment, and USER_INFO_4 has usri4_comment and usri4_usr_comment.) The documentation explains that usri2_comment "contains a comment to associate with the user account" whereas usri2_usr_comment is "a Unicode string that contains a user comment". But it never makes clear what is the difference between the two – why are there two comment fields here? What is each supposed to be used for?
The NET USER command displays both in its output – it calls usri2_comment the "Comment", whereas usri2_usr_comment it calls the "User's comment". The former can be changed using the /COMMENT option whereas the later can be changed using the /USERCOMMENT option. But that still is unenlightening as to what the actual difference between them is.

A: The difference is:

*

*usri2_comment is a comment set by the administrator. A non-administrator user cannot modify it even on their own account.

*usri2_usr_comment is a comment set by the user themselves. A non-administrator can modify it on their own account only.

A user can set their own usri2_usr_comment by calling NetUserSetInfo on themselves using info level 1012 (create a USER_INFO_1012 structure and set the usri1012_usr_comment field to the new user comment).
Note however that, in my own testing, NET USER username /USERCOMMENT:comment, when run by a non-admin user on themselves, fails with an access denied error. I believe the reason for this is that the NET USER command is calling NetUserSetInfo with info level 2 (or 3 or 4) instead of 1012.


text:
Q: ExtJS 4 Loading data into form panel on creation. Which event to catch? I'm stuck with populating Ext.form.Panel with data in my MVC project. In Controller I want to load data from store into form. But I cannot access basic form via form panel.
Form view
Ext.define('Example.view.webitem.Form', {
    extend: 'Ext.form.Panel',
    alias: 'widget.webitemform',
    renderTo: 'webstructure-form',

    items: [{
        xtype: 'fieldset',
        title: 'Metadata',
        items: [{
            xtype: 'displayfield',
            name: 'id',
            fieldLabel: 'ID'
        },
        {
            xtype: 'textfield',
            name: 'name',
            fieldLabel: 'Name'
        }]
    }],
    buttons: [{
        text: 'Load',
        action: 'loaditem'
    }]
});

Controller
Ext.define('Example.controller.WebItemsForm', {
    extend: 'Ext.app.Controller',

    stores: ['WebItemsForm'],
    models: ['WebItem'],
    views: ['webitem.Form'],
    init: function() {
        // This does not work. Data aren't loaded in store
        this.control({
            'webitemform': {
               render: this.loadItem
            }
        });
        // This works, but isn't userfriendly
        this.control({
            'webitemform button[action=loaditem]': {
                click: this.loadItem
            }
        });
    },
    loadItem: function() {
        var form = this.getWebItemForm().getForm();
        var data = this.getStore('WebItemsForm').getAt(0);
        form.loadRecord(data);
    }
});

After clicking on Load button, data are correctly loaded into form. But when I'm trying to catch Ext.form.Panel render event, store doesn't have data loaded.
Uncaught TypeError: Cannot read property 'data' of undefined.

If I understand correctly, this is caused because load operation is asynchronous? How to load data on render event? Is there more suitable event?

A: Afer the panel is rendered (afterrender event) check if store is is loaded yet (usally it will not be, unless panel's render has been deferred because it's in an inactive tab for example). If the test fails in the same event add load listener to the store, that will push data back to panel once it's ready.


text:
Q: Getting null values while deserialize json string to textview gson I am newbie, I have created webservice in java for get all Restaurant category from MySQL database and accessing in android studio
 ,
my json response is as following,
[
{
    "restro": {
        "categoryid": 1,
        "categoryname": "Restaurant (Vegetarian)"
    }
},
{
    "restro": {
        "categoryid": 2,
        "categoryname": "Restaurant (Non-Vegetarian)"
    }
}
]

deserialization code gson library
Gson gson=new Gson();
        Type RestroTypeListType=new TypeToken<Collection<Category>>(){}.getType();
        List<Category> categories=(List<Category>)gson.fromJson(jsonstring,RestroTypeListType);
        tv1.setText("");
        for(Category category : categories)
        {
              tv1.append(category.getCategoryName()+"\n");
        }

my entity class is
public class Category {

private int categoryID;
private String categoryName;

public Category() {

}

public int getCategoryID() {
    return categoryID;
}

public void setCategoryID(int categoryID) {
    this.categoryID = categoryID;
}

public String getCategoryName() {
    return categoryName;
}

public void setCategoryName(String categoryName) {
    this.categoryName = categoryName;
}

@Override
public String toString() {
    return "Category{" +
            ", categoryName='" + categoryName + '\'' +
            '}';
}

}
I am getting null in textview.

A: Your problem is that you are expecting a collection of categories but you are returning a collection of restro.
Can you provide more detail about the restro attribute in your json response.
But i guess that introducing a new Class that has an attribute named (restro) of type Category will solve your problem.
And change
Type RestroTypeListType=new TypeToken<Collection<Category>>(){}.getType();

For
Type RestroTypeListType=new TypeToken<Collection<Restro>>(){}.getType();

A: yeah, I got the answer
without add any external library ,
JSONArray jsonArray = new JSONArray(jsonstring);
        String OuterstringArray;
        tv1.setText("");
        for (int outer = 0; outer < jsonArray.length(); outer++) {
            OuterstringArray=jsonArray.getJSONObject(outer).getString("restro");
            JSONObject jsonObject=new JSONObject(OuterstringArray);

            arrayListRestro.add(jsonObject.getString("categoryname"));
        }
        ArrayAdapter arrayAdapter=new ArrayAdapter(this,android.R.layout.simple_list_item_1,arrayListRestro);
        listRestros.setAdapter(arrayAdapter);


text:
Q: Name variables in a model using TensorFlow 1.14 It seems like TensorFlow1.14 will automatically name variables in a model by order if you don't do that. For example:
Conv_1/weights:0
Conv_1/biases:0
BatchNorm_1/beta:0
Conv_2/weights:0
Conv_2/biases:0
BatchNorm_2/beta:0
Conv_3/weights:0
Conv_3/biases:0
BatchNorm_3/beta:0

I hope to keep these and add a head "net1", like this:
net1/Conv_1/weights:0
net1/Conv_1/biases:0
net1/BatchNorm_1/beta:0

And then, I need to initialize a same architecture with a different name, like:
net2/Conv_1/weights:0
net2/Conv_1/biases:0
net2/BatchNorm_1/beta:0

However, I can't simply change the scope in each layer to achieve that.

A: Use with tf.variable_scope("net1") before the definition of your network instead of with tf.name_scope("net1"). Hope this can help more people.


text:
Q: How do I define client_id? I have two models jobs and clients.
A user can simple create a client and then assign them a number of jobs.
Here's my models for both.
job.rb
class Job < ActiveRecord::Base
  has_and_belongs_to_many :clients
end

client.rb
class Client < ActiveRecord::Base
  has_and_belongs_to_many :jobs
end

My form for creating a new job looks like this:
<%= simple_form_for :job do |f| %>
  <%= f.input :name %>
  <%= <%= collection_select(:job, :client_ids, Client.all, :id, :name, {:include_blank => 'None'}, { :multiple => true }) %>%>
  <%= f.button :submit %>
<% end %>

So as you can see there is a drop down box on the form which contains all of the clients.
When  try to save it however, I recieve this messed:
ActiveRecord::UnknownAttributeError in JobsController#create

unknown attribute: client_id

Application Trace | Framework Trace | Full Trace
app/controllers/jobs_controller.rb:22:in `new'
app/controllers/jobs_controller.rb:22:in `create'
Request

Parameters:

{"utf8"=>"✓",
 "authenticity_token"=>"0ZVYpM9vTgY+BI55Y9yJDwCJwrwSgGL9xjHq8dz5OBE=",
 "job"=>{"name"=>"Sample Monthly",
 "client_id"=>"1"},
 "commit"=>"Save Job"}

My job controller is quite basic and looks like this:
class JobsController < ApplicationController

  def index
    @jobs = Job.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml { render :xml => @job }
    end
  end

  def new
    @jobs = Job.new

    respond_to do |format|
      format.html # index.html.erb
      format.xml { render :xml => @job }
    end
  end

  def create
    @jobs = Job.new(params[:job])
    respond_to do |format|
      if @jobs.save
        format.html { redirect_to @jobs, notice: 'Job was successfully created.' }
        format.json { render json: @jobs, status: :created, location: @jobs }
      else
        format.html { render action: "new" }
        format.json { render json: @jobs.errors, status: :unprocessable_entity }
      end
    end
  end

  def show
    @jobs = Job.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @jobs }
    end
  end
end

I have a junction table setup with both job_id and client_id as a integer value in them.
So I think its just a case of defining them in my controller under the new and create action like the error message suggests.
This is my first Rails app though sand im not quite sure how.
Any help would be greatly appreciated!

A: Problem might be in your form. Try to replace this
<%= <%= collection_select(:job, :client_ids, Client.all, :id, :name, {:include_blank => 'None'}, { :multiple => true }) %>%>

with
<%= f.association :clients %>

so the form will look like this
<%= simple_form_for @job do |f| %>
  <%= f.input :name %>
  <%= f.association :clients %>
  <%= f.button :submit %>
<% end %>


text:
Q: Getting an error when trying to block public access with boto3 I am trying to query all the buckets in my account using boto3. I will then iterate over all the buckets blocking public access on each as I go through.
here is my code:
import boto3

s3 = boto3.resource('s3')
client = boto3.client('s3')

def handler(event, context):
    for bucket in s3.buckets.all():
        response = client.put_public_access_block(
            Bucket=bucket,
            ContentMD5='string',
            PublicAccessBlockConfiguration={
                'BlockPublicAcls': False,
                'IgnorePublicAcls': False,
                'BlockPublicPolicy': True,
                'RestrictPublicBuckets': True
            },
            ExpectedBucketOwner= '691126532408'
)

Here is my error:
{
  "errorMessage": "expected string or bytes-like object",
  "errorType": "TypeError",
  "stackTrace": [
    [
      "/var/task/s3PublicAccess.py",
      17,
      "handler",
      "ExpectedBucketOwner= '691126532408'"
    ],
    [
      "/var/runtime/botocore/client.py",
      316,
      "_api_call",
      "return self._make_api_call(operation_name, kwargs)"
    ],
    [
      "/var/runtime/botocore/client.py",
      608,
      "_make_api_call",
      "api_params, operation_model, context=request_context)"
    ],
    [
      "/var/runtime/botocore/client.py",
      654,
      "_convert_to_request_dict",
      "api_params, operation_model, context)"
    ],
    [
      "/var/runtime/botocore/client.py",
      686,
      "_emit_api_params",
      "params=api_params, model=operation_model, context=context)"
    ],
    [
      "/var/runtime/botocore/hooks.py",
      356,
      "emit",
      "return self._emitter.emit(aliased_event_name, **kwargs)"
    ],
    [
      "/var/runtime/botocore/hooks.py",
      228,
      "emit",
      "return self._emit(event_name, kwargs)"
    ],
    [
      "/var/runtime/botocore/hooks.py",
      211,
      "_emit",
      "response = handler(**kwargs)"
    ],
    [
      "/var/runtime/botocore/handlers.py",
      200,
      "validate_bucket_name",
      "if not VALID_BUCKET.search(bucket) and not VALID_S3_ARN.search(bucket):"
    ]
  ]
}

What I have tried:
Stringing the ExpectedBucketOwner field.
I have experienced this issue when trying to put bucketEncryption on the same iterated list of s3Buckets and am trying to figure it out. Thank you!
Thank you in advance!!

A: To get bucket name from your bucket, you have to use bucket.name. Also ContentMD5 is optional, so you can skip it.
Thus, you can try the following (assuming everything else is correct):
import boto3

s3 = boto3.resource('s3')
client = boto3.client('s3')

def handler(event, context):
    for bucket in s3.buckets.all():
        response = client.put_public_access_block(
            Bucket=bucket.name,
            PublicAccessBlockConfiguration={
                'BlockPublicAcls': False,
                'IgnorePublicAcls': False,
                'BlockPublicPolicy': True,
                'RestrictPublicBuckets': True
            },
            ExpectedBucketOwner= '691126532408'
)


text:
Q: Use Newton's method to approximate a unique root in [-1,1] for $f(x)=arccos(x)-2x-3$ to within $10^{-6}$ Edited for readability
I'm having some trouble with this because I've tried solving this myself through the iterations, and I've also tried Matlab and an online calculator.
The first time I tried the iterations myself I began with x=1. On the second iteration I was getting $1-\frac{0}{0}$ which did not look right to me at all. I get the same behavior (an error of division by 0 when I try Matlab).
Here is what I am doing - now I have chosen $-.5$ because it is closer to the root (which is approx $-.47$ by looking at the graph of f(x)=arccos(x)−2x−3.
$$f(x) = arccos(x)-2x-3$$
$$f'(x) = \frac{-1}{\sqrt{1-x^2}} - 2$$
Newton's method : $$x - \frac{f(x)}{f'(x)} $$
which, in this particular case $$x - \frac{ arccos(x) - 2·x - 3}{ -\sqrt{ 1-x^2 }} - 2$$
Now when I plug in x=−.5
$$p1 = (-.5) - \frac{( arccos(-.5) - 2·(-.5) - 3 )}{ -\sqrt{ 1-(-.5)^2} } - 2 = -2.3910019244$$
$$p2 = (-2.3910019244)-\frac{arccos(-2.3910019244)-2·(-2.3910019244)-3}{-\sqrt{1-(-2.3910019244)^2}}-2$$
p2=not a real number
So this is where I am stuck because I can clearly see the root on the graph but I do not seem to be getting close to it.
Thanks for the help!

A: Note that $f'(x)$ is undefined at $x= \pm 1$ because of division by zero.  Newton's method works well if you start close to the root.  If you graph it, the root is somewhere near $-0.4$.  Starting at $-0.4$ I converge rapidly to $-0.4699722$

A: sometimes it helps to look at a problem from a different angle. you will notice that your equation can be re-written as:
$$
g(x) = x - \cos(2x+3) = 0
$$
now you have:
$$
g'(x) = 1+2\sin(2x+3)
$$
if you take $x_1 = -0.5$ then
$$
x_2 = -0.5 - \left( \frac{-0.5 +   \cos(2)}{1+2\sin(2)}\right) \\
= - 0.4703...
$$

A: Edit
Darya found my mistake, I was placing the -2 from my f' outside of f/f' which is why I wasn't getting close to the root.
Therefore, this is Newton's method, in this particular case:
$$x - \frac{ arccos(x) - 2·x - 3}{ \frac {-1}{\sqrt{ 1-x^2} } -2}$$
Now when I plug in x=−.5
$$-.5 - \frac{ arccos(-.5) - 2·(-.5) - 3}{ \frac {-1}{\sqrt{ 1-(-.5)^2} } -2} = -4.7007795515$$


text:
Q: Rows into Columns by using pivot Can you help me to solve this error

The type of column "nvrchildgender" conflicts with the type of other columns specified in the UNPIVOT list.

Table structure:
CREATE TABLE [dbo].[tblHRIS_ChildDetails](
    [intCHID] [int],
    [intSID] [int] NOT NULL,
    [nvrChildname] [nvarchar](250) NULL,
    [nvrChildGender] [nvarchar](50) NULL,
    [dttChildDOB] [datetime] NULL,
    [nvrnominee] [nvarchar](50) NULL,
    [nvrChildOccupation] [nvarchar](250) NULL,
    [dttCreatedon] [datetime] NULL,
    [dttModifiedOn] [datetime] NULL,
    [nvrModifiedby] [nvarchar](50) NULL
) ON [PRIMARY]

Query:
select *
from
(
  select value, col+'_'+cast(rn as varchar(10)) col
  from
  (
    select nvrchildname,
      nvrchildgender,
      convert(nvarchar(10), dttchildDOB, 120) dttchildDOB,
      nvrchildoccupation,
      row_number() over(partition by intsid order by intCHID) rn
    from tblHRIS_ChildDetails
    where intsid = 463
  ) src
  unpivot
  (
    value
    for col in (nvrchildname, nvrchildgender, dttchildDOB,  nvrchildoccupation)
  ) unpiv
) src1
pivot
(
  max(value)
  for col in ([nvrchildname_1], [nvrgender_1],
              [dttchildDOB_1], [occupation_1],
              [nvrchildname_2], [nvrgender_2],
              [dttchildDOB_2], [occupation_2])
) piv

I cannot to able to run this query i think some cast problem pls resolve.
Sql fiddle

A: The columns in the UNPIVOT list:
nvrchildname, nvrchildgender, dttchildDOB,  nvrchildoccupation

Have different data types.
You have to ensure that the types of the columns. Something like :
 ...
  CAST(nvrchildname AS NVARCHAR(10)) nvrchildname,
  CAST(nvrchildgender AS NVARCHAR(10)) nvrchildgender,
  convert(nvarchar(10), dttchildDOB, 120) dttchildDOB,
  CAST (nvrchildoccupation AS NVARCHAR(10)) nvrchildoccupation
 ...

Updated SQL Fiddle Demo

A: To UNPIVOT successfully, the column types must match. Since two of the 4 columns are already nvarchar(250) and the other two shorter, promoting them to nvarchar(250) is the most expedient fix.
select *
from
(
  select value, col+'_'+cast(rn as varchar(10)) col
  from
  (
    select nvrchildname,
      cast(nvrchildgender as nvarchar(250)) nvrgender,
      convert(nvarchar(250), dttchildDOB, 120) dttchildDOB,
      nvrchildoccupation occupation,
      row_number() over(partition by intsid order by intCHID) rn
    from tblHRIS_ChildDetails
    where intsid = 463
  ) src
  unpivot
  (
    value
    for col in (nvrchildname, nvrgender, dttchildDOB, occupation)
  ) unpiv
) src1
pivot
(
  max(value)
  for col in ([nvrchildname_1], [nvrgender_1],
              [dttchildDOB_1], [occupation_1],
              [nvrchildname_2], [nvrgender_2],
              [dttchildDOB_2], [occupation_2])
) piv

Note: You have named the PIVOT column nvrgender but the base column was nvrchildgender. Same problem with mismatched occupation column naming between pivot and unpivot.


text:
Q: How do I resolve "No such file or directory" with Python os.rename module Here is my code:
file_list = os.listdir("/home/vanessa/prank")

    def rename_files():
        # current_dir = os.getcwd()

        for file_name in file_list:
            os.rename(file_name, file_name.translate(None, "0,1,2,3,4,5,6,7,8,9"))

rename_files()

When I run, i get

os.rename(file_name, file_name.translate(None, "0,1,2,3,4,5,6,7,8,9"))
  OSError: [Errno 2] No such file or directory

A: You should specify the full path to your file, not just the relative path. You can do that by calling os.getcwd and joining the result to the tail with os.path.join.
def rename_files():
    root = "/home/vanessa/prank"

    for file_name in file_list:
        os.rename(os.path.join(root, file_name),
                  os.path.join(root, file_name.translate(None,
                                                   "0,1,2,3,4,5,6,7,8,9")))

A: os.listdir() returns just name of the files , not paths. add path to the files.

A: try absolute path instead of relative path
file_list = os.listdir("/home/vanessa/prank")

to
file_list = os.listdir("C:/home/vanessa/prank")


text:
Q: How can I read multiple matrices from one csv-file? I'm trying to load multiple matrices from a text file.
I want to read several matrices from the same file so that I can draw them in a network. I've managed to do it when to input file only contains one matrix, but don't understand how to do it when it has many.
The input file looks something like this, only it is a big bigger:
x [*,*,0]
:    0   1   2   3   4   :=
0    .   0   0   1   1
1    1   .   0   0   0
2    1   0   .   0   0
3    0   0   0   .   0
4    0   0   0   0   .

And my code is like this:
infile = "testfile.sol"
edges = []
import pandas as pd
colNames = [i for i in range(11)]
df = pd.read_csv('testfile.sol', sep=' ', skipinitialspace=True, index_col=0,names=colNames, skiprows=[0, 1])

for i in range(len(df)):
    for j in range(len(df)):
        if df[i][j] == "1":
            index_i = i
            index_j = j
            edge = (i,j)
            edges.append(edge)
import networkx as nx
G = nx.Graph()
G.add_edges_from(edges)

This sort of works, but my input file has several of these written further down the file:
x [*,*,0]
:    0   1   2   3   4   :=
0    .   0   0   1   1
1    1   .   0   0   0
2    1   0   .   0   0
3    0   0   0   .   0
4    0   0   0   0   .

x [*,*,1]
:    0   1   2   3   4   :=
0    .   0   0   1   0
1    1   .   0   0   0
2    1   0   .   0   1
3    0   0   0   .   0
4    0   0   0   0   .

How can I read all of these, and make the lists edges0, edges1, and so on?

A: I didn't try it but you may use numpy.genfromtxt() with correct delimiters. You need to use two times. First get matrices and use second time by iterating on matrices array.


text:
Q: Why blocking the user, not the IP when fail to login? I have read here and here that tracking the failed login attempts should be done on the user.
"If anyone tries to log in with the username/email
somone@example.com X wrong times. I block somone@example.com"
Why shouldn't I do this based on IP ? as anyone can block my users by knowing only their usernames/emails. Why shouldn't I do it like :
"If this IP tries to log in with any username/email X wrong times. I block this IP" ?

A: A good example is https://en.wikipedia.org/wiki/Wikipedia:AOL#Why_are_AOL_users_often_blocked?
IPs don't identify a single person. ISPs, large corporations, public spots like libraries, etc will often use some kind of enforced proxy, NAT, or transparent caching host for outgoing connections. This makes all the users from that network share a single IP.
Blocking the IP because of one person can block the whole group.

A: Ips are generally dynamically assigned, so blocking a black hat one day maybe blocking a white hat the next


text:
Q: ClickOnce application settings best practice? I'm using ClickOnce and have some local settings to store.
My problem is I would like them to be removed on uninstall which as I understand it rules out the registry?
So I can save them into a file but am not sure where to save it to so that it will be removed on uninstall.
My conundrum is I would like the settings to remain at the same location when the application gets updated each time round so my app will continue to work.
Hope you can help, many thanks in advance.

A: Store settings with application scoped isolated storage. This will be removed on uninstall.
See this answer for details.


text: Q: Is it Heroku postgresql database free for hobby package? If yes, How much data can store it? I have a web app which contains a PostgreSQL database. I want to host my site in Heroku hobby package. But I bit confuse the pricing policy of Heroku. I don't sure that Heroku hobby package includes PostgreSQL freely. If freely connect the PostgreSQL database in a hobby package, then my question how much data can I store freely?


text:
Q: If the solution is too simple, it must be incorrect?
Prove that to each $\epsilon > 0$ there exists a $\delta > 0$ such that $\displaystyle \int_E |f| d \mu < \epsilon$ whenever $\mu (E) < \delta$, where $f \in L^1(\mu)$.

I found this question asked on MSE here, here, and here, but some of the suggestions seem relatively complicated (at least compared to what I did). When I was solving the problem, no such ideas/theorems found in those links came to my mind; indeed, I just followed my nose by playing with inequalities. But, after looking at some other solutions, I am beginning to doubt that mine is correct. Here is what I did:

First note that by definition
\begin{align}
\int_{E} |f|d \mu &= \sup \{\sum_{i=1}^m a_i \mu (A_i \cap E) \mid m \in \Bbb{N}, 0 \le a_i \le |f|, E = \bigsqcup_{i=1}^m A_i, A_i \mbox{measurable} \} \\
&\le \sup\{\max \{a_i\} \sum_{i=1}^m \mu(A_i \cap E) \mid ... \} \\
&= \sup\{\max \{a_i\} \mu(E) \mid ... \} \\
&= \mu(E) \cdot \sup\{\max \{a_i\} \mid ... \} \\
&\le \mu(E) \inf_{x \in E} |f(x)| \\
\end{align}
The first inequality follows simply because the elements in the one set are larger than the other. The second because $0 \le a_i \le |f|$ on $E$ implies $a_i \le \inf_{x \in E} |f(x)|$ and therefore $\max \{a_i \} \le \inf_{x \in E} |f(x)|$. Now, if $\inf_{x \in E} |f(x)| = 0$, then any $\delta > 0$ will do, since the above together with this implies $\int_{E} |f| d \mu =0$. If not, then $\displaystyle \delta = \frac{\epsilon}{\inf_{x \in X} |f(x)|}$ will work.

I can't spot the error.


text:
Q: How do I grab a MySQL column's position? I'm currently working on creating a Discord bot with a level module, and I can't seem to grab the position of a MySQL column. This is to display the current rank of the user. Here's the query:
connection.query(`SELECT * FROM levels WHERE GuildID = ${message.guild.id} ORDER BY UserLvl DESC, LevelExp DESC`, function(error6, results6) {
  result_json6 = JSON.stringify(results6);
  final_result6 = JSON.parse(result_json6);
});

I've tried several things, from forEach to while to for and more. Is there any way to grab the position of a column and display it?

A: Define column order in the query.
For eg. SELECT Column1, Column2, Column3... FROM TABLE
Then retrieve column with their name and row position 0..N-1 (N = size of result6)

*

*If you want to get Column2 from first row, then result6[0].Column2

*If you want to get Column3 from second row, then result6[1].Column3
You can put row position using for loop, lets say i = 0 to N-1, and get the value as
result6[i].Column1


text:
Q: Efficient way to accumulate in Pandas I would like to calculate an exponential moving average on a Pandas time series.
I have two columns, one called 'value' and one called 'time'. Time is nondecreasing. I can as well reset the index as 'time' and get the value Series.
ewma uses only integer "time" values.
Instead of calculating
ewma[i+1] = value[i+1] + alpha * ewma[i]

like ewma, I would like to do:
ewma[i+1] = value[i+1] + exp(alpha * (time[i] - time[i+1]) ) * ewma[i]

What is the most efficient way to do it?
numpy.accumulate requires numpy.ufunc.


text:
Q: Different colors for each bib file and custom prefix I have multiple bib files. I would like to use different text colors for all the references mentioned in different bib files.
Secondly, i would like a custom prefix for each bib file.
Please let me know how can I do it?
The result should be similar to as follows:
[R1] uses [O1] and [R2] is based on [O2].
References
[R1]  .....
[R2]  .....
Other References
[O1] ....
[O2] ....
Color of references mentioned in section "References" will be black, where as color of references mentioned in section "Other references" will be blue.

A: We can split the bibliography by .bib file (something that is not necessarily very semantic) following biblatex: multiple bibliographies categorised by different .bib files and separating bibliography items based on resource file (the second link shows how to deal with existing keywords).
Adding the additional letter into the label is then as simple as issuing \newrefcontext[labelprefix=<prefix>] before the \printbibliography. See Biblatex entry renumbering and prefixing, Custom citation label, Biblatex with sections, prefix, and reversed order, Separate bibliographies for phdthesis and mastersthesis in biblatex.
\documentclass{article}

\usepackage{xcolor}
\usepackage[backend=biber, style=numeric, defernumbers]{biblatex}

\DeclareSourcemap{
  \maps[datatype=bibtex,overwrite]{
    \map{
      \perdatasource{\jobname-1.bib}
      \step[fieldset=keywords, fieldvalue={,file1}, append]
    }
    \map{
      \perdatasource{\jobname-2.bib}
      \step[fieldset=keywords, fieldvalue={,file2}, append]
    }
  }
}

\newcommand*{\mkbibcolourcite}[1]{%
  \ifkeyword{file2}
    {\textcolor{blue}{#1}}
    {#1}}
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{\mkbibcolourcite{#1}}}
\DeclareFieldFormat{colourcite}{\mkbibcolourcite{#1}}

\renewbibmacro*{cite}{%
  \printtext[bibhyperref]{%
    \printtext[colourcite]{%
      \printfield{labelprefix}%
      \printfield{labelnumber}%
      \ifbool{bbx:subentry}
        {\printfield{entrysetcount}}
        {}}}}

\usepackage{filecontents}
\begin{filecontents}{\jobname-1.bib}
@book{book1,
  author = {Onymous, Anne},
  title  = {First Bibliography: Category 1},
  date   = {2000},
}
@book{book3,
  author   = {Scribbler, Sarah},
  title    = {First Bibliography Again: Category A and B},
  date     = {1899},
  keywords = {cata},
}
\end{filecontents}
\begin{filecontents}{\jobname-2.bib}
@book{book2,
  author = {Writer, William},
  title  = {Second Bibliography: Category 2},
  date   = {2010},
}
@book{book4,
  author = {Poetaster, Paula},
  title  = {Second Bibliography Again: Category B},
  date   = {1767},
}
\end{filecontents}

\addbibresource{\jobname-1.bib}
\addbibresource{\jobname-2.bib}

\begin{document}
\cite{book1,book2,book3,book4}
\newrefcontext[labelprefix=R]
\printbibliography[keyword=file1]
\newrefcontext[labelprefix=O]
\printbibliography[keyword=file2, title=Other references]
\end{document}

edit How embarassing! I completely forgot to colour the citations according to their file/keyword. That is fixed now. Sorry!


text:
Q: Using only CSS, any way to "flash" an element to draw attention after named anchor click? I'm really not much of a web coder.  I'm struggling through modifying a shopping cart template.  I'm using a named anchor to get a user down to a detailed description area. That works fine, but the way it jumps is kind of disorienting and I'd like to draw attention to the heading.  Below is the div containing the named anchor.  I'd preferably like to flash #more_info_sheets (which is the heading) or else idTab1 (which is the content and also the anchor target)

More info

Comments(0)

Installation Instructions

                [...subject content...]

                    [...blahblah...]

                [...blahblah...]

                [...blahblah...]

What I have managed to do so far on my own is get the #idTab1 content to change to a yellow background when I click the link.  But now I'm stuck.  First off, I don't want it to stay highlighted.  Second, it isn't exactly a slick effect even if it did go away!  Third, I'd really rather flash the heading when clicked, rather than the #idTab1 itself.
#idTab1:target {
background-color: yellow; }

I found javascript based examples on the Web that seemingly do exactly what I want, but I can't seem to get Javascript to work with this cart so I'd rather not go there right now.

A: source:  http://codepen.io/anon/pen/xfjrh
@import "compass/css3";

/**
 * Use the :target pseudo-element to apply
 * styles to the element with the same ID as
 * the fragment identifier.
 * (e.g. `#target-section`)
 *
 * The pseudo-element can also be used in
 * conjunction with another selector to
 * define a variety of target styles.
 * (e.g. `#target-section:target)
 */

:target {
    -webkit-animation: target-fade 1s;
    -moz-animation: target-fade 1s;
    -o-animation: target-fade 1s;
    animation: target-fade 1s;
}

/**
 * Keyframe animation definition
 *
 * 1. Insert a color of your choice here
 */

@-webkit-keyframes target-fade {
    from { background-color: red; } /* [1] */
    to { background-color: transparent; }
}

@-moz-keyframes target-fade {
    from { background-color: red; } /* [1] */
    to { background-color: transparent; }
}

@-o-keyframes target-fade {
    from { background-color: red; } /* [1] */
    to { background-color: transparent; }
}

@keyframes target-fade {
    from { background-color: red; } /* [1] */
    to { background-color: transparent; }
}

/* Demo-specific styles */
body {
  width: 500px;
  margin: 0 auto;
}


text:
Q: While installing package PackageKit relocate application bundle. How to disable this behaviour? My program erlier distibuted as a zipped bundle, but now  I planing add daemon that must start after installation. So I decide create package while installing that will run Post-Install script.
First, I create a simple package like this:

 productbuil --component MyAppName.app /Applications --sign "common name of my certificate" MyAppName.pkg

and trying to install it.
Installation wase successful but after I not find the app bundle in /Application directory. While inverstigatin this poltergaste I found in /var/log/install.log this line:

installd[1954]: PackageKit: Applications/MyAppName.app relocated to Users/myUserName/PAServer/scratch-dir/UserName1.Kh-profileName/MyAppName.app

After that I find this answer Making OS X Installer Packages like a Pro - Xcode Developer ID ready pkg
and try to execute command lines finded in it.

pkgbuild --analyze --root ./MyProgram.app MyProgram.app.plist
     pkgbuild: Inferring bundle components from contents of ./MyProgram.app
     pkgbuild: Writing new component property list to MyProgram.app1.plist

Where I planing to edit plist file but first I was try to simple build package with default params.

pkgbuild --root ./MyProgram.app --component-plist
  ./MyProgram.app.plist MyProgram.pkg    pkgbuild: Reading components
  from ./MyProgram.app.plist    pkgbuild: error: No package identifier
  specified and not exactly one component to derive it from.

What is wrong?
-----------------------------
I also trying to install old version of XCode aux tools to trying use PackageMaker, but can't find documentation (I needed use PackageMaker from command line) to It even if I installing XCode 4.5.
I can't build packages manualy from GUI-tools, because into end-user bundle placed unique resource library, and manual buildin is too expensive. So i search for automatic building methods.

A: You're missing the --identifier parameter.  Try:
pkgbuild --identifier MyIdentifier --root ./MyProgram.app \
--component-plist ./MyProgram.app.plist MyProgram.pkg

Where --identifier MyIdentifier is the unique name that can be registered with the system.
P.S. You may choose to follow the suffix.domain.project naming convention via:
pkgbuild --identifier com.mydomain.MyIdentifier --root ./MyProgram.app \
--component-plist ./MyProgram.app.plist MyProgram.pkg

Where --identifier com.mydomain.MyIdentifier is the unique name that can be registered with the system.


text:
Q: Inviting test users facebook SDK? I have integrated my game with facebook in unity. My sharing and leaderboards work properly. The problem is with invites(FB.AppRequest). I am able to send them but they are never received by others. I know fb doesnt allow publish_actions without approval and i have created the test users but am still unable to invite them.
How can i invite test user to play the game using facebook sdk since they are already friends with each other and using the app?


text:
Q: Intelligent routing methods I noticed that jquery.com uses /nameOfMethod as there routing convention.  Using this to my advantage to cite sources on a previous stack question I mistyped www.jquery.com/next -> www.jquery.com/nex  What I found surprising is that the routing was smart enough to see the similarity in names and correctly(perhaps incorrectly) route me.  I'm super new to back end programming.  I am just finishing up my first Project in Ruby on Rails. The project has exposed me to things like associations, CRUD, MVC and just a huge array of things I've never known of.  I'm becoming more and more concious of how the web works and this is knowledgable routing is interesting me.
Using Ruby on Rails as an example how would one accomplish this intelligent routing?  What kind of words are can I Google to learn more about this process?  How difficult or deep down the rabbit hole of back end programming is this interaction?  Is there anything that trumps this interaction, something more cutting edge, that you could suggest?

A: So, in routes.rb you'd do something like
match '/:itemname', to items#show
In the Items controller you'd then have
def show
    item = Item.where("itemname like ?", "#{params[:itemname]}%").to_sql
    redirect_to item
end

In essence you're

*

*Mapping root_url/name_of_an_item to an action in your controller
    which

*Forms a SQL query that takes a wildcard after itemname that
    is used to

*Redirect the user to the route for the item in
    question.

My example probably isn't syntactically correct, but that's the logic behind it.
Head on over to http://guides.rubyonrails.org/index.html and read the routing and query interface guides. Everything there's great, but those two in particular might be helpful to learn more about this sort of thing.


text:
Q: WPF TreeView "autowidth" over several items? What is the right way to display columns in a tree view, that auto align their width to the width of the content.
The problem that I see is, that each TreeViewItem is independent and therefor I don't know how to tell that eg the date column in every TreeViewItem shall have the same width, but depending on the TreeViewItem with the widest date string?
  <TreeView Name="treeView" TreeViewItem.Expanded="TreeViewItem_Expanded" AutomationProperties.IsColumnHeader="True" AutomationProperties.IsRowHeader="True" AllowDrop="True" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">

    <TreeViewItem>
      <TreeViewItem.Header>
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="auto" />
          </Grid.ColumnDefinitions>
          2.3.00
          Something
        </Grid>
      </TreeViewItem.Header>
    </TreeViewItem>

    <TreeViewItem>
      <TreeViewItem.Header>
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="auto" />
          </Grid.ColumnDefinitions>
          22.03.2000
          Something 2
        </Grid>
      </TreeViewItem.Header>
    </TreeViewItem>
  </TreeView>

A: Use a SharedSizeGroup
<TreeView Name="treeView" Grid.IsSharedSizeScope="True" TreeViewItem.Expanded="TreeViewItem_Expanded" AutomationProperties.IsColumnHeader="True" AutomationProperties.IsRowHeader="True" AllowDrop="True" VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling">

  <TreeViewItem>
    <TreeViewItem.Header>
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" SharedSizeGroup="A" />
          <ColumnDefinition Width="auto" SharedSizeGroup="B"  />
        </Grid.ColumnDefinitions>
        2.3.00
        Something
      </Grid>
    </TreeViewItem.Header>
  </TreeViewItem>

  <TreeViewItem>
    <TreeViewItem.Header>
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*" SharedSizeGroup="A"  />
          <ColumnDefinition Width="auto" SharedSizeGroup="B"  />
        </Grid.ColumnDefinitions>
        22.03.2000
        Something 2
      </Grid>
    </TreeViewItem.Header>
  </TreeViewItem>
</TreeView>

Note the attribute Grid.IsSharedSizeScope="True" in the TreeView and the SharedSizeGroup="A" in the Column Definitions


text:
Q: is there a way to copy behavior of a function into another in C++? struct Vec{
    int x;
    int y;
    Vec operator+(const Vec &v){
        x+=v.x;     y+=v.y;
        return *this;
    }
    Vec Vec::operator+=(const Vec &v){
        x+=v.x;     y+=v.y;
        return *this;
    }
};
ostream& operator<<(ostream &out, const Vec &v){
    return out << "x : " << v.x << "\ny : " << v.y << "\n";
}

my + and += operator have same behavior how can I avoid redefinition?