qid
int64 1
74.7M
| question
stringlengths 0
58.3k
| date
stringlengths 10
10
| metadata
sequence | response_j
stringlengths 2
48.3k
| response_k
stringlengths 2
40.5k
|
---|---|---|---|---|---|
53,868,770 | I simply want to use a modified example of Nested flex on the [PrimeNG Flex](https://www.primefaces.org/primeng/#/flexgrid) by using the code below:
```
<h3>Nested</h3>
<div class="p-grid nested-grid">
<div class="p-col-8">
<div class="p-grid">
<div class="p-col-6">
<div class="box">6</div>
</div>
<div class="p-col-6">
<div class="box">6</div>
</div>
<div class="p-col-12">
<div class="box">12</div>
</div>
</div>
</div>
<div class="p-col-4">
<div class="box box-stretched">4</div>
</div>
</div>
```
However, the col divs act as the total size is not 12, instead 11 and if the total p-col number is 12 or more, the elements wrap to the next row that I do not want. On the other hand, I have a look at all of the main divs and body paddings and margins but there is no problem with that. I think the padding of the p-cols does not causing this problem and their paddings are also 0-5 px range. Any idea how to fix this problem? | 2018/12/20 | [
"https://Stackoverflow.com/questions/53868770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/836018/"
] | the example in the site shows kind of like this
i don't think you need 'p-grid nested-grid'
```
<div class="p-grid">
<div class="p-col-8">
<div class="p-grid">
<div class="p-col-6">
6
</div>
<div class="p-col-6">
6
</div>
<div class="p-col-12">
12
</div>
</div>
</div>
<div class="p-col-4">
4
</div>
``` | To keep the `nested-grid` class in the first `div` element you can add the following to your global styles.css file to fix it.
```
* {
-webkit-box-sizing: border-box;
}
```
This will stop the col divs from acting as if the total size is 11 instead of 12 and works with all the examples shown on the primefaces website <https://www.primefaces.org/primeng/#/flexgrid> |
52,616,343 | I'm wondering if it's better practice to use Bundle or make another class entirely to save data?
During a fragment change I can set it up so that onSaveInstanceState() saves information. Alternatively, I could store that information as a static variable in another class, then create a getter function in that class and use it to "restore" the variables state under onCreateView().
I would much prefer to use another class as I feel like I have more control over the management of my data, but I'm not sure if this would cause any issues or if this is bad practice as I haven't seen any mention of people doing it this way. | 2018/10/02 | [
"https://Stackoverflow.com/questions/52616343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10318432/"
] | For the various steps, I can give you the following hints.
### File names
For obtaining mp3 file names the [glob](https://docs.python.org/3/library/glob.html) module is your friend: `glob.iglob('*.mp3', recursive=True)`.
### Dealing with mp3
For dealing with mp3 files you can use practically any command line utility that serves your needs. A few examples:
* [avprobe](https://askubuntu.com/a/249843/445311)
* [exiftool, ffmpeg, mplayer](https://askubuntu.com/a/303461/445311)
* [mediainfo](https://superuser.com/a/595205/742396)
You can run these tools from within python via the [subprocess](https://docs.python.org/3/library/subprocess.html) module. For example:
```
subprocess.check_output(['avprobe', 'path/to/file'])
```
Then you can parse the output as appropriate; how to detect if the file is broken needs to be explored though.
### Dive into mp3
If you're feeling adventurous then you can also scan the mp3 files directly. [Wikipedia](https://en.wikipedia.org/wiki/MP3#File_structure) gives a hint about the file structure. So in order to get the bit rate the following should do:
```
with open('path/to/file', 'rb') as fp:
fp.read(2) # Skip the first two bytes.
bit_rate = fp.read(1) & 0xf0
``` | For my purposes ideally fits [mutagen](https://mutagen.readthedocs.io/en/latest/index.html) here is [**solution**](https://m5-web.com/blog/165) with comments.
Everything is pretty simple. |
13,823 | I have installed MySQL via [homebrew](https://brew.sh/): `brew install mysql`. I'd like to get the MySQL preference pane hooked up to my installation of MySQL through homebrew. How can I achieve this? | 2011/05/09 | [
"https://apple.stackexchange.com/questions/13823",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/6162/"
] | See [my answer to your question at superuser.com](https://superuser.com/a/413814/121764). | My understanding is that you can't get the MySQL Preference Pane via homebrew. But if you download the 64-bit DMG file from [MySQL's community server download page](http://www.mysql.com/downloads/mysql/), it includes an installer, preference pane, and startup script.
See also the answer to [this StackOverflow question](https://stackoverflow.com/questions/6317614/getting-mysql-work-on-osx-10-7-lion), about installing MySQL on Lion. |
51,643,920 | Given these two classes:
```
public class Abc
{
public static void Method(string propertyName) { }
}
public class Def
{
public int Prop { get; }
public void Method2() { Abc.Method("Prop"); }
}
```
As is, Roslyn rule CA1507 (use nameof) will be triggered for `Method2`. I don't want that, because that string is used for long-term custom serialization and can never change (if we decide to change the name of `Prop` we won't be changing that string). I don't want to disable the rule on an assembly level or even class level. There are also hundreds of callers like `Def` so I want something that doesn't require me to do anything to the callers.
Is there some kind of [ExcludeParameterFromCodeAnalysis] I can put on the `propertyName` param to be excluded from all or some code analysis?
Here's the concept I hope exists, or some variant on it:
```
public class Abc
{
public static void Method([SuppressMessageForCallers("CA1507")]string propertyName) { }
}
public class Def
{
public int Prop { get; }
public void Method2() { Abc.Method("Prop"); }
}
``` | 2018/08/02 | [
"https://Stackoverflow.com/questions/51643920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2234468/"
] | I believe that this rule only [triggers](https://github.com/dotnet/roslyn-analyzers/blob/ea231a69f9891764f10c5ed214409627da010be7/src/Microsoft.CodeQuality.Analyzers/Core/Maintainability/UseNameofInPlaceOfString.cs#L67)1 when the name of your parameter is `paramName` or `propertyName`2. So let's change the parameter:
```
public class Abc
{
public static void Method(string propertySerializationName) { }
}
```
---
1Even if you don't know or can guess at which specific analyzer implements a warning, it looks like searching the [roslyn-analyzers](https://github.com/dotnet/roslyn-analyzers) repository for the specific code (`CA1507`) should help you find them without too many false positives.
2Weirdly, it wouldn't even appear to trigger on a parameter called `parameterName`. | There's nothing that can be done to `Abc.Method` declaration regarding this warning because the warning is not on the method (or even on it's invocation) but on the literal itself.
It might be ugly, but it works:
```
public class Abc
{
public static void Method(string propertyName) { }
}
public class Def
{
public int Prop { get; }
public void Method2()
{
#pragma warning disable CA1507 - use nameof
Abc.Method("Prop");
#pragma warning restore CA1507 - use nameof
}
}
```
Visual Studio will offer that on the light bulb or screwdriver menu on the left gutter. |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | You can change how the keyboard behaves when it appears over the Ad. Go into your AndroidManifest.xml and add this attribute in the activity tag with the AdMob banner.
```
android:windowSoftInputMode="adjustPan"
```
This will prevent the ads from jumping above the keyboard and hiding the input. Instead, they will appear behind the keyboard (hidden). I don't know if this is against AdMob policy, I am just providing a solution. | This may not be the ideal solution for you but it is what I found to be best for my users. When the keyboard was shown it was covering buttons and text in my WebView making for a bad user experience. To fix this I set my AdView height to the height of the banner ad, in my case 50dp and set the AdView layout to below to the WebView. Finally I set the WebView height to wrap\_content. When the keyboard is visible the ad is temporary removed because it runs out of space, when the keyboard is hidden the ad is shown again. Hope this helps.
```
<WebView
android:id="@+id/webUI"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_below="@+id/webUI" />
``` |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | You can change how the keyboard behaves when it appears over the Ad. Go into your AndroidManifest.xml and add this attribute in the activity tag with the AdMob banner.
```
android:windowSoftInputMode="adjustPan"
```
This will prevent the ads from jumping above the keyboard and hiding the input. Instead, they will appear behind the keyboard (hidden). I don't know if this is against AdMob policy, I am just providing a solution. | I tried setting android:windowSoftInputMode="adjustPan".
it hides the adMob banner **but** also the EdiText.
So the solution I found is to hide the adMob banner when the keyboard opens.
I learned how to detect if the keyboard opens [here](https://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android?page=1&tab=oldest#tab-top).
and here is my solution:
```
final View activityRootView = findViewById(R.id.sample_main_layout);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
if (heightDiff > Support.dpToPx(MainActivity.this, 200)) { // if more than 200 dp, it's probably a keyboard...
mAdView.setVisibility(View.GONE);
}
else{
mAdView.setVisibility(View.VISIBLE);
}
}
});
``` |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | You can change how the keyboard behaves when it appears over the Ad. Go into your AndroidManifest.xml and add this attribute in the activity tag with the AdMob banner.
```
android:windowSoftInputMode="adjustPan"
```
This will prevent the ads from jumping above the keyboard and hiding the input. Instead, they will appear behind the keyboard (hidden). I don't know if this is against AdMob policy, I am just providing a solution. | add this in your Manifest in activity
android:windowSoftInputMode="stateVisible|adjustPan" |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | You can change how the keyboard behaves when it appears over the Ad. Go into your AndroidManifest.xml and add this attribute in the activity tag with the AdMob banner.
```
android:windowSoftInputMode="adjustPan"
```
This will prevent the ads from jumping above the keyboard and hiding the input. Instead, they will appear behind the keyboard (hidden). I don't know if this is against AdMob policy, I am just providing a solution. | I had a similar issue in my **Ionic app**. I wanted the Ad to completely be hidden when the soft keyboard shows up, but be visible when the soft keyboard is dismissed. I solved it by adding the following in the `<platform name="android">` tag of **config.xml:**
```
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
<activity android:windowSoftInputMode="adjustPan|adjustResize" />
</edit-config>
</platform>
``` |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | I tried setting android:windowSoftInputMode="adjustPan".
it hides the adMob banner **but** also the EdiText.
So the solution I found is to hide the adMob banner when the keyboard opens.
I learned how to detect if the keyboard opens [here](https://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android?page=1&tab=oldest#tab-top).
and here is my solution:
```
final View activityRootView = findViewById(R.id.sample_main_layout);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
if (heightDiff > Support.dpToPx(MainActivity.this, 200)) { // if more than 200 dp, it's probably a keyboard...
mAdView.setVisibility(View.GONE);
}
else{
mAdView.setVisibility(View.VISIBLE);
}
}
});
``` | This may not be the ideal solution for you but it is what I found to be best for my users. When the keyboard was shown it was covering buttons and text in my WebView making for a bad user experience. To fix this I set my AdView height to the height of the banner ad, in my case 50dp and set the AdView layout to below to the WebView. Finally I set the WebView height to wrap\_content. When the keyboard is visible the ad is temporary removed because it runs out of space, when the keyboard is hidden the ad is shown again. Hope this helps.
```
<WebView
android:id="@+id/webUI"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_below="@+id/webUI" />
``` |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | add this in your Manifest in activity
android:windowSoftInputMode="stateVisible|adjustPan" | This may not be the ideal solution for you but it is what I found to be best for my users. When the keyboard was shown it was covering buttons and text in my WebView making for a bad user experience. To fix this I set my AdView height to the height of the banner ad, in my case 50dp and set the AdView layout to below to the WebView. Finally I set the WebView height to wrap\_content. When the keyboard is visible the ad is temporary removed because it runs out of space, when the keyboard is hidden the ad is shown again. Hope this helps.
```
<WebView
android:id="@+id/webUI"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_below="@+id/webUI" />
``` |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | I tried setting android:windowSoftInputMode="adjustPan".
it hides the adMob banner **but** also the EdiText.
So the solution I found is to hide the adMob banner when the keyboard opens.
I learned how to detect if the keyboard opens [here](https://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android?page=1&tab=oldest#tab-top).
and here is my solution:
```
final View activityRootView = findViewById(R.id.sample_main_layout);
activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
int heightDiff = activityRootView.getRootView().getHeight() - activityRootView.getHeight();
if (heightDiff > Support.dpToPx(MainActivity.this, 200)) { // if more than 200 dp, it's probably a keyboard...
mAdView.setVisibility(View.GONE);
}
else{
mAdView.setVisibility(View.VISIBLE);
}
}
});
``` | I had a similar issue in my **Ionic app**. I wanted the Ad to completely be hidden when the soft keyboard shows up, but be visible when the soft keyboard is dismissed. I solved it by adding the following in the `<platform name="android">` tag of **config.xml:**
```
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
<activity android:windowSoftInputMode="adjustPan|adjustResize" />
</edit-config>
</platform>
``` |
6,229,913 | I am struggling to get my interior background image to display in IE, works fine in FF and chrome. Cant figure it out.
```
<div id="banner">
<div id="banner-image"><cms:CMSEditableImage ID="BannerPhoto" runat="server" ImageHeight="284" ImageWidth="892" /></div>
</div>
<div id="interior-content-block">
<div id="repeating-content">
<div id="interior-content">
<cc1:CMSEditableRegion ID="txtMain" runat="server" DialogHeight="312" RegionType="HtmlEditor" RegionTitle="Main Content" />
</div>
</div>
<div id="side-navigation">
<cms:CMSListMenu ID="CMSListMenuSub" runat="server" HighlightAllItemsInPath="true" ClassNames="CMS.MenuItem" RenderCssClasses="true" CSSPrefix="side1;side2" DisplayHighlightedItemAsLink="true" Path="/{0}/%"/>
</div>
<div style="clear: both;"></div>
```
```
#repeating-content-landing
{
float: left;
margin: 0px 0px 0px 40px;
background: #959398 url(../site-images/landing-page/final-landing-page-design.jpg);
width: 820px;
}
#interior-content
{
padding: 32px 32px 32px 32px;
background: #999999 url(../site-images/interior-content.gif)repeat-y;
min-height: 312px;
}
#interior-content-landing
{
padding: 0px 0px 0px 0px;
background: #999999 url(../site-images/landing-page/final-landing-page-design.jpg) no-repeat;
min-height: 700px;
}
<style />
``` | 2011/06/03 | [
"https://Stackoverflow.com/questions/6229913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783021/"
] | add this in your Manifest in activity
android:windowSoftInputMode="stateVisible|adjustPan" | I had a similar issue in my **Ionic app**. I wanted the Ad to completely be hidden when the soft keyboard shows up, but be visible when the soft keyboard is dismissed. I solved it by adding the following in the `<platform name="android">` tag of **config.xml:**
```
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application/activity">
<activity android:windowSoftInputMode="adjustPan|adjustResize" />
</edit-config>
</platform>
``` |
56,394 | I have replaced three flats on my new bike and found each time a tear or hole at the base of the air valve. What can cause this. | 2018/08/11 | [
"https://bicycles.stackexchange.com/questions/56394",
"https://bicycles.stackexchange.com",
"https://bicycles.stackexchange.com/users/38917/"
] | 1. As Kibbee suggests, the wrong size valve.
2. A badly-formed valve hole in the rim. It's not that unusual to find that there is a "lip" of metal at the hole that will cut into the tube. This requires a bit of filing with a small round file to correct.
3. Running the tire flat or with very low pressure. As an under-inflated tire rolls on the ground it tends to "walk" along the rim, tugging on the valve stem.
4. Poor tube installation technique. Most importantly, inflate the tube slightly before installing -- just enough that it rounds out (though it should still be limp). | The most likely cause is using a presto valve is a rim that's drilled for Schrader. Make sure you're using the correct tube for your rims. You can get a grommet to fill the hole if you want to use presto tubes on rims that are drilled for Schrader.
It might also be because the pressure was too low. This can cause the tire to be able to move around inside the tire, and would mostly occur during braking.
Check on the valve hole to make sure there aren't any rough edges, and file them down (only lightly, be careful) if the hole has any sharp edges. |
1,650,529 | An often given example of a group of infinite order where every element has infinite order is the group $\dfrac{\mathbb{(Q, +)}}{(\mathbb{Z, +})}$.
But I don't see why every element necessarily has finite order in this group. Why is this true?
Also, what is the identity element of this group? | 2016/02/11 | [
"https://math.stackexchange.com/questions/1650529",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/312641/"
] | The identity of $G =\mathbb Q / \mathbb Z$ is $\mathbb Z$.
1) Every element of $G$ has **finite** order. Indeed, if you take any $r + \mathbb Z \in G$ where $r \in \mathbb Q$ then we may write $r = \frac{m}{n}$, with $m,n \in \mathbb Z $ and $n > 0$. Thus
$$n (r + \mathbb Z) = m + \mathbb Z = \mathbb Z$$
then it follows that $\left|r + \mathbb Z\right| \leq n$.
**Edit:**
2) The group has **infinite** order because we may choose an element in $G$ with arbitrarily large order, consider $\frac{1}{n} + \mathbb Z$, where $\left|\frac{1}{n} + \mathbb Z\right| = n$ (why?). | If the group is of finite order then the order of every element in the group divides the order of the group. Hence no element can have infinite order.
In your example, if $\dfrac {p}{q} +\mathbb Z \in \mathbb Q/\mathbb Z$ then $\left(\dfrac{p} {q} +\mathbb Z\right)^q =q\left(\dfrac {p} {q} +\mathbb Z \right) =\mathbb Z$ which is the identity element of this group. Hence every element is of finite order. |
32,730 | The following code evaluates the similarity between two time series:
```
set.seed(10)
RandData <- rnorm(8760*2)
America <- rep(c('NewYork','Miami'),each=8760)
Date = seq(from=as.POSIXct("1991-01-01 00:00"),
to=as.POSIXct("1991-12-31 23:00"), length=8760)
DatNew <- data.frame(Loc = America,
Doy = as.numeric(format(Date,format = "%j")),
Tod = as.numeric(format(Date,format = "%H")),
Temp = RandData,
DecTime = rep(seq(1, length(RandData)/2) / (length(RandData)/2),
2))
require(mgcv)
mod1 <- gam(Temp ~ Loc + s(Doy) + s(Doy,by = Loc) +
s(Tod) + s(Tod,by = Loc),data = DatNew, method = "ML")
```
Here, `gam` is used to evaluate how the temperature at New York and Miami vary from the mean temperature (of both locations) at different times of the day. The problem that I now have is that I need to include an interaction term which shows how the temperature of each location varies throughout at the day for different days of the year. I eventually hope to display all of this information on one graph (for each location). So, for Miami I hope to have one graph that shows how the temperature varies from the mean during different times of the day and different times of the year (3d plot?) | 2012/07/21 | [
"https://stats.stackexchange.com/questions/32730",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/12141/"
] | The "a" in "gam" stands for "additive" which means no interactions, so if you fit interactions you are really not fitting a gam model any more.
That said, there are ways to get some interaction like terms within the additive terms in a gam, you are already using one of those by using the `by` argument to `s`. You could try extending this to having the argument `by` be a matrix with a function (sin, cos) of doy or tod. You could also just fit smoothing splines in a regular linear model that allows interactions (this does not give the backfitting that gam does, but could still be useful).
You might also look at projection pursuit regression as another fitting tool. Loess or more parametric models (with sin and/or cos) might also be useful.
Part of decision on what tool(s) to use is what question you are trying to answer. Are you just trying to find a model to predict future dates and times? are you trying to test to see if particular predictors are significant in the model? are you trying to understand the shape of the relationship between a predictor and the outcome? Something else? | For two continuous variables then you can do what you want (whether this is an interaction or not I'll leave others to discuss as per comments to @Greg's Answer) using:
```
mod1 <- gam(Temp ~ Loc + s(Doy, bs = "cc", k = 5) +
s(Doy, bs = "cc", by = Loc, k = 5, m = 1) +
s(Tod, bs = "cc", k = 5) +
s(Tod, bs = "cc", by = Loc, k = 5, m = 1) +
te(Tod, Doy, by = Loc, bs = rep("cc",2)),
data = DatNew, method = "ML")
```
The simpler model should then be nested within the more complex model above. That simpler model is:
```
mod0 <- gam(Temp ~ Loc + s(Doy, bs = "cc", k = 5) +
s(Doy, bs = "cc", by = Loc, k = 5, m = 1) +
s(Tod, bs = "cc", k = 5) +
s(Tod, bs = "cc", by = Loc, k = 5, m = 1),
data = DatNew, method = "ML")
```
Note two things here:
1. The basis-type for each smoother is stated. In this case we would expect that there are no discontinuities in Temp between 23:59 and 00:00 for `Tod` nor between `Doy == 1` and `Doy == 365.25`. Hence cyclic cubic splines are appropriate, indicated here via `bs = "cc"`.
2. The basis dimension is stated explicitly (`k = 5`). This matches the default basis dimension for each smooth in a `te()` term.
Together these features ensure that the simpler model really is nested within the more complex model.
For more see `?gam.models` in **mgcv**. |
36,403,859 | How do I use "UPSERT" or "INSERT INTO likes (user\_id,person\_id) VALUES (32,64) ON CONFLICT (user\_id,person\_id) DO NOTHING" in PostgreSQL 9.5 on Rails 4.2? | 2016/04/04 | [
"https://Stackoverflow.com/questions/36403859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3384741/"
] | Have a look at `active_record_upsert` gem here: <https://github.com/jesjos/active_record_upsert>. This does the upsert, but obviously only on Postgres 9.5+. | You can achieve that by creating the SQL using the active records internals. You can use the `arel_attributes_with_values_for_create` to extract values for each active\_record for the insert sql with the Rails attributes, something like:
```
INSERT_REGEX = /(INSERT INTO .* VALUES) (.*)/
def values_for(active_record)
active_record.updated_at = Time.now if active_record.respond_to?(:updated_at)
active_record.created_at ||= Time.now if active_record.respond_to?(:created_at)
sql = active_record.class.arel_table.create_insert.tap do |insert_manager|
insert_manager.insert(
active_record.send(:arel_attributes_with_values_for_create, active_record.attribute_names.sort)
)
end.to_sql
INSERT_REGEX.match(sql).captures[1]
end
```
Then you can add all the values into one big "values" string:
```
def values(active_records)
active_records.map { |active_record| values_for(active_record) }.join(",")
end
```
For the insert part of the SQL you can use a similar code to the one used for the value extraction:
```
INSERT_REGEX = /(INSERT INTO .* VALUES) (.*)/
def insert_statement(active_record)
sql = active_record.class.arel_table.create_insert.tap do |insert_manager|
insert_manager.insert(
active_record.send(:arel_attributes_with_values_for_create, active_record.attribute_names.sort)
)
end.to_sql
INSERT_REGEX.match(sql).captures[0]
end
```
For the conflict part you can do the following:
```
def on_conflict_statement(conflict_fields)
return ';' if conflict_fields.blank?
"ON CONFLICT (#{conflict_fields.join(', ')}) DO NOTHING"
end
```
At the end just concatenate all of them together for execution:
```
def perform(active_records:, conflict_fields:)
return if active_records.empty?
ActiveRecord::Base.connection.execute(
<<-SQL.squish
#{insert_statement(active_records.first)}
#{values(active_records)}
#{on_conflict_statement(conflict_fields)}
SQL
)
end
```
You can check [here](https://gist.github.com/marcelorxaviers/9fc7ffeec007e497477cfc412de285bc) the final solution.
This is the output for me - using my **balance** active record model and removing the piece of code that executes the SQL(`ActiveRecord::Base.connection.execute...`):
```
> puts BatchCreate.perform(active_records: [balance], conflict_fields: [:bank_account_id, :date])
INSERT INTO "balances" ("amount", "created_at", "currency", "date", "id", "bank_account_id", "updated_at") VALUES (0, '2018-11-28 15:42:44.312954', 'MXN', '2018-11-28', 15169, 26300, '2018-11-28 16:05:07.465402') ON CONFLICT (bank_account_id, date) DO NOTHING
``` |
27,150,695 | This may (should) have been asked before somewhere but I can't seem to find an answer. If someone provides a link I can delete this post!:
Just trying to get my head around some of composer's (probably applies to other package managers too) functionality.
Basically I just want to know what composer does in the following scenarios:
1.
My main project has a dependency:
```
"guzzlehttp/guzzle": "5.0.*",
```
My external bundle has a dependency on
```
"guzzlehttp/guzzle": "5.0.*",
```
Does composer install guzzlehttp/guzzle one time because it knows it only needs it once?
2.
Same scenario but in the future if someone updates the main project to use:
```
"guzzlehttp/guzzle": "6.0.*",
```
Will composer now install 2 versions of guzzle (5 and 6) (I presume this is what it should do), or will it take the highest version (i.e. 6)? Also if there are 2 versions will this cause any conflicts because namespaces might be the same?
Thanks | 2014/11/26 | [
"https://Stackoverflow.com/questions/27150695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1624933/"
] | ### To question 1
Yes Composer can only install one version of each extension/package.
### To question 2
Because of answer 1: Composer would consider your main project and the external package as incompatible.
In this case you could
* stay with version 5 at your main project too.
* ask the external package owner to upgrade to version 6 too if it's compatible to.
* fork the external package and make it compatible to version 6 yourself | We had a situation today where we were using multiple libraries, and one used Guzzle v5 and the other Guzzle v6. Upgrading (or downgrading) was not a viable option, as it was third party code, so we had to be able to install both versions of Guzzle.
Here's what we did. This is a **TOTAL FRACKING HACK**, and I'd advise doing this only as an absolute last resort. It works, but updating your calling code to use just one version is a much better option.
The trick is that you need to re-namespace one of the two versions. In our case we decided to change v6 to GuzzleHttp6. Here's how to do that:
1. Make sure your `composer.json` has v6 enabled:
```js
"require": {
"guzzlehttp/guzzle": "^6.2"
// possible other stuff
},
```
2. `composer install` to get Guzzle v6 all its dependencies installed.
3. Move the `/vendor/guzzlehttp` directory over to a new `/vendor-static/guzzlehttp` directory.
4. Do a case-sensitive find & replace on the `/vendor-static` directory to replace **GuzzleHttp** with **GuzzleHttp6**. This effectively brings the Guzzle 6 code into a new namespace.
5. Now update your `composer.json` to include Guzzle's own dependencies manually, and then autoload the code in the `/vendor-static` folder. Note you'll want to REMOVE the main guzzle require statement (or change it include guzzle 5);
```js
"require": {
"guzzlehttp/guzzle": "~5",
"psr/http-message": "~1.0",
"ralouphie/getallheaders": "^2.0.5"
},
"autoload": {
"files": ["vendor-static/guzzlehttp/guzzle/src/functions_include.php",
"vendor-static/guzzlehttp/psr7/src/functions_include.php",
"vendor-static/guzzlehttp/promises/src/functions_include.php"],
"psr-4": {
"GuzzleHttp6\\": "vendor-static/guzzlehttp/guzzle/src/",
"GuzzleHttp6\\Psr7\\": "vendor-static/guzzlehttp/psr7/src/",
"GuzzleHttp6\\Promise\\": "vendor-static/guzzlehttp/promises/src/"
}
},
```
5. `composer update` to remove the old Guzzle v6, and install Guzzle v5. This will also install the `psr/http-message` and `ralouphie/getallheaders` dependencies.
6. You may need to do a `composer dump-autoload` to force the autoloader to add the new include paths. In theory this should happen on `composer update` but I had to force it.
7. Now update your calling code; instead of calling **\GuzzleHttp**, you'll call **\GuzzleHttp6** .
And that's it. You should be able to run both concurrently. Note that whatever version of Guzzle v6 you've got in the `/vendor-static` directory will be there forever-more, so you may want to update that from time-to-time. |
38,092,075 | So simply put I'm trying to make a simple search engine where I've got a MySQL database and its contents being displayed on a HTML table (using PHP to get the information) and I want to make a search bar that as you type, filters the list automatically.
I've found tutorials on how to make that with plain text where it displays in just a list, but nothing on how to filter an already displayed table.
If someone could point in me in the direction of some helpful links or maybe some code I could use to start me off that would be great, sorry if this has been answered before, I've been looking for 20 odd minutes and just can't find anything that works.
**TLDR**: Making a search bar that as you type, filters an HTML table filled a with MySQL database table's information brought onto the page via PHP code, cant find any tutorials or helpful links/code after 20-ish min of searching and came here. | 2016/06/29 | [
"https://Stackoverflow.com/questions/38092075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5800070/"
] | I have doubt in the way you are passing the data.
Try to pass the data without doing **stringify** and see if it works. | 1. check if signin method is in document.ready function
2. if synchronous call is needed then you can use 'async': false
3. controller signin method expects AuthenticationModel as input parameter hence check ajax method returns the expected object, else try as string parameters in controller
4. as per the above controller code it always return jsondata which always returns error object in it. |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | You can get the base path by using the following code and append your needed path with that.
```
string path = System.AppDomain.CurrentDomain.BaseDirectory;
``` | Use this [System.Web.Hosting.HostingEnvironment.MapPath()](https://msdn.microsoft.com/en-us/library/system.web.hosting.hostingenvironment.mappath.aspx).
```
HostingEnvironment.MapPath("~/file")
```
Wonder why nobody mentioned it here. |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | You should reference System.Web and call:
```
HttpContext.Current.Server.MapPath(...)
``` | ```
HostingEnvironment.MapPath
System.Web.Hosting.HostingEnvironment.MapPath(path);
``` |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | Use this [System.Web.Hosting.HostingEnvironment.MapPath()](https://msdn.microsoft.com/en-us/library/system.web.hosting.hostingenvironment.mappath.aspx).
```
HostingEnvironment.MapPath("~/file")
```
Wonder why nobody mentioned it here. | Maybe you could abstract this as a dependency and create an IVirtualPathResolver. This way your service classes wouldn't be bound to System.Web and you could create another implementation if you wanted to reuse your logic in a different UI technology. |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | By calling it?
```
var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx");
```
Make sure you add a reference to the System.Web assembly. | You can get the base path by using the following code and append your needed path with that.
```
string path = System.AppDomain.CurrentDomain.BaseDirectory;
``` |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | You should reference System.Web and call:
```
HttpContext.Current.Server.MapPath(...)
``` | Maybe you could abstract this as a dependency and create an IVirtualPathResolver. This way your service classes wouldn't be bound to System.Web and you could create another implementation if you wanted to reuse your logic in a different UI technology. |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | By calling it?
```
var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx");
```
Make sure you add a reference to the System.Web assembly. | Architecturally, System.web should not be referred in Business Logic Layer (BLL). Employ BLL into the solution structure to follow the separate of concern principle so refer System.Web is a bad practice. BLL should not load/run in Asp.net context. Because of the reason you should consider using of `System.AppDomain.CurrentDomain.BaseDirectory` instead of `System.Web.HttpContext.Current.Server.MapPath` |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | Use this [System.Web.Hosting.HostingEnvironment.MapPath()](https://msdn.microsoft.com/en-us/library/system.web.hosting.hostingenvironment.mappath.aspx).
```
HostingEnvironment.MapPath("~/file")
```
Wonder why nobody mentioned it here. | ```
HostingEnvironment.MapPath
System.Web.Hosting.HostingEnvironment.MapPath(path);
``` |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | By calling it?
```
var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx");
```
Make sure you add a reference to the System.Web assembly. | You should reference System.Web and call:
```
HttpContext.Current.Server.MapPath(...)
``` |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | By calling it?
```
var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx");
```
Make sure you add a reference to the System.Web assembly. | Use this [System.Web.Hosting.HostingEnvironment.MapPath()](https://msdn.microsoft.com/en-us/library/system.web.hosting.hostingenvironment.mappath.aspx).
```
HostingEnvironment.MapPath("~/file")
```
Wonder why nobody mentioned it here. |
1,199,486 | How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite | 2009/07/29 | [
"https://Stackoverflow.com/questions/1199486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40521/"
] | By calling it?
```
var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx");
```
Make sure you add a reference to the System.Web assembly. | Maybe you could abstract this as a dependency and create an IVirtualPathResolver. This way your service classes wouldn't be bound to System.Web and you could create another implementation if you wanted to reuse your logic in a different UI technology. |
99,841 | >
> Slight specific staining with the antibody was observed in **isolated** peripheral blood lymphocytes.
>
>
>
Would this **isolated** always evoke the meaning "[happening or existing only once, separate](http://dictionary.cambridge.org/dictionary/english/isolated)", as in
>
> There were only a few **isolated** cases of violent behaviour.
>
>
>
or might it half-imply that "someone has *isolated* these lymphocytes from tissue", and thus the term is better avoided in this sentence for clarity's sake?
What would be good alternatives? I can think of "individual" and "single". | 2016/08/06 | [
"https://ell.stackexchange.com/questions/99841",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/2127/"
] | I would interpret this sentence as meaning "isolated ... from tissue." However, I am not a physician or biologist and I can't say whether one would interpret it differently. What I can do is quote a number of publications that use that phrase:
>
> [*Apoptogenic effect of fentanyl on freshly isolated peripheral blood lymphocytes.*](http://www.ncbi.nlm.nih.gov/pubmed/15284552)
>
>
>
In this case, the use of *freshly* tells us that it does not mean "isolated cases."
>
> In this study, we used in vitro isolated peripheral blood lymphocytes as
> biosensors to test the effect of hypobaric hypoxia on seven climbers by
> measuring the functional activity of these cells.
>
>
> — [*Peripheral blood lymphocytes: a model for monitoring physiological adaptation to high altitude.*](http://www.ncbi.nlm.nih.gov/pubmed/21190502)
>
>
>
Since "in vitro" means "outside a living organism," we can also safely assume that this usage does not mean "isolated cases."
>
> Thirteen patients with SLE with active disease, 10 patients with inactive
> disease, and 14 controls entered the study. In addition, samples from 10 of
> the 13 patients with active disease could be studied at a moment of inactive
> disease as well. **Isolated peripheral blood lymphocytes were stained** for
> the lymphocyte subset markers CD4, CD8, CD19, their respective activation
> markers CD25, HLA-DR, CD38, and the costimulatory molecules CD40L, CD28,
> CD40, CD80, and CD86. Expression was measured by flow cytometry.
>
>
> — [*Expression of costimulatory molecules on peripheral blood lymphocytes of patients with systemic lupus erythematosus*](http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1753642/)
>
>
>
Again, this usage cannot refer to "isolated cases." This time because it's being used as an adjective to modify "peripheral blood lymphocytes."
These were the first three results when searching for the phrase"isolated peripheral blood lymphocytes," so I think it is safe to conclude that that phrase will only ever be interpreted to mean "isolated ... from tissue."
---
If you wish to express that staining was observed in only some of the lymphocytes, you might want to reword the sentence as:
>
> Slight specific staining with the antibody was observed in **a small number
> of** peripheral blood lymphocytes.
>
>
>
If your intention was to say that slight staining was observed in those lymphocytes not clustered together, you might say:
>
> Slight specific staining with the antibody was observed in **discrete**
> peripheral blood lymphocytes.
>
>
>
The definition of *discrete* from Oxford Dictionaries:
>
> [**discrete**](http://www.oxforddictionaries.com/definition/english/discrete)
>
> Individually separate and distinct:
>
> "*That is, does age affect general ability or does it have discrete effects on individual abilities?*"
>
>
>
Be careful not to confuse *discrete* and [*discreet*](http://www.oxforddictionaries.com/definition/english/discreet). | >
> Actually, having just searched Google Books for [in isolated peripheral blood lymphocytes](https://www.google.com/search?tbm=bks&q=%22in+isolated+peripheral+blood+lymphocytes%22) it seems to me you might be dealing with a context-specific usage here. I think the default "natural" meaning would indeed be [a small number,] not physically connected to *each other*, but without spending too long looking at those examples I get the impression that for this particular sequence of words it might mean *taken away from their normal environment* (exact context might clarify).
>
>
>
From FF comment under the answer. |
37,739,324 | I have the following code where `Model.VerticalType` contains string. I want to compare it with an `Enum` but I get error:
Operator '==' cannot be applied to operands of type 'string' and
`DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice`
```
@if (Model.VerticalType == DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice)
{
<img src="@phoneWSource" />
}
``` | 2016/06/10 | [
"https://Stackoverflow.com/questions/37739324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5788013/"
] | Call `.ToString()` on the enum value.
```
@if (Model.VerticalType == DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice.ToString())
```
This will convert the enum to it's name, in this case `Voice`. | Try [`Enum.Parse`](https://msdn.microsoft.com/en-us/library/kxydatf9(v=vs.110).aspx) to convert from string to Enum value:
```
Enum.Parse(typeof(DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType), Model.VerticalType, true) == DGS.DGSAPI.UI.BusinessModels.Enums.VerticalType.Voice
```
`true` means to ignore case while parsing |
12,511,801 | I have two dictionaries as follows:
`D1={'a':1,'b':2,'c':3}`
and
`D2={'b':2,'c':3,'d':1}`
I want to merge these two dictionaries and the result should be as follows:
`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`
how can I achieve this in python? | 2012/09/20 | [
"https://Stackoverflow.com/questions/12511801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321663/"
] | You may want to try:
```
D3 = {}
D3.update(D1)
D3.update(D2)
```
Here, we're creating an empty dictionary `D3` first, then update it from the two other dictionaries.
Note that you need to be careful with the order of the updates: if `D2` shares some keys with `D1`, the code above will overwrite the corresponding entries of `D1` with those of `D2`.
Note as well that the keys will **not** be repeated. The example you give `D3={a:1,b:2,c:3,b:2,c:3,d:1}` is not a valid dictionary. | What are you asking is not possible, since you cannot have two different keys with the same value in a Python dictionary.
The closest answer to your question is:
`D3 = dict( D1.items() + D2.items() )`
Note: if you have different values for the same key, the ones from D2 will be the ones in D3.
Example:
`D1 = { 'a':1, 'b'=2 }`
`D2 = { 'c':3, 'b':3}`
Then, D3 will be:
`D3= { 'a':1, 'b':3, 'c':3 }` |
12,511,801 | I have two dictionaries as follows:
`D1={'a':1,'b':2,'c':3}`
and
`D2={'b':2,'c':3,'d':1}`
I want to merge these two dictionaries and the result should be as follows:
`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`
how can I achieve this in python? | 2012/09/20 | [
"https://Stackoverflow.com/questions/12511801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321663/"
] | You may want to try:
```
D3 = {}
D3.update(D1)
D3.update(D2)
```
Here, we're creating an empty dictionary `D3` first, then update it from the two other dictionaries.
Note that you need to be careful with the order of the updates: if `D2` shares some keys with `D1`, the code above will overwrite the corresponding entries of `D1` with those of `D2`.
Note as well that the keys will **not** be repeated. The example you give `D3={a:1,b:2,c:3,b:2,c:3,d:1}` is not a valid dictionary. | Dictionaries by definition can't have duplicate keys, so "merging" dictionaries will actually give the following result (note the order is arbitrary):
```
{'a': 1, 'b': 2, 'c': 3, 'd': 1}
```
You can create a clone of one of the dictionaries and merge the entries from the other into it:
```
D3 = dict(D1)
D3.update(D2)
```
or you can create a new dictionary from the concatenation of the (key, value) tuples from each input dictionary:
```
D3 = dict(D1.items() + D2.items())
```
If you really want multiple values for duplicate keys, you need something like a list of values for each key:
```
from itertools import groupby
dict(( (key, [v for k, v in group]) for key, group in groupby(sorted(D1.items() + D2.items()), lambda x: x[0])))
``` |
12,511,801 | I have two dictionaries as follows:
`D1={'a':1,'b':2,'c':3}`
and
`D2={'b':2,'c':3,'d':1}`
I want to merge these two dictionaries and the result should be as follows:
`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`
how can I achieve this in python? | 2012/09/20 | [
"https://Stackoverflow.com/questions/12511801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321663/"
] | You may want to try:
```
D3 = {}
D3.update(D1)
D3.update(D2)
```
Here, we're creating an empty dictionary `D3` first, then update it from the two other dictionaries.
Note that you need to be careful with the order of the updates: if `D2` shares some keys with `D1`, the code above will overwrite the corresponding entries of `D1` with those of `D2`.
Note as well that the keys will **not** be repeated. The example you give `D3={a:1,b:2,c:3,b:2,c:3,d:1}` is not a valid dictionary. | ```
In [3]: D1={'a':1,'b':2,'c':3}
In [4]: D2={'b':2,'c':3,'d':1}
In [5]: D1.update(D2)
In [6]: D1
Out[6]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
```
**Update**
Alternative solutions
```
In [9]: D3=D1.copy()
In [10]: D3.update(D2)
In [11]: D3
Out[11]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
In [12]: D4=dict(D1, **D2)
```
or
```
In [13]: D4
Out[13]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
```
or
```
In [16]: D5 = dict(D1.items() + D2.items())
In [17]: D5
Out[17]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
``` |
12,511,801 | I have two dictionaries as follows:
`D1={'a':1,'b':2,'c':3}`
and
`D2={'b':2,'c':3,'d':1}`
I want to merge these two dictionaries and the result should be as follows:
`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`
how can I achieve this in python? | 2012/09/20 | [
"https://Stackoverflow.com/questions/12511801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321663/"
] | >
> I want to merge these two dictionaries and the result should be as
> follows:
>
>
> D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}
>
>
> how can I achieve this in python?
>
>
>
You can't. You can only have one value per key in a Python dict. What you can do is to have a list or a set as the value.
Here is an example with a set:
```
d1 = { 'a': 1, 'b': 2, 'c': 3 }
d2 = { 'a': 1, 'b': 5, 'd': 4 }
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, set([])).add(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
This will give you `d3`:
```
{'a': set([1]), 'c': set([3]), 'b': set([2, 5]), 'd': set([4])}
```
You can also do this with a list (possibly closer to your example):
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, []).append(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
You'll get this:
```
{'a': [1], 'c': [3, 3], 'b': [2, 2], 'd': [1]}
```
However, looking at `{'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}` (which can't be a dict), it seems that you're after a different data structure altogether. Perhaps something like this:
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
result = []
result += [ { 'key': key, 'value': d1[key] } for key in d1 ]
result += [ { 'key': key, 'value': d2[key] } for key in d2 ]
```
This would produce this, which looks closer to the data structure you had in mind initially:
```
[ {'value': 1, 'key': 'a'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 1, 'key': 'd'} ]
``` | You may want to try:
```
D3 = {}
D3.update(D1)
D3.update(D2)
```
Here, we're creating an empty dictionary `D3` first, then update it from the two other dictionaries.
Note that you need to be careful with the order of the updates: if `D2` shares some keys with `D1`, the code above will overwrite the corresponding entries of `D1` with those of `D2`.
Note as well that the keys will **not** be repeated. The example you give `D3={a:1,b:2,c:3,b:2,c:3,d:1}` is not a valid dictionary. |
12,511,801 | I have two dictionaries as follows:
`D1={'a':1,'b':2,'c':3}`
and
`D2={'b':2,'c':3,'d':1}`
I want to merge these two dictionaries and the result should be as follows:
`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`
how can I achieve this in python? | 2012/09/20 | [
"https://Stackoverflow.com/questions/12511801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321663/"
] | >
> I want to merge these two dictionaries and the result should be as
> follows:
>
>
> D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}
>
>
> how can I achieve this in python?
>
>
>
You can't. You can only have one value per key in a Python dict. What you can do is to have a list or a set as the value.
Here is an example with a set:
```
d1 = { 'a': 1, 'b': 2, 'c': 3 }
d2 = { 'a': 1, 'b': 5, 'd': 4 }
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, set([])).add(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
This will give you `d3`:
```
{'a': set([1]), 'c': set([3]), 'b': set([2, 5]), 'd': set([4])}
```
You can also do this with a list (possibly closer to your example):
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, []).append(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
You'll get this:
```
{'a': [1], 'c': [3, 3], 'b': [2, 2], 'd': [1]}
```
However, looking at `{'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}` (which can't be a dict), it seems that you're after a different data structure altogether. Perhaps something like this:
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
result = []
result += [ { 'key': key, 'value': d1[key] } for key in d1 ]
result += [ { 'key': key, 'value': d2[key] } for key in d2 ]
```
This would produce this, which looks closer to the data structure you had in mind initially:
```
[ {'value': 1, 'key': 'a'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 1, 'key': 'd'} ]
``` | What are you asking is not possible, since you cannot have two different keys with the same value in a Python dictionary.
The closest answer to your question is:
`D3 = dict( D1.items() + D2.items() )`
Note: if you have different values for the same key, the ones from D2 will be the ones in D3.
Example:
`D1 = { 'a':1, 'b'=2 }`
`D2 = { 'c':3, 'b':3}`
Then, D3 will be:
`D3= { 'a':1, 'b':3, 'c':3 }` |
12,511,801 | I have two dictionaries as follows:
`D1={'a':1,'b':2,'c':3}`
and
`D2={'b':2,'c':3,'d':1}`
I want to merge these two dictionaries and the result should be as follows:
`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`
how can I achieve this in python? | 2012/09/20 | [
"https://Stackoverflow.com/questions/12511801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321663/"
] | >
> I want to merge these two dictionaries and the result should be as
> follows:
>
>
> D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}
>
>
> how can I achieve this in python?
>
>
>
You can't. You can only have one value per key in a Python dict. What you can do is to have a list or a set as the value.
Here is an example with a set:
```
d1 = { 'a': 1, 'b': 2, 'c': 3 }
d2 = { 'a': 1, 'b': 5, 'd': 4 }
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, set([])).add(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
This will give you `d3`:
```
{'a': set([1]), 'c': set([3]), 'b': set([2, 5]), 'd': set([4])}
```
You can also do this with a list (possibly closer to your example):
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, []).append(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
You'll get this:
```
{'a': [1], 'c': [3, 3], 'b': [2, 2], 'd': [1]}
```
However, looking at `{'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}` (which can't be a dict), it seems that you're after a different data structure altogether. Perhaps something like this:
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
result = []
result += [ { 'key': key, 'value': d1[key] } for key in d1 ]
result += [ { 'key': key, 'value': d2[key] } for key in d2 ]
```
This would produce this, which looks closer to the data structure you had in mind initially:
```
[ {'value': 1, 'key': 'a'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 1, 'key': 'd'} ]
``` | Dictionaries by definition can't have duplicate keys, so "merging" dictionaries will actually give the following result (note the order is arbitrary):
```
{'a': 1, 'b': 2, 'c': 3, 'd': 1}
```
You can create a clone of one of the dictionaries and merge the entries from the other into it:
```
D3 = dict(D1)
D3.update(D2)
```
or you can create a new dictionary from the concatenation of the (key, value) tuples from each input dictionary:
```
D3 = dict(D1.items() + D2.items())
```
If you really want multiple values for duplicate keys, you need something like a list of values for each key:
```
from itertools import groupby
dict(( (key, [v for k, v in group]) for key, group in groupby(sorted(D1.items() + D2.items()), lambda x: x[0])))
``` |
12,511,801 | I have two dictionaries as follows:
`D1={'a':1,'b':2,'c':3}`
and
`D2={'b':2,'c':3,'d':1}`
I want to merge these two dictionaries and the result should be as follows:
`D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}`
how can I achieve this in python? | 2012/09/20 | [
"https://Stackoverflow.com/questions/12511801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1321663/"
] | >
> I want to merge these two dictionaries and the result should be as
> follows:
>
>
> D3={'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}
>
>
> how can I achieve this in python?
>
>
>
You can't. You can only have one value per key in a Python dict. What you can do is to have a list or a set as the value.
Here is an example with a set:
```
d1 = { 'a': 1, 'b': 2, 'c': 3 }
d2 = { 'a': 1, 'b': 5, 'd': 4 }
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, set([])).add(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
This will give you `d3`:
```
{'a': set([1]), 'c': set([3]), 'b': set([2, 5]), 'd': set([4])}
```
You can also do this with a list (possibly closer to your example):
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
d3 = {}
def add_dict(target, d):
for key in d:
target.setdefault(key, []).append(d[key])
add_dict(d3, d1)
add_dict(d3, d2)
```
You'll get this:
```
{'a': [1], 'c': [3, 3], 'b': [2, 2], 'd': [1]}
```
However, looking at `{'a':1,'b':2,'c':3,'b':2,'c':3,'d':1}` (which can't be a dict), it seems that you're after a different data structure altogether. Perhaps something like this:
```
d1 = { 'a':1, 'b':2, 'c': 3}
d2 = { 'b':2 ,'c':3, 'd': 1}
result = []
result += [ { 'key': key, 'value': d1[key] } for key in d1 ]
result += [ { 'key': key, 'value': d2[key] } for key in d2 ]
```
This would produce this, which looks closer to the data structure you had in mind initially:
```
[ {'value': 1, 'key': 'a'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 3, 'key': 'c'},
{'value': 2, 'key': 'b'},
{'value': 1, 'key': 'd'} ]
``` | ```
In [3]: D1={'a':1,'b':2,'c':3}
In [4]: D2={'b':2,'c':3,'d':1}
In [5]: D1.update(D2)
In [6]: D1
Out[6]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
```
**Update**
Alternative solutions
```
In [9]: D3=D1.copy()
In [10]: D3.update(D2)
In [11]: D3
Out[11]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
In [12]: D4=dict(D1, **D2)
```
or
```
In [13]: D4
Out[13]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
```
or
```
In [16]: D5 = dict(D1.items() + D2.items())
In [17]: D5
Out[17]: {'a': 1, 'b': 2, 'c': 3, 'd': 1}
``` |
69,908,135 | I just tried building my old project in vs2019 to newer vs2022 but getting following error and unable to build it.
Can somebody suggest what can be done to resolve the issue?
```
Severity Code Description Project File Line Suppression State
Error The "ResolveManifestFiles" task failed unexpectedly.
System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: name
v4.0_12.0.0.0_de_89845dcd8080cc91 is an invalid culture identifier.
at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
at Microsoft.Build.Tasks.ResolveManifestFiles.GetItemCulture(ITaskItem item)
at Microsoft.Build.Tasks.ResolveManifestFiles.GetOutputAssemblies(List`1 publishInfos, List`1 assemblyList)
at Microsoft.Build.Tasks.ResolveManifestFiles.GetOutputAssembliesAndSatellites(List`1 assemblyPublishInfos, List`1 satellitePublishInfos)
at Microsoft.Build.Tasks.ResolveManifestFiles.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() Kings ERP
``` | 2021/11/10 | [
"https://Stackoverflow.com/questions/69908135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1761822/"
] | Not sure why, but if you remove "Enable ClickOnce security settings" it'll work.
Regards | I did some research and finally I found the problematic code in my solution.
I have 198 Projects in my solution, in 197 of them is the line
[assembly: AssemblyCulture("")]
disabled: //[assembly: AssemblyCulture("")]
or the line does not exist at all
inside the Assembly.cs.
But in one of my (base) projects I found this:
[assembly: AssemblyCulture("en-US")]
After I changed it to: //[assembly: AssemblyCulture("en-US")]
everything works fine. |
72,363,010 | How can I add random numbers (for example from 1 to 100) into an array using Julia language? Also, the array already has to have a defined length (for example 30 numbers). | 2022/05/24 | [
"https://Stackoverflow.com/questions/72363010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19053578/"
] | If your initial vector is `v`, you can do as follows:
```
v .+= rand(1:100,length(v))
```
* `rand(1:100,length(v))` will generate a random vector of integers between 1 and 100 and of length identical to `v`'s one (the `length(v)` part), you can read the [rand()](https://docs.julialang.org/en/v1/stdlib/Random/#Base.rand) doc for further details.
* `.+=` is the Julia syntax to do an "in-place" vector addition. Concerning performance, this is an important syntax to know, see ["dot call" syntax](https://docs.julialang.org/en/v1/manual/mathematical-operations/#man-dot-operators)
---
**Update** a more efficient approach, is :
```
map!(vi->vi+rand(1:100),v,v)
```
Note: the approach is more efficient as it avoids the creation of the `rand(1:100,length(v))` temporary vector.
---
**Update** an alternative, if you want to **fill** (and not to add) the vector with random integers, is @DNS's one (see comment) :
```
using Random
v = Vector{Int}(undef,30)
rand!(v,1:100)
```
Note:
* `Vector{Int}(undef,30)` is the Julia's way to create a vector of 30 **uninitialized** integers.
* the `rand!()`function **fills** this vector with random integers. Internally it uses a for loop.
.
```
rand!(A::AbstractArray{T}, X) where {T} = rand!(default_rng(), A, X)
# ...
function rand!(rng::AbstractRNG, A::AbstractArray{T}, sp::Sampler) where T
for i in eachindex(A)
@inbounds A[i] = rand(rng, sp)
end
A
end
``` | the idiomatic way of doing this in one line is probably
```
julia> v = zeros(3)
julia> v .+= rand.((1:100, ))
3-element Vector{Float64}:
35.0
27.0
89.0
julia> @benchmark x .+= rand.((1:100, )) setup=(x = zeros(100))
BenchmarkTools.Trial: 10000 samples with 241 evaluations.
Range (min … max): 313.544 ns … 609.581 ns ┊ GC (min … max): 0.00% … 0.00%
Time (median): 323.021 ns ┊ GC (median): 0.00%
Time (mean ± σ): 327.143 ns ± 20.920 ns ┊ GC (mean ± σ): 0.00% ± 0.00%
▃▇██▇▆▆▅▄▃▂▂▁▁▁▁▁ ▁ ▂
██████████████████████████▇▇▆▆▆▅▆▆▆▅▅▅▅▁▅▄▃▅▁▁▁▃▃▁▁▁▃▄▃▃▁▁▁▁▃ █
314 ns Histogram: log(frequency) by time 415 ns <
Memory estimate: 0 bytes, allocs estimate: 0.
```
as you can see, this version is allocation-free thanks to broadcast loop fusion |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | My first exposure to étale cohomology was through Bjorn Poonen's notes [Rational Points on Varieties](http://www-math.mit.edu/~poonen/papers/Qpoints.pdf), Ch. 6. Not all of the big theorems are mentioned there, but it provides a great introduction to those who have had no previous dealings with the subject. | In the web page of [Uwe Jannsen](http://www.mathematik.uni-regensburg.de/Jannsen/) there are great lecture notes of (étale cohomology) courses. In particular:
Sommersemester 2015: [Étale Kohomologie](http://www.mathematik.uni-regensburg.de/Jannsen/home/UebungSS15/seminar-Dateien/Etale-gesamt.pdf) ([Eng](http://www.mathematik.uni-regensburg.de/Jannsen/Etale-gesamt-eng.pdf)). |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | I would highly recommend [these notes](http://www.math.purdue.edu/~dvb/preprints/etale.pdf) by Donu Arapura for a good overview of etale cohomology, as well as [this short paper](http://www.tomsutherland.postgrad.shef.ac.uk/etale.pdf) by Tom Sutherland for an even quicker overview. | In the web page of [Uwe Jannsen](http://www.mathematik.uni-regensburg.de/Jannsen/) there are great lecture notes of (étale cohomology) courses. In particular:
Sommersemester 2015: [Étale Kohomologie](http://www.mathematik.uni-regensburg.de/Jannsen/home/UebungSS15/seminar-Dateien/Etale-gesamt.pdf) ([Eng](http://www.mathematik.uni-regensburg.de/Jannsen/Etale-gesamt-eng.pdf)). |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | Not a textbook, but a free PDF by J.S. Milne, <http://www.jmilne.org/math/CourseNotes/LEC.pdf>, pretty good IMHO. | My first exposure to étale cohomology was through Bjorn Poonen's notes [Rational Points on Varieties](http://www-math.mit.edu/~poonen/papers/Qpoints.pdf), Ch. 6. Not all of the big theorems are mentioned there, but it provides a great introduction to those who have had no previous dealings with the subject. |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | Not a textbook, but a free PDF by J.S. Milne, <http://www.jmilne.org/math/CourseNotes/LEC.pdf>, pretty good IMHO. | In the web page of [Uwe Jannsen](http://www.mathematik.uni-regensburg.de/Jannsen/) there are great lecture notes of (étale cohomology) courses. In particular:
Sommersemester 2015: [Étale Kohomologie](http://www.mathematik.uni-regensburg.de/Jannsen/home/UebungSS15/seminar-Dateien/Etale-gesamt.pdf) ([Eng](http://www.mathematik.uni-regensburg.de/Jannsen/Etale-gesamt-eng.pdf)). |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | Lei Fu, Étale Cohomology Theory is also nice and has not been mentioned yet.
And the lecture notes of Alexander Schmidt: <http://theorics.yichuanshen.de/etale-kohomologie/> (unfortunately in German) | Here are some extra references:
* [Amazeen, Étale and Pro-Étale Fundamental Groups](http://page.mi.fu-berlin.de/lei/finalversion%20(1).pdf);
* [Belmans, Grothendieck Topologies and Étale Cohomology](https://pbelmans.ncag.info/notes/etale-cohomology.pdf);
* [Bergström--Rydh, Étale Cohomology Spring 2016](https://people.kth.se/~dary/etale-cohomology/);
* [Conrad (?), Étale Cohomology](https://www.math.ru.nl/~bmoonen/Seminars/EtCohConrad.pdf);
* [Hajj Chehade, Sheaf Cohomology on Sites and the Leray Spectral Sequence, Chapter
3](http://www.math.leidenuniv.nl/scripties/hajj.pdf);
* [Klingler, Étale Cohomology and the Weil Conjectures](https://webusers.imj-prg.fr/~bruno.klingler/cours/Weil.pdf);
* [Kunkel, Étale Fundamental Group: An Exposition](http://www.math.harvard.edu/theses/senior/kunkel/kunkel.pdf);
* [Laskar, Étale Cohomology](http://algant.eu/documents/theses/laskar.pdf);
* [Puttick, Galois Groups and the Étale Fundamental Group](https://webusers.imj-prg.fr/~jean-francois.dat/enseignement/memoires/M1AlexPuttick.pdf);
* [Robinson, Étale Cohomology](https://www.the-paper-trail.org/wp-content/uploads/2014/03/EC-Essay-1.pdf);
* [Sarlin, The Étale Fundamental Group, Étale Homotopy and Anabelian
Geometry](http://kth.diva-portal.org/smash/get/diva2:1165816/FULLTEXT01.pdf);
* [Szamuely, Galois Groups and Fundamental Groups, Chapter 5](https://www.cambridge.org/br/academic/subjects/mathematics/algebra/galois-groups-and-fundamental-groups-1);
* [The Stacks Project Authors, Étale Cohomology](https://stacks.math.columbia.edu/download/etale-cohomology.pdf);
* [Yang, Fundamental Groups of Schemes](https://www.math.u-bordeaux.fr/ALGANT/documents/theses/yang.pdf);
* [Zarabara, Étale Cohomology over $\mathrm{Spec}(k)$](http://algant.eu/documents/theses/zarabara.pdf). |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | I'll complement the list of well known books on the subject by some freely available documents, which I find user-friendly.
[Here](http://stacks.math.columbia.edu/download/etale-cohomology.pdf) are great lecture notes , from a course that de Jong (of Stacks Project fame) gave in 2009.
Edgar José Martins Dias Costa's [short dissertation](https://dspace.ist.utl.pt/bitstream/2295/686086/1/tese.pdf) on the subject .
Evan Jenkins's [notes](http://www.math.uchicago.edu/~ejenkins/etale.html) of a seminar on étale cohomology (click on the pdf icons).
The [arXiv notes](http://arxiv.org/PS_cache/arxiv/pdf/1101/1101.0683v1.pdf) of a mini-course given by a fine expositor, Antoine Ducros, which also cover analytical aspects of étale cohomology (used for Berkovich spaces).
And finally a [historic survey](http://www.math.u-psud.fr/~illusie/Grothendieck_etale.pdf) (in French unfortunately) on the genesis and successes of étale cohomology.
It was written by Illusie, one of Grothendieck's most brilliant students, who acknowledges the help he received in his reminiscences from luminaries such as Serre and Deligne. | In the web page of [Uwe Jannsen](http://www.mathematik.uni-regensburg.de/Jannsen/) there are great lecture notes of (étale cohomology) courses. In particular:
Sommersemester 2015: [Étale Kohomologie](http://www.mathematik.uni-regensburg.de/Jannsen/home/UebungSS15/seminar-Dateien/Etale-gesamt.pdf) ([Eng](http://www.mathematik.uni-regensburg.de/Jannsen/Etale-gesamt-eng.pdf)). |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | Not a textbook, but a free PDF by J.S. Milne, <http://www.jmilne.org/math/CourseNotes/LEC.pdf>, pretty good IMHO. | Here are some extra references:
* [Amazeen, Étale and Pro-Étale Fundamental Groups](http://page.mi.fu-berlin.de/lei/finalversion%20(1).pdf);
* [Belmans, Grothendieck Topologies and Étale Cohomology](https://pbelmans.ncag.info/notes/etale-cohomology.pdf);
* [Bergström--Rydh, Étale Cohomology Spring 2016](https://people.kth.se/~dary/etale-cohomology/);
* [Conrad (?), Étale Cohomology](https://www.math.ru.nl/~bmoonen/Seminars/EtCohConrad.pdf);
* [Hajj Chehade, Sheaf Cohomology on Sites and the Leray Spectral Sequence, Chapter
3](http://www.math.leidenuniv.nl/scripties/hajj.pdf);
* [Klingler, Étale Cohomology and the Weil Conjectures](https://webusers.imj-prg.fr/~bruno.klingler/cours/Weil.pdf);
* [Kunkel, Étale Fundamental Group: An Exposition](http://www.math.harvard.edu/theses/senior/kunkel/kunkel.pdf);
* [Laskar, Étale Cohomology](http://algant.eu/documents/theses/laskar.pdf);
* [Puttick, Galois Groups and the Étale Fundamental Group](https://webusers.imj-prg.fr/~jean-francois.dat/enseignement/memoires/M1AlexPuttick.pdf);
* [Robinson, Étale Cohomology](https://www.the-paper-trail.org/wp-content/uploads/2014/03/EC-Essay-1.pdf);
* [Sarlin, The Étale Fundamental Group, Étale Homotopy and Anabelian
Geometry](http://kth.diva-portal.org/smash/get/diva2:1165816/FULLTEXT01.pdf);
* [Szamuely, Galois Groups and Fundamental Groups, Chapter 5](https://www.cambridge.org/br/academic/subjects/mathematics/algebra/galois-groups-and-fundamental-groups-1);
* [The Stacks Project Authors, Étale Cohomology](https://stacks.math.columbia.edu/download/etale-cohomology.pdf);
* [Yang, Fundamental Groups of Schemes](https://www.math.u-bordeaux.fr/ALGANT/documents/theses/yang.pdf);
* [Zarabara, Étale Cohomology over $\mathrm{Spec}(k)$](http://algant.eu/documents/theses/zarabara.pdf). |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | I'll complement the list of well known books on the subject by some freely available documents, which I find user-friendly.
[Here](http://stacks.math.columbia.edu/download/etale-cohomology.pdf) are great lecture notes , from a course that de Jong (of Stacks Project fame) gave in 2009.
Edgar José Martins Dias Costa's [short dissertation](https://dspace.ist.utl.pt/bitstream/2295/686086/1/tese.pdf) on the subject .
Evan Jenkins's [notes](http://www.math.uchicago.edu/~ejenkins/etale.html) of a seminar on étale cohomology (click on the pdf icons).
The [arXiv notes](http://arxiv.org/PS_cache/arxiv/pdf/1101/1101.0683v1.pdf) of a mini-course given by a fine expositor, Antoine Ducros, which also cover analytical aspects of étale cohomology (used for Berkovich spaces).
And finally a [historic survey](http://www.math.u-psud.fr/~illusie/Grothendieck_etale.pdf) (in French unfortunately) on the genesis and successes of étale cohomology.
It was written by Illusie, one of Grothendieck's most brilliant students, who acknowledges the help he received in his reminiscences from luminaries such as Serre and Deligne. | Here are some extra references:
* [Amazeen, Étale and Pro-Étale Fundamental Groups](http://page.mi.fu-berlin.de/lei/finalversion%20(1).pdf);
* [Belmans, Grothendieck Topologies and Étale Cohomology](https://pbelmans.ncag.info/notes/etale-cohomology.pdf);
* [Bergström--Rydh, Étale Cohomology Spring 2016](https://people.kth.se/~dary/etale-cohomology/);
* [Conrad (?), Étale Cohomology](https://www.math.ru.nl/~bmoonen/Seminars/EtCohConrad.pdf);
* [Hajj Chehade, Sheaf Cohomology on Sites and the Leray Spectral Sequence, Chapter
3](http://www.math.leidenuniv.nl/scripties/hajj.pdf);
* [Klingler, Étale Cohomology and the Weil Conjectures](https://webusers.imj-prg.fr/~bruno.klingler/cours/Weil.pdf);
* [Kunkel, Étale Fundamental Group: An Exposition](http://www.math.harvard.edu/theses/senior/kunkel/kunkel.pdf);
* [Laskar, Étale Cohomology](http://algant.eu/documents/theses/laskar.pdf);
* [Puttick, Galois Groups and the Étale Fundamental Group](https://webusers.imj-prg.fr/~jean-francois.dat/enseignement/memoires/M1AlexPuttick.pdf);
* [Robinson, Étale Cohomology](https://www.the-paper-trail.org/wp-content/uploads/2014/03/EC-Essay-1.pdf);
* [Sarlin, The Étale Fundamental Group, Étale Homotopy and Anabelian
Geometry](http://kth.diva-portal.org/smash/get/diva2:1165816/FULLTEXT01.pdf);
* [Szamuely, Galois Groups and Fundamental Groups, Chapter 5](https://www.cambridge.org/br/academic/subjects/mathematics/algebra/galois-groups-and-fundamental-groups-1);
* [The Stacks Project Authors, Étale Cohomology](https://stacks.math.columbia.edu/download/etale-cohomology.pdf);
* [Yang, Fundamental Groups of Schemes](https://www.math.u-bordeaux.fr/ALGANT/documents/theses/yang.pdf);
* [Zarabara, Étale Cohomology over $\mathrm{Spec}(k)$](http://algant.eu/documents/theses/zarabara.pdf). |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | I'll complement the list of well known books on the subject by some freely available documents, which I find user-friendly.
[Here](http://stacks.math.columbia.edu/download/etale-cohomology.pdf) are great lecture notes , from a course that de Jong (of Stacks Project fame) gave in 2009.
Edgar José Martins Dias Costa's [short dissertation](https://dspace.ist.utl.pt/bitstream/2295/686086/1/tese.pdf) on the subject .
Evan Jenkins's [notes](http://www.math.uchicago.edu/~ejenkins/etale.html) of a seminar on étale cohomology (click on the pdf icons).
The [arXiv notes](http://arxiv.org/PS_cache/arxiv/pdf/1101/1101.0683v1.pdf) of a mini-course given by a fine expositor, Antoine Ducros, which also cover analytical aspects of étale cohomology (used for Berkovich spaces).
And finally a [historic survey](http://www.math.u-psud.fr/~illusie/Grothendieck_etale.pdf) (in French unfortunately) on the genesis and successes of étale cohomology.
It was written by Illusie, one of Grothendieck's most brilliant students, who acknowledges the help he received in his reminiscences from luminaries such as Serre and Deligne. | My first exposure to étale cohomology was through Bjorn Poonen's notes [Rational Points on Varieties](http://www-math.mit.edu/~poonen/papers/Qpoints.pdf), Ch. 6. Not all of the big theorems are mentioned there, but it provides a great introduction to those who have had no previous dealings with the subject. |
80,633 | What is the best textbook (or book) for studying Etale cohomology? | 2011/11/10 | [
"https://mathoverflow.net/questions/80633",
"https://mathoverflow.net",
"https://mathoverflow.net/users/-1/"
] | I'll complement the list of well known books on the subject by some freely available documents, which I find user-friendly.
[Here](http://stacks.math.columbia.edu/download/etale-cohomology.pdf) are great lecture notes , from a course that de Jong (of Stacks Project fame) gave in 2009.
Edgar José Martins Dias Costa's [short dissertation](https://dspace.ist.utl.pt/bitstream/2295/686086/1/tese.pdf) on the subject .
Evan Jenkins's [notes](http://www.math.uchicago.edu/~ejenkins/etale.html) of a seminar on étale cohomology (click on the pdf icons).
The [arXiv notes](http://arxiv.org/PS_cache/arxiv/pdf/1101/1101.0683v1.pdf) of a mini-course given by a fine expositor, Antoine Ducros, which also cover analytical aspects of étale cohomology (used for Berkovich spaces).
And finally a [historic survey](http://www.math.u-psud.fr/~illusie/Grothendieck_etale.pdf) (in French unfortunately) on the genesis and successes of étale cohomology.
It was written by Illusie, one of Grothendieck's most brilliant students, who acknowledges the help he received in his reminiscences from luminaries such as Serre and Deligne. | Lei Fu, Étale Cohomology Theory is also nice and has not been mentioned yet.
And the lecture notes of Alexander Schmidt: <http://theorics.yichuanshen.de/etale-kohomologie/> (unfortunately in German) |
58,595 | >
> Es ist für beide fast so, als **seien** sie niemals getrennt gewesen.
>
>
>
Warum wird hier der Konjunktiv 1 verwendet?
Es handelt sich um keine indirekte Rede wo der Konjunktiv 1 hauptsächlich verwendet wird.
Meines Wissens nach sollte hier Konjunktiv 2 verwendet werden, also:
>
> Es ist für beide fast so, als **wären** sie niemals getrennt gewesen.
>
>
> | 2020/05/14 | [
"https://german.stackexchange.com/questions/58595",
"https://german.stackexchange.com",
"https://german.stackexchange.com/users/40962/"
] | Von der Konsistenz her gesehen hast Du recht und es müsste der Konjunktiv 2 verwendet werden. Da sie tatsächlich getrennt waren, beschreibt der Nebensatz eine irreale Situation, wofür normalerweise der Konjunktiv 2 verwendet wird. Es liegt keine indirekte Rede (oder ähnliches) vor, die den Konjunktiv 1 verlangen würde.
Einige Präskriptivisten raten deshalb von dieser Verwendung ab, z. B. [Belles Lettres](https://www.belleslettres.eu/content/konjunktiv/konjunktiv.php#vergleich):
>
> Der Konjunktiv 1 hat in Vergleichssätzen allerdings nichts verloren. Die Wortkombinationen *als sei, als habe* usw. sind also immer falsch. Richtig sind *als wäre* und *als hätte*.
>
>
>
**Aber:** Es ist tatsächlich sehr üblich, dass in solchen irrealen Vergleichssätzen der Konjunktiv 1 verwendet wird. So beobachtet zum Beispiel [der Duden](https://www.duden.de/sprachwissen/sprachratgeber/Nebensatze-mit-als-ob-als-wenn-wie-wenn):
>
> In irrealen Vergleichssätzen mit *als ob, als wenn* und *wie wenn* wird sowohl der Konjunktiv I als auch der Konjunktiv II verwendet:
>
>
>
> >
> > Du tust ja geradezu, als ob du zu gar nichts zu gebrauchen wär[e]st/sei[e]st.
> >
> >
> >
>
>
> Der Konjunktiv II *([...] zu gebrauchen wärest)* ist aber üblicher. Das gilt auch für irreale Vergleichssätze mit *als* bei folgender Verbform:
>
>
>
> >
> > Sie lächelte, als hätte/habe sie niemals lügen müssen.
> >
> >
> >
>
>
>
Warum der Duden hier einen vagen Unterschied zwischen *als* und *als ob* macht, ist mir unklar. Mir ist kein Unterschied in der Verwendung bewusst.
Von diesem deskriptiven Standpunkt ist die Verwendung des Konjunktiv 1 in Vergleichssätzen legitim:
Es ist korrekt, weil es so verwendet wird (und zwar auch in der Hochsprache).
Ob diese Verwendung aus Schludrigkeit, Hyperkorrektur, dem Lateinischen, oder etwas anderem erwachsen ist, kann ich nicht sagen.
Die Antwort auf Deine Frage ist also:
Der Konjunktiv 1 wird hier verwendet, da es sich um einen irrealen Vergleichssatz handelt und diese einen Spezialfall darstellen. | Nach meinem persönlichen Sprachempfinden ist der Satz schlicht falsch, und er müsste korrekt lauten: "... als **wären** sie ..." |
57,032,235 | I'm trying to filter a Dataframe based on the length of the string in the index. In the following example I'm trying to filter out everything but `Foo Bar`:
```
index Value
Foo 1
Foo Bar 2
Bar 3
In: df[df.index.apply(lambda x: len(x.split()) > 1]
Out: AttributeError: 'Index' object has no attribute 'apply'
```
Is there any way to perform this operation directly on the index rather than resetting the index and applying the function on the new column? | 2019/07/15 | [
"https://Stackoverflow.com/questions/57032235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7542939/"
] | We do not need `apply` here
```
df[df.index.str.count(' ')==1]
```
To fix your code `map`
```
df[df.index.map(lambda x: len(x.split()) > 1)]
``` | I'm having success with the following:
```
>>> df[df.index.str.split().str.len() > 1]
Value
Foo Bar 2
```
Basically split the string and then use len() to count the number of occurrences. This has the benefit of allowing you to split however you want and filter however you want, without using apply. |
6,904,065 | this is from selenium grid. How to write java/C# code to make parallel execution.
Is this enough?
```
ISelenium selenium1 = new DefaultSelenium("localhost", 5555, "*iehta", "http://localhost/");
ISelenium selenium2 = new DefaultSelenium("localhost", 5556, "*iehta", "http://localhost/");
ISelenium selenium4 = new DefaultSelenium("localhost", 5557, "*iehta", "http://localhost/");
selenium1.Start();
selenium2.Start();
selenium3.Start();
```
Because when I run <http://localhost:4444/console> there are 3 Available Remote Controls but 0 Active Remote Controls even if I run code from up.
Code from ant which I do not understand 100%. Why is there parameter
`<arg value="-parallel"/>`?
```
<target name="run-demo-in-parallel" description="Run Selenium tests in parallel">
<java classpathref="demo.classpath"
classname="org.testng.TestNG"
failonerror="true"
>
<sysproperty key="java.security.policy" file="${basedir}/lib/testng.policy"/>
<sysproperty key="webSite" value="${webSite}" />
<sysproperty key="seleniumHost" value="${seleniumHost}" />
<sysproperty key="seleniumPort" value="${seleniumPort}" />
<sysproperty key="browser" value="${browser}" />
<arg value="-d" />
<arg value="${basedir}/target/reports" />
<arg value="-suitename" />
<arg value="Selenium Grid Demo In Parallel" />
<arg value="-parallel"/>
<arg value="methods"/>
<arg value="-threadcount"/>
<arg value="10"/>
<arg value="-testclass"/>
<arg value="com.thoughtworks.selenium.grid.demo.WebTestForASingleBrowser"/>
</java>
</target>
``` | 2011/08/01 | [
"https://Stackoverflow.com/questions/6904065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267679/"
] | Why is there parameter
```
<arg value="-parallel"/>?
```
This is for testng. This would run all the methods/classes/tests in parallel rather than sequentially. You can see more about this property [here](http://testng.org/doc/documentation-main.html#parallel-running). You have registered 3 RCs and ideally you should see all 3 being used for execution. You can check the grid console link to see the utilization - <http://localhost:4444/console> where localhost is the IP on which hub is running and port is the portnumber on which hub is listening to.
EDIT:
Change your code to point to selenium hub port rather than RC port. By default Hub port will be 4444. Also make sure you have started the RC nodes with environment as \*iehta.
```
`ISelenium selenium1 = new DefaultSelenium("localhost", 4444, "*iehta",` "http://localhost/");
``` | What you are doing will work but will be slow and almost as bad as doing it in a truly serial way. This is because most of the calls in Selenium will block until completion. To really take advantage of the parallelisation offered by the Grid, you should multi-thread your code. Have one thread for each Selenium object. |
6,904,065 | this is from selenium grid. How to write java/C# code to make parallel execution.
Is this enough?
```
ISelenium selenium1 = new DefaultSelenium("localhost", 5555, "*iehta", "http://localhost/");
ISelenium selenium2 = new DefaultSelenium("localhost", 5556, "*iehta", "http://localhost/");
ISelenium selenium4 = new DefaultSelenium("localhost", 5557, "*iehta", "http://localhost/");
selenium1.Start();
selenium2.Start();
selenium3.Start();
```
Because when I run <http://localhost:4444/console> there are 3 Available Remote Controls but 0 Active Remote Controls even if I run code from up.
Code from ant which I do not understand 100%. Why is there parameter
`<arg value="-parallel"/>`?
```
<target name="run-demo-in-parallel" description="Run Selenium tests in parallel">
<java classpathref="demo.classpath"
classname="org.testng.TestNG"
failonerror="true"
>
<sysproperty key="java.security.policy" file="${basedir}/lib/testng.policy"/>
<sysproperty key="webSite" value="${webSite}" />
<sysproperty key="seleniumHost" value="${seleniumHost}" />
<sysproperty key="seleniumPort" value="${seleniumPort}" />
<sysproperty key="browser" value="${browser}" />
<arg value="-d" />
<arg value="${basedir}/target/reports" />
<arg value="-suitename" />
<arg value="Selenium Grid Demo In Parallel" />
<arg value="-parallel"/>
<arg value="methods"/>
<arg value="-threadcount"/>
<arg value="10"/>
<arg value="-testclass"/>
<arg value="com.thoughtworks.selenium.grid.demo.WebTestForASingleBrowser"/>
</java>
</target>
``` | 2011/08/01 | [
"https://Stackoverflow.com/questions/6904065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267679/"
] | Why is there parameter
```
<arg value="-parallel"/>?
```
This is for testng. This would run all the methods/classes/tests in parallel rather than sequentially. You can see more about this property [here](http://testng.org/doc/documentation-main.html#parallel-running). You have registered 3 RCs and ideally you should see all 3 being used for execution. You can check the grid console link to see the utilization - <http://localhost:4444/console> where localhost is the IP on which hub is running and port is the portnumber on which hub is listening to.
EDIT:
Change your code to point to selenium hub port rather than RC port. By default Hub port will be 4444. Also make sure you have started the RC nodes with environment as \*iehta.
```
`ISelenium selenium1 = new DefaultSelenium("localhost", 4444, "*iehta",` "http://localhost/");
``` | You don't need to multi-thread your test code to run selenium instances in parallel (although you could if you really wanted to). A framework that handles thread forking can do it for you, such as TestNG, Maven Surefire, or Gradle. For example, my project proves this by demonstrating multiple instances running through grid on a single computer using Gradle to fork threads/instances: <https://github.com/djangofan/selenium-gradle-example> |
513,765 | The comments section of [this post](http://www.ehow.com/how_5157582_calculate-pi.html) says that $\pi$ does repeat itself if done under base 11... and that it somehow defines the universe.
* Can anyone expand on the idea that irrational numbers may repeat if a different base is used?
* Does $\pi$ in fact repeat under base 11?
* Is there any known value in numbers that have this property? (or conversely the ones that don't have this property?) | 2013/10/03 | [
"https://math.stackexchange.com/questions/513765",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/4420/"
] | The comment is mistaken.
A number is rational if and only if its expansion *in any base* is eventually recurring (possibly with a recurring string of $0$s). Thus $\pi$ has no recurring expansion in any base.
---
**Why?** Well suppose it did. Then
$$\pi = n . d\_1d\_2 \cdots d\_k \overline{r\_1 r\_2 \cdots r\_{\ell}}$$
in some base $b$ say, where $r\_1 \cdots r\_{\ell}$ is the recurring part. Thus
$$b^k\pi = m . \overline{r\_1 r\_2 \cdots r\_{\ell}}$$
where $m$ is some integer, it doesn't really matter what it is. Also notice
$$b^{k+\ell}\pi = mr\_1 r\_2 \cdots r\_{\ell}. \overline{r\_1 r\_2 \cdots r\_{\ell}}$$
Subtracting one from the other gives
$$b^{k+\ell}\pi - b^k\pi = mr\_1 r\_2 \cdots r\_{\ell} - m = M$$
where $M$ is again some integer, and hence
$$\pi = \dfrac{M}{b^{k+\ell} - b^k}$$
so $\pi$ is rational.
...this ain't true -- we know that $\pi$ is irrational -- so our assumption that $\pi$ has a recurring expansion to base $b$ must have been mistaken.
---
My notation above was a bit sloppy. The $d\_i$ and $r\_i$s refer to *digits* whilst the other letters refer to *numbers*. I hope it's understandable, but if it isn't then let me know and I'll clarify. | **A irrational number is a number that cannot be expressed as an integer over another integer.**
That is the *definition*, and it does not say anything at all about repeating or terminating decimals. It is a **theorem, not a definition** that when expanded in a base-$b$ numeral system, where $b\ge 2$, it does not terminate or repeat.
The erroneous definition, that rationality and irrationality are defined via terminating or repeating expansions, is a very very persistent meme, lasting many decades, without ever being taught in classrooms. Everyone who's graded homework assignments knows there are lots of memes that persist that way without ever being taught. |
513,765 | The comments section of [this post](http://www.ehow.com/how_5157582_calculate-pi.html) says that $\pi$ does repeat itself if done under base 11... and that it somehow defines the universe.
* Can anyone expand on the idea that irrational numbers may repeat if a different base is used?
* Does $\pi$ in fact repeat under base 11?
* Is there any known value in numbers that have this property? (or conversely the ones that don't have this property?) | 2013/10/03 | [
"https://math.stackexchange.com/questions/513765",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/4420/"
] | The comment is mistaken.
A number is rational if and only if its expansion *in any base* is eventually recurring (possibly with a recurring string of $0$s). Thus $\pi$ has no recurring expansion in any base.
---
**Why?** Well suppose it did. Then
$$\pi = n . d\_1d\_2 \cdots d\_k \overline{r\_1 r\_2 \cdots r\_{\ell}}$$
in some base $b$ say, where $r\_1 \cdots r\_{\ell}$ is the recurring part. Thus
$$b^k\pi = m . \overline{r\_1 r\_2 \cdots r\_{\ell}}$$
where $m$ is some integer, it doesn't really matter what it is. Also notice
$$b^{k+\ell}\pi = mr\_1 r\_2 \cdots r\_{\ell}. \overline{r\_1 r\_2 \cdots r\_{\ell}}$$
Subtracting one from the other gives
$$b^{k+\ell}\pi - b^k\pi = mr\_1 r\_2 \cdots r\_{\ell} - m = M$$
where $M$ is again some integer, and hence
$$\pi = \dfrac{M}{b^{k+\ell} - b^k}$$
so $\pi$ is rational.
...this ain't true -- we know that $\pi$ is irrational -- so our assumption that $\pi$ has a recurring expansion to base $b$ must have been mistaken.
---
My notation above was a bit sloppy. The $d\_i$ and $r\_i$s refer to *digits* whilst the other letters refer to *numbers*. I hope it's understandable, but if it isn't then let me know and I'll clarify. | >
> **Zach Lynch**
>
> actually, pi repeats if you use base 11 arithmetic and use a computer to search for patterns. It describes the universe as we know it.
>
>
>
*What* computer can tell whether a pattern will repeat? This means not knowing the basics of mathematics. The second statement is simply ridiculous. Please, be careful in believing to what can be found on the net.
A definition of an irrational number that uses base ten expansion would be ridiculous as well and indeed nobody seriously interested in mathematics would accept it.
A number is rational if some integer multiple of it is integer. It is irrational otherwise. The fact that $\pi$ is irrational has been established by Joahann Heinrich Lambert in 1761, more than 250 years ago. Can you believe that in 250 years nobody would have caught a flaw in the proof of such an important statement?
About a century later, Lindemann proved the fact that $\pi$ not only is irrational but also transcendental. The proof by Lindemann closed, with a negative answer, a 22 century old problem, that is, squaring the circle with ruler and compass. Can you believe that in more than 100 years nobody would have caught a flaw in Lindemann's proof or in the one of a more general theorem by Weierstraß?
Of course, this might be a conspiration involving all mathematicians, who don't want that the rationality of $\pi$ is known by the general public, because the NSA folks base on it their algorithms for decoding instantaneously all encrypted communications. |
513,765 | The comments section of [this post](http://www.ehow.com/how_5157582_calculate-pi.html) says that $\pi$ does repeat itself if done under base 11... and that it somehow defines the universe.
* Can anyone expand on the idea that irrational numbers may repeat if a different base is used?
* Does $\pi$ in fact repeat under base 11?
* Is there any known value in numbers that have this property? (or conversely the ones that don't have this property?) | 2013/10/03 | [
"https://math.stackexchange.com/questions/513765",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/4420/"
] | >
> **Zach Lynch**
>
> actually, pi repeats if you use base 11 arithmetic and use a computer to search for patterns. It describes the universe as we know it.
>
>
>
*What* computer can tell whether a pattern will repeat? This means not knowing the basics of mathematics. The second statement is simply ridiculous. Please, be careful in believing to what can be found on the net.
A definition of an irrational number that uses base ten expansion would be ridiculous as well and indeed nobody seriously interested in mathematics would accept it.
A number is rational if some integer multiple of it is integer. It is irrational otherwise. The fact that $\pi$ is irrational has been established by Joahann Heinrich Lambert in 1761, more than 250 years ago. Can you believe that in 250 years nobody would have caught a flaw in the proof of such an important statement?
About a century later, Lindemann proved the fact that $\pi$ not only is irrational but also transcendental. The proof by Lindemann closed, with a negative answer, a 22 century old problem, that is, squaring the circle with ruler and compass. Can you believe that in more than 100 years nobody would have caught a flaw in Lindemann's proof or in the one of a more general theorem by Weierstraß?
Of course, this might be a conspiration involving all mathematicians, who don't want that the rationality of $\pi$ is known by the general public, because the NSA folks base on it their algorithms for decoding instantaneously all encrypted communications. | **A irrational number is a number that cannot be expressed as an integer over another integer.**
That is the *definition*, and it does not say anything at all about repeating or terminating decimals. It is a **theorem, not a definition** that when expanded in a base-$b$ numeral system, where $b\ge 2$, it does not terminate or repeat.
The erroneous definition, that rationality and irrationality are defined via terminating or repeating expansions, is a very very persistent meme, lasting many decades, without ever being taught in classrooms. Everyone who's graded homework assignments knows there are lots of memes that persist that way without ever being taught. |
43,185,964 | Getting this error why trying to deploy the war in weblogic
>
> Caused By: weblogic.management.DeploymentException: [HTTP:101170]The
> servlet Web Rest Services is referenced in servlet-mapping /myrest/\*
> but not defined in web.xml.
> at weblogic.servlet.internal.WebAppServletContext.verifyServletMappings(WebAppServletContext.java:1465)
> at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2809)
> at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661)
> at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:822)
> at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360)
>
>
>
my web.xml:
```
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>REST</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>rest.apis</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Web Rest Services</servlet-name>
<url-pattern>/myrest/*</url-pattern>
</servlet-mapping>
</web-app>
```
If required I can paste the code of rest resources but not sure it matters.
What worries me, can there be issue with weblogic?
Note: Recently app server was upgraded to weblogic 12.1.2 | 2017/04/03 | [
"https://Stackoverflow.com/questions/43185964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1847484/"
] | >
> `<servlet-name --> Jersey Web Application != Web Rest Services`
>
>
>
The `<servlet-name>` in the `<servlet-mapping>` should correspond to a `<servlet-name>` in a `<servlet>` definition. Hence the error
>
> The servlet Web Rest Services is referenced in servlet-mapping /myrest/\* but not defined in web.xml
>
>
> | Try this configuration for your web.xml file:
```
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>NAME</display-name>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>YOUR REST CLASS PACKAGE</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>
</web-app>
```
And create an weblogic.xml file in the same folder (web-app\WEB-INF) like this:
```
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<library-ref>
<library-name>jax-rs</library-name>
<specification-version>2.0</specification-version>
<implementation-version>2.5.1</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<container-descriptor>
<prefer-application-packages>
<package-name>org.glassfish.jersey.media.*</package-name>
<package-name>org.glassfish.jersey.client.*</package-name>
<package-name>org.glassfish.jersey.servlet.*</package-name>
<package-name>org.glassfish.jersey.jaxb.internal.*</package-name>
<package-name>com.sun.research.ws.wadl.*</package-name>
<package-name>org.glassfish.hk2.*</package-name>
<package-name>org.jvnet.hk2.*</package-name>
<package-name>jersey.repackaged.org.objectweb.asm.*</package-name>
<package-name>org.objectweb.asm.*</package-name>
<package-name>com.sun.ws.rs.ext.*</package-name>
<package-name>org.aopalliance.*</package-name>
<package-name>javax.annotation.*</package-name>
<package-name>javax.inject.*</package-name>
<package-name>javax.ws.rs.*</package-name>
<package-name>jersey.repackaged.com.google.common.*</package-name>
<package-name>javassist.*</package-name>
</prefer-application-packages>
</container-descriptor>
<context-root>YOUR_ROOT</context-root>
</weblogic-web-app>
``` |
18,630,436 | I need to read permanent (burned-in) MAC address of network adapter. Since MAC address can be easily spoofed, I need to read the real one which is written on EEPROM. I need to do it using C++ on Linux.
I tried using [ethtool](http://linux.die.net/man/8/ethtool) which is quite good and works fine. However on some systems it does not work as intented.
```
ethtool -P eth0
```
returns this:
```
Permanent address: 00:00:00:00:00:00
```
and
```
ethtool -e eth0
```
returns this:
```
Cannot get EEPROM data: Operation not supported
```
---
Network Adapter has following info:
* driver: ucc\_geth
* version: 1.1
* firmware-version: N/A
* bus-info: QUICC ENGINE
Linux kernel version is: 2.6.32.13
Question is: Can i fix this issue with any update(driver, kernel etc)?
Additionally, I make the same ethtool calls with `ioctl` function in C++. Is there any way to fix this inside the code? Or is there any other way to get the permanent MAC address from EEPROM? | 2013/09/05 | [
"https://Stackoverflow.com/questions/18630436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1338432/"
] | If you haven't find the answer yet, you might want to check this out.
<https://serverfault.com/questions/316976/can-i-get-the-original-mac-address-after-it-has-been-changed> | Take a look at a couple of things.
1. Look at packets on the wire (using a sniffer) emanating from this NIC and see the MAC address being used.
2. Look at the output of "ifconfig -a eth0". If the MAC address is the same as on the wire, then you can get that MAC address using the [mechanism that ifconfig uses](http://sourceforge.net/p/net-tools/code/ci/master/tree/ifconfig.c). |
6,756 | It seems pretty normal to see screenshots of MS Word, steps for "this is how you generate a template". I don't think Microsoft would object.
But I'm not sure about reprinting images from in-game scenes for specific games, like Diablo II. Do you need to obtain permission to include a screenshot of a game in your book? | 2012/12/06 | [
"https://writers.stackexchange.com/questions/6756",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/389/"
] | There are four factors to determining Fair Use of copyrighted material that must be weighed in the balance:
* Purpose and character of use...better if not for profit; better if transforming in some way
* The nature of the work...factual is better, creative works less so
* The amount and substance of the work...less is better; uses that don't get at "the heart of the work" are better. There are no rules about percentages, etc, despite myths to the contrary.
* The effect of the use on market value...if it doesn't take away from real or potential profit, better
Depending on the nature of the book you are writing, you are probably quite safe using screenshots. You are likely writing something that will stimulate sales and that isn't going to reveal workings of the game that are protected.
Your publisher should have experience with this and probably has a policy for when they ask permission. Unfortunately, many people and organizations don't understand Fair Use and err too far on the side of caution, ceding rights they don't actually have to.
I teach about Fair Use regularly; you can find more information here: <http://iteachu.uaf.edu/develop-courses/constructing-a-course/copyright/> | There is a legal consideration concerning using part of one copyright work in another. The rules around it involve the quantity of material copied and the purpose for which it used.
However in your case there may be an over-riding consideration. If *Blizzard Entertainment* took exception to your use of material from *Diablo II*, would it harm the market for your book?
If there could be a negative impact from not seeking approval, then ask, whether or not you are strictly required to by law. |
6,756 | It seems pretty normal to see screenshots of MS Word, steps for "this is how you generate a template". I don't think Microsoft would object.
But I'm not sure about reprinting images from in-game scenes for specific games, like Diablo II. Do you need to obtain permission to include a screenshot of a game in your book? | 2012/12/06 | [
"https://writers.stackexchange.com/questions/6756",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/389/"
] | There is a legal consideration concerning using part of one copyright work in another. The rules around it involve the quantity of material copied and the purpose for which it used.
However in your case there may be an over-riding consideration. If *Blizzard Entertainment* took exception to your use of material from *Diablo II*, would it harm the market for your book?
If there could be a negative impact from not seeking approval, then ask, whether or not you are strictly required to by law. | The copyright information included with the game itself should tell you the answer to this. They will set out the parameters of what you can and can't do.
My hunch would be that a specific screenshot of a game in action, created by yourself, would be considered 'an original creative work' and would therefore not be restricted by the game publishers copyright rules.
However, you would really need to consult a lawyer specialising in copyright to know what you can and cannot do legally. |
6,756 | It seems pretty normal to see screenshots of MS Word, steps for "this is how you generate a template". I don't think Microsoft would object.
But I'm not sure about reprinting images from in-game scenes for specific games, like Diablo II. Do you need to obtain permission to include a screenshot of a game in your book? | 2012/12/06 | [
"https://writers.stackexchange.com/questions/6756",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/389/"
] | There is a legal consideration concerning using part of one copyright work in another. The rules around it involve the quantity of material copied and the purpose for which it used.
However in your case there may be an over-riding consideration. If *Blizzard Entertainment* took exception to your use of material from *Diablo II*, would it harm the market for your book?
If there could be a negative impact from not seeking approval, then ask, whether or not you are strictly required to by law. | Depends highly on the use.
If you were for example to make a story book and just use diablo screenshots as illustrations, that would (probably) not be considered fair use even if it is transformative. Neither would it be if you would just publish an outright art book by using the game assets as they are.
If you were making a book about the history of gaming in general, you do not need permissions to use screenshots. For this there is plenty of precedent and it is generally accepted practice, much the same that if you're making a documentary about 80's action movies you don't need permission to show the terminator 2 poster in context in the documentary.
However, it would be better for you if you took the screenshots yourself as that can put in another entity into the copyright chain. In other words you can't just copy the screenshots from a book containing all the nintendo games ever published and put them in your book about all the nintendo and sega games published.
Even including long stretches of video from a game even in a highly critical piece just badmouthing the game for 15 minutes is fair use(jim sterling vs. digital homicide, although that lawsuit wasn't just about the video I think they tried to claim copyright over it as well along the way). |
6,756 | It seems pretty normal to see screenshots of MS Word, steps for "this is how you generate a template". I don't think Microsoft would object.
But I'm not sure about reprinting images from in-game scenes for specific games, like Diablo II. Do you need to obtain permission to include a screenshot of a game in your book? | 2012/12/06 | [
"https://writers.stackexchange.com/questions/6756",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/389/"
] | There are four factors to determining Fair Use of copyrighted material that must be weighed in the balance:
* Purpose and character of use...better if not for profit; better if transforming in some way
* The nature of the work...factual is better, creative works less so
* The amount and substance of the work...less is better; uses that don't get at "the heart of the work" are better. There are no rules about percentages, etc, despite myths to the contrary.
* The effect of the use on market value...if it doesn't take away from real or potential profit, better
Depending on the nature of the book you are writing, you are probably quite safe using screenshots. You are likely writing something that will stimulate sales and that isn't going to reveal workings of the game that are protected.
Your publisher should have experience with this and probably has a policy for when they ask permission. Unfortunately, many people and organizations don't understand Fair Use and err too far on the side of caution, ceding rights they don't actually have to.
I teach about Fair Use regularly; you can find more information here: <http://iteachu.uaf.edu/develop-courses/constructing-a-course/copyright/> | The copyright information included with the game itself should tell you the answer to this. They will set out the parameters of what you can and can't do.
My hunch would be that a specific screenshot of a game in action, created by yourself, would be considered 'an original creative work' and would therefore not be restricted by the game publishers copyright rules.
However, you would really need to consult a lawyer specialising in copyright to know what you can and cannot do legally. |
6,756 | It seems pretty normal to see screenshots of MS Word, steps for "this is how you generate a template". I don't think Microsoft would object.
But I'm not sure about reprinting images from in-game scenes for specific games, like Diablo II. Do you need to obtain permission to include a screenshot of a game in your book? | 2012/12/06 | [
"https://writers.stackexchange.com/questions/6756",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/389/"
] | There are four factors to determining Fair Use of copyrighted material that must be weighed in the balance:
* Purpose and character of use...better if not for profit; better if transforming in some way
* The nature of the work...factual is better, creative works less so
* The amount and substance of the work...less is better; uses that don't get at "the heart of the work" are better. There are no rules about percentages, etc, despite myths to the contrary.
* The effect of the use on market value...if it doesn't take away from real or potential profit, better
Depending on the nature of the book you are writing, you are probably quite safe using screenshots. You are likely writing something that will stimulate sales and that isn't going to reveal workings of the game that are protected.
Your publisher should have experience with this and probably has a policy for when they ask permission. Unfortunately, many people and organizations don't understand Fair Use and err too far on the side of caution, ceding rights they don't actually have to.
I teach about Fair Use regularly; you can find more information here: <http://iteachu.uaf.edu/develop-courses/constructing-a-course/copyright/> | Depends highly on the use.
If you were for example to make a story book and just use diablo screenshots as illustrations, that would (probably) not be considered fair use even if it is transformative. Neither would it be if you would just publish an outright art book by using the game assets as they are.
If you were making a book about the history of gaming in general, you do not need permissions to use screenshots. For this there is plenty of precedent and it is generally accepted practice, much the same that if you're making a documentary about 80's action movies you don't need permission to show the terminator 2 poster in context in the documentary.
However, it would be better for you if you took the screenshots yourself as that can put in another entity into the copyright chain. In other words you can't just copy the screenshots from a book containing all the nintendo games ever published and put them in your book about all the nintendo and sega games published.
Even including long stretches of video from a game even in a highly critical piece just badmouthing the game for 15 minutes is fair use(jim sterling vs. digital homicide, although that lawsuit wasn't just about the video I think they tried to claim copyright over it as well along the way). |
6,756 | It seems pretty normal to see screenshots of MS Word, steps for "this is how you generate a template". I don't think Microsoft would object.
But I'm not sure about reprinting images from in-game scenes for specific games, like Diablo II. Do you need to obtain permission to include a screenshot of a game in your book? | 2012/12/06 | [
"https://writers.stackexchange.com/questions/6756",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/389/"
] | Depends highly on the use.
If you were for example to make a story book and just use diablo screenshots as illustrations, that would (probably) not be considered fair use even if it is transformative. Neither would it be if you would just publish an outright art book by using the game assets as they are.
If you were making a book about the history of gaming in general, you do not need permissions to use screenshots. For this there is plenty of precedent and it is generally accepted practice, much the same that if you're making a documentary about 80's action movies you don't need permission to show the terminator 2 poster in context in the documentary.
However, it would be better for you if you took the screenshots yourself as that can put in another entity into the copyright chain. In other words you can't just copy the screenshots from a book containing all the nintendo games ever published and put them in your book about all the nintendo and sega games published.
Even including long stretches of video from a game even in a highly critical piece just badmouthing the game for 15 minutes is fair use(jim sterling vs. digital homicide, although that lawsuit wasn't just about the video I think they tried to claim copyright over it as well along the way). | The copyright information included with the game itself should tell you the answer to this. They will set out the parameters of what you can and can't do.
My hunch would be that a specific screenshot of a game in action, created by yourself, would be considered 'an original creative work' and would therefore not be restricted by the game publishers copyright rules.
However, you would really need to consult a lawyer specialising in copyright to know what you can and cannot do legally. |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | ```
git remote rm heroku
heroku git:remote -a newname
``` | There is another way, you can fix it by renaming the app to the original name via web.
To find out the old name use heroku command line:
```
> heroku rename newname
```
which will spit out the old name. Use the old name to rename the app via web. You can check if renaming success by running
```
> heroku info
```
Once done you can rename to the preferred name by using
```
> heroku rename preferredname
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | Try to update the git remote for the app:
```
git remote rm heroku
git remote add heroku [email protected]:yourappname.git
``` | ```
git remote rm heroku
heroku git:remote -a newname
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | The Answer by James Ward is also correct, alternatively try doing this:
1). open a terminal
2). Go to your\_app\_directory/.git/config
3). Once you open the config file then edit as follows:
Change
```
url = [email protected]:old_app_name.git
```
to
```
url = [email protected]:new_app_name.git
```
Obviously substituting your apps old name to its new name. Hope it helps
Also checkout this link [renaming from cli - heroku](http://devcenter.heroku.com/articles/renaming-apps) | James Ward's solution didn't work for me. I had to enter my git url in a different format:
```
git remote rm heroku
git remote add heroku https://git.heroku.com/appname.git
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | Try to update the git remote for the app:
```
git remote rm heroku
git remote add heroku [email protected]:yourappname.git
``` | James Ward's solution didn't work for me. I had to enter my git url in a different format:
```
git remote rm heroku
git remote add heroku https://git.heroku.com/appname.git
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | ```
git remote rm heroku
heroku git:remote -a newname
``` | From [the Heroku docs](https://devcenter.heroku.com/articles/renaming-apps#updating-git-remotes)...
>
> If you rename from the website ... [your app] will need to be updated manually:
>
>
>
```
git remote rm heroku
heroku git:remote -a newname
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | From [the Heroku docs](https://devcenter.heroku.com/articles/renaming-apps#updating-git-remotes)...
>
> If you rename from the website ... [your app] will need to be updated manually:
>
>
>
```
git remote rm heroku
heroku git:remote -a newname
``` | James Ward's solution didn't work for me. I had to enter my git url in a different format:
```
git remote rm heroku
git remote add heroku https://git.heroku.com/appname.git
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | The Answer by James Ward is also correct, alternatively try doing this:
1). open a terminal
2). Go to your\_app\_directory/.git/config
3). Once you open the config file then edit as follows:
Change
```
url = [email protected]:old_app_name.git
```
to
```
url = [email protected]:new_app_name.git
```
Obviously substituting your apps old name to its new name. Hope it helps
Also checkout this link [renaming from cli - heroku](http://devcenter.heroku.com/articles/renaming-apps) | ```
git remote rm heroku
heroku git:remote -a newname
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | The Answer by James Ward is also correct, alternatively try doing this:
1). open a terminal
2). Go to your\_app\_directory/.git/config
3). Once you open the config file then edit as follows:
Change
```
url = [email protected]:old_app_name.git
```
to
```
url = [email protected]:new_app_name.git
```
Obviously substituting your apps old name to its new name. Hope it helps
Also checkout this link [renaming from cli - heroku](http://devcenter.heroku.com/articles/renaming-apps) | There is another way, you can fix it by renaming the app to the original name via web.
To find out the old name use heroku command line:
```
> heroku rename newname
```
which will spit out the old name. Use the old name to rename the app via web. You can check if renaming success by running
```
> heroku info
```
Once done you can rename to the preferred name by using
```
> heroku rename preferredname
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | There is another way, you can fix it by renaming the app to the original name via web.
To find out the old name use heroku command line:
```
> heroku rename newname
```
which will spit out the old name. Use the old name to rename the app via web. You can check if renaming success by running
```
> heroku info
```
Once done you can rename to the preferred name by using
```
> heroku rename preferredname
``` | James Ward's solution didn't work for me. I had to enter my git url in a different format:
```
git remote rm heroku
git remote add heroku https://git.heroku.com/appname.git
``` |
7,615,807 | After renaming my heroku app from the heroku website, whenever I cd to its directory in a terminal and run any heroku command, I get `App not found`. Does anybody know of a way to remedy this? | 2011/09/30 | [
"https://Stackoverflow.com/questions/7615807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454761/"
] | ```
git remote rm heroku
heroku git:remote -a newname
``` | James Ward's solution didn't work for me. I had to enter my git url in a different format:
```
git remote rm heroku
git remote add heroku https://git.heroku.com/appname.git
``` |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Google doesn't find database records. Google finds web pages. If you want your classifieds to be found then they'll need to be on a Web page of some kind. You can help this process by giving Google a site map/index of all your classifieds.
I suggest you take a look at [Google Basics](http://www.google.com/support/webmasters/bin/answer.py?answer=70897&hl=en) and [Creating and submitting SitemapsPrint](http://www.google.com/support/webmasters/bin/answer.py?answer=156184&hl=en). Basically the idea is to spoon feed Google every URL you want Google to find. So if your reference your classifieds this way:
```
http://www.mysite.com/classified?id=1234
```
then you create a list of every URL required to find every classified and yes this might be hundreds of thousands or even millions.
The above assumes a single classified per page. You can of course put 5, 10, 50 or 100 on a single page and then create a smaller set of URLs for Google to crawl.
Whatever you do however remember this: your sitemap should reflect how your site is used. Every URL Google finds (or you give it) will appear in the index. So don't give Google a URL that a user couldn't reach by using the site normally or that you don't want a user to use.
So while 50 classifieds per page might mean less requests from Google, if that's not how you want users to use your site (or a view you want to provide) then you'll have to do it some other way.
Just remember: Google indexes *Web pages* not *data*. | How would you normally access these classifieds? You're not just keeping them locked up in the database, are you?
Google sees your website like any other visitor would see your website. If you have a normal database-driven site, there's some unique URL for each classified where it it displayed. If there's a link to it somewhere, Google will find it. |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How would you normally access these classifieds? You're not just keeping them locked up in the database, are you?
Google sees your website like any other visitor would see your website. If you have a normal database-driven site, there's some unique URL for each classified where it it displayed. If there's a link to it somewhere, Google will find it. | Google can find you no matter *where* you try to hide. Even if you can somehow fit yourself into a mysql table. Because they're Google. :-D
Seriously, though, they use a bot to periodically spider your site so you mostly just need to make the data in your database available as web pages on your site, and make your site bot-friendly (use an appropriate robots.txt file, provide a search engine-friendly site map, etc.) You need to make sure they can *find* your site, so make sure it's linked to by other sites -- preferably sites with lots of traffic.
If your site only displays specific results in response to search terms you'll have a harder time. You may want to make full lists of the records available for people without search terms (paged appropriately if you have lots of data). |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How would you normally access these classifieds? You're not just keeping them locked up in the database, are you?
Google sees your website like any other visitor would see your website. If you have a normal database-driven site, there's some unique URL for each classified where it it displayed. If there's a link to it somewhere, Google will find it. | First Create a PHP file that pulls the index plus human readable reference for all records.
That is your main page broken out into categories (like in the case of Craigslist.com - by Country and State).
Then each category link feeds back to the php script the selected value regardless of level(s) finally reaching the ad itself.
So, If a category is selected which contains more categories (like states contain cities) Then display the next list of categories. Else display the list of ads for that city.
This will give Google.com a way to index a site (aka mysql db) dynamically with out creating static content for the millions (billions or trillions) of records involved.
This is Just an idea of how to get Google.com to index a database. |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Google doesn't find database records. Google finds web pages. If you want your classifieds to be found then they'll need to be on a Web page of some kind. You can help this process by giving Google a site map/index of all your classifieds.
I suggest you take a look at [Google Basics](http://www.google.com/support/webmasters/bin/answer.py?answer=70897&hl=en) and [Creating and submitting SitemapsPrint](http://www.google.com/support/webmasters/bin/answer.py?answer=156184&hl=en). Basically the idea is to spoon feed Google every URL you want Google to find. So if your reference your classifieds this way:
```
http://www.mysite.com/classified?id=1234
```
then you create a list of every URL required to find every classified and yes this might be hundreds of thousands or even millions.
The above assumes a single classified per page. You can of course put 5, 10, 50 or 100 on a single page and then create a smaller set of URLs for Google to crawl.
Whatever you do however remember this: your sitemap should reflect how your site is used. Every URL Google finds (or you give it) will appear in the index. So don't give Google a URL that a user couldn't reach by using the site normally or that you don't want a user to use.
So while 50 classifieds per page might mean less requests from Google, if that's not how you want users to use your site (or a view you want to provide) then you'll have to do it some other way.
Just remember: Google indexes *Web pages* not *data*. | If you want Google to index your site, you need to put all your pages on the web and link between them.
You do not have to auto-generate a static HTML page for everything, all pages can be dynamically created (JSP, ASP, PHP, what have you), but they need to be accessible for a web crawler. |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you want Google to index your site, you need to put all your pages on the web and link between them.
You do not have to auto-generate a static HTML page for everything, all pages can be dynamically created (JSP, ASP, PHP, what have you), but they need to be accessible for a web crawler. | Google can find you no matter *where* you try to hide. Even if you can somehow fit yourself into a mysql table. Because they're Google. :-D
Seriously, though, they use a bot to periodically spider your site so you mostly just need to make the data in your database available as web pages on your site, and make your site bot-friendly (use an appropriate robots.txt file, provide a search engine-friendly site map, etc.) You need to make sure they can *find* your site, so make sure it's linked to by other sites -- preferably sites with lots of traffic.
If your site only displays specific results in response to search terms you'll have a harder time. You may want to make full lists of the records available for people without search terms (paged appropriately if you have lots of data). |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If you want Google to index your site, you need to put all your pages on the web and link between them.
You do not have to auto-generate a static HTML page for everything, all pages can be dynamically created (JSP, ASP, PHP, what have you), but they need to be accessible for a web crawler. | First Create a PHP file that pulls the index plus human readable reference for all records.
That is your main page broken out into categories (like in the case of Craigslist.com - by Country and State).
Then each category link feeds back to the php script the selected value regardless of level(s) finally reaching the ad itself.
So, If a category is selected which contains more categories (like states contain cities) Then display the next list of categories. Else display the list of ads for that city.
This will give Google.com a way to index a site (aka mysql db) dynamically with out creating static content for the millions (billions or trillions) of records involved.
This is Just an idea of how to get Google.com to index a database. |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Google doesn't find database records. Google finds web pages. If you want your classifieds to be found then they'll need to be on a Web page of some kind. You can help this process by giving Google a site map/index of all your classifieds.
I suggest you take a look at [Google Basics](http://www.google.com/support/webmasters/bin/answer.py?answer=70897&hl=en) and [Creating and submitting SitemapsPrint](http://www.google.com/support/webmasters/bin/answer.py?answer=156184&hl=en). Basically the idea is to spoon feed Google every URL you want Google to find. So if your reference your classifieds this way:
```
http://www.mysite.com/classified?id=1234
```
then you create a list of every URL required to find every classified and yes this might be hundreds of thousands or even millions.
The above assumes a single classified per page. You can of course put 5, 10, 50 or 100 on a single page and then create a smaller set of URLs for Google to crawl.
Whatever you do however remember this: your sitemap should reflect how your site is used. Every URL Google finds (or you give it) will appear in the index. So don't give Google a URL that a user couldn't reach by using the site normally or that you don't want a user to use.
So while 50 classifieds per page might mean less requests from Google, if that's not how you want users to use your site (or a view you want to provide) then you'll have to do it some other way.
Just remember: Google indexes *Web pages* not *data*. | Google can find you no matter *where* you try to hide. Even if you can somehow fit yourself into a mysql table. Because they're Google. :-D
Seriously, though, they use a bot to periodically spider your site so you mostly just need to make the data in your database available as web pages on your site, and make your site bot-friendly (use an appropriate robots.txt file, provide a search engine-friendly site map, etc.) You need to make sure they can *find* your site, so make sure it's linked to by other sites -- preferably sites with lots of traffic.
If your site only displays specific results in response to search terms you'll have a harder time. You may want to make full lists of the records available for people without search terms (paged appropriately if you have lots of data). |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Google doesn't find database records. Google finds web pages. If you want your classifieds to be found then they'll need to be on a Web page of some kind. You can help this process by giving Google a site map/index of all your classifieds.
I suggest you take a look at [Google Basics](http://www.google.com/support/webmasters/bin/answer.py?answer=70897&hl=en) and [Creating and submitting SitemapsPrint](http://www.google.com/support/webmasters/bin/answer.py?answer=156184&hl=en). Basically the idea is to spoon feed Google every URL you want Google to find. So if your reference your classifieds this way:
```
http://www.mysite.com/classified?id=1234
```
then you create a list of every URL required to find every classified and yes this might be hundreds of thousands or even millions.
The above assumes a single classified per page. You can of course put 5, 10, 50 or 100 on a single page and then create a smaller set of URLs for Google to crawl.
Whatever you do however remember this: your sitemap should reflect how your site is used. Every URL Google finds (or you give it) will appear in the index. So don't give Google a URL that a user couldn't reach by using the site normally or that you don't want a user to use.
So while 50 classifieds per page might mean less requests from Google, if that's not how you want users to use your site (or a view you want to provide) then you'll have to do it some other way.
Just remember: Google indexes *Web pages* not *data*. | First Create a PHP file that pulls the index plus human readable reference for all records.
That is your main page broken out into categories (like in the case of Craigslist.com - by Country and State).
Then each category link feeds back to the php script the selected value regardless of level(s) finally reaching the ad itself.
So, If a category is selected which contains more categories (like states contain cities) Then display the next list of categories. Else display the list of ads for that city.
This will give Google.com a way to index a site (aka mysql db) dynamically with out creating static content for the millions (billions or trillions) of records involved.
This is Just an idea of how to get Google.com to index a database. |
1,746,676 | I am creating a classifieds website.
Im storing all ads in mysql database, in different tables.
Is it possible to find these ads somehow, from googles search engine?
Is it possible to create meta information about each ad so that google finds them?
How does major companies do this?
I have thought about auto-generating a html-page for each ad inserted, but 500thousand auto-generated html pages doesn't really sound that good of a solution!
Any thoughts and idéas?
**UPDATE**:
Here is my basic website so far:
(ALL PHP BASED)
I have a search engine which searches database for records.
After finding and displaying search results, you can click on a result ('ad') and then PHP fetches info from the database and displays it, simple!
In the 'put ad' section of my site, you can put your own ad into a mysql database.
I need to know how I should make google find ads in my website also, as I dont think google-crawler can search my database just because users can.
Please explain your answers more thoroughly so that I understand fully how this works!
Thank you | 2009/11/17 | [
"https://Stackoverflow.com/questions/1746676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Google can find you no matter *where* you try to hide. Even if you can somehow fit yourself into a mysql table. Because they're Google. :-D
Seriously, though, they use a bot to periodically spider your site so you mostly just need to make the data in your database available as web pages on your site, and make your site bot-friendly (use an appropriate robots.txt file, provide a search engine-friendly site map, etc.) You need to make sure they can *find* your site, so make sure it's linked to by other sites -- preferably sites with lots of traffic.
If your site only displays specific results in response to search terms you'll have a harder time. You may want to make full lists of the records available for people without search terms (paged appropriately if you have lots of data). | First Create a PHP file that pulls the index plus human readable reference for all records.
That is your main page broken out into categories (like in the case of Craigslist.com - by Country and State).
Then each category link feeds back to the php script the selected value regardless of level(s) finally reaching the ad itself.
So, If a category is selected which contains more categories (like states contain cities) Then display the next list of categories. Else display the list of ads for that city.
This will give Google.com a way to index a site (aka mysql db) dynamically with out creating static content for the millions (billions or trillions) of records involved.
This is Just an idea of how to get Google.com to index a database. |
213,778 | I want to perform a statistical test: Wilcoxon Signed Rank Test to test if there is a significant difference between them, but I don't know if the two samples are dependent or not?
Context: I have a dataset that contains a set of elements, I want to predict the dependent variable, I use two models A and B to perform the prediction using LOOCV. So, I have two samples based on the absolute errors (sample A: contains the absolute errors based on prediction of Model A, Sample B: contains the absolute erroers based on prediction of Model B).
My Question: is the sample A and B are dependent or independent?
Thank you in advance | 2016/05/21 | [
"https://stats.stackexchange.com/questions/213778",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/116392/"
] | The answer is *dependent*. Or, to be a bit more precise: paired.
The thing to keep in mind here is that you only have one sample, and have two measurements for each observations in that sample.
If, instead, you had two distinct samples (e.g., one representing the first 100 cases in your data set and the other the second 100 cases), and were comparing the predictive accuracy between these two samples, you would then have two independent samples. | Two or more samples are said to be dependent, in short, if one sample is dependent or is influenced by another. Suppose, one wants to study earning difference between men and women. So s/he randomly selects 100 men and 100 women, and records interested variable values. In this case, the samples are independent because a man's earning value cannot be related to that of a woman. Let's again say, one collects data of 100 couples. Here, the samples are dependent in that couples tend to have similarities in aspects like *level of education*, *ambition*, *ethnicity*, etc. If one finds factors that are likely to affect samples, then they should be treated as dependent. |
22,875,579 | I would like to add a CSS class to a Bootstrap (3.x) tooltip, but it seems not working. So I would like to use Firebug to inspect the tooltip content. However, when I move my mouse to the Firebug area, the dynamically generated tooltip disappers.
How can I inspect a dynamically generated Bootstrap tooltip?
Here is the [jsfiddle link](http://jsfiddle.net/mddc/4JGx9/9/).
```
<label>
Some Text
<a href="#" data-toggle="tooltip" title="Tooltip goes here!">?</a>
</label>
$(function() {
$('[data-toggle="tooltip"]').tooltip({
'animation': true,
'placement': 'top'
});
});
```
Thanks! | 2014/04/05 | [
"https://Stackoverflow.com/questions/22875579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/997474/"
] | 1. Enable the [*Script* panel](https://getfirebug.com/wiki/index.php/Script_Panel)
2. Reload the page
3. Inspect the `<label>` element containing `Some Text?`
4. Right-click the element and choose *Break On Child Addition or Removal* from the context menu
5. Move the mouse over the question mark
=> The script execution will stop and you'll see a hint showing you the tooltip element.

6. Press the *Step Over* button () or press `F10` once, so the element is added to the DOM
7. Switch to the [*HTML* panel](https://getfirebug.com/wiki/index.php/HTML_Panel)
=> There you'll see the `<div>` containing the tooltip and you'll be able to check its styles.
 | I was looking for
How to inspect a JQuery tooltip in firebug
1. Inspect the element in Firebug
2. Select the "Event" tab to the right
3. Disable the mouseoutevent.
4. Now when the mouse is gone from the element, the tooltip stays. Can be inspected as any other element via FireBug.
Here is a small video: <https://youtu.be/msTU8JDnaBU> |
22,875,579 | I would like to add a CSS class to a Bootstrap (3.x) tooltip, but it seems not working. So I would like to use Firebug to inspect the tooltip content. However, when I move my mouse to the Firebug area, the dynamically generated tooltip disappers.
How can I inspect a dynamically generated Bootstrap tooltip?
Here is the [jsfiddle link](http://jsfiddle.net/mddc/4JGx9/9/).
```
<label>
Some Text
<a href="#" data-toggle="tooltip" title="Tooltip goes here!">?</a>
</label>
$(function() {
$('[data-toggle="tooltip"]').tooltip({
'animation': true,
'placement': 'top'
});
});
```
Thanks! | 2014/04/05 | [
"https://Stackoverflow.com/questions/22875579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/997474/"
] | 1. Enable the [*Script* panel](https://getfirebug.com/wiki/index.php/Script_Panel)
2. Reload the page
3. Inspect the `<label>` element containing `Some Text?`
4. Right-click the element and choose *Break On Child Addition or Removal* from the context menu
5. Move the mouse over the question mark
=> The script execution will stop and you'll see a hint showing you the tooltip element.

6. Press the *Step Over* button () or press `F10` once, so the element is added to the DOM
7. Switch to the [*HTML* panel](https://getfirebug.com/wiki/index.php/HTML_Panel)
=> There you'll see the `<div>` containing the tooltip and you'll be able to check its styles.
 | I found that the only MAIN step (instead of steps 1-5 in the accepted answer of Sebastian Zartner) is to FIRST enable Firebug's HTML tab's "Break On Mutate" button. It is the most left-top button in that tab.
With just this step, JavaScript will be paused when there is dynamically shown tool-tip. Then, you could inspect the CSS style, or use Script's step over button to see the Javascript line of that tooltip.
Firebug version is 2.0.17 |
22,875,579 | I would like to add a CSS class to a Bootstrap (3.x) tooltip, but it seems not working. So I would like to use Firebug to inspect the tooltip content. However, when I move my mouse to the Firebug area, the dynamically generated tooltip disappers.
How can I inspect a dynamically generated Bootstrap tooltip?
Here is the [jsfiddle link](http://jsfiddle.net/mddc/4JGx9/9/).
```
<label>
Some Text
<a href="#" data-toggle="tooltip" title="Tooltip goes here!">?</a>
</label>
$(function() {
$('[data-toggle="tooltip"]').tooltip({
'animation': true,
'placement': 'top'
});
});
```
Thanks! | 2014/04/05 | [
"https://Stackoverflow.com/questions/22875579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/997474/"
] | I was looking for
How to inspect a JQuery tooltip in firebug
1. Inspect the element in Firebug
2. Select the "Event" tab to the right
3. Disable the mouseoutevent.
4. Now when the mouse is gone from the element, the tooltip stays. Can be inspected as any other element via FireBug.
Here is a small video: <https://youtu.be/msTU8JDnaBU> | I found that the only MAIN step (instead of steps 1-5 in the accepted answer of Sebastian Zartner) is to FIRST enable Firebug's HTML tab's "Break On Mutate" button. It is the most left-top button in that tab.
With just this step, JavaScript will be paused when there is dynamically shown tool-tip. Then, you could inspect the CSS style, or use Script's step over button to see the Javascript line of that tooltip.
Firebug version is 2.0.17 |
64,288,547 | Currently doing a school mini-project where we have to make a program to extract the domain name from a few given URL's, and put those which end in .uk (ie are websites from the united kingdom) in a list.
A couple of specifications:
* We cannot import any modules or anything.
* We can ignore urls that don't start with either "http://" or "https://"
I was originally just going to do:
```
uksites = []
file = open('urlfile.txt','r')
urllist = file.read().splitlines()
for url in urllist:
if "http://" in url:
domainstart = url.find("http://") + len("http://")
elif "https://" in url:
domainstart = url.find("https://") + len("https://")
domainend = url.find("/", domainstart)
if domainend >= 0:
domain = url[domainstart:domainend]
else:
domain = url[domainstart:]
if domain[-3:] = ".uk":
uksites.append(url)
```
But then our professor warned us that not all domain names will be ended with a "/" (for example, one of the given ones in the test file we were supplied ends with ":")
Is this the only other valid character that can signify the end of a domain name? or are there even more?
If so how could I approach this?
The test file is pretty short, it contains a few "links" (some aren't real sites apparently):
```
http://google.com.au/
https://google.co.uk/
https://00.auga.com/shop/angel-haired-dress/
http://applesandoranges.co.uk:articles/best-seasonal-fruits-for-your-garden/
https://www.youtube.com/watch?v=GVbG35DeMto
http://docs.oracle.com/en/java/javase/11/docs/api/
https://www.instagram.co.uk/posts/hjgjh42324/
``` | 2020/10/09 | [
"https://Stackoverflow.com/questions/64288547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13292868/"
] | This should work
```py
def compute():
ret = []
hs = ['https:', 'http:']
domains = ['uk']
file = open('urlfile.txt','r')
urllist = file.read().splitlines()
for url in urllist:
url_t = url.split('/')
# \setminus {http*}
if url_t[0] in hs:
url_t = (url_t[2]).split('.')
else:
url_t = (url_t[0]).split('.')
# get domain
if ':' in url_t[-1]:
url_t = (url_t[-1].split(':'))[0]
else:
url_t = url_t[-1]
# verify it
if url_t in domains:
ret.append(url)
return ret
if __name__ == '__main__':
print(compute())
``` | Analyze the structure of the url first.
An url contains a few characters which cannot appear randomly e.g. the dot "."
The last dot allows therefore marks the end of the url + the country code.
The easiest solution could be to split the urls at the last dot with .rsplit(".", 1) and then take the first 2 letters after the split and re-attach them to the first part of the split. I chose a different approach and checked the second part after the split for alphanumeric characters, because after the country code there is always a special character (non-alphanumeric) so this allows for an additional split of the second part.
```
s = '''http://google.com.au/
https://google.co.uk/
https://00.auga.com/shop/angel-haired-dress/
http://applesandoranges.co.uk:articles/best-seasonal-fruits-for-your-garden/
https://www.youtube.com/watch?v=GVbG35DeMto
http://docs.oracle.com/en/java/javase/11/docs/api/
https://www.instagram.co.uk/posts/hjgjh42324/'''
s_splitted = s.split("\n")
for raw_url in s_splitted:
a,b = raw_url.rsplit(".", 1)
c = "".join([x if x.isalnum() else " " for x in b ]).split(" ",1)[0]
url = a+"."+c
if url.endswith(".uk"):
print(url)
``` |
45,867,756 | I am trying to customize the font on my site title to Raleway in Wordpress.
I have added the google font code in `Customize` > `Typography`. This is working to change the font on my PC but not on my mobile device.
I added this code to the Custom CSS panel:
```
@site-title {
font-family: 'Raleway';
font-style: light;
src: url ('https://fonts.googleapis.com/css?family=Raleway');
}
```
Nothing seems to work. Any ideas of what I can do?
my site: [stillnorthretreatco.com](http://stillnorthretreatco.com)
Thanks!! | 2017/08/24 | [
"https://Stackoverflow.com/questions/45867756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8513028/"
] | `#` is only used to indicate a comment when used inside Python code. In your query, it is inside the query string, and so is not parsed as a comment identifier, but as part of the query.
If you delete it, you are left with 8 `%s` and only 7 items inside `payload`. | I believe the problem is you have multiple %s string indicators in your execute string but are only giving it a single item (in this case a list) which it doesn't know it should break down into multiple values.
Try using some of the suggestions in this post to get your desired effect.
[Using Python String Formatting with Lists](https://stackoverflow.com/questions/7568627/using-python-string-formatting-with-lists) |
33,273,809 | I'm making a basic calculator where you can plus, times, divide and minus as i was experimenting to see if it worked i noticed that instead of 5 divided by being equal to 1.25 it only displayed 1.
Here's the code i use to handle the math problems:
```
if (box.getSelectedItem().equals(divide)){
JOptionPane.showMessageDialog(null, Integer.parseInt(first.getText()) / Integer.parseInt(second.getText()), "Answer", -1);
main(args);
}
```
Is there code that displays the decimal points as well? | 2015/10/22 | [
"https://Stackoverflow.com/questions/33273809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5448013/"
] | Since you are using Integer,it is happening.
Use [Double](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html) to preserve decimals.
In your case,use
```
Double.parseDouble(first.getText()) / Double.parseDouble(second.getText())
``` | Integer division will give you Integer. Try using Double or BigDecimal data type. |
33,273,809 | I'm making a basic calculator where you can plus, times, divide and minus as i was experimenting to see if it worked i noticed that instead of 5 divided by being equal to 1.25 it only displayed 1.
Here's the code i use to handle the math problems:
```
if (box.getSelectedItem().equals(divide)){
JOptionPane.showMessageDialog(null, Integer.parseInt(first.getText()) / Integer.parseInt(second.getText()), "Answer", -1);
main(args);
}
```
Is there code that displays the decimal points as well? | 2015/10/22 | [
"https://Stackoverflow.com/questions/33273809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5448013/"
] | Since you are using Integer,it is happening.
Use [Double](http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html) to preserve decimals.
In your case,use
```
Double.parseDouble(first.getText()) / Double.parseDouble(second.getText())
``` | You need to do the casting
```
(double)parseInt(first.getText()) / (double)parseInt(second.getText())
```
Int/Int will give you an Integer. So you need to cast it to Double to get the result in decimal.
**EDIT:**
If you dont want to show decimal when the result is a whole number then you need to check it like this:
```
Double res = (double)parseInt(first.getText()) / (double)parseInt(second.getText())
Integer x;
if(res % 1 == 0)
{
x = (int)res
}
``` |
9,929 | One of Blackberry's [strongest assets](http://www.marketwatch.com/story/rim-the-long-slow-death-spiral-begins-2011-12-20?pagenumber=2) is the "network" that it uses. Can someone explain, or link to technical information that covers what this secure network is, and what it does better than the rest? | 2011/12/20 | [
"https://security.stackexchange.com/questions/9929",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/396/"
] | How dare you! How dare you question the most secure mobile platform available to mankind! My attempt at humor there.. now to a serious answer before the mods attack. Blackberry has some whitepapers regarding security here: <http://us.blackberry.com/ataglance/security/>
I would argue the network is not RIM's strongest asset. Corporate and government adoption of the product due to the level of control they have over the devices is RIM's strongest asset. MDM is a hot topic now, but people seem forget that RIM has been doing it for 14 years.
Unfortunately for RIM the pendelum has swung away from corporate control towards the "bring your own device" philosophy, and with good reason. Android and IOS offers a better user experience. | Blackberry Architecture is designed in such a way that the entire communication (data and not voice channel) is managed by the blackberry servers ecosystem in highly secured manner. The telco data channel acts as a carrier and transport medium of data packets to and fro between the mobile device and the blackberry servers like BIS and BES.
For establishing the ecosystem the telco is needed to host blackberry servers and applications in its network infrastructure. Hence to use the blackberry service it is important that the telco have the blackberry infrastructure setup.
In my knowledge there are 2 unique things about blackberry compared to other devices in a telco network ecosystem:
1. Blackberry devices have a secured element in them. The secure element can be compared to a secure smart card (Not the SIM card provided by telco). Blackberry initializes it with some keys and certificates in the manufacturing time. The mapping is referred as the device PIN.
2. Unlike other devices in network, blackberry devices are allowed to listen in a socket port which typically is not allowed by telco in other devices. This is from where the true sense of push mail or push messaging originates. In sense blackberry devices have true push support while other devices actually perform pull and make it look like push. This is one more reason why blackberry device have high battery life even after performing heavy data transmission operations.
Now the security; as discussed in one of the post many documents are public. AFAIK the session key which is derived in between blackberry servers and mobiles is generated in such way that key is not recoverable even on the server. For this reason, blackberry has been pushed by many nations to host some servers and do some modifications so that the intelligence agencies can trace data transmitted and received by the devices.
Blackberry devices from long have the processing capability of performing crypto operations like AES, RSA, ECC and many more. It supports full fledged PKI operations like signing and validations. In-fact BB was one of the first to have ECC support and own the Certicom Infra. |
9,929 | One of Blackberry's [strongest assets](http://www.marketwatch.com/story/rim-the-long-slow-death-spiral-begins-2011-12-20?pagenumber=2) is the "network" that it uses. Can someone explain, or link to technical information that covers what this secure network is, and what it does better than the rest? | 2011/12/20 | [
"https://security.stackexchange.com/questions/9929",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/396/"
] | Obscurity. No seriously though. Thanks to Blackberry enterprise server (which has been out for years), corporate mobile phones were able to be managed and controlled through a policy set or a group of "rules".. Not altogether unlike your windows user account at work on your company domain controlled by Active Directory GPO. I think this was initially what brought blackberry proliferation to the insane levels it reached in the early 2000's in the corporate world. | Blackberry Architecture is designed in such a way that the entire communication (data and not voice channel) is managed by the blackberry servers ecosystem in highly secured manner. The telco data channel acts as a carrier and transport medium of data packets to and fro between the mobile device and the blackberry servers like BIS and BES.
For establishing the ecosystem the telco is needed to host blackberry servers and applications in its network infrastructure. Hence to use the blackberry service it is important that the telco have the blackberry infrastructure setup.
In my knowledge there are 2 unique things about blackberry compared to other devices in a telco network ecosystem:
1. Blackberry devices have a secured element in them. The secure element can be compared to a secure smart card (Not the SIM card provided by telco). Blackberry initializes it with some keys and certificates in the manufacturing time. The mapping is referred as the device PIN.
2. Unlike other devices in network, blackberry devices are allowed to listen in a socket port which typically is not allowed by telco in other devices. This is from where the true sense of push mail or push messaging originates. In sense blackberry devices have true push support while other devices actually perform pull and make it look like push. This is one more reason why blackberry device have high battery life even after performing heavy data transmission operations.
Now the security; as discussed in one of the post many documents are public. AFAIK the session key which is derived in between blackberry servers and mobiles is generated in such way that key is not recoverable even on the server. For this reason, blackberry has been pushed by many nations to host some servers and do some modifications so that the intelligence agencies can trace data transmitted and received by the devices.
Blackberry devices from long have the processing capability of performing crypto operations like AES, RSA, ECC and many more. It supports full fledged PKI operations like signing and validations. In-fact BB was one of the first to have ECC support and own the Certicom Infra. |
15,053,715 | I'm making a management program with C# & SQL Server 2008. I want to search records using Blood Group, District & Club Name wise all at a time. This is what is making prob:
```
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM Table2
WHERE @Blood_Group =" + tsblood.Text + "AND @District =" + tsdist.Text +
"AND Club_Name =" + tscname.Text, Mycon1);
```
Can anyone tell me what is the correct syntax? Tnx in advance. :) | 2013/02/24 | [
"https://Stackoverflow.com/questions/15053715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2104796/"
] | The correct syntax is to use parametrized queries and absolutely never use string concatenations when building a SQL query:
```
string query = "SELECT * FROM Table2 WHERE BloodGroup = @BloodGroup AND District = @District AND Club_Name = @ClubName";
using (SqlDataAdapter sda = new SqlDataAdapter(query, Mycon1))
{
sda.SelectCommand.Parameters.AddWithValue("@BloodGroup", tsblood.Text);
sda.SelectCommand.Parameters.AddWithValue("@District", tsdist.Text);
sda.SelectCommand.Parameters.AddWithValue("@ClubName", tscname.Text);
...
}
```
This way your parameters will be properly encoded and your code not vulnerable to SQL injection attacks. Checkout [`bobby tables`](http://bobby-tables.com/).
Also notice how I have wrapped IDisposable resources such as a SqlDataAdapter into a using statement to ensure that it is properly disposed even in case of an exception and that your program will not be leaking unmanaged handles. | You forgot an `AND` (and possible an `@` in front of `Club_Name`?):
```
String CRLF = "\r\n";
String sql = String.Format(
"SELECT * FROM Table2" + CRLF+
"WHERE @Blood_Group = {0}" + CRLF+
"AND @District = {1} " + CRLF+
"AND Club_Name = {2}",
SqlUtils.QuotedStr(tsblood.Text),
SqlUtils.QuotedStr(tsdist.Text),
SqlUtils.QuotedStr(tscname.Text));
SqlDataAdapter sda = new SqlDataAdapter(sql, Mycon1);
``` |
34,995 | I planted red and new potatoes in early May. They were planted 6-8 inches deep. The potatoes were sprouted potatoes from our local hardware store. Our soil is heavy clay but the potatoes were planted in purchased hummus which had been worked into the soil to a depth of about 15 inches. Our climate zone is zone 9B.
[](https://i.stack.imgur.com/A8pEG.jpg)
[](https://i.stack.imgur.com/qXDvJ.jpg)
As you can see, the potato plants only grew to about 1 ft high. Some of the plants dried up so we started harvesting today (Aug 13). To our surprise, there were no potatoes at all. We watered the potatoes using a drip system (2 GPH) that was set to 15 minutes once per week. However, the summer here has been very hot and whenever the plants looked wilted, we added an additional watering cycle. | 2017/08/13 | [
"https://gardening.stackexchange.com/questions/34995",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/19536/"
] | Judging by the state of the plants when you dug them up, and what the soil surface looks like there are no nutrients whatever in it.
The potatoes *tried* to grow, using the material stored in the tuber, but that's as much as they managed to do. The leaves never developed properly, nor did the roots. They would have grown just as "well" if you had just put them on a concrete driveway and ignored them.
"Purchased humus" doesn't necessarily contain any nutrients. If you really want to grow potatoes in this soil, I would dig the area now to break it up, then spread about a 6 inch depth of horse manure on the surface and leave it for 3 months to let the micro-organisms to break it down and release the nutrients, then dig it in. That might give you better results next year! | >
> However, the summer here has been very hot
>
>
>
This might very well be the reason. Potatoes tend to stop the production of tubers once the soil reaches a certain temperature. Gardeners that plant their potatoes in dark plastic bags and unwittingly put the bags into a sunny spot often have the same problem.
Next year, plant your potatoes as early as possible to get a long growing phase before the summer heat sets in. |
34,995 | I planted red and new potatoes in early May. They were planted 6-8 inches deep. The potatoes were sprouted potatoes from our local hardware store. Our soil is heavy clay but the potatoes were planted in purchased hummus which had been worked into the soil to a depth of about 15 inches. Our climate zone is zone 9B.
[](https://i.stack.imgur.com/A8pEG.jpg)
[](https://i.stack.imgur.com/qXDvJ.jpg)
As you can see, the potato plants only grew to about 1 ft high. Some of the plants dried up so we started harvesting today (Aug 13). To our surprise, there were no potatoes at all. We watered the potatoes using a drip system (2 GPH) that was set to 15 minutes once per week. However, the summer here has been very hot and whenever the plants looked wilted, we added an additional watering cycle. | 2017/08/13 | [
"https://gardening.stackexchange.com/questions/34995",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/19536/"
] | >
> However, the summer here has been very hot
>
>
>
This might very well be the reason. Potatoes tend to stop the production of tubers once the soil reaches a certain temperature. Gardeners that plant their potatoes in dark plastic bags and unwittingly put the bags into a sunny spot often have the same problem.
Next year, plant your potatoes as early as possible to get a long growing phase before the summer heat sets in. | In addition to the answers above (*especially* regarding the need to improve the soil) you should be prepared to periodically mound more soil or mulch or straw around the plants as they grow. The tubers actually grow along the stems of the plants, so if you don't cover them up, you may grow larger plants next year, but they still don't produce a crop of any size.
There are loads of resources online that outline "best practices" for growing any vegetable. Have a look and plan for next year. |
34,995 | I planted red and new potatoes in early May. They were planted 6-8 inches deep. The potatoes were sprouted potatoes from our local hardware store. Our soil is heavy clay but the potatoes were planted in purchased hummus which had been worked into the soil to a depth of about 15 inches. Our climate zone is zone 9B.
[](https://i.stack.imgur.com/A8pEG.jpg)
[](https://i.stack.imgur.com/qXDvJ.jpg)
As you can see, the potato plants only grew to about 1 ft high. Some of the plants dried up so we started harvesting today (Aug 13). To our surprise, there were no potatoes at all. We watered the potatoes using a drip system (2 GPH) that was set to 15 minutes once per week. However, the summer here has been very hot and whenever the plants looked wilted, we added an additional watering cycle. | 2017/08/13 | [
"https://gardening.stackexchange.com/questions/34995",
"https://gardening.stackexchange.com",
"https://gardening.stackexchange.com/users/19536/"
] | Judging by the state of the plants when you dug them up, and what the soil surface looks like there are no nutrients whatever in it.
The potatoes *tried* to grow, using the material stored in the tuber, but that's as much as they managed to do. The leaves never developed properly, nor did the roots. They would have grown just as "well" if you had just put them on a concrete driveway and ignored them.
"Purchased humus" doesn't necessarily contain any nutrients. If you really want to grow potatoes in this soil, I would dig the area now to break it up, then spread about a 6 inch depth of horse manure on the surface and leave it for 3 months to let the micro-organisms to break it down and release the nutrients, then dig it in. That might give you better results next year! | In addition to the answers above (*especially* regarding the need to improve the soil) you should be prepared to periodically mound more soil or mulch or straw around the plants as they grow. The tubers actually grow along the stems of the plants, so if you don't cover them up, you may grow larger plants next year, but they still don't produce a crop of any size.
There are loads of resources online that outline "best practices" for growing any vegetable. Have a look and plan for next year. |
34,640,668 | I'm working on a plugin for Revit. Revit permits only dll type addins and I chose c# and wpf for gui. I couldn't initialize wpf natively so I needed to contain it in a system.windows.window as content.
Now if I close that window with upper right X program continues (looping processing etc.) it doesn't get terminated. Window.close() again just closes the window not the application it self.
How should I exit my app and not keep it lurking in the shadows?
```
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class FDNMain : IExternalCommand
{
public Result Execute(ExternalCommandData CommandData, ref string message, ElementSet elements)
{
FDNControl wpfControl = new FDNControl();
return Result.Succeeded;
}
}
```
Above is the Revit external command class which cannot initialize (show up) the wpfControl. So I need to wrap the wpfcontrol with a System.Windows.Window as below:
```
Window hostWindow = new Window();
hostWindow.Content = wpfControl;
hostWindow.Show();
``` | 2016/01/06 | [
"https://Stackoverflow.com/questions/34640668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4338414/"
] | Unfortunately I don't know how to do this without any existing form. But I'm sure you have some kind of main form you can access. Or you can obtain a `Form` using
```
var invokingForm = Application.OpenForms[0];
```
So you can change the code of your method like this:
```
static void OnNewMessage(object sender, S22.Xmpp.Im.MessageEventArgs e)
{
var invokingForm = Application.OpenForms[0]; // or whatever Form you can access
if (invokingForm.InvokeRequired)
{
invokingForm.BeginInvoke(new EventHandler<S22.Xmpp.Im.MessageEventArgs>(OnNewMessage), sender, e);
return; // important!!!
}
// the rest of your code goes here, now running
// on the same ui thread as invokingForm
if(CheckIfFormIsOpen(e.Jid.ToString(), e.Message.ToString()) == true)
{
}
else
{
newMessageFrm tempMsg = new newMessageFrm(e.Jid.ToString());
tempMsg._msgText = e.Jid.ToString() + ": " + e.Message.ToString();
tempMsg.frmId = e.Jid.ToString();
tempMsg.Show();
}
}
```
Note that I assumend that `S22.Xmpp.Im.MessageEventArgs` is inherited from `System.EventArgs`. | In WinForms there is still a requirement that the UI objects need to be on a thread with a message pump. This is usually the main application thread, also called the UI thread.
In Winforms checking to see if you are on the right thread to access a UI object is done with `Control.InvokeRequired`. If this returns true, it means you are not on the proper thread, and need to use an Invoke operation.
Since you know you are one a different thread, you don't need to check, you can just Invoke.
```
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
ThreadPool.QueueUserWorkItem(BadBackgroundLaunch);
ThreadPool.QueueUserWorkItem(GoodBackgroundLaunch);
}
private void GoodBackgroundLaunch(object state)
{
this.Invoke((Action) (() =>
{
var form2 = new SecondForm();
form2.Text = "Good One";
form2.Show();
}));
}
private void BadBackgroundLaunch(object state)
{
var form2 = new SecondForm();
form2.Text = "Bad one";
form2.Show();
}
}
``` |
35,253,840 | I am building an app which uploads files to the server via ajax.
The problem is that users most likely sometimes won't have the internet connection and client would like to have the ajax call scheduled to time when user have the connection back. This is possible that user will schedule the file upload when he's offline and close the app. Is it possible to do ajax call when the application is closed (not in background)?
When app is in the background, we can use background-fetch but I have never faced a problem to do something when app is closed. | 2016/02/07 | [
"https://Stackoverflow.com/questions/35253840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2008950/"
] | The short answer is no, your app can't run code after being terminated.
You can run code in your `AppDelegate`'s `applicationWillTerminate`, but that method is mainly intended for saving user data and other similar tasks.
See [this answer](https://stackoverflow.com/a/32225247/5389870) also. | Yes you can do stuff in the background. You are limited to several different background modes of execution. Server communication is one of the modes that is allowed (background fetch). Make sure you set the properties correctly in Xcode per the guidelines (i.e. don't say you are a audio app when you are doing data transfer). See the details here:
<https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html>
I found your question because it has the Cordova tag associated with it. If you are using Cordova you can use this plugin here to manage things in the background:
<https://github.com/katzer/cordova-plugin-background-mode>
Edit: If the user is FORCE closing / terminating the app then there is nothing you can do. If they are just exiting the app to the home screen and use other apps, then you can run in the background.
The other option you can do is schedule a local notification to upload the file. If you app successfully uploads the file because it is open / has a connection / did it in the background, then you cancel the local notification.
If the local notification isn't cancelled it will remind the user the file is not uploaded and when they open the notification your app will start back where it left off. |
35,253,840 | I am building an app which uploads files to the server via ajax.
The problem is that users most likely sometimes won't have the internet connection and client would like to have the ajax call scheduled to time when user have the connection back. This is possible that user will schedule the file upload when he's offline and close the app. Is it possible to do ajax call when the application is closed (not in background)?
When app is in the background, we can use background-fetch but I have never faced a problem to do something when app is closed. | 2016/02/07 | [
"https://Stackoverflow.com/questions/35253840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2008950/"
] | The short answer is no, your app can't run code after being terminated.
You can run code in your `AppDelegate`'s `applicationWillTerminate`, but that method is mainly intended for saving user data and other similar tasks.
See [this answer](https://stackoverflow.com/a/32225247/5389870) also. | ```
- (void)applicationWillTerminate:(UIApplication *)application {
if (application) {
__block UIBackgroundTaskIdentifier backgroundTask = UIBackgroundTaskInvalid;
backgroundTask = [application beginBackgroundTaskWithName:@"MyTask" expirationHandler:^{
backgroundTask = UIBackgroundTaskInvalid;
}];
[self doSomething];
[application endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
}
}
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.