qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
32,309,239 | My routes.php as Below:
```
$controller_list = array('showmenu','aboutus'); // etc you will have to put all your controllers in this array
foreach($controller_list as $controller_name)
{
$route[$controller_name] = $controller_name;
$route[$controller_name.'/(:any)'] = $controller_name.'/$1';
}
$route... | 2015/08/31 | [
"https://Stackoverflow.com/questions/32309239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5159311/"
] | i exactly don't understand what you want to say but you can define each function separately in your routes.php for simple and fine url like this:
```
$route['whatever you want in your url'] = 'your controller name/your function name';
```
this will like:
```
localhost/foldername/(different slugs)
``` | ```
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Main extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('form_validation');
$this->load->database();
$this->load->model("menu_model");
$this->load->model("... |
32,309,239 | My routes.php as Below:
```
$controller_list = array('showmenu','aboutus'); // etc you will have to put all your controllers in this array
foreach($controller_list as $controller_name)
{
$route[$controller_name] = $controller_name;
$route[$controller_name.'/(:any)'] = $controller_name.'/$1';
}
$route... | 2015/08/31 | [
"https://Stackoverflow.com/questions/32309239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5159311/"
] | i exactly don't understand what you want to say but you can define each function separately in your routes.php for simple and fine url like this:
```
$route['whatever you want in your url'] = 'your controller name/your function name';
```
this will like:
```
localhost/foldername/(different slugs)
``` | Try this first you have to set your default controller
```
$default_controller = "main";
$route['default_controller'] = $default_controller;
```
then you have to define your methods
```
$route['same url'] = 'aboutus';
$route['same url'] = 'showmenu';
``` |
32,309,239 | My routes.php as Below:
```
$controller_list = array('showmenu','aboutus'); // etc you will have to put all your controllers in this array
foreach($controller_list as $controller_name)
{
$route[$controller_name] = $controller_name;
$route[$controller_name.'/(:any)'] = $controller_name.'/$1';
}
$route... | 2015/08/31 | [
"https://Stackoverflow.com/questions/32309239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5159311/"
] | i exactly don't understand what you want to say but you can define each function separately in your routes.php for simple and fine url like this:
```
$route['whatever you want in your url'] = 'your controller name/your function name';
```
this will like:
```
localhost/foldername/(different slugs)
``` | in your routes.php
```
$default_controller = "main";
$route['default_controller'] = $default_controller;
$route['aboutus'] = 'aboutus';
$route['slug'] = 'showmenu';
$route["^((?!\b".implode('\b|\b', $controller_exceptions)."\b).*)$"] = $default_controller.'/$1';
$route['404_override'] = '';
``` |
108,223 | I want to cite a journal itself, not an article in it, the publication. I think the same would hold for a magazine, not an issue of that magazine. The specific citation information will be enough.
Bonus points for showing how to set this citation information with biber and biblatex, so it displays properly formatted. | 2018/04/16 | [
"https://academia.stackexchange.com/questions/108223",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/68352/"
] | There are certainly interesting kinds of research where you would do this, such as bibliometrics, meta-analyses, history of science, intellectual history, or a subject bibliography.
[The APA style blog](http://blog.apastyle.org/apastyle/2012/09/citing-a-whole-periodical.html) opines that **you would not need to make t... | BibTeX doesn't appear to define an entry that captures *a journal* (unlike a proceedings, which is captured by `proceedings`), [it does provide](https://en.wikipedia.org/wiki/BibTeX):
```
book
A book with an explicit publisher.
Required fields: author/editor, title, publisher, year
Optional fields: volume/... |
16,349,376 | When configuring tests to run in parallel, such as using ReSharper, there seems to be no way to flag a specific unit test class to be run serially.
An example of a class that requires this could be one that deletes/recreates data before each indiviual test (from a database or just file structures).
If parallel test r... | 2013/05/02 | [
"https://Stackoverflow.com/questions/16349376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1425013/"
] | Quoting from documentation:
>
> void pop\_front();
>
>
> Delete first element
> Removes the first element in the deque container, effectively reducing its size by one.
>
>
> This destroys the removed element.
>
>
>
```
pop_front()
```
destroys the object, you may need to try:
```
Job currentJob = jobs.fr... | What you want is this
```
Job currentJob = jobs.front();
jobs.pop_front();
``` |
71,887 | I have a problem with `group by`, I want to select multiple columns but group by only one column. The query below is what I tried, but it gave me an error.
```
SELECT Rls.RoleName,Pro.[FirstName],Pro.[LastName],Count(UR.[RoleId]) as [Count]
from [b.website-sitecore-core].[dbo].[aspnet_UsersInRoles] UR
inner join [b.we... | 2014/07/19 | [
"https://dba.stackexchange.com/questions/71887",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/31120/"
] | In SQL Server you can only select columns that are part of the `GROUP BY` clause, or aggregate functions on any of the other columns. [I've blogged about this in detail here](https://blog.jooq.org/2016/12/09/a-beginners-guide-to-the-true-order-of-sql-operations/). So you have two options:
1. Add the additional columns... | *Note: This answer is intended as a supplement to [@Lukas Eder's answer](https://dba.stackexchange.com/a/71889/52150)*
If there are multiple values present for the fields `SELECT`ed but a field you wish to `GROUP BY`, you could instead grab the top matching line, rather than waiting for an aggregation (`MAX`) to retur... |
71,887 | I have a problem with `group by`, I want to select multiple columns but group by only one column. The query below is what I tried, but it gave me an error.
```
SELECT Rls.RoleName,Pro.[FirstName],Pro.[LastName],Count(UR.[RoleId]) as [Count]
from [b.website-sitecore-core].[dbo].[aspnet_UsersInRoles] UR
inner join [b.we... | 2014/07/19 | [
"https://dba.stackexchange.com/questions/71887",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/31120/"
] | In SQL Server you can only select columns that are part of the `GROUP BY` clause, or aggregate functions on any of the other columns. [I've blogged about this in detail here](https://blog.jooq.org/2016/12/09/a-beginners-guide-to-the-true-order-of-sql-operations/). So you have two options:
1. Add the additional columns... | I had this same problem when I wanted to group by something from a transactional table where the timestamp was the latest entry. So for example an audit table that had a username, someUniqueId and a timestamp.
So I could get the max timestamp of when all the objects were last updated via:
```
SELECT max(timeStamp) ... |
71,887 | I have a problem with `group by`, I want to select multiple columns but group by only one column. The query below is what I tried, but it gave me an error.
```
SELECT Rls.RoleName,Pro.[FirstName],Pro.[LastName],Count(UR.[RoleId]) as [Count]
from [b.website-sitecore-core].[dbo].[aspnet_UsersInRoles] UR
inner join [b.we... | 2014/07/19 | [
"https://dba.stackexchange.com/questions/71887",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/31120/"
] | *Note: This answer is intended as a supplement to [@Lukas Eder's answer](https://dba.stackexchange.com/a/71889/52150)*
If there are multiple values present for the fields `SELECT`ed but a field you wish to `GROUP BY`, you could instead grab the top matching line, rather than waiting for an aggregation (`MAX`) to retur... | I had this same problem when I wanted to group by something from a transactional table where the timestamp was the latest entry. So for example an audit table that had a username, someUniqueId and a timestamp.
So I could get the max timestamp of when all the objects were last updated via:
```
SELECT max(timeStamp) ... |
57,398,784 | I have a fairly large dataset containing several columns (over 100). I want to check which ones are completely empty so that they can be dropped.
I'm using this code `len(df.col_name.value_counts()) > 0` to plug in different columns to check but this is painfully slow. Is there a way I can check using a for loop? | 2019/08/07 | [
"https://Stackoverflow.com/questions/57398784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11698918/"
] | We could leverage [`broadcasting`](https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) -
```
v = vec3.reshape(-1,3)*vec1[:,None]
m = vec1<0.5
vec2_out = (v*m[:,None]).ravel()
```
Another way to express that would be -
```
mask = vec1<0.5
vec2_out = (vec3.reshape(-1,3)*(vec1*mask)[:,None]).ravel()
```
... | `numpy.vectorize`, [as mentioned in the comments](https://stackoverflow.com/questions/57398731/how-to-vectorize-operation-with-vectors-of-different-size/57398980#comment101279031_57398731), is for convenience, not performance, [per the docs](https://docs.scipy.org/doc/numpy/reference/generated/numpy.vectorize.html):
>... |
57,398,784 | I have a fairly large dataset containing several columns (over 100). I want to check which ones are completely empty so that they can be dropped.
I'm using this code `len(df.col_name.value_counts()) > 0` to plug in different columns to check but this is painfully slow. Is there a way I can check using a for loop? | 2019/08/07 | [
"https://Stackoverflow.com/questions/57398784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11698918/"
] | We could leverage [`broadcasting`](https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) -
```
v = vec3.reshape(-1,3)*vec1[:,None]
m = vec1<0.5
vec2_out = (v*m[:,None]).ravel()
```
Another way to express that would be -
```
mask = vec1<0.5
vec2_out = (vec3.reshape(-1,3)*(vec1*mask)[:,None]).ravel()
```
... | The reshape/broadcasting that @Divakar demonstrates is equivalent to rewriting your iteration as:
```
In [5]: n = 10
...: vec1 = np.random.rand(n)
...: vec2 = np.zeros((n,3))
...: vec3 = np.random.rand(n,3)
...:
...: for i in range(len(vec1)):
...: if vec1[i] < 0.5:
...: vec2[i... |
70,615,650 | I want to join an element in this case it's "\*" between each element of the list but not at the first position and not in the last position
How can I do this ?
Code :
```
import math
def decompose(n:int):
factors = []
if n < 2:
return False
for d in range(2, int(math.sqrt(n)) +1):
if... | 2022/01/07 | [
"https://Stackoverflow.com/questions/70615650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17842879/"
] | This way:
```py
def decompose(n: int):
factors = []
if n < 2:
return False
d = 2
while d <= n:
while n % d == 0:
factors.append(str(d))
n //= d
d += 1
if n > 1:
factors.append(str(n))
print(f"The decomposition of {number5} in prime fact... | One good way to return the factors from the method and then iterate the list as string value.
```
import math
def decompose(n: int):
factors = []
if n < 2:
return False
for d in range(2, int(math.sqrt(n)) + 1):
if n % d == 0:
factors.append(d)
return factors
number5 = int(... |
70,615,650 | I want to join an element in this case it's "\*" between each element of the list but not at the first position and not in the last position
How can I do this ?
Code :
```
import math
def decompose(n:int):
factors = []
if n < 2:
return False
for d in range(2, int(math.sqrt(n)) +1):
if... | 2022/01/07 | [
"https://Stackoverflow.com/questions/70615650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17842879/"
] | This way:
```py
def decompose(n: int):
factors = []
if n < 2:
return False
d = 2
while d <= n:
while n % d == 0:
factors.append(str(d))
n //= d
d += 1
if n > 1:
factors.append(str(n))
print(f"The decomposition of {number5} in prime fact... | There are different ways to do this, the following explanation is just one way.
In this line:
```
factors = str(factors)
```
You are turning the list itself into a string. You need to turn each item in the list into strings if you want to join them. You can do this by using a list comprehension:
```
factors = [str... |
482,756 | In my Abstract Algebra class, the professor defined a restriction as
Given $ X\xrightarrow{f} Y $ and a non-void subset $S$ of $X$ define $ f \mid S\xrightarrow{S} Y $ by $(f \mid S )(s) = f(s), \forall s \in S$
He literally just pulled this one out of a hat without explaining what he meant by restriction or even ... | 2013/09/03 | [
"https://math.stackexchange.com/questions/482756",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/58540/"
] | Let $d$ be the distance between your starting and ending points, and $b$ the bulge. Note that the starting point, the midpoint of the starting and ending points, and the centre of the circle form a right triangle.
If $r$ is the radius of the circle, we have $r^2 = (d/2)^2 + (r-b)^2$.
Solving that for $r$, we get $$ ... | On the page I've been lookinga t on the subject <http://www.afralisp.net/archive/lisp/Bulges1.htm> they actually have that c (for chord) is the distance between the 2 points and $s = (c/2)\*b$ (s for sagitta) with $r = ((c/2)^2+s^2)/2s$
On the webpage I've listed above it explains very well why the travel angle is 4a... |
482,756 | In my Abstract Algebra class, the professor defined a restriction as
Given $ X\xrightarrow{f} Y $ and a non-void subset $S$ of $X$ define $ f \mid S\xrightarrow{S} Y $ by $(f \mid S )(s) = f(s), \forall s \in S$
He literally just pulled this one out of a hat without explaining what he meant by restriction or even ... | 2013/09/03 | [
"https://math.stackexchange.com/questions/482756",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/58540/"
] | Let $d$ be the distance between your starting and ending points, and $b$ the bulge. Note that the starting point, the midpoint of the starting and ending points, and the centre of the circle form a right triangle.
If $r$ is the radius of the circle, we have $r^2 = (d/2)^2 + (r-b)^2$.
Solving that for $r$, we get $$ ... | OK. I started trying to express my solution in words, and found out it was faster to write it in Matlab. If you're not familiar with matlab, the only subtlety is that variables store arrays of data, so p = [2 4] makes a 1 x 2 array with two elements, p(1) = 2 and p(2) = 4. (Note that indexing starts at 1, not zero). To... |
26,253,369 | I'm trying to create a cross platform app using Xamarin.Forms. As far as I know, the UI will be created from the code and the .axml file will be generated automatically.
Can I modify the .axml file to edit the UI? I tried editing but all that comes up is what is written in the code. ie: `hello forms`
**UPDATE**
```
... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26253369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/848968/"
] | In **Xamarin.Forms** you can create your pages from markup definitions that are shared across all platforms.
Typically you will write all your content pages using **Xamarin.Forms**, however you can mix-and-match native pages into an application should you so wish.
These shared common pages, written in **Xamarin.Forms... | You got it wrong. Forms are created either through code or XAML. No axml or anything persistent is generated at platform level, everything is done in runtime(XAML is sort of compiled at compile time).
So, modify either code or XAML if you wish to change something. Or, if you need something more demanding, than conside... |
26,253,369 | I'm trying to create a cross platform app using Xamarin.Forms. As far as I know, the UI will be created from the code and the .axml file will be generated automatically.
Can I modify the .axml file to edit the UI? I tried editing but all that comes up is what is written in the code. ie: `hello forms`
**UPDATE**
```
... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26253369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/848968/"
] | Along with the previous answer re: .xaml instead of .axml, you need to remember to change the startup code in app.cs to use your new .xaml form. Replace the "new ContentPage {...};" with "new MyForm();" (where "MyForm" is the name of your shiny new XAML form).
EDIT: Downloaded the project from the dropbox link. Commen... | You got it wrong. Forms are created either through code or XAML. No axml or anything persistent is generated at platform level, everything is done in runtime(XAML is sort of compiled at compile time).
So, modify either code or XAML if you wish to change something. Or, if you need something more demanding, than conside... |
26,253,369 | I'm trying to create a cross platform app using Xamarin.Forms. As far as I know, the UI will be created from the code and the .axml file will be generated automatically.
Can I modify the .axml file to edit the UI? I tried editing but all that comes up is what is written in the code. ie: `hello forms`
**UPDATE**
```
... | 2014/10/08 | [
"https://Stackoverflow.com/questions/26253369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/848968/"
] | In **Xamarin.Forms** you can create your pages from markup definitions that are shared across all platforms.
Typically you will write all your content pages using **Xamarin.Forms**, however you can mix-and-match native pages into an application should you so wish.
These shared common pages, written in **Xamarin.Forms... | Along with the previous answer re: .xaml instead of .axml, you need to remember to change the startup code in app.cs to use your new .xaml form. Replace the "new ContentPage {...};" with "new MyForm();" (where "MyForm" is the name of your shiny new XAML form).
EDIT: Downloaded the project from the dropbox link. Commen... |
6,612,543 | Full Question: Have Powershell Script using Invoke SQL command, using snappins, I need them to be included in a SQL job, the SQL Server version of Powershell is somewhat crippled, does anyone know a workaround?
From what I have gathered, SQL Management Studio's version of powershell is underpowered, not allowing for ... | 2011/07/07 | [
"https://Stackoverflow.com/questions/6612543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/823694/"
] | So I figured out the answer to my own question. Using this site: <http://www.mssqltips.com/tip.asp?tip=1684> and
<http://www.mssqltips.com/tip.asp?tip=1199>
I figured out that he was able to do so using a SQL Server Agent Proxy, so I followed the yellow brick road, and basically I set up a proxy to my account and was ... | You have to add the snapins each time. In your editor you likely already have them loaded from another script/tab/session. In SQL Server you will need to add something like this to the beginning of the script:
```
IF ( (Get-PSSnapin -Name sqlserverprovidersnapin100 -ErrorAction SilentlyContinue) -eq $null )
{
... |
6,612,543 | Full Question: Have Powershell Script using Invoke SQL command, using snappins, I need them to be included in a SQL job, the SQL Server version of Powershell is somewhat crippled, does anyone know a workaround?
From what I have gathered, SQL Management Studio's version of powershell is underpowered, not allowing for ... | 2011/07/07 | [
"https://Stackoverflow.com/questions/6612543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/823694/"
] | So I figured out the answer to my own question. Using this site: <http://www.mssqltips.com/tip.asp?tip=1684> and
<http://www.mssqltips.com/tip.asp?tip=1199>
I figured out that he was able to do so using a SQL Server Agent Proxy, so I followed the yellow brick road, and basically I set up a proxy to my account and was ... | I'm not sure the error you are trying to workaround - can you post that?
Have you tried this from a PowerShell prompt?
Add-PSSnapin SqlServerCmdletSnapin100 |
764,612 | I have a frameset where I would like to have someone be able to click a button in one frame that does something with the text selected in the other frame. The button in `frame[0]` invokes the following JavaScript to get the selected text from `frame[1]`:
```
self.parent.frames[1].getSelection()
```
The problem, I be... | 2009/04/19 | [
"https://Stackoverflow.com/questions/764612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try using onmousedown rather than onclick as the handler for the button. I believe it will get handled before focus is given to the button and the selection is lost. | Your problem is in something else. Previous selection survives long enough to be recorded on click. It may help you to look at the working code that does what you want to do.
I coded a [smart quote](http://www.mrfixitonline.com/viewtopic.php?t=8025) plugin for [FCKEditor](http://www.fckeditor.net/). It may seem compli... |
58,161,464 | I'm writing an Arduino app (Using platformIO in VSCode), and including an external CAN library (FlexCAN\_T4). I want to define all of my protocol / message handler callbacks in a separate file (protocol.cpp), and refer to them from my main file (main.cpp). So I create a header file (protocol.h) with all my function sig... | 2019/09/30 | [
"https://Stackoverflow.com/questions/58161464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/378184/"
] | Move the code which handles the jump, to an `update` method of the class `person`:
```py
class person(object):
def __init__(self, x, y, width, height):
self.x = x
self.y = y
self.width = width
self.height = height
self.vel = 5
self.IsJump = False
self.jumpCou... | It seems you didn't write codes to react with keyboard input w (`pygame.K_w`) and up (`pygame.K_UP`) at first. However, in your code that you uploaded, player1 (`man`) already can jump with space bar (`K_SPACE`) properly. you can copy that part, and just change some variables for `man2`. |
11,328,802 | Im using ScrollToFixed very successfully, with one catch. I have an expanding div inside my content, if the div is expanded, the scrollToFixed endpoint doesnt dynmaically increase to account for the new height.
So what happens is the endpoint remains fixed to the point originally calculated when the expanding div was... | 2012/07/04 | [
"https://Stackoverflow.com/questions/11328802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/826511/"
] | @user338128 is on the right track; however, the plugin only calculates or recalculates its "endpoint" on initialization or window resize. When the div expands or contracts, call this:
```
$(window).resize()
```
This will cause the plugin to unfix its target then recalculate. | I don't know for sure if it works but when the expanding is done do this
`jQuery(window).scroll();`
What function do you use to expand the div? Could give the link of the plugin? |
11,328,802 | Im using ScrollToFixed very successfully, with one catch. I have an expanding div inside my content, if the div is expanded, the scrollToFixed endpoint doesnt dynmaically increase to account for the new height.
So what happens is the endpoint remains fixed to the point originally calculated when the expanding div was... | 2012/07/04 | [
"https://Stackoverflow.com/questions/11328802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/826511/"
] | The GitHub example says to call `trigger('resize')` on your element and this seems to work as a recalculation is performed. However, there is no 'resize' event bound to your element. But there is on the window and this causes a recalculation.
Looking into the plugin code, there is an event 'resize.ScrollToFixed'. So I... | I don't know for sure if it works but when the expanding is done do this
`jQuery(window).scroll();`
What function do you use to expand the div? Could give the link of the plugin? |
11,328,802 | Im using ScrollToFixed very successfully, with one catch. I have an expanding div inside my content, if the div is expanded, the scrollToFixed endpoint doesnt dynmaically increase to account for the new height.
So what happens is the endpoint remains fixed to the point originally calculated when the expanding div was... | 2012/07/04 | [
"https://Stackoverflow.com/questions/11328802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/826511/"
] | This question is two years old and the given solutions (They are from the Github Page) are not working with my expanding text areas on bootstrap.
Therefore i've written an event listener to dynamic update the plugin base option for the limit.
If anyone has the same problem, here is the fix:
Add this listener to scr... | I don't know for sure if it works but when the expanding is done do this
`jQuery(window).scroll();`
What function do you use to expand the div? Could give the link of the plugin? |
21,437,564 | I have an undirected graph which initially has no edges. Now in every step an edge is added or deleted and one has to check whether the graph has at least one circle. Probably the easiest sufficient condition for that is
connected components + number of edges <= number of nodes.
As the "steps" I mentioned above are ... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21437564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927493/"
] | I suggest you label all the nodes. Use integers, that's easiest.
At any point, your graph will be divided into a number of disjoint subgraphs. Initially, each node is in its own subgraph.
Maintain the condition that each subgraph has a unique label, and all the nodes in the subgraph carry that label. Initially, just ... | If you know which two nodes are being connected by the new edge, you could use some sort of path finding algorithm to detect an alternative path between the two nodes. In other words, if a path exists which connects the two nodes of your new edge before you add the new edge, adding the new edge will create a circle.
Y... |
21,437,564 | I have an undirected graph which initially has no edges. Now in every step an edge is added or deleted and one has to check whether the graph has at least one circle. Probably the easiest sufficient condition for that is
connected components + number of edges <= number of nodes.
As the "steps" I mentioned above are ... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21437564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927493/"
] | If you are keen, you can try to implement a fully dynamic graph connectivity data structure like described in ["Poly-logarithmic deterministic fully-dynamic graph algorithms I: connectivity and minimum spanning tree" by Jacob Holm, Kristian de Lichtenberg, Mikkel Thorup](http://citeseerx.ist.psu.edu/viewdoc/summary?doi... | If you know which two nodes are being connected by the new edge, you could use some sort of path finding algorithm to detect an alternative path between the two nodes. In other words, if a path exists which connects the two nodes of your new edge before you add the new edge, adding the new edge will create a circle.
Y... |
21,437,564 | I have an undirected graph which initially has no edges. Now in every step an edge is added or deleted and one has to check whether the graph has at least one circle. Probably the easiest sufficient condition for that is
connected components + number of edges <= number of nodes.
As the "steps" I mentioned above are ... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21437564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/927493/"
] | If you are keen, you can try to implement a fully dynamic graph connectivity data structure like described in ["Poly-logarithmic deterministic fully-dynamic graph algorithms I: connectivity and minimum spanning tree" by Jacob Holm, Kristian de Lichtenberg, Mikkel Thorup](http://citeseerx.ist.psu.edu/viewdoc/summary?doi... | I suggest you label all the nodes. Use integers, that's easiest.
At any point, your graph will be divided into a number of disjoint subgraphs. Initially, each node is in its own subgraph.
Maintain the condition that each subgraph has a unique label, and all the nodes in the subgraph carry that label. Initially, just ... |
3,794,703 | Consider complex numbers $z,z^2,z^3,z^4$ in that order which form a cyclic quadrilateral . If $\arg z=\alpha$ and $\alpha$ lies in $[0,2\pi]$.Find the values $\alpha$ can take.
I encountered this question in one competitive exam.i tried using the property of cyclic quadrilateral to get $$\arg\left(\frac{z^3-z^4}{z-z^4... | 2020/08/18 | [
"https://math.stackexchange.com/questions/3794703",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/769226/"
] | By Ptolemy we obtain:
$$|z-z^2|\cdot|z^3-z^4|+|z-z^4|\cdot|z^2-z^3|=|z-z^3|\cdot|z^2-z^4|$$ or
$$|z|+|z^2+z+1|=|(z+1)^2|.$$
Now, we can use a triangle inequality.
Id est, for $|z|=r$ we obtain:
$$(\cos\alpha,\sin\alpha)||(r^2\cos2\alpha+r\cos\alpha+1,r^2\sin2\alpha+r\sin\alpha),$$ which gives
$$\sin\alpha(r^2\cos2\alp... | Like in Michael’s solution, use Ptolemy to obtain $|z|+|z^{2}+z+1|=|z^{2}+2z+1|$.
Refer to the picture, it is obvious that $|z^{2}|=1$ and consequentlly $|z|=1$. For $-\frac{2\pi}{3}\leq\alpha\leq\frac{2\pi}{3}$ the equation is valid. Hint: at which angle $\alpha$ does the direction of $z^{2}+z+1$ become opposite of $... |
3,794,703 | Consider complex numbers $z,z^2,z^3,z^4$ in that order which form a cyclic quadrilateral . If $\arg z=\alpha$ and $\alpha$ lies in $[0,2\pi]$.Find the values $\alpha$ can take.
I encountered this question in one competitive exam.i tried using the property of cyclic quadrilateral to get $$\arg\left(\frac{z^3-z^4}{z-z^4... | 2020/08/18 | [
"https://math.stackexchange.com/questions/3794703",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/769226/"
] | Here is an alternative way to render $|z|=1$ -- by mathematical induction, of all things.
Suppose that $z,z^2,z^3,z^4$ lie on a circle for nonzero $z$. Then through multiplying all elements by $z$ we infer that $z^2,z^3,z^4,z^5$ also lie on a circle, which must be the same as the first circle because of the overlappin... | By Ptolemy we obtain:
$$|z-z^2|\cdot|z^3-z^4|+|z-z^4|\cdot|z^2-z^3|=|z-z^3|\cdot|z^2-z^4|$$ or
$$|z|+|z^2+z+1|=|(z+1)^2|.$$
Now, we can use a triangle inequality.
Id est, for $|z|=r$ we obtain:
$$(\cos\alpha,\sin\alpha)||(r^2\cos2\alpha+r\cos\alpha+1,r^2\sin2\alpha+r\sin\alpha),$$ which gives
$$\sin\alpha(r^2\cos2\alp... |
3,794,703 | Consider complex numbers $z,z^2,z^3,z^4$ in that order which form a cyclic quadrilateral . If $\arg z=\alpha$ and $\alpha$ lies in $[0,2\pi]$.Find the values $\alpha$ can take.
I encountered this question in one competitive exam.i tried using the property of cyclic quadrilateral to get $$\arg\left(\frac{z^3-z^4}{z-z^4... | 2020/08/18 | [
"https://math.stackexchange.com/questions/3794703",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/769226/"
] | By Ptolemy we obtain:
$$|z-z^2|\cdot|z^3-z^4|+|z-z^4|\cdot|z^2-z^3|=|z-z^3|\cdot|z^2-z^4|$$ or
$$|z|+|z^2+z+1|=|(z+1)^2|.$$
Now, we can use a triangle inequality.
Id est, for $|z|=r$ we obtain:
$$(\cos\alpha,\sin\alpha)||(r^2\cos2\alpha+r\cos\alpha+1,r^2\sin2\alpha+r\sin\alpha),$$ which gives
$$\sin\alpha(r^2\cos2\alp... | **For the modulus issue,** let us use the classical equivalence (see [here](https://proofwiki.org/wiki/Quadrilateral_in_Complex_Plane_is_Cyclic_iff_Cross_Ratio_of_Vertices_is_Real)):
$$a,b,c,d \ \text{constitute a cyclic quadrilateral} \ \iff \ $$
$$\underbrace{[a,c;b,d]}\_{\text{cross ratio}}=\frac{(b-a)}{(b-c)} /\fr... |
3,794,703 | Consider complex numbers $z,z^2,z^3,z^4$ in that order which form a cyclic quadrilateral . If $\arg z=\alpha$ and $\alpha$ lies in $[0,2\pi]$.Find the values $\alpha$ can take.
I encountered this question in one competitive exam.i tried using the property of cyclic quadrilateral to get $$\arg\left(\frac{z^3-z^4}{z-z^4... | 2020/08/18 | [
"https://math.stackexchange.com/questions/3794703",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/769226/"
] | Here is an alternative way to render $|z|=1$ -- by mathematical induction, of all things.
Suppose that $z,z^2,z^3,z^4$ lie on a circle for nonzero $z$. Then through multiplying all elements by $z$ we infer that $z^2,z^3,z^4,z^5$ also lie on a circle, which must be the same as the first circle because of the overlappin... | Like in Michael’s solution, use Ptolemy to obtain $|z|+|z^{2}+z+1|=|z^{2}+2z+1|$.
Refer to the picture, it is obvious that $|z^{2}|=1$ and consequentlly $|z|=1$. For $-\frac{2\pi}{3}\leq\alpha\leq\frac{2\pi}{3}$ the equation is valid. Hint: at which angle $\alpha$ does the direction of $z^{2}+z+1$ become opposite of $... |
3,794,703 | Consider complex numbers $z,z^2,z^3,z^4$ in that order which form a cyclic quadrilateral . If $\arg z=\alpha$ and $\alpha$ lies in $[0,2\pi]$.Find the values $\alpha$ can take.
I encountered this question in one competitive exam.i tried using the property of cyclic quadrilateral to get $$\arg\left(\frac{z^3-z^4}{z-z^4... | 2020/08/18 | [
"https://math.stackexchange.com/questions/3794703",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/769226/"
] | Here is an alternative way to render $|z|=1$ -- by mathematical induction, of all things.
Suppose that $z,z^2,z^3,z^4$ lie on a circle for nonzero $z$. Then through multiplying all elements by $z$ we infer that $z^2,z^3,z^4,z^5$ also lie on a circle, which must be the same as the first circle because of the overlappin... | **For the modulus issue,** let us use the classical equivalence (see [here](https://proofwiki.org/wiki/Quadrilateral_in_Complex_Plane_is_Cyclic_iff_Cross_Ratio_of_Vertices_is_Real)):
$$a,b,c,d \ \text{constitute a cyclic quadrilateral} \ \iff \ $$
$$\underbrace{[a,c;b,d]}\_{\text{cross ratio}}=\frac{(b-a)}{(b-c)} /\fr... |
30,165,023 | I'm new to FIT and FitNess and I'm wondering if is possible to cascade method calls without defining special fixtures.
Background: we are testing our web based GUI with Selenium WebDriver. I have created a framework based on the PageObject pattern to decouple the HTML from the page logic. This framework is used in our... | 2015/05/11 | [
"https://Stackoverflow.com/questions/30165023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4886742/"
] | You can use System.Xml.Linq namespace to create xml. Code snippet in C#:
```
XDocument doc = new XDocument(
new XElement("Project ",
new XAttribute("Title", "old one"),
new XAttribute("Version", "1.5.1.0"),
new XAttribute("Author", ""),
new XAttribute("EmphasisColor1Label", ""),
... | **Using LINQ**:-
```
using System.Xml.Linq;
var xml =
new XElement("Project",
new XAttribute("Title", "old one"),
new XAttribute("Version", "1.5.1.0"),
new XAttribute("Author", ""),
new XAttribute("EmphasisColor1Label", ""),
new XAttribute("Emph... |
30,165,023 | I'm new to FIT and FitNess and I'm wondering if is possible to cascade method calls without defining special fixtures.
Background: we are testing our web based GUI with Selenium WebDriver. I have created a framework based on the PageObject pattern to decouple the HTML from the page logic. This framework is used in our... | 2015/05/11 | [
"https://Stackoverflow.com/questions/30165023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4886742/"
] | You can use System.Xml.Linq namespace to create xml. Code snippet in C#:
```
XDocument doc = new XDocument(
new XElement("Project ",
new XAttribute("Title", "old one"),
new XAttribute("Version", "1.5.1.0"),
new XAttribute("Author", ""),
new XAttribute("EmphasisColor1Label", ""),
... | **WITHOUT LINQ:-**
```
XmlDocument doc = new XmlDocument();
XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
doc.AppendChild(decl);
XmlElement ChatMapper = doc.CreateElement("Project");
ChatMapper.SetAttribute("Title", "old one");
ChatMapper.SetAttribute("V... |
28,001 | I used Pleco on iOS to recognize the characters in the table of contents of a book. The font was a simulation of handwriting, so I was quite surprised at better than ninety percent accuracy. Although, irritatingly, it attempted to recognize 汉字 in the Arabic page numbers.
But the OCR feature has disappeared from the ap... | 2017/12/09 | [
"https://chinese.stackexchange.com/questions/28001",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/15442/"
] | I use command line tesseract chi-sim or cuneiform when I need to do that. The picture has to be high enough resolution or you will get a lot of errors. | You can try tencent cloud [link](https://cloud.tencent.com/product/ocr?lang=en) or baidu cloud [link](https://cloud.baidu.com/product/ocr.html) if you're able to code a computer program. And aliyun also host third-party OCR APIs. |
28,001 | I used Pleco on iOS to recognize the characters in the table of contents of a book. The font was a simulation of handwriting, so I was quite surprised at better than ninety percent accuracy. Although, irritatingly, it attempted to recognize 汉字 in the Arabic page numbers.
But the OCR feature has disappeared from the ap... | 2017/12/09 | [
"https://chinese.stackexchange.com/questions/28001",
"https://chinese.stackexchange.com",
"https://chinese.stackexchange.com/users/15442/"
] | I was intending to try the command-line options mentioned by Pedroski, but I stumbled on [Cisdem PDF Converter OCR](https://www.cisdem.com/resource/best-chinese-ocr-software.html)
Does a better job than Pleco with worse image quality.
And the vendor of Pleco says they have licensed the same engine for their next majo... | You can try tencent cloud [link](https://cloud.tencent.com/product/ocr?lang=en) or baidu cloud [link](https://cloud.baidu.com/product/ocr.html) if you're able to code a computer program. And aliyun also host third-party OCR APIs. |
533,960 | I have been reading a lot about [Reinforcement Learning](http://en.wikipedia.org/wiki/Reinforcement_Learning) lately, and I have found ["Reinforcement Learning: An Introduction"](http://incompleteideas.net/sutton/book/ebook/the-book.html) to be an excellent guide. The author's helpfully provice [source code](http://inc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | That code is for Macintosh Common Lisp (MCL). It will only run there. Using Clozure CL (CCL) will not help. You would have to comment the graphics code. The random state stuff also is slightly special for MCL. You have to port it to portable Common Lisp ([make-random-state](http://www.lispworks.com/documentation/HyperS... | My guess is that the code is CCL-dependent, so use [CCL](http://www.cliki.net/CCL) instead of CLISP or SBCL. You can download it from here: <http://trac.clozure.com/openmcl> |
533,960 | I have been reading a lot about [Reinforcement Learning](http://en.wikipedia.org/wiki/Reinforcement_Learning) lately, and I have found ["Reinforcement Learning: An Introduction"](http://incompleteideas.net/sutton/book/ebook/the-book.html) to be an excellent guide. The author's helpfully provice [source code](http://inc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | My guess is that the code is CCL-dependent, so use [CCL](http://www.cliki.net/CCL) instead of CLISP or SBCL. You can download it from here: <http://trac.clozure.com/openmcl> | In addition to [Rainer Joswig's answer](https://stackoverflow.com/a/641231/2584145): Once you install Clozure you'll have to update references to the function `RANDOM-STATE` in `utilities.lisp` to `random-mrg31k3p-state`.
More specifically replace: `#.(RANDOM-STATE 64497 9)` with `#.(ccl::random-mrg31k3p-state)`
`ran... |
533,960 | I have been reading a lot about [Reinforcement Learning](http://en.wikipedia.org/wiki/Reinforcement_Learning) lately, and I have found ["Reinforcement Learning: An Introduction"](http://incompleteideas.net/sutton/book/ebook/the-book.html) to be an excellent guide. The author's helpfully provice [source code](http://inc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | That code is for Macintosh Common Lisp (MCL). It will only run there. Using Clozure CL (CCL) will not help. You would have to comment the graphics code. The random state stuff also is slightly special for MCL. You have to port it to portable Common Lisp ([make-random-state](http://www.lispworks.com/documentation/HyperS... | Using the latest version of CCL on linux x86, with this file saved as foo.lisp:
```
#+ccl (defun random-state (x y)
(ccl::initialize-random-state x y))
(load "utilities.lisp")
(use-package 'rss-utilities)
(load "testbed.lisp")
(setup)
(init)
(print (runs 10 10 .1))
```
Running
```
~/svn/ccl/lx86cl -l fo... |
533,960 | I have been reading a lot about [Reinforcement Learning](http://en.wikipedia.org/wiki/Reinforcement_Learning) lately, and I have found ["Reinforcement Learning: An Introduction"](http://incompleteideas.net/sutton/book/ebook/the-book.html) to be an excellent guide. The author's helpfully provice [source code](http://inc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | That code is for Macintosh Common Lisp (MCL). It will only run there. Using Clozure CL (CCL) will not help. You would have to comment the graphics code. The random state stuff also is slightly special for MCL. You have to port it to portable Common Lisp ([make-random-state](http://www.lispworks.com/documentation/HyperS... | If you have never used lisp in a meaningful way, there is a [Matlab code](http://waxworksmath.com/Authors/N_Z/Sutton/sutton.html) for "Reinforcement Learning: An Introduction". |
533,960 | I have been reading a lot about [Reinforcement Learning](http://en.wikipedia.org/wiki/Reinforcement_Learning) lately, and I have found ["Reinforcement Learning: An Introduction"](http://incompleteideas.net/sutton/book/ebook/the-book.html) to be an excellent guide. The author's helpfully provice [source code](http://inc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | That code is for Macintosh Common Lisp (MCL). It will only run there. Using Clozure CL (CCL) will not help. You would have to comment the graphics code. The random state stuff also is slightly special for MCL. You have to port it to portable Common Lisp ([make-random-state](http://www.lispworks.com/documentation/HyperS... | In addition to [Rainer Joswig's answer](https://stackoverflow.com/a/641231/2584145): Once you install Clozure you'll have to update references to the function `RANDOM-STATE` in `utilities.lisp` to `random-mrg31k3p-state`.
More specifically replace: `#.(RANDOM-STATE 64497 9)` with `#.(ccl::random-mrg31k3p-state)`
`ran... |
533,960 | I have been reading a lot about [Reinforcement Learning](http://en.wikipedia.org/wiki/Reinforcement_Learning) lately, and I have found ["Reinforcement Learning: An Introduction"](http://incompleteideas.net/sutton/book/ebook/the-book.html) to be an excellent guide. The author's helpfully provice [source code](http://inc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | Using the latest version of CCL on linux x86, with this file saved as foo.lisp:
```
#+ccl (defun random-state (x y)
(ccl::initialize-random-state x y))
(load "utilities.lisp")
(use-package 'rss-utilities)
(load "testbed.lisp")
(setup)
(init)
(print (runs 10 10 .1))
```
Running
```
~/svn/ccl/lx86cl -l fo... | In addition to [Rainer Joswig's answer](https://stackoverflow.com/a/641231/2584145): Once you install Clozure you'll have to update references to the function `RANDOM-STATE` in `utilities.lisp` to `random-mrg31k3p-state`.
More specifically replace: `#.(RANDOM-STATE 64497 9)` with `#.(ccl::random-mrg31k3p-state)`
`ran... |
533,960 | I have been reading a lot about [Reinforcement Learning](http://en.wikipedia.org/wiki/Reinforcement_Learning) lately, and I have found ["Reinforcement Learning: An Introduction"](http://incompleteideas.net/sutton/book/ebook/the-book.html) to be an excellent guide. The author's helpfully provice [source code](http://inc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | If you have never used lisp in a meaningful way, there is a [Matlab code](http://waxworksmath.com/Authors/N_Z/Sutton/sutton.html) for "Reinforcement Learning: An Introduction". | In addition to [Rainer Joswig's answer](https://stackoverflow.com/a/641231/2584145): Once you install Clozure you'll have to update references to the function `RANDOM-STATE` in `utilities.lisp` to `random-mrg31k3p-state`.
More specifically replace: `#.(RANDOM-STATE 64497 9)` with `#.(ccl::random-mrg31k3p-state)`
`ran... |
62,101,980 | I have the following dictionary and I want to add these in to a pandas dataframe:
```
crimes1 = {'SOUTHERN': 28445,
'NORTHERN': 20100,
'MISSION': 19503}
```
I create the blank dataframe with the column names I want:
```
column_names = ['Neighborhood', 'Count']
crimes2 = pd.DataFrame(columns=column_names)
```
Ne... | 2020/05/30 | [
"https://Stackoverflow.com/questions/62101980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11659974/"
] | I would try to process the attributes with a recursive template and keep the mapping from attribute names to HTML elements in a map (in XSLT as supported since Saxon 9.8 you can use an XPath 3.1 map but in XSLT 2 if you need to use that rather old version of Saxon you can of course define some variable holding an XML s... | I found that this works:
```
<xsl:template match="PARA">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="EMPH">
<xsl:choose>
<xsl:when test="@BOLD=1"><b><xsl:value-of select="text()"/></b></xsl:when>
<xsl:when test="@HL='HIGH'"><sup><xsl:value-of select="text()"/></sup></xsl:when>
... |
300,744 | I've created a page using Page Manager, at the route `/project/(node}/attendance`.
I need to add a custom access check on it, comparing information about the current user with the node to see if they should have access.
I have added a route subscriber, but when I loop through the route collection, my route does not a... | 2021/03/08 | [
"https://drupal.stackexchange.com/questions/300744",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/94098/"
] | The module already allows you to create Condition plugins by extending the **ConditionPluginBase** class.
There is an `evaluate()` method that you can put your logic in.
This plugin will be available then under the Page manager UI under "Page access" menu:
[ is failing to build on Travis, throwing a `GC overhead limit exceeded` error despite compiling fine locally with the same `MAVEN_OPTS=-Xmx3g -XX:MaxPermSize=512m`. I suspect that Travis is somehow ignoring my `MAVEN_OPTS`: When I try to test against Oracle JDK 8, Travis logs:
```
$ Set... | 2015/03/23 | [
"https://Stackoverflow.com/questions/29201549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121413/"
] | **UPDATE (11/2/15):**
This was finally fully resolved [here](https://github.com/travis-ci/travis-ci/issues/4613#issuecomment-135215956). Quoting:
If you want to use container-based builds (not relying on sudo), you can echo what you want into a `$HOME/.mavenrc` file and that will take precedence over `/etc/mavenrc`, ... | While it is possible to set `-Xmx3g` in Travis CI builds, its servers have limited memory to be free for JVM heap in forked surefire tests.
Here is project that use `-Xmx2560m` for max speed on Travis CI:
<https://github.com/plokhotnyuk/actors/blob/8f22977981e0c4d21b67beee994b339eb787ee9a/pom.xml#L151>
You can check ... |
29,201,549 | My Scala project (Maven-managed) is failing to build on Travis, throwing a `GC overhead limit exceeded` error despite compiling fine locally with the same `MAVEN_OPTS=-Xmx3g -XX:MaxPermSize=512m`. I suspect that Travis is somehow ignoring my `MAVEN_OPTS`: When I try to test against Oracle JDK 8, Travis logs:
```
$ Set... | 2015/03/23 | [
"https://Stackoverflow.com/questions/29201549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121413/"
] | `export MAVEN_SKIP_RC=true` is the recommended way of doing this when dealing with a system that has an /etc/mavenrc. This will make it ignore the defaults and read the `MAVEN_OPTS` variable. | While it is possible to set `-Xmx3g` in Travis CI builds, its servers have limited memory to be free for JVM heap in forked surefire tests.
Here is project that use `-Xmx2560m` for max speed on Travis CI:
<https://github.com/plokhotnyuk/actors/blob/8f22977981e0c4d21b67beee994b339eb787ee9a/pom.xml#L151>
You can check ... |
29,201,549 | My Scala project (Maven-managed) is failing to build on Travis, throwing a `GC overhead limit exceeded` error despite compiling fine locally with the same `MAVEN_OPTS=-Xmx3g -XX:MaxPermSize=512m`. I suspect that Travis is somehow ignoring my `MAVEN_OPTS`: When I try to test against Oracle JDK 8, Travis logs:
```
$ Set... | 2015/03/23 | [
"https://Stackoverflow.com/questions/29201549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121413/"
] | While it is possible to set `-Xmx3g` in Travis CI builds, its servers have limited memory to be free for JVM heap in forked surefire tests.
Here is project that use `-Xmx2560m` for max speed on Travis CI:
<https://github.com/plokhotnyuk/actors/blob/8f22977981e0c4d21b67beee994b339eb787ee9a/pom.xml#L151>
You can check ... | This is what finally worked for me.
```
language: java
sudo: false
jdk:
- oraclejdk8
install: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn install -DskipTests=true
script: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn
```
The MAVEN\_SKIP\_RC is needed as @adam says and the MAVEN\_OPTS are what I needed to get javac to ... |
29,201,549 | My Scala project (Maven-managed) is failing to build on Travis, throwing a `GC overhead limit exceeded` error despite compiling fine locally with the same `MAVEN_OPTS=-Xmx3g -XX:MaxPermSize=512m`. I suspect that Travis is somehow ignoring my `MAVEN_OPTS`: When I try to test against Oracle JDK 8, Travis logs:
```
$ Set... | 2015/03/23 | [
"https://Stackoverflow.com/questions/29201549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121413/"
] | **UPDATE (11/2/15):**
This was finally fully resolved [here](https://github.com/travis-ci/travis-ci/issues/4613#issuecomment-135215956). Quoting:
If you want to use container-based builds (not relying on sudo), you can echo what you want into a `$HOME/.mavenrc` file and that will take precedence over `/etc/mavenrc`, ... | `export MAVEN_SKIP_RC=true` is the recommended way of doing this when dealing with a system that has an /etc/mavenrc. This will make it ignore the defaults and read the `MAVEN_OPTS` variable. |
29,201,549 | My Scala project (Maven-managed) is failing to build on Travis, throwing a `GC overhead limit exceeded` error despite compiling fine locally with the same `MAVEN_OPTS=-Xmx3g -XX:MaxPermSize=512m`. I suspect that Travis is somehow ignoring my `MAVEN_OPTS`: When I try to test against Oracle JDK 8, Travis logs:
```
$ Set... | 2015/03/23 | [
"https://Stackoverflow.com/questions/29201549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121413/"
] | **UPDATE (11/2/15):**
This was finally fully resolved [here](https://github.com/travis-ci/travis-ci/issues/4613#issuecomment-135215956). Quoting:
If you want to use container-based builds (not relying on sudo), you can echo what you want into a `$HOME/.mavenrc` file and that will take precedence over `/etc/mavenrc`, ... | This is what finally worked for me.
```
language: java
sudo: false
jdk:
- oraclejdk8
install: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn install -DskipTests=true
script: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn
```
The MAVEN\_SKIP\_RC is needed as @adam says and the MAVEN\_OPTS are what I needed to get javac to ... |
29,201,549 | My Scala project (Maven-managed) is failing to build on Travis, throwing a `GC overhead limit exceeded` error despite compiling fine locally with the same `MAVEN_OPTS=-Xmx3g -XX:MaxPermSize=512m`. I suspect that Travis is somehow ignoring my `MAVEN_OPTS`: When I try to test against Oracle JDK 8, Travis logs:
```
$ Set... | 2015/03/23 | [
"https://Stackoverflow.com/questions/29201549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4121413/"
] | `export MAVEN_SKIP_RC=true` is the recommended way of doing this when dealing with a system that has an /etc/mavenrc. This will make it ignore the defaults and read the `MAVEN_OPTS` variable. | This is what finally worked for me.
```
language: java
sudo: false
jdk:
- oraclejdk8
install: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn install -DskipTests=true
script: MAVEN_SKIP_RC=true MAVEN_OPTS="-Xss4M" mvn
```
The MAVEN\_SKIP\_RC is needed as @adam says and the MAVEN\_OPTS are what I needed to get javac to ... |
28,092,057 | I have this problem when I collapse my webpage, the header shrinks instead of staying stretched across the entire page.

In this situation, I really have no idea what code to post along with it. I've tried various ways to fix it and nothing seems to ... | 2015/01/22 | [
"https://Stackoverflow.com/questions/28092057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4454027/"
] | Use [`array_map`](http://php.net/manual/en/function.array-map.php) instead.
```
$numbs = array(3, 5.5, -10.5);
$numbs = array_map("ceil", $numbs);
print_r($numbs);
```
[`array_walk`](http://php.net/manual/en/function.array-walk.php) actually passes 2 parameters to the callback, and some built-in functions don't like... | That is because `array_walk` needs function which first parameter is a reference `&`
```
function myCeil(&$value){
$value = ceil($value);
}
$numbs = array(3, 5.5, -10.5);
array_walk($numbs, "myCeil");
print_r($numbs);
``` |
28,092,057 | I have this problem when I collapse my webpage, the header shrinks instead of staying stretched across the entire page.

In this situation, I really have no idea what code to post along with it. I've tried various ways to fix it and nothing seems to ... | 2015/01/22 | [
"https://Stackoverflow.com/questions/28092057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4454027/"
] | Use [`array_map`](http://php.net/manual/en/function.array-map.php) instead.
```
$numbs = array(3, 5.5, -10.5);
$numbs = array_map("ceil", $numbs);
print_r($numbs);
```
[`array_walk`](http://php.net/manual/en/function.array-walk.php) actually passes 2 parameters to the callback, and some built-in functions don't like... | The reason it doesn't work is because `ceil($param)` expects only one parameter instead of two.
What you can do:
```
$numbs = array(3, 5.5, -10.5);
array_walk($numbs, function($item) {
echo ceil($item);
});
```
If you want to save these values then go ahead and use `array_map` which returns an array.
**UPDA... |
28,092,057 | I have this problem when I collapse my webpage, the header shrinks instead of staying stretched across the entire page.

In this situation, I really have no idea what code to post along with it. I've tried various ways to fix it and nothing seems to ... | 2015/01/22 | [
"https://Stackoverflow.com/questions/28092057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4454027/"
] | I had the same problem with another PHP function.
You can create "your own ceil function".
In that case it is very easy to solve:
```
function myCeil(&$list){
$list = ceil($list);
}
$numbs = [3, 5.5, -10.5];
array_walk($numbs, "myCeil");
// $numbs output
Array
(
[0] => 3
[1] => 6
[2] => -10... | That is because `array_walk` needs function which first parameter is a reference `&`
```
function myCeil(&$value){
$value = ceil($value);
}
$numbs = array(3, 5.5, -10.5);
array_walk($numbs, "myCeil");
print_r($numbs);
``` |
28,092,057 | I have this problem when I collapse my webpage, the header shrinks instead of staying stretched across the entire page.

In this situation, I really have no idea what code to post along with it. I've tried various ways to fix it and nothing seems to ... | 2015/01/22 | [
"https://Stackoverflow.com/questions/28092057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4454027/"
] | I had the same problem with another PHP function.
You can create "your own ceil function".
In that case it is very easy to solve:
```
function myCeil(&$list){
$list = ceil($list);
}
$numbs = [3, 5.5, -10.5];
array_walk($numbs, "myCeil");
// $numbs output
Array
(
[0] => 3
[1] => 6
[2] => -10... | The reason it doesn't work is because `ceil($param)` expects only one parameter instead of two.
What you can do:
```
$numbs = array(3, 5.5, -10.5);
array_walk($numbs, function($item) {
echo ceil($item);
});
```
If you want to save these values then go ahead and use `array_map` which returns an array.
**UPDA... |
43,110,713 | Hey I am trying to build an android application regarding google adsense.
I want to import the android sample.
<https://github.com/Ishaan-Kumar/googleads-adsense-examples>
Since I am only interested in android I want to import only this.
<https://github.com/Ishaan-Kumar/googleads-adsense-examples/tree/master/android>
... | 2017/03/30 | [
"https://Stackoverflow.com/questions/43110713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4922328/"
] | Often programmers explain that in there Git Page, some time don't explain. [like it](https://github.com/jitpack/jitpack.io)
Many way to import Github project into your android studio project like this ways
1. use zip git file Like this Step Answer [here]
2. use clone or git in android studio [See this](https://stacko... | Step 1: **Download Zip**. Don't Fork the project or use git command or VCS in android studio.
Step 2: Open Android Studio->New Project->Open->Select android directory.
Step 3: Android Studio tells you this is a eclipse project (Convert it to gradle blah blah). **Hit Next**. This is the time I came to know this is an ... |
40,110,466 | In my API I have a function that returns `std::istringstream`.
The [`std::istringstream` class](http://en.cppreference.com/w/cpp/io/basic_istringstream) is non-copyable but supports moving so on a conforming compiler there is no problem returning a local `std::istringstream`.
However, on gcc 4.9, there is [no suppo... | 2016/10/18 | [
"https://Stackoverflow.com/questions/40110466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135862/"
] | You can check if the number of elements is more than 1 with `length` like this:
```js
$(document).ready(function() {
if ($('div *:contains("text")').length > 1){
$('div').css('background','red')
}
});
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<d... | You can even write this:
```
$('h2:contains("text")').length + $('p:contains("text")').length === 2
```
This way you will sure that both h2 and p are matched |
70,443,472 | How am I able to use the column after using groupby?
Let's say
```
x = df_new.groupby('industry')['income'].mean().sort_values(ascending = False)
```
would give:
```
"industry"
telecommunications 330
crypto. 100
gas 100
.
.
.
```
I would like to store the top... | 2021/12/22 | [
"https://Stackoverflow.com/questions/70443472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8936041/"
] | `groupby(...).XXX()` (where `XXX` is some support method, e.g. [`mean`](https://pandas.pydata.org/docs/reference/api/pandas.Series.mean.html), [`sort_values`](https://pandas.pydata.org/docs/reference/api/pandas.Series.sort_values.html), etc.) typical return **Series** objects, where the **index** contains the values th... | You can also convert it into another dataframe using following code
```
x = df_new.groupby('industry')['income'].mean().sort_values(ascending = False).to_frame(name='mean').reset_index()
``` |
42,195,892 | I'm trying to find the square root of a big integer in R language. I'm using package gmp which provides bigz for big integers but it seems it's missing a function for square root. I'm opened to using another package for big integers if needed.
```
library(gmp)
sqrt(as.bigz("113423713055421844361000443349850346743"))
... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42195892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4942300/"
] | This type of problem is exactly what the [Rmpfr](https://cran.r-project.org/web/packages/Rmpfr/Rmpfr.pdf) package was built for.
```
library(Rmpfr)
a <- mpfr("113423713055421844361000443349850346743", 128) ## specify the number of bits
sqrt(a)
1 'mpfr' number of precision 128 bits
[1] 10650056950806500000.0000000... | Sometimes you might want to use logs to do calculations with big numbers. I.e. x^y = exp(y\*log(x)).
```
library(gmp)
x <- 113423713055421844361000443349850346743
as.bigz(exp(0.5*log(as.bigz(x))))
Big Integer ('bigz') :
[1] 10650056950806493184
``` |
33,667,100 | I usually use that kind of method (function) to test if conditions are valid :
```
Function IsShapeSelected(ByRef oShape As Object, Optional bThrowExc As Boolean = False) As Boolean
'Detect if a shape is selected
Dim bOk As Boolean
'Test if shape (and return it byref) is selected (using Try Catch if necess... | 2015/11/12 | [
"https://Stackoverflow.com/questions/33667100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5553762/"
] | To expand on the answer given by Jamiec, one reason, besides it merely being a convention, for not using such behaviour is that oftentimes the method might throw other exceptions for unrelated reasons. So you have a `bool` `throwOnError` which can be set to `false`, but that will only turn off the throwing of some part... | >
> Why is it bad to have arguments like bool throwException on public methods
>
>
>
Simply because it is not the convention of the design guidlines for .NET apps. That does not mean you *can't* do it, it just means that if you follow design conventions, then other programmers will thank you. Of course, this may n... |
54,261,043 | I have searched this forum, and have tried a multitude of possible solutions I found, but nothing is working. can anyone shed some light on this situation? Thanks!
```
SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=TESTdatabase;Integrated Security=True");
con.Open();
SqlCommand cmd =... | 2019/01/18 | [
"https://Stackoverflow.com/questions/54261043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10788184/"
] | You could just run a [`SHOW TABLES`](https://dev.mysql.com/doc/refman/8.0/en/show-tables.html) query e.g.
```
SHOW TABLES FROM puzzleGame LIKE 'puzzle%'
```
Then in your PHP you could load them all into an array and deal with the random selection. | Try mysql query:
```
show tables from your_db like '%puzzle%';
```
and then count result |
54,261,043 | I have searched this forum, and have tried a multitude of possible solutions I found, but nothing is working. can anyone shed some light on this situation? Thanks!
```
SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=TESTdatabase;Integrated Security=True");
con.Open();
SqlCommand cmd =... | 2019/01/18 | [
"https://Stackoverflow.com/questions/54261043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10788184/"
] | You could just run a [`SHOW TABLES`](https://dev.mysql.com/doc/refman/8.0/en/show-tables.html) query e.g.
```
SHOW TABLES FROM puzzleGame LIKE 'puzzle%'
```
Then in your PHP you could load them all into an array and deal with the random selection. | I don't know PHP. But I know this MySql query will give your result :
**SELECT TABLE\_NAME from information\_schema.TABLES where TABLE\_SCHEMA='puzzleGame' and TABLE\_TYPE='base table' and TABLE\_NAME like 'Puzzle%';** |
54,261,043 | I have searched this forum, and have tried a multitude of possible solutions I found, but nothing is working. can anyone shed some light on this situation? Thanks!
```
SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=TESTdatabase;Integrated Security=True");
con.Open();
SqlCommand cmd =... | 2019/01/18 | [
"https://Stackoverflow.com/questions/54261043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10788184/"
] | Try mysql query:
```
show tables from your_db like '%puzzle%';
```
and then count result | I don't know PHP. But I know this MySql query will give your result :
**SELECT TABLE\_NAME from information\_schema.TABLES where TABLE\_SCHEMA='puzzleGame' and TABLE\_TYPE='base table' and TABLE\_NAME like 'Puzzle%';** |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Turns out, calling -selectAll: with a non-nil sender displays the menu. Calling it with nil causes it to select the text, but not display the menu.
I tried this after my bug report about it came back from Apple with the suggestion that I pass nil instead of self.
No need to muck with UIMenuController or other selecti... | If you mean how would you allow the user to edit the text in a uitextfield then just assign firstResponder to it:
```
[textField becomeFirstResponder]
```
If you mean how do you get the text in the uitextfield than this will do it:
```
textField.text
```
If you mean actually select the text (as in highlight it) t... |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Thats what did the trick for me:
```
[self.titleField setSelectedTextRange:[self.titleField textRangeFromPosition:self.titleField.beginningOfDocument toPosition:self.titleField.endOfDocument]];
```
Pretty ugly but it works, so there will be no sharedMenuController shown!
To fix the "only works every second time" pr... | Swift 3:
```
textField.selectAll(self)
``` |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | **Swift**
Select all text in a `UITextField`:
```
textField.selectedTextRange = textField.textRange(from: textField.beginningOfDocument, to: textField.endOfDocument)
```
My full answer is here: <https://stackoverflow.com/a/34922332/3681880> | Swift 3:
```
textField.selectAll(self)
``` |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Thats what did the trick for me:
```
[self.titleField setSelectedTextRange:[self.titleField textRangeFromPosition:self.titleField.beginningOfDocument toPosition:self.titleField.endOfDocument]];
```
Pretty ugly but it works, so there will be no sharedMenuController shown!
To fix the "only works every second time" pr... | This is the best solution I've found. No sharedMenuController, and it works consecutively:
```
-(void)textFieldDidBeginEditing:(UITextField *)textField
{
[textField performSelector:@selector(selectAll:) withObject:nil afterDelay:0.1];
}
``` |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Thats what did the trick for me:
```
[self.titleField setSelectedTextRange:[self.titleField textRangeFromPosition:self.titleField.beginningOfDocument toPosition:self.titleField.endOfDocument]];
```
Pretty ugly but it works, so there will be no sharedMenuController shown!
To fix the "only works every second time" pr... | To be able to select text, the text field has to be editable. To know when the text field is editable use the delegate methods:
```
- (void)textFieldDidBeginEditing:(UITextField *)textField
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
```
I don't think textFieldShouldBeginEditing: is required but it'... |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Use what you need
**ObjC**
```
[yourtextField becomeFirstResponder]; //puts cursor on text field
[yourtextField selectAll:nil]; //highlights text
[yourtextField selectAll:self]; //highlights text and shows menu(cut copy paste)
```
**Swift**
```
yourTextField.becomeFirstResponder() //puts cursor on text field
your... | ```
UITextField *tf = yourTF;
// hide cursor (you have store default color!!!)
[[tf valueForKey:@"textInputTraits"] setValue:[UIColor clearColor]
forKey:@"insertionPointColor"];
// enable selection
[tf selectAll:self];
// insert your string here
// and select nothing (!!!)
[tf set... |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Thats what did the trick for me:
```
[self.titleField setSelectedTextRange:[self.titleField textRangeFromPosition:self.titleField.beginningOfDocument toPosition:self.titleField.endOfDocument]];
```
Pretty ugly but it works, so there will be no sharedMenuController shown!
To fix the "only works every second time" pr... | Unfortunately I don't think you can do that.
I'm not sure if this helps you, but `setClearsOnBeginEditing` lets you specify that the `UITextField` should delete the existing value when the user starts editing (this is the default for secure `UITextFields`). |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Thats what did the trick for me:
```
[self.titleField setSelectedTextRange:[self.titleField textRangeFromPosition:self.titleField.beginningOfDocument toPosition:self.titleField.endOfDocument]];
```
Pretty ugly but it works, so there will be no sharedMenuController shown!
To fix the "only works every second time" pr... | **Swift**
Select all text in a `UITextField`:
```
textField.selectedTextRange = textField.textRange(from: textField.beginningOfDocument, to: textField.endOfDocument)
```
My full answer is here: <https://stackoverflow.com/a/34922332/3681880> |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | **Swift**
Select all text in a `UITextField`:
```
textField.selectedTextRange = textField.textRange(from: textField.beginningOfDocument, to: textField.endOfDocument)
```
My full answer is here: <https://stackoverflow.com/a/34922332/3681880> | Unfortunately I don't think you can do that.
I'm not sure if this helps you, but `setClearsOnBeginEditing` lets you specify that the `UITextField` should delete the existing value when the user starts editing (this is the default for secure `UITextFields`). |
1,689,911 | How can I programmatically select all text in UITextField? | 2009/11/06 | [
"https://Stackoverflow.com/questions/1689911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1431916/"
] | Unfortunately I don't think you can do that.
I'm not sure if this helps you, but `setClearsOnBeginEditing` lets you specify that the `UITextField` should delete the existing value when the user starts editing (this is the default for secure `UITextFields`). | If you mean how would you allow the user to edit the text in a uitextfield then just assign firstResponder to it:
```
[textField becomeFirstResponder]
```
If you mean how do you get the text in the uitextfield than this will do it:
```
textField.text
```
If you mean actually select the text (as in highlight it) t... |
27,734,265 | Im trying to configure the Sonata AdminBundle. Its a very interesting bundle with many functionalities however it is not straightforward to use. I have a Post entity so I can tweak the posts, as in the doc manual. I want to implement a child Admin, for the comments of each post (a Many to One relationship). I implement... | 2015/01/01 | [
"https://Stackoverflow.com/questions/27734265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3811602/"
] | Remove
```
/**
* @return mixed
*/
public function __toString()
{
return $this->comments;
}
```
from your Post entity and add it to your comments entity but change $this->comments to the field used for the body of your comment. | IMO :
```
/**
* @return mixed
*/
public function __toString()
{
return $this->comments;
}
```
This method must return a string and not an array collection |
33,602,574 | This code here is for reversing words in a string. The problem is that it only reverses the first word in the string. When I ran a trace I found that it is stopping after encountering the statement `if(s[indexCount] == '\0') break;`
Why the code is getting null character every time the first word is reversed even thou... | 2015/11/09 | [
"https://Stackoverflow.com/questions/33602574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3480088/"
] | ```
from collections import defaultdict
d = defaultdict(float)
for name, amt in a:
d[name] += amt
```
What this does is to create a dict where the amount will be zero (`float()`) by default, and then sum up using the names as keys.
If you really need the result to be a list, you can get it this way:
```
>>> pri... | ```
from collections import defaultdict
d = defaultdict(list)
l=[['Acer', 481242.74], ['Beko', 966071.86], ['Cemex', 187242.16], ['Datsun', 748502.91], ['Equifax', 146517.59], ['Gerdau', 898579.89], ['Haribo', 265333.85], ['Gerdau', 13019.63676], ['Gerdau', 34107.12062], ['Acer', 52153.02848]]
for k,v in l:
d[k].ap... |
33,602,574 | This code here is for reversing words in a string. The problem is that it only reverses the first word in the string. When I ran a trace I found that it is stopping after encountering the statement `if(s[indexCount] == '\0') break;`
Why the code is getting null character every time the first word is reversed even thou... | 2015/11/09 | [
"https://Stackoverflow.com/questions/33602574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3480088/"
] | ```
from collections import defaultdict
d = defaultdict(float)
for name, amt in a:
d[name] += amt
```
What this does is to create a dict where the amount will be zero (`float()`) by default, and then sum up using the names as keys.
If you really need the result to be a list, you can get it this way:
```
>>> pri... | `defaultdict` is probably a good way to go but you can do this with a normal dictionary:
```
>>> data = [['Acer', 481242.74], ['Beko', 966071.86], ['Cemex', 187242.16], ...]
>>> result = {}
>>> for k, v in data:
... result[k] = result.get(k, 0) + v
>>> result
{'Acer': 533395.76848, 'Beko': 966071.86, 'Cemex': 1872... |
62,314,352 | I am working on a PokeDex project using the PokeAPI, and could use your help. While trying to handle the json i receive from the API, I am faced with two seemingly distinct array types:
[Console representation of arrays](https://i.stack.imgur.com/78yrD.png)
[Opened array](https://i.stack.imgur.com/GrAAx.png)
For ex... | 2020/06/10 | [
"https://Stackoverflow.com/questions/62314352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13189436/"
] | Please try the following slicing method:
`df[df['Age']>65]` | if you want to to get the rows in which the value of age variable is > 65. Then use this code
```
data['Age']=(data['Age'].loc[data['Age']>65])
```
the values which are below 65 are filled with NaN or remain empty
You can check the min value in this column by writing
```
data.describe(include='all')
```
The min v... |
943,761 | I successfully created a multiboot persistent USB flash drive with [multibootusb](https://github.com/mbusb/multibootusb). The persistent storage was limited (4GB).
However, how can I add a data partition that can be read on Ubuntu and windows?
If `multibootusb` is not the right application to do that, I accept other ... | 2017/08/07 | [
"https://askubuntu.com/questions/943761",
"https://askubuntu.com",
"https://askubuntu.com/users/530032/"
] | Boot the MultiBootUSB drive.
Open Nautilus as root, go to computer/cdrom and make a folder named Shared Data.
Save any stuff you want to share with a Windows computer there, You will need to be root to access the folder.
When plugged into a computer running Windows, the Shared Data folder will be accessible when the... | Use `GParted` to partition the drive with a `Fat32` partition for the live usb and a `ntfs` partition for your data.
[described here](https://askubuntu.com/questions/423300/live-usb-on-a-2-partition-usb-drive) |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | You may use
$$\sqrt[n]a-\sqrt[n]b = \frac{a-b}{\sqrt[n]{a^{n-1}}+\sqrt[n]{a^{n-2}b}+\cdots+\sqrt[n]{b^{n-1}}}$$
to mimic the case of $n=2$. | Here's another, less elementary approach, which may be useful to some.
Recall the definition of the derivative:
$$f'(x)=\lim\_{h\to 0}\frac{f(x+h)-f(x)}h.$$
Using this, your limit is
$$\frac d{dx}\sqrt[n]{1+x}\bigg|\_{x=0}.$$
We have
$$\frac {d(1+x)^{1/n}}{dx}=\frac1n(1+x)^{1/n-1},$$
so the derivative at $0$ is $1/n$. |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | You may use
$$\sqrt[n]a-\sqrt[n]b = \frac{a-b}{\sqrt[n]{a^{n-1}}+\sqrt[n]{a^{n-2}b}+\cdots+\sqrt[n]{b^{n-1}}}$$
to mimic the case of $n=2$. | $$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$
Let's work with numerator. Thanks to the answers of my colleagues I will use this one:
$$\sqrt[n]{1+x}-1=\sqrt[n]{1+x}-\sqrt[n]{1} = \frac{1+x -1}{\sqrt[n]{{(1+x)^n}{1^0}}+\sqrt[n]{(1+x)^{n-1}}{1^1}+...+\sqrt[n]{{(1+x)^0}{1^{n-1}}}}=\frac{x}{1+1+...+1} $$ We ... |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | You may use
$$\sqrt[n]a-\sqrt[n]b = \frac{a-b}{\sqrt[n]{a^{n-1}}+\sqrt[n]{a^{n-2}b}+\cdots+\sqrt[n]{b^{n-1}}}$$
to mimic the case of $n=2$. | $$\lim\_{x\to 0}\frac{\sqrt[n]{1+x}-1}x=\lim\_{x\to 0}\frac{e^{\frac1n\ln(1+x)}-1}x=\lim\_{x\to0}\frac{e^{\frac1n\ln(1+x)}-1}{\frac1n\ln(1+x)}\cdot\frac1n\frac{\ln(1+x)}x=\frac1n.$$
Just use the manual limits $$\boxed{\lim\_{x\to 0}\frac{e^x-1}x=1}\\\boxed{\lim\_{x\to 0}\frac{\ln(1+x)}x=1}$$ |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | You may use
$$\sqrt[n]a-\sqrt[n]b = \frac{a-b}{\sqrt[n]{a^{n-1}}+\sqrt[n]{a^{n-2}b}+\cdots+\sqrt[n]{b^{n-1}}}$$
to mimic the case of $n=2$. | $$y=\frac{\sqrt[n]{1+x}-1}{x}=\frac{A-1}{x}$$
$$A=\sqrt[n]{1+x}\implies \log(A)=\frac 1n \log(1+x)=\frac 1n \Big[x-\frac{x^2}{2}+O\left(x^3\right) \Big]$$
$$A=e^{\log(A)}=1+\frac{x}{n}-\frac{(n-1) x^2}{2 n^2}+O\left(x^3\right)$$
$$y=\frac{A-1}{x}=\frac{1}{n}-\frac{(n-1) x}{2 n^2}+O\left(x^2\right)$$ which shows the lim... |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | You may use
$$\sqrt[n]a-\sqrt[n]b = \frac{a-b}{\sqrt[n]{a^{n-1}}+\sqrt[n]{a^{n-2}b}+\cdots+\sqrt[n]{b^{n-1}}}$$
to mimic the case of $n=2$. | Well, I have an interesting approach to it using non standard Analysis.
The limit is nothing but,
$$st\left(\frac{(1+dx)^{1/n} - 1}{dx}\right)$$
According to [chapter 17](http://faculty.washington.edu/etou/eulersoc/documents/Euler-Introductio_Ch7.pdf) of Euler's book on "The analysis on infinity" $1+dx=e^{dx}$.
$$st\le... |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | Here's another, less elementary approach, which may be useful to some.
Recall the definition of the derivative:
$$f'(x)=\lim\_{h\to 0}\frac{f(x+h)-f(x)}h.$$
Using this, your limit is
$$\frac d{dx}\sqrt[n]{1+x}\bigg|\_{x=0}.$$
We have
$$\frac {d(1+x)^{1/n}}{dx}=\frac1n(1+x)^{1/n-1},$$
so the derivative at $0$ is $1/n$. | Well, I have an interesting approach to it using non standard Analysis.
The limit is nothing but,
$$st\left(\frac{(1+dx)^{1/n} - 1}{dx}\right)$$
According to [chapter 17](http://faculty.washington.edu/etou/eulersoc/documents/Euler-Introductio_Ch7.pdf) of Euler's book on "The analysis on infinity" $1+dx=e^{dx}$.
$$st\le... |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | $$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$
Let's work with numerator. Thanks to the answers of my colleagues I will use this one:
$$\sqrt[n]{1+x}-1=\sqrt[n]{1+x}-\sqrt[n]{1} = \frac{1+x -1}{\sqrt[n]{{(1+x)^n}{1^0}}+\sqrt[n]{(1+x)^{n-1}}{1^1}+...+\sqrt[n]{{(1+x)^0}{1^{n-1}}}}=\frac{x}{1+1+...+1} $$ We ... | Well, I have an interesting approach to it using non standard Analysis.
The limit is nothing but,
$$st\left(\frac{(1+dx)^{1/n} - 1}{dx}\right)$$
According to [chapter 17](http://faculty.washington.edu/etou/eulersoc/documents/Euler-Introductio_Ch7.pdf) of Euler's book on "The analysis on infinity" $1+dx=e^{dx}$.
$$st\le... |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | $$\lim\_{x\to 0}\frac{\sqrt[n]{1+x}-1}x=\lim\_{x\to 0}\frac{e^{\frac1n\ln(1+x)}-1}x=\lim\_{x\to0}\frac{e^{\frac1n\ln(1+x)}-1}{\frac1n\ln(1+x)}\cdot\frac1n\frac{\ln(1+x)}x=\frac1n.$$
Just use the manual limits $$\boxed{\lim\_{x\to 0}\frac{e^x-1}x=1}\\\boxed{\lim\_{x\to 0}\frac{\ln(1+x)}x=1}$$ | Well, I have an interesting approach to it using non standard Analysis.
The limit is nothing but,
$$st\left(\frac{(1+dx)^{1/n} - 1}{dx}\right)$$
According to [chapter 17](http://faculty.washington.edu/etou/eulersoc/documents/Euler-Introductio_Ch7.pdf) of Euler's book on "The analysis on infinity" $1+dx=e^{dx}$.
$$st\le... |
4,308,873 | **What methods can be used to evaluate the limit:
$$\lim\_{x\to 0} \frac{\sqrt[n]{1+x}-1}{x}, n \in \Bbb Z$$**
By the way, as a rule, I use method with conjugate expression for removing problem like this $$ \sqrt[]a - \sqrt[]b = \frac{(\sqrt[]a - \sqrt[]b)(\sqrt[]a + \sqrt[]b)}{ \sqrt[]a + \sqrt[]b} = \frac{a-b}{\sqrt... | 2021/11/17 | [
"https://math.stackexchange.com/questions/4308873",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/994284/"
] | $$y=\frac{\sqrt[n]{1+x}-1}{x}=\frac{A-1}{x}$$
$$A=\sqrt[n]{1+x}\implies \log(A)=\frac 1n \log(1+x)=\frac 1n \Big[x-\frac{x^2}{2}+O\left(x^3\right) \Big]$$
$$A=e^{\log(A)}=1+\frac{x}{n}-\frac{(n-1) x^2}{2 n^2}+O\left(x^3\right)$$
$$y=\frac{A-1}{x}=\frac{1}{n}-\frac{(n-1) x}{2 n^2}+O\left(x^2\right)$$ which shows the lim... | Well, I have an interesting approach to it using non standard Analysis.
The limit is nothing but,
$$st\left(\frac{(1+dx)^{1/n} - 1}{dx}\right)$$
According to [chapter 17](http://faculty.washington.edu/etou/eulersoc/documents/Euler-Introductio_Ch7.pdf) of Euler's book on "The analysis on infinity" $1+dx=e^{dx}$.
$$st\le... |
23,979 | Android phones can be USB tethered via RNDIS protocol on Windows and Linux. As far as I understood Apple does not provide RNDIS driver for OSX.
Are there RNDIS drivers for OSX by third party (Android vendor) or community?
I don't want to use any any app for tethering, I want the real thing, as other operating system... | 2011/09/02 | [
"https://apple.stackexchange.com/questions/23979",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/6545/"
] | Since then, this driver has come out. It's FOSS too.
<http://www.joshuawise.com/horndis> | RNDIS is a Microsoft-proprietary protocol and it's highly unlikely that Apple is going to support it just for the sake of Android tethering.
<http://en.m.wikipedia.org/wiki/RNDIS>
Your best chance is for a 3rd party to write a Mac OS X driver for RNDIS. Don't expect this to be free (as in beer) though.
However you s... |
23,979 | Android phones can be USB tethered via RNDIS protocol on Windows and Linux. As far as I understood Apple does not provide RNDIS driver for OSX.
Are there RNDIS drivers for OSX by third party (Android vendor) or community?
I don't want to use any any app for tethering, I want the real thing, as other operating system... | 2011/09/02 | [
"https://apple.stackexchange.com/questions/23979",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/6545/"
] | RNDIS is a Microsoft-proprietary protocol and it's highly unlikely that Apple is going to support it just for the sake of Android tethering.
<http://en.m.wikipedia.org/wiki/RNDIS>
Your best chance is for a 3rd party to write a Mac OS X driver for RNDIS. Don't expect this to be free (as in beer) though.
However you s... | horndis is a brilliant solution - just started using it yesterday and it's completely stable
I couldn't get my Andriod phone to work as a USB modem.
I compiled it from source for 10.6.8 then used `packagemaker` and the included `packagemaker` project file to create a package to install.
Only gotcha was using `sudo s... |
23,979 | Android phones can be USB tethered via RNDIS protocol on Windows and Linux. As far as I understood Apple does not provide RNDIS driver for OSX.
Are there RNDIS drivers for OSX by third party (Android vendor) or community?
I don't want to use any any app for tethering, I want the real thing, as other operating system... | 2011/09/02 | [
"https://apple.stackexchange.com/questions/23979",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/6545/"
] | Since then, this driver has come out. It's FOSS too.
<http://www.joshuawise.com/horndis> | horndis is a brilliant solution - just started using it yesterday and it's completely stable
I couldn't get my Andriod phone to work as a USB modem.
I compiled it from source for 10.6.8 then used `packagemaker` and the included `packagemaker` project file to create a package to install.
Only gotcha was using `sudo s... |
14,419,721 | I'm creating a class that implements `DirectoryStream` so I can iterate through a directory. However, I am not able to get beyond compile time errors because, when I try to import "java.nio.file", it states "cannot find symbol - class file". Does anyone have a clue why?
```
import java.nio.file;
... | 2013/01/19 | [
"https://Stackoverflow.com/questions/14419721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/768398/"
] | it should be
```
import java.nio.file.*;
```
`java.nio.file` is a [package](http://docs.oracle.com/javase/7/docs/api/java/nio/file/package-summary.html) not a class | The statement
```
import java.nio.file;
```
tries to import the class named `file` from the package `java.nio`. Which obviously doesn't exist (in the JRE).
In you code, the statement should be
```
import java.nio.file.DirectoryStream;
```
(and double check that you're using Java 7, it's not available in previou... |
3,341,968 | >
> Suppose that $h\in(0,1)$, $l\in(0,1)$, $p\in(0,1)$, and $l<h$. Show that:
>
>
> $\frac{hl}{ph+(1-p)l}+\frac{(1-h)(1-l)}{p(1-h)+(1-p)(1-l)}<1 $
>
>
>
What I have done:
1. I tried expanding the inequality. It gets very messy and I could not find any useful pattern.
2. I tried taking derivatives with respect t... | 2019/09/02 | [
"https://math.stackexchange.com/questions/3341968",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/426018/"
] | Yes, you have 101 different score posibilities. By the pidgeon hole principle, you must have 102 students in class to assure that two of them get the same score. | The number of possible scores a student can be assigned is from 0 to 100 hence total of 101 scores assigned, 0 to ist 1 to second and similarly 100 to 101th student. Now when 102th student is given a score that will be surely repeated(0-100 value).
Hence at least 102 students should be there. |
1,882,351 | How precisely does windows decide that SendMessage should return- that is, how does it decide the receiving thread has finished processing the sent message?
Detailed scenario:
I've got thread A using SendMessage to send a thread to thread B. Obviously SendMessage doesn't return until thread B finishes processing the m... | 2009/12/10 | [
"https://Stackoverflow.com/questions/1882351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since `SendMessage` has a return value, it is always after the message is processed.
`PostMessage` on the other hand will not wait for the message to be processed.
From MSDN on [SendMessage](http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx):
>
> The SendMessage function calls the
> window procedure for... | It sounds as if your original SendMessage has NOT returned but rather than the WindowProc in thread A has been called during the processing of the message sent. There is no requirement that a message handler must refrain from calling SendMessage in response to receipt of a message.
You should be able to see the origin... |
1,882,351 | How precisely does windows decide that SendMessage should return- that is, how does it decide the receiving thread has finished processing the sent message?
Detailed scenario:
I've got thread A using SendMessage to send a thread to thread B. Obviously SendMessage doesn't return until thread B finishes processing the m... | 2009/12/10 | [
"https://Stackoverflow.com/questions/1882351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Since `SendMessage` has a return value, it is always after the message is processed.
`PostMessage` on the other hand will not wait for the message to be processed.
From MSDN on [SendMessage](http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx):
>
> The SendMessage function calls the
> window procedure for... | From the MSDN, it sounds like that the problem may be that displaying a dialog box in thread B may cause deadlocks. See [Message Deadlocks](http://msdn.microsoft.com/en-us/library/ms644927%28VS.85%29.aspx#deadlocks).
---
Possibly it is because the message received by thread A was a nonqueued message. From MSDN:
>
>... |
1,882,351 | How precisely does windows decide that SendMessage should return- that is, how does it decide the receiving thread has finished processing the sent message?
Detailed scenario:
I've got thread A using SendMessage to send a thread to thread B. Obviously SendMessage doesn't return until thread B finishes processing the m... | 2009/12/10 | [
"https://Stackoverflow.com/questions/1882351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | From the MSDN, it sounds like that the problem may be that displaying a dialog box in thread B may cause deadlocks. See [Message Deadlocks](http://msdn.microsoft.com/en-us/library/ms644927%28VS.85%29.aspx#deadlocks).
---
Possibly it is because the message received by thread A was a nonqueued message. From MSDN:
>
>... | It sounds as if your original SendMessage has NOT returned but rather than the WindowProc in thread A has been called during the processing of the message sent. There is no requirement that a message handler must refrain from calling SendMessage in response to receipt of a message.
You should be able to see the origin... |
1,882,351 | How precisely does windows decide that SendMessage should return- that is, how does it decide the receiving thread has finished processing the sent message?
Detailed scenario:
I've got thread A using SendMessage to send a thread to thread B. Obviously SendMessage doesn't return until thread B finishes processing the m... | 2009/12/10 | [
"https://Stackoverflow.com/questions/1882351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | As long as processing of the message has *started*, the WindowProc processing the interthread message can call [ReplyMessage](http://msdn.microsoft.com/en-us/library/ms644948(VS.85).aspx) to allow the calling thread to continue while processing continues. | It sounds as if your original SendMessage has NOT returned but rather than the WindowProc in thread A has been called during the processing of the message sent. There is no requirement that a message handler must refrain from calling SendMessage in response to receipt of a message.
You should be able to see the origin... |
1,882,351 | How precisely does windows decide that SendMessage should return- that is, how does it decide the receiving thread has finished processing the sent message?
Detailed scenario:
I've got thread A using SendMessage to send a thread to thread B. Obviously SendMessage doesn't return until thread B finishes processing the m... | 2009/12/10 | [
"https://Stackoverflow.com/questions/1882351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | As long as processing of the message has *started*, the WindowProc processing the interthread message can call [ReplyMessage](http://msdn.microsoft.com/en-us/library/ms644948(VS.85).aspx) to allow the calling thread to continue while processing continues. | From the MSDN, it sounds like that the problem may be that displaying a dialog box in thread B may cause deadlocks. See [Message Deadlocks](http://msdn.microsoft.com/en-us/library/ms644927%28VS.85%29.aspx#deadlocks).
---
Possibly it is because the message received by thread A was a nonqueued message. From MSDN:
>
>... |
381,520 | I am stuck with the simple expression
$$
\frac{\cos^2(\theta + \alpha)}{1 - \cos^2(\theta - \alpha)} = \text{const.}
$$
where $\theta$ is a variable and $\alpha$ is the number satisfying
$$
\alpha = \tan^{-1} (\frac{4}{3})\,.
$$
I cannot see it to be immediate, somehow I am missing a particular trigonometric identity. ... | 2013/05/04 | [
"https://math.stackexchange.com/questions/381520",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/22194/"
] | Note that $1 - \cos^2(\theta - \alpha) = \sin^2(\theta - \alpha)$
That gives you:
$$\frac{\cos^2(\theta + \alpha)}{1 - \cos^2(\theta - \alpha)} = \text{const.} = \frac{\cos^2(\theta + \alpha)}{\sin^2(\theta - \alpha)}$$
For the numerator: $\cos(\theta+\alpha) = \cos\theta\cos\alpha-\sin\theta\sin\alpha.\tag{1}$
For... | $$
\cos(\theta+\alpha) = \cos\theta\cos\alpha-\sin\theta\sin\alpha.
$$
We have $\tan\alpha=\dfrac43$ so if $\mathrm{opp}=4$ and $\mathrm{adj}=3$ then $\mathrm{hyp}=5$ by the Pythagorean theorem, so $\sin\alpha=\dfrac{\mathrm{opp}}{\mathrm{hyp}}= \dfrac45$ and $\cos\alpha=\dfrac35$.
Consequently $\cos^2(\theta+\alpha)... |
381,520 | I am stuck with the simple expression
$$
\frac{\cos^2(\theta + \alpha)}{1 - \cos^2(\theta - \alpha)} = \text{const.}
$$
where $\theta$ is a variable and $\alpha$ is the number satisfying
$$
\alpha = \tan^{-1} (\frac{4}{3})\,.
$$
I cannot see it to be immediate, somehow I am missing a particular trigonometric identity. ... | 2013/05/04 | [
"https://math.stackexchange.com/questions/381520",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/22194/"
] | Note that $1 - \cos^2(\theta - \alpha) = \sin^2(\theta - \alpha)$
That gives you:
$$\frac{\cos^2(\theta + \alpha)}{1 - \cos^2(\theta - \alpha)} = \text{const.} = \frac{\cos^2(\theta + \alpha)}{\sin^2(\theta - \alpha)}$$
For the numerator: $\cos(\theta+\alpha) = \cos\theta\cos\alpha-\sin\theta\sin\alpha.\tag{1}$
For... | **Hint:**
Draw a right angled triangle. You know the sides(How?) |
381,520 | I am stuck with the simple expression
$$
\frac{\cos^2(\theta + \alpha)}{1 - \cos^2(\theta - \alpha)} = \text{const.}
$$
where $\theta$ is a variable and $\alpha$ is the number satisfying
$$
\alpha = \tan^{-1} (\frac{4}{3})\,.
$$
I cannot see it to be immediate, somehow I am missing a particular trigonometric identity. ... | 2013/05/04 | [
"https://math.stackexchange.com/questions/381520",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/22194/"
] | Note that $1 - \cos^2(\theta - \alpha) = \sin^2(\theta - \alpha)$
That gives you:
$$\frac{\cos^2(\theta + \alpha)}{1 - \cos^2(\theta - \alpha)} = \text{const.} = \frac{\cos^2(\theta + \alpha)}{\sin^2(\theta - \alpha)}$$
For the numerator: $\cos(\theta+\alpha) = \cos\theta\cos\alpha-\sin\theta\sin\alpha.\tag{1}$
For... | $\tan\alpha=\frac{4}{3}$,then one solution of $\sin\alpha=\frac{4}{5},\cos\alpha=\frac{3}{5}$,the other is $\sin\alpha=-\frac{4}{5},\cos\alpha=-\frac{3}{5}$.
If your conclusion is right. The value of left hand does not depend on $\theta$, so we choose free, for easy calculation. I prefer $\theta=0$,the result is $\fra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.