qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
42,266,147 | I am trying to get the XPath for `Search Results:`. However when I giving it
`//span[@class='zeiss-font-Md aletssubtitle']`
it's not detecting the text, it's detecting the span
```
<div class="col-xs-12">
<div class="col-xs-5" style="padding:0">
<div>
<span class="zeiss-font-Md aletssubtitle" style="l... | 2017/02/16 | [
"https://Stackoverflow.com/questions/42266147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7572947/"
] | You cannot use `XPath` with `selenium` to get text node like @Sunil Garg suggested (`//span[@class='zeiss-font-Md aletssubtitle']/text()`). It's syntactically correct `XPath` expression, but `selenium` doesn't support this syntax:
>
> selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: The... | It's simple, you can try :
```
//*[text()='Search Results :']
```
Hope this will help you. |
893,112 | I'm migrating from iptables to firewalld, using Centos 7.
In the old times, I used to write the (permament) iptables rules in the `/etc/sysconfig/iptables` , which also served to place comments prepended by `#` (to remind us why we restricted this or that ip, etc).
Now, it seems that the current (permanent) configurat... | 2018/01/19 | [
"https://serverfault.com/questions/893112",
"https://serverfault.com",
"https://serverfault.com/users/38966/"
] | Thinking it over, I'm finding this `firewalld-cmd` thing slightly silly. After all, XML configuration files are human editable. It makes little sense to me, having to learn an extra layer of commands (well, one command, but with [tons of arguments](http://www.firewalld.org/documentation/man-pages/firewall-cmd.html)) on... | Although in the firewall-cmd man page, there is a section on Direct Options, that allow you to give parameters, so you could do something like:
`firewall-cmd --direct --add-rule <table> <chain> <priority> <args> -c <some comment>`
Although, as Michael Hampton said, probably not the best thing. |
14,738,067 | I'm a novice. I want to concatenate 3 fields (city, provinceName, countryName) from MySQL into comma separated strings and return the strings in JSON with "city" as the key. I can't get the strings and I can't construct them into complete text in JSON. My PHP is:
```
$fetch = mysql_query("SELECT DISTINCT city GROUP_CO... | 2013/02/06 | [
"https://Stackoverflow.com/questions/14738067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693756/"
] | A byte array is just a byte array. It's just got data in.
How you *interpret* that data is up to you. What's the difference between a text file and a string, for example?
Fundamentally, if your application needs to know how to interpret the data, you've got to put that into the protocol. | A byte array is just a byte array. However, you could make the original byte array include a byte that describes what type it is (assuming you are the originator of it). Then you find this descriptor byte and use it to make decisions. |
8,035,513 | I am developing app similar to restaurant locator or bank locator. I was looking through examples of `google places api`. But then I noticed `google local search` using this url <http://ajax.googleapis.com/ajax/services/search/local>.
I want to know what is difference between two since both returns places based on la... | 2011/11/07 | [
"https://Stackoverflow.com/questions/8035513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/495906/"
] | [SqlCommand.ExecuteScalar](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executescalar.aspx "SqlCommand.ExecuteScalar")
```
// setup sql command and sql connection etc first...
int count = (int) cmd.ExecuteScalar();
``` | ```
if (ds.Tables[0].Rows.Count > 0) {
int i = Convert.ToInt32(ds.Tables[0].Rows[0]["colname"]);
}
``` |
15,186,055 | I have a class of which there may be many instances (on a mobile device), so I'm trying to minimize the size. One of my fields is a "DrawTarget" that indicates whether drawing operations are being ignored, queued to a path or drawn to the display. I would like it to take a single byte or less since there are only 3 pos... | 2013/03/03 | [
"https://Stackoverflow.com/questions/15186055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78162/"
] | >
> and I guess enum values end up being integer-sized values in Java.
>
>
>
No, enums are always *classes* in Java. So if you have a field of type `DrawTarget`, that will be a reference - either to `null` or to one of the three instances of `DrawTarget`. (There won't be any more instances than that; it's not like... | Your classes will only contain a reference to the enum. Only one instance of each enum will be created.
Aside from that, consider using polymorphism to implement the drawing behavior.
If the value of the enum is fixed, instantiate a different subclass for each object depending on its desired drawing behavior.
If t... |
11,189,545 | I get the exception from the title when I run my app. What it does is it has a .txt file with words for a Hangman game and I think the exception is thrown when accessing the file. My file, cuvinte.txt is located into /assets/. Here is my code (i skipped the layout/xml part, which works fine):
```
public void onCreate(... | 2012/06/25 | [
"https://Stackoverflow.com/questions/11189545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048172/"
] | Using DataBinding and setting background to the `EditText` with resources from the drawable folder causes the exception.
```xml
<EditText
android:background="@drawable/rectangle"
android:imeOptions="flagNoExtractUi"
android:layout_width="match_parent"
android:layout_height="45dp"
android:hint="Ente... | You are assigning a numeric value to a text field. You have to convert the numeric value to a string with:
```
String.valueOf(variable)
``` |
45,188,174 | I am currently working in a form.
I have some issue with multiple file upload validation. I have only one field in a form which allows multiple file upload.
```
<input type="file" name="file[]" multiple="multiple">
```
And this is my validation,
```
$this->validate($request, [
'file' =>'required',
'file.*... | 2017/07/19 | [
"https://Stackoverflow.com/questions/45188174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6708661/"
] | You can use check for the images.
```
$errors->has('file.*')
``` | If anyone is still struggling with multiple file upload issues, here is a working solution for this:
Validation Rules in Controller
==============================
```
$validated = $request->validate([
'files.*' => 'mimes:pdf,jpeg,png|max:4096',
'files' => 'required',
],
$messa... |
16,611,704 | I'm trying to return the value of a checkbox to enable and disable a button.
Making the checkbox is not a problem, the problem is the check box value always returns on. How should I get a value indicating if the checkbox is checked?
HTML:
```
<form>
<input type="checkbox" id="checkbox" /> <label>Do you agree </l... | 2013/05/17 | [
"https://Stackoverflow.com/questions/16611704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It seems that you need `checked`
```
var checkboxValue = this.checked;
``` | A couple of things is going on here
1. the check box as is does not have a value
2. you should be checking to see if its checked or not
try this
```
$('#checkBox').prop('checked');
```
if its checked you should get back true and false if its not checked. |
1,639,197 | I'm looking at notes on the threshold for random 2-sat which is given as $r\_{2}^{\*}=1$.
In the first part of proving the threshold they claim that a 2-sat formula is satisfiable if and only if the graph of implications does not contain a cycle containing a variable and it's negation. In the calculation it says the f... | 2016/02/03 | [
"https://math.stackexchange.com/questions/1639197",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/154686/"
] | Let $C$ be a $2$-CNF formula. We prove that if $C$ is unsatisfiable then there is some variable $x$ such that $x$ is reachable from $\bar x$ and vice versa in the implication graph $G(C)$. The proof uses induction on the number $n$ of variables in $C$.
**Base case.** If $n = 1$ then $C$ must contain clauses $x \vee x$... | The implication graph tells you that 'if $x$ is false, then $y$ has to be true' to make some litteral true, and therefore the formula true. So if you have a bicycle, it means that you have a sequence of implications that say that for some $w\_i$, $w\_i$ has to be true and false to satisfy the formula. Since this is a c... |
38,322,397 | I need to display an image(bmp) in console window using C++ (Windows 10).
Not display by characters, for that I already knew how, but show the image pixel by pixel the way ordinary images appears to be.
And not by launch another application to show the image in another window, but right in the black console window.
... | 2016/07/12 | [
"https://Stackoverflow.com/questions/38322397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5530828/"
] | Your hypothesis is wrong: in general a C++ (or C) program might not even be started from some "console window" (e.g. it might be started in "batch mode"). In particular, some C++ implementations may run on computers (such as Linux servers in data centers, which are the majority of the servers on Internet) without any s... | Oh, simply by looking thru (or reverse engineering) the [caca](http://caca.zoy.org/browser/libcaca/trunk/caca/codec/import.c?rev=4876) code ;-)
See [example use](http://www.howtogeek.com/howto/linux/stupid-geek-tricks-watch-movies-in-your-linux-terminal-window/). |
1,070,813 | I've searched around and not found anything quite like the issue I'm having.
I have Windows 10 on an NVME drive and I want to install Ubuntu to a second SSD on the same system.
I tried earlier and went through the basic install and it seemed successful - the machine booted to Ubuntu.
I was expecting the GRUB menu sc... | 2018/08/31 | [
"https://askubuntu.com/questions/1070813",
"https://askubuntu.com",
"https://askubuntu.com/users/865877/"
] | The problem is your if-condition is wrong. It does not do what you think it does.
```
if TouchpadOff=0; then
```
This runs `TouchpadOff=0` as a shell command, which creates a variable `$TouchpadOff` and assigns it the value `0`. As this should normally run successfully, the result is that the condition is always tr... | `TouchpadOff=0` as a condition is interpreted as an assignment, so it's always true (unless the variable is readonly).
Use numeric comparison:
```
if (( TouchpadOff == 0 )) ; then
``` |
15,158,863 | The time command returns the time elapsed in execution of a command.
If I put a "gettimeofday()" at the start of the command call (using system() ), and one at the end of the call, and take a difference, it doesn't come out the same. (its not a very small difference either)
Can anybody explain what is the exact diffe... | 2013/03/01 | [
"https://Stackoverflow.com/questions/15158863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870438/"
] | The Unix `time` command measures the whole program execution time, including the time it takes for the system to load your binary and all its libraries, and the time it takes to clean up everything once your program is finished.
On the other hand, `gettimeofday` can only work inside your program, that is after it has ... | `time()` returns time since epoch in **seconds**.
`gettimeofday():` returns:
```
struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
``` |
5,317,320 | I have never done regex before, and I have seen they are very useful for working with strings. I saw a few [tutorials](http://www.vogella.de/articles/JavaRegularExpressions/article.html) (for example) but I still cannot understand how to make a simple Java regex check for hexadecimal characters in a string.
The user w... | 2011/03/15 | [
"https://Stackoverflow.com/questions/5317320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/507512/"
] | Yes, you can do that with a regular expression:
```
^[0-9A-F]+$
```
Explanation:
```
^ Start of line.
[0-9A-F] Character class: Any character in 0 to 9, or in A to F.
+ Quantifier: One or more of the above.
$ End of line.
```
---
To use this regular expression in Java you c... | May be you want to use the POSIX character class **`\p{XDigit}`**, so:
`^\p{XDigit}+$`
===============
Additionally, if you plan to use the regular expression very often, it is recommended to use a constant in order to avoid recompile it each time, e.g.:
```java
private static final Pattern REGEX_PATTERN =
... |
456,997 | I'm having an issue **mounting a shared NAS drive that is hosted on a Windows 2000 server**. This is a drive that I'm certain I have access to, and I frequently access it from a Windows 7 machine and a Windows Server 2008 machine. Now, **I'm attempting to mount this drive from a RHEL7 machine**, but I'm having some iss... | 2018/07/18 | [
"https://unix.stackexchange.com/questions/456997",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/68573/"
] | Well, I had the same problem after I got windows 10 update 1809.
The windows firewall was blocking the access.
There is a predefined rule for inbound SMB conections that was not activated for private network.
Funny thing: It seems to be activated for public networks.... | Just replace the network path with the IP address of sharing device
 |
400,209 | Given a collection of random points within a grid, how do you check **efficiently** that they are all lie within a fixed range of other points. ie: Pick any one random point you can then navigate to any other point in the grid.
To clarify further: If you have a 1000 x 1000 grid and randomly placed 100 points in it how... | 2008/12/30 | [
"https://Stackoverflow.com/questions/400209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342/"
] | **New and Improved** ;-)
Thanks to Guillaume and Jason S for comments that made me think a bit more. That has produced a second proposal whose statistics show a significant improvement.
Guillaume remarked that the earlier strategy I posted would lose uniform density. Of course, he is right, because it's essentially a... | Force the desired condition by construction. Instead of placing all points solely by drawing random numbers, constrain the coordinates as follows:
1. Randomly place an initial point.
2. Repeat for the remaining number of points (e.g. 99):
2.1. Randomly select an x-coordinate within some range (e.g. 90) of the previou... |
29,320,798 | I want to make jQuery shoot an action triggered by a click or pressed key only WHILE `input#show1` is checked. The way I tried it below seems to be the most simple way to check if the input is checked but it doesn't work somehow.
Any help what I did wrong in my code is appreciated!
```
<script>
if ($('input#show1')... | 2015/03/28 | [
"https://Stackoverflow.com/questions/29320798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4551676/"
] | Two options here, either you execute the conditional check on DOM load or you check on change. You **have to** wait on the document to be loaded, which you can do by using a `$(document).ready()` call. Calling the function on `click` as mplungjan suggested will work as well, though I don't like it. You only want someth... | `#show1` is not checked at all in your `HTML` markup. I assume you meant to check for `#hide1`.
Also, you'd need to wrap your code around
```
jQuery(function($) { // same as doing $(document).ready(function() {
if ($('input#hide1').is(':checked')) {
alert("hide1 is checked");
}
});
```
To wait for t... |
277,941 | I want to give credit to all open source libraries we use in our (commercial) application. I thought of showing a HTML page in our about dialog. Our build process uses ant and the third party libs are committed in svn.
What do you think is the best way of generating the HTML-Page?
* Hard code the HTML-Page?
* Switch... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/969/"
] | There are two different things you need to consider.
First, you may need to identify the licenses of the third-party code. This is often down with a THIRDPARTYLICENSE file. Sun Microsystems does this a lot. Look in the install directory for OpenOffice.org, for example. There are examples of .txt and .html versions of... | Generating the page with each build would be wasteful if the libraries are not going to change often. Library versions may change, but the actual libraries don't. Easier to just create a HTML page would be the easiest way out, but that's one more maintenance head ache. Generate it once and include it with the package. ... |
182,186 | I recently enrolled in a Master's program in electrical engineering at a public research university in the midwestern United States. I am currently focusing on power distribution and transmission, as it seems like there are only a small number of well-defined channels between such things and militarism (compared to, sa... | 2022/02/09 | [
"https://academia.stackexchange.com/questions/182186",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/153230/"
] | If you don't want to do military-related research, just say "I don't want to do military-related research." The basic reason will be obvious to anyone, and there are probably plenty of academics who feel the same way.
If you think that even saying that phrase to a foreign-born professor will cause them some problem, I... | If you have the freedom to choose the mode of conversation, let it be verbal. This would reduce the chances of your statements being misrepresented/used against you, especially at a later stage.
It would also be nice to seek permission to express your (non) preference of topic before you actually state it. Doing so is... |
256,362 | I've got a domain name, let's call it: iam.us (which it is not). Now, I want to be able to provide users the chance to buy THEIRNAME.iam.us domain names.
1. Is it legal?
2. Is it possible? If so, where do I start? What software? Does my ISP host it for me?
3. Why isn't everybody doing this?
Thanks so much! | 2011/04/06 | [
"https://serverfault.com/questions/256362",
"https://serverfault.com",
"https://serverfault.com/users/16042/"
] | 1. Yes, it is legal.
2. You're basically talking about opening your own DNS registry. At the very least you'd need a website (of course), some method of accepting payments (credit card, paypal, etc.), and nameserver software (BIND, NSD, djbdns, etc.) You could sell referrals only, leaving the registrant to set up their... | 1. Depends on your location mainly, and on the subdomain. You will find out when someone wants to buy disney.iam.us or apple.iam.us ....
2. Yes. With a server, a website to offer the domain and a DNS server. Ask your ISP if it complies with his TOS.
3. Plenty of people do, but few sites who wants to leave a professiona... |
160,620 | I recently started learning C# and am taking the opportunity to try and accelerate my introduction by helping the RubberDuck team ([Website](http://rubberduckvba.com/) and [GitHub Repo](https://github.com/rubberduck-vba/Rubberduck)). The full class code that I'm working on [can be found here](https://github.com/rubberd... | 2017/04/13 | [
"https://codereview.stackexchange.com/questions/160620",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/131748/"
] | Only targeting `_moduleInit` and `_methodInit`
IMO the use of `string.Concat` with many parameters together with `\r\n` is hurting the readability a lot.
How about using a `StringBuilder` instead like so
```
private readonly string _moduleInit = new StringBuilder(256)
.AppendLine("'@ModuleInitialize")
.App... | Personally, I would use large string literals for your `_moduleInit` and `_methodInit` values, as they are more visually alike to their expected output:
```
private readonly string _moduleInit =
$@"'@ModuleInitialize
Public Sub ModuleInitialize()
'{RubberduckUI.UnitTest_NewModule_RunOnce}.
{{0}}
{{1}}
... |
3,521,621 | For an ecommerce site I want to generate a random coupon code that looks better than a randomly generated value. It should be a readable coupon code, all in uppercase with no special characters, only letters (A-Z) and numbers (0-9).
Since people might be reading this out / printing it elsewhere, we need to make this a... | 2010/08/19 | [
"https://Stackoverflow.com/questions/3521621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/425188/"
] | ```
$chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$res = "";
for ($i = 0; $i < 10; $i++) {
$res .= $chars[mt_rand(0, strlen($chars)-1)];
}
```
You can optimize this by preallocating the `$res` string and caching the result of `strlen($chars)-1`. This is left as an exercise to the reader, since probably you won... | Try this:
```
substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, 10)
``` |
31,681,915 | I have the following simple php code that gives me a result that I want to display.
```
$linkz= mysql_connect($host,$username,$password) or die(mysql_error());
mysql_select_db($db, $linkz);
$sq_name= $_POST['unameTF'];
$sq_pass= $_POST['passTF'];
$sq_search= $_POST['searchTF'];
if($sq_search=""||$sq_search=null)
{
e... | 2015/07/28 | [
"https://Stackoverflow.com/questions/31681915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4135250/"
] | The reason why it works without the `if()` statement is because you used assignment operators, rather than comparison operators causing the flow of your if statement to work like this:
```
if we can set $sq_search = "" ... we can!
check that it's not a null-terminated value... that's good too!
if we can set $sq_se... | ```
if ((!isset($_POST['searchTF'])) || (empty($_POST['searchTF']))
{
echo "type something";
} else
``` |
36,584,501 | I am using PassportJS to authenticate my node.js application. I'm using the WSFED/ADFS strategy. However, my `passport.serializeUser()` and `passport.deserializeUser()` functions are not working. They are not even called. The typical solution I have found is to add `app.use(passport.initialize())` and `app.use(passport... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36584501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1547174/"
] | Solved the same problem by removing `cookie: { secure: true }`
HTTPS is necessary for secure cookies. If secure is set, and you access your site over HTTP, the cookie will not be set
```
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: true,
}));
``` | Edited: I think you configured the passport strategy incorrectly. Looking at the docs, its looking like it should be:
```
passport.use(new wsfedsaml2({
realm: 'https://localhost:3001',
identityProviderUrl: 'https://some_company.org/adfs/ls/',
thumbprint: '9.....4'
},
function(profile, done) {
console.l... |
49,836,822 | What I'm trying to achieve: when my mouse **is moving** then do this, but when it **stops moving** for like half a second then do that, but when it **starts to move again** then do that.
This is my temporary jQuery:
```
$(document).ready(function() {
$('.test').mouseenter(function(){
$(this).mousemove(function... | 2018/04/14 | [
"https://Stackoverflow.com/questions/49836822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9421094/"
] | So I was just googling. This is the answer:
```
$(document).ready(function() {
var countdown;
$('.test').hover(function() {
setTimeout(function(){
$('.test').css({
'background-color' : '#666',
'cursor' : 'none'
});
cursor();
}, 2000);
}, function(e)... | This may deviate from your current code, but I think CSS is more appropriate here than JavaScript.
```
.test {
background-color:#666;
}
.test:hover {
background-color:#777;
cursor:none;
}
```
These lines of CSS should perform the exact same thing without the complication. Note that in your example, for ... |
60,034,420 | I need to GREP second column (path name) from the text file. I have a text file which has a md5checksum filepath size . Such as:
```
ce75d423203a62ed05fe53fe11f0ddcf kart/pan/mango.sh 451b
8e6777b67f1812a9d36c7095331b23e2 kart/hey/local 301376b
e0ddd11b23378510cad9b45e3af89d79 yo/cat/so 293188b
4e0bdbe9bbda41d7601821... | 2020/02/03 | [
"https://Stackoverflow.com/questions/60034420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12724344/"
] | If you can live with spaces before and after, you can use:
```
grep -o "\s[[:alnum:]/]*\s"
```
If you need the spaces removed, you will need some zero-width look-ahead/look-behind which is only available with -P (perl regexes), if you have that you can use:
```
grep -Po "(?<=\s)[[:alnum:]/]+(?=\s)"
```
* `(?<=\s)... | When you are allowed to combine `grep` with other tools and your input file only has slashes in the second field, you can use
```
tr " " "\n" < file.txt | grep '/'
``` |
10,190,456 | I've got an existing web application, that is installed on several machines. script clients and .net clients consume ".asmx" services through one machine, that routes all calls to other machines.
Client ----> |Website \ Virtual directory(HttpHandler)| ----> |Other server \ real .asmx|
I added a new .svc service that ... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10190456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/355289/"
] | i solved it with workaround, incase somebody comes looking -
chart and shapes are still not moving, but now i am assigning `TopLeftCell` property of chart and shape at runtime and forcing them to move, although now i have overhead of keeping its location. | I had the same problem and managed to fix it by unlocking the chart(s). |
73,225,745 | How would I work out the average of a range where it has to meet two requirements.
In the example below, I would like to calculate the average 'Score' of all of the 'Type 1' results that are within August 2022.
[](https://i.stack.imgur.com/6mkqK.png) | 2022/08/03 | [
"https://Stackoverflow.com/questions/73225745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19340264/"
] | try:
```
=AVERAGE(FILTER(C:C; YEAR(A:A)=2022; MONTH(A:A)=8; B:B="Type 1"))
```
or even `AVERAGEIFS` can be used | * Fix th date format first there is no August in your dates
[](https://i.stack.imgur.com/TiNXn.png)
>
> To look like this
>
>
>
[](https://i.stack.imgur.com/dcAUM.png)
Try this... |
9,363,146 | This is how my code looks like:
```
int main()
{
int a[] = {1,23,5,56,7,5};
int *p2 = a;
size = sizeof(a)/sizeof(a[0]);
int *p1 = new int[size];
cout << "sizeof " << size << endl;
int i = 0;
while(p2 != a+size )
{
*p1++ = *p2++;
}
cout << p1[1] << ' ' << p1[3];
retu... | 2012/02/20 | [
"https://Stackoverflow.com/questions/9363146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817810/"
] | You need to reset p1 to the begining of the initial array. | You should reset p1 before accessing elements:
```
int main()
{
int a[] = {1,23,5,56,7,5};
int *p2 = a;
int size = sizeof(a)/sizeof(a[0]);
int *p1 = new int[size];
cout << "sizeof " << size << endl;
int i = 0;
while(p2 != a+size )
{
*p1++ = *p2++;
}
p1 -= size;
cout << p1[1] << ' ' << p1[3]... |
1,018,176 | Is $GL(n,\mathbb R)$ dense in $M(n,\mathbb R)$? I have proved it to be open,not closed,not connected but not sure about this property .How to do this? | 2014/11/12 | [
"https://math.stackexchange.com/questions/1018176",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/294365/"
] | Yes, $GL(n,\mathbb R)$ is dense in $M(n,\mathbb R)$.
Using the determinant function $\det:M(n,\mathbb R)\rightarrow \mathbb R$, check that for small values of $\varepsilon$, the matrix $A+\varepsilon I\_n$ is invertible. | The way I like writing this is as follows: Consider $A\in M\_{n}(\mathbb R)$ and let $\varepsilon>0$. Let $\lambda \_1, \ldots, \lambda\_n$ be the eigenvalues of $A$. Take $\delta$ such that $0<\delta<\frac{\varepsilon}{n^{1/2}}$ and $\delta\neq \lambda\_j$ for every $j\in \{1, \ldots, n\}$. Define
$$A\_\delta:=A-\del... |
27,294 | Is there a way to set a keyboard shortcut to toggle layer visibility in Photoshop (CS3)? | 2009/08/21 | [
"https://superuser.com/questions/27294",
"https://superuser.com",
"https://superuser.com/users/7479/"
] | Mac = `command` + `,` toggles selected layer visibility
Mac = `command` + `option` + `,` turns all layers' visibility on regardless of layer selection.
PC = `ctl` + `,`
PC = `ctl` + `alt` + `,` | I don't think Photoshop has a default hotkey for showing/hiding a certain layer. You can, however, create your own action to do this, and just bind it to a key. |
28,033,504 | I require a form that is hidden until the user clicks the button and only then the form will be visible, when the submit button is pressed the form would go back to being invisible.
can anyone give me an idea on how implement this, i am assuming this would need to be done using php and ajax calls. | 2015/01/19 | [
"https://Stackoverflow.com/questions/28033504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3552356/"
] | Try this <http://jsfiddle.net/ManikandanK/c477rone/1/>
There are two things you need to correct.
```
ensureSingleActive: function(current) {
if(current.get('isActive') ) {
var previous= _.find(this.models, function(model) {
return model != current && model.get('isActive')
});
... | To expand on other answers, you could sidestep events and just call a method on your collection directly.
In your view:
```
activate: function() {
this.model.collection.setActive(this.model)
}
```
And then in your collection:
```
setActive: function(model) {
this.each( function(m) { m.set('selected', m === mo... |
5,506,587 | I am pretty much a new newbie when it comes to PHP, and have a problem that I need to solve, for a website that has to go live tomorrow.
Basically I have been using a javascript upload script called 'uploadify' which had an option for the upload folder which was added to the script in the form:
```
'folder' : '/so... | 2011/03/31 | [
"https://Stackoverflow.com/questions/5506587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672147/"
] | Assuming you still have the session var to work with...
```
$targetFolder = '/songs/' . $_SESSION['name'];
``` | You're looking for a [concatenation operator ('.')](http://php.net/manual/en/language.operators.string.php):
```
$targetFolder = '/songs/'.$_SESSION["name"].'/';
``` |
29,158,346 | I have the following matrix:
```
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 2 1 3 5 1
[2,] 3 5 4 6 7 2
```
I need to filter this matrix so that I remove the columns with duplicate elements in row 1, leaving behind only columns with the max value in row 2. So in this example, colum... | 2015/03/20 | [
"https://Stackoverflow.com/questions/29158346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3294195/"
] | You could compute the maximum second-row values for each first-row element and then only keep columns where the second row is the max value for the element in the first:
```
(maxes <- tapply(mat[2,], mat[1,], max))
# 1 2 3 5
# 4 5 6 7
(mat2 <- mat[,maxes[as.character(mat[1,])] == mat[2,]])
# [,1] [,2] [,3] [,4]... | You could use `ave`
```
res <- mat[,!!ave(mat[2,], mat[1,], FUN=function(x) x==max(x))]
res
# [,1] [,2] [,3] [,4]
#[1,] 2 1 3 5
#[2,] 5 4 6 7
```
**NOTE:** If there are ties in the dataset, you can remove those columns by
```
res[,!duplicated(split(res, col(res)))]
``` |
16,666,987 | Is there a way to tell attribute to work only when used with static methods?
`AttributeUsage` class does not seem to allow such specyfic usage.
```
[AttributeUsage(AttributeTargets.Method,
Inherited = false, AllowMultiple = false)]
``` | 2013/05/21 | [
"https://Stackoverflow.com/questions/16666987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/796078/"
] | No, there is no way to restrict this. However - you could use reflection at run-time to enforce this. | There is no such feature available in C# that allows you to restrict attribute usage based on a member's accessibility. |
124,824 | **How to invert colors of a picture on Mac?**
I'm using macOS 10.13. | 2019/05/22 | [
"https://graphicdesign.stackexchange.com/questions/124824",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/13481/"
] | Absent photo manipulation software (such as Photoshop, GIMP, Affinity Photo, PixelMator, Luminar) on a Mac you can use the inbuilt OS application called Preview for a lot of basic image manipulation stuff, and even the Photos app has a ton of tone-mapping and histogram editing you can do - but I don't recall there bein... | * Open the image in **Mac Preview**
[](https://i.stack.imgur.com/tcqUC.png)
* Go to menu Tools → Color Adjustment
* Change the histogram extreme sliders position: move the shadow slider to the right and the light slider to the left
[![enter image de... |
98,808 | I have a half-bath on the main floor of our house that is small and has only 3 electrical items in it:
1. Light above the sink (and corresponding light switch)
2. Fart fan (and corresponding light switch)
3. Two non-GFCI receptacles (one box, two plug-ins) next to the sink
I understand that, by itself, this is agains... | 2016/09/06 | [
"https://diy.stackexchange.com/questions/98808",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/11981/"
] | Step One, which I do for every home I occupy, is to do a thorough map of the circuit breakers by simple trial-and-error. Check every outlet, light, and wired appliance in the home. Print a nice list of what each breaker protects and tape it over the cryptic scribbles left by sparky.
Here's [my Google sheet](https://d... | While I understand things should be up to code, I wouldn't assume anything. A previous owner could have done anything they wanted.
1. The orange button causes a "ground fault" which should trip the GFCI if one exists. I'm not sure what happens if there is no GFCI installed. Also worth noting is you can get a [simple G... |
313,402 | I want to fetch the date when a data extension record was modified . I want to exclude all the records modified in last 15 days or DE itself if any of its record has been modified in last 15 days. I know this can be achieved using WS proxy SSJS but i am unable to find anything prudctive in SF documentation . I have als... | 2020/07/21 | [
"https://salesforce.stackexchange.com/questions/313402",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/64445/"
] | Since Rahul's answer didn't address the border on mouse hover (and I was working on this anyway), I'm going to give you a second answer.
Key points:
* Per Rahul, you want to use the custom select event to set a `selected` property to `true` on the selected child component
* Similarly, you can use [mouseover](https://... | We use the event to send data from child to parent. Public attribute to send data from parent to child. Looks like you are trying to fire an event from parent to child which does not work.
Instead,
1. You need to create a property on the case record to hold its selected state.
2. Then you need a public property on th... |
869,945 | I have an existing application which does all of its logging against log4j. We use a number of other libraries that either also use log4j, or log against Commons Logging, which ends up using log4j under the covers in our environment. One of our dependencies even logs against slf4j, which also works fine since it eventu... | 2009/05/15 | [
"https://Stackoverflow.com/questions/869945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249/"
] | OCTOBER 2014
Since version 2.1 of log4j exists the component log4j-jul, which allows exactly this. Still, in case you are using log4j 1, it has to be possible to upgrade to log4j2 in order to use this approach.
[JDK Logging Adapter](https://logging.apache.org/log4j/2.x/log4j-jul/index.html)
[Class LogManager](https:... | The slf4j site I believe has a bridge for passing java.util.logging events via slf4j (and hence to log4j).
Yes, the SLF4J download contains jul-to-slf4j which I believe does just that. It contains a JUL handler to pass records to SLF4J. |
140,354 | I have a vector of desired values that I want to fit based in some generated predictors. The tricky part is that I wish to have the explicit formula. For example, giving the below input I would like to get the following formula
Input:
```
Y=[1,2,3,6,7]
X=[1,2,3,4,5;0,0,0,1,1]
```
Output:
```
Transf={'multiply',1,'... | 2015/03/04 | [
"https://stats.stackexchange.com/questions/140354",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/60211/"
] | In addition to nice answer by @DankMasterDan (+1), I would like to share further information on the topic. It seems that an approach that you're looking for is [symbolic regression](http://en.wikipedia.org/wiki/Symbolic_regression). It seems to be closely associated with and usually is implemented via *evolutionary alg... | I strongly prefer *Mathematica* for such tasks. Given data of the form $mydata = \{ \{ x\_1, y\_1 \}, \{ x\_2, y\_2 \}, ... \}$, one searches for the unknown parameters such as $a$, $b$, $c$, and $d$ in a non-linear function of your choice in this way:
```
NonlinearModelFit[mydata, {a + b x + c x^2 + d Sin[x]}, {a, b,... |
19,237,918 | I just upgraded from cordova 3.0 to 3.1 and I'm still experiencing a very disturbing issue (which still exists when playing with KeyboardShrinksView preference).
Whenever I'm focusing an element (input/textarea) which triggers the keyboard opening, the element gets hidden behind the keyboard and I need to scroll down ... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19237918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1016659/"
] | Just had a very similar problem to this. Some of the hacks found on this site did work, but had nasty side effects (such as making a mess of scrolling or CSS layout). Finally came up with a brand new stupid hack.
Viewport meta tag:
```
<meta name="viewport" content="initial-scale=1, maximum-scale=1, width=device-widt... | I think the issue here originates from Framework7.
```
document.body.style.height = window.outerHeight + 'px';
```
The above code placed in my index.js file worked like charm. |
69,566 | To expand on the title, I'm building a pair of 3 way speakers and, to make them more compact, I'm planning on facing the sub woofer to the sides or rear. I'd expect to use them in small venues (pubs, clubs). I know it's an ambiguous question and it will depend on the room, but will the direction of the sub woofer have ... | 2018/04/04 | [
"https://music.stackexchange.com/questions/69566",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/49455/"
] | It's somewhat dependent on what the speakers are for. One assumes p.a., for vocals. That will mean there's no great need, in smaller venues, for sub-woofers anyway. If it's for the whole band, a disco or suchlike, then sub-woofers are generally a separate entity in my experience in small venues. Mounting them in the sa... | I would say you need to be more specific about what you mean by "subwoofer" to get a proper answer here. Are we talking about a 10" speaker? A 12" speaker? 15"? 18"? Below a certain frequency, sounds are unidirectional. There's a Wikipedia article on [directional sound](https://en.wikipedia.org/wiki/Directional_sound).... |
22,475,135 | When calling 'exit', or letting my program end itself, it causes a debug assertion:
[](https://i.stack.imgur.com/K4B5B.png)
.
Pressing 'retry' doesn't help me find the source of the problem. I know that it's most likely caused by memory being freed twice s... | 2014/03/18 | [
"https://Stackoverflow.com/questions/22475135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879228/"
] | It wasn't working because the carousel is using overflow, and the tooltips exceeded its margins. | carousel-inner sets overflow to hidden. You can disable it, however your content (content inside de inner div) needs to use fixed width
Add this to your CSS header
```
carousel-inner {
overflow: visible;
}
``` |
6,684,585 | How can I pull a data from any a web site through webrequest in c#? e.g price of the product in www.xxx.com
Thanks, | 2011/07/13 | [
"https://Stackoverflow.com/questions/6684585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/769829/"
] | The "prescribed" way of doing this is passing the [`TaskScheduler`](http://msdn.microsoft.com/en-us/library/system.threading.tasks.taskscheduler.aspx) instance from [`TaskSheduler::FromCurrentSynchronizationContext`](http://msdn.microsoft.com/en-us/library/system.threading.tasks.taskscheduler.fromcurrentsynchronization... | I don't think that you should directly update the ViewModel directly from a background thread either. I write a lot of Silverlight apps and I like to use the MVVMLight toolkit to implement the MVVM pattern.
In MVVM, sometimes you need to have the ViewModel "affect" the View, which you cannot do directly because the V... |
22,287,060 | How can I change what I am using which is javascript alert to use a jQuery UI / dialog. I have been trying to change my script over to use a dialog with no success. I want to use something better than alert to create the popup for my calendar. So I was thinking of a dialog but if there is something better I would be in... | 2014/03/09 | [
"https://Stackoverflow.com/questions/22287060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3326386/"
] | the '+' character is a meta-character used to formulate regular expressions. If you wish to refer to it literally you need to escape it. The same goes with several other characters like `'.', '*', '[', ']'`, etc.
```
if (msg[1].contains("+")){
numeros = msg[1].split("\\+"); // this should work
}
```
You migh... | You need to escape `+` in your regular expression. `+` in regular expression is used to denote 'one or more of the preceding element' and you have no preceding element, hence the error.
```
numeros = msg[1].split("\\+");
``` |
11,492,895 | I'm currently working on a project out of a text book and I've had an obscure problem with a while loop. The code from the text book is as follows;
```
while(getImage().getWidth(applet) <= 0);
double x = applet.getSize().width/2 - width()/2;
double y = applet.getSize().height/2 - height()/2;
at = AffineTransform.getTr... | 2012/07/15 | [
"https://Stackoverflow.com/questions/11492895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1298736/"
] | A semicolon is an empty statement. You can use it when evaluating the continuation condition of your `while` loop has a side effect: the loop will produce a chain of side effects that invalidate the loop condition upon completion, or run forever.
For example, if `getImage()` gets you a new image every time you call it... | The semicolon is the end of the while loop in the first example. It's sometimes useful to have a single-line loop like that, but it's also a common mistake.
If it's intentional, then it looks like maybe this code is waiting for another thread to change the width of the applet in question. This isn't a great way to do ... |
44,467,910 | When I run this code the output of **D** comes out as the value of **C**. Is it because I call for a float and it just takes the most recent float in the memory?
```
#include <stdio.h>
int main()
{
int a=3/2;
printf("The value of 3/2 is : %d\n", a );
float b=3.0/2;
printf("The value of 3/2 is : %f\... | 2017/06/09 | [
"https://Stackoverflow.com/questions/44467910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8122862/"
] | >
> I try it by detect the base `height` of my element at first and use it to work with `transition`, because the `transition` need `height` to work .
>
>
>
```js
var box = document.getElementById("box");
var button = document.getElementById("button");
var expanded = true;
var height = box.offsetHeight;
box.s... | Try this:
```
var box = document.getElementById("box");
var button = document.getElementById("button");
//get your dynamic div's height:
var clientHeight = document.getElementById('box').clientHeight;
var expanded = true;
//define max-height property your div before collapse it.
//otherwise it collapse without trans... |
35,993,810 | I have been experiencing something while calculating with floats which I do not understand, maybe somebody can explain the difference between these two operations and the results:
```
for var i = 10; i < 20; i++ {
//Assuming i = 11
var result1:Float = Float(i/10) //equals 1
var result2:Float = Float(i)/10 //e... | 2016/03/14 | [
"https://Stackoverflow.com/questions/35993810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2548205/"
] | Your intuition is right, `i/10` where `i: Int` will **always** return an integer.
It is then converted to a floating point number, but `Float(1) == 1`.
The second statement converts `10` to a Float implicitly before performing the division, hence return `1.1` | Just an addendum, you can also get result2 with:
```
var result3 = Float(i/10.0)
```
Also an FYI, C style for loops are [going away in Swift 3.0](https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md) |
35,953,938 | Hi so I've been looking into this for a while and nothing I've tried has worked. Forgive me for asking this again, but I cannot replace a new line with a space in powershell
```
$path = "$root\$filename"
Get-Content $path | % $_.Replace "`r`n"," " | Set-Content "$root\bob.txt" -Force
```
This is one of the many thin... | 2016/03/12 | [
"https://Stackoverflow.com/questions/35953938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2763391/"
] | A couple of issues here. First, the way you are calling Get-Content, the strings sent down the pipe will never have a newline in them. That's because the default way Get-Content works is to split the file up on newline and output a string for each line. Second, your Foreach command requires {} around the replace comman... | Try this:
```
$NewStr = "";
Get-Content $Path -Raw | ForEach {$NewStr += "$_ "}
$NewStr | Set-Content DestinationPath -Force
``` |
1,134,746 | I have the following in .screenrc
```
# I want to use Vim's navigation keys
bind h focus down
bind t focus up
```
I would like to be able to move by `Ctrl-A t` to a next window, while by `Ctrl-A h to the previous window.
However, the above mapping... | 2009/07/16 | [
"https://Stackoverflow.com/questions/1134746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54964/"
] | ```
bind h prev
bind t next
``` | If you start screen then type Ctrl-A ?, you'll see the help page, which lists next [n] and prev [p]. I believe that binding to next and prev instead of focus will do what you want. |
57,577,092 | I am trying to develop an app which plays audio and includes the function to change audio devices. My only problem is when I try to use the `setSinkId()` function, it gives me a DOMException AbortError with the message 'The operation could not be performed and was aborted'. I have tried the exact same code in the lates... | 2019/08/20 | [
"https://Stackoverflow.com/questions/57577092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4788795/"
] | I feel your pain and I had the same question during my development. I didn't solve it in straight way. I can only suggest to check a few things regarding your source HTML element reference.
1) Is the `srcObject` set correctly?
Before first time use `setSinkId()`, check if
```
audio.srcObject = stream;
```
2) Check... | Maybe it's related to this old-reported issue. It's been on hold for years.
<https://bugs.chromium.org/p/chromium/issues/detail?id=697877>
Remember that for getting visibility on chromium, you should “Start" it with your Google account to help to the Chromium team to understand its importance. |
12,599,505 | I'm trying to create a backup from PostgreSQL database, but getting the following error: pg\_dump: No matching schemas were found
I'm logged in as root and running the command
pg\_dump -f db.dump --format=plain --schema=existing\_schema --username=userx --host=localhost databasename
1. I logged in with userx to psq... | 2012/09/26 | [
"https://Stackoverflow.com/questions/12599505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1565682/"
] | You can try with back slash and double quote as metioned [here](http://postgresql.nabble.com/pg-dump-t-quot-Table-quot-for-cmd-exe-td5731755.html).
```
sudo -u postgres pg_dump -v Database_Name -t "\"Table_Name\""
``` | ```
\dn list out all the schema in the database
```
if you want to dump only schema ,
[refer](https://stackoverflow.com/questions/12564777/schema-only-backup-and-restore-in-postgresql/12564792#12564792) |
97,969 | I use this command: yum install apache2-mpm-worker
with no success. Searching on google also not found
Thanks. | 2009/12/29 | [
"https://serverfault.com/questions/97969",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Uncomment the httpd.worker line in /etc/sysconfig/httpd:
```
# The default processing model (MPM) is the process-based
# 'prefork' model. A thread-based model, 'worker', is also
# available, but does not work with some modules (such as PHP).
# The service must be stopped before changing this variable.
#
#HTTPD=/usr/s... | I've done that and restarted apache. I do an httpd -l and it only shows the prefork.c not the worker.c . I have checked the sbin directory and know for a fact the httpd.worker file exists. ANy other ideas? |
7,172,725 | I have a EF4.1 class X and I want to make copy of that plus all its child records.
X.Y and X.Y.Z
Now if I do the following it returns error.
The property 'X.ID' is part of the object's key information and cannot be modified.
```
public void CopyX(long ID)
{
var c = db.Xs.Include("Y").Include("W").Include("Y.Z").... | 2011/08/24 | [
"https://Stackoverflow.com/questions/7172725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/467425/"
] | You need to make correct deep copy of the whole entity graph - the best way is to serialize the original entity graph to memory stream and deserialize it to a new instance. Your entity must be serializable. It is [often used with DataContractSerializer](http://blog.vascooliveira.com/how-to-duplicate-entity-framework-ob... | I use Newtonsoft.Json, and this awesome function.
```
private static T CloneJson<T>(T source)
{
return ReferenceEquals(source, null) ? default(T) : JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(source));
}
``` |
66,566,889 | I have a function xyz() which returns an `tuple<std::string, double>`.
When I call this function individually, I can do the following:
```
auto [tresh, loss] = xyz(i);
```
This results in no error, but if I want to use the xyz() function in an if else block, then I can not use the `tresh` and `loss` variables anymor... | 2021/03/10 | [
"https://Stackoverflow.com/questions/66566889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7657749/"
] | Depending on the exact code, you could replace with a ternary
```
auto [tresh, loss] = boolX ? xyz(a) : xyz(b);
std::cout << tresh << std::endl;
``` | You can use a lambda for it:
```
auto [tresh, loss] = [&boolX, &i, &j](){
if (boolX) {
return xyz(i);
} else {
return xyz(j);
}
}();
std::cout << tresh << std::endl;
``` |
60,736,380 | I hope you got the question from the title itself.
After migrating I can select multiple fields from that many to many field in django admin page but when I click on save it saves in the admin page of django but when I check the postgresql database everything that is not many to many field saves but the table lacks ma... | 2020/03/18 | [
"https://Stackoverflow.com/questions/60736380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13081289/"
] | There are no many-to-many connections in Postgres, nor other SQL databases as far as I know. These connections are generally made thru a third table (called thru-table sometimes), connecting values from two tables.
Django does this behind the scenes for you.
You should find the third table in the database. There ... | If you check the database in graphical interfaces such as pgadmin or in the terminal, you will see that none of the databases show the many-to-many relationship, but in practice everything is in order and working.
This could be because you can't change it through tools like pgadmin, and the reason of many-to-many relat... |
15,879 | In Aperture 3, at the beginning of the Import process, one can select/check or unselect/uncheck images one by one.
But it requires the mouse.
In the Viewer view, during that selection process, I can go to the next image easily using the keyboard, with the `->` key, but what is the way to uncheck an image using the ke... | 2011/06/13 | [
"https://apple.stackexchange.com/questions/15879",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/7163/"
] | Safari will show what the developper of the given website provides as alternative content for browsers (user agents) that do not support Flash. In many cases this is just nothing or the hint to download Flash player plugin. Youtube videos are played by the built-in youtube app of iOS. | There is a Youtube app built in which does not require flash. It probably makes use of HTML5 markup. |
48,293,307 | I need to compare two arrays containing a list of names and a list of selected indices. I need to get as a result another array with names of just the indices given. How could achieve this?
I am trying using `foreach` but I get doubled values.
```
let selectedIndices = [1, 3, 7, 10]
let namesArray = ["aaa", "bbb", "c... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48293307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2075848/"
] | Here is how to get that done:
If you are using cli,
<https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html>
Get the object with the version you want.
Then perform a put object for the downloaded object.
<https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html>
Your old S3 object w... | No. However, to protect against this in the future, you can enable versioning on your bucket and even configure the bucket to prevent automatic overwrites and deletes.
[](https://i.stack.imgur.com/gYwyz.png)
To enable versioning on your bucket, visi... |
12,371 | Movie super-heroes are commonly shown to be fearless. In *Dark Knight Rises*, fearlessness is discussed directly:
```
Blind Prisoner: You do not fear death. You think this makes you strong. It makes you weak.
Bruce Wayne: Why?
Blind Prisoner: How can you move faster than possible, fight longer than possible
... | 2013/07/05 | [
"https://movies.stackexchange.com/questions/12371",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/5315/"
] | I would argue the answer to this is no; fear of death may be a powerful impulse of the spirit but to say it is the **MOST** powerful does not satisfy reason (which is the basis of philosophy), and facing the fear of death is not enough to explain the power of the superhero.
1. **A bit of logic…** When faced with a sta... | >
> Is the fear of death the most powerful impulse of the spirit for Batman in *Dark Knight Rises*
>
>
>
No. Bruce Wayne ends up showing us his humanity in many ways, including a few of his fears, in this movie. However, considering that he fights and puts himself in harm's way as he does, a fear of death is not o... |
47,948,555 | My header is devided in 3 sections: `left`, `center` and `right`. The `left` section is empty. In the `center` section I have my page title and in the `right` section I placed an "Account" link with an icon next to it. The link contains the word ACCOUNT and an icon. the icon is somehow pushed to the top and leaves a bl... | 2017/12/22 | [
"https://Stackoverflow.com/questions/47948555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8315609/"
] | You can convert the `Counter` objects to `frozenset`s, which are hashable and can be put in a set themselves for linear savings on the `in` check:
```
from collections import Counter
counters = set()
no_duplicates = []
for sub_list in all_subsets:
c = frozenset(Counter(sub_list).items())
if c not in counter... | Why you are using any external module and why making it too complex when you can do it in just few lines of code:
```
data_=[[], [1, 2, 2], [1], [2], [2], [1, 2], [1, 2], [2, 1], [2, 2]]
dta_dict={}
for j,i in enumerate(data_):
if tuple(sorted(i)) not in dta_dict:
dta_dict[tuple(sorted(i))]=[j]
else:... |
467,554 | I'm currently reading a book on optics, and have encountered a curious section:
>
> $$\nu = \nu'\sqrt{1-\frac{u^2}{c^2}} = \nu'\left(1-\frac{u^2}{2c^2}+\ldots\right)$$
>
>
> This is the formula for the *transverse Doppler shift*, giving the frequency change when the relative motion is at right angles to the directi... | 2019/03/20 | [
"https://physics.stackexchange.com/questions/467554",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/-1/"
] | I think it is a combination of the relative sizes of $v/c$ versus $v^2/c^2$ combined with the requirement to make sure a tangential velocity has no confusing radial component with a high level of precision throughout the measurement.
I suppose ideally you want something moving in a perfect circle and emitting radiatio... | The transverse Doppler actually doesn't exist, it is the "relativisic" Doppler Effect that occurs at all angles, which is caused by a slowing down of emission processes by motion in the gravitational field of the earth, which has nothing to do with some kind of time dilatation. There is no need to measure the transvers... |
18,459,515 | I want to insert data from an array. Below is an example situation.
I grab all my friends available in friends list (fb) and store them in an array.
Now I want to insert their data ( `name, fbid, birthday` ) into a table.
Currently I'm doing this using a for loop below is an example code.
```
<?php
$friendsname ... | 2013/08/27 | [
"https://Stackoverflow.com/questions/18459515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2555660/"
] | Please See this query hope this will be improve our code and speed.
Avoid doing SQL queries within a loop
A common mistake is placing a SQL query inside of a loop. This results in multiple round trips to the database, and significantly slower scripts. In the example below, you can change the loop to build a single SQ... | ```
$sql = '';
foreach($friendsfbid as $key => $value){
$sql .= INSERT INTO table (fbid, name, birthday) VALUES ('$value[$key]','$friendsname[$key]','$friendsbday[$key]') ON DUPLICATE KEY UPDATE fbid='$value[$key]', name='$friendsname[$key]', birthday='$friendsbday[$key]'";
}
mysql_query($sql);
```
You can stack y... |
25,544,348 | I've started learning how to use PHPUnit. However, I'm facing a problem which I have no clue how to solve.
I have a folder called `lessons` and inside there is a `composer.json` which I installed PHPUnit with.
The output resulted in a folder called `vendor` and a sub-folder called `bin` which has the phpunit file in i... | 2014/08/28 | [
"https://Stackoverflow.com/questions/25544348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1972768/"
] | I was getting the same, but if you type `phpunit` then tab you will see what directory you are in and it should autosuggest. Then navigate to your test file. | I have created a phpunit.bat in the root folder of my project containing
```
@ECHO OFF SET BIN_TARGET=%~dp0/vendor/phpunit/phpunit/phpunit php "%BIN_TARGET%" %*
```
Now it works. |
395,396 | My notes say that the ordinals $\omega + 1, \omega + 2, ... , 2 \omega, ... , 3 \omega, ... \omega^2, ... $ are all countable, and hence have cardinality equal to $\omega = \aleph\_\mathbb{0}$. So I was wondering if it's fair to say that every ordinal has cardinality no greater than $\aleph\_\mathbb{0}$?
Alternatively... | 2013/05/18 | [
"https://math.stackexchange.com/questions/395396",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/78274/"
] | A hint to start you off. Take all the countable ordinals, ordered in size. Ask: are they *well-ordered*? if so, ask: What is the order-type of *that* sequence of objects? Is it an ordinal? Must it be bigger than any countable ordinal? | (In ZFC) by Cantor's theorem, $2^{\aleph\_{0}}=\vert \mathcal{P}(\omega)\vert> \vert \omega\vert=\aleph\_{0}$, so that $\vert P(\omega)\vert (\approx \mathbb{R})$ is an uncountable cardinal and therefore an uncountable (limit) ordinal (here $2^{\aleph\_{0}}$ is cardinal exponentiation). The claim that $2^{\aleph\_{0}}=... |
11,864,926 | This is probably something very basic and simple, and I'm probably just googling for the wrong terms, but hopefully someone here can help me. (I'm still a beginner to programming, which is probably obvious from this question.)
I'm looking for a way to access variables from strings.
Like this:
```
A1 = {}
B1 = {}
C1 ... | 2012/08/08 | [
"https://Stackoverflow.com/questions/11864926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1413513/"
] | use `eval()`.
example:
```
A1 = []
B1 = []
C1 = []
mylist = ["A","B","C"]
for blurb in mylist:
eval("%s1.append(blurb)" % blurb)
print A1,B1,C1
>>>
['A'] ['B'] ['C']
```
and for your code it can be:
```
for blurb in mylist:
eval("%s1.foo()" % blurb)
``` | I looks like you simply want a dictionary and to look it up rather than run a bunch of checks.
```
dict_look_up = {'A' : A1, 'B' : B1, 'C' : C1}
try:
dict_look_up[blurb].foo()
except KeyError:
#whatever on item not found
```
`try/except` blocks are incredibly important in Python (better to ask for forgivenes... |
15,338,191 | Here is my PHP code. In this I am creating a table and Populating data by pulling it from the database. I am printing two rows. In the second table row I have written "Hello There". My understanding of .hide() function makes me belief that it should be hidden on page display. But its not happening so?
```
<table>
... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15338191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1590011/"
] | I have found out a way may be its not the best one but some how I am getting a fast parsing.
```
NSData * fileData = [[NSData alloc] initWithContentsOfURL:url];
xmlParser = [[NSXMLParser alloc] initWithData:[self removeElements:fileData]];
[xmlParser setDelegate:objUtil];
success = [xmlParser parse];
```
I ahve cea... | Try to use [TBXML](http://www.tbxml.co.uk/TBXML/TBXML_Free.html) parsing Library for iOS.This is a DOM Parser easy to use.
You can find parser comparison here : [Ray Wenderlich Blog](http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project) |
126 | As I see people's reputations rapidly grow, and become frustrated because it seems impossible to get to a question first, I can't help but wonder if there is manipulation/cheating going on. After all, this would be expected Internet behavior.
How do we know that people don't manipulate their reputations by using fake ... | 2013/04/08 | [
"https://reverseengineering.meta.stackexchange.com/questions/126",
"https://reverseengineering.meta.stackexchange.com",
"https://reverseengineering.meta.stackexchange.com/users/1563/"
] | No, **I don't think** there's a reputation manipulation going on here.
You have to remember that the site is barely three weeks old and less than one week in public beta. There aren't that many questions posted, so every new question gets a lot of attention and it's not unusual that they get good answers reasonably qu... | It sounds like the end result is quickly getting in-depth, well-formatted responses to questions, so I don't see this as a bad thing. I think the purpose of reputation is to incentivise good, fast answers, so everything is working to plan.
SE actually encourages answering your own questions. I'm not sure if people are... |
950,136 | I'm new to JQuery. I have a
```
<div id='field1'> </div>
```
I'm referring to it twice in my code. But at each time it refers to the same 1st reference.
E.g. I'm changing the `DIV` content initially with the value
```
$("#field1").change(function (){alert('hi')});
```
After some piece of code inside one anothe... | 2009/06/04 | [
"https://Stackoverflow.com/questions/950136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79980/"
] | If you mean you have two DIVs with the same ID, that's actually invalid HTML. IDs should be unique per-document. | I think jQuery when using ID's, only ever returns one element.
If you must use the same selector name (which as Rytmis correctly stated, using multiple ID's with the same name is invalid HTML), then changing to a class selector would be best.
You can then use the **:eq()** functionality in jQuery
To target yo... |
47,789 | When should you use generator expressions and when should you use list comprehensions in Python?
```
# Generator expression
(x*2 for x in range(256))
# List comprehension
[x*2 for x in range(256)]
``` | 2008/09/06 | [
"https://Stackoverflow.com/questions/47789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] | [John's answer](https://stackoverflow.com/a/47792/4518341) is good (that list comprehensions are better when you want to iterate over something multiple times). However, it's also worth noting that you should use a list if you want to use any of the list methods. For example, the following code won't work:
```
def gen... | Sometimes you can get away with the *tee* function from [itertools](https://docs.python.org/3/library/itertools.html), it returns multiple iterators for the same generator that can be used independently. |
14,274,274 | So I using access database(\*mdb).
This my code and success to connect:
```
$db['test']['hostname'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\blabla.mdb';
$db['test']['username'] = '';
$db['test']['password'] = '';
$db['test']['database'] = 'Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\blabla.mdb';
$db['te... | 2013/01/11 | [
"https://Stackoverflow.com/questions/14274274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1599703/"
] | I found this thread for a similar problem: <http://ellislab.com/forums/viewthread/93160/>. Says you should try loading loading the odbc driver manually from your controller:
```
$this->load->database();
$this->db->dbdriver = “odbc”;
```
It also says that for some reason the database config is not available in the od... | Have you checked read/write access to that file? If your php app is running on IIS, then your IIS' user account will need to have read/write permissions to that file, not the user account you use to login to your computer. |
128,405 | >
> **Possible Duplicate:**
>
> [Should deleted/closed questions count towards 6 questions in 24 hours rule?](https://meta.stackexchange.com/questions/113957/should-deleted-closed-questions-count-towards-6-questions-in-24-hours-rule)
>
> [6 questions per day including deleted questions?](https://meta.stackexchan... | 2012/04/06 | [
"https://meta.stackexchange.com/questions/128405",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/175200/"
] | The limit is to prevent spamming the community with questions and not making progress independently.
If we allowed deleted questions not to count **people could just delete the oldest one and continue in a loop**, effectively having no throttle at all. As soon as you got the answer you wanted, it'd encourage deletion... | This has been discussed before on numerous occasions. It doesn't matter whether you deleted a question or not. The value of StackOverflow is primarily for the entire community, and not for any one user. It is *highly* unlikely that you can research, compose, write examples for, and eventually maintain more than six val... |
98,503 | One of my customers uses a Citrix server to allow their employees access to my MSACCESS application. I was curious about how I would go about hosting a Citrix server for some of my smaller customers who don't have IT departments. Any resources or thoughts are appreciated. | 2009/12/31 | [
"https://serverfault.com/questions/98503",
"https://serverfault.com",
"https://serverfault.com/users/30473/"
] | You could do a simple 2 server setup with a gateway at the edge with the Citrix Secure Ticketing running, then having a terminal server behind it servicing the app requests.
Or, just go with a Citrix hosting solution, like [THIS.](http://www.redplaid.com/citrix_hosting.html) | Well depends on what you need, but for simple scenarios even vanilla remote desktop services can be enough. |
573,274 | Here is my code:
```
#define A 16777216.0
#define B 30.0
#define C 6990.51
#define D 1.0
#define Pulse_relation_ThetaAZ (A*B)/(360.0*C)
#define StopFreqAZAUX (((D*1.0*Pulse_relation_ThetaAZ))/(D*1.0))*50.0+52
printf("%ld",StopFreqAZAUX);
```
This code be compiled... | 2021/06/28 | [
"https://electronics.stackexchange.com/questions/573274",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/269511/"
] | C is very much not strongly typed.
When you say `printf("%ld", foo);`, you are telling the printf function "here is a mess of bits which you should *interpret as an integer*".
You're telling the compiler "Make a string containing `%ld` and shove its address onto the stack. Then shove `foo` onto the stack. Then call p... | The incorrect output of `printf` is expected. It is the result of a mismatch between the format-specifier `%ld` and the argument `StopFreqAZAUX`.
After pre-processing, `StopFreqAZAUX` becomes a constant-literal of type `double`. However, the `%ld` format specifier tells `printf` to retrieve the argument as a `long sig... |
18,264,944 | This may be a bug or just my bad coding.
I've built a website using twitter bootstrap 2.3.\* and found no problem, especially for the responsive function. The problem came up when I tried to switch into bootstrap 3.RC-2 which was latest stable release (according to [Wikipedia](http://en.wikipedia.org/wiki/Twitter_Boots... | 2013/08/16 | [
"https://Stackoverflow.com/questions/18264944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1707829/"
] | Additionally to what Bass Jobsen has mentioned, for a better usability on mobile, the following CSS snippet removes the "sub-scrolling" on the navigation bar and removes the top margin which is there due to the large screen fixed navbar:
```
@media (max-width: 767px) {
.navbar-fixed-top {
position: relativ... | For responsive and fixed navbar use this piece of code:
```
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button"class="navbar-toggle collapsed" data-toggle="collapse" data-target="ID-name or class_name" ari... |
17,309,808 | @H2CO3
this is my main code :
```
#pragma OPENCL EXTENSION cl_ amd_ printf : enable
#define PROGRAM_FILE "matvec.cl"
#define KERNEL_FUNC "matvec_mult"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#ifdef MAC
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
int main() {
cl_platform_id platform;
c... | 2013/06/26 | [
"https://Stackoverflow.com/questions/17309808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2125747/"
] | On the cl\_platform.h header installed on my machine, i found that cl\_ulong is define as:
```
typedef uint64_t cl_ulong;
```
So I guess you could try to printf as suggested [here](https://stackoverflow.com/questions/9225567/how-to-print-a-int64-t-type-in-c).
BTW, I don't know if you use the pragma for something... | As one of the other answers mentioned, the [sizes of OpenCL scalar data types](https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/scalarDataTypes.html) are a constant number of bits:
```
DATA TYPE | BITS
===========================
cl_char / cl_uchar | 8
cl_short / cl_ushort | 16
cl_int ... |
28,192,426 | so my codes are:
```
<?php
$date2=date('Y', strtotime('+1 Years'));
for($i=date('Y'); $i<$date2+5;$i++){
echo '<option>'.$i.'-'.$date2.'</option>';
}
?>
```
the output is
```
2015-2016
2016-2016
2017-2016
2018-2016
2019-2016
```
I want the output goes like this:
```
2015-2016
2016-2017
2017-2018
2018-2019
2... | 2015/01/28 | [
"https://Stackoverflow.com/questions/28192426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4041288/"
] | Change your code following way-
```
<?php
$date2=date('Y', strtotime('+1 Years'));
for($i=date('Y'); $i<$date2+5;$i++){
echo '<option>'.$i.'-'.($i+1).'</option>';
}
?>
``` | This worked really well for me.
```php
$years = range('2015', date('Y'), 1);
foreach($years as &$year) {
$year = $year . '-' . ($year + 1);
}
```
This outputs an array of years from the set year until the current year. |
67,472,625 | I have images that need to be cropped to perfect passport size photos. I have thousands of images that need to be cropped and straightened automatically like this. If the image is too blur and not able to crop I need it to be copied to the rejected folder. I tried to do using haar cascade but this approach is giving me... | 2021/05/10 | [
"https://Stackoverflow.com/questions/67472625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10496449/"
] | Here is one way to extract the photo in Python/OpenCV by keying on the black lines surrounding the image.
Input:
[](https://i.stack.imgur.com/ocZ0f.jpg)
```
- Read the input
- Pad the image with white so that the lines can be extended until inters... | ### The Concept
1. Process each image to enhance the edges of the photos.
2. Get the 4 corners of the photo of each processed image by first finding the contour with the greatest area, getting its convex hull and approximating the convex hull until only 4 points are left.
3. Warp each image according to the 4 corners ... |
19,751 | My provider told me that they cannot give us a separate IP address for a separate website. I understand that they could give us one where an existing address absolutely cannot be reused, like if we had a second virtual server, or required SSL.
Having browsed around, it seems that this isn't really up to them, and is i... | 2011/09/16 | [
"https://webmasters.stackexchange.com/questions/19751",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/5119/"
] | [Hostgator's policy on IPs](http://support.hostgator.com/articles/pre-sales-policies/can-i-get-unlimited-dedicated-ips) is:
>
> Due to the global shortage of IPv4 addresses, although there is no
> limit on the number you may have, we are now required to request
> justification for dedicated IP address requests.
>
... | Contray to what @Bruce Harris & @Cyclops suggest, there are policies in place limiting companies in how they use and allocate to its users IPv4 addresses.
As of February, IANA has no more /8 IP pool to allocate to regional RIR, and as of April for the Asia Pacific region APNIC has run out of freely allocated IPs, with... |
29,385,648 | I keep getting '$scope is not defined' console errors for this controller code in AngularJS:
```
angular.module('articles').controller('ArticlesController', ['$scope', '$routeParams', '$location', 'Authentication', 'Articles',
function($scope, $routeParams, $location, Authentication, Articles){
$sc... | 2015/04/01 | [
"https://Stackoverflow.com/questions/29385648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/743623/"
] | For others who land here from Google, you'll get this error if you forget the quotes around `$scope` when you're annotating the function for minification.
Error
-----
```
app.controller('myCtrl', [$scope, function($scope) {
...
}]);
```
Happy Angular
-------------
```
app.controller('myCtrl', ['$scope', function... | Check scope variable declared after controller defined.
Eg:
```
var app = angular.module('myApp','');
app.controller('customersCtrl', function($scope, $http) {
//define scope variable here.
});
```
Check defined range of controller in view page.
Eg:
```
<div ng-controller="mycontroller">
//scope ... |
7,186,282 | When I SELECT a Geometry column with `AsText()`, the returned value is truncated to 8193 bytes.
This looks like a bug to me, but I'd like to post here first to see if I'm missing anything with the way prepared statements work under MySQLi. Are there any settings I'm overlooking here?
Chances are I either I'm Doing ... | 2011/08/25 | [
"https://Stackoverflow.com/questions/7186282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9867/"
] | It's probably because **$stmt** is not getting un/reset like the other values. It's always returns consistent data when you call it the first time ;) | This issue went away when PHP was upgraded to 5.3.8. |
541,504 | **How i solved it:**
all possible non-distinct groups $(a,b,c)$ are,
$a = 0 \Rightarrow (b,c) = (0,13)(1,12)(2,11)(3,10)(4,9)(5,8)(6,7)$
$a = 1 \Rightarrow (b,c) = (1,11)(2,10)(3,9)(4,8)(5,7)(6,6)$
$a = 2 \Rightarrow (b,c) = (2,9)(3,8)(4,7)(5,6)$
$a = 3 \Rightarrow (b,c) = (3,7)(4,6)(5,5)$
$a = 4 \Rightarrow (b,c... | 2013/10/27 | [
"https://math.stackexchange.com/questions/541504",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/103571/"
] | If you consider different orders equivalent, so that $7^87^37^2$ is considered the same as $7^27^37^8$, you are asking about the number of [partitions](http://en.wikipedia.org/wiki/Partition_%28number_theory%29) of $13$ into $3$ parts, while the stars-and-bars answers give you the number of [compositions](http://en.wik... | In this case, you are distributing 13 into a + b +c.
This can be done by 15C2.
But 15C2 i.e 105 will be considering 1 case more than one time because it will give you ordered pairs or solutions. So, you have to subtract redundant pairs.
You cant do that by dividing it by 3! as every single pair is not present 6 times... |
171,357 | I was looking at some VivaAerobús flight ticket and read that one may check in up to ten days prior to the flight departure:
[](https://i.stack.imgur.com/88DGu.png)
(And the seat can be chosen when purchasing the ticket: "free regular seat selection"... | 2021/12/21 | [
"https://travel.stackexchange.com/questions/171357",
"https://travel.stackexchange.com",
"https://travel.stackexchange.com/users/1810/"
] | One big one: Many airlines use time of check in as a tie-breaker when it comes to issuing upgrades or clearing stand by lists.
Source: worked at an airline, and [quora](https://www.quora.com/Why-should-or-shouldnt-you-check-into-a-flight-early-as-in-online-24-hours-before-your-flight-leaves-Are-there-any-real-reasons-... | For me it's good because I can check-in while I'm thinking about it.
It's just a bit more convenient and gets it out of the way. |
17,038,558 | when i am using `#define` function,I observe something bizarre.
In the below code if I gave `i` value as `'10'` from input `i` got the output as `132`. However if I declare `i=10` by commenting 10,12 and 13 lines then my output is `144`. can anyone explain me how this is happening?
thanks in advance
```
#include <io... | 2013/06/11 | [
"https://Stackoverflow.com/questions/17038558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2413497/"
] | What you have is undefined behaviour.
You `Double(++i)` is changed to `++i * ++i`, when you compile you code. | Macro's have subtleties.
What your macro does is:
`Double(++i) -> ++i*++i`
in your case 11\*12 or 12\*11 |
33,597,949 | I'm using the Bandsintown api to grab upcoming concert dates based on which artists a user is following on my site and where the user is located. Right now I'm having trouble iterating over a multidimensional array of data that I get back as a response.
**The Goal**
To iterate through an array of arrays and then grab... | 2015/11/08 | [
"https://Stackoverflow.com/questions/33597949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3534558/"
] | You can dynamically add new asp:image objects to the form1.
```
Image img = new Image();
img.ImageUrl = dr["Image_Path"].ToString();
img.AlternateText = "Test image";
form1.Controls.Add(img);
``` | The problem is in this statement:
```
Image.ImageUrl = Convert.ToString(dr["Image_Path"]);
```
What does this statement do? It assigns **each** `image path` value to **only one** `Image.ImageUrl`. So, the `Image.ImageUrl` will hold the last assigned `image path`. The result is only one picture will be displayed. Thi... |
59,074,948 | I write a programe in JavaScript where I want to add file "tables.js". There are many tables saved in this file.I want to validate the data in each table.
How can I save each of these tables as a separate variable? var people = ...; var city = ...
Part of tables.js file below.
```
{
people: [{
id: 1,
name:... | 2019/11/27 | [
"https://Stackoverflow.com/questions/59074948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12447160/"
] | I had the same issue. I had follow the instructions to change the default machine folder to the same path as the one set for environment variable for VAGRANT\_HOME
Open VirtualBox
Go to File -> Preferences
In the General tab, change the Default Machine Folder path to an existing path.
Run vagrant up again | you can check PATH below,if has blank or special character, change it.
1. Vagrant install PATH
2. VirtualBox install PATH
3. $VAGRANT\_HOME PATH
4. VirtualBox default Virtual Machine location PATH
Also, free enough space $VAGRANT\_HOME and VirtualBox default Virtual Machine location |
9,746,683 | As the title suggests, I'm having trouble understanding exactly what a pointer is and why they're used. I've searched around a bit but still don't really understand. I'm working in Objective-C mainly, but from what I've read this is really more of a C topic (so I added both tags).
From what I understand, a variable wi... | 2012/03/17 | [
"https://Stackoverflow.com/questions/9746683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1004162/"
] | >
> I don't quite understand why you'd use a pointer to a value instead of
> just using the value itself.
>
>
>
You use a pointer when you want to refer to a specific instance of a value instead of a copy of that value. Say you want me to double some value. You've got two options:
* You can tell me *what* the va... | >
>
> > `NSString *stringVar = @"This is a test.";`
>
>
> When calling methods on this string, why is it a pointer instead of just using the string directly?
>
This is a fairly existential question. I would posit it this way: what ***is*** the string if not its location? How would you implement a system if you c... |
16,855,648 | I have a question about how best to check if a service is still running.
First a bit of clarification. The service I have is a C# application which can either be run from the command line or can be run as a Windows Service. The function of the service is to check for changes to a remote 3rd party data source and proce... | 2013/05/31 | [
"https://Stackoverflow.com/questions/16855648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/422671/"
] | you might want to consider something like a 'heartbeat':
[Heartbeat activity for Windows Service](https://stackoverflow.com/questions/9013737/heartbeat-activity-for-windows-service)
But your main consideration should be working out why your service should be able to stop/hang? All exceptions need to be caught, and at... | you can use **ServiceController** class in .net to monitor services.
I faced the same problem in one of my projects.
I used the below approach to monitor the my service.
* First thing, i logged all the informations,errors from my service to event viewer in a standard format like this
**custom-eventid|datetime|messa... |
24,013,974 | I have written a stored procedure to check the how transaction working in stored procedure.
Is this correct? How can I check this is correct or not?
What I want to do is if second table data not deleted ; both the table data should not be delete.
```
CREATE PROCEDURE DeleteDepartment
(
@DepartmentID int
)
AS
... | 2014/06/03 | [
"https://Stackoverflow.com/questions/24013974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3230466/"
] | ```
CREATE PROCEDURE DeleteDepartment
(
@DepartmentID int
)
AS
BEGIN TRY
BEGIN TRANSACTION
DELETE FROM Employees
WHERE DepartmentID = @DepartmentID
--Test Code Start
--For testing purpose Add an Insert statement with passing value in the identity column.
declare @table1 as table(ID Identity(1,1),Test varchar... | COMMIT is supposed to be before ROLLBACK. and i advice using try/catch blocks
it should look like something like this
```
BEGIN TRY
declare @errorNumber as int
BEGIN TRANSACTION
--do 1st statement
IF @@ERROR<>0
BEGIN
SET @errorNumber=1
END
--do 2nd statement
IF @@ERROR<>0
... |
68,889,663 | I tried this code but it doesn't work.
This is my Html code
```
<div class="left-container1">
<button class="ui button " value="right" id="answer1">yes</button>
<button class="ui button " value="wrong" id="answer2">no</button></div>
</div>
<div class="navigation-controllers ">
<button onclick="displayAns... | 2021/08/23 | [
"https://Stackoverflow.com/questions/68889663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15172308/"
] | I am not an Redis expert but from what I can see:
```
kubectl describe pod red3-redis-master-0
...
Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>
...
```
Means that your appendonly.aof file was corrupted with invalid byte sequences in the mid... | * I think your redis is not quit Gracefully , so the AOF file is in a bad format [What is AOF](https://redis.io/topics/persistence)
* you should repair aof file using a initcontainer by command (./redis-check-aof --fix .)
```
apiVersion: apps/v1
kind: StatefulSet
metadata:
annotations:
meta.helm.sh/release-name:... |
17,056,374 | How to check if a string contains version in numberic/decimal format in shell script
for eg we have 1.2.3.5 or 2.3.5
What if we do not have a constraint on the number of characters we have in here. It could x.x.x.x or x.x as well. | 2013/06/12 | [
"https://Stackoverflow.com/questions/17056374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1057351/"
] | Using [*bash regular expressions*](http://www.linuxtopia.org/online_books/advanced_bash_scripting_guide/x13357.html):
```
echo -n "Test: "
read i
if [[ $i =~ ^[0-9]+(\.[0-9]+){2,3}$ ]];
then
echo Yes
fi
```
This accepts `digits.digits.digits` or `digits.digits.digits.digits`
Change `{2,3}` to shrink or enlarge ... | And if you're truly restricted to the Bourne shell, then use *expr*:
```
if expr 1.2.3.4.5 : '^[0-9][.0-9]*[0-9]$' > /dev/null; then
echo "yep, it's a version number"
fi
```
I'm sure there are solutions involving awk or sed, but this will do. |
70,549,444 | Hello everyone and happy new year,
I had learned on this site to create dictionaries to prepare sections of lists from a property of an object, for example:
```
struct Lieu: Identifiable, Hashable {
var id = UUID().uuidString
var nom: String
var dateAjout = Date()
var img: String
var tag: String
... | 2022/01/01 | [
"https://Stackoverflow.com/questions/70549444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17809663/"
] | Use `read_csv`:
```
>>> pd.read_csv('E:/Tabledata.csv', squeeze=True).tolist()
['DimCurrency',
'DimOrganization',
'DimProduct',
'DimProductCategory',
'DimProductSubcategory',
'DimPromotion']
```
Or you can simply use:
```
lines = [line.strip() for line in open('E:/Tabledata.csv').readlines()][1:]
``` | seems like the content you need is in index column so do this after import data into dataframe.
```
list(df1.index)
```
output:
['DimCurrency', 'DimOrganization', 'DimProduct', 'DimProductCategory', 'DimProductSubcategory', 'DimPromotion'] |
139,238 | I had a 160 GB hard disk with Windows XP. Then I installed Ubuntu 11.10 64bit. But I didn't knew anything about disk partition. After installation, I only have C drive with 20 GB in xp and about 40 GB in Ubuntu. I have The Ubuntu in a DVD.
How do I remove it and get all the space back in Windows XP without losing XP? | 2012/05/19 | [
"https://askubuntu.com/questions/139238",
"https://askubuntu.com",
"https://askubuntu.com/users/64595/"
] | This solution will seem to be worked until you reboot your computer. **Do not try it.**
--> I realised that; that will probably remove grub and Windows will not be able to understand nor rewrite mbr data for "sure".
That means you will lose both OS.
>
> Open your XP.
>
>
> write `diskmgmt.msc` to "Run"
>
>
> Fi... | There are 2 ways you can use:
1. Download a trial of Acronis Disk Director, boot from the CD and increase the size of your partitions. [To download go here and click on free trial](http://www.acronis.eu/homecomputing/products/diskdirector/)
2. Keep Ubuntu installed after you change the partition sizes, and boot from t... |
46,204,112 | I am unable to understand why tensorflow maxpooling with my parameters.
When performed a maxpool with `ksize=2` and `strides=2` i get the following output with both `padding SAME` and `padding VALID`
```
input : (?, 28, 28, 1)
conv2d_out : (?, 28, 28, 32)
maxpool2d_out : (?, 14, 14, 32)
```
But when I try to per... | 2017/09/13 | [
"https://Stackoverflow.com/questions/46204112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275815/"
] | Problem you're facing is `MainViewModel.CurrentDateTime` only gets notified when you assign `MainViewModel.DateTimeModel`, not when `DateTimeModel`'s properties change.
[This is a known Fody limitation](https://github.com/Fody/PropertyChanged/issues/179) and a guy [here found a walkaround](https://github.com/Fody/Prop... | Raise the `PropertyChanged` event for the `CurrentDateTime` of the `MainViewModel` that you bind to whenever the `PropertyChanged` event of the `DateTimeModel` is raised:
```
public class MainViewModel : ViewModelBase, INotifyPropertyChanged
{
public DateTimeModel DateTimeModel;
[DependsOn(nameof(DateTimeMode... |
47,356,453 | I want to schedule a python function to run everyday at a certain time for a list of customers with different timezones.
This is basically what I want to do:
```
import schedule
import time
def job(text):
print("Hello " + text)
def add_job(user_tz, time, text):
schedule.every().day.at(time).do(job(text))
... | 2017/11/17 | [
"https://Stackoverflow.com/questions/47356453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8872639/"
] | The arrow library is great for this, and much simpler than the standard date/time (imo). [arrow docs](http://arrow.readthedocs.io/en/latest/).
```
import arrow
from datetime import datetime
now = datetime.now()
atime = arrow.get(now)
print(now)
print (atime)
eastern = atime.to('US/Eastern')
print (eastern)
print (ea... | The described problem sounds like the [scheduler library](https://gitlab.com/DigonIO/scheduler) for python provides a solution out of the box that requires no further customization by the user.
The scheduler library is designed so that jobs can be scheduled in different timezones, it is irrelevant with which timezone t... |
13,015,698 | It appears that there is no API call to calculate the width (in pixels) of a text string in Java FX 2.2. There have been suggestions of workarounds on other forums, but my efforts to create or find any code that returns the width of a String, either using the default font or otherwise, have failed. Any help would be ap... | 2012/10/22 | [
"https://Stackoverflow.com/questions/13015698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1066408/"
] | I tried this:
```
Text theText = new Text(theLabel.getText());
theText.setFont(theLabel.getFont());
double width = theText.getBoundsInLocal().getWidth();
```
and it seems to be working fine. | ```
Bounds bounds = TextBuilder.create().text(text).font(font).build().getLayoutBounds();
double width=bounds.getWidth();
double height=bounds.getHeight();
``` |
44,806,032 | I am trying to optimize my stored procedure. When I look at the query plan, I can see tablescan on tempcompany is showing 97 percent. I am also seeing the following message Missing index (Impact 97) : Create Non Clustered Index on #tempCompany
I have already set non clustered indexes. Could somebody point out what the ... | 2017/06/28 | [
"https://Stackoverflow.com/questions/44806032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4607841/"
] | Well, firstly what is wrong is you have a ETIMEDOUT error coming from your email call. Are you sure you have all the parameters correct?
Secondly use Promises, rather than callback style, and catch the rejection. Like this,
```
smtpTransport
.sendMail(...)
.then(success => console.log('success: ', success))
.ca... | Maybe is a rejection from GMail, Try Login in to: [https//www.google.com/setti
ngs/security/lesssecureapps](https://www.google.com/settings/security/lesssecureapps) and TURN ON "*Access for less secure apps*".
Or use OAuth. |
239,116 | [This question was asked on [MSE](https://math.stackexchange.com/questions/1788107/on-a-parallelizable-manifold-is-there-always-a-frame-satisfying-x-i-x-j-0), but got no answers, I thought it could be more appropriate here]
Let $M$ be a parallelizable manifold.
1. Is there always a global frame $(X\_i)$ such that $[X... | 2016/05/17 | [
"https://mathoverflow.net/questions/239116",
"https://mathoverflow.net",
"https://mathoverflow.net/users/89425/"
] | Suppose that $M$ is compact, such a frame exists implies that the commutative group $R^n$ acts transitively on it, this implies that $M$ is a torus. But a compact Lie group is parallelizable, so that is not always possible. | On a compact manifold, you have a global frame such that $[X\_i, X\_j]=0$ if and only if your manifold is the torus. Starting from dimension 3, there are parallelisable manifolds different from the torus, possibly the simplest example is $S^3$.
Indeed, the flows of the vector fields generate an action of $R^n$ on the... |
20,835,534 | I was trying to declare a function pointer that points to any function that returns the same type. I omitted the arguments types in the pointer declaration to see what error will be generated. But the program was compiled successfully and executed without any issue.
Is this a correct declaration? Shouldn't we specify ... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20835534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2727656/"
] | Empty parentheses within a type name means unspecified arguments. Note that this is an obsolescent feature.
>
> ### C11(ISO/IEC 9899:201x) §6.11.6 Function declarators
>
>
> The use of function declarators with empty parentheses (not prototype-format parameter
> type declarators) is an obsolescent feature.
>
>
> | `void (*pointer)()` explains function pointed have unspecified number of argument. It is not similar to `void (*pointer)(void)`. So later when you used two arguments that fits successfully according to definition. |
58,867,869 | I tried to run `create-react-app myapp` and everytime it throws an error
I tried to clean the cache by `npm cache clean --force`
but it didn't fix the problem
```
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module './node'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:6... | 2019/11/14 | [
"https://Stackoverflow.com/questions/58867869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4054689/"
] | I was presenting the same problem, until I realized that I had an instance of create-react-app installed globally, apparently this generates a kind of conflict, I solved it as follows:
* Check the npm folder in the following path: C:/Users/username/AppData/Roaming/npm
I noticed that in this npm folder I had executabl... | This is because the create-react-app is not fully deleted from global packages, so to delete it completely `goto 'C:\Users\YOUR_USERNAME\AppData\Roaming\npm'` and **delete** the
**create-react-app.cmd** file
[Picture showing which file to delete](https://i.stack.imgur.com/PukkI.png) |
973,586 | I was disappointed to find that Array.Clone, Array.CopyTo, and Array.Copy can all be beat by a simple 3-line manually coded for(;;) loop:
```
for(int i = 0; i < array.Length; i++)
{
retval[i] = array[i];
}
```
Say the base case for performing an operation a few million times on an array of some p... | 2009/06/10 | [
"https://Stackoverflow.com/questions/973586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Your test may have a wrinkle. A quick look with [Reflector](http://www.red-gate.com/products/reflector/) shows Array.Copy uses an externed implementation (Array.CopyTo ultimately uses the same call):
```
[MethodImpl(MethodImplOptions.InternalCall),
ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
inte... | You didn't mention how large the array being copied was. Perhaps the JIT doesn't specialize Array.Copy and Array.Clone for each type of array, the way it does for generic types. Consequently, the first thing these methods would have to do is examine the array to determine: is it a reference type or a value type, and if... |
62,913,826 | *This is my first post to the coding community, so I hope I get the right level of detail in my request for help!*
Background info:
I want to repeat (loop) command in a df using a variable that contains a list of options. While the series '*amenity\_options*' contains a simple list of specific items (let's say only... | 2020/07/15 | [
"https://Stackoverflow.com/questions/62913826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13848258/"
] | I would recommend `not exists` rather than `not in`; it is `null`-safe, and usually more efficient:
```
select count(distinct charging_id)
from billingdb201908 b
where
b.cdr_type = 'gprso'
and not exists (select 1 from cbs_chrg_id_aug a where a.chargingid = b.chargingid)
``` | There are two dangers with `not in` when the subquery key may contain nulls:
1. If there actually is a null value, you may not get the result you were expecting (as you have found). The database is actually correct, even though nobody in the history of SQL has ever expected this result.
2. Even if all key values are p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.