qid int64 1 74.7M | question stringlengths 0 70k | date stringlengths 10 10 | metadata list | response stringlengths 0 115k |
|---|---|---|---|---|
105,849 | So in 3 we learn about the Virgo II lander, but really not much else in the space program. What else happened? Were there space stations, probes to other planets? | 2015/10/23 | [
"https://scifi.stackexchange.com/questions/105849",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/40833/"
] | Ultimately, we have speculative evidence that *Project: Safehouse*, aka the *Societal Preservation Program*, which tasked the Enclave to oversee the vaults, had but one supreme objective.
>
> The purpose of the [vault experiments](http://fallout.wikia.com/wiki/Vault) was to help prepare the Enclave for either re-colo... |
45,804,686 | Given a variable number of strings, I'd like to one-hot encode them as in the following example:
```
s1 = 'awaken my love'
s2 = 'awaken the beast'
s3 = 'wake beast love'
# desired result - NumPy array
array([[ 1., 1., 1., 0., 0., 0.],
[ 1., 0., 0., 1., 1., 0.],
[ 0., 0., 1., 0., 1., 1.]])... | 2017/08/21 | [
"https://Stackoverflow.com/questions/45804686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7954504/"
] | If you do a slight refactoring so that you treat each sentence as a list of words thoughout, it removes a lot of the `split`ting and `join`ing you're having to do, and naturalises the behaviour of `word in s` a bit. However, a `set` is preferred for membership testing, as it can do this in `O(1)`, and you should only c... |
5,183,807 | I have this code in my view page.
```
<td>
Mandate Name:
</td>
<td>
<%= Html.TextBox("MandateName")%>
</td>
```
I wrote MVC2 Validation for this name.
something like this.
```
//[Validator(typeof(MandateVali... | 2011/03/03 | [
"https://Stackoverflow.com/questions/5183807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268349/"
] | do you have anything like
```
<%= Html.ValidationMessageFor(model => model.MandateName)%>
```
in your view?
Check out SottGu's [post on Model Validation](http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx) with mvc2. |
13,841,212 | I have working web service. I had to use same code and develop REST web service. I have done it. When I was debugging it I found one unusual thing. Static constructors are not being called when I am debugging my `RESTWebService` project.
All business logic is inside one DLL. Both `WebService` and `RESTWebService` proj... | 2012/12/12 | [
"https://Stackoverflow.com/questions/13841212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1099228/"
] | Don't check if it was called via a breakpoint - instead, when an instance/service mthod is called, check if the values are actually initialized. Or try to log something from the static constructor and see if it was called.
The static constructor may be called before you have a chance to debug/break on it. |
523,140 | [1] Total number of 3-digit numbers which do not contain more than 2 different digits.
[2] Total number of 5-digit numbers which do not contain more than 3 different digits.
$\underline{\bf{My\; Try}}::$ I have formed different cases.
$\bullet$ If all digits are different, like in the form $aaa$, where $a\in \{1,2... | 2013/10/12 | [
"https://math.stackexchange.com/questions/523140",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/14311/"
] | The fact that a $3$-digit number, by most definitions, cannot begin with $0$ complicates the analysis.
The case where there is only one digit is easy, there are $9$ possibilities.
We now count the $3$-digit numbers which have $2$ different digit.
There are two subcases (i) $0$ is one of the digits, and (ii) all the... |
37,484,134 | I have this table structure, where all the columns have a different click method to them. The first column is not so wide, so it's pretty hard to click on it in a mobile browser, but i want to keep it like that, because of the borders.
Is there a way, where the clickable area of the first column could overlap invisibl... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37484134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3609107/"
] | The first thing that comes to mind is to:
1. Give the first col a greater z-index then the second col
```
.firstcolumn{
z-index : 2;
}
.secondcolumn{
z-index : 1;
}
```
2. Extend the padding-right of col1 to cover the bit of col2 you want to be clickable for col1.
I think that's most of the work you would ... |
7,771,607 | I've already do my research but I think I don't know how to ask so I'll try to explain...
Im looking for a way to ask for the first entry saved on a Scaffold...
Like
If I have in the table Products:
* Sweeter
* Pants
* Scarf
* Tennis
and I write `@first_prod = Products.first` (or something like that) on my model or... | 2011/10/14 | [
"https://Stackoverflow.com/questions/7771607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/992653/"
] | In rails you can define a few default ways to get the content from a model.
In your case i would create a scope.
in your model enter the following:
```
scope ordered, :order => "Product.created_at ASC"
```
When you call
```
Product.ordered
```
It will return all your products ordered by when they were created.
... |
16,308,375 | I'm writing a simple MVC4 application in which I chose the internet application template when I created the project. When I right click **\_Layout.cshtml** and go to **view in page inspector**, I receive a screen in the page inspector view that says
>
> "Server Error in '/' Application.
> ---------------------------... | 2013/04/30 | [
"https://Stackoverflow.com/questions/16308375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1691849/"
] | Okay, I still stand by my comment that it is not meant to view the layout file as a standalone piece. However, I was a little curious as to the issue of viewing the layout.
If you look at the provided link, you will see how to properly use the Page Inspector. Please look at item number 5. That will give you some deta... |
1,520,231 | I am trying to integrate a calendar plugin like google calendar with custom database and code with asp.net MVC in C#.
It needs to handle Day/Week/Month Events in the Calendar as like google calendar.
I found the similar plugin in jquery <http://www.webappers.com/2009/08/04/jquery-weekly-calendar-plugin-inspired-by-g... | 2009/10/05 | [
"https://Stackoverflow.com/questions/1520231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111435/"
] | I'd try [FullCalendar](http://arshaw.com/fullcalendar/) |
41,282,587 | I have a 2-dimensional lattice (L\*L) with fixed boundaries and considering N-S-W-E sites as 4 neighbours to each site. Each site is assigned an float value. For each site I am calculating average of values of its neighbouring sites added to its own value. I want to solve this using convolv2d from scipy.signal. Followi... | 2016/12/22 | [
"https://Stackoverflow.com/questions/41282587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7245071/"
] | Try this to understand your response structure.
```
$.getJSON("myjasonfile.json", function(json) {
console.log(json); // access the response object
console.log(json.data); // access the array
console.log(json.data[0]); // access the first object of the array
console.log(json.data[0].nu... |
51,487 | I have a document library containing a lot of personal information. Originally only admins could see the library but now it has been decided that users need to see their own information. Admins have Full Control and users have Read. The default view shows only documents where the user's name appears in a certain field.... | 2012/11/13 | [
"https://sharepoint.stackexchange.com/questions/51487",
"https://sharepoint.stackexchange.com",
"https://sharepoint.stackexchange.com/users/7433/"
] | ^ Disregard the first, I think I misread your question. The answer in this link may help you instead: <http://social.msdn.microsoft.com/Forums/gu-IN/sharepoint2010customization/thread/5faea89f-f3ea-4b4b-b4c0-2c0cc7e6ceee> |
1,266,731 | I moved to Kubuntu 20.04 recently.Two days ago I installed pyenv and using pyenv i installed python(3.6.8) then I looked for available python versions from pyenv using this command.
```
samip@samip-Inspiron-3521:~$ pyenv versions
3.6.8
```
But it only showed me this recently installed version but my system has pytho... | 2020/08/13 | [
"https://askubuntu.com/questions/1266731",
"https://askubuntu.com",
"https://askubuntu.com/users/1116117/"
] | The problem on a fresh Kubuntu 20.04 installation is that there is no python executable. The `/usr/bin` only has `python2` and `python3` but pyenv checks for `python` to determine if a system version is available.
As a workaround create a python executable yourself:
```
ln -s /usr/bin/python3 /usr/bin/python
``` |
24,762,520 | We have the demo [here](http://angular-ui.github.io/ui-utils/#/mask) on the angular-ui page.
Wondering how we can write a mask with optional extension number.
`(999) 999-9999 ext. 999` will make the extension required. | 2014/07/15 | [
"https://Stackoverflow.com/questions/24762520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863637/"
] | I shared this same problem with you. There is a completely undocumented optional character feature for this component. I could only find it by reading the source code.
The solution for your mask would be:
```
(999) 999-9999 ext. ?9?9?9
```
Question marks in your mask will flag the next character as optional. Trust... |
84,796 | I seem to be asking questions that often belong to other overflow sites.
Where can I browse the list of current overflow sites so I can choose one where to ask the question? | 2011/03/25 | [
"https://meta.stackexchange.com/questions/84796",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/159333/"
] | Look up and left in this page. There you will see the Stack Exchange™ MultiCollider SuperDropdown™. Second tab is what you want.
Or hop on over to <http://stackexchange.com> and check the [Sites tab](https://stackexchange.com/sites).
The page footer also lists all sites which have been officially launched. |
1,956,757 | How can I replace the last two matched string
`string s= "{\"test\":\"value\"}";`
From this string "s" I need to remove the double quotes of the value.
But I need generic, like the value may be any string in feature.
I need this to be done in `C#`. | 2009/12/24 | [
"https://Stackoverflow.com/questions/1956757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171365/"
] | This [example](http://answers.oreilly.com/topic/340-how-to-quickly-find-the-last-match-in-a-string-in-c/) shows how to search a string using regex from right to left. You might find it of use. |
1,228,440 | I am having trouble writing a typeof statement which would be using a variable from a config file the code is like this
```
Type t = new typeof ("My.other.class" + configValue[0]);
```
configValue being the dynamic value I get from the app.config file.
The error I get is "type expected" it is fine if I type out the... | 2009/08/04 | [
"https://Stackoverflow.com/questions/1228440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88765/"
] | The `typeof` keyword is for compile-time use. Use the [`Type.GetType(string)`](http://msdn.microsoft.com/en-us/library/system.type.gettype.aspx) API instead. |
45,797,025 | This is my database table:
[](https://i.stack.imgur.com/fXsjl.jpg)
I want to display this table (5 columns) on my page when clicking a button (List Users).
But I'm getting the following as output:
[](https://i... | 2017/08/21 | [
"https://Stackoverflow.com/questions/45797025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1745446/"
] | I've reached out to Fabric support and got an answer:
>
> The Latest Releases page shows all builds that have been used by at
> least 10% of your Daily Active Users (DAU) on any single day in the
> past 30 days or at least 4% of DAU on the current day. What's likely
> happening is that 3.5.9 isn't hitting the crit... |
25,962,690 | I created a Simple Setup Project by using Windows Form Application with C# that doing only insert Data in Database.
My Database is in Ms Access.First i try to install it on my own Computer it works great, it install all drive in any location and work properly.
In my other computer there are 4 Drive C,D,E,F.
The problem... | 2014/09/21 | [
"https://Stackoverflow.com/questions/25962690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834541/"
] | It's difficult to pinpoint the exact reason why your application raises this exception, but a few common pointers that might help you.
The exception is raised when you are using a class in your code that isn't available when it runs. In this case, it seems you are unable to use org.apache.http.protocol.HttpContext. Mo... |
6,529,505 | I have a class that extends Activity and implements ViewFactory.
I have found some tutorials and code examples that show how to setup a [textSwitcher](http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/TextSwitcher1.html) and [imageSwitcher](http://developer.android.com/resources... | 2011/06/30 | [
"https://Stackoverflow.com/questions/6529505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/756623/"
] | As Stéphane stated before me, create an inner class implementing ViewFactory
```
public class TextSwitcherFactory implements ViewFactory
{
@Override
public View makeView() {
TextView t = new TextView(Latest.this);
t.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
t.setTextSize(36);... |
194,987 | You are given a matrix of forward and back slashes, for instance:
```
//\\
\//\
//\/
```
A slash cuts along the diagonal of its cell corner-to-corner, splitting it in two pieces.
Pieces from adjacent (horizontally or vertically) cells are glued together.
Your task is to count the number of resulting pieces. For the ... | 2019/10/28 | [
"https://codegolf.stackexchange.com/questions/194987",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/24908/"
] | [MATL](https://github.com/lmendo/MATL), 21 bytes
================================================
```
3XytPJ*-X*Xj~4&1ZIunq
```
The input is a matrix with `1` for `\` and `j` (imaginary unit) for `/`.
[Try it online!](https://tio.run/##y00syfn/3ziisiTAS0s3Qisiq85EzTDKszSv8P//6CydLB1DHUNrBUMdMNNaASKSFQsA) Or [verify... |
9,329,114 | Does anyone know of a 'pluck' plugin that matches the underscore array method?
```
pluck_.pluck(list, propertyName)
```
A convenient version of what is perhaps the most common use-case for map: extracting a list of property values.
```
var stooges = [{name : 'moe', age : 40}, {name : 'larry', age : 50}, {name : 'c... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135687/"
] | You can do it with an expression;
```
var arr = $.map(stooges, function(o) { return o["name"]; })
``` |
28,914 | I have read Steven Pinker's Sense of Style, which is a great book.
In chapter 4, he talks about how to form lucid coherent sentences, and in chapter 5, called "Arcs of Coherence", he extends his analysis of coherence to relations between sentences within a paragraph (and also somewhat about coherence between subseque... | 2017/06/26 | [
"https://writers.stackexchange.com/questions/28914",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/24575/"
] | It seems to me that what Pinker is describing at the sentence and paragraph level is substantially what most books on story are describing at the level of a document as a whole. Stories have a coherent shape and that shape has been mapped in various ways by different authors, but broadly the same shape underlies what a... |
13,623,126 | I have a two variables:
```
boost::array my_boost_array_variable_1<float, 3>;
boost::array my_boost_array_variable_2<float, 3>;
```
now I want to call a C function with the following signature:
```
int MPI_Allreduce ( void *sendbuf, void *recvbuf, ...);
```
I want to pass the address of a particular element of my... | 2012/11/29 | [
"https://Stackoverflow.com/questions/13623126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18775/"
] | For me first is more clear then second. But in reality i think they are equal. |
4,584 | This post is about Zephir's answer [here](https://physics.stackexchange.com/questions/16227/what-is-the-kinematics-of-a-particle-with-complex-mass/18678#18678). To quote him,
>
> **In AWT (dense aether model)** all particles have **complex mass terms due the quantum fluctuations.** A the case of **photons and neutrin... | 2013/07/16 | [
"https://physics.meta.stackexchange.com/questions/4584",
"https://physics.meta.stackexchange.com",
"https://physics.meta.stackexchange.com/users/23119/"
] | This makes sense, deleted.
I think this may have been during the period of time when a couple of members of this site (you included) were generating a lot of incorrect non-mainstream flags (about wrong posts, not non mainstream posts). Basically it was a "crying wolf" situation. At first glance this does indeed look ... |
4,757,392 | I need fast way for generating random strings a-Z0-9 in PHP. I've been doing some thinking and testing, this is what I've got so far:
```
function randStr($length) {
$result = null;
$replace = array('/', '+', '=');
while(!isset($result[$length-1])) {
$result.= str_replace($replace, NULL, base64... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/294696/"
] | 1. base64\_encoding won't decrease entropy, it is just a different representation of the same data.
2. It is OS specific, but I think the random values created are good enough with this function. Under PHP 5.3 you have to seed the generator beforehand, it can be a problem if you use this code on different servers. |
18,471 | According to Catholic thought, if we are washed of Original Sin at the time of baptism, why do we transmit Original Sin to our children? In other words, how is it that my child is born with Original Sin when I was freed from Original Sin at the time of my baptism? | 2013/08/18 | [
"https://christianity.stackexchange.com/questions/18471",
"https://christianity.stackexchange.com",
"https://christianity.stackexchange.com/users/5459/"
] | I think you misunderstood the role of Baptism in Catholicism.
Cathecism of the Catholic Church-1263 says
>
> [1263] By Baptism all sins are **forgiven**, original sin and all personal
> sins, as well as all punishment for sin. In those who have been
> reborn nothing remains that would impede their entry into the ... |
26,061,764 | I'm trying to manage some event.
I've my main project, written in C#, and I've added another project, written in VB.NET.
In the VB.NET project, I've a class, raising an event:
```
Public Class newMessageArgs
Inherits EventArgs
Public Property messageCode As String
Public Property appName As String
End Cl... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26061764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/819161/"
] | Are you intend something like this?
```
var raiser = new EventRaiser();
raiser.NewMessage += raiser_NewMessage;
private void raiser_NewMessage(object sender, EventArgs e)
{
//handle your event here
}
```
But `newMessageArgs` class and `NewMessage` event should be public in your VB code.
And of course, you shou... |
11,369,040 | I need to return the actual text description of the db connection, and any other relevant info about the DB.
Why? I call a service and the expected data comes back perfectly.
Now, when I do the same call inside of a secure tunnel, I get completely different results.
All indications say that the code is working in bo... | 2012/07/06 | [
"https://Stackoverflow.com/questions/11369040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/777828/"
] | I hope I've understood correctly:
```
function test() {
var db = ScriptDb.getMyDb();
var result = db.query({id: 434})
var quals = result.next().qualifications;
var hasQual = false;
for (var i = 0; i < quals.length; i++) {
if (quals[i].name == 'QUAL1' && quals[i].issueDate > 20050101) {
hasQual = ... |
32,876,250 | I downloaded a Pycharm community mac OSX version. But after installation, each time I try to open it. It gives me this error. I can't find any information about this error after I google the error.
[](https://i.stack.imgur.com/QzNEO.png)
Thank you. | 2015/09/30 | [
"https://Stackoverflow.com/questions/32876250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1076975/"
] | OK. It turn out be a permission problem. Just chmod 777 the directory(mkdir before). Then this problem is solved |
56,100,559 | I've migrated to `androidx` and after a ton of time with it, I can't move away from the error below. I've integrated `multidex` but I still get the error.
This is the exception:
>
> FAILURE: Build failed with an exception.
>
>
>
>
What went wrong:
>
> Execution failed for task ':app:transformDexArchiveWithE... | 2019/05/12 | [
"https://Stackoverflow.com/questions/56100559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064171/"
] | This is a great question!
Your rectangle can be thought of as 4 lines:
```
(x, y) → (x+width, y) # top
(x+width, y) → (x+width, y+height) # right
(x, y+height) → (x+width, y+height) # bottom
(x, y) → (x, y+height) # left
```
Taking your intersecting line, it's possible to use the [two-l... |
42,504 | Ce [proverbe](http://www.linternaute.fr/proverbe/377/au-royaume-des-aveugles-les-borgnes-sont-rois/#:%7E:text=Au%20royaume%20des%20aveugles%2C%20les%20borgnes%20sont%20rois.%22&text=Entour%C3%A9%20de%20personnes%20ignorantes%20ou,intelligence%20passe%20pour%20un%20g%C3%A9nie.&text=Ce%20proverbe%20provient%20de%20la,par... | 2020/07/08 | [
"https://french.stackexchange.com/questions/42504",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/16020/"
] | J’ai déjà entendu plusieurs fois cette expression et elle est pour moi toujours couramment utilisée, en tout cas comprise.
En revanche, elle est effectivement politiquement peu correcte. Pour cela, je ne la vois être utilisée que dans certains cas : car (1) elle dénote toujours un certain sarcasme et (2) relève plutôt... |
8,228,047 | Well, I'm a linux newbie, and I'm having an issue with a simple bash script.
I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a startup script which will rename and move the log file before each run, effectively creating separate log files for each ru... | 2011/11/22 | [
"https://Stackoverflow.com/questions/8228047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023673/"
] | ```
mv server.log logs/$(date -d "today" +"%Y%m%d%H%M").log
``` |
34,372,419 | I would like to make an ImageView ? AND WHEN i touch it it change background, when i drag finger far of it it become normal i don't know how to do, thanks
```
imgButton.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
cmp++;
... | 2015/12/19 | [
"https://Stackoverflow.com/questions/34372419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872660/"
] | You could go with `serverVersion`. But as you can see in the picture, you still get `Glassfish V3.1` with Glassfish 4.1.
[](https://i.stack.imgur.com/WwqDv.png)
Now, `ApplicationServerFullVersion` will bring better results: `GlassFish Server Open Source Edit... |
414,742 | In [J.J. Sakurai's](https://en.wikipedia.org/wiki/J._J._Sakurai) *[Modern Quantum Mechanics](https://en.wikipedia.org/wiki/J._J._Sakurai#Textbooks)*, the same operator $X$ acts on both, elements of the [ket](https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation#Ket_notation) space and the [bra](https://en.wikipedia.or... | 2018/07/02 | [
"https://physics.stackexchange.com/questions/414742",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/170225/"
] | This is what computer scientists would call [(ad-hoc) polymorphic](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)) or “overloaded” functions: basically, an operator $X$ on the Hilbert space $\mathcal{H}$ is not just one function $X: \mathcal{H}\to\mathcal{H}$, but a family of two functions
$$
X = \{ X\_... |
19,440,525 | I have a bean whose business logic loads beans of a certain type from the ApplicationContext in order to process them.
For my jUnit tests, I would like to create some dummy beans within my unit test class and see if my bean under test properly processes them. However, I am not sure what the best way to accomplish this... | 2013/10/18 | [
"https://Stackoverflow.com/questions/19440525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/827480/"
] | You need to make your inner class `static`; Spring can't instantiate a non-`static` inner class as a bean. If there really is a valid reason why it needs to be non-`static`, you could create it manually in an `@Bean` method. |
724,698 | I have genuine windows 10 in my lappy. I tried to dual boot with Ubuntu but accidentally I replaced my windows with ubuntu. So now I have only ubuntu in my pc and I lost my genuine windows. How to get back my windows OS.I dont even have my back up image of my windows | 2016/01/23 | [
"https://askubuntu.com/questions/724698",
"https://askubuntu.com",
"https://askubuntu.com/users/496793/"
] | If you really deleted the Windows partition, Ubuntu is not going to get it back for you. Sorry.
Not knowing if this computer originally came with Windows 10, I will make the assumption it's fairly new and did. You could post more info per <https://askubuntu.com/help/how-to-ask> :>)
When you start there should be a re... |
148,438 | My home’s A/C has an external circuit breaker. Do I need to switch it off for the winter? | 2018/10/10 | [
"https://diy.stackexchange.com/questions/148438",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/44694/"
] | There is no need to switch off the external breaker serving the outside condensing unit. I have never done so in 40 years at our house. I have never heard of anyone doing so, and I have never heard it recommended. In our installation the external box adjacent to the condensing unit contains a double pole switch, not a ... |
29,619,208 | I implement `GoogleApiClient` as bellow:
```
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, 0 /* clientId */, this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addConnectionCallbacks(this)
.bu... | 2015/04/14 | [
"https://Stackoverflow.com/questions/29619208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3205503/"
] | I had the same problem. All I did to solve it is remove `.enableAutoManage(this, 0 /* clientId */, this)` because it just doesn't work properly from what I assumed. Then, override these methods in your activity:
```
@Override
public void onStart() {
super.onStart();
if (mGoogleApiClient != null) {
mGoo... |
13,250,030 | I'm using this CoverFlow :
<http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html>
I want to be able to change View when I click on a button, the button being a back/forward icon which will take you to the previous/next item in the coverflow.
I have modded the coverflow slightly so that I use an XML lay... | 2012/11/06 | [
"https://Stackoverflow.com/questions/13250030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1067944/"
] | While I was trying to find out how to add the animation I came across this which does everything in just one line :
go left
`coverFlow.onKeyDown(KeyEvent.KEYCODE_DPAD_LEFT, new KeyEvent(0, 0));`
go right
`coverFlow.onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT, new KeyEvent(0, 0));`
(just add each line to their respectiv... |
38,378,060 | I have data which is represented as a list of positive double numbers, and a list containing the intervals which will be used to group the data. The interval is always sorted.
I tried to group the data with the following implementation
```
List<Double> data = DoubleStream.generate(new Random()::nextDouble).lim... | 2016/07/14 | [
"https://Stackoverflow.com/questions/38378060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3212878/"
] | Use a [`TreeSet.ceiling()`](https://docs.oracle.com/javase/8/docs/api/java/util/TreeSet.html#ceiling-E-) to find the "group" boundary value.
*Example*
```
TreeSet<Double> groups = new TreeSet<>();
groups.add( 5d); // [-Inf, 5]
groups.add(10d); // ] 5, 10]
groups.add(15... |
32,537,729 | I installed libsql-translator-perl on Ubuntu 15.04 and ran it with
```
sqlt -f SQLite -t MySql /tmp/test.sql /tmp/out.sql
```
test.sql contains only this:
```
CREATE TABLE X (id INTEGER);
```
It failed with
```
Use of uninitialized value $name in pattern match (m//) at /usr/share/perl5/SQL/Translator.pm line 610... | 2015/09/12 | [
"https://Stackoverflow.com/questions/32537729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/458742/"
] | The error message tells you that `$name` is undefined; it is set to the first argument, i.e. the value of `$module` in `_load_sub`, which is set to the second captured match in `m/((.*)::)?(\w+)$/`: everything in the value of `$tool` before the first occurrence of `::`, if `::` occurs, and undefined otherwise.
So `$to... |
32,506,415 | I'm trying to load google font to my webapp (angular based but not relevant) and I'm getting this error:
```
Failed to decode downloaded font: https://fonts.googleapis.com/css?family=Open+Sans
```
The relevant part of my webpack.config.js is:
```
loaders: [
{test: /\.less$/, loader: "style!css!less", exclud... | 2015/09/10 | [
"https://Stackoverflow.com/questions/32506415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4470201/"
] | I'd suggest you have a look at this article by Paul Irish from 2009 named [Bulletproof @font-face syntax](http://www.paulirish.com/2009/bulletproof-font-face-implementation-syntax/)
It explains very well and in all detail how to get webfonts up and running across all (or at least all capable) browsers. |
15,746,542 | I have a problem with sorting my sentence values in descending order:
I typed this command in unix:
```
sort fileInput -t"(" -k2r >fileSort
```
Here's the input file:
```
comité de conciliation de décision du parlement européen et du (0.00098379)
les amendements CARD CARD CARD CARD CARD CARD et CARD (-0.00025... | 2013/04/01 | [
"https://Stackoverflow.com/questions/15746542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2215112/"
] | Add `-n` and `-g` options for numeric sort like this:
```
sort -t"(" -ngk2r
``` |
1,003,201 | Is there a way to list runtime-only (i.e. no `--permanent`) changes in firewalld? I would like to see a diff in my configuration to make sure no change will get lost in case of a `--reload`. | 2020/02/15 | [
"https://serverfault.com/questions/1003201",
"https://serverfault.com",
"https://serverfault.com/users/364632/"
] | as far as I can see no tool that offers you that possibility, but you can create it yourself.
I add a runtime acl to port 54/tcp:
```
# firewall-cmd --add-port=54/tcp
```
Then I can save the runtime rules to a file:
```
# firewall-cmd --list-all > /tmp/runtime_rules
```
And I save the permanent rules to another ... |
49,547,744 | I am trying to deploy Lambda functions using AWS Cloud9. When I press deploy, all of my functions are deployed/synced at the same time rather than just the one I selected when deploying. Same thing when right clicking on the function and pressing deploy. I find this quite annoying and wondering if there is any work aro... | 2018/03/29 | [
"https://Stackoverflow.com/questions/49547744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4718413/"
] | When you click deploy Cloud9 runs `aws cloudformation package` and `aws cloudformation deploy` on your `template.yaml` file in the background. (source: I developed the Lambda integration for AWS Cloud9).
Because all your files are bundled into one serverless application and there is only one CloudFormation stack they ... |
33,402,360 | I am attempting to create a random number generator for any number of numbers in a line and then repeating those random numbers until a "target" number is reached.
The user will enter both the number of numbers in the sequence and the sequence they are shooting for. The program will run the random numbers over and ove... | 2015/10/28 | [
"https://Stackoverflow.com/questions/33402360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5344823/"
] | The issue with your comparison is that you're testing `Target` which is a string against `num` which is a list of integers. That will never match, no matter what integers and what string you're dealing with. You need to compare two like-types to get a meaningful result.
It looks like you wanted your `getTarget` functi... |
38,356,333 | Another beginners question here, coming from Delphi you always have access to another forms controls but in my early days with C# / Visual Studio I am faced with a problem which is proving more difficult than it should be.
I have been getting started by writing a simple notepad style application, I have my main form a... | 2016/07/13 | [
"https://Stackoverflow.com/questions/38356333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4645457/"
] | The `editLineNumber` control is private. You can change it to be public, but that's discouraged.
Instead, create a property in `GoToForm` that returns the value you want.
```
public string LineNumber
{
get { return this.editLineNumber.Text; }
}
```
Now you can just reference your new property:
```
if (dialogRe... |
29,845,218 | I,m trying to write a regex to check if the given string is like
a + b, 2 + a + b, 3 + 6 \* 9 + 6 \* 5 + a \* b, etc...
Only + and \* operators.
I tried
`if (str.matches("(\\d|\\w \\+|\\*){1,} \\d|\\w"))`
Unfortunately it only handles cases like 3 \* 7 ... (numeric \* numeric).
Waiting for your answers, thanks fo... | 2015/04/24 | [
"https://Stackoverflow.com/questions/29845218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4807032/"
] | Put `*` and `+` inside a character class.
```
str.matches("\\w(?:\\s[+*]\\s\\w)+");
```
[DEMO](https://regex101.com/r/dI4uH0/2) |
66,436,586 | I have the below list :-
```
someList = ["one","three","four","five","six","two"]
```
I want to change position of "two" i.e after "one" and rest string should be shifted as they are.
Expected Output : -
>
> someList = ["one","two","three","four","five","six",]
>
>
> | 2021/03/02 | [
"https://Stackoverflow.com/questions/66436586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8048800/"
] | You can pop 2 from current index and insert to new index
```py
l.insert(1, l.pop(-1))
``` |
12,331,968 | I have code like this I need to access the `mysample` variable of static class `InnerClass` in the `getInnerS()` method which is inside the the `NestedClass`. I tried accessing it by creating a new object for `InnerClass` but i am getting `java.lang.StackOverflowError`.
```
public class NestedClass{
private Strin... | 2012/09/08 | [
"https://Stackoverflow.com/questions/12331968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1604151/"
] | In `InnerClass` constructor:
```
NestedClass a = new NestedClass();
```
So, you create a new `NestedClass`, which creates a new `InnerClass`, which creates itself its own `NestedClass`, with the corresponding `InnerClass`.... No wonder the stackoverflow.
If you want to access the enclosing class, you should use (i... |
4,402,482 | I can't get PHPMyAdmin to connect to my Amazon RDS instance. I've granted permissions for my IP address to the DB Security Group which has access to this database I'm trying to access. Here's what I'm working with...
```
$cfg['Servers'][$i]['pmadb'] = $dbname;
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookma... | 2010/12/09 | [
"https://Stackoverflow.com/questions/4402482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/197606/"
] | I found most of the answers in this question lack explanation. To add RDS server in phpMyAdmin installed in EC2, you can first login to your EC2 via SSH. Then, issue the following command to edit the Config file of phpMyAdmin (use `vi`, `nano` or any other favorite text editing tool):
```
sudo vi /etc/phpMyAdmin/confi... |
139,990 | If an algorithm for $SAT$ runs in $O(n^{\log n})$ time, and if $L$ belongs to $\mathsf{NP}$, is there an algorithm for $L$ that runs in $O(n^{\log n})$ time? | 2021/05/06 | [
"https://cs.stackexchange.com/questions/139990",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/136310/"
] | As $\mathrm{SAT}$ is $\mathrm{NP}$-complete, we know that there is a polytime reduction from our language $L$ to $\mathrm{SAT}$. However, this reduction can involve a polynomial blowup of the input size. This means that an input $w$ to $L$ could be mapped to a formula $\phi\_w$ such that $|\phi\_w| \approx |w|^k$ for s... |
8,305,527 | What is a regular expression to allow letters only, with no spaces or numbers, with a length of 20 characters?
Some examples of acceptable usernames:
```
ask1kew
supacool
sec1entertainment
ThatPerson1
Alexking
```
Some examples of unacceptable usernames:
```
No_problem1
a_a_sidkd
Thenamethatismorethen20charactersl... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8305527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/604023/"
] | This should work if you're limiting yourself to ASCII:
```none
/\A[a-z0-9]{,20}\z/i
```
That will also match an empty string though so you might want to add a lower limit (5 in this example):
```none
/\A[a-z0-9]{5,20}\z/i
```
If you wanted to be adventurous and allow non-ASCII letters and you're using Ruby 1.9 th... |
37,938,413 | Is there a function or something in laravel which I can use to make first letter uppercase in breadcrumbs?
This is what I'm using right now but in my links and routes are all lowercase letters and if I go and try to update all will be very time consuming..
```
<ul class="breadcrumb">
<li>
<i class="glyphicon gl... | 2016/06/21 | [
"https://Stackoverflow.com/questions/37938413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Yes and no.
It is not possible at the time of writing, if you want to do it only with browser client side javascript, because twitter does not allow cross site requests.
Browsers execute javascript code in a sandbox environment, which does not allow you to do a request to another domain as yours, except the 3rd par... |
4,022,426 | I am new to Iphone.How to create file browser in iphone ?
I wish to show all the files and folders in the iphone.How to do this? | 2010/10/26 | [
"https://Stackoverflow.com/questions/4022426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/482568/"
] | Unless you are on a jailbroken phone, your app can only access files within its own "sandbox".
There are [three folders](http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/RuntimeEnvironment/RuntimeEnvironment.html#//apple_ref/doc/uid/TP40007072-CH2-SW12) your app can acc... |
9,735,164 | How can I make `find` apply my shell's defined functions and aliases inside its *exec* parameter?
For example I have defined a function analogous to **bzip2** but using **7z**:
>
> function 7zip() { for f in $@; do ls -alF "$f"; 7za a -t7z -m0=lzma
> -mx=9 -mfb=64 -md=64m -ms=on "$f.7z" "$f" && touch -r "$f" "$f.7z... | 2012/03/16 | [
"https://Stackoverflow.com/questions/9735164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1069375/"
] | You can export a function definition with:
```
export -f 7zipi
```
but using an indentifier whose name begins with a number is asking for trouble. Try changing the name to something sensible. (eg "f7zipi", or "\_7zipi") |
34,352,840 | I am using an extendible hash and I want to have strings as keys. The problem is that the current hash function that I am using iterates over the whole string/key and I think that this is pretty bad for the program's performance since the hash function is called multiple times especially when I am splitting buckets.
*... | 2015/12/18 | [
"https://Stackoverflow.com/questions/34352840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4484809/"
] | You should prefer to use `std::hash` unless measurement shows that you can do better. To limit the number of characters it uses, use something like:
```
const auto limit = min(key.length(), 16);
for(unsigned i = 0; i < limit; i++)
```
You will want to experiment to find the best value of 16 to use.
I would ... |
3,412,699 | Suppose you have the product of two expressions: $ 2^5$ \* $ 2^2$, the result will be : $ 2^{5+2}$ = $ 2^7$. This is because we know the exponent rule that if they have the same base, we can add the power. Is there a way to express the product of two expressions of different bases and powers into 1 expression with one ... | 2019/10/28 | [
"https://math.stackexchange.com/questions/3412699",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/711602/"
] | No, the definition you gave is correct. Take for example $\mathbb N$ with discrete metric. Of course $\mathbb N$ is dense in it self. If you use $\mathcal B(x\_0,\varepsilon )\setminus \{x\_0\}$ instead of $\mathcal B(x\_0,\varepsilon )$, then when $\varepsilon <1$ and $n\in\mathbb N$, you'll get $$\mathcal B(n,\vareps... |
40,734,246 | Consider the following (simplified) example where two lambda functions call each other, one of which also takes another function as an argument. I need to use lambda functions, since the functions also pass modified, nested functions between each other.
```
#include <iostream>
using namespace std;
auto f = [](int n,... | 2016/11/22 | [
"https://Stackoverflow.com/questions/40734246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4114626/"
] | You need to capture the lambda inside `g` (or vice versa). `g` and `f` are variables which are **pointing** to a (unnamed) function. Making these lambdas doesn't make sense. Lambdas work best when you need a function in local scope. You will have to convert at-least one of them as a function and do a forward-declare fo... |
1,701 | Throughout both my academic and professional career I've encountered situations where in such roles (as most of us would have), where as a happy go lucky graduate who doesn't know it all (but thought I did) would attend meetings and I wouldn't know what certain industry terminology meant or understood certain aspects o... | 2017/08/12 | [
"https://interpersonal.stackexchange.com/questions/1701",
"https://interpersonal.stackexchange.com",
"https://interpersonal.stackexchange.com/users/2167/"
] | **Note**: as the question specifically aims at meetings, this answer aligns to that scenario.
You'll have to weigh up the problems you face, either look attentive and eager to learn by overcoming your fear of looking stupid or keep doing what you're currently doing. But, my advice is if someone knows and you don't, **... |
38,100,970 | I'm trying to figure out how to make an embedded video only readable by a specific player. Here's the context:
I have a website that hosts videos for streaming. All videos are private. My clients would like to be able to generate an embedding code snippet that would allow him to post this video to whichever site he de... | 2016/06/29 | [
"https://Stackoverflow.com/questions/38100970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1658211/"
] | What if we put something similar to the following on a .htacces file?
```
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)?my.domain\.com/.*$ [NC]
RewriteRule .*\.(mp4|avi)$ http://www.my.domain.com/forbidden.mp4 [R,NC,L]
# or serve a standard 403 forbidden error page
# Rewrit... |
6,825,198 | I have a large text string and about 200 keywords that I want to filter out of the text.
There are numerous ways todo this, but I'm stuck on which way is the best:
1) Use a for loop with a gsub for each keyword
3) Use a massive regular expression
Any other ideas, what would you guys suggest | 2011/07/26 | [
"https://Stackoverflow.com/questions/6825198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340939/"
] | A massive regex is faster as it's going to walk the text only once.
Also, if you don't need the text, only the words, at the end, you can make the text a Set of downcased words and then remove the words that are in the filter array. But this only works if you don't need the "text" to make sense at the end (usually fo... |
15,843,230 | i have an XML that we were able to generate using HAPI libraries and use XSL to change the format of the XML. I am using the following template. The current template looks at the OBX.5 segment for a digital value and then interprets the OBX6 (units of measure). However I am trying to also interpret the OBX6 when they c... | 2013/04/05 | [
"https://Stackoverflow.com/questions/15843230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/552782/"
] | **Use**:
```
tokenize(hl7:CE.1, '\^')[1]
```
**Here is a simple XSLT 2.0 - based verification:**
```
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="OBX.6">
<x... |
2,653,047 | So I'm trying to register for the MPMoviePlayerDidExitFullscreenNotification notification in my universal app (iPhone and iPad).
Problem is, OS 3.1.3 doesn't support this notification, and just crashes.
I've tried version checking, like so:
```
if ([MPMoviePlayerController instancesRespondToSelector:@selector(setSho... | 2010/04/16 | [
"https://Stackoverflow.com/questions/2653047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310175/"
] | Since MPMoviePlayerDidExitFullscreenNotification is a symbol, it must be known at (dynamic) link time for any versions. Run time check doesn't help.
To solve this, you need to delay loading of this to run time. You could use `dlsym`:
```
NSString* x_MPMoviePlayerDidExitFullscreenNotification
= dlsym(RTLD_DEFAULT, "... |
21,951,969 | In Eclipse, there is an option Export -> JAR File. Then we select desirable classes which want to export to output jar.
How can we do that in IntelliJ? | 2014/02/22 | [
"https://Stackoverflow.com/questions/21951969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2361910/"
] | I don't know if you need this answer anymore, but I had the same issue today and I figured out how to solve it.
Please, follow these steps:
1. File -> Project Structure (Ctrl + Alt + Shift + S);
2. Go to the "Artifacts" Menu -> click on the "+" button -> JAR -> From modules with dependencies...
3. Select the module yo... |
36,502,572 | ```
function convertToRoman(num) {
//seperate the number in to singular digits which are strings and pass to array.
var array = ("" + num).split(""),
arrayLength = array.length,
romStr = "";
//Convert the strings in the array to numbers
array = array.map(Number);
//Itterate over every number i... | 2016/04/08 | [
"https://Stackoverflow.com/questions/36502572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5950725/"
] | It seems to me your problem is in the use of `array.indexOf(array[i])` to calculate the power. Guess what, if you have the same value in your array twice, **the first found index is returned**, not the index of your *current* element.
Guess what the index of your current element actually is? → `i`
No need for `ind... |
28,828,145 | I got a table named "Stock" as shown below.
```
+-----------+--------------+---------------+---------+
| client_id | date | credit | debit|
+-----------+--------------+---------------+---------+
| 1 | 01-01-2015 | 50 | 0 |
| 2 | 01-01-2015 | 250 | ... | 2015/03/03 | [
"https://Stackoverflow.com/questions/28828145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4608311/"
] | Here how you can do it..
```
select
s.client_id,
s.date,
s.op_balance as Open_Balance,
s.credit,
s.debit,
s.balance
from
(
select
t.client_id,
t.date,
t.credit,
t.debit,
@tot_credit := if(@prev_client = t.client_id, @tot_credit + t.credit,t.credit) as tot_cred,
@tot_debit := if(@prev_client = t.client_... |
3,241,286 | The problem is to solve this:
$$a^2 + b^2 =c^4 \text{ }a,b,c\in \Bbb{N}\text{ }a,b,c<100$$
My idea: To see this problem I at first must see idea with Pythagorean triplets, and to problem is to find hypotheses of length square number. Is there any easier approach to this problem? | 2019/05/27 | [
"https://math.stackexchange.com/questions/3241286",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/259483/"
] | I think, the way with using Pythagorean triplets is the best.
Let $\gcd(a,b,c)=1$.
Thus, there are natural $m$ and $n$ with different parity such that $m>n$ and $\gcd(m,n)=1$ and
$a=2mn,$ $b=m^2-n^2$.
Thus, $c^2=m^2+m^2$ and by the same way there are naturals $p$ and $q$ with a different parity, such that $p>q$, $\g... |
41,411,432 | Simple Code:
```
<div id="right">
<h2>Zamiana jednostek temperatury</h2>
temperatura w <sup>o</sup>Celsjusza<br>
<input type="text" id="cyfry" name="cyfry"><br>
<button onclick="fahrenheit()">Fahrenheit</button>
<button onclick="kelwin()">Kelwin</button>
<span id="w... | 2016/12/31 | [
"https://Stackoverflow.com/questions/41411432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7361359/"
] | You should use document.getElementById **not** Document.getElementById . Heres a working solution. Hope it helps!
```js
function fahrenheit(){
var x=document.getElementById("cyfry");
parseInt(x);
x = (x*1,8)+32;
document.getElementById("wynik").innerHTML=x;
}
function kelwin(){
var x=documen... |
15,760,336 | These two views are inside of `RelativeLayout`. The IDE throws an error there is no `@id/et_pass`, but if I set `@+id/et_pass` it is OK. Why is that?
```
<ImageView
android:id="@+id/devider_zero"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/et_pass... | 2013/04/02 | [
"https://Stackoverflow.com/questions/15760336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/397991/"
] | You did not allocate any memory for the pointer to point at. You can do so like this:
```
int *a = malloc(sizeof(*a));
```
or like this:
```
int value;
int *a = &value;
```
If you allocate with `malloc` then you'll want to call `free` on the pointer when you are finished using it.
Accessing an uninitialized poin... |
65,854,355 | I'm doing a project and I'm having problems moving files into different subfolders. So for example, I have 2 files in the main folder, I want to read the first line, and if the first line has the word "Job", then I will move to the subfolder (main\_folder/files/jobs). My code looks like this:
```
# Get all file names ... | 2021/01/23 | [
"https://Stackoverflow.com/questions/65854355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11639529/"
] | The error happens because you are trying to move a file while it is active and being read inside the `with` statement. The problem should be fixed if you un-indent the `if` statement by one layer. This should close the file and allow it to be moved. Here is the code:
```
# Read files and separate them
def categorize_f... |
14,138,188 | [the error and the class http://puu.sh/1ITnS.png](http://puu.sh/1ITnS.png)
When I name the class file Main.class, java says it has the wrong name, and when I name it shop.Main.class it says that the main class can't be found. Can anyone help?
```
package shop;
import java.text.DecimalFormat;
public class Main
{
... | 2013/01/03 | [
"https://Stackoverflow.com/questions/14138188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1774214/"
] | keep it Main.class and try `java shop.Main` from command line in java folder |
44,135,248 | I am trying to retrieve data from excel and put them into the following format in python:
```
dataset={
'User A': {'Lady in the Water': 2.5,
'Snakes on a Plane': 3.5,
'Just My Luck': 3.0,
'Superman Returns': 3.5,
... | 2017/05/23 | [
"https://Stackoverflow.com/questions/44135248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7677413/"
] | The `pandas` module makes this pretty easy:
```
import pandas as pd
df = pd.read_excel('workbook.xlsx', index_col=0)
dataset = df.to_dict()
```
In this code the `pd.read_excel` function collects all data from the excel file and stores it into a pandas [DataFrame](https://pandas.pydata.org/pandas-docs/stable/dsintro.... |
28,645 | I'm developing a finite volume solver for the simple twodimensional advection equation with constant velocities $u, v$ and constant mesh spaces $\Delta x$:
$$ \frac{\partial \rho}{\partial t} + u \frac{\partial \rho}{\partial x} + v \frac{\partial \rho}{\partial y} = 0$$
where $u,v > 0$.
According to [this lecture](h... | 2018/01/18 | [
"https://scicomp.stackexchange.com/questions/28645",
"https://scicomp.stackexchange.com",
"https://scicomp.stackexchange.com/users/26461/"
] | It turns out that the main problem here was that I thought just naively extending the 1D advection
$$ \rho^{n+1}\_{i} = \rho^n\_{i} + u\frac{\Delta t}{\Delta x}(\rho^n\_{i-1/2} - \rho^n\_{i+1/2}) $$
to 2D just by adding the $y$ term like this:
$$ \rho^{n+1}\_{i,j} = \rho^n\_{i,j} + u\frac{\Delta t}{\Delta x}(\rho^n\_... |
21,107,057 | Is it possible automatically add `Access-Control-Allow-Origin` header to all responses which was initiated by ajax request (with header `X-Requested-With`) in Pyramid? | 2014/01/14 | [
"https://Stackoverflow.com/questions/21107057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813758/"
] | I've solved the problem using `set_request_factory`:
```
from pyramid.request import Request
from pyramid.request import Response
def request_factory(environ):
request = Request(environ)
if request.is_xhr:
request.response = Response()
request.response.headerlist = []
request.response.... |
811,624 | I saw this definition in one of the computer science book but I am unable to recall the theorem name. Can someone please provide the reference?
$$\lim\_{n \to \infty} \frac{f(n)}{g(n)} = c > 0$$ means there is some $n\_{0}$ beyond which the ratio is always between $\frac{1}{2}c$ and $2c$. | 2014/05/27 | [
"https://math.stackexchange.com/questions/811624",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/20411/"
] | Notice that $\|Ax\| \le \|x\|$. So $\sigma(A)$ is contained in the closed unit disk $D^{c}$. To find the resolvent $(A-\lambda I)^{-1}$, try to solve $(A-\lambda I)x = y$ for $x$, and see if it can be done. First, see if there are any eigenfunctions $Ax=\lambda x$. If there were such an $x$, then $|\lambda| \le 1$ and ... |
44,702,855 | We are trying to run rbenv on El-Capitan 10.11.6. When we try to run rbenv command in the terminal we got the following error message:
```
command not found
```
We googled how to solve that issue and one possible solution is to add the "rbenv" to the system PATH, we followed the steps stated in [this link](http://ar... | 2017/06/22 | [
"https://Stackoverflow.com/questions/44702855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3732958/"
] | Assuming your source is stored in `exampleScriptFile`:
```js
// polyfill
const fs = { readFileSync() { return 'console.log(`${EXAMPLE_3}`);'; } };
// CONSTANTS
const EXAMPLE_1 = 'EXAMPLE_1';
const EXAMPLE_2 = 'EXAMPLE_2';
const EXAMPLE_3 = 'EXAMPLE_3';
const exampleScriptFile = fs.readFileSync('./exampleScript... |
422,828 | I need to make the word "Table" within paragraph clickable.
I have tried this [When referencing a figure, make text and figure name clickable](https://tex.stackexchange.com/questions/230828/when-referencing-a-figure-make-text-and-figure-name-clickable). But I got "???" instead.
[=k>0$ for all $x$. |
56,565,986 | I have a dataframe with full of ip addresses.
I have a list of ip address that I want to remove from my dataframe.
I wanted to have a new dataframe "filtered\_list" after all the ip addresses are removed according to "lista".
I saw an example at [How to use NOT IN clause in filter condition in spark](https://stackov... | 2019/06/12 | [
"https://Stackoverflow.com/questions/56565986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9272452/"
] | You could use the except method on dataframe.
```
var df = Seq("119.73.148.227", "42.61.124.218", "42.61.66.174", "118.201.94.2","118.201.149.146", "119.73.234.82", "42.61.110.239", "58.185.72.118", "115.42.231.178").toDF("ipAddress")
var lista = Seq("119.73.148.227", "118.201.94.2").toDF("ipAddress")
var onlyWanted... |
316,791 | I am getting the following error when I try to connect to a Minecraft server:
[](https://i.stack.imgur.com/31C7S.jpg)
This is all servers, not just one.
The error says:
>
> io.netty.channel.AbstractChannel$AnnotatedConnectException: ... | 2017/08/23 | [
"https://gaming.stackexchange.com/questions/316791",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/195593/"
] | I have the same error on my local network, it looks like a firewall issue on the host/server side. For me, to troubleshoot I used [nmap](https://nmap.org/). The LAN game showed up in multiplayer as 10.0.0.21:49299. nmap reported that port from that IP as closed/filtered; i.e. a firewall issue.
To confirm it is a firew... |
20,848,810 | I've read many articles and posts about executing NAnt scripts using TFS build, none of which have satisfied my needs.
I have a NAnt script that has been developed over the years to automatically build, test and deploy our websites to an internal staging and external demo environments.
Usually, the team has been so s... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20848810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/767428/"
] | Here is how you can do it:
1) Download Nant.exe from <http://sourceforge.net/projects/nant/files/> and check-in the bin directory which has Nant.exe.
2) Create a msbuild file (say msbuild.proj) with following code(change Path) and check-in the file.
```
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/... |
36,294,466 | UDF:
```
bigquery.defineFunction(
'newdate', // Name of the function exported to SQL
[], // Names of input columns
[
{name: 'date', type: 'timestamp'}
, {name: 'datestr', type: 'string'}
],
function newDate(row, emit) {
var date = new Date(); // curre... | 2016/03/29 | [
"https://Stackoverflow.com/questions/36294466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2259571/"
] | That's an unfortunate oversight on our part.
Many Google servers run using Pacific time (semi-jokingly referred to as "Google standard time"). When launching BigQuery, we tried to standardize on UTC instead, but we missed this case. We may try to find an opportunity to fix it, but unfortunately we risk breaking existi... |
62,753,397 | I write button.xml and qweb in **manifest**.py but it not worked.
button.xml (static/src/xml/button.xml)
```
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="after">
<button name="xxx" type="button" t-if='wid... | 2020/07/06 | [
"https://Stackoverflow.com/questions/62753397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13876116/"
] | The first thing I notice is that you are iterating through `i in range(0, int(pages))`, however, the pages only start on line 1 (line 0 consists of n & q).
So your for loop should like more like (you also want to do +1 because you want to count the last page, otherwise python only goes 'uptil but not including'):
```... |
69,139,132 | I'm using the weightloss dataset:
```
structure(list(id = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L), .Label = c("1", "2",
"3", "4", "5", "6",... | 2021/09/11 | [
"https://Stackoverflow.com/questions/69139132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16631565/"
] | ```
Icon(
Icons.add_circle_outline,
color: Colors.white,
size: 30,
),
```
You can use flutter built in icon. |
39,559,845 | I have the following transaction:
```
typedef enum {READ = 0, WRITE = 1} direction_enum;
//Transaction
class axi_transaction extends uvm_sequence_item();
bit id = 0; //const
bit [31:0] addr;
bit [2:0] size = 0'b100;//const
direction_enum rw;
bit [31:0] transfers [$];
//factory registration
`u... | 2016/09/18 | [
"https://Stackoverflow.com/questions/39559845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6465067/"
] | You cannot add arguments to the class constructor when using the UVM factory. In general this is not good OOP programing practice for re-use because if you do add arguments to either the base class or extended class, you have to modify every place where the class gets constructed.
A better option is to use the uvm\_co... |
61,717,941 | I have configured the connection to IBM MQ using application properties. As below,
```
ibm.mq.conn-name=localhost(1415)
ibm.mq.queue-manager=QMGR
ibm.mq.channel=QMGR.SVR.CON.C
ibm.mq.user=xxxxx
ibm.mq.password=xxxxx
```
I have class annotated @service which has method as below that reads messages from queue,
```
@S... | 2020/05/10 | [
"https://Stackoverflow.com/questions/61717941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9180615/"
] | As @JoshMc suggested, you should use a `JmsListener`.
There is good [JMS Getting Started Guide](https://spring.io/guides/gs/messaging-jms/) from Spring. For you it will look like this (definition for `myFactory` you can see in the mentioned Spring guide):
```
package hello;
import org.springframework.jms.annotation.... |
30,223,119 | I would like to know how to create a clickable button in HTML format that sits on in the center of a header image.
I have tried to use the button tags along with the href attribute along with the img tags to try to wrap the code around the desired image but it doesn't work. An example of the result that I am trying to... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30223119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4897118/"
] | You need to call `WebView.enableSlowWholeDocumentDraw()` before creating *any* WebViews in your app.
That is, if you have a WebView somewhere in your static layout, make sure you call `WebView.enableSlowWholeDocumentDraw()` before your first call to `setContentView()` that inflates a layout with WebView.
Also make s... |
3,130,701 | How to kill a running thread in java | 2010/06/28 | [
"https://Stackoverflow.com/questions/3130701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/297115/"
] | You can ask the thread to interrupt, by calling [`Thread.interrupt()`](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#interrupt%28%29)
Note that a few other methods with similar semantics exist - `stop()` and `destroy()` - but they are *deprecated*, because they are [unsafe](http://java.sun.com/j2se/1.5... |
36,425,945 | I want to display picture from access and show that on a form in vb.net
I have this for display information:
```
info.TextBox5.Text = DataGridView1.SelectedRows(0).Cells(5).Value
```
Now I tried something like this for pictures:
```
info.PictureBox1.Image = DataGridView1.SelectedRows(0).Cells(6).Value
```
But I ... | 2016/04/05 | [
"https://Stackoverflow.com/questions/36425945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5433094/"
] | Based on Google Maps [docs](https://developers.google.com/maps/faq#usage-limits):
>
> Excess usage over the complimentary quota for each Google Maps API
> service is calculated at the end of each day.
>
>
> Web service APIs offer 2,500 free requests per day. If you enable
> billing to access higher quotas, once y... |
163 | I was tasked with figuring out whether carbon or nitrogen has a more negative electron affinity value. I initially picked nitrogen, just because nitrogen has a higher $Z\_\mathrm{eff}$, creating a larger attraction between electrons and protons, decreasing the radius, causing a higher ionization energy, and therefore d... | 2012/04/29 | [
"https://chemistry.stackexchange.com/questions/163",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/85/"
] | This exception rule is actually orbital filling rule. For two electrons to be in same orbital they need to have different spins (Pauli exclusion principal). This electron pairing requires additional energy and thus it is easier to add electrons if there are free orbitals. When element has a half-filled p sublevel all 3... |
36,105,068 | I am currently learning Meteor and I found out something that intrigued me.
I can load HTML and CSS assets from a JS file using the import statement.
```
import '../imports/hello/myapp.html';
import '../imports/hello/myapp.css';
import * as myApp from '../imports/hello/myapp.js';
```
This was a surprise to me so I ... | 2016/03/19 | [
"https://Stackoverflow.com/questions/36105068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/400544/"
] | After going through the implementation of the built files for my app
I found out why this works.
**HTML**
Files are read from the file system and their contents added to the global Template object, e.g.,
```
== myapp.html ==
<body>
<h1>Welcome to Meteor!</h1>
{{> hello}}
</body>
```
results in the following J... |
3,852,932 | I am working application in which i calling `presentModalViewController` and once finished(calling `dismissModalViewControllerAnimated:YES`) it should immediately call `popToRootViewControllerAnimated`.
But the issue is `dismissModalViewControllerAnimated:YES` is working properly but `popToRootViewControllerAnimated`i... | 2010/10/04 | [
"https://Stackoverflow.com/questions/3852932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/384150/"
] | Try something like this:
```
[self.navigationController dismissModalViewControllerAnimated:YES] ;
[self performSelector:@selector(patchSelector) withObject:nil afterDelay:0.3];
-(void)patchSelector{
[self.navigationController popToRootViewControllerAnimated:YES];
}
```
It is not so neat but it should work.
**UP... |
58,369,989 | Need help passing state as a prop to another state component. I'm very new to React and I'm not sure what I'm doing wrong. When I console.log inside the Timer component it displays undefined but when I console.log in the Main component it displays the object perfectly.
```
class Main extends React.Component {
const... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58369989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6383688/"
] | @tlrmacl might have answered it there. It's missing the `this` keyword. In theory, you might be assigning the initial value still to the state.
It is due to how react lifecycle works
On your `componentDidMount()`, you are calling setState after the jsx gets mounted to the DOM. `this.state.itemsP` is given an initial ... |
52,436,015 | I'm trying to mimic the Web Audio API multitrack demo from the 'Mozilla Web Audio API for games' Web doc.
<https://developer.mozilla.org/en-US/docs/Games/Techniques/Audio_for_Web_Games#Web_Audio_API_for_games>
The only caveat I have is that I want the previous track to stop, once a new track is clicked (instead of pl... | 2018/09/21 | [
"https://Stackoverflow.com/questions/52436015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10241361/"
] | Simply store the BufferSources somewhere in the outer scope and then call their `stop()` method.
I took the liberty to rewrite a bit your loading logic, you shouldn't create a new request every time you start a new track, in that case you loose the main advantages of AudioBuffers against Audio element: they're truly f... |
34,538,571 | I am trying run cucumber tests using maven with following command
```
mvn test -Dcucumber.options="--tag @debug1"
```
This command works fine, however if i try something like following, i get error
```
mvn test -Dcucumber.options="--tag @debug1 @debug2"
```
Is there a way to pass in multiple tag names with cucumb... | 2015/12/30 | [
"https://Stackoverflow.com/questions/34538571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3062121/"
] | * To run scenarios with `@debug1` and `@debug2`:
**Old version of Cucumber-jvm:**
```
mvn test -Dcucumber.options="--tags @debug1 --tags @debug2"
```
**Actual version of Cucumber-jvm:**
```
mvn test -Dcucumber.options="--tags '@debug1 and @debug2'"
```
* To run scenarios with `@debug1` or `@debug2`:
**Old versi... |
9,803,396 | I am looking for a lightweight, reliable and fast key/value database for storing binary data. Simple without server. Most of popular key/value databases like CDB and BerkeleyDB does not natively store `BLOB`. What can be the best choice that I missed?
My current choice is SQLite, but it is too advanced for my simple u... | 2012/03/21 | [
"https://Stackoverflow.com/questions/9803396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/943340/"
] | As it was previously pointed out, BerkeleyDB does support opaque values and keys, but I would suggest a better alternative: LevelDB.
**LevelDB:**
Google is your friend :), so much so that they even provide you with an embedded database: [A fast and lightweight key/value database library by Google.](https://github.com... |
2,225,263 | Suppose I have a simple table, like this:
```
Smith | Select
Jones | Select
Johnson | Select
```
And I need to write a Selenium test to select the link corresponding to Jones. I can make it click the "Select" in the 2nd row, but I would rather have it find where "Jones" is and click the corresponding "Sele... | 2010/02/08 | [
"https://Stackoverflow.com/questions/2225263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16012/"
] | Use an xpath expression like "//tc[.//text() = 'Jones']/../tc[2]/a" which looks for a table cell whose text contents are 'Jones' and then naviagates up to that cells parent, selects the second table cell of that parent, and then a link inside the second table cell. |
117,095 | **Your task:**
Find the most efficient mowing path around the dark green bushes that mows (passes over) all of the grass (light green).
[](https://i.stack.imgur.com/hSmSr.png)
---
For those who cannot view the image above, there are 9 rows of 16,... | 2022/07/15 | [
"https://puzzling.stackexchange.com/questions/117095",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/463/"
] | >
> **Optimal : 111 moves**
>
>
>
> [](https://i.stack.imgur.com/cqYPf.png)
>
>
>
> [Visual of path](https://i.stack.imgur.com/WiFNJ.png)
>
>
>
Others of the same length exist, such as [this](https://i.stack.imgur.com/8daZH.png), [th... |
135,851 | Related to [Poker Hand Evaluator](https://codereview.stackexchange.com/questions/135649/poker-hand-evaluator). This it **not** the same. This is take best from all combinations of 7. The other is all combinations of 5.
Poker is 52 cards - 4 suits and 13 ranks:
* Texas holdem
* Hand is exactly 5 cards
* Order of hands... | 2016/07/25 | [
"https://codereview.stackexchange.com/questions/135851",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/105946/"
] | When checking for a flush, instead of looping through the cards 4 times, you could have an array of length 4 where each position represents a suit. Then loop over the 7 cards one time and use a switch statement to increment the element that corresponds to the suit. Then loop over the array and check if any of the eleme... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.