text:
Q: What does "Kalipedia" mean?
Kalipedia, he prophesied, would soon be generally adopted..
   - James Joyce, Ulysses

I cannot find any information about this word! It doesn't help that there appears to be a Spanish online encyclopedia of the same name. What does Kalipedia mean in this context? It sounds as if it's an ideology or way of doing things perhaps?

A: I offer another possible meaning. The Dictionary of the Spanish Royal Acamedy defines "calipedia" as such:
calipedia.
(Del gr. καλλιπαιδία).
1. f. Arte quimérica de procrear hijos hermosos.
Rough/literal translation:
(From the Greek καλλιπαιδία)
1. Chimeric art of procreating beautiful children.
In this sense the suffix -pedia refers not to education, but to children, as in "pediatrics".
Whether Joyce intended this meaning, I cannot know, but perhaps one of you can attest as to which one would be more likely, if not plausible.

A: Joyce is famous for his neologisms and Kalipedia is one such. The entire sentence reads:

Kalipedia, he prophesied, would soon be generally adopted and all the
  graces of life, genuinely good music, agreeable literature, light philosophy,
  instructive pictures, plastercast reproductions of the classical statues such as
  Venus and Apollo, artistic coloured photographs of prize babies, all these
  little attentions would enable ladies who were in a particular condition to pass the intervening months in a most enjoyable manner.

The word is constructed from the Greek kali (meaning beauty, as in calligraphy) and paedia (meaning education) and could be construed to mean education through beauty or perhaps enrichment through beauty. Joyce (or his character, Mr. Mulligan) very likely derived the word from the Greek phrase, Kalos kagathos:

Kalos kagathos (Ancient Greek καλὸς κἀγαθός [kalos kaːɡatʰǒs]), of which kalokagathia (καλοκαγαθία) is the derived noun, is a phrase used by classical Greek writers to describe an ideal of personal conduct, especially in a military context. Its use is attested since Herodotus and the classical period. The phrase is adjectival, composed of two adjectives, καλός ("beautiful") and ἀγαθός ("good" or "virtuous"), the second of which is combined by crasis with καί "and" to form κἀγαθός. Werner Jaeger summarizes it as "the chivalrous ideal of the complete human personality, harmonious in mind and body, foursquare in battle and speech, song and action".

A: Joyce (and the Spanish academy) spell it with one 'l' and not two - indicating that the word derives not from Greek κάλλος (beauty) but from καλός (good). And the rest of Joyce's paragraph is about "good" things not "beautiful".


text:
Q: What is a reasonable way to articulate in the question that answers need to revolve around the legacy language? When asking questions about legacy programming languages (in particular web based code) it seems that most often the majority of answers are basically "you should up date the code to a more modern language/framework". (This is one reason I have not asked more questions as my current job requires me to work almost exclusively in classic ASP, as well as I'm a complete idiot and humbled by the entire SO community and don't want to be thrashed for asking "silly" questions.)
While I understand that in some cases a valid answer is to update to a modern language/framework, there are situations where it is a requirement that the legacy code continue to be used.
Could there be some sort of short hand or a general understanding introduced so that most of the SO community, especially the major contributers who answer so many questions (which I greatly appreciate by the way) could ID these types of questions, therefore helping to ensure two things.

*

*Answers that are needed for specific legacy programming languages will be supplied as such, helping the asker out by having only relevant answers.

*Users looking to answer only questions about modern programming language/framework questions can know not to inject the answers so as to save themselves and the asker time.
Thanks,

A: I think this is one specific example of a more general rule:
If your question has an "obvious" answer which you can't use for some valid reason, state that in the question.
If any answer ignores that part of the question, downvote it. The possible grey area would be when an answer explains why your restriction makes the question impossible to answer, or when it suggests a way of working round your original reason for avoiding the obvious answer.

A: I think you might need a two-fold approach:

*

*Tag it with "legacy" or "legacy-code" so it's a bit more obvious on the main page.

*Just put a sentence at the top of the question (and perhaps bottom as well!) stating that you can't rewrite the application at this stage. The fact that you're never going to rewrite it needn't be mentioned :)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Transfer JSON data to Heroku Rails application I am quite new to Rails and noticed that none of my data from my local environment was being pushed to the Heroku environment using the heroku run rake db:migrate command.In particular I was wondering how to transfer the JSON data to the Heroku environment.
Gem File:
source 'https://rubygems.org'

gem 'figaro'
gem 'angular-rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-script', '~> 2.2.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
gem 'rails_12factor', group: :production

end

/config/environments/production.rb:
Rails.application.configure do

  config.cache_classes = true

  config.eager_load = true

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?

  config.assets.js_compressor = :uglifier

  config.assets.compile = true

  config.assets.digest = true

  config.log_level = :debug

  config.i18n.fallbacks = true

  config.active_support.deprecation = :notify

  config.log_formatter = ::Logger::Formatter.new

  config.active_record.dump_schema_after_migration = false

  config.action_mailer.delivery_method = :smtp
end

Angular Controller:
myApp.controller("BlogController", function($scope, $http){
  $http.get('/assets/blogs.json').success(function(data){
    $scope.blogs = data;

    String.prototype.trunc = String.prototype.trunc ||
      function(n){
      // this will return a substring and
      // if its larger than 'n' then truncate and append '...' to the string and return it.
      // if its less than 'n' then return the 'string'
      return this.length>n ? this.substr(0,n-1)+'...' : this;
    };

  });
});

I am also receiving the following error in my console for the deployed environment: Error: Unknown provider: eProvider <- e

A: Changing the pattern of the AngularJs controller resolved the issue:
myApp.controller("BlogController", ['$scope', '$http', function($scope, $http){
  $http.get('/assets/blogs.json').success(function(data){
    $scope.blogs = data;

    String.prototype.trunc = String.prototype.trunc ||
      function(n){
      // this will return a substring and
      // if its larger than 'n' then truncate and append '...' to the string and return it.
      // if its less than 'n' then return the 'string'
      return this.length>n ? this.substr(0,n-1)+'...' : this;
    };

  });
}]);


text:
Q: Trying to get only the text between two strong tags I am currently trying to get only the HTML text (a list of names) that is between the first two occurrences of the strong tag.
Here is a short example of the HTML I scraped

Title of Article

Section Header 1

A paragraph with some information and footnotes1

PRESENT:

John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher

George Jungle, Savage

....
....
....

William, Baller

Roy Williams, Coach

Section Header 2

A second paragraph with lots of text and footnotes

....
....
....
....
....

Hers is some quick code that I wrote with the basic logic of counting the number of strong tags occurring. I know after the second occurrence all the names that I want have been collected
html = requests.get('https://www.somewebsite.com')
soup = BS(html.text, 'html.parser')

#Pull only the HTML from the article that I am interested in
notes = soup.find('div', attrs = {'id' : 'article'})

# Define a function to print true if a string contains
def findstrong(i):
    return "" in i

# initialize a value for strong, after the second strong I know all the
# names I am interested in have been collected
strong_counts = 0

list_of_names = []
for i in range(len(notes)):

    if strong_counts < 2:

        note = notes.contents[i]
        #make note string so we can use the findstrong function
        note_2_str = str(note)

        if findstrong(note_2_str) == False:
            list_of_names.append(note)
        else:
            strong_counts += 1

The loop works and collects all the text before the first strong tag and everything after up until the next occurrence of the strong tag. i.e.

Title of Article

A paragraph with some information and footnotes1

PRESENT:

John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher

George Jungle, Savage

....
....
....

William, Baller

Roy Williams, Coach

This basically does what I want, but I lose some of the functionality of a BeautifulSoup object since it is now a list. Is there a BeautifulSoup function that can help me do this or another option? Or should I focus on making this loop more efficient before I scale it up to multiple articles?

A: Based on assumptions of contains strings being present for use e.g. PRESENT:. Produces list of names (names residing with p elements). Requires bs 4.7.1 +
from bs4 import BeautifulSoup as bs

html = '''

Title of Article

Section Header 1

A paragraph with some information and footnotes1

PRESENT:

John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher

George Jungle, Savage

William, Baller

Roy Williams, Coach

Section Header 2

A second paragraph with lots of text and footnotes

Other
'''

soup = bs(html, 'lxml')
select_html = soup.select('p:contains("PRESENT:") ~ p:not(p:contains("Section Header 2") ~ p, p:contains("Section Header 2"))')
l = [y for x in [i.text.split('\n') for i in select_html] for y in x]
print(l)

A: Based on the title Trying to get only the text between two strong tags if this is truly what is wanted, you can use something like what is found below. We utilize CSS level 4 :has() to test that an element contains certain elements, we use CSS level :nth-child(x of s) to target a certain instance of a compound selector type (in our case 1st and 2nd p tag with a strong tag).

*

*https://facelessuser.github.io/soupsieve/selectors/#:nth-child

*https://facelessuser.github.io/soupsieve/selectors/#has
from bs4 import BeautifulSoup

html = '''

Title of Article

Section Header 1

A paragraph with some information and footnotes1

PRESENT:

John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher

George Jungle, Savage

....
....
....

William, Baller

Roy Williams, Coach

Section Header 2

A second paragraph with lots of text and footnotes

....
....
....
....
....
'''

soup = BeautifulSoup(html, 'html.parser')
print(soup.select('p:nth-child(1 of :has(strong)) ~ *:has(~ p:nth-child(2 of :has(strong)))'))

Output:
[
A paragraph with some information and footnotes1
,
PRESENT:
,
John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher
,
George Jungle, Savage
,
William, Baller
,
Roy Williams, Coach
]

If we really want just the list of names though, we'd change the selector to start collecting elements after the paragraph that contains PRESENT::

*

*https://facelessuser.github.io/soupsieve/selectors/#:contains
soup.select('p:contains("PRESENT:") ~ *:has(~ p:nth-child(2 of :has(strong)))')

Output:
[
John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher
,
George Jungle, Savage
,
William, Baller
,
Roy Williams, Coach
]

