text:
Q: Is my answer to this limit correct? Define a function $ z(x, y) = \frac{11x^3+5y^3}{x^2+y^2} $. Using the continuous extension, what is the value of the following limit:
$$ \lim_{(\Delta x, \Delta y) \rightarrow (0, 0)\\ \text{along the line } x=y \neq 0}{\left(\frac{\Delta z - dz}{\sqrt{(\Delta x)^2+(\Delta y)^2}}\right)} $$
I computed $\Delta z$ and  the partial derivatives for $ dz $ and set $x = y$. I got $\Delta z = 8\Delta x$ and $ dz = 8\Delta x$; which gives $ 0 $ as the limit after subtraction.
To evaluate $z_{x}$, and $z_{y}$ at the point $ (0, 0) $, I used the following limits: $ \lim_{(x, y) \rightarrow (0, 0)} \left( z_{x}(x, y) \right) $ and $ \lim_{(x, y) \rightarrow (0, 0)} \left( z_{y}(x, y) \right) $ along the line $x=y$. Which give the values $\frac{17}{2}$ and $-\frac{1}{2}$ respectively. If I use the definition of partial derivatives however, I get, 11 and 5 respectively. Along the line $x=y$, the first one gives $dz = 8dx$, and thus the limit is $0$; and the second one gives $dz = 16dx$, and thus the limit is $32$.


text:
Q: Load prototype enhancements with require.js I am using require.js to load my modules which generally works fine. Nevertheless, I do have two additonal questions:
1) If you have a module that is like a helper class and defines additional methods for existing prototypes (such as String.isNullOrEmpty), how would you include them? You want to avoid using the reference to the module.
2) What needs to be changed to use jQuery, too. I understand that jQuery needs to be required but do I also need to pass on $?
Thanks!

A:
1) If you have a module that is like a helper class and defines
  additional methods for existing prototypes (such as
  String.isNullOrEmpty), how would you include them? You want to avoid
  using the reference to the module.

If you need to extend prototypes then just don't return a value and use it as your last argument to require:
// helpers/string.js
define(function() {
    String.prototype.isNullOrEmpty = function() {
        //
    }
});

// main.js
require(['moduleA', 'helpers/string'], function(moduleA) {

});

2) What needs to be changed to use jQuery, too. I understand that
  jQuery needs to be required but do I also need to pass on $?

The only requirement for jQuery is that you configure the path correct
require.config({
    paths: {
        jquery: 'path/to/jquery'
    }
});

require(['jquery', 'moduleB'], function($, moduleB) {
    // Use $.whatever
});

In my opinion it's unnecessary to use the version of RequireJS that has jQuery built into it as this was  primarily used when jQuery didn't support AMD.
Nowadays it does and keeping it separate allows you to swap another library out easily (think Zepto).

A: 2/ For jquery it's really simple :
require(["jquery", "jquery.alpha", "jquery.beta"], function($) {
    //the jquery.alpha.js and jquery.beta.js plugins have been loaded.
    $(function() {
        $('body').alpha().beta();
    });
});

More information on require site : http://requirejs.org/docs/jquery.html#get
1/ in my devs for such extension I did it in a global file without require module code.... and I include it in my app with require... not perfect, but it's work fine
global.js
myglobalvar ="";
(...other global stuff...)

