qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
595,372 | We got
$P\_1 : (1,1,0)$
$P\_2 : (2,2,2)$
$P\_3 : (2,3,1)$
$P\_4 : (3,2,1)$
And should calculate the angle between the normal vector to the triangle of $P\_1, P\_2, P\_3$ and $\boldsymbol{P\_1P\_4}$.
I've started with $P\_1$ in the plane equation to get the normal:
$\pi = 1a+1b+2c=0 \Rightarrow (1,1,-1)$. I think my ... | 2013/12/06 | [
"https://math.stackexchange.com/questions/595372",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/99795/"
] | The plane normal is obtained by:
$$
\boldsymbol{n} = \left(P\_2 - P\_1\right) \times \left(P\_3 - P\_1\right) \\
= (1,1,2)\times(1,2,1) \\
= (-3,1,1) \\
\Rightarrow \hat{\boldsymbol{n}} = \frac{(-3,1,1)}{\sqrt{11}}\\
P\_1P\_4 \equiv \boldsymbol{v} = P\_4 - P\_1 = (2, 1, 1) \Rightarrow \hat{\boldsymbol{v}} = \frac{(2,1,... | This is pretty straightforward . You dont even need to find the equation of the plane to do this calculation . $P\_1P\_2 \times P\_1P\_3$ will give you the direction of the normal vector to the plane that contains the triangle $P\_1P\_2P\_3$ . Then you can use the formula
$$ cos(\theta) =\frac{u\cdot v}{|u||v|} $$ |
48,414,610 | I have a child component:
```
import * as React from 'react';
import Select from 'react-select';
import { Link } from 'react-router-dom';
import { Button } from '../controls/Button/Button';
import { ISelectedItem } from '../../interfaces/ISelectedItem';
import * as service from "../../helpers/service";
export inter... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48414610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3102993/"
] | In windows, use `&` to connect two commands, eg:
```
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "SET NODE_ENV=development& webpack serve --progress --color",
"build": "SET NODE_ENV=production& webpack --progress --color",
"serve-old": "webpack-dev-server --watch"
},
``` | Please change
```
"build": "NODE_ENV=production webpack --progress --colors -p"
```
to
```
"build": "set NODE_ENV=production;webpack --progress --colors -p"
```
or
```
"build": "NODE_ENV=production;webpack --progress --colors -p"
```
The problem is that once you finish a command you need to give a semicolon ... |
48,414,610 | I have a child component:
```
import * as React from 'react';
import Select from 'react-select';
import { Link } from 'react-router-dom';
import { Button } from '../controls/Button/Button';
import { ISelectedItem } from '../../interfaces/ISelectedItem';
import * as service from "../../helpers/service";
export inter... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48414610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3102993/"
] | Production deployments will vary in many ways, but a standard convention when deploying in production is to define an environment variable called **NODE\_ENV** and set its value to "**production**".
For setting NODE\_ENV you can use any of these methods
**method 1: set NODE\_ENV in script attribute of the `package.js... | Please change
```
"build": "NODE_ENV=production webpack --progress --colors -p"
```
to
```
"build": "set NODE_ENV=production;webpack --progress --colors -p"
```
or
```
"build": "NODE_ENV=production;webpack --progress --colors -p"
```
The problem is that once you finish a command you need to give a semicolon ... |
48,414,610 | I have a child component:
```
import * as React from 'react';
import Select from 'react-select';
import { Link } from 'react-router-dom';
import { Button } from '../controls/Button/Button';
import { ISelectedItem } from '../../interfaces/ISelectedItem';
import * as service from "../../helpers/service";
export inter... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48414610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3102993/"
] | In windows, use `&` to connect two commands, eg:
```
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "SET NODE_ENV=development& webpack serve --progress --color",
"build": "SET NODE_ENV=production& webpack --progress --color",
"serve-old": "webpack-dev-server --watch"
},
``` | Production deployments will vary in many ways, but a standard convention when deploying in production is to define an environment variable called **NODE\_ENV** and set its value to "**production**".
For setting NODE\_ENV you can use any of these methods
**method 1: set NODE\_ENV in script attribute of the `package.js... |
16,097,057 | I use the below script to move all the specific files to destination folder. I want to copy the files to destination folder without duplicating.
As I am going to schedule to run the VBS for every 10 minutes, it should not again copy the same files which are already present in the folder.
```
Set fso = CreateObject("S... | 2013/04/19 | [
"https://Stackoverflow.com/questions/16097057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2296527/"
] | The problem here is that you want to copy all source files (including those in sub folders) into 1 destination folder. At this point there are chances that files will have the same file name and you may have files overwritten during the copy or files will be skipped as it will see it as a duplicate.
You're trying to a... | If you want to synchronize folders without creating duplicates and without copying files that already exist in the destination, simply use `robocopy`:
```
robocopy "D:\Movie Keys\License\2013_Apr_19" "D:\env" *.env
```
Or in a [batch](/questions/tagged/batch "show questions tagged 'batch'") script:
```
@echo off
s... |
48,703,979 | I'm having troubles with re.sub. I understand from other answers that this is due to the fact I'm referencing to a capturing group that I don't have.
My question is: how do I adjust my code to have a valid group?
```
s = "hello a world today b is sunny c day"
markers = "a b c".split()
pattern = r'\b' + ' (?:\w+ )?(?:... | 2018/02/09 | [
"https://Stackoverflow.com/questions/48703979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5832773/"
] | You cannot use `\1` replacement backreference if there are no capturing groups in the pattern. Add the capturing group to the pattern:
```
pattern = r'\b(' + ' (?:\w+ )?(?:\w+ )?'.join(markers) + r')\b' # or
^ ^
pattern = r'\b({})\b'.format(r' (?:\w+ )?(?:\w+ )... | You don't have any groups in your regex.
`(?:...)` is a non capture group, I guess you want
```
pattern = r'\b(' + ' (?:\w+ )?(?:\w+ )?'.join(markers) + r')\b'
``` |
48,703,979 | I'm having troubles with re.sub. I understand from other answers that this is due to the fact I'm referencing to a capturing group that I don't have.
My question is: how do I adjust my code to have a valid group?
```
s = "hello a world today b is sunny c day"
markers = "a b c".split()
pattern = r'\b' + ' (?:\w+ )?(?:... | 2018/02/09 | [
"https://Stackoverflow.com/questions/48703979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5832773/"
] | You don't have any groups in your regex.
`(?:...)` is a non capture group, I guess you want
```
pattern = r'\b(' + ' (?:\w+ )?(?:\w+ )?'.join(markers) + r')\b'
``` | This code can get the result what you want.I have tested.
```
import re
s = "hello a world today b is sunny c day"
pat = r'(a.*c)'
result = re.sub(pat,r'<b>\1</b>',s)
``` |
48,703,979 | I'm having troubles with re.sub. I understand from other answers that this is due to the fact I'm referencing to a capturing group that I don't have.
My question is: how do I adjust my code to have a valid group?
```
s = "hello a world today b is sunny c day"
markers = "a b c".split()
pattern = r'\b' + ' (?:\w+ )?(?:... | 2018/02/09 | [
"https://Stackoverflow.com/questions/48703979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5832773/"
] | You cannot use `\1` replacement backreference if there are no capturing groups in the pattern. Add the capturing group to the pattern:
```
pattern = r'\b(' + ' (?:\w+ )?(?:\w+ )?'.join(markers) + r')\b' # or
^ ^
pattern = r'\b({})\b'.format(r' (?:\w+ )?(?:\w+ )... | This code can get the result what you want.I have tested.
```
import re
s = "hello a world today b is sunny c day"
pat = r'(a.*c)'
result = re.sub(pat,r'<b>\1</b>',s)
``` |
13,954,905 | I am new to C++, and haven't quite grasped all the concepts yet, so i am perplexed at why this function does not work. I am currently not at home, so i cannot post the compiler error just yet, i will do it as soon as i get home.
Here is the function.
```
const char * ConvertToChar(std::string input1, std::string inpu... | 2012/12/19 | [
"https://Stackoverflow.com/questions/13954905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031822/"
] | The code returns a pointer to a local (stack) variable. When the caller gets this pointer that local variable doesn't exist any more. This is often called dangling reference.
If you want to convert `std::string` to a c-style string use [`std::string::c_str()`](http://en.cppreference.com/w/cpp/string/basic_string/c_str... | Without knowing what the error is, it's hard to say, but this
line:
```
const char* cstr[80];
```
seems wrong: it creates an array of 80 pointers; when it
implicitly converts to a pointer, the type will be `char
const**`, which should give an error when it is passed as an
argument to `strcpy`, and the dereference in... |
4,720,620 | When orientation changes in landscape mode, start a new activity. After back to this activity when orientation in portrait mode in Android. | 2011/01/18 | [
"https://Stackoverflow.com/questions/4720620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/579396/"
] | Yes this the default behavior of any activity. If you want to stop this you can
- Set the activity `asandroid:configChanges="orientation"`
Then Override the onConfigurationChanged like this
```
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfi... | I think that you can set only one orientation in your app so that you cannot change orientation like written in this [Q&A](https://stackoverflow.com/questions/582185/android-disable-landscape-mode) |
4,720,620 | When orientation changes in landscape mode, start a new activity. After back to this activity when orientation in portrait mode in Android. | 2011/01/18 | [
"https://Stackoverflow.com/questions/4720620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/579396/"
] | In the Android Manifest file xml for your app place this code in there in the activity for the forms that you want. Each form will have its own activity and you can specify which ones that you want to have as landscape. Find the name for the activity listed ".name"
```
<activity android:name=".name"
and... | I think that you can set only one orientation in your app so that you cannot change orientation like written in this [Q&A](https://stackoverflow.com/questions/582185/android-disable-landscape-mode) |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | Actually, `MimeMessage` [does not implement `Serializable` by design](http://www.oracle.com/technetwork/java/javamail/faq-135477.html#serialize), you can extend `MimeMessage` to do so but you do not need to as `MimeMessage` has facilities using [writeTo(OutputStream)](https://javamail.java.net/nonav/docs/api/javax/mail... | `NotSerializableException` is thrown when the Object being serialized does not implement `java.io.Serializable` interface. Since, [javax.mail.internet.MimeMessage](http://docs.oracle.com/javaee/6/api/javax/mail/internet/MimeMessage.html) does not implement this interface it *cannot* be serialized.
```
public class Mim... |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | `NotSerializableException` is thrown when the Object being serialized does not implement `java.io.Serializable` interface. Since, [javax.mail.internet.MimeMessage](http://docs.oracle.com/javaee/6/api/javax/mail/internet/MimeMessage.html) does not implement this interface it *cannot* be serialized.
```
public class Mim... | This has worked for me
***Serialisation***
```cs
var mailMessage = new MimeMessage();
mailMessage.From.Add(new MailboxAddress("from", "email@example.com"));
mailMessage.To.Add(new MailboxAddress("to", "email2@example.com"));
mailMessage.ReplyTo.Add(new MailboxAddress("r... |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | `NotSerializableException` is thrown when the Object being serialized does not implement `java.io.Serializable` interface. Since, [javax.mail.internet.MimeMessage](http://docs.oracle.com/javaee/6/api/javax/mail/internet/MimeMessage.html) does not implement this interface it *cannot* be serialized.
```
public class Mim... | We can create MimeMessage and write it to a ByteArrayOutputStream as below:
```
JavaMailSenderImpl sender = new JavaMailSenderImpl();
MimeMessage message = sender.createMimeMessage();
MimeMailMessage mimeMailMessage = new MimeMailMessage(message);
mimeMailMessage.setTo("To@address.com");
ByteArrayOutputStream bos = n... |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | Actually, `MimeMessage` [does not implement `Serializable` by design](http://www.oracle.com/technetwork/java/javamail/faq-135477.html#serialize), you can extend `MimeMessage` to do so but you do not need to as `MimeMessage` has facilities using [writeTo(OutputStream)](https://javamail.java.net/nonav/docs/api/javax/mail... | As stated in other answers: if you don't need the session information in the MimeMessage you can make use of the `MimeMessage.writeTo` method to store it in a serializable wrapper object. As a template see the following code (Beware, it's not Null-safe).
```
import java.io.ByteArrayInputStream;
import java.io.ByteArra... |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | Actually, `MimeMessage` [does not implement `Serializable` by design](http://www.oracle.com/technetwork/java/javamail/faq-135477.html#serialize), you can extend `MimeMessage` to do so but you do not need to as `MimeMessage` has facilities using [writeTo(OutputStream)](https://javamail.java.net/nonav/docs/api/javax/mail... | This has worked for me
***Serialisation***
```cs
var mailMessage = new MimeMessage();
mailMessage.From.Add(new MailboxAddress("from", "email@example.com"));
mailMessage.To.Add(new MailboxAddress("to", "email2@example.com"));
mailMessage.ReplyTo.Add(new MailboxAddress("r... |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | Actually, `MimeMessage` [does not implement `Serializable` by design](http://www.oracle.com/technetwork/java/javamail/faq-135477.html#serialize), you can extend `MimeMessage` to do so but you do not need to as `MimeMessage` has facilities using [writeTo(OutputStream)](https://javamail.java.net/nonav/docs/api/javax/mail... | We can create MimeMessage and write it to a ByteArrayOutputStream as below:
```
JavaMailSenderImpl sender = new JavaMailSenderImpl();
MimeMessage message = sender.createMimeMessage();
MimeMailMessage mimeMailMessage = new MimeMailMessage(message);
mimeMailMessage.setTo("To@address.com");
ByteArrayOutputStream bos = n... |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | As stated in other answers: if you don't need the session information in the MimeMessage you can make use of the `MimeMessage.writeTo` method to store it in a serializable wrapper object. As a template see the following code (Beware, it's not Null-safe).
```
import java.io.ByteArrayInputStream;
import java.io.ByteArra... | This has worked for me
***Serialisation***
```cs
var mailMessage = new MimeMessage();
mailMessage.From.Add(new MailboxAddress("from", "email@example.com"));
mailMessage.To.Add(new MailboxAddress("to", "email2@example.com"));
mailMessage.ReplyTo.Add(new MailboxAddress("r... |
17,609,046 | I have been trying to serialize a MimeMessage instance, but as I read on web it is not possible. What I want to achieve with serializing a MimeMessage instance is that I want to hash that instance and send it along mail itself. What I coded so far is this:
```
MimeMessage message = new MimeMessage(session);
//...setti... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17609046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813330/"
] | As stated in other answers: if you don't need the session information in the MimeMessage you can make use of the `MimeMessage.writeTo` method to store it in a serializable wrapper object. As a template see the following code (Beware, it's not Null-safe).
```
import java.io.ByteArrayInputStream;
import java.io.ByteArra... | We can create MimeMessage and write it to a ByteArrayOutputStream as below:
```
JavaMailSenderImpl sender = new JavaMailSenderImpl();
MimeMessage message = sender.createMimeMessage();
MimeMailMessage mimeMailMessage = new MimeMailMessage(message);
mimeMailMessage.setTo("To@address.com");
ByteArrayOutputStream bos = n... |
3,904,090 | I'm doing a VB.Net subject at university and the major assignment is the creation of a WPF application.
The application is management-focused (adding, modifying, deleting entries, etc). As these are all rather disparate tasks I'm thinking to create a tabbed interface for my assignment (in a similar vein to Spybot's in... | 2010/10/11 | [
"https://Stackoverflow.com/questions/3904090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394491/"
] | Have you heard about the MVVM pattern ? Have a look at [this article by Josh Smith](http://msdn.microsoft.com/en-us/magazine/dd419663.aspx), the example he uses does something similar to what you want.
If you only want one view to be visible at a time, you can use a `ContentControl` instead of a `TabControl`, and bind... | You can have a look into composite application development, mono addins (can use this for plugin architecture) in combination with a shell. |
231,854 | I want to open files without file name extension, including .dotsystemfiles (e.g. `.htaccess` or `.vimrc`) with a different editor than TextEdit. Doing the regular *Change All...* in the *Get Info* panel won't do the trick as it gives the following error:
 | 2011/01/11 | [
"https://superuser.com/questions/231854",
"https://superuser.com",
"https://superuser.com/users/62434/"
] | You need to change the editor for the `text/plain` mime type or `public.plain-text` UTI. The regular *Get Info* dialog changes the association for the file name extension, which these files don't have.
---
Get [RCDefaultApp](http://www.rubicode.com/Software/RCDefaultApp/) and install it.
Open *System Preferences » D... | You can also run `plutil -convert xml1 ~/Library/Preferences/com.apple.LaunchServices.plist` and add something like this:
```
<dict>
<key>LSHandlerContentType</key>
<string>public.plain-text</string>
<key>LSHandlerRoleAll</key>
<string>com.macromates.textmate</string>
</dict>
<dict>
<key>LSHandlerC... |
231,854 | I want to open files without file name extension, including .dotsystemfiles (e.g. `.htaccess` or `.vimrc`) with a different editor than TextEdit. Doing the regular *Change All...* in the *Get Info* panel won't do the trick as it gives the following error:
 | 2011/01/11 | [
"https://superuser.com/questions/231854",
"https://superuser.com",
"https://superuser.com/users/62434/"
] | You need to change the editor for the `text/plain` mime type or `public.plain-text` UTI. The regular *Get Info* dialog changes the association for the file name extension, which these files don't have.
---
Get [RCDefaultApp](http://www.rubicode.com/Software/RCDefaultApp/) and install it.
Open *System Preferences » D... | RCDefaultApp is sadly no longer available, but [SwiftDefaultApps](https://github.com/Lord-Kamina/SwiftDefaultApps) is a modern replacement. It does not list MIME types, but I found that changing `public/data` on the "Uniform Type Identifiers" pane did the trick for files without an extension. |
231,854 | I want to open files without file name extension, including .dotsystemfiles (e.g. `.htaccess` or `.vimrc`) with a different editor than TextEdit. Doing the regular *Change All...* in the *Get Info* panel won't do the trick as it gives the following error:
 | 2011/01/11 | [
"https://superuser.com/questions/231854",
"https://superuser.com",
"https://superuser.com/users/62434/"
] | You can also run `plutil -convert xml1 ~/Library/Preferences/com.apple.LaunchServices.plist` and add something like this:
```
<dict>
<key>LSHandlerContentType</key>
<string>public.plain-text</string>
<key>LSHandlerRoleAll</key>
<string>com.macromates.textmate</string>
</dict>
<dict>
<key>LSHandlerC... | RCDefaultApp is sadly no longer available, but [SwiftDefaultApps](https://github.com/Lord-Kamina/SwiftDefaultApps) is a modern replacement. It does not list MIME types, but I found that changing `public/data` on the "Uniform Type Identifiers" pane did the trick for files without an extension. |
34,404,728 | I am developing a chat client using Socket.io as a means of communicating with the server. As such, using GCM is not exactly an option.
I want be able to receive chats at any time (even if the application is closed); essentially the socket needs to be listening at all times. I understand that a service can be started ... | 2015/12/21 | [
"https://Stackoverflow.com/questions/34404728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5704973/"
] | You should run one service(e.g. ListenerService) when your application start and inside that service you must start one thread(e.g. ListenerThread). And keep that thread and service alives till your application is in onResume()/onPause(). Through that thread connect your client socket to server. and receive all updates... | GCM is the correct way to handle this. Send the GCM alert to the device and then the user can click it to open your app. At that time you can re-open your socket and get the data needed.
If you ever plan to deploy your app to iOS this is the route you will be taking there. iOS kills your background tasks after 5 minu... |
58,565,280 | I have been trying to come up with a sed command that will pull certain lines from blocks of text separated by a blank line in a file. The blocks of text are as below.
```
# cat test_file.txt
line 1
line 2
line 3
line 4
line 5
line 1
line 2
line 3
line 4
line 5
line 1
line 2
line 3
line 4
line 5
```
I am trying ... | 2019/10/25 | [
"https://Stackoverflow.com/questions/58565280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8657911/"
] | I'd use awk for this, e.g:
```
awk '(!NF&&m=NR)||NR-m==2||NR-m==4' file
``` | This might work for you (GNU sed):
```
sed -n '/\S/{n;p;n;n;p;:a;n;//ba;p}' file
```
Set the `-n` option for explicit printing. Print the second and fourth lines then throw away any non-blank lines and print the first blank one. Repeat. |
58,565,280 | I have been trying to come up with a sed command that will pull certain lines from blocks of text separated by a blank line in a file. The blocks of text are as below.
```
# cat test_file.txt
line 1
line 2
line 3
line 4
line 5
line 1
line 2
line 3
line 4
line 5
line 1
line 2
line 3
line 4
line 5
```
I am trying ... | 2019/10/25 | [
"https://Stackoverflow.com/questions/58565280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8657911/"
] | awks paragraph mode exists specifically to handle blank-line separated records/blocks of text like you're dealing with:
```
$ awk 'BEGIN{RS=""; ORS="\n\n"; FS=OFS="\n"} {print $2, $4}' file
line 2
line 4
line 2
line 4
line 2
line 4
```
Reference [the POSIX standard](https://pubs.opengroup.org/onlinepubs/9699919799... | This might work for you (GNU sed):
```
sed -n '/\S/{n;p;n;n;p;:a;n;//ba;p}' file
```
Set the `-n` option for explicit printing. Print the second and fourth lines then throw away any non-blank lines and print the first blank one. Repeat. |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | You should check out [jQuery](http://www.jquery.com). It has a rich base of [AJAX functionality](http://docs.jquery.com/Ajax) that can give you the power to do all of this. You can load in an external page, and parse it's HTML content with intuitive [CSS-like selectors](http://docs.jquery.com/Selectors).
An example us... | Write a proxy script that forwards along the http request from your domain, this will bypass the XMLHttpRequest restrictions.
If your using PHP, simply use cURL to request and read the page, then simply spit out the html as if it was from you domain. |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | You should check out [jQuery](http://www.jquery.com). It has a rich base of [AJAX functionality](http://docs.jquery.com/Ajax) that can give you the power to do all of this. You can load in an external page, and parse it's HTML content with intuitive [CSS-like selectors](http://docs.jquery.com/Selectors).
An example us... | >
> update 2018:
>
>
>
You can only access cross domain with the following 4 condition
* in response header has `Access-Control-Allow-Origin: *`
Demo
```js
$.ajax({
url: 'https://api.myjson.com/bins/bq6eu',
success: function(response){
console.log(response.string);
},
error: function(response){... |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | You should check out [jQuery](http://www.jquery.com). It has a rich base of [AJAX functionality](http://docs.jquery.com/Ajax) that can give you the power to do all of this. You can load in an external page, and parse it's HTML content with intuitive [CSS-like selectors](http://docs.jquery.com/Selectors).
An example us... | You will need to write a proxy on the server to do this. And all requests will be to your server and then your server will load html and send it back to client. And there are no good way to implement this via javascript only.
jQuery contains functionality to load JSON data or external scripts using XmlHttpRequest bu... |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | You can also use a iframe to emulate an ajax request. This saves you the mess of having to code a Backend solution for a Frontend problem. Here is an example:
```
function setUploadEvent(typeComponet){
var eventType = "";
var iframe = document.getElementById("iframeId");
try{
/* for Moz... | Thanks a lot, this is really a good trick. I did in this way:
test.html
```
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Micros... |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | >
> update 2018:
>
>
>
You can only access cross domain with the following 4 condition
* in response header has `Access-Control-Allow-Origin: *`
Demo
```js
$.ajax({
url: 'https://api.myjson.com/bins/bq6eu',
success: function(response){
console.log(response.string);
},
error: function(response){... | You can also use a iframe to emulate an ajax request. This saves you the mess of having to code a Backend solution for a Frontend problem. Here is an example:
```
function setUploadEvent(typeComponet){
var eventType = "";
var iframe = document.getElementById("iframeId");
try{
/* for Moz... |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | Write a proxy script that forwards along the http request from your domain, this will bypass the XMLHttpRequest restrictions.
If your using PHP, simply use cURL to request and read the page, then simply spit out the html as if it was from you domain. | Thanks a lot, this is really a good trick. I did in this way:
test.html
```
<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Micros... |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | You should check out [jQuery](http://www.jquery.com). It has a rich base of [AJAX functionality](http://docs.jquery.com/Ajax) that can give you the power to do all of this. You can load in an external page, and parse it's HTML content with intuitive [CSS-like selectors](http://docs.jquery.com/Selectors).
An example us... | You can also use a iframe to emulate an ajax request. This saves you the mess of having to code a Backend solution for a Frontend problem. Here is an example:
```
function setUploadEvent(typeComponet){
var eventType = "";
var iframe = document.getElementById("iframeId");
try{
/* for Moz... |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | You can also use a iframe to emulate an ajax request. This saves you the mess of having to code a Backend solution for a Frontend problem. Here is an example:
```
function setUploadEvent(typeComponet){
var eventType = "";
var iframe = document.getElementById("iframeId");
try{
/* for Moz... | You will need to write a proxy on the server to do this. And all requests will be to your server and then your server will load html and send it back to client. And there are no good way to implement this via javascript only.
jQuery contains functionality to load JSON data or external scripts using XmlHttpRequest bu... |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | Write a proxy script that forwards along the http request from your domain, this will bypass the XMLHttpRequest restrictions.
If your using PHP, simply use cURL to request and read the page, then simply spit out the html as if it was from you domain. | <script language="JavaScript" type="text/javascript" src="http://www.example.com/hello.js"></script>
You add the data into hello.js in as an array, JSON or similar. Example:
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
Getting a JavaScript from another server doesn't much simpler.. :-) |
578,095 | How can I make requests to other server(s) (i.e. get a page from any desired server) with a JavaScript within the user's browser? There are limitations in place to prevent this for methods like XMLHttpRequest, are there ways to bypass them or other methods?
That is a general question, specifically I want to check a se... | 2009/02/23 | [
"https://Stackoverflow.com/questions/578095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46665/"
] | >
> update 2018:
>
>
>
You can only access cross domain with the following 4 condition
* in response header has `Access-Control-Allow-Origin: *`
Demo
```js
$.ajax({
url: 'https://api.myjson.com/bins/bq6eu',
success: function(response){
console.log(response.string);
},
error: function(response){... | Write a proxy script that forwards along the http request from your domain, this will bypass the XMLHttpRequest restrictions.
If your using PHP, simply use cURL to request and read the page, then simply spit out the html as if it was from you domain. |
4,312,823 | At the begining I would like to say hello, so ... Hello. I need to create a nested object structure.
I've got an object (xaml page) like this
```
<navigation:Page x:Class="ItemTemplateExample.ContentItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524991/"
] | Use the Find and Replace dialog (`Ctrl` + `H`). Search for
```
\n\n
```
and replace with
```
\n
```
using regular expressions (expand the Find Options section to enable).
If you want to remove lines containing nothing but whitespace you could try searching for
```
\n\s*\n+
``` | I don't think there is any. You can use a separate refactoring add-in to automate this, such as [ReSharper](http://en.wikipedia.org/wiki/ReSharper). |
4,312,823 | At the begining I would like to say hello, so ... Hello. I need to create a nested object structure.
I've got an object (xaml page) like this
```
<navigation:Page x:Class="ItemTemplateExample.ContentItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524991/"
] | [CodeMaid](http://visualstudiogallery.msdn.microsoft.com/en-us/76293c4d-8c16-4f4a-aee6-21f83a571496) has a setting that automatically removes empty lines (when you save the file, I think) according to some configurable rules. I think it makes the files quite neat. | I don't think there is any. You can use a separate refactoring add-in to automate this, such as [ReSharper](http://en.wikipedia.org/wiki/ReSharper). |
4,312,823 | At the begining I would like to say hello, so ... Hello. I need to create a nested object structure.
I've got an object (xaml page) like this
```
<navigation:Page x:Class="ItemTemplateExample.ContentItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524991/"
] | Use the Find and Replace dialog (`Ctrl` + `H`). Search for
```
\n\n
```
and replace with
```
\n
```
using regular expressions (expand the Find Options section to enable).
If you want to remove lines containing nothing but whitespace you could try searching for
```
\n\s*\n+
``` | [CodeMaid](http://visualstudiogallery.msdn.microsoft.com/en-us/76293c4d-8c16-4f4a-aee6-21f83a571496) has a setting that automatically removes empty lines (when you save the file, I think) according to some configurable rules. I think it makes the files quite neat. |
4,312,823 | At the begining I would like to say hello, so ... Hello. I need to create a nested object structure.
I've got an object (xaml page) like this
```
<navigation:Page x:Class="ItemTemplateExample.ContentItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524991/"
] | Use the Find and Replace dialog (`Ctrl` + `H`). Search for
```
\n\n
```
and replace with
```
\n
```
using regular expressions (expand the Find Options section to enable).
If you want to remove lines containing nothing but whitespace you could try searching for
```
\n\s*\n+
``` | In the Visual Studio options, under Text Editor -> General, there's an option "Apply Cut and Copy commands to blank lines when there is no selection". If you check this, `Ctrl` + `X` will remove a blank line. |
4,312,823 | At the begining I would like to say hello, so ... Hello. I need to create a nested object structure.
I've got an object (xaml page) like this
```
<navigation:Page x:Class="ItemTemplateExample.ContentItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4312823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524991/"
] | [CodeMaid](http://visualstudiogallery.msdn.microsoft.com/en-us/76293c4d-8c16-4f4a-aee6-21f83a571496) has a setting that automatically removes empty lines (when you save the file, I think) according to some configurable rules. I think it makes the files quite neat. | In the Visual Studio options, under Text Editor -> General, there's an option "Apply Cut and Copy commands to blank lines when there is no selection". If you check this, `Ctrl` + `X` will remove a blank line. |
133,923 | When a post other than a question is revised (edited or a new answer posted), the "revised" timestamp on the Questions page is a link that takes you right to the post which was edited; useful and logical.
For some reason, when the revised post was the question (like when the question is first posted or an edit has bee... | 2012/05/29 | [
"https://meta.stackexchange.com/questions/133923",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/166936/"
] | This is already the case. The timestamp is only then not a link if there are no answers at all. If you e.g. look at this very question on the homepage, you'll see that the timestamp is indeed a link, and it ends up on the question itself.
But, for the sake of consistency, the timestamp will now be a direct link to the... | I hope they assume that when you ask question you are more cleared about it rather than while you are giving answer(You can misunderstood problem sometimes and give answer).
So any changes to answer (Either revise or edit) it will lead you to answer to see the changes so that you get exact solution to your problem and... |
59,621,847 | I have this Biometrics, but it gives me the completely wrong output - the different *userid* and the *verify date* at year 2132.
What can be causing such wrong information?
I couldn't find any similar problem on Internet. Does anyone else have encountered the same problem like mine?
---
C# Code:
```
if ... | 2020/01/07 | [
"https://Stackoverflow.com/questions/59621847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8444564/"
] | That is not how you should construct DateTime objects. Try using [this constructor](https://learn.microsoft.com/en-us/dotnet/api/system.datetime.-ctor?view=netframework-4.8#System_DateTime__ctor_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_System_Globalization_Calendar_) to construct th... | The date and time at machine must be wrong. |
957,513 | **Note: I am using the Gnome desktop environment**
My laptop keyboard has only the keys it needs, and few of the normal compose keys available. I use them all.
I'd like to set the compose key to `End`, but it's not on the list in Gnome Tweak Tool:
[]... | 2017/09/19 | [
"https://askubuntu.com/questions/957513",
"https://askubuntu.com",
"https://askubuntu.com/users/457562/"
] | I solved the problem with help from [@chaskes](https://askubuntu.com/users/117123/chaskes):
```
xmodmap -e "keycode 115 = Multi_key End"
```
remapped the first level of `End` to the compose key, but allows me to press `Shift`-`End` to send an actual `End` keypress.
I made this permanent by putting it in my `~/.xinit... | On my system, the *insert* key is totally useless. Touching it could only create typing errors. And the name makes sense for a Compose key.
xev told me that the *insert* key is keycode 118.
So my ~/.xmodmap is 2 lines:
```
keycode 118 = Multi_key
! Insert key is Compose key.
```
And for backup, I execute this in ... |
29,338,987 | I have a excel with multiple tabs and the name of the sheets coming as
>
> sheet0, sheet1, .... sheet10
>
>
>
I wanted to rename those tabs how to do it in UNIX shell using **ksh** or **bash**.
Please note that by tabs of excel , my context is the name of excel sheet that is getting displayed at bottom of excel... | 2015/03/30 | [
"https://Stackoverflow.com/questions/29338987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4728299/"
] | Give this a try:
```
// Display confirmation dialog
$('td a.delete-slideshow-image').click(function (e) {
window.tr = $(this).parents('tr'); // store the 'TR' in a global variable, no need for the keyword 'var'
var imageId = $(this).data('id'); // use data-id='$image_id' in your HTML table
... | As you said that you are generating table dynamically so what is happening over there. Jquery ready function bind the events on elements after DOM loaded, in your case it could not bind event on your target elements. Try to change the syntax of click event like as below.
```
$(document).on('click','td a.delete-slidesh... |
221,507 | My question is should I use *was* or *were* in the following sentence:
>
> ...this is one of the messages, which *was*/*were* sent in the space 37 years ago.
>
>
>
Which one I should use? | 2015/01/14 | [
"https://english.stackexchange.com/questions/221507",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/106166/"
] | It depends on which noun or nouns the phrase "went into space" is modifying.
If a number of messages went into space and this is one of them then the verb belongs to 'messages' and is 'were'. If there were a number of messages and this one alone went into space, then the verb belongs to 'one' and is 'was'. Either your ... | I would normally use the expression **“one of”** with a plural noun.
Reason:
It could be a group of people or things. *“One of”* informs the listener that you are talking about one member *of the group.*
Since you are talking about **one message of the many messages**, you use a singular verb after the plural noun... |
17,897 | I am using WordPress, and when I post some post data into my WordPress post, including some html code, as follows:
```
<code><div id="access"></div></code>
```
I want the code to be displayed, but the code is not displayed.
How can I make it work? | 2011/05/21 | [
"https://wordpress.stackexchange.com/questions/17897",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11893/"
] | You have to escape the `<` and `>` signs with their HTML entities:
```
<div id="access"></div>
```
Now, the browser doesn't render the code inside of the `<code>` blocks. | Try this plugin, [Preserve Code Formatting](http://wordpress.org/extend/plugins/preserve-code-formatting/), Wordpress will tend to strip some html tags.
Or you can character encode your html tags. |
17,897 | I am using WordPress, and when I post some post data into my WordPress post, including some html code, as follows:
```
<code><div id="access"></div></code>
```
I want the code to be displayed, but the code is not displayed.
How can I make it work? | 2011/05/21 | [
"https://wordpress.stackexchange.com/questions/17897",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11893/"
] | You have to escape the `<` and `>` signs with their HTML entities:
```
<div id="access"></div>
```
Now, the browser doesn't render the code inside of the `<code>` blocks. | If it is not display correctly and shows up as regular paragraph text. You would have to format the `<code>` property within your style sheet *if* it is not yet styled.
Here is an example
```
code {font-family:lucida console}
``` |
17,897 | I am using WordPress, and when I post some post data into my WordPress post, including some html code, as follows:
```
<code><div id="access"></div></code>
```
I want the code to be displayed, but the code is not displayed.
How can I make it work? | 2011/05/21 | [
"https://wordpress.stackexchange.com/questions/17897",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11893/"
] | [Syntax Highlighter Evolved](http://wordpress.org/extend/plugins/syntaxhighlighter/) is the best plugin to use IMHO. | Try this plugin, [Preserve Code Formatting](http://wordpress.org/extend/plugins/preserve-code-formatting/), Wordpress will tend to strip some html tags.
Or you can character encode your html tags. |
17,897 | I am using WordPress, and when I post some post data into my WordPress post, including some html code, as follows:
```
<code><div id="access"></div></code>
```
I want the code to be displayed, but the code is not displayed.
How can I make it work? | 2011/05/21 | [
"https://wordpress.stackexchange.com/questions/17897",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/11893/"
] | [Syntax Highlighter Evolved](http://wordpress.org/extend/plugins/syntaxhighlighter/) is the best plugin to use IMHO. | If it is not display correctly and shows up as regular paragraph text. You would have to format the `<code>` property within your style sheet *if* it is not yet styled.
Here is an example
```
code {font-family:lucida console}
``` |
29,293,212 | I have start to learning how to test properly on controller and encounter this following script.
<http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-karma.html>
```
it('should have a properly working VideosCtrl controller', inject(function($rootScope, $controller, $httpBackend) {
var search... | 2015/03/27 | [
"https://Stackoverflow.com/questions/29293212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/409275/"
] | Without changing the outer loop, you only need to change the inner loop to :
```
for (int c = BASE_SIZE; c > r; c--)
```
So :
```
for (int r = 0; r < BASE_SIZE; r++)
{
for (int c = BASE_SIZE; c > r; c--)
{
System.out.print("*");
}
System.out.println();
}
``` | ```
for(int c = r ; c > 0 ; c--)
System.out.print("*");
``` |
29,293,212 | I have start to learning how to test properly on controller and encounter this following script.
<http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-karma.html>
```
it('should have a properly working VideosCtrl controller', inject(function($rootScope, $controller, $httpBackend) {
var search... | 2015/03/27 | [
"https://Stackoverflow.com/questions/29293212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/409275/"
] | I would implement it with a [`StringBuilder`](http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html). Start with the longest line, and in a loop subtract one character until the `StringBuilder` is empty. Something like
```
StringBuilder sb = new StringBuilder("*******");
while (sb.length() > 0) {
S... | ```
for(int c = r ; c > 0 ; c--)
System.out.print("*");
``` |
29,293,212 | I have start to learning how to test properly on controller and encounter this following script.
<http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-karma.html>
```
it('should have a properly working VideosCtrl controller', inject(function($rootScope, $controller, $httpBackend) {
var search... | 2015/03/27 | [
"https://Stackoverflow.com/questions/29293212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/409275/"
] | I would implement it with a [`StringBuilder`](http://docs.oracle.com/javase/7/docs/api/java/lang/StringBuilder.html). Start with the longest line, and in a loop subtract one character until the `StringBuilder` is empty. Something like
```
StringBuilder sb = new StringBuilder("*******");
while (sb.length() > 0) {
S... | Without changing the outer loop, you only need to change the inner loop to :
```
for (int c = BASE_SIZE; c > r; c--)
```
So :
```
for (int r = 0; r < BASE_SIZE; r++)
{
for (int c = BASE_SIZE; c > r; c--)
{
System.out.print("*");
}
System.out.println();
}
``` |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I found that if you program a pause of 1 or 2 seconds (using time.sleep), then it is able to locate the image. It also takes time for python to locate the image (my computer took about 5 seconds). | I think that the library pyautogui needs several recognition points. For example, Number seven on calculator:
[](https://i.stack.imgur.com/rSZ5a.png)
The number seven on the calculator of windows 10. In this format, I´ve got the location on the scree... |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I was encountering the same problem, what I did is
```
import pyautogui
r= None
while r is None:
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
```
I think its just because that it takes time to locate image. If you found a better solution share with me :) | I think that the library pyautogui needs several recognition points. For example, Number seven on calculator:
[](https://i.stack.imgur.com/rSZ5a.png)
The number seven on the calculator of windows 10. In this format, I´ve got the location on the scree... |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I had same issue and kept returning None value.
I did several trials and found the solution for me.
OS : MacOS
I saved photo with my system screenshot tool ( command+shift+5) and saved. it seems it's different pixel info as what it's displayed in my screen.
Therefore I used pyautogui screenshot instead to save the ph... | I am sure most of you guys know this, but if you forget to run your python script or IDE (wether that be Visual Studio, Python IDLE, etc.) as an administrator, then pyautogui will not be able to use the click command. It will still be able to move the mouse around, but it just won’t be able to click (this is true for a... |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | The official [documentation](https://pyautogui.readthedocs.io/en/latest/screenshot.html) says;
```
The Locate Functions
NOTE: As of version 0.9.41, if the locate functions can’t find the provided image,
they’ll raise ImageNotFoundException instead of returning None.
```
So you can decide whether an exception was ra... | If you have taken screenshot with snipping tool it wont work, so take screenshot with "prt sc" or command prompt. This worked for me! |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I had the similar problem.
My fault was I had saved the compare picture as jpg first and then as png in MS paint.
Be sure to save the compare picture as png format. After this the Locate function worked for me. | I got this working by using the following:
```
r = None
while r is None:
r = pyautogui.locateOnScreen('rbin.PNG', grayscale = True)
print icon_to_click + ' now loaded'
```
The key is to make grayscale = True. |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I had same issue and kept returning None value.
I did several trials and found the solution for me.
OS : MacOS
I saved photo with my system screenshot tool ( command+shift+5) and saved. it seems it's different pixel info as what it's displayed in my screen.
Therefore I used pyautogui screenshot instead to save the ph... | If you have taken screenshot with snipping tool it wont work, so take screenshot with "prt sc" or command prompt. This worked for me! |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | It has to be a pixel-perfect match in order to be found. To allow for any sort of deviance you can invoke a confidence parameter.
For example:
```
loc = pyautogui.locateOnScreen(image, grayscale=True, confidence=.5)
```
However, in order to use the confidence parameter you have to have opencv\_python installed. Thi... | Before
```
import pyautogui
image = '9.png'
loc = pyautogui.locateOnScreen(image, grayscale=True, confidence=.5)
print (loc)
```
Error:
```
None
>>>
```
Solution
```
import pyautogui
import time
time.sleep(5)
image = '9.png'
loc = pyautogui.locateOnScreen(image, grayscale=True, confidence=.5)
print (loc)
```
S... |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I found that if you program a pause of 1 or 2 seconds (using time.sleep), then it is able to locate the image. It also takes time for python to locate the image (my computer took about 5 seconds). | I found a way to fix my problem. Only search for an image as small as possible. A picture that is only 1 pixel is found after 3 seconds. And when i try to search for an image over 500x500 then it won't find anything. |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I had the similar problem.
My fault was I had saved the compare picture as jpg first and then as png in MS paint.
Be sure to save the compare picture as png format. After this the Locate function worked for me. | I found that if you program a pause of 1 or 2 seconds (using time.sleep), then it is able to locate the image. It also takes time for python to locate the image (my computer took about 5 seconds). |
43,702,511 | Here's the code that I'm trying to run:
```
import pyautogui
r=pyautogui.locateOnScreen('C:\Users\David\Desktop\index.png',grayscale=False)
print r
``` | 2017/04/30 | [
"https://Stackoverflow.com/questions/43702511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6660758/"
] | I got this working by using the following:
```
r = None
while r is None:
r = pyautogui.locateOnScreen('rbin.PNG', grayscale = True)
print icon_to_click + ' now loaded'
```
The key is to make grayscale = True. | I am sure most of you guys know this, but if you forget to run your python script or IDE (wether that be Visual Studio, Python IDLE, etc.) as an administrator, then pyautogui will not be able to use the click command. It will still be able to move the mouse around, but it just won’t be able to click (this is true for a... |
179,664 | I would like to import a csv file into an empty table in SQL Server Developer 2016, using Task Wizard. I know with BULK INSERT there are options to specify firstrow and lastrow; does Import Wizard have a similar feature? | 2017/07/12 | [
"https://dba.stackexchange.com/questions/179664",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/129498/"
] | If the intention is to build a *relational* database, it is really helpful to first carry out (a) an analysis of the business context of interest —in order to delineate a *conceptual* schema— in terms of *entity types*, inspecting their *properties* and *associations* before (b) thinking in terms of tables, columns and... | Adding the account table doesn't appear to change the fundamental issue.
In TransferHistory, you could have TransferFrom and TransferFromType, where TransferFrom is either a Member or an Organization ID value, and TransferFromType is "M" or "O". You can't use foreign keys at all here, and would have to maintain refere... |
3,048,340 | >
> **Possible Duplicate:**
>
> [Are database triggers evil?](https://stackoverflow.com/questions/460316/are-database-triggers-evil)
>
>
>
There is lot of negative information on database triggers, just want to get the community's take on when is it good vs bad. | 2010/06/15 | [
"https://Stackoverflow.com/questions/3048340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1748769/"
] | I think they're OK when they are used to populate a separate, one-off set of tables for things like logging, aggregation etc. for security or creating metadata for example.
When you start altering your "live" data or "looping back" into your biz info tables, that's when they become evil and unwieldy. They are also utt... | Because they're "magic". They aren't very visible and they can do lots of work.
I've seen good developers take a lot of time trying to track down issues that are trigger related because they just didn't think to look for them. Also, they are very rarely needed. |
3,048,340 | >
> **Possible Duplicate:**
>
> [Are database triggers evil?](https://stackoverflow.com/questions/460316/are-database-triggers-evil)
>
>
>
There is lot of negative information on database triggers, just want to get the community's take on when is it good vs bad. | 2010/06/15 | [
"https://Stackoverflow.com/questions/3048340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1748769/"
] | Because they're "magic". They aren't very visible and they can do lots of work.
I've seen good developers take a lot of time trying to track down issues that are trigger related because they just didn't think to look for them. Also, they are very rarely needed. | Here are a few articles that should help you figure out by yourself for your needs.
1. [Pros and Cons of Triggers vs. Stored Procedures for Denormalization](https://stackoverflow.com/questions/2088905/pros-and-cons-of-triggers-vs-stored-procedures-for-denormalization) (SO question) ;
2. [Choice Between Stored Procedur... |
3,048,340 | >
> **Possible Duplicate:**
>
> [Are database triggers evil?](https://stackoverflow.com/questions/460316/are-database-triggers-evil)
>
>
>
There is lot of negative information on database triggers, just want to get the community's take on when is it good vs bad. | 2010/06/15 | [
"https://Stackoverflow.com/questions/3048340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1748769/"
] | I think they're OK when they are used to populate a separate, one-off set of tables for things like logging, aggregation etc. for security or creating metadata for example.
When you start altering your "live" data or "looping back" into your biz info tables, that's when they become evil and unwieldy. They are also utt... | Database triggers are bad when they are used when other features are more appropriate.
Features which should be considered before attempting to use triggers:
Check constraints
Foreign key constraints
Unique indexes/constraints
(Persisted) computed columns
(Indexed) Views (if a trigger is attempting something like... |
3,048,340 | >
> **Possible Duplicate:**
>
> [Are database triggers evil?](https://stackoverflow.com/questions/460316/are-database-triggers-evil)
>
>
>
There is lot of negative information on database triggers, just want to get the community's take on when is it good vs bad. | 2010/06/15 | [
"https://Stackoverflow.com/questions/3048340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1748769/"
] | I think they're OK when they are used to populate a separate, one-off set of tables for things like logging, aggregation etc. for security or creating metadata for example.
When you start altering your "live" data or "looping back" into your biz info tables, that's when they become evil and unwieldy. They are also utt... | Here are a few articles that should help you figure out by yourself for your needs.
1. [Pros and Cons of Triggers vs. Stored Procedures for Denormalization](https://stackoverflow.com/questions/2088905/pros-and-cons-of-triggers-vs-stored-procedures-for-denormalization) (SO question) ;
2. [Choice Between Stored Procedur... |
3,048,340 | >
> **Possible Duplicate:**
>
> [Are database triggers evil?](https://stackoverflow.com/questions/460316/are-database-triggers-evil)
>
>
>
There is lot of negative information on database triggers, just want to get the community's take on when is it good vs bad. | 2010/06/15 | [
"https://Stackoverflow.com/questions/3048340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1748769/"
] | Database triggers are bad when they are used when other features are more appropriate.
Features which should be considered before attempting to use triggers:
Check constraints
Foreign key constraints
Unique indexes/constraints
(Persisted) computed columns
(Indexed) Views (if a trigger is attempting something like... | Here are a few articles that should help you figure out by yourself for your needs.
1. [Pros and Cons of Triggers vs. Stored Procedures for Denormalization](https://stackoverflow.com/questions/2088905/pros-and-cons-of-triggers-vs-stored-procedures-for-denormalization) (SO question) ;
2. [Choice Between Stored Procedur... |
23,930,739 | I am developing a simple windows phone 8 application.
I do not use `MVVM`, it is very simple.
I have a button, and when I press it I want to add some data into the database (using the post method).
The web `API` is made in `asp.net` and it works properly because I tested with `fiddler`, and also with a console... | 2014/05/29 | [
"https://Stackoverflow.com/questions/23930739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3383324/"
] | By default the `XmlMediaTypeFormmatter` of Web API uses the `DataContractSerializer`.
When this serializer serializes auto-properties, it adds the infamous `xxx_BackingField` to the serialized properties. To avoid this you can do two different things:
* decorate all the autoproperties with `[DataMember]`, and keep us... | When `Serializable` Attribute is required I always return an anonymous type.
```
public dynamic Me()
{
var user = new LoggedInUser() { FirstName = "Test" };
return new {FirstName = user.FirstName};
}
``` |
169,828 | The Cambridge dictionary says:
>
> "Prepositional verbs have two parts: a verb and a preposition which
> **cannot** be separated from each other."
>
>
>
If they cannot be separated, does it mean that we can't put a verb's preposition at the beginning?
>
> **At what** are you looking?
>
>
> **After whom** a... | 2018/06/19 | [
"https://ell.stackexchange.com/questions/169828",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/76388/"
] | You're confusing prepositions and "prepositional verbs".
>
> Multi-word verbs are verbs which consist of a verb and one or two particles or prepositions (e.g. up, over, in, down). There are three
> types of multi-word verbs: **phrasal verbs, prepositional verbs and
> phrasal-prepositional verbs**. Sometimes, the na... | These are the sort of sentences that I would expect to see from people who adhere to the false notion that 'you should never end a sentence with a preposition'. The people who adhere to that "rule" would possibly say these sentences are correct. I agree with you, they are weird.
In normal English these sentences woul... |
29,159 | Can anyone recommend an iOS email client (Exchange/ActiveSync or IMAP... preferably both) that supports really sweet email signatures? Our company email signature has an official format that has a base64 encoded image and a standardized font/color.
Please, throw me some suggestions! | 2011/10/25 | [
"https://apple.stackexchange.com/questions/29159",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/12770/"
] | **[Sparrow](http://sparrowmailapp.com/)** is now available for the iPhone, and it supports IMAP.
The app description does not mention exchange, and it specifically says that there's no POP support, but being that it's such a popular mail client, I figured it's worth mentioning.
Disclaimer: I've never used it either... | [Moxier](http://www.moxier.com/)
--------------------------------
This is an email client which supports Exchange ActiveSync in the AppStore. But I'm not sure it supports sweet email signatures. |
29,159 | Can anyone recommend an iOS email client (Exchange/ActiveSync or IMAP... preferably both) that supports really sweet email signatures? Our company email signature has an official format that has a base64 encoded image and a standardized font/color.
Please, throw me some suggestions! | 2011/10/25 | [
"https://apple.stackexchange.com/questions/29159",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/12770/"
] | [Moxier](http://www.moxier.com/)
--------------------------------
This is an email client which supports Exchange ActiveSync in the AppStore. But I'm not sure it supports sweet email signatures. | Outlook Mail is pretty good and supports signatures. The problem I've run into is that it doesn't support saved searches (As far as I can Tell) or unread search. |
29,159 | Can anyone recommend an iOS email client (Exchange/ActiveSync or IMAP... preferably both) that supports really sweet email signatures? Our company email signature has an official format that has a base64 encoded image and a standardized font/color.
Please, throw me some suggestions! | 2011/10/25 | [
"https://apple.stackexchange.com/questions/29159",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/12770/"
] | [Moxier](http://www.moxier.com/)
--------------------------------
This is an email client which supports Exchange ActiveSync in the AppStore. But I'm not sure it supports sweet email signatures. | Try "Touchdown" for iOS, available in the App Store. |
29,159 | Can anyone recommend an iOS email client (Exchange/ActiveSync or IMAP... preferably both) that supports really sweet email signatures? Our company email signature has an official format that has a base64 encoded image and a standardized font/color.
Please, throw me some suggestions! | 2011/10/25 | [
"https://apple.stackexchange.com/questions/29159",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/12770/"
] | [Moxier](http://www.moxier.com/)
--------------------------------
This is an email client which supports Exchange ActiveSync in the AppStore. But I'm not sure it supports sweet email signatures. | try Mail+ for Outlook by iKonic Apps...best email client out there |
29,159 | Can anyone recommend an iOS email client (Exchange/ActiveSync or IMAP... preferably both) that supports really sweet email signatures? Our company email signature has an official format that has a base64 encoded image and a standardized font/color.
Please, throw me some suggestions! | 2011/10/25 | [
"https://apple.stackexchange.com/questions/29159",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/12770/"
] | **[Sparrow](http://sparrowmailapp.com/)** is now available for the iPhone, and it supports IMAP.
The app description does not mention exchange, and it specifically says that there's no POP support, but being that it's such a popular mail client, I figured it's worth mentioning.
Disclaimer: I've never used it either... | Outlook Mail is pretty good and supports signatures. The problem I've run into is that it doesn't support saved searches (As far as I can Tell) or unread search. |
29,159 | Can anyone recommend an iOS email client (Exchange/ActiveSync or IMAP... preferably both) that supports really sweet email signatures? Our company email signature has an official format that has a base64 encoded image and a standardized font/color.
Please, throw me some suggestions! | 2011/10/25 | [
"https://apple.stackexchange.com/questions/29159",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/12770/"
] | **[Sparrow](http://sparrowmailapp.com/)** is now available for the iPhone, and it supports IMAP.
The app description does not mention exchange, and it specifically says that there's no POP support, but being that it's such a popular mail client, I figured it's worth mentioning.
Disclaimer: I've never used it either... | Try "Touchdown" for iOS, available in the App Store. |
29,159 | Can anyone recommend an iOS email client (Exchange/ActiveSync or IMAP... preferably both) that supports really sweet email signatures? Our company email signature has an official format that has a base64 encoded image and a standardized font/color.
Please, throw me some suggestions! | 2011/10/25 | [
"https://apple.stackexchange.com/questions/29159",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/12770/"
] | **[Sparrow](http://sparrowmailapp.com/)** is now available for the iPhone, and it supports IMAP.
The app description does not mention exchange, and it specifically says that there's no POP support, but being that it's such a popular mail client, I figured it's worth mentioning.
Disclaimer: I've never used it either... | try Mail+ for Outlook by iKonic Apps...best email client out there |
8,510,464 | If you have a property in your public interface like the following
```
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
```
And then synthesize it, in effect synthesizing the variable:
```
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
```... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8510464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106658/"
] | A synthesized ivar is *completely invisible* to all code that cannot see the `@synthesize` line (which basically means anything outside of the .m file). It's not `@protected`, it's not `@private`, it's simply unknown. With a `@private` ivar, other code trying to access it will be told that it's private, but with a synt... | If it is declared in your interface it is virtually public when using the `@property` declarative. If you want to use `@property` declaratives and keep them property truly private, you should create a private category in your implementation.
**MyClass.h**
```
@interface MyClass : NSObject {
@private
NSObject* foo... |
8,510,464 | If you have a property in your public interface like the following
```
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
```
And then synthesize it, in effect synthesizing the variable:
```
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
```... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8510464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106658/"
] | If it is declared in your interface it is virtually public when using the `@property` declarative. If you want to use `@property` declaratives and keep them property truly private, you should create a private category in your implementation.
**MyClass.h**
```
@interface MyClass : NSObject {
@private
NSObject* foo... | Other classes have access to everything that they `#include`. In other words, to everything that is inside your header.
If something appears only in your implementation file, other classes (including subclasses) don't know it exists. A synthesized property is like that. Other classes know only about the property (a pr... |
8,510,464 | If you have a property in your public interface like the following
```
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
```
And then synthesize it, in effect synthesizing the variable:
```
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
```... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8510464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106658/"
] | A synthesized ivar is *completely invisible* to all code that cannot see the `@synthesize` line (which basically means anything outside of the .m file). It's not `@protected`, it's not `@private`, it's simply unknown. With a `@private` ivar, other code trying to access it will be told that it's private, but with a synt... | A synthesized variable acts as if declared `@private`:
```
@interface Garble : NSObject
@property (copy) NSString * s;
@end
@implementation Garble
@synthesize s;
@end
@interface Bargle : Garble
@end
@implementation Bargle
- (void) useS {
NSLog(@"%@", s); // error: instance variable 's' is private
}
@end
`... |
8,510,464 | If you have a property in your public interface like the following
```
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
```
And then synthesize it, in effect synthesizing the variable:
```
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
```... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8510464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106658/"
] | A synthesized variable acts as if declared `@private`:
```
@interface Garble : NSObject
@property (copy) NSString * s;
@end
@implementation Garble
@synthesize s;
@end
@interface Bargle : Garble
@end
@implementation Bargle
- (void) useS {
NSLog(@"%@", s); // error: instance variable 's' is private
}
@end
`... | Other classes have access to everything that they `#include`. In other words, to everything that is inside your header.
If something appears only in your implementation file, other classes (including subclasses) don't know it exists. A synthesized property is like that. Other classes know only about the property (a pr... |
8,510,464 | If you have a property in your public interface like the following
```
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
```
And then synthesize it, in effect synthesizing the variable:
```
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
```... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8510464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106658/"
] | A synthesized ivar is *completely invisible* to all code that cannot see the `@synthesize` line (which basically means anything outside of the .m file). It's not `@protected`, it's not `@private`, it's simply unknown. With a `@private` ivar, other code trying to access it will be told that it's private, but with a synt... | Other classes have access to everything that they `#include`. In other words, to everything that is inside your header.
If something appears only in your implementation file, other classes (including subclasses) don't know it exists. A synthesized property is like that. Other classes know only about the property (a pr... |
8,510,464 | If you have a property in your public interface like the following
```
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
```
And then synthesize it, in effect synthesizing the variable:
```
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
```... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8510464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106658/"
] | A synthesized ivar is *completely invisible* to all code that cannot see the `@synthesize` line (which basically means anything outside of the .m file). It's not `@protected`, it's not `@private`, it's simply unknown. With a `@private` ivar, other code trying to access it will be told that it's private, but with a synt... | You can create a dynamic property and indicate it to the compiler that its instantiation would be at run time.
And then in your subclass write your own getter or synthesize the property.
@interface BaseClass : NSObject
@property (nonatomic, strong) NSString \*ThisWillBeSynthesizedInRespectiveSubclasses;
@end
@impl... |
8,510,464 | If you have a property in your public interface like the following
```
@interface MyClass : NSObject
@property(strong) NSString *myProp;
@end
```
And then synthesize it, in effect synthesizing the variable:
```
@implementation MyClass
@synthesize myProp = _myProp; // or just leave it at the default name..
@end
```... | 2011/12/14 | [
"https://Stackoverflow.com/questions/8510464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106658/"
] | You can create a dynamic property and indicate it to the compiler that its instantiation would be at run time.
And then in your subclass write your own getter or synthesize the property.
@interface BaseClass : NSObject
@property (nonatomic, strong) NSString \*ThisWillBeSynthesizedInRespectiveSubclasses;
@end
@impl... | Other classes have access to everything that they `#include`. In other words, to everything that is inside your header.
If something appears only in your implementation file, other classes (including subclasses) don't know it exists. A synthesized property is like that. Other classes know only about the property (a pr... |
55,502,149 | Due to the structure of my project I have to define my modal's markup in js.
To do so I write:
`var modal_message = '<ul><li id="address"></li><li id="average"></li></ul>';`
However, I need to pass inside this html markup some js variables from my code.
It's kind of `$('#address').innerHTML = var1;
$('#average_sum').i... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55502149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11300816/"
] | Here is a possible solution. I may be over-complicating it, but it should give you the desired result. The first thing that I did was make it so that the strings were not factors in the dataframe.
```
A1 <- data.frame(Animal1= c("A", "A","B","B","D"), Animal2=c("B","D","D","A","B"),
Frequency=c(2,3,... | I am not sure if I understood your question but is this what you are looking for?
```
library(dplyr)
df %>% as_tibble %>%
filter((Animal1 == "B" & Animal2 == "D") | (Animal1 == "D" & Animal2 == "B")) %>%
summarise(sum_freq = sum(Frequency))
``` |
55,502,149 | Due to the structure of my project I have to define my modal's markup in js.
To do so I write:
`var modal_message = '<ul><li id="address"></li><li id="average"></li></ul>';`
However, I need to pass inside this html markup some js variables from my code.
It's kind of `$('#address').innerHTML = var1;
$('#average_sum').i... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55502149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11300816/"
] | I am not sure if I understood your question but is this what you are looking for?
```
library(dplyr)
df %>% as_tibble %>%
filter((Animal1 == "B" & Animal2 == "D") | (Animal1 == "D" & Animal2 == "B")) %>%
summarise(sum_freq = sum(Frequency))
``` | Thanks, guys. In addition to @StephenK's answer, I added another step to split the new "combined" column.
```
A1 <- data.frame(Animal1= c("A", "A","B","B","D"), Animal2=c("B","D","D","A","B"),
Frequency=c(2,3,1,4,5), stringsAsFactors = FALSE)
A2<- as.data.frame(A1 %>% mutate(combined = map2_chr(Animal1... |
55,502,149 | Due to the structure of my project I have to define my modal's markup in js.
To do so I write:
`var modal_message = '<ul><li id="address"></li><li id="average"></li></ul>';`
However, I need to pass inside this html markup some js variables from my code.
It's kind of `$('#address').innerHTML = var1;
$('#average_sum').i... | 2019/04/03 | [
"https://Stackoverflow.com/questions/55502149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11300816/"
] | Here is a possible solution. I may be over-complicating it, but it should give you the desired result. The first thing that I did was make it so that the strings were not factors in the dataframe.
```
A1 <- data.frame(Animal1= c("A", "A","B","B","D"), Animal2=c("B","D","D","A","B"),
Frequency=c(2,3,... | Thanks, guys. In addition to @StephenK's answer, I added another step to split the new "combined" column.
```
A1 <- data.frame(Animal1= c("A", "A","B","B","D"), Animal2=c("B","D","D","A","B"),
Frequency=c(2,3,1,4,5), stringsAsFactors = FALSE)
A2<- as.data.frame(A1 %>% mutate(combined = map2_chr(Animal1... |
25,682,567 | So I have this json file (json.json) stored on a server, I would like to overwrite it with new json Data ('refresh\_token' object to be exact) everytime I call on this php class:
```
$file = file_get_contents('/var/json.json');
$json = json_decode($file);
**$REFRESH_TOKEN** = $json->refresh_token;
$js... | 2014/09/05 | [
"https://Stackoverflow.com/questions/25682567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3986062/"
] | Make sure you have permission to write on the file. Change file permission to 777. | If you set the 2nd parameter of `json_decode` to `true` you get an associative array instead of an object.
Documentation for `json_decode`: <http://php.net//manual/en/function.json-decode.php> |
25,682,567 | So I have this json file (json.json) stored on a server, I would like to overwrite it with new json Data ('refresh\_token' object to be exact) everytime I call on this php class:
```
$file = file_get_contents('/var/json.json');
$json = json_decode($file);
**$REFRESH_TOKEN** = $json->refresh_token;
$js... | 2014/09/05 | [
"https://Stackoverflow.com/questions/25682567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3986062/"
] | From your code, it is not obvious what you are trying to do. I guess it is the following:
* fetch json object from file
* modify refresh token
* write json object back to file
This would work as follows:
```
$REFRESHTOKEN = $_GET['REFRESH_TOKEN']; // Calculate refresh token
$json = json_decode(file_get_contents('/va... | If you set the 2nd parameter of `json_decode` to `true` you get an associative array instead of an object.
Documentation for `json_decode`: <http://php.net//manual/en/function.json-decode.php> |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | SysInternals has a tool called MoveFile that will do move or delete the file upon reboot of the machine.
[MoveFile link](http://technet.microsoft.com/en-us/sysinternals/bb897556.aspx) | As a last resort you can try booting up in "Safe Mode" or "Command Prompt" mode and deleting the file that way.
We see this a lot with viruses, spyware, etc. Booting up in safe mode usually does the trick.
Good luck! |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | ```
1.) Open `computer management', (right-click "My Computer", select
`Manage')
2.) Scroll down to `Shared Folders', expand.
3.) Select/click on `Open Files'. Double/triple-check to make sure
nobody has it open.
```
If you're good on the above, a too-deep file/folder path might be giving you some grief. Try naviga... | SysInternals has a tool called MoveFile that will do move or delete the file upon reboot of the machine.
[MoveFile link](http://technet.microsoft.com/en-us/sysinternals/bb897556.aspx) |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Use the [openfiles](https://technet.microsoft.com/en-us/library/Bb490961.aspx) command to identify and disconnect users who have the file open. If that doesn't work, download the [Unlocker](http://www.emptyloop.com/unlocker/) utility.
Openfiles syntax:
```
openfiles.exe /query
openfiles.exe /disconnect /id openFileID... | A few methods are here:
<http://www.geeksaresexy.net/2007/06/04/how-to-delete-an-undeletable-file/> |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Use the [openfiles](https://technet.microsoft.com/en-us/library/Bb490961.aspx) command to identify and disconnect users who have the file open. If that doesn't work, download the [Unlocker](http://www.emptyloop.com/unlocker/) utility.
Openfiles syntax:
```
openfiles.exe /query
openfiles.exe /disconnect /id openFileID... | ```
1.) Open `computer management', (right-click "My Computer", select
`Manage')
2.) Scroll down to `Shared Folders', expand.
3.) Select/click on `Open Files'. Double/triple-check to make sure
nobody has it open.
```
If you're good on the above, a too-deep file/folder path might be giving you some grief. Try naviga... |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | ```
1.) Open `computer management', (right-click "My Computer", select
`Manage')
2.) Scroll down to `Shared Folders', expand.
3.) Select/click on `Open Files'. Double/triple-check to make sure
nobody has it open.
```
If you're good on the above, a too-deep file/folder path might be giving you some grief. Try naviga... | I see this all the time, you can also run Systernal's Process Explorer to find who has the file, here's a great how-to on using Process Explorer for this purpose: [Unlocking files that are in use](http://blog.shijaz.com/2008/10/unlocking-files-that-are-in-use.html)
I personally like this way since I have this tool on ... |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Use the [openfiles](https://technet.microsoft.com/en-us/library/Bb490961.aspx) command to identify and disconnect users who have the file open. If that doesn't work, download the [Unlocker](http://www.emptyloop.com/unlocker/) utility.
Openfiles syntax:
```
openfiles.exe /query
openfiles.exe /disconnect /id openFileID... | SysInternals has a tool called MoveFile that will do move or delete the file upon reboot of the machine.
[MoveFile link](http://technet.microsoft.com/en-us/sysinternals/bb897556.aspx) |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | ```
1.) Open `computer management', (right-click "My Computer", select
`Manage')
2.) Scroll down to `Shared Folders', expand.
3.) Select/click on `Open Files'. Double/triple-check to make sure
nobody has it open.
```
If you're good on the above, a too-deep file/folder path might be giving you some grief. Try naviga... | As a last resort you can try booting up in "Safe Mode" or "Command Prompt" mode and deleting the file that way.
We see this a lot with viruses, spyware, etc. Booting up in safe mode usually does the trick.
Good luck! |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | SysInternals has a tool called MoveFile that will do move or delete the file upon reboot of the machine.
[MoveFile link](http://technet.microsoft.com/en-us/sysinternals/bb897556.aspx) | A few methods are here:
<http://www.geeksaresexy.net/2007/06/04/how-to-delete-an-undeletable-file/> |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | I see this all the time, you can also run Systernal's Process Explorer to find who has the file, here's a great how-to on using Process Explorer for this purpose: [Unlocking files that are in use](http://blog.shijaz.com/2008/10/unlocking-files-that-are-in-use.html)
I personally like this way since I have this tool on ... | A few methods are here:
<http://www.geeksaresexy.net/2007/06/04/how-to-delete-an-undeletable-file/> |
18,783 | I'm moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file? | 2009/06/03 | [
"https://serverfault.com/questions/18783",
"https://serverfault.com",
"https://serverfault.com/users/-1/"
] | Use the [openfiles](https://technet.microsoft.com/en-us/library/Bb490961.aspx) command to identify and disconnect users who have the file open. If that doesn't work, download the [Unlocker](http://www.emptyloop.com/unlocker/) utility.
Openfiles syntax:
```
openfiles.exe /query
openfiles.exe /disconnect /id openFileID... | As a last resort you can try booting up in "Safe Mode" or "Command Prompt" mode and deleting the file that way.
We see this a lot with viruses, spyware, etc. Booting up in safe mode usually does the trick.
Good luck! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.