A problem has occured when checking for updates – 16.04

There’s red circle with white minus sign in the middle that says that a problem has occured when checking for updates. I’m also unable to open “Software & Updates” and “Software Center”. I have tried uninstalling and reinstalling the software-center, but it gives me this error when I try to open the software-center via terminal.

File "/usr/bin/software-center", line 140     print time.time()              ^ SyntaxError: invalid syntax 

Appears to python2 code. Is it using python3 to interpret?

when i tried software-properties-gtk

it gave me this

  File "/usr/bin/software-properties-gtk", line 32, in <module>     import aptsources   File "/usr/lib/python3/dist-packages/aptsources/__init__.py", line 3, in <module>     import apt_pkg ModuleNotFoundError: No module named 'apt_pkg' 

regression DNN: gradient checking doesn’t match with backpropagation derivatives

I think the problem lies within a bad implementation of back propagation, it’s the only way i could explain this (gradient checking that doesn’t match backprop derivatives), but i’m not able to find any error, and derivatives are ok to me, so i ask you if the derivatives i compute make sense, or there is some error.

About DNN:

I built a 3 layer (1 input, 1 hidden, 1 output) neural network. My goal was regression, so the last layer has 1 neuron, and I used leakyRelu as activation function on the hidden layer, and no activation function on the output layer. I used Mean Squared Error (MSE) as cost function. I also used normalization, and i didn’t use regularization yet.

About derivatives:

dCost/dALayerOutput = d( 1/m * sum( (ALayerOutput – y)^2 ) )/dALayerOutput = 2/m * (ALayerOutput – y) = dA

dCost/DZLayerOutput = dA * dALayerOutput/dZLayerOutput = dA * d(ZLayerOutput) = dA * 1 = dZ (because i don’t apply any activation function to the last layer).

dCost/DWeightOutput = dZ * dZLayerOutput/dWeightOutput = dZ * d(WeightOutput * ALayerHidden + BiasOutput)/dWeightOutput = dZ * ALayerHidden = dW

dCost/DBiasOutput = dZ * dZLayerOutput/dBiasOutput = dZ * d(WeightOutput * ALayerHidden + BiasOutput)/dBiasOutput = dZ * 1 = dZ = dB

dCost/DALayerHidden = dZ * dZLayerOutput/dALayerHidden = dZ * d(WeightOutput * ALayerHidden + BiasOutput)/dALayerHidden = dZ * WeightOutput = dA-1

dCost/dZLayerHidden = dA-1 * dALayerHidden/dZLayerHidden = d( leakyRelu(ZLayerHidden) )/dZLayerHidden = dA-1 * dLeakyRelu(dZLayerHidden) = dZ-1

dCost/dWeightHidden = dZ-1 * dZLayerHidden/dWeightHidden = dZ-1 * d(WeightHidden * LayerInput + BiasHidden)/dWeightHidden = dZ-1 * LayerInput = dW-1

dCost/dBiasHidden = dZ-1 * d(WeightHidden * LayerInput + BiasHidden)/dBiasHidden = dZ-1 * 1 = dB-1

About Gradient Descent:

netWeightsLayerOutput = netWeightsLayerOutput – (learningRate * dW)

netWeightsLayerHidden = netWeightsLayerHidden – (learningRate * dW-1)

netBiasesLayerOutput = netBiasesLayerOutput – (learningRate * dB)

netBiasesLayerHidden = netBiasesLayerHidden – (learningRate * dB-1)


Did you find any error?

How to fix “no backend found for spell checking” in Kate editor settings?

I have installed Kate editor into my Ubuntu MATE 16.04.6 LTS system as simple as sudo apt-get install kate.

In its Settings → Configure Kate, Editor Component, Editing, Spellcheck tab I see that it does not detect back-end for spell-checking:

No backend found for spell checking Configure - Kate

$   kate Sonnet: No speller backends available! No language dictionaries for the language: "en" 

I have the following packages installed related to spell-check:

$   dpkg -l | grep -iE "dict|spell.*(check|correct)" ii  anthy                                                       9100h-25ubuntu1                                 amd64        input method for Japanese - backend, dictionary and utility ii  anthy-common                                                9100h-25ubuntu1                                 all          input method for Japanese - common files and dictionary ii  aspell                                                      0.60.7~20110707-3build1                         amd64        GNU Aspell spell-checker ii  aspell-en                                                   7.1-0-1.1                                       all          English dictionary for GNU Aspell ii  dictionaries-common                                         1.26.3                                          all          spelling dictionaries - common utilities ii  enchant                                                     1.6.0-10.1build2                                amd64        Wrapper for various spell checker engines (binary programs) ii  geany-plugin-spellcheck                                     1.27+dfsg-2                                     amd64        spellcheck plugin for Geany ii  hunspell-en-ca                                              1:5.1.0-1ubuntu2.2                              all          English (Canada) dictionary for hunspell ii  hunspell-en-gb                                              1:5.1.0-1ubuntu2.2                              all          English (GB) dictionary for hunspell ii  hunspell-en-us                                              20070829-6ubuntu3                               all          English_american dictionary for hunspell ii  hunspell-en-za                                              1:5.1.0-1ubuntu2.2                              all          English (South Africa) dictionary for hunspell ii  hunspell-ru                                                 20120501-1                                      all          Russian dictionary for hunspell ii  iamerican                                                   3.4.00-5                                        all          American English dictionary for ispell (standard version) ii  ienglish-common                                             3.4.00-5                                        all          Common files for British and American ispell dictionaries ii  ispell                                                      3.4.00-5                                        amd64        International Ispell (an interactive spelling corrector) ii  libaspell15:amd64                                           0.60.7~20110707-3build1                         amd64        GNU Aspell spell-checker runtime library ii  libenchant1c2a:amd64                                        1.6.0-10.1build2                                amd64        Wrapper library for various spell checker engines (runtime libs) ii  libgdict-common                                             3.18.0-2                                        all          GNOME Dictionary base library - common files ii  libgtkspell0                                                2.0.16-1.1ubuntu1                               amd64        a spell-checking addon for GTK's TextView widget ii  libgtkspell3-3-0:amd64                                      3.0.7-2                                         amd64        spell-checking addon for GTK+'s TextView widget ii  libhunspell-1.3-0:amd64                                     1.3.3-4ubuntu1                                  amd64        spell checker and morphological analyzer (shared library) ii  libhunspell-dev:amd64                                       1.3.3-4ubuntu1                                  amd64        spell checker and morphological analyzer (development) ii  libjazzy-java                                               0.5.2-1                                         all          spell checker java library ii  libkf5sonnet5-data                                          5.18.0-0ubuntu1                                 all          spell checking library for Qt ii  libkf5sonnetcore5:amd64                                     5.18.0-0ubuntu1                                 amd64        spell checking library for Qt ii  libkf5sonnetui5:amd64                                       5.18.0-0ubuntu1                                 amd64        spell checking library for Qt ii  libmatedict6                                                1.12.0-1                                        amd64        MATE desktop utilities (matedict library) ii  link-grammar-dictionaries-en                                4.7.4-3                                         all          Carnegie Mellon University's link grammar parser (English dictionary) ii  myspell-en-au                                               2.1-5.4                                         all          English_australian dictionary for myspell ii  myspell-en-gb                                               1:5.1.0-1ubuntu2.2                              all          English (GB) dictionary for hunspell - dummy transitional package ii  myspell-en-za                                               1:5.1.0-1ubuntu2.2                              all          English (ZA) dictionary for hunspell - dummy transitional package rc  myspell-ru                                                  0.99g5-20                                       all          Russian dictionary for MySpell ii  python-enchant                                              1.6.6-2                                         all          spellchecking library for Python ii  python3-enchant                                             1.6.6-2                                         all          spellchecking library for Python 3 ii  wamerican                                                   7.1-1                                           all          American English dictionary words for /usr/share/dict ii  wbritish                                                    7.1-1                                           all          British English dictionary words for /usr/share/dict   

How should I fix this?

Definition of liveness property in model checking

A property $ P$ is simply a set of sequences of states and a certain program is characterized by its set of sequences of states, let’s call it $ T$ . A program is compliant to a specific property P if $ T\subseteq P$ .

Intuitively, a specific liveness property LP1 is the set of traces (sequences of states ) in each of which “something good” will happen, based on the specific property LP1 (for example “termination”). This means that if a program it’s compliant with LP1 in each of its traces the “good thing” will happen, that is the program will terminate.

However, I don’t understand how the formal definition of liveness property contains what was said, can you explain me? This definition to me makes no sense (i know all the terminology)…

$ \forall t\in S^{*}\,(\exists t’\in S^{\omega }:t\leq t^{‘}\wedge t^{‘}\in LP1)$

Password checking implementation: delay on unsuccessful attempts [duplicate]

This question already has an answer here:

  • Should I implement incorrect password delay in a website or a webservice? 4 answers

What would be wrong with the username/password checker where the response is instantaneous for valid attempts but a pre-built time delay (say 1 sec) is used for unsuccessful ones? It would not slow down legitimate users, but would obviate the need for key derivation functions, and thwart the timing attacks. Can someone critique please?

“Error while checking if topic is synchronous” on setup:upgrade