myapp.js
// Filename: app.js
define([
    (...)
    'metrix.globals'
], function(.....){
myApp = {
(...)

redpajama_set_name: RedPajamaStackExchange


text: Q: Explanation of the decomposition in the Non Negative Matrix Factorization I perform matrix factorizaition in my data using the sklearn implementation of Non Negative Matrix Factorization. In the evaluation process I am removing some values from my initial dataset and I am trying to see if the approximation matrix of NMF can predict well those missing values. What I have notice from the experimental results is that, the smaller the latent factors of the decomposition are the better the prediction of the missing value I got. However, this means also that the rest of the values are not approximated really well. Is this an expected behavior? Why this is happening? Moreover, is there any explanation for the l1_ratio and the alpha value?


text:
Q: Sort email address using compareTo() returns unexpected result I'm newbie to Java and trying to sort email address alphabetically using compareTo() but the result is not as I expect. I put my question in the code, could you please advise?
public class SortTest {
    public static void main(String[] args) {
        String text1= "customer1@example.com";
        String text2 = "customer10@example.com";
        System.out.println(text1.compareTo(text2)); //Result is 16. Why? I expect a negative number as result.

        String text3= "customer1";
        String text4 = "customer10";
        System.out.println(text3.compareTo(text4)); //result is -1 which is correct.
    }

}

UPDATE:
I want to sort ascending with text1 and text2 above, the expected result in order is "customer1@example.com", then "customer10@example.com". Could u advise how to achieve it?

A: Take a look at the javadoc:

If there is no index position at which they differ, then the shorter string lexicographically precedes the longer string. In this case, compareTo returns the difference of the lengths of the strings -- that is, the value

This explains the second example.
In the first one "0" is lexicographically before "@". You can simply check that by running:
"@".compareTo("0")

which results in the value 16.
Or another way:
(int) '@' // 64
(int) '0' // 48

So the difference is 16.
Edit: to compare the emails the way you want it, you should involve some more logic, for example compare only login part (remove the domain separated by "@"): str1.split("@")[0].compareTo(str2.split("@")[0])

A: Take a look at the Ascii table - http://www.asciitable.com/index/asciifull.gif
'@' Dec value is 64
While '0' dec value is 48.
Now if you do (64-48) = 16.


text:
Q: How to trim zero's from price in Magento 1.7.0.2 (JavaScript) Here is the code:
function wpTrimZeroRight(price, precision) {
var format = {
    'pattern': '%s',
    'precision': precision,
    'requiredPrecision': precision,
    'decimalSymbol': '.',
    'groupSymbol': '',
    'groupLength': 0,
    'integerRequired': 2
};
var xPrice = formatCurrency(price, format);
var decimal = '';
var pointPos = xPrice.lastIndexOf('.');
if (pointPos !== -1) decimal = xPrice.substr(pointPos);
var c1 = decimal.length;
decimal = decimal.replace(new RegExp("[0]+$", "g"), "");
var c2 = decimal.length;
var xPrecision = precision - (c1 - c2);
return xPrecision;

This piece of code is taken from webandpeople trim price extension. It does the job but in configurable and bundle producs trim all zeros; so when the price looks like £11.50 on the category page on product page looks like £11.5 . The idea is to have two decimal numbers everywhere except where products cost £0.012 for example. I have played with the code a bit and I changed   (new RegExp("[0]+$", "g"), "");     to     (new RegExp("00", "g"), "0") This gives me £28.990 on some products but the correct amount of £55.50 on the others. I think there is lack of if statement but nothing with much sense comes to my mind. I already spent few hours searching for the answer here and on the other magento related sites. I would be grateful for any ideas.

A: Javascript Number.toFixed method is what you are lookign for. (12.5001).toFixed(2) --> 12.50

A: Why you need to trim a price. I think magento automatically does it.
Use code like Mage::helper('core')->currency($price, true, false);
wherever you are getting price. I think you would get the price in formatted manner


text:
Q: When declaring a List and assigning it to a LinkedList or ArrayList, are the different performance benefits still retained? Take the following two lines of code:
List<String> listOfStrings = new ArrayList<>();

List<String> listOfStrings2 = new LinkedList<>();

I understand that it's good practice to program to Interfaces, however as a newbie, I'm trying to understand since we can only call List methods on both these instances, do they still "behave" like ArrayLists or LinkedLists (As in they perform like their respective classes when sorting/adding etc.)

A: Yeah they do behave like ArrayList or LinkedList, you can use this to save more different Lists (or your own objects) and call different implementations of the superclass's methods while iterating over an Array.

A: Both LinkedList and ArrayList implemented List, Collection, Iterable... interfaces, but they have different implementation of methods (like add(), remove(), etc. Arraylist and LinkedList will have different behavior/performance due to different implementations, when calling these methods).


text:
Q: how to break a long callback chain in libuv Suppose that we receive data from TCP socket, and process it step by step to get the result. Each step is implemented as a function which tasks parameter from the previous and return result to the next. We chain all these functions as a callback chain and name each of these functions as f1 f2 ... fn.
There are no block functions in this callback chain and each callback runs pretty fast. However, the run time of the whole chain is not negligible, so run whole chain in single loop iteration is not accepted.
For simply chain these functions in one callback chain, it will run as:
data -> f1 -> f2 -> f3 -> f4 -> f5 ->... -> fn -> result
        |------- single loop iteration -------|

It is good to break this chain into many sections, and run each section in one single loop iteration. This looks like:
data -> f1 ->  f2 -> f3 -> f4 -> f5 ->... -> fn-1  -> fn -> result
        | loop1 |    |-- loop 2 --|          |- loop m -|

I know in Twisted, there exists a deferred() to do such a task. However, in libuv, how to do it?

A: libuv doesn't have a builtin API to do this.  You do have some building blocks though: you could create some sort of "chain" structure where you remember the state, and run it in a uv_idle_t.  Note that idle handles prevent the loop from blocking for i/o when they are active.


text:
Q: How to hyperref prefixed URLs? Is it possible to define URL prefixes and correctly provide hyperrefs for them?
For example:
\defineprefix{dbo}{http://dbpedia.org/ontology/}
\prefixurl{dbo:City}

Should have the same effect as:
\href{http://dbpedia.org/ontology/City}{dbo:City}

Edit:
This is the MWE of the accepted code where it causes an error:
\documentclass{article}
\usepackage{hyperref}

\makeatletter
\newcommand\defineprefix[2]{%
      \def\urlprefixabbrv@#1{#2}}
\newcommand\prefixurl[2]{%
      \href{\urlprefixabbrv@#1/#2}{#1:#2}}
\makeatother

\begin{document}
\defineprefix{owl}{http://www.w3.org/2002/07/owl\#}
\defineprefix{xsd}{http://www.w3.org/2001/XMLSchema\#}

\prefixurl{owl}{Class}
\prefixurl{xsd}{string}

\end{document}

A: The following should work
\documentclass{article}
\usepackage{hyperref}

\makeatletter
\newcommand\defineprefix[2]{%
      \expandafter\def\csname urlprefixabbrv@#1\endcsname{#2}}
\newcommand\prefixurl[2]{%
      \href{\csname urlprefixabbrv@#1\endcsname/#2}{#1:#2}}
\makeatother

\begin{document}
\defineprefix{dbo}{http://dbpedia.org/ontology/}
\prefixurl{dbo}{City}

\end{document}

You are responsible yourself for keeping track you don't define the same prefix twice and overwrite each other.


text:
Q: Is there a simpler way than using STI or polymorphic associations? I have been reading a lot on the difference between STI and polymorphic associations and decided to use STI:
user.rb
Class User < ActiveRecord::Base
   has_many :articles
end

article.rb
Class Article < ActiveRecord::Base
   belongs_to :users
end

sport.rb
Class Sport < Article
end

politic.rb
Class Politic < Article
end

food.rb
Class Food < Article
end

create_table "articles", force: :cascade do |t|
t.string   "title"
t.string   "artwork"
t.integer  "user_id"
t.datetime "created_at",                 null: false
t.datetime "updated_at",                 null: false
t.boolean  "approved",   default: false
t.string   "type"

However, upon further reading, this becomes even more complicated. All I am really looking to do is to find some way to sort my articles by type. For example, is it possible that I simply have a string column tag and specify that tag must be either politics, sports, or food?

A: In this case, use an enum:
#app/models/article.rb
class Article < ActiveRecord::Base
  enum article_type: [:sport, :politic, :food] #-> "article_type" (int) column required
end

The only drawback to this would be that you can only assign one enum value to your model; from the use case you've outlined, it seems that's what you need.

The enum will allow you to use the following:
@article = Article.find params[:id]

@article.sport?    #-> true
@article.politic?  #-> false
@article.food?     #-> false

@article.profile_type #-> "sport"

You also get a set of class methods to identify the various objects you need from the db:
@sports_articles = Article.sport #-> collection of "sport" articles

To create an @article through a form, you'll need collection_select:
#app/views/articles/new.html.erb
<%= form_for @article do |f| %>
   <%= f.collection_select :profile_type, Article.profile_types, :first, :first %>
   <%= f.submit %>
<% end %>

Update
Pagination occurs on data received from the db.
Thus, if you wanted to "include" data in the pagination, you'd just have to make sure you're pulling it from the db. To do this, you'd need to include as many article_types as you want:
#app/models/article.rb
class Article < ActiveRecord::Base
   scope :by_type, (types) -> { where(article_type: Array.new(types)) }
end

This will allow you to use the following:
@articles = Article.by_type(:sport, :politic).paginate(page: params [:page], per_page: 12)

As per the docs:
Conversation.where(status: [:active, :archived])


text:
Q: What is the right function to add persons number to my cooking app? import 'package:flutter/foundation.dart';

enum Complexity {
  Simple,
  Challenging,
  Hard,
}

class Meal {
  final String id;
  final List<String> categories;
  final String title;
  final String imageUrl;
  final List<String> ingredients;
  final List<String> steps;
  final int duration;
  final Complexity complexity;
  final bool isGlutenFree;
  final bool isLactoseFree;
  final bool isVegan;
  final bool isVegetarian;

  const Meal({
    required this.id,
    required this.categories,
    required this.title,
    required this.imageUrl,
    required this.ingredients,
    required this.steps,
    required this.duration,
    required this.complexity,
    required this.isGlutenFree,
    required this.isLactoseFree,
    required this.isVegan,
    required this.isVegetarian,
  });
}

Hallo, i have added the complexity of my meals to my meal app.
But, how can I add the number of persons? What do I need? I want to add, that the meal is for 1 or 2 or 3 persons.
Thank you!


text:
Q: CoreData basics – to-many relationship array data As I am fairly new to CoreData and coming from a MySQL-DB background, the CoreData Moddeling is kind of hard to understand at some point. I am sure you can help me out with this basic question.

CoreData model-descripton:
My database-model basically consists of two entities. The first one is called "Manager", the second one is called "Zipcodes". The "Manager" has 3 attributes, which are negligible at the moment. The important thing in my opinion is here the relationship called "zipcodes". The "Zipcodes"-Entity has an attribute called zip, which is a 16 int. It has a relationship as well, called "manager".
No I'll get to the point: Each manager has multiple zicodes in which he is responsible for all sales. The problem is now that I've setup an manager entity and want to link multiple ziplcodes to him. The zipcodes per manager are seperated in one comma seperated string. (12345,56789,...)
First of all I am creating an Manager Entity.
Manager *manager = [NSEntityDescription insertNewObjectForEntityForName:@"Manager" inManagedObjectContext:self.managedObjectContext];

The next step is seperating all zicodes to an array.
Manager *manager = [NSEntityDescription insertNewObjectForEntityForName:@"Manager" inManagedObjectContext:self.managedObjectContext];

NSArray *zipcodesArray = [[dict objectForKey:@"zipcodes"] componentsSeparatedByString:@","];

for (NSString *zip in zipcodesArray) {
     ???
}

So now that's the point where I am stuck. As later on I have to check the zipcodes via a searchBar they should be separated in the database. Do I now have to create a managedObjectModel for each zipcode? How do I connect all of them with the "one" manager entity? I'am sure there is a way to achieve that but I don't really know how.
Hopefully my question is understandable. If there's anything you would like to know, feel free to ask.
Thank you guys!

A: for (NSString *zip in zipcodesArray) {
  NSManagedObject* zipcode = [NSEntityDescription insertNewObjectForEntityName:@"Zipcode"
                                                  inManagedObjectContext:self.managedObjectContext];
  [zipcode setValue:zip forKey:@"zip"];
  [zipcode setValue:manager forKey:@"manager"];
}

By establishing the relation from the zipcode to the manager on the last line, Core Data will automatically take care of inserting the zipcode into the relation from the manager back to the zipcodes.

A: Create a managed object instance of Zipcode. Set that object's zip attribute to the value of the string from your zipcodesArray. When you're done, save the managed object to your data store, check for errors, and repeat until you've walked all the way through your zip code array.


text:
Q: How we can pass the browser name through command prompt in protractor I am using protractor-cucumber frame work with protractor 5.2.2. and cucumber 3.2.1. i have to pass browser name through command prompt instead of hard coding in config file.

A: Case 1: Specify the browser name in cmd line only to make script run on that browser.
 // conf.js
 capabilities: {
    browserName: 'chrome'
 }

protractor conf.js --browser=firefox // will run on firefox
protractor conf.js // with run on chrome
Case 2: Want to use the browser name for some code logic before protractor runner launched
You can use process.argv to get all stuff in command and extract the browser name you passed-in.
// cmd.params.js
// parse cmd parameters

var params = {};
process.argv.slice(3).forEach(function (arg) {
    let flag = arg.split('=')[0];
    let value = arg.split('=')[1];
    let name = flag.replace('--', '');

    params[name] = value;
});

module.exports = params;

// conf.js
var params = require('./cmd.params.js');

var browser = params.browser;
// now you can use the variable: browser anywhere in conf.js

var multiCapabilities = browser.split(',').map(function(browserName){
    return {
        browserName: browserName.trim()
    };
})

exports.config = {
    multiCapabilities: multiCapabilities
    ....
};

protractor conf.js --browser=firefox // will run only on firefox
protractor conf.js --browser="firefox, chrome" // will run on firefox and chrome


text:
Q: How can I assign values from one array to another according to the index more efficiently? I am trying to replace the values of one array with another according to how many ones are in the source array. I assign a value from a given index in the replacement array based on the sum. Thus, if there are 2 ones in a row, it assigns a value of l1[1] to the species, and if there is one unit, it assigns a value of l1[0] to the output.
It will be better seen in a specific example:
import numpy as np

l1 = np.array([4, 5])
x112 = np.array([[0, 0], [0, 1], [1, 1], [0, 0], [1, 0], [1, 1]])

array([[0, 0],
       [1, 0],
       [1, 1],
       [0, 0],
       [1, 0],
       [1, 1]])

Required output:
[[0]
 [4]
 [5]
 [0]
 [4]
 [5]]

I did this by counting the units in each row and assigning accordingly using np.where:
x1x2 = np.array([0, 1, 2, 0 1, 2]) #count value 1
x1x2 = np.where(x1x2 != 1, x1x2, l1[0])
x1x2 = np.where(x1x2 != 2, x1x2, l1[1])
print(x1x2)

output
[0 4 5 0 4 5]

Could this be done more effectively?

A: Okay I actually gave devectorizing your code a shot. First the vectorized NumPy you have:
def op(x112, l1):
    # bit of cheating, adding instead of counting 1s
    x1x2 = x112[:,0] + x112[:,1]

    x1x2=np.where(x1x2 != 1, x1x2, l1[0])
    x1x2=np.where(x1x2 != 2, x1x2, l1[1])
    return x1x2

The most efficient alternative is to loop through x112 only once, so let's do a Numba loop.
import numba as nb

@nb.njit
def loop(x112, l1):
    d0, d1 = x112.shape
    x1x2 = np.zeros(d0, dtype = x112.dtype)
    for i in range(d0):
        # actually count the 1s
        num1s = 0
        for j in range(d1):
            if x112[i,j] == 1:
                num1s += 1

        if num1s == 1:
            x1x2[i] = l1[0]
        elif num1s == 2:
            x1x2[i] = l1[1]
    return x1x2

Numba loop has a ~9-10x speed improvement on my laptop.
%timeit op(x112, l1)
8.05 µs ± 34.4 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

%timeit loop(x112, l1)
873 ns ± 5.09 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

As @Mad_Physicist requested, timings with a bigger array. I'm including his advanced-indexing method too.
x112 = np.random.randint(0, 2, size = (100000, 2))
l1_v2 = np.array([0,4,5])

%timeit op(x112, l1)
1.35 ms ± 27.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

%timeit loop(x112, l1)
956 µs ± 2.78 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

%timeit l1_v2[x112.sum(1)]
1.2 ms ± 1.05 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

EDIT: Okay maybe take these timings with a grain of salt because when I went to restart the IPython kernel and reran this stuff, op(x112, l1) improved to 390 µs ± 22.1 µs per loop while the other methods retained the same performance (971 µs, 1.23 ms).

A: You can use direct indexing:
l1 = np.array([0, 4, 5])
x112 = np.array([[0, 0], [0, 1], [1, 1], [0, 0], [1, 0], [1, 1]])

result = l1[x112.sum(1)]

This works if you're at liberty to prepend the zero to l1 at creation time. If not:
result = np.r_[0, l1][x112.sum(1)]


text:
Q: Saving an OpenXML Document (Word) generated from a template I have a bit of code that will open a Word 2007 (docx) document and update the appropriate CustomXmlPart (thus updating the Content Controls in the document itself as they are mapped to the CustomXmlPart) but can't work out how to save this as a new file.! Surely it can't be that hard!
My current thinking is that I need to open the template and copy the content into a new, blank document - file by file, updating the CustomXmlPart when I encounter it.
Call me old fashioned but that sounds a little bit clunky to me!
Why can't I just do a WordprocessingDocument.SaveAs(filename); ...?
Please tell me I am missing something simple here.
Thanks in advance

A: OpenXml 2.8.1 has a SaveAs method that seems to do the trick.
var document = WordprocessingDocument.Open(specificationPath, true);
document.SaveAs("filePath/documentCopy.docx");

A: Are you referring to the OpenXml SDK? Unfortunately, as of OpenXml SDK 2.0, there's no SaveAs method. You'll need to:

*

*Make a temporary copy of your template file, naming it whatever you want.

*Perform your OpenXml changes on the above file.

*Save the appropriate sections (ie. using the .myWordDocument.MainDocumentPart.Document.Save() method for the main content or someHeaderPart.Header.Save() method for a particular header).

A: Indeed you can, at least, in OpenXml SDK 2.5. However, watchout to work with a copy of the original file, because changes in the XML will be actually reflected in the file. Here you have the methods Load and Save of my custom class (after removing some validation code,...):
    public void Load(string pathToDocx)
    {
        _tempFilePath = CloneFileInTemp(pathToDocx);
        _document = WordprocessingDocument.Open(_tempFilePath, true);
        _documentElement = _document.MainDocumentPart.Document;
    }

    public void Save(string pathToDocx)
    {
        using(FileStream fileStream = new FileStream(pathToDocx, FileMode.Create))
        {
            _document.MainDocumentPart.Document.Save(fileStream);
        }
    }

Having "_document" as a WordprocessingDocument instance.

A: You can use a MemoryStream to write the changes, rather than in the original file. Consequently, you can save that MemoryStream to a new file:
byte[] byteArray = File.ReadAllBytes("c:\\temp\\mytemplate.docx");
using (var stream = new MemoryStream())
{
    stream.Write(byteArray, 0, byteArray.Length);
    using (var wordDoc = WordprocessingDocument.Open(stream, true))
    {
       // Do work here
       // ...
       wordDoc.MainDocumentPart.Document.Save(); // won't update the original file
    }
    // Save the file with the new name
    stream.Position = 0;
    File.WriteAllBytes("C:\\temp\\newFile.docx", stream.ToArray());
}

A: In Open XML SDK 2.5 Close saves changes when AutoSave is true.
See my answer here:
https://stackoverflow.com/a/36335092/3285954


text:
Q: Configure better index choices for MySQL I have a MySQL table with ~17M rows where I end up doing a lot of aggregation queries.
For this example lets say I have index_on_b, index_on_c, compound_index_on_a_b, compound_index_on_a_c
I try and run a query explain
EXPLAIN SELECT SUM(revenue) FROM table WHERE a = some_value AND b = other_value

And I find that the selected index is index_on_b, but when I use a query hint
SELECT SUM(revenue) FROM table USE INDEX(compound_index_on_a_b)

The query runs way way faster. Is there anything I can do in MySQL config to make MySQL choose the compound indexes first?

A: There are 2 possible routes you can take:
A) The index resolution process is when according to the optimizer all things are equal based on the order the indexes are created in. You could drop index_b and recreate it and check if the optimizer was in a scenario where it just thought they were the same.
Or
B) Use optimizer_search_depth (see https://mariadb.com/blog/setting-optimizer-search-depth-mysql). By altering this parameter you determine how much effort the optimizer is allowed to spend on a query plan, and it might come up with the much better solution of using the combined index.

A: A possible explanation:
If a has the same value throughout the table, then INDEX(b) is actually better than INDEX(a,b).  This is because the former is smaller, hence faster to work with.  Note that both will return the same number of rows, even without further checking of a.
Please provide:
SHOW CREATE TABLE
SHOW INDEXES  -- to see cardinality
EXPLAIN SELECT


text:
Q: On QTreeView double_Clicked event: how to know which folder was clicked? I'm still pretty new to C++ and qt creator. I have a TreeView displaying a directory, and upon double-clicking a folder I'd like to be able to get the directory of the folder, so i can do something with the contents. I notice the double_Clicked event passing along a "const QModelIndex& index" and I suppose this holds some information on which folder of the tree was clicked. I can't find any documentation on this signal, and what the "index" passed along could be. Does anyone have an explanation, tutorial, example, documentation, ... for me? I've been searching for awhile and trying things out but I can't find the solution. Or additionally: how can I check what gets passed along? How could I print this, or know what it is?

A: You can set up your treeView in the constructor like this:
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    model = new QFileSystemModel(this);
    model->setRootPath("");
    ui->treeView->setModel(model);
    ui->treeView->setRootIndex(model->index("/home/waqar/"));
}

And in the double_Clicked() slot, use the QModelIndex to get the name of the folder you clicked on:
void MainWindow::on_treeView_doubleClicked(const QModelIndex &index)
{
    //displays the name of the folder you clicked on in the terminal
    qDebug () << index.data(Qt::DisplayRole).toString();

   //get full path
  QString path = model->filePath(index)
}


text:
Q: How can I rotate the logo circle on its center in svg file? My svg Logo contains a text "My Smart Closet" and a circle. Normally the result should be like this : click to see
The circle must rotate in the right of the text on its own center. But when I apply animateTransform before the closing  tag, the circle changes it position!
Please check the code :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   id="svg8"
   version="1.1"
   viewBox="0 0 60.009521 7.646053"
   height="28.89847"
   width="226.80762"
   sodipodi:docname="LogoO2.svg"
   inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1366"
     inkscape:window-height="705"
     id="namedview974"
     showgrid="false"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:zoom="1.5181291"
     inkscape:cx="64.199039"
     inkscape:cy="-10.196825"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg8"
     units="px" />
  <defs
     id="defs2">
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="marker1763"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#1b4d82;fill-opacity:1;fill-rule:evenodd;stroke:#1b4d82;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1761" />
    </marker>
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="marker1755"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#1b4d82;fill-opacity:1;fill-rule:evenodd;stroke:#1b4d82;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1753" />
    </marker>
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="DotS"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#aa2224;fill-opacity:1;fill-rule:evenodd;stroke:#aa2224;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1553" />
    </marker>
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="marker1759"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#a92121;fill-opacity:1;fill-rule:evenodd;stroke:#a92121;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1757" />
    </marker>
  </defs>
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     transform="matrix(0.56629515,0,0,0.56629515,-27.797677,-51.624623)"
     id="layer1">
    <text
       id="text817"
       y="101.96429"
       x="49.136906"
       style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:1;stroke-opacity:1"
       xml:space="preserve"><tspan
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.69999981px;line-height:0px;font-family:'Tropical Summer Signature';-inkscape-font-specification:'Tropical Summer Signature';stroke:#000000;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:1;stroke-opacity:1"
         y="101.96429"
         x="49.136906"
         id="tspan815">My Smart Closet</tspan></text>
  </g>
  <g
     id="g871"
     transform="matrix(0.17003611,0,0,0.17003961,52.363618,0)">
    <path
       inkscape:connector-curvature="0"
       style="opacity:1;fill:#d3b444;fill-opacity:1;stroke:#cfae3b;stroke-width:1.23599994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
       id="path1555"
       d="M 44.34832,22.48316 A 21.86515,21.86515 0 0 1 22.48316,44.34831 21.86515,21.86515 0 0 1 0.61799997,22.48316 21.86515,21.86515 0 0 1 22.48316,0.61799997 21.86515,21.86515 0 0 1 44.34832,22.48316 Z" />
    <path
       id="path1557"
       d="m 10.80167,33.15435 -0.27407,0.44526 c -0.10927,0.18848 -0.21307,0.38607 -0.24767,0.60187 -0.0483,0.30777 0.051,0.62009 0.17391,0.90691 0.12293,0.28683 0.27226,0.56637 0.33144,0.87322 0.0938,0.48442 -0.0601,1.00799 -0.39062,1.37403 -0.33053,0.36604 -0.82952,0.57092 -1.32304,0.55635 C 8.5781,37.89739 8.09733,37.66705 7.7668,37.30101 7.43627,36.93496 7.25598,36.43871 7.26235,35.94519 c 0.005,-0.43706 0.15389,-0.8714 0.41795,-1.22014"
       inkscape:connector-curvature="0"
       style="fill:none;stroke:#1b4d82;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1763)" />
    <path
       id="path1559"
       d="m 33.65565,11.52324 0.27408,-0.44526 C 34.039,10.88949 34.1428,10.6919 34.1774,10.4761 34.2257,10.16834 34.1264,9.85602 34.00349,9.56919 33.88056,9.28237 33.73123,9.00283 33.67204,8.69597 33.57824,8.21156 33.73214,7.68799 34.06267,7.32195 34.3932,6.9559 34.89219,6.75103 35.38571,6.7656 c 0.49352,0.0146 0.97429,0.24494 1.30482,0.61098 0.33053,0.36604 0.51082,0.86229 0.50445,1.35581 -0.006,0.43707 -0.15389,0.8714 -0.41795,1.22014"
       inkscape:connector-curvature="0"
       style="fill:none;stroke:#1b4d82;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1755)" />
    <path
       id="path1561"
       d="m 37.33528,26.35893 c 0.509,-1.38859 -0.26042,-2.46669 -1.19191,-3.37178 -0.8277,-0.80493 -1.82202,-1.75646 -2.21447,-2.88191 -0.52084,-1.4924 0.16845,-3.02395 0.66106,-4.42985 0.24312,-0.69202 0.54542,-1.30118 0.43707,-2.05785 -0.26589,-1.84297 -2.70344,-3.04399 -4.25503,-1.95588 -0.48259,0.33873 -0.84044,0.8368 -1.23744,1.2675 -0.79219,0.85956 -1.72915,1.75919 -2.87098,2.07697 -1.77923,0.49534 -3.33901,-0.62373 -4.99349,-0.98613 -1.23198,-0.26952 -2.34103,0.17847 -2.99481,1.2766 -0.19122,0.32143 -0.35876,0.62282 -0.43889,0.99433 -0.39791,1.8466 1.34125,3.64677 3.16418,3.36632 1.15185,-0.17756 1.73552,-1.11725 2.4676,-1.92036 0.59551,-0.65287 1.33579,-1.21741 2.13617,-1.57344 3.43825,-1.53064 7.42739,1.527 7.01855,5.27393 -0.21124,1.93766 -2.04328,3.93724 -0.69475,5.78567 0.23037,0.31596 0.51355,0.49352 0.84135,0.68838 1.59985,0.94971 3.49927,0.2677 4.16761,-1.55432 z M 7.12216,18.31873 c -0.50901,1.3886 0.26041,2.4667 1.19191,3.37179 0.8277,0.80493 1.82202,1.75646 2.21447,2.8819 0.52084,1.4924 -0.16845,3.02396 -0.66106,4.42985 -0.24312,0.69203 -0.54542,1.30119 -0.43707,2.05786 0.26588,1.84296 2.70344,3.04398 4.25503,1.95587 0.48259,-0.33872 0.84044,-0.8368 1.23744,-1.26749 0.79218,-0.85957 1.72915,-1.75919 2.87098,-2.07698 1.77923,-0.49534 3.33901,0.62373 4.99348,0.98613 1.23199,0.26953 2.34104,-0.17847 2.99482,-1.27659 0.19122,-0.32143 0.35876,-0.62282 0.43889,-0.99433 0.39791,-1.84661 -1.34125,-3.64677 -3.16418,-3.36632 -1.15185,0.17756 -1.73552,1.11725 -2.46761,1.92036 -0.5955,0.65287 -1.33578,1.21741 -2.13616,1.57344 -3.43825,1.53064 -7.4274,-1.527 -7.01856,-5.27394 0.21125,-1.93766 2.04329,-3.93724 0.69476,-5.78566 C 11.89893,17.13865 11.61575,16.96109 11.28794,16.76624 9.6881,15.81653 7.78868,16.49853 7.12033,18.32055 Z"
       inkscape:connector-curvature="0"
       style="fill:#1b4d82;fill-opacity:1;stroke-width:0.89733565" />
    <path
       id="path1563"
       d="m 18.0643,37.46406 c 1.38859,0.509 2.46669,-0.26042 3.37178,-1.19191 0.80493,-0.8277 1.75646,-1.82202 2.88191,-2.21447 1.4924,-0.52084 3.02395,0.16845 4.42985,0.66106 0.69202,0.24312 1.30118,0.54542 2.05785,0.43707 1.84297,-0.26589 3.04399,-2.70344 1.95588,-4.25503 -0.33873,-0.48259 -0.83681,-0.84044 -1.2675,-1.23744 -0.85956,-0.79218 -1.75919,-1.72915 -2.07697,-2.87098 -0.49535,-1.77923 0.62373,-3.33901 0.98613,-4.99349 0.26952,-1.23198 -0.17847,-2.34103 -1.2766,-2.99481 -0.32143,-0.19122 -0.62282,-0.35876 -0.99433,-0.43889 -1.8466,-0.39791 -3.64677,1.34125 -3.36632,3.16418 0.17756,1.15185 1.11725,1.73552 1.92036,2.4676 0.65287,0.59551 1.21741,1.33579 1.57344,2.13617 1.53064,3.43825 -1.527,7.42739 -5.27393,7.01855 -1.93767,-0.21125 -3.93724,-2.04328 -5.78567,-0.69475 -0.31596,0.23037 -0.49352,0.51355 -0.68838,0.84135 -0.94971,1.59985 -0.2677,3.49927 1.55432,4.16761 z"
       inkscape:connector-curvature="0"
       style="fill:#a92121;fill-opacity:1;stroke-width:0.89733565" />
    <path
       id="path1565"
       d="m 32.88442,33.7717 0.44526,0.27408 c 0.18848,0.10926 0.38607,0.21307 0.60187,0.24767 0.30777,0.0483 0.62009,-0.051 0.90691,-0.17392 0.28683,-0.12292 0.56637,-0.27225 0.87322,-0.33144 0.48442,-0.0938 1.00799,0.0601 1.37403,0.39063 0.36604,0.33053 0.57092,0.82951 0.55635,1.32303 -0.0146,0.49352 -0.24494,0.97429 -0.61098,1.30483 -0.36605,0.33053 -0.8623,0.51082 -1.35582,0.50444 -0.43706,-0.005 -0.8714,-0.15388 -1.22014,-0.41794"
       inkscape:connector-curvature="0"
       style="fill:none;fill-opacity:1;stroke:#aa2224;stroke-width:0.73000002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#DotS)" />
    <path
       id="path1567"
       d="m 26.6226,6.83936 c -1.38859,-0.509 -2.46669,0.26042 -3.37178,1.19192 -0.80493,0.8277 -1.75646,1.82202 -2.88191,2.21447 -1.4924,0.52084 -3.02395,-0.16845 -4.42985,-0.66106 -0.69202,-0.24312 -1.30118,-0.54542 -2.05785,-0.43707 -1.84297,0.26588 -3.04399,2.70344 -1.95588,4.25503 0.33873,0.48259 0.8368,0.84044 1.2675,1.23744 0.85956,0.79218 1.75919,1.72914 2.07697,2.87098 0.49534,1.77922 -0.62373,3.33901 -0.98613,4.99348 -0.26952,1.23198 0.17847,2.34104 1.2766,2.99482 0.32142,0.19122 0.62282,0.35876 0.99433,0.43889 1.8466,0.39791 3.64677,-1.34125 3.36632,-3.16418 -0.17756,-1.15185 -1.11725,-1.73552 -1.92036,-2.46761 -0.65287,-0.5955 -1.21742,-1.33578 -1.57344,-2.13616 -1.53065,-3.43825 1.527,-7.4274 5.27393,-7.01856 1.93766,0.21125 3.93724,2.04329 5.78567,0.69476 0.31596,-0.23037 0.49352,-0.51356 0.68838,-0.84136 0.94971,-1.59984 0.2677,-3.49926 -1.55432,-4.16761 z"
       inkscape:connector-curvature="0"
       style="fill:#aa2224;fill-opacity:1;stroke-width:0.89733565" />
    <path
       id="path1569"
       d="M 11.80237,10.53165 11.35711,10.25757 C 11.16863,10.1483 10.97104,10.0445 10.75524,10.0099 10.44747,9.9616 10.13515,10.0609 9.84833,10.18382 9.5615,10.30674 9.28196,10.45607 8.9751,10.51526 8.49069,10.60906 7.96712,10.45516 7.60108,10.12463 7.23504,9.7941 7.03016,9.29512 7.04473,8.8016 7.05933,8.30808 7.28967,7.8273 7.65571,7.49677 8.02176,7.16624 8.51801,6.98595 9.01153,6.99233 c 0.43706,0.005 0.8714,0.15388 1.22014,0.41794"
       inkscape:connector-curvature="0"
       style="fill:none;stroke:#a92121;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1759)" />
       <animateTransform
     attributeName="transform"
     attributeType="XML"
     type="rotate"

     from="0 22 22 "
     to="360 22 22"
     dur="5s"
     repeatCount="indefinite" />
  </g>
</svg>

Please notice that: from="0 22 22 "  to="360 22 22" , 22 is 50% of the 44px (widht and height of the circle) .
So please how can I make it rotate in its position (in the right of the text).
Many thanks.

A: I'm transforming the group you need to rotate in a symbol and I'm animating the symbol.
The symbol has a viewBox="0 0 45 45". This is important because I need to give the use element a size (width) and a position (x).
Please observe that I've deleted the transform.
Also in order to calculate the rotation center of the use element I've used elUse.getBBox() to get the position and the size.

<svg viewBox="0 0 60.009521 7.646053">

  <defs id="defs2">
    <marker style="overflow:visible" id="marker1763" refX="0" refY="0" orient="auto">
      <path transform="matrix(0.2,0,0,0.2,1.48,0.2)" style="fill:#1b4d82;fill-opacity:1;fill-rule:evenodd;stroke:#1b4d82;stroke-width:1.00000003pt;stroke-opacity:1" d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" id="path1761" />
    </marker>
    <marker style="overflow:visible" id="marker1755" refX="0" refY="0" orient="auto">
      <path transform="matrix(0.2,0,0,0.2,1.48,0.2)" style="fill:#1b4d82;fill-opacity:1;fill-rule:evenodd;stroke:#1b4d82;stroke-width:1.00000003pt;stroke-opacity:1" d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" id="path1753" />
    </marker>
    <marker style="overflow:visible" id="DotS" refX="0" refY="0" orient="auto">
      <path transform="matrix(0.2,0,0,0.2,1.48,0.2)" style="fill:#aa2224;fill-opacity:1;fill-rule:evenodd;stroke:#aa2224;stroke-width:1.00000003pt;stroke-opacity:1" d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" id="path1553" />
    </marker>
    <marker style="overflow:visible" id="marker1759" refX="0" refY="0" orient="auto">
      <path transform="matrix(0.2,0,0,0.2,1.48,0.2)" style="fill:#a92121;fill-opacity:1;fill-rule:evenodd;stroke:#a92121;stroke-width:1.00000003pt;stroke-opacity:1" d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z" id="path1757" />
    </marker>
  </defs>

  <g transform="matrix(0.56629515,0,0,0.56629515,-27.797677,-51.624623)" id="layer1">
    <text id="text817" y="101.96429" x="49.136906" style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:1;stroke-opacity:1" xml:space="preserve">
      <tspan style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.69999981px;line-height:0px;font-family:'Tropical Summer Signature';-inkscape-font-specification:'Tropical Summer Signature';stroke:#000000;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:1;stroke-opacity:1" y="101.96429" x="49.136906" id="tspan815">My Smart Closet</tspan>
    </text>
  </g>
  <symbol viewBox="0 0 45 45" id="g871">
    <path style="opacity:1;fill:#d3b444;fill-opacity:1;stroke:#cfae3b;stroke-width:1.23599994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke" id="path1555" d="M 44.34832,22.48316 A 21.86515,21.86515 0 0 1 22.48316,44.34831 21.86515,21.86515 0 0 1 0.61799997,22.48316 21.86515,21.86515 0 0 1 22.48316,0.61799997 21.86515,21.86515 0 0 1 44.34832,22.48316 Z" />
    <path id="path1557" d="m 10.80167,33.15435 -0.27407,0.44526 c -0.10927,0.18848 -0.21307,0.38607 -0.24767,0.60187 -0.0483,0.30777 0.051,0.62009 0.17391,0.90691 0.12293,0.28683 0.27226,0.56637 0.33144,0.87322 0.0938,0.48442 -0.0601,1.00799 -0.39062,1.37403 -0.33053,0.36604 -0.82952,0.57092 -1.32304,0.55635 C 8.5781,37.89739 8.09733,37.66705 7.7668,37.30101 7.43627,36.93496 7.25598,36.43871 7.26235,35.94519 c 0.005,-0.43706 0.15389,-0.8714 0.41795,-1.22014" style="fill:none;stroke:#1b4d82;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1763)" />
    <path id="path1559" d="m 33.65565,11.52324 0.27408,-0.44526 C 34.039,10.88949 34.1428,10.6919 34.1774,10.4761 34.2257,10.16834 34.1264,9.85602 34.00349,9.56919 33.88056,9.28237 33.73123,9.00283 33.67204,8.69597 33.57824,8.21156 33.73214,7.68799 34.06267,7.32195 34.3932,6.9559 34.89219,6.75103 35.38571,6.7656 c 0.49352,0.0146 0.97429,0.24494 1.30482,0.61098 0.33053,0.36604 0.51082,0.86229 0.50445,1.35581 -0.006,0.43707 -0.15389,0.8714 -0.41795,1.22014" style="fill:none;stroke:#1b4d82;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1755)" />
    <path id="path1561" d="m 37.33528,26.35893 c 0.509,-1.38859 -0.26042,-2.46669 -1.19191,-3.37178 -0.8277,-0.80493 -1.82202,-1.75646 -2.21447,-2.88191 -0.52084,-1.4924 0.16845,-3.02395 0.66106,-4.42985 0.24312,-0.69202 0.54542,-1.30118 0.43707,-2.05785 -0.26589,-1.84297 -2.70344,-3.04399 -4.25503,-1.95588 -0.48259,0.33873 -0.84044,0.8368 -1.23744,1.2675 -0.79219,0.85956 -1.72915,1.75919 -2.87098,2.07697 -1.77923,0.49534 -3.33901,-0.62373 -4.99349,-0.98613 -1.23198,-0.26952 -2.34103,0.17847 -2.99481,1.2766 -0.19122,0.32143 -0.35876,0.62282 -0.43889,0.99433 -0.39791,1.8466 1.34125,3.64677 3.16418,3.36632 1.15185,-0.17756 1.73552,-1.11725 2.4676,-1.92036 0.59551,-0.65287 1.33579,-1.21741 2.13617,-1.57344 3.43825,-1.53064 7.42739,1.527 7.01855,5.27393 -0.21124,1.93766 -2.04328,3.93724 -0.69475,5.78567 0.23037,0.31596 0.51355,0.49352 0.84135,0.68838 1.59985,0.94971 3.49927,0.2677 4.16761,-1.55432 z M 7.12216,18.31873 c -0.50901,1.3886 0.26041,2.4667 1.19191,3.37179 0.8277,0.80493 1.82202,1.75646 2.21447,2.8819 0.52084,1.4924 -0.16845,3.02396 -0.66106,4.42985 -0.24312,0.69203 -0.54542,1.30119 -0.43707,2.05786 0.26588,1.84296 2.70344,3.04398 4.25503,1.95587 0.48259,-0.33872 0.84044,-0.8368 1.23744,-1.26749 0.79218,-0.85957 1.72915,-1.75919 2.87098,-2.07698 1.77923,-0.49534 3.33901,0.62373 4.99348,0.98613 1.23199,0.26953 2.34104,-0.17847 2.99482,-1.27659 0.19122,-0.32143 0.35876,-0.62282 0.43889,-0.99433 0.39791,-1.84661 -1.34125,-3.64677 -3.16418,-3.36632 -1.15185,0.17756 -1.73552,1.11725 -2.46761,1.92036 -0.5955,0.65287 -1.33578,1.21741 -2.13616,1.57344 -3.43825,1.53064 -7.4274,-1.527 -7.01856,-5.27394 0.21125,-1.93766 2.04329,-3.93724 0.69476,-5.78566 C 11.89893,17.13865 11.61575,16.96109 11.28794,16.76624 9.6881,15.81653 7.78868,16.49853 7.12033,18.32055 Z" style="fill:#1b4d82;fill-opacity:1;stroke-width:0.89733565" />
    <path id="path1563" d="m 18.0643,37.46406 c 1.38859,0.509 2.46669,-0.26042 3.37178,-1.19191 0.80493,-0.8277 1.75646,-1.82202 2.88191,-2.21447 1.4924,-0.52084 3.02395,0.16845 4.42985,0.66106 0.69202,0.24312 1.30118,0.54542 2.05785,0.43707 1.84297,-0.26589 3.04399,-2.70344 1.95588,-4.25503 -0.33873,-0.48259 -0.83681,-0.84044 -1.2675,-1.23744 -0.85956,-0.79218 -1.75919,-1.72915 -2.07697,-2.87098 -0.49535,-1.77923 0.62373,-3.33901 0.98613,-4.99349 0.26952,-1.23198 -0.17847,-2.34103 -1.2766,-2.99481 -0.32143,-0.19122 -0.62282,-0.35876 -0.99433,-0.43889 -1.8466,-0.39791 -3.64677,1.34125 -3.36632,3.16418 0.17756,1.15185 1.11725,1.73552 1.92036,2.4676 0.65287,0.59551 1.21741,1.33579 1.57344,2.13617 1.53064,3.43825 -1.527,7.42739 -5.27393,7.01855 -1.93767,-0.21125 -3.93724,-2.04328 -5.78567,-0.69475 -0.31596,0.23037 -0.49352,0.51355 -0.68838,0.84135 -0.94971,1.59985 -0.2677,3.49927 1.55432,4.16761 z" style="fill:#a92121;fill-opacity:1;stroke-width:0.89733565" />
    <path id="path1565" d="m 32.88442,33.7717 0.44526,0.27408 c 0.18848,0.10926 0.38607,0.21307 0.60187,0.24767 0.30777,0.0483 0.62009,-0.051 0.90691,-0.17392 0.28683,-0.12292 0.56637,-0.27225 0.87322,-0.33144 0.48442,-0.0938 1.00799,0.0601 1.37403,0.39063 0.36604,0.33053 0.57092,0.82951 0.55635,1.32303 -0.0146,0.49352 -0.24494,0.97429 -0.61098,1.30483 -0.36605,0.33053 -0.8623,0.51082 -1.35582,0.50444 -0.43706,-0.005 -0.8714,-0.15388 -1.22014,-0.41794" inkscape:connector-curvature="0" style="fill:none;fill-opacity:1;stroke:#aa2224;stroke-width:0.73000002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#DotS)" />
    <path id="path1567" d="m 26.6226,6.83936 c -1.38859,-0.509 -2.46669,0.26042 -3.37178,1.19192 -0.80493,0.8277 -1.75646,1.82202 -2.88191,2.21447 -1.4924,0.52084 -3.02395,-0.16845 -4.42985,-0.66106 -0.69202,-0.24312 -1.30118,-0.54542 -2.05785,-0.43707 -1.84297,0.26588 -3.04399,2.70344 -1.95588,4.25503 0.33873,0.48259 0.8368,0.84044 1.2675,1.23744 0.85956,0.79218 1.75919,1.72914 2.07697,2.87098 0.49534,1.77922 -0.62373,3.33901 -0.98613,4.99348 -0.26952,1.23198 0.17847,2.34104 1.2766,2.99482 0.32142,0.19122 0.62282,0.35876 0.99433,0.43889 1.8466,0.39791 3.64677,-1.34125 3.36632,-3.16418 -0.17756,-1.15185 -1.11725,-1.73552 -1.92036,-2.46761 -0.65287,-0.5955 -1.21742,-1.33578 -1.57344,-2.13616 -1.53065,-3.43825 1.527,-7.4274 5.27393,-7.01856 1.93766,0.21125 3.93724,2.04329 5.78567,0.69476 0.31596,-0.23037 0.49352,-0.51356 0.68838,-0.84136 0.94971,-1.59984 0.2677,-3.49926 -1.55432,-4.16761 z" inkscape:connector-curvature="0" style="fill:#aa2224;fill-opacity:1;stroke-width:0.89733565" />
    <path id="path1569" d="M 11.80237,10.53165 11.35711,10.25757 C 11.16863,10.1483 10.97104,10.0445 10.75524,10.0099 10.44747,9.9616 10.13515,10.0609 9.84833,10.18382 9.5615,10.30674 9.28196,10.45607 8.9751,10.51526 8.49069,10.60906 7.96712,10.45516 7.60108,10.12463 7.23504,9.7941 7.03016,9.29512 7.04473,8.8016 7.05933,8.30808 7.28967,7.8273 7.65571,7.49677 8.02176,7.16624 8.51801,6.98595 9.01153,6.99233 c 0.43706,0.005 0.8714,0.15388 1.22014,0.41794" style="fill:none;stroke:#a92121;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1759)" />

  </symbol>
  <use id="elUse" xlink:href="#g871" width="44" x="33" y="0">
    <animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0 54.997 3.82 " to="360 54.997 3.82" dur="5s" repeatCount="indefinite" />
  </use>
</svg>

UPDATE

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   id="svg8"
   version="1.1"
   viewBox="0 0 60.009521 7.646053"
   height="28.89847"
   width="226.80762"
   sodipodi:docname="LogoO2.svg"
   inkscape:version="0.92.4 (5da689c313, 2019-01-14)">
  <sodipodi:namedview
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1"
     objecttolerance="10"
     gridtolerance="10"
     guidetolerance="10"
     inkscape:pageopacity="0"
     inkscape:pageshadow="2"
     inkscape:window-width="1366"
     inkscape:window-height="705"
     id="namedview974"
     showgrid="false"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:zoom="1.5181291"
     inkscape:cx="64.199039"
     inkscape:cy="-10.196825"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:current-layer="svg8"
     units="px" />
  <defs
     id="defs2">
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="marker1763"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#1b4d82;fill-opacity:1;fill-rule:evenodd;stroke:#1b4d82;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1761" />
    </marker>
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="marker1755"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#1b4d82;fill-opacity:1;fill-rule:evenodd;stroke:#1b4d82;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1753" />
    </marker>
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="DotS"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#aa2224;fill-opacity:1;fill-rule:evenodd;stroke:#aa2224;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1553" />
    </marker>
    <marker
       inkscape:isstock="true"
       style="overflow:visible"
       id="marker1759"
       refX="0"
       refY="0"
       orient="auto"
       inkscape:stockid="DotS">
      <path
         inkscape:connector-curvature="0"
         transform="matrix(0.2,0,0,0.2,1.48,0.2)"
         style="fill:#a92121;fill-opacity:1;fill-rule:evenodd;stroke:#a92121;stroke-width:1.00000003pt;stroke-opacity:1"
         d="m -2.5,-1 c 0,2.76 -2.24,5 -5,5 -2.76,0 -5,-2.24 -5,-5 0,-2.76 2.24,-5 5,-5 2.76,0 5,2.24 5,5 z"
         id="path1757" />
    </marker>
  </defs>
  <metadata
     id="metadata5">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     transform="matrix(0.56629515,0,0,0.56629515,-27.797677,-51.624623)"
     id="layer1">
    <text
       id="text817"
       y="101.96429"
       x="49.136906"
       style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:1;stroke-opacity:1"
       xml:space="preserve"><tspan
         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:12.69999981px;line-height:0px;font-family:'Tropical Summer Signature';-inkscape-font-specification:'Tropical Summer Signature';stroke:#000000;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:1;stroke-opacity:1"
         y="101.96429"
         x="49.136906"
         id="tspan815">My Smart Closet</tspan></text>
  </g>
  <symbol viewBox="0 0 45 45"
     id="g871"
     transform="matrix(0.17003611,0,0,0.17003961,52.363618,0)">
    <path
       inkscape:connector-curvature="0"
       style="opacity:1;fill:#d3b444;fill-opacity:1;stroke:#cfae3b;stroke-width:1.23599994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:markers fill stroke"
       id="path1555"
       d="M 44.34832,22.48316 A 21.86515,21.86515 0 0 1 22.48316,44.34831 21.86515,21.86515 0 0 1 0.61799997,22.48316 21.86515,21.86515 0 0 1 22.48316,0.61799997 21.86515,21.86515 0 0 1 44.34832,22.48316 Z" />
    <path
       id="path1557"
       d="m 10.80167,33.15435 -0.27407,0.44526 c -0.10927,0.18848 -0.21307,0.38607 -0.24767,0.60187 -0.0483,0.30777 0.051,0.62009 0.17391,0.90691 0.12293,0.28683 0.27226,0.56637 0.33144,0.87322 0.0938,0.48442 -0.0601,1.00799 -0.39062,1.37403 -0.33053,0.36604 -0.82952,0.57092 -1.32304,0.55635 C 8.5781,37.89739 8.09733,37.66705 7.7668,37.30101 7.43627,36.93496 7.25598,36.43871 7.26235,35.94519 c 0.005,-0.43706 0.15389,-0.8714 0.41795,-1.22014"
       inkscape:connector-curvature="0"
       style="fill:none;stroke:#1b4d82;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1763)" />
    <path
       id="path1559"
       d="m 33.65565,11.52324 0.27408,-0.44526 C 34.039,10.88949 34.1428,10.6919 34.1774,10.4761 34.2257,10.16834 34.1264,9.85602 34.00349,9.56919 33.88056,9.28237 33.73123,9.00283 33.67204,8.69597 33.57824,8.21156 33.73214,7.68799 34.06267,7.32195 34.3932,6.9559 34.89219,6.75103 35.38571,6.7656 c 0.49352,0.0146 0.97429,0.24494 1.30482,0.61098 0.33053,0.36604 0.51082,0.86229 0.50445,1.35581 -0.006,0.43707 -0.15389,0.8714 -0.41795,1.22014"
       inkscape:connector-curvature="0"
       style="fill:none;stroke:#1b4d82;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1755)" />
    <path
       id="path1561"
       d="m 37.33528,26.35893 c 0.509,-1.38859 -0.26042,-2.46669 -1.19191,-3.37178 -0.8277,-0.80493 -1.82202,-1.75646 -2.21447,-2.88191 -0.52084,-1.4924 0.16845,-3.02395 0.66106,-4.42985 0.24312,-0.69202 0.54542,-1.30118 0.43707,-2.05785 -0.26589,-1.84297 -2.70344,-3.04399 -4.25503,-1.95588 -0.48259,0.33873 -0.84044,0.8368 -1.23744,1.2675 -0.79219,0.85956 -1.72915,1.75919 -2.87098,2.07697 -1.77923,0.49534 -3.33901,-0.62373 -4.99349,-0.98613 -1.23198,-0.26952 -2.34103,0.17847 -2.99481,1.2766 -0.19122,0.32143 -0.35876,0.62282 -0.43889,0.99433 -0.39791,1.8466 1.34125,3.64677 3.16418,3.36632 1.15185,-0.17756 1.73552,-1.11725 2.4676,-1.92036 0.59551,-0.65287 1.33579,-1.21741 2.13617,-1.57344 3.43825,-1.53064 7.42739,1.527 7.01855,5.27393 -0.21124,1.93766 -2.04328,3.93724 -0.69475,5.78567 0.23037,0.31596 0.51355,0.49352 0.84135,0.68838 1.59985,0.94971 3.49927,0.2677 4.16761,-1.55432 z M 7.12216,18.31873 c -0.50901,1.3886 0.26041,2.4667 1.19191,3.37179 0.8277,0.80493 1.82202,1.75646 2.21447,2.8819 0.52084,1.4924 -0.16845,3.02396 -0.66106,4.42985 -0.24312,0.69203 -0.54542,1.30119 -0.43707,2.05786 0.26588,1.84296 2.70344,3.04398 4.25503,1.95587 0.48259,-0.33872 0.84044,-0.8368 1.23744,-1.26749 0.79218,-0.85957 1.72915,-1.75919 2.87098,-2.07698 1.77923,-0.49534 3.33901,0.62373 4.99348,0.98613 1.23199,0.26953 2.34104,-0.17847 2.99482,-1.27659 0.19122,-0.32143 0.35876,-0.62282 0.43889,-0.99433 0.39791,-1.84661 -1.34125,-3.64677 -3.16418,-3.36632 -1.15185,0.17756 -1.73552,1.11725 -2.46761,1.92036 -0.5955,0.65287 -1.33578,1.21741 -2.13616,1.57344 -3.43825,1.53064 -7.4274,-1.527 -7.01856,-5.27394 0.21125,-1.93766 2.04329,-3.93724 0.69476,-5.78566 C 11.89893,17.13865 11.61575,16.96109 11.28794,16.76624 9.6881,15.81653 7.78868,16.49853 7.12033,18.32055 Z"
       inkscape:connector-curvature="0"
       style="fill:#1b4d82;fill-opacity:1;stroke-width:0.89733565" />
    <path
       id="path1563"
       d="m 18.0643,37.46406 c 1.38859,0.509 2.46669,-0.26042 3.37178,-1.19191 0.80493,-0.8277 1.75646,-1.82202 2.88191,-2.21447 1.4924,-0.52084 3.02395,0.16845 4.42985,0.66106 0.69202,0.24312 1.30118,0.54542 2.05785,0.43707 1.84297,-0.26589 3.04399,-2.70344 1.95588,-4.25503 -0.33873,-0.48259 -0.83681,-0.84044 -1.2675,-1.23744 -0.85956,-0.79218 -1.75919,-1.72915 -2.07697,-2.87098 -0.49535,-1.77923 0.62373,-3.33901 0.98613,-4.99349 0.26952,-1.23198 -0.17847,-2.34103 -1.2766,-2.99481 -0.32143,-0.19122 -0.62282,-0.35876 -0.99433,-0.43889 -1.8466,-0.39791 -3.64677,1.34125 -3.36632,3.16418 0.17756,1.15185 1.11725,1.73552 1.92036,2.4676 0.65287,0.59551 1.21741,1.33579 1.57344,2.13617 1.53064,3.43825 -1.527,7.42739 -5.27393,7.01855 -1.93767,-0.21125 -3.93724,-2.04328 -5.78567,-0.69475 -0.31596,0.23037 -0.49352,0.51355 -0.68838,0.84135 -0.94971,1.59985 -0.2677,3.49927 1.55432,4.16761 z"
       inkscape:connector-curvature="0"
       style="fill:#a92121;fill-opacity:1;stroke-width:0.89733565" />
    <path
       id="path1565"
       d="m 32.88442,33.7717 0.44526,0.27408 c 0.18848,0.10926 0.38607,0.21307 0.60187,0.24767 0.30777,0.0483 0.62009,-0.051 0.90691,-0.17392 0.28683,-0.12292 0.56637,-0.27225 0.87322,-0.33144 0.48442,-0.0938 1.00799,0.0601 1.37403,0.39063 0.36604,0.33053 0.57092,0.82951 0.55635,1.32303 -0.0146,0.49352 -0.24494,0.97429 -0.61098,1.30483 -0.36605,0.33053 -0.8623,0.51082 -1.35582,0.50444 -0.43706,-0.005 -0.8714,-0.15388 -1.22014,-0.41794"
       inkscape:connector-curvature="0"
       style="fill:none;fill-opacity:1;stroke:#aa2224;stroke-width:0.73000002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#DotS)" />
    <path
       id="path1567"
       d="m 26.6226,6.83936 c -1.38859,-0.509 -2.46669,0.26042 -3.37178,1.19192 -0.80493,0.8277 -1.75646,1.82202 -2.88191,2.21447 -1.4924,0.52084 -3.02395,-0.16845 -4.42985,-0.66106 -0.69202,-0.24312 -1.30118,-0.54542 -2.05785,-0.43707 -1.84297,0.26588 -3.04399,2.70344 -1.95588,4.25503 0.33873,0.48259 0.8368,0.84044 1.2675,1.23744 0.85956,0.79218 1.75919,1.72914 2.07697,2.87098 0.49534,1.77922 -0.62373,3.33901 -0.98613,4.99348 -0.26952,1.23198 0.17847,2.34104 1.2766,2.99482 0.32142,0.19122 0.62282,0.35876 0.99433,0.43889 1.8466,0.39791 3.64677,-1.34125 3.36632,-3.16418 -0.17756,-1.15185 -1.11725,-1.73552 -1.92036,-2.46761 -0.65287,-0.5955 -1.21742,-1.33578 -1.57344,-2.13616 -1.53065,-3.43825 1.527,-7.4274 5.27393,-7.01856 1.93766,0.21125 3.93724,2.04329 5.78567,0.69476 0.31596,-0.23037 0.49352,-0.51356 0.68838,-0.84136 0.94971,-1.59984 0.2677,-3.49926 -1.55432,-4.16761 z"
       inkscape:connector-curvature="0"
       style="fill:#aa2224;fill-opacity:1;stroke-width:0.89733565" />
    <path
       id="path1569"
       d="M 11.80237,10.53165 11.35711,10.25757 C 11.16863,10.1483 10.97104,10.0445 10.75524,10.0099 10.44747,9.9616 10.13515,10.0609 9.84833,10.18382 9.5615,10.30674 9.28196,10.45607 8.9751,10.51526 8.49069,10.60906 7.96712,10.45516 7.60108,10.12463 7.23504,9.7941 7.03016,9.29512 7.04473,8.8016 7.05933,8.30808 7.28967,7.8273 7.65571,7.49677 8.02176,7.16624 8.51801,6.98595 9.01153,6.99233 c 0.43706,0.005 0.8714,0.15388 1.22014,0.41794"
       inkscape:connector-curvature="0"
       style="fill:none;stroke:#a92121;stroke-width:0.73026383;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;marker-end:url(#marker1759)" />
       <animateTransform
     attributeName="transform"
     attributeType="XML"
     type="rotate"

     from="0 22 22 "
     to="360 22 22"
     dur="5s"
     repeatCount="indefinite" />
  </symbol>
    <use id="elUse" xlink:href="#g871" width="44" x="33" y="0">
    <animateTransform attributeName="transform" attributeType="XML" type="rotate" from="0 54.997 3.82 " to="360 54.997 3.82" dur="5s" repeatCount="indefinite" />
  </use>
</svg>


text:
Q: Does django orm create objects instantly I have a a django view which adds object id's to a queue via an API POST request. I then have a celery task which dequeues the id and does some processing. Sometimes the celery task throws an error indicating the object does not exists. I added a a 5 second delay to the view and I don't get that error anymore.
View:
def create(self, request):
    user = request.user
    serializer = UnpredictedSentenceSerializer(data=request.data)
    if serializer.is_valid():
        saved_raw_text = UnpredictedSentence.objects.create(
                                    raw_text=serializer.data['raw_text'],
                                    user=user)
        prediction.apply_async(
            args=[saved_raw_text.pk],
            countdown=5
        )
        print(saved_raw_text.pk)
        return Response(status=status.HTTP_200_OK)
    else:
        return Response(
                    serializer.errors, status=status.HTTP_400_BAD_REQUEST)

Task:
@task()
def prediction(id):
    print(id)
    print(type(id))
    UnpredictedSentence.objects.get(pk=id)
    try:
       un_sent = UnpredictedSentence.objects.get(pk=id)
    except UnpredictedSentence.DoesNotExist:
       un_sent = None
    if un_sent:
       print(type(un_sent.raw_text))
       text = json.loads(un_sent.raw_text)
       results = kudos.main(text['raw_text'])
       PredictedSentence.objects.create(
         cleaned_text=results['cleaned_text'],
         raw_text=results['raw_text'],
         sentiment=results['sentiment'],
         user=un_sent.user)
       print(results)

A: Almost certainly a transaction issue. Because of transaction isolation, other processes won't see objects that have been created until the transaction is committed, which happens at the end of the request. The five-second delay gives enough time for this to happen.


text:
Q: passing FormCollection to controller via JQuery Post method and getting data back... I am having a slight issue sending formCollection data to my controller action method in MVC using jQuery .Post method.  While I am sending the data via jQuery, it is not in the formCollection parameter of my action controller, well let me be more specific, it is in there, but not quite how I expected it to be in there...  First off, the formCollection parameter now has 2 entries... the PopID passed in (21) plus the serialized data passed in (FirstName=Fifo&LastName=Caputo&DateOfBirth=&DateOfBirth=7%2F29%2F2011+12%3A00%3A00+AM&City=&State=&Country=&Postal+Code=&deathIndicator=&email=&gender=&language=&NextOfKin=&Phone=)
What am I doing wrong here?  Controller Action.
    [HttpPost]
    public ActionResult SearchByDemographic(int PopID, FormCollection formCollection)
    {
    }

JavaScript-Jquery method to pass in values...
    $(function () {
    $("#DemoGraphSubmit").click(function (e) {
        e.preventDefault();
        var form = $("#DemoGraphID");
        var srlzdform = form.serialize();
        var PopID = <% =PopID %>
        var options = [];
        var serializedForm = form.serialize();
        $.post("/PatientACO/SearchByDemographic", {PopID:PopID,srlzdform:srlzdform}, function (data) {
            options = $.map(data, function (item, i) {
                return "<option value=" + item.Value + ">" + item.Text + "</option>";
            });
            $("#PatientListToAdd").html(options.join(""));
        });
    });
});

Any ideas?  I am going to keep looking.

A: Try this:
$.post("/PatientACO/SearchByDemographic", srlzdform, function (data) {

Although I am not sure why you want to use a FormCollection instead of a viewmodel.
Perhaps you want to take a look at NerdDinner
So here is your view (obviously more complex than this)
@model TestModel

<form action="@Url.Action("SearchByDemographic","PatientACO")" method="post">
    @Html.HiddenFor(model => model.PopID)
    @Html.TextBoxFor(model => model.Text)
</form>

Here is your action:
[HttpPost]
public ActionResult SearchByDemographic(TestModel model)
{
}

And here is your model
public class TestModel
{
    public int PopID { get; set; }
    public string Text { get; set; }
    // more properties
}

This way if you store your PopID in the model you don't have to do <%: PopID %> in your javascript.


text:
Q: Problems with vue rendering Json returns well but does not display Vue Rendering Problem The back end receives a 200ok signal, but the front end page does not show any results.
    methods:{
      async created() {
          try {
              let response = await axios.get('http://localhost:5000/process')
              this.msg = response.data
              this.msg.$forceUpdate()
          } catch (err) {
              // eslint-disable-next-line
              console.log(err)
          }
      }
      },
};

I've tried many things, such as forced asynchronous update rendering, but the results are still the same.

A: Instead of  this.msg.$forceUpdate() use this.$forceUpdate(); and write created() outof methods.
 <template>

        <div  v-bind:style="{ color: `${msg.font_color}`}">

{{msg.info_text}}

 {{msg.rate_adult}}

        <img :src="require(`../../static/dst/${msg.file_name}`)">

{{msg.part_name}} : {{msg.rate_part}}

    </template>


text:
Q: webapi, reading microsoft article, but contains error I am reading this article:
https://docs.asp.net/en/latest/tutorials/first-web-api.html.
and they say. you have to put this:
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using TodoApi.Models;

    namespace TodoApi.Controllers
    {
        [Route("api/[controller]")]
        public class TodoController : Controller
        {
            public TodoController(ITodoRepository todoItems)
            {
                TodoItems = todoItems;
            }
        }
    }

But where is TodoItems  declared?
Do I something wrong? Or is it mistake in the article?
Because If I put this in the file:
public ITodoRepository TodoItems { get; private set; }

The error goes away. But is this correct?

A: It's probably mistake. You should declare it as:
    public class TodoController : Controller
    {
        private readonly ITodoRepository TodoItems;

        public TodoController(ITodoRepository todoItems)
        {
            TodoItems = todoItems;
        }
    }

Here is using dependency injection by constructor.
So, I think that declaring of TodoItems as a public property is not a good idea. It should be a private readonly field that initializing only in constructor. In other case if you going to use inheritance it might be declared as a protected.


text:
Q: Absolute position background 100% of page height I am having trouble with giving my absolute positioned element a 100% height so it covers the entire page rather than just the screen height.
I am using LESS and this is what I have so far:
html, body {
    height: 100%;
    position: relative;
}

div#top-bar {
    background: #333;
    height: 50px;
    width: 100%;
}

nav#primary {
    background: #333;
    bottom: 0;
    min-height: 100%;
    left: -100%;
    padding-top: 50px;
    position: absolute;
    top: 0;
    width: 100%;
}

This gives me a nav#primary height of 100% but that isn't the page height, it's the screen height.
See this image:

I want the background to be the full height of the page, not the screen (so it covers the entire nav#primary)

A: Add this to your CSS
nav#primary {
    overflow: auto;
}

A: nav#primary {
background-image:url(../images/onlinekhabar.jpg);
        background-size:100% 100%;
}

A: Unless nav#primary containing all other content on the page, you can't set it to height: 100%. Have you considered using a background image on the body element? You can force the image to fill the screen with something like background-size: cover;.

A: Firstly, many thanks for all your help I wouldn't of done this without you guys.
I've managed to somehow get this working, my first step was to remove the absolute positioning from the nav#primary and use margin-left rather than the left option. I also needed to float left and display inline.
For my content div#main I also needed to float left and display inline. This is where for my mobile first approach I position:absolute it (so my navigation can overlay it). My small media query (min-height: 768px), set the position back to default (static).
In my jQuery I then needed to add this code to get the min-height to change based on the window height. (Note: min-height not height)
menu.css('minHeight', (jQuery(window).height() - 50) + 'px');

The -50 was to remove my topbar height.
The results:
Mobile:

Tablet:

A: It's because you set relative position at the body. Try to wrap your nav tag with the container and give relative position.
Something like this.
HTML :

CSS :
html, body {
    height: 100%;
}

header#top-bar {
    background: #333;
    height: 50px;
    width: 100%;
}

section#container {
    padding-top: 50px;
    position: relative;
    min-height: 100%;
    width: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -o-box-sizing: border-box;
    box-sizing: border-box;
    background: #333;
}

nav#primary {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
}


text:
Q: ORA-00904: "DISCIPLINE"."SPORT_NO": invalid identifier select
  sport_name
from
  GAMES.sport
where
  sport.sport_no = discipline.SPORT_NO;

HELP please, the table and column do exist in my database

A: Try this
SELECT
      SPORT_NAME
FROM
      GAMES.SPORT,
      GAMES.DISCIPLINE
WHERE
      SPORT.SPORT_NO = DISCIPLINE.SPORT_NO;

A: select
  sport_name
from
  SPORT
  inner join
     DISCIPLINE
        on SPORT.sport_no = DISCIPLINE.SPORT_NO;

SPORT.sport_no is a primary key of SPORT table
and
DISCIPLINE.SPORT_NO is a foreign key in DISCIPLINE table


text:
Q: PHP - Undefined index but it is defined and it appears defined in both "isset" and "print_r" <?php
      require("db.php");

      session_start();
      $id = $_SESSION["id"];

      $sql = "SELECT seguido FROM seguindo WHERE seguidor = '$id'";
      $result = $conn->query($sql) or die($conn->error);

      $posts = array();

      while($row = $result->fetch_assoc()){
        print_r($row);
        $id_seguindo = $row["seguido"];
        $sql = "SELECT imagem, descricao, tempo FROM posts WHERE id = '$id_seguindo' OR id='$id' ORDER BY tempo DESC";
        $result = $conn->query($sql) or die($conn->error);
        $row = $result->fetch_assoc();

        $posts[] = array(
            "imagem" => $row["imagem"],
            "descricao" => $row["descricao"],
            "tempo" => $row["tempo"]
        );
      }
      foreach($posts as $post){
          echo "
";
          echo "";
          echo "
" . $post["descricao"] . "
";
          echo "
" . $post["tempo"] . "
";
          echo "
";
      }

    ?>

For some reason, the while has become infinite and it is noticing that the "seguido" index is not defined. I don't know why this is happening and I've tried both the "isset" function and "print_r" to debug, but it didn't work.


text:
Q: Retrieving data from inner join using LIMIT and OFFSET These are my two tables:
table1
qid[PK]     |gid[PK]  |abcd     | xyz  |    date
---------------+---------+---------+------+------------
 00001      |     qwe |      54 |    a | 1994-11-29
 00002      |     asd |       0 |    s | 1994-11-29
 00003      |     azx |      50 | 0.25 | 1994-11-27

table2
qid[PK]     | gid[PK] | user[PK]
------------+---------+--------
 00001      |     qwe | shreya
 00001      |     qwe | nagma
 00001      |     qwe | koena
 00001      |     qwe | paoli
 00002      |     asd | anushka
 00002      |     asd | angelina
 00003      |     azx | jolie
 00003      |     azx | scarlett
 00003      |     azx | sharon
 00003      |     azx | jeniffer

As you can see for each qid and gid of table1 there can be any number of rows in table2.
My requirement :
I want to retrieve all the users for the first 10 values of qid and gid from the offset.
My Query :
    select  * from table1 q inner join table2 a on q.qid=a.qid
 and q.gid=a.gid  order by q.date desc limit 10 offset ?

But this query will retrieve  10 rows from offset from the inner join, But I want all rows from table 2 for the 10 rows[offset] from table1.
How can this be achieved?

A: Use a subquery (as displayed) or a CTE for that purpose:
SELECT *
FROM  (
   SELECT qid, gid
   FROM   table1
   ORDER  BY date DESC
   LIMIT  10
   OFFSET ?
   ) q
JOIN   table2 a USING (qid, gid);

USING (qid, gid) is just a shortcut for ON q.qid = a.qid AND q.gid = a.gid with the side effect that the two columns are only included once in the result.


text:
Q: Titanfall 2/Apex Legends Stop Refreshing Screen After Clicking Out of it Whenever playing these two games, occasionally a pop-up will open up and it will prioritize that over the game and show that. I will then click back into my game, get into a safe spot, then click out to deal with whatever popped up. It also happens when I change it from windowed to fullscreen, as it often opens in windowed
After I have done that though, the game will stop updating the picture (sound still works, button inputs are registered, and I can hear my mouse moving around over menu buttons) after a few seconds. The only way to get it to resume is to click out and back in again, but a few seconds later it freezes the image again.
I run the game in fullscreen with two monitors, and I was wondering if there is any way to prevent this without changing those two things, as the only way to fix it is to quit and restart the game.

A: As stated by @Varaquilex in there comment, I turned off Radeon Enhanced Sync. This stopped the game from freezing when the game opened in full-screen.


text:
Q: Cannot get past Dell "setup" while installing Ubuntu on a USB I was given a Dell Dimension e521, no operating system and a mystery 160GB Hard drive. By using a USB flash drive to install Ubuntu Studio 14.04, I cannot get past the Built-in Bios? I keep getting a message +corrupted registry, .../windows/system32/config/windows"
Wouldn't the Ubuntu installer bypass any windows XP installed? if there even is an operating system?
Start ups without the Ubuntu USB give me a simple response. "no operating system"
I have installed Linux including Ubuntu on a number of PC laptops without any trouble. The current HD can be wiped clean, re-formatted (there's nothing needed on it).
How do I get past the /windows/system32/config/windows ? I have no Windows installer. I only want to install linux.

A: It may be that the computer does not fully support booting from a USB stick, even in the off chance it supports booting from an external hard drive. Go into the bios (I believe it is F2 on dells) and go over to the boot page/tab. Move the USB option up above all hard drives. If it does not support booting from USB, then try burning a DVD and boot from that.

A: Try swapping the hard drive with another hard drive, preferably either an empty hard drive or a data hard drive that does not have either an operating system or a bootloader already installed on it. By "swapping" I mean putting another hard drive into an empty hard drive bay in the Dell Dimension, and then switching the cables from the old hard drive to the new hard drive.
In order to boot the computer from a USB flash drive you need to enter your BIOS setup utility by pressing one of these keys, usually: Delete, F2 or F10 as soon as the motherboard splash screen appears when the computer is booting. Dell computers usually use the F2 key to access the BIOS. In the BIOS menu, change the boot order so that the USB flash drive, which is usually called USB-HDD in newer computers, is the first entry in the boot sequence, and then save your new BIOS settings and exit the BIOS setup utility.


text:
Q: Complexity of Algorithm Here is my current code, the time and space complexities are displayed in two separate lines. I want to put them into the same line, each occupies half the width, how could I achieve that?
\algnewcommand\algorithmicinput{\textbf{Input:}}
\algnewcommand\algorithmicoutput{\textbf{Output:}}
\algnewcommand\algorithmictcomplex{\textbf{Time Complexity:}}
\algnewcommand\algorithmicscomplex{\textbf{Space Complexity:}}
\algnewcommand\Input{\item[\algorithmicinput]}
\algnewcommand\Output{\item[\algorithmicoutput]}
\algnewcommand\TimeComplex{\item[\algorithmictcomplex]}
\algnewcommand\SpaceComplex{\item[\algorithmicscomplex]}

\begin{algorithm}
\caption{Update the largest observation}\label{alg-max-element}
\begin{algorithmic}
\Input $x_{max}$, $x_{new}$
\Output $x_{max}$
\If{$x_{new} > x_{max}$}
    \State $x_{max} \gets x_{new}$
\EndIf
\end{algorithmic}
\hrule
\begin{algorithmic}
\TimeComplex{$\mathcal{O}(1)$}
\SpaceComplex{$\mathcal{O}(1)$} % put them on the same line
\end{algorithmic}
\end{algorithm}

current output


text:
Q: JWT connectiong failing with Connected App in a Different Org We have two SF orgs SF1 and SF2. In SF1, we create a connected app, uploaded a digital certificate, and have policy of 'Admin Authorized user'.  We added the needed profile. The client is able to connect via JWT token to SF1. Connecting to SF2 with same client id yields the error 'Missing Consumer Key Parameter' The client is using the same private key to sign the token. Also, the user belongs to the same profile in SF2. We are able to connect with Username Password flow to SF2.  Will the same connected app not work in a different environment?

A: Connected Apps in general work in any org (e.g. see the Data Loader, SFDX, etc). However, JWT-based flows need a Connected App per org, as far as I can tell. See for example Authorize an Org Using the JWT-Based Flow.


text:
Q: How to force Docker to rerun `apt-get update`? Some security updates have just come out and I want to rebuild my Docker images to take advantage of the updates.
However when I run docker build . it completes immediately without updating anything because nothing has changed in the Dockerfile, and everything is cached.  It doesn't even try to run the apt-get update line in my Dockerfile.
How can I force Docker to run the apt-get update command again, even though nothing has changed?
There is a --no-cache option that says it won't use the cache during the build, but I want it to use the cache for the commands before apt-get update and I want the results saved into the cache for the next run (replacing the currently cached images), so I definitely want to be using the cache.
I also can't use docker rmi to remove the image generated at the point after apt-get has been run, because it refuses to delete this image as the image has dependent child images.

A: You can try something like the following:
FROM ubuntu:16.04

# LAYER 1
RUN echo "$(date), layer1" > /tmp/cache.txt

# LAYER 2
RUN echo "$(date), layer2" >> /tmp/cache.txt

# LAYER 3
ARG FORCE_UPDATE=no
RUN echo "$(date), layer3" >> /tmp/cache.txt

# LAYER 4
RUN echo "$(date), layer4" >> /tmp/cache.txt

CMD ["cat", "/tmp/cache.txt"]

Build image for the first time
$ docker build -t serverfault:900445 .
Sending build context to Docker daemon  2.048kB
Step 1/7 : FROM ubuntu:16.04
 ---> 0458a4468cbc
Step 2/7 : RUN echo "$(date), layer1" > /tmp/cache.txt
 ---> Running in ac7f6b1e915a
Removing intermediate container ac7f6b1e915a
 ---> 42a6d14cc4cc
Step 3/7 : RUN echo "$(date), layer2" >> /tmp/cache.txt
 ---> Running in ba4cf5b54c35
Removing intermediate container ba4cf5b54c35
 ---> 783957979b21
Step 4/7 : ARG FORCE_UPDATE=no
 ---> Running in 818fd652d5cb
Removing intermediate container 818fd652d5cb
 ---> b8afb473cd9d
Step 5/7 : RUN echo "$(date), layer3" >> /tmp/cache.txt
 ---> Running in 38c0e6cbb94e
Removing intermediate container 38c0e6cbb94e
 ---> 03ac41df5bfa
Step 6/7 : RUN echo "$(date), layer4" >> /tmp/cache.txt
 ---> Running in 0294b5a4078e
Removing intermediate container 0294b5a4078e
 ---> 141667a2d5f3
Step 7/7 : CMD ["cat", "/tmp/cache.txt"]
 ---> Running in 86b852d8222d
Removing intermediate container 86b852d8222d
 ---> dcd57aca0c25
Successfully built dcd57aca0c25
Successfully tagged serverfault:900445

As we can see all layers were built. Run one more time
$ docker build -t serverfault:900445 .
Sending build context to Docker daemon  2.048kB
Step 1/7 : FROM ubuntu:16.04
 ---> 0458a4468cbc
Step 2/7 : RUN echo "$(date), layer1" > /tmp/cache.txt
 ---> Using cache
 ---> 42a6d14cc4cc
Step 3/7 : RUN echo "$(date), layer2" >> /tmp/cache.txt
 ---> Using cache
 ---> 783957979b21
Step 4/7 : ARG FORCE_UPDATE=no
 ---> Using cache
 ---> b8afb473cd9d
Step 5/7 : RUN echo "$(date), layer3" >> /tmp/cache.txt
 ---> Using cache
 ---> 03ac41df5bfa
Step 6/7 : RUN echo "$(date), layer4" >> /tmp/cache.txt
 ---> Using cache
 ---> 141667a2d5f3
Step 7/7 : CMD ["cat", "/tmp/cache.txt"]
 ---> Using cache
 ---> dcd57aca0c25
Successfully built dcd57aca0c25
Successfully tagged serverfault:900445

And now all layers were taken from cache. Simple check
$ docker run -it --rm serverfault:900445
Wed Mar  7 15:44:22 UTC 2018, layer1
Wed Mar  7 15:44:23 UTC 2018, layer2
Wed Mar  7 15:44:24 UTC 2018, layer3
Wed Mar  7 15:44:25 UTC 2018, layer4

Now if you need to force update cache for some specific layer use the following
$ docker build --build-arg FORCE_UPDATE=$(date '+%s') -t serverfault:900445 .
Sending build context to Docker daemon  2.048kB
Step 1/7 : FROM ubuntu:16.04
 ---> 0458a4468cbc
Step 2/7 : RUN echo "$(date), layer1" > /tmp/cache.txt
 ---> Using cache
 ---> 42a6d14cc4cc
Step 3/7 : RUN echo "$(date), layer2" >> /tmp/cache.txt
 ---> Using cache
 ---> 783957979b21
Step 4/7 : ARG FORCE_UPDATE=no
 ---> Using cache
 ---> b8afb473cd9d
Step 5/7 : RUN echo "$(date), layer3" >> /tmp/cache.txt
 ---> Running in f8ad1cd195eb
Removing intermediate container f8ad1cd195eb
 ---> b22972691095
Step 6/7 : RUN echo "$(date), layer4" >> /tmp/cache.txt
 ---> Running in 9994175a082e
Removing intermediate container 9994175a082e
 ---> 7ed42904373f
Step 7/7 : CMD ["cat", "/tmp/cache.txt"]
 ---> Running in 67de76e45d43
Removing intermediate container 67de76e45d43
 ---> 833f3faf9fd7
Successfully built 833f3faf9fd7
Successfully tagged serverfault:900445

As you can see layers 1,2 were taken from cache but layer 3 and all latest layers were rebuilt
$ docker run -it --rm serverfault:900445
Wed Mar  7 15:44:22 UTC 2018, layer1
Wed Mar  7 15:44:23 UTC 2018, layer2
Wed Mar  7 15:45:35 UTC 2018, layer3
Wed Mar  7 15:45:35 UTC 2018, layer4

Repeat one more time
$ docker build --build-arg FORCE_UPDATE=$(date '+%s') -t serverfault:900445 .
Sending build context to Docker daemon  2.048kB
Step 1/7 : FROM ubuntu:16.04
 ---> 0458a4468cbc
Step 2/7 : RUN echo "$(date), layer1" > /tmp/cache.txt
 ---> Using cache
 ---> 42a6d14cc4cc
Step 3/7 : RUN echo "$(date), layer2" >> /tmp/cache.txt
 ---> Using cache
 ---> 783957979b21
Step 4/7 : ARG FORCE_UPDATE=no
 ---> Using cache
 ---> b8afb473cd9d
Step 5/7 : RUN echo "$(date), layer3" >> /tmp/cache.txt
 ---> Running in 618880ba45be
Removing intermediate container 618880ba45be
 ---> b0512372ddfd
Step 6/7 : RUN echo "$(date), layer4" >> /tmp/cache.txt
 ---> Running in 0cb552431048
Removing intermediate container 0cb552431048
 ---> 61be6f0c0f21
Step 7/7 : CMD ["cat", "/tmp/cache.txt"]
 ---> Running in 5f9ee850c28e
Removing intermediate container 5f9ee850c28e
 ---> ac73b7754107
Successfully built ac73b7754107
Successfully tagged serverfault:900445

$ docker run -it --rm serverfault:900445
Wed Mar  7 15:44:22 UTC 2018, layer1
Wed Mar  7 15:44:23 UTC 2018, layer2
Wed Mar  7 15:46:10 UTC 2018, layer3
Wed Mar  7 15:46:11 UTC 2018, layer4

A: Another way which I have taken to doing is using the LABEL command:
FROM ...

# Update this date to re-run apt-get.
LABEL package.date=2021-09-12

RUN apt-get ...

Then any time the date in the label is changed, every command after that runs again.  As a bonus, the date gets built into the image so you can retrieve it with docker inspect --format '{{ index .Config.Labels "package.dates" }}'  <container> so you can check your images to find any that have not had any security updates for a while, even if they have been rebuilt recently.
Another trick which may save time updating packages is to update the base image first.  With a Dockerfile like this:
FROM debian:stable
...

You can run docker pull debian:stable to update that tag/image to the latest version.  When you next build the Docker image, it will start with that new version and rebuild everything after it because there are not yet any cached layers starting from that new base image.
Typically the base images are updated fairly regularly to include the latest packages, so updating that first will usually result in a smaller number of packages that the following apt-get update needs to download.

A: Use --cache-from=... option and specify hash of the last layer to reuse without rebuild. All subsequent layers will be re-built.
Say I have following cached docker build:
$ docker build -t pinger:latest .
Sending build context to Docker daemon  6.924MB
Step 1/5 : FROM ubuntu:latest
 ---> 58db3edaf2be
Step 2/5 : RUN echo "$(date)"
 ---> Using cache
 ---> b62b5deffedf
Step 3/5 : RUN apt-get update -y && apt-get install -y iputils-ping
 ---> Using cache
 ---> 02ba4da7d7a6
Step 4/5 : ENTRYPOINT ["ping"]
 ---> Using cache
 ---> dfd4c593d7be
Step 5/5 : CMD ["127.0.0.1"]
 ---> Using cache
 ---> 716cc6cbcf0e
Successfully built 716cc6cbcf0e
Successfully tagged pinger:latest

Now if I want to force apt-get stanza to re-run:
$ docker build --cache-from=b62b5deffedf -t pinger:latest .
Sending build context to Docker daemon  6.924MB
Step 1/5 : FROM ubuntu:latest
 ---> 58db3edaf2be
Step 2/5 : RUN echo "$(date)"
 ---> Using cache
 ---> b62b5deffedf
Step 3/5 : RUN apt-get update -y && apt-get install -y iputils-ping
 ---> Running in 0d96737075a6
...


text:
Q: How to filter out list elements based on if they contain a substring from another list in Python I have a list of strings like so called 'main_list':
['Hello_Kitty [data]', 'abc_xyz [data]']

and another list called 'ids'
[abc, xyz]

I create this list by looking through 'contents_list' and appending to main_list if 'data' is found in the row entry (contents_list) is just a list of strings.
for entry in contents_list:
    if 'data' in entry:
        main_list.append(entry)

How can I filter out entries to not append anything to main_list if it contains an id from 'ids' in the substring?
I want to end up with this:
['Hello_Kitty [data]']

A: main_list = ['Hello_Kitty [data]', 'abc_xyz [data]']
ids = ['abc', 'xyz']

filtered_output=[]

for item in main_list:
    blocked=False
    for id in ids:
        if id in item:
            blocked=True
    if blocked == False:
        filtered_output.append(item)

Output:

['Hello_Kitty [data]']

A: You'll need to check for every id whether it is in the string before appending.
My preferred method is to use a list comprehension.
I'll use the list comprehension to make a list which contains all the ids a string contains. If this list's length is more than 0, then that string is not appended.
[id for id in ids if id in entry] will be the list comprehension. This will, for each element of ids, check if that element is a substring of the entry. If yes, that id goes into the list comprehension.
I'll use the condition len( [id for id in ids if id in entry] ) == 0 with another if to get the job done. If the length is 0, no id is a substring of entry.
for entry in contents_list:
    if 'data' in entry:
        if len( [id for id in ids if id in entry] ) == 0:
            main_list.append(entry)


text:
Q: Proving Completeness of a $\alpha$-Holder space In the linked question: Holder Continuous Functions on $[0,1]$ are complete + Banach space OP is trying to show an $\alpha$-Holder space ($\Lambda_{\alpha}$) is a Banach space. The first answer reads proceeds in three steps: producing a limit $f$, showing that $f_n \rightarrow f$ in norm, and finally showing $f$ is in the space.
To produce $f$ the poster assumes there's a Cauchy sequence in $\Lambda_{\alpha}$ and then states there exists a pointwise limit $f$ of this cauchy sequence.
My question: If we show $f \in \Lambda_{\alpha}$ aren't we done? -- we've assumed that a cauchy sequence in $\Lambda_{\alpha}$ and proved the limit lives in $\Lambda_{\alpha}$. If so, why does the poster bother checking $f_n \rightarrow f$ in norm separately in step 1? They should be able to just skip to step 2, right?


text:
Q: Sourcecode license: free for personal use and modification but no public distibution For one of my apps, I want to make the source code "open source" so that others might adapt the code to their personal needs or even contribute improvements, but I don't want anybody else to publish "my app". Furthermore, I still want to be able to sell the app at some time in the future.
Is there a usual license for this, like the GPL or similar?
I found similar questions from 2010 which say something about dual licensing, but maybe there is a license fitting my needs?

*

*A commercial software but open and free for personal/edu. How to license?

*Free for personal use license?

*Open Source but not Free Software (or vice versa)

*Software licensing: open source, no commerical, no derivatives

A: If you don't allow re-distribution of your software, then your code is not "open source".
To my knowledge, there is only one 'license' that forbids redistribution of the original software, and that is the default option of copyright law: no license.
Personal modification, without redistribution, is (to my knowledge) allowed under the copyright law in most jurisdictions, and if it isn't there is no effective way to enforce it anyway (apart from withholding the source code).

A: First off, how big is your checkbook?
Putting a copyright notice on your stuff is one thing.  Enforcing your copyright is something else.  When (not if but WHEN) some scumbag steals your stuff, you're going to have to pay a lawyer to go after said scumbag.  This costs money.
Also note: In the US, for all practical purposes, to enforce a copyright, you must have registered the copyright with the government.  This costs a small amount of money.  The lawyer costs a lot more.  The money you pay for the lawyer will be WASTED if you didn't pay money to register the copyright FIRST.  This is the on-the-ground reality in the US.  Deal with it.
Having gotten all that out of the way...
The simplest answer is this: Put proper copyright notices on your stuff, with the magic incantation "All Rights Reserved", and put it on your website or FTP server or wherever.  Anyone is free to read copyrighted stuff.  Anyone is free to modify THEIR OWN PERSONAL COPY of copyrighted stuff.  (If this were not true, you would not be allowed to underline or highlight important stuff in your textbooks.)  The line is drawn at COPYING and redistributing the copyrighted stuff.
The thing is this: Once you put it out there, someone WILL attempt to rip it off and sell it, regardless of what your copyright notice says.  The world is full of scumbags, and not all of them are where your lawyers can reach.


text:
Q: Objective C - Terminate all other apps running in the background I need to develop an enterprise application, which should be able to close all other Apps which are currently running via multithreading on non-jailbreaked iOS-devices.
Some years ago I had an App called PKiller or Process Killer, which listed all currently running applications including their program ID and was able to close them. It was an App published in the official AppStore but of course Apple took it down, due to the violation of their guidelines.
Does anybody know how to get currently running processes and shut them down?
(again this App will not go to Apple / the AppStore, due to the fact, that it's an enterprise Application)
EDIT:
I did deeper researches and found out, that you can't even get any running or installed Apps and the connected information like the PID anymore in iOS 9. Apple made the sysctl no longer accessible to sandboxed iOS 9 apps. Also other methods in order to get any third PID failed in iOS 9.

A: I believe you can't do that because apple won't allow you to access the data out side on your application sandbox.

A: There was a way to do it in the past, but as of iOS 9, it will no longer work. The library that was used for this, sysctl is no longer accessible to sandboxed iOS 9 apps.

In iOS 9, the sandbox now prevents a process from accessing the
  kern.proc, kern.procargs, and kern.procargs2 values for other
  processes

and

iOS apps are not permitted to see what other apps are running

https://developer.apple.com/videos/play/wwdc2015-703/
There may be another way, but it certainly will not be as easy as it was a couple of years ago, and not without major effort that Apple will be looking to shut down, even for enterprise apps.


text:
Q: Notepad++ autosave plugin not working I have installed notepad++ latest version but when i go to plugin manager and click on autosave to install but it gives error.
Also if i copy the autosave files in notepad++ files separately then i can see the plugin there , i did change the setting like save on lose focus but it is not saving files

A: Yeah i have seen this same error for some time now.
You'll have to go to http://sites.google.com/site/fstellari/nppplugins
And download the latest.Unpack only the AutoSaveU.dll to C:\Program Files (x86)\Notepad++\plugins (this is for 64bit system.Regular Program Files for 32bit system).