At that point you can just extract the content you want.

A: To answer the question as is, leaving the opportunity to scrape the "Title of Article" and "Footnotes". You can use findChildren() then decompose() to remove unwanted elements. From the output of this code you can extract the data you need quite easily. It works even if the text "PRESENT" and "Section Header" are not present. It can easily be adapted to remove elements before the first "Strong" tag if needed.
from bs4 import BeautifulSoup, element

html = """

 blah blah

Title of Article

Section Header 1

A paragraph with some information and footnotes1

PRESENT:

John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher

George Jungle, Savage

William, Baller

Roy Williams, Coach

Section Header 2

A second paragraph with lots of text and footnotes

 blah blah

"""

soup = BeautifulSoup(html, 'html.parser')
# Pull only the HTML from the article that I am interested in
notes = soup.find('div', attrs = {'id' : 'article'})
counter = 0
# Iterate over children.
for i in notes.findChildren():
    if i.name == "strong":
        counter += 1
        if counter == 2:
            i.parent.decompose()  # Remove the second Strong tag's parent.
    if counter > 1:  # Remove all tags after second Strong tag.
        if isinstance(i, element.Tag):
            i.decompose()
print(notes)

Outputs:

Title of Article

Section Header 1

A paragraph with some information and footnotes1

PRESENT:

John Smith, Farmer

William Dud, Bum

Luke Brain, Terrible Singer

Charles Evans, Doctor

Stanley Fish, Fisher

George Jungle, Savage

William, Baller

Roy Williams, Coach


text:
Q: Error in set_user_by_token.rb in deviseTokenAuth Using DeviseTokenAuth for authentication in rails api.It gives error in update
user
NoMethodError (undefined method `enable_standard_devise_support' for DeviseTokenAuth:Module):
app/controllers/devise_token_auth/concerns/set_user_by_token.rb:35:in `set_user_by_token'

On this line
if DeviseTokenAuth.enable_standard_devise_support
devise_warden_user = warden.user(rc.to_s.underscore.to_sym)
 if devise_warden_user && devise_warden_user.tokens[@client_id].nil?
 @used_auth_by_token = false
 @resource = devise_warden_user
 @resource.create_new_auth_token
 end
end

Routes is
namespace :api, defaults: {format: 'json'} do

  mount_devise_token_auth_for 'User', at: '/auth'
  resources :users

end
DeviseTokenAuth.setup do |config|
   #everything is in comments there
end


text:
Q: How do I debug this error: CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER? I am getting an error in my app that I have no idea of how to figure out, has anyone seen this before:
#   Binary Image Name   Address Symbol
0   RepZio  0x002bd302  testflight_backtrace
1   RepZio  0x002bc996  TFSignalHandler
2   libsystem_platform.dylib    0x39ce0062  _sigtramp
3   CoreFoundation  0x2edde118  __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
4   CoreFoundation  0x2ed52256  _CFXNotificationPost
5   Foundation  0x2f737c2c  -[NSNotificationCenter postNotificationName:object:userInfo:]
6   Foundation  0x2f73c50a  -[NSNotificationCenter postNotificationName:object:]
7   UIKit   0x3180b2cc  -[UIApplication _performMemoryWarning]
8   libdispatch.dylib   0x39ba0d06  _dispatch_client_callout
9   libdispatch.dylib   0x39ba9802  _dispatch_source_invoke$VARIANT$mp
10  libdispatch.dylib   0x39ba773c  _dispatch_main_queue_callback_4CF$VARIANT$mp
11  CoreFoundation  0x2ede6818  __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
12  CoreFoundation  0x2ede50ec  __CFRunLoopRun
13  CoreFoundation  0x2ed4fc26  CFRunLoopRunSpecific
14  CoreFoundation  0x2ed4fa0a  CFRunLoopRunInMode
15  GraphicsServices    0x33a50282  GSEventRunModal
16  UIKit   0x315f3048  UIApplicationMain
17  MyAppName   0x00109afa  main in main.m on Line 15
18  libdyld.dylib   0x39bc5ab6  start

Lost on this one.

A: I know it's old question, but maybe I will help to someone.
In my case the same crash occurred when NSTextField in NSTableViewCell was in editing mode and user tried to select value from combobox outside of tableView without finishing editing. And the same CFNOTIFICATIONCENTER_... crash was on line [tableView reloadData].
So, my way to resolve crash was to put [self.window makeFirstResponder:nil] before reloading the table.

A: Make sure you remove all notification observers before freeing them. This problem occurs when an observer is freed and notification center has still a pointer to that object and tries to notify it. Check that all addObserver have the corresponding removeObserver calls.


text:
Q: Redirect to a url for facebook like I have a page for like grap meta tags.
<!DOCTYPE html>
<html>
    <head>
        <title>@Model.Title</title>
        <meta property="og:title" content="@Model.Title"/>
        <meta property="og:image" content="@Model.Image"/>
        <meta property="og:url" content="@Model.Url"/>
        <meta property="og:description" content="@Model.Description"/>
        <meta property="fb:app_id" content="@Model.AppId"/>

    </head>
    <body>
    </body>
</html>

Also i have a property RedirectUrl which when user click to link should redirected to.
How could I do in this page? Because this page is done just for meta tags. I want take user to another page when click to liked url?

A: <meta http-equiv="refresh" content='0; url=@Request.QueryString["ReturnUrl"]' />

Or use js and document.location.


text:
Q: How do i change directories on command prompt in runtime and then run another process? I have this code:
var process = new System.Diagnostics.Process();
var startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C copy /b Image1.jpg + Archive.rar Image2.jpg";
process.StartInfo = startInfo;
process.Start();

This will open/run the cmd.exe will hide the window and do the Arguments.
What i want to do is that it will run the cmd.exe then will go to:
D:\pipetest\pipetest\ffmpegx86

Will do another Arguments:
"rem ffmpeg -f rawvideo -pix_fmt rgb24 -video_size 1280x720 -i \\.\pipe\mytestpipe -map 0 -c:v libx264 -r 25 out.avi"

Then it will make the command start the process name: Run
I mean after it will make the arguments it will make Run like i'm typing Run and enter in the command prompt window.
How can i do it ?

A: Run one process, then the other, or put the various commands you need to run in a batch file, and then run that.


text:
Q: GCC 11.2 from Ubuntu 21.10 and version in Compiler Explorer yield different output for a C-string used as a collection for iteration I'm getting two different results from GCC 11.2, one from Ubuntu 21.10 and the other from the version in Compiler Explorer.
The sample is an adaptation from Nicolai Josuttis' book, C++20 - The Complete Guide.
The issue is that with Ubuntu, when I pass a C string, both the lambda and the function emit a non-printable character for the null terminator, but that's not the case when I run the same program in Compiler Explore.
My assumption is that the version in Compiler Explorer is the correct one, but cannot determine why the issue is present in Ubuntu.
Here's the code:
#include <iostream>
#include <vector>

void print_collection_cpp20(const auto& collection) {
    for (const auto& element : collection) {
        std::cout << element << '\n';
    }
}

int main() {
    auto print_collection = [](const auto& collection) {
        for (const auto& element : collection) {
            std::cout << element << '\n';
        }
    };

    print_collection("Hello"); // This is the deal breaker
    print_collection(std::string{"Hello"});

    print_collection_cpp20("HelloCpp20"); // and this one, too
    print_collection_cpp20(std::string{"HelloCpp20"});

    return 0;
}

The compiler version in Ubuntu 21.10 is as follows:
ubuntu1:$ gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The output of the program is just the letters followed by a new line.  In Ubuntu you'll see that there's an "extra" blank space--non-printable character that separates the output. If you use an IDE such as IntelliJIDEA, you'll see the rectangle that indicates a non-printable character.
If you have an idea of what's going on, please chime in.


text:
Q: col-md-4 overlapping on mobile I have a contact section on the site, this section should contain columns, as the site is divided into 12 I used col-md-4, but in mobile it simply stands one on top of the other.
How are you doing.

And I'm trying to leave it this way.

HTML

Entre em contato com a gente:

 51 99999999

51 999999999

51 999999999

Rua XXXXX

XXXXXXXX/RS

CEP xxxx-xxx

CSS
.third-section{
 margin-top: 10%;
 margin-bottom: 5%;
 padding-left: 35%;
 padding-right: 30%;

 .phone{
 img{
 margin-right: 3px;
 margin-bottom: 20px;
 height: 20px;
}
.resd{
  margin-left: 23px;
}
 }
 h4{
 font-size: 1.6em;
 color: #77D3C2;
 }
 p{
 font-size: 1.2em;
 line-height: 1em;
 color: #999999
 }
 }

A: The easiest way to achieve this would be to manually specify that each part should take up four columns on a smaller device, by adding .col-sm-4 to each of the elements.
Note that this will, however, cause a horizontal overlap in your example due to having such a large amount of content in such a confined space. To rememedy this, I've changed the .third-section horizontal padding to only be 3%, but you may want to accommodate for this in a different way in the actual layout.

.third-section {
  margin-top: 10%;
  margin-bottom: 5%;
  padding-left: 3%;
  padding-right: 3%;
  /*padding-left: 35%; */
  /* padding-right: 30%; */
}

.third-section .phone img {
  margin-right: 3px;
  margin-bottom: 20px;
  height: 20px;
}

.third-section .phone .resd {
  margin-left: 23px;
}

.third-section h4 {
  font-size: 1.6em;
  color: #77D3C2;
}

.third-section p {
  font-size: 1.2em;
  line-height: 1em;
  color: #999999;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

Entre em contato com a gente:

 51 99999999

51 999999999

51 999999999

Rua XXXXX

XXXXXXXX/RS

CEP xxxx-xxx


text:
Q: How to make ruby loops wait for 15 min after each 300 element? I want to make ruby script that will print all followers for any account, but twitters API will gife me an error (too many requests) after 300 printed follower, how can i make loop to print the frist 300 then wait for 15 min then to start where its done to another 300?

A: you can do it like:
some_variable = 0
loop do
  #**your code that puts element **
  some_variable += 1
  sleep(15*60) if (some_variable % 300).zero?
end


text:
Q: Are there ways to get modulated values similar to cyclic and negacyclic convolutions? The Wikipedia article on the Schönhage–Strassen algorithm states that there are methods that can get values modulo $a^n+1$ or $a^n-1$ for some value $a$.  More specifically, it shows that the cyclic convolution yields values modulo $a^n-1$ and that the negacyclic convolution yields values modulo $a^n+1$.
Are there other similar methods of transforming values into different moduli?  I'm wondering if there are similar methods to those in the above links that can get products of something like values modulo $a^n+2$ or even modulo $a^n+c$ for some $c$.


text:
Q: How do I execute multiple firebase uploads and wait for the collective results I am playing around with Firebase Storage baked into an photo collection app that takes a collection of photos and uploads them to a firebase storage backend. I want to upload multiple photos and wait for all tasks to finish, collect the download urls and proceed to the next step. Here is my code below
    public void saveImageData() {
    Incident incident = new Incident();
    final ArrayList<Uri> downloadUris = new ArrayList<>();

    StorageReference storageRef = storage.getReferenceFromUrl(Constants.FIREBASE_URL);
    for (Uri uri : imageUris) {
        StorageReference imagesRef = storageRef.child("images/" + uri.getLastPathSegment());
        uploadTask = imagesRef.putFile(uri);
        uploadTask.addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                downloadUris.add(taskSnapshot.getDownloadUrl());
                Log.e(TAG, "Size of data: " + downloadUris.size());
            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception e) {

            }
        });
    }
}

