qid
int64 1
74.6M
| question
stringlengths 45
24.2k
| date
stringlengths 10
10
| metadata
stringlengths 101
178
| response_j
stringlengths 32
23.2k
| response_k
stringlengths 21
13.2k
|
---|---|---|---|---|---|
13,383,647 |
I have Google Translate on my page. It looks like a drop-down list, but all other drop-down lists on my page have another style. So I created jQuery function which change Google Translator drop down list styles. This function adds or deletes some style parameters. I'd like to know when I should call this function? In current code I call it after 3 sec. after document.ready
```
$(document).ready(function () {
setTimeout(wrapGoogleTranslate, 3000);
});
```
Current situation is that I hide the Div where Google translate is placed and show it after it's styles are corrected by my function. It means that my page loads, then it wait for 3 seconds, and *then* Google Translate appears with corrected styles.
I'd like to know how I can determine that Google Translate drop-down was loaded and then call my function to change the style. I don't want to make users wait for 3 seconds (maybe in some situations Google Translate would loads more than 3 seconds, then my function would never be executed).
|
2012/11/14
|
['https://Stackoverflow.com/questions/13383647', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1753077/']
|
I recently wanted to change "Select Language" to simply "Language", so I also had to run code after Google's code had been executed. Here's how I did it:
**HTML**
It's important to set Google's `div` to `display:none` -- we'll fade it in with JavaScript so that the user doesn't see the text switching from "Select Language" to "Language".
```
<div id="google_translate_element" style="display:none;"></div>
<script type="text/javascript">function googleTranslateElementInit() {new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, gaTrack: true, gaId: 'UA-35158556-1'}, 'google_translate_element');}</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
```
**JavaScript**
```
function changeLanguageText() {
if ($('.goog-te-menu-value span:first-child').text() == "Select Language") {
$('.goog-te-menu-value span:first-child').html('Language');
$('#google_translate_element').fadeIn('slow');
} else {
setTimeout(changeLanguageText, 50);
}
}
changeLanguageText();
```
|
I had a similar situation where i had to change "Select Language" to just display "Language". Here is my CSS solution:
```
div#google_translate_element{
display: inline-block;
vertical-align: top!important;
}
div#google_translate_element *{
margin: 0px;
padding: 0px;
border: none!important;
display: inline-block;
vertical-align: top!important;
}
div#google_translate_element .goog-te-gadget-icon{
display: none;
}
div#google_translate_element .goog-te-menu-value{
color: #899290;
}
div#google_translate_element .goog-te-menu-value:hover{
color: #a6747e;
}
div#google_translate_element .goog-te-menu-value *{
display: none;
}
div#google_translate_element .goog-te-menu-value span:nth-child(3){
display: inline-block;
vertical-align: top!important;
}
div#google_translate_element .goog-te-menu-value span:nth-child(3)::after{
content: "Language"!important;
}
```
|
16,445,791 |
I'm developing a system to manage in a very simple way some tables in the database.
The system first loads with Ajax the databases the user can see and manage. Then load the tables in that database and then load the data for that table.
I have something like this:
```
$.ajax({
url : "myUrl.php",
data : {
db : $dbSelector.val(),
table : tableToLoad
},
success : function (json) { /* Some cool stuff here */ }
});
```
And I've found you cannot use parameterized queries when the parameters are the db name, tables or columns, so I cannot do:
```
<?php
$query = "SELECT * FROM :db.:table";
$st = $pdo->prepare($query);
$st->execute(
array(
"db"=>$db,
"table" => $table
)
);
$rows = $st->fetchAll(PDO::FETCH_OBJ);
```
I cannot use mysql\_ or mysqli\_ filtering cause we don't have it installed.
|
2013/05/08
|
['https://Stackoverflow.com/questions/16445791', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1339973/']
|
The color format of the console cant accept these HEX color value: `#XXXXXX` you need to check these file:
<https://github.com/Marak/colors.js/blob/master/colors.js> and pass a [ANSI color format value](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors).
As the developer describes:
```
'bold' : ['\x1B[1m', '\x1B[22m'],
'italic' : ['\x1B[3m', '\x1B[23m'],
'underline' : ['\x1B[4m', '\x1B[24m'],
'inverse' : ['\x1B[7m', '\x1B[27m'],
'strikethrough' : ['\x1B[9m', '\x1B[29m'],
//grayscale
'white' : ['\x1B[37m', '\x1B[39m'],
'grey' : ['\x1B[90m', '\x1B[39m'],
'black' : ['\x1B[30m', '\x1B[39m'],
//colors
'blue' : ['\x1B[34m', '\x1B[39m'],
'cyan' : ['\x1B[36m', '\x1B[39m'],
'green' : ['\x1B[32m', '\x1B[39m'],
'magenta' : ['\x1B[35m', '\x1B[39m'],
'red' : ['\x1B[31m', '\x1B[39m'],
'yellow' : ['\x1B[33m', '\x1B[39m']
```
|
You can only override the existing theme properties and set pre-defined colors to specific keys
From the readme:
```
colors.setTheme({
silly: 'rainbow',
input: 'grey',
verbose: 'cyan',
prompt: 'grey',
info: 'green',
data: 'grey',
help: 'cyan',
warn: 'yellow',
debug: 'blue',
error: 'red'
});
```
For example you can set `prompt` to `green` but you cannot set `prompt` to a custom hex color
|
16,445,791 |
I'm developing a system to manage in a very simple way some tables in the database.
The system first loads with Ajax the databases the user can see and manage. Then load the tables in that database and then load the data for that table.
I have something like this:
```
$.ajax({
url : "myUrl.php",
data : {
db : $dbSelector.val(),
table : tableToLoad
},
success : function (json) { /* Some cool stuff here */ }
});
```
And I've found you cannot use parameterized queries when the parameters are the db name, tables or columns, so I cannot do:
```
<?php
$query = "SELECT * FROM :db.:table";
$st = $pdo->prepare($query);
$st->execute(
array(
"db"=>$db,
"table" => $table
)
);
$rows = $st->fetchAll(PDO::FETCH_OBJ);
```
I cannot use mysql\_ or mysqli\_ filtering cause we don't have it installed.
|
2013/05/08
|
['https://Stackoverflow.com/questions/16445791', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1339973/']
|
The color format of the console cant accept these HEX color value: `#XXXXXX` you need to check these file:
<https://github.com/Marak/colors.js/blob/master/colors.js> and pass a [ANSI color format value](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors).
As the developer describes:
```
'bold' : ['\x1B[1m', '\x1B[22m'],
'italic' : ['\x1B[3m', '\x1B[23m'],
'underline' : ['\x1B[4m', '\x1B[24m'],
'inverse' : ['\x1B[7m', '\x1B[27m'],
'strikethrough' : ['\x1B[9m', '\x1B[29m'],
//grayscale
'white' : ['\x1B[37m', '\x1B[39m'],
'grey' : ['\x1B[90m', '\x1B[39m'],
'black' : ['\x1B[30m', '\x1B[39m'],
//colors
'blue' : ['\x1B[34m', '\x1B[39m'],
'cyan' : ['\x1B[36m', '\x1B[39m'],
'green' : ['\x1B[32m', '\x1B[39m'],
'magenta' : ['\x1B[35m', '\x1B[39m'],
'red' : ['\x1B[31m', '\x1B[39m'],
'yellow' : ['\x1B[33m', '\x1B[39m']
```
|
Yes, you can use hex colors in console! This example was done in Node on OSX.
```
let hex = 'AA4296'; // magenta-ish
let red = parseInt(hex.substr(0, 2), 16);
let green = parseInt(hex.substr(2, 2), 16);
let blue = parseInt(hex.substr(4,2), 16);
let fgColorString = `\x1b[38;2;${red};${green};${blue}m`;
let bgColorString = `\x1b[48;2;${red};${green};${blue}m`;
let resetFormatString = `\x1b[0m`;
console.log(`${fgColorString}Magenta Foreground`);
console.log(`${resetFormatString}Back to Normal Colors`);
console.log(`${bgColorString}Magenta Background`);
console.log(`${resetFormatString}Back to Normal Again`);
```
|
42,680,054 |
I'm running a query against an Azure SQL DB...
```
select Id
from Table1
WHERE ([Table1].[CustomFieldString2] IS NULL) AND
(N'New' = [Table1].[CustomFieldString7]) AND (0 = [Table1].[Deleted])
```
This query runs fast roughly 300ms...
As soon as I add another column to my select (bool) as in
```
Select Id, IsActive
```
my query is super slow (minutes)
This doesn't make any sense...
Was wondering if anyone knew what this could be
|
2017/03/08
|
['https://Stackoverflow.com/questions/42680054', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1706578/']
|
In Summary, when you add columns which are not part of index to the `select` then SQL can't choose the same execution plan.
If SQL estimates there are fewer rows, then it will opt to use nested lookups in the execution plan. This can take more time, if estimates are wrong.
If there are more rows or key lookup cost crosses some threshold, SQL may then decide that a scan of the table is likely to be more efficient.
Try adding `isactive` to the included column list, if the query performance is not acceptable.
|
You query constructure is important of course but Azure is naturally slow. Is is using cloud systems so it is not so fast (I supposed using free version.) ı have not seen anyone pleasure about azure velocity. (in low prices)
|
45,694 |
Suppose I have the following lower and upper bound for the Gaussian Q Function:
$$ \frac{x}{x^2 + 1} \varphi(x) < Q(x) < \frac{1}{x} \varphi(x), $$
where $Q(x) = \int\_x^\infty \frac{1}{\sqrt{2\pi}} e^{-\frac{u^2}{2}} \, \mathrm{d}u$ and $\varphi(x) = \frac{1}{\sqrt{2 \pi}} e^{-x^2 / 2}$.
How do I show $Q(x) \sim \varphi(x)/x$ as $x \to \infty$? Apparently, this fact can be shown simply from the upper and lower bounds.
Also, I am unsure how the limit $\lim\_{x \to \infty} \frac{Q(x)}{\varphi(x)} = \frac{1}{x}$ (which I can verify through L'Hopital's Rule) proves $Q(x) \sim \varphi(x)/x$, since the claim $\lim\_{x \to \infty} \frac{A}{B} = C \iff \lim\_{x \to \infty} A = \left(\lim\_{x \to \infty} B \right) \times C$ doesn't seem to be legitimate.
Thanks
|
2011/06/16
|
['https://math.stackexchange.com/questions/45694', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/8140/']
|
You are supposed to show that $\frac{Q(x)}{\varphi(x)/x}$ converges to $1$. (That is the meaning of the curly line.)
To do this divide by $\varphi(x)/x$ everywhere in your inequality and use the squeeze rule.
|
The fact that the limit is $1$ can be simply obtained from the given bounds, as explained by Johan. And the bounds are more important than the limit stuff, since the bounds give practical estimates.
Let us look at your attempt through L'Hospital's Rule. The idea was good, but there were some problems in execution.
The result that you mention obtaining cannot be correct. You say that the limit as $x \to \infty$ of $Q(x)/\varphi(x)$ is $1/x$. But the limit, if it exists, of $Q(x)/\varphi(x)$ must be a "number" (let us temporarily assign honorary number status to $+\infty$). So in particular the limit cannot be $1/x$, that is a function of $x$.
However, a L'Hospital's Rule argument of the type you attempted **can** be made to work.
There are various ways to set up the calculation. Some work more quickly than others. We will use a somewhat inefficient method, and mention a better way at the end.
We will find
$$\lim\_{x\to\infty} \frac{xQ(x)}{\varphi(x)}$$
By L'Hospital's Rule, this is the same as
$$\lim\_{x\to\infty} \frac{xQ'(x)+Q(x)}{\varphi'(x)}$$
Calculate.
$$xQ'(x)=-x\varphi(x) +Q(x)$$
and
$$\varphi'(x)=-x\varphi(x)$$
So L'Hospital's Rule says that our limit is
$$\lim\_{x\to\infty}\frac{-x\varphi(x) +Q(x)}{-x\varphi(x)}$$
Almost there! By dividing, we can see that the function we are trying to take the limit of is
$$1 -\frac{Q(x)}{\varphi(x)}$$
If we can show that
$$\lim\_{x \to \infty}\frac{Q(x)}{\varphi(x)}=0$$
we will be finished.
Use L'Hospital's Rule again.
We find that
$$\lim\_{x \to \infty}\frac{Q(x)}{\varphi(x)}=\lim\_{x\to\infty}\frac{-\varphi(x)}{-x\varphi(x)}$$
Do the obvious cancellation.
We now want
$$\lim\_{x\to\infty}\frac{1}{x}$$
and this is $0$.
It is more efficient to use L'Hospital's Rule to show that
$$\lim\_{x\to\infty} \frac{\frac{\varphi(x)}{x}}{Q(x)}=1$$
(Here "top" is $\varphi(x)/x$ and "bottom" is $Q(x)$.) A single calculation is enough. Try it!
|
45,694 |
Suppose I have the following lower and upper bound for the Gaussian Q Function:
$$ \frac{x}{x^2 + 1} \varphi(x) < Q(x) < \frac{1}{x} \varphi(x), $$
where $Q(x) = \int\_x^\infty \frac{1}{\sqrt{2\pi}} e^{-\frac{u^2}{2}} \, \mathrm{d}u$ and $\varphi(x) = \frac{1}{\sqrt{2 \pi}} e^{-x^2 / 2}$.
How do I show $Q(x) \sim \varphi(x)/x$ as $x \to \infty$? Apparently, this fact can be shown simply from the upper and lower bounds.
Also, I am unsure how the limit $\lim\_{x \to \infty} \frac{Q(x)}{\varphi(x)} = \frac{1}{x}$ (which I can verify through L'Hopital's Rule) proves $Q(x) \sim \varphi(x)/x$, since the claim $\lim\_{x \to \infty} \frac{A}{B} = C \iff \lim\_{x \to \infty} A = \left(\lim\_{x \to \infty} B \right) \times C$ doesn't seem to be legitimate.
Thanks
|
2011/06/16
|
['https://math.stackexchange.com/questions/45694', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/8140/']
|
You are supposed to show that $\frac{Q(x)}{\varphi(x)/x}$ converges to $1$. (That is the meaning of the curly line.)
To do this divide by $\varphi(x)/x$ everywhere in your inequality and use the squeeze rule.
|
First, as Johan mentioned in his answer,
$$
Q(x)\sim \frac{{\varphi (x)}}{x} \;\; {\rm as} \; x \to \infty
$$
means that
$$
\frac{{Q(x)}}{{\varphi (x)/x}} \to 1 \;\; {\rm as} \; x \to \infty.
$$
Concerning the last paragraph of your question, it is certainly wrong to write $\lim \_{x \to \infty } \frac{{Q(x)}}{{\varphi (x)}} = \frac{1}{x}$; rather, the asymptotic equivalence $Q(x)\sim \varphi (x)/x$ can be proved as follows.
$$
\mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x)}}{{\varphi (x)/x}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{xQ(x)}}{{\varphi (x)}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{(xQ(x))'}}{{\varphi '(x)}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x) + xQ'(x)}}{{\varphi '(x)}}.
$$
Now,
$$
Q'(x) = \frac{d}{{dx}}\int\_x^\infty {\frac{1}{{\sqrt {2\pi } }}e^{ - u^2 /2} du} = - \frac{1}{{\sqrt {2\pi } }}e^{ - x^2 /2}
$$
and
$$
\varphi '(x) = \frac{d}{{dx}}\frac{1}{{\sqrt {2\pi } }}e^{ - x^2 /2} = \frac{1}{{\sqrt {2\pi } }}e^{ - x^2 /2} ( - x).
$$
Hence $xQ'(x) = \varphi '(x)$, and so it remains to show that
$$
\mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x)}}{{\varphi '(x)}} = 0.
$$
Indeed,
$$
\mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x)}}{{\varphi '(x)}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{Q'(x)}}{{\varphi ''(x)}} = 0.
$$
|
45,694 |
Suppose I have the following lower and upper bound for the Gaussian Q Function:
$$ \frac{x}{x^2 + 1} \varphi(x) < Q(x) < \frac{1}{x} \varphi(x), $$
where $Q(x) = \int\_x^\infty \frac{1}{\sqrt{2\pi}} e^{-\frac{u^2}{2}} \, \mathrm{d}u$ and $\varphi(x) = \frac{1}{\sqrt{2 \pi}} e^{-x^2 / 2}$.
How do I show $Q(x) \sim \varphi(x)/x$ as $x \to \infty$? Apparently, this fact can be shown simply from the upper and lower bounds.
Also, I am unsure how the limit $\lim\_{x \to \infty} \frac{Q(x)}{\varphi(x)} = \frac{1}{x}$ (which I can verify through L'Hopital's Rule) proves $Q(x) \sim \varphi(x)/x$, since the claim $\lim\_{x \to \infty} \frac{A}{B} = C \iff \lim\_{x \to \infty} A = \left(\lim\_{x \to \infty} B \right) \times C$ doesn't seem to be legitimate.
Thanks
|
2011/06/16
|
['https://math.stackexchange.com/questions/45694', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/8140/']
|
First, as Johan mentioned in his answer,
$$
Q(x)\sim \frac{{\varphi (x)}}{x} \;\; {\rm as} \; x \to \infty
$$
means that
$$
\frac{{Q(x)}}{{\varphi (x)/x}} \to 1 \;\; {\rm as} \; x \to \infty.
$$
Concerning the last paragraph of your question, it is certainly wrong to write $\lim \_{x \to \infty } \frac{{Q(x)}}{{\varphi (x)}} = \frac{1}{x}$; rather, the asymptotic equivalence $Q(x)\sim \varphi (x)/x$ can be proved as follows.
$$
\mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x)}}{{\varphi (x)/x}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{xQ(x)}}{{\varphi (x)}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{(xQ(x))'}}{{\varphi '(x)}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x) + xQ'(x)}}{{\varphi '(x)}}.
$$
Now,
$$
Q'(x) = \frac{d}{{dx}}\int\_x^\infty {\frac{1}{{\sqrt {2\pi } }}e^{ - u^2 /2} du} = - \frac{1}{{\sqrt {2\pi } }}e^{ - x^2 /2}
$$
and
$$
\varphi '(x) = \frac{d}{{dx}}\frac{1}{{\sqrt {2\pi } }}e^{ - x^2 /2} = \frac{1}{{\sqrt {2\pi } }}e^{ - x^2 /2} ( - x).
$$
Hence $xQ'(x) = \varphi '(x)$, and so it remains to show that
$$
\mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x)}}{{\varphi '(x)}} = 0.
$$
Indeed,
$$
\mathop {\lim }\limits\_{x \to \infty } \frac{{Q(x)}}{{\varphi '(x)}} = \mathop {\lim }\limits\_{x \to \infty } \frac{{Q'(x)}}{{\varphi ''(x)}} = 0.
$$
|
The fact that the limit is $1$ can be simply obtained from the given bounds, as explained by Johan. And the bounds are more important than the limit stuff, since the bounds give practical estimates.
Let us look at your attempt through L'Hospital's Rule. The idea was good, but there were some problems in execution.
The result that you mention obtaining cannot be correct. You say that the limit as $x \to \infty$ of $Q(x)/\varphi(x)$ is $1/x$. But the limit, if it exists, of $Q(x)/\varphi(x)$ must be a "number" (let us temporarily assign honorary number status to $+\infty$). So in particular the limit cannot be $1/x$, that is a function of $x$.
However, a L'Hospital's Rule argument of the type you attempted **can** be made to work.
There are various ways to set up the calculation. Some work more quickly than others. We will use a somewhat inefficient method, and mention a better way at the end.
We will find
$$\lim\_{x\to\infty} \frac{xQ(x)}{\varphi(x)}$$
By L'Hospital's Rule, this is the same as
$$\lim\_{x\to\infty} \frac{xQ'(x)+Q(x)}{\varphi'(x)}$$
Calculate.
$$xQ'(x)=-x\varphi(x) +Q(x)$$
and
$$\varphi'(x)=-x\varphi(x)$$
So L'Hospital's Rule says that our limit is
$$\lim\_{x\to\infty}\frac{-x\varphi(x) +Q(x)}{-x\varphi(x)}$$
Almost there! By dividing, we can see that the function we are trying to take the limit of is
$$1 -\frac{Q(x)}{\varphi(x)}$$
If we can show that
$$\lim\_{x \to \infty}\frac{Q(x)}{\varphi(x)}=0$$
we will be finished.
Use L'Hospital's Rule again.
We find that
$$\lim\_{x \to \infty}\frac{Q(x)}{\varphi(x)}=\lim\_{x\to\infty}\frac{-\varphi(x)}{-x\varphi(x)}$$
Do the obvious cancellation.
We now want
$$\lim\_{x\to\infty}\frac{1}{x}$$
and this is $0$.
It is more efficient to use L'Hospital's Rule to show that
$$\lim\_{x\to\infty} \frac{\frac{\varphi(x)}{x}}{Q(x)}=1$$
(Here "top" is $\varphi(x)/x$ and "bottom" is $Q(x)$.) A single calculation is enough. Try it!
|
34,365,395 |
I have re-done it a few times but I can't get it to work... It detects collisions when button1 is in the lower and/or right-most part of button2, but not if it's in the upper and/or left-most part... Would be nice to know what the problem is cuz I suck at debugging...
```
if (
(
(button1.Top >= button2.Top && button1.Top <= (button2.Top + button2.Height))
|| (button1.Bottom >= button2.Bottom && button1.Bottom <= (button2.Bottom + button2.Height))
)
&&
(
(button1.Left >= button2.Left && button1.Left <= (button2.Left + button2.Width))
|| (button1.Right >= button2.Right && button1.Right <= (button2.Right + button2.Width))
)
)
```
|
2015/12/18
|
['https://Stackoverflow.com/questions/34365395', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5696900/']
|
In general, I think that question is more suited for Code Review not Stack Overflow.
Maybe you should rethink your class completely. For me it looks a lot like you wanted to model the student and not the classroom. Something like following might fit your needs better:
```
class Student(object):
"""A class to model students"""
def __init__(self, age, grade, name):
self.age = age
self.grade = grade
self.name = name
def get_all_information(self):
"""Get all information about the student"""
return (self.age, self.grade, self.name)
james = Student(15, 9, 'James Herbert')
print(james.get_all_information())
```
**Edit:**
It seems others like [Prune](https://stackoverflow.com/users/4785185/prune) came up with the same idea.
|
The central problem is that james\_all is a local variable of the method **Classroom.James**. It is not an attribute of the class. Unless you're within the **James** method, it has no useful value.
In **print\_student**, you made it a parameter, but when you called **print\_student** from the main program, you didn't supply the argument.
Perhaps you're looking for a general property of a student in the classroom?
Have a method to initialize an object of the class and pass the defining values to that when you create a new instance.
```
class Student(object):
def __init__(self, name, age, grade):
self.name = name
self.age = age
self.grade = grade
def print_student(self):
print (self.age, self.grade, self.name)
James = Student('James Herbert', 15, 9)
James.print_student()
```
Output:
```
15, 9, 'James Herbert'
```
|
34,365,395 |
I have re-done it a few times but I can't get it to work... It detects collisions when button1 is in the lower and/or right-most part of button2, but not if it's in the upper and/or left-most part... Would be nice to know what the problem is cuz I suck at debugging...
```
if (
(
(button1.Top >= button2.Top && button1.Top <= (button2.Top + button2.Height))
|| (button1.Bottom >= button2.Bottom && button1.Bottom <= (button2.Bottom + button2.Height))
)
&&
(
(button1.Left >= button2.Left && button1.Left <= (button2.Left + button2.Width))
|| (button1.Right >= button2.Right && button1.Right <= (button2.Right + button2.Width))
)
)
```
|
2015/12/18
|
['https://Stackoverflow.com/questions/34365395', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5696900/']
|
Your problem boils down to a fundamental misunderstanding about how classes work. A class is just a template (think of a cookie cutter shape). By calling the class you are creating an instance of the class. An instance is to a class what a cookie is to a cookie cutter. The function that tells your class how to make an instance is the `__init__` function. So when you call:
```
x = Classroom()
```
What happens is the `__init__` function is called for `Classroom`. You may be asking "But I didn't ever write an `__init__` function for the class, so how does that work?" Simply put, *all classes in python will automatically inherit from the `object` class even if they don't explicitly code it in*, which means they use its methods unless you explicitly override them with your own. `object` has a very simple `__init__` that pretty much doesn't do anything.
Going back to the cookie cutter analogy, in the same way that you can make different flavors of cookie (e.g. chocolate chip, oatmeal, peanut butter) from the same cookie cutter, so too can classes make different instances when you instantiate them with different parameters. Like so (adapted from @Prune's answer):
```
class Student(object):
def __init__(self, name, age, grade):
self.name = name
self.age = age
self.grade = grade
def print_student(self):
print (self.age, self.grade, self.name)
James = Student('James Herbert', 15, 9)
James.print_student()
Diego = Student('Diego Heriberto', 14, 9)
Diego.print_student()
```
Which should print out:
```
15 9 James Herbert
14 9 Diego Heriberto
```
Each instance is different, and so behaves differently, but they both follow the same template laid out by the class.
If you want a `Classroom` class, you could do something like this:
```
class Classroom(object):
def __init__(self):
# create a list to hold students and assign the list to self
self.students = list()
def add_student(self, student):
self.students.append(student)
def print_students(self):
# use a loop to print out all the students in the classroom instance
for stud in self.students:
stud.print_student()
cr = Classroom()
James = Student('James Herbert', 15, 9)
Diego = Student('Diego Heriberto', 14, 9)
cr.add_student(James)
cr.add_student(Diego)
cr.print_students()
```
This would have identical output to what was shown previously.
You may ask yourself "But there is the 'self' parameter that I never pass in. Is Python broken?" Python is working just fine. The `self` parameter is implicit when you call a method on an instance like `James` or `Diego`, but it is explicit in the actual body of the method. If you want to modify the instance in a method, then you must modify the `self` parameter. That is why we assign values to it in `__init__`. If you want to find out something about an instance, you check for it on the `self` parameter.
|
The central problem is that james\_all is a local variable of the method **Classroom.James**. It is not an attribute of the class. Unless you're within the **James** method, it has no useful value.
In **print\_student**, you made it a parameter, but when you called **print\_student** from the main program, you didn't supply the argument.
Perhaps you're looking for a general property of a student in the classroom?
Have a method to initialize an object of the class and pass the defining values to that when you create a new instance.
```
class Student(object):
def __init__(self, name, age, grade):
self.name = name
self.age = age
self.grade = grade
def print_student(self):
print (self.age, self.grade, self.name)
James = Student('James Herbert', 15, 9)
James.print_student()
```
Output:
```
15, 9, 'James Herbert'
```
|
34,365,395 |
I have re-done it a few times but I can't get it to work... It detects collisions when button1 is in the lower and/or right-most part of button2, but not if it's in the upper and/or left-most part... Would be nice to know what the problem is cuz I suck at debugging...
```
if (
(
(button1.Top >= button2.Top && button1.Top <= (button2.Top + button2.Height))
|| (button1.Bottom >= button2.Bottom && button1.Bottom <= (button2.Bottom + button2.Height))
)
&&
(
(button1.Left >= button2.Left && button1.Left <= (button2.Left + button2.Width))
|| (button1.Right >= button2.Right && button1.Right <= (button2.Right + button2.Width))
)
)
```
|
2015/12/18
|
['https://Stackoverflow.com/questions/34365395', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5696900/']
|
In general, I think that question is more suited for Code Review not Stack Overflow.
Maybe you should rethink your class completely. For me it looks a lot like you wanted to model the student and not the classroom. Something like following might fit your needs better:
```
class Student(object):
"""A class to model students"""
def __init__(self, age, grade, name):
self.age = age
self.grade = grade
self.name = name
def get_all_information(self):
"""Get all information about the student"""
return (self.age, self.grade, self.name)
james = Student(15, 9, 'James Herbert')
print(james.get_all_information())
```
**Edit:**
It seems others like [Prune](https://stackoverflow.com/users/4785185/prune) came up with the same idea.
|
Your problem boils down to a fundamental misunderstanding about how classes work. A class is just a template (think of a cookie cutter shape). By calling the class you are creating an instance of the class. An instance is to a class what a cookie is to a cookie cutter. The function that tells your class how to make an instance is the `__init__` function. So when you call:
```
x = Classroom()
```
What happens is the `__init__` function is called for `Classroom`. You may be asking "But I didn't ever write an `__init__` function for the class, so how does that work?" Simply put, *all classes in python will automatically inherit from the `object` class even if they don't explicitly code it in*, which means they use its methods unless you explicitly override them with your own. `object` has a very simple `__init__` that pretty much doesn't do anything.
Going back to the cookie cutter analogy, in the same way that you can make different flavors of cookie (e.g. chocolate chip, oatmeal, peanut butter) from the same cookie cutter, so too can classes make different instances when you instantiate them with different parameters. Like so (adapted from @Prune's answer):
```
class Student(object):
def __init__(self, name, age, grade):
self.name = name
self.age = age
self.grade = grade
def print_student(self):
print (self.age, self.grade, self.name)
James = Student('James Herbert', 15, 9)
James.print_student()
Diego = Student('Diego Heriberto', 14, 9)
Diego.print_student()
```
Which should print out:
```
15 9 James Herbert
14 9 Diego Heriberto
```
Each instance is different, and so behaves differently, but they both follow the same template laid out by the class.
If you want a `Classroom` class, you could do something like this:
```
class Classroom(object):
def __init__(self):
# create a list to hold students and assign the list to self
self.students = list()
def add_student(self, student):
self.students.append(student)
def print_students(self):
# use a loop to print out all the students in the classroom instance
for stud in self.students:
stud.print_student()
cr = Classroom()
James = Student('James Herbert', 15, 9)
Diego = Student('Diego Heriberto', 14, 9)
cr.add_student(James)
cr.add_student(Diego)
cr.print_students()
```
This would have identical output to what was shown previously.
You may ask yourself "But there is the 'self' parameter that I never pass in. Is Python broken?" Python is working just fine. The `self` parameter is implicit when you call a method on an instance like `James` or `Diego`, but it is explicit in the actual body of the method. If you want to modify the instance in a method, then you must modify the `self` parameter. That is why we assign values to it in `__init__`. If you want to find out something about an instance, you check for it on the `self` parameter.
|
59,651,531 |
I am having a problem with accessing data in different parts of my server() function. The basic structure is something like this:
```
server <- shinyServer(function(input, output) {
# get the data from a file obtained from a textInput in the ui
data <- reactive({
req(input$file)
file <- input$file$datapath
# process the file and return a new dataframe
})
output$head <- renderTable({
mydf <- data()
head(mydf)
})
output$tail <- renderTable({
mydf <- data()
tail(mydf)
})
})
```
I would like to avoid having to call data() twice but I haven't found a way to do that.
---
Edit following the comment by @KentJohnson
What I am trying to achieve is for the user to select a file to open, using `textInput`, and after the file is opened, the app should do some processing and populate the two tables in the ui. After this, the user then chooses some other actions which also require the same data.
I wanted to avoid having to call `data()` twice but I haven't found a way to do that. I was assuming that each call would mean reading from the file each time. The file is very large so that is my motivation.
|
2020/01/08
|
['https://Stackoverflow.com/questions/59651531', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1461667/']
|
As @KentJohnson points out, `reactive` already achieves your goal. The expression that makes up data...
```
req(input$file)
file <- input$file$datapath
# process the file and return a new dataframe
```
...only runs when `input$file$datapath` changes. It does not rerun each time `data()` is called.
|
Putting your two tables into an `observe` environment makes it possible to call `data()` only twice, but I don't know if it will fit with what you want to do. Notice that here, I didn't put a `textInput` or things like that because my point was to show the `observe` environment. I'll let you adapt it to your situation (since you didn't put the `ui` part in your post):
```
library(shiny)
ui <- basicPage(
fileInput("file",
"Import a CSV file",
accept = ".csv"),
tableOutput("head"),
tableOutput("tail")
)
server <- shinyServer(function(input, output) {
# get the data from a file obtained from a textInput in the ui
data <- reactive({
req(input$file)
inFile <- input$file
read.csv(inFile$datapath, header = F, sep = ";")
# process the file and return a new dataframe
})
observe({
mydf <- data()
if (is.null(mydf)){
output$head <- renderTable({})
output$tail <- renderTable({})
}
else {
output$head <- renderTable({
head(mydf)
})
output$tail <- renderTable({
tail(mydf)
})
}
})
})
shinyApp(ui, server)
```
**Edit:** I misunderstood the OP's question, see @SmokeyShakers' answer for a more appropriate answer.
|
2,205,739 |
In my search I used autosuggest. The problem now is I have to search the value in multiple fields such as firstname,middlename,lastname,caption etc. How to identify that the match string will belong on specific field name.
let say i have table
```
firstname middlename lastname caption
james kelly tow handsome
timy john fung fearless
hanes bing ken great
```
in my input field once I typed "j" I should select and ouput
james
john
great
Currently I just output the firstname so instead of the above result I came out like below which is not good.
james
timy
hanes
It is possible? Any help would greatly appreciated.
|
2010/02/05
|
['https://Stackoverflow.com/questions/2205739', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/175313/']
|
You could do something like:
```
SELECT IF(first LIKE 'j%',
first,
IF(middle LIKE 'j%',
middle,
IF(last LIKE 'j%',
last,
''))) AS name
FROM mytable
HAVING name <> '';
```
|
Just OR them together like so:
```
SELECT * FROM yourTable WHERE firstname LIKE '%j%' OR lastname LIKE '%j%' -- ...
```
|
2,205,739 |
In my search I used autosuggest. The problem now is I have to search the value in multiple fields such as firstname,middlename,lastname,caption etc. How to identify that the match string will belong on specific field name.
let say i have table
```
firstname middlename lastname caption
james kelly tow handsome
timy john fung fearless
hanes bing ken great
```
in my input field once I typed "j" I should select and ouput
james
john
great
Currently I just output the firstname so instead of the above result I came out like below which is not good.
james
timy
hanes
It is possible? Any help would greatly appreciated.
|
2010/02/05
|
['https://Stackoverflow.com/questions/2205739', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/175313/']
|
You could do something like:
```
SELECT IF(first LIKE 'j%',
first,
IF(middle LIKE 'j%',
middle,
IF(last LIKE 'j%',
last,
''))) AS name
FROM mytable
HAVING name <> '';
```
|
This shouts for a fulltext search.
Check out [the mysql entries about that](http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html)!
|
6,122,837 |
I have this string: £0,00
Which i want to replace with float 3.95 for instance. But i want to keep the £ and the ","
So result -> £3,95
How would i do it?
--
Added some details:
Will the currency symbol always be a £?
The currency symbol might be before and sometimes behind the numbers. ie 0,00 kr
Will the separator always be ,, or might it be . or even an arbitrary character?
The separator might be . sometimes.
Will there always be two decimal places?
The decimal will always be 2 places.
How many integer digits might there be, and will there be a thousands separator?
It will not be above 100.
|
2011/05/25
|
['https://Stackoverflow.com/questions/6122837', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/218372/']
|
```
function convert (proto, value) {
return proto.replace (/0(.)00/, function (m, dp) {
return value.toFixed (2).replace ('.', dp);
});
}
```
the proto parameter specifies the format, it must have a sub-string consisting of a single 0 digit followed by any character followed by two 0 digits, this entire sub-string is replaced by the numeric value parameter replacing the decimal point with the character between the 0 digits in the proto.
|
```
<script type="text/javascript">
function Convert(Value) {
return '£' + Value.toString().replace('.', ',');
}
alert(Convert(3.95));
</script>
```
|
6,122,837 |
I have this string: £0,00
Which i want to replace with float 3.95 for instance. But i want to keep the £ and the ","
So result -> £3,95
How would i do it?
--
Added some details:
Will the currency symbol always be a £?
The currency symbol might be before and sometimes behind the numbers. ie 0,00 kr
Will the separator always be ,, or might it be . or even an arbitrary character?
The separator might be . sometimes.
Will there always be two decimal places?
The decimal will always be 2 places.
How many integer digits might there be, and will there be a thousands separator?
It will not be above 100.
|
2011/05/25
|
['https://Stackoverflow.com/questions/6122837', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/218372/']
|
```
function convert (proto, value) {
return proto.replace (/0(.)00/, function (m, dp) {
return value.toFixed (2).replace ('.', dp);
});
}
```
the proto parameter specifies the format, it must have a sub-string consisting of a single 0 digit followed by any character followed by two 0 digits, this entire sub-string is replaced by the numeric value parameter replacing the decimal point with the character between the 0 digits in the proto.
|
Regular expression `/(\D*)\s?([\d|.|,]+)\s?(\D*)/` will return an array with following values:
* [0] = whole string (eg "£4.30"
* [1] = prefix (eg. "£")
* [2] = numerical value (eg. "4.30")
* [3] = suffix (eg. "kr")
Usage: `var parts = /(\D*)\s?([\d|.|,]+)\s?(\D*)/.exec(myValue);`
It also handles cases where either prefix or suffix has following or leading space.
And whenever you need to replace the comma from number, just use the *value.replace(",",".")* method.
|
47,546,007 |
I am trying to create my first web page. The style part of the code was suposed to change the background color, but it dont.
I think the code works so why dont it show up when I use it?
By mistake I changed the default way to open css files to "skype" and this created a problem. I changed it to notepad, but that did not fix the problem and I dont know what should be the default program to open it.
```
<!doctype html>
<html>
<head>
<title> My web Page </title>
<style>
body {
background:red;
}
</style>
</head>
<body>
<h1> My webSite</h1>
<h2> This is my homepage content</h2>
</body>
</html>
```
|
2017/11/29
|
['https://Stackoverflow.com/questions/47546007', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9023862/']
|
Use `sortBy`
```
val rdd : RDD[((String,Int),Int)] = ???
rdd.sortBy{case ((name,age),_) => name}
```
Sort by age:
```
rdd.sortBy{case ((name,age),_) => age}
```
|
`sparkContext.parallelize(Array( ("Sam", 23),("Ram", 32),("Dan", 25) )).sortBy(_._1)//If it's inverted order,input false ,If you pass the age _1 to _2
.foreach(println)`
[enter image description here](https://i.stack.imgur.com/wuDXK.png)
|
16,643,391 |
I have read lots of posts on sending SMS and multipart SMS messages such as:
[Sending SMS in Android](https://stackoverflow.com/questions/5944345/sending-sms-in-android),
[Sending and Receiving SMS and MMS in Android (pre Kit Kat Android 4.4)](https://stackoverflow.com/questions/14452808/sending-and-receiving-sms-and-mms-in-android),
[Android PendingIntent extras, not received by BroadcastReceiver](https://stackoverflow.com/questions/14571564/android-pendingintent-extras-not-received-by-broadcastreceiver)
... and others, but they don't seem to go into checking that all parts of the message were sent successfully.
From what I understand, with a multi part message, you add a PendingIntent for each message part, but the examples I have seen don't seem to check that all parts are sent successfully... if one is (I guess the first one) they seem to assume it was successful...
So I thought I would send a multipart message and keep track of the parts. I would not say the message is successfully sent until all parts are successfully sent.
I have attempted to do this in the following code... SmsMessageInfo is just a simple class containing the phone number, a message and a list of booleans for parts processed and a list of parts successfully sent, it also has a unique message Id.
I have tried the following:
```
private void sendLongSmsMessage(Context context, final SmsMessageInfo messageInfo) {
// Receive when each part of the SMS has been sent (or does it????)
context.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String messageIdAsString = intent.getExtras().getString(INTENT_EXTRA_MESSAGE_ID_KEY);
Log.i("SMSMessageSender", "Broadcast Intent Recieved, IntentMessageID: " + messageIdAsString + " messageInfoId: " + messageInfo.messageId);
if (messageIdAsString != null) {
if (Long.parseLong(messageIdAsString) == messageInfo.messageId) {
String messagePartNrAsString = (String) intent.getExtras().get(INTENT_EXTRA_PART_NR_KEY);
int messagePartNr = Integer.parseInt(messagePartNrAsString);
Log.i("SMSMessageSender", "Broadcast Intent Recieved Multi Part Message Part No: " + messagePartNrAsString);
// We need to make all the parts succeed before we say we have succeeded.
switch (getResultCode()) {
case Activity.RESULT_OK:
messageInfo.partsSent.add(messagePartNr, true);
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
messageInfo.failMessage = "Error - Generic failure";
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
messageInfo.failMessage = "Error - No Service";
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
messageInfo.failMessage = "Error - Null PDU";
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
messageInfo.failMessage = "Error - Radio off";
break;
}
messageInfo.partsProcessed.add(messagePartNr, true);
boolean allSent = true;
for (Boolean partSent : messageInfo.partsSent) {
allSent = allSent && partSent;
}
messageInfo.sent = allSent;
boolean allProcessed = true;
for (Boolean partProcessed : messageInfo.partsProcessed) {
allProcessed = allProcessed && partProcessed;
}
if (allProcessed) {
// We have our response for all of our message parts, so we can unregister our receiver.
Log.i("SMSMessageSender", "All message part resoponses received, unregistering message Id: " + messageIdAsString);
context.unregisterReceiver(this);
}
} else {
Log.w("SMSMessageSender", "Received a broadcast message with Id for a different message");
}
} else {
Log.w("SMSMessageSender", "Received a broadcast message but not for message Id");
}
}
}, new IntentFilter(SENT));
ArrayList<String> messageList = SmsManager.getDefault().divideMessage(messageInfo.message);
ArrayList<PendingIntent> pendingIntents = new ArrayList<PendingIntent>(messageList.size());
messageInfo.partsSent.clear();
for (int i = 0; i < messageList.size(); i++) {
messageInfo.partsSent.add(i, false);
messageInfo.partsProcessed.add(i, false);
Intent sentIntent = new Intent(SENT);
sentIntent.putExtra(INTENT_EXTRA_MESSAGE_ID_KEY, Long.toString(messageInfo.messageId));
sentIntent.putExtra(INTENT_EXTRA_PART_NR_KEY, Integer.toString(i));
Log.i("SMSMessageSender", "Adding part " + i + " tp multi-part message Id: " + messageInfo.messageId);
pendingIntents.add(PendingIntent.getBroadcast(context, 0, sentIntent, PendingIntent.FLAG_ONE_SHOT));
}
Log.i("SMSMessageSender", "About to send multi-part message Id: " + messageInfo.messageId);
SmsManager.getDefault().sendMultipartTextMessage(messageInfo.phoneNumber, null, messageList, pendingIntents, null);
}
```
The problem with this is that the second message part never gets received.
It seems strange to have to go into all the hassle of creating multiple PendingIntents only to not go and check that they all worked.
In the log message where I show the Message Part No, it is always 0, I never get the second part, therefore this code never thinks it gets completed.
Am I just making it too complicated, should I just take any old PendingIntent that comes back and assume the same applies to the rest (in which case why did Google make you supply a list of them in the first place).
I apologise for the long question, but didn't really know how to ask more clearly in a shorter fashion :-)
Regards
Colin
|
2013/05/20
|
['https://Stackoverflow.com/questions/16643391', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2400538/']
|
Here is the code I have ended up using, it is a mix of my original and that of Bolton (thanks Bolton :-)).
The new code *may* detect a failure of a part better, a bit hard to test, the code above sets anyError to false for each message part, so if part 1 failed and part 2 succeeded it might think that the whole thing succeeded... the code below calls (my) messageInfo.fail which won't get reset if a subsequent message part succeeds... I imagine this is all pretty unneeded as you would think that if one part works, the rest will too... anyhow, below is the code I ultimately used.
Edit > Updated the code to remove the Extras in the intent as under heavy load, multiple intents (I think) got merged into one (using different PendingIntent flags did not help). In the end, I used a different intent action for each message (e.g. new Intent(SENT + messageInfo.getMessageId())), this way the receiver definitely only gets broadcasts for its own message. Seems to work better under heavy load.
Thanks.
```
private void sendLongSmsMessage4(Context context, final SmsMessageInfo messageInfo) {
// Receive when each part of the SMS has been sent
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// We need to make all the parts succeed before we say we have succeeded.
switch (getResultCode()) {
case Activity.RESULT_OK:
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
messageInfo.fail("Error - Generic failure");
break;
case SmsManager.RESULT_ERROR_NO_SERVICE:
messageInfo.fail("Error - No Service");
break;
case SmsManager.RESULT_ERROR_NULL_PDU:
messageInfo.fail("Error - Null PDU");
break;
case SmsManager.RESULT_ERROR_RADIO_OFF:
messageInfo.fail("Error - Radio off");
break;
}
nMsgParts--;
if (nMsgParts <= 0) {
// Stop us from getting any other broadcasts (may be for other messages)
Log.i(LOG_TAG, "All message part resoponses received, unregistering message Id: " + messageInfo.getMessageId());
context.unregisterReceiver(this);
if (messageInfo.isFailed()) {
Log.d(LOG_TAG, "SMS Failure for message id: " + messageInfo.getMessageId());
} else {
Log.d(LOG_TAG, "SMS Success for message id: " + messageInfo.getMessageId());
messageInfo.setSent(true);
}
}
}
};
context.registerReceiver(broadcastReceiver, new IntentFilter(SENT + messageInfo.getMessageId()));
SmsManager smsManager = SmsManager.getDefault();
ArrayList<String> messageParts = smsManager.divideMessage(messageInfo.getMessage());
ArrayList<PendingIntent> pendingIntents = new ArrayList<PendingIntent>(messageParts.size());
nMsgParts = messageParts.size();
for (int i = 0; i < messageParts.size(); i++) {
Intent sentIntent = new Intent(SENT + messageInfo.getMessageId());
pendingIntents.add(PendingIntent.getBroadcast(context, 0, sentIntent, 0));
}
Log.i(LOG_TAG, "About to send multi-part message Id: " + messageInfo.getMessageId());
smsManager.sendMultipartTextMessage(messageInfo.getPhoneNumber(), null, messageParts, pendingIntents, null);
}
```
|
I'm using the code below to sent multipart message to multiple contact, and it works fine:
```
// Send the SMS message
SmsManager sms = SmsManager.getDefault();
ArrayList<String> parts = sms.divideMessage(content);
final int numParts = parts.size();
ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();
sentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d(TAG, "SMS onReceive intent received.");
boolean anyError = false;
switch (getResultCode()) {
case Activity.RESULT_OK:
break;
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
case SmsManager.RESULT_ERROR_NO_SERVICE:
case SmsManager.RESULT_ERROR_NULL_PDU:
case SmsManager.RESULT_ERROR_RADIO_OFF:
anyError = true;
break;
}
msgParts--;
if (msgParts == 0) {
hideProgressBar();
if (anyError) {
Toast.makeText(context,
getString(R.string.sms_send_fail),
Toast.LENGTH_SHORT).show();
} else {
//success
}
unregisterReceiver(sentReceiver);
}
}
};
registerReceiver(sentReceiver, new IntentFilter(SENT_ACTION));
// SMS delivered receiver
// registerReceiver(new BroadcastReceiver() {
// @Override
// public void onReceive(Context context, Intent intent) {
// Log.d(TAG, "SMS delivered intent received.");
// }
// }, new IntentFilter(DELIVERED_ACTION));
for (int i = 0; i < numParts; i++) {
sentIntents.add(PendingIntent.getBroadcast(this, 0, new Intent(
SENT_ACTION), 0));
}
for (PhoneInfo phone : recipientsList) {
sms.sendMultipartTextMessage(phone.num, null, parts, sentIntents,
null);
}
msgParts = numParts * recipientsList.size();
showProgressBar();
```
|
8,937,162 |
I wanted to measure the battery consumption of various colors in the range of 0-255 in android. Wanted to do it through an application. Currently I am using the PowerManager to measure the initial level of Battery and then keeping the screen bright for say 10-20 mins and check the final battery level, the difference giving me the usage in %. But I am getting weird results as in "white" uses same power as "black" (both having a drop of 4%). So I think my appraoch may be wrong. Can someone please suggest me to appraoch the problem in a correct way. Please help !!
|
2012/01/20
|
['https://Stackoverflow.com/questions/8937162', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/872506/']
|
I dont know what device you are using, but usually what really consumes the battery is the backlight, while the color is disposable in terms of power consumption.
|
(disclaimer: I co-founded the company that built the below product)
Try [Little Eye](http://www.littleeye.co) from Little Eye Labs, which lets you track an individual apps power consumption and breaks it down into its various hardware usage, including display, CPU and wifi (and shortly GPS). Based on the pixel color and the brightness levels used, the power consumption trend of the app will vary, and Little Eye helps you visualize that quite easily. Note its a desktop product (which connects to your phone) that you need to download and install from [here](http://www.littleeye.co)
|
8,937,162 |
I wanted to measure the battery consumption of various colors in the range of 0-255 in android. Wanted to do it through an application. Currently I am using the PowerManager to measure the initial level of Battery and then keeping the screen bright for say 10-20 mins and check the final battery level, the difference giving me the usage in %. But I am getting weird results as in "white" uses same power as "black" (both having a drop of 4%). So I think my appraoch may be wrong. Can someone please suggest me to appraoch the problem in a correct way. Please help !!
|
2012/01/20
|
['https://Stackoverflow.com/questions/8937162', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/872506/']
|
I dont know what device you are using, but usually what really consumes the battery is the backlight, while the color is disposable in terms of power consumption.
|
There's an official power estimation tool called [Battery Historian](https://developer.android.com/studio/profile/battery-historian.html).It will create a text file which will show the power consumption of each component of the device in mAh.
I also suggest you to run you App for a longer time like 1 hour because the power consumption difference may be very small.
I hope this will help you.
|
8,937,162 |
I wanted to measure the battery consumption of various colors in the range of 0-255 in android. Wanted to do it through an application. Currently I am using the PowerManager to measure the initial level of Battery and then keeping the screen bright for say 10-20 mins and check the final battery level, the difference giving me the usage in %. But I am getting weird results as in "white" uses same power as "black" (both having a drop of 4%). So I think my appraoch may be wrong. Can someone please suggest me to appraoch the problem in a correct way. Please help !!
|
2012/01/20
|
['https://Stackoverflow.com/questions/8937162', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/872506/']
|
(disclaimer: I co-founded the company that built the below product)
Try [Little Eye](http://www.littleeye.co) from Little Eye Labs, which lets you track an individual apps power consumption and breaks it down into its various hardware usage, including display, CPU and wifi (and shortly GPS). Based on the pixel color and the brightness levels used, the power consumption trend of the app will vary, and Little Eye helps you visualize that quite easily. Note its a desktop product (which connects to your phone) that you need to download and install from [here](http://www.littleeye.co)
|
There's an official power estimation tool called [Battery Historian](https://developer.android.com/studio/profile/battery-historian.html).It will create a text file which will show the power consumption of each component of the device in mAh.
I also suggest you to run you App for a longer time like 1 hour because the power consumption difference may be very small.
I hope this will help you.
|
27,152 |
Would it be possible to create a (non-toxic) alcoholic drink that, when zapped with a 0.5mW laser pointer, changes color?
This would be mainly for the visual effects (bartender show) so it should not require aiming the laser at the drink for more than a few seconds. The reason for choosing a 0.5mW laser is to minimize the need for eye protection.
It would not matter what color laser is used, but would this be possible?
If it is possible, what kind of chemical(s) would be needed in the drink?
|
2015/03/10
|
['https://chemistry.stackexchange.com/questions/27152', 'https://chemistry.stackexchange.com', 'https://chemistry.stackexchange.com/users/-1/']
|
I see a couple of problems here:
### Beam diameter vs volume of the beverage
The volume of the sample that is actually hit by a narrow laser beam is very small, as compared to the total volume of the sample (= the drink). As a consequence, only a very small amount of the dye in drink will undergo a transformation. A wide beam of a switchable light source definitely is the better option.
### Is is possible in general?
Yes, a number of compound classes undergo transformations upon iradiation and change their colour (spiropyranes, fulgides, etc.). Often, the reverse reaction can be induce thermally.
### So what?
Food dyes are strictly regulated, you can't add a photochromic dye to a drink just because the colour change looks nice in the lab. If the dye isn't approved as a food dye, there's no legal way! To my knowledge, food dyes typically do not show photochromism but are photostable. Consumers usually don't like that their food changes the colour in the light.
In summary, the idea sounds funny but I rather doubt that it can be realized.
The only option to add a dramatic effect would be the use of fluorescent and food-compatible ingedients. Think in quinine (tonic water).
|
Klaus has provided an excellent answer. Basically your desired approach is possible, but fraught with difficulty.
Perhaps there is another way to attack the problem. Still, I suspect considerable testing will be required.
For reasons mentioned by Klaus, it is necessary to use a food dye that is already approved. Many food dyes are photobleachable. For example, azo dyes exist as *cis-trans* isomer pairs. Typically, the *trans* isomer is more stable and provides the dye color.

Often (not always, this is why you'll need to test), when the *trans*-dye is irradiated with laser light it will convert to the colorless (or differently colored) *cis* isomer. This is termed "photobleaching" - light has "bleached" the color out of the dye. Generally the *cis* isomer remains stable as long as you keep it cold. The same concept can be applied to non-azo dyes that can exist as isomeric pairs.

[image source](http://www.hindawi.com/journals/ijp/2009/434897/)
Buy a number of food dyes that provide the color you desire and can exist as isomers (*cis-trans* or otherwise). Dissolve each one separately (until you find one that works) in the minimum amount of one of the ingredients in your "Blue Light Special". Irradiate the (presumably colored) solution with a general lab laser (maybe you have a chemist friend who can do this for you) - a laser pointer probably won't have enough power. If the experiment is successful, the color should disappear from the solution. Keep the solution cold in your bar fridge.
When someone orders the "Blue Light Special" mix all of the other ingredients in a glass at room temperature. Add some of the cold, colorless (photobleached) dye solution to the room temperature mix. As the cold dye warms up it should convert back to its colored form and the drink should **become colored right before the customer's eyes.**
|
19,238,564 |
I trying to find way to change table data to one sentence
For example
If i have a table
```
Data
1
2
3
4
5
```
and i want it to change as '1 2 3 4 5'
:D
ok to make it clear.
I declare a vairable @k1 nvarchar(200)
select @k1 = keyword from keyword where concept\_id = (select Concept\_ID from concept where @concept\_name = Concept\_name)
so this variable returns a table as shown above example
like
keyword
1
2
3
.
.
and if i used this variable into freetext
```
select id as Post_ID, post as Txt from Post
where freetext (post, @k1)
end
```
It shows the result but the result is only @ki is recognised as last word of the table
So i want to @k1 can be including all the data from the table so the freetext function can find any words in @k1
:C;; hard to exaplain..
|
2013/10/08
|
['https://Stackoverflow.com/questions/19238564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2740486/']
|
you can use stuff function to make it
```
SELECT STUFF((SELECT ' '+CONVERT(NVARCHAR(MAX),DATA) FROM SAMPLE
FOR XML PATH('')),1,1,(''))
```
Sample below
<http://sqlfiddle.com/#!3/f4c05/3>
|
Use that code:
```
declare @result nvarchar(max) = ''
select @result = @result + [data] + ' ' from tble1
print rtrim(@result)
```
|
19,238,564 |
I trying to find way to change table data to one sentence
For example
If i have a table
```
Data
1
2
3
4
5
```
and i want it to change as '1 2 3 4 5'
:D
ok to make it clear.
I declare a vairable @k1 nvarchar(200)
select @k1 = keyword from keyword where concept\_id = (select Concept\_ID from concept where @concept\_name = Concept\_name)
so this variable returns a table as shown above example
like
keyword
1
2
3
.
.
and if i used this variable into freetext
```
select id as Post_ID, post as Txt from Post
where freetext (post, @k1)
end
```
It shows the result but the result is only @ki is recognised as last word of the table
So i want to @k1 can be including all the data from the table so the freetext function can find any words in @k1
:C;; hard to exaplain..
|
2013/10/08
|
['https://Stackoverflow.com/questions/19238564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2740486/']
|
you can use stuff function to make it
```
SELECT STUFF((SELECT ' '+CONVERT(NVARCHAR(MAX),DATA) FROM SAMPLE
FOR XML PATH('')),1,1,(''))
```
Sample below
<http://sqlfiddle.com/#!3/f4c05/3>
|
Store the resultset in a table like you have shown and use `COALESCE` [function](http://msdn.microsoft.com/en-us/library/ms190349.aspx) .
```
DECLARE @List varchar(max)
SELECT @List = COALESCE(@List + ' ', '') + Data
FROM <yourTable>
```
|
1,737,500 |
I have an asp:Label inside an update panel that I need to update from both the server application and client side Javascript. I can update the label fine before the first UpdatePanel refresh by setting label.innerHTML. The server changes the label correctly during a panel update. After the update, setting label.innerHTML from client Javascript no longer changes the value shown in the browser.
How can I find the label to continue to update it from Javascript after an UpdatePanel update?
|
2009/11/15
|
['https://Stackoverflow.com/questions/1737500', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1743/']
|
The reference to the DOM element you obtained presumably with `document.getElementById` before the UpdatePanel refresh is no longer valid after the refresh because the label is replaced with a new DOM element. So you need to obtain a new reference to this element and set innerHTML to this new reference.
The events might look like this
1. `var label = document.getElementById('some_label'); label.innerHTML = 'abc';`
2. UpdatePanel is trigerred which replaces the label inside the DOM
3. `label.innerHTML` no longer works. You need to repeat step 1) here.
|
The DOM element is being replaced when the UpdatePanel refreshes. Any references that you have to the previous DOM element are no longer usable, they reference the DOM element that was removed and no longer exists. You'll need to find the replacement DOM element before you'll be able to access its properties. You can do this using document.getElementById('label') or, with jQuery, $('#label'), assuming that you've given it the name `label`.
|
9,131,483 |
I am using coldfusion's imageGetIPTCMetadata() function to get the iptc keywords.
I used Photomechanics to insert some keywords in a hierarchical fashion like this
```
Personnel | Appointments | Assistant Chief of General Staff (ACGS), Personnel | Ranks | Royal Marine | Colour Sergeant (CSgt), Personnel | Ranks | Royal Navy | Chief Petty Officer (CPO), Personnel|Ranks|Army|Field Marshall (Fd Marshall) (FM)
```
But after I call the method in my CFC I get this -
How can I get the keywords with a delimeter or something so that I can reuse them in my code.

|
2012/02/03
|
['https://Stackoverflow.com/questions/9131483', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/418366/']
|
If I understand your question correctly, you can use one of the [List functions](http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1a60c-7ffc.html#WSc3ff6d0ea77859461172e0811cbec22c24-6a42) like [ListGetAt](http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-6d78.html) to get the keywords with a delimiter. Or if you prefer working with arrays you can use the [ListToArray](http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f0f.html) function `keywordsArray = ListToArray(data.Keywords,"|")`
```
<cfscript>
data = ImageGetIPTCMetadata(myImage);
for( i=1; i LTE ListLen(data.Keywords,"|"); i++ )
{
WriteOutput( Trim( ListGetAt(data.Keywords, i, "|") ) & "<br />" );
}
</cfscript>
```
|
I use CFX\_OpenImage to read and write IPTC\_ data in .jpg files in CF8 thru CF11. I also use this for image resize and rotation.
More CFX\_OPENIMAGE INFO go to <http://www.kolumbus.fi/jukka.manner/cfx_openimage/>
It GraphicsMagick 1.3.17.
GraphicsMagick (www.graphicsmagick.org) maintains a stable release branch, maintains a detailed Change Log, and maintains a stable source repository with complete version history so that changes are controlled, and changes between releases are accurately described. GraphicsMagick provides continued support for a release branch.
More INSTALLATION INFO:
Note: If you are installing 64bit version of the tag, please download and install Microsoft Visual C++ 2010 Redistributable Package (x64) from Microsoft (<http://www.microsoft.com/download/en/details.aspx?id=14632>). The x64 version has been compiled and written in Visual Studio 2010.
CFX\_OPENIMAGE installation steps common to both versions:
Create an environment variable Since GraphicsMagick needs read configuration files (\*.mgk files), we need to tell the tag where those files are located. In order to do that, a system or cold fusion runtime user specific environment variable must be set. The name of this variable is CFX\_OPENIMAGE\_FULLPATH.
CFX\_OPENIMAGE\_FULLPATH environment variable should contain full pathname which points to a directory where all mgk-files and cfx\_openimage.ini file are kept. A default value for this is “c:\cfx\_openimage\”. Notice that the last “\” character is needed too.
You may install the actual dll where ever you like, it’s up to you to register is anyway via CF admin page. For keeping the security settings for all the files equal, it is recommended to keep cfx\_openimage.dll in the same directory that the \*.mgk and cfx\_openimage.ini directory.
|
9,131,483 |
I am using coldfusion's imageGetIPTCMetadata() function to get the iptc keywords.
I used Photomechanics to insert some keywords in a hierarchical fashion like this
```
Personnel | Appointments | Assistant Chief of General Staff (ACGS), Personnel | Ranks | Royal Marine | Colour Sergeant (CSgt), Personnel | Ranks | Royal Navy | Chief Petty Officer (CPO), Personnel|Ranks|Army|Field Marshall (Fd Marshall) (FM)
```
But after I call the method in my CFC I get this -
How can I get the keywords with a delimeter or something so that I can reuse them in my code.

|
2012/02/03
|
['https://Stackoverflow.com/questions/9131483', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/418366/']
|
I found the solution [here](http://www.genuinejd.com/blog/index.cfm/2009/2/20/Reading-Embedded-XMP-Packets-using-ColdFusion):
```xml
<cfparam name="URL.source" default="xmp-asset.jpg">
<cffile action="readbinary" file="#ExpandPath(URL.source)#" variable="data">
<!-- encode the binary data to hex -->
<cfset hex_data = BinaryEncode(data,"hex") />
<!-- string indicating beginning of packet '<x:xmpmeta' -->
<cfset xmp_string_begin = "3C783A786D706D657461" />
<!-- string indicating end of packet '</x:xmpmeta>' -->
<cfset xmp_string_end = "3C2F783A786D706D6574613E" />
<!-- find the starting index in the hex string -->
<cfset idx_start = FindNoCase(xmp_string_begin,hex_data) />
<!-- find the ending index in the hex string -->
<cfset idx_end = FindNoCase(xmp_string_end,hex_data,idx_start) + Len(xmp_string_end) />
<!-- using the start and end indices, extract the xmp packet -->
<cfset xmp_hex = Mid(hex_data,idx_start,Evaluate(idx_end-idx_start)) />
<!-- convert the hex to readable characters -->
<cfset xmp_string = ToString(BinaryDecode(xmp_hex,"hex")) />
<!-- parse the xml string to and xml structure -->
<cfset xmp_xml = XmlParse(xmp_string) />
<cfcontent type="text/xml">
<cfoutput>#xmp_string#</cfoutput>
```
Now I can get the entire XMP xml and do all I want to do with the data there.
|
I use CFX\_OpenImage to read and write IPTC\_ data in .jpg files in CF8 thru CF11. I also use this for image resize and rotation.
More CFX\_OPENIMAGE INFO go to <http://www.kolumbus.fi/jukka.manner/cfx_openimage/>
It GraphicsMagick 1.3.17.
GraphicsMagick (www.graphicsmagick.org) maintains a stable release branch, maintains a detailed Change Log, and maintains a stable source repository with complete version history so that changes are controlled, and changes between releases are accurately described. GraphicsMagick provides continued support for a release branch.
More INSTALLATION INFO:
Note: If you are installing 64bit version of the tag, please download and install Microsoft Visual C++ 2010 Redistributable Package (x64) from Microsoft (<http://www.microsoft.com/download/en/details.aspx?id=14632>). The x64 version has been compiled and written in Visual Studio 2010.
CFX\_OPENIMAGE installation steps common to both versions:
Create an environment variable Since GraphicsMagick needs read configuration files (\*.mgk files), we need to tell the tag where those files are located. In order to do that, a system or cold fusion runtime user specific environment variable must be set. The name of this variable is CFX\_OPENIMAGE\_FULLPATH.
CFX\_OPENIMAGE\_FULLPATH environment variable should contain full pathname which points to a directory where all mgk-files and cfx\_openimage.ini file are kept. A default value for this is “c:\cfx\_openimage\”. Notice that the last “\” character is needed too.
You may install the actual dll where ever you like, it’s up to you to register is anyway via CF admin page. For keeping the security settings for all the files equal, it is recommended to keep cfx\_openimage.dll in the same directory that the \*.mgk and cfx\_openimage.ini directory.
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
The only reason that it wouldn't be recommended is consistency. Most developers prefer to deal with a single language when working on an application. Having a single language also means that your developers only need to know a single language rather than knowing both VB.NET and C# (even though the two are extremely similar).
If you need to mix legacy VB.NET and C#, there's no reason not to.
|
It's a matter of "use the best tools available to you for what you're building". Mixing C# and VB *within* a project isn't recommended (for obvious "it won't compile" reasons), but there's no point in continuing to write old code in VB if you feel your development team can operate faster and in a more maintainable fashion using C#.
We've been doing this at my office for the past few months (in a similar legacy code situation) and have yet to run into any major issues (beyond potential lost dev time due to context switching), and we've gained incredibly from working with a language that we all feel more comfortable with.
More information on task switching [here](http://en.wikipedia.org/wiki/Task_switching_%28psychology%29). I really do feel like the benefits we see on a daily basis from our level of comfort with C# outweighs the cost of occasionally having to dip back into the legacy pool.
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
There is no real reason to avoid this, other than adding complexity from having two languages in one "solution".
Your scenario (working with a legacy product, but adding new features) is a valid reason to have both languages used in a single solution, in my opinion.
|
Why would you want to do that? If you have legacy code what you want to use, you keep that code in its own components, you don't mix it with the new code. It is not recommended because it does not promote "Clean Code". It can lead you to have a solution that is difficult to read and maintain.
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
It's a matter of "use the best tools available to you for what you're building". Mixing C# and VB *within* a project isn't recommended (for obvious "it won't compile" reasons), but there's no point in continuing to write old code in VB if you feel your development team can operate faster and in a more maintainable fashion using C#.
We've been doing this at my office for the past few months (in a similar legacy code situation) and have yet to run into any major issues (beyond potential lost dev time due to context switching), and we've gained incredibly from working with a language that we all feel more comfortable with.
More information on task switching [here](http://en.wikipedia.org/wiki/Task_switching_%28psychology%29). I really do feel like the benefits we see on a daily basis from our level of comfort with C# outweighs the cost of occasionally having to dip back into the legacy pool.
|
Its just a matter of person choice. if you are comfortable with both the languages, You surely can use them in same solution.
Using a single language in a solution seems easily maintainable. hence it is preferred.
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
The only reason that it wouldn't be recommended is consistency. Most developers prefer to deal with a single language when working on an application. Having a single language also means that your developers only need to know a single language rather than knowing both VB.NET and C# (even though the two are extremely similar).
If you need to mix legacy VB.NET and C#, there's no reason not to.
|
Mixing code in solutions can get real messy real quickly, its never clear what method you are calling from where, to keep it nice. Develop in separate Solutions, it will keep your projects easier to track and make sure you are not confusing languages inside projects
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
The only reason that it wouldn't be recommended is consistency. Most developers prefer to deal with a single language when working on an application. Having a single language also means that your developers only need to know a single language rather than knowing both VB.NET and C# (even though the two are extremely similar).
If you need to mix legacy VB.NET and C#, there's no reason not to.
|
Its just a matter of person choice. if you are comfortable with both the languages, You surely can use them in same solution.
Using a single language in a solution seems easily maintainable. hence it is preferred.
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
It's a matter of "use the best tools available to you for what you're building". Mixing C# and VB *within* a project isn't recommended (for obvious "it won't compile" reasons), but there's no point in continuing to write old code in VB if you feel your development team can operate faster and in a more maintainable fashion using C#.
We've been doing this at my office for the past few months (in a similar legacy code situation) and have yet to run into any major issues (beyond potential lost dev time due to context switching), and we've gained incredibly from working with a language that we all feel more comfortable with.
More information on task switching [here](http://en.wikipedia.org/wiki/Task_switching_%28psychology%29). I really do feel like the benefits we see on a daily basis from our level of comfort with C# outweighs the cost of occasionally having to dip back into the legacy pool.
|
Mixing code in solutions can get real messy real quickly, its never clear what method you are calling from where, to keep it nice. Develop in separate Solutions, it will keep your projects easier to track and make sure you are not confusing languages inside projects
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
There is no real reason to avoid this, other than adding complexity from having two languages in one "solution".
Your scenario (working with a legacy product, but adding new features) is a valid reason to have both languages used in a single solution, in my opinion.
|
Mixing code in solutions can get real messy real quickly, its never clear what method you are calling from where, to keep it nice. Develop in separate Solutions, it will keep your projects easier to track and make sure you are not confusing languages inside projects
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
It's a matter of "use the best tools available to you for what you're building". Mixing C# and VB *within* a project isn't recommended (for obvious "it won't compile" reasons), but there's no point in continuing to write old code in VB if you feel your development team can operate faster and in a more maintainable fashion using C#.
We've been doing this at my office for the past few months (in a similar legacy code situation) and have yet to run into any major issues (beyond potential lost dev time due to context switching), and we've gained incredibly from working with a language that we all feel more comfortable with.
More information on task switching [here](http://en.wikipedia.org/wiki/Task_switching_%28psychology%29). I really do feel like the benefits we see on a daily basis from our level of comfort with C# outweighs the cost of occasionally having to dip back into the legacy pool.
|
Why would you want to do that? If you have legacy code what you want to use, you keep that code in its own components, you don't mix it with the new code. It is not recommended because it does not promote "Clean Code". It can lead you to have a solution that is difficult to read and maintain.
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
There is no real reason to avoid this, other than adding complexity from having two languages in one "solution".
Your scenario (working with a legacy product, but adding new features) is a valid reason to have both languages used in a single solution, in my opinion.
|
The only reason that it wouldn't be recommended is consistency. Most developers prefer to deal with a single language when working on an application. Having a single language also means that your developers only need to know a single language rather than knowing both VB.NET and C# (even though the two are extremely similar).
If you need to mix legacy VB.NET and C#, there's no reason not to.
|
15,706,564 |
I was reading [this question](https://stackoverflow.com/q/2903430/1882077) when I noticed a curious comment underneath:
>
> not sure what the question is: you can use VB.NET and C# projects in one solution (though I wouldn't recommend doing so).
>
>
>
I do this quite a bit, as we have legacy VB.Net code, and new code is written in C#. Is this really not recommended? Why not?
|
2013/03/29
|
['https://Stackoverflow.com/questions/15706564', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/969613/']
|
The only reason that it wouldn't be recommended is consistency. Most developers prefer to deal with a single language when working on an application. Having a single language also means that your developers only need to know a single language rather than knowing both VB.NET and C# (even though the two are extremely similar).
If you need to mix legacy VB.NET and C#, there's no reason not to.
|
Why would you want to do that? If you have legacy code what you want to use, you keep that code in its own components, you don't mix it with the new code. It is not recommended because it does not promote "Clean Code". It can lead you to have a solution that is difficult to read and maintain.
|
5,058 |
I have been running for almost 2 years now, after pretty much never running before in my life. I have had the usual injuries (shin splints, sprained ankle, etc.), but nothing serious. I've always thought I was doing everything right, until I saw this video about the day after the marathon:
<http://www.youtube.com/watch?v=m-hCuYjvw2I>
The thing is, my thighs have never - not once - hurt after a run! My calves have hurt, as well as my feet, hips, etc. So what am I doing wrong? Or am I doing anything wrong at all?
Some sites suggest this could be because I have weak thighs, and the rest of my legs are picking up the slack. But I can comfortably leg press about 3 times my body weight, so I don't think that's the problem.
Is this something to be concerned about? Or is it just marathon specific: I mean, I've never run more than a 10K.
|
2012/01/07
|
['https://fitness.stackexchange.com/questions/5058', 'https://fitness.stackexchange.com', 'https://fitness.stackexchange.com/users/2471/']
|
The main differences between the two is the philosophies behind it, and how they are designed to work. First and foremost, it is important to realize that Paleo does allow carbs, just not grains and legumes (or anything that grows underground).
**Atkins**
* Is a ketogenic diet. It puts your body in a safe version of a fasting state so that your body turns fat into ketone bodies. Ketone bodies cannot be reassimilated to fat so unused ketone bodies are urinated out.
* Emphasis is on both protein and fats. Protein is there to help protect your muscle mass, and fat is used to provide some additional energy.
* Is designed as a temporary diet to help you lose weight, it is not intended for prolonged use.
**Paleo**
* Is based on what scientists believe the average paleolithic man ate. This includes berries and easily accessible fruit/vegetables as well as meat.
* Emphasis is on avoiding processed foods and foods that are likely to cause digestion problems. This includes grains (like wheat), tubers (like potatoes), and legumes (like beans).
* Is designed as a way of life diet, or in other words a sustainable diet you can use for the long term.
There are some commonalities between the two approaches, such as the emphasis on meat as a protein source. However, Paleo tends towards whole foods and grass/natural diet fed meat and Atkins makes no distinction. While Atkins does not allow carbs which would take someone out of ketosis, Paleo does allow carbs.
Anyone who exercises regularly will need the following for a healthy diet:
* About 1g protein / lb lean body mass. This is both for the better thermic effect of food (i.e. it burns more calories digesting it), and for restoring muscles that have been torn down by exercise.
* Carbs on workout day. This is a minimum, as it helps restore your glycogen levels to help you recover more quickly.
* A combination of saturated and mono-unsaturated fats. Fat is used for energy, but it also carries with it essential fat-born vitamins. NOTE: I did not include poly-unsaturated fats which are man-made and cause health issues over the long term.
How you proportion those depends on your daily caloric needs, but it is safe to split the remaining calories after you have your protein evenly between the carbs and fat. This is very possible on the Paleo diet, but due to the way Atkins is designed it is not possible on that diet. You will likely need to alter how you exercise on Atkins to ensure you do not burn muscle.
|
Berin Loritsch is mistaken in that Atkins would be meant only for weight loss. It is meant for prolonged use as well as any reasonable diet.
In Atkins you drop the carbohydrate intake to max of 20 grams per day for two weeks. After that you start gradually adding carbohydrates to your diet until you reach the point where you stop losing weight. Then you dial the carb intake back until you have reached desired weight. After that you can raise the carb intake a bit to a point where you don't lose or gain weight. The most probable mechanism for losing weight with Atkins is lessened hunger due to eating less carbs and more importantly more protein. This leads to less energy intake, leading to weight loss when the energy intake drops below energy expenditure. [More detailed description about different phases of Atkins](http://www.atkinsdietfreeplan.com/).
Paleo diet is basically based on some anthropology-based ideas on what some people ate during the paleolithic era. The basic idea is that this would be the diet we evolved to eat, so based on that it should be good. The problem is that people living in paleolithic era ate extremely varied diets based on where they lived. The diet itself is basically various meats and vegetables. Depending on whose paleo ideas you follow dairy and grains are allowed/disallowed. Generally on paleo diet you eat less carbs than is common these days. There are lot of sites about paleo around. Most prominent gurus are propably Dr. Cordain, Mark Sisson and Robb Wolf among others.
Neither is really much evidence based (unsurprisingly little about any diet is). My advice would be that if you feel fine on one of these, then go ahead. You should take any health claims made on behalf of either approach with grain of salt. Though restricting bad carbs is good, there is lot of hype based on little evidence about either one.
|
5,058 |
I have been running for almost 2 years now, after pretty much never running before in my life. I have had the usual injuries (shin splints, sprained ankle, etc.), but nothing serious. I've always thought I was doing everything right, until I saw this video about the day after the marathon:
<http://www.youtube.com/watch?v=m-hCuYjvw2I>
The thing is, my thighs have never - not once - hurt after a run! My calves have hurt, as well as my feet, hips, etc. So what am I doing wrong? Or am I doing anything wrong at all?
Some sites suggest this could be because I have weak thighs, and the rest of my legs are picking up the slack. But I can comfortably leg press about 3 times my body weight, so I don't think that's the problem.
Is this something to be concerned about? Or is it just marathon specific: I mean, I've never run more than a 10K.
|
2012/01/07
|
['https://fitness.stackexchange.com/questions/5058', 'https://fitness.stackexchange.com', 'https://fitness.stackexchange.com/users/2471/']
|
The main differences between the two is the philosophies behind it, and how they are designed to work. First and foremost, it is important to realize that Paleo does allow carbs, just not grains and legumes (or anything that grows underground).
**Atkins**
* Is a ketogenic diet. It puts your body in a safe version of a fasting state so that your body turns fat into ketone bodies. Ketone bodies cannot be reassimilated to fat so unused ketone bodies are urinated out.
* Emphasis is on both protein and fats. Protein is there to help protect your muscle mass, and fat is used to provide some additional energy.
* Is designed as a temporary diet to help you lose weight, it is not intended for prolonged use.
**Paleo**
* Is based on what scientists believe the average paleolithic man ate. This includes berries and easily accessible fruit/vegetables as well as meat.
* Emphasis is on avoiding processed foods and foods that are likely to cause digestion problems. This includes grains (like wheat), tubers (like potatoes), and legumes (like beans).
* Is designed as a way of life diet, or in other words a sustainable diet you can use for the long term.
There are some commonalities between the two approaches, such as the emphasis on meat as a protein source. However, Paleo tends towards whole foods and grass/natural diet fed meat and Atkins makes no distinction. While Atkins does not allow carbs which would take someone out of ketosis, Paleo does allow carbs.
Anyone who exercises regularly will need the following for a healthy diet:
* About 1g protein / lb lean body mass. This is both for the better thermic effect of food (i.e. it burns more calories digesting it), and for restoring muscles that have been torn down by exercise.
* Carbs on workout day. This is a minimum, as it helps restore your glycogen levels to help you recover more quickly.
* A combination of saturated and mono-unsaturated fats. Fat is used for energy, but it also carries with it essential fat-born vitamins. NOTE: I did not include poly-unsaturated fats which are man-made and cause health issues over the long term.
How you proportion those depends on your daily caloric needs, but it is safe to split the remaining calories after you have your protein evenly between the carbs and fat. This is very possible on the Paleo diet, but due to the way Atkins is designed it is not possible on that diet. You will likely need to alter how you exercise on Atkins to ensure you do not burn muscle.
|
There are many differences between the two diets but I think one of most defining is the kind of animal foods you are encouraged to eat.
The Paleo Diet emphasizes lean game meat. You're not going to be eating a marbled steak or bacon on the Paleo Diet. You're going to be eating things like salmon, halibut, venison, bison, organic free range beef, pork, etc. These foods differ from traditional western animal foods because they are much lower in fat and have a higher amount of Omega-3 fats.
The real goal of the Paleo Diet is adjust your diet to closer match those of our non-agrarian ancestors - the idea being that biologically our bodies have not had time to adjust to rapid change in our diet since the Agricultural Revolution.
|
5,058 |
I have been running for almost 2 years now, after pretty much never running before in my life. I have had the usual injuries (shin splints, sprained ankle, etc.), but nothing serious. I've always thought I was doing everything right, until I saw this video about the day after the marathon:
<http://www.youtube.com/watch?v=m-hCuYjvw2I>
The thing is, my thighs have never - not once - hurt after a run! My calves have hurt, as well as my feet, hips, etc. So what am I doing wrong? Or am I doing anything wrong at all?
Some sites suggest this could be because I have weak thighs, and the rest of my legs are picking up the slack. But I can comfortably leg press about 3 times my body weight, so I don't think that's the problem.
Is this something to be concerned about? Or is it just marathon specific: I mean, I've never run more than a 10K.
|
2012/01/07
|
['https://fitness.stackexchange.com/questions/5058', 'https://fitness.stackexchange.com', 'https://fitness.stackexchange.com/users/2471/']
|
Berin Loritsch is mistaken in that Atkins would be meant only for weight loss. It is meant for prolonged use as well as any reasonable diet.
In Atkins you drop the carbohydrate intake to max of 20 grams per day for two weeks. After that you start gradually adding carbohydrates to your diet until you reach the point where you stop losing weight. Then you dial the carb intake back until you have reached desired weight. After that you can raise the carb intake a bit to a point where you don't lose or gain weight. The most probable mechanism for losing weight with Atkins is lessened hunger due to eating less carbs and more importantly more protein. This leads to less energy intake, leading to weight loss when the energy intake drops below energy expenditure. [More detailed description about different phases of Atkins](http://www.atkinsdietfreeplan.com/).
Paleo diet is basically based on some anthropology-based ideas on what some people ate during the paleolithic era. The basic idea is that this would be the diet we evolved to eat, so based on that it should be good. The problem is that people living in paleolithic era ate extremely varied diets based on where they lived. The diet itself is basically various meats and vegetables. Depending on whose paleo ideas you follow dairy and grains are allowed/disallowed. Generally on paleo diet you eat less carbs than is common these days. There are lot of sites about paleo around. Most prominent gurus are propably Dr. Cordain, Mark Sisson and Robb Wolf among others.
Neither is really much evidence based (unsurprisingly little about any diet is). My advice would be that if you feel fine on one of these, then go ahead. You should take any health claims made on behalf of either approach with grain of salt. Though restricting bad carbs is good, there is lot of hype based on little evidence about either one.
|
There are many differences between the two diets but I think one of most defining is the kind of animal foods you are encouraged to eat.
The Paleo Diet emphasizes lean game meat. You're not going to be eating a marbled steak or bacon on the Paleo Diet. You're going to be eating things like salmon, halibut, venison, bison, organic free range beef, pork, etc. These foods differ from traditional western animal foods because they are much lower in fat and have a higher amount of Omega-3 fats.
The real goal of the Paleo Diet is adjust your diet to closer match those of our non-agrarian ancestors - the idea being that biologically our bodies have not had time to adjust to rapid change in our diet since the Agricultural Revolution.
|
61,929,649 |
code.gs
```
var runSelect = true
function onSelectionChange(e) {
var sheet = SpreadsheetApp.getActiveSheet()
var range = e.range;
var column = range.getColumn();
var lastRow = sheet.getLastRow();
var ui = SpreadsheetApp.getUi();
if (runSelect == true) {
sheet.getRange(5, column, lastRow-4).activate();
sheet.getRange(1, column).copyTo(sheet.getActiveRange());
ui.alert("Finnish")
```
I have try to change my selection, but alert never show and not do copy
|
2020/05/21
|
['https://Stackoverflow.com/questions/61929649', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13578315/']
|
This works pretty good and it can also be used for people that have wanted to trigger an event when clicking on a cell in past questions.
```
function onSelectionChange(e) {
var sh=e.range.getSheet();
e.source.toast('Sheet: ' + sh.getName() + ' Range: ' + e.range.getA1Notation());
}
```
|
According to <https://developers.google.com/apps-script/reference/base/ui.html> alert(prompt) does not require authorization. Probably the onSelectionChange trigger is not executed and you are using the new V8 runtime. Use the legacy runtime, not the V8 runtime. With V8 runtime in my case sometimes it is triggered, sometimes not. There are general problems with trigger executions in V8, see <https://issuetracker.google.com/issues/147016387>
|
61,929,649 |
code.gs
```
var runSelect = true
function onSelectionChange(e) {
var sheet = SpreadsheetApp.getActiveSheet()
var range = e.range;
var column = range.getColumn();
var lastRow = sheet.getLastRow();
var ui = SpreadsheetApp.getUi();
if (runSelect == true) {
sheet.getRange(5, column, lastRow-4).activate();
sheet.getRange(1, column).copyTo(sheet.getActiveRange());
ui.alert("Finnish")
```
I have try to change my selection, but alert never show and not do copy
|
2020/05/21
|
['https://Stackoverflow.com/questions/61929649', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13578315/']
|
This works pretty good and it can also be used for people that have wanted to trigger an event when clicking on a cell in past questions.
```
function onSelectionChange(e) {
var sh=e.range.getSheet();
e.source.toast('Sheet: ' + sh.getName() + ' Range: ' + e.range.getA1Notation());
}
```
|
Same issue happened to me. I run the code manually from the editor and it asked for authorization. I authorized it and viola! Now the onSelectionChange trigger works! I hope it may be helpful for someone passing by...
|
61,929,649 |
code.gs
```
var runSelect = true
function onSelectionChange(e) {
var sheet = SpreadsheetApp.getActiveSheet()
var range = e.range;
var column = range.getColumn();
var lastRow = sheet.getLastRow();
var ui = SpreadsheetApp.getUi();
if (runSelect == true) {
sheet.getRange(5, column, lastRow-4).activate();
sheet.getRange(1, column).copyTo(sheet.getActiveRange());
ui.alert("Finnish")
```
I have try to change my selection, but alert never show and not do copy
|
2020/05/21
|
['https://Stackoverflow.com/questions/61929649', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13578315/']
|
This works pretty good and it can also be used for people that have wanted to trigger an event when clicking on a cell in past questions.
```
function onSelectionChange(e) {
var sh=e.range.getSheet();
e.source.toast('Sheet: ' + sh.getName() + ' Range: ' + e.range.getA1Notation());
}
```
|
I just faced the same issue on a new spreadsheet with a new project having only a very simple `onSelectionChange`:
```
function onSelectionChange(e) {
console.log(JSON.stringify(e));
}
```
After reopening the spreadsheet (refreshing the web browser tab), the `onSelectionChange` worked fine.
|
61,929,649 |
code.gs
```
var runSelect = true
function onSelectionChange(e) {
var sheet = SpreadsheetApp.getActiveSheet()
var range = e.range;
var column = range.getColumn();
var lastRow = sheet.getLastRow();
var ui = SpreadsheetApp.getUi();
if (runSelect == true) {
sheet.getRange(5, column, lastRow-4).activate();
sheet.getRange(1, column).copyTo(sheet.getActiveRange());
ui.alert("Finnish")
```
I have try to change my selection, but alert never show and not do copy
|
2020/05/21
|
['https://Stackoverflow.com/questions/61929649', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13578315/']
|
I just faced the same issue on a new spreadsheet with a new project having only a very simple `onSelectionChange`:
```
function onSelectionChange(e) {
console.log(JSON.stringify(e));
}
```
After reopening the spreadsheet (refreshing the web browser tab), the `onSelectionChange` worked fine.
|
According to <https://developers.google.com/apps-script/reference/base/ui.html> alert(prompt) does not require authorization. Probably the onSelectionChange trigger is not executed and you are using the new V8 runtime. Use the legacy runtime, not the V8 runtime. With V8 runtime in my case sometimes it is triggered, sometimes not. There are general problems with trigger executions in V8, see <https://issuetracker.google.com/issues/147016387>
|
61,929,649 |
code.gs
```
var runSelect = true
function onSelectionChange(e) {
var sheet = SpreadsheetApp.getActiveSheet()
var range = e.range;
var column = range.getColumn();
var lastRow = sheet.getLastRow();
var ui = SpreadsheetApp.getUi();
if (runSelect == true) {
sheet.getRange(5, column, lastRow-4).activate();
sheet.getRange(1, column).copyTo(sheet.getActiveRange());
ui.alert("Finnish")
```
I have try to change my selection, but alert never show and not do copy
|
2020/05/21
|
['https://Stackoverflow.com/questions/61929649', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/13578315/']
|
I just faced the same issue on a new spreadsheet with a new project having only a very simple `onSelectionChange`:
```
function onSelectionChange(e) {
console.log(JSON.stringify(e));
}
```
After reopening the spreadsheet (refreshing the web browser tab), the `onSelectionChange` worked fine.
|
Same issue happened to me. I run the code manually from the editor and it asked for authorization. I authorized it and viola! Now the onSelectionChange trigger works! I hope it may be helpful for someone passing by...
|
5,779,479 |
When you are installing VS 2008 and VS 2010, will VS 2008 install its own framwork 3.5 or will it use VS 2010's framwork 4? That would be also with VS 2010.
My request is that VS 2008 use framework 3.5 and VS 2010 use framework 4 only.
|
2011/04/25
|
['https://Stackoverflow.com/questions/5779479', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/484390/']
|
When installing Visual Studio 2008, it will install version 3.5 of the .NET Framework. It will not use version 4.0, as installed with VS 2010.
However, both VS 2008 and VS 2010 have multiple-targeting support, meaning that you can choose which version of the framework to target per-project. So, you can create a project in VS 2010 that targets version 3.5 of the framework, rather than 4.0, if you so choose. Obviously you do not have to take advantage of multiple targeting support, if you do not wish to do so. You can retain VS 2008 to develop .NET 3.5 projects and VS 2010 to develop .NET 4.0 projects.
In fact, the default target versions of the framework will be exactly as you expect. VS 2010 will target .NET 4.0, and VS 2008 will target .NET 3.5. You can choose to target earlier versions, but not later versions. VS 2008 cannot be used to develop projects targeting .NET 4.0.
|
You can select the target framework when creating the project both in visual studio 2008 and 2010 >
<http://weblogs.asp.net/scottgu/archive/2007/06/20/vs-2008-multi-targeting-support.aspx>
|
5,779,479 |
When you are installing VS 2008 and VS 2010, will VS 2008 install its own framwork 3.5 or will it use VS 2010's framwork 4? That would be also with VS 2010.
My request is that VS 2008 use framework 3.5 and VS 2010 use framework 4 only.
|
2011/04/25
|
['https://Stackoverflow.com/questions/5779479', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/484390/']
|
When installing Visual Studio 2008, it will install version 3.5 of the .NET Framework. It will not use version 4.0, as installed with VS 2010.
However, both VS 2008 and VS 2010 have multiple-targeting support, meaning that you can choose which version of the framework to target per-project. So, you can create a project in VS 2010 that targets version 3.5 of the framework, rather than 4.0, if you so choose. Obviously you do not have to take advantage of multiple targeting support, if you do not wish to do so. You can retain VS 2008 to develop .NET 3.5 projects and VS 2010 to develop .NET 4.0 projects.
In fact, the default target versions of the framework will be exactly as you expect. VS 2010 will target .NET 4.0, and VS 2008 will target .NET 3.5. You can choose to target earlier versions, but not later versions. VS 2008 cannot be used to develop projects targeting .NET 4.0.
|
VS 2008 cannot use framework 4.0. See [Can I develop for .NET Framework 4 in Visual Studio 2008?](https://stackoverflow.com/questions/1836410/can-i-develop-for-net-framework-4-in-visual-studio-2008) for details.
So to answer your question, VS 2008 will use 3.5 and you can choose between 3.5 or 4.0 in VS 2010.
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
By Cauchy-Schwartz:
$a=x-144,b=722-x$
$\sqrt{a}+\sqrt{b}\le \sqrt{(a+b)(1+1)}=\sqrt{1156}$
(You can read <https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality>)
Alternbatively
${(\sqrt{a}+\sqrt{b})}^2=a+b+2\sqrt{ab}$
recall by AM-Gm
$2\sqrt{ab}\le a+b$
thus
${(\sqrt{a}+\sqrt{b})}^2\le 2(a+b)$
So finally,
$\sqrt{a} + \sqrt{b} \le \sqrt{2(a+b)}$
Equality holds for $a=b$.
|
We have that $P^2=578+2\sqrt{(x-144)(722-x)}$
To maximize $P^2$ is to maximize $(x-144)(722-x)$, which is a downward parabola. By symmetry, it is maximized right between the two roots, i.e. at $x=\frac{(722+144)}{2}=433$
This also maximizes $P$ since it is always positive, so the maximum is $P$ evaluated at $433$, which yields $34$
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
By Cauchy-Schwartz:
$a=x-144,b=722-x$
$\sqrt{a}+\sqrt{b}\le \sqrt{(a+b)(1+1)}=\sqrt{1156}$
(You can read <https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality>)
Alternbatively
${(\sqrt{a}+\sqrt{b})}^2=a+b+2\sqrt{ab}$
recall by AM-Gm
$2\sqrt{ab}\le a+b$
thus
${(\sqrt{a}+\sqrt{b})}^2\le 2(a+b)$
So finally,
$\sqrt{a} + \sqrt{b} \le \sqrt{2(a+b)}$
Equality holds for $a=b$.
|
Use
$$2(p^2+q^2)-(p+q)^2=\cdots\ge0$$
$$\implies p+q\le\sqrt{2(p^2+q^2)}$$
Here $p^2=x-144,q^2=722-x$
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
By Cauchy-Schwartz:
$a=x-144,b=722-x$
$\sqrt{a}+\sqrt{b}\le \sqrt{(a+b)(1+1)}=\sqrt{1156}$
(You can read <https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality>)
Alternbatively
${(\sqrt{a}+\sqrt{b})}^2=a+b+2\sqrt{ab}$
recall by AM-Gm
$2\sqrt{ab}\le a+b$
thus
${(\sqrt{a}+\sqrt{b})}^2\le 2(a+b)$
So finally,
$\sqrt{a} + \sqrt{b} \le \sqrt{2(a+b)}$
Equality holds for $a=b$.
|
By C-S $$\sqrt{x-144}+\sqrt{722-x}\leq\sqrt{(1+1)(x-144+722-x)}=34.$$
The equality occurs for $(1,1)||(x-144,722-x),$ which says that we got a maximal value.
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
By Cauchy-Schwartz:
$a=x-144,b=722-x$
$\sqrt{a}+\sqrt{b}\le \sqrt{(a+b)(1+1)}=\sqrt{1156}$
(You can read <https://en.wikipedia.org/wiki/Cauchy%E2%80%93Schwarz_inequality>)
Alternbatively
${(\sqrt{a}+\sqrt{b})}^2=a+b+2\sqrt{ab}$
recall by AM-Gm
$2\sqrt{ab}\le a+b$
thus
${(\sqrt{a}+\sqrt{b})}^2\le 2(a+b)$
So finally,
$\sqrt{a} + \sqrt{b} \le \sqrt{2(a+b)}$
Equality holds for $a=b$.
|
I agree with Evariste's answer, but would like to offer an alternative approach. My approach **begins** with Evariste's conclusion that it is desired to maximize
$(x - 144)(722 - x) = -x^2 + x(866) - (144 \times 722).$
This is equivalent to trying to maximize
$-x^2 + x(866)$, where (presumably) $x$ is required to be in the interval [144, 722].
Suppose you pose the equation $-x^2 + x(866) = k.$
Then the question is what is the largest possible (real) value for $k$
that will generate at least one **real** root for $x.$
The above equation is equivalent to the equation $x^2 - x(866) + k = 0.$
This equation will have at least one real root if and only if
$[(866)^2 - 4k] \;\geq\; 0.$
This means that the largest permissible value of $k$ is
$\frac{1}{4} \times (866)^2.$
It is immediate that choosing this value for $k$ will cause
$[(866)^2 - 4k]$ to equal 0.
This means that with this choice of $k$, the root(s) of
$x^2 - x(866) + k = 0$ will be
$x = (866/2)$.
By the above analysis, the OP's original expression should therefore be maximized by
$x = 433.$
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
We have that $P^2=578+2\sqrt{(x-144)(722-x)}$
To maximize $P^2$ is to maximize $(x-144)(722-x)$, which is a downward parabola. By symmetry, it is maximized right between the two roots, i.e. at $x=\frac{(722+144)}{2}=433$
This also maximizes $P$ since it is always positive, so the maximum is $P$ evaluated at $433$, which yields $34$
|
Use
$$2(p^2+q^2)-(p+q)^2=\cdots\ge0$$
$$\implies p+q\le\sqrt{2(p^2+q^2)}$$
Here $p^2=x-144,q^2=722-x$
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
We have that $P^2=578+2\sqrt{(x-144)(722-x)}$
To maximize $P^2$ is to maximize $(x-144)(722-x)$, which is a downward parabola. By symmetry, it is maximized right between the two roots, i.e. at $x=\frac{(722+144)}{2}=433$
This also maximizes $P$ since it is always positive, so the maximum is $P$ evaluated at $433$, which yields $34$
|
By C-S $$\sqrt{x-144}+\sqrt{722-x}\leq\sqrt{(1+1)(x-144+722-x)}=34.$$
The equality occurs for $(1,1)||(x-144,722-x),$ which says that we got a maximal value.
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
We have that $P^2=578+2\sqrt{(x-144)(722-x)}$
To maximize $P^2$ is to maximize $(x-144)(722-x)$, which is a downward parabola. By symmetry, it is maximized right between the two roots, i.e. at $x=\frac{(722+144)}{2}=433$
This also maximizes $P$ since it is always positive, so the maximum is $P$ evaluated at $433$, which yields $34$
|
I agree with Evariste's answer, but would like to offer an alternative approach. My approach **begins** with Evariste's conclusion that it is desired to maximize
$(x - 144)(722 - x) = -x^2 + x(866) - (144 \times 722).$
This is equivalent to trying to maximize
$-x^2 + x(866)$, where (presumably) $x$ is required to be in the interval [144, 722].
Suppose you pose the equation $-x^2 + x(866) = k.$
Then the question is what is the largest possible (real) value for $k$
that will generate at least one **real** root for $x.$
The above equation is equivalent to the equation $x^2 - x(866) + k = 0.$
This equation will have at least one real root if and only if
$[(866)^2 - 4k] \;\geq\; 0.$
This means that the largest permissible value of $k$ is
$\frac{1}{4} \times (866)^2.$
It is immediate that choosing this value for $k$ will cause
$[(866)^2 - 4k]$ to equal 0.
This means that with this choice of $k$, the root(s) of
$x^2 - x(866) + k = 0$ will be
$x = (866/2)$.
By the above analysis, the OP's original expression should therefore be maximized by
$x = 433.$
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
Use
$$2(p^2+q^2)-(p+q)^2=\cdots\ge0$$
$$\implies p+q\le\sqrt{2(p^2+q^2)}$$
Here $p^2=x-144,q^2=722-x$
|
By C-S $$\sqrt{x-144}+\sqrt{722-x}\leq\sqrt{(1+1)(x-144+722-x)}=34.$$
The equality occurs for $(1,1)||(x-144,722-x),$ which says that we got a maximal value.
|
3,814,894 |
>
> Find the maximum value of $\sqrt{x - 144} + \sqrt{722 - x} .$
>
>
>
**What I Tried** :- Let me tell you first . What I Tried is absolutely silly , but you may check for it .
I thought AM-GM would do the trick and got :-
$\sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(x - 144)(722 - x)}}$
$\rightarrow \sqrt{x - 144} + \sqrt{722 - x} \geq 2 \sqrt{\sqrt{(-x^2 + 866x + 103968)}}$
From here I realised that there's no useful information I can find for $x$ .
**Back to Another Attempt** :- let $P = \sqrt{x - 144} + \sqrt{722 - x}$ . Then :-
$P^2 = 578 + 2\sqrt{(x - 144)(722 - x)}$
As $P \geq 0$ , we have that $P^2 \geq 578 \rightarrow P \geq 17\sqrt2 .$
This Attempt seemed reasonable and I thought I already found the solution, but then I realised that this is the minimum value of $P$ , and now I am hopeless .
Wolfram Alpha gives the answer to be $34$ , which can also be checked by Trial and Error of integer values , but that does not seem to be a proof of this problem .
Can anyone help me with this?
|
2020/09/05
|
['https://math.stackexchange.com/questions/3814894', 'https://math.stackexchange.com', 'https://math.stackexchange.com/users/772237/']
|
I agree with Evariste's answer, but would like to offer an alternative approach. My approach **begins** with Evariste's conclusion that it is desired to maximize
$(x - 144)(722 - x) = -x^2 + x(866) - (144 \times 722).$
This is equivalent to trying to maximize
$-x^2 + x(866)$, where (presumably) $x$ is required to be in the interval [144, 722].
Suppose you pose the equation $-x^2 + x(866) = k.$
Then the question is what is the largest possible (real) value for $k$
that will generate at least one **real** root for $x.$
The above equation is equivalent to the equation $x^2 - x(866) + k = 0.$
This equation will have at least one real root if and only if
$[(866)^2 - 4k] \;\geq\; 0.$
This means that the largest permissible value of $k$ is
$\frac{1}{4} \times (866)^2.$
It is immediate that choosing this value for $k$ will cause
$[(866)^2 - 4k]$ to equal 0.
This means that with this choice of $k$, the root(s) of
$x^2 - x(866) + k = 0$ will be
$x = (866/2)$.
By the above analysis, the OP's original expression should therefore be maximized by
$x = 433.$
|
By C-S $$\sqrt{x-144}+\sqrt{722-x}\leq\sqrt{(1+1)(x-144+722-x)}=34.$$
The equality occurs for $(1,1)||(x-144,722-x),$ which says that we got a maximal value.
|
23,230 |
I apologize for the title of this question. I did not know how to summarize my question into the title.
Anyway ......
We have here a old program that we call "Who is where" (its a translation from my language).
This is a program we use to show what employees are doing. It does not monitor them what they are doing at the moment. It just shows that they are at work, or in a meeting, or on vacation.
Managing this program is difficult. We have to manually input the employee info. Like full name, phone and email. Same thing when an employee quits. Have to manually remove them. Then we have to rely on the employee to make changes when they go on vacation or what ever.
So my question is this.....
Cant I have this on Outlook 2007 ?
I mean have like a public folder, or something, that all the users can see. And it automatically signs them in when they start up Outlook 2007. Sets them to Out of Office when they go on vacation or meetings. And maybe link it to Active Directory so that when I make a new users, and input all the information like phone and email, it will automatically show in that folder.
Someone told me I could do this with Tasks in Outlook 2007. But I have no idea on how to do that.
So any help would be very much appreciated.
|
2009/06/10
|
['https://serverfault.com/questions/23230', 'https://serverfault.com', 'https://serverfault.com/users/2792/']
|
I take it from the fact you mention public folders, that you are using Exchange?
If so you can use the free/busy features of Exchange to do this. It does have some problems, in that it will only show that a user is free or busy, not what they are busy doing. You can read more about it [here](http://www.msexchange.org/tutorials/FreeBusy-Folders-Exchange-Server-2003-Depth.html).
|
Without writing custom code, I don't think you're going to get the kind of "presence" information you're looking for with a stock Outlook 2007 installation. Microsoft's answer to "presence" is the "Office Communications Server" product, and though I can't tell you a lot about the feature set (because I haven't gotten interested enough in the product to play with it), I can only assume that Microsoft would be focusing their efforts toward doing the kind of things you're describing toward that platform.
An IM client with some integration into Outlook to do the kind of things you're talking about would be pretty neat. Outlook exposes a reasonably complete object model. It wouldn't be outside the realm of feasibility to have a coder take an open source IM client and tweak it up to use information provided by Outlook to augment the presence information the IM client provides natively.
|
23,230 |
I apologize for the title of this question. I did not know how to summarize my question into the title.
Anyway ......
We have here a old program that we call "Who is where" (its a translation from my language).
This is a program we use to show what employees are doing. It does not monitor them what they are doing at the moment. It just shows that they are at work, or in a meeting, or on vacation.
Managing this program is difficult. We have to manually input the employee info. Like full name, phone and email. Same thing when an employee quits. Have to manually remove them. Then we have to rely on the employee to make changes when they go on vacation or what ever.
So my question is this.....
Cant I have this on Outlook 2007 ?
I mean have like a public folder, or something, that all the users can see. And it automatically signs them in when they start up Outlook 2007. Sets them to Out of Office when they go on vacation or meetings. And maybe link it to Active Directory so that when I make a new users, and input all the information like phone and email, it will automatically show in that folder.
Someone told me I could do this with Tasks in Outlook 2007. But I have no idea on how to do that.
So any help would be very much appreciated.
|
2009/06/10
|
['https://serverfault.com/questions/23230', 'https://serverfault.com', 'https://serverfault.com/users/2792/']
|
I take it from the fact you mention public folders, that you are using Exchange?
If so you can use the free/busy features of Exchange to do this. It does have some problems, in that it will only show that a user is free or busy, not what they are busy doing. You can read more about it [here](http://www.msexchange.org/tutorials/FreeBusy-Folders-Exchange-Server-2003-Depth.html).
|
Don't know what your budget is but you could look at the Microsoft Communications server, can't remember what they call it these days.
Anyway basicly everyone gets the IM client and that ties into exchange and you then use the status to show what people are doing, it ties into their Outlook calendar so if they are in a meeting it will show in a meeting and so on, away when idle for 5 minutes, stuff like that. Much like MSN, but much more regulated and internal only.
|
69,274,024 |
Documentation page <https://docs.snowflake.com/en/sql-reference/sql/create-table.html>
What could [ ... ] near the end of the following diagrams stand for?
```
CREATE [ OR REPLACE ] TABLE <table_name> [ ( <col_name> [ <col_type> ] , <col_name> [ <col_type> ] , ... ) ]
[ CLUSTER BY ( <expr> [ , <expr> , ... ] ) ]
[ COPY GRANTS ]
AS SELECT <query>
[ ... ]
CREATE [ OR REPLACE ] TABLE <table_name>
[ COPY GRANTS ]
USING TEMPLATE <query>
[ ... ]
CREATE [ OR REPLACE ] TABLE <table_name> LIKE <source_table>
[ CLUSTER BY ( <expr> [ , <expr> , ... ] ) ]
[ COPY GRANTS ]
[ ... ]
CREATE [ OR REPLACE ] TABLE <name> CLONE <source_table>
[ { AT | BEFORE } { TIMESTAMP => <timestamp> | OFFSET => <time_difference> | STATEMENT => <id> } ]
[ COPY GRANTS ]
[ ... ]
```
The [ ... ] is not documented in <https://docs.snowflake.com/en/sql-reference/conventions.html> .
|
2021/09/21
|
['https://Stackoverflow.com/questions/69274024', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/854533/']
|
That's an ellipsis. It is standard English for "and so on", here meaning "more clauses / statements could go here". It's like *etcetera*.
|
IIRC, [ COPY GRANTS ] is called out specifically in each of the syntax "variations" because these keywords must be ordered as presented; whereas, the ordering of other keywords or properties for the CREATE TABLE command does not matter.
|
49,756,059 |
I am trying to reduce a group in Scala.
Below is my code:
```
val record = file.map(rec => (rec.state,rec.gender,rec.aadharGenerated.toInt)).groupByKey(_._1)
.reduceGroups((a,b)=>{
var total = a._3 + b._3
var mTotal = if(a._2.trim().equalsIgnoreCase("m")) {(a._3.toInt + b._3.toInt)}
(a._1,total.toString(),mTotal)
}).collect
```
In second last line I am getting compile time error "type mismatch; found : AnyVal required: Int"
The third parameter is supposed to be int. And the value I am adding are int already.
I am new to Scala, any help is appreciated.
Thanks in advance
|
2018/04/10
|
['https://Stackoverflow.com/questions/49756059', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9323888/']
|
You're using `if` as an expression without an `else` for your `mTotal` variable. The return type of an `if` is the nearest common super type of both the *success* block and the *else* block.
If you don't provide an `else` block, Scala will **assume**:
```
else ()
```
`()` is the value of `Unit`. So, for `mTotal` to be an `Int`, you need to provide a fallback value with an `else` block.
|
I don't know your data, but your assertion:
>
> The third parameter is supposed to be int.
>
>
>
doesn't hold. What if `a._2.trim().equalsIgnoreCase ("m")` evaluates to false?
```
scala> var mTotal = if ("a".equalsIgnoreCase("m")) {7}
mTotal: AnyVal = ()
```
|
1,415,700 |
I frequently had this problem and didn't find a solution yet: Whenever I write a new Eclipse RCP based application and include plugins from the Eclipse platform, I 'inherit' UI contributions from some of those plugins.
Most of this contributions (menu entries, keyboard shortcuts, property pages) are useful but sometimes I'd rather disabled some of these contributions, just because I really do not need them and they might confuse the users.
Does anyone know of the official or a practical way to disable/prohibit selected contributions in Eclipse RCP applications?
|
2009/09/12
|
['https://Stackoverflow.com/questions/1415700', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/105224/']
|
Take a look at the Eclipse "Activities" API. It allows you to hide contributions based on ID.
A few links:
* <http://wiki.eclipse.org/FAQ_How_do_I_add_activities_to_my_plug-in%3F>
* <http://blog.vogella.com/2009/07/13/eclipse-activities/>
* <http://random-eclipse-tips.blogspot.com/2009/02/eclipse-rcp-removing-unwanted_02.html>
* <http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench_scalability.htm>
|
The only method which comes close to do that would be:
[`IMenuService::removeContributionFactory()`](http://kickjava.com/src/org/eclipse/ui/menus/IMenuService.java.htm)
Paul Webster has been calling for a [`IMenuService::addOverride()`](http://wiki.eclipse.org/Menu_Contributions/RCP_removes_the_Project_menu) to change the visibility of the menu, preventing any contribution, but that idea has not been integrated yet.
You can see an example of removing a contribution in this [`org.eclipse.ui.tests.menus.MenuBuilder`](http://mail.eclipse.org/viewcvs/index.cgi/org.eclipse.ui.tests/Eclipse%20UI%20Tests/org/eclipse/ui/tests/menus/MenuBuilder.java?view=co) class;
```
public static void removeMenuContribution() {
if (!PlatformUI.isWorkbenchRunning()) {
return;
}
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench()
.getService(IMenuService.class);
if (menuService==null) {
return;
}
menuService.removeContributionFactory(viewMenuAddition);
viewMenuAddition = null;
menuService.removeContributionFactory(viewToolbarAddition);
viewMenuAddition = null;
}
```
|
1,415,700 |
I frequently had this problem and didn't find a solution yet: Whenever I write a new Eclipse RCP based application and include plugins from the Eclipse platform, I 'inherit' UI contributions from some of those plugins.
Most of this contributions (menu entries, keyboard shortcuts, property pages) are useful but sometimes I'd rather disabled some of these contributions, just because I really do not need them and they might confuse the users.
Does anyone know of the official or a practical way to disable/prohibit selected contributions in Eclipse RCP applications?
|
2009/09/12
|
['https://Stackoverflow.com/questions/1415700', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/105224/']
|
The only method which comes close to do that would be:
[`IMenuService::removeContributionFactory()`](http://kickjava.com/src/org/eclipse/ui/menus/IMenuService.java.htm)
Paul Webster has been calling for a [`IMenuService::addOverride()`](http://wiki.eclipse.org/Menu_Contributions/RCP_removes_the_Project_menu) to change the visibility of the menu, preventing any contribution, but that idea has not been integrated yet.
You can see an example of removing a contribution in this [`org.eclipse.ui.tests.menus.MenuBuilder`](http://mail.eclipse.org/viewcvs/index.cgi/org.eclipse.ui.tests/Eclipse%20UI%20Tests/org/eclipse/ui/tests/menus/MenuBuilder.java?view=co) class;
```
public static void removeMenuContribution() {
if (!PlatformUI.isWorkbenchRunning()) {
return;
}
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench()
.getService(IMenuService.class);
if (menuService==null) {
return;
}
menuService.removeContributionFactory(viewMenuAddition);
viewMenuAddition = null;
menuService.removeContributionFactory(viewToolbarAddition);
viewMenuAddition = null;
}
```
|
Equinox transformations can also be used to supply XLST transformations that remove unwanted UI contributions.
|
1,415,700 |
I frequently had this problem and didn't find a solution yet: Whenever I write a new Eclipse RCP based application and include plugins from the Eclipse platform, I 'inherit' UI contributions from some of those plugins.
Most of this contributions (menu entries, keyboard shortcuts, property pages) are useful but sometimes I'd rather disabled some of these contributions, just because I really do not need them and they might confuse the users.
Does anyone know of the official or a practical way to disable/prohibit selected contributions in Eclipse RCP applications?
|
2009/09/12
|
['https://Stackoverflow.com/questions/1415700', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/105224/']
|
Take a look at the Eclipse "Activities" API. It allows you to hide contributions based on ID.
A few links:
* <http://wiki.eclipse.org/FAQ_How_do_I_add_activities_to_my_plug-in%3F>
* <http://blog.vogella.com/2009/07/13/eclipse-activities/>
* <http://random-eclipse-tips.blogspot.com/2009/02/eclipse-rcp-removing-unwanted_02.html>
* <http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench_scalability.htm>
|
Equinox transformations can also be used to supply XLST transformations that remove unwanted UI contributions.
|
31,656 |
I am not a developer- but I want to upload my favicon to my EE site. Which file folder (Content, Base Images, General Content, Gallery Images) should I upload it to?
Is this the proper way to upload the favicon?
|
2015/05/27
|
['https://expressionengine.stackexchange.com/questions/31656', 'https://expressionengine.stackexchange.com', 'https://expressionengine.stackexchange.com/users/6346/']
|
I would upload it to the root of the site and then link to it in the head of your document like this
```
<!--favicon-->
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
```
|
You need to upload the file to the root of your site, as CreateSean said. To do this, you generally need to access your web server via FTP, File Transfer Protocol. I would recommend FileZilla for ease of use.
<https://filezilla-project.org/>
To log in to your web server via FTP, you'll need to know a username, password, and address (address is usually www.yourwebsite.com). You will probably need to contact your web hosting partner to get this information.
Once you have access, your web root is usually located here on a Linux server:
```
/var/www/html
```
I'm not sure where it would be on a Windows server. But this is generally where you'd upload your favicon.ico, and then you link to it as CreateSean said, with a link tag in your html header.
|
26,755 |
In 1 Timothy there is a passage that talks about widows receiving a pension from the church:
1 Timothy 5:9-16
>
> A widow is to be put on the list only if she is not less than sixty
> years old, having been the wife of one man, 10 having a reputation for
> good works; and if she has brought up children, if she has shown
> hospitality to strangers, if she has washed the saints’ feet, if she
> has assisted those in distress, and if she has devoted herself to
> every good work. 11 But refuse to put younger widows on the list, for
> when they feel sensual desires in disregard of Christ, they want to
> get married, 12 thus incurring condemnation, because they have set
> aside their previous pledge. 13 At the same time they also learn to be
> idle, as they go around from house to house; and not merely idle, but
> also gossips and busybodies, talking about things not proper to
> mention. 14 Therefore, I want younger widows to get married, bear
> children, keep house, and give the enemy no occasion for reproach;
> 15 for some have already turned aside to follow Satan. 16 If any woman
> who is a believer has dependent widows, she must assist them and the
> church must not be burdened, so that it may assist those who are
> widows indeed
>
>
>
Is there a historical record of this practice in the church and do any modern churches still have a similar practice?
|
2014/03/24
|
['https://christianity.stackexchange.com/questions/26755', 'https://christianity.stackexchange.com', 'https://christianity.stackexchange.com/users/6506/']
|
Let's start by remembering that we are living in very different times from those of the New Testament. 1 Timothy is a letter written by one pastor to another, and not all of it is intended as commandments to the entire church in all places down the millenia. Some of it is Paul giving Timothy good advice for the present circumstances (Sometimes we can deduce universal principles from that, but that's a different matter). So asking whether any church is ministering to widows in the way specified should be a trivial and unimportant matter, and doesn't in any way make a statement about the church. You should also consider that nothing in 1 Timothy says that widows under the age of sixty shouldn't receive help in other ways if they need it. Let's also remember that providing financial assistance to the elderly is now the responsibility of the state, at least in the Western world.
Having said that, many churches provide financial assistance specifically aimed at Widows. Here are a couple of examples:
>
> [The Widows Program of the Rafiki Foundation](https://www.rafikifoundation.org/OurWork/widows.aspx) gives African widows and impoverished women of the church a means of employment and artistic expression
>
>
> The orphan and the widow are often forgotten, marginalized and in need. God longs to meet their needs through us, His Church. [Africa Revolution](http://africarevolution.org/causes/orphans-widows-urban-poor/) is being used by God, not only to help meet these needs, but also to equip and empower local churches and community members to better serve this population with best practice solutions.
>
>
> [Widow Connection](http://www.widowconnection.com/Help/Help/htsawm.html) - Helping Widows in time of need.
>
>
> The mission of the [Women Of Grace Widows’ Fund](http://www.womenofgracewidowsfund.org/) is to enact and make real an ongoing structure to alleviate the extreme poverty faced by widows in Malawi by providing funding to meet basic food, shelter, and safety needs, while creating opportunities and resources that enable and empower widows to establish their own self-sufficiency and independence, regardless of religious affiliation.
>
>
>
That's just from the first two pages of Google.
|
It appears that the answer to the question you actually asked is, "No, there are no churches today that maintain a Widow's List in accordance with I Timothy 5." Yes, there are all sorts of other programs but nothing like that described in I Timothy 5.
|
49,951,419 |
So I have the following apple-app-site-association on my site, located at `stage.domain.com/apple-app-site-association`:
```
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.application.id.goes.here",
"paths": ["*"]
}
]
}
}
```
I've set my Associated Domains as `applinks:stage.domain.com`
But when I try to navigate to `stage.domain.com` in Safari, it doesn't register and I stay in the browser. Is there anything else I need to do? I know that I need to eventually set routing up in the app for various pages, but that isn't a necessary requirement is it? It should just pull up the app without anything else? Or am I missing something?
Also, my restoration handler:
```
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
print("DEBUG GETS TO NSURL?")
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL
else
{return false}
print("DEBUG GETS TO URL")
return true
}
```
It gets to neither debug condition.
|
2018/04/21
|
['https://Stackoverflow.com/questions/49951419', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/756566/']
|
Did you already go through the debugging steps here: <https://developer.apple.com/library/content/qa/qa1916/_index.html>
I found the validation tool linked to in step one of the diagnostic section of the above reference to be quite helpful. It will verify that you set the app association file up correctly, and often give some guidance if you didn’t.
Update:
-------
Based on your comment below regarding the link not working in Safari, I'd suggest verifying that your universal link setting for that domain didn't get disabled on your test device.
Specifically:
* If a user opens a universal link and is taken to the app, there is a shortcut in the top right of the status bar which, if tapped, takes the user to the web version of the link *and also disables the universal link opening the app*. To re-enable the universal link for your app, you can paste the link into an app like Notes or Messages, long press on it, and choose "Open in... [Your App]".
* The other possibility is that your web page in Safari is trying to open the universal link via Javascript or wrapped in a redirect. Neither of these will work.
There are more details in this blog post, along with some other universal link issues: <https://medium.com/mobile-growth/the-things-i-hate-and-you-should-know-about-apple-universal-links-5beb15f88a29>
Additional Update:
------------------
I have a suspicion regarding your scenario: Apple does not trigger a universal link when the user directly types a URL to a universal link domain into the Safari address bar. The assumption being that if the user explicitly entered a URL into the Safari address bar, the correct response is to open the URL in Safari. In this scenario, Safari inserts the banner that allows the user to intentionally open the link in the app to the top of the page.
You can test this yourself:
1. Install the Twitter app
2. Paste the URL to a tweet in Safari's address bar. Note that it opens the tweet page in the browser. Tap the banner with the "Open" link at the top of the page to open it in the Twitter app.
3. Open Safari again. Now Google the word "tweet" or otherwise find a page that has a *link* to a tweet (rather than typing or pasting the URL in the Safari address bar)
4. Note that tapping the link opens the Twitter app instead of the page in Safari.
|
Usually universal links end with `://`, so try using this URL for your example:
`applinks://stage.domain.com`.
|
49,951,419 |
So I have the following apple-app-site-association on my site, located at `stage.domain.com/apple-app-site-association`:
```
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.application.id.goes.here",
"paths": ["*"]
}
]
}
}
```
I've set my Associated Domains as `applinks:stage.domain.com`
But when I try to navigate to `stage.domain.com` in Safari, it doesn't register and I stay in the browser. Is there anything else I need to do? I know that I need to eventually set routing up in the app for various pages, but that isn't a necessary requirement is it? It should just pull up the app without anything else? Or am I missing something?
Also, my restoration handler:
```
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
print("DEBUG GETS TO NSURL?")
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL
else
{return false}
print("DEBUG GETS TO URL")
return true
}
```
It gets to neither debug condition.
|
2018/04/21
|
['https://Stackoverflow.com/questions/49951419', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/756566/']
|
Did you already go through the debugging steps here: <https://developer.apple.com/library/content/qa/qa1916/_index.html>
I found the validation tool linked to in step one of the diagnostic section of the above reference to be quite helpful. It will verify that you set the app association file up correctly, and often give some guidance if you didn’t.
Update:
-------
Based on your comment below regarding the link not working in Safari, I'd suggest verifying that your universal link setting for that domain didn't get disabled on your test device.
Specifically:
* If a user opens a universal link and is taken to the app, there is a shortcut in the top right of the status bar which, if tapped, takes the user to the web version of the link *and also disables the universal link opening the app*. To re-enable the universal link for your app, you can paste the link into an app like Notes or Messages, long press on it, and choose "Open in... [Your App]".
* The other possibility is that your web page in Safari is trying to open the universal link via Javascript or wrapped in a redirect. Neither of these will work.
There are more details in this blog post, along with some other universal link issues: <https://medium.com/mobile-growth/the-things-i-hate-and-you-should-know-about-apple-universal-links-5beb15f88a29>
Additional Update:
------------------
I have a suspicion regarding your scenario: Apple does not trigger a universal link when the user directly types a URL to a universal link domain into the Safari address bar. The assumption being that if the user explicitly entered a URL into the Safari address bar, the correct response is to open the URL in Safari. In this scenario, Safari inserts the banner that allows the user to intentionally open the link in the app to the top of the page.
You can test this yourself:
1. Install the Twitter app
2. Paste the URL to a tweet in Safari's address bar. Note that it opens the tweet page in the browser. Tap the banner with the "Open" link at the top of the page to open it in the Twitter app.
3. Open Safari again. Now Google the word "tweet" or otherwise find a page that has a *link* to a tweet (rather than typing or pasting the URL in the Safari address bar)
4. Note that tapping the link opens the Twitter app instead of the page in Safari.
|
Have you tried below code in your app : ***info.plist***
```
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>stage</string>
</array>
</dict>
</array>
```
Then open safari type "**stage://**" and press **Go**. It'll redirect you to your app.
|
49,951,419 |
So I have the following apple-app-site-association on my site, located at `stage.domain.com/apple-app-site-association`:
```
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.application.id.goes.here",
"paths": ["*"]
}
]
}
}
```
I've set my Associated Domains as `applinks:stage.domain.com`
But when I try to navigate to `stage.domain.com` in Safari, it doesn't register and I stay in the browser. Is there anything else I need to do? I know that I need to eventually set routing up in the app for various pages, but that isn't a necessary requirement is it? It should just pull up the app without anything else? Or am I missing something?
Also, my restoration handler:
```
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
print("DEBUG GETS TO NSURL?")
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL
else
{return false}
print("DEBUG GETS TO URL")
return true
}
```
It gets to neither debug condition.
|
2018/04/21
|
['https://Stackoverflow.com/questions/49951419', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/756566/']
|
Did you already go through the debugging steps here: <https://developer.apple.com/library/content/qa/qa1916/_index.html>
I found the validation tool linked to in step one of the diagnostic section of the above reference to be quite helpful. It will verify that you set the app association file up correctly, and often give some guidance if you didn’t.
Update:
-------
Based on your comment below regarding the link not working in Safari, I'd suggest verifying that your universal link setting for that domain didn't get disabled on your test device.
Specifically:
* If a user opens a universal link and is taken to the app, there is a shortcut in the top right of the status bar which, if tapped, takes the user to the web version of the link *and also disables the universal link opening the app*. To re-enable the universal link for your app, you can paste the link into an app like Notes or Messages, long press on it, and choose "Open in... [Your App]".
* The other possibility is that your web page in Safari is trying to open the universal link via Javascript or wrapped in a redirect. Neither of these will work.
There are more details in this blog post, along with some other universal link issues: <https://medium.com/mobile-growth/the-things-i-hate-and-you-should-know-about-apple-universal-links-5beb15f88a29>
Additional Update:
------------------
I have a suspicion regarding your scenario: Apple does not trigger a universal link when the user directly types a URL to a universal link domain into the Safari address bar. The assumption being that if the user explicitly entered a URL into the Safari address bar, the correct response is to open the URL in Safari. In this scenario, Safari inserts the banner that allows the user to intentionally open the link in the app to the top of the page.
You can test this yourself:
1. Install the Twitter app
2. Paste the URL to a tweet in Safari's address bar. Note that it opens the tweet page in the browser. Tap the banner with the "Open" link at the top of the page to open it in the Twitter app.
3. Open Safari again. Now Google the word "tweet" or otherwise find a page that has a *link* to a tweet (rather than typing or pasting the URL in the Safari address bar)
4. Note that tapping the link opens the Twitter app instead of the page in Safari.
|
If, when you access your site, it shows the universal links banner on top of the page, like this: <https://i.stack.imgur.com/ZSQGK.jpg>, you are doing it right.
If you click on Open, it should open the app. Then, if you try to click on a link to your website AFTER you opened your app through the banner, iOS should save your preferences and open the app directly, instead of going to Safari with the banner on top.
The way Universal Linking works, it does not allow the app to be opened by links without any consent of the user. Thus, the user must give permission at least one time before the app opens automatically.
|
49,951,419 |
So I have the following apple-app-site-association on my site, located at `stage.domain.com/apple-app-site-association`:
```
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.application.id.goes.here",
"paths": ["*"]
}
]
}
}
```
I've set my Associated Domains as `applinks:stage.domain.com`
But when I try to navigate to `stage.domain.com` in Safari, it doesn't register and I stay in the browser. Is there anything else I need to do? I know that I need to eventually set routing up in the app for various pages, but that isn't a necessary requirement is it? It should just pull up the app without anything else? Or am I missing something?
Also, my restoration handler:
```
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
print("DEBUG GETS TO NSURL?")
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL
else
{return false}
print("DEBUG GETS TO URL")
return true
}
```
It gets to neither debug condition.
|
2018/04/21
|
['https://Stackoverflow.com/questions/49951419', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/756566/']
|
Have you tried below code in your app : ***info.plist***
```
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>stage</string>
</array>
</dict>
</array>
```
Then open safari type "**stage://**" and press **Go**. It'll redirect you to your app.
|
Usually universal links end with `://`, so try using this URL for your example:
`applinks://stage.domain.com`.
|
49,951,419 |
So I have the following apple-app-site-association on my site, located at `stage.domain.com/apple-app-site-association`:
```
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.application.id.goes.here",
"paths": ["*"]
}
]
}
}
```
I've set my Associated Domains as `applinks:stage.domain.com`
But when I try to navigate to `stage.domain.com` in Safari, it doesn't register and I stay in the browser. Is there anything else I need to do? I know that I need to eventually set routing up in the app for various pages, but that isn't a necessary requirement is it? It should just pull up the app without anything else? Or am I missing something?
Also, my restoration handler:
```
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
print("DEBUG GETS TO NSURL?")
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL
else
{return false}
print("DEBUG GETS TO URL")
return true
}
```
It gets to neither debug condition.
|
2018/04/21
|
['https://Stackoverflow.com/questions/49951419', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/756566/']
|
If, when you access your site, it shows the universal links banner on top of the page, like this: <https://i.stack.imgur.com/ZSQGK.jpg>, you are doing it right.
If you click on Open, it should open the app. Then, if you try to click on a link to your website AFTER you opened your app through the banner, iOS should save your preferences and open the app directly, instead of going to Safari with the banner on top.
The way Universal Linking works, it does not allow the app to be opened by links without any consent of the user. Thus, the user must give permission at least one time before the app opens automatically.
|
Usually universal links end with `://`, so try using this URL for your example:
`applinks://stage.domain.com`.
|
49,951,419 |
So I have the following apple-app-site-association on my site, located at `stage.domain.com/apple-app-site-association`:
```
{
"applinks": {
"apps": [],
"details": [
{
"appID": "TEAMID.application.id.goes.here",
"paths": ["*"]
}
]
}
}
```
I've set my Associated Domains as `applinks:stage.domain.com`
But when I try to navigate to `stage.domain.com` in Safari, it doesn't register and I stay in the browser. Is there anything else I need to do? I know that I need to eventually set routing up in the app for various pages, but that isn't a necessary requirement is it? It should just pull up the app without anything else? Or am I missing something?
Also, my restoration handler:
```
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
print("DEBUG GETS TO NSURL?")
guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let url = userActivity.webpageURL
else
{return false}
print("DEBUG GETS TO URL")
return true
}
```
It gets to neither debug condition.
|
2018/04/21
|
['https://Stackoverflow.com/questions/49951419', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/756566/']
|
If, when you access your site, it shows the universal links banner on top of the page, like this: <https://i.stack.imgur.com/ZSQGK.jpg>, you are doing it right.
If you click on Open, it should open the app. Then, if you try to click on a link to your website AFTER you opened your app through the banner, iOS should save your preferences and open the app directly, instead of going to Safari with the banner on top.
The way Universal Linking works, it does not allow the app to be opened by links without any consent of the user. Thus, the user must give permission at least one time before the app opens automatically.
|
Have you tried below code in your app : ***info.plist***
```
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>stage</string>
</array>
</dict>
</array>
```
Then open safari type "**stage://**" and press **Go**. It'll redirect you to your app.
|
3,715 |
If, based on encountering new information, or simply based on a re-thinking of the problem, or based on an actual change in circumstances (e.g. new regulations passed), I wish to completely replace an answer (written by me) with entirely different content, is it better to delete the old one and add the new one, or to paste the new one in place of the old one via an edit? Or should I feel free to do whichever I prefer?
One issue is that if I've linked to the answer in other answers, then if I deleted and replaced it, I'd have to go change those links (assuming it was still relevant to have the link), and those other answers would get bumped up to the top of the home page-- this would be avoided if I cut and pasted the new content in.
Another issue is that "comments" may be attached to the old answer that might be of interest to anyone thinking about the question, and it might be better not to lose them by deleting the answer-- I could always add a comment noting that substantial changes had happened so the comments may not be exactly relevant to the current answer but are still of general interest--
---
Update 5-5-21 --
I understand that comments are not to be considered lasting features on ASE. Preserving comments under the old answer is no longer a concern.
I'm not sure sufficient weight has been given to this issue:
"One issue is that if I've linked to the answer in other answers, then if I deleted and replaced it, I'd have to go change those links (assuming it was still relevant to have the link), and those other answers would get bumped up to the top of the home page-- this would be avoided if I cut and pasted the new content in. "
I've also put links elsewhere on the internet to this answer that I'd really like to keep working, even after the revision.
I don't really care about trying to retain the points from the old answer, it's only +2, that's not the issue.
---
Update 5-6-21--
I've decided to just delete the old answer and not worry about the links. I no longer am in need of guidance on this particular issue, but feel free to chime in anyway if you have something to say that would be helpful to others in the same situation.
I appreciate the heads-up from ymb1 that non-logged-in visitors (as well as logged-in users w/ less rep points than needed to see deleted answers) will still be directed to the question, if they follow a link that points to an answer that has been deleted.
|
2018/11/08
|
['https://aviation.meta.stackexchange.com/questions/3715', 'https://aviation.meta.stackexchange.com', 'https://aviation.meta.stackexchange.com/users/34686/']
|
If the answer is substantially different, it'd be better to post a new answer so that the content can be judged freshly regardless of existing score (yes, SE allows users to post multiple answers on the same question, as long as each has its own merit). Might be a good idea too to update the old answer and state that it's outdated (no need to delete the answer, but it's up to you).
The alternative is to *append* (not replace) the new info on current answer, so that it won't invalidate the current score.
---
Regarding comments, if possible, integrate them to the answer, then flag as "no longer needed". Comments are considered as second-class citizen and might subject to deletion at any time. The most ideal post in SE is a post free from comments.
|
What I've personally done on a couple of occasions is delete + new answer.
---
**RE:** *One issue is that if I've linked to the answer in other answers...*
The old links will still take the visitor to the question, but not the new answer. A small price to pay for less noise.
|
48,859,005 |
This compiles with no errors:
```
Function<T, List<R>> f = T::getRs;
Function<List<R>, Stream<R>> g = List::stream;
Function<T, Stream<R>> h = f.andThen(g);
List<T> ts = ...;
ts.stream().flatMap(h);
```
But this produces errors:
```
List<T> ts = ...;
ts.stream().flatMap(T::getRs.andThen(List::stream));
```
The errors are:
```
error: method reference not expected here
.flatMap(T::getRs.andThen((List::stream)))
^
error: invalid method reference
.flatMap(T::getRs.andThen((List::stream)))
^
non-static method stream() cannot be referenced from a static context
where E is a type-variable:
E extends Object declared in interface Collection
```
I would have thought that the two approaches would be equivalent. Am I missing some syntax? Some grouping somewhere perhaps? I would prefer to take the latter "one-line" approach if possible.
|
2018/02/19
|
['https://Stackoverflow.com/questions/48859005', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/31379/']
|
I found workaround for this...
from <https://issuetracker.google.com/issues/63814741>
adding
```
android.enableExperimentalFeatureDatabinding = true
android.databinding.enableV2=true
```
in `gradle.properties` files kinda solve the issue... but I doubt that this is a solution... but for now... this is how the problem is solved
|
I also encountered this issue recently. Adding kapt plugin to app level build.gradle file solved my issue. The problem is that you already have that plugin in your gradle file. Maybe issue is resolved after some time but I want to leave this answer because this question comes up first in Google search.
`apply plugin: 'kotlin-kapt'`
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
A working example.
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YourTableName'
EXECUTE ('SELECT * INTO #TEMP FROM ' + @TableName +'; SELECT * FROM #TEMP;')
```
Second solution with accessible temp table
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YOUR_TABLE_NAME'
EXECUTE ('CREATE VIEW vTemp AS
SELECT *
FROM ' + @TableName)
SELECT * INTO #TEMP FROM vTemp
--DROP THE VIEW HERE
DROP VIEW vTemp
/*START USING TEMP TABLE
************************/
--EX:
SELECT * FROM #TEMP
--DROP YOUR TEMP TABLE HERE
DROP TABLE #TEMP
```
|
Take a look at [`OPENROWSET`](http://msdn.microsoft.com/en-us/library/ms190312.aspx), and do something like:
```
SELECT * INTO #TEMPTABLE FROM OPENROWSET('SQLNCLI'
, 'Server=(local)\SQL2008;Trusted_Connection=yes;',
'SELECT * FROM ' + @tableName)
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
```
declare @sql varchar(100);
declare @tablename as varchar(100);
select @tablename = 'your_table_name';
create table #tmp
(col1 int, col2 int, col3 int);
set @sql = 'select aa, bb, cc from ' + @tablename;
insert into #tmp(col1, col2, col3) exec( @sql );
select * from #tmp;
```
|
Take a look at [`OPENROWSET`](http://msdn.microsoft.com/en-us/library/ms190312.aspx), and do something like:
```
SELECT * INTO #TEMPTABLE FROM OPENROWSET('SQLNCLI'
, 'Server=(local)\SQL2008;Trusted_Connection=yes;',
'SELECT * FROM ' + @tableName)
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
How I did it with a pivot in dynamic sql (#AccPurch was created prior to this)
```
DECLARE @sql AS nvarchar(MAX)
declare @Month Nvarchar(1000)
--DROP TABLE #temp
select distinct YYYYMM into #temp from #AccPurch AS ap
SELECT @Month = COALESCE(@Month, '') + '[' + CAST(YYYYMM AS VarChar(8)) + '],' FROM #temp
SELECT @Month= LEFT(@Month,len(@Month)-1)
SET @sql = N'SELECT UserID, '+ @Month + N' into ##final_Donovan_12345 FROM (
Select ap.AccPurch ,
ap.YYYYMM ,
ap.UserID ,
ap.AccountNumber
FROM #AccPurch AS ap
) p
Pivot (SUM(AccPurch) FOR YYYYMM IN ('+@Month+ N')) as pvt'
EXEC sp_executesql @sql
Select * INTO #final From ##final_Donovan_12345
DROP TABLE ##final_Donovan_12345
Select * From #final AS f
```
|
Take a look at [`OPENROWSET`](http://msdn.microsoft.com/en-us/library/ms190312.aspx), and do something like:
```
SELECT * INTO #TEMPTABLE FROM OPENROWSET('SQLNCLI'
, 'Server=(local)\SQL2008;Trusted_Connection=yes;',
'SELECT * FROM ' + @tableName)
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
```
DECLARE @count_ser_temp int;
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'TableTemporal'
EXECUTE ('CREATE VIEW vTemp AS
SELECT *
FROM ' + @TableTemporal)
SELECT TOP 1 * INTO #servicios_temp FROM vTemp
DROP VIEW vTemp
-- Contar la cantidad de registros de la tabla temporal
SELECT @count_ser_temp = COUNT(*) FROM #servicios_temp;
-- Recorro los registros de la tabla temporal
WHILE @count_ser_temp > 0
BEGIN
END
END
```
|
Take a look at [`OPENROWSET`](http://msdn.microsoft.com/en-us/library/ms190312.aspx), and do something like:
```
SELECT * INTO #TEMPTABLE FROM OPENROWSET('SQLNCLI'
, 'Server=(local)\SQL2008;Trusted_Connection=yes;',
'SELECT * FROM ' + @tableName)
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
A working example.
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YourTableName'
EXECUTE ('SELECT * INTO #TEMP FROM ' + @TableName +'; SELECT * FROM #TEMP;')
```
Second solution with accessible temp table
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YOUR_TABLE_NAME'
EXECUTE ('CREATE VIEW vTemp AS
SELECT *
FROM ' + @TableName)
SELECT * INTO #TEMP FROM vTemp
--DROP THE VIEW HERE
DROP VIEW vTemp
/*START USING TEMP TABLE
************************/
--EX:
SELECT * FROM #TEMP
--DROP YOUR TEMP TABLE HERE
DROP TABLE #TEMP
```
|
```
declare @sql varchar(100);
declare @tablename as varchar(100);
select @tablename = 'your_table_name';
create table #tmp
(col1 int, col2 int, col3 int);
set @sql = 'select aa, bb, cc from ' + @tablename;
insert into #tmp(col1, col2, col3) exec( @sql );
select * from #tmp;
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
A working example.
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YourTableName'
EXECUTE ('SELECT * INTO #TEMP FROM ' + @TableName +'; SELECT * FROM #TEMP;')
```
Second solution with accessible temp table
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YOUR_TABLE_NAME'
EXECUTE ('CREATE VIEW vTemp AS
SELECT *
FROM ' + @TableName)
SELECT * INTO #TEMP FROM vTemp
--DROP THE VIEW HERE
DROP VIEW vTemp
/*START USING TEMP TABLE
************************/
--EX:
SELECT * FROM #TEMP
--DROP YOUR TEMP TABLE HERE
DROP TABLE #TEMP
```
|
How I did it with a pivot in dynamic sql (#AccPurch was created prior to this)
```
DECLARE @sql AS nvarchar(MAX)
declare @Month Nvarchar(1000)
--DROP TABLE #temp
select distinct YYYYMM into #temp from #AccPurch AS ap
SELECT @Month = COALESCE(@Month, '') + '[' + CAST(YYYYMM AS VarChar(8)) + '],' FROM #temp
SELECT @Month= LEFT(@Month,len(@Month)-1)
SET @sql = N'SELECT UserID, '+ @Month + N' into ##final_Donovan_12345 FROM (
Select ap.AccPurch ,
ap.YYYYMM ,
ap.UserID ,
ap.AccountNumber
FROM #AccPurch AS ap
) p
Pivot (SUM(AccPurch) FOR YYYYMM IN ('+@Month+ N')) as pvt'
EXEC sp_executesql @sql
Select * INTO #final From ##final_Donovan_12345
DROP TABLE ##final_Donovan_12345
Select * From #final AS f
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
A working example.
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YourTableName'
EXECUTE ('SELECT * INTO #TEMP FROM ' + @TableName +'; SELECT * FROM #TEMP;')
```
Second solution with accessible temp table
```
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'YOUR_TABLE_NAME'
EXECUTE ('CREATE VIEW vTemp AS
SELECT *
FROM ' + @TableName)
SELECT * INTO #TEMP FROM vTemp
--DROP THE VIEW HERE
DROP VIEW vTemp
/*START USING TEMP TABLE
************************/
--EX:
SELECT * FROM #TEMP
--DROP YOUR TEMP TABLE HERE
DROP TABLE #TEMP
```
|
```
DECLARE @count_ser_temp int;
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'TableTemporal'
EXECUTE ('CREATE VIEW vTemp AS
SELECT *
FROM ' + @TableTemporal)
SELECT TOP 1 * INTO #servicios_temp FROM vTemp
DROP VIEW vTemp
-- Contar la cantidad de registros de la tabla temporal
SELECT @count_ser_temp = COUNT(*) FROM #servicios_temp;
-- Recorro los registros de la tabla temporal
WHILE @count_ser_temp > 0
BEGIN
END
END
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
```
declare @sql varchar(100);
declare @tablename as varchar(100);
select @tablename = 'your_table_name';
create table #tmp
(col1 int, col2 int, col3 int);
set @sql = 'select aa, bb, cc from ' + @tablename;
insert into #tmp(col1, col2, col3) exec( @sql );
select * from #tmp;
```
|
How I did it with a pivot in dynamic sql (#AccPurch was created prior to this)
```
DECLARE @sql AS nvarchar(MAX)
declare @Month Nvarchar(1000)
--DROP TABLE #temp
select distinct YYYYMM into #temp from #AccPurch AS ap
SELECT @Month = COALESCE(@Month, '') + '[' + CAST(YYYYMM AS VarChar(8)) + '],' FROM #temp
SELECT @Month= LEFT(@Month,len(@Month)-1)
SET @sql = N'SELECT UserID, '+ @Month + N' into ##final_Donovan_12345 FROM (
Select ap.AccPurch ,
ap.YYYYMM ,
ap.UserID ,
ap.AccountNumber
FROM #AccPurch AS ap
) p
Pivot (SUM(AccPurch) FOR YYYYMM IN ('+@Month+ N')) as pvt'
EXEC sp_executesql @sql
Select * INTO #final From ##final_Donovan_12345
DROP TABLE ##final_Donovan_12345
Select * From #final AS f
```
|
9,534,990 |
This seems relatively simple, but apparently it's not.
I need to create a temp table based on an existing table via the select into syntax:
```
SELECT * INTO #TEMPTABLE FROM EXISTING_TABLE
```
The problem is, the existing table name is accepted via a parameter...
I can get the table's data via:
```
execute ('SELECT * FROM ' + @tableName)
```
but how do I marry the two so that I can put the results from the execute directly into the temp table.
The columns for each table that this is going to be used for are not the same so building the temp table before getting the data is not practical.
I'm open to any suggestions except using a global temp table.
**Update:**
This is completely ridiculous, BUT my reservations with the global temp table is that this is a multi user platform lends itself to issues if the table will linger for long periods of time...
Sooo.. just to get past this part I've started by using the execute to generate a global temp table.
```
execute('select * into ##globalDynamicFormTable from ' + @tsFormTable)
```
I then use the global temp table to load the local temp table:
```
select * into #tempTable from ##globalDynamicFormTable
```
I then drop the global table.
```
drop table ##globalDynamicFormTable
```
this is dirty and I don't like it, but for the time being, until i get a better solution, its going to have to work.
**In the End:**
I guess there is no way to get around it.
The best answer appears to be either;
Create a **view** in the execute command and use that to load the local temp table in the stored procedure.
Create a **global temp table** in the execute command and use that to load the local temp table.
With that said i'll probably just stick with the global temp table because creating and dropping views is audited in my organization, and I'm sure they are going to question that if it starts happening all the time.
Thanks!
|
2012/03/02
|
['https://Stackoverflow.com/questions/9534990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/112550/']
|
```
declare @sql varchar(100);
declare @tablename as varchar(100);
select @tablename = 'your_table_name';
create table #tmp
(col1 int, col2 int, col3 int);
set @sql = 'select aa, bb, cc from ' + @tablename;
insert into #tmp(col1, col2, col3) exec( @sql );
select * from #tmp;
```
|
```
DECLARE @count_ser_temp int;
DECLARE @TableName AS VARCHAR(100)
SELECT @TableName = 'TableTemporal'
EXECUTE ('CREATE VIEW vTemp AS
SELECT *
FROM ' + @TableTemporal)
SELECT TOP 1 * INTO #servicios_temp FROM vTemp
DROP VIEW vTemp
-- Contar la cantidad de registros de la tabla temporal
SELECT @count_ser_temp = COUNT(*) FROM #servicios_temp;
-- Recorro los registros de la tabla temporal
WHILE @count_ser_temp > 0
BEGIN
END
END
```
|
36,896,345 |
I am having some troubles with Xcode login with account created through iTunes connect. I have no experience with developer program whatsoever so please help me if you can.
We have company account and the app on app store. External company is developing it for us. But we wanted to create another app, so my boss, admin on iTunes connect has given me app manager role. After that I have successfully created new app, but I cant get my Xcode to use that apple id as a team one, only personal. Also when I try to login to developer.apple.com it treats me like a regular new user, not like I am in company and my account and apple id has ben created via iTunes connect and asks me to enrol to developer program and I believe pay 99$.
I can see that I do not yet understand the process fully so please if anyone knows, give me some guide on my trouble.
Thanks in advance
EDIT: PROBLEM SOLVED
For anyone with similar problem, invitation in iTunes connect is not enough, you have to get invited to developer team on developer.apple.com.
|
2016/04/27
|
['https://Stackoverflow.com/questions/36896345', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2683119/']
|
In `setTimeout` this is timeout object's this. Thats why it is not working
```
$('.switch').hover(function() {
$(this).find('.avg_words').hide();
$(this).find('.avg_num').show();
}, function() {
var hoverObj = this;
setTimeout(function() {
$(hoverObj ).find('.avg_num').hide();
$(hoverObj ).find('.avg_words').show();
}, 1000);
});
```
|
Try using [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout):
```
$('.switch').hover(function() {
$(this).find('.avg_words').hide();
$(this).find('.avg_num').show();
}, function() {
var _this = this;
setTimeout(function() {
$(_this).find('.avg_num').hide();
$(_this).find('.avg_words').show();
}, 1000); //delay in milliseconds, here 1s
});
```
[JSFiddle](https://jsfiddle.net/rjnpy7ge/)
|
36,896,345 |
I am having some troubles with Xcode login with account created through iTunes connect. I have no experience with developer program whatsoever so please help me if you can.
We have company account and the app on app store. External company is developing it for us. But we wanted to create another app, so my boss, admin on iTunes connect has given me app manager role. After that I have successfully created new app, but I cant get my Xcode to use that apple id as a team one, only personal. Also when I try to login to developer.apple.com it treats me like a regular new user, not like I am in company and my account and apple id has ben created via iTunes connect and asks me to enrol to developer program and I believe pay 99$.
I can see that I do not yet understand the process fully so please if anyone knows, give me some guide on my trouble.
Thanks in advance
EDIT: PROBLEM SOLVED
For anyone with similar problem, invitation in iTunes connect is not enough, you have to get invited to developer team on developer.apple.com.
|
2016/04/27
|
['https://Stackoverflow.com/questions/36896345', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2683119/']
|
You can use setTimeout to run a function delayed. Don't forget to store the interval so that you won't get any weird jittering with hovering.
```
var i;
$('.switch').hover(function() {
clearInterval(i);
$(this).find('.avg_words').hide();
$(this).find('.avg_num').show();
}, function() {
clearInterval(i);
i = setTimeout(function() {
$(this).find('.avg_num').hide();
$(this).find('.avg_words').show();
}.bind(this), 500);
});
```
|
Try using [setTimeout](https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout):
```
$('.switch').hover(function() {
$(this).find('.avg_words').hide();
$(this).find('.avg_num').show();
}, function() {
var _this = this;
setTimeout(function() {
$(_this).find('.avg_num').hide();
$(_this).find('.avg_words').show();
}, 1000); //delay in milliseconds, here 1s
});
```
[JSFiddle](https://jsfiddle.net/rjnpy7ge/)
|
35,294,871 |
I want to scroll the line (uiview - Hieght=1) between the button And i had put the button in container view of pageviewcontroller.Pageviewcontroller is starting from bottom of the buttons .I want the line to move when i scroll pageviewcontrollers subviews.
The Image as shown below...
[](https://i.stack.imgur.com/ZWUcE.png)
So this line white line I want to move when I scroll page 1 to 2 then 2 - 1 How can i do this Please help....
As I have to use pageviewcontroller
|
2016/02/09
|
['https://Stackoverflow.com/questions/35294871', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5750980/']
|
you can do this in with help of `UIScrollView` , in here no need of `UIpageViewController`
take the delegate methods of
```
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
- (void)scrollViewDidScroll:(UIScrollView *)sender;
```
**Step-1**
create the one scrollView like `self.tblScroll`
```
//It call end of scroll
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
if (scrollView != MovemylineinBlack && scrollView != MovemylineinRed)
{
int x=fmod(scrollView.contentOffset.x, self.tblScroll.frame.size.width);
if (x <= self.tblScroll.frame.size.width/2 )
{
[scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x-x, scrollView.contentOffset.y) animated:YES];
}
else
{
[scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x+self.tblScroll.frame.size.width-x, scrollView.contentOffset.y) animated:YES];
}
}
}
```
**Step-2**
// it s call your scroll is closusre
```
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate: (BOOL)decelerate
{
if (scrollView != MovemylineinBlack && scrollView != MovemylineinRed)
{
int x=fmod(scrollView.contentOffset.x, self.tblScroll.frame.size.width);
if (x <= self.tblScroll.frame.size.width/2 )
{
[scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x-x, scrollView.contentOffset.y) animated:YES];
}
else
{
[scrollView setContentOffset:CGPointMake(scrollView.contentOffset.x+self.tblScroll.frame.size.width-x, scrollView.contentOffset.y) animated:YES];
}
}
}
```
**Step-3**
// Imeplement the every drag of move capture method
```
- (void)scrollViewDidScroll:(UIScrollView *)sender
{
if (self.tblScroll.contentOffset.x<KAPPDeviceWidth/2) // KAPPDeviceWidth--> this is your view Width
{
self.viewSubBack.frame=CGRectMake(self.tblScroll.contentOffset.x, 106, 160, 5); // viewSubBack --> is your white line
}
else
{
self.viewSubBack.frame=CGRectMake((KAPPDeviceWidth/2)+1, 106, 160, 5);
}
}
```
|
This project will let you integrate this need
<https://github.com/hightower/HTHorizontalSelectionList>
|
100,326 |
I'm trying to typeset `$\frac{x^*}{2}$`, but I can't find a (simple) way to make the alignment look nice. So far, I've tried the following:
```
\documentclass{article}
\begin{document}
\begin{equation}
\frac{x^*}{2} \qquad \frac{x^*}{2\phantom{{}^*}}
\end{equation}
\end{document}
```
With the following output:

In the left one, it looks odd because the `x` is very off-center, and in the right example the fraction bar is extended way more to the right than what's really necessary.
Is there a nicer (and still simple enough) way to typeset this fraction?
|
2013/02/28
|
['https://tex.stackexchange.com/questions/100326', 'https://tex.stackexchange.com', 'https://tex.stackexchange.com/users/223/']
|
```
\begin{equation*}
\frac{x^*}{2} \quad \frac{x^*}{2\phantom{{}^*}} \quad
\frac{x\rlap{$^*$}}{\,2\,}
\end{equation*}
```
The correct one is the first one, as the ugly syntax of the other two demonstrates :-) However, I have to admit that the third one is the best looking one:

Update
======
As egreg noted in a comment, the problem with the third solution is that it is not clear if the \* applies only to x, or to the whole fraction. Thiking about this, I've found another solution which avoids this problem, has a cleaner syntax, and still (imho) looks better than the first one.
The following MWE shows first the standard way, second my first attempt, and third my new proposed solution. I put them in the context of a bigger expression, and aligned them vertically at the right bar, for easier comparison:
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\Big|\frac{x^*}{2} \Big|&=y \\
\Big|\frac{x\rlap{$^*$}}{\,2\,} \Big|&=y \\
\Big|\frac{x^*\!}{2} \Big|&=y
\end{align*}
\end{document}
```

|
How about using `\mathrlap` from the [`mathtools`](http://www.ctan.org/pkg/mathtools)-package?
```
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\frac{x^*}{2} \qquad \frac{x^*}{2\phantom{{}^*}} \qquad \frac{x^{\mathrlap{*}}}{2}
\end{equation}
\end{document}
```
This inserts the asterisk without adding additional space and thus keeping the fraction line as long as in the first example:

|
100,326 |
I'm trying to typeset `$\frac{x^*}{2}$`, but I can't find a (simple) way to make the alignment look nice. So far, I've tried the following:
```
\documentclass{article}
\begin{document}
\begin{equation}
\frac{x^*}{2} \qquad \frac{x^*}{2\phantom{{}^*}}
\end{equation}
\end{document}
```
With the following output:

In the left one, it looks odd because the `x` is very off-center, and in the right example the fraction bar is extended way more to the right than what's really necessary.
Is there a nicer (and still simple enough) way to typeset this fraction?
|
2013/02/28
|
['https://tex.stackexchange.com/questions/100326', 'https://tex.stackexchange.com', 'https://tex.stackexchange.com/users/223/']
|
```
\begin{equation*}
\frac{x^*}{2} \quad \frac{x^*}{2\phantom{{}^*}} \quad
\frac{x\rlap{$^*$}}{\,2\,}
\end{equation*}
```
The correct one is the first one, as the ugly syntax of the other two demonstrates :-) However, I have to admit that the third one is the best looking one:

Update
======
As egreg noted in a comment, the problem with the third solution is that it is not clear if the \* applies only to x, or to the whole fraction. Thiking about this, I've found another solution which avoids this problem, has a cleaner syntax, and still (imho) looks better than the first one.
The following MWE shows first the standard way, second my first attempt, and third my new proposed solution. I put them in the context of a bigger expression, and aligned them vertically at the right bar, for easier comparison:
```
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\Big|\frac{x^*}{2} \Big|&=y \\
\Big|\frac{x\rlap{$^*$}}{\,2\,} \Big|&=y \\
\Big|\frac{x^*\!}{2} \Big|&=y
\end{align*}
\end{document}
```

|
Aligning things that should not be aligned is a bad idea. Very similar example to yours is adding `\phantom{-}` in front of `0` and `1` in matricis comprising only `0`, `1` and `-1`. You align the numbers, but you lose the visual distinction between `1` and `-1`.
Here, it is a bit different but still valid: I, as a reader, would really get the impression that there's a missing symbol after `2`, just because the whole denominator is not centered, whereas I expect it to be centered.
Conclusion: Two options are correct: `\frac{x^*}{2}` and `x^*/2`.
|
100,326 |
I'm trying to typeset `$\frac{x^*}{2}$`, but I can't find a (simple) way to make the alignment look nice. So far, I've tried the following:
```
\documentclass{article}
\begin{document}
\begin{equation}
\frac{x^*}{2} \qquad \frac{x^*}{2\phantom{{}^*}}
\end{equation}
\end{document}
```
With the following output:

In the left one, it looks odd because the `x` is very off-center, and in the right example the fraction bar is extended way more to the right than what's really necessary.
Is there a nicer (and still simple enough) way to typeset this fraction?
|
2013/02/28
|
['https://tex.stackexchange.com/questions/100326', 'https://tex.stackexchange.com', 'https://tex.stackexchange.com/users/223/']
|
How about using `\mathrlap` from the [`mathtools`](http://www.ctan.org/pkg/mathtools)-package?
```
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\frac{x^*}{2} \qquad \frac{x^*}{2\phantom{{}^*}} \qquad \frac{x^{\mathrlap{*}}}{2}
\end{equation}
\end{document}
```
This inserts the asterisk without adding additional space and thus keeping the fraction line as long as in the first example:

|
Aligning things that should not be aligned is a bad idea. Very similar example to yours is adding `\phantom{-}` in front of `0` and `1` in matricis comprising only `0`, `1` and `-1`. You align the numbers, but you lose the visual distinction between `1` and `-1`.
Here, it is a bit different but still valid: I, as a reader, would really get the impression that there's a missing symbol after `2`, just because the whole denominator is not centered, whereas I expect it to be centered.
Conclusion: Two options are correct: `\frac{x^*}{2}` and `x^*/2`.
|
37,250,573 |
I try to deploy my Django project to apache. But I getting an error 500response. And in logs I getting information that Django is missing. I'm using `virtualenv`to run this project. It's the first time when I try to deploy Django project. And from my experience, I know that I probably missing some simple thing. I was looking for solutions on this site but they are for previous versions of Django and python. They don't work for me.
**This is my Apache test.conf**
```html
WSGIScriptAlias / /home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py
WSGIDaemonProcess localhost python-path=/home/mariusz/Dokumenty/Projekty/zalien:/home/mariusz/Dokumenty/Projekt/envy/lib/python3.5/site-packages
<Directory /home/mariusz/Dokumenty/Projekty/zalien/zalien>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
```
**This is my wsgi.py**
```html
import os
import sys
import site
from django.core.wsgi import get_wsgi_application
application = django.core.handlers.wsgi.WSGIHandler()
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/home/mariusz/Dokumenty/Projekty/envy/local/lib/python3.5/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/mariusz/Dokumenty/Projekty/zalien')
sys.path.append('/home/mariusz/Dokumenty/Projekty/zalien/zalien')
os.environ['DJANGO_SETTINGS_MODULE'] = 'zalien.settings'
# Activate your virtual env
activate_env=os.path.expanduser("/home/mariusz/Dokumenty/Projekty/envy/bin/activate_this.py")
exec(activate_env, dict(__file__=activate_env))
```
**Error Log**
```html
[Mon May 16 09:44:28.368084 2016] [wsgi:error] [pid 7418:tid 139640747427584] mod_wsgi (pid=7418): Call to 'site.addsitedir()' failed for '(null)', stopping.
[Mon May 16 09:44:28.368132 2016] [wsgi:error] [pid 7418:tid 139640747427584] mod_wsgi (pid=7418): Call to 'site.addsitedir()' failed for '/home/mariusz/Dokumenty/Projekty/zalien/'.
[Mon May 16 09:44:28.369458 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] mod_wsgi (pid=7418): Target WSGI script '/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py' cannot be loaded as Python module.
[Mon May 16 09:44:28.369493 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] mod_wsgi (pid=7418): Exception occurred processing WSGI script '/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py'.
[Mon May 16 09:44:28.369724 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] Traceback (most recent call last):
[Mon May 16 09:44:28.369752 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] File "/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py", line 23, in <module>
[Mon May 16 09:44:28.369758 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] from django.core.wsgi import get_wsgi_application
[Mon May 16 09:44:28.369781 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] ImportError: No module named 'django'
```
**Permissions**
```html
-rw-rw-r-- 1 mariusz www-data 295 May 9 14:50 app.json
-rw-rw-r-- 1 mariusz www-data 51200 May 13 09:53 db.sqlite3
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 games
-rwxrwxr-x 1 mariusz www-data 249 May 9 14:50 manage.py
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 portal
-rw-rw-r-- 1 mariusz www-data 39 May 9 14:50 Procfile
-rw-rw-r-- 1 mariusz www-data 45 May 9 14:50 Procfile.windows
-rw-rw-r-- 1 mariusz www-data 1368 May 9 14:50 README.md
-rw-rw-r-- 1 mariusz www-data 298 May 9 14:50 requirements.txt
-rw-rw-r-- 1 mariusz www-data 13 May 9 14:50 runtime.txt
drwxrwxr-x 5 mariusz www-data 4096 May 9 14:50 static
drwxrwxr-x 4 mariusz www-data 4096 May 9 14:50 templates
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 userprofile
drwxrwxr-x 3 mariusz www-data 4096 May 16 11:50 zalien
```
|
2016/05/16
|
['https://Stackoverflow.com/questions/37250573', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5004814/']
|
The problem is that you probably changed permissions to the directory `/usr/bin`.
To resolve that :
1) First be sure that **root** is owner of this directory `/usr/bin` :
```
chown root:root /usr/bin
```
2) and change permission for this directory :
```
chmod u+s /usr/bin/sudo
```
|
Issue:
sudo: effective uid is not 0, is sudo installed setuid root?
Noticed:
---s--x--x. 1 dev root 123832 Aug 13 2015 /usr/bin/sudo
user and group should be root and the sudo file should have setuid
Should be
---s--x--x. 1 root root 123832 Aug 13 2015 /usr/bin/sudo
and also double
|
37,250,573 |
I try to deploy my Django project to apache. But I getting an error 500response. And in logs I getting information that Django is missing. I'm using `virtualenv`to run this project. It's the first time when I try to deploy Django project. And from my experience, I know that I probably missing some simple thing. I was looking for solutions on this site but they are for previous versions of Django and python. They don't work for me.
**This is my Apache test.conf**
```html
WSGIScriptAlias / /home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py
WSGIDaemonProcess localhost python-path=/home/mariusz/Dokumenty/Projekty/zalien:/home/mariusz/Dokumenty/Projekt/envy/lib/python3.5/site-packages
<Directory /home/mariusz/Dokumenty/Projekty/zalien/zalien>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
```
**This is my wsgi.py**
```html
import os
import sys
import site
from django.core.wsgi import get_wsgi_application
application = django.core.handlers.wsgi.WSGIHandler()
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/home/mariusz/Dokumenty/Projekty/envy/local/lib/python3.5/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/mariusz/Dokumenty/Projekty/zalien')
sys.path.append('/home/mariusz/Dokumenty/Projekty/zalien/zalien')
os.environ['DJANGO_SETTINGS_MODULE'] = 'zalien.settings'
# Activate your virtual env
activate_env=os.path.expanduser("/home/mariusz/Dokumenty/Projekty/envy/bin/activate_this.py")
exec(activate_env, dict(__file__=activate_env))
```
**Error Log**
```html
[Mon May 16 09:44:28.368084 2016] [wsgi:error] [pid 7418:tid 139640747427584] mod_wsgi (pid=7418): Call to 'site.addsitedir()' failed for '(null)', stopping.
[Mon May 16 09:44:28.368132 2016] [wsgi:error] [pid 7418:tid 139640747427584] mod_wsgi (pid=7418): Call to 'site.addsitedir()' failed for '/home/mariusz/Dokumenty/Projekty/zalien/'.
[Mon May 16 09:44:28.369458 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] mod_wsgi (pid=7418): Target WSGI script '/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py' cannot be loaded as Python module.
[Mon May 16 09:44:28.369493 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] mod_wsgi (pid=7418): Exception occurred processing WSGI script '/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py'.
[Mon May 16 09:44:28.369724 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] Traceback (most recent call last):
[Mon May 16 09:44:28.369752 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] File "/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py", line 23, in <module>
[Mon May 16 09:44:28.369758 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] from django.core.wsgi import get_wsgi_application
[Mon May 16 09:44:28.369781 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] ImportError: No module named 'django'
```
**Permissions**
```html
-rw-rw-r-- 1 mariusz www-data 295 May 9 14:50 app.json
-rw-rw-r-- 1 mariusz www-data 51200 May 13 09:53 db.sqlite3
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 games
-rwxrwxr-x 1 mariusz www-data 249 May 9 14:50 manage.py
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 portal
-rw-rw-r-- 1 mariusz www-data 39 May 9 14:50 Procfile
-rw-rw-r-- 1 mariusz www-data 45 May 9 14:50 Procfile.windows
-rw-rw-r-- 1 mariusz www-data 1368 May 9 14:50 README.md
-rw-rw-r-- 1 mariusz www-data 298 May 9 14:50 requirements.txt
-rw-rw-r-- 1 mariusz www-data 13 May 9 14:50 runtime.txt
drwxrwxr-x 5 mariusz www-data 4096 May 9 14:50 static
drwxrwxr-x 4 mariusz www-data 4096 May 9 14:50 templates
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 userprofile
drwxrwxr-x 3 mariusz www-data 4096 May 16 11:50 zalien
```
|
2016/05/16
|
['https://Stackoverflow.com/questions/37250573', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5004814/']
|
If anyone is still experiencing problems with sudo, I was able t solve it by checking the shell access of the account in WHM. I received the same error because the account had Jailed Shell restrictions. I set it to normal shell and the error was gone.
|
Issue:
sudo: effective uid is not 0, is sudo installed setuid root?
Noticed:
---s--x--x. 1 dev root 123832 Aug 13 2015 /usr/bin/sudo
user and group should be root and the sudo file should have setuid
Should be
---s--x--x. 1 root root 123832 Aug 13 2015 /usr/bin/sudo
and also double
|
37,250,573 |
I try to deploy my Django project to apache. But I getting an error 500response. And in logs I getting information that Django is missing. I'm using `virtualenv`to run this project. It's the first time when I try to deploy Django project. And from my experience, I know that I probably missing some simple thing. I was looking for solutions on this site but they are for previous versions of Django and python. They don't work for me.
**This is my Apache test.conf**
```html
WSGIScriptAlias / /home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py
WSGIDaemonProcess localhost python-path=/home/mariusz/Dokumenty/Projekty/zalien:/home/mariusz/Dokumenty/Projekt/envy/lib/python3.5/site-packages
<Directory /home/mariusz/Dokumenty/Projekty/zalien/zalien>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
```
**This is my wsgi.py**
```html
import os
import sys
import site
from django.core.wsgi import get_wsgi_application
application = django.core.handlers.wsgi.WSGIHandler()
# Add the site-packages of the chosen virtualenv to work with
site.addsitedir('/home/mariusz/Dokumenty/Projekty/envy/local/lib/python3.5/site-packages')
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/mariusz/Dokumenty/Projekty/zalien')
sys.path.append('/home/mariusz/Dokumenty/Projekty/zalien/zalien')
os.environ['DJANGO_SETTINGS_MODULE'] = 'zalien.settings'
# Activate your virtual env
activate_env=os.path.expanduser("/home/mariusz/Dokumenty/Projekty/envy/bin/activate_this.py")
exec(activate_env, dict(__file__=activate_env))
```
**Error Log**
```html
[Mon May 16 09:44:28.368084 2016] [wsgi:error] [pid 7418:tid 139640747427584] mod_wsgi (pid=7418): Call to 'site.addsitedir()' failed for '(null)', stopping.
[Mon May 16 09:44:28.368132 2016] [wsgi:error] [pid 7418:tid 139640747427584] mod_wsgi (pid=7418): Call to 'site.addsitedir()' failed for '/home/mariusz/Dokumenty/Projekty/zalien/'.
[Mon May 16 09:44:28.369458 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] mod_wsgi (pid=7418): Target WSGI script '/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py' cannot be loaded as Python module.
[Mon May 16 09:44:28.369493 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] mod_wsgi (pid=7418): Exception occurred processing WSGI script '/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py'.
[Mon May 16 09:44:28.369724 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] Traceback (most recent call last):
[Mon May 16 09:44:28.369752 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] File "/home/mariusz/Dokumenty/Projekty/zalien/zalien/wsgi.py", line 23, in <module>
[Mon May 16 09:44:28.369758 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] from django.core.wsgi import get_wsgi_application
[Mon May 16 09:44:28.369781 2016] [wsgi:error] [pid 7418:tid 139640747427584] [client 127.0.0.1:37494] ImportError: No module named 'django'
```
**Permissions**
```html
-rw-rw-r-- 1 mariusz www-data 295 May 9 14:50 app.json
-rw-rw-r-- 1 mariusz www-data 51200 May 13 09:53 db.sqlite3
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 games
-rwxrwxr-x 1 mariusz www-data 249 May 9 14:50 manage.py
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 portal
-rw-rw-r-- 1 mariusz www-data 39 May 9 14:50 Procfile
-rw-rw-r-- 1 mariusz www-data 45 May 9 14:50 Procfile.windows
-rw-rw-r-- 1 mariusz www-data 1368 May 9 14:50 README.md
-rw-rw-r-- 1 mariusz www-data 298 May 9 14:50 requirements.txt
-rw-rw-r-- 1 mariusz www-data 13 May 9 14:50 runtime.txt
drwxrwxr-x 5 mariusz www-data 4096 May 9 14:50 static
drwxrwxr-x 4 mariusz www-data 4096 May 9 14:50 templates
drwxrwxr-x 4 mariusz www-data 4096 May 13 10:06 userprofile
drwxrwxr-x 3 mariusz www-data 4096 May 16 11:50 zalien
```
|
2016/05/16
|
['https://Stackoverflow.com/questions/37250573', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5004814/']
|
The problem is that you probably changed permissions to the directory `/usr/bin`.
To resolve that :
1) First be sure that **root** is owner of this directory `/usr/bin` :
```
chown root:root /usr/bin
```
2) and change permission for this directory :
```
chmod u+s /usr/bin/sudo
```
|
If anyone is still experiencing problems with sudo, I was able t solve it by checking the shell access of the account in WHM. I received the same error because the account had Jailed Shell restrictions. I set it to normal shell and the error was gone.
|
19,786,191 |
I need to do this with jQuery.
Let's say that I have simple div element in HTML like that:
```
<div class="grow"></div>
```
**CSS:**
```
body, html {
width: 100%;
height:100%;
min-height:100%
}
.grow {
height:20px;
width:100%;
}
```
I need to write script where DIV `grow` will be growing according to the screen resolution. Starting from 90px's.
Sth like this:
For **90px** screen wide DIV height will be - **20px**
For **130px** screen wide DIV height will be - **30px**
**so for any 4px's width height will grow 1px.**
I tried lots of solutions but without any luck. Any help will be appreciated.
|
2013/11/05
|
['https://Stackoverflow.com/questions/19786191', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1587500/']
|
Try this
```
$(window).resize(function() {
var bodyheight = $(document).height();
var divHeight = (bodyheight-10)/2;
$('.grow').css("height", divHeight+"px");;
});
```
|
Try this
```
var width = (+$(window).width());
var divHeight = (width-10)/2;
$(".grow").height(divHeight);
```
|
19,786,191 |
I need to do this with jQuery.
Let's say that I have simple div element in HTML like that:
```
<div class="grow"></div>
```
**CSS:**
```
body, html {
width: 100%;
height:100%;
min-height:100%
}
.grow {
height:20px;
width:100%;
}
```
I need to write script where DIV `grow` will be growing according to the screen resolution. Starting from 90px's.
Sth like this:
For **90px** screen wide DIV height will be - **20px**
For **130px** screen wide DIV height will be - **30px**
**so for any 4px's width height will grow 1px.**
I tried lots of solutions but without any luck. Any help will be appreciated.
|
2013/11/05
|
['https://Stackoverflow.com/questions/19786191', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1587500/']
|
here you go [http://jsfiddle.net/6KfHy/1/]
```
var baseWidth = 90;
var stepWidth = 4;
var baseHeight = 20;
var growHeightPerStep = 1;
function changeHeight() {
var windowW = $(window).width();
var diffWidth = windowW - baseWidth;
var diffHeight = parseInt(diffWidth / 4, 10);
$('.grow').css('height', baseHeight + diffHeight + 'px');
}
changeHeight();
$(window).resize(function() {
changeHeight();
});
```
|
Try this
```
var width = (+$(window).width());
var divHeight = (width-10)/2;
$(".grow").height(divHeight);
```
|
19,786,191 |
I need to do this with jQuery.
Let's say that I have simple div element in HTML like that:
```
<div class="grow"></div>
```
**CSS:**
```
body, html {
width: 100%;
height:100%;
min-height:100%
}
.grow {
height:20px;
width:100%;
}
```
I need to write script where DIV `grow` will be growing according to the screen resolution. Starting from 90px's.
Sth like this:
For **90px** screen wide DIV height will be - **20px**
For **130px** screen wide DIV height will be - **30px**
**so for any 4px's width height will grow 1px.**
I tried lots of solutions but without any luck. Any help will be appreciated.
|
2013/11/05
|
['https://Stackoverflow.com/questions/19786191', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1587500/']
|
Try this
```
$(window).resize(function() {
var bodyheight = $(document).height();
var divHeight = (bodyheight-10)/2;
$('.grow').css("height", divHeight+"px");;
});
```
|
```
var $grow = $('.grow'),
$window = $(window);
$(window)
.resize(function () {
var windowWidth = $window.width();
if (windowWidth > 90) {
$grow.height(~~ (windowWidth / 4));
}
})
.resize();
```
Trigger it the first time on dom ready.
<http://jsfiddle.net/techunter/Xug5A/>
remark careful with `.grow` margins and paddings :)
|
19,786,191 |
I need to do this with jQuery.
Let's say that I have simple div element in HTML like that:
```
<div class="grow"></div>
```
**CSS:**
```
body, html {
width: 100%;
height:100%;
min-height:100%
}
.grow {
height:20px;
width:100%;
}
```
I need to write script where DIV `grow` will be growing according to the screen resolution. Starting from 90px's.
Sth like this:
For **90px** screen wide DIV height will be - **20px**
For **130px** screen wide DIV height will be - **30px**
**so for any 4px's width height will grow 1px.**
I tried lots of solutions but without any luck. Any help will be appreciated.
|
2013/11/05
|
['https://Stackoverflow.com/questions/19786191', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1587500/']
|
here you go [http://jsfiddle.net/6KfHy/1/]
```
var baseWidth = 90;
var stepWidth = 4;
var baseHeight = 20;
var growHeightPerStep = 1;
function changeHeight() {
var windowW = $(window).width();
var diffWidth = windowW - baseWidth;
var diffHeight = parseInt(diffWidth / 4, 10);
$('.grow').css('height', baseHeight + diffHeight + 'px');
}
changeHeight();
$(window).resize(function() {
changeHeight();
});
```
|
Try this
```
$(window).resize(function() {
var bodyheight = $(document).height();
var divHeight = (bodyheight-10)/2;
$('.grow').css("height", divHeight+"px");;
});
```
|
19,786,191 |
I need to do this with jQuery.
Let's say that I have simple div element in HTML like that:
```
<div class="grow"></div>
```
**CSS:**
```
body, html {
width: 100%;
height:100%;
min-height:100%
}
.grow {
height:20px;
width:100%;
}
```
I need to write script where DIV `grow` will be growing according to the screen resolution. Starting from 90px's.
Sth like this:
For **90px** screen wide DIV height will be - **20px**
For **130px** screen wide DIV height will be - **30px**
**so for any 4px's width height will grow 1px.**
I tried lots of solutions but without any luck. Any help will be appreciated.
|
2013/11/05
|
['https://Stackoverflow.com/questions/19786191', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1587500/']
|
here you go [http://jsfiddle.net/6KfHy/1/]
```
var baseWidth = 90;
var stepWidth = 4;
var baseHeight = 20;
var growHeightPerStep = 1;
function changeHeight() {
var windowW = $(window).width();
var diffWidth = windowW - baseWidth;
var diffHeight = parseInt(diffWidth / 4, 10);
$('.grow').css('height', baseHeight + diffHeight + 'px');
}
changeHeight();
$(window).resize(function() {
changeHeight();
});
```
|
```
var $grow = $('.grow'),
$window = $(window);
$(window)
.resize(function () {
var windowWidth = $window.width();
if (windowWidth > 90) {
$grow.height(~~ (windowWidth / 4));
}
})
.resize();
```
Trigger it the first time on dom ready.
<http://jsfiddle.net/techunter/Xug5A/>
remark careful with `.grow` margins and paddings :)
|
173,408 |
My brother jumped into the voice of the doom in my Hardcore Creative map.
I didn't press the ΄΄**Delete This World**΄΄ button yet.
|
2014/06/22
|
['https://gaming.stackexchange.com/questions/173408', 'https://gaming.stackexchange.com', 'https://gaming.stackexchange.com/users/80112/']
|
As you probably know, hardcore mode is the same as hard mode but when you die your world is deleted.
When you die in hardcore mode you are given this game over screen.

If you clicked the `Delete world` button your world is gone, kapoosh. But you might be in luck.
The can retrieve this is if you revert the `saves` folder to a previous version. To do this you have to locate your `saves` folder.
It can be found in the directory: `%appdata%\.minecraft\saves`
Once you have found the `saves` folder right click on it and select `Restore previous versions`. Select the latest version before you died and restore it.
Your world should return to its previous state, before you died.
|
Don't click the "Delete World" button instead close out Minecraft and write down the seed before you make your world.
|
173,408 |
My brother jumped into the voice of the doom in my Hardcore Creative map.
I didn't press the ΄΄**Delete This World**΄΄ button yet.
|
2014/06/22
|
['https://gaming.stackexchange.com/questions/173408', 'https://gaming.stackexchange.com', 'https://gaming.stackexchange.com/users/80112/']
|
As you probably know, hardcore mode is the same as hard mode but when you die your world is deleted.
When you die in hardcore mode you are given this game over screen.

If you clicked the `Delete world` button your world is gone, kapoosh. But you might be in luck.
The can retrieve this is if you revert the `saves` folder to a previous version. To do this you have to locate your `saves` folder.
It can be found in the directory: `%appdata%\.minecraft\saves`
Once you have found the `saves` folder right click on it and select `Restore previous versions`. Select the latest version before you died and restore it.
Your world should return to its previous state, before you died.
|
After dieing, choose to go into spectator mode instead of deleting the world (for obvious reasons). Then open the world to LAN and set `cheats enabled` to `ON`.
Run the command `/gamemode survival`.
Save and exit.
You should now be able to load your world again and you will be in survival mode, cheats will be disabled and your next death will be permanent (unless you follow these steps again).
*Note: I tested this in 1.14.4, it may not work in previous versions*
|
173,408 |
My brother jumped into the voice of the doom in my Hardcore Creative map.
I didn't press the ΄΄**Delete This World**΄΄ button yet.
|
2014/06/22
|
['https://gaming.stackexchange.com/questions/173408', 'https://gaming.stackexchange.com', 'https://gaming.stackexchange.com/users/80112/']
|
After dieing, choose to go into spectator mode instead of deleting the world (for obvious reasons). Then open the world to LAN and set `cheats enabled` to `ON`.
Run the command `/gamemode survival`.
Save and exit.
You should now be able to load your world again and you will be in survival mode, cheats will be disabled and your next death will be permanent (unless you follow these steps again).
*Note: I tested this in 1.14.4, it may not work in previous versions*
|
Don't click the "Delete World" button instead close out Minecraft and write down the seed before you make your world.
|
57,477,658 |
I have an application which needs the full path of the file when clicking on choose file button. Now I want to get the full path of that file. For e.g. D:\MyNodeApp\project\text.doc
How do I get the file location in node.js?
|
2019/08/13
|
['https://Stackoverflow.com/questions/57477658', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10709726/']
|
async/await doesn't really matter here because it will essentially wrap/unwrap promises (which you arent using)
I dont really see a problem here. Your `console.log(__email__info)` and your `__email__info.push(__vs_status__)` both need to be within the callback of `transporter.sendMail`
so, the below:
```
_send_to_.forEach( /* tried[2] async here */ email => {
verifyEmailExist(email, (ev) => {
console.log(ev.smtpCheck)
if (ev.smtpCheck == 'true') {
__vs_status__.email_v = true
transporter.sendMail(mailOptions, function (error, info) { //want to wait for this too but couldn't test bcz valid email wait was not working properly
if (error) {
console.log(error);
__vs_status__.email_s = false
} else {
__vs_status__.email_s = true
}
__email__info.push(__vs_status__)
console.log(/* tried[1] await here */ __email__info)
});
}
})
});
```
|
Its better to use for of loop then for each loop, as for each loop contains callbacks. Here using request-promise module as it returns promise. ANd promisify object of the util library. So that the method which accepts callbacks are converted into promises.
```
const rp = require('request-promise'),
{promisify} = require('util');
function sendMails(fields) {
var transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 587,
secure: false,
requireTLS: true,
auth: {
user: email_from,
pass: password
}
});
var mailOptions = {
from: email_from,
to: _send_to_.toString(),
subject: fields.email_subject,
text: fields.msg_type == 'text' ? fields.message_text : '',
html: fields.msg_type == 'html' ? fields.message_text : ''
};
let __vs_status__ = {
email: email,
email_v: false,
email_s: false
};
_send_to_ = fields.emails
for (var email of _send_to_) {
var ev = await verifyEmailExist(email)
console.log(ev.smtpCheck)
if (ev.smtpCheck == 'true') {
__vs_status__.email_v = true
const sendMail = promisify(transporter.sendMail).bind(transporter);
const info = await sendMail(mailOptions);
if (!info) {
console.log("error");
__vs_status__.email_s = false
} else {
__vs_status__.email_s = true
}
}
__email__info.push(__vs_status__)
}
console.log( /* tried[1] await here */ __email__info) // this prints before loop and callbacks gets completed (don't want that)
}
// ----------------------------- EMAILS EXIST CHECK CALLBACK ---------------
async function verifyEmailExist(email, callback) {
console.log('callback ' + email)
var email = email;
var api_key = apikey;
var api_url = 'https://emailverification.whoisxmlapi.com/api/v1?';
var url = api_url + 'apiKey=' + api_key + '&emailAddress=' + email;
const str = await rp(url);
return JSON.parse(str);
}
```
|
2,057,227 |
In order to comply with [HIPAA](http://en.wikipedia.org/wiki/Health_Insurance_Portability_and_Accountability_Act) regulations, we need to send email from an external site (outside the firewall) to an internal Exchange server (inside the firewall). Our Exchange admins tell us we need to use TLS encryption to send mail from the web server to the email server.
I've never used TLS before and I'm not very familiar with it. Searching on Google as brought up numerous paid-for-use libraries. Is there anything native to .NET that will accomplish this? If so, how do I configure it? If not, is there something free or open source?
Current Configuration:
* ASP.NET C# Web Application
* 2.0 Framework
* Using System.Net.Mail to send email and attachments via SMTP
* IIS 6.0
|
2010/01/13
|
['https://Stackoverflow.com/questions/2057227', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/249861/']
|
TLS (Transport Level Security) is the slightly broader term that has replaced SSL (Secure Sockets Layer) in securing HTTP communications. So what you are being asked to do is enable SSL.
|
On SmtpClient there is an EnableSsl property that you would set.
i.e.
```
SmtpClient client = new SmtpClient(exchangeServer);
client.EnableSsl = true;
client.Send(msg);
```
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.