qid int64 1 74.7M | question stringlengths 0 70k | date stringlengths 10 10 | metadata list | response stringlengths 0 115k |
|---|---|---|---|---|
13,831,447 | The Ocaml manual contains an exercise ([here](http://caml.inria.fr/pub/docs/manual-ocaml-4.00/manual003.html#toc11)) in which library object files are loaded in the toplevel loop (the ocaml interactive interpreter) in the following way:
```
#load "dynlink.cma";;
#load "camlp4o.cma";;
```
I'm trying to replicate the ... | 2012/12/12 | [
"https://Stackoverflow.com/questions/13831447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896328/"
] | I'm assuming your source is written using extensions implemented by camlp4o. To compile your source, you can say:
```
ocamlc -pp camlp4o -o myfile myfile.ml
```
I believe the complexities of the #load command are required only when you want to use the extensions in the toplevel (the interpreter). |
55,678,914 | Let's say I have a number from user, for exemple: 456789.
I know how to print in reverse the number, but I am not sure how I can stop the execution to print only 3 first reversed digits.
What I mean is that I want to print only 987 from the given number
I have to stop somehow with break; but I am not sure how.
```
p... | 2019/04/14 | [
"https://Stackoverflow.com/questions/55678914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11301177/"
] | You could follow this algo:
1. modulo the number by 1000
2. reverse it
3. print |
779,898 | How can I pass a arbitrary number of arguments to the class constructor using the Object() function defined below?
```
<?php
/*
./index.php
*/
function Object($object)
{
static $instance = array();
if (is_file('./' . $object . '.php') === true)
{
$class = basename($object);
if (array_ke... | 2009/04/23 | [
"https://Stackoverflow.com/questions/779898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89771/"
] | ```
$klass = new ReflectionClass($classname);
$thing = $klass->newInstanceArgs($args);
```
Although the need to use reflection suggests that you are overcomplicating something in your design. Why do you want to write this function in the first place? |
14,063,072 | So I would like to do a select from an SQL database, using Java, subject to a conditional statement (less than or equal to something) subject to some loop in Java. In other words, something like the following:
```
for (int i=0; i< 195; i++) {
// Get the results of the SQL query
resultSet = stat... | 2012/12/28 | [
"https://Stackoverflow.com/questions/14063072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1849003/"
] | The SQL statement is parsed and run in a different environment than your Java code - different language, different scope, and unless you use SQLite they run in different processes or even different machines. Because of that, you can't just refer to the Java variable `i` from your SQL code - you have to either inject it... |
98,812 | I seek a reference for the fact that "coefficients of the Hirzebruch $L$-polynomial have odd denominators". The coefficients are
$$\frac{2^{2k}(2^{2k-1}-1)B\_k}{(2k)!}$$ where $B\_k$ is the Bernoulli number, but I cannot locate the appropriate divisibility property of $B\_k$. Of course, $2^{2k-1}-1$ is odd, so it can b... | 2012/06/04 | [
"https://mathoverflow.net/questions/98812",
"https://mathoverflow.net",
"https://mathoverflow.net/users/1573/"
] | This follows from the Clausen - von Staudt theorem. See <http://www.bernoulli.org> (structure of the denominator) |
9,287,960 | I currently have this code that parses imdbAPI http returns:
```
text = 'unicode: {"Title":"The Fountain","Year":"2006","Rated":"R","Released":"22 Nov 2006","Genre":"Drama, Romance, Sci-Fi","Director":"Darren Aronofsky","Writer":"Darren Aronofsky, Darren Aronofsky","Actors":"Hugh Jackman, Rachel Weisz, Sean Patrick Th... | 2012/02/15 | [
"https://Stackoverflow.com/questions/9287960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1176502/"
] | ```
>>> ast.literal_eval(text.split(' ', 1)[1])
{'Plot': 'Spanning over one thousand years, and three parallel stories, The Fountain is a story of love, death, spirituality, and the fragility of our existence in this world.', 'Votes': '100139', 'Rated': 'R', 'Response': 'True', 'Title': 'The Fountain', 'Poster': 'http:... |
52,466,555 | I want to find (or make) a python script that reads a different python script line by line and prints the commands executed and the output right there after.
Suppose you have a python script, `testfile.py` as such:
```
print("Hello world")
for i in range(3):
print(f"i is: {i}")
```
Now, I want a different pyth... | 2018/09/23 | [
"https://Stackoverflow.com/questions/52466555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/997253/"
] | [`code.InteractiveConsole.interact`](https://docs.python.org/3/library/code.html#code.InteractiveConsole.interact) does exactly what is asked. |
30,205,906 | I have been using oauth 2.0 with Linkedin as the provider. Now as of today suddenly the authentication is no longer working. Looked on Linkedin its API profile page and figured that they have been updating their program.
The error that I am getting is the following:
>
> No 'Access-Control-Allow-Origin' header is pr... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30205906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2164689/"
] | LinkedIn February 12th 2015 update effects LinkedIn applications between May 12th - May 19th, 2015. Maybe, your application affected today.
I'm getting error after updating. Your application has not been authorized for the scope "r\_fullprofile". The update affected somethings.
<https://developer.linkedin.com/support... |
50,886,900 | I'm trying to make a test for some of my students where they need to type in missing words from a paragraph (see picture). The key problem I'm hitting is trying to embed input boxes into a text paragraph, so that when there is a gap, tkinter can make an entry box for the student to type in.
Sketch of desired Output:
... | 2018/06/16 | [
"https://Stackoverflow.com/questions/50886900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9181800/"
] | You can add widgets to a text widget with the `window_create` method.
Here's a quick example to show how you can use it to embed widgets into a block of text. The code inserts a string that contains `{}` wherever you want an entry widget. The code then searches for that pattern in the widget, deletes it, and inserts ... |
14,527,237 | We have a website running and my boss wanted to use a WordPress website as a cover.
I am trying to create a log in in WordPress using our existing user database. So that when the user log in in WordPress, they will be redirect to our current website.
Any suggestions on how should I approach this?
I tried using jQuer... | 2013/01/25 | [
"https://Stackoverflow.com/questions/14527237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2011844/"
] | Thanks, I've found the problem.
My resource identifier `R.id.listItem_date` is declared as `@+id/listItem.date` in my resource xml file.
Android seems to convert the "." in the name to an "\_" in the generated R file. This works fine when compiling and running the code but apparently robolectric has problems with thi... |
29,252,113 | I am using [PredicateBuilder](http://www.albahari.com/nutshell/predicatebuilder.aspx) to build reusable expressions as return values of objects. For example:
```
public interface ISurveyEligibilityCriteria
{
Expression<Func<Client, bool>> GetEligibilityExpression();
}
```
I want to have automated tests that dete... | 2015/03/25 | [
"https://Stackoverflow.com/questions/29252113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1860652/"
] | You can create a LINQ statement containing the expression and then check whether it can be translated without actually executing it:
```
var connString = @"server=x;database=x";
using(var db = new MyContext(connString))
{
// ToString() shows the generated SQL string.
var sql = db.Entities.Where(generatedExpres... |
35,828,328 | I am using Swashbuckle (swagger for C#) with my Web API. I have several GET End-Points that return lists and I allow the user to add a perpage and page params into the QueryString
Example: <http://myapi.com/endpoint/?page=5&perpage=10>
I see that swagger does support parameter in 'query' but how do I get Swashbuckle ... | 2016/03/06 | [
"https://Stackoverflow.com/questions/35828328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4202984/"
] | You can achieve that quite easily. Suppose you have an `ItemsController` with an action like this:
```
[Route("/api/items/{id}")]
public IHttpActionResult Get(int id, int? page = null, int? perpage = null)
{
// some relevant code
return Ok();
}
```
Swashbuckle will generate this specification (only showing rel... |
34,870 | My pro tools version is HD 10.3.7.
When I arm and start recording, everything is working, the meters going up, wave form is bulit.
And when I stop it, the wave form (aka. region) immediately disappears. This happens only to short recordings. (As far as my test goes, it happens to recordings under 4 seconds).
However,... | 2015/04/05 | [
"https://sound.stackexchange.com/questions/34870",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/11447/"
] | Try this:
click off pre-roll on transport window (CMND + 1) |
14,809,861 | I'm having trouble with reverse navigation on one of my entities.
I have the following two objects:
```
public class Candidate
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long CandidateId { get; set; }
....
// Reverse navigation
public virtual CandidateData Data { get; s... | 2013/02/11 | [
"https://Stackoverflow.com/questions/14809861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2056149/"
] | The One to One problem....
The issue is EF and CODE First, when 1:1 , for the dependent to have a Primary key that refers to the principal. ALthough you can define a DB otherwise and indeed with a DB you can even have OPTIONAL FK on the Primary. EF makes this restriction in Code first. Fair Enough I think...
TRy this ... |
65,797,290 | I need to ask the user for input on entering height and width to find perimeter and area while using the main function, I'm getting a simple error which is ( Area= (Width \* Height)
NameError: name 'Width' is not defined) but I've tried everything I know to fix it
```
print("Find the Area and Perimeter of a retangle."... | 2021/01/19 | [
"https://Stackoverflow.com/questions/65797290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Cant you define an `AnswerManager`, if you want answers filtered by section?
Maybe like this:
```py
class AnswerManager(models.Manager):
def answer_by_section(self, section):
if section:
return self.filter(questions__section__slug=section.slug)
class Answer(models.Model):
...
objects ... |
19,615,784 | I'm trying to run a simple batch file.
```
for /f %%a IN ('dir /b /s "%~dp0\EnsembleIndependant\*.mis"') DO (ECHO %%a >> ResultatVorace.txt & CALL vorace.exe -f %%a >> ResultatVorace.txt)
```
this only works if there is no space in the path of the batch file.
the batch is in:
C:\Users\Rafael\Documents\Visual Studi... | 2013/10/27 | [
"https://Stackoverflow.com/questions/19615784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2453139/"
] | ```
for /f "delims=" %%a IN ('dir /b /s "%~dp0EnsembleIndependant\*.mis"') DO (ECHO %%a >> ResultatVorace.txt & CALL vorace.exe -f %%a >> ResultatVorace.txt)
```
`%~dp0` has already a backspace at the end. |
4,764,553 | I want to create computer for the word-game [Ghost](http://en.wikipedia.org/wiki/Ghost_%28game%29). However, I'm having problems thinking of a good way to deal with accessing the huge word list. Here's my current implementation (which doesn't work):
```
import os, random, sys, math, string
def main():
#Contains ... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4764553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/372526/"
] | I would suggest not deleting words from your list. It will be extremely slow because deleting in the middle of a list is O(N).
It is better to just make a new list. One possible way to do this is to replace the lines
```
for line in wordlist:
if not line.startswith(word):
wordlist.remove(line)
```
with
... |
62,465,566 | I am trying to first upload images to firebase then retrieving in in an activity(gallery) but getting a code error.
```
@Override
public void onBindViewHolder(ImageViewHolder holder, int position) {
ImageUploaderAdapter uploadCurrent = mUploads.get(position);
holder.textViewName.setText(uploadCur... | 2020/06/19 | [
"https://Stackoverflow.com/questions/62465566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13607439/"
] | matchTemplate wont work well in this case, as they need exact size and viewpoint match.
Opencv Feature based method might work. You can try SIFT based method first. But the general assumption is that the rotation, translation, perspective changes are bounded. It means that for adjacent iamge pair, it can not be 1 tak... |
15,795,748 | I am hosting an ASP.NET MVC 4 site on AppHarbor (which uses Amazon EC2), and I'm using CloudFlare for Flexible SSL. I'm having a problem with redirect loops (310) when trying to use RequireHttps. The problem is that, like EC2, CloudFlare terminates the SSL before forwarding the request onto the server. However, whereas... | 2013/04/03 | [
"https://Stackoverflow.com/questions/15795748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1141679/"
] | The `X-Forwarded-Proto` header is intentionally overridden by AppHarbor's load balancers to the actual scheme of the request.
Note that while CloudFlare's flexible SSL option may add slightly more security, there is still unencrypted traffic travelling over the public internet from CloudFlare to AppHarbor. This arguab... |
27,343,087 | I am developing an application which requires the youtube api.
I am stuck at a point where i need the keywords of a youtube channel. I am getting all keywords in a string.
```
$string = 'php java "john smith" plugins';
```
I am trying to get the above keywords in an array. I can use `explode(' ',$string)` but the p... | 2014/12/07 | [
"https://Stackoverflow.com/questions/27343087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1015448/"
] | ```
char *get_set(int size, char *set){// size : size of set as buffer size
char ch;
int i;
for(i = 0; i < size-1 && (ch=getchar()) != '\n'; ){
if(!isspace(ch))
set[i++] = ch;
}
set[i] = '\0';
return set;
}
``` |
25,382,103 | I have created a Login page using MVC Razor. The page contains a User name & Password to be entered and two button Login and SignUp button.
I have applied required field validation for both textboxes. It works fine when i click Login button. For Signup button i want the page to be redirected to signup page. But when i... | 2014/08/19 | [
"https://Stackoverflow.com/questions/25382103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3211705/"
] | Take `Signup` button as **input type button** not **input type submit** as shown :-
```
<input type="button" value="SignUp" name="Command" class="loginBtn" id="SignUpBtn" />
```
and use some **Jquery/Javascript** to go to `SignUp Page` as :-
```
$("#SignUpBtn").click(function(){
window.location.href="/SignUp/Sig... |
11,838 | My website can only be accessed by authenticated users. How can I automatically make the author's name the user's name without giving users the option to input anything else in the name field? | 2011/09/22 | [
"https://drupal.stackexchange.com/questions/11838",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/1273/"
] | Custom datepicker options are now supported (as of Date module version 7.x-2.6) by setting the necessary values with `#datepicker_options`. Alex's use case of a custom form element to display only future dates would look like this:
```
$form['date'] = array(
'#prefix'=>t('When do you want to start the featured campa... |
2,646,463 | I have a XMLDocument like:
```
<Folder name="test">
<Folder name="test2">
<File>TestFile</File>
</Folder>
</Folder>
```
I want only the folder´s, not the files. So, how to delete / manipulate the XML Document in c# to delete / remove ALL elements in the document?
Thanks! | 2010/04/15 | [
"https://Stackoverflow.com/questions/2646463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298926/"
] | If you can use `XDocument` and LINQ, you can do
```
XDocument doc = XDocument.Load(filename) // or XDocument.Parse(string)
doc.Root.Descendants().Where(e => e.Name == "File").Remove();
```
-- edited out an error |
45,041,702 | My Application wants to Request for Wifi Permission on the start.So far I have managed to give permission through **Setting**.But I don't want to Do that anymore.So far I have seen this previous [Question](https://stackoverflow.com/questions/40301628/how-to-request-permissions-during-run-time-when-using-gluon-mobile-en... | 2017/07/11 | [
"https://Stackoverflow.com/questions/45041702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7315145/"
] | The Android Developers Website has a great walkthrough example on how runtime permissions work here:
<https://developer.android.com/training/permissions/requesting.html>
Also don't forget to add the permissions into your manifest as well. |
45,062,106 | So i have two different queries as follows:
```
Query1
CPT Resource 1 2 3 4 5
2017-06-12 RM1 5.00 5.00 4.00 4.00 2.00
2017-06-12 RM2 3.00 6.00 4.00 7.00 4.00
2017-06-12 RM3 3.00 4.00 6.00 8.00 6.00
2017-06-13 RM1 3.00 7.00 ... | 2017/07/12 | [
"https://Stackoverflow.com/questions/45062106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8249331/"
] | Just join for the key field and use `ABS()` to return a positive result.
```
SELECT Q1.CPT,
Q1.Resource,
ABS(Q1.[1] * Q2.[1]) as [1],
ABS(Q1.[2] * Q2.[2]) as [2],
ABS(Q1.[3] * Q2.[3]) as [3],
ABS(Q1.[4] * Q2.[4]) as [4],
ABS(Q1.[5] * Q2.[5]) as [5]
FROM Query1 Q1
JOIN Query2 ... |
31,903,819 | I am using in memory H2 database for my tests. My application is Spring Boot and I am having trouble when running a CTE (Recursive query) from the application.
From the H2 console the query works like a charm but not when it's called from the application (it returns no records, although they are there, I can see from ... | 2015/08/09 | [
"https://Stackoverflow.com/questions/31903819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1474815/"
] | H2 only support recursive CTE without named parameter. |
194,571 | What is the meaning of ''one block into'' in the below sentences? Which grammar rule ?
**You own a house one block into the ward.** | 2019/01/29 | [
"https://ell.stackexchange.com/questions/194571",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/88975/"
] | In the context of housing, a ***block*** is either a single (multi-storey) building containing multiple apartments / offices / etc., or a (usually rectangular) area between two pairs of intersecting roads, mostly or completely filled with buildings (houses / offices / shops / etc.).
And a ***ward*** usually refers to ... |
11,558,710 | Hi guys i have to pass the checked value from checkbox and selected value from DropDown,
my view looks like this
```
Project:DropDown
-----------------------------
EmployeeNames
--------------------------
checkbox,AnilKumar
checkBox,Ghouse
this... | 2012/07/19 | [
"https://Stackoverflow.com/questions/11558710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206468/"
] | use `android:gravity` like this:
```
TextView
android:id="@+id/gateNameText"
android:layout_width="0dip"
android:layout_height="match_parent"
android:gravity="center_vertical|center"
android:layout_weight=".7"
android:textSize="15dp" />
``` |
19,306,342 | My PHP code is this:
```
$userdetails = mysqli_query($con, "SELECT *FROM aircraft_status");
#$row = mysql_fetch_row($userdetails) ;
while($rows=mysqli_fetch_array($userdetails)){
$status[]= array($rows['Aircraft']=>$rows['Status']);
}
#Output the JSON data
echo json_encode($status);
```
and gives this:
```
[{"A... | 2013/10/10 | [
"https://Stackoverflow.com/questions/19306342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2840648/"
] | ```
echo json_encode($status, JSON_FORCE_OBJECT);
```
Demo: <http://codepad.viper-7.com/lrYKv6>
or
```
echo json_encode((Object) $status);
```
Demo; <http://codepad.viper-7.com/RPtchU> |
27,005,824 | I would like to construct a match spec to select the first element from a tuple when a match is found on the second element, or the second element when the first element matches. Rather than calling ets:match twice, can this be done in one match specification? | 2014/11/18 | [
"https://Stackoverflow.com/questions/27005824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/450706/"
] | Yes.
In [documentation](http://www.erlang.org/doc/man/ets.html#select-2) there is example of `is_integer(X), is_integer(Y), X + Y < 4711`, or `[{is_integer, '$1'}, {is_integer, '$2'}, {'<', {'+', '$1', '$2'}, 4711}]`.
If you are using `fun2ms` just write funciton with two clauses.
```
fun({X, Y}) when in_integer(X)... |
328,965 | I understand that Hamiltonian has to be hermitian. For a two level system, why does the general form of an Hamiltonian of a qubit have all real entries :
$$
\hat{H} = \frac{1}{2}\left( \begin{array}{cc} \epsilon & \delta \\ \delta & -\epsilon \end{array} \right)
$$
where $\epsilon$ as the offset between the potential e... | 2017/04/25 | [
"https://physics.stackexchange.com/questions/328965",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/75725/"
] | Perfectly incompressible bodies are actually prohibited by stability of thermodynamic equilibrium (entropy maximization). Section 21 of Landau & Lifshitz Vol 5: *Statistical Physics* has a nice discussion and derivation of the general thermodynamic inequality $C\_V > 0$.
So the equation of state $T = T(V)$ is patholog... |
18,545,018 | I have two Textviews in a RelativeLayout like this:
```
<RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
(*) android:layout_above="@+id/message"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="tr... | 2013/08/31 | [
"https://Stackoverflow.com/questions/18545018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2693419/"
] | First of all you have to remove **"+"** from
This
`android:layout_above="@+id/message"`
To
```
android:layout_above="@id/message"
```
And use TextView's scrolling method rather than scrollview
```
<TextView
android:scrollbars="vertical" // Add this to your TextView in .xml file
android:maxLines="ANY_INTEGER... |
63,515,655 | I was solving the basic problem of finding the number of distinct integers in a given array.
My idea was to declare an `std::unordered_set`, insert all given integers into the set, then output the size of the set. Here's my code implementing this strategy:
```
#include <iostream>
#include <fstream>
#include <cmath>
#... | 2020/08/21 | [
"https://Stackoverflow.com/questions/63515655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14023031/"
] | The input file you've provided consists of successive integers congruent to `1` modulo `107897`. So what is most likely happening is that, at some point when the load factor crosses a threshold, the particular library implementation you're using resizes the table, using a table with `107897` entries, so that a key with... |
57,380,963 | I am using Spring Webflux, and I need to return the ID of user upon successful save.
Repository is returning the Mono
```
Mono<User> savedUserMono = repository.save(user);
```
But from controller, I need to return the user ID which is in object returned from save() call.
I have tried using doOn\*, and subscribe(),... | 2019/08/06 | [
"https://Stackoverflow.com/questions/57380963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037492/"
] | Any time you feel the need to *transform* or *map* what's in your `Mono` to something else, then you use the `map()` method, passing a lambda that will do the transformation like so:
```
Mono<Integer> userId = savedUserMono.map(user -> user.getId());
```
(assuming, of course, that your user has a `getId()` method, a... |
18,454,052 | I'm wondering if I will miss any data if I replace a trigger while my oracle database is in use. I created a toy example and it seems like I won't, but one of my coworkers claims otherwise.
```
create table test_trigger (id number);
create table test_trigger_h (id number);
create sequence test_trigger_seq;
--/
create... | 2013/08/26 | [
"https://Stackoverflow.com/questions/18454052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/558585/"
] | `create or replace` is locking the table. So all the inserts will wait until it completes. Don't worry about missed inserts. |
48,735,869 | I opened up localhost:9870 and try to upload a txt file to the hdfs.
I see the error message below
```
Failed to retrieve data from /webhdfs/v1/?op=LISTSTATUS: Server Error
``` | 2018/02/11 | [
"https://Stackoverflow.com/questions/48735869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8824687/"
] | I had the same issue with JDK 9.
The fix for me was to add this line in hadoop-env.sh
>
> export HADOOP\_OPTS="--add-modules java.activation"
>
>
>
Thats because java.activation package is deprecated in Java 9. |
33,625,063 | I haven't long time in touch with C language. I have some questions related to chinese words and strncpy.
```
char* testString = "你好嗎?"
sizeof(testString) => it prints out 4.
strlen(testString) => it prints out 10.
```
When i want to copy to another char array, i have some issue.
char msgArray[7]; /\* This is just... | 2015/11/10 | [
"https://Stackoverflow.com/questions/33625063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3733534/"
] | Pointers are not arrays. `testString` is a pointer and therefore, `sizeof(testString)` will give the size of pointer instead of the string it points to.
`strlen` works differently and only for null terminated `char` arrays and string literals. It gives the length of the string preceding the null character. |
45,007,249 | In my code:(works well on tf1.0)
```
from tensorflow.contrib.rnn.python.ops import core_rnn
from tensorflow.contrib.rnn.python.ops import core_rnn_cell
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
```
report error with tf1.2:
from tensorflow.contrib.rnn.python.ops import core\_rnn
ImportError... | 2017/07/10 | [
"https://Stackoverflow.com/questions/45007249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4344990/"
] | Here you go with the solution <https://jsfiddle.net/w0nefkfo/>
```js
$('button').prop('disabled', true);
setTimeout(function(){
$('button').prop('disabled', false);
}, 2000);
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button type="submit" value="submit">... |
31,355,287 | I'm a learner of C++ and I'm currently making my assignment and I can't seem to update my value.
It's a must to use define for the balance:
```
#define balance 5000.00
```
In the end of the statement I can't seem to able to update my balance:
```
printf("Deposit Successful!\nYou have deposited the followin... | 2015/07/11 | [
"https://Stackoverflow.com/questions/31355287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5105438/"
] | `#define`s are directives to the so called preprocessor. This is transforming the source code of your programm by textual substitution before it is actually compiled.
When you write something like:
```
#define value 42;
printf("%d", value);
```
then the compiler effectively sees
```
printf("%d", 42);
```
This ha... |
832,362 | In my calculus III textbook, the following sentence is causing trouble for me and preventing me from understanding the theory behind Lagrange multipliers.
>
> "Since the gradient vector for a given function is orthogonal to its level curves at any given point, for a level curve of $f$ to be tangent to the constraint ... | 2014/06/12 | [
"https://math.stackexchange.com/questions/832362",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/156816/"
] | Let $\displaystyle a = \prod\_{p\text{ is prime}}p^{i\_p}$, $\displaystyle b = \prod\_{p\text{ is prime}}p^{j\_p}$, and $\displaystyle c = \prod\_{p\text{ is prime}}p^{k\_p}$. Then $\displaystyle (a,b,c) = \prod\_{p\text{ is prime}}p^{\min\{i\_p,j\_p,k\_p\}}$ and $\displaystyle [a,b,c] = \prod\_{p\text{ is prime}}p^{\m... |
57,377,905 | I have a deep network using Keras and I need to apply cropping on the output of one layer and then send to the next layer. for this aim, I write the following code as a lambda layer:
```
def cropping_fillzero(img, rate=0.6): # Q = percentage
residual_shape = img.get_shape().as_list()
h, w = residual_shape[1:3]... | 2019/08/06 | [
"https://Stackoverflow.com/questions/57377905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11013499/"
] | Use `pd.Grouper` along with `Country` and `City` as your `groupby` keys. I chose `60S` as the frequency, but change this as needed.
---
```
keys = ['Country', 'City', pd.Grouper(key='Datetime', freq='60S')]
df.groupby(keys, sort=False).agg(Unit=('Unit', 'first'), count=('count', 'sum'))
```
```
... |
51,917,574 | I am new on using a Kinect sensor, I have Kinect XBOX 360 and I need to use it to get a real moving body 3D positions. I need to use it with c++ and openCV. I could not find anything helpful on the web. So, please if anyone can give me some advice or if there any code for opening Kinect XBOX 360 with c++ to start with ... | 2018/08/19 | [
"https://Stackoverflow.com/questions/51917574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10245929/"
] | 3 days ago, Our team had met this question. We spent a lot of time for that.
Problem reason should be in AWS ecs-agent(we have 2 envrionment, one ecs-agent's version is 1.21 and another one is 1.24)
Yesterday, We solved this problem: Using AWS console to update ecs-agent to the latest version: 1.34 and restart the ec... |
18,820,233 | I'm working on a CMS back-end with Codeigniter. Maybe it's not clear to state my question with word. So I use some simple html code to express my question:
There is a html page called `A.html`. The code in `A.html` is following:
```
<html>
<head>
/*something*/
</head>
<!-- menu area -->
<div class... | 2013/09/16 | [
"https://Stackoverflow.com/questions/18820233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/669647/"
] | If you want all links to load content into `#content`, you can use this:
```
$(document).on('click', 'a', function(){
$('#content').load(this.href);
});
```
But this won't work for external links.
If all your pages have the structure you described for A.html, you can add another div around `#content` (say, `#con... |
131,444 | We received a note from the security review team highlighting a CRUD/FLS vulnerability in our package and in the note it says there is a "Instances of SELECT vulnerability found across the application".
An example provided is shown below in a "with sharing" class:
>
> myAttachments = [SELECT name, id, parentid, Crea... | 2016/07/14 | [
"https://salesforce.stackexchange.com/questions/131444",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/11790/"
] | I contacted Salesforce's Support team and they provided [this article](https://support.microsoft.com/en-us/kb/2994633) as a temporary fix.
They also mentioned:
>
> "Our R&D team has investigated this matter and logged a New Issue for it to be repaired. Unfortunately, I cannot provide a timeline as to when this rep... |
6,877,117 | I'm writing a small GUI program. Everything works except that I want to recognize mouse double-clicks. However, I can't recognize mouse clicks (as such) at all, though I can click buttons and select code from a list.
The following code is adapted from Ingo Maier's "The scala.swing package":
```
import scala.swing._
i... | 2011/07/29 | [
"https://Stackoverflow.com/questions/6877117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/303624/"
] | Maybe that way?
```
object App extends SimpleSwingApplication {
lazy val ui = new Panel {
listenTo(mouse.clicks)
reactions += {
case e: MouseClicked =>
println("Mouse clicked at " + e.point)
}
}
def top = new MainFrame {
contents = ui
}
}
```
BTW, `SimpleGUIApplication` is depre... |
29,044,357 | I have a `main activity A` -> `call activity B` -> `call activity C` -> `call activity D`.
Activity is called by `startActivity(intent).`
`Activity D` have a "Close" button.
How to I notify to `Activity A` when hit "close" button on `Activity D`?
Any help is appreciated. | 2015/03/14 | [
"https://Stackoverflow.com/questions/29044357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1773083/"
] | Try this:
Use SharedPreference to store the status of button in Activity D.
In activity A under onResume() get the status of button from the SharedPreference. |
18,706,544 | I'm currently using the latest release of bootstrap 3.0.0
The issue is simple. In the jumbotron container I use how do i center align the text with the logo
I've been playing for hours, with col-md-\* and with little luck.
In bootstrap 2.3.2 I achieved the effect of centering everything in hero by using `.text-cent... | 2013/09/09 | [
"https://Stackoverflow.com/questions/18706544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1408559/"
] | Here is another answer, that can center some content inside the actual div:
```
<head>
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
<style>
.centerfy img{
margin: 0 auto;
}
.centerfy{
... |
33,248,694 | I am using pure javascript (no jquery or any other framework) for animations.
Which one's more optimized? Creating classes for transition like:
CSS class:
```
.all-div-has-this-class { transition: all 1s; }
.class1 { left: 0; }
.class2 { left: 30px; }
```
Javscript:
```
testdiv.className += " class... | 2015/10/20 | [
"https://Stackoverflow.com/questions/33248694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3141303/"
] | Hoisting moves function declarations and variable declarations to the top, but doesn't move assignments.
Therefore, you first code becomes
```
var a;
function f() {
console.log(a.v);
}
f();
a = {v: 10};
```
So when `f` is called, `a` is still `undefined`.
However, the second code becomes
```
var a, f;
a = {v: 1... |
3,638,312 | When I use JTAG to load my C code to evaluation board, it loads successfully. However, when I executed my code from main(), I immediately got "CPU is not halted" error, followed by "No APB-AP found" error.
I was able to load and executed the USB-related code before I got this error.
I googled for it and use JTAG com... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3638312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310567/"
] | One possibility: **watchdog**
If your hardware has a watchdog, then you must ensure that it does not reset the CPU when the JTAG wants to halt it. If the watchdog resets the CPU you would typically get a "CPU not halted" type of error you described.
If the CPU has an internal watchdog circuit, on some CPUs it is auto... |
69,263,443 | I have extracted an email and save it to a text file that is not properly formatted. How to remove unwanted line spacing and paragraph spacing?
The file looks like this:
```
Hi Kim,
Hope you are fine.
Your Code is:
42483423
... | 2021/09/21 | [
"https://Stackoverflow.com/questions/69263443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14364775/"
] | You can use `re.sub`:
```
import re
re.sub('\s\s+', '\n', s)
``` |
514,828 | So my understanding of one scenario that ZFS addresses is where a RAID5 drive fails, and then during a rebuild it encountered some corrupt blocks of data and thus cannot restore that data. From Googling around I don't see this failure scenario demonstrated; either articles on a disk failure, or articles on healing data... | 2013/06/11 | [
"https://serverfault.com/questions/514828",
"https://serverfault.com",
"https://serverfault.com/users/15810/"
] | Mostly you get things right.
1. You can feel safe if only one drive fails out of raidz1 pool. If there is some corruption on one more drive some data would be lost forever.
2. You can feel safe if two out of 4 drives fail in raidz2 pool. If there is... and so on.
3. You can be mostly sure about that but for no reason.... |
24,322,973 | I want to test database performance and understand how database throughput (in terms of transactions per second) depends on disk properties like IO latency and variation, write queue length, etc. Ideally, I need a simulator that can be mounted as a disk volume and has a RAM disk inside wrapped into a controller that al... | 2014/06/20 | [
"https://Stackoverflow.com/questions/24322973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1128016/"
] | You declare globals inside function scope.
Try to declare them at class scope:
```
class Someclass{
function topFunction()
{
function makeMeGlobal($var)
{
global $a, $b;
$this->a = "a".$var;
$this->b = "b".$var;
}
makeMeGlobal(1); ... |
69,152,970 | I am trying to generate CSV files from a set of records from Excel.
Column A is the file name and the rest of the columns are the data to write to the the file.
As of now, I am using `WriteLine`, but it doesn't work as expected:
[](https://i.sta... | 2021/09/12 | [
"https://Stackoverflow.com/questions/69152970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13611682/"
] | ```
@echo off
for /F "skip=1" %%a in ('dir /B /S D:\TargetFolder\Settings.txt 2^>NUL') do (
del /Q /S D:\TargetFolder\Settings.txt >NUL
goto break
)
:break
```
The `for /F` loop process file names from `dir /S` command, but the first one is skipped (because `"skip=1"`switch), that is to say, if there are *more... |
10,992,077 | I have this fiddle and i would like to make it count the number of boxes that are selected.
Now it shows the numbers of the boxes.
Any idea how to do it??
```
$(function() {
$(".selectable").selectable({
filter: "td.cs",
stop: function(){
var result = $("#select-result").empty();
var r... | 2012/06/12 | [
"https://Stackoverflow.com/questions/10992077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1421432/"
] | Just try this withih `stop()`:
```
$(".ui-selected").length
```
**[DEMO](http://jsfiddle.net/dw6Hf/46/)**
### NOTE
To get all selected div you need to place above code like following:
```
alert($(".ui-selected").length); // here to place
if ($(".ui-selected").length > 4) {
$(".ui-selected", this).each(fu... |
52,772,908 | [](https://i.stack.imgur.com/PfIiJ.gif)
How do I develop the above gif image using Unity3D? | 2018/10/12 | [
"https://Stackoverflow.com/questions/52772908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6008065/"
] | why don't you just use CSS to do the job?
```css
.uppercase{
text-transform: uppercase;
}
```
```html
<input class="uppercase" type="text" placeholder="type here">
``` |
32,216,118 | I have a nested class structure where when I instantiate the top level class it instantiates a bunch of objects of other classes as attributes, and those instantiate a few other classes as their own attributes.
As I develop my code I want to override a class definition in a new module (this would be a good way for me... | 2015/08/26 | [
"https://Stackoverflow.com/questions/32216118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5266259/"
] | Make the Card class an optional parameter to the Deck instance initializer that defaults to your initial Card class, and override it by passing a second parameter of your second Card class when you initialize a deck of your new cards.
**EDIT** Made names more Pythonic and made index a tuple as suggested by cyphase .
... |
3,515,059 | I have some objects on the screen and would like to rotate only one of them. I tried using the glRotatef(...) function but turns out glRotatef(...) rotates all my objects (rotates the camera, maybe?).
How can I rotate only one?
I use openGL ES 1.1 | 2010/08/18 | [
"https://Stackoverflow.com/questions/3515059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/110028/"
] | You need the rotation to be in effect only when the geometry you're interested in is being drawn.
```
... draw stuff ...
glPushMatrix();
glRotatef(angle, 0, 1, 0);
... draw rotated stuff ...
glPopMatrix();
... draw more stuff ...
``` |
2,957,996 | Im stuck, Im setting a variable when someone clicks, then testing with if to see if the variable exists and doing something else. Its a simple script which Im probably overthinking, would love someone's thoughts.
```
$('.view-alternatives-btn').live('click', function() {
//$("#nc-alternate-wines").scrollTo();
//... | 2010/06/02 | [
"https://Stackoverflow.com/questions/2957996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28454/"
] | You're *always* setting it to `null` when the button is clicked, so you'll never reach the `else if`...
You might instead use a global variable, or [`$.data()`](http://api.jquery.com/jQuery.data/) |
9,597,122 | I have established a basic hadoop master slave cluster setup and able to run mapreduce programs (including python) on the cluster.
Now I am trying to run a python code which accesses a C binary and so I am using the subprocess module. I am able to use the hadoop streaming for a normal python code but when I include t... | 2012/03/07 | [
"https://Stackoverflow.com/questions/9597122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1253987/"
] | Used simple id and hash token like Amazon for now... |
10,945,303 | I've started to learn PHP. `$_POST` variable is working in some of files, that I'm even able to post the data obtained through `$_POST` to database.
Strangely, `$_POST` is not working in few files. I mean its inconsistent.
Below is the html:
```
<html>
<title></title>
<head>
</head>
<body>
<form method="POST" actio... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10945303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/840352/"
] | $\_POST should not have any consistency issues. It could be many things:
**Possible Code Errors**
1. You misspelled a key name
2. Ensure that you actually set the values
3. Perhaps you are passing some variables via the URL www.example.com?var=x (GET) and then trying to reference `$_POST['var']` instead of `$_GET['va... |
68,336,882 | I have a Java servlet app running on Ubuntu 20.04.2 in Tomcat9 apache. The servlets are required to run using https transport. I am using a self signed certificate to enable https/TLS on Tomcat9.
The servlet attempts to upload a file using a form that includes an html input tag with type file.
On my local area networ... | 2021/07/11 | [
"https://Stackoverflow.com/questions/68336882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10234883/"
] | This looks like a simple typo, you define
```
...
const productsDom = document.querySelector('.products-center')
...
```
but use
```
...
productsDOM.innerHTML = result;
...
```
in your function. Case sensitivity matters, so you get an error saying that `productsDOM` doesn't exist - it doesn't, `productsDom` exist... |
7,042,626 | I need to validate a number entered by a user in a textbox using JavaScript. The user should not be able to enter 0 as the first digit like 09, 08 etc, wherein he should be allowed to enter 90 , 9.07 etc..
Please help me.. I tried to use the below function but it disallows zero completely:
```
function AllowNonZer... | 2011/08/12 | [
"https://Stackoverflow.com/questions/7042626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/622096/"
] | Use `charAt()` to control the placement of X at Y:
```
function checkFirst(str){
if(str.charAt(0) == "0"){
alert("Please enter a valid number other than '0'");
}
}
``` |
1,003,105 | I'm trying to host a static website on Azure storage with a custom domain and HTTPS.
I have created a storage account, uploaded my files, and enabled static site hosting. The site works nicely from the `<foo>.web.core.windows.net` domain provided by Azure.
I have created a CDN endpoint for the site with the origin ho... | 2020/02/14 | [
"https://serverfault.com/questions/1003105",
"https://serverfault.com",
"https://serverfault.com/users/374091/"
] | You could automate certificates for the apex using Let's Encrypt, making the cert part a little more easy to handle.
Other than that, you basically need to host a 301 redirect somewhere that talks both HTTP and HTTPS to get this to work, no shortcut I'm afraid, especially if you're going to be using HSTS. There are s... |
59,956,586 | We have just upgraded a .NET 4.6 project to .NET 4.8 and this function
```
Private Function MeasureTextSize(ByVal text As String, ByVal fontFamily As FontFamily, ByVal fontStyle As FontStyle, ByVal fontWeight As FontWeight, ByVal fontStretch As FontStretch, ByVal fontSize As Double) As Size
Dim ft As New Formatte... | 2020/01/28 | [
"https://Stackoverflow.com/questions/59956586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1956080/"
] | You have three options basically:
* Create a visual and use the `GetDpi` method to get a value for the `pixelsPerDip` parameter:
```
VisualTreeHelper.GetDpi(new Button()).PixelsPerDip
```
* Define a static value yourself, e.g. `1.25`.
* Ignore the warning and use the obsolete overload. |
36,386,362 | I'm about a couple weeks into learning Python.
With the guidance of user:' Lost' here on Stackoverflow I was able to figure out how to build a simple decoder program. He suggested a code and I changed a few things but what was important for me was that I understood what was happening. I understand 97% of this code exc... | 2016/04/03 | [
"https://Stackoverflow.com/questions/36386362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3564925/"
] | You need to use a smaller fixed length buffer when reading from the socket, and then append the received data to a dynamically growing buffer (like a `std::string`, or a file) on each loop iteration. `recv()` tells you how many bytes were actually received, do not access more than that many bytes when accessing the buf... |
70,653,677 | I would like to use nls to fit a global parameter and group-specific parameters. The closest I have found to a minimum reproducible example is below (found here: <https://stat.ethz.ch/pipermail/r-help/2015-September/432020.html>)
```
#Generate some data
d <- transform(data.frame(x=seq(0,1,len=17),
group=rep(c("A"... | 2022/01/10 | [
"https://Stackoverflow.com/questions/70653677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16491398/"
] | I think you can do this much more easily with `nlme::gnls`:
```r
fit2 <- nlme::gnls(y~1/(b+x^p),
params = list(p~group-1, b~1),
data=d,
start = list(b=1, p = rep(3,3)))
```
Results:
```
Generalized nonlinear least squares fit
Model: y ~ 1/(b + x^p)
Data: d
Log-likelihood: ... |
47,629,259 | I'm looking for a way to fit all views with the right zoom which in my app's instance is one annotation and userlocation and the whole polyline which signifies the route connecting the annotation and the userlocation.
I have this code below which I call every time the map loads the mapview:
```
func mapViewDidFinishL... | 2017/12/04 | [
"https://Stackoverflow.com/questions/47629259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5328686/"
] | This method will give you the bounds on the polyline no matter how short or long it is. You need an array of locations somewhere in your VC being locationList: [CLLocation] in this example.
```
func setCenterAndBounds() -> (center: CLLocationCoordinate2D, bounds: MGLCoordinateBounds)? {
let latitudes = locationLis... |
66,569,955 | I have the following data in a table:
```
GROUP1|FIELD
Z_12TXT|111
Z_2TXT|222
Z_31TBT|333
Z_4TXT|444
Z_52TNT|555
Z_6TNT|666
```
And I engineer in a field that removes the leading numbers after the '\_'
```
GROUP1|GROUP_ALIAS|FIELD
Z_12TXT|Z_TXT|111
Z_2TXT|Z_TXT|222
Z_31TBT|Z_TBT|333 <- to be removed
Z_4TXT|Z_TXT|44... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66569955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9682236/"
] | Here is one way, using analytic `count`. If you are not familiar with the `with` clause, read up on it - it's a very neat way to make your code readable. The way I declare column names in the `with` clause works since Oracle 11.2; if your version is older than that, the code needs to be re-written just slightly.
I als... |
55,228,206 | I followed threejs documentation in vuejs project to import image using :
```
texture.load( "./clouds" )
```
This code is not working, I have to import image using require :
```
texture.load( require( "./clouds.png" ) )
```
Now I want to use functions for sucess or error, so thank's to the internet i found that
... | 2019/03/18 | [
"https://Stackoverflow.com/questions/55228206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10380588/"
] | Your problem is not related to VueJS /ThreeJs (again ^^), you should learn how to use `this` inside a callback, here is a E6 fix :
```
texture.load( require( "./clouds.png" ), t => this.onSuccess(t), e => this.onProgress(e), e => this.onError(e) )
```
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referenc... |
70,558,800 | I want to change the content of a List with a class funcion.
The class takes an item from the list as a parameter. Now I want to change this item in the list.
How do I do that? I was only able to change the parameter in the instance but not the original list.
```
list = ["just", "an", "list"]
class Test():
def __... | 2022/01/02 | [
"https://Stackoverflow.com/questions/70558800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17816849/"
] | `list[1]` is an expression that evaluates to `"an"` before `Test` is ever called. You have to pass the list and the index to modify separately, and let `blupp` make the assignment.
```
class Test:
def __init__(self, bla, x):
self.bla = bla
self.x = x
def blupp(self):
self.bla[self.x] =... |
11,521,178 | I have an EditText view which I am using to display information to the user. I am able to append a String and it works correctly with the following method:
```
public void PrintToUser(String text){
MAIN_DISPLAY.append("\n"+text);
}
```
The application is an RPG game which has battles, when the u... | 2012/07/17 | [
"https://Stackoverflow.com/questions/11521178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2474385/"
] | My suggestion would be to use the method:
```
myTextView.setText(Hmtl.fromHtml(myString));
```
Where the myString could be of the format:
```
String myString = "Hello <font color=\'#ff0000\'>World</font>";
``` |
7,863,936 | I'm using a BYTE variable in assembler to hold partial statements before they're copied to a permanent location. I'm trying to figure out how I could clear that after each new entry. I tried moving an empty variable into it, but that only replaced the first character space of the variable. Any help would be much apprec... | 2011/10/23 | [
"https://Stackoverflow.com/questions/7863936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974953/"
] | Use XOR instead of MOV. It's faster.
```
XOR r1, r1
``` |
55,376,694 | So basically, i have a component "ShowTaskStatus" that will show how many tasks are open, how many closed and the total. This result i get by POSTing to my query server endpoint.
In my dashboard, ShowTaskStatus can be rendered multiple times and the results will be visible per row in a table. There can be up to 50 dif... | 2019/03/27 | [
"https://Stackoverflow.com/questions/55376694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9460865/"
] | You need to move the code inside a method. one of the solutions could be as follows
```
package application;
public class Mathprocess {
public static void main(String[] args){
int numberOne = 15;
int numberTwo = 5;
int answerNumbers;
int ansSubtract = 0;
int ansDivide = 0... |
4,307,536 | I am building a string to detect whether filename makes sense or if they are completely random with PHP. I'm using regular expressions.
A valid filename = `sample-image-25.jpg`
A random filename = `46347sdga467234626.jpg`
I want to check if the filename makes sense or not, if not, I want to alert the user to fix the... | 2010/11/29 | [
"https://Stackoverflow.com/questions/4307536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/148718/"
] | I'm not really sure that's possible because I'm not sure it's possible to define "random" in a way the computer will understand sufficiently well.
"umiarkowany" looks random, but it's a perfectly valid word I pulled off the Polish Wikipedia page for South Korea.
My advice is to think more deeply about why this design... |
36,401,911 | **TL;DR**
When I'm importing my existing Cordova project in Visual Studio and run the application in my browser (through Ripple) I'll get the following error:
`PushPlugin.register - We seem to be missing some stuff :(`
**Full explanation:**
First of all apologies for the long post, I wanted to include as much i... | 2016/04/04 | [
"https://Stackoverflow.com/questions/36401911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2664414/"
] | Just add a button at the top that deletes the selected rows. It looks like your using a `QTreeWidget`
```
def __init__(...)
...
self.deleteButton.clicked.connect(self.deleteRows)
def deleteRows(self):
items = self.tree.selectedItems()
for item in items:
# Code to delete items in database
s... |
37,481,473 | I'm setting the routes and I would like to pass a parameter to the delete method.
I've tried this which doesn't work:
```
namespace :admin do
resources :item do
get 'create_asset'
delete 'destroy_asset/:asset_id'
end
resources :asset
end
```
I've done that, but it doesn't look like the p... | 2016/05/27 | [
"https://Stackoverflow.com/questions/37481473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1498118/"
] | I have log4net in my project from before I added identity server, it just works for me, I did not have to change anything that I had done.
so in my case I had got the nuget package created the table and updated my web.config to use log4net before I added identity server.
if you want a sample of my setup I can add it la... |
41,786,278 | I've tried adding JAVA\_HOME with the directory - C:\Program Files\Java\jdk1.8.0\_121 to my system variables, and then adding %JAVA\_HOME%/bin to Path variable and this didn't work and I receive
>
> 'java' is not recognized as an internal or external command, operable
> program or batch file.
>
>
>
So I've trie... | 2017/01/22 | [
"https://Stackoverflow.com/questions/41786278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6321773/"
] | Did you try closing that command prompt and reopening it? |
44,161,916 | Please can anyone help me, I am stuck, I have to extract data from JIRA web page and put it into EXCEL without using plugins that's way i am trying to do it with VBA but I don't how to proceed. I have tried several methods but it dosen't work for me, Is there anyone who has done that already ?
Thank you | 2017/05/24 | [
"https://Stackoverflow.com/questions/44161916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8054553/"
] | The piece of code you posted works , maybe in the rest of your code there is some html output before `header( )` , this can be also in some of included files if there is some .
UPDATE :
Some useful answers about the same issue could be found here :
[php-header-redirect-not-working](https://stackoverflow.com/question... |
37,516,491 | I am running git commands remotely through the SSH protocol as the server doesn't accept HTTPS. I am running it through a bash script and would prefer if I could pass in a username and password as variables.
More specifically, I am doing a migrate of repositories and am having issues when running
```
git remote add ... | 2016/05/30 | [
"https://Stackoverflow.com/questions/37516491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4727710/"
] | Assuming you're using a recent version of Git, you can use the `GIT_SSH_COMMAND` environment variable:
>
>
> ```
> GIT_SSH, GIT_SSH_COMMAND
>
> If either of these environment variables is set then git fetch
> and git push will use the specified command instead of ssh when
> they need to connect ... |
1,201,312 | $D: \begin{bmatrix}1&4.19\\2&3.40\\3&2.80\\4&2.30\\5&1.99\\6&1.70\\7&1.51\\8&1.34\\9&1.21\\10&1.09\end{bmatrix}$
In this table of data the first column is representing time (in minutes), and the second column is the mass of some element.
* The element consists of two types of isotopes that decay rapidly.
* The first... | 2015/03/22 | [
"https://math.stackexchange.com/questions/1201312",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/174557/"
] | **Hint 1:** $t \mapsto (1-x)/(1+x)$
>
> $$\begin{equation}\displaystyle\int\frac{x-1}{(x+1)\sqrt{x+x^2+x^3}}\,\mathrm{d}x = 2\arccos\left(\frac{\sqrt{x}} {x+1}\right) + \mathcal{C}\end{equation}$$
>
>
>
**Hint 2:** One can show that $t = (1-x)/(1+x)$ is it's own inverse. In other words $x = (1-t)/(1+t)$. Hence t... |
68,486,025 | I'm trying to add validation to my route in a fastapi server, followed the instructions [here](https://fastapi.tiangolo.com/tutorial/path-params-numeric-validations/) and managed to have added validation on my int path parameters like so:
```
route1 = router.get("/start={start:int}/end={end:int}")(route1_func)
```
a... | 2021/07/22 | [
"https://Stackoverflow.com/questions/68486025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14952079/"
] | You can put path params & query params in a Pydantic class, and add the whole class as a function argument with `= Depends()` after it. The FastAPI docs barely mention this functionality, but it does work.
Then, once you have your args in a Pydantic class, you can easily use Pydantic validators for custom validation.
... |
42,088,715 | I'm using word2vec model to build a classifier on training data set and wonder what are technics to deal with unseen terms (words) in the test data.
Removing new terms doesn't seem like a best approach.
My current thought is to recalculate word2vec on combined data set (training + test) and replace new terms with near... | 2017/02/07 | [
"https://Stackoverflow.com/questions/42088715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6077279/"
] | To get document without having name is N3 of properties use [$ne](https://docs.mongodb.com/v3.2/reference/operator/query/ne/#ne) (*not equal*) operator
```
db.collectionName.find( { "properties.name": { $ne: "N3" } } )
```
**Updated:**
You need to use aggregate query to get all record with properties only discard ... |
92,711 | I've read on a Twitter support page that when we block a user that user will be notified that he/she has been blocked. My question is: when I block a user, that user will still be able to see my profile? Is there a way to prevent users from viewing my profile permanently? | 2016/05/11 | [
"https://webapps.stackexchange.com/questions/92711",
"https://webapps.stackexchange.com",
"https://webapps.stackexchange.com/users/123448/"
] | >
> How to change comma to dot?
>
>
>
Use Edit, Find and Replace...
[](https://i.stack.imgur.com/OzrSP.jpg)
However the result is a text string, so you might need to substitute dot with comma if to calculate with the result. |
117,945 | I need to put a letter under the min symbol in the equation below but i couldn't do it,It now looks like this:

and I need it to look like this:

```
\begin{document}
\begin{equatio... | 2013/06/06 | [
"https://tex.stackexchange.com/questions/117945",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/28377/"
] | ```
\begin{document}
\begin{equation}
\min_A\sum^{N}_{i=1}\sum^{N}_{j=1}|y_i - y_j|^2 W_{ij}
\label{eqn4}
\end{equation}
\end{document}
``` |
27,351,064 | I have a class that makes car objects. It has two instance variables: Make and Color. I am having an issue calling this method within the workspace (noted below)
Class Method -Constructor
```
make: aMake color: aColor
"Creates a new car object, sets its instance variables by the arguments"
|car|
car := se... | 2014/12/08 | [
"https://Stackoverflow.com/questions/27351064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2249815/"
] | Everything looks alright. The likely gotcha would be that your "constructor" (which would more likely be called an "instance creation message" in Smalltalk) needs to be implemented on the class side, and you may have done so on the instance side. Conversely, your set... must be on the instance side. Which message is no... |
41,601,636 | When I try to run this Python script, the following happens:
```
$ python mlp_training.py
Loading training data...
(0, 38400)
(0, 4)
Loading image duration: 0.000199834
Training MLP ...
Traceback (most recent call last):
File "mlp_training.py", line 49, in <module>
num_iter = model.train((train, ( train_labels )... | 2017/01/11 | [
"https://Stackoverflow.com/questions/41601636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7405626/"
] | See code from [mlp\_training.py](https://github.com/hamuchiwa/AutoRCCar/blob/master/computer/mlp_training.py)
```
num_iter = model.train(train, train_labels, None, params = params)
```
It runs `train()` with 4 arguments but you run with only one - tuple
```
model.train( (train, ( train_labels ), ( params )) )
... |
11,906,219 | I have a question on my mind. Let's assume that I have two parameters passed to JVM:
-Xms256mb -Xmx1024mb
At the beginning of the program 256MB is allocated. Next, some objects are created and JVM process tries to allocate more memory. Let's say that JVM needs to allocate 800MB. Xmx attribute allows that but the memory... | 2012/08/10 | [
"https://Stackoverflow.com/questions/11906219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275053/"
] | The quality of the GC (barring a buggy GC) does not affect memory leaks, as memory leaks are an artifact of the application -- GC can't collect what isn't actual garbage.
If a JVM needs more memory, it will take it from the system. If the system can swap, it will swap (like any other process). If the system can not sw... |
7,475,837 | This is the code (corona SDK btw), it is calling a physicsdata (unimportant).
```
r = math.random(1,5)
local scaleFactor = 1.0
local physicsData = (require "retro").physicsData(scaleFactor)
physics.addBody( enemy, physicsData:get(r) )
```
The r in
```
physicsData:get(r) )
```
has to be inside speech marks to ... | 2011/09/19 | [
"https://Stackoverflow.com/questions/7475837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you need a string,
```
tostring(r)
```
For example,
```
physics.addBody( enemy, physicsData:get(tostring(r)) )
```
If you really need quotes in the string (I doubt you do):
```
physics.addBody( enemy, physicsData:get('"' .. tostring(r) .. '"') )
``` |
64,654,855 | So I have the following 3 tables:
```
Table: Products
Columns: id, name, description, price, currency
Table: Orders
Columns: id, firstName, lastName, phoneNumber
Table: Order_Products
Columns: orderId, productId, quantity
```
Now I'm trying to figure out where to put the total price of the order and I have 2 ideas... | 2020/11/02 | [
"https://Stackoverflow.com/questions/64654855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8618818/"
] | I would recommend that you store the order total in the `orders` table.
Why? Basically, order totals are not necessarily the same as the sum of all the prices on the items:
* The prices might change over time.
* The order itself might have discounts.
In addition, the order might have additional charges:
* Discounts... |
42,008,449 | I am trying to see if an array contains each element of another array. Plus I want to account for the duplicates. For example:
```
array = [1, 2, 3, 3, "abc", "de", "f"]
```
array contains [1, 2, 3, 3] but does not contain [2, 2, "abc"] - too many 2's
I have tried the below but obviously doesn't take into account t... | 2017/02/02 | [
"https://Stackoverflow.com/questions/42008449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6449679/"
] | This method iterates once over both arrays.
For each array, it creates a hash with the number of occurences of each element.
It then checks that for every unique element in `subset`, there are at least as many elements in `superset`.
```
class Array
def count_by
each_with_object(Hash.new(0)) { |e, h| h[e] += 1 ... |
29,144,832 | I want to sequentially read each line of an input unsorted file into consecutive elements of the array until there are no more records in
the file or until the input size is reached, whichever occurs first. but i can't think of a way to check the next line if its the end of the file?
This is my code:
```
Scanner cin... | 2015/03/19 | [
"https://Stackoverflow.com/questions/29144832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4532762/"
] | From [the docs](http://docs.oracle.com/javase/7/docs/api/java/io/BufferedReader.html):
>
> public String readLine()
>
>
> Returns: A String containing the contents of the line, not including
> any line-termination characters, or null if the end of the stream has
> been reached
>
>
>
In other words, you shou... |
49,707 | I was rewatching Stargate-SG1 and noticed something while I was watching "[Menace](http://stargate.wikia.com/wiki/Menace)" where we learn that the android Reese created the Replicators and sent them out in to the galaxy.
We know that the Replicators integrate technology they consume to their own and lastly we know of ... | 2014/02/08 | [
"https://scifi.stackexchange.com/questions/49707",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/22619/"
] | The short answer is that it's not explained in canon. Although the Asgard have had a presence in the Milky Way Galaxy for a very long time (and hence it would be logical to assume they encountered the Replicators there) Thor [explictly states](http://stargate-sg1-solutions.com/wiki/3.22_%22Nemesis_Part_1%22_Transcript#... |
338,952 | On top of [an answer](https://meta.stackexchange.com/a/63791/399694) describing a meme about pluralization bugs, there was a deprecation notice posted (from August 2018):
>
> This meme is officially deprecated.
>
>
> Please do not use this meme. It remains here while links to it are
> still quite 'out in the wild'... | 2019/11/24 | [
"https://meta.stackexchange.com/questions/338952",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/38765/"
] | It is possible that your post may be on-topic at the [Information Security](https://security.stackexchange.com) Stack Exchange site. They have quite a few questions and a lot of them do cover Internet censorship by governments. |
5,303,118 | i have a relative layout and i have two buttons in it with texts "hello" and "world" respectively. i want these two buttons to lie adjacent to each other and equally occupy the whole horizontal space available.
i tried the following but didnt get expected output
```
<RelativeLayout xmlns:android="http://schemas.and... | 2011/03/14 | [
"https://Stackoverflow.com/questions/5303118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41432/"
] | ```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_a... |
51,620,422 | In Postgres, I have a table with many columns (e.g. t1(a, b, c, ..., z)). I need to obtain its subset through a select-from-where statement into a new table (e.g. t2), but this new table must have a `serial` attribute. So, t2 would like t2(id, a, b, c, ..., z), where id the `serial` attribute. In Postgres, this works:
... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51620422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1959766/"
] | As suggested by people in the comment section, **your best bet for this type of task is using list comprehension** like so,
```
['file_Path ' + i for i in List]
```
Now, I wanted to add an answer because I wanted to add that `List` is definitely not a good choice of naming for you `list` object.
**I would go with ... |
39,233,962 | I want to submit a score to my leaderboard. Sometimes it works but sometimes i get the error:
```
Error Code 6: STATUS_NETWORK_ERROR_OPERATION_FAILED
```
I am connected to the internet and enabled multiplayer in the developer console. Any ideas?
Here is my code:
MainActivity:
```
if(isSignedIn()){
Games... | 2016/08/30 | [
"https://Stackoverflow.com/questions/39233962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4835496/"
] | You can use this lazy regex:
```
(.*?) \((.*)\)[^()]*$
```
[RegEx Demo](https://regex101.com/r/yQ8xI8/1)
Examples:
```
>>> reg = r'(.*?) \((.*)\)[^()]*$'
>>> s = 'Bell St/Oriel Rd (Bellfield (3081))'
>>> re.findall(reg, s)
[('Bell St/Oriel Rd', 'Bellfield (3081)')]
>>> s = 'Stud Rd/(after) Ferntree Gully Rd (Sco... |
23,577,146 | Haskell does not have loops like many other languages. I understand the reasoning behind it and some of the different approaches used to solve problems without them. However, when a loop structure is necessary, I am not sure if the way I'm creating the loop is correct/good.
For example (trivial function):
```
dumdum ... | 2014/05/10 | [
"https://Stackoverflow.com/questions/23577146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1993391/"
] | For general iteration, having a recursive function call itself is definitely the way to go. If your calls are in [tail position](https://en.wikipedia.org/wiki/Tail_call), they don't use any extra stack space and behave more like `goto`1. For example, here is a function to sum the first n integers using constant stack s... |
31,494,001 | I want to change this url from:
```
https://lh3.googleusercontent.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif
```
to this:
```
http://3.bp.blogspot.com/-5EoWQXUJMiA/VZ86O7eskeI/AAAAAAADHGs/ej6F-va__Ig/s1600/i2Fun.com-helpful-dogs-015.gif
```
This is my code, but it's ... | 2015/07/18 | [
"https://Stackoverflow.com/questions/31494001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1201672/"
] | It's a simple string replace.
Search for `"https://lh3.googleusercontent.com/"`. Replace with `"http://3.bp.blogspot.com/"`.
`str_replace()` will do this. Am I missing something? |
758,758 | I am learning about radians in my current class and am totally confused.
How does $\sin(x+\frac\pi 2)=\cos(x)$ when $\frac\pi 2<x$ < $\pi$.
I drew the triangles and I got
$\sin(x+\frac\pi 2)=\frac{-\mathrm{opposite}}{-\mathrm{hypotenuse}}=\frac{\mathrm{opp}}{\mathrm{hyp}}$
$\cos(x)=\frac{\mathrm{adjacent}}{\mathrm{... | 2014/04/18 | [
"https://math.stackexchange.com/questions/758758",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/90108/"
] | Your expression for $\sin(x)$ is correct. But recall that the cosine is the abscissa divided by the radius of the circle. So in your drawing, $\cos(x)=\frac a b$.
 |
58,648,255 | `str_getcsv ()` has some odd behaviour. It removes **all** characters that match the enclosing character, instead of **just the enclosing ones**. I'm trying to parse a CSV string (contents of an uploaded file) in two steps:
1. split the CSV string into an array of lines
2. split each line into an array of fields
with... | 2019/10/31 | [
"https://Stackoverflow.com/questions/58648255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11036459/"
] | Create a branch at **exactly** the revision where the person who worked separately started working from. Then remove every single file from it (use `git rm` for removing).... then put there whatever the user code is.... then add all of that and commit (use `--author="batman forever"` with the name of the developer so t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.