I would like for all the uris to be collected and use the results stored in downloadUris. As I type this I realise this may not be a firebase issue but understanding how to wait for parallel tasks to finish executing and proceed with the results. How can I achieve this objective?
Thanks

A: The Play services Task API actually powers much of the Firebase client side asynchronous APIs, such as Firebase Storage file uploads.  That UploadTask you have is a subclass of the standard Task that accepts success and failure listeners, as you're doing it now.
If you're dealing with multiple concurrent uploads and wish to know when all of them are complete, you can use the Tasks utility class which has a whenAll() method that accepts multiple Task objects.  That method will return a new Task where you can register additional success and failure listeners.  The success listener will be called as soon as all the Tasks are complete, and the failure listener will be called if and when any of the tasks fail.
You can register listeners both on the individual tasks, and also on the composite task returned from Tasks.whenAll().
(Also, stay tuned of an upcoming blog series about the use of the Task API with various Firebase features.)


text:
Q: Nginx If-Modified-Since sometimes is ignored Css files are picked from the cache, so i have to manually edit file version style.css?v=2 for example, to force cache reset.
On my PC everything is ok, but many people telling, that they have old logo or old design stuff from the last version of css file. Meaning they are taken from the cache.
How to fix this via nginx?
I'm already thinking about solution to dynamically append modify time to all css files like this style.css?v=%last file modify time%
The only caching thing inside my nginx conf is this line:
expires 1y;

A: When modified is omitted expires will allow the browser to cache a file based on the request time. Read the mod_header documentation for all the details.


text:
Q: Suggestions for Winter Bash 2017 Winter Bash 2016 is not over yet (it started later than usual this year and will end later than usual), but after noticing that the corresponding versions of this question for Winter Bash 2015 and Winter Bash 2014 were posted on Jan 4 2016 and Jan 4 2015 respectively,  I figured it would be fitting to post this year's version on Jan 4 2017.
Please post your suggestions regarding how to make Winter Bash 2017 even more fun than Winter Bash 2016.

*

*New suggestions for hats and hat triggers (either regular or secret ones)

*Which hats should be kept?

*Which hats should be retired?

*Do we want more secret Hats?

*Do we want more secret hats that don't get triggered until long after the start of Winter Bash?

Let's keep the traditional format of one suggestion per answer, so people can vote on individual suggestions.
See also: Winter Bash wrap-up on the SO blog

A: When choosing hat to wear, let us choose on which sites to wear it, instead of just choosing between current site and all sites.

A: Change the colors!
Hats are usually distinguishable by their shapes only, without the need of colors due to their... well... distinctive shapes.

Take my current hat, "Like Clockwork", as an example. You know that it's "Like Clockwork" (or at least not any other hat) due to its simple shape and the clock gear. For my profile, black is suitable but I prefer blue! Changing the color to blue or any basic colors (red, green, yellow, white, etc.) shouldn't be that hard and would add a much more fun spectrum (sorry for the science pun) to hats!
To clarify, let us change the color of the the hat manually.

