qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
36,050,697 | For simple example, in my `ImageDetailViewController`, property `image`(it is `UIImage!`) must be initialized before end of `viewDidLoad` (in other words, before `viewWillAppear`).
I use `XCTAssertNotNil` on the first line of `viewWillAppear`.
How can I secure this behavior in unit test? or cannot?
EDIT:
If every i... | 2016/03/17 | [
"https://Stackoverflow.com/questions/36050697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4364584/"
] | I did some tests. Here is how to trigger several different view cycle methods. I think the asserts speak for themselves.
```
class AppearanceTestDemoTests: XCTestCase {
var sut: ViewController!
override func setUp() {
super.setUp()
sut = ViewController()
}
func testLoading() {
_ = sut.view
... | You could do something like:
```
let vc = ImageDetailViewController()
vc.view // loads view, triggering call to viewDidLoad()
XCTAssertNotNil(vc.image)
``` |
22,574,482 | I'm learning PHP and built a little search in text file script. Here is the chain of events:
1. Opens text file
2. Creates array from each new line
3. If form is submitted, the post data is put into a function runs a regex to find the partial string or word and if matched, all entries are replaced in code with a class... | 2014/03/22 | [
"https://Stackoverflow.com/questions/22574482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890315/"
] | You better divide lines into words ,It'll make easy to match them | I think this would be ok:
```
<form action="" method="post">
<h4>Search Object In Text File:</h4>
<input type="text" name="search" value="">
<input type="submit" value="Submit" name="Submit">
</form>
<?php
$filename="tekst.txt";
$lines = file($filename, FILE_IGNORE_NEW_LINES);
... |
74,033,137 | ```
<html>
<head>
<title></title>
<link rel="stylesheet" href="styles/kendo.common.min.css" />
<link rel="stylesheet" href="styles/kendo.default.min.css" />
<link rel="stylesheet" href="styles/kendo.default.mobile.min.css" />
<script src="js/jquery.min.js"></script>
<script src="js/kendo.all.m... | 2022/10/11 | [
"https://Stackoverflow.com/questions/74033137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8802878/"
] | According to [this post](https://stackoverflow.com/a/10461175/4926757), Tkinter labels do not support transparency.
As an alternative, we may create green image, and apply [alpha\_composite](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.alpha_composite):
* Create green image with RGBA color f... | This image is filled with black even if its not on a black background.
You should try to set a white bg or just pick an image witch is filled in white |
17,842,981 | I created an *MFC* app on *Windows 8* using **Visual Studio 2012 Update 3**. It works on *Windows 8*, but on *Windows XP*, it shows me the following error:
`The procedure entry point GetTickCount64 could not be located in the dynamic link library KERNEL32.dll`
I searched for a solution, but it was said that *Update 3... | 2013/07/24 | [
"https://Stackoverflow.com/questions/17842981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/492352/"
] | The function does not exist in XP. In the documentation for the function it says "To compile an application that uses this function, define \_WIN32\_WINNT as 0x0600 or later." (That means Vista and newer.) If you do that the app will not run on XP. | You should download Visual Studio Update 1 or later. Then you can target Windows XP
See here:
[How to compile for Win XP with Visual Studio 2012?](https://stackoverflow.com/questions/13130713/how-to-compile-for-win-xp-with-visual-studio-2012) |
36,182,405 | I'm writing a TypeScript definition file for an existing node library which use building node module like `http` and `events.EventEmitter` as a parameter.
**my question** is how can I write a definition file for this library? I have tried to copy these modules from node.d.ts into my own definition file, but I don't th... | 2016/03/23 | [
"https://Stackoverflow.com/questions/36182405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1606208/"
] | Your module should include it's own `node.d.ts` file among your `.d.ts` file (let's call it `my_awesome_lib.d.ts`)
In your `.d.ts` file you may include the necessary types as following:
```
declare module 'my_awesome_lib' {
import * as express from 'express'; // just as example
import { EventEmitter } from 'eve... | Use the Typings tool with a `typings.json` file to manage TypeScript definition dependencies.
See that project's [FAQ](https://github.com/typings/typings/blob/master/docs/faq.md#how-do-i-write-typings-definitions)
>
> Start by creating a new `typings.json` file, then add dependencies as
> normal. When you publish t... |
8,979,429 | Is there a `present?` method in ruby to check if a string is present within an other? I'd want to return as soon as a match is found since I will be checking for multiple substrings. Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454375/"
] | I believe you mean [include?](http://www.ruby-doc.org/core-1.9.2/String.html#method-i-include-3F) | include?
<http://ruby-doc.org/core-1.9.3/String.html#method-i-include-3F> |
8,979,429 | Is there a `present?` method in ruby to check if a string is present within an other? I'd want to return as soon as a match is found since I will be checking for multiple substrings. Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454375/"
] | I believe you mean [include?](http://www.ruby-doc.org/core-1.9.2/String.html#method-i-include-3F) | I believe you are looking for include?
```
"ab123de".include?("123")
``` |
8,979,429 | Is there a `present?` method in ruby to check if a string is present within an other? I'd want to return as soon as a match is found since I will be checking for multiple substrings. Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454375/"
] | I believe you mean [include?](http://www.ruby-doc.org/core-1.9.2/String.html#method-i-include-3F) | Sorry, found what i was looking for (because of the use of **regexp**):
>
> index(regexp [, offset]) → fixnum or nil
>
>
> Returns the index of the
> first occurrence of the given substring or pattern (regexp) in str.
> Returns nil if not found.
>
>
>
```
"hello".index('lo') #=> 3
"hello".index('a') ... |
8,979,429 | Is there a `present?` method in ruby to check if a string is present within an other? I'd want to return as soon as a match is found since I will be checking for multiple substrings. Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454375/"
] | I believe you are looking for include?
```
"ab123de".include?("123")
``` | include?
<http://ruby-doc.org/core-1.9.3/String.html#method-i-include-3F> |
8,979,429 | Is there a `present?` method in ruby to check if a string is present within an other? I'd want to return as soon as a match is found since I will be checking for multiple substrings. Thanks! | 2012/01/23 | [
"https://Stackoverflow.com/questions/8979429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/454375/"
] | Sorry, found what i was looking for (because of the use of **regexp**):
>
> index(regexp [, offset]) → fixnum or nil
>
>
> Returns the index of the
> first occurrence of the given substring or pattern (regexp) in str.
> Returns nil if not found.
>
>
>
```
"hello".index('lo') #=> 3
"hello".index('a') ... | include?
<http://ruby-doc.org/core-1.9.3/String.html#method-i-include-3F> |
159,622 | Wine is a fantastic project and in my opinion it's speed of development is extremely fast. This must cost quite some resources, which I doubt is all done by volunteers. This makes me wonder: who are the major stakeholers in WINE, and who bears the brunt of the financial backing? | 2012/07/04 | [
"https://askubuntu.com/questions/159622",
"https://askubuntu.com",
"https://askubuntu.com/users/2192/"
] | this depends:-) Some are internal commands of your shell, some scripts, some are compiled programs.
You can find out more with the `type` command: For example: `type type` gives (in my cygwin bash!) `type is a shell builtin`.
If you type `type bash`, your answer will be something like `bash is /usr/bin/bash`.
Now y... | Some of them are part of the functionality of the interpreter you are working at(I presume you are using `bash`), but can be overridden with one that is not built-in(should such an executable exist) using `env`*`commmand`*. The rest of the important commands are in `/bin` or `/sbin`, which is on your path, giving quick... |
159,622 | Wine is a fantastic project and in my opinion it's speed of development is extremely fast. This must cost quite some resources, which I doubt is all done by volunteers. This makes me wonder: who are the major stakeholers in WINE, and who bears the brunt of the financial backing? | 2012/07/04 | [
"https://askubuntu.com/questions/159622",
"https://askubuntu.com",
"https://askubuntu.com/users/2192/"
] | Most of all , i can rather say ALMOST all commands came from UNIX , a Predecessor and fundamental mechanism Behind LINUX.
Most of the Utilities , like `mv- move` , `cp- copy` is a utility in Linux since they are utilize to do basic management functions.This holds true for every other such utilities , i would rather s... | Some of them are part of the functionality of the interpreter you are working at(I presume you are using `bash`), but can be overridden with one that is not built-in(should such an executable exist) using `env`*`commmand`*. The rest of the important commands are in `/bin` or `/sbin`, which is on your path, giving quick... |
159,622 | Wine is a fantastic project and in my opinion it's speed of development is extremely fast. This must cost quite some resources, which I doubt is all done by volunteers. This makes me wonder: who are the major stakeholers in WINE, and who bears the brunt of the financial backing? | 2012/07/04 | [
"https://askubuntu.com/questions/159622",
"https://askubuntu.com",
"https://askubuntu.com/users/2192/"
] | this depends:-) Some are internal commands of your shell, some scripts, some are compiled programs.
You can find out more with the `type` command: For example: `type type` gives (in my cygwin bash!) `type is a shell builtin`.
If you type `type bash`, your answer will be something like `bash is /usr/bin/bash`.
Now y... | They are usually written in C, but they might also be ba/sh, python, perl, ... scripts (such `adduser` being a perl wrapper to `useradd`). You can tell which scripting language they are written in by looking at the first line of the script itself or at the line which starts with `#!` (eg: `#!/usr/bin/perl`). This is of... |
159,622 | Wine is a fantastic project and in my opinion it's speed of development is extremely fast. This must cost quite some resources, which I doubt is all done by volunteers. This makes me wonder: who are the major stakeholers in WINE, and who bears the brunt of the financial backing? | 2012/07/04 | [
"https://askubuntu.com/questions/159622",
"https://askubuntu.com",
"https://askubuntu.com/users/2192/"
] | this depends:-) Some are internal commands of your shell, some scripts, some are compiled programs.
You can find out more with the `type` command: For example: `type type` gives (in my cygwin bash!) `type is a shell builtin`.
If you type `type bash`, your answer will be something like `bash is /usr/bin/bash`.
Now y... | Most of all , i can rather say ALMOST all commands came from UNIX , a Predecessor and fundamental mechanism Behind LINUX.
Most of the Utilities , like `mv- move` , `cp- copy` is a utility in Linux since they are utilize to do basic management functions.This holds true for every other such utilities , i would rather s... |
159,622 | Wine is a fantastic project and in my opinion it's speed of development is extremely fast. This must cost quite some resources, which I doubt is all done by volunteers. This makes me wonder: who are the major stakeholers in WINE, and who bears the brunt of the financial backing? | 2012/07/04 | [
"https://askubuntu.com/questions/159622",
"https://askubuntu.com",
"https://askubuntu.com/users/2192/"
] | Most of all , i can rather say ALMOST all commands came from UNIX , a Predecessor and fundamental mechanism Behind LINUX.
Most of the Utilities , like `mv- move` , `cp- copy` is a utility in Linux since they are utilize to do basic management functions.This holds true for every other such utilities , i would rather s... | They are usually written in C, but they might also be ba/sh, python, perl, ... scripts (such `adduser` being a perl wrapper to `useradd`). You can tell which scripting language they are written in by looking at the first line of the script itself or at the line which starts with `#!` (eg: `#!/usr/bin/perl`). This is of... |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | ```
$ awk '{ORS=(/hello|world/?FS:RS)}1' file
this is an original
file with lines
containing words like hello and world this is the end of the file
``` | ```
sed -n '
:beg
/hello/ b keep
/world/ b keep
H;s/.*//;x;s/\n/ /g;p;b
: keep
H;s/.*//
$ b beg
' YourFile
```
a bit harder due to check on current line that may include a previous *hello* or *world* already
principle:
on every pattern match, keep the string in hold buffer
other wise, load hold buffer and remove \n... |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | Using awk you can do:
```
awk '/hello|world/{printf "%s ", $0; next} 1' file
this is an original
file with lines
containing words like hello and world this is the end of the file
``` | ```
sed -n '
:beg
/hello/ b keep
/world/ b keep
H;s/.*//;x;s/\n/ /g;p;b
: keep
H;s/.*//
$ b beg
' YourFile
```
a bit harder due to check on current line that may include a previous *hello* or *world* already
principle:
on every pattern match, keep the string in hold buffer
other wise, load hold buffer and remove \n... |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | A non-regex approach:
```
awk '
BEGIN {
# define the word list
w["hello"]
w["world"]
}
{
printf "%s", $0
for (i=1; i<=NF; i++)
if ($i in w) {
printf " "
next
}
print ""
}
'
```
or a perl one-liner... | ```
sed -n '
:beg
/hello/ b keep
/world/ b keep
H;s/.*//;x;s/\n/ /g;p;b
: keep
H;s/.*//
$ b beg
' YourFile
```
a bit harder due to check on current line that may include a previous *hello* or *world* already
principle:
on every pattern match, keep the string in hold buffer
other wise, load hold buffer and remove \n... |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | A non-regex approach:
```
awk '
BEGIN {
# define the word list
w["hello"]
w["world"]
}
{
printf "%s", $0
for (i=1; i<=NF; i++)
if ($i in w) {
printf " "
next
}
print ""
}
'
```
or a perl one-liner... | This might work for you (GNU sed):
```
sed -r ':a;/^.*(hello|world).*\'\''/M{$bb;N;ba};:b;s/\n/ /g' file
```
This checks if the last line, of a possible multi-line, contains the required string(s) and if so reads another line until end-of-file or such that the last line does not contain the/those string(s). Newlines... |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | A non-regex approach:
```
awk '
BEGIN {
# define the word list
w["hello"]
w["world"]
}
{
printf "%s", $0
for (i=1; i<=NF; i++)
if ($i in w) {
printf " "
next
}
print ""
}
'
```
or a perl one-liner... | ```
$ awk '{ORS=(/hello|world/?FS:RS)}1' file
this is an original
file with lines
containing words like hello and world this is the end of the file
``` |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | Using awk you can do:
```
awk '/hello|world/{printf "%s ", $0; next} 1' file
this is an original
file with lines
containing words like hello and world this is the end of the file
``` | ```
$ awk '{ORS=(/hello|world/?FS:RS)}1' file
this is an original
file with lines
containing words like hello and world this is the end of the file
``` |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | here is simple one using sed
```
sed -r ':a;$!{N;ba};s/((hello|world)[^\n]*)\n/\1 /g' file
```
### Explanation
* `:a;$!{N;ba}` read whole file into pattern, like this: `this is an original\nfile with lines\ncontaining words like hell\
o\nand world\nthis is the end of the file$`
* `s/((hello|world)[^\n]*)\n/\1 /g` s... | Using awk you can do:
```
awk '/hello|world/{printf "%s ", $0; next} 1' file
this is an original
file with lines
containing words like hello and world this is the end of the file
``` |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | This might work for you (GNU sed):
```
sed -r ':a;/^.*(hello|world).*\'\''/M{$bb;N;ba};:b;s/\n/ /g' file
```
This checks if the last line, of a possible multi-line, contains the required string(s) and if so reads another line until end-of-file or such that the last line does not contain the/those string(s). Newlines... | ```
sed -n '
:beg
/hello/ b keep
/world/ b keep
H;s/.*//;x;s/\n/ /g;p;b
: keep
H;s/.*//
$ b beg
' YourFile
```
a bit harder due to check on current line that may include a previous *hello* or *world* already
principle:
on every pattern match, keep the string in hold buffer
other wise, load hold buffer and remove \n... |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | here is simple one using sed
```
sed -r ':a;$!{N;ba};s/((hello|world)[^\n]*)\n/\1 /g' file
```
### Explanation
* `:a;$!{N;ba}` read whole file into pattern, like this: `this is an original\nfile with lines\ncontaining words like hell\
o\nand world\nthis is the end of the file$`
* `s/((hello|world)[^\n]*)\n/\1 /g` s... | ```
sed -n '
:beg
/hello/ b keep
/world/ b keep
H;s/.*//;x;s/\n/ /g;p;b
: keep
H;s/.*//
$ b beg
' YourFile
```
a bit harder due to check on current line that may include a previous *hello* or *world* already
principle:
on every pattern match, keep the string in hold buffer
other wise, load hold buffer and remove \n... |
21,858,806 | I'd like to know if I can remove a `\n` (newline) only if the current line has one ore more keywords from a list; for instance, I want to remove the `\n` if it contains the words *hello* or *world*.
**Example:**
```
this is an original
file with lines
containing words like hello
and world
this is the end of the file
... | 2014/02/18 | [
"https://Stackoverflow.com/questions/21858806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/293420/"
] | here is simple one using sed
```
sed -r ':a;$!{N;ba};s/((hello|world)[^\n]*)\n/\1 /g' file
```
### Explanation
* `:a;$!{N;ba}` read whole file into pattern, like this: `this is an original\nfile with lines\ncontaining words like hell\
o\nand world\nthis is the end of the file$`
* `s/((hello|world)[^\n]*)\n/\1 /g` s... | ```
$ awk '{ORS=(/hello|world/?FS:RS)}1' file
this is an original
file with lines
containing words like hello and world this is the end of the file
``` |
70,196,615 | I want to change the color of my png,i want to fill it with color,so i thought about creating a bitmap from the png,placing it on a canvas and drawing the canvas,but it is drawing the whole canvas,like this,so my icons are covered completely
[](https:... | 2021/12/02 | [
"https://Stackoverflow.com/questions/70196615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16774621/"
] | You can try something like that ? (not tested)
You can use the[Color Filter](https://developer.android.com/reference/android/graphics/ColorFilter) to change the icon's color at runtime.
Then you transform the drawable into Bitmap.
```kotlin
private fun testResizeImg(@DrawableRes imgRes: Int): BitmapDescriptor {
... | ```
private fun testResizeImg(imgRes: Int): BitmapDescriptor {
var bm = BitmapFactory.decodeResource(resources, imgRes)
bm = Bitmap.createScaledBitmap(bm, (bm.width * 0.1).toInt(), (bm.height * 0.1).toInt(), true)
val canvas = Canvas(bm)
canvas.drawBitmap(bm,0F,0F,null)
return Bi... |
69,611,471 | This URL used to function well in my browser, but now it returns an error code of 401.
***URL:*** [https://api.soundcloud.com/tracks/881102623/stream?client\_id=fbb40e82698631328efb400b0700834f](https://api.soundcloud.com/tracks/881102623/stream?client_id=fbb40e82698631328efb400b0700834d)
***Browser Response:***
```... | 2021/10/18 | [
"https://Stackoverflow.com/questions/69611471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9596361/"
] | The method [stream](https://developers.soundcloud.com/docs/api/guide#playing) requires an authorization header.
```
# request a track you want to stream
$ curl -X GET "https://api.soundcloud.com/tracks/TRACK_ID" \
-H "accept: application/json; charset=utf-8" \
-H "Authorization: OAuth ACCESS_TOKEN"
# e... | Here's my code now that I've fixed the Soundcloud Stream URL returning an error code 401. It is now fully operational.
```
<?php
/* SOUNDCLOUD CREDENTIALS */
$CLIENT_ID = 'YOUR_CLIENT_ID';
$CLIENT_SECRET = 'YOUR_CLIENT_SECRET';
$trackId = 1142143435; /*Your Track Id*/
$ACCESS_... |
52,400,690 | I am using c# wpf ColorCanvas control for using colors in my application.I want to remove dropdown arrow from ColorCanvas control.
I am using this Xaml Code for ColorCanvas
`<xctk:ColorPicker x:Name="canvas_Copy" ColorMode="ColorCanvas" VerticalAlignment="Top" Margin="93,323,409,0" />`
[![enter image description here]... | 2018/09/19 | [
"https://Stackoverflow.com/questions/52400690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7877121/"
] | You should use a custom `ButtonStyle`:
```
<xctk:ColorPicker x:Name="canvas_Copy" ColorMode="ColorCanvas" VerticalAlignment="Top" Margin="93,323,409,0" >
<xctk:ColorPicker.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</xctk:ColorPicker.Resources>
<xctk:ColorPicke... | finds its css file (or its styling file) and change its color to match its background |
52,400,690 | I am using c# wpf ColorCanvas control for using colors in my application.I want to remove dropdown arrow from ColorCanvas control.
I am using this Xaml Code for ColorCanvas
`<xctk:ColorPicker x:Name="canvas_Copy" ColorMode="ColorCanvas" VerticalAlignment="Top" Margin="93,323,409,0" />`
[![enter image description here]... | 2018/09/19 | [
"https://Stackoverflow.com/questions/52400690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7877121/"
] | Use ColorCanvas control from the same namespace instead of ColorPicker. | finds its css file (or its styling file) and change its color to match its background |
52,400,690 | I am using c# wpf ColorCanvas control for using colors in my application.I want to remove dropdown arrow from ColorCanvas control.
I am using this Xaml Code for ColorCanvas
`<xctk:ColorPicker x:Name="canvas_Copy" ColorMode="ColorCanvas" VerticalAlignment="Top" Margin="93,323,409,0" />`
[![enter image description here]... | 2018/09/19 | [
"https://Stackoverflow.com/questions/52400690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7877121/"
] | You should use a custom `ButtonStyle`:
```
<xctk:ColorPicker x:Name="canvas_Copy" ColorMode="ColorCanvas" VerticalAlignment="Top" Margin="93,323,409,0" >
<xctk:ColorPicker.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</xctk:ColorPicker.Resources>
<xctk:ColorPicke... | Use ColorCanvas control from the same namespace instead of ColorPicker. |
15,354,809 | Before I open this post, I did spent three days try to figure out this, but no luck at all, so please help me out. Thanks~~~~
Ok, this is what I’ve done so far:
1. Install a fresh copy of CI 2.1.3, no any name change on any folders
2. Create a new .htaccess file to CI ROOT directory with all structures that I found o... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15354809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023332/"
] | Try this .htaccess (put this into root of the project directory i.e. /chat here):
```
# To remove index.php from URL
RewriteEngine On
# RewriteBase /chat
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$... | Have the.htaccess file in the application root directory, along with the index.php file. (Check if the htaccess extension is correct , Bz htaccess.txt did not work for me.)
And Add the following rules to .htaccess file,
```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Rewr... |
15,354,809 | Before I open this post, I did spent three days try to figure out this, but no luck at all, so please help me out. Thanks~~~~
Ok, this is what I’ve done so far:
1. Install a fresh copy of CI 2.1.3, no any name change on any folders
2. Create a new .htaccess file to CI ROOT directory with all structures that I found o... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15354809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023332/"
] | Have the.htaccess file in the application root directory, along with the index.php file. (Check if the htaccess extension is correct , Bz htaccess.txt did not work for me.)
And Add the following rules to .htaccess file,
```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Rewr... | Try it :
`RewriteEngine on`
`RewriteCond %{REQUEST_FILENAME} !-f`
`RewriteCond %{REQUEST_FILENAME} !-d`
`RewriteRule .* /codeigniterNameFolder/index.php/$0 [PT,L]`
change codeigniterNameFolder :) |
15,354,809 | Before I open this post, I did spent three days try to figure out this, but no luck at all, so please help me out. Thanks~~~~
Ok, this is what I’ve done so far:
1. Install a fresh copy of CI 2.1.3, no any name change on any folders
2. Create a new .htaccess file to CI ROOT directory with all structures that I found o... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15354809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023332/"
] | Try this .htaccess (put this into root of the project directory i.e. /chat here):
```
# To remove index.php from URL
RewriteEngine On
# RewriteBase /chat
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$... | 
Note:
**htdocs** is the root folder
**ci\_intro** is the code igniter's folder
if we have the same case, then your .htaccess should be like this
```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_intro/
#Removes access to ... |
15,354,809 | Before I open this post, I did spent three days try to figure out this, but no luck at all, so please help me out. Thanks~~~~
Ok, this is what I’ve done so far:
1. Install a fresh copy of CI 2.1.3, no any name change on any folders
2. Create a new .htaccess file to CI ROOT directory with all structures that I found o... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15354809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023332/"
] | 
Note:
**htdocs** is the root folder
**ci\_intro** is the code igniter's folder
if we have the same case, then your .htaccess should be like this
```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_intro/
#Removes access to ... | Try it :
`RewriteEngine on`
`RewriteCond %{REQUEST_FILENAME} !-f`
`RewriteCond %{REQUEST_FILENAME} !-d`
`RewriteRule .* /codeigniterNameFolder/index.php/$0 [PT,L]`
change codeigniterNameFolder :) |
15,354,809 | Before I open this post, I did spent three days try to figure out this, but no luck at all, so please help me out. Thanks~~~~
Ok, this is what I’ve done so far:
1. Install a fresh copy of CI 2.1.3, no any name change on any folders
2. Create a new .htaccess file to CI ROOT directory with all structures that I found o... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15354809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2023332/"
] | Try this .htaccess (put this into root of the project directory i.e. /chat here):
```
# To remove index.php from URL
RewriteEngine On
# RewriteBase /chat
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$... | Try it :
`RewriteEngine on`
`RewriteCond %{REQUEST_FILENAME} !-f`
`RewriteCond %{REQUEST_FILENAME} !-d`
`RewriteRule .* /codeigniterNameFolder/index.php/$0 [PT,L]`
change codeigniterNameFolder :) |
1,361,680 | So it seems I can't browse a website by IP, but I can browse using it's hostname.
```
C:\Users\c>nslookup www.example.com
Non-authoritative answer:
Name: cx-cdn-bre.gss.consultix.net
Addresses: 62.168.203.241
62.168.202.241
```
Trying to access 62.168.203.241 is displaying an "nginx Internal Server Err... | 2018/09/26 | [
"https://superuser.com/questions/1361680",
"https://superuser.com",
"https://superuser.com/users/810079/"
] | There are a variety of reasons this might be the case. Here are just a couple:
* [host headers](https://en.m.wikipedia.org/wiki/List_of_HTTP_header_fields) - In short, the webserver might host multiple websites on a single IP address. Without the domain name, it cannot display the proper website.
* load balancing or s... | Because the ip could point to the server but the hostname is merely pointing to a domain which could be a subdomain which could have some other ip all together.
A domain has 132.21.12.21 as ip (example, is made up number). A subdomain (meaning it has the same principal hostname and then something added to it) could h... |
1,361,680 | So it seems I can't browse a website by IP, but I can browse using it's hostname.
```
C:\Users\c>nslookup www.example.com
Non-authoritative answer:
Name: cx-cdn-bre.gss.consultix.net
Addresses: 62.168.203.241
62.168.202.241
```
Trying to access 62.168.203.241 is displaying an "nginx Internal Server Err... | 2018/09/26 | [
"https://superuser.com/questions/1361680",
"https://superuser.com",
"https://superuser.com/users/810079/"
] | Apache and nginx both (not sure about others....) can serve multiple sites from the same IP based on the host name that is used to connect and request the file(s).
But when you access the server via the IP address, there must be a virtual host defined to service the name used (the IP). The fact that the server is gene... | Because the ip could point to the server but the hostname is merely pointing to a domain which could be a subdomain which could have some other ip all together.
A domain has 132.21.12.21 as ip (example, is made up number). A subdomain (meaning it has the same principal hostname and then something added to it) could h... |
1,361,680 | So it seems I can't browse a website by IP, but I can browse using it's hostname.
```
C:\Users\c>nslookup www.example.com
Non-authoritative answer:
Name: cx-cdn-bre.gss.consultix.net
Addresses: 62.168.203.241
62.168.202.241
```
Trying to access 62.168.203.241 is displaying an "nginx Internal Server Err... | 2018/09/26 | [
"https://superuser.com/questions/1361680",
"https://superuser.com",
"https://superuser.com/users/810079/"
] | There are a variety of reasons this might be the case. Here are just a couple:
* [host headers](https://en.m.wikipedia.org/wiki/List_of_HTTP_header_fields) - In short, the webserver might host multiple websites on a single IP address. Without the domain name, it cannot display the proper website.
* load balancing or s... | Apache and nginx both (not sure about others....) can serve multiple sites from the same IP based on the host name that is used to connect and request the file(s).
But when you access the server via the IP address, there must be a virtual host defined to service the name used (the IP). The fact that the server is gene... |
346,649 | ```
Magento 2.4.2-p1
Porto theme
```
I enabled Gift Messages in:
```
Stores > Settings > Configuration > Sales > Sales:
```
* Allow Gift Messages on Order Level
* Allow Gift Messages for Order Items
**It does not show up on the front end. What do I need to do to make this work?**
---
UPDATED on September 8th, 2... | 2021/09/06 | [
"https://magento.stackexchange.com/questions/346649",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/20848/"
] | First of all, we need to understand how the Magento Gift Message works on Cart Page.
```
vendor/magento/module-gift-message/view/frontend/templates/cart/gift_options.phtml
```
This file is our light. We will save a lot of time if we understand its logic.
`window.giftOptionsConfig:` this global variable used for con... | Please try the below link:
[Moving Gift message form block from Cart to Checkout step 1](https://magento.stackexchange.com/questions/184769/moving-gift-message-form-block-from-cart-to-checkout-step-1)
I hope it's work for you... |
346,649 | ```
Magento 2.4.2-p1
Porto theme
```
I enabled Gift Messages in:
```
Stores > Settings > Configuration > Sales > Sales:
```
* Allow Gift Messages on Order Level
* Allow Gift Messages for Order Items
**It does not show up on the front end. What do I need to do to make this work?**
---
UPDATED on September 8th, 2... | 2021/09/06 | [
"https://magento.stackexchange.com/questions/346649",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/20848/"
] | First of all, we need to understand how the Magento Gift Message works on Cart Page.
```
vendor/magento/module-gift-message/view/frontend/templates/cart/gift_options.phtml
```
This file is our light. We will save a lot of time if we understand its logic.
`window.giftOptionsConfig:` this global variable used for con... | follow above solution to display Gift Options on Checkout page.
Step 1: Create file app/code/Vendor/CheckoutGiftMessage/view/frontend/layout/checkout\_index\_index.xml
Step 2: Create file app/code/Vendor/CheckoutGiftMessage/view/frontend/templates/gift\_options.phtml
Step 3: Create file app/code/Vendor/CheckoutGiftM... |
295,017 | Given $P(B)=\frac{3}{4}$, $P(A\cap B\cap \bar C)=\frac{1}{3}$, and $P(\bar A\cap B\cap \bar C)=\frac{1}{3}$, find $P(B\cap C)$. The answer choices are
(a) $\frac{1}{12}$, (b) $\frac{1}{9}$, (c)$\frac{1}{15}$ and (d)$\frac{1}{18}$
Ans: option a)
I tried using Venn diagram but my answer is not matching with any optio... | 2013/02/05 | [
"https://math.stackexchange.com/questions/295017",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/60681/"
] | Draw a generic Venn Diagram. We will start inserting numbers.
Work first with $A\cap B\cap\bar{C}$. Can you identify this little region? It is the stuff that is in $A$, in $B$, but outside $C$. Write $1/3$ in that region.
Work next with $\bar{A}\cap B\cap \bar{C}$. This is the region outside $A$ and $C$, but inside $... | The facts you have allow you to find $P(B\cap \overline C)$. Now use that $P(B\cap C)+P(B\cap\overline C)=\frac 34$. |
54,213,173 | I'm trying to query a SharePoint list with the following query:
```
<Where>
<Or>
<In>
<FieldRef Name='col1' />
<Values><Value Type='Integer'>1</Value></Values>
</In>
<In>
<FieldRef Name='col2' />
<Values><Value Type='Integer'>1</Value></Values>
</In>
</Or>
</Where>
```
Both are Taxonomy fields. T... | 2019/01/16 | [
"https://Stackoverflow.com/questions/54213173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6291623/"
] | I ended up querying on the hidden TextFields of the Taxonomy fields, by using the term ids:
```
<Where>
<Or>
<Contains><FieldRef Name='kf7aa880952e4699a9693b8b7379c884'/><Value Type='Text'>40e7b1fd-3892-4311-8428-6dbe77fc4ad7</Value></Contains>
<Contains><FieldRef Name='le11567cdf314372b377761db5f67b84'/><Value Ty... | try something like this
```
<FieldRef LookupId='TRUE' Name='MyTaxonomyField' />
<Values>
<Value Type='Integer'>4</Value>
</Values>
``` |
54,213,173 | I'm trying to query a SharePoint list with the following query:
```
<Where>
<Or>
<In>
<FieldRef Name='col1' />
<Values><Value Type='Integer'>1</Value></Values>
</In>
<In>
<FieldRef Name='col2' />
<Values><Value Type='Integer'>1</Value></Values>
</In>
</Or>
</Where>
```
Both are Taxonomy fields. T... | 2019/01/16 | [
"https://Stackoverflow.com/questions/54213173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6291623/"
] | I ended up querying on the hidden TextFields of the Taxonomy fields, by using the term ids:
```
<Where>
<Or>
<Contains><FieldRef Name='kf7aa880952e4699a9693b8b7379c884'/><Value Type='Text'>40e7b1fd-3892-4311-8428-6dbe77fc4ad7</Value></Contains>
<Contains><FieldRef Name='le11567cdf314372b377761db5f67b84'/><Value Ty... | I would suggest using CAML builder to build up your query.
Try the following
```
<Where>
<Or>
<In>
<FieldRef Name='col1' />
<Values><Value Type='Text'>TAxTextValue</Value></Values>
</In>
<In>
<FieldRef Name='col2' />
<Values><Value Type='Text'>TAxTextValue</Value></Values>
</In>
</Or>
</Where... |
14,687,153 | What do you think fellow programmers about using short functions vs using inline code?
Example with function:
```
//Check if all keys from $keys exist in $array
function functionName(array $array, array $keys) {
return array_diff($keys, array_keys($array));
}
functionName($mas,$keys);
```
vs. using just the co... | 2013/02/04 | [
"https://Stackoverflow.com/questions/14687153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386293/"
] | I think that in your example, it's superfluous. There's no need to create an extra function call and add bytes to the filesize without good reason.
Also, the inline `array_diff($keys, array_keys($mas));` is a lot easier to debug for fellow programmers, than looking through your code to find out exactly what `functionN... | It depends on what `functionName` actually is.
If you're using `customerDetailsAreValid` throughout your code and you suddenly have to add validation of `$array['email']`, you're going to be grateful for the separation of intent and implementation.
If on the other hand you're wrapping `array_diff` in the function `di... |
14,687,153 | What do you think fellow programmers about using short functions vs using inline code?
Example with function:
```
//Check if all keys from $keys exist in $array
function functionName(array $array, array $keys) {
return array_diff($keys, array_keys($array));
}
functionName($mas,$keys);
```
vs. using just the co... | 2013/02/04 | [
"https://Stackoverflow.com/questions/14687153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386293/"
] | I think that in your example, it's superfluous. There's no need to create an extra function call and add bytes to the filesize without good reason.
Also, the inline `array_diff($keys, array_keys($mas));` is a lot easier to debug for fellow programmers, than looking through your code to find out exactly what `functionN... | I think clarity is a prime concern when writing logic you hope will be around for any amount of time.
In general, I abhor inline functions. I think they are lazy, promote spaghetti code, and in general exude a complete lack of concern for style/readability/clarity on the part of the developer.
Filesize - I find thi... |
14,687,153 | What do you think fellow programmers about using short functions vs using inline code?
Example with function:
```
//Check if all keys from $keys exist in $array
function functionName(array $array, array $keys) {
return array_diff($keys, array_keys($array));
}
functionName($mas,$keys);
```
vs. using just the co... | 2013/02/04 | [
"https://Stackoverflow.com/questions/14687153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386293/"
] | It depends on what `functionName` actually is.
If you're using `customerDetailsAreValid` throughout your code and you suddenly have to add validation of `$array['email']`, you're going to be grateful for the separation of intent and implementation.
If on the other hand you're wrapping `array_diff` in the function `di... | I think clarity is a prime concern when writing logic you hope will be around for any amount of time.
In general, I abhor inline functions. I think they are lazy, promote spaghetti code, and in general exude a complete lack of concern for style/readability/clarity on the part of the developer.
Filesize - I find thi... |
34,066,921 | I have 3 select tags on one page, generated from struts2 select tag. I am using a jQuery filter function that filters the select. One textfield for every select, but all of them use the same filter function. I have another js function that is called on onChange event.
The problem is that before adding this jQuery func... | 2015/12/03 | [
"https://Stackoverflow.com/questions/34066921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1974248/"
] | May be this will help you. i did some modification in your code.
```
$(function() {
$('#selectedClientId').filterByText($('#textbox'), false);
$("#selectedClientId").change(function(){
alert("you have selected ++ " + $(this).val());
});
});
```
I used change() event of jquery instead of javascript on... | I solved the problem by changing the whole filter function. The function with problem was taken from a stack overflow question response ([How to dynamic filter options of <select > with jQuery?](https://stackoverflow.com/questions/1447728/how-to-dynamic-filter-options-of-select-with-jquery)). The problem is, from what ... |
54,079,152 | I have some strange thing happening on my Android studio dart console : every second there is this message :
`Failed to send request: {"jsonrpc":"2.0","id":"9354","method":"getVM","params":{}}`
The "id" count keeps incrementing and i can't find a solution to stop the logs. Does someone have a solution to this problem... | 2019/01/07 | [
"https://Stackoverflow.com/questions/54079152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10646164/"
] | Actually this error is not showing anymore after a reboot of my computer. Couldn't reproduce it but strange log anyway...
Thanks for the answers, if i have the same issue again i will try to find out where it comes from. | restart android studio will be enough to fix the problem |
54,079,152 | I have some strange thing happening on my Android studio dart console : every second there is this message :
`Failed to send request: {"jsonrpc":"2.0","id":"9354","method":"getVM","params":{}}`
The "id" count keeps incrementing and i can't find a solution to stop the logs. Does someone have a solution to this problem... | 2019/01/07 | [
"https://Stackoverflow.com/questions/54079152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10646164/"
] | Actually this error is not showing anymore after a reboot of my computer. Couldn't reproduce it but strange log anyway...
Thanks for the answers, if i have the same issue again i will try to find out where it comes from. | This has nothing to do with your app.Sometimes this error appears in the **log box** of android studio....
1.This problem appears after running an app on a emulator/real device.
2.This error always displays after the below message
```
Enter while loop.
Lost connection to device.
```
No need to worry about this m... |
54,079,152 | I have some strange thing happening on my Android studio dart console : every second there is this message :
`Failed to send request: {"jsonrpc":"2.0","id":"9354","method":"getVM","params":{}}`
The "id" count keeps incrementing and i can't find a solution to stop the logs. Does someone have a solution to this problem... | 2019/01/07 | [
"https://Stackoverflow.com/questions/54079152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10646164/"
] | restart android studio will be enough to fix the problem | This has nothing to do with your app.Sometimes this error appears in the **log box** of android studio....
1.This problem appears after running an app on a emulator/real device.
2.This error always displays after the below message
```
Enter while loop.
Lost connection to device.
```
No need to worry about this m... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | If you are working on a project that can use full .NET you may try to use
the ZipFile.CreateFromDirectory method, as [explained here](http://msdn.microsoft.com/en-us/library/hh485721(v=vs.110).aspx%5C):
```
using System;
using System.IO;
using System.IO.Compression;
namespace ConsoleApplication
{
class Program
... | A little change in the very good approach from @Andrey
```
public static void CreateEntryFromDirectory2(this ZipArchive archive, string sourceDirName, CompressionLevel compressionLevel = CompressionLevel.Fastest)
{
var folders = new Stack<string>();
folders.Push(sourceDirName);
do
... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | A little change in the very good approach from @Andrey
```
public static void CreateEntryFromDirectory2(this ZipArchive archive, string sourceDirName, CompressionLevel compressionLevel = CompressionLevel.Fastest)
{
var folders = new Stack<string>();
folders.Push(sourceDirName);
do
... | Use the recursive approach to Zip Folders with Subfolders.
```
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
public static async Task<bool> ZipFileHelper(IFolder folderForZipping, IFolder folderForZipFile, string zipFileName)
{
if (folderForZipping == null || folder... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | Here is one possible solution:
```
public static class ZipArchiveExtension
{
public static ZipArchiveDirectory CreateDirectory(this ZipArchive @this, string directoryPath)
{
return new ZipArchiveDirectory(@this, directoryPath);
}
}
public class ZipArchiveDirectory
{
private readonly string _d... | A little change in the very good approach from @Andrey
```
public static void CreateEntryFromDirectory2(this ZipArchive archive, string sourceDirName, CompressionLevel compressionLevel = CompressionLevel.Fastest)
{
var folders = new Stack<string>();
folders.Push(sourceDirName);
do
... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | If you are working on a project that can use full .NET you may try to use
the ZipFile.CreateFromDirectory method, as [explained here](http://msdn.microsoft.com/en-us/library/hh485721(v=vs.110).aspx%5C):
```
using System;
using System.IO;
using System.IO.Compression;
namespace ConsoleApplication
{
class Program
... | One more tuned `ZipArchive` extension, which adds folder structure including all subfolders and files to zip. Solved `IOException` (*Process can't access the file...*) which is thrown if files are in use at zipping moment, for example by some logger
```
public static class ZipArchiveExtensions
{
public static void... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | A little change in the very good approach from @Andrey
```
public static void CreateEntryFromDirectory2(this ZipArchive archive, string sourceDirName, CompressionLevel compressionLevel = CompressionLevel.Fastest)
{
var folders = new Stack<string>();
folders.Push(sourceDirName);
do
... | I don't like recursion as it was proposed by @Val, @sDima, @Nitheesh. Potentially it leads to the [StackOverflowException](https://learn.microsoft.com/en-us/dotnet/api/system.stackoverflowexception?view=netframework-4.5) because the stack has limited size. So here is my two cents with tree traversal.
```
public static... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | If you are working on a project that can use full .NET you may try to use
the ZipFile.CreateFromDirectory method, as [explained here](http://msdn.microsoft.com/en-us/library/hh485721(v=vs.110).aspx%5C):
```
using System;
using System.IO;
using System.IO.Compression;
namespace ConsoleApplication
{
class Program
... | I was also looking for a similar solution and found @Val & @sDima's solution more promising to me. But I found some issues with the code and fixed them to use with my code.
Like @sDima, I also decided to use Extension to add more functionality to ZipArchive.
```
using System;
using System.Collections.Generic;
using S... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | I don't like recursion as it was proposed by @Val, @sDima, @Nitheesh. Potentially it leads to the [StackOverflowException](https://learn.microsoft.com/en-us/dotnet/api/system.stackoverflowexception?view=netframework-4.5) because the stack has limited size. So here is my two cents with tree traversal.
```
public static... | It's working for me.
Static class
```
public static class ZipArchiveExtension
{
public static void CreateEntryFromAny(this ZipArchive archive, string sourceName, string entryName = "")
{
var fileName = Path.GetFileName(sourceName);
if (File.GetAttributes(sourceName).HasFlag(FileAt... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | I was also looking for a similar solution and found @Val & @sDima's solution more promising to me. But I found some issues with the code and fixed them to use with my code.
Like @sDima, I also decided to use Extension to add more functionality to ZipArchive.
```
using System;
using System.Collections.Generic;
using S... | It's working for me.
Static class
```
public static class ZipArchiveExtension
{
public static void CreateEntryFromAny(this ZipArchive archive, string sourceName, string entryName = "")
{
var fileName = Path.GetFileName(sourceName);
if (File.GetAttributes(sourceName).HasFlag(FileAt... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | My answer is based on the Val's answer, but a little improved for performance and without producing empty files in ZIP.
```
public static class ZipArchiveExtensions
{
public static void CreateEntryFromAny(this ZipArchive archive, string sourceName, string entryName = "")
{
var fileName = Path.GetFileNa... | Use the recursive approach to Zip Folders with Subfolders.
```
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
public static async Task<bool> ZipFileHelper(IFolder folderForZipping, IFolder folderForZipFile, string zipFileName)
{
if (folderForZipping == null || folder... |
15,133,628 | I am working on an existing code. This thing has got a ComboBox with a few ComboBoxItems. Each items has got a StackPanel withing which there is an Image control and a TextBlock.
Now the source property of the Image control is set to different vector images stored in XAML files whereas the Text property of the TextBl... | 2013/02/28 | [
"https://Stackoverflow.com/questions/15133628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1165036/"
] | Here is one possible solution:
```
public static class ZipArchiveExtension
{
public static ZipArchiveDirectory CreateDirectory(this ZipArchive @this, string directoryPath)
{
return new ZipArchiveDirectory(@this, directoryPath);
}
}
public class ZipArchiveDirectory
{
private readonly string _d... | One more tuned `ZipArchive` extension, which adds folder structure including all subfolders and files to zip. Solved `IOException` (*Process can't access the file...*) which is thrown if files are in use at zipping moment, for example by some logger
```
public static class ZipArchiveExtensions
{
public static void... |
24,543,086 | i try to write a JPQL query, which deletes all entities which are within a collection of another entity.
(Example code, without getter/setter and annotations)
```
class Aa implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String value;
}
@Entity
cl... | 2014/07/03 | [
"https://Stackoverflow.com/questions/24543086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2429841/"
] | The reason why this happens is usually because of translucent `UINavigationBar's`. Or Auto-Layout sometimes does this automatically based on the positioning of your Views and `UIScrollView`.
SOLUTIONS:
----------
1. The easiest thing to do is to disable Auto-Layout (it'll fix the problem in either situation) *OR* you... | If you want to keep AutoLayout on, you should set your ScrollView `contentSize` in `viewDidLayoutSubviews()`. |
25,057,327 | The code works fine in the browser the images load. However in the app PHP file is loaded but the images appear broken. Any text I add to the PHP is fine just the images are broken.
Here's my PHP code.
```
<html>
<?php
include("mysqlconnect.php");
$select_query = "SELECT `ImagesPath` FROM `offerstbl` ORDER by `Image... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25057327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3889508/"
] | You can use a `LEFT JOIN` instead of using `NOT IN`, like so:
```
select e.*
from employee e
left join service s on e.employeeid = s.employeeid
where s.employeeid is null
```
The `LEFT JOIN` ensures that you get a result set where every employee may or may not have a matching entry in `Service` table. The `WHERE` t... | ```sql
SELECT *
FROM Employee e
WHERE (
SELECT COUNT(*)
FROM service s
WHERE e.EmployeeId = s.EmployeeId
) = 0;
```
I do not recommend doing this, though.
Another solution with better performance (from [Conffusion's comment](https://stackoverflow.com/questions/25057317/alternative-methodo... |
25,057,327 | The code works fine in the browser the images load. However in the app PHP file is loaded but the images appear broken. Any text I add to the PHP is fine just the images are broken.
Here's my PHP code.
```
<html>
<?php
include("mysqlconnect.php");
$select_query = "SELECT `ImagesPath` FROM `offerstbl` ORDER by `Image... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25057327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3889508/"
] | You can use a `LEFT JOIN` instead of using `NOT IN`, like so:
```
select e.*
from employee e
left join service s on e.employeeid = s.employeeid
where s.employeeid is null
```
The `LEFT JOIN` ensures that you get a result set where every employee may or may not have a matching entry in `Service` table. The `WHERE` t... | didNot tested, but I think it can work:
```
select *
from (select distinct E.*, S.employeeid serviceEmployeeid
from employee E left outer join service S on e.employeeid = S.employeeid)
where serviceEmployeeid is null
```
added distinct for the situation a single employee had multiple services. |
25,057,327 | The code works fine in the browser the images load. However in the app PHP file is loaded but the images appear broken. Any text I add to the PHP is fine just the images are broken.
Here's my PHP code.
```
<html>
<?php
include("mysqlconnect.php");
$select_query = "SELECT `ImagesPath` FROM `offerstbl` ORDER by `Image... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25057327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3889508/"
] | You can use a `LEFT JOIN` instead of using `NOT IN`, like so:
```
select e.*
from employee e
left join service s on e.employeeid = s.employeeid
where s.employeeid is null
```
The `LEFT JOIN` ensures that you get a result set where every employee may or may not have a matching entry in `Service` table. The `WHERE` t... | I think this would produce your solution.
```
SELECT EmployeeId
FROM
EMPLOYEE
LEFT OUTER JOIN
SERVICE
ON (EMPLOYEE.EmployeeId = SERVICE.EmployeeId)
WHERE
SERVICE.ServiceId IS NULL
;
``` |
2,953,975 | I am currently using the following script for a few documents:
```
var pp = this.getPrintParams();
pp.interactive = pp.constants.interactionLevel.automatic;
this.print(pp);
```
How do I add another command, say `document.close()` so that it reads the print function and then follows the close document last? Do I simp... | 2010/06/01 | [
"https://Stackoverflow.com/questions/2953975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30043/"
] | add this `history.go(-1);` instead of `history.back(-1);` | The `print` function should block (pause) until the user finishes dealing with the print dialog, then continue. You don't have to do anything special to run more code after it.
That said, do you *really* need to force the document to close after it prints? As a user, I'd be pretty miffed if a website did this to me. W... |
2,640,678 | Example:
I have an NSArray with 40 objects. What is the most efficient way to return ONLY those objects with index equal to a number specified in another NSArray (e.g {0, 27, 36} for example)?
Can a predicate be used here? Or is there a more simple and efficient approach? | 2010/04/14 | [
"https://Stackoverflow.com/questions/2640678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54818/"
] | Why don't you just iterate over the index array and look up each index in the data array replacing the index with the looked-up object.
In the end, the array that held the indices now holds the objects. If you don't want to wipe out your index array, then just create a new array of the same size as the index array and... | I remember reading one time, and I cant say where but it stuck in my mind, that if this was something you need to do many times and the array is fairly large that there is a more efficient way. You could create a new dictionary from that array where each entry has the key of the index number and the value is the array ... |
2,640,678 | Example:
I have an NSArray with 40 objects. What is the most efficient way to return ONLY those objects with index equal to a number specified in another NSArray (e.g {0, 27, 36} for example)?
Can a predicate be used here? Or is there a more simple and efficient approach? | 2010/04/14 | [
"https://Stackoverflow.com/questions/2640678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54818/"
] | Why don't you just iterate over the index array and look up each index in the data array replacing the index with the looked-up object.
In the end, the array that held the indices now holds the objects. If you don't want to wipe out your index array, then just create a new array of the same size as the index array and... | There is a method ([objectsAtIndexes](http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/objectsAtIndexes:)) for returning specified indexes from an original array, but it requires an NSIndexSet as its argument, and there isn'... |
2,640,678 | Example:
I have an NSArray with 40 objects. What is the most efficient way to return ONLY those objects with index equal to a number specified in another NSArray (e.g {0, 27, 36} for example)?
Can a predicate be used here? Or is there a more simple and efficient approach? | 2010/04/14 | [
"https://Stackoverflow.com/questions/2640678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54818/"
] | There is a method ([objectsAtIndexes](http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html#//apple_ref/occ/instm/NSArray/objectsAtIndexes:)) for returning specified indexes from an original array, but it requires an NSIndexSet as its argument, and there isn'... | I remember reading one time, and I cant say where but it stuck in my mind, that if this was something you need to do many times and the array is fairly large that there is a more efficient way. You could create a new dictionary from that array where each entry has the key of the index number and the value is the array ... |
38,429,280 | So, I'm trying to learn some react, so far egghead.io is pretty good, but I have a question. I have the following code:
<https://jsfiddle.net/42pe/69z2wepo/49393/>
Basically these are 3 sliders which update the state on the parent component. Pretty straightforward.
Specifically, I can update the state like this (by... | 2016/07/18 | [
"https://Stackoverflow.com/questions/38429280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4159208/"
] | Use below Regular Expression for extracting domain name from string, Try:
```
$input = 'AmericanSwan.com Indian Websites';
preg_match_all('#[-a-zA-Z0-9@:%_\+.~\#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~\#?&//=]*)?#si', $input, $result);
echo $result[0][0]; //$result will give list of all domain names of string... | You should refer to this function: [parse\_url()](http://php.net/manual/en/function.parse-url.php)
And this example: [parse\_url example](http://php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-examples) |
342,778 | I am currently writing a ASP.Net web application that has a section for out IT department to manage users. One of the things it will do is give a checkbox list of the active directory security groups and email groups a user can be a member of. I was easily able to work out the code needed to add a user to a group when ... | 2017/02/22 | [
"https://softwareengineering.stackexchange.com/questions/342778",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/211994/"
] | If it is a List on the server side then not going to make a lot of difference.
Contains is O(n)
Remove is O(n)
Add is O(1) or O(n)
But is if the List does not need to be increase then O(1) and since you just removed it then the List does not need to be increased.
A skilled developer would design business obj... | Is performance really an issue? Seems to me that the more important NFR is transaction integrity.
If you gather a list (i.e. make a clone of it in a c# data structure) and then do the update afterward, there is a chance that the system of record will change before the update is complete, in which case your list will b... |
342,778 | I am currently writing a ASP.Net web application that has a section for out IT department to manage users. One of the things it will do is give a checkbox list of the active directory security groups and email groups a user can be a member of. I was easily able to work out the code needed to add a user to a group when ... | 2017/02/22 | [
"https://softwareengineering.stackexchange.com/questions/342778",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/211994/"
] | If it is a List on the server side then not going to make a lot of difference.
Contains is O(n)
Remove is O(n)
Add is O(1) or O(n)
But is if the List does not need to be increase then O(1) and since you just removed it then the List does not need to be increased.
A skilled developer would design business obj... | Let's take a step back here. You are adding and removing users from what seems like, at most, a handful of groups. Given your example, I can't imagine it would be very "process intensive" to calculate the 3 changes you propose. (If the checked groups list is only 4 items long and the existing list is 5 items long, I wo... |
4,075,230 | I realize this question has been asked and answered multiple times, but I'm still not understanding the reasoning. For reference, I've read [this](https://math.stackexchange.com/questions/603456/prove-that-the-union-of-countably-many-countable-sets-is-countable), [this](https://math.stackexchange.com/questions/447505/t... | 2021/03/24 | [
"https://math.stackexchange.com/questions/4075230",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/895860/"
] | It's hard, at least for me, to make the diagonal argument clearer, so I offer you the next. Define the following sets:
$$\begin{cases}A\_0=\{1,3,5,7,...,2n-1,...\}\\{}\\
A\_1=\{2,6,10,14,...,4n-2,...\}\\{}\\
A\_2=\{4,12,20,28,...,8n-4,...\}\\{}\\
...................................\\{}\\
A\_n=\{2^n, 2^n+2^{n+1}, 2^n+2... | Intuitively, a set is countable precisely when it can be put into a list. And that's exactly what the diagonal process does: it puts *all* the elements of the array into a list. |
4,075,230 | I realize this question has been asked and answered multiple times, but I'm still not understanding the reasoning. For reference, I've read [this](https://math.stackexchange.com/questions/603456/prove-that-the-union-of-countably-many-countable-sets-is-countable), [this](https://math.stackexchange.com/questions/447505/t... | 2021/03/24 | [
"https://math.stackexchange.com/questions/4075230",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/895860/"
] | It's hard, at least for me, to make the diagonal argument clearer, so I offer you the next. Define the following sets:
$$\begin{cases}A\_0=\{1,3,5,7,...,2n-1,...\}\\{}\\
A\_1=\{2,6,10,14,...,4n-2,...\}\\{}\\
A\_2=\{4,12,20,28,...,8n-4,...\}\\{}\\
...................................\\{}\\
A\_n=\{2^n, 2^n+2^{n+1}, 2^n+2... | All you're doing is showing that you can break $\mathbb{N}$ into sequential sets of size 1, 2, 3, 4 and so on as:
$\left\{\{0\}, \{1, 2\}, \{3, 4, 5\}, \{6, 7, 8, 9\}, \ldots \right\}$
and we can match those up with equally-sized sets of ordered pairs from $\mathbb{N}^2$ as:
$\left\{\{(0, 0)\}, \{(0, 1), (1, 0)\}, \... |
4,075,230 | I realize this question has been asked and answered multiple times, but I'm still not understanding the reasoning. For reference, I've read [this](https://math.stackexchange.com/questions/603456/prove-that-the-union-of-countably-many-countable-sets-is-countable), [this](https://math.stackexchange.com/questions/447505/t... | 2021/03/24 | [
"https://math.stackexchange.com/questions/4075230",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/895860/"
] | The argument shows that there is a surjection $g : \Bbb{N} \to S$ (that's what the bit about arranging the elements in a sequence is telling us). Given such a surjection $g$, you can define the function $h : S \to \Bbb{N}$ that maps $s \in S$ to the least $n \in \Bbb{N}$ such that $g(n) = s$. $h$ is an injection. | Intuitively, a set is countable precisely when it can be put into a list. And that's exactly what the diagonal process does: it puts *all* the elements of the array into a list. |
4,075,230 | I realize this question has been asked and answered multiple times, but I'm still not understanding the reasoning. For reference, I've read [this](https://math.stackexchange.com/questions/603456/prove-that-the-union-of-countably-many-countable-sets-is-countable), [this](https://math.stackexchange.com/questions/447505/t... | 2021/03/24 | [
"https://math.stackexchange.com/questions/4075230",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/895860/"
] | The argument shows that there is a surjection $g : \Bbb{N} \to S$ (that's what the bit about arranging the elements in a sequence is telling us). Given such a surjection $g$, you can define the function $h : S \to \Bbb{N}$ that maps $s \in S$ to the least $n \in \Bbb{N}$ such that $g(n) = s$. $h$ is an injection. | All you're doing is showing that you can break $\mathbb{N}$ into sequential sets of size 1, 2, 3, 4 and so on as:
$\left\{\{0\}, \{1, 2\}, \{3, 4, 5\}, \{6, 7, 8, 9\}, \ldots \right\}$
and we can match those up with equally-sized sets of ordered pairs from $\mathbb{N}^2$ as:
$\left\{\{(0, 0)\}, \{(0, 1), (1, 0)\}, \... |
4,075,230 | I realize this question has been asked and answered multiple times, but I'm still not understanding the reasoning. For reference, I've read [this](https://math.stackexchange.com/questions/603456/prove-that-the-union-of-countably-many-countable-sets-is-countable), [this](https://math.stackexchange.com/questions/447505/t... | 2021/03/24 | [
"https://math.stackexchange.com/questions/4075230",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/895860/"
] | All you're doing is showing that you can break $\mathbb{N}$ into sequential sets of size 1, 2, 3, 4 and so on as:
$\left\{\{0\}, \{1, 2\}, \{3, 4, 5\}, \{6, 7, 8, 9\}, \ldots \right\}$
and we can match those up with equally-sized sets of ordered pairs from $\mathbb{N}^2$ as:
$\left\{\{(0, 0)\}, \{(0, 1), (1, 0)\}, \... | Intuitively, a set is countable precisely when it can be put into a list. And that's exactly what the diagonal process does: it puts *all* the elements of the array into a list. |
45,861,965 | ### System information
* **Have I written custom code**: Custom project
* **OS Platform and Distribution**: macOS Sierra (10.12.6)
* **TensorFlow installed from**: Source
* **TensorFlow version**: Git tagged at 1.3 and master at d27ed9c
* **Python version**: Python 2.7.13 :: Anaconda 4.4.0
* **Bazel version**: 0.5.3\_... | 2017/08/24 | [
"https://Stackoverflow.com/questions/45861965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4176786/"
] | use
```
if item in {"dog", "fog", "sog", "log"}:
...
``` | This will solve your isse
```
old_list = ['cat','dog','bat','cat']
new_list = []
for item in old_list:
if item == "cat" or item=="bat":
new_list.append("a")
elif item == "dog" or item== "fog" or item=="sog" or item=="log":
new_list.append("o")
else:
new_list.append(item)
print(new_l... |
26,476,889 | I know there are many questions about this topic but I believe I went through all of them in the last 10 days and I could not find the solution for the error I'm heavily suffering.
I have a COM server dll in C# and a COM client in C#. All in Windows 7. I'm receiving InvalidCastException and I cannot solve the problem.... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26476889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2906820/"
] | According to Redhat's support site you should run
```
# subscription-manager repos --enable rhel-7-server-optional-rpms
# yum install mod_ldap -y
```
See: <https://access.redhat.com/solutions/977573> | If you're using Centos 7 or RHEL 7, this should do the trick:
```
sudo yum install -y mod_ldap
``` |
26,476,889 | I know there are many questions about this topic but I believe I went through all of them in the last 10 days and I could not find the solution for the error I'm heavily suffering.
I have a COM server dll in C# and a COM client in C#. All in Windows 7. I'm receiving InvalidCastException and I cannot solve the problem.... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26476889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2906820/"
] | If you're using Debian / Ubuntu and came to this page because you're getting the error:
>
> Unknown Authn provider: ldap
>
>
>
then this command should fix it (prefix with `sudo` if not running as root):
```
a2enmod authnz_ldap
``` | If you're using Centos 7 or RHEL 7, this should do the trick:
```
sudo yum install -y mod_ldap
``` |
26,476,889 | I know there are many questions about this topic but I believe I went through all of them in the last 10 days and I could not find the solution for the error I'm heavily suffering.
I have a COM server dll in C# and a COM client in C#. All in Windows 7. I'm receiving InvalidCastException and I cannot solve the problem.... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26476889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2906820/"
] | According to Redhat's support site you should run
```
# subscription-manager repos --enable rhel-7-server-optional-rpms
# yum install mod_ldap -y
```
See: <https://access.redhat.com/solutions/977573> | [These instructions on the Red Hat website](https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/1/html/1.2_Release_Notes/chap-Installation.html) explain how to enable the appropriate `yum` repositories to expose `mod_ldap`, as well as other packages on which it might depend or that may be useful ... |
26,476,889 | I know there are many questions about this topic but I believe I went through all of them in the last 10 days and I could not find the solution for the error I'm heavily suffering.
I have a COM server dll in C# and a COM client in C#. All in Windows 7. I'm receiving InvalidCastException and I cannot solve the problem.... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26476889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2906820/"
] | If you're using Debian / Ubuntu and came to this page because you're getting the error:
>
> Unknown Authn provider: ldap
>
>
>
then this command should fix it (prefix with `sudo` if not running as root):
```
a2enmod authnz_ldap
``` | [These instructions on the Red Hat website](https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/1/html/1.2_Release_Notes/chap-Installation.html) explain how to enable the appropriate `yum` repositories to expose `mod_ldap`, as well as other packages on which it might depend or that may be useful ... |
26,476,889 | I know there are many questions about this topic but I believe I went through all of them in the last 10 days and I could not find the solution for the error I'm heavily suffering.
I have a COM server dll in C# and a COM client in C#. All in Windows 7. I'm receiving InvalidCastException and I cannot solve the problem.... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26476889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2906820/"
] | According to Redhat's support site you should run
```
# subscription-manager repos --enable rhel-7-server-optional-rpms
# yum install mod_ldap -y
```
See: <https://access.redhat.com/solutions/977573> | If Oracle Linux 7, this should get you there:
```
yum --enablerepo=ol7_optional_latest install mod_ldap
``` |
26,476,889 | I know there are many questions about this topic but I believe I went through all of them in the last 10 days and I could not find the solution for the error I'm heavily suffering.
I have a COM server dll in C# and a COM client in C#. All in Windows 7. I'm receiving InvalidCastException and I cannot solve the problem.... | 2014/10/21 | [
"https://Stackoverflow.com/questions/26476889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2906820/"
] | If you're using Debian / Ubuntu and came to this page because you're getting the error:
>
> Unknown Authn provider: ldap
>
>
>
then this command should fix it (prefix with `sudo` if not running as root):
```
a2enmod authnz_ldap
``` | If Oracle Linux 7, this should get you there:
```
yum --enablerepo=ol7_optional_latest install mod_ldap
``` |
55,580,345 | ```
"Roles":
{
"0_A":["Developer"],
"0_B":["Developer"],
"0_C":["Developer","Tester","Player"],
"0_D":["Tester"]
}
```
Is there a way to check if the value 'Player'/'Tester'/'Developer' exists anywhere in 'Roles' object? This is what I tried:
```
let isPlayer= false;
if (response) {
const k = Obje... | 2019/04/08 | [
"https://Stackoverflow.com/questions/55580345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3693060/"
] | The main problem that prevents `QuickSort()` from exiting the recursion is here:
```py
pivot=L[0]
newL=partition(L,pivot)[0]
newPivot=partition(L,pivot)[1]
L2=newL[newPivot:]
L1=newL[:newPivot]
```
Firstly, `pivot` must be initialized with a *position* in the list, not with a ... | My reading of the [QuickSort algorithm in Wikipedia](https://en.wikipedia.org/wiki/Quicksort) is that you should be able to sort the array *in place* and not do things like `newL = L.copy()`. And the `merge()` operation you're doing should be a simpler concatenation as the two arrays are already sorted, one of all lowe... |
56,403,326 | Create a class Employee with the following private member variables.
```
int employeeId
String employeeName
double salary
double netSalary
```
Include appropriate getters and setters method in Employee class. Write the following method in the Employee class:
```
public void calculateNetSalary(int pfpercentage) // T... | 2019/06/01 | [
"https://Stackoverflow.com/questions/56403326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11585448/"
] | ```
public class Employee {
private int employeeId;
private String employeeName;
private double salary;
private double netSalary;
public int getEmployeeId() {
return employeeId;
}
public String getEmployeeName() {
return employeeName;
}
public double getSalary() {
return salary;
}
public void setEmployeeI... | Try this code.
```
class Employee {
private int employeeId;
private String employeeName;
private double salary;
private double netSalary;
public Employee(int employeeId, String employeeName, double salary) {
this.employeeId = employeeId;
this.employeeName = employeeName;
... |
43,447,643 | I set condition that a number greater than surrounding,but it go a false.
```
for (var i = 0; i + 1 < n; i++) {
if (arr[i] < arr[i + 1] || arr[i + 1] > arr[i + 2]) {
count++;
index1 = i + 1;
}
}
```
arr=[1, 2, 3, 6, 5, 4, 7, 8],n=8.
You can see count plus when arr[i+1] smaller than arr[i+2].... | 2017/04/17 | [
"https://Stackoverflow.com/questions/43447643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7352407/"
] | You should use AND condition instead of OR to check value is greater than left and right.
Refer below code:
```js
var arr=[1, 2, 3, 6, 5, 4, 9, 8];
var n=8;
var count = 0;
var pos = [];
for (var i = 0; i + 1 < n; i++) {
if (arr[i] < arr[i + 1] && arr[i + 1] > arr[i + 2]) {
count++;
index1 ... | When i is reaching 6, you test array[i+2] with i+2=8, so the index i+2 is out of bound (the array contains 8 elements, with index starting from 0 to 7).
In js, getting a value out of array returns undefined, which is evaluated as a falsy value (evaluated as false).
You can get an explanation about falsy values here:
... |
43,447,643 | I set condition that a number greater than surrounding,but it go a false.
```
for (var i = 0; i + 1 < n; i++) {
if (arr[i] < arr[i + 1] || arr[i + 1] > arr[i + 2]) {
count++;
index1 = i + 1;
}
}
```
arr=[1, 2, 3, 6, 5, 4, 7, 8],n=8.
You can see count plus when arr[i+1] smaller than arr[i+2].... | 2017/04/17 | [
"https://Stackoverflow.com/questions/43447643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7352407/"
] | The problem is in the condition of ||(OR) since
```
true || false will result in true
```
Also, &&(AND) will result in
```
true && false will reult in false
```
So modify your function using "&&" instead of "||"
```
var arr=[1, 2, 3, 6, 5, 4, 9, 8];
var n=8;
var count = 0;
for (var i = 0; i + 1 < n; i++) {
... | When i is reaching 6, you test array[i+2] with i+2=8, so the index i+2 is out of bound (the array contains 8 elements, with index starting from 0 to 7).
In js, getting a value out of array returns undefined, which is evaluated as a falsy value (evaluated as false).
You can get an explanation about falsy values here:
... |
177,462 | So I was playing with some friends on my minecraft server and an idiot decided to spawn this:

Now the server is lagging like hell and it's impossible to play. I am not able to kill it with a sword either. So please, how do I kill this? | 2014/07/20 | [
"https://gaming.stackexchange.com/questions/177462",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/73529/"
] | Ok, it's solved. We used lava to drown that thing. It's dead now. | The hitbox is actually not out at the surface of the slime. I spawned one of these in a test world a while ago and found that the hitbox is near the center of the slime, about where the darker inner cube starts, and only within about 3-4 blocks of the ground. The only way to kill it with a sword is to be in creative mo... |
177,462 | So I was playing with some friends on my minecraft server and an idiot decided to spawn this:

Now the server is lagging like hell and it's impossible to play. I am not able to kill it with a sword either. So please, how do I kill this? | 2014/07/20 | [
"https://gaming.stackexchange.com/questions/177462",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/73529/"
] | Ok, it's solved. We used lava to drown that thing. It's dead now. | ### Solution using commands
If you have access to commands *and* are playing Minecraft 1.8 (snapshot 14w02a or newer), you can use them to get rid of any mob.
```
/kill @e[r=50,type=slime]
```
Kills all slimes in a 50m radius around the player. In the case of slimes, you might have to repeat the command, since I am... |
177,462 | So I was playing with some friends on my minecraft server and an idiot decided to spawn this:

Now the server is lagging like hell and it's impossible to play. I am not able to kill it with a sword either. So please, how do I kill this? | 2014/07/20 | [
"https://gaming.stackexchange.com/questions/177462",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/73529/"
] | Ok, it's solved. We used lava to drown that thing. It's dead now. | ```
/kill @e{type=slime}
```
No space in `@e` and `{type=slime}` |
177,462 | So I was playing with some friends on my minecraft server and an idiot decided to spawn this:

Now the server is lagging like hell and it's impossible to play. I am not able to kill it with a sword either. So please, how do I kill this? | 2014/07/20 | [
"https://gaming.stackexchange.com/questions/177462",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/73529/"
] | The hitbox is actually not out at the surface of the slime. I spawned one of these in a test world a while ago and found that the hitbox is near the center of the slime, about where the darker inner cube starts, and only within about 3-4 blocks of the ground. The only way to kill it with a sword is to be in creative mo... | ```
/kill @e{type=slime}
```
No space in `@e` and `{type=slime}` |
177,462 | So I was playing with some friends on my minecraft server and an idiot decided to spawn this:

Now the server is lagging like hell and it's impossible to play. I am not able to kill it with a sword either. So please, how do I kill this? | 2014/07/20 | [
"https://gaming.stackexchange.com/questions/177462",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/73529/"
] | ### Solution using commands
If you have access to commands *and* are playing Minecraft 1.8 (snapshot 14w02a or newer), you can use them to get rid of any mob.
```
/kill @e[r=50,type=slime]
```
Kills all slimes in a 50m radius around the player. In the case of slimes, you might have to repeat the command, since I am... | ```
/kill @e{type=slime}
```
No space in `@e` and `{type=slime}` |
222,668 | I'm about to get started converting a C# based desktop app to be web based. For a couple of reasons, I would like to cut the GUI from the logic via a web service. Microsoft has asmx files, WCF, and probably something new at PDC next week. Data can be passed via SOAP, REST, JSON, and probably 12 other ways as well.
Cou... | 2008/10/21 | [
"https://Stackoverflow.com/questions/222668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/632/"
] | You are about to move to a new platform. I would go for WCF. It can support all your needs.
Initially when you move you can use httpBinding and that is very close to ASMX web services and is based on SOAP. If you later require some advanced features, then you can definitely utilise webHttpBinding and that will give yo... | I vote for WCF, hands down. |
222,668 | I'm about to get started converting a C# based desktop app to be web based. For a couple of reasons, I would like to cut the GUI from the logic via a web service. Microsoft has asmx files, WCF, and probably something new at PDC next week. Data can be passed via SOAP, REST, JSON, and probably 12 other ways as well.
Cou... | 2008/10/21 | [
"https://Stackoverflow.com/questions/222668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/632/"
] | You are about to move to a new platform. I would go for WCF. It can support all your needs.
Initially when you move you can use httpBinding and that is very close to ASMX web services and is based on SOAP. If you later require some advanced features, then you can definitely utilise webHttpBinding and that will give yo... | If you want the option of SOAP, REST, and JSON, then you may want to look at the [WCF Web Programming Model](http://msdn.microsoft.com/en-us/library/bb412169.aspx) and [WCF JSON support](http://msdn.microsoft.com/en-us/library/bb412187.aspx), although personally I'm not happy about the REST implementation. But WCF offe... |
222,668 | I'm about to get started converting a C# based desktop app to be web based. For a couple of reasons, I would like to cut the GUI from the logic via a web service. Microsoft has asmx files, WCF, and probably something new at PDC next week. Data can be passed via SOAP, REST, JSON, and probably 12 other ways as well.
Cou... | 2008/10/21 | [
"https://Stackoverflow.com/questions/222668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/632/"
] | You are about to move to a new platform. I would go for WCF. It can support all your needs.
Initially when you move you can use httpBinding and that is very close to ASMX web services and is based on SOAP. If you later require some advanced features, then you can definitely utilise webHttpBinding and that will give yo... | For a desktop app like yours, passing data as JSON does not make a lot of sense. Its main use is to allow for easier access from a web browser. Although they serve different purposes, the same could be said for REST.
For two .NET apps communicating, WCF is the way to go, in my opinion. Though for many people ASMX more... |
498,557 | I'm trying to write a script to enable IPMI on a ton of machines without having to hook up a KVM to them one by one. Is it possible to change the BIOS settings from Linux? OS is SL6.
I understand that each machine will likely need to be power cycled, but I can do that programmatically of course. | 2013/04/11 | [
"https://serverfault.com/questions/498557",
"https://serverfault.com",
"https://serverfault.com/users/107102/"
] | This is just a guess, but it's too long for a comment, so here goes.
With virtual private servers, you get a "slice" of a real server. Rather than spending, say, $500 each on 24 small servers with 512MB ram etc, it's cheaper to buy (and operate) one $3500 server with 12GB RAM and two six-core hyperthreaded cpus.
He... | Take a look at the virt field in the output of your top command.Your VPS has 512MB of memory, yet apache is demanding far mare memory, which probably explains why you've got 4GB of virtual memory. With all those apache threads, virtual memory is going to be swapping constantly, which is causing the high IO.
Why is apa... |
498,557 | I'm trying to write a script to enable IPMI on a ton of machines without having to hook up a KVM to them one by one. Is it possible to change the BIOS settings from Linux? OS is SL6.
I understand that each machine will likely need to be power cycled, but I can do that programmatically of course. | 2013/04/11 | [
"https://serverfault.com/questions/498557",
"https://serverfault.com",
"https://serverfault.com/users/107102/"
] | This is just a guess, but it's too long for a comment, so here goes.
With virtual private servers, you get a "slice" of a real server. Rather than spending, say, $500 each on 24 small servers with 512MB ram etc, it's cheaper to buy (and operate) one $3500 server with 12GB RAM and two six-core hyperthreaded cpus.
He... | Your `httpd` processes are using up more RAM than you physically have available, thus something has to get swapped. (It's also interesting that in the screenshot showing this, you cut off the top, and that you restarted Apache before taking the second screenshot. What are you hiding?) You need to reduce the system's me... |
498,557 | I'm trying to write a script to enable IPMI on a ton of machines without having to hook up a KVM to them one by one. Is it possible to change the BIOS settings from Linux? OS is SL6.
I understand that each machine will likely need to be power cycled, but I can do that programmatically of course. | 2013/04/11 | [
"https://serverfault.com/questions/498557",
"https://serverfault.com",
"https://serverfault.com/users/107102/"
] | Take a look at the virt field in the output of your top command.Your VPS has 512MB of memory, yet apache is demanding far mare memory, which probably explains why you've got 4GB of virtual memory. With all those apache threads, virtual memory is going to be swapping constantly, which is causing the high IO.
Why is apa... | Your `httpd` processes are using up more RAM than you physically have available, thus something has to get swapped. (It's also interesting that in the screenshot showing this, you cut off the top, and that you restarted Apache before taking the second screenshot. What are you hiding?) You need to reduce the system's me... |
17,523 | En el idioma alemán existen varias grafías, véase ä, ö, ü y ß, que pueden ser complicadas de escribir en algunos teclados. Sin embargo, ningún alemán se rasga las vestiduras si ve cualquiera de estos caracteres sustituido por sus versiones ASCII:
* ä >> ae
* ö >> oe
* ü >> ue
* ß >> ss
De este modo, cualquiera con un... | 2016/07/25 | [
"https://spanish.stackexchange.com/questions/17523",
"https://spanish.stackexchange.com",
"https://spanish.stackexchange.com/users/12637/"
] | Como ya [se ha indicado](https://spanish.stackexchange.com/questions/17523/hay-alguna-alternativa-oficial-para-escribir-la-%C3%B1-en-teclados-extranjeros#comment24134_17523), la RAE no ha lanzado una propuesta de grafía sustituta para transcribir el sonido nasal palatal /ɲ/ que representamos con la letra *ñ*. A lo larg... | Personalmente, cuando me toca sustituirla (normalmente al programar, que el compilador puede no reconocer ese símbolo) prefiero sustituirla por "ni", ya que al juntar esas dos letras con una vocal, se produce un sonido muy parecido al de la ñ + vocal.
Por ejemplo:
"ña", por "niá". "España" por "Espaniá". Además he obs... |
17,523 | En el idioma alemán existen varias grafías, véase ä, ö, ü y ß, que pueden ser complicadas de escribir en algunos teclados. Sin embargo, ningún alemán se rasga las vestiduras si ve cualquiera de estos caracteres sustituido por sus versiones ASCII:
* ä >> ae
* ö >> oe
* ü >> ue
* ß >> ss
De este modo, cualquiera con un... | 2016/07/25 | [
"https://spanish.stackexchange.com/questions/17523",
"https://spanish.stackexchange.com",
"https://spanish.stackexchange.com/users/12637/"
] | Como ya [se ha indicado](https://spanish.stackexchange.com/questions/17523/hay-alguna-alternativa-oficial-para-escribir-la-%C3%B1-en-teclados-extranjeros#comment24134_17523), la RAE no ha lanzado una propuesta de grafía sustituta para transcribir el sonido nasal palatal /ɲ/ que representamos con la letra *ñ*. A lo larg... | Para quienes desistan de escribir la ñ, no digo nada, pero me parece importante señalar que siempre hay formas de teclear cualquier carácter.
[Aquí](https://filipiknow.net/enye/) se explican unos cuantos métodos para Windows. Me gusta especialmente el método B.b: tras la configuración necesaria basta con usar Alt-n pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.