qid
int64
1
74.6M
question
stringlengths
45
24.2k
date
stringlengths
10
10
metadata
stringlengths
101
178
response_j
stringlengths
32
23.2k
response_k
stringlengths
21
13.2k
3,015,046
This question comes from a Chinese high school olympiad training program. It seems remarkably more difficult (and indeed, interesting!) than all other problems arising in the same program, especially since an elementary (high-school level) solution is probably available. > > Show that there exists integers $a,b,c,d,e...
2018/11/26
['https://math.stackexchange.com/questions/3015046', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/496634/']
You are supposed to bruteforce or guess $(a,b,c,d,e)=(1,2,3,4,5)$ or any other small solution, and then go up by [Vieta jumping](https://en.wikipedia.org/wiki/Vieta_jumping). That is, once you have a solution, you rewrite it as a quadratic polynomial in $a$ (just like you did), and since one root is integer, so is the ...
Here is the output of the [Maxima](http://maxima.sourceforge.net/) commands I used to calculate a solution according to [Ivan Neretin's answer](https://math.stackexchange.com/a/3015056/11206). ``` (%i2) ev(x^2-b*c*d*e*x+b^2+c^2+d^2+e^2+65,x = 1,b = 2,c = 3,d = 4,e = 5) (%o2) 0 (%i3) ...
3,015,046
This question comes from a Chinese high school olympiad training program. It seems remarkably more difficult (and indeed, interesting!) than all other problems arising in the same program, especially since an elementary (high-school level) solution is probably available. > > Show that there exists integers $a,b,c,d,e...
2018/11/26
['https://math.stackexchange.com/questions/3015046', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/496634/']
You are supposed to bruteforce or guess $(a,b,c,d,e)=(1,2,3,4,5)$ or any other small solution, and then go up by [Vieta jumping](https://en.wikipedia.org/wiki/Vieta_jumping). That is, once you have a solution, you rewrite it as a quadratic polynomial in $a$ (just like you did), and since one root is integer, so is the ...
*This expands upon @Ivan Neretin 's answer* This is what is meant by Vieta jumping, when it comes to this problem--we can use Vieta jumping to prove the following claim: > > Proposition 1: For any $A \in \mathbb{Z}^+$ there is a solution $(a,b,c,d,e)$; $a,b,c,d,e \in \mathbb{Z}^+$ to the equation $a^2+b^2+c^2+d^2+e^...
7,610,254
My trying to make an Ajax call to a PHP function that pulls out data from my database. I've run into a problem though. My query looks like this ``` $query = "SELECT * FROM mytable WHERE field LIKE '%$string%'" ``` I then check on the number of rows returned by the query, but when i type in æ ø å then i my query ret...
2011/09/30
['https://Stackoverflow.com/questions/7610254', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/626535/']
Set the connection to use UTF-8: ``` <?php // MySQLi: $connection = new MySQLi( /* ... credentials ...*/); $connection->set_charset("utf8"); // MySQL: $connection = mysql_connect(/* ... credentials ... */); mysql_set_charset("utf8", $connection); ?> ```
in my case, I had to add this line: ``` mysqli_set_charset($con,"utf8mb4"); ```
37,307,901
I was messing around with transitions and I noticed some stuttering and flickering when the transitions are applied to the selection in a different function. If, however, the transition is applied with method chaining, it works exactly as prescribed. Below is small example ([Fiddle](https://jsfiddle.net/Fjotten/k8kv4...
2016/05/18
['https://Stackoverflow.com/questions/37307901', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4231740/']
You could use a simple circle collision detection such as described on msdn website: <https://msdn.microsoft.com/en-us/library/dn265052(v=vs.85).aspx> ``` function circlesOverlap(circleA, circleB) { // Returns true if the SVG circles A and B overlap, false otherwise. var deltaX = circleA.cx.baseVal.value - circleB...
Try using .offset() rather than .position() (check the console, with position, the values are never changing, with offset, they change) ``` var positionplanet = $("#Earth").offset(); var positionsun = $("#Sun").offset(); ``` <https://jsfiddle.net/zkuhpjwf/> As far as a good collision detection, you could write some...
37,307,901
I was messing around with transitions and I noticed some stuttering and flickering when the transitions are applied to the selection in a different function. If, however, the transition is applied with method chaining, it works exactly as prescribed. Below is small example ([Fiddle](https://jsfiddle.net/Fjotten/k8kv4...
2016/05/18
['https://Stackoverflow.com/questions/37307901', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4231740/']
You could use a simple circle collision detection such as described on msdn website: <https://msdn.microsoft.com/en-us/library/dn265052(v=vs.85).aspx> ``` function circlesOverlap(circleA, circleB) { // Returns true if the SVG circles A and B overlap, false otherwise. var deltaX = circleA.cx.baseVal.value - circleB...
You should be able to use either `position` or `offset` according to jQuery docs - > > The `.position()` method allows us to retrieve the current position of > an element relative to the offset parent. Contrast this with > `.offset()`, which retrieves the current position relative to the > document. When positioni...
61,417,816
I wrote a simple Node.js program with a nice menu system facilitated by [inquirer.js](https://github.com/SBoudrias/Inquirer.js/). However, after selecting an option in the menu and completing some action, the program exits. I need the menu to show again, until I select the Exit [last] option in the menu. I would like t...
2020/04/24
['https://Stackoverflow.com/questions/61417816', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/371392/']
You can use `async/await` syntax: Declare your `main` function `async`, and `await` the returned Promise from inquirer: ```js const main = async () => { for (let count = 0; count < 3; count++) { await showMenu() .then(answers => { [...] } }; ``` Your code doesn't work as you expect because, in sho...
Using your code as a starting point, I hacked together my own library for displaying cli menus. It strips away a lot of Inquirer's boilerplate, letting you declare a menu graph/tree concisely. The main.ts file shows how you use it. You declare a dictionary of MenuPrompts, which you add Menus, Actions and LoopActions t...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
`D:\temp` does not exists in linux systems (what I mean is it interprets it as if it were any other foldername) In Linux systems the file seperator is `/` instead of `\` as in case of Windows so the solution is to : ``` File folder = new File("/tmp"); ``` instead of ``` File folder = new File("D:\\temp"); `...
Consider both solutions using the getProperty static method of System class. ``` String os = System.getProperty("os.name"); if(os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os.indexOf("aix") > 0 ) // Unix File folder = new File("/home/tmp"); else if(os.indexOf("win") >= 0) // Windows File folder = new ...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
You directory (D:\temp) is nos appropriate on Linux. Please, consider using linux File System, and the File.SEPARATOR constant : ``` static String OS = System.getProperty("OS.name").toLowerCase(); String root = "/tmp"; if (OS.indexOf("win") >= 0) { root="D:\\temp"; } else { root="/"; } File folder = new Fil...
Before Java 7 the File API has some possibilities to create a temporary file, utilising the operating system configuration (like temp files on a RAM disk). Since Java 7 use the utility functions class [Files](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory%28java.nio.file.Path,%20j...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
Linux does not use drive letters (like D:) and uses forward slashes as file separator. You can do something like this: ``` File folder = new File("/path/name/of/the/folder"); folder.mkdirs(); // this will also create parent directories if necessary File file = new File(folder, "filename"); StreamResult result = new S...
Since Java 7, you can use the [Files](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html) utility class, with the new [Path](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html) class. **Note that exception handling has been omitted in the examples below.** ``` // uses os separator for path...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
`D:\temp` does not exists in linux systems (what I mean is it interprets it as if it were any other foldername) In Linux systems the file seperator is `/` instead of `\` as in case of Windows so the solution is to : ``` File folder = new File("/tmp"); ``` instead of ``` File folder = new File("D:\\temp"); `...
Since Java 7, you can use the [Files](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html) utility class, with the new [Path](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html) class. **Note that exception handling has been omitted in the examples below.** ``` // uses os separator for path...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
`D:\temp` does not exists in linux systems (what I mean is it interprets it as if it were any other foldername) In Linux systems the file seperator is `/` instead of `\` as in case of Windows so the solution is to : ``` File folder = new File("/tmp"); ``` instead of ``` File folder = new File("D:\\temp"); `...
Before Java 7 the File API has some possibilities to create a temporary file, utilising the operating system configuration (like temp files on a RAM disk). Since Java 7 use the utility functions class [Files](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory%28java.nio.file.Path,%20j...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
Linux does not use drive letters (like D:) and uses forward slashes as file separator. You can do something like this: ``` File folder = new File("/path/name/of/the/folder"); folder.mkdirs(); // this will also create parent directories if necessary File file = new File(folder, "filename"); StreamResult result = new S...
On Unix-like systems no logical discs. You can try create on `/tmp` or `/home` Below code for create `temp` dirrectory in your home directory: ``` String myPathCandidate = System.getProperty("os.name").equals("Linux")? System.getProperty("user.home"):"D:\\"; System.out.println(myPathCandidate); //Check write permi...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
Linux does not use drive letters (like D:) and uses forward slashes as file separator. You can do something like this: ``` File folder = new File("/path/name/of/the/folder"); folder.mkdirs(); // this will also create parent directories if necessary File file = new File(folder, "filename"); StreamResult result = new S...
Consider both solutions using the getProperty static method of System class. ``` String os = System.getProperty("os.name"); if(os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os.indexOf("aix") > 0 ) // Unix File folder = new File("/home/tmp"); else if(os.indexOf("win") >= 0) // Windows File folder = new ...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
You directory (D:\temp) is nos appropriate on Linux. Please, consider using linux File System, and the File.SEPARATOR constant : ``` static String OS = System.getProperty("OS.name").toLowerCase(); String root = "/tmp"; if (OS.indexOf("win") >= 0) { root="D:\\temp"; } else { root="/"; } File folder = new Fil...
Since Java 7, you can use the [Files](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html) utility class, with the new [Path](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Path.html) class. **Note that exception handling has been omitted in the examples below.** ``` // uses os separator for path...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
Linux does not use drive letters (like D:) and uses forward slashes as file separator. You can do something like this: ``` File folder = new File("/path/name/of/the/folder"); folder.mkdirs(); // this will also create parent directories if necessary File file = new File(folder, "filename"); StreamResult result = new S...
Before Java 7 the File API has some possibilities to create a temporary file, utilising the operating system configuration (like temp files on a RAM disk). Since Java 7 use the utility functions class [Files](http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory%28java.nio.file.Path,%20j...
20,066,413
Here is what I wanna do: 1. Check if a folder exists 2. If it does not exists, create the folder 3. If it doest exists do nothing 4. At last create a file in that folder Everything is working fine in Windows 7, but when I run the application in Ubuntu it doesn't create the folder, it is just creating the file with t...
2013/11/19
['https://Stackoverflow.com/questions/20066413', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1966049/']
You directory (D:\temp) is nos appropriate on Linux. Please, consider using linux File System, and the File.SEPARATOR constant : ``` static String OS = System.getProperty("OS.name").toLowerCase(); String root = "/tmp"; if (OS.indexOf("win") >= 0) { root="D:\\temp"; } else { root="/"; } File folder = new Fil...
On Unix-like systems no logical discs. You can try create on `/tmp` or `/home` Below code for create `temp` dirrectory in your home directory: ``` String myPathCandidate = System.getProperty("os.name").equals("Linux")? System.getProperty("user.home"):"D:\\"; System.out.println(myPathCandidate); //Check write permi...
1,468,037
Using Flex 3, I had created a employer profile application where I could view 10 profiles in a page using repeater, however, when I tried to load 20 profiles in a page, all of the component go haywire, became non-function. It would not happen if I set the application height to 100% but due to native scrollbar requirem...
2009/09/23
['https://Stackoverflow.com/questions/1468037', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
Have you tried placing the Canvas inside of some other container with an explicit height? That might be all you need. eg: ``` <mx:VBox id = "theFakeContainer" verticalScrollPolicy = "off" height = "{EXPLICIT HEIGHT}" > <mx:Canvas id = "theR...
I have this part of the code as you have shown me. I was think of creating a custom components with canvas and loop with the repeater or another idea is that I might use one of the working solution I have just thought of it to overcome the issue.
59,116,410
I'm trying to replace any global variables in my example to a specific value `$var` as shows in the following example: (example.php) ``` <?php // before $firstname = $_GET['firstname']; $lastname = $_POST['lastname']; $age = $_REQUEST['age']; ?> ``` As shown in the example above, I want to change any global variab...
2019/11/30
['https://Stackoverflow.com/questions/59116410', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10092475/']
Is that what you want? ``` $file = file_get_contents("example.php"); $lines = explode("\n", $file); $var = '$var'; foreach ($lines as $key => &$value) { if(strpos($value, '$_GET') !== false){ $value = preg_replace('/\$_GET\[.+?\]/', $var, $value); } elseif(strpos($value, '$_POST') !== false){ ...
**Solution:** The following code will turn `$_REQUEST['thisvar']` into `$thisvar`, as well as any other `$_GET`/`$_POST` variables you have set. As mentioned in the comments `$_REQUEST` covers both `$_GET` and `$_POST`. ``` foreach($_REQUEST as $key => $value) $$key = $value; ``` **If I modify your example:** ```...
59,116,410
I'm trying to replace any global variables in my example to a specific value `$var` as shows in the following example: (example.php) ``` <?php // before $firstname = $_GET['firstname']; $lastname = $_POST['lastname']; $age = $_REQUEST['age']; ?> ``` As shown in the example above, I want to change any global variab...
2019/11/30
['https://Stackoverflow.com/questions/59116410', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10092475/']
[See Regex Demo](https://regex101.com/r/FdiQgh/1/) `/\$_(GET|POST|REQUEST)\[[^\]]*\]/'` will match, for example, `$_GET[anything-other-than-a-right-bracket]` and all we have to do is replace it with `$var` and rewrite the file: ``` <?php $file = file_get_contents("example.php"); $file = preg_replace('/\$_(GET|POST|RE...
**Solution:** The following code will turn `$_REQUEST['thisvar']` into `$thisvar`, as well as any other `$_GET`/`$_POST` variables you have set. As mentioned in the comments `$_REQUEST` covers both `$_GET` and `$_POST`. ``` foreach($_REQUEST as $key => $value) $$key = $value; ``` **If I modify your example:** ```...
59,116,410
I'm trying to replace any global variables in my example to a specific value `$var` as shows in the following example: (example.php) ``` <?php // before $firstname = $_GET['firstname']; $lastname = $_POST['lastname']; $age = $_REQUEST['age']; ?> ``` As shown in the example above, I want to change any global variab...
2019/11/30
['https://Stackoverflow.com/questions/59116410', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10092475/']
[See Regex Demo](https://regex101.com/r/FdiQgh/1/) `/\$_(GET|POST|REQUEST)\[[^\]]*\]/'` will match, for example, `$_GET[anything-other-than-a-right-bracket]` and all we have to do is replace it with `$var` and rewrite the file: ``` <?php $file = file_get_contents("example.php"); $file = preg_replace('/\$_(GET|POST|RE...
Is that what you want? ``` $file = file_get_contents("example.php"); $lines = explode("\n", $file); $var = '$var'; foreach ($lines as $key => &$value) { if(strpos($value, '$_GET') !== false){ $value = preg_replace('/\$_GET\[.+?\]/', $var, $value); } elseif(strpos($value, '$_POST') !== false){ ...
35,522,805
Something strange here with Meteor 1.2.1 and Iron Router 1.0.12. ``` Router.route('/news/:_id', function() { this.render('l_basic'); console.log (newsCollection.findOne().title); }); ``` This works perfect. I’ve got the title of my last post in the console. But there is an unwanted exception too. No matter ...
2016/02/20
['https://Stackoverflow.com/questions/35522805', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2498182/']
Here is some [helpful documentation](https://meteorhacks.com/subscription-manager-for-iron-router/) on managing subscriptions for Iron Router. I'm pretty sure your `findOne()` is returning `undefined` at this point, which means your findOne().title is going to throw an exception. You'll want to use `waitOn()` to get y...
Thanks to Stephen Woods I found that my initial code printed both the exception and the title just because of reactivity. And everything I had to do is wait for subscriptions from iron:router. ``` Router.route('/news/:_id', function() { this.render('l_basic'); console.log (newsCollection.findOne().title); }, {...
12,410,727
I have a list of `<li>` items being generated from a CMS/DB. Each `<li>` has a `<div>` in it which contains a link to a lightbox (a hidden `<div>`). The link targets the id of the hidden `<div>` (#inline-content-print) so the javascript plugin triggers and pulls up the lightbox. The problem I'm running into is that al...
2012/09/13
['https://Stackoverflow.com/questions/12410727', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1669207/']
**If I'm not wrong, when a `before` callback returns `false`, the transaction gets rolled back.** That's probably what's happening. ``` def check_new_record self.is_new = self.new_record? end ``` When `self.new_record?` returns `false`, it assigns `false` to `self.is_new` and then the method returns `self.is_new...
For one thing, you can get rid of the hack you have to detect if the record is new in the after\_save. If the record is new, the .changed? method will return true. ``` class Video < ActiveRecord::Base after_save :index_me def index_me Resque.enqueue(IndexVideo, self.id) if self.changed? end end ```
11,460,929
This is more of a theory question than a programming question. As you know when you instantiate a table view in iOS, you have to account for dequeuing and reusing table cells, when they are scrolled in and out of view. The confusing thing to me is, all the data that populates the cells is cached anyway. When you look...
2012/07/12
['https://Stackoverflow.com/questions/11460929', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/591487/']
It's not about the amount of data in the model. It is more so about the amount of memory that is used in creating the Cell views. If I have a table that is going to create over 1000 `UITableViewCell` objects, why would it create them all when only about a dozen or so can appear on the screen? Don't just think about the...
It's just good memory management. There's no telling how big a table could be, so better safe than sorry. You only ever need the memory for however many cells fit in a view.
1,404,832
is it possible to initialize a List with other List's in C#? Say I've got these to lists: ``` List<int> set1 = new List<int>() {1, 2, 3}; List<int> set2 = new List<int>() {4, 5, 6}; ``` What I'd like to have is a shorthand for this code: ``` List<int> fullSet = new List<int>(); fullSet.AddRange(set1); fullSet.AddRa...
2009/09/10
['https://Stackoverflow.com/questions/1404832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16440/']
``` static void Main(string[] args) { List<int> set1 = new List<int>() { 1, 2, 3 }; List<int> set2 = new List<int>() { 4, 5, 6 }; List<int> set3 = new List<int>(Combine(set1, set2)); } private static IEnumerable<T> Combine<T>(IEnumerable<T> list1, IE...
``` var fullSet = set1.Union(set2); // returns IEnumerable<int> ``` If you want List<int> instead of IEnumerable<int> you could do: ``` List<int> fullSet = new List<int>(set1.Union(set2)); ```
1,404,832
is it possible to initialize a List with other List's in C#? Say I've got these to lists: ``` List<int> set1 = new List<int>() {1, 2, 3}; List<int> set2 = new List<int>() {4, 5, 6}; ``` What I'd like to have is a shorthand for this code: ``` List<int> fullSet = new List<int>(); fullSet.AddRange(set1); fullSet.AddRa...
2009/09/10
['https://Stackoverflow.com/questions/1404832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16440/']
To allow duplicate elements (as in your example): ``` List<int> fullSet = set1.Concat(set2).ToList(); ``` This can be generalized for more lists, i.e. `...Concat(set3).Concat(set4)`. If you want to remove duplicate elements (those items that appear in both lists): ``` List<int> fullSet = set1.Union(set2).ToList(); ...
``` var fullSet = set1.Union(set2); // returns IEnumerable<int> ``` If you want List<int> instead of IEnumerable<int> you could do: ``` List<int> fullSet = new List<int>(set1.Union(set2)); ```
1,404,832
is it possible to initialize a List with other List's in C#? Say I've got these to lists: ``` List<int> set1 = new List<int>() {1, 2, 3}; List<int> set2 = new List<int>() {4, 5, 6}; ``` What I'd like to have is a shorthand for this code: ``` List<int> fullSet = new List<int>(); fullSet.AddRange(set1); fullSet.AddRa...
2009/09/10
['https://Stackoverflow.com/questions/1404832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16440/']
``` static void Main(string[] args) { List<int> set1 = new List<int>() { 1, 2, 3 }; List<int> set2 = new List<int>() { 4, 5, 6 }; List<int> set3 = new List<int>(Combine(set1, set2)); } private static IEnumerable<T> Combine<T>(IEnumerable<T> list1, IE...
``` List<int> fullSet = new List<int>(set1.Union(set2)); ``` may work.
1,404,832
is it possible to initialize a List with other List's in C#? Say I've got these to lists: ``` List<int> set1 = new List<int>() {1, 2, 3}; List<int> set2 = new List<int>() {4, 5, 6}; ``` What I'd like to have is a shorthand for this code: ``` List<int> fullSet = new List<int>(); fullSet.AddRange(set1); fullSet.AddRa...
2009/09/10
['https://Stackoverflow.com/questions/1404832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16440/']
To allow duplicate elements (as in your example): ``` List<int> fullSet = set1.Concat(set2).ToList(); ``` This can be generalized for more lists, i.e. `...Concat(set3).Concat(set4)`. If you want to remove duplicate elements (those items that appear in both lists): ``` List<int> fullSet = set1.Union(set2).ToList(); ...
``` List<int> fullSet = new List<int>(set1.Union(set2)); ``` may work.
1,404,832
is it possible to initialize a List with other List's in C#? Say I've got these to lists: ``` List<int> set1 = new List<int>() {1, 2, 3}; List<int> set2 = new List<int>() {4, 5, 6}; ``` What I'd like to have is a shorthand for this code: ``` List<int> fullSet = new List<int>(); fullSet.AddRange(set1); fullSet.AddRa...
2009/09/10
['https://Stackoverflow.com/questions/1404832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/16440/']
To allow duplicate elements (as in your example): ``` List<int> fullSet = set1.Concat(set2).ToList(); ``` This can be generalized for more lists, i.e. `...Concat(set3).Concat(set4)`. If you want to remove duplicate elements (those items that appear in both lists): ``` List<int> fullSet = set1.Union(set2).ToList(); ...
``` static void Main(string[] args) { List<int> set1 = new List<int>() { 1, 2, 3 }; List<int> set2 = new List<int>() { 4, 5, 6 }; List<int> set3 = new List<int>(Combine(set1, set2)); } private static IEnumerable<T> Combine<T>(IEnumerable<T> list1, IE...
49,292,885
I need to have `TabbedPage` throughout the app. In the first page Tab's are displaying fine. When I am starting second page From Tab1, It is hiding all tabs. How can I have Tab's all over the app. [![First page with tabs](https://i.stack.imgur.com/A5yVm.png)](https://i.stack.imgur.com/A5yVm.png) [![Second page without...
2018/03/15
['https://Stackoverflow.com/questions/49292885', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/8977696/']
> > I need to have TabbedPage throughout the app > > > You must add a `NavigationPage` as a child page in your TabbedPage in order to open pages inside the tab So in your Xaml, you can have a `NavigationPage` inside TabbedPage ``` <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="...
Try to use: `Navigation.PushAsync(new Page2());` Instead of: `Navigation.PushModalAsync(new Page2());`
1,628,058
Ok. this one's a challenge. I have a tableview within a navigation controller. I push it from the root, where I have an add action that allows me to add a new record. That works fine. Now what I've tried to do is add this tableview to a tab bar view (without a tab bar controller cuz that won't work) but within the s...
2009/10/27
['https://Stackoverflow.com/questions/1628058', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/188710/']
In the Intellij configuration that you use to start the server, set 'Server host' to the hostname of your machine. If it is set to 'localhost' you can't connect using the actual hostname of the machine.
You should launch Grails with debug parameters (grailsDebug) and create a Remote debug run configuration in IntelliJ IDEA's Run Configurations combobox. Enter your host name and port there and you can connect now.
1,803,867
thanks for taking the time to look at my problems. I was trying to calculate the norm of $(3, 1 + \sqrt{-17})$ and $(\sqrt{-17})$. The second one is 17 because of the norm of the element $\sqrt{-17}$, but how does this follow from $|\mathbb{Z}[\sqrt{-17}]/(\sqrt{-17})|$? I tried to calculate $|\mathbb{Z}[\sqrt{-17}]/...
2016/05/28
['https://math.stackexchange.com/questions/1803867', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/296749/']
Your computations are correct. Since $-17\equiv3\bmod{4}$ our ring of integers is $\mathbb{Z}[\sqrt{-17}]$, so we may factor the ideal $(3)$ in $\mathbb{Z}[\sqrt{-17}]$ by factoring $$x^2 + 17 \equiv x^2 - 1 \equiv (x+1)(x+2) \bmod{3}.$$ This yields the ideal $(3,1+\sqrt{-17})$, and since 3 splits the norm of this...
Given $a+b\sqrt{-17}$, you can subtract $b(1+\sqrt{-17})$ to get a rational integer, then subtract an appropriate multiple of 3 to get 0, 1, or 2. So the quotient ring has at most 3 elements, indeed, has number of elements a divisor of 3, so it now suffices to show it's not 1. If it's 1, then 1 is in the ideal, $1=3(...
1,803,867
thanks for taking the time to look at my problems. I was trying to calculate the norm of $(3, 1 + \sqrt{-17})$ and $(\sqrt{-17})$. The second one is 17 because of the norm of the element $\sqrt{-17}$, but how does this follow from $|\mathbb{Z}[\sqrt{-17}]/(\sqrt{-17})|$? I tried to calculate $|\mathbb{Z}[\sqrt{-17}]/...
2016/05/28
['https://math.stackexchange.com/questions/1803867', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/296749/']
Your computations are correct. Since $-17\equiv3\bmod{4}$ our ring of integers is $\mathbb{Z}[\sqrt{-17}]$, so we may factor the ideal $(3)$ in $\mathbb{Z}[\sqrt{-17}]$ by factoring $$x^2 + 17 \equiv x^2 - 1 \equiv (x+1)(x+2) \bmod{3}.$$ This yields the ideal $(3,1+\sqrt{-17})$, and since 3 splits the norm of this...
You already seem know that the norm of a prinicipal ideal is the norm of its generator. Hence $|\mathbb Z[\sqrt{-17}]/(3)|=9$. We have $(3) \subsetneq (3,1+\sqrt{-17}) \subsetneq (1)$, hence $\mathbb Z[\sqrt{-17}]/(3,1+\sqrt{-17})$ is a non-trivial quotient of $\mathbb Z[\sqrt{-17}]/(3)$. A non-trivial quotient of a g...
19,533,566
I have a LinearLayout with a white background,filled with a bunch of LinearLayouts and RelativeLayouts. I've tried to set the parent layout to have a minimum height, but it still seems to be wrapping to the content. Here's a picture of what it looks like now. The white space should have a set minimum height that is gr...
2013/10/23
['https://Stackoverflow.com/questions/19533566', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2175846/']
``` // try this <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/contactViewScrollView" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ABABAB" > <LinearLayout android:layout_width="match_parent" an...
set the height in second linearlayout. now it is set as wrap content.. do like ``` <LinearLayout android:id="@+id/mobile" android:layout_width="match_parent" android:layout_height="50dp" //for example android:orientation="vertical" android:paddingLeft="10dp" > <Tex...
19,533,566
I have a LinearLayout with a white background,filled with a bunch of LinearLayouts and RelativeLayouts. I've tried to set the parent layout to have a minimum height, but it still seems to be wrapping to the content. Here's a picture of what it looks like now. The white space should have a set minimum height that is gr...
2013/10/23
['https://Stackoverflow.com/questions/19533566', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2175846/']
``` // try this <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/contactViewScrollView" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ABABAB" > <LinearLayout android:layout_width="match_parent" an...
It can be because of the device size too. I'd definitely suggest using linear layout's weight. That should make it perfect on all the devices irrespective of tablet or phone. Let me know if you want any more guidance, or if you have any issues with weight.
18,835,104
I have a library in User Space that intercepts socket layer calls such as `socket()`, `connect()`, `accept()`, etc. I'm only dealing with TCP sockets. Down in Kernel Space I have a network kernel module, which deals with all the TCP connections. I need to be able to identify in the driver which sockets were intercepte...
2013/09/16
['https://Stackoverflow.com/questions/18835104', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1181890/']
There is really no such "private field" option that can be used solely by user space and your kernel code. Using the `SO_PRIORITY` option seems a little too intrusive, as it can change how the stack processes packets, and it might lead to hard to understand results. A safer option would be to adjust the `SO_RCVBUF` or...
Getting to your original question "I need to be able to identify in the driver which sockets were intercepted by the User Space library." there are a few functions in fact. Firstly you need to know that ALL the existing connections are stored in a global hash table - "tcp\_hashinfo", and you can find the address in /p...
13,086,869
I am creating a 12 month calendar using the individual calendar controls for each month. Since I am controlling the calendars (Jan - Dec) via separate next year and previous year buttons, I want to remove the previous and next calendaritem buttons from the individual calendars and disable the ability to change the disp...
2012/10/26
['https://Stackoverflow.com/questions/13086869', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1777028/']
I would refer you to [this](http://msdn.microsoft.com/en-us/magazine/dd882520.aspx) article to get some basic understanding of Calendar control. In short, you need to modify CalendarItemStyle and remove PART\_PreviousButton and PART\_NextButton from its template. You can find default template for all parts of Calendar...
Like Chris, I didn't want to mess with a ton a XAML. I also needed to hide/show dynamically. I imagine there is a way to do this with bindings in XAML as well, but I thought this was a pretty simple start. Just add a new class with this code, then use this derived control instead. Edit: I updated it to have a property...
13,086,869
I am creating a 12 month calendar using the individual calendar controls for each month. Since I am controlling the calendars (Jan - Dec) via separate next year and previous year buttons, I want to remove the previous and next calendaritem buttons from the individual calendars and disable the ability to change the disp...
2012/10/26
['https://Stackoverflow.com/questions/13086869', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1777028/']
Well, after lots of digging, many examples and Dodsky pointing me in the right direction. I figured it out and felt that sharing was the best way to repay the developer community. Since, I am new to XAML it is a small victory in project battle that I am in. Hopefully, it will help other newbies like me. I will try to ...
Like Chris, I didn't want to mess with a ton a XAML. I also needed to hide/show dynamically. I imagine there is a way to do this with bindings in XAML as well, but I thought this was a pretty simple start. Just add a new class with this code, then use this derived control instead. Edit: I updated it to have a property...
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
You can use clientX or pageX, see [here](http://www.sitepen.com/blog/2011/12/07/touching-and-gesturing-on-iphone-android-and-more/)
Was having similar issue on binding event-handler using jQuery's `.on` function on `canvas` element (Don't know the reason). I resolved it by binding event-handler using `addEventListener`. The `event` object in the handler has offsetX and offsetY defined with proper values. Hope it helps...
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
You can use clientX or pageX, see [here](http://www.sitepen.com/blog/2011/12/07/touching-and-gesturing-on-iphone-android-and-more/)
The page - offset / client approach did not work for me. There was still an offset. I found this other solution that works perfectly: ``` let r = canvas.getBoundingClientRect(); let x = e.touches[0].pageX - r.left; let y = e.touches[0].pageY - r.top; ```
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
You can use clientX or pageX, see [here](http://www.sitepen.com/blog/2011/12/07/touching-and-gesturing-on-iphone-android-and-more/)
Thanks, @Kontiki - this is the solution that finally fixed things for me: ``` if("touchmove" == e.type) { let r = canvas.getBoundingClientRect(); currX = e.touches[0].clientX - r.left; currY = e.touches[0].clientY - r.top; } else { currX = e.offsetX; currY = e.offsetY; } ```
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
The correct answer based on the comments in the suggested answer: ``` e.offsetX = e.touches[0].pageX - e.touches[0].target.offsetLeft; e.offsetY = e.touches[0].pageY - e.touches[0].target.offsetTop; ``` This ignores any transformations such as rotations or scaling. Also be sure to check if there are any touches...
Was having similar issue on binding event-handler using jQuery's `.on` function on `canvas` element (Don't know the reason). I resolved it by binding event-handler using `addEventListener`. The `event` object in the handler has offsetX and offsetY defined with proper values. Hope it helps...
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
The page - offset / client approach did not work for me. There was still an offset. I found this other solution that works perfectly: ``` let r = canvas.getBoundingClientRect(); let x = e.touches[0].pageX - r.left; let y = e.touches[0].pageY - r.top; ```
Was having similar issue on binding event-handler using jQuery's `.on` function on `canvas` element (Don't know the reason). I resolved it by binding event-handler using `addEventListener`. The `event` object in the handler has offsetX and offsetY defined with proper values. Hope it helps...
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
Thanks, @Kontiki - this is the solution that finally fixed things for me: ``` if("touchmove" == e.type) { let r = canvas.getBoundingClientRect(); currX = e.touches[0].clientX - r.left; currY = e.touches[0].clientY - r.top; } else { currX = e.offsetX; currY = e.offsetY; } ```
Was having similar issue on binding event-handler using jQuery's `.on` function on `canvas` element (Don't know the reason). I resolved it by binding event-handler using `addEventListener`. The `event` object in the handler has offsetX and offsetY defined with proper values. Hope it helps...
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
The correct answer based on the comments in the suggested answer: ``` e.offsetX = e.touches[0].pageX - e.touches[0].target.offsetLeft; e.offsetY = e.touches[0].pageY - e.touches[0].target.offsetTop; ``` This ignores any transformations such as rotations or scaling. Also be sure to check if there are any touches...
The page - offset / client approach did not work for me. There was still an offset. I found this other solution that works perfectly: ``` let r = canvas.getBoundingClientRect(); let x = e.touches[0].pageX - r.left; let y = e.touches[0].pageY - r.top; ```
11,287,899
Is this possible to generate a new Zabbix event from a Ruby script? I was suggested to use [zabbix\_sender](http://www.zabbix.com/documentation/1.8/manpages/zabbix_sender) script, but I couldn't find any example. Also, I couldn't find any API related to the [events](http://www.zabbix.com/documentation/1.8/api/event) c...
2012/07/02
['https://Stackoverflow.com/questions/11287899', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/398309/']
The correct answer based on the comments in the suggested answer: ``` e.offsetX = e.touches[0].pageX - e.touches[0].target.offsetLeft; e.offsetY = e.touches[0].pageY - e.touches[0].target.offsetTop; ``` This ignores any transformations such as rotations or scaling. Also be sure to check if there are any touches...
Thanks, @Kontiki - this is the solution that finally fixed things for me: ``` if("touchmove" == e.type) { let r = canvas.getBoundingClientRect(); currX = e.touches[0].clientX - r.left; currY = e.touches[0].clientY - r.top; } else { currX = e.offsetX; currY = e.offsetY; } ```
232,858
Are all sentences below correct? * I parked in the parking lot. * I parked on the parking lot. * I parked at the parking lot. My understanding is that I can use "to park in" if the parking lot is indoors and "to park at" with any kind of parking lot, but I'm not sure if "to park on" is usual for both indoor and outdo...
2019/12/18
['https://ell.stackexchange.com/questions/232858', 'https://ell.stackexchange.com', 'https://ell.stackexchange.com/users/92124/']
When talking about a structure for holding cars, such as a lot, you park *in*. "I parked in the lot." "I parked in the parking garage." You can also talk about parking *on* a surface or *on* a street/road. "I parked on the concrete". "I parked on 4th Avenue." "Parking on grass is not good for your car." In this sense...
I think you use "to park in" both when it’s outdoors and indoors. I have never heard someone saying "to park at" or "to park on".
232,858
Are all sentences below correct? * I parked in the parking lot. * I parked on the parking lot. * I parked at the parking lot. My understanding is that I can use "to park in" if the parking lot is indoors and "to park at" with any kind of parking lot, but I'm not sure if "to park on" is usual for both indoor and outdo...
2019/12/18
['https://ell.stackexchange.com/questions/232858', 'https://ell.stackexchange.com', 'https://ell.stackexchange.com/users/92124/']
> > I parked in the parking lot. > > > This is correct whether the parking lot is enclosed in some way or not (it doesn't matter). The use of "in" here generally means "within the borders of". This is also the same sense you would use when saying "I parked in a parking space" as well. > > I parked on the parking...
I think you use "to park in" both when it’s outdoors and indoors. I have never heard someone saying "to park at" or "to park on".
232,858
Are all sentences below correct? * I parked in the parking lot. * I parked on the parking lot. * I parked at the parking lot. My understanding is that I can use "to park in" if the parking lot is indoors and "to park at" with any kind of parking lot, but I'm not sure if "to park on" is usual for both indoor and outdo...
2019/12/18
['https://ell.stackexchange.com/questions/232858', 'https://ell.stackexchange.com', 'https://ell.stackexchange.com/users/92124/']
When talking about a structure for holding cars, such as a lot, you park *in*. "I parked in the lot." "I parked in the parking garage." You can also talk about parking *on* a surface or *on* a street/road. "I parked on the concrete". "I parked on 4th Avenue." "Parking on grass is not good for your car." In this sense...
> > I parked in the parking lot. > > > This is correct whether the parking lot is enclosed in some way or not (it doesn't matter). The use of "in" here generally means "within the borders of". This is also the same sense you would use when saying "I parked in a parking space" as well. > > I parked on the parking...
64,173,564
I'm trying to upgrade my Spring Boot 2.3.4 app to use Flyway 7.0.0 (the latest version). Previously it was using Flyway 6.5.6. The relevant entries in `build.gradle` are shown below. ``` buildscript { ext { flywayVersion = "7.0.0" // changed from 6.5.6 } } plugins { id "org.flywaydb.flyway" version "${flywa...
2020/10/02
['https://Stackoverflow.com/questions/64173564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4786956/']
Basically, see Philip's comment on your question. Flyway 7.x.x is not currently compatible with Spring Boot 2.3.4 Temporary solution is to just downgrade to Flyway 6.5.7 (the last 6.x.x version) until Spring Boot 2.3.5 is released. Read more and follow the issue here: <https://github.com/spring-projects/spring-boot/...
downgrade to Flyway 6.5.7 works.
64,173,564
I'm trying to upgrade my Spring Boot 2.3.4 app to use Flyway 7.0.0 (the latest version). Previously it was using Flyway 6.5.6. The relevant entries in `build.gradle` are shown below. ``` buildscript { ext { flywayVersion = "7.0.0" // changed from 6.5.6 } } plugins { id "org.flywaydb.flyway" version "${flywa...
2020/10/02
['https://Stackoverflow.com/questions/64173564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4786956/']
Basically, see Philip's comment on your question. Flyway 7.x.x is not currently compatible with Spring Boot 2.3.4 Temporary solution is to just downgrade to Flyway 6.5.7 (the last 6.x.x version) until Spring Boot 2.3.5 is released. Read more and follow the issue here: <https://github.com/spring-projects/spring-boot/...
In Flyway 7 the signature of `migrate` changed. To get Flyway 7.x.x working with Spring Boot 2.3.x you can provide a custom FlywayMigrationStrategy implementation, which calls the the right `migrate` method. ``` import org.flywaydb.core.Flyway; import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrat...
64,173,564
I'm trying to upgrade my Spring Boot 2.3.4 app to use Flyway 7.0.0 (the latest version). Previously it was using Flyway 6.5.6. The relevant entries in `build.gradle` are shown below. ``` buildscript { ext { flywayVersion = "7.0.0" // changed from 6.5.6 } } plugins { id "org.flywaydb.flyway" version "${flywa...
2020/10/02
['https://Stackoverflow.com/questions/64173564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4786956/']
In Flyway 7 the signature of `migrate` changed. To get Flyway 7.x.x working with Spring Boot 2.3.x you can provide a custom FlywayMigrationStrategy implementation, which calls the the right `migrate` method. ``` import org.flywaydb.core.Flyway; import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrat...
downgrade to Flyway 6.5.7 works.
502,374
I have this spec file that will install numerous rpm packages such as apache, mysql, etc. I'm new to building rpms and I did looked at the Fedora documentation but I did not find the answer to my question. How do I add commands in my spec file so that if I do a: ``` rpm -e yum erase ``` it will stop services that ...
2013/04/24
['https://serverfault.com/questions/502374', 'https://serverfault.com', 'https://serverfault.com/users/163460/']
It may not be relevant to this case, but remember that if you will upgrade your RPM, rpm will install the new version and then remove the old one, so after upgrade the services will be down. To be on the safe side, do: ``` %preun if [[ $1 -eq 0 ]] then service https stop # or what ever you want fi ```
There is a section in spec file preun which runs before package is uninstalled: ``` %preun service https stop # or what ever you want ```
14,755,569
I have some floated divs where I can't use display: inline-block because some of those divs are jqxSwitchButtons and using that inline-block would mess everything around those buttons. [Here](http://jsfiddle.net/Luigino/Ps3zE/) is a JSFiddle example where I commented some lines that are jqxSwitchButtons and I'd like t...
2013/02/07
['https://Stackoverflow.com/questions/14755569', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1487979/']
You can use a meteorite package. accounts-anonymous <https://github.com/tmeasday/meteor-accounts-anonymous> So you use ``` Meteor.loginAnonymously(); ``` if the user visits your page for the first time, and use .allow to check what you need
Use a session or localStorage key. When the visitor submits the form check if the key has been set, and if it has, reject the insert.
14,755,569
I have some floated divs where I can't use display: inline-block because some of those divs are jqxSwitchButtons and using that inline-block would mess everything around those buttons. [Here](http://jsfiddle.net/Luigino/Ps3zE/) is a JSFiddle example where I commented some lines that are jqxSwitchButtons and I'd like t...
2013/02/07
['https://Stackoverflow.com/questions/14755569', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1487979/']
To get the ip address, the observatory (<https://github.com/jhoxray/observatory>) project uses this: in coffee: ``` Meteor.userIP = (uid)-> ret = {} if uid? s = ss for k, ss of Meteor.default_server.sessions when ss.userId is uid if s ret.forwardedFor = s.socket?.headers?['x-forwarded-for'] re...
Use a session or localStorage key. When the visitor submits the form check if the key has been set, and if it has, reject the insert.
14,755,569
I have some floated divs where I can't use display: inline-block because some of those divs are jqxSwitchButtons and using that inline-block would mess everything around those buttons. [Here](http://jsfiddle.net/Luigino/Ps3zE/) is a JSFiddle example where I commented some lines that are jqxSwitchButtons and I'd like t...
2013/02/07
['https://Stackoverflow.com/questions/14755569', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1487979/']
You can use a meteorite package. accounts-anonymous <https://github.com/tmeasday/meteor-accounts-anonymous> So you use ``` Meteor.loginAnonymously(); ``` if the user visits your page for the first time, and use .allow to check what you need
You can do something like this: ``` if (Meteor.isClient) { Meteor.startup(function () { Session.set('currentuser', 'something randomly generated by another function'); } } ``` and check if the 'currentuser' already has inserted in your database.
14,755,569
I have some floated divs where I can't use display: inline-block because some of those divs are jqxSwitchButtons and using that inline-block would mess everything around those buttons. [Here](http://jsfiddle.net/Luigino/Ps3zE/) is a JSFiddle example where I commented some lines that are jqxSwitchButtons and I'd like t...
2013/02/07
['https://Stackoverflow.com/questions/14755569', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1487979/']
To get the ip address, the observatory (<https://github.com/jhoxray/observatory>) project uses this: in coffee: ``` Meteor.userIP = (uid)-> ret = {} if uid? s = ss for k, ss of Meteor.default_server.sessions when ss.userId is uid if s ret.forwardedFor = s.socket?.headers?['x-forwarded-for'] re...
You can do something like this: ``` if (Meteor.isClient) { Meteor.startup(function () { Session.set('currentuser', 'something randomly generated by another function'); } } ``` and check if the 'currentuser' already has inserted in your database.
14,755,569
I have some floated divs where I can't use display: inline-block because some of those divs are jqxSwitchButtons and using that inline-block would mess everything around those buttons. [Here](http://jsfiddle.net/Luigino/Ps3zE/) is a JSFiddle example where I commented some lines that are jqxSwitchButtons and I'd like t...
2013/02/07
['https://Stackoverflow.com/questions/14755569', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1487979/']
You can use a meteorite package. accounts-anonymous <https://github.com/tmeasday/meteor-accounts-anonymous> So you use ``` Meteor.loginAnonymously(); ``` if the user visits your page for the first time, and use .allow to check what you need
To get the ip address, the observatory (<https://github.com/jhoxray/observatory>) project uses this: in coffee: ``` Meteor.userIP = (uid)-> ret = {} if uid? s = ss for k, ss of Meteor.default_server.sessions when ss.userId is uid if s ret.forwardedFor = s.socket?.headers?['x-forwarded-for'] re...
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
The easiest way to move your theme folder is only via constant; include the wp-content folder. You can set a constant for the plugin folder and wp-content folder. Then is your plugins and themes in separete url, also in the include in the source of the frontend. like this example for my dev installs: ``` define( 'WP_...
Why dont you use bloginfo(); default wordpress functions ``` <?php bloginfo( $show ); ?> <script src="<?php bloginfo('template_directory'); ?>/incs/js/script.js"></script> ``` more info <http://codex.wordpress.org/Function_Reference/bloginfo>
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
The easiest way to move your theme folder is only via constant; include the wp-content folder. You can set a constant for the plugin folder and wp-content folder. Then is your plugins and themes in separete url, also in the include in the source of the frontend. like this example for my dev installs: ``` define( 'WP_...
Nowadays I use the technique I describe in this Q: [Steps to Take to Hide the Fact a Site is Using WordPress?](https://wordpress.stackexchange.com/q/1507/12615). Before that, I used the [Roots Theme method](http://benword.com/how-to-hide-that-youre-using-wordpress/), which is what I think you are looking for: > > T...
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
The easiest way to move your theme folder is only via constant; include the wp-content folder. You can set a constant for the plugin folder and wp-content folder. Then is your plugins and themes in separete url, also in the include in the source of the frontend. like this example for my dev installs: ``` define( 'WP_...
I created the [Roots Plug](http://wordpress.org/extend/plugins/roots-plug/) which has the same `.htaccess` rewrites as the Roots Theme. But completely agree with what @brasofolio [said](https://wordpress.stackexchange.com/a/76605/9605)
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
The easiest way to move your theme folder is only via constant; include the wp-content folder. You can set a constant for the plugin folder and wp-content folder. Then is your plugins and themes in separete url, also in the include in the source of the frontend. like this example for my dev installs: ``` define( 'WP_...
This can be easily achieved by using '[hide my wp](http://bit.ly/1cyQW91)' plugin. Please change it's permalinks and url settings as shown below: ![Change theme path under Permalinks & urls to /incs](https://i.stack.imgur.com/tHGVs.jpg) Change theme path under Permalinks & urls to `/incs`. Once you have changed these...
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
Nowadays I use the technique I describe in this Q: [Steps to Take to Hide the Fact a Site is Using WordPress?](https://wordpress.stackexchange.com/q/1507/12615). Before that, I used the [Roots Theme method](http://benword.com/how-to-hide-that-youre-using-wordpress/), which is what I think you are looking for: > > T...
Why dont you use bloginfo(); default wordpress functions ``` <?php bloginfo( $show ); ?> <script src="<?php bloginfo('template_directory'); ?>/incs/js/script.js"></script> ``` more info <http://codex.wordpress.org/Function_Reference/bloginfo>
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
I created the [Roots Plug](http://wordpress.org/extend/plugins/roots-plug/) which has the same `.htaccess` rewrites as the Roots Theme. But completely agree with what @brasofolio [said](https://wordpress.stackexchange.com/a/76605/9605)
Why dont you use bloginfo(); default wordpress functions ``` <?php bloginfo( $show ); ?> <script src="<?php bloginfo('template_directory'); ?>/incs/js/script.js"></script> ``` more info <http://codex.wordpress.org/Function_Reference/bloginfo>
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
This can be easily achieved by using '[hide my wp](http://bit.ly/1cyQW91)' plugin. Please change it's permalinks and url settings as shown below: ![Change theme path under Permalinks & urls to /incs](https://i.stack.imgur.com/tHGVs.jpg) Change theme path under Permalinks & urls to `/incs`. Once you have changed these...
Why dont you use bloginfo(); default wordpress functions ``` <?php bloginfo( $show ); ?> <script src="<?php bloginfo('template_directory'); ?>/incs/js/script.js"></script> ``` more info <http://codex.wordpress.org/Function_Reference/bloginfo>
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
Nowadays I use the technique I describe in this Q: [Steps to Take to Hide the Fact a Site is Using WordPress?](https://wordpress.stackexchange.com/q/1507/12615). Before that, I used the [Roots Theme method](http://benword.com/how-to-hide-that-youre-using-wordpress/), which is what I think you are looking for: > > T...
This can be easily achieved by using '[hide my wp](http://bit.ly/1cyQW91)' plugin. Please change it's permalinks and url settings as shown below: ![Change theme path under Permalinks & urls to /incs](https://i.stack.imgur.com/tHGVs.jpg) Change theme path under Permalinks & urls to `/incs`. Once you have changed these...
76,593
in my header and other sections I would like to use ``` <script src="/incs/js/script.js"></script> ``` While maintaining the default theme folder structure in server as below ``` /wp-content/themes/theme-name/incs/js/script.js ``` file need to be accessed via browser/html source if need be so that it hides **/wp...
2012/12/19
['https://wordpress.stackexchange.com/questions/76593', 'https://wordpress.stackexchange.com', 'https://wordpress.stackexchange.com/users/16419/']
I created the [Roots Plug](http://wordpress.org/extend/plugins/roots-plug/) which has the same `.htaccess` rewrites as the Roots Theme. But completely agree with what @brasofolio [said](https://wordpress.stackexchange.com/a/76605/9605)
This can be easily achieved by using '[hide my wp](http://bit.ly/1cyQW91)' plugin. Please change it's permalinks and url settings as shown below: ![Change theme path under Permalinks & urls to /incs](https://i.stack.imgur.com/tHGVs.jpg) Change theme path under Permalinks & urls to `/incs`. Once you have changed these...
36,248,147
I have a regexp: ``` import re regexp = re.compile(r'^(?P<parts>(?:[\w-]+/?)+)/$') ``` It matches a string like `foo/bar/baz/` and put the `foo/bar/baz` in a group named `parts` (the `/?` combined with the `/$` support this). This works perfectly fine, **until you match a string that doesn't end in a slash**. Then...
2016/03/27
['https://Stackoverflow.com/questions/36248147', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/128463/']
It is getting slow due to [catastrophic backtracking](http://www.regular-expressions.info/catastrophic.html) in your regex: You can fix catastrophic backtracking by using this regex: ``` ^(?P<parts>(?:[\w-]+/)*[\w-]+)/$ ``` As per the link above: > > The **solution to avoid *catastrophic backtracking*** is simple...
Wiktor Stribizew is correct. The issue is the question mark after the slash inside the repeating pattern. So, the pattern you gave: ``` '^(?P<parts>(?:[\w-]+/?)+)/$' ``` Says, look for one or more groups of one or more word characters or dashes possibly followed by a slash, then there should be a slash at the very e...
25,530,172
1) Here's my schema: ``` { "_id" : ObjectId("53f4db1d968166157c2d57ce"), "init" : "SJ", "name" : "Steve Jobs", "companies" : [ { "_id" : ObjectId("53f4db1d968166157c2d57cf"), "ticker" : "AAPL", "compname" : "Apple" }, { "_id" : O...
2014/08/27
['https://Stackoverflow.com/questions/25530172', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/979127/']
From reading the MongoDB [documentation](http://docs.mongodb.org/ecosystem/tutorial/use-csharp-driver/#findone-and-findoneas-methods), it looks like you need to initialise the query object properly first. Try this: ``` $query = new-object MongoDB.Driver.QueryDocument("init","SJ") $results = $collection.FindOne($query)...
So when I use your query procedure with ``` $mongoDbDriverPath = 'D:\mongo\driver\' $mongoServer = 'myserver:27000' Add-Type -Path "$($mongoDbDriverPath)MongoDB.Bson.dll" Add-Type -Path "$($mongoDbDriverPath)MongoDB.Driver.dll" $databaseName = 'Tickets' $collectionName = 'MongoUserTicket' $client = New-Object -Typ...
25,530,172
1) Here's my schema: ``` { "_id" : ObjectId("53f4db1d968166157c2d57ce"), "init" : "SJ", "name" : "Steve Jobs", "companies" : [ { "_id" : ObjectId("53f4db1d968166157c2d57cf"), "ticker" : "AAPL", "compname" : "Apple" }, { "_id" : O...
2014/08/27
['https://Stackoverflow.com/questions/25530172', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/979127/']
From reading the MongoDB [documentation](http://docs.mongodb.org/ecosystem/tutorial/use-csharp-driver/#findone-and-findoneas-methods), it looks like you need to initialise the query object properly first. Try this: ``` $query = new-object MongoDB.Driver.QueryDocument("init","SJ") $results = $collection.FindOne($query)...
here is what allowed me to get an object that i could operate on: ``` $results = @() foreach($item in $collection.Find($query)) { $props = @{} $item | foreach { $props[ $_.name ] = $_.value } $pso = [pscustomobject]$props $results += $pso } ``` full code: ``` $mongoDbDriverPath = 'D:\mongo...
25,530,172
1) Here's my schema: ``` { "_id" : ObjectId("53f4db1d968166157c2d57ce"), "init" : "SJ", "name" : "Steve Jobs", "companies" : [ { "_id" : ObjectId("53f4db1d968166157c2d57cf"), "ticker" : "AAPL", "compname" : "Apple" }, { "_id" : O...
2014/08/27
['https://Stackoverflow.com/questions/25530172', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/979127/']
Here's my updated code: ``` $databaseName = "CompanyInfo" $collectionName = "comps" $client = New-Object -TypeName MongoDB.Driver.MongoClient -ArgumentList "mongodb://localhost:27017" $server = $client.GetServer() $database = $server.GetDatabase($databaseName) $collection = $database.GetCollection($collectionName) $q...
So when I use your query procedure with ``` $mongoDbDriverPath = 'D:\mongo\driver\' $mongoServer = 'myserver:27000' Add-Type -Path "$($mongoDbDriverPath)MongoDB.Bson.dll" Add-Type -Path "$($mongoDbDriverPath)MongoDB.Driver.dll" $databaseName = 'Tickets' $collectionName = 'MongoUserTicket' $client = New-Object -Typ...
25,530,172
1) Here's my schema: ``` { "_id" : ObjectId("53f4db1d968166157c2d57ce"), "init" : "SJ", "name" : "Steve Jobs", "companies" : [ { "_id" : ObjectId("53f4db1d968166157c2d57cf"), "ticker" : "AAPL", "compname" : "Apple" }, { "_id" : O...
2014/08/27
['https://Stackoverflow.com/questions/25530172', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/979127/']
Here's my updated code: ``` $databaseName = "CompanyInfo" $collectionName = "comps" $client = New-Object -TypeName MongoDB.Driver.MongoClient -ArgumentList "mongodb://localhost:27017" $server = $client.GetServer() $database = $server.GetDatabase($databaseName) $collection = $database.GetCollection($collectionName) $q...
here is what allowed me to get an object that i could operate on: ``` $results = @() foreach($item in $collection.Find($query)) { $props = @{} $item | foreach { $props[ $_.name ] = $_.value } $pso = [pscustomobject]$props $results += $pso } ``` full code: ``` $mongoDbDriverPath = 'D:\mongo...
1,748,356
I have some application, which has ability to update itself. Its downloads the jar file from the net, and then tries to replace used jar to run this application by downloaded one. But I cannot to do that, because the file is locked by windows, because application is still running. Does anybody know some workaround of ...
2009/11/17
['https://Stackoverflow.com/questions/1748356', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/212822/']
One of the popular solutions for this is to run your updater as a separate program. Have you ever noticed that Firefox has to restart when it is updated? Well that is because a separate process (updater.exe) is updating the files, then starting Firefox again. You can try this approach. The only obstacle I see in the w...
I think the correct thing to do here is to **restart** the application. Event if you could update the jar at *runtime*, all sort of errors might occur after because of class versions, different classes, different implementations, etc.
1,748,356
I have some application, which has ability to update itself. Its downloads the jar file from the net, and then tries to replace used jar to run this application by downloaded one. But I cannot to do that, because the file is locked by windows, because application is still running. Does anybody know some workaround of ...
2009/11/17
['https://Stackoverflow.com/questions/1748356', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/212822/']
I think the correct thing to do here is to **restart** the application. Event if you could update the jar at *runtime*, all sort of errors might occur after because of class versions, different classes, different implementations, etc.
Typical way to do this is to write a separate updater which will be invoked by your main program when it sees an update. At this time your main program can start the updater in a new process and exit. You updater can wait for main program to exit, download and copy the updated files and restart your main program
1,748,356
I have some application, which has ability to update itself. Its downloads the jar file from the net, and then tries to replace used jar to run this application by downloaded one. But I cannot to do that, because the file is locked by windows, because application is still running. Does anybody know some workaround of ...
2009/11/17
['https://Stackoverflow.com/questions/1748356', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/212822/']
One of the popular solutions for this is to run your updater as a separate program. Have you ever noticed that Firefox has to restart when it is updated? Well that is because a separate process (updater.exe) is updating the files, then starting Firefox again. You can try this approach. The only obstacle I see in the w...
Typical way to do this is to write a separate updater which will be invoked by your main program when it sees an update. At this time your main program can start the updater in a new process and exit. You updater can wait for main program to exit, download and copy the updated files and restart your main program
1,748,356
I have some application, which has ability to update itself. Its downloads the jar file from the net, and then tries to replace used jar to run this application by downloaded one. But I cannot to do that, because the file is locked by windows, because application is still running. Does anybody know some workaround of ...
2009/11/17
['https://Stackoverflow.com/questions/1748356', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/212822/']
One of the popular solutions for this is to run your updater as a separate program. Have you ever noticed that Firefox has to restart when it is updated? Well that is because a separate process (updater.exe) is updating the files, then starting Firefox again. You can try this approach. The only obstacle I see in the w...
That's a problem **already solved** by OSGi. The real problem is not to load a new jar version. This could be done with your own classloader that releases the file lock. The real problem is how to [handle instances of different versions of the same class](http://en.wikipedia.org/wiki/Classloader#JAR_hell). Restart do...
1,748,356
I have some application, which has ability to update itself. Its downloads the jar file from the net, and then tries to replace used jar to run this application by downloaded one. But I cannot to do that, because the file is locked by windows, because application is still running. Does anybody know some workaround of ...
2009/11/17
['https://Stackoverflow.com/questions/1748356', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/212822/']
That's a problem **already solved** by OSGi. The real problem is not to load a new jar version. This could be done with your own classloader that releases the file lock. The real problem is how to [handle instances of different versions of the same class](http://en.wikipedia.org/wiki/Classloader#JAR_hell). Restart do...
Typical way to do this is to write a separate updater which will be invoked by your main program when it sees an update. At this time your main program can start the updater in a new process and exit. You updater can wait for main program to exit, download and copy the updated files and restart your main program
12,302,290
I have a log file on server called `writelog` which is about `2GB`. I want to delete first `100,000` lines from the file. I could open the file and delete those lines but because of the file size it takes me forever to download it. So, is it possible to do this from Linux terminal? If yes how?
2012/09/06
['https://Stackoverflow.com/questions/12302290', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1143828/']
If you want to clear out the *whole file* a quick way is `cat /dev/null > writelog` See also [this thread on unix.com](http://www.unix.com/unix-dummies-questions-answers/150082-create-empty-file-overwrite-file-differences-between-cat-echo-etc.html).
If you are running a Linux server, you can use `ssh`: ``` ssh username@mydomain.com sed -i '1,100000d' /path/to/logfile ```
12,302,290
I have a log file on server called `writelog` which is about `2GB`. I want to delete first `100,000` lines from the file. I could open the file and delete those lines but because of the file size it takes me forever to download it. So, is it possible to do this from Linux terminal? If yes how?
2012/09/06
['https://Stackoverflow.com/questions/12302290', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1143828/']
If you want to clear out the *whole file* a quick way is `cat /dev/null > writelog` See also [this thread on unix.com](http://www.unix.com/unix-dummies-questions-answers/150082-create-empty-file-overwrite-file-differences-between-cat-echo-etc.html).
It might be better to keep the last 1000 lines: ``` mv writelog writelog.bak tail -1000 writelog.bak > writelog ``` And you should enable `logrotate` ([manual](http://linux.die.net/man/8/logrotate)) for the file. The system will then make sure the file doesn't grow out of proportions.
9,293,124
``` Qt :: WindowFlags flags = 0; // Makes the Pomodoro stay on the top of all windows. flags |= Qt :: WindowStaysOnTopHint; // Removes minimize, maximize, and close buttons. flags |= Qt :: WindowTitleHint | Qt :: CustomizeWindowHint; window->setWindowFlags (flags); window->setWindowTitle ...
2012/02/15
['https://Stackoverflow.com/questions/9293124', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/462608/']
This is working for me: ``` Qt::Window | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint ``` ![Screen shot](https://i.stack.imgur.com/zCRxF.png) Sometimes you have to specify these in the constructor of the window for them to take effect. If you assign them later (`setWindowFlags`), some of...
I'm currently at work without an Qt environment, so I could not test it. Would you please try this? ``` Qt::WindowFlags flags = 0; // Makes the Pomodoro stay on the top of all windows. flags |= Qt :: WindowStaysOnTopHint; // Removes minimize, maximize, and close buttons. flags |= Qt :: WindowTitleHint | Qt :: Custom...
9,293,124
``` Qt :: WindowFlags flags = 0; // Makes the Pomodoro stay on the top of all windows. flags |= Qt :: WindowStaysOnTopHint; // Removes minimize, maximize, and close buttons. flags |= Qt :: WindowTitleHint | Qt :: CustomizeWindowHint; window->setWindowFlags (flags); window->setWindowTitle ...
2012/02/15
['https://Stackoverflow.com/questions/9293124', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/462608/']
This is working for me: ``` Qt::Window | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint ``` ![Screen shot](https://i.stack.imgur.com/zCRxF.png) Sometimes you have to specify these in the constructor of the window for them to take effect. If you assign them later (`setWindowFlags`), some of...
Try to start by setting Qt::Dialog ``` setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowStaysOnTopHint); ```
10,581,112
What would be the best way to create a C# Web Application that allows the user to browse for an image and then display it? An equivalent of Picturebox in windows applications, sort of Ideally the user should be able to click on Browse, choose the picture and see it in the browser itself Thanks
2012/05/14
['https://Stackoverflow.com/questions/10581112', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1211929/']
There are all ready some image-browser for asp.net including source code. Some of them <http://www.codeproject.com/Articles/17605/Thumbnail-Image-Viewer-Control-for-ASP-NET-2-0> <http://www.codeproject.com/Articles/29846/A-simple-ASP-NET-AJAX-image-browser>
For this, the user needs to choose an image which will be uploaded to the server, and then rendered in the HTML or recovered using AJAX. The problem is that you can't get rid of the send/receive, and it can get slow. You can use a `FileUpload` or any other component that allows to upload files directly or via AJAX (lo...
30,796,314
Am new to Angularjs, any one can help me about this infact my array is like this ``` array = [{"loc_name":"pronto network office","address":"3rd floor, kalyani motors","ap":[]}], ``` but when i use at dynamically its converted like this ``` [" {\"loc_name\":\"pronto="" network="" office\",\"address\":\"3rd="" flo...
2015/06/12
['https://Stackoverflow.com/questions/30796314', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/748447/']
Your response should not contain `"` at starting of object inside array right after `[` and just before `]` need to remove `"` like it should be like `[{\"loc_name\":\"pronto="" network="" office\",\"address\":\"3rd="" floor,="" kalyani="" motors\",\"ap\":[]}]` Then place it in your scope variable `$scope.locations = ...
You can just use single quotes instead of `"`: ``` <ul ng-repeat="loc in [{loc_name: 'pronto network office', address: '3rd floor, kalyani motors', ap: []}]"> <!-- ... --> </ul> ``` You can also omit quotes around keys: string inside `ngRepeat` doesn't have to comply string JSON notation with quoted keys. Of cou...
30,796,314
Am new to Angularjs, any one can help me about this infact my array is like this ``` array = [{"loc_name":"pronto network office","address":"3rd floor, kalyani motors","ap":[]}], ``` but when i use at dynamically its converted like this ``` [" {\"loc_name\":\"pronto="" network="" office\",\"address\":\"3rd="" flo...
2015/06/12
['https://Stackoverflow.com/questions/30796314', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/748447/']
Your response should not contain `"` at starting of object inside array right after `[` and just before `]` need to remove `"` like it should be like `[{\"loc_name\":\"pronto="" network="" office\",\"address\":\"3rd="" floor,="" kalyani="" motors\",\"ap\":[]}]` Then place it in your scope variable `$scope.locations = ...
Do you really want your array inside your html? Otherwise to make it simple and recommended way of doing is to move it to your controller in the JS. I have created a sample in <http://jsbin.com/tayege/2/edit?html,js,output> for you
55,740,242
Are there any compiler independent flags that can be set? I'd like to be able to set single variable to e.g. `OPTIMIZE_MOST` and get `-O3` on gcc and `/O2` in MS C++ compiler. Is there something I can use or should flags be set for each compiler separately?
2019/04/18
['https://Stackoverflow.com/questions/55740242', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3826362/']
Simply spoken: No, there is no flag to directly set the optimization level independently for every compiler. However, CMake provides so called [build types](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html). Those are independent of the compiler in use and each comes with a predefined selection of f...
To a degree. For some concepts, CMake has support for specifying them in a compiler-agnostic manner, usually by setting properties on the target in question. Unfortunately, there is no one location where all such possibilities would be listed. I went through the current [list of target properties](https://cmake.org/cma...
20,693,377
I have a sortable list of items (each with a draggable handle) and I'm trying to align some elements within each item: a title, link, and some descriptive text. The items are adjacent to a left-floated div (the "handle" you see on the left). Unfortunately, there is a large gap between the title and the link: ![There's...
2013/12/19
['https://Stackoverflow.com/questions/20693377', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/557928/']
Try adding these properties to your existing classes: ``` .itemSubContainer { overflow:hidden; } .handle { margin-right:10px; } ``` To help clear your floated elemets, because your itemSubContainer class doesn't know about the containing elements because they are floated and taken out of the flow.
Try the [`Media Object`](http://getbootstrap.com/components/#media) implementation given in Bootstrap. It includes a left-floated element with multiple text elements on its right. ``` <div class="media"> <a class="pull-left" href="#"> <img class="media-object" src="..." alt="..."> </a> <div class="media-body...
20,693,377
I have a sortable list of items (each with a draggable handle) and I'm trying to align some elements within each item: a title, link, and some descriptive text. The items are adjacent to a left-floated div (the "handle" you see on the left). Unfortunately, there is a large gap between the title and the link: ![There's...
2013/12/19
['https://Stackoverflow.com/questions/20693377', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/557928/']
Try adding these properties to your existing classes: ``` .itemSubContainer { overflow:hidden; } .handle { margin-right:10px; } ``` To help clear your floated elemets, because your itemSubContainer class doesn't know about the containing elements because they are floated and taken out of the flow.
The problem is that `.row` itself is also floating left and each `.row` clears the float. Instead of floating `.handle`, use `position: absolute` so the handle doesn't interfere with the rest of the content. Note that there's also a 10px margin on `h4` that you may wish to adjust. ![enter image description here](http...
60,996,959
I have this command : ``` $ anbox session-manager --single-window --window-size=400,650 ``` and i need to run it **frequently**, is there any way to avoid **rewriting** it every time I need it ?
2020/04/02
['https://Stackoverflow.com/questions/60996959', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10863605/']
You can set an alias like this, ``` alias sessmgr = "anbox session-manager --single-window --window-size=400,650" ``` Later, you can directly use `sessmgr`.
There are several ways you can do this, the most common is probably [using an alias](https://www.tecmint.com/create-alias-in-linux/) A common alias is using 'll' for 'ls -al', one way you could do that is with the following command: `alias ll='ls-al'`
60,996,959
I have this command : ``` $ anbox session-manager --single-window --window-size=400,650 ``` and i need to run it **frequently**, is there any way to avoid **rewriting** it every time I need it ?
2020/04/02
['https://Stackoverflow.com/questions/60996959', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10863605/']
For permanently use 1. run this ``` echo 'alias customcommand="anbox session-manager --single-window --window-size=400,650"' >> /home/$(USER)/.bashrc ``` 2. open new terminal 3. now you can run `customcommand` and get that response
There are several ways you can do this, the most common is probably [using an alias](https://www.tecmint.com/create-alias-in-linux/) A common alias is using 'll' for 'ls -al', one way you could do that is with the following command: `alias ll='ls-al'`
60,996,959
I have this command : ``` $ anbox session-manager --single-window --window-size=400,650 ``` and i need to run it **frequently**, is there any way to avoid **rewriting** it every time I need it ?
2020/04/02
['https://Stackoverflow.com/questions/60996959', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10863605/']
You can use the alias command, and if you want to make the change permanent you can append the alias command in your .bashrc file, so every time you launch a terminal you will have by default the defined alias that you set before in your .bashrc file. e.g. `alias <name_of_the_alias>="<command>".` You can find more inf...
There are several ways you can do this, the most common is probably [using an alias](https://www.tecmint.com/create-alias-in-linux/) A common alias is using 'll' for 'ls -al', one way you could do that is with the following command: `alias ll='ls-al'`
60,996,959
I have this command : ``` $ anbox session-manager --single-window --window-size=400,650 ``` and i need to run it **frequently**, is there any way to avoid **rewriting** it every time I need it ?
2020/04/02
['https://Stackoverflow.com/questions/60996959', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10863605/']
For permanently use 1. run this ``` echo 'alias customcommand="anbox session-manager --single-window --window-size=400,650"' >> /home/$(USER)/.bashrc ``` 2. open new terminal 3. now you can run `customcommand` and get that response
You can set an alias like this, ``` alias sessmgr = "anbox session-manager --single-window --window-size=400,650" ``` Later, you can directly use `sessmgr`.
60,996,959
I have this command : ``` $ anbox session-manager --single-window --window-size=400,650 ``` and i need to run it **frequently**, is there any way to avoid **rewriting** it every time I need it ?
2020/04/02
['https://Stackoverflow.com/questions/60996959', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10863605/']
For permanently use 1. run this ``` echo 'alias customcommand="anbox session-manager --single-window --window-size=400,650"' >> /home/$(USER)/.bashrc ``` 2. open new terminal 3. now you can run `customcommand` and get that response
You can use the alias command, and if you want to make the change permanent you can append the alias command in your .bashrc file, so every time you launch a terminal you will have by default the defined alias that you set before in your .bashrc file. e.g. `alias <name_of_the_alias>="<command>".` You can find more inf...
58,505,500
My code looks like this: ``` cIndex = (int)rand.Next(App.viewablePhrases.Count); phrase = App.viewablePhrases[cIndex]; ``` Infrequently it's giving me an error: ``` Application Specific Information: *** Terminating app due to uncaught exception 'SIGABRT', reason: 'Index was out of range. Must be non-negative and le...
2019/10/22
['https://Stackoverflow.com/questions/58505500', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1422604/']
> > Is there a way I could catch this exception to show more details? > > > Just put your code in try / catch block like this: ``` try { cIndex = (int)rand.Next(App.viewablePhrases.Count); phrase = App.viewablePhrases[cIndex]; } catch(System.ArgumentOutOfRangeException e) { Console.WriteLine("Exception inform...
Index can be from 0 to Count-1.
38,710,913
I'm learning Angular on Plural Sight and the first lesson gives an example of how to use the ng-app directive. Here's a link to the Plunker editor <http://plnkr.co/edit/HIDCS8A9CR1jnAIDR0Zb?p=preview> ``` <!DOCTYPE html> <html> <head> <script data-require="angular.js@*" data-semver="2.0.0" src="h...
2016/08/02
['https://Stackoverflow.com/questions/38710913', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6665622/']
The method you are looking for is this **[`org.bouncycastle.util.encoders.Base64.encode(byte[] data)`](https://people.eecs.berkeley.edu/~jonah/bc/org/bouncycastle/util/encoders/Base64.html#encode(byte[]))** I'm not sure where you got the reference to `Base64.toBase64String`, but a quick search shows that is very clo...
I guess you will have to use the methoad as below and check if it compiles ``` Base64.getEncoder().encodeToString(cipher.doFinal(initiatorpassword.getBytes())) ```
19,447,314
There in C# available any methods like serialize and unserialize in php? I need it for best way to transfer an array through network.
2013/10/18
['https://Stackoverflow.com/questions/19447314', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1146533/']
``` var countries = ["FR", "IT", "DE", "AU", "RU"]; $('div').hide(); $('select').change(function () { if ($.inArray(this.value, countries) >= 0) { $('div').show(); } else { $('div').hide(); } }); ``` [**FIDDLE**](http://jsfiddle.net/qYnKK/1/)
Try this, ``` var countries = ["FR", "IT", "DE", "AU", "RU"]; $('#myitems').hide(); $('#country').on('change', function () { if ($.inArray($(this).val(), countries)!=-1) { $('#myitems').show(); } else { $('#myitems').hide(); } }); ``` [Demo](http://jsfiddle.net/rohankumar1524/sVXJF/)
19,447,314
There in C# available any methods like serialize and unserialize in php? I need it for best way to transfer an array through network.
2013/10/18
['https://Stackoverflow.com/questions/19447314', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1146533/']
``` var countries = ["FR", "IT", "DE", "AU", "RU"]; $('div').hide(); $('select').change(function () { if ($.inArray(this.value, countries) >= 0) { $('div').show(); } else { $('div').hide(); } }); ``` [**FIDDLE**](http://jsfiddle.net/qYnKK/1/)
[JSFIDDLE](http://jsfiddle.net/zDuq5/) ``` var countries=["FR","IT","DE", "AU", "RU"]; $("#country").change(function(){ var selectedVal = $(this).val(); if(countries.indexOf(selectedVal) != -1){ $("#divToShow").show(); } else { $("#divToShow").hide(); } }); ```
19,447,314
There in C# available any methods like serialize and unserialize in php? I need it for best way to transfer an array through network.
2013/10/18
['https://Stackoverflow.com/questions/19447314', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1146533/']
``` var countries = ["FR", "IT", "DE", "AU", "RU"]; $('div').hide(); $('select').change(function () { if ($.inArray(this.value, countries) >= 0) { $('div').show(); } else { $('div').hide(); } }); ``` [**FIDDLE**](http://jsfiddle.net/qYnKK/1/)
**[Live Demo](http://jsfiddle.net/FfzgR/1/)** you can use `$.inArray("Your data", array)` using `Jquery` function for ex: **HTML:** ``` <select name="country" id="country"> <option value="0">Your country</option> <option value="IT">Afghanistan</option> <option value="AX">&#197;land Islands</option> ...
54,126,434
Right now I'm calling an external bash script via open, because said script might run for seconds or it might run for minutes. The only things that are certain are: 1. It will output text which has to be displayed to the user. Not after the script is done, but while it is still running. 2. It will set a return code wi...
2019/01/10
['https://Stackoverflow.com/questions/54126434', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/6009051/']
You need to switch the file descriptor back to blocking before you close it to get the exit code. For example: You can use `try ... trap`, which was implemented with tcl 8.6: ``` chan configure $process -blocking 1 try { close $process # No error return 0 } trap CHILDSTATUS {result options} { return [...
To get the status in 8.5, use this: ``` fconfigure $process -blocking 1 if {[catch {close $process} result options] == 1} { set code [dict get $options -errorcode] if {[lindex $code 0] eq "CHILDSTATUS"} { return [lindex $code 2] } # handle other types of failure here... } ``` To get the statu...
34,811,616
As a complete beginner to VBA Excel, I would like to be able to do the following: I want to find the first value larger than 0 in a row, and then sum over the following 4 cells in the same row. So ``` Animal1 0 0 1 2 3 0 1 Animal2 3 3 0 1 4 2 0 Animal3 0 0 0 0 ...
2016/01/15
['https://Stackoverflow.com/questions/34811616', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4729787/']
(Your problem description didn't match your examples. I interpreted the problem as one of summing the 4 elements in a row which begin with the first number which is greater than 0. If my interpretation is wrong -- the following code would need to be tweaked.) You could do it with a user-defined function (i.e. a UDF --...
Here is what I would use, I dont know any of the cell placement you have used so you will need to change that yourself. Future reference this isnt a code writing site for you, if you are new to VBA i suggest doing simple stuff first, make a message box appear, use code to move to different cells, try a few if statment...
34,811,616
As a complete beginner to VBA Excel, I would like to be able to do the following: I want to find the first value larger than 0 in a row, and then sum over the following 4 cells in the same row. So ``` Animal1 0 0 1 2 3 0 1 Animal2 3 3 0 1 4 2 0 Animal3 0 0 0 0 ...
2016/01/15
['https://Stackoverflow.com/questions/34811616', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4729787/']
This is the one of the variants of how you can achieve required result: ``` Sub test() Dim cl As Range, cl2 As Range, k, Dic As Object, i%: i = 1 Set Dic = CreateObject("Scripting.Dictionary") For Each cl In ActiveSheet.UsedRange.Columns(1).Cells For Each cl2 In Range(Cells(cl.Row,...
Here is what I would use, I dont know any of the cell placement you have used so you will need to change that yourself. Future reference this isnt a code writing site for you, if you are new to VBA i suggest doing simple stuff first, make a message box appear, use code to move to different cells, try a few if statment...
34,811,616
As a complete beginner to VBA Excel, I would like to be able to do the following: I want to find the first value larger than 0 in a row, and then sum over the following 4 cells in the same row. So ``` Animal1 0 0 1 2 3 0 1 Animal2 3 3 0 1 4 2 0 Animal3 0 0 0 0 ...
2016/01/15
['https://Stackoverflow.com/questions/34811616', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4729787/']
(Your problem description didn't match your examples. I interpreted the problem as one of summing the 4 elements in a row which begin with the first number which is greater than 0. If my interpretation is wrong -- the following code would need to be tweaked.) You could do it with a user-defined function (i.e. a UDF --...
This is the one of the variants of how you can achieve required result: ``` Sub test() Dim cl As Range, cl2 As Range, k, Dic As Object, i%: i = 1 Set Dic = CreateObject("Scripting.Dictionary") For Each cl In ActiveSheet.UsedRange.Columns(1).Cells For Each cl2 In Range(Cells(cl.Row,...