A: Keep cross-site hats
This year there were two hats, Polymath and Running Ragged, for non-trivial participation on multiple sites.  A few years ago there was a hat for asking (or answering?) on a new-to-you site at some score threshold (don't remember the details).  Hats like these encourage breadth, which is good -- Stack Exchange has more than 160 sites, with new ones being added all the time.  It's easy to lose track of other great sites on the network, either because we didn't even know about them or because we used to participate there and gradually lost touch.
So let's keep doing something along these lines.  It should be more than "show up and vote once", and it should encourage contributing to the core Q&A.  I don't think a hat for, say, reviewing on three different sites would be as valuable as one for providing good questions or answers.

A: Make the hat notifications less spammy
With the large number of "post or vote on ..." hats this year, the blue dot in my top bar stayed pretty much constantly lit.
I just counted, and it seems I managed to earn Where in the World? 22 times, Bûche de Noël 18 times, I Have A Little Dreidel 43 times, Mmmm Bacon 16 times, Epiphany 6 times, and Just Here for the Hat a total of 50(!) times.  I'm sure the same thing happened to other people who have accounts on multiple SE sites and like to browser the Hot Network Questions sidebar for interesting questions.
There were a couple of points where I was really close to clicking the "I hate hats" link just to get rid of the annoying notification.
For next year, I have a request: please only light up the notification icon for new hats, not for the ones that I've already earned on some other site.
Finding out that you've finally managed to hit the rep cap three times in a row is awesome, and deserves a notification.  Finding out that you've clicked the upvote button on yet another site during the solstice / Christmas day / Chanukah / New Year's eve / etc. isn't, and doesn't.

A: Flip the hats!
The hats can only be rotated or moved. But for some avatars, the hat may look better (at discretion of the hat and avatar owner) if the hat was flipped over. This would make hat wearing so much cooler and make our avatars look even cooler (no Winter pun intended).
For example, take my current hat (Like Clockwork) on my Double 0-Minion avatar. The gear is next to the eye, but my Minion would look more spy-like with the gear over the eye. Only possible with hat flipping.

A: With 41 hats this year, I miss the '42'.*
This can be an universal hat, as 42 is the answer to everything, but I would like it to be for those who are not regulars on many sites.
A hat for the new guys/girls who have not learned all the tricks of the trade.
Maybe for getting to have 50 rep on a site, which will exclude all of us long term users who will get 100 extra on joining a new site. (Yes, that does exclude me.)
While it is not impossible for someone to start as 'new user' at the start of WB to also earn most or even all of the other hats, it would be very unlikely for someone to be able to get all hats, even less likely to win all on one site.
PS. For those who don't get it, 42 as in the Hitchhiker's Guide to the Galaxy by Douglas Adams.
*-It turns out there were 42 hats, the day and night hats counted as two separate ones. Still, I feel that there are not really 42 as the day/night were given for the same reason and at the same time.

A: Add a hat for finding duplicates
Can we have a hat that you get if you find, say 10, duplicates and the questions are successfully closed as a result of your 'possible duplicate suggestion'?
Note: this would only be awarded if you found the dupe, not if you voted to close as a dupe.
It would also be interesting to see some statistics next year relating to this hat if it was added. If it turns out that this has increased dupe finding, or made it quicker, maybe this could be considered into making a badge.

A: Badge Giver Hat
Being the one that, with an upvote, makes a question or answer to hit 10 (Nice Q/A), 25 (Good Q/A) or 100 (Great Q/A) score, hence giving a badge for someone.

A: Sportsmanship Hat
I'm a big fan of the sportsmanship badge.  It'd be nice to have a hat to honor those that are good sports and up vote competing answers.
Maybe something like. Up vote competing answer on five questions in which both your answer and the one up  voted have a positive score.

A: Don't bring Archimedes back
I haven't missed the secret hat for correctly guessing a secret hat.  There's still an appropriate amount of secret-hat research going on, but it's taking place in a more controlled environment and isn't generating as much angst, as far as I can tell.  That's a win.  Thanks!

A: Design request: hats, not masks
accessibility
The hats this year are really spiffy -- great job on the graphics!  But the "natural size" of some of them fills most of the user image, making it hard to tell people apart graphically.  These are all active users on the same site:

Yeah, they're all different because of what leaks out around the edges, but it turns out that's not enough to help me recognize individuals, particularly in chat.
The following two have been slightly enlarged by the users, but even at their natural sizes they hide a lot.  I've definitely seen other cases of these two at original sizes concealing identity:

It's possible to shrink and move them so you can still see who's under there, I know, but in my experience this is uncommon:

Other hats manage to be big or "full-featured" without hiding as much, like these two:

I know that user avatars are accompanied by names and we can just read the text, but the avatars help, more than I realized.  Can we design hats that let more show through while still having awesome art?

A: I would like to suggest
Stealing Hat
This hat would be awarded for answering a question that already has an accepted answer and having OP change the acceptance to the new answer.
Also, perhaps some other sort of bonus hat for receiving more upvotes than the original answer.  Just a thought.
I'm proposing that this stealing hat be called "The Steeler" and have the logo of the American Football team, the Pittsburgh Steelers.

I thought that the "Fiery" tag was really cool this year and I just thought that it would be cool to incorporate different logos and such.

A: Tag: You're It
Tag wikis don't get a lot of love.  Edits don't bump them anywhere, so when people do put effort into building them out it often goes unnoticed.  But good tag wikis benefit a site; there's only so much you can express in the 25 characters of a tag name or even the couple hundred characters of a tag summary.  The wiki itself is where you can provide more information, cross-reference related tags, link to canonical questions, and so on.  Not all tag wikis call for this treatment, but I suspect most sites have a few.  (Mine do.)
A hat for making a substantial edit to a tag wiki (including creating one) would remind people that this feature exists.  Since wikis can't be voted on I'm not sure how to set a quality threshold; obviously we don't want it to just be based on size or people will blather in pursuit of character count.  I don't have a good answer for this part.

A: Secret Hat For Editing a Hidden Gem "Question"
Similar to the description in the late answers review task but with a twist.
The hat would be earned for anyone who edited a -3 question which subsequently earned four upvotes.
First, it shows that LQQs can sometimes be drastically improved/saved with a good edit. Secondly, it's important that the edit is not done for egoistic purposes, e.g. wanting to post an answer on a question  that was deliberately "tailor-made". Lastly, if the editor upvotes the question, I don't find anything wrong with that. It just means they saw a potential gem hiding among the "garbage".

A: FINISH HIM1
A hat for dealing the killing blow (5th Close Vote) to a question.
While not an issue on main sites such as StackOverflow, other sites (e.g. WorldBuilding) often see questions getting much attention even though they do not fit the format and thus further encourage questions that are off-topic.
Such a hat would (hopefully) encourage people with enough reputation to more liberally apply their VTC rights.
1Him, Her, Them, It, Us, ...

A: Consolation Prize
A(nother) bounty-based hat idea. We had a hat this year for awarding a bounty on the final day, but what if you don't get an answer at all, or at least not anything worthy eligible for the automatic-bounty awarding? In other words:
What if the bounty expires with no winning answer?
According to the Help Page on Bounties:

If you do not award the bounty within 24 hours of the bounty period ending, half the bounty value will be automatically awarded to the top voted answer posted after the bounty start, provided it has a score of at least 2. If no new answer matches this requirement, no reputation will be awarded at all, and the reputation used on the bounty will be lost forever.

So the requirements for the badge would be:

Consolation Prize
Start a bounty in Winterbash that expires without a winning answer (not manually awarded and no answer >= 2 total score).

Why I think this hat would work well:

*

*Hard to game: Your can't just raise a bounty and then not award it. Other people's votes will ensure that at least some of the bounty is awarded to people that try to answer the question. You can also only raise 3 bounties per-site at one time, so the 'shotgun' approach won't work either.

*Semi-random: It's not something you can just work towards, like 'Edit 5 posts' or 'Close and Reopen' a question. It's a little bit luck-based (or unlucky if you consider the fact you didn't get an answer).

*The Spirit of Giving: Like all previous bounty hats, it rewards those who are willing to give and it helps get eyeballs and answers on questions.

*Low entry fee: You need 75 rep to raise a bounty, compared to 2000 for non-suggested editing hats or 3000 for closing/reopening hats.

This could also work well as a secret hat, making it harder to game.

A: Add hats for meta participation
We currently have what seems to be 1 hat ("I am Your Father") for meta participation. This seems really sad as this seems to encourage users to focus more about posting and other relevant actions on the main site. But meta is important to since it helps users deal with the inner problems with the site! Thus, I suggest hats for participating for meta. Two such hats would be:

*

*Answer three questions on meta, all accepted with positive score

*Ask three questions on meta, all with positive score
Since the activity and the importance of a post is debatable and not always represented by score, I also suggest:

*

*Participate in meta for five days

A: Add a general hat for starting (or awarding?) a bounty
We had a holiday bountapalooza on Worldbuilding as a kind of year-end celebration, and over two dozen questions received bounties totaling over 2,500 reputation points. It's not yet over, but it's been a huge success, and I think encouraging bounties would be fun and extremely productive for the site. Also, the idea of gift-giving fits in well with the various holidays that fall during Winter Bash, including Christmas and Hanukkah.
We did have a bounty-based hat this year (Philanthropist) for awarding a bounty on the last day of Winter Bash. Perhaps a more general one - or even one based on how large a bounty was placed - could attract more encouraged generosity.
Hat name suggestion: Boba Fett (in keeping with the Star Wars tradition).

A: Whether from a bug or not, I really liked how some of the hats were not available at the start of the WB. I'm not talking about just the "do X on the solstice" hat, or "vote on the 6th" hat.
Next year have hats without any specific date trigger, only available starting X days after the bash.
This would have a number of side effects:

*

*It would keep the bash lively all throughout, and everybody guessing

*It would stump secret hat guessers (me included)

*It would teach patience :)

Now without any Archimedes hat, this is a great way to have some of the secret hats, especially the easier ones.

A: Keep hats for reviewing old contributions.
This was one of the most beneficial features of this year's Winter Bash that old posts got some new attention: Answers, edits, resurrection of hidden gems, or closing of bad old posts long forgotten.

A: Community Hats!
There is only one hat for the community participating, "Just Here for the Hat". Sure, 20 unique hats is pretty difficult, but the community should also earn hats together for other actions. I mean, a community is based on its actions as a whole rather than its individual users who top the leader boards in rep and probably hats.
Some ideas would be helpful since I'm a little stuck... but I'll put some that came out of my head:

*

*Earn 10,000 rep cumulatively (probably secret hat)

*Create five community wiki posts that have at least seven different contributors and a positive score

*Collect all non-secret hats (definitely a secret hat)

A: Viral hats
Seed a couple of these at random (or infect the CMs) then award them for up-voting someone who already has the hat.
Result: up-votes all around!

A: Inspired by this earlier post
Change the "Maverick" from a non-secret to a secret hat.
As we've seen some concerns about the behaviour triggered by the criteria of this particular hat, maybe the criteria can be slightly modified (the present criteria is already known) and the hat can be made a "secret" hat. This way

*

*The possibility of alleged "gaming" the system would be less.

*There would not be much space for doubting the actual quality of the Q/A.

A: Selfless / Mask of Zorro "Hat"

*

*Edit an answer to a question where your own answer already got accepted; this answer should already have two upvotes when you edit it.

*The answer you improved becomes the new "accepted answer".

This can be a secret hat but doesn't need to be.

A: I would like to search for users who wear a specific hat.
The reason: when I wear hats, I will consider how I wear hats. In that case, if I could search them, I could use the results as reference. I may be able to consider how to wear hats entertainingly.

A: Community driven hat designs.
We see it all the time. The SE network is community driven (not referring to the Community user).
Why not hold a contest on Graphic Design SE for users there to help create the 2017 WB hats?
There would have to be limitations and you would probably have it only for the normal (not secret) hats, but I think it would give us some fun designs.

A: Soften the "well-received" criteria to include "accepted answer"
Take for example the Lifesaver hat:

answer a question qualifying for the Tumbleweed badge that gets accepted

Many users get confused when their answer gets accepted but doesn't get the hat.
It's because of another requirement that's not spelled out, that the answer must have positive score, also known more generally as the "well-received" criteria.
The well-received criteria also appeared in the Polymath hat this year,
and it commonly appears in some hats every year.
It would be great if this criteria could be softened to include accepted answers with no votes (that is not the same thing as 0 score).

A: I would suggest
Site specific hats:
(of both secret and non secret variety (maybe two of each type?))
Stack Overflow had a site specific hat for documentation. It would be really cool if each site could have a super secret site themed hat decided upon by the moderators on that site.
For example, Math SE could have divide by zero hat, photography could have a cheese hat, etc.
There could also be a hat for getting X secret (or non secret) hats from different sites.
To those who think this is not feasible, the moderators of each site would make a secret hat and design the graphics (in SVG so that they can actually be displayed). Then the community could vote on non secret hat/hats, or the moderators could just choose those as well.

A: Add hats for moderation
We do have some hats for this like Abominable but there could be more. There should be hats for:

*

*Successfully taking down spam posts

*Having a certain number of accepted flags - may be secret due to comments

*Editing a lot of posts
This would encourage moderation within the community and with the "successful" part to discourage any random flagging, editing, or flagging for spam. Of course, Abominable should be kept since it deals with closing and deleting. And of course, over time to prevent an overload of reviews on the first day of WInterbash.

A: Include requirements in hat descriptions more precisely
Take for example the Lifesaver hat:

answer a question qualifying for the Tumbleweed badge that gets accepted

An important requirement was left out there, that the answer must reach a positive score, also known more generally as the "well-received" criteria.
This can be easily added without making the description too long.
Another example is 011:

collect 11 hats

It wasn't clear that 11 hats must be earned on one site.

On the other hand,
it's ok if the description is inaccurate when the real requirements are actually softer. For example all the date-specific hats are awarded within ±12 hours of the date itself, but nobody minds this wasn't mentioned,
as receiving hats unexpectedly is always a pleasant surprise.

A: Add a "viral" hat
The general idea would be to create a post associated with one created by either someone with the hat or an arbitrary "starter" user(s) (this will need some thought). I was thinking these criteria:

*

*post is an answer to a question made by the user with the hat/starter or a question answered by someone with the hat/starter

*post reaches a score of 5 or more

*one or both posts were created during Winter Bash

This would actually encourage users to pay it forward, because the hat can be earned by answering questions, and would reward you with extra attention to your questions.

A: Add a hat for consistent voting
Unless I'm missing the point of one or more secret hats, it seems that this year the only hats that rewarded voting have been "Cutting the cord" and the various general participation hats (vote or post: Buche de Noel, Epiphany, I Have a Little Dreidel).
Thus I'd suggest a hat that rewards users for voting (i.e., upvotes and downvotes) throughout the winter bash.  For example:

*

*Vote five times on posts, on each of ten distinct days

*Vote ten times on posts, on each of five distinct days

I envision these sorts of criteria encouraging a responsible voting habit, which plenty of sites would benefit from.

A: Time is hard, part 2
In an early Winterbash there was a hat for chatting at the turn of the year UTC, +/- something like 5-10 minutes.  That left people in some time zones out, unless they got up in the middle of their night (which at least one person did), and so in future years the time ranges on time-based hats were broadened.  This is why you could earn the "visit on the solstice" hat over about a 36-hour span -- when it was solstice anywhere in the world plus a buffer.
That's the background.  This year when I saw "Like Clockwork" show up I thought "hey, that's a cool-looking hat that I'd like to wear".  And I figured from the name that it had to do with consistent activity.  There are several sites that I'm active on on a daily basis, so I figured whatever the trigger was, I would probably bump into it.
But I didn't, because the hat had a time-constrained requirement on nine consecutive days.  As someone who observes Shabbat, that meant I couldn't satisfy the trigger one day a week.  So that was a bummer.
Shabbat-observant users are a very small proportion of the Stack Exchange community, of course, but it would be great if all hats were theoretically available to those who want to put in the effort.  If the range on this hat had been six days instead of nine days, the hat would have been harder for the Shabbat-observant to get, but not impossible.  ("First Responder" was harder for many of us too because of being on Saturday; that's fine.)  Or if a visit at any time in the day would have counted, then it would have been possible in most -- but not all -- time zones.  (It's possible to earn Fanatic on Mi Yodeya without violating Jewish law, but you have to choose your dates carefully.)
Again, I recognize that this is a specialized constraint, and -- dare I say it -- it's only a hat.  But I humbly request that, for hats that require participation on Saturdays, we try to be flexible.

A: Hats for review tasks

*

*Awarded when a user successfully passes a review audit.

or

*

*Awarded when a user completes a task (or a certain amount of tasks) in one of the review queues (and picked the same action as the community consensus).

If that would cause users to robo-review, I'd suggest to make it a secret hat.

A: Win a hat for having at least X hats on 3 different stack exchange sites
This could be a secret hat, in which case X should be lower - perhaps 5 hats on 3 different sites.
Or it could be a normal hat, in which case X should be higher - perhaps 10 or even 20 hats on 3 different sites (looking at my top 3 hat sites, I have 32/16/16 hats, so I would have made additional effort on two of those sites if we had such a hat with X = 20).
Most users get most of their hats on their single favorite site.
This would encourage users to participate and gain hats on multiple sites.
I'm not sure whether it should be the same X hats on each of the 3 sites, or different hats on different sites.

A: Allow us to wear multiple hats
I want to create hat mashups

A: Make it possible to distinguish hats earned on current site
This was requested in many previous years too.

A: Eatable hats
We had cupcakes in past and now taco, but why not some fruits as hat next year like pineapple hat or fruit basket/salad, or my own favorite Kiwi hat.
They can be triggered for helping new users, like editing their posts or upvoting them.

A: Keep site-specific hats but don't 'punish' users not on Stack Overflow
I really liked the idea of having hats that were awarded for participation across non-SO sites. I also thought 'wow, What's up, Doc? looks like a cool hat' before I realised it was SO only and I wasn't able to get it. Why? I'm not anywhere near a programming expert wouldn't want to attempt to look through sites and sites worth of Documentation just to find typos that I can fix by suggesting edits. If I visit SO, it's to search for answers and upvote what I found helpful. I'm sure I'm not alone.
That of course means that me not actively participating on SO (for a good reason) implicitly punished me in the overall network-wide hat leaderboard. My maximum possible hat count would have been 39 rather than 41.
Instead, I suggest tying each SO-specific hat to a non-SO-specific hat and counting them as 1 achieved hat. This is already the case for all the other hats: even if you win them on all sites you frequent it will only count once for the leaderboard. Why should the SO-specific hats (and their non-SO counterparts) be any different?

A: Give us a site to test the hats.
Don't get rid of secret hats, just give us a place to test them. If we had a site for testing, such as Winter Bash 2017 Secret Hat Testing site, that would remove soul-selling for hats.
The only downside would be that we can't test secret hats on old questions here. But I think it's worth it for any other triggers.

A: I am seeing a hat for nearly every feature, like editing 5 old questions (Werewolf Hunter), cleaning up comments after post owner edit (It's a me), removing 10 unnecessary comments from 2017 (This is Fine), Vote 7 times from app (Too cool), etc.
Should we have one for cleaning up downvotes, which should be removed when post owner edited legitimately? As the downvoter won't get notification as he didn't comment (if I am not wrong) and the owner cannot ping the downvoter to get revision?
This will motivate someone to revisit & revert their downvotes.

A: A hat for spending the holidays off the network
This year we had a hat for posting something on the chat on the New Year.
What about having a hat for spending some of the holidays off the network/site.
E.g. a hat that would be awarded to someone that spends at least 3 consecutive days without logging into (any) Stackexchange site?

How to award this hat:
UserXYZ is online on day 1. They are then offline for days 2, 3 and 4. They come online again on day 5 and get the hat.

A: What is my hat rank?
At the moment, you can go to the hat leader boards and see who has the most hats. But I can't see what my rank is. Sure there is a number that I get, but there a bunch of other people with that number also. Why?
I am not sure how that ranking works on the hat leaderboards, but I think it would be better to have the leaderboard work like the site wide rep leaderboard. With everyone getting their own rank.
Update:
I now know how the leaderboards work. Should we make it so ranks are first come first serve? That way we only have one user for each rank.

A: Make the hunt for secret hats bit easier
Give the names of all secret hats in advance, either in the blog annoucement or in the Winterbash site itself. No clues, just the names.
At least for me, if I would hunt for secret hats, knowing the names before someone else get them first would also be an incentive.


text:
Q: Problem with checkbox and database in tkinter I tried to save the checkbox through "INSERT INTO", but after the .get () method is triggered, zero is constantly written to the database, how I can solve this problem?
When starting the program, it writes two zeros to the variable, although if the checkbox is active, one must be written.
Code:
var1 = IntVar()

c1 = Checkbutton(text="First", variable=var1, onvalue=1, offvalue=0)

c1.pack(anchor=W)

var2 = IntVar()

c2 = Checkbutton(text="Second", variable=var2, onvalue=1, offvalue=0)

c2.pack(anchor=W)

conn = sqlite3.connect("MyDB.db")

cursor = conn.cursor()

conn.execute("INSERT INTO TestDB VALUES (:var1, :var2)", {'var1': var1.get(), 'var2': var2.get()})

conn.commit()

conn.close()

No console errors. Values into DB(zero, in any case, it doesn't matter if the checkbox is active or not) - https://ibb.co/B6jBDTV

A: I make a function that will get variable of checkbox and function that write this variable into my DB, this is code:
root = Tk()
root.title("getcheck")
root.geometry("350x250")

def create_DB():
    conn = sqlite3.connect("MyDB.db")
    cursor = conn.cursor()
    conn.execute("""CREATE TABLE IF NOT EXISTS TestDB (var1 integer, var2 integer)""")
    conn.commit()
    conn.close()

def get_var():
    conn = sqlite3.connect("MyDB.db")
    cursor = conn.cursor()
    conn.execute("INSERT INTO TestDB VALUES (:var1, :var2)", {'var1': var1.get(), 'var2': var2.get()})
    conn.commit()
    conn.close()

btn = Button(root, text = "create_db", command = create_DB).pack(anchor = W)
btn1 = Button(root, text = "get value", command = get_var).pack(anchor = W)

var1 = IntVar()
Checkbutton(root, text = "first var", variable = var1).place(x = 75,y = 1)

var2 = IntVar()
Checkbutton(root, text = "second var", variable = var2).place(x = 120, y = 28)

root.mainloop()

A: It seems you need a decent initialization.
For this, you can initialize the value for Checkbutton by ChkVar = []
And then consider setting :
for i in range(0,2):
    ChkVar.append(0)

ChkVar[0] = IntVar(value=ChkVar[0])
ChkVar[1] = IntVar(value=ChkVar[1])

If you want your Checkbutton item should be unchecked at the beginning, use
Checkbutton(text="First", variable=ChkVar[0]),
otherwise Checkbutton(text="Second", variable=ChkVar[1])
Note that, we removed , onvalue=1, offvalue=0 part in this method.
And lastly ( assuming your Checkbuttons is unchecked at the beginning ),
Rearrange your INSERT Statement as
conn.execute("INSERT INTO TestDB VALUES (:var1, :var2)", {'var1': ChkVar[0].get(), 'var2': ChkVar[1].get()})
Sample code depending on above Caveats:
from tkinter import *

wnd = Tk()

ChkVar = []

def printCb():
    print(ChkVar[0].get())
    print(ChkVar[1].get())

wnd.geometry('370x130')

renk_z="green"

wnd.resizable(width=False,height=False)

wnd.configure(background=renk_z)

for i in range(0,2):
    ChkVar.append(0)

ChkVar.append(1)
ChkVar[0] = IntVar(value=ChkVar[0])
ChkVar[1] = IntVar(value=ChkVar[1])
Checkbutton(wnd, text="First",bg=renk_z,variable=ChkVar[0]).grid(row=1,column=0,sticky=W)
Checkbutton(wnd, text="Second",bg=renk_z,variable=ChkVar[1]).grid(row=2,column=0,sticky=W)

Button(wnd,text="Print",width=5,command=printCb,bg=renk_z).grid(row=3,column=0,sticky=W)

#conn.execute("INSERT INTO TestDB VALUES (:var1, :var2)", {'var1': ChkVar[0].get(), 'var2': ChkVar[1].get()})

wnd.mainloop()

As you check/uncheck Check buttons and then press Print button you'll see the value of them are as printed. You can use those values by activating commented part which is related to interaction with the database.


text:
Q: Razor 2 to Razor 3 MVC 5 I've been working on an MVC 4 solution, and I've been trying to upgrade it to MVC 5. I've followed the steps outlined here.
I've followed it, and now whenever I run the MVC Application, it gives me this error message:
[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to
[B]System.Web.WebPages.Razor.Configuration.HostSection.

Type A originates from
'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location
'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'.
Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location
'C:\Users\User\AppData\Local\Temp\Temporary ASP.NET
Files\root\665ac028\de53a189\assembly\dl3\c2c0a4b5\56e8099e_40e0ce01\System.Web.WebPages.Razor.dll'.

Does anyone know how this could have originated? or how it can be solved? I've looked around thus far? I've tried changing the web.config files, with no avail...

A: In your Web.config(-s) make sure assemblyBinding contains the proper version for the assembly System.Web.WebPages.Razor and System.Web.Mvc.
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
  </dependentAssembly>

  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

And make sure that razor sectionGroup in ConfigSections reference latest versions as well:
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

</sectionGroup>

A: Check for version in web.config. If it again gives an error, try to clean the solution and rebuild it. Also check for project's Bin folder, removes old references from bin folder and rebuild the project solution.

A: Looks like you still have a reference to Razor 2.0 dll.
Check your project references' properties - especially 'Use specific version' one.


text:
Q: Scaling up a Kafka streams application deployment in Kubernetes using helm We have a Java based kafka streams application which is deployed to a kubernetes cluster using helm charts. For scaling up the deployment we are using the Kubernetes option of replica sets which will run multiple instances of the app. But running multiple instances of the app keeps crashing the pods with the error below.
Exception in thread "****-StreamThread-1" org.apache.kafka.common.errors.FencedInstanceIdException: The broker rejected this static consumer since another consumer with the same group.instance.id has registered with a different member.id.

A: Too much of your config is static.
As per documentation:
group.instance.id
A unique identifier of the consumer instance provided by the end user. Only non-empty strings are permitted. If set, the consumer is treated as a static member, which means that only one instance with this ID is allowed in the consumer group at any time.

It looks like different instances of your application should have different group.instance.id.
In the end, it's not related to k8, helm or anything - and you should be capable of replicating it by starting multiple instances of your application on your local machine, all of them pointing to the same Kafka installation.


text:
Q: Is it possible to create this animation using particles.js I've been trying to make an animation similar to this but all I was able to achieve so far using particles.js is this.
Basically I was unable to make the shapes look like spheres and the interaction element itself is very lacking. So I'm just wondering If I can actually use particles.js for this, or if there's a much better or easier option.
JavaScript:
 particlesJS("particles-js", {
  particles: {
    number: {
      value: 147,
      density: { enable: true, value_area: 946.9771699587272 }
    },
    color: { value: "#017185" },
    shape: {
      type: "circle",
      stroke: { width: 0, color: "#000000" },
      polygon: { nb_sides: 3 },
      image: { src: "img/github.svg", width: 100, height: 100 }
    },
    opacity: {
      value: 1,
      random: false,
      anim: { enable: false, speed: 1, opacity_min: 0.1, sync: false }
    },
    size: {
      value: 15,
      random: false,
      anim: { enable: false, speed: 40, size_min: 0.1, sync: false }
    },
    line_linked: {
      enable: false,
      distance: 150,
      color: "#ffffff",
      opacity: 0.4,
      width: 1
    },
    move: {
      enable: true,
      speed: 6,
      direction: "none",
      random: false,
      straight: false,
      out_mode: "out",
      bounce: false,
      attract: { enable: false, rotateX: 600, rotateY: 1200 }
    }
  },
  interactivity: {
    detect_on: "canvas",
    events: {
      onhover: { enable: true, mode: "repulse" },
      onclick: { enable: true, mode: "push" },
      resize: true
    },
    modes: {
      grab: { distance: 400, line_linked: { opacity: 1 } },
      bubble: { distance: 400, size: 40, duration: 2, opacity: 8, speed: 3 },
      repulse: { distance: 200, duration: 0.4 },
      push: { particles_nb: 4 },
      remove: { particles_nb: 2 }
    }
  },
  retina_detect: true
});
var count_particles, stats, update;
stats = new Stats();
stats.setMode(0);
stats.domElement.style.position = "absolute";
stats.domElement.style.left = "0px";
stats.domElement.style.top = "0px";
document.body.appendChild(stats.domElement);
count_particles = document.querySelector(".js-count-particles");
update = function() {
  stats.begin();
  stats.end();
  if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array) {
    count_particles.innerText = window.pJSDom[0].pJS.particles.array.length;
  }
  requestAnimationFrame(update);
};
requestAnimationFrame(update);

A: As far as I know It's not possible with Particle.js
Check out Three js and its amazing features.
You can detect mouse event on particles such as bellow examples:

Waves
Points

Good luck


text:
Q: Como criar um armazenador de arquivos? Como faço para criar um armazenador de arquivos?
Exemplo:
A pessoa quer salvar um arquivo PDF no meu site, ai ela vai lá, clica no botão de enviar arquivo e fica salvo no meu sistema. E quando ela acessar, ela pode ir lá e baixar o arquivo que ela salvou.
Tipo agora, que fui colocar essa imagem na publicação...
Vai ser open, qualquer um que acessar vai poder fazer o download dos arquivos.


text:
Q: How to map co-ordinates from the image to a 2D surface I'm trying to map the badminton court coverage by a player. For detecting the player I used a faster RCNN deep learning model. It detects both the players.
I've also extracted their position from the bounding boxes using xmin and xmax coordinates. Now I'm planning to map the coordinates to a 2D map of a badminton court.

Value of bounding box coordinates of PB class are[ymin, xmin, ymax, xmax] [0.4867423, 0.38700044, 0.7571616, 0.45828968]

I've no clue where to start with.

A: Will take a more substantial look at this when work clears up, and edit accordingly, but for now my instinct is that you should try a combination of Hough Transform and Ransac to find the corners of the badminton court, perform a perspective transform to get a top view of the court, and use the transformation on the center of the bottom edge of your bounding box as the player coordinate in the transformed court view.
For an approach to finding and transforming the badminton court, this response might prove handy.
Edit 1:
It strikes me that, if the camera is fixed (which I imagine it may very well be), the need for Hough+RANSAC is extraneous. You can simply identify the coordinates of the four corners of the court by hand, and then use OpenCV to transform the image perspective and resize the image to the dimensions of a badminton court. I whipped up a short notebook to demonstrate how to do this.


text:
Q: Error in Query (Connected Hive with R Studio) I have connected Hive with R Studio (Shiny application). Trying to implement a query in R Studio. Below  is the query -
function (input){
    hadooptest <- paste("SELECT distinct(varid) FROM
                         staples_us.dfp_networkimpressions
                         where lineid = input")
}

So the input(numeric) is dynamic and coming from UI part of Shiny given by user.
It is showing me an error -

SemanticException [Error 10004]: Line 1:83 Invalid table alias or column reference 'input'

It seems that it is not recognizing the input while fetching data from Hive.

A: Change your code to:
function (input){
    hadooptest <- paste("SELECT distinct(varid) FROM
                         staples_us.dfp_networkimpressions
                         where lineid = ", input)
}


text:
Q: C# Remove x Number of Parent Directories from String I am reading several files from a directory and inserting their path into an array of strings like so:
string[] file_tree = Directory.GetFiles(Path.GetDirectoryName(file_path), "*.*", SearchOption.AllDirectories);

Each element in the array looks like:
C:\\filepath1\\filepath2\\filepath3\\filepath4\\file.txt

I would like them to end up looking like this:
\\filepath3\\filepath4\\file.txt

Note: In my case, the names of the parent directories (filepath1, filepath2, etc) are not always the same.
What is the most efficient way to remove the top X amount of parent directories?

A: int x = 2;
file_tree = file_tree.Select(a => string.Join("\\",a.Split('\\').Skip(x).ToArray())).ToArray();

Explanation:
a.Split('\\') splits the string by \\
.Skip(x) skips x element from it
string.Join("\\", result) joins the items in result with \\ and produce a string
file_tree.Select(a => ...) for each item (a) in the array selects the new produced string
Live Demo


text:
Q: If G is a simple 4-regular planar graph, is the maximum degree of a face 4? Are there any restrictions in general for Simple k-regular planar graphs?
Also is it possible for a face to have degree 1 or degree 2 in this case?
I assume that it could be possible for an isolated point but then the graph wouldn't be k-regular.

A: In a simple graph, a face can never have degree $1$ or $2$. (Degree-$1$ faces correspond to loops, and degree-$2$ faces correspond to multiple edges between the same pair of vertices. Neither of these is allowed in a simple graph.)
However, a face can have degree more than $4$, and this remains the case if the graph is $4$-regular. For example, consider the skeleton graph of the pentagonal antiprism. This is $4$-regular with $10$ vertices; it has $10$ faces of degree $3$ and $2$ faces of degree $5$. Here is a plane embedding:

Other antiprisms give us examples of $4$-regular planar graphs with faces that have arbitrarily many sides.


text:
Q: Add custom target to Android SDK and AVD Manager From the Android SDK and AVD Manager it is possible to add an extra Add-on Site URL.
I'd like to have some starting point or documentation about developing and distributing add-ons so I can distribute an SDK for my own target device.

A: I found a similar question that directed me to the platform/vendor/samples folder of the Android source. The samples folder also contains some documentation.


text:
Q: How to create a table like structure in drupal content type? I am almost there with this but cannot seem to get this functionality going as planned.
I am creating a questionnaire using drupal content type. What I am trying to do is to create a table like structure as below in content type. The second and third column contain check boxes  and first column data(i.e computer, internet) and first row(i.e Everyone have access , Nobody have access) are taxonomy terms . Is it possible to display like this in content type by using some modules in drupal? Anybody have any better suggestions?
|           | Everyone have access | Nobody have access |
---------------------------------------------------------
| Computers |           1          |         2          |
---------------------------------------------------------
| Internet  |           1          |         2          |
---------------------------------------------------------
| Fax       |           1          |         2          |
---------------------------------------------------------

A: You can use the Term Level Field module. This module provides a field type for referencing terms with a level to an entity.

A: You may use Editable fields with Views module. Of course, if you didn't need such a display (table forms) you should use Views Bulk Operations modules.
If you need to do this in a node use Tableform module. But if you want to show nodes whike editing a node it is the same. A node should not be used for tasks just for content.


text:
Q: Disabling WinAPI I'm building a game where each player must program his bot. The key idea is that the player will program in C (or C++, or whatever compatible language), build a DLL and send this DLL to the server, so that no one can get his code. The problem is: how to make sure that he is not calling any illegal function? Like creating files or opening a socket. The DLL will be loaded with LoadLibrary and a function will be called. All interaction will happen with callback functions. A possible solution would be placing a empty kernel32.dll (and others) so that all winapi calls will fail. Is this safe and works on every case? Is there a better way to do it?
Please note that the player thread (the one how called the dll) must still be able to comunicate with the game, maybe with an open socket. On Linux this can be easily done with seccomp.

A: This will not work without either fully analyzing all DLLs prior to loading them (which is basically impossible), or creating some sort of magic on the same level as seccomp. Given any measures you take to restrict their access, such as creating a dummy kernel32.dll, the user-submitted DLL can take countermeasures, such as loading DLLs you didn't consider, calling DLLs which were loaded by the host process (possibly via functions in the host application!), or submitting Windows system calls directly.
One option may be making use of the Windows security token functionality which Google Chrome uses to "sandbox" web renderer processes. This is incredibly arcane stuff, though, and it involves running the DLL in a separate process anyway. If you're still interested, you may want to read the Windows Chrome sandbox design documents. Keep in mind, though, that Google has spent an lot of development time getting the sandbox "right", and yet there have still been a couple of high-profile compromises -- the chances that you will be able to do the same on your own are slim, especially without extensive previous experience with Windows security.

A: Your best bet is to create a user with reduced privileges, which will allow you to control file access quite easily, and run the bot code in a sub-process running as that user.
If you also want to restrict network connections, it is also easy to setup a firewall so that the aforementionned process does not have the right to connect to external hosts.
If you need more control over which API calls you allow or not, there is a technique called 'API Interception via DLL Redirection' which is explained for example here:
http://109.163.225.194/download/files/other/DLL_Redirection_en.pdf

(found via google)

A: Maybe my answer will not be very helpful but i think using DLL or any other executable that contains machine code is unsafe, even if it is being ran as limited user or even in virtual machine it still opens attack vectors. First thing that comes to mind is to use off the shelf interpreter and use it to compile your own bytecode. However if you insist on using DLL, you can edit DLL import address table and ditch unwanted functions. As complex as this sounds there is library for this

A: A local firewall may solve the networking aspect - but I see no simple bulletproof solution for the other parts of your question.
I also believe that placing an "empty" kernel32 and ntdll may cause some serious issues for many legit processes.


text:
Q: How to make a javascript logic not visible in page resource in angularjs? I am working on a angularjs module in which we are trying to avoid a particular piece of logic in the view source on the browser. I have just given the skeleton code where the logic written inside script tags should not be shown in the page source of the browser.
<html ng-app="myApp">
     <head>
         <script>
            if(something){
            do something...
            }
         <script>
     </head>
     <body></body>
</html>

Is there any way in angularjs or javascript such that the logic written inside script is not visible in view page source on browser?.

A: This is not possible as the code needs to be executed by the browser, thus transferred to the client. Anyone can read/copy your code.
The most you can do is to use uglify or similar tool to minify your code. This will have to advantages for you. First, your code will be hard to read for others who might want to exploit your application. But keep in mind, it is still not impossible to understand your code even when minified - it just takes more time. And second, your scripts will become smaller thus making your page load slightly faster.

A: You can't hide code to your client. It is executed in the client browser.
The best thing you can do here is to minify your code. It will make it unreadable without parsing it. Also, the code will be smaller, and will be loaded by the browser faster.
As a side note, luckily all the code is visible: imagine if malicious code could be executed without you know it.

A: One more solution is make it look a bit complex so the user trying to read it does not understand it(in case you are not interested in making a minfied version)

*

*Store all the Variables required in a separate file and access them form that file.

*Even your base URL should be stored as global variable.

These are some options which you can use but making a minfied code is best practice.


text:
Q: How does ARC work in the following code snippet in ios? Let's say I have a method that returns an object pointer
-(MyObj *) returnMyObj {
   MyObj *obj = [MyObj alloc] init];
   return obj;
}

If I call this function without assigning the pointer like this
Scenario 1
[self returnMyObj];

and if I call this function with assignment to a pointer like this
Scenario 2
MyObj* obj = [self returnMyObj];

Compiler can release the object at the end of the returnMyObj method call in the Scenario 1 but it cant do the same in Scenario 2.How does ARC decide if it needs to retain the created object at the end of method invocation or not in both cases?

A: Here is what the ARC article in the documentation has to say:

To make sure that instances don't disappear while they are still needed, ARC tracks how many properties, constants, and variables are currently referring to each class instance. ARC will not deallocate an instance as long as at least one active reference to that instance still exists.
To make this possible, whenever you assign a class instance to a property, constant, or variable, that property, constant, or variable makes a strong reference to the instance. The reference is called a "strong" reference because it keeps a firm hold on that instance, and does not allow it to be deallocated for as long as that strong reference remains.

ARC decides which objects will be kept in memory and which will be deallocated by counting the strong references to the objects.
In your second scenario you are creating a strong reference to the MyObj instance and ARC will not deallocate it while the object is in use. In this case it will be deallocated when the method that uses this object finishes.

A: The optimizer may absolutely release the object in scenario 2 at the end of the statement if obj is not referenced later in the block.
The whole point is that the optimizer can see when the pointer is referenced, and may release it as soon as the last reference is completed. obj does not have precise lifetime semantics, so it only extends the life of the object until the last time obj is referenced, not when obj goes out of scope.
In scenario 1, the reference is not assigned to any variable, so it clearly has no later references, and may be immediately released. That said, it may not immediately release the object, since returnMyObj does not transfer ownership to the caller (due to its name). So the object may not actually be released until the autorelease pool drains.


text:
Q: How to make setters for List JAXB I have some XSD files, I try to generate Java Class (Jaxb) with setters for attributes java.util.List.
I have this pom.xml :
<plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>0.13.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>src/main/resources/here</schemaDirectory>
                    <generatePackage>ws</generatePackage>
                    <includeSchema>${basedir}/src/main/resources/file.xsd</includeSchema>
                    <plugins>
                        <plugin>
                            <groupId>org.jvnet.jaxb2_commons</groupId>
                            <artifactId>jaxb2-basics</artifactId>
                            <version>0.10.0</version>
                        </plugin>
                    </plugins>
                </configuration>
            </plugin>

I added but this parameter is not recognized :
<arg>-Xcollection-setter-injector</arg>

Do you know how to do ?
Thanks,

A: I think you miss the configuration parameter extension.
<extension>true</extension>

pom.xml
<configuration>
                    <extension>true</extension>
                    <args>
                        <arg>-Xsimplify</arg>
                        <arg>-Xcollection-setter-injector</arg>
                    </args>
                    <plugins>
                        <plugin>
                            <groupId>org.jvnet.jaxb2_commons</groupId>
                            <artifactId>jaxb2-basics</artifactId>
                            <version>0.11.0</version>
                        </plugin>
                    </plugins>
                </configuration>


text:
Q: Git pre-commit hooks in .yaml file can't push to github I'm trying to create an R function that automatically creates git commit hooks in the file .pre-commit-config.yaml if it isn't already present in the current directory.
The function is as follows:
create_commit_hook_yaml <- function() {
if (!file.exists(".pre-commit-config.yaml")) {
    system('printf "repos:\n- repo: local\n  hooks:\n  - id: jupyter-nb-clear-output\n    name: jupyter-nb-clear-output\n    files: \\.ipynb$\n    stages: commit\n    language: system\n    entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace\n" > .pre-commit-config.yaml')
}}

It creates the file and the file looks as expected:
repos:
- repo: local
  hooks:
  - id: jupyter-nb-clear-output
    name: jupyter-nb-clear-output
    files: \.ipynb$
    stages: commit
    language: system
    entry: jupyter nbconvert --ClearOutputPreprocessor.enabled=True --inplace

However, when trying to push the file to github I get the following error:
An error has occurred: InvalidConfigError: ==> File .pre-commit-config.yaml ==> At Config() ==> At key: repos ==> At Repository(repo='local') ==> At key: hooks ==> At Hook(id='jupyter-nb-clear-output') ==> At key: stages =====> Expected array but got 'str' Check the log at /home/jupyter/.cache/pre-commit/pre-commit.log

The log contains the following:
### version information

```
pre-commit version: 2.20.0
git --version: git version 2.20.1
sys.version:
    3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:53)
    [GCC 9.4.0]
sys.executable: /opt/conda/bin/python3.7
os.name: posix
sys.platform: linux
```

### error information

```
An error has occurred: InvalidConfigError:
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='local')
==> At key: hooks
==> At Hook(id='jupyter-nb-clear-output')
==> At key: stages
=====> Expected array but got 'str'
```

```
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/opt/conda/lib/python3.7/site-packages/pre_commit/main.py", line 365, in main
    args=args.rest[1:],
  File "/opt/conda/lib/python3.7/site-packages/pre_commit/commands/hook_impl.py", line 254, in hook_impl
    return retv | run(config, store, ns)
  File "/opt/conda/lib/python3.7/site-packages/pre_commit/commands/run.py", line 408, in run
    config = load_config(config_file)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 411, in load_from_filename
    return apply_defaults(data, schema)
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 43, in reraise_as
    raise tp(e).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 40, in reraise_as
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 411, in load_from_filename
    return apply_defaults(data, schema)
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 34, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 31, in validate_context
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 410, in load_from_filename
    validate(data, schema)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 376, in validate
    schema.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 244, in check
    item.check(v)
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 34, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 31, in validate_context
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 244, in check
    item.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 73, in _check_required
    _check_optional(self, dct)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 54, in _check_optional
    self.check_fn(dct[self.key])
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 34, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 31, in validate_context
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 54, in _check_optional
    self.check_fn(dct[self.key])
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 79, in check_fn
    validate(val, self.schema)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 376, in validate
    schema.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 272, in check
    validate(val, self.of)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 376, in validate
    schema.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 244, in check
    item.check(v)
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 34, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 31, in validate_context
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 244, in check
    item.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 106, in _check_conditional
    inner(self, dct)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 73, in _check_required
    _check_optional(self, dct)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 54, in _check_optional
    self.check_fn(dct[self.key])
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 34, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 31, in validate_context
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 54, in _check_optional
    self.check_fn(dct[self.key])
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 79, in check_fn
    validate(val, self.schema)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 376, in validate
    schema.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 272, in check
    validate(val, self.of)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 376, in validate
    schema.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 244, in check
    item.check(v)
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 34, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 31, in validate_context
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 244, in check
    item.check(v)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 54, in _check_optional
    self.check_fn(dct[self.key])
  File "/opt/conda/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 34, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 31, in validate_context
    yield
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 54, in _check_optional
    self.check_fn(dct[self.key])
  File "/opt/conda/lib/python3.7/site-packages/cfgv.py", line 359, in check_array_fn
    f'Expected array but got {type(v).__name__!r}',
pre_commit.clientlib.InvalidConfigError:
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='local')
==> At key: hooks
==> At Hook(id='jupyter-nb-clear-output')
==> At key: stages
=====> Expected array but got 'str'
```

To my knowledge, the repo and hook id's should be arrays as they have a '-' in front, but I've tried removing the '-'s and have also tried adding more in in various places but none of it works. I'm new to commit hooks and yaml files so don't understand what isn't working. Is anyone able to help me do this right?
EDIT:
To be specific about what I've tried, I added "- " in front of stages, which is what the error suggests but that results in a different error message which I don't understand:
An error has occurred: InvalidConfigError: ==> File .pre-commit-config.yaml =====> while parsing a block mapping in "<unicode string>", line 4, column 5 did not find expected key in "<unicode string>", line 7, column 5 Check the log at /home/jupyter/.cache/pre-commit/pre-commit.log


text:
Q: consulta sobre getter and setter El ejercicio es de una sencillez extrema, pero le quiero poner un poco de dificultad y hacerlo con POO. Tengo que pedir 5 numeros y luego hacer una operacion con esos numeros, hay una condicion que los numeros no pueden ser mayores a 10. Ahora bien, en la clase donde declaro los numeros les puse valor1,valor2,valor3,valor4,valor5, la cuestion es que si quiero crear un for para que me pida los numeros uno atras del otro, practica a = new practica(); a.setValor1(leer.nextInt());
como podria hacer para hacer para que verifique la condicion a medida que se van ingresando los numeros, sin tener que poner setValor2, setValor3, etc, ya que el for seria para simplificar el codigo.. Como dije anteriormente, se puede realizar el ejercicio de manera mucho mas simple, declarando solo variables en la misma clase main, pero estoy practicando POO. Aguardo sus comentarios.

A: una cosa que podrías hacer es sustituir, en la clase práctica, la declaración de los cinco valores por un array de int de longitud 5. Con eso almacenarías los cinco números en una sola variable.
//Creas el array de int
    private int[] numeros;

    public Practica(){
        //lo inicias con longitud cinco
        numeros = new int[5];
    }

Y como lo vas a tratar en un for, pues puedes hacer un método getter que te devuelva el array de números o un método al que le pasas la posición y el valor y de este modo te introduce un valor (nextInt()) en una determinada posicion(el valor que toma el iterador en el bucle for).
//Devulve el array de int numeros
public int[] getNum(){
        return numeros;
    }

//ingresa en la posicion = posicion del array un número = num
    public void ingresaNum(int posicion, int num){
        numeros[posicion] = num;
    }

Ya en el bucle for podrías hacer usar cualquiera de estos dos métodos.
Scanner teclado = new Scanner(System.in);
        Practica practica = new Practica();
        int numero = 0;
        for(int i=0; i<5;i++){
            numero = teclado.nextInt();
            practica.getNum()[i] = numero;
        }

O bien,
Scanner teclado = new Scanner(System.in);
    Tarea practica = new Practica();
    int numero = 0;
    for(int i=0; i<5;i++){
        numero = teclado.nextInt();
        practica.ingresaNum(i, numero);
    }

Por último, recordarte que si después tienes que operar con ellos, las posiciones de los números en el array empiezan por 0. Por tanto, si quisieras sumar el primer y el tercer valor deberías seleccionar la posición 0 y la 2.
//Si lo haces desde el main
int suma = practica.getNum()[0] + practica.getNum[2];

//Si lo haces desde la clase Practica
int suma = numeros[0] + numeros[2];

Un saludo.

A: public class Ejemplo{
public static void main(String[] args) {
    Scanner leer = new Scanner(System.in);
    practica a = new practica();

    int dato;
    int i = 0;
    // creé esta condición de (i<5) ya que lo que pedías es muy
    //específico a 5 datos
    while (i < 5) {
        dato = leer.nextInt();
    //en este if se aumenta la variable i
    //la cual necesita ser 5 o mayor para que el loop termine
    //pero solo se va a incrementar si el dato que damos por teclado
    //es menor o igual a 10, esto para cumplir con la condición que pedías

        if (dato <= 10) {
            a.setValor(dato);
            i++;
        }
    }

}

}
si intentas de agregar mas de 5 números te dará una excepción
ya que tú lo pedías muy específico a 5 números
si quieres ingresar mas datos debes aumentar el tamaño del array o hacerlo de otra manera
class practica {
private int[] array= new int[5];
private int contador = 0; // el objetivo de esta variable es controlar la
                       //cantidad de números en el array

public void setValor(int a) {
    array[contador] = a;
    contador++;
}

}
esta sería mi manera básica de resolver lo que pides
Saludos


text:
Q: Identifying value in matrix I have a problem and then I need your help to solve it.
I have a matrix A
A = [ 0 0 1 2 3 4 0;
      1 2 3 4 0 0 0;
      0 0 0 1 2 3 4;
      0 1 2 3 4 0 0]

and then I want to know how many number of each values "1" of each rows in matrix A which is not in the same column with each value ">=3" of each rows in matrix A.
so I wish that my answer
Ans = 2

Thanks before.

A: Try this:
>> num = sum( any(A(:,all(A<3))==1,2) )
num =
     2

First we find the columns indices containing no values greater or equal to 3 idx = all(A<3).
Next in those columns A(:,idx), we find the rows containing any 1: any(A(:,idx)==1,2).
Finally we count how many such rows were found sum(.)

A: You can use something like
   sum( (sum(A == 1 ,1) > 0) & ~(sum(A >= 3,1) > 0))


text:
Q: fading in my image gallery I have an image gallery and I want to add fade effect, How can I do do this in this code?
$(document).ready(function() {
$(".gallery div").mouseover(function(){
    $(".gallery div").removeClass("current");
    $(this).toggleClass("current");
});
 });

Thanks in advance

A: Use the fade effect.
You can do fadeIn, fadeOut or fadeTo depending on what you need :
$("p:first").click(function () {
  $(this).fadeTo("slow", 0.33);
});

A: Something like this, fades out on mouseout, fades in on hover?
$(document).ready(function() {
  $(".gallery div").mouseover(function(){
    $(".gallery div").removeClass("current").fadeTo(500, 0.25);
    $(this).toggleClass("current").stop().fadeIn(200);
  });
});

You can also do this via the hover() function:
$(document).ready(function() {
  $(".gallery div").hover(function(){
    $(this).addClass("current").stop().fadeIn(200);
  }, function() {
    $(this).removeClass("current").fadeTo(500, 0.25);
  });
});

A: $(document).ready(function() {
$(".gallery div").hover(function(){
    $(".gallery div").removeClass("current").fadeOut('fast');
    $(this).toggleClass("current").fadeIn('fast');
});
 });


text:
Q: Negate a function in python Is there a way to negate a function so it returns negatives. In my function, I have conditionals and each makes this "turtle" move. Is there a way to negate this so the every turtle move is negative. I am speaking of '=' condition.
def ttInterpret( program ):
            """
            interpret program as a TinyTurtle language string.
            program -- a TinyTurtle string, possibly with string manipulation symbols
            """
            stor_pos = turtle.pos()
            spec_index = 0
            for ch in program:
                if ch >= '0' and ch <= '9':
                    turtle.fd(int(ch) * 10)
                elif ch == '<':
                    turtle.left(15)
                elif ch == 'L':
                    turtle.left(90)
                elif ch == '>':
                    turtle.right(15)
                elif ch == 'R':
                    turtle.right(90)
                elif ch == ' ':
                    pass

                elif ch == '@':
                    # ttInterpret( program[:program.index(ch):-1] )
                    stor_pos = turtle.pos() #keeps track of when @ was used
                    spec_index = program.index( ch ) #returns the index of the most recent specified character

                elif ch == '/':
                    fds_index = program.index( ch ) #returns last '/' index
                    ttInterpret( program[spec_index:fds_index - 1] )
                    # while ch != '/':
                        # ttInterpret( -program[ch::-1] )
                elif ch == '!':
                    turtle.setpos(stor_pos)

                elif ch == '=':
                    ttInterpret( program[:int(program.index(ch)):-1] ) #returns to start
                    ttInterpret( program[:int(program.index(ch)):1] ) #mirrors from start

                else:
                    print("Error: ", ch," is not supported by TinyTurtle")
            return

A: Put the whole code within a while loop, as below.
 while True:

Then, instead of calling the same function recursively, use:
program = program[:int(program.index(ch)):-1]
continue #returns to start

And similar

A: I ended up just duplicating the function and negating everything in it. Thanks guys