qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
633,372
I have two wired connections of which the first has internet via static IPv4 and gateway and the second connects to another network. I want to share internet from first connection over second connection with a different IP-address.
2015/06/07
[ "https://askubuntu.com/questions/633372", "https://askubuntu.com", "https://askubuntu.com/users/417490/" ]
Edit `/etc/sysctl.conf` (for example using `sudoedit /etc/sysctl.conf`) and search for the following lines: ``` # Uncomment the next line to enable packet forwarding for IPv4 #net.ipv4.ip_forward=1 ``` And uncomment `net.ipv4.ip_forward=1` by removing the `#` at the start of the line: ``` # Uncomment the next line ...
You could've done it easier than this. If your internet connection is established via some sort of routing device you can just make a VLAN for the connection you want to share internet with to make it to have access to the router subnet. <https://wiki.ubuntu.com/vlan> You can do this in Network Manager GUI easily. Af...
57,082
With cards like [Sefris of the Hidden Ways](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BSefris%20of%20the%20Hidden%20Ways%5D%0A) or the new card [Akki Battle Squad](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BAkki%20Battle%20Squad%5D%0A) they have an additional line stating thi...
2022/02/07
[ "https://boardgames.stackexchange.com/questions/57082", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/27646/" ]
Although this is a common game mechanic, each game appears to use its own term for such a thing, rather than any commonly-used term. * Fabled Fruit calls it the "Market". This term is quite generic and would lend itself to be used in any game if you wanted. * Splendor is the same as Ticket to Ride; just calling them "...
While individual games may use their own (usually thematic or contextual) word for such an layout, one generic term for this would be **tableau**, as in a static display of various objects, like that seen in Ticket To Ride and games listed in another answer. Also applicable is **array**, though this feels more appropr...
57,082
With cards like [Sefris of the Hidden Ways](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BSefris%20of%20the%20Hidden%20Ways%5D%0A) or the new card [Akki Battle Squad](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BAkki%20Battle%20Squad%5D%0A) they have an additional line stating thi...
2022/02/07
[ "https://boardgames.stackexchange.com/questions/57082", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/27646/" ]
Although this is a common game mechanic, each game appears to use its own term for such a thing, rather than any commonly-used term. * Fabled Fruit calls it the "Market". This term is quite generic and would lend itself to be used in any game if you wanted. * Splendor is the same as Ticket to Ride; just calling them "...
A term I saw in Pax Emancipation is "splay".
57,082
With cards like [Sefris of the Hidden Ways](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BSefris%20of%20the%20Hidden%20Ways%5D%0A) or the new card [Akki Battle Squad](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BAkki%20Battle%20Squad%5D%0A) they have an additional line stating thi...
2022/02/07
[ "https://boardgames.stackexchange.com/questions/57082", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/27646/" ]
Although this is a common game mechanic, each game appears to use its own term for such a thing, rather than any commonly-used term. * Fabled Fruit calls it the "Market". This term is quite generic and would lend itself to be used in any game if you wanted. * Splendor is the same as Ticket to Ride; just calling them "...
I like a lot of the other answers. Another potential generic term is **Pool**, as in "the card pool". One definition from [Merriam-Webster](https://www.merriam-webster.com/dictionary/pool) is - *a readily available supply*
57,082
With cards like [Sefris of the Hidden Ways](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BSefris%20of%20the%20Hidden%20Ways%5D%0A) or the new card [Akki Battle Squad](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BAkki%20Battle%20Squad%5D%0A) they have an additional line stating thi...
2022/02/07
[ "https://boardgames.stackexchange.com/questions/57082", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/27646/" ]
While individual games may use their own (usually thematic or contextual) word for such an layout, one generic term for this would be **tableau**, as in a static display of various objects, like that seen in Ticket To Ride and games listed in another answer. Also applicable is **array**, though this feels more appropr...
A term I saw in Pax Emancipation is "splay".
57,082
With cards like [Sefris of the Hidden Ways](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BSefris%20of%20the%20Hidden%20Ways%5D%0A) or the new card [Akki Battle Squad](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BAkki%20Battle%20Squad%5D%0A) they have an additional line stating thi...
2022/02/07
[ "https://boardgames.stackexchange.com/questions/57082", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/27646/" ]
While individual games may use their own (usually thematic or contextual) word for such an layout, one generic term for this would be **tableau**, as in a static display of various objects, like that seen in Ticket To Ride and games listed in another answer. Also applicable is **array**, though this feels more appropr...
I like a lot of the other answers. Another potential generic term is **Pool**, as in "the card pool". One definition from [Merriam-Webster](https://www.merriam-webster.com/dictionary/pool) is - *a readily available supply*
57,082
With cards like [Sefris of the Hidden Ways](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BSefris%20of%20the%20Hidden%20Ways%5D%0A) or the new card [Akki Battle Squad](http://gatherer.wizards.com/Pages/Search/Default.aspx?name=%2B%5BAkki%20Battle%20Squad%5D%0A) they have an additional line stating thi...
2022/02/07
[ "https://boardgames.stackexchange.com/questions/57082", "https://boardgames.stackexchange.com", "https://boardgames.stackexchange.com/users/27646/" ]
I like a lot of the other answers. Another potential generic term is **Pool**, as in "the card pool". One definition from [Merriam-Webster](https://www.merriam-webster.com/dictionary/pool) is - *a readily available supply*
A term I saw in Pax Emancipation is "splay".
49,604,378
In Java 8, default methods for an interface were introduced for adding methods to existing interface without breaking backward compatibility. Since default methods are non-abstract, they can be used to make a `FunctionalInterface` with multiple overridable methods. Say, a `StringTransformer` interface has two methods...
2018/04/02
[ "https://Stackoverflow.com/questions/49604378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1448742/" ]
As said in [this answer](https://stackoverflow.com/a/19998622/2711488), allowing to create interfaces with more than one method still being functional interfaces, is one of the purposes of default methods. As also mentioned there, you will find examples within the Java API itself, say [`Comparator`](https://docs.oracle...
Theoretically there is nothing wrong wit h it. You can use this type of interfaces. I would like to start with the conditions where you need this type of construct. **Backward capability** As you mentioned, default methods are introduced to maintain backward capability, so usage of default methods to make interface b...
49,604,378
In Java 8, default methods for an interface were introduced for adding methods to existing interface without breaking backward compatibility. Since default methods are non-abstract, they can be used to make a `FunctionalInterface` with multiple overridable methods. Say, a `StringTransformer` interface has two methods...
2018/04/02
[ "https://Stackoverflow.com/questions/49604378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1448742/" ]
As said in [this answer](https://stackoverflow.com/a/19998622/2711488), allowing to create interfaces with more than one method still being functional interfaces, is one of the purposes of default methods. As also mentioned there, you will find examples within the Java API itself, say [`Comparator`](https://docs.oracle...
To my mind it’s not a good idea to transform a regular interface that can be referenced as data type to functional interface. If you do this then user can implement the StringTransform where they need actually this interface as a type and where they create lambdas. That reduces readability and maintainability.
19,990,888
Thanks for your patience - I'm starting my post all over again and going ahead and putting up everything I have. It's hard for me to explain what advice I need because I don't quite understand what's wrong. If anyone can take a look, that would be wonderful. The biggest problem I am having is with the CHECK BALANCE but...
2013/11/14
[ "https://Stackoverflow.com/questions/19990888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2994339/" ]
You may try this ``` public abstract class AbstractCrud<T extends Entity> { private GenericTableModel<T> table; public AbstractCrud( GenericTableModel<T> table ){ this.table = table } public List<T> getList(){ return this.table.listAll() } public class UserSimpleCrud extends AbstractCrud<Use...
If I were writing my own rather than using, say, Spring Data (which has served me well for these types of situations), I would do something like: ``` public abstract class AbstractCrud<T extends GenericTableModel, E extends Entity> { private T table; public AbstractCrud( T t ){ this.table = t } public Li...
15,250,620
If I have a Rule which has many Criteria and a user selects multiple criteria, how do I write a linq query giving me all the rules where EVERY criteria within that rule exists with the user's selected criteria? Here is how I'm doing it in SQL currently: **Tables** ``` rule: ruleId int categoryId int ruleCriteri...
2013/03/06
[ "https://Stackoverflow.com/questions/15250620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/64279/" ]
I played around with some test data in [LINQPad](http://www.linqpad.net/) and this is what I came up with. ``` from rc in ruleCriteria group new { rc.criteriaId, rc.categoryId } by rc.ruleId into rules where rules.Count() == userCriteria.Count(uc => rules.Contains(new { uc.criteriaId, uc.categoryId })) select rule...
Unless I am misunderstanding (and therefore over simplyfying the problem) maybe the all [.All()](http://msdn.microsoft.com/en-gb/library/bb548541.aspx) method is what you need. ``` var userCriteria = ; //TODO: Build user criteria var result = context.Rules.Where(r => r.CategoryId == userCriteria.CategoryId ...
15,250,620
If I have a Rule which has many Criteria and a user selects multiple criteria, how do I write a linq query giving me all the rules where EVERY criteria within that rule exists with the user's selected criteria? Here is how I'm doing it in SQL currently: **Tables** ``` rule: ruleId int categoryId int ruleCriteri...
2013/03/06
[ "https://Stackoverflow.com/questions/15250620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/64279/" ]
This query generates better SQL than the other one, and it's more direct: ``` from rc in ruleCriterias group rc by rc.ruleId into rules where rules.All(rc => userCriterias.Any(uc => uc.criteriaId == rc.criteriaId && uc.categoryId == rc.categoryId)) select rules.Key ``` You should make sure all the columns are `N...
Unless I am misunderstanding (and therefore over simplyfying the problem) maybe the all [.All()](http://msdn.microsoft.com/en-gb/library/bb548541.aspx) method is what you need. ``` var userCriteria = ; //TODO: Build user criteria var result = context.Rules.Where(r => r.CategoryId == userCriteria.CategoryId ...
15,250,620
If I have a Rule which has many Criteria and a user selects multiple criteria, how do I write a linq query giving me all the rules where EVERY criteria within that rule exists with the user's selected criteria? Here is how I'm doing it in SQL currently: **Tables** ``` rule: ruleId int categoryId int ruleCriteri...
2013/03/06
[ "https://Stackoverflow.com/questions/15250620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/64279/" ]
This query generates better SQL than the other one, and it's more direct: ``` from rc in ruleCriterias group rc by rc.ruleId into rules where rules.All(rc => userCriterias.Any(uc => uc.criteriaId == rc.criteriaId && uc.categoryId == rc.categoryId)) select rules.Key ``` You should make sure all the columns are `N...
I played around with some test data in [LINQPad](http://www.linqpad.net/) and this is what I came up with. ``` from rc in ruleCriteria group new { rc.criteriaId, rc.categoryId } by rc.ruleId into rules where rules.Count() == userCriteria.Count(uc => rules.Contains(new { uc.criteriaId, uc.categoryId })) select rule...
6,222,758
I am working on a mobile library app. I have a 3-4 db files of books stored in raw folder. If I know the name of the book then I first copy this file to /databases/book\_name.db and then access them as required. I use ``` InputStream fileInputStream = getResources().openRawResource(R.raw.book_name); ``` for accessi...
2011/06/03
[ "https://Stackoverflow.com/questions/6222758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/429150/" ]
Use [Resources.getIdentifier()](http://d.android.com/reference/android/content/res/Resources.html#getIdentifier%28java.lang.String,%20java.lang.String,%20java.lang.String%29) method: ``` int resId = getResources().getIdentifier("raw/book_name", null, this.getPackageName()); ``` If your code not in activity or applic...
You can use the answer I gave here: [Android: Accessing string.xml using variable name](https://stackoverflow.com/questions/5980577/android-accessing-string-xml-using-variable-name) Try: ``` int identifier = getResources().getIdentifier(bookname, "raw", "<application package class>"); ``` EDIT: meh, its raw.
6,222,758
I am working on a mobile library app. I have a 3-4 db files of books stored in raw folder. If I know the name of the book then I first copy this file to /databases/book\_name.db and then access them as required. I use ``` InputStream fileInputStream = getResources().openRawResource(R.raw.book_name); ``` for accessi...
2011/06/03
[ "https://Stackoverflow.com/questions/6222758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/429150/" ]
Use [Resources.getIdentifier()](http://d.android.com/reference/android/content/res/Resources.html#getIdentifier%28java.lang.String,%20java.lang.String,%20java.lang.String%29) method: ``` int resId = getResources().getIdentifier("raw/book_name", null, this.getPackageName()); ``` If your code not in activity or applic...
*Based off of Sergey's answer.* I'm using this in a CursorAdapter to DRY up the code and the final version that worked was: ``` String attribute = "company_name"; String packageName = view.getContext().getPackageName(); int resourceId = view.getResources().getIdentifier(attribute, null, packageName); ``` Actual...
6,222,758
I am working on a mobile library app. I have a 3-4 db files of books stored in raw folder. If I know the name of the book then I first copy this file to /databases/book\_name.db and then access them as required. I use ``` InputStream fileInputStream = getResources().openRawResource(R.raw.book_name); ``` for accessi...
2011/06/03
[ "https://Stackoverflow.com/questions/6222758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/429150/" ]
You can use the answer I gave here: [Android: Accessing string.xml using variable name](https://stackoverflow.com/questions/5980577/android-accessing-string-xml-using-variable-name) Try: ``` int identifier = getResources().getIdentifier(bookname, "raw", "<application package class>"); ``` EDIT: meh, its raw.
*Based off of Sergey's answer.* I'm using this in a CursorAdapter to DRY up the code and the final version that worked was: ``` String attribute = "company_name"; String packageName = view.getContext().getPackageName(); int resourceId = view.getResources().getIdentifier(attribute, null, packageName); ``` Actual...
159,958
I have installed Ubuntu 10.04 on a desktop, and do not have a keyboard that I can use with it. I would like to install sshd (secure shell daemon) so that I can access that computer, but I can't seem to get onBoard, the on screen, accessibility keyboard to launch. I am sure that it could be launched by typing `onboard' ...
2010/07/04
[ "https://superuser.com/questions/159958", "https://superuser.com", "https://superuser.com/users/52569/" ]
I managed to launch the on screen keyboard by creating a text file on a USB drive with the contents "onboard\n", copying that text from the file to the terminal and continuing from there. I would recommend to anyone with this problem in the future to compose the shell script, `#!/bin/bash` onboard and to execute it ...
I know this is old, and im not using your distro, but if you do want to use the built-in on screen keyboard (part of the accessibility you could try this (thinking also there should be an easier way) ``` #!/usr/bin/env bash OSK_CONF_PATH="/org/gnome/desktop/a11y/applications/screen-keyboard-enabled" if $(dconf read "...
19,831,270
I have developed a application in ASP.NET using c#. The entire application working fine but the problem is when I open the application for first time it running very slow. i.e. its taking so much time to load a page like home page or any other page. But when I reopen that page then that page opens quickly as I expect. ...
2013/11/07
[ "https://Stackoverflow.com/questions/19831270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2688886/" ]
The application is compiled on the first request. Read [this](http://msdn.microsoft.com/en-us/library/ms178466.ASPX) article by Microsoft. > > Because **ASP.NET compiles your Web site on first user request**, you can > simply copy your application's source code to the production Web > server. However, ASP.NET als...
Check your site in firebug in .net tab there you will find which part of your page take much time to load, there might be some exceptions or some code errors in client side language. Try to use less sessions and debug your code to clarify no extra looping of code (sorry for bad English but hopefully you have got my poi...
39,987,963
I'm trying to use Esri map. To include map in my project, here is what I found: ``` require([ "esri/map", "esri/dijit/Search", "esri/dijit/LocateButton", "esri/geometry/Point", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", ``` But the...
2016/10/11
[ "https://Stackoverflow.com/questions/39987963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4104996/" ]
An alternative method to the above is the one demonstrated in [esri-react-router-example](https://github.com/tomwayson/esri-react-router-example). That application uses a library called [esri-loader](https://github.com/tomwayson/esri-loader) to lazy load the ArcGIS API only in components/routes where it is needed. Exam...
You don't need to import esri api like you do for ReactJS. As the react file will finally compile into a js file you need to write the esri parts as it is and mix the ReactJS part for handling the dom node, which is the main purpose of ReactJS. A sample from the links below is here ``` define([ 'react', 'e...
39,987,963
I'm trying to use Esri map. To include map in my project, here is what I found: ``` require([ "esri/map", "esri/dijit/Search", "esri/dijit/LocateButton", "esri/geometry/Point", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", ``` But the...
2016/10/11
[ "https://Stackoverflow.com/questions/39987963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4104996/" ]
Use esri-loader to load the required esri modules. This is a component rendering basemap. ``` import React, { Component } from 'react'; import { loadModules } from 'esri-loader'; const options = { url: 'https://js.arcgis.com/4.6/' }; const styles = { container: { height: '100vh', width: '100vw' }, m...
You don't need to import esri api like you do for ReactJS. As the react file will finally compile into a js file you need to write the esri parts as it is and mix the ReactJS part for handling the dom node, which is the main purpose of ReactJS. A sample from the links below is here ``` define([ 'react', 'e...
39,987,963
I'm trying to use Esri map. To include map in my project, here is what I found: ``` require([ "esri/map", "esri/dijit/Search", "esri/dijit/LocateButton", "esri/geometry/Point", "esri/symbols/SimpleFillSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", ``` But the...
2016/10/11
[ "https://Stackoverflow.com/questions/39987963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4104996/" ]
Use esri-loader to load the required esri modules. This is a component rendering basemap. ``` import React, { Component } from 'react'; import { loadModules } from 'esri-loader'; const options = { url: 'https://js.arcgis.com/4.6/' }; const styles = { container: { height: '100vh', width: '100vw' }, m...
An alternative method to the above is the one demonstrated in [esri-react-router-example](https://github.com/tomwayson/esri-react-router-example). That application uses a library called [esri-loader](https://github.com/tomwayson/esri-loader) to lazy load the ArcGIS API only in components/routes where it is needed. Exam...
17,853,687
I want to use multiple fragments inside single tab. my tab activity extends `SherlockFragmentActivity`. Now i add first fragment for first tab in `onTabChanged()` method. and i replace another fragment from within first fragment in first tab. But no when i go to second tab and then again re-open first tab, state of fi...
2013/07/25
[ "https://Stackoverflow.com/questions/17853687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1405983/" ]
If you are using two tabs, you have to maintain two fragments separately for each tab i.e FragmentA for tab1 and FragmentB for tab2 and xmls of FragmentA , FragmentB should have FrameLayout for FrgmentTransaction. **xml of FragmentA i.e frag\_a.xml :** ``` <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:and...
Here is a sample code for managing multiple fragments in an activity: ``` public class MainActivity extends FragmentActivity { private FragmentManager fragmentManager; Fragment currentFragment; Fragment1 initialFragment; Fragment2 nextFragment; @Override protected void onCreate(Bundle savedInstanceState) { super...
50,569,488
Failed to compile. ./src/app/services/admin.service.ts Module not found: Error: Can't resolve 'rxjs/Rx' in 'C:\project\test-m\angular\src\app\services' package.json "rxjs": "^6.0.0",
2018/05/28
[ "https://Stackoverflow.com/questions/50569488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9018673/" ]
Use ``` import { Observable } from 'rxjs'; ``` in place of ``` import { Observable } from 'rxjs/Rx'; ```
i resolved the issue app.module.ts ------------- import { HttpClientModule } from '@angular/common/http'; imports: [ ``` HttpClientModule, ``` ], service.ts ---------- import { HttpClient, HttpHeaders } from '@angular/common/http'; import { map } from 'rxjs/operators'; constructor(private http: HttpClient) { ...
40,247
I want to unplug my refrigerator in the winter, and cool it down by taking air from outside. The idea is to lead cool air from the outside through a pipe into the fridge, then let hot air out of the fridge with another pipe to the outside, powered by a small fan. By looking at the electric power consumption, I estimat...
2021/02/08
[ "https://engineering.stackexchange.com/questions/40247", "https://engineering.stackexchange.com", "https://engineering.stackexchange.com/users/30434/" ]
Having a fixed airflow will not be very appropriate for the things stored in the fridge. First of all, you can't be certain what the external temperature will be. It would be preferable to use a thermostat to turn on and off the fan. Even better would be to regulate the speed of the fan again with a thermostat and so...
Let's assume you 50 W is the correct figure. Then you need to solve $50 W = C\_{air}\*(T\_{out}-T\_{in})\*\dot{m}$ with thermal capacity at constant pressure C and mass flow rate $\dot{m}$ (thisgives you your volumetric flowrate.). The tricky part is $T\_{out}$ - this will be between the temeprature of the stuff in you...
65,908,558
So only useful part of code is ``` print(gender) print(age) print(height) print(health[randomm]) print(hobby[randomm]) print(phobia[randomm]) print(character[randomm]) print(inventory[randomm]) print(additionalInformation[randomm]) print(cardN1[randomm]) print(cardN2[randomm]) ``` The output is ``` 2 103 199 Ишемич...
2021/01/26
[ "https://Stackoverflow.com/questions/65908558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15086693/" ]
Use the `.replace()` ``` string = "Hello \n World" print(string.replace("\n", "")) ```
you dont need to write separate print function for each line. just write all the lines in a single print function with \n in between those statements. ``` print(health[randomm]\nhobby[randomm]) ```
65,908,558
So only useful part of code is ``` print(gender) print(age) print(height) print(health[randomm]) print(hobby[randomm]) print(phobia[randomm]) print(character[randomm]) print(inventory[randomm]) print(additionalInformation[randomm]) print(cardN1[randomm]) print(cardN2[randomm]) ``` The output is ``` 2 103 199 Ишемич...
2021/01/26
[ "https://Stackoverflow.com/questions/65908558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15086693/" ]
What is happening here is that `print` adds a newline when printing a string. When printing `"test\n"`, you end up with `"test\n\n"`, which creates blanks. ``` >>> print("test\n") test ``` You have multiple options here. You can remove the `\n` from the string: ``` >>> print("test\n".strip()) test ``` Or remove t...
you dont need to write separate print function for each line. just write all the lines in a single print function with \n in between those statements. ``` print(health[randomm]\nhobby[randomm]) ```
65,908,558
So only useful part of code is ``` print(gender) print(age) print(height) print(health[randomm]) print(hobby[randomm]) print(phobia[randomm]) print(character[randomm]) print(inventory[randomm]) print(additionalInformation[randomm]) print(cardN1[randomm]) print(cardN2[randomm]) ``` The output is ``` 2 103 199 Ишемич...
2021/01/26
[ "https://Stackoverflow.com/questions/65908558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15086693/" ]
Use the `.replace()` ``` string = "Hello \n World" print(string.replace("\n", "")) ```
What is happening here is that `print` adds a newline when printing a string. When printing `"test\n"`, you end up with `"test\n\n"`, which creates blanks. ``` >>> print("test\n") test ``` You have multiple options here. You can remove the `\n` from the string: ``` >>> print("test\n".strip()) test ``` Or remove t...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
Now we can use the [visibility API](https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API?redirectlocale=en-US&redirectslug=DOM/Using_the_Page_Visibility_API). To deal with the different browser-specific syntaxes, I made this small code : ``` var vis = (function(){ var s...
These 3 lines of code **worked for me** ``` document.addEventListener("visibilitychange", function() { document.title = document.hidden ? "I'm away" : "I'm here"; }); ``` reference link: [document.hidden](https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden) demo: <https://iamsahilralkar.github.io...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
Now we can use the [visibility API](https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API?redirectlocale=en-US&redirectslug=DOM/Using_the_Page_Visibility_API). To deal with the different browser-specific syntaxes, I made this small code : ``` var vis = (function(){ var s...
**CASE 1** Just add this `EventListener` in your **constructor**. ```js document.addEventListener("visibilitychange", function() { if (document.hidden) { //do whatever you want console.log("Hidden"); } else { //do whatever you want console.log("SHOWN"); } }); ``...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
Now we can use the [visibility API](https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API?redirectlocale=en-US&redirectslug=DOM/Using_the_Page_Visibility_API). To deal with the different browser-specific syntaxes, I made this small code : ``` var vis = (function(){ var s...
If you want to detect whether the tab is **visible** to the user, use `document.visibilityState` to perform the check (a read-only property). Although `document.hidden` works too, as others have written, then [W3C considers it 'historical'](https://www.w3.org/TR/page-visibility-2) and recommends using the former approa...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
Now we can use the [visibility API](https://developer.mozilla.org/en-US/docs/Web/Guide/User_experience/Using_the_Page_Visibility_API?redirectlocale=en-US&redirectslug=DOM/Using_the_Page_Visibility_API). To deal with the different browser-specific syntaxes, I made this small code : ``` var vis = (function(){ var s...
This is an ES6 multi-browser-solution which I use to determine the tab visibility. I took inspiration from Deny's solution and tailored it to my needs. ```js const vis = (c) => { let self = this const browserProps = { hidden: "visibilitychange", msHidden: "msvisibilitychange", webkitHidden: "webkitvisi...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
These 3 lines of code **worked for me** ``` document.addEventListener("visibilitychange", function() { document.title = document.hidden ? "I'm away" : "I'm here"; }); ``` reference link: [document.hidden](https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden) demo: <https://iamsahilralkar.github.io...
**CASE 1** Just add this `EventListener` in your **constructor**. ```js document.addEventListener("visibilitychange", function() { if (document.hidden) { //do whatever you want console.log("Hidden"); } else { //do whatever you want console.log("SHOWN"); } }); ``...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
These 3 lines of code **worked for me** ``` document.addEventListener("visibilitychange", function() { document.title = document.hidden ? "I'm away" : "I'm here"; }); ``` reference link: [document.hidden](https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden) demo: <https://iamsahilralkar.github.io...
If you want to detect whether the tab is **visible** to the user, use `document.visibilityState` to perform the check (a read-only property). Although `document.hidden` works too, as others have written, then [W3C considers it 'historical'](https://www.w3.org/TR/page-visibility-2) and recommends using the former approa...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
These 3 lines of code **worked for me** ``` document.addEventListener("visibilitychange", function() { document.title = document.hidden ? "I'm away" : "I'm here"; }); ``` reference link: [document.hidden](https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden) demo: <https://iamsahilralkar.github.io...
This is an ES6 multi-browser-solution which I use to determine the tab visibility. I took inspiration from Deny's solution and tailored it to my needs. ```js const vis = (c) => { let self = this const browserProps = { hidden: "visibilitychange", msHidden: "msvisibilitychange", webkitHidden: "webkitvisi...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
**CASE 1** Just add this `EventListener` in your **constructor**. ```js document.addEventListener("visibilitychange", function() { if (document.hidden) { //do whatever you want console.log("Hidden"); } else { //do whatever you want console.log("SHOWN"); } }); ``...
This is an ES6 multi-browser-solution which I use to determine the tab visibility. I took inspiration from Deny's solution and tailored it to my needs. ```js const vis = (c) => { let self = this const browserProps = { hidden: "visibilitychange", msHidden: "msvisibilitychange", webkitHidden: "webkitvisi...
19,519,535
How can I detect if a user is switching to another browser tab? Currently, I have this: ``` $(window).on("blur focus", function (e) { var prevType = $(this).data("prevType"); if (prevType != e.type) { // reduce double fire issues switch (e.type) { case "blur": $('.messa...
2013/10/22
[ "https://Stackoverflow.com/questions/19519535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/989185/" ]
If you want to detect whether the tab is **visible** to the user, use `document.visibilityState` to perform the check (a read-only property). Although `document.hidden` works too, as others have written, then [W3C considers it 'historical'](https://www.w3.org/TR/page-visibility-2) and recommends using the former approa...
This is an ES6 multi-browser-solution which I use to determine the tab visibility. I took inspiration from Deny's solution and tailored it to my needs. ```js const vis = (c) => { let self = this const browserProps = { hidden: "visibilitychange", msHidden: "msvisibilitychange", webkitHidden: "webkitvisi...
659,124
The earth pulls all bodies towards it at $9.8\ \mathrm{m/s^2}$. I would like to imagine that the ground is accelerating up at $9.8\ \mathrm{m/s^2}$ (just as an analogy). So this means that a rocket going up should have a greater acceleration than $9.8\ \mathrm{m/s^2}$ to go up. But that doesn't seem to be the case. I f...
2021/08/13
[ "https://physics.stackexchange.com/questions/659124", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/311272/" ]
> > But the universe expands faster than light-speed, and this expansion was caused by the big bang. Doesn't this demonstrate that the speed of light cannot be the speed of causality? > > > No, because the big bang happened everywhere. So there is no spatial distance between any point in the universe and the big b...
Your mistake is to have assumed that the expansion of the Universe is in itself a cause of something else. Nothing is 'caused' by the expansion.
59,322,112
I have 6 view controllers and I am using UiTabbar view. so om main screen the number of 4 viewcontrollers are shown in tabs and OS create another one and named it as more. On clicking more it shown me 2 of my view controller inside UiTableView. and when I click on them it opens up my viewcontroller with the Navigatio...
2019/12/13
[ "https://Stackoverflow.com/questions/59322112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6724458/" ]
In OffersViewController: ``` override func viewWillAppear(_ animated: Bool) { self.title = "Offers" } ``` In the previous ViewController ``` override func viewWillDisappear(_ animated: Bool) { self.title = "" } ``` You can also try this: ``` override func viewWillAppear(_ animated: Bo...
Normally this is done in view did load on the view controller: ``` override func viewDidLoad() { super.viewDidLoad() self.navigationItem.title = "Your Title" } ```
219,720
I asked a [question](https://stats.stackexchange.com/q/419575/247356) based on a book. > > section 2.3.2.1 of book "Machine Learning - A Probabilistic > Perspective" > > > in this case, should I say "section 2.3.2.1 of book... " or "section 2.3.2.1 of `the` book ..."?
2019/07/29
[ "https://ell.stackexchange.com/questions/219720", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
You would not say: > > …section 2.3.2.1 of book *Machine Learning*… > > > At very least, it would have to be: > > …section 2.3.2.1 of the book *Machine Learning…* > > > But in this specific context, where you are citing a publication, you could also simply have: > > …section 2.3.2.1 of *Machine Learning…*...
You should use **the** book as it is a specific book and not any old book. > > **the** definite article (PARTICULAR) used before a noun to refer to a particular thing because it is clear which thing is intended:[Link to C.E.D.](https://dictionary.cambridge.org/us/dictionary/english/the) > > >
256,297
Clarification: There were two accounts on this macbook air (plus guest): Account A (Admin) Account B (standard) 1) After restarting after the latest macOS update, Account A was missing from the startup screen (Account B and Guest are the only options). 2) After a successful login to Account B, instead of starting mac...
2016/10/07
[ "https://apple.stackexchange.com/questions/256297", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/205095/" ]
This can happen when some users are not FileVault Enabled. Log in with another user and then check out security system preferences. Thanks for the help, @bret7600. FileVault pointed me in the right direction; the solution was the same as here [User account doesn't appear on first login screen](https://apple.stackexcha...
I had a similar issue with no FileVault enabled and only one User that disappeared after 10.12.3 update (from 10.12.2). Nothing worked apart reinstalling 10.12.3 from USB without erasing the disk. This worked.
1,116,823
> > If a fair coin is tossed four times. What is the probability that two heads and two tails will result? > > > > I was solving the question above, since the sample space was small, I was able to list down all possible combinations, but what if the number of coins was let's say 20, how would one solve it?
2015/01/23
[ "https://math.stackexchange.com/questions/1116823", "https://math.stackexchange.com", "https://math.stackexchange.com/users/158096/" ]
I think I've found a solution to my own question- The sample space $n(S)=2^4$ combinations. let A be the event of occurrence of heads $x$ times. Therefore, the combinations in which heads may appear $x$ times is $\dbinom{4}{x}$. So, the probability $P(A)$ that heads will appear $x$ times is - $P(A)=\frac...
First thing is to note that any two heads two tails flip (e.g. HHTT, HTTH) because of independence of flips has probability of $\frac{1}{2^4}$ of happening. Now all we must do is count how many of these type of events there are. Well if we want 2 out of the 4 flips to be heads (thus other two must be tails), which is $...
42,273
Bit of a long one, I know. I know that they are linked in their meanings, but I don't know when to use each one. Also, there are two types of そう, such as 大雪が降りそう and 大雪が降るそう What are the differences? Also, I hear that みたい is almost exactly the same as よう, but is more informal. Is this correct? I appreciate your he...
2017/01/05
[ "https://japanese.stackexchange.com/questions/42273", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/19109/" ]
This is a typical example of contrastive-*wa* added for emphasis. Here, contrast is established between: * 私は至らぬ身であると承知している → I may not be the right person to be involved * 連絡を頂きたい → I want to get involved So this *wa* effectively turns "although I understand" to "**even** though I understand" or "although I **do** u...
1) "まだまだ至らぬ身であると重々承知してはおりますが、・・・" 2) "まだまだ至らぬ身であると重々承知しておりますが、・・・" Both sentences are interchangeable. If you really recongnize that you are not qualified for the job. You have two options. One is to give up for the job. The other is to keep working so that you can get the job. If you choose second option, it's tac...
1,475,953
I've recently written a Windows service and installed it on the production system. After some applied Windows updates, the server had to be rebooted and my service did not load correctly, although it was set to start automatically. The service started fine manually after we were noticed of the failure by customers. Aft...
2009/09/25
[ "https://Stackoverflow.com/questions/1475953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/86143/" ]
How would a tool know which services you need? By analyzing the source code? By running your service until the service fails? The only way to make this work is to know the services on which you depend and add them to the registry when you install your service. I'm not saying that it would be impossible to automate th...
Services and their dependencies are described in the Registry under HKLM/System/CurrentControlSet/Services/xxx where xxx is the name of a service. There are hundreds of services and only some of them are visible in the Services.msc console. In the services console, you can bring up the property window for a service and...
45,829,632
So I have spent a lot of time trying to figure this out but nothing works. I have divs, and I want to have 3 in each row, but centered. I have tried selecting the 4th div and putting it onto a new line, but that doesn't work. I tried to read the guide, but don't quite understand it. If someone can help me out and expl...
2017/08/23
[ "https://Stackoverflow.com/questions/45829632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6913879/" ]
You only need to change 2 properties and add 2 to make that work. If you change to `justify-content: space-around;` in the `.portfolio-col` rule, and add `margin: 0 auto; max-width: 850px;`, you'll get 3 columns in a row, always centered on bigger screens. ``` .portfolio-col { display: flex; justify-content: spac...
Here's my working [jsFiddle](https://jsfiddle.net/beljems/mxxg93oe/) :) ```css *{ box-sizing: border-box; } .port-folio h2{ text-align: center; } .portfolio-col { text-align: center; overflow: hidden; padding: 5px; clear: both; } .port-folio ul{ list-style: none; padding: 0; margin: 25px 0 0;...
45,829,632
So I have spent a lot of time trying to figure this out but nothing works. I have divs, and I want to have 3 in each row, but centered. I have tried selecting the 4th div and putting it onto a new line, but that doesn't work. I tried to read the guide, but don't quite understand it. If someone can help me out and expl...
2017/08/23
[ "https://Stackoverflow.com/questions/45829632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6913879/" ]
You only need to change 2 properties and add 2 to make that work. If you change to `justify-content: space-around;` in the `.portfolio-col` rule, and add `margin: 0 auto; max-width: 850px;`, you'll get 3 columns in a row, always centered on bigger screens. ``` .portfolio-col { display: flex; justify-content: spac...
``` h2 { text-align: center; } .col li { list-style-type: none; } .portfolio-col { display: flex; flex-wrap: wrap; } .col { align-items: center; box-sizing: border-box; display: flex; flex: 1 0 28%; flex-direction: column; ...
23,659,531
I have custom Entity that i want to put as Json to my view page But when i serialize it in map using ObjectMapper from Jackson i receive String created from toString() method ``` @Test public void test() throws JsonProcessingException { Map<ProductEntity, Integer> map = new HashMap<ProductEntity, Integer>(); ...
2014/05/14
[ "https://Stackoverflow.com/questions/23659531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3245504/" ]
`LIMIT` is intended to limit the number of rows you'll get from your query. I suggest you use the `COUNT` function as follows : ``` SELECT id, CASE WHEN COUNT(*) < 6 then COUNT(*) ELSE '5+' END as 'hits' FROM tbhits GROUP BY id ``` More details about selecting the minimum of two numbers [here](https://stackoverflo...
Try with this? ``` SELECT id,COUNT(*) as 'hits' FROM tbhits GROUP BY id HAVING hits >= 5 ```
23,659,531
I have custom Entity that i want to put as Json to my view page But when i serialize it in map using ObjectMapper from Jackson i receive String created from toString() method ``` @Test public void test() throws JsonProcessingException { Map<ProductEntity, Integer> map = new HashMap<ProductEntity, Integer>(); ...
2014/05/14
[ "https://Stackoverflow.com/questions/23659531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3245504/" ]
`LIMIT` is intended to limit the number of rows you'll get from your query. I suggest you use the `COUNT` function as follows : ``` SELECT id, CASE WHEN COUNT(*) < 6 then COUNT(*) ELSE '5+' END as 'hits' FROM tbhits GROUP BY id ``` More details about selecting the minimum of two numbers [here](https://stackoverflo...
LIMIT on GROUP BY clause won't actually limit the counts, it will limit the rows being outputed. Try using `if` statement to compare count result, ``` SELECT id,if(COUNT(*)>5,'5+',COUNT(*)) as 'hits' FROM tbhits GROUP BY id ``` O/p: ``` id | hits -------------------- 101 | 5+ 102 | ...
23,659,531
I have custom Entity that i want to put as Json to my view page But when i serialize it in map using ObjectMapper from Jackson i receive String created from toString() method ``` @Test public void test() throws JsonProcessingException { Map<ProductEntity, Integer> map = new HashMap<ProductEntity, Integer>(); ...
2014/05/14
[ "https://Stackoverflow.com/questions/23659531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3245504/" ]
`LIMIT` is intended to limit the number of rows you'll get from your query. I suggest you use the `COUNT` function as follows : ``` SELECT id, CASE WHEN COUNT(*) < 6 then COUNT(*) ELSE '5+' END as 'hits' FROM tbhits GROUP BY id ``` More details about selecting the minimum of two numbers [here](https://stackoverflo...
As was already said LIMIT applies last in this case, thus after the grouping. What you want to do is modify the value that is selected once the grouping is done. This will appropriately output "5+" if you have more than 5 records for your table. ``` SELECT id, IF(COUNT(*)>5,"5+",COUNT(*)) AS 'count' FROM Whatever ...
23,659,531
I have custom Entity that i want to put as Json to my view page But when i serialize it in map using ObjectMapper from Jackson i receive String created from toString() method ``` @Test public void test() throws JsonProcessingException { Map<ProductEntity, Integer> map = new HashMap<ProductEntity, Integer>(); ...
2014/05/14
[ "https://Stackoverflow.com/questions/23659531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3245504/" ]
LIMIT on GROUP BY clause won't actually limit the counts, it will limit the rows being outputed. Try using `if` statement to compare count result, ``` SELECT id,if(COUNT(*)>5,'5+',COUNT(*)) as 'hits' FROM tbhits GROUP BY id ``` O/p: ``` id | hits -------------------- 101 | 5+ 102 | ...
Try with this? ``` SELECT id,COUNT(*) as 'hits' FROM tbhits GROUP BY id HAVING hits >= 5 ```
23,659,531
I have custom Entity that i want to put as Json to my view page But when i serialize it in map using ObjectMapper from Jackson i receive String created from toString() method ``` @Test public void test() throws JsonProcessingException { Map<ProductEntity, Integer> map = new HashMap<ProductEntity, Integer>(); ...
2014/05/14
[ "https://Stackoverflow.com/questions/23659531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3245504/" ]
LIMIT on GROUP BY clause won't actually limit the counts, it will limit the rows being outputed. Try using `if` statement to compare count result, ``` SELECT id,if(COUNT(*)>5,'5+',COUNT(*)) as 'hits' FROM tbhits GROUP BY id ``` O/p: ``` id | hits -------------------- 101 | 5+ 102 | ...
As was already said LIMIT applies last in this case, thus after the grouping. What you want to do is modify the value that is selected once the grouping is done. This will appropriately output "5+" if you have more than 5 records for your table. ``` SELECT id, IF(COUNT(*)>5,"5+",COUNT(*)) AS 'count' FROM Whatever ...
67,725,799
Why the output of following code is **4** and not tuple **(4,)** ? ``` tup = (1, 2, 4, 8) tup = tup[-2:-1] tup = tup[-1] print(tup) ``` output ``` 4 ```
2021/05/27
[ "https://Stackoverflow.com/questions/67725799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11310640/" ]
When you called `tup[-1]` you accessed a specific element at index `-1`. On the other hand, when you called `tup[-2:-1]` you **sliced** the tuple, resulting in a tuple.
You are selecting **one** element from a tuple, so it gives you that specific element (an `int`, in this case).
5,339,990
I want to create a gui, if it means implementing the code, where do I implement the code? And how to run the qtdesigener?
2011/03/17
[ "https://Stackoverflow.com/questions/5339990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/659960/" ]
You can use Qt Designer, or Qt Creator which is a full developement environment (IDE) not just a GUI designer. Visit this site <http://qt.nokia.com/products/developer-tools> Each window or widget in Qt generally is defined in 3 files: some\_name.ui - this file is generated by Qt Designer or Qt creator. some\_name....
The following tutorial shows a hello world in qt creator: <http://www.youtube.com/watch?v=QLT7oEt6gLE> I hope this is what you were looking for.
22,569,028
I am trying to open the Direct3D Tutorial Win32 Samples with VS 2013 Express for Windows Desktop. To my surprise it claims that the individuals projects in the solution each cannot be opened because their project types (.vcxproj) are not supported by this version of the application. Does anyone know why the vcxproj fi...
2014/03/21
[ "https://Stackoverflow.com/questions/22569028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
To do a major upgrade it might be better to use the majorupgrade element to make sure that you've included everything required. That's assuming you want a major upgrade, and I can't tell. You are misunderstanding something. You (in WiX) use the majorupgrade element when you have a new version of your product that wil...
What GUI are you including? See an online tutorial here: <http://wix.tramontana.co.hu/tutorial/user-interface/ui-wizardry> Are you setting the [ARPNOREPAIR property](http://wix.tramontana.co.hu/tutorial/com-expression-syntax-miscellanea/add-or-remove-programs-entries)? Check in the registry at the following location (...
2,589,069
I have the following code: ``` var table = $('.photogalleryTable').before('<ul class="photogallery"></ul>') table.find('td a').wrap('<li>').parent().appendTo('ul.photogallery'); table.remove(); ``` This code finds a table with a list of photos and re-codes it to use a unordered list instead. The script works perfect...
2010/04/06
[ "https://Stackoverflow.com/questions/2589069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1207537/" ]
Try this: ``` $('.photogalleryTable').each(function(i){ $(this) .before('<ul class="photogallery"></ul>') .find('td a').wrap('<li>').parent().appendTo('ul.photogallery:eq('+i+')'); }).remove(); ```
I think this should help: <http://api.jquery.com/each/> I don't know enough to tell you exactly how to implement it, but I'm pretty sure using that function should get you the result you want. *EDIT* Maybe try ``` var table = $('.photogalleryTable').before('<ul class="photogallery"></ul>') table.each(function(){fin...
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
You can bypass all the list operations with slicing: ``` S = S[:1] + S[2:] ``` or more generally ``` S = S[:Index] + S[Index + 1:] ``` Many answers to your question (including ones like this) can be found here: [How to delete a character from a string using python?](https://stackoverflow.com/q/3559559/2988730). H...
Slicing is the best and easiest approach I can think of, here are some other alternatives: ``` >>> s = 'abcd' >>> def remove(s, indx): return ''.join(x for x in s if s.index(x) != indx) >>> remove(s, 1) 'acd' >>> >>> >>> def remove(s, indx): return ''.join(filter(lambda x: s.index(x) != 1, s)) >>> ...
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
You can bypass all the list operations with slicing: ``` S = S[:1] + S[2:] ``` or more generally ``` S = S[:Index] + S[Index + 1:] ``` Many answers to your question (including ones like this) can be found here: [How to delete a character from a string using python?](https://stackoverflow.com/q/3559559/2988730). H...
You can replace the Index character with "". ``` str = "ab1cd1ef" Index = 3 print(str.replace(str[Index],"",1)) ```
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
You can bypass all the list operations with slicing: ``` S = S[:1] + S[2:] ``` or more generally ``` S = S[:Index] + S[Index + 1:] ``` Many answers to your question (including ones like this) can be found here: [How to delete a character from a string using python?](https://stackoverflow.com/q/3559559/2988730). H...
``` def missing_char(str, n): n = abs(n) front = str[:n] # up to but not including n back = str[n+1:] # n+1 through end of string return front + back ```
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
You can bypass all the list operations with slicing: ``` S = S[:1] + S[2:] ``` or more generally ``` S = S[:Index] + S[Index + 1:] ``` Many answers to your question (including ones like this) can be found here: [How to delete a character from a string using python?](https://stackoverflow.com/q/3559559/2988730). H...
``` S = "abcd" Index=1 #index of string to remove S = S.replace(S[Index], "") print(S) ``` I hope it helps!
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
Slicing is the best and easiest approach I can think of, here are some other alternatives: ``` >>> s = 'abcd' >>> def remove(s, indx): return ''.join(x for x in s if s.index(x) != indx) >>> remove(s, 1) 'acd' >>> >>> >>> def remove(s, indx): return ''.join(filter(lambda x: s.index(x) != 1, s)) >>> ...
``` def missing_char(str, n): n = abs(n) front = str[:n] # up to but not including n back = str[n+1:] # n+1 through end of string return front + back ```
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
Slicing is the best and easiest approach I can think of, here are some other alternatives: ``` >>> s = 'abcd' >>> def remove(s, indx): return ''.join(x for x in s if s.index(x) != indx) >>> remove(s, 1) 'acd' >>> >>> >>> def remove(s, indx): return ''.join(filter(lambda x: s.index(x) != 1, s)) >>> ...
``` S = "abcd" Index=1 #index of string to remove S = S.replace(S[Index], "") print(S) ``` I hope it helps!
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
You can replace the Index character with "". ``` str = "ab1cd1ef" Index = 3 print(str.replace(str[Index],"",1)) ```
``` def missing_char(str, n): n = abs(n) front = str[:n] # up to but not including n back = str[n+1:] # n+1 through end of string return front + back ```
38,066,847
I have FragmentX in a ViewPager. FragmentX has EditText's in it and a Button. The user presses the Button and FragmentY replaces FragmentX. The user then presses back and FragmentX has lost all of its input from the user. How do you either: a) Save the data in FragmentX before FragmentY appears then FragmentY is repl...
2016/06/28
[ "https://Stackoverflow.com/questions/38066847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4427540/" ]
You can replace the Index character with "". ``` str = "ab1cd1ef" Index = 3 print(str.replace(str[Index],"",1)) ```
``` S = "abcd" Index=1 #index of string to remove S = S.replace(S[Index], "") print(S) ``` I hope it helps!
11,727,701
I'm using the LingPy 1.0.1 library for Python 2.7, attempting to conduct Cognate Analysis on a single tab-delimited list of Spanish-English words I created. The list is named SE.lxs and looks like this: ``` ID Words Spanish 1 dog pero 2 cat gato 3 water agua 4 table meza 5 hand mano 6 red...
2012/07/30
[ "https://Stackoverflow.com/questions/11727701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372526/" ]
Actually, the get\_file (blame my bad documentation on this) is a simple shortcut function which helps me to get access to some test modules residing in the text folder. So if you want to make an analysis on some languages, you do not need the get\_file argument. Just make sure that the lxs-file is in the folder from w...
Wooble was right-- apparently the location of the .lxs file must be in both of the following directories (for Python 2.7) ``` C:\Python27\Lib\site-packages\lingpy-1.0.1-py2.7-win32.egg\lingpy\test\tests C:\Python27\Lib\lingpy-1.0.1\lingpy\test\tests ```
56,324,218
I am attempting to wrap every 20 chars in a new div container. I keep getting undefined I assume from the array results that do not exist yet. How can I wrap every 20 chars as the user types and reaches char 20, 40, 60,and 80 and place it into a div container with the max allowed chars being 80, and is there a better w...
2019/05/27
[ "https://Stackoverflow.com/questions/56324218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8616823/" ]
Here's the source code for [`socket.accept()`](https://github.com/python/cpython/blob/master/Lib/socket.py#L205-L219). Honestly, this looks like a mistake on the `socket` class, they've hardcoded it to create a new instance of `socket`: ``` sock = socket(self.family, self.type, self.proto, fileno=fd) ``` When it pr...
So you want something like the equivalent of a *copy constructor*. Although there are some things that indicate an *XY Problem*, there's a simple alternative (If I got things right). According to [[Python 3.Docs]: socket.**socket**(*family=AF\_INET, type=SOCK\_STREAM, proto=0, fileno=None)*](https://docs.python.org/3...
15,797,611
This may come as a huge surprise to some people but I am having an issue with the IE browser when I am using the `$(window).scroll` method. My goal: I would like to have the menu located on the left retain it's position until the scroll reaches > y value. It will then fix itself to the top of the page until the scrol...
2013/04/03
[ "https://Stackoverflow.com/questions/15797611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2137928/" ]
Instead of setting the top distance at each scroll event, please consider only switching between a fixed position and an absolute or relative position.All browsers will appreciate and Especially IE. So you still listen to scroll but you now keep a state flag out of the scroll handler and simply evaluate if it has to s...
I can get flickers in Chrome as well if I scroll very quickly. Instead of updating the top position on scroll, instead used the `fixed` position for your element once the page has scrolled below the threshold. Take a look at the updated fiddle: <http://jsfiddle.net/nLK7j/2/>
15,797,611
This may come as a huge surprise to some people but I am having an issue with the IE browser when I am using the `$(window).scroll` method. My goal: I would like to have the menu located on the left retain it's position until the scroll reaches > y value. It will then fix itself to the top of the page until the scrol...
2013/04/03
[ "https://Stackoverflow.com/questions/15797611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2137928/" ]
You might want to take a look at the [jQuery Waypoints](http://imakewebthings.com/jquery-waypoints/) plugin, it lets you do [sticky elements](http://imakewebthings.com/jquery-waypoints/shortcuts/sticky-elements/) like this and a lot more. If you want to stick with your current method, like the other answers have indic...
I can get flickers in Chrome as well if I scroll very quickly. Instead of updating the top position on scroll, instead used the `fixed` position for your element once the page has scrolled below the threshold. Take a look at the updated fiddle: <http://jsfiddle.net/nLK7j/2/>
15,797,611
This may come as a huge surprise to some people but I am having an issue with the IE browser when I am using the `$(window).scroll` method. My goal: I would like to have the menu located on the left retain it's position until the scroll reaches > y value. It will then fix itself to the top of the page until the scrol...
2013/04/03
[ "https://Stackoverflow.com/questions/15797611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2137928/" ]
You might want to take a look at the [jQuery Waypoints](http://imakewebthings.com/jquery-waypoints/) plugin, it lets you do [sticky elements](http://imakewebthings.com/jquery-waypoints/shortcuts/sticky-elements/) like this and a lot more. If you want to stick with your current method, like the other answers have indic...
Instead of setting the top distance at each scroll event, please consider only switching between a fixed position and an absolute or relative position.All browsers will appreciate and Especially IE. So you still listen to scroll but you now keep a state flag out of the scroll handler and simply evaluate if it has to s...
59,519,688
I use [windows](/questions/tagged/windows "show questions tagged 'windows'") and [python](/questions/tagged/python "show questions tagged 'python'") v3.8.1. I am trying to [install](/questions/tagged/install "show questions tagged 'install'") [pyinstaller](/questions/tagged/pyinstaller "show questions tagged 'pyinstall...
2019/12/29
[ "https://Stackoverflow.com/questions/59519688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try ``` python3 -m pip install stdlib_list --user ``` Otherwise try to uninstall and reinstall PIP
Try installing using the following command `python3 -m pip install <library_name_here> --user`
59,519,688
I use [windows](/questions/tagged/windows "show questions tagged 'windows'") and [python](/questions/tagged/python "show questions tagged 'python'") v3.8.1. I am trying to [install](/questions/tagged/install "show questions tagged 'install'") [pyinstaller](/questions/tagged/pyinstaller "show questions tagged 'pyinstall...
2019/12/29
[ "https://Stackoverflow.com/questions/59519688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Try ``` python3 -m pip install stdlib_list --user ``` Otherwise try to uninstall and reinstall PIP
Check this, using: pip list * There is a setuptools module installed. If not: py -m pip install setuptools I remember latest version is 44.0 Then try to install, using: py -m pip install PyInstaller ``` Latest version is 3.5 ``` > > Anyway, [PyInstaller](https://www.pyinstaller.org/) doesn't support Python 3.8....
42,358,259
I have a tsv file which includes some newline data. ``` 111 222 333 "aaa" 444 555 666 "bb b" ``` Here `b` on the third line is a newline character of `bb` on the second line, so they are one data: The fourth value of first line: ``` aaa ``` The fourth value of second line: ``` bb b ``` If I use Ctrl+C and Ctr...
2017/02/21
[ "https://Stackoverflow.com/questions/42358259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6785635/" ]
Just use the [csv module](https://docs.python.org/3/library/csv.html). It knows about all the possible corner cases in CSV files like new lines in quoted fields. And it can delimit on tabs. ``` with open("file.tsv") as fd: rd = csv.reader(fd, delimiter="\t", quotechar='"') for row in rd: print(row) ``...
Newline characters, when within the content (cell) of your .tsv/.csv, is usually enclosed in quotes. If not, standard parses might confuse it as the start of the next row. In your case, the line ``` for line in open(file.tsv) ``` automatically uses newline character as a separator. If you are sure that the file o...
42,358,259
I have a tsv file which includes some newline data. ``` 111 222 333 "aaa" 444 555 666 "bb b" ``` Here `b` on the third line is a newline character of `bb` on the second line, so they are one data: The fourth value of first line: ``` aaa ``` The fourth value of second line: ``` bb b ``` If I use Ctrl+C and Ctr...
2017/02/21
[ "https://Stackoverflow.com/questions/42358259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6785635/" ]
``` import pandas as pd data = pd.read_csv ("file.tsv", sep = '\t') ```
Newline characters, when within the content (cell) of your .tsv/.csv, is usually enclosed in quotes. If not, standard parses might confuse it as the start of the next row. In your case, the line ``` for line in open(file.tsv) ``` automatically uses newline character as a separator. If you are sure that the file o...
42,358,259
I have a tsv file which includes some newline data. ``` 111 222 333 "aaa" 444 555 666 "bb b" ``` Here `b` on the third line is a newline character of `bb` on the second line, so they are one data: The fourth value of first line: ``` aaa ``` The fourth value of second line: ``` bb b ``` If I use Ctrl+C and Ctr...
2017/02/21
[ "https://Stackoverflow.com/questions/42358259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6785635/" ]
Just use the [csv module](https://docs.python.org/3/library/csv.html). It knows about all the possible corner cases in CSV files like new lines in quoted fields. And it can delimit on tabs. ``` with open("file.tsv") as fd: rd = csv.reader(fd, delimiter="\t", quotechar='"') for row in rd: print(row) ``...
``` import scipy as sp data = sp.genfromtxt("filename.tsv", delimiter="\t") ```
42,358,259
I have a tsv file which includes some newline data. ``` 111 222 333 "aaa" 444 555 666 "bb b" ``` Here `b` on the third line is a newline character of `bb` on the second line, so they are one data: The fourth value of first line: ``` aaa ``` The fourth value of second line: ``` bb b ``` If I use Ctrl+C and Ctr...
2017/02/21
[ "https://Stackoverflow.com/questions/42358259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6785635/" ]
Just use the [csv module](https://docs.python.org/3/library/csv.html). It knows about all the possible corner cases in CSV files like new lines in quoted fields. And it can delimit on tabs. ``` with open("file.tsv") as fd: rd = csv.reader(fd, delimiter="\t", quotechar='"') for row in rd: print(row) ``...
``` import pandas as pd data = pd.read_csv ("file.tsv", sep = '\t') ```
42,358,259
I have a tsv file which includes some newline data. ``` 111 222 333 "aaa" 444 555 666 "bb b" ``` Here `b` on the third line is a newline character of `bb` on the second line, so they are one data: The fourth value of first line: ``` aaa ``` The fourth value of second line: ``` bb b ``` If I use Ctrl+C and Ctr...
2017/02/21
[ "https://Stackoverflow.com/questions/42358259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6785635/" ]
``` import pandas as pd data = pd.read_csv ("file.tsv", sep = '\t') ```
``` import scipy as sp data = sp.genfromtxt("filename.tsv", delimiter="\t") ```
49,244,897
This is more of a syntactical question than anything. Can't seem to figure out the syntax to write out this proof of concept. I currently have a *RoR / psql* database that users can sign up for and log in to. A few forms are restricted for admins (user accounts are not admins by default). The actual tab in the naviga...
2018/03/12
[ "https://Stackoverflow.com/questions/49244897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9387445/" ]
Conceptually the best way to handle this is to not do it in the view at all. Instead you should handle the authorization logic in the controller and use a `before_action` filter to redirect the user to the login or somewhere else that makes sense for your application. This avoids duplicating the authorization logic ...
Just remove `=` from your `<% %>` blocks that have logic such as `if` and `else`. Only use `<%= %>` blocks for a self-contained variable or function call that returns a value by itself. ``` <html> <head></head> <body> <% if current_user.admin? %> <div class="container"> <!-- form content --> ...
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
There are some tricks that you can try, listed below. The layouting itself is performed by GraphViz (dot layouting iirc), and GraphViz simply does this sometimes. Graph layouting is a NP-complete problem, so algorithms usually take harsh shortcuts. Typical workarounds that I've seen or used include: * adding hidden l...
If anyone wants to know a more specific, put probably much more useless answer, here is what I did in the end. ``` order -down- publisher publisher -[hidden]up- order ``` so for some reason adding the duplicated command both ways solves it.
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
There are some tricks that you can try, listed below. The layouting itself is performed by GraphViz (dot layouting iirc), and GraphViz simply does this sometimes. Graph layouting is a NP-complete problem, so algorithms usually take harsh shortcuts. Typical workarounds that I've seen or used include: * adding hidden l...
Try the options suggested by @Peter Uhnak along with linetype : ``` skinparam linetype polyline skinparam linetype ortho ``` Give better options for lines. Using ortho - ([Here](http://www.plantuml.com/plantuml/uml/TLJBRiCW4Bpp5QkSqeF_8QtRGwLAYVhu069lR1GC5bvNggh-UrcmmSw34pixExCBsBk1fAEnqs8uAzDB9plGoY3zz0ZMKMk5nXC1M...
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
There are some tricks that you can try, listed below. The layouting itself is performed by GraphViz (dot layouting iirc), and GraphViz simply does this sometimes. Graph layouting is a NP-complete problem, so algorithms usually take harsh shortcuts. Typical workarounds that I've seen or used include: * adding hidden l...
All these good answers are compiled and referenced in the semi-official [Hitchhiker’s Guide to PlantUML](https://crashedmind.github.io/PlantUMLHitchhikersGuide/index.html). See the [Layout section](https://crashedmind.github.io/PlantUMLHitchhikersGuide/layout/layout.html). Not sure how it was 3 years ago, but it's pro...
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
Try the options suggested by @Peter Uhnak along with linetype : ``` skinparam linetype polyline skinparam linetype ortho ``` Give better options for lines. Using ortho - ([Here](http://www.plantuml.com/plantuml/uml/TLJBRiCW4Bpp5QkSqeF_8QtRGwLAYVhu069lR1GC5bvNggh-UrcmmSw34pixExCBsBk1fAEnqs8uAzDB9plGoY3zz0ZMKMk5nXC1M...
If anyone wants to know a more specific, put probably much more useless answer, here is what I did in the end. ``` order -down- publisher publisher -[hidden]up- order ``` so for some reason adding the duplicated command both ways solves it.
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
To make a connection less important in the layout, use `[norank]`, e.g., `a -[norank]-> b`
If anyone wants to know a more specific, put probably much more useless answer, here is what I did in the end. ``` order -down- publisher publisher -[hidden]up- order ``` so for some reason adding the duplicated command both ways solves it.
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
If anyone wants to know a more specific, put probably much more useless answer, here is what I did in the end. ``` order -down- publisher publisher -[hidden]up- order ``` so for some reason adding the duplicated command both ways solves it.
All these good answers are compiled and referenced in the semi-official [Hitchhiker’s Guide to PlantUML](https://crashedmind.github.io/PlantUMLHitchhikersGuide/index.html). See the [Layout section](https://crashedmind.github.io/PlantUMLHitchhikersGuide/layout/layout.html). Not sure how it was 3 years ago, but it's pro...
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
To make a connection less important in the layout, use `[norank]`, e.g., `a -[norank]-> b`
Try the options suggested by @Peter Uhnak along with linetype : ``` skinparam linetype polyline skinparam linetype ortho ``` Give better options for lines. Using ortho - ([Here](http://www.plantuml.com/plantuml/uml/TLJBRiCW4Bpp5QkSqeF_8QtRGwLAYVhu069lR1GC5bvNggh-UrcmmSw34pixExCBsBk1fAEnqs8uAzDB9plGoY3zz0ZMKMk5nXC1M...
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
Try the options suggested by @Peter Uhnak along with linetype : ``` skinparam linetype polyline skinparam linetype ortho ``` Give better options for lines. Using ortho - ([Here](http://www.plantuml.com/plantuml/uml/TLJBRiCW4Bpp5QkSqeF_8QtRGwLAYVhu069lR1GC5bvNggh-UrcmmSw34pixExCBsBk1fAEnqs8uAzDB9plGoY3zz0ZMKMk5nXC1M...
All these good answers are compiled and referenced in the semi-official [Hitchhiker’s Guide to PlantUML](https://crashedmind.github.io/PlantUMLHitchhikersGuide/index.html). See the [Layout section](https://crashedmind.github.io/PlantUMLHitchhikersGuide/layout/layout.html). Not sure how it was 3 years ago, but it's pro...
48,712,801
I created this diagram using the following code. But as you can see, the lines going from (Cancel Order) and (Place Order) to (Publisher) decide to take a terribly rounded path to get their, instead of going straight to the right and then down to publisher. I tried using manual direction commands like "-down" but none ...
2018/02/09
[ "https://Stackoverflow.com/questions/48712801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5679048/" ]
To make a connection less important in the layout, use `[norank]`, e.g., `a -[norank]-> b`
All these good answers are compiled and referenced in the semi-official [Hitchhiker’s Guide to PlantUML](https://crashedmind.github.io/PlantUMLHitchhikersGuide/index.html). See the [Layout section](https://crashedmind.github.io/PlantUMLHitchhikersGuide/layout/layout.html). Not sure how it was 3 years ago, but it's pro...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
> > It is not possible for me to create MyCar objects right away (since out of thousands of Car objects only a few will become MyCar objects), > > > So, you'll have lots of objects of Car type, a few of which you'd like to, at runtime, "promote" to SpecialCar type? Do SpecialCars have exactly the same interface ...
I don't get it. What's wrong with a regular inheritance? ``` class Car { private int attributeOne; ..... private boolean attrbuteThirty; public void methodOne(){...} ... public void methodThirty(){...} } ``` And then just subclass it: ``` class SubCar extends Car { private int extraAt...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
OP here. I understand that this looks like laziness. But I already have it working by manually copying 30 variables in the constructor. Not that big of a task, I know. The thing is, I have been taught to code with style. When I see mindless code blocks that look like copypasta my instincts tell me that there is proba...
I don't get it. What's wrong with a regular inheritance? ``` class Car { private int attributeOne; ..... private boolean attrbuteThirty; public void methodOne(){...} ... public void methodThirty(){...} } ``` And then just subclass it: ``` class SubCar extends Car { private int extraAt...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
You can add a constructor that gets a Car object and copy the values from the Car to the new MyCar.
I don't get it. What's wrong with a regular inheritance? ``` class Car { private int attributeOne; ..... private boolean attrbuteThirty; public void methodOne(){...} ... public void methodThirty(){...} } ``` And then just subclass it: ``` class SubCar extends Car { private int extraAt...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
**Effective Java 2nd Edition, Item 2: Consider a builder when faced with many constructor parameters** > > And neither does creating a > constructor which takes 30 arguments, > or setting 30 arguments through method > calls. > > > If you are facing a constructor with **too many parameters** then you might want...
I don't get it. What's wrong with a regular inheritance? ``` class Car { private int attributeOne; ..... private boolean attrbuteThirty; public void methodOne(){...} ... public void methodThirty(){...} } ``` And then just subclass it: ``` class SubCar extends Car { private int extraAt...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
OP here. I understand that this looks like laziness. But I already have it working by manually copying 30 variables in the constructor. Not that big of a task, I know. The thing is, I have been taught to code with style. When I see mindless code blocks that look like copypasta my instincts tell me that there is proba...
We can create an interface ICar that has all the getters and setters for all the 30 columns. Car can implement ICar and can contain all the 30 fields with their corresponding getters and setters. MyCar can also implement ICar and can use composition. It exposes Car's methods as delegate methods (which can automatically...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
OP here. I understand that this looks like laziness. But I already have it working by manually copying 30 variables in the constructor. Not that big of a task, I know. The thing is, I have been taught to code with style. When I see mindless code blocks that look like copypasta my instincts tell me that there is proba...
I have a feeling that what you are looking for is the notion of a template; e.g. ``` public class Car { private final int attr1; private final int attr2; ... public Car() { super(); } /* copy constructor */ public Car(Car template) { this.attr1 = template.attr1; this.attr2 =...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
**Effective Java 2nd Edition, Item 2: Consider a builder when faced with many constructor parameters** > > And neither does creating a > constructor which takes 30 arguments, > or setting 30 arguments through method > calls. > > > If you are facing a constructor with **too many parameters** then you might want...
> > It is not possible for me to create MyCar objects right away (since out of thousands of Car objects only a few will become MyCar objects), > > > So, you'll have lots of objects of Car type, a few of which you'd like to, at runtime, "promote" to SpecialCar type? Do SpecialCars have exactly the same interface ...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
**Effective Java 2nd Edition, Item 2: Consider a builder when faced with many constructor parameters** > > And neither does creating a > constructor which takes 30 arguments, > or setting 30 arguments through method > calls. > > > If you are facing a constructor with **too many parameters** then you might want...
We can create an interface ICar that has all the getters and setters for all the 30 columns. Car can implement ICar and can contain all the 30 fields with their corresponding getters and setters. MyCar can also implement ICar and can use composition. It exposes Car's methods as delegate methods (which can automatically...
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
**Effective Java 2nd Edition, Item 2: Consider a builder when faced with many constructor parameters** > > And neither does creating a > constructor which takes 30 arguments, > or setting 30 arguments through method > calls. > > > If you are facing a constructor with **too many parameters** then you might want...
You can add a constructor that gets a Car object and copy the values from the Car to the new MyCar.
3,275,757
Let's say I have an object of the class Car, with like 30 variables ranging from top speed to color. I want to make a MyCar object (class MyCar extends Car) that is basically the same thing except it stores some more information. It is not possible for me to create MyCar objects right away (since out of thousands of C...
2010/07/18
[ "https://Stackoverflow.com/questions/3275757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395172/" ]
You can add a constructor that gets a Car object and copy the values from the Car to the new MyCar.
I have a feeling that what you are looking for is the notion of a template; e.g. ``` public class Car { private final int attr1; private final int attr2; ... public Car() { super(); } /* copy constructor */ public Car(Car template) { this.attr1 = template.attr1; this.attr2 =...
36,116,204
I'm learning PHP, just started with the intermediate level. Below is the class hierarchy - ``` FamilyTree | | Grandparents | | Parents ``` `Parents` have an extra property called `$dob` the rest are inherited from `Grandparents` I was able to overload `set_values()` because they differed in the num...
2016/03/20
[ "https://Stackoverflow.com/questions/36116204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/938133/" ]
Sorry to disappoint you, but you were unsuccessful in "overloading" that method. If you take a closer look at your implementation if `__call`: ``` public function __call($function_name, $arguments) { if($function_name == 'set_values' && count($arguments) == 5) { $this->$name = $name; $thi...
For method overloading signature and method name should have to be same. Without these two it would not considered as method overloading. In this case , is is not overloading , but a separate method. You can simply overload by this display\_values($name, $sex, $married, $number\_of\_kids) and set all values
36,116,204
I'm learning PHP, just started with the intermediate level. Below is the class hierarchy - ``` FamilyTree | | Grandparents | | Parents ``` `Parents` have an extra property called `$dob` the rest are inherited from `Grandparents` I was able to overload `set_values()` because they differed in the num...
2016/03/20
[ "https://Stackoverflow.com/questions/36116204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/938133/" ]
Sorry to disappoint you, but you were unsuccessful in "overloading" that method. If you take a closer look at your implementation if `__call`: ``` public function __call($function_name, $arguments) { if($function_name == 'set_values' && count($arguments) == 5) { $this->$name = $name; $thi...
Unless I have misunderstood you, in this instance you are not overrloading set\_values via \_\_call in class parent. To overload, the method must be inaccessible. ``` class Parents extends Grandparents { private $dob; public function __call($function_name, $arguments) { echo 'called'; if($function_name == 's...
4,006,850
**[Edit]** From the feedback/answers I have received, I gather there is some confusion regarding the original question. Consequently, I have reduced the problem to its most rudimentary form Here are the relevant facts of the problem: 1. I have a sorted sequence: **S** 2. I have an item (denoted by ***i***) that is G...
2010/10/24
[ "https://Stackoverflow.com/questions/4006850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197843/" ]
Given your relevant facts: ``` >>> import bisect >>> def find_fwd_iter(S, i): ... j = bisect.bisect_left(S, i) ... for k in xrange(j, len(S)): ... yield S[k] ... >>> def find_bkwd_iter(S, i): ... j = bisect.bisect_left(S, i) ... for k in xrange(j, -1, -1): ... yield S[k] ... >>> L = [10...
You can do ``` def on_or_after(date): from itertools import dropwhile sorted_items = sorted(date_dictionary.iteritems()) def before_date(pair): return pair[0] < date on_or_after_date = dropwhile(before_date, sorted_items) ``` which I think is about as efficient as it's going to get if you're ...
4,006,850
**[Edit]** From the feedback/answers I have received, I gather there is some confusion regarding the original question. Consequently, I have reduced the problem to its most rudimentary form Here are the relevant facts of the problem: 1. I have a sorted sequence: **S** 2. I have an item (denoted by ***i***) that is G...
2010/10/24
[ "https://Stackoverflow.com/questions/4006850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197843/" ]
yes , you can do like this: ``` import itertools from datetime import datetime data = { "2008-11-10 17:53:59":"data", "2005-11-10 17:53:59":"data", } list_ = data.keys() new_list = [datetime.strptime(x, "%Y-%m-%d %H:%M:%S") for x in list_] begin_date = datetime.strptime("2007-11-10 17:53:59", "%Y-%m-%d ...
First off, this question isn't related to dicts. You're operating on a sorted `list`. You're using the *results* on a dict, but that's not relevant to the question. You want the `bisect` module, which implements binary searching. Starting from your code: ``` import bisect mydict = { "2001-01-01":"data1", ...
4,006,850
**[Edit]** From the feedback/answers I have received, I gather there is some confusion regarding the original question. Consequently, I have reduced the problem to its most rudimentary form Here are the relevant facts of the problem: 1. I have a sorted sequence: **S** 2. I have an item (denoted by ***i***) that is G...
2010/10/24
[ "https://Stackoverflow.com/questions/4006850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197843/" ]
Given your relevant facts: ``` >>> import bisect >>> def find_fwd_iter(S, i): ... j = bisect.bisect_left(S, i) ... for k in xrange(j, len(S)): ... yield S[k] ... >>> def find_bkwd_iter(S, i): ... j = bisect.bisect_left(S, i) ... for k in xrange(j, -1, -1): ... yield S[k] ... >>> L = [10...
yes , you can do like this: ``` import itertools from datetime import datetime data = { "2008-11-10 17:53:59":"data", "2005-11-10 17:53:59":"data", } list_ = data.keys() new_list = [datetime.strptime(x, "%Y-%m-%d %H:%M:%S") for x in list_] begin_date = datetime.strptime("2007-11-10 17:53:59", "%Y-%m-%d ...
4,006,850
**[Edit]** From the feedback/answers I have received, I gather there is some confusion regarding the original question. Consequently, I have reduced the problem to its most rudimentary form Here are the relevant facts of the problem: 1. I have a sorted sequence: **S** 2. I have an item (denoted by ***i***) that is G...
2010/10/24
[ "https://Stackoverflow.com/questions/4006850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/197843/" ]
yes , you can do like this: ``` import itertools from datetime import datetime data = { "2008-11-10 17:53:59":"data", "2005-11-10 17:53:59":"data", } list_ = data.keys() new_list = [datetime.strptime(x, "%Y-%m-%d %H:%M:%S") for x in list_] begin_date = datetime.strptime("2007-11-10 17:53:59", "%Y-%m-%d ...
One simpler way (albeit slower) would be to use `filter` and filter for keys before/after that date. Filter has to process each element in the list as opposed to slicing not needing to.