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 |
|---|---|---|---|---|---|
1,735 | The bardic lore skill always left me baffled. I never had clear the terms of such skill. A bard can roll a bard lore throw to know some abstruse information. The fact is that the throw is bound to a specific need or question, and it can very well be that the bard knows nothing about one topic, and a lot of a very relat... | 2010/08/29 | [
"https://rpg.stackexchange.com/questions/1735",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/113/"
] | Original celtic bards were actually historians. All of celtic tradition was oral, so someone had to remeber it and pass it on. The poetry and music were only added to make it easier to remember. We can imagine the D&D Bard as a kind of wandering historian-in-training. He already knows some of the songs/stories, but has... | Bardic lore is a real life skill. Heck, a lot of people possess it. It's just having information about something that given your background, learning, or skill set you generally wouldn't be expected to know. Just being well read and having general knowledge of a host of different skills, professions, situations, histor... |
7,901,373 | Is there a way to tell Python about additional `site-packages` locations without modifying existing scripts?
On my CentOS 5.5 server I have a Python 2.7 installation that is installed in `/opt/python2.7.2` and there is a `site-packages` folder at `/opt/python2.7.2/lib/python2.7/site-packages`.
The reason for this is ... | 2011/10/26 | [
"https://Stackoverflow.com/questions/7901373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/419/"
] | You can use the [Site-specific configuration hook](http://docs.python.org/library/site.html).
>
> "A path configuration file is a file whose name has the form `name.pth` and exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added to `sys.path`."
>
>
>
I... | You could replace the python executable with a wrapper script which appends your added installpath to PYTHONPATH. But this is a kludge.
But I'd try to fix the installation of the add-on so that it properly goes into the site-packages dir. |
73,400,532 | I have two screens. **Approve List** and **Approve Detail**. When data approved in Approve Detail, page navigate to Approve List. Then approved data should disapear from FLatList. How to remove FlatList item when data approved? or how to re render FlatList when data change? Here is my code:
Approve List:
```
const Ap... | 2022/08/18 | [
"https://Stackoverflow.com/questions/73400532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3169003/"
] | Using `sed`, this will change all null values to `BLANK` and strings with consecutive spaces between the values to change the space to `_` after the delimiter `:`
```
$ sed -E ':a;s/^([^ ]*: +)([^ ]*) +/\1\2_/;ta;s/: +?$/: BLANK/' input_file
servername: tesing1001
os: Unix
bu: BLANK
aid: 132
location: anywhere
en... | Maybe this will help you.
I replace all spaces with an \_
After that i replace all ":\_" with ": "
```
foo=${str// /_}
echo $foo
echo ${foo/:_/: }
``` |
73,400,532 | I have two screens. **Approve List** and **Approve Detail**. When data approved in Approve Detail, page navigate to Approve List. Then approved data should disapear from FLatList. How to remove FlatList item when data approved? or how to re render FlatList when data change? Here is my code:
Approve List:
```
const Ap... | 2022/08/18 | [
"https://Stackoverflow.com/questions/73400532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3169003/"
] | Using `sed`, this will change all null values to `BLANK` and strings with consecutive spaces between the values to change the space to `_` after the delimiter `:`
```
$ sed -E ':a;s/^([^ ]*: +)([^ ]*) +/\1\2_/;ta;s/: +?$/: BLANK/' input_file
servername: tesing1001
os: Unix
bu: BLANK
aid: 132
location: anywhere
en... | Using awk (gawk in particular):
```
awk -F ': ' '/^application/ { gsub(" ","_",$2) } /^bu/ { gsub("","BLANK",$2)}1' file
Set the field delimiter to ": " and then where the line starts with "application", use awks, gsub function to replace all instances of " " with "_" in the second field. With lines starting with bu,... |
73,400,532 | I have two screens. **Approve List** and **Approve Detail**. When data approved in Approve Detail, page navigate to Approve List. Then approved data should disapear from FLatList. How to remove FlatList item when data approved? or how to re render FlatList when data change? Here is my code:
Approve List:
```
const Ap... | 2022/08/18 | [
"https://Stackoverflow.com/questions/73400532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3169003/"
] | Using `sed`, this will change all null values to `BLANK` and strings with consecutive spaces between the values to change the space to `_` after the delimiter `:`
```
$ sed -E ':a;s/^([^ ]*: +)([^ ]*) +/\1\2_/;ta;s/: +?$/: BLANK/' input_file
servername: tesing1001
os: Unix
bu: BLANK
aid: 132
location: anywhere
en... | Using **awk** you could set the FS *(Field Separator)* to a colon followed by optional spaces, and the OFS *(Ouput Field Separator)* to `:`
Using a pattern, you could match if the line starts with non whitespace chars followed by `:` and then optional spaces only.
If that is the case, print out the first field with ... |
47,508,179 | When I return base or custom object from `SxcApiController` everything work OK,
but If I try to return:
"`HttpResponseMessage`", Something like:
```
return Request.CreateResponse(HttpStatusCode.BadRequest, new { Message = "ERROR : " + ex.Message } );
```
I get error:
>
> 'System.Net.Http.HttpResponseMessage' is ... | 2017/11/27 | [
"https://Stackoverflow.com/questions/47508179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6334086/"
] | I copy the file:
System.Net.Http.dll
to Bin folder of the site and then also add:
```
using System.Net;
using System.Net.Http;
```
Now stuff work | As the error message stated, you needed to add the requested `dll` to the site. The framework searches the `bin` directory of the site for the necessary references in order to operate correctly.
Also assuming that the controller is derived from `ApiController` you can try the following using a different syntax
```
[H... |
63,129,476 | RDBMS: MariaDB 10.1.44
My database structure is as follows :
```
CREATE TABLE product
(
id int primary key auto_increment,
name varchar(255),
is_pack tinyint(1)
);
CREATE TABLE cart
(
id int primary key auto_increment
);
CREATE TABLE cart_item
(
id int primary key auto_increment,
id_cart int not nul... | 2020/07/28 | [
"https://Stackoverflow.com/questions/63129476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10198980/"
] | Hi there its not the fault of the mat table you are making a table out of the same variable and each row has two way binding for the same variable this will result in the each row will have the same value.
In order to achive what you wanted please take a look at Angular Reactive formarrays.
Here is a pretty good tuto... | It should be `[(ngModel)]="AppRemarks"` since `name= "AppRemarks"` in your Input field |
63,129,476 | RDBMS: MariaDB 10.1.44
My database structure is as follows :
```
CREATE TABLE product
(
id int primary key auto_increment,
name varchar(255),
is_pack tinyint(1)
);
CREATE TABLE cart
(
id int primary key auto_increment
);
CREATE TABLE cart_item
(
id int primary key auto_increment,
id_cart int not nul... | 2020/07/28 | [
"https://Stackoverflow.com/questions/63129476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10198980/"
] | I ran into this as well! Ended up being the `name` attribute throwing things off. `name` is used to uniquely identify the control, so when you apply the same name to each attribute they all share the same identifier/key and get treated as one input.
This should solve your issue (left some code out for brevity):
```
<... | It should be `[(ngModel)]="AppRemarks"` since `name= "AppRemarks"` in your Input field |
33,333,159 | First of all I want to say that I have a website where I want to change the language without reloading the page. That is why I inserted buttons for EN and DE.
```
<button lang="de" class="btn btn-primary btn-sm language" >DE</button>
<button lang="en" class="btn btn-primary btn-sm language" >EN</button>
```
Further... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33333159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5460523/"
] | Yes - every page load will result in a new JavaScript scope. If you need to maintain any state between pages, you'll need to use cookies or keep something appended on to the URL between pages. (Even if using server-side components, a client-side identifier is typically required to keep a session ID for the server to re... | An easy way you could do this on the client side is by using query strings. You can append a query string to the end of a url like this:
```
?lang=en
```
Then in your javascript you can parse out the query string and handle accordingly. While there are good libraries out there for parsing query strings ([like this](... |
33,333,159 | First of all I want to say that I have a website where I want to change the language without reloading the page. That is why I inserted buttons for EN and DE.
```
<button lang="de" class="btn btn-primary btn-sm language" >DE</button>
<button lang="en" class="btn btn-primary btn-sm language" >EN</button>
```
Further... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33333159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5460523/"
] | Yes - every page load will result in a new JavaScript scope. If you need to maintain any state between pages, you'll need to use cookies or keep something appended on to the URL between pages. (Even if using server-side components, a client-side identifier is typically required to keep a session ID for the server to re... | You can disable the buttons to prevent reload page since you don't need to reload this page
```
$('.language').click(function(e){
($('html').toggleClass('de en'));
e.preventDefault();
});
``` |
33,333,159 | First of all I want to say that I have a website where I want to change the language without reloading the page. That is why I inserted buttons for EN and DE.
```
<button lang="de" class="btn btn-primary btn-sm language" >DE</button>
<button lang="en" class="btn btn-primary btn-sm language" >EN</button>
```
Further... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33333159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5460523/"
] | To keep trace of the current locale, the best practice is to set it in the url, this approach allows the user to switch lang when he needs!!
If you're not able to keep the lang on the url you may consider the use of WebStorage...
Try something like this:
```js
var I18nService = (function($, storage) {
var STORAGE_... | An easy way you could do this on the client side is by using query strings. You can append a query string to the end of a url like this:
```
?lang=en
```
Then in your javascript you can parse out the query string and handle accordingly. While there are good libraries out there for parsing query strings ([like this](... |
33,333,159 | First of all I want to say that I have a website where I want to change the language without reloading the page. That is why I inserted buttons for EN and DE.
```
<button lang="de" class="btn btn-primary btn-sm language" >DE</button>
<button lang="en" class="btn btn-primary btn-sm language" >EN</button>
```
Further... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33333159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5460523/"
] | An easy way you could do this on the client side is by using query strings. You can append a query string to the end of a url like this:
```
?lang=en
```
Then in your javascript you can parse out the query string and handle accordingly. While there are good libraries out there for parsing query strings ([like this](... | You can disable the buttons to prevent reload page since you don't need to reload this page
```
$('.language').click(function(e){
($('html').toggleClass('de en'));
e.preventDefault();
});
``` |
33,333,159 | First of all I want to say that I have a website where I want to change the language without reloading the page. That is why I inserted buttons for EN and DE.
```
<button lang="de" class="btn btn-primary btn-sm language" >DE</button>
<button lang="en" class="btn btn-primary btn-sm language" >EN</button>
```
Further... | 2015/10/25 | [
"https://Stackoverflow.com/questions/33333159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5460523/"
] | To keep trace of the current locale, the best practice is to set it in the url, this approach allows the user to switch lang when he needs!!
If you're not able to keep the lang on the url you may consider the use of WebStorage...
Try something like this:
```js
var I18nService = (function($, storage) {
var STORAGE_... | You can disable the buttons to prevent reload page since you don't need to reload this page
```
$('.language').click(function(e){
($('html').toggleClass('de en'));
e.preventDefault();
});
``` |
1,201,467 | To explain a little more, I have a file Sidebar.cs, and I have Sidebar.js, and Sidebar.css.
I would like to be able to make it Sidebar.cs, Sidebar.cs.js, and Sidebar.cs.css, and have the js and css file go "under" (as children of) the Sidebar.cs node in the treeview, just like what happens with .designer files and .as... | 2009/07/29 | [
"https://Stackoverflow.com/questions/1201467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3226/"
] | Open up the project file in a text editor or using the "edit project file" context menu (might be only part of an add-in I have). You can then use the DependentUpon XML tag to get the hierarchy. For example, this is how a Form and it's designer look:
```
<Compile Include="Views\SSWizardForm.cs">
<SubType>Form</SubTy... | I haven't tried this myself, so take this with a pinch of salt, but this is what I infer by looking at projects I have to hand
Open the project file in notepad (or other preferred text editor), and the structure of a project file so it looks like
```
<Compile Include="whatever.cs">
<DependentUpon>whatever.else</Dep... |
128,588 | Whenever I open google voice typing, it plays a rising ding sound, then a falling ding sound when it stops.
This is very annoying to me. I have a rooted stock S5 on Lollipop. I searched for the sound file but couldn't locate it, it may be wrapped up in the apk file.
Is there a way to stop this irritating sound? If I ... | 2015/11/11 | [
"https://android.stackexchange.com/questions/128588",
"https://android.stackexchange.com",
"https://android.stackexchange.com/users/99196/"
] | I have a solution that may be useful ,if not for the OP I hope it will be useful as a reference for shutting the volume of a particular application OFF.
This method will mute all sounds coming from Google App but will not affect the other apps. It works on 4.1 up to Lollipop, but the questioner found that the App Sett... | Automation is my solution.
There are plenty of automation apps, but I use [MacroDroid](https://play.google.com/store/apps/details?id=com.arlosoft.macrodroid), since it is easy to learn (that's why I use it) and the behaviour can be easily customized to get the result you want. Besides,free version allows you to create... |
282,814 | I'm currently working on a science fair project, were I have to power a LED light bulb with potatoes. I can't find any websites that answer my 2 questions. Luckily I was able to find the answers to most of them. So i'll list them below and hopefully you can answer them.
1. How many volts does it take to power a 120 wa... | 2017/01/27 | [
"https://electronics.stackexchange.com/questions/282814",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/137231/"
] | What can you expect from a two potato (in series) battery voltage wise?
[](https://i.stack.imgur.com/1pv44.png)
The voltage depends on how far the metal electrodes are apart in the **electrochemical series**.
By connecting the potatoes **in series**... | 1. Depends on the LED, some are in the thirties.
2. By sticking two different types of metals into a potato, you are able to use the conductive materials and acids in the potato to create a flow of electrons from one metal to the other.
120w? You'd probably need hundreds of potatoes in order to even get it to dimly li... |
198,480 | I am trying to download the Ricci.m file from [this page](https://sites.math.washington.edu/~lee/Ricci/). The instructions say
>
> You'll need to download the source file Ricci.m and save it in a directory accessible to Mathematica...Once you've successfully transferred all the Ricci files to your system, start up M... | 2019/05/16 | [
"https://mathematica.stackexchange.com/questions/198480",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/65635/"
] | >
> Also, how do I know which directory is accessible to Mathematica?
>
>
>
These directories can be listed by evaluating [`$Path`](https://reference.wolfram.com/language/ref/$Path.html).
The standard place to put packages is the directory opened by the command
```
SystemOpen@FileNameJoin[{$UserBaseDirectory, "A... | You have to use the right mousebutton, then choose save-as.
Then open this file, and evaluate it.
You have then all functions defined in the package available to use. Read the
```
(* comments sections; or text between brackets and asterixes as indicated *)
```
to find out how to use these functions. |
7,499,950 | I need to serialize a Transferable object to I can send it over an object data stream but during runtime I get the error java.io.NotSerializableException & I have no idea whats wrong. How do I fix this?
Here's the part of the code that is causing the error
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSyst... | 2011/09/21 | [
"https://Stackoverflow.com/questions/7499950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813852/"
] | It seems that your object have to implements both Transferable and Serializable.
Hope this code helps you
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
//Initialiaze ObjectStreams
FileOutputStream fos = new FileOutputStream("t.tmp");
ObjectOutputStream oos = new ObjectOutputStream(fos);
... | Your concrete class must implement the `Serializable` interface to be able to do so. |
7,499,950 | I need to serialize a Transferable object to I can send it over an object data stream but during runtime I get the error java.io.NotSerializableException & I have no idea whats wrong. How do I fix this?
Here's the part of the code that is causing the error
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSyst... | 2011/09/21 | [
"https://Stackoverflow.com/questions/7499950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813852/"
] | The vest way around this is to parse each data flavor into a serializable object of it's kind i.e. put string clipboard content into a string object | Your concrete class must implement the `Serializable` interface to be able to do so. |
7,499,950 | I need to serialize a Transferable object to I can send it over an object data stream but during runtime I get the error java.io.NotSerializableException & I have no idea whats wrong. How do I fix this?
Here's the part of the code that is causing the error
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSyst... | 2011/09/21 | [
"https://Stackoverflow.com/questions/7499950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813852/"
] | It seems that your object have to implements both Transferable and Serializable.
Hope this code helps you
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
//Initialiaze ObjectStreams
FileOutputStream fos = new FileOutputStream("t.tmp");
ObjectOutputStream oos = new ObjectOutputStream(fos);
... | ```
* Thrown when an instance is required to have a Serializable interface.
* The serialization runtime or the class of the instance can throw
* this exception. The argument should be the name of the class.
```
Hmm. Have you added to your object `implements Serializable` ?
UPD.
Also check that all fields are also... |
7,499,950 | I need to serialize a Transferable object to I can send it over an object data stream but during runtime I get the error java.io.NotSerializableException & I have no idea whats wrong. How do I fix this?
Here's the part of the code that is causing the error
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSyst... | 2011/09/21 | [
"https://Stackoverflow.com/questions/7499950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813852/"
] | The vest way around this is to parse each data flavor into a serializable object of it's kind i.e. put string clipboard content into a string object | ```
* Thrown when an instance is required to have a Serializable interface.
* The serialization runtime or the class of the instance can throw
* this exception. The argument should be the name of the class.
```
Hmm. Have you added to your object `implements Serializable` ?
UPD.
Also check that all fields are also... |
7,499,950 | I need to serialize a Transferable object to I can send it over an object data stream but during runtime I get the error java.io.NotSerializableException & I have no idea whats wrong. How do I fix this?
Here's the part of the code that is causing the error
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSyst... | 2011/09/21 | [
"https://Stackoverflow.com/questions/7499950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813852/"
] | The vest way around this is to parse each data flavor into a serializable object of it's kind i.e. put string clipboard content into a string object | It seems that your object have to implements both Transferable and Serializable.
Hope this code helps you
```
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
//Initialiaze ObjectStreams
FileOutputStream fos = new FileOutputStream("t.tmp");
ObjectOutputStream oos = new ObjectOutputStream(fos);
... |
11,338,827 | ```
NodeList nList2 = doc.getElementsByTagName("dep");
Map<String, List<Map<String, String>>> depMap = new HashMap<String, List<Map<String, String>>>();
for (int temp = 0; temp < nList2.getLength(); temp++) {
Element el = (Element)nList2.item(temp);
String type=el.getAttribute("type");
Node nNode = nList2.item(te... | 2012/07/05 | [
"https://Stackoverflow.com/questions/11338827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1468694/"
] | so instead of creating new list in each iteration you need to get the list from map and `add()` items to that list
Change
```
List<Map<String,String>> flist = new ArrayList<Map<String,String>>();
```
to
```
List<Map<String,String>> flist = depMap.get(type);
if(flist == null){
List<Map<String,String>> flist = new... | Move the initialization of `flist`, `govdepmap` and `depList` outside the for-loop. |
11,338,827 | ```
NodeList nList2 = doc.getElementsByTagName("dep");
Map<String, List<Map<String, String>>> depMap = new HashMap<String, List<Map<String, String>>>();
for (int temp = 0; temp < nList2.getLength(); temp++) {
Element el = (Element)nList2.item(temp);
String type=el.getAttribute("type");
Node nNode = nList2.item(te... | 2012/07/05 | [
"https://Stackoverflow.com/questions/11338827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1468694/"
] | so instead of creating new list in each iteration you need to get the list from map and `add()` items to that list
Change
```
List<Map<String,String>> flist = new ArrayList<Map<String,String>>();
```
to
```
List<Map<String,String>> flist = depMap.get(type);
if(flist == null){
List<Map<String,String>> flist = new... | Just change your code to following code.
```
NodeList nList2 = doc.getElementsByTagName("dep");
Map<String, List<Map<String, String>>> depMap = new HashMap<String, List<Map<String, String>>>();
List<Map<String,String>> flist = null;
for (int temp = 0; temp < nList2.getLength(); temp++) {
Element... |
69,601,473 | I'm having trouble doing my code since I'm learning from scratch I don't have any idea how I'm going to print out a reversed input from my array.
This is what I have so far:
```
import java.util.Scanner;
public class ReverseList {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
... | 2021/10/17 | [
"https://Stackoverflow.com/questions/69601473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17165770/"
] | Dynamic variable name is not recommended, especially in this situation because you are directly taking the user input. But if you really want to implement it, `globals()` is one option:
```py
x = '123'
y = '456'
which = input('What do you want to see?: ') # x
print(globals()[which]) # 123
```
A better and more secu... | `input()` can be used to fetch input from the command line.
```py
name = input("Your Name: ")
print("Hello there, " + name + "!")
``` |
69,601,473 | I'm having trouble doing my code since I'm learning from scratch I don't have any idea how I'm going to print out a reversed input from my array.
This is what I have so far:
```
import java.util.Scanner;
public class ReverseList {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
... | 2021/10/17 | [
"https://Stackoverflow.com/questions/69601473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17165770/"
] | `input()` can be used to fetch input from the command line.
```py
name = input("Your Name: ")
print("Hello there, " + name + "!")
``` | You can make use of the dictionary in python as follows:
```
user_options = {'x': '123', 'y': '456', 'z': '789'}
entered_value = input('Please enter an input?: ') # could be x, y or z depending upon the dictionary
print(user_options[entered_value])
```
This should give you the number depending on if x,y, or z is en... |
69,601,473 | I'm having trouble doing my code since I'm learning from scratch I don't have any idea how I'm going to print out a reversed input from my array.
This is what I have so far:
```
import java.util.Scanner;
public class ReverseList {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
... | 2021/10/17 | [
"https://Stackoverflow.com/questions/69601473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17165770/"
] | `input()` can be used to fetch input from the command line.
```py
name = input("Your Name: ")
print("Hello there, " + name + "!")
``` | You can also use `eval()`,
The `eval()` method parses the expression passed to this method and runs python expression (code) within the program.
```
x = '123'
try:
print(eval(input()))
except NameError:
print("Invalid variable name")
``` |
69,601,473 | I'm having trouble doing my code since I'm learning from scratch I don't have any idea how I'm going to print out a reversed input from my array.
This is what I have so far:
```
import java.util.Scanner;
public class ReverseList {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
... | 2021/10/17 | [
"https://Stackoverflow.com/questions/69601473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17165770/"
] | Dynamic variable name is not recommended, especially in this situation because you are directly taking the user input. But if you really want to implement it, `globals()` is one option:
```py
x = '123'
y = '456'
which = input('What do you want to see?: ') # x
print(globals()[which]) # 123
```
A better and more secu... | You can make use of the dictionary in python as follows:
```
user_options = {'x': '123', 'y': '456', 'z': '789'}
entered_value = input('Please enter an input?: ') # could be x, y or z depending upon the dictionary
print(user_options[entered_value])
```
This should give you the number depending on if x,y, or z is en... |
69,601,473 | I'm having trouble doing my code since I'm learning from scratch I don't have any idea how I'm going to print out a reversed input from my array.
This is what I have so far:
```
import java.util.Scanner;
public class ReverseList {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
... | 2021/10/17 | [
"https://Stackoverflow.com/questions/69601473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17165770/"
] | Dynamic variable name is not recommended, especially in this situation because you are directly taking the user input. But if you really want to implement it, `globals()` is one option:
```py
x = '123'
y = '456'
which = input('What do you want to see?: ') # x
print(globals()[which]) # 123
```
A better and more secu... | You can also use `eval()`,
The `eval()` method parses the expression passed to this method and runs python expression (code) within the program.
```
x = '123'
try:
print(eval(input()))
except NameError:
print("Invalid variable name")
``` |
3,369,802 | I would like to ask if someone could help me with the following equation.
\begin{equation}
x^4+ax^3+(a+b)x^2+2bx+b=0
\end{equation}
Could you first solve in general then $a=11$ and $b=28$.
I get it to this form but I stuck.
\begin{equation}
1+a\left(\frac{1}{x}+\frac{1}{x^2}\right)+b\left(\frac{1}{x^2}+\frac{1}{x^3}+\f... | 2019/09/25 | [
"https://math.stackexchange.com/questions/3369802",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | The polynomial equation for $(a, b)=(11,28)$ is given by
$$
x^4+11x^3+39x^2+56x+28=(x^2 + 7x + 7)(x + 2)^2=0.
$$
"How do we come up wit this layout"? By the rational root test, we find the factor $x-2$ twice, and dividing gives the factor $x^2+7x+7$. Hence the roots are $x=-2,-2,\frac{\sqrt{21}-7}{2},\frac{-\sqrt{21}-7... | You are almost there !
$$1+a\left(\frac{1}{x}+\frac{1}{x^2}\right)+b\left(\frac{1}{x^2}+\frac{1}{x^3}+\frac{1}{x^3}+\frac{1}{x^4}\right) = 0$$
$$1+a\left(\frac{x+1}{x^2}\right)+b\left(\frac{x+1}{x^3}+\frac{x+1}{x^4}\right) = 0$$
$$1+a\left(\frac{x+1}{x^2}\right)+b\left(\frac{x+1}{x^2}\right)^2 = 0$$ |
12,212,139 | I have to implement java based call routing engine which route calls based on the phone number prefix to the appropriate gateway.
Here my table (postgres) containing the prefixes:
```
CREATE TABLE call_routing (
prefix character varying(20) PRIMARY KEY NOT NULL,
carrier character varying(50) NOT NULL,
dialstri... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12212139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905640/"
] | I'd personally cache the table, but you could get the best matching prefix by ordering by length (`number` is what you're searching for):
```
SELECT dialstring FROM call_routing WHERE strpos(number, prefix) = 1 ORDER BY length(prefix) DESC LIMIT 1;
``` | I am wondering about this. It seems like the biggest problem is the fact that you have catchalls (gw1 in your example).
```
SELECT dialstring from call_routing where number like prefix || '%'
ORDER BY length(prefix) DESC
LIMIT 1
```
Indexing this will be hard, but I guess the first question is, how many call prefixe... |
12,212,139 | I have to implement java based call routing engine which route calls based on the phone number prefix to the appropriate gateway.
Here my table (postgres) containing the prefixes:
```
CREATE TABLE call_routing (
prefix character varying(20) PRIMARY KEY NOT NULL,
carrier character varying(50) NOT NULL,
dialstri... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12212139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905640/"
] | **Get a better indexing**
By ordering directly on prefix, not length(prefix):
```
SELECT dialstring FROM call_routing
WHERE number like prefix || '%'
ORDER BY prefix DESC
LIMIT 1
```
Why?
Because the selected rows for a number `abcdef` will be prefixes. So will be numbers like:
a
ab
abc
abcd
So if you order them... | I'd personally cache the table, but you could get the best matching prefix by ordering by length (`number` is what you're searching for):
```
SELECT dialstring FROM call_routing WHERE strpos(number, prefix) = 1 ORDER BY length(prefix) DESC LIMIT 1;
``` |
12,212,139 | I have to implement java based call routing engine which route calls based on the phone number prefix to the appropriate gateway.
Here my table (postgres) containing the prefixes:
```
CREATE TABLE call_routing (
prefix character varying(20) PRIMARY KEY NOT NULL,
carrier character varying(50) NOT NULL,
dialstri... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12212139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905640/"
] | I'd personally cache the table, but you could get the best matching prefix by ordering by length (`number` is what you're searching for):
```
SELECT dialstring FROM call_routing WHERE strpos(number, prefix) = 1 ORDER BY length(prefix) DESC LIMIT 1;
``` | You may also look at this PostgreSQL module on github that is specifically meant to provide fast prefix matching for phone numbers:
<https://github.com/dimitri/prefix> |
12,212,139 | I have to implement java based call routing engine which route calls based on the phone number prefix to the appropriate gateway.
Here my table (postgres) containing the prefixes:
```
CREATE TABLE call_routing (
prefix character varying(20) PRIMARY KEY NOT NULL,
carrier character varying(50) NOT NULL,
dialstri... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12212139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905640/"
] | **Get a better indexing**
By ordering directly on prefix, not length(prefix):
```
SELECT dialstring FROM call_routing
WHERE number like prefix || '%'
ORDER BY prefix DESC
LIMIT 1
```
Why?
Because the selected rows for a number `abcdef` will be prefixes. So will be numbers like:
a
ab
abc
abcd
So if you order them... | I am wondering about this. It seems like the biggest problem is the fact that you have catchalls (gw1 in your example).
```
SELECT dialstring from call_routing where number like prefix || '%'
ORDER BY length(prefix) DESC
LIMIT 1
```
Indexing this will be hard, but I guess the first question is, how many call prefixe... |
12,212,139 | I have to implement java based call routing engine which route calls based on the phone number prefix to the appropriate gateway.
Here my table (postgres) containing the prefixes:
```
CREATE TABLE call_routing (
prefix character varying(20) PRIMARY KEY NOT NULL,
carrier character varying(50) NOT NULL,
dialstri... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12212139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905640/"
] | **Get a better indexing**
By ordering directly on prefix, not length(prefix):
```
SELECT dialstring FROM call_routing
WHERE number like prefix || '%'
ORDER BY prefix DESC
LIMIT 1
```
Why?
Because the selected rows for a number `abcdef` will be prefixes. So will be numbers like:
a
ab
abc
abcd
So if you order them... | You may also look at this PostgreSQL module on github that is specifically meant to provide fast prefix matching for phone numbers:
<https://github.com/dimitri/prefix> |
12,835,677 | Suppose I have a method like this
```
Calculator calc;
public void testMethod(){
-----
----
Calc.add(1,2);
-----
-------
}
```
Now I want print Calculator.add at the end of the function, i.e i want to print the classname.printname at the end of the function. The printing should be generic enough that I can use the s... | 2012/10/11 | [
"https://Stackoverflow.com/questions/12835677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650521/"
] | ```
private static final int CLIENT_CODE_STACK_INDEX;
static {
// Finds out the index of "this code" in the returned stack trace - funny but it differs in JDK 1.5 and 1.6
int i = 0;
for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
i++;
if (ste.getClassName().equals(Res... | user Calculator.getClass().getName());for finding name of class and Calculator.getMethod();
or use System.out.println( "I was called by " + e.getStackTrace()[1].getClassName() +
"." +
e.getStackTrace()[1].getMethodName() +
"()!" ); |
12,835,677 | Suppose I have a method like this
```
Calculator calc;
public void testMethod(){
-----
----
Calc.add(1,2);
-----
-------
}
```
Now I want print Calculator.add at the end of the function, i.e i want to print the classname.printname at the end of the function. The printing should be generic enough that I can use the s... | 2012/10/11 | [
"https://Stackoverflow.com/questions/12835677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/650521/"
] | As the very simplest approach, remember you can always call `this.getClass().getName()`:
```
class SimpleCalculator {
public int add(int a, int b) {
System.out.println(this.getClass().getName() +
" - adding " + a + " and " + b);
return a + b;
}
}
```
---
Another common appro... | user Calculator.getClass().getName());for finding name of class and Calculator.getMethod();
or use System.out.println( "I was called by " + e.getStackTrace()[1].getClassName() +
"." +
e.getStackTrace()[1].getMethodName() +
"()!" ); |
2,917,973 | There is already a [question](https://math.stackexchange.com/questions/724556/abbotts-exercise-6-2-14-convergent-subsequences-for-bounded-sequences-of-fu) regarding exercise 6.2.14 from Stephen Abbott's Understanding Analysis in this site. But it does not answer my question. The Question is posed below, and my question... | 2018/09/15 | [
"https://math.stackexchange.com/questions/2917973",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/79342/"
] | First to prove that the polynomial is irreducible you can use the Eisenstein criterion for $p=2$.
For the second part you can notice that the roots are $\pm\sqrt{2\pm\sqrt{2}}$. To prove that the $\mathbb{Q}(\alpha)$ is the splitting field you can use the fact that $\pm \frac{\sqrt{2}}{\alpha}$ is a root of the polyno... | As noted by @Stefan4024, the polynomial $f(x) = x^4-4x^2+2$ is irreducible so it is the minimal polynomial of $\alpha$.
Notice that
$$f(x) = (x^4-4x^2+4)- 2 = (x^2-2)^2- 2$$
so the roots are $\sqrt{2+\sqrt2}, -\sqrt{2+\sqrt2}, \sqrt{2-\sqrt2},-\sqrt{2-\sqrt2}$.
Now clearly $-\sqrt{2+\sqrt2} = -\alpha \in \mathbb{Q}... |
17,709,246 | I have what I hope is a quick question. Haven't found working code for this, and I'm at a little bit of a loss.
I'm working with an old database on SQL Server 2005. It has a dynamic questionnaire (or a thousand, actually... long story), and each question can have the answer stored as either a smallint or as ntext.
Th... | 2013/07/17 | [
"https://Stackoverflow.com/questions/17709246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592948/"
] | Faced Similar Error when I accidentally gave string values to column defined as int.
Please rearrange the values and Table fields in the insert statement
For ex
```
Insert into Table (int,string) values (string,int)
```
will not work and generate the error as stated above. So re arrange it in respective manner.
``... | This [link](https://stackoverflow.com/questions/2133946/nvarcharmax-vs-ntext) describes the difference between ntext and nvarchar(max). Is does mention that the ntext is being deprecated. It also talk about the nvarchar(max) being stored within your table making the queries faster. You might want to try using the varia... |
8,696 | Are there word elements, including suffixes, from Old English or other languages that have been linked to their ancient deities and the people that served them, to which these elements are still in use today in the evolution of their language? e.g.:
Jehovah/Jesus Christ a.k.a. Cristos; Christus derived to: Christian; ... | 2014/07/31 | [
"https://linguistics.stackexchange.com/questions/8696",
"https://linguistics.stackexchange.com",
"https://linguistics.stackexchange.com/users/3689/"
] | I assumed the question implied words other than the days of the week,
interesting because different but "functionally" related deities have
named them such as Frigg in English for Friday, and Venus in French
for vendredi.
I guess it also excluded the names of planets and other bodies of the
solar system, which are dir... | **Days of week** may be a good example of what you are looking for.
In many IE languages, names of those are derived from ancient deities representing individual planets.
>
> *In most Indian languages, the word for **Sunday** is Ravivāra or Adityavāra or its derived forms — vāra meaning day, Aditya and Ravi both b... |
60,258,123 | I am trying to integrate payment gateway on my website. There are three courses each having different prices. I am passing the value of the amount and package to `form.php` and i have made the input fields to readonly but the user can still change the amount in inspect element and make it 0 and pass on the value and ge... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60258123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12849804/"
] | Never let the user send the price. Each course has an ID. Let's assume this:
* course 1, has ID = 1, price = 499, name = 2-Days Classroom Training
* course 2, has ID = 2, price = 999, name = 4-Days Classroom Training
On your payment page, inside `<forms>` send only `course_id = X`.
On the PHP script which receives t... | Check the value of the field, if its zero, just kill the execution of the code, send the user back to the form and print a warning...
Or you could use JavaScript to validate the amount onClick and double check after submission.
***It's a jungle out there!!!*** |
60,258,123 | I am trying to integrate payment gateway on my website. There are three courses each having different prices. I am passing the value of the amount and package to `form.php` and i have made the input fields to readonly but the user can still change the amount in inspect element and make it 0 and pass on the value and ge... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60258123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12849804/"
] | U can do one thing to avoid the trap is that just make a session variable for the amount value and then fetch the session variable in the next page and then send the session variable for the amount element(mandatory) along with the others field which are encrypted/decrypted by the payment gateway. | Check the value of the field, if its zero, just kill the execution of the code, send the user back to the form and print a warning...
Or you could use JavaScript to validate the amount onClick and double check after submission.
***It's a jungle out there!!!*** |
60,258,123 | I am trying to integrate payment gateway on my website. There are three courses each having different prices. I am passing the value of the amount and package to `form.php` and i have made the input fields to readonly but the user can still change the amount in inspect element and make it 0 and pass on the value and ge... | 2020/02/17 | [
"https://Stackoverflow.com/questions/60258123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12849804/"
] | Never let the user send the price. Each course has an ID. Let's assume this:
* course 1, has ID = 1, price = 499, name = 2-Days Classroom Training
* course 2, has ID = 2, price = 999, name = 4-Days Classroom Training
On your payment page, inside `<forms>` send only `course_id = X`.
On the PHP script which receives t... | U can do one thing to avoid the trap is that just make a session variable for the amount value and then fetch the session variable in the next page and then send the session variable for the amount element(mandatory) along with the others field which are encrypted/decrypted by the payment gateway. |
33,169 | Does using a semicolon to join two clauses form a coordinate construction with two clauses coordinated and is it the same as with "and" and are such sentences interchangeable ? And can we omit words(ellipsis/gapping) as we did with coordinate structure ?
>
> In 2000 there were seven cases; in 1999, five.
>
> In... | 2014/09/10 | [
"https://ell.stackexchange.com/questions/33169",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/9862/"
] | >
> In 2000 there were seven cases; in 1999, five.
>
>
>
Yes, this can be considered coordination. Specifically, it's **asyndetic** coordination, meaning that there is no overt coordinator such as *and* present.
Yes, both of your examples have the same meaning. As you suggest, the first sentence is an example o... | The rule I know of is summed up as:
>
> "a semicolon should be used to separate two independent clauses (or complete sentences) that are closely related in meaning."
>
>
>
*Technically*, **"In 1999, five"** cannot stand as a complete sentence. **"In 1999, there were five cases"** can. You can also build a sentenc... |
31,351,626 | I have look at many web sites and many pages on Stackoverflow, but none of them has solved my problem yet. Simply, I have a `hyperlink` and I want to retrieve an image from database via `Ajax` call and then display it on `FancyBox` popup. I also tried many different combinations of `Javascript` and `Controller` action ... | 2015/07/10 | [
"https://Stackoverflow.com/questions/31351626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/836018/"
] | Better try
```
success: function (response) {
$.fancybox({
content: '<img height="200" width="250" src="data:image/png;base64,' + response + '" />',
type: "html"
});
}
```
I wonder why you trying to load the content inside a fancybox container when you don't show any code where you already ... | This should work. Looks like image is stored as JSON. If so, I think you should convert it back to Base64 before sending it to the browser. See <http://mobile.cs.fsu.edu/converting-images-to-json-objects/>
```
function downloadFile(id) {
$('#fancybox-inner').html('<img height="200" width="250" src="/Issue/RenderIm... |
28,710 | I understand that he had four major projects come out in 2005 - all of which got nominated for major awards, so I understand why he did not do Goblet of Fire. However, was there any particular reason ever given by him or the directors/producers/etc involved, why he did not return for 5-8? | 2012/12/31 | [
"https://scifi.stackexchange.com/questions/28710",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/10926/"
] | John Williams [was asked back](http://en.wikipedia.org/wiki/John_williams#Film_and_television_scoring) to score *Harry Potter and the Deathly Hallows - Part 2* by director David Yates; however, Williams's schedule and Yates's schedule "did not align" -- Yates would have had to have provided Williams with a raw cut of *... | He had already passed the torch.
Many creative people are like that - once they have to let go of something or move on, they would rather not go back to revisit old works. The other side to it is something a bit like courtesy. Once you've turned it over to someone else, let them have it - don't grab it back.
In terms... |
28,710 | I understand that he had four major projects come out in 2005 - all of which got nominated for major awards, so I understand why he did not do Goblet of Fire. However, was there any particular reason ever given by him or the directors/producers/etc involved, why he did not return for 5-8? | 2012/12/31 | [
"https://scifi.stackexchange.com/questions/28710",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/10926/"
] | He had already passed the torch.
Many creative people are like that - once they have to let go of something or move on, they would rather not go back to revisit old works. The other side to it is something a bit like courtesy. Once you've turned it over to someone else, let them have it - don't grab it back.
In terms... | One of the main reasons why John Williams never came back to Compose for Goblet of Fire was due to his involvement of 'Revenge of the Sith - Episode III' that same year. Thus, his scheduling made it nearly impossible to compose both films at the same time, so Williams generously acknowledged Mike Newell (the director) ... |
28,710 | I understand that he had four major projects come out in 2005 - all of which got nominated for major awards, so I understand why he did not do Goblet of Fire. However, was there any particular reason ever given by him or the directors/producers/etc involved, why he did not return for 5-8? | 2012/12/31 | [
"https://scifi.stackexchange.com/questions/28710",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/10926/"
] | John Williams [was asked back](http://en.wikipedia.org/wiki/John_williams#Film_and_television_scoring) to score *Harry Potter and the Deathly Hallows - Part 2* by director David Yates; however, Williams's schedule and Yates's schedule "did not align" -- Yates would have had to have provided Williams with a raw cut of *... | One of the main reasons why John Williams never came back to Compose for Goblet of Fire was due to his involvement of 'Revenge of the Sith - Episode III' that same year. Thus, his scheduling made it nearly impossible to compose both films at the same time, so Williams generously acknowledged Mike Newell (the director) ... |
1,443,231 | java & keytool install paths:
```
C:\Users\foobar>where java
C:\Program Files\Java\jdk1.8.0_211\bin\java.exe
C:\Users\foobar>where keytool
C:\Program Files\Java\jdk1.8.0_211\bin\keytool.exe
```
As it's the only `cacerts` file in the `Java` directory, I assume this is the default:
```
"C:\Program Files\Java\jdk1.8.... | 2019/05/31 | [
"https://superuser.com/questions/1443231",
"https://superuser.com",
"https://superuser.com/users/1043627/"
] | It turns out that my .env file is incorrect. You should not put ',' separator between the variables. | If its a react app be sure you're in the client directory and that you're not trying to run you react app in server directory...as it won't give you error but address issues |
46,626,862 | I have another question posted where my query would not return the results into my sealresult Label. So I figured to ask it in a different way because I still cannot figure this out. I have the following code, it runs perfectly when the button "Search" is clicked and returns the query result. However, I have a textBox ... | 2017/10/08 | [
"https://Stackoverflow.com/questions/46626862",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7958874/"
] | ```
vector<int> numbers;
// some code here to add values to the numbers array
int maxStreak = 0;
int counter = 0;
int previousNumber;
int currentNumber;
for (int i= 1; i < numbers.size(); i++)
{
previousNumber = numbers[i - 1];
currentNumber = numbers[i];
if (abs(currentNumber - previousNumber) <= 10) {
... | Remember `start` index of potential run (initially 0)
Start loop from the second index and check **every** pair `(i++)`
Calculate **absolute** value of difference (AD) of `A[i]` and `A[i-1]`
If AD is **too large**, run is over, so find whether run length `(i-start)` is longer than previous (`maxlen`)
Check run ... |
53,847,803 | Similar to [Clojure recur with multi-arity](https://stackoverflow.com/questions/49546574/clojure-recur-with-multi-arity) I'd like recur with a different arity. But in my case, I define the function via a let, as I want to use another value from the let (`file-list`) without passing it:
```
(let [file-list (drive/list-... | 2018/12/19 | [
"https://Stackoverflow.com/questions/53847803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362378/"
] | You can give a local name to the `fn`:
```
(let [download-file (fn download-file
([name] (download-file name (fn ...))))
```
you could also use [`letfn`](https://clojuredocs.org/clojure.core/letfn):
```
(letfn [(download-file
([name] (download-file name (fn ...)))
([name no... | In order to make more readable exception error messages, I often append `-fn` to the inner function name, like so:
```
(let [download-file (fn download-file-fn [name] ...) ]
<use download-file> ...)
``` |
71,124 | Once I asked my friend 'how's the summer treating you?', he replied 'It's been good because it's been bad.'
What does it mean? Good or bad? | 2012/06/15 | [
"https://english.stackexchange.com/questions/71124",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/22352/"
] | Just my guess: Low heat tolerance + bad (cold) weather = good summer. | It really depends on what country, where the emphasis was in the sentence, what your friend's sense of humor is like...
In other words, it means absolutely nothing to me. If I were sitting with someone who said it, I would have to guess based on everything *other* than the words. |
71,124 | Once I asked my friend 'how's the summer treating you?', he replied 'It's been good because it's been bad.'
What does it mean? Good or bad? | 2012/06/15 | [
"https://english.stackexchange.com/questions/71124",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/22352/"
] | It sounds like your friend was referring to a [***silver lining***](http://www.wordnik.com/words/silver%20lining) of some sort. It may have been weather-related, as SF. guessed, or it could have been a host of other things.
For example, If he was a student, it might mean:
>
> This term, my professors are really givi... | It really depends on what country, where the emphasis was in the sentence, what your friend's sense of humor is like...
In other words, it means absolutely nothing to me. If I were sitting with someone who said it, I would have to guess based on everything *other* than the words. |
71,124 | Once I asked my friend 'how's the summer treating you?', he replied 'It's been good because it's been bad.'
What does it mean? Good or bad? | 2012/06/15 | [
"https://english.stackexchange.com/questions/71124",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/22352/"
] | It sounds like your friend was referring to a [***silver lining***](http://www.wordnik.com/words/silver%20lining) of some sort. It may have been weather-related, as SF. guessed, or it could have been a host of other things.
For example, If he was a student, it might mean:
>
> This term, my professors are really givi... | Just my guess: Low heat tolerance + bad (cold) weather = good summer. |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | You define method like you do now, but you need to use the same url as method name and add link decorator, so for
```
/myobjects/123/locations/
```
You add method like this
```
@link(permission_classes=[...])
def locations(self, request, pk=None):
...
```
and router will pick it automatically. | From [Routing to extra methods on a ViewSet](https://groups.google.com/forum/#!msg/django-rest-framework/naTNAxw4jws/nue_fhS5vI4J):
>
> I think you may need to route the method by hand, i.e. The Old-Fashioned Way™.
>
>
> First pull the method out as a separate view:
>
>
>
> ```
> set_password_view = UserVie... |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | The [answer given by mariodev](https://stackoverflow.com/a/18970651/3216056) above is correct, as long as you're only looking to make `GET` requests.
If you want to `POST` to a function you're appending to a ViewSet, you need to use the `action` decorator:
```
from rest_framework.decorators import action, link
from r... | You define method like you do now, but you need to use the same url as method name and add link decorator, so for
```
/myobjects/123/locations/
```
You add method like this
```
@link(permission_classes=[...])
def locations(self, request, pk=None):
...
```
and router will pick it automatically. |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | You can now do this with the list\_route and detail\_route decorators: <http://www.django-rest-framework.org/api-guide/viewsets/#marking-extra-actions-for-routing>
For example:
```
from rest_framework.decorators import list_route
from rest_framework.response import Response
...
class MyObjectsViewSet(viewsets.ViewSe... | You define method like you do now, but you need to use the same url as method name and add link decorator, so for
```
/myobjects/123/locations/
```
You add method like this
```
@link(permission_classes=[...])
def locations(self, request, pk=None):
...
```
and router will pick it automatically. |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | You define method like you do now, but you need to use the same url as method name and add link decorator, so for
```
/myobjects/123/locations/
```
You add method like this
```
@link(permission_classes=[...])
def locations(self, request, pk=None):
...
```
and router will pick it automatically. | If you want to extend a viewset with a view that is or should not directly be written inside your viewset, you can write a “wrapper” action to pass the data through.
For example, with class based views:
```py
from somewhere import YourExternalClassView
class SomeViewSet(viewsets.ReadOnlyModelViewSet):
# ...
... |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | The [answer given by mariodev](https://stackoverflow.com/a/18970651/3216056) above is correct, as long as you're only looking to make `GET` requests.
If you want to `POST` to a function you're appending to a ViewSet, you need to use the `action` decorator:
```
from rest_framework.decorators import action, link
from r... | From [Routing to extra methods on a ViewSet](https://groups.google.com/forum/#!msg/django-rest-framework/naTNAxw4jws/nue_fhS5vI4J):
>
> I think you may need to route the method by hand, i.e. The Old-Fashioned Way™.
>
>
> First pull the method out as a separate view:
>
>
>
> ```
> set_password_view = UserVie... |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | You can now do this with the list\_route and detail\_route decorators: <http://www.django-rest-framework.org/api-guide/viewsets/#marking-extra-actions-for-routing>
For example:
```
from rest_framework.decorators import list_route
from rest_framework.response import Response
...
class MyObjectsViewSet(viewsets.ViewSe... | From [Routing to extra methods on a ViewSet](https://groups.google.com/forum/#!msg/django-rest-framework/naTNAxw4jws/nue_fhS5vI4J):
>
> I think you may need to route the method by hand, i.e. The Old-Fashioned Way™.
>
>
> First pull the method out as a separate view:
>
>
>
> ```
> set_password_view = UserVie... |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | From [Routing to extra methods on a ViewSet](https://groups.google.com/forum/#!msg/django-rest-framework/naTNAxw4jws/nue_fhS5vI4J):
>
> I think you may need to route the method by hand, i.e. The Old-Fashioned Way™.
>
>
> First pull the method out as a separate view:
>
>
>
> ```
> set_password_view = UserVie... | If you want to extend a viewset with a view that is or should not directly be written inside your viewset, you can write a “wrapper” action to pass the data through.
For example, with class based views:
```py
from somewhere import YourExternalClassView
class SomeViewSet(viewsets.ReadOnlyModelViewSet):
# ...
... |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | The [answer given by mariodev](https://stackoverflow.com/a/18970651/3216056) above is correct, as long as you're only looking to make `GET` requests.
If you want to `POST` to a function you're appending to a ViewSet, you need to use the `action` decorator:
```
from rest_framework.decorators import action, link
from r... | You can now do this with the list\_route and detail\_route decorators: <http://www.django-rest-framework.org/api-guide/viewsets/#marking-extra-actions-for-routing>
For example:
```
from rest_framework.decorators import list_route
from rest_framework.response import Response
...
class MyObjectsViewSet(viewsets.ViewSe... |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | The [answer given by mariodev](https://stackoverflow.com/a/18970651/3216056) above is correct, as long as you're only looking to make `GET` requests.
If you want to `POST` to a function you're appending to a ViewSet, you need to use the `action` decorator:
```
from rest_framework.decorators import action, link
from r... | If you want to extend a viewset with a view that is or should not directly be written inside your viewset, you can write a “wrapper” action to pass the data through.
For example, with class based views:
```py
from somewhere import YourExternalClassView
class SomeViewSet(viewsets.ReadOnlyModelViewSet):
# ...
... |
18,969,798 | Essentially, I'm trying to find a good way to attach more views to a Router without creating a custom Router. **What's a good way to accomplish this?**
Here is something sort of equivalent to what I'm trying to accomplish. Variable names have been changed and the example method I want to introduce is extremely simplif... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18969798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485900/"
] | You can now do this with the list\_route and detail\_route decorators: <http://www.django-rest-framework.org/api-guide/viewsets/#marking-extra-actions-for-routing>
For example:
```
from rest_framework.decorators import list_route
from rest_framework.response import Response
...
class MyObjectsViewSet(viewsets.ViewSe... | If you want to extend a viewset with a view that is or should not directly be written inside your viewset, you can write a “wrapper” action to pass the data through.
For example, with class based views:
```py
from somewhere import YourExternalClassView
class SomeViewSet(viewsets.ReadOnlyModelViewSet):
# ...
... |
34,904,191 | Is there a way of passing a function to another function and then executing it?
```
functionCaller(functionToBeCalled());
``` | 2016/01/20 | [
"https://Stackoverflow.com/questions/34904191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5058429/"
] | Double.MIN\_VALUE:
A constant holding the smallest positive nonzero value of type double.
Double.MAX\_VALUE:
A constant holding the largest positive finite value of type double.
You can check here for more details: <https://docs.oracle.com/javase/7/docs/api/java/lang/Double.html> | For `double highest = Double.MIN_VALUE;`, instead use `-Double.MAX_VALUE`. Note the '-' sign.
And for :
```
if (num > highest)
{
highest = num;
}
```
Use:
```
highest = Math.max(highest, num)
lowest = Math.min(lowest, num)
``` |
65,557,020 | I learned I can use [:hover:after](https://stackoverflow.com/a/13234028/667903) so I tried it myself, however it is not working:
```css
.img-shadow img:hover:after {
-webkit-box-shadow: inset 10px 10px 10px 0px rgba(0,0,0,0.75);
-moz-box-shadow: inset 10px 10px 10px 0px rgba(0,0,0,0.75);
box-shadow: inset ... | 2021/01/04 | [
"https://Stackoverflow.com/questions/65557020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/667903/"
] | By default, `dotnet publish` publishes the entire application for running on the current operating system. When that does not match where you intend to run the application you can specify the runtime to publish for with `-r|--runtime`.
Something like this should work: `dotnet publish -r linux-x64` | A 403 error would lie somewhere in the IIS/web server configuration. Look at the config file or the IIS settings. |
27,726,430 | ```
pyg = 'ay'
original = raw_input('Enter a word:')
word = original.lower()
first = word[0]
if len(original) > 0 and original.isalpha():
print original
else:
print 'empty'
new_word = word[1:]
print new_word + first + pyg
```
^ the above code is something I've tried on codeacademy as Im at a beginners... | 2014/12/31 | [
"https://Stackoverflow.com/questions/27726430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4117165/"
] | For Android API 21 and above, just use:
```
Os.symlink(originalFilePath,symLinkFilePath);
``` | There is no public API to do this. You can however use some dirty reflection to create your symbolic link. I just tested the following code and it worked for me:
```
// static factory method to transfer a file from assets to package files directory
AssetUtils.transferAsset(this, "test.png");
// The file that was tran... |
57,782 | Mathematica won't change a number's BaseForm recursively:
```
63969 // BaseForm[#, 16] & // BaseForm[#, 8] & // BaseForm[#, 2] &
```
Well, I inspected former answers, most of them treated formatting problems, but none of the anwers given treated the nestable aspect. Maybe I'm wrong, and I risk a duplicate.
(1) I wo... | 2014/08/20 | [
"https://mathematica.stackexchange.com/questions/57782",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/16373/"
] | There is a useful attribute, `NHoldFirst` whose purpose is to protect the function from exactly that. So setting:
```
SetAttributes[a, NHoldFirst];
```
and then evaluating the integral works the way you want:
```
Integrate[(a[1] + x)^2, {x, 1., 2.}]
(*2.33333 + 3. a[1] + 1. a[1]^2*)
```
The relevant example from ... | First, I did not get same result as your answer. I got numerical values in all terms.
```
int = Integrate[(a[1] + x)^2, {x, 1., b}]
```
MMA 9:
```
(* -0.333333 + 0.333333 b^3 - 1. a[1.] + 1. b^2 a[1.] - 1. a[1.]^2 +
1. b a[1.]^2 + 5.55112*10^-17 a[1.]^3 *)
```
MMA 10:
```
(*-0.333333 (1. + a[1.])^3 + 0.... |
10,439,948 | i have this testing code which am working with ..
i have a module called `ms` and and another one called `test`
the `test` controller code is :
```
<?php
class Test extends MX_Controller {
public function __construct()
{
parent::__construct();
$this->template->title($this->config->item('site_n... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10439948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013493/"
] | Since the `test` module is being called in the context of the `ms` one, `$this->template->build()` is looking for a view file in the `ms` module. The same way you can load models and libraries cross-module, you would have to do this for your view path as well:
```
class Test extends MX_Controller {
public functio... | You can try to change the module.php the run method
The following example is I have to use the fix solution:
1. Open the third\_party/MX/Modules.php
2. Near 75 lines to find
$buffer = ob\_get\_clean();
3. Increase in its following:
if($output === NULL && $buffer === ''){
$output = CI::$APP->output->get\_output();
}... |
4,106,035 | Let $A\_1, \dots , A\_n$ be commutative unitary Rings and $A = \prod\_{i=1}^{n} A\_i$.
Then every prime Ideal $\frak{p}$ $\subset A$ is of the form $\pi\_i^{-1}(\frak{p}\_i)$ where $\pi\_i: A \to A\_i$ are the canonical projections and $\frak{p\_i}$ $\subset A\_i$ is prime.
I know that every Ideal in $A$ is a direct p... | 2021/04/17 | [
"https://math.stackexchange.com/questions/4106035",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/697395/"
] | You can derive the proof from the following facts:
1. An ideal $\mathfrak{a} \subseteq A$ is prime iff $A/\mathfrak{a}$ is an integral domain.
2. There is an isomorphism of rings $(\prod\_i A\_i) / (\prod\_i \mathfrak{a}\_i) \cong \prod\_i A\_i / \mathfrak{a\_i}$
3. A product $\prod\_i A\_i$ is an integral domain iff... | Assume $\mathfrak a\_i\neq A\_i,\mathfrak a\_j\neq A\_j$ for $i\neq j.$ Then $1\_i\in A\_i\setminus \mathfrak a\_i$ and $1\_j\in A\_j\setminus \mathfrak a\_j.$
Define $a=(a\_k)\_{k=1}^n,b=(b\_k)\_{k=1}^n\in A$ as:
$$a\_k=\begin{cases}0&k\neq i\\
1\_i&k=i
\end{cases}$$
$$b\_k=\begin{cases}0&k\neq j\\
1\_j&k=j
\end{ca... |
3,922,083 | Is there any Applescript available that sends either an URL or array of images as attachment of the mail through Mac Office 2011? | 2010/10/13 | [
"https://Stackoverflow.com/questions/3922083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/474228/"
] | Also see:
MS Outlook 2011 sp1 V14.1.0 changes the apple script dictionary..
<http://www.officeformachelp.com/2011/04/microsoft-updates-applescript-dictionary-for-outlook-2011-sp1/>
also:
run send all -- forces mail in out box to be sent right now | Seeing as how Office 2011 is very new, I'd be surprised you'll find ready-made code to use outside of an example script given with Office. [This is where the Dictionary comes in; the Dictionary tells you everything that an application responds to, what objects can be manipulated, etc.](https://stackoverflow.com/questio... |
169,712 | I'm writing a package which, among other things, gives abbreviations for `\mathbb`, as follows:
```
\newcommand{\A}{\mathbb A}
\def\B{\mathbb B}
\def\C{\mathbb C}
\newcommand{\D}{\mathbb D}
\newcommand{\E}{\mathbb E}
\newcommand{\F}{\mathbb F}
\def\G{\mathbb G}
\def\H{\mathbb H}
\newcommand{\I}{\mathbb I}
\newcommand{... | 2014/04/05 | [
"https://tex.stackexchange.com/questions/169712",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/42315/"
] | You have probably discovered why it's very strongly discouraged to redefine kernel commands with `\def`.
For instance, `\H` is defined to give the “hungarian umlaut” accent; so, if you are talking about Erdős in your document, you'll get a puzzling error, even if you seem not to be using `\H`. Actually when `\usepacka... | As the posted code doesn't generate the error shown, I'll modify it so it does.
This *complete* document demonstrates the error.
```
\RequirePackage{amsfonts}
\newcommand{\A}{\mathbb A}
\def\B{\mathbb B}
\def\C{\mathbb C}
\newcommand{\D}{\mathbb D}
\newcommand{\E}{\mathbb E}
\newcommand{\F}{\mathbb F}
\def\G{\mathbb ... |
67,255 | 
If it means watched, then I saw the check box is over there even though I selected unwatched column.
Does it mean downloaded? There is no tool tips and it's kind of silly to have 2 columns expressing the same thing.
The checkbox may means downloade... | 2012/10/13 | [
"https://apple.stackexchange.com/questions/67255",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/23343/"
] | The checkbox is a tool for downloaded items to specify if you want that specific item to sync to your device. There is a setting in your iTunes device list to sync only checked items in iTunes:

If you have that setting turned on, unchecking any song ... | Check box is for you to check when you have completed a lesson. The circles gradually fill up as you complete the lesson. |
67,255 | 
If it means watched, then I saw the check box is over there even though I selected unwatched column.
Does it mean downloaded? There is no tool tips and it's kind of silly to have 2 columns expressing the same thing.
The checkbox may means downloade... | 2012/10/13 | [
"https://apple.stackexchange.com/questions/67255",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/23343/"
] | The blue circle tells you how much of the media file your have played. A full circle means that it has never been played or has been marked as unplayed. A half circle means it has been partially played. No circle means it has been fully played.
As for the checkboxes, they are just for marking purposes and can have mul... | Check box is for you to check when you have completed a lesson. The circles gradually fill up as you complete the lesson. |
67,255 | 
If it means watched, then I saw the check box is over there even though I selected unwatched column.
Does it mean downloaded? There is no tool tips and it's kind of silly to have 2 columns expressing the same thing.
The checkbox may means downloade... | 2012/10/13 | [
"https://apple.stackexchange.com/questions/67255",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/23343/"
] | The checkbox is a tool for downloaded items to specify if you want that specific item to sync to your device. There is a setting in your iTunes device list to sync only checked items in iTunes:

If you have that setting turned on, unchecking any song ... | The blue circle tells you how much of the media file your have played. A full circle means that it has never been played or has been marked as unplayed. A half circle means it has been partially played. No circle means it has been fully played.
As for the checkboxes, they are just for marking purposes and can have mul... |
43,196,636 | I have an example of a neural network with two layers. The first layer takes two arguments and has one output. The second should take one argument as result of the first layer and one additional argument. It should looks like this:
```
x1 x2 x3
\ / /
y1 /
\ /
y2
```
So, I'd created a model with two... | 2017/04/04 | [
"https://Stackoverflow.com/questions/43196636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/944000/"
] | You're getting the error because `result` defined as `Sequential()` is just a container for the model and you have not defined an input for it.
Given what you're trying to build set `result` to take the third input `x3`.
```python
first = Sequential()
first.add(Dense(1, input_shape=(2,), activation='sigmoid'))
secon... | You can experiment with `model.summary()` (notice the concatenate\_XX (Concatenate) layer size)
```
# merge samples, two input must be same shape
inp1 = Input(shape=(10,32))
inp2 = Input(shape=(10,32))
cc1 = concatenate([inp1, inp2],axis=0) # Merge data must same row column
output = Dense(30, activation='relu')(cc1)
m... |
43,196,636 | I have an example of a neural network with two layers. The first layer takes two arguments and has one output. The second should take one argument as result of the first layer and one additional argument. It should looks like this:
```
x1 x2 x3
\ / /
y1 /
\ /
y2
```
So, I'd created a model with two... | 2017/04/04 | [
"https://Stackoverflow.com/questions/43196636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/944000/"
] | You're getting the error because `result` defined as `Sequential()` is just a container for the model and you have not defined an input for it.
Given what you're trying to build set `result` to take the third input `x3`.
```python
first = Sequential()
first.add(Dense(1, input_shape=(2,), activation='sigmoid'))
secon... | Adding to the above-accepted answer so that it helps those who are using `tensorflow 2.0`
```py
import tensorflow as tf
# some data
c1 = tf.constant([[1, 1, 1], [2, 2, 2]], dtype=tf.float32)
c2 = tf.constant([[2, 2, 2], [3, 3, 3]], dtype=tf.float32)
c3 = tf.constant([[3, 3, 3], [4, 4, 4]], dtype=tf.float32)
# bake... |
43,196,636 | I have an example of a neural network with two layers. The first layer takes two arguments and has one output. The second should take one argument as result of the first layer and one additional argument. It should looks like this:
```
x1 x2 x3
\ / /
y1 /
\ /
y2
```
So, I'd created a model with two... | 2017/04/04 | [
"https://Stackoverflow.com/questions/43196636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/944000/"
] | Adding to the above-accepted answer so that it helps those who are using `tensorflow 2.0`
```py
import tensorflow as tf
# some data
c1 = tf.constant([[1, 1, 1], [2, 2, 2]], dtype=tf.float32)
c2 = tf.constant([[2, 2, 2], [3, 3, 3]], dtype=tf.float32)
c3 = tf.constant([[3, 3, 3], [4, 4, 4]], dtype=tf.float32)
# bake... | You can experiment with `model.summary()` (notice the concatenate\_XX (Concatenate) layer size)
```
# merge samples, two input must be same shape
inp1 = Input(shape=(10,32))
inp2 = Input(shape=(10,32))
cc1 = concatenate([inp1, inp2],axis=0) # Merge data must same row column
output = Dense(30, activation='relu')(cc1)
m... |
60,146,978 | `print('python'*5,sep=',')`
<https://i.stack.imgur.com/zB3HT.png>
How do I print it on a new line?
Ex: pythonpythonpythonppythonpython
But it's not using `'sep=','` option
so, how do I get it working ?
ex: python,python,python,.... | 2020/02/10 | [
"https://Stackoverflow.com/questions/60146978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12870928/"
] | Try this way
```
print(*5*('python',), sep=',')
```
Output
>
> python,python,python,python,python
>
>
>
You have to add the ',' to let the separator know what to separate, otherwise it will think there's only one word. | There are a number of ways to do so. Try
```
'python, ' * 5
```
or
```
print(*['python']*5,sep=',')
```
or
```
', '.join(['python'] * 5)
```
`sep` is an argument of `print()` function and not a string formatter. It puts the separator when print's work is done. |
41,252,208 | I'd like to use an HTTP proxy (such as nginx) to cache large/expensive requests. These resources are identical for any *authorized* user, but their authentication/authorization needs to be checked by the backend on each request.
It sounds like something like `Cache-Control: public, max-age=0` along with the nginx dire... | 2016/12/20 | [
"https://Stackoverflow.com/questions/41252208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/113/"
] | I would like to address the additional questions / concerns that have come up during the conversation since my original answer of simply using `X-Accel-Redirect` (and, if Apache-compatibility is desired, `X-Sendfile`, respectively).
The solution that you seek as "optimal" (without `X-Accel-Redirect`) is incorrect, for... | I think your best bet would be to modify your backend with support of `X-Accel-Redirect`.
Its functionality is enabled by default, and is described in the documentation for [`proxy_ignore_headers`](http://nginx.org/r/proxy_ignore_headers):
>
> “X-Accel-Redirect” performs an internal redirect to the specified URI;
>... |
41,252,208 | I'd like to use an HTTP proxy (such as nginx) to cache large/expensive requests. These resources are identical for any *authorized* user, but their authentication/authorization needs to be checked by the backend on each request.
It sounds like something like `Cache-Control: public, max-age=0` along with the nginx dire... | 2016/12/20 | [
"https://Stackoverflow.com/questions/41252208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/113/"
] | I would like to address the additional questions / concerns that have come up during the conversation since my original answer of simply using `X-Accel-Redirect` (and, if Apache-compatibility is desired, `X-Sendfile`, respectively).
The solution that you seek as "optimal" (without `X-Accel-Redirect`) is incorrect, for... | If you are unable to modify the backend app as suggested or if the authentication is straightforward such as auth basic, an alternative approach would be to carry out the authentication in Nginx.
Implementing this auth process and defining the cache validity period would be all you would have to do and Nginx will take... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | In order to include a global library, you have to add the jquery.js file in the `scripts` array from angular-cli.json:
```
"scripts": [
"../node_modules/jquery/dist/jquery.js"
]
```
After this, restart `ng serve` if it is already started. | If you use webPack and Typescript you can do something like this:
in your vendor.ts file import jquery:
```
/ RxJS.
import "rxjs";
// Angular 2.
import "@angular/common";
import "@angular/compiler";
import "@angular/core";
import "@angular/http";
import "@angular/platform-browser";
import "@angular/platform-browser-... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | If you use webPack and Typescript you can do something like this:
in your vendor.ts file import jquery:
```
/ RxJS.
import "rxjs";
// Angular 2.
import "@angular/common";
import "@angular/compiler";
import "@angular/core";
import "@angular/http";
import "@angular/platform-browser";
import "@angular/platform-browser-... | I recommend to follow [Nikhil Shah](https://stackoverflow.com/a/41376442/1986423) suggestion in case of existing @type (like the case of jQuery)
However if you have library that export global variable (like jQuery) but does not have known @type file you can take a look at [my following answer](https://stackoverflow.co... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | There is a new way to deal with *external libraries* using **@types**
In order to install/use **jquery**, you just need to install it in your project using
```
npm install --save @types/jquery
```
and then in **tsconfig.json**,under **types**, add its reference accordingly as shown,
**tsconfig.json**
```
{
"co... | I recommend to follow [Nikhil Shah](https://stackoverflow.com/a/41376442/1986423) suggestion in case of existing @type (like the case of jQuery)
However if you have library that export global variable (like jQuery) but does not have known @type file you can take a look at [my following answer](https://stackoverflow.co... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | There is a new way to deal with *external libraries* using **@types**
In order to install/use **jquery**, you just need to install it in your project using
```
npm install --save @types/jquery
```
and then in **tsconfig.json**,under **types**, add its reference accordingly as shown,
**tsconfig.json**
```
{
"co... | If @tudorciotlos answer does not work for you (like in my case) try this extended way:
```
"scripts": [
{ "input": "../node_modules/jquery/dist/jquery.js", "bundleName": "renamed-script.js" }
]
```
```html
<script src="renamed-script.js"></script>
```
[Source here](https://github.com/angular/angular-c... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | In order to include a global library, you have to add the jquery.js file in the `scripts` array from angular-cli.json:
```
"scripts": [
"../node_modules/jquery/dist/jquery.js"
]
```
After this, restart `ng serve` if it is already started. | There is a new way to deal with *external libraries* using **@types**
In order to install/use **jquery**, you just need to install it in your project using
```
npm install --save @types/jquery
```
and then in **tsconfig.json**,under **types**, add its reference accordingly as shown,
**tsconfig.json**
```
{
"co... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | In order to include a global library, you have to add the jquery.js file in the `scripts` array from angular-cli.json:
```
"scripts": [
"../node_modules/jquery/dist/jquery.js"
]
```
After this, restart `ng serve` if it is already started. | If @tudorciotlos answer does not work for you (like in my case) try this extended way:
```
"scripts": [
{ "input": "../node_modules/jquery/dist/jquery.js", "bundleName": "renamed-script.js" }
]
```
```html
<script src="renamed-script.js"></script>
```
[Source here](https://github.com/angular/angular-c... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | Firstly you don't need to put it in index.html instead put this entry in `angular-cli.json` file
Like this:
```
"scripts": [
"../node_modules/wow.js/dist/wow.js",
"../node_modules/jquery/dist/jquery.js",
"....Other Libs..."
]
```
Then make sure you have installed jQuery properly ... | If @tudorciotlos answer does not work for you (like in my case) try this extended way:
```
"scripts": [
{ "input": "../node_modules/jquery/dist/jquery.js", "bundleName": "renamed-script.js" }
]
```
```html
<script src="renamed-script.js"></script>
```
[Source here](https://github.com/angular/angular-c... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | There is a new way to deal with *external libraries* using **@types**
In order to install/use **jquery**, you just need to install it in your project using
```
npm install --save @types/jquery
```
and then in **tsconfig.json**,under **types**, add its reference accordingly as shown,
**tsconfig.json**
```
{
"co... | Firstly you don't need to put it in index.html instead put this entry in `angular-cli.json` file
Like this:
```
"scripts": [
"../node_modules/wow.js/dist/wow.js",
"../node_modules/jquery/dist/jquery.js",
"....Other Libs..."
]
```
Then make sure you have installed jQuery properly ... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | There is a new way to deal with *external libraries* using **@types**
In order to install/use **jquery**, you just need to install it in your project using
```
npm install --save @types/jquery
```
and then in **tsconfig.json**,under **types**, add its reference accordingly as shown,
**tsconfig.json**
```
{
"co... | If you use webPack and Typescript you can do something like this:
in your vendor.ts file import jquery:
```
/ RxJS.
import "rxjs";
// Angular 2.
import "@angular/common";
import "@angular/compiler";
import "@angular/core";
import "@angular/http";
import "@angular/platform-browser";
import "@angular/platform-browser-... |
41,376,266 | I am using python 2.7 and trying to **search folder not file**.
We have specific project number for every project and evry documents goes to project folder under any project. So , we have to search the project folder if it is exist or valid.
My script can find the specific folder but it takes long time (about 11 to ... | 2016/12/29 | [
"https://Stackoverflow.com/questions/41376266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1764861/"
] | In order to include a global library, you have to add the jquery.js file in the `scripts` array from angular-cli.json:
```
"scripts": [
"../node_modules/jquery/dist/jquery.js"
]
```
After this, restart `ng serve` if it is already started. | I recommend to follow [Nikhil Shah](https://stackoverflow.com/a/41376442/1986423) suggestion in case of existing @type (like the case of jQuery)
However if you have library that export global variable (like jQuery) but does not have known @type file you can take a look at [my following answer](https://stackoverflow.co... |
30,972 | Is there anything similar on Windows what would achieve the same as the InputManager on OS X? | 2008/08/27 | [
"https://Stackoverflow.com/questions/30972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/260/"
] | 1. Require SSL on the application
2. In a custom error page for the 403 redirect the browser to the incoming URL, changing http to https along the way.
Note: Keep port 80 open for this - or there won't be a server to listen for requests to redirect. | Is just not accepting any connections on port 80 an option? I'm a complete web server noob so I don't know if the server can operate without an unsecured listen port but if the server can operate only listen on port 443 that would seem to be simplest option.
Another option would be a redirect from the unsecure port to... |
30,972 | Is there anything similar on Windows what would achieve the same as the InputManager on OS X? | 2008/08/27 | [
"https://Stackoverflow.com/questions/30972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/260/"
] | Just to clarify Greg's point 1. IIS Manager > Site properties > Directory Security > Secure Communications > Require Secure Channel (SSL) | Is just not accepting any connections on port 80 an option? I'm a complete web server noob so I don't know if the server can operate without an unsecured listen port but if the server can operate only listen on port 443 that would seem to be simplest option.
Another option would be a redirect from the unsecure port to... |
22,842,323 | I have spent the last 5 hours tracking down a bug where symlinked files have been relabelled as normal files (I don't know how!). I would like to add a verification step to my build script to ensure this doesn't happen again.
In the working environment I get this:
```
> ls -l
... [Info] ... File1.h -> ../../a/b/File... | 2014/04/03 | [
"https://Stackoverflow.com/questions/22842323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296446/"
] | You can use the numpy.timedelta64 object to perform time delta calculations on a numpy.datetime64 object, see [Datetime and Timedelta Arithmetic](http://docs.scipy.org/doc/numpy/reference/arrays.datetime.html#datetime-and-timedelta-arithmetic/ "Datetime and Timedelta Arithmetic").
Since a year can be either 365 or 366... | How about:
```
import numpy as np
import pandas as pd
def numpy_date_add(vd_array,y_array):
ar=((vd_array.astype('M8[Y]') + np.timedelta64(1, 'Y') * \
y_array).astype('M8[M]')+ \
(vd_array.astype('M8[M]')- \
vd_array.astype('M8[Y]'))).astype('M8[D]')+ \
(vd_array.astype('M8[D]')-\
vd_array... |
65,946,960 | I wrote a replacement for VB's MsgBox to gain control over the screen location. In the Visual Studio environment it did exactly what I wanted. I converted it into a class library but Strings with embedded vbCrLf characters add a blank line and lose the five spaces inserted into the line for the indent.
I've tried doub... | 2021/01/28 | [
"https://Stackoverflow.com/questions/65946960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11582774/"
] | I think I see a likely culprit. This is a perfect example of why you should ALWAYS have `Option Strict On`. This line:
```vb
strLineArr = strMsg.Split(vbCrLf)
```
is trying to call a method that doesn't exist. `vbCrLf` is a `String` and there is no overload of the `Split` method that accepts a `String` parameter lik... | This is not an answer to the question you asked but it requires a bit of code so I didn't want to post it as a comment. It is basically a different way of doing things such that your current question should become moot.
In a new WinForms project, I added a new form named `MessageForm` and I added a `Label` to it. I di... |
12,009 | I need to use multiple instances of Tor with different IP addresses on each. I looked it up on google and found this [link](https://tor.stackexchange.com/questions/2006/how-to-run-multiple-tor-browsers-with-different-ips). So far I was able to make use of the "manual way" of editing everything and launching the instanc... | 2016/07/03 | [
"https://tor.stackexchange.com/questions/12009",
"https://tor.stackexchange.com",
"https://tor.stackexchange.com/users/13490/"
] | When you are looking for configuration of Tor-daemon, you should take a look at this file:
```
tor-browser_en-US/Browser/TorBrowser/Data/Tor/torrc-defaults
```
I'm not on Windows, however, I can advice to you to find a correct `torrc` - config file which is used by Windows version. For example, push at one time `ctr... | Windows can easily run Bash scripts - Windows 10 now has "Ubuntu subsystem", previous versions have "Services for Unix", there also a Cygwin, MinGW and even standalone builds of Bash+binutils for Windows, so you can obtain the package which will be best for you and *just run* your bash script on Windows. |
25,825 | I saw a comment by mpiktas that ["The sum of two independent t-distributed random variables is not t-distributed"](https://stats.stackexchange.com/questions/10856/what-is-the-distribution-of-the-difference-of-two-t-distributions). Is it then of any known distribution?
Actually, I am using piece-wise linear regression.... | 2012/04/04 | [
"https://stats.stackexchange.com/questions/25825",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/10356/"
] | These are called piecewise linear splines, you should be able to find some references on the internet also regarding different possible parametrizations (the coefficient of the second spline may represent the change in the slope from the preceding interval or it may represent the slope for the second interval).
Anyway... | Whuber,
Just to confirm. My equations are:
E(y) = beta0 + beta1x , if x > break
E(y) = (beta0 – beta2\*break) + (beta1+beta2)x , otherwise
Is it wrong to:
1) test the null hypothesis of beta1+beta2 = 0 to determine if x is a significant predictor on the left of breakpoint (i.e. when x =< break); and
2) use the p-... |
45,739,217 | I use laravel 5.3 framework and have a middleware to check for languages, redirects are correct and localization works, my question is, it is recommended to save selected language in a cookie? So I will be able to redirect the user every time to the selected language? Can it be also good for performance...
At the mome... | 2017/08/17 | [
"https://Stackoverflow.com/questions/45739217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2968642/"
] | I use this middleware to check/set the language in session for every request:
```
<?php
namespace App\Http\Middleware;
use App;
use Auth;
use Config;
use Session;
use Closure;
class SetLocale
{
public function handle($request, Closure $next)
{
// If the session doesn't have already a locale
... | For the simple one, you can try this code too..
```
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Session;
class SetLocale
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Clo... |
13,707 | Using Twig, is it possible to strip out or replace a non-breaking space (` `)?
I've got a string variable `price` (returned from the [`currency`](https://craftcms.com/docs/templating/filters#currency) filter) that prints like this:
```
Nkr 100,00
```
What I'd like, is to strip the `Nkr ` part, so the... | 2016/02/16 | [
"https://craftcms.stackexchange.com/questions/13707",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/1098/"
] | You just think it is ` ` that get's returned from the filter, because that's how your developer tools display it, but in fact it is a *UTF-8 encoded* non-breaking space character. Have a look at the source code that is output and you won't see the ` `.
The filter gets the formatting pattern from the [app/fra... | Here's a different spin... Try removing everything that's **not numeric or comma**.
```
{{ price|replace('/[^0-9,]/', '') }}
``` |
13,707 | Using Twig, is it possible to strip out or replace a non-breaking space (` `)?
I've got a string variable `price` (returned from the [`currency`](https://craftcms.com/docs/templating/filters#currency) filter) that prints like this:
```
Nkr 100,00
```
What I'd like, is to strip the `Nkr ` part, so the... | 2016/02/16 | [
"https://craftcms.stackexchange.com/questions/13707",
"https://craftcms.stackexchange.com",
"https://craftcms.stackexchange.com/users/1098/"
] | Here's a different spin... Try removing everything that's **not numeric or comma**.
```
{{ price|replace('/[^0-9,]/', '') }}
``` | If you need to trim a non-breaking space which is the UTF-8 encoded non-breaking space character:
```
{{ value|trim(" \t\n\r\0\x0B\xC2\xA0") }}
```
This works because internally Twig uses the PHP `trim`, `ltrim`, and `rtrim functions`. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.