While upgrading a 2.2.8 database to 2.3.2 I got this error today:

  Schema post-updates:                                                            Module 'Magento_Store':                                                         Module 'Magento_Directory':                                                     Module 'Magento_Theme':                                                         Module 'Magento_Eav':                                                           Module 'Magento_AdvancedPricingImportExport':                                   Module 'Magento_Rule':                                                          Module 'Magento_Customer':                                                      Module 'Magento_Amqp':                                                          Error while checking if topic is synchronous                                  

It must have something to do with environment configuration because on the same DB snapshot with the same code base, it worked on a test environment.

We do not use the Magento_Amqp module at all, so there is no AMQP configuration on either system.

I looked where the error message can be thrown and found:

\Magento\Framework\MessageQueue\Topology\Config\QueueConfigItem\DataMapper::isSynchronousTopic 

which can be traced back to:

\Magento\Framework\MessageQueue\Topology\Config\QueueConfigItem\Iterator::__construct 

And the exception is thrown if in

\Magento\Framework\Communication\Config::getTopic() 

a configuration path (topics/$ topicName, from cache id communication_config_cache) cannot be found.

But now I’m lost: Why should this configuration be present in one installation and not in the other? Or why would Magento look for the configuration at all during DB schema updates?

The output suggests, that the recurring schema update (\Magento\Amqp\Setup\Recurring) of Magento_Amqp are not even started (No “Running schema recurring”), so I guess the error comes while instantiating it.

Trying to find a dependency path to the class from above, that throws the exception in its constructor:

  • \Magento\Framework\Amqp\TopologyInstaller
  • \Magento\Framework\MessageQueue\Topology\Config
  • \Magento\Framework\MessageQueue\Topology\Config\QueueConfigItem\Iterator

Yes! We have a trace. (but still no idea, why. I’ll keep this updated)

Checking whether the win-loss standings of a league are possible

You’re hosting a 1 v 1 basketball league with a game schedule. At the end of the league you have each player report their supposed win-loss record (there are no ties), but you want to check whether the proposed standings were actually possible given the schedule.

For example: you have four players (Alice+Bob+Carol+Dave) and your schedule is a simple round robin. The reported standings [A: 3-0 B: 1-2 C: 1-2 D: 1-2] and [A: 2-1 B: 1-2 C: 1-2 D: 2-1] would be possible, but the standing [A: 3-0 B: 0-3 C: 0-3 D: 3-0] would not be.

Now suppose the schedule is instead a 3 game head to head between Alice+Bob and Carol+Dave. The reported standing [A: 3-0 B: 0-3 C: 0-3 D: 3-0] is now possible, but [A: 3-0 B: 1-2 C: 1-2 D: 1-2] would no longer be.

(The schedule does not need to be symmetric in any way. You could have Alice only play against Bob 10 times, then make Bob+Carol+Dave play 58 round robins against each other.)

Problem: Given a schedule with k participants and n total games, efficiently check whether a proposed win-loss standings could actually occur from that schedule.


The O($ 2^n$ ) brute force method is obvious, enumerate all possible game outcomes and see if any match the proposed standings. And if k is small increasing n doesn’t add much complexity – it’s very easy to check a two person league’s standings regardless of whether they play ten games or ten billion games. Beyond that I haven’t made much headway in finding a better method, and was curious if anyone had seen a similar problem before.

How can repetitive variable checking be streamlined?

I often have to execute some function, save the output, and depending on what the output was, do different things. And then later on use the output as input to more functions.

It results in a very specific pattern of code.

I feel like I’m missing something simple. … as if some logic here could be somehow streamlined. The variable declaration, variable checking, and forthcoming execution of other stuff onto said variable seems almost redundant.

(tried to make the code as applicable to everyone and as applicable to every application, as possible) here’s some sample code that fits this predicament:

    some_sort_of_data=validate(var1, 'type1')            if some_sort_of_data.is_bad:         return some_sort_of_data.is_bad      more_data=validate(var2, 'type2')     if more_data.is_bad:         return more_data.is_bad      get_special_info=get_parent_of_item(some_sort_of_data.validated_item)     if get_special_info['error']:         return get_special_info['data']      if not (has_access_rights() or         special_relationship(more_data.validated_item) or          some_sort_of_other_permissions(get_special_info['result'])):             return "Blah Blah blah some sort of incompatibility"      new_status_result=change_status(some_sort_of_data.validated_item, more_data.validated_item)     if new_status_result['error']         return new_status_result['result']      # If we've passed all the previous checks and managed to get all the way here..     return "yay did a thing successfully" 

… is it just me or do you also see how such a pattern feels off? If so, how can it best be streamlined?

edit: I know in some other languages you can streamline it a bit by writing

if (some_sort_of_data=validate(var1, 'type1')=="success")     return some_sort_of_data.some_class_variable 

instead of

some_sort_of_data=validate(var1, 'type1')        if some_sort_of_data=="success":     return some_sort_of_data.some_class_variable 

but that’s still not enough and still quite redundant, right?