move

Bring task to front on widget click

落花浮王杯 提交于 2019-12-09 23:46:05
问题 I sent a task (activity) to back with: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); moveTaskToBack(true); } but I need bring it to front by setOnClickPendingIntent in widget. 回答1: Just start the main (root) activity of your application like this: Intent intent = new Intent(context, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); If the

Move tr by index to a new position

我怕爱的太早我们不能终老 提交于 2019-12-09 20:13:40
问题 I have a table that has a fixed layout of rows. Each row has unique identifier. When the data is returned from the database it has a different order for the rows in that table. The returned data has the same index that exists in the fixed layout so I can find the matching row in the fixed table. I need to move the rows in the fixed table layout to match the order of rows in the data. Table Layout: <table> <tr id="a1"><td>Some Value1</td></tr> <tr id="a2"><td>Some Value2</td></tr> <tr id="a3">

Questions about the move assignment operator

会有一股神秘感。 提交于 2019-12-09 13:42:12
问题 Imagine the following class that manages a resource (my question is only about the move assignment operator): struct A { std::size_t s; int* p; A(std::size_t s) : s(s), p(new int[s]){} ~A(){delete [] p;} A(A const& other) : s(other.s), p(new int[other.s]) {std::copy(other.p, other.p + s, this->p);} A(A&& other) : s(other.s), p(other.p) {other.s = 0; other.p = nullptr;} A& operator=(A const& other) {A temp = other; std::swap(*this, temp); return *this;} // Move assignment operator #1 A&

C++: std::move with rvalue reference is not moving contents

不羁岁月 提交于 2019-12-09 00:22:45
问题 Sample program: #include <iostream> #include <string> #include <vector> template <typename T> void print(const T& _vec) { for( auto c: _vec ) std::cout << c << ","; } typedef std::vector<std::string> vecstr_t; struct Trade { explicit Trade(vecstr_t&& vec) : _vec(vec ) { } vecstr_t _vec; }; int main() { vecstr_t tmpV = {"ONE", "TWO", "THREE", "FOUR"}; std::cout << "size 1:" << tmpV.size() << "\t"; print(tmpV); std::cout << "\n" ; Trade t(std::move(tmpV)); std::cout << "size 2:" << tmpV.size()

When does returning a value outside of a function uses move vs copy?

橙三吉。 提交于 2019-12-08 16:44:07
问题 After reading this question. I created this small little test: class A{ public: A(){} A(const A&){printf("copy\n");} A(A&&){printf("move\n");} static A f(){ A a; return a;} static A g(){ A a; return (a);}//could be return *&a; too. static A h(){ A a; return true?a:a;} }; The result is (without RVO and NRVO): f uses move g uses move h uses copy As far as I know the rules used to decide whether to use copy or move are described in 12.8.32: When the criteria for elision of a copy operation are

Python Move Files Based On Name

时光毁灭记忆、已成空白 提交于 2019-12-08 13:02:16
问题 To give credit, the code I am currently working with is from this response by cji , here. I am trying to recursively pull all files from the source folder, and move them into folders from the file names first-five characters 0:5 My Code Below: import os import shutil srcpath = "SOURCE" srcfiles = os.listdir(srcpath) destpath = "DESTINATION" # extract the three letters from filenames and filter out duplicates destdirs = list(set([filename[0:5] for filename in srcfiles])) def create(dirname,

C# - Make form semi-transparent while moving

好久不见. 提交于 2019-12-08 09:03:41
Is there any way to make the form semi-transparent while it is being moved and then become opaque when it's not being moved anymore? I have tried the Form_Move event with no luck. I'm stuck, any help? The reason the form loads as semi-transparent is because the form has to be moved into the starting position, which triggers the Move event. You can overcome that by basing whether the opacity is set, on whether the form has fully loaded. The ResizeEnd event fires after a form has finished moving, so something like this should work: bool canMove = false; private void Form1_Load(object sender,

PyQt4: Move context menu to position

坚强是说给别人听的谎言 提交于 2019-12-08 08:43:13
问题 How would you change the position of a popup menu in pyqt4? This code doesn't seem to do it. self.popMenu.exec_(self.table.mapToGlobal(point)) position = self.popMenu.pos() self.popMenu.move(position.x() + 100, position.y() + 100) 回答1: You version doesn't work because exec_ opens the menu synchronously , i.e. exec_ will block/wait until menu is closed. So your move is processed after the menu is closed. You can use popup instead of exec_ . That is asynchronous, so the following code will be

Move and rename files from folder to folder as a .bat file and adding modified date at beginning

送分小仙女□ 提交于 2019-12-08 07:17:09
问题 I have spent many hours trying to work this out and no luck. Scenario: Have multiple different file names, but same extension in a folder. On Windows server 2008 64bit. Want to move them to another folder using a schedule batch job. .bat. During the move I want to rename them to include their last modified date. I am trying to put into this format: yyyymmddhhmmss-name.zip I have looked at PowerShell and for commands and just can't work it out. I found this 3-line piece of code and it worked

C# - Make form semi-transparent while moving

旧巷老猫 提交于 2019-12-08 06:40:48
问题 Is there any way to make the form semi-transparent while it is being moved and then become opaque when it's not being moved anymore? I have tried the Form_Move event with no luck. I'm stuck, any help? 回答1: The reason the form loads as semi-transparent is because the form has to be moved into the starting position, which triggers the Move event. You can overcome that by basing whether the opacity is set, on whether the form has fully loaded. The ResizeEnd event fires after a form has finished