qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
40,143,861 | after running code i get no result in window. and i cant find problem
result have to be string created from charCode.
```js
function rot13(str) {
var te = [];
var i = 0;
var a = 0;
var newte = [];
while (i < str.length) {
te[i] = str.charCodeAt(i);
i++;
}
while (a != te.length) {
i... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40143861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3225277/"
] | Try this code:
Answer 1:
```
func tableView(tableView:UITableView!, numberOfRowsInSection section: Int) -> Int {
yourTableViewName.estimatedRowHeight = 44.0 // Standard tableViewCell size
yourTableViewName.rowHeight = UITableViewAutomaticDimension
return yourArrayName.count }
And also p... | in viewDidLoad Add this
```
tableView.estimatedRowHeight = 44.0
tableView.rowHeight = UITableViewAutomaticDimension
```
Just add these two lines and your problem will b solved |
2,229,054 | Basically, what I'm looking for is some kind of class or method to implement a dictionary in PHP.
For example, if I was building a word unscrambler - lets say I used the letters 'a,e,l,p,p'. The number of possibilities for arrangement is huge - how do I only display those which are actual words (apple, pale etc )?
Tha... | 2010/02/09 | [
"https://Stackoverflow.com/questions/2229054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/246637/"
] | you can also consider pspell
<http://php.net/manual/en/book.pspell.php>
```
$ps = pspell_new("en");
foreach(array('alppe', 'plape', 'apple') as $word)
if(pspell_check($ps, $word))
echo $word;
``` | Store a list of words in a file or a database, and then just try all the combinations. You could also consider the likely position of vowels vs consonants to potentially speed it up. Rather than making your own word list, you could use something like [WordNet](http://wordnet.princeton.edu/wordnet/). |
46,666,787 | Validation is not working. All the form fields are coming dynamically. It depends on the user how many fields he chooses.If he chooses 2 and it will display 2 fields in the view. If select 3 then it will display 3 fields and so on.I have more than 30 fields
I set 3 arrays(for testing purpose I set only 3. It will be t... | 2017/10/10 | [
"https://Stackoverflow.com/questions/46666787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Of course it will fail. Your validation rules define a 'middlename' field as `required`, and that field doesn't even exist in the form.
A missing field cannot satisfy a `required` rule. | As others have mentioned, you are requiring a field that does not exist. You either need to:
* Add a field in your view with the name `middlename`
* Remove the validation rule that requires a field `middlename` to exist
Not contributing to your issue, but in a usability aspect, you likely want to change the label in ... |
30,892,945 | Using `Ctrl`+`Shift`+`B` I added a default tasks.json file and uncommented the second task runner block. I have a typescript file in the root of the directory and a tsconfig.json.
Everytime I compile I get 'error TS5023: Unknown compiler option 'p'. What is the correct definition to allow me to compile a typescript fi... | 2015/06/17 | [
"https://Stackoverflow.com/questions/30892945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40986/"
] | I had the same problem. It was a wrong PATH variable to the TypeScript compiler. (try to type `tsc -v` in a command window). The `tsconfig.json` is supported in TypeScript version 1.5. My PATH variable was set to version 1.
When I changed the system PATH variable to the updated installation folder (`C:\Program Files (... | I struggled until I understood how npm was installing the typescript 1.5 beta (or not) on my windows laptop.
The key to getting this to work for me was:
1. uninstall current version of typescript (for me, this was version 1.4.1)
>
> npm uninstall -g typescript
>
>
>
2. install 1.5.1-beta version
>
> npm install... |
3,262,947 | Please help me with this Herstein exercise (Page 103,Sec 2.12, Ques 16).
\begin{array} { l } { \text { If } G \text { is a finite group and its } p \text { -Sylow subgroup } P \text { lies in the center of } } \\ { G , \text { prove that there exists a normal subgroup } N \text { of } G \text { with } P \cap N = (e)} \... | 2019/06/15 | [
"https://math.stackexchange.com/questions/3262947",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/446929/"
] | Let $G' = [G,G]$ be the [derived subgroup](https://en.wikipedia.org/wiki/Commutator_subgroup) of $G$. Let $\pi$ be the natural projection of $G$ onto the quotient $Q = G/G'$ (also called the abelization of $G$). The Abelian group $Q$ splits as a direct product $Q = \pi(P) \times M$. The group you are looking for is $N ... | The basic idea is that you know that because $P$ lies in the center it is the only $p$-Sylow subgroup. That fact is enough to tell you that every element can be decomposed into a "$P$ part" and a "not $P$ part", and each "part" is a subgroup. Here is how that decomposition works:
$G$ is a finite group, therefore it is... |
62,558,602 | Im trying to `import numpy as np` (im using VS2019 as the IDE) and I get the error `"No module names 'numpy'"`. So I tried going to the windows cmd and did `pip install numpy` and I get the error: `"'Pip' is Not Recognized as an Internal or External Command."` I tried watching [this video](https://www.youtube.com/watch... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62558602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11041361/"
] | On of my friends had the same problem. We simply reinstalled python on his Windows 10 laptop and we paid attention to add python to PATH and select an option to install pip with python. This worked pretty much, I think the python Win10 installer is sometimes a little bit to complicated on Win10. | First check if pip is already installed by running this command
pip - - version
If it is installed then change the os path and if not check if python is correctly installed or not by running this command
python - - version
If python is installed then try this command
python get-pip.py |
22,370,922 | A chart on a form I created has two overlapping areas. The overlapping part works just fine. The problem is that visible graph only takes up half the height of the chart control:

The bottom half of the control is left empty (presumably because that'... | 2014/03/13 | [
"https://Stackoverflow.com/questions/22370922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/852757/"
] | If you're using GCC or compilers with [`__int128`](https://gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html) like Clang or ICC
```
unsigned __int128 H = 0, L = 0;
L++;
if (L == 0) H++;
```
On systems where `__int128` isn't available
```
std::array<uint64_t, 4> c[4]{};
c[0]++;
if (c[0] == 0)
{
c[1]++;
if (c[... | Neither of your counter versions increment correctly. Instead of counting up to `UINT256_MAX`, you are actually just counting up to `UINT64_MAX` 4 times and then starting back at 0 again. This is apparent from the fact that you do not bother to clear any of the indices that has reached the max value until all of them h... |
623,208 | I have a framed window (currently iframe but may possibly be frame) - I do not have control over this.
I would like to detect if my content is inside an iframe (or frame).
I wanted to compare the location of the current document with the one the top object holds but it appears it is the same object (top === window)... | 2009/03/08 | [
"https://Stackoverflow.com/questions/623208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48317/"
] | If you're using Linux, you can install the "strace" utility to see what the Ruby process is doing that's consuming all the CPU. That will give you a good low-level view. It should be available in your package manager. Then you can:
```
$ sudo strace -p 22710
Process 22710 attached - interrupt to quit
...lots of stuff.... | I had a ruby process related to Phusion Passenger, which consumed lots of CPU, even though it should have been idle.
The problem went away after I ran
```
date -s "`date`"
```
as suggested in [this thread](http://www.redmine.org/boards/2/topics/31731). (That was on Debian Squeeze)
Apparently, the problem was relat... |
5,492,258 | I guess you all know by now easyacordion:
<http://www.madeincima.eu/blog/jquery-plugin-easy-accordion/>
but i just find the documentation invisible for this..
lets say i have my acordion:
```
<div id="intro_web">
<dt>una</dt> <dd>descripcion una</dd>
<dt>dos</dt> <dd>descripcion una</dd>
<dt>... | 2011/03/30 | [
"https://Stackoverflow.com/questions/5492258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/533941/"
] | Google re-ranks the sites it has regularly. If the site changes, the ranking very well could... if more or fewer people link to it or if the terms on the site (the content) is different.
The effect might be good or bad, but uploading different content isn't going to make their rank go away overnight or anything like ... | Page Rank is most about incoming links. So if the incoming links won't be broken page rank will not be affected that much.
Though, overall ranking is not just Page Rank, so... further discussion is needed |
1,393,683 | I have two profiles in my Google Chrome: Joe and Sam. I would like to rename the name of my profile into "JoeJobs" but I can't find any way to do it. I'm only getting "Manage people" and "Remove this person".
Is there any way to rename my username profile. Deleting it and re-creating it is truely ridiculous - I saved ... | 2019/01/13 | [
"https://superuser.com/questions/1393683",
"https://superuser.com",
"https://superuser.com/users/588467/"
] | I just found this out after looking around for a while. this method works as of 2019-May 30th, on Chrome 74. Other versions may change how it's done.
1) Open Chrome, make sure you are on the profile you want to change the name or icon picture of.
* Change profiles by clicking on the icon on the upper right of Chrome,... | There are two parts to the Chrome Profile as shown in the dropdown menu from the current user. Like this:
Company (Client Project)
In this example "Company" is the firstname of the Google Account, which can be changed under name at: <https://myaccount.google.com/personal-info>
"Client Project" comes from the Chrome ... |
22,644,884 | The header file will not compile into my main test program. Why would this be the case. I have looked on line but found no simple reason why this would be the case. I have tried a couple of `#ifndef`, and `#define` and am still not sure as to why the file will not include into my test program.
Below are the error mess... | 2014/03/25 | [
"https://Stackoverflow.com/questions/22644884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This line isn't valid:
```
#include'myDataStructures.h' <-- name of my include file
```
In C/C++, single quotes are used to quote *character literals*, not string literals. You need to use double quotes:
```
#include "myDataStructures.h"
```
The error messages are slightly less helpful than they could be because ... | You need to use double quotes `"MyIncludeFile.h"` when including files. |
2,558,197 | I wanted to create a page with a simple button which runs away from the user when he tries to click it. Lets call it the Run away button?
Is there a simple 'jQuery' snippet which will allow me to do the same?
Regards,
Karan Misra | 2010/04/01 | [
"https://Stackoverflow.com/questions/2558197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207426/"
] | Use `aggregate` to summarize across a factor:
```
> df<-read.table(textConnection('
+ egg 1 20
+ egg 2 30
+ jap 3 50
+ jap 1 60'))
> aggregate(df$V3,list(df$V1),mean)
Group.1 x
1 egg 25
2 jap 55
```
For more flexibility look at the `tapply` function and the `plyr` package.
In `ggplot2` use `stat_summary`... | @Jyotirmoy mentioned that this can be done with the `plyr` library. Here is what that would look like:
```
DF <- read.table(text=
"Widget Type Energy
egg 1 20
egg 2 30
jap 3 50
jap 1 60", header=TRUE)
library("plyr")
ddply(DF, .(Widget), summarise, Energy=mean(Energy))
```
which gives
```
> ddply(DF, .(Wid... |
18,358,675 | I'm trying to use the ng-if expression to render posts as images or text, depending on the content. The first of theese lines render true sometimes and false sometimes in a ng-repeat-loop, however both the image and the span are shown in each itteration.
```
<a href="{{post.url}}">
{{post.type == 0}}
<img ng-if="p... | 2013/08/21 | [
"https://Stackoverflow.com/questions/18358675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/350080/"
] | You are defining the value of "post.type" to equal 0 or 1. Use the "==" operator to determine if the value is equal to the comparison
```
<a href="{{post.url}}">
{{post.type = 0}}
<img ng-if="post.type == 0" src="{{post.content}}" />
<span ng-if="post.type == 1">{{post.content}}<span>
</a>
```
A different app... | 1. Sometimes in a complex HTML not closing tags can create an issue and your span isn't closed (no ).
2. Just for a test case try to change to ng-show.
3. JB Nizet gave u a working plnkr in the comments so I think there is an issue before that. |
63,540,492 | When the `space` key is pressed, I want the button to not trigger; how can I implement that functionality? I have found a similar [post](https://stackoverflow.com/questions/58388744/how-to-stop-spacebar-from-triggering-a-focused-qpushbutton) but it is written in [c++](/questions/tagged/c%2b%2b "show questions tagged 'c... | 2020/08/22 | [
"https://Stackoverflow.com/questions/63540492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13281485/"
] | If you want any keyboard event that triggers the button then just implement an event filter:
```
import sys
from PyQt5 import QtCore, QtWidgets
class Listener(QtCore.QObject):
def __init__(self, button):
super().__init__(button)
self._button = button
self.button.installEventFilter(self)
... | Setting noFocus policy for button also works. Button stops reacting to spacebar.
```
self.button= QPushButton()
self.button.setFocusPolicy(Qt.NoFocus)
``` |
18,588 | One of my colleagues is in charge of QA (acceptance testing), and I keep on having to double check his work, and when I do, I find bugs - it is becoming tedious.
Short of double checking his work, how can I improve the process so that it is more efficiently done? | 2016/06/30 | [
"https://pm.stackexchange.com/questions/18588",
"https://pm.stackexchange.com",
"https://pm.stackexchange.com/users/20871/"
] | Let's divide QA(Quality Assurance) from QC(Quality control), check the [difference](http://www.diffen.com/difference/Quality_Assurance_vs_Quality_Control).
Short term solution for manual QC would be to create test plans, acceptance criteria's, force your QC to add test evidence(Screenshots, screencasts, logs, SQL quer... | Clearly document the *finds* in emails to your colleague, and CC this colleague's direct boss (and maybe the one above them).
After 3 such emails it's appropriate to ask the boss to request your colleague to either shape up or ship out.
(Most times, after one such email+CC your colleague will make sure to clean up th... |
22,331,911 | I have two end-points that are giving the following error when viewing the list of end-points:
>
> **Error while fetching Revision**
>
>
> APIProxy revision *[revision #]* does not exist for APIProxy *[end-point-name]* in organization *[org name]*
>
>
>
If I try to delete the end-point from the "Api Proxies" li... | 2014/03/11 | [
"https://Stackoverflow.com/questions/22331911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3407199/"
] | Don't know previous iOS but Setting **Build Active Architecture** Only to `YES` in **iOS 8** did the trick.
 | I just changed the Debug from Yes to No,
```
Build Settings -> Architectures -> Build Active Architecture Only -> Debug -> NO.
```
This one fixed my error. |
72,602,523 | Here's what I got:
```c
enum X {
NONE = 0x00000000,
FLAG_1 = 0x00000001,
FLAG_2 = 0x00000002,
FLAG_3 = 0x00000004,
FLAG_4 = 0x00000008,
FLAG_5 = 0x00000010,
// ...
FLAG_32 = 0x80000000
}
```
Is there a way to make "bit numbering" automatic so I could like insert a flag so all that goe... | 2022/06/13 | [
"https://Stackoverflow.com/questions/72602523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/126537/"
] | Here is an alternative approach:
```
enum X_bits {
B0, // replace Bx with actual flag name
B1,
B2,
//...
B32
};
#define FLAG(x) FLAG_##x = 1U << x
enum X {
NONE = 0,
FLAG(B0), // will define FLAG_B0 with the appropriate value 0x1
FLAG(B1),
FLAG(B2),
//...
FLAG(B32)
};
`... | My last take: flags.h header:
```c
#pragma once
#define BIT_FLAG_BASE(base) enum { base = __COUNTER__ + 1 } ///< Sets the base for the bit flag counter.
#define BIT_FLAG(base) 1U << (__COUNTER__ - base) ///< Gets the next bit for the bit flag counter.
```
Used like this:
```c
#include "flags.h"
BIT_FLAG_BASE(MyFl... |
36,901,154 | I'm writing test visualization program based on test results.
I want to run jupyter notebook via terminal and generate html page to show it to user without showing the editable scripts to user.
Can I do that? Or suggest the better way to show visualized test results. | 2016/04/27 | [
"https://Stackoverflow.com/questions/36901154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6019664/"
] | Yes you can and it's quite easy and a built in feature
```
jupyter nbconvert --to html notebook.ipynb
```
That will generate a *notebook.html* file. Output [can be customized](http://nbconvert.readthedocs.io/en/latest/customizing.html). Also check out the slideshow functionality (View>Cell-Toolbar>Slideshow) which c... | I developed jupyter-runner (<https://github.com/omar-masmoudi/jupyter-runner>) which is a simple wrapper around "jupyter nbconvert".
Several notebooks can be executed, with parameters, with parallel workers, input/output located in S3 and mail sending capabilities. |
4,757,469 | I'm using `Zend_Mail` and the following code to send my email messages.
```
$mail = new Zend_Mail('UTF-8');
$mail ->setBodyText($plainBody)
->setBodyHtml($htmlBody)
->setSubject($subject)
->setFrom(FROM_ADDR, FROM_NAME)
->addTo($email, $name )
->addHeader(MY_HEADER, serialize( array( 'foo' => 'bar' ) ) ... | 2011/01/21 | [
"https://Stackoverflow.com/questions/4757469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/474376/"
] | we finally ended up with the following solution (not exactly what Valentin suggested, but +1 for help!):
The `ServiceReferences.ClientConfig` contains both binding and endpoint configurations like this:
```
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="DefaultB... | I think there can be a number of ways one is to provide initparams to SL app from your web pages like
>
> param name="initParams"
> value="Https=true"
>
>
>
for https page
and false for html page. parse it
inside SL and set up security mode for
endpoint.
You can create/edit endpoint proxy programmatically i... |
49,694,326 | I have this piece of code:
```
var dashboardPanel1 = Ext.create('Ext.Panel', {
renderTo: Ext.getBody(),
collapsible: true,
margin: '0 0 50 0',
layout: {
type: 'hbox',
align: 'stretch'
},
defaults: {
// applied to each contained panel
bodyStyle: 'padding:20px',
... | 2018/04/06 | [
"https://Stackoverflow.com/questions/49694326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4195212/"
] | You can always nest boxes. Depending on your requirements, either use vboxes inside a hbox:

or even hboxes inside a vbox inside a hbox:

Or maybe you can use a table layout and add a width to the [`tableAttrs`](http://docs.sencha.com/extjs/6.2... | I haven't verified this, its not a great answer either. It assumes this layout is static and not changing which I don't think is what you are looking for. But for fun here is an example I came up with that should emulate what your looking for.
```js
var dashboardPanel1 = Ext.create('Ext.Panel', {
renderTo: Ext.... |
57,952,706 | Has someone an idea how to solve the following problem?
Take the numbers 1,...,100000 and permute them in some way. At first you can make a swap of two numbers. Then you have to compute how many rounds it would take to collect numbers in ascending order. You have to collect numbers by every round by going left to righ... | 2019/09/16 | [
"https://Stackoverflow.com/questions/57952706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479273/"
] | It's easy, have a function to fetch Prometheus counter value
```
import (
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/log"
)
func GetCounterValue(metric *prometheus.CounterVec) float64 {
var m = &dto.Metric{}
if err :=... | It is possible to read the value of a counter (or any metric) in the official Golang implementation. I'm not sure when it was added.
This works for me for a simple metric with no vector:
```
func getMetricValue(col prometheus.Collector) float64 {
c := make(chan prometheus.Metric, 1) // 1 for metric with no vector... |
35,617,499 | how to use java script validation in after using the clone function in a form
how can do separate validation in each row in java script i used in clone for add more function but i can't do validation for every row.how is this ?
help me
```js
var i = 0;
function cloneRow() {
var row = document.getElementById(... | 2016/02/25 | [
"https://Stackoverflow.com/questions/35617499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5945137/"
] | After trying many ways I finally made it work.
First I removed all my previous installation by
* `sudo apt-get remove --purge wkhtmltopdf`
* `sudo apt-get autoremove`
Then I opened wkhtmltopdf.org and navigated into their Downloads > Archive. In Archive section I downloaded 0.12.1 .deb version by
* `wget <copy th... | I was facing same issue with wkhtmltopdf 0.12.4
installed new version of wkhtmltopdf 0.12.6-1
follow below commands to install wkhtmltopdf 0.12.6-1
```
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rp... |
4,411,880 | I am using Entity Framework and Linq to Entities with the MySQL ADO.Net connector to access a MySQL database.
There are two tables Requests and Submissions with a one to many relationship from Requests to Submissions. Accordingly, the Submissions table contains a RequestId column that is has a foreign key dependency o... | 2010/12/10 | [
"https://Stackoverflow.com/questions/4411880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/89593/"
] | You should be able to determine this yourself, by looking at the query plans generated for both queries in SSMS. Look specifically for any scans being done instead of seeks.
Then, you can analyze both queries in SQL Profiler to see which generates fewer overall reads, and consumes less CPU cycles. | The first approach potentially involves a sort (distinct) which suggests that the EXISTS alternative will perform better when the nr of submissions for each request is large.
What does the wall clock tell you? |
1,821,142 | An example from my textbook says the following:
Five persons entered the lift cabin on the ground floor of an 8 floor house. Suppose each of them can leave the cabin independently at any floor beginning with the first. Find the total number of ways in which each of the five persons can leave the cabin at any one of th... | 2016/06/10 | [
"https://math.stackexchange.com/questions/1821142",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342628/"
] | ### Wrong Solution:
The problem (as you guessed) lies within the following statement:
>
> I would assume that since there's 5 people and 7 floors.. it would be
> the same as 7 questions with 5 choices
>
>
>
One issue with this statement is that "7 questions with 5 choices" implies only one of those choices can ... | The answer is definitely $7^5$.
Numbering your people arbitrarily, the first person can choose any of 7 floors to exit, as can the 2nd, as can the 3rd and so on.
$7\times7\times7\times7\times7=7^5$ |
175,309 | I have a table with a sequence of data.
This data is used in a graph.
There are holes in this data that I want to fill in with smoothed out numbers.
Take this table for example:

In the example above, there are 3 gaps between 93 and 68 which I want to fill ... | 2010/08/12 | [
"https://superuser.com/questions/175309",
"https://superuser.com",
"https://superuser.com/users/11045/"
] | With this VBA sub you can select the cells you want to interpolate, then activate the macro. I used a button, but you'll probably want to workup a shortcut key combo.
```
Private Sub InterpolateGap()
Dim Gap As Range
Dim GapRows As Integer, i As Integer, Increment As Integer
Set Gap = Selection
If Not Gap Is Nothing... | It's going to be hard to do when you don't have a steady upward or downward climb.
My best advice is simply highlighting the numbers you have and then clicking on the box in the bottom right hand corner of the highlighted area, and dragging in down to let Excel do its best job at guessing.
 to left and right. | 2009/03/26 | [
"https://Stackoverflow.com/questions/687893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75654/"
] | Using CSS...
```
body {
margin:0 auto;
width:600px;
}
``` | The width advice given by others is the key. From the usability standpoint, you definitely want to ensure that you don't have multiple columns Newspaper-style - people are just not used to reading web pages in this way. It's OK for unrelated content though. |
43,752,262 | I am trying to deploy add a custom script extension to an Azure VM using an ARM template, and I want to have it download files from a storage account using a SAS token.
Here is the template (simplified):
```
{
"name": "CustomScriptExtension"
"type": "Microsoft.Compute/virtualMachines/extensions",
"locatio... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43752262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1806514/"
] | I figured it out, this must be a bug in the custom script extension which causes it to not support storage account level SAS tokens. If I add `&sr=b` on the the end of the SAS token (which isn't part of the storage account level SAS token spec) it starts working.
I found this info here:
<https://azureoperations.wordpr... | Currently, there is support for SAS token in VM Extension |
214,119 | After spending over one year working on a social network project for me using [WordPress](http://en.wikipedia.org/wiki/WordPress) and [BuddyPress](http://en.wikipedia.org/wiki/BuddyPress), my programmer has disappeared, even though he got paid every single week, for the whole period. Yes, he's not dead as I used an ema... | 2013/10/11 | [
"https://softwareengineering.stackexchange.com/questions/214119",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/104611/"
] | This is a strange situation, and I'm quite sure you're not telling the whole story. I worked with many people, some of who left for various reasons (me being their colleague), but don't try to tell us that everything was super good and one day just no contact.
But that's not problem. At least not anymore; you should l... | So, your only programmer was [hit by a bus](https://workplace.stackexchange.com/questions/9128/how-can-i-prepare-for-getting-hit-by-a-bus), and you need replacement now.
You could try to sue your former programmer, based on yout contract, or find out what's wrong with him. Assuming that he won't come back, this won't ... |
4,586,894 | Stumbled on some old code that is throwing and empty catching some cast exceptions (about 20 per trip :( )
What if any is the performance hit were taking due to this? Should I be worried about this or is the overhead simply in the try / catch
Surprisingly lacking information on the topic of exception performance with... | 2011/01/03 | [
"https://Stackoverflow.com/questions/4586894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/443688/"
] | Exceptions are expensive, performance-wise. Last time I measured these, they were taking **about a full millisecond** to throw and catch each exception.
Avoid using exceptions as a flow control mechanism. | If you haven't encountered any performance problem and this is the only way you have to do that algorithm continue to use this method.
Maybe before trying to cast you could see with some `if` clauses if you could do the cast. |
25,678 | Medicare, Medicaid, and Social Security are called "incentives" programs by some Republicans. These plans were put in place to help those disadvantage and many all ready pay federal taxes.
Social Security was meant to be a sort of "retirement" plan if you will. People pay into it and once reach a certain age, you rec... | 2017/10/25 | [
"https://politics.stackexchange.com/questions/25678",
"https://politics.stackexchange.com",
"https://politics.stackexchange.com/users/9016/"
] | In addition to the answers above, I should point out that they do not "continuously" go after cuts in those programs. Social Security and Medicare are very dangerous thing to go after politically. That's why the cuts you mention aren't specified. They want to keep any cuts they do make on the low-low and many times in ... | I don't think that Republicans necessarily want to cut those programs. However, those programs are a mainstay of the Democrats (it's how they buy votes). So, the Republicans make threats to cut those programs so they can force the Democrats to concede other points in negotiation.
This is the same reason that the Democ... |
27,917,304 | how can i look, what i saved in the isloated storage untill now?
i try to make a app where user can save more lists. And choose after that which List he wants to have and Display that. | 2015/01/13 | [
"https://Stackoverflow.com/questions/27917304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4448320/"
] | There's a very handy tool for viewing the files currently in the isolated storage. Here's a [link](http://msdn.microsoft.com/en-us/library/windows/apps/hh286408(v=vs.105).aspx).
However, if you're planning on doing this at runtime, then I would suggest checking the following tutorial from MSDN, [here](http://msdn.micr... | Try this Application. This is very helpful as it integrates with your device and emulator and you get the Complete Storage Access of How Data is stored in stored in your Emulator or Device and is very flexible as you can Manipulate the storage Contents in Runtime.
[windows Phone Power Tools](http://wptools.codeplex.co... |
2,873,178 | An example of what I am talking about is indicating multiplication by writing
$$ab\equiv{a}\times{b},$$
in traditional real number algebra.
I was writing some notes involving matrix multiplication. Previously in these notes I had specified that placing two tensor symbols next to each other indicates a *direct product... | 2018/08/05 | [
"https://math.stackexchange.com/questions/2873178",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342834/"
] | In abstract algebra, when words are formed using letters from an alphabet, the operation of joining two words together with no symbol in-between is called **concatenation**.
Now I wouldn't recommend that in a case where the left and right sides are mathematical objects of a different nature. In that case, it seems tha... | The third term I have heard for this is *apposition*, as in "two symbols written in apposition".
(However, I concur with the other answers that *juxtaposition* is perfectly understandable.) |
32,999,868 | How do I select the strings in the randomImage.images array from my randomImage.imagePicker method?
```
(function() {
var randomImage = {
images : [
'http://placehold.it/100x100',
'http://placehold.it/200x200',
'http://placehold.it/300x300',
'ht... | 2015/10/07 | [
"https://Stackoverflow.com/questions/32999868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4338703/"
] | Or if you want to specify the index of the randomImage you want to get:
```
imagePicker : function (idx) {
return randomImage.images[idx];
}
```
`randomImage.imagePicker(1)` will return `http://placehold.it/200x200` | Provided you just want it to return a random image from the `images` array:
[DEMO](http://jsfiddle.net/ncpqe3zo/)
```
imagePicker : function () {
var index = Math.floor(Math.random() * randomImage.images.length);
return randomImage.images[index];
}
```
Returning just a specific image can be done using the index... |
9,105,511 | So is it just the shovel operator that modifies the original string? Why does this work, it looks like:
```
hi = original_string
```
is acting like some kind of a pointer? Can I get some insight as to when and how and why this behaves like this?
```
def test_the_shovel_operator_modifies_the_original_string
or... | 2012/02/02 | [
"https://Stackoverflow.com/questions/9105511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1109313/"
] | In ruby, everything is a reference. If you do `foo = bar`, now `foo` and `bar` are two names for the same object.
If, however, you do `foo = foo + bar` (or, equivalently, `foo += bar`), `foo` now refers to a new object: one that is the result of the computation `foo + bar`. | >
> is acting like some kind of a pointer
>
>
>
It's called *reference semantics*. As in Python, Ruby's variables refer to values, rather than containing them. This is normal for dynamically typed languages, as it's much easier to implement the "values have type, variables don't" logic when the variable is always ... |
19,092,598 | i am running queries on a table that has thousands of rows:
```
$sql="select * from call_history where extension_number = '0536*002' and flow = 'in' and DATE(initiated) = '".date("Y-m-d")."' ";
```
and its taking forever to return results.
The SQL itself is
```
select *
from call_history
where extension_nu... | 2013/09/30 | [
"https://Stackoverflow.com/questions/19092598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2710234/"
] | Here are some suggestions:
1) Replace `SELECT *` by the only fields you want.
2) Add indexing on the table fields you want as output.
3) Avoid running queries in loops. This causes multiple requests to SQL server.
4) Fetch all the data at once.
5) Apply `LIMIT` tag as and when required. Don't select all the record... | You should add index to your table. This way MySql will fetch faster. I have not tested but command should be like this:
```
ALTER TABLE `call_history ` ADD INDEX `callhistory` (`extension_number`,`flow`,`extension_number`,`DATE(initiated)`);
``` |
45,312,636 | I am posting a variable to a PHP process in an attempt to find a file in a directory.
The problem is the filename is much longer than what the user will submit. They will only submit a voyage number that looks like this:
```
222INE
```
Whereas the filename will look like this:
```
CMDU-YMUNICORN-222INE-23082016.tx... | 2017/07/25 | [
"https://Stackoverflow.com/questions/45312636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4262571/"
] | Ok, first, you must do a directory listing
```
<?php
if($_POST['voyage'] == true)
{
$voyage = $_POST['voyage']; //in this case is not important to escape
$files = scandir("backup"); // <-this is where the voyage will go ***HERE YOU USE DIR LISTING***
unset($files[0], $files[1]) // remove ".." and ".";
... | I'd use the scandir function to get a list of files in the backup directory and filter it down to the appropriate file.
```
$voyageFiles = array_filter( scandir( "backup" ),
function($var) use ($voyage) {
// expand this regexp as needed.
return preg_match("/$voyage/", $var );
}
)
$voya... |
66,741 | The first part of code is for me very unreadable. I tried to write in another way but I'm open to your suggestion!
```
return ViewData.ModelState.FirstOrDefault(x => x.Key.Equals(parameterName)).Value != null && ViewData.ModelState.FirstOrDefault(x => x.Key.Equals(parameterName)).Value.Errors.Any(x => !string.IsNullOr... | 2014/10/15 | [
"https://codereview.stackexchange.com/questions/66741",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/34992/"
] | Not only is this difficult to read, it's also *inefficient*.
Cache your duplicate LINQ lookup to save time and make it more readable.
As for using the ternary operator, that's up to you, but I prefer to use a full if statement when the line gets too long.
Additionally swap out "" for String.Empty, it shows your inte... | you should probably move it into a if-else statement:
```
if(modelState != null && modelState.Errors.Any(x => !string.IsNullOrEmpty(x.ErrorMessage)))
return "";
else
return " ";
```
This immediately say "this function returns a empty string or a string with a space depending on this condition". |
48,432,846 | I am searching for a way to read/write data from `Google Sheets` directly. Does anyone have an idea how to do that in **Xamarin.Forms**?
Keep in your mind access `Google sheets` from Windows Form working fine with me using `Install-Package Google.Apis.Sheets.v4` Package.
I Used the following link:
<https://develope... | 2018/01/24 | [
"https://Stackoverflow.com/questions/48432846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1253921/"
] | Reading & writing data on spread sheet is not an easy thing. I would suggest you go with `WebView` that might solve you issues. Here you might found some clue to do so
<https://www.twilio.com/blog/2017/03/google-spreadsheets-and-net-core.html>
& here on Google.Apis.Sheets.v4 API's are
<https://github.com/xamarin/go... | Despite the fact that it really isn't a good idea to use Google Sheets as your online database, there are many better alternatives, if you want to access it from a Xamarin Forms app you can do it using the Sheets API
[Sheets API documentation here](https://developers.google.com/sheets/api/) |
59,081,328 | Is there any RegEx expression - without using replace - to match against:
```
AB.D..G
ABCDEFG
```
and return in each case as a match
```
ABDG
ABCDEFG
``` | 2019/11/28 | [
"https://Stackoverflow.com/questions/59081328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10407510/"
] | You can try to use this pattern: `\w{1,}`
```js
var str1 = 'AB.D..G';
var str2 = 'ABCDEFG';
var pattern = /\w{1,}/g;
console.log(str1.match(pattern).join(''));
console.log(str2.match(pattern).join(''));
```
`\w` means: any alphabet character
`{1,}` means: one or more times
`g` means: repeat this method multipl... | You can split and join the string. |
61,863,826 | I'm on iOS 13.5 and using Xcode 11.4 to build on to it. I'm getting this error message:
[](https://i.stack.imgur.com/SrbVf.png)
The `KBlackberry` is my iPhone device name.
I tried restarting the device and reconnecting of course and various other th... | 2020/05/18 | [
"https://Stackoverflow.com/questions/61863826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1035899/"
] | Developers who are using Xcode 11.5 and trying to install their app in iOS 13.6 device will also see this message. It's a very confusing message.
All you need to do is **Download Device support files of iOS 13.6** from this link
[filsv/iPhoneOSDeviceSupport](https://github.com/filsv/iPhoneOSDeviceSupport)
* Close Xc... | If you are on iOS 13.5 and Xcode 11.5, removing the device and adding it again fixed it for me. |
164,629 | I am developing a asp.net website. When I used the CSS property "word-wrap", VIsual Studio 2010 is showing a warning: Validation (CSS 2.1) 'word-wrap' is not a known CSS property name.
When I tested the website, it is working fine. However, can there be any issue in using this property ignoring the warning? | 2012/09/12 | [
"https://softwareengineering.stackexchange.com/questions/164629",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/58676/"
] | You've also got to take into account some pretty smashing features offered by github that I've yet to see mentioned.
* github pages with github flavored markdown
* github mobile app
* github eclipse plugin
* github for mac
* [github jobs](http://jobs.github.com/)
* github for windows
* github ticketing/bug tracking sy... | To be honest, the most important thing of Git for myself when I see it:
1. Network Graph or Should I call the History(also commenting)
2. Branch and Pull Request
3. It's more powerful, really, I would say it's so feels like I have a secretary holding all my work, and I can told that sec to wrote down anything for me, t... |
10,271,985 | With Visual Studio 2010 (possibly 2008 as well) I am noticing behavior where Intellisense will suggest the fully qualified namespace for enums.
For example, I can write code like this:
```
element.HorizontalAlignment = HorizontalAlignment.Right;
element.VerticalAlignment = VerticalAlignment.Bottom;
```
But when I t... | 2012/04/22 | [
"https://Stackoverflow.com/questions/10271985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/852555/"
] | This indeed seems to be the same name for property & the type.
Here is the smallest reproducible example that mimics things (could be smaller but this reveals more)...
```
namespace Company.Project.SubProject.Area.Test.AndSomeMore
{
public class TestClass
{
public TestEnum MyEnum { get; set; }
... | I *suppose* you are working in WPF environment (I see element) and you have *somehow* the reference to `System.Windows.Forms` dll.
My deduction is based on fact that `HorizontalAlignment` can be found in both namespaces:
in [System.Windows.Forms.HorizontalAlignment](http://msdn.microsoft.com/en-us/library/system.wind... |
15,914,387 | I am trying to implement an accordion with jQuery, however I am having a problem. When I press the button it is supposed to `slideToggle` the info but instead it is just sliding in and out.
I don't know why it's behaving this way, I am learning and I will appreciate if someone could help me with this.
This is my Java... | 2013/04/09 | [
"https://Stackoverflow.com/questions/15914387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2130184/"
] | I think that you are looking for `process_vm_readv` and `process_vm_writev`.
>
> These system calls transfer data between the address space of the
> calling process ("the local process") and the process
> identified by pid ("the remote process"). The data moves directly
> between the address spaces of the two proc... | nope there is no reverse of vmsplice operation, there is a project going on now for putting DBUS in kernel you might want to take a look at it. I too have the same requirement and was investigating this whole vmsplice thing. |
44,454,668 | I'm doing a school project to read the temperature through the sensor mlx90615.
In my code an error appears:
Traceback (most recent call last):
File "/home/p/12345.py", line 21, in
Import i2c
Importerror: no module named 'i2c' | 2017/06/09 | [
"https://Stackoverflow.com/questions/44454668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8136255/"
] | Do you know that your entity references are actually `EntityReference` objects in this line:
```
entity[attribute.Key] = attribute.Value;
```
Perhaps they're `Entity` or `EntityDto` objects, in which case you'll get an `InvalidCastException`.
If you're not sure, and unable to debug, you could type check them and... | You cannot use `entity[attribute.Key] = attribute.Value;` for all datatypes.
Invoice & InvoiceDetail are possessing parent/child relationships, so Parent Invoice Id will be available as Entityreference (lookup) in Detail entity.
You have to check the datatype of each attribute & do the mapping inside foreach loop of ... |
32,765,762 | javascript newbie here, but I was wondering if it is possible to set a timeout after a user clicks a HTML Link, now I was wondering this because I am making a simple maths game, and it uses the alert method, which means that once a user clicks the link, the page in which the link is placed, is still visible in the back... | 2015/09/24 | [
"https://Stackoverflow.com/questions/32765762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5372909/"
] | For example, if you have a `<a id="foo" href="#"> </a>` in your HTML, once could do
```
document.getElementById("foo").onclick = function() {
setTimeout(function() {
// do stuff
}, 5000); // triggers the callback after 5s
};
``` | If I understand you correctly, you want to actually load a new page and *then* have the alert pop up, right?
Well, timeouts won't run once the user has left your page.
But there are at least two ways to do what you're asking:
1. Fake the page.
You can include everything that would be on the "next page" on the cur... |
73,297,069 | i'm trying to add a v-tooltip in a entire row in vuetify data table, i just want to add in a specific row of the array, when the item.confirmed is false then the line that has it will have a tooltip , i managed to do it but just with one value and not with a entire row. The tooltip message is in the array and the vueti... | 2022/08/09 | [
"https://Stackoverflow.com/questions/73297069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19729708/"
] | Here's a solution that's a little more terse. It can accommodate any number of breaks, and you can define additional break types if you want. I think the only assumption is that work always follows a break, but that could probably be adjusted if need be.
```
BEGIN
declare @temp table (emp varchar(10),t1 time, t2 time,... | So, let's do this with the following caveats:
1. Your table layout is precisely how you indicated at the top where you have four rows per person.
2. Each person has a pattern of WORK-BREAK-WORK-LUNCH-WORK-BREAK-WORK.
You can use a combination of CTE's with some UNIONed queries such as this. I changed a few column nam... |
133,756 | I know that as the DM I can make up whatever I want and put the heroes of Faerûn wherever I choose in the story. What I am looking for is answers that are in other modules (published adventures) that I do not own yet.
For example: I think Drizzt shows up in *Out of the Abyss*, so I can hint as to where he is during t... | 2018/10/16 | [
"https://rpg.stackexchange.com/questions/133756",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/39432/"
] | Well, let's see what we can find...
Timeline Background
===================
The *Tyranny of Dragons* storyline kicks off in 1489 DR. *Princes of the Apocalypse* happens in 1491 DR. The pre-plot of *Out of the Abyss* got kicked off around 1485/1486, but the module itself doesn't specify when it actually happens - Chri... | Our DM had Isteval show up as part of the council meeting not sure if that is written as part of the story or he added it. but he did nothing to help us in our fight. |
1,830,875 | I'm using Vim for a C++ project that I've started working on and I've been spending a lot of time lately browsing through the existing code to get a hang of it. To make the browsing easier, I've setup ctags and cscope in Vim to jump to definitions and find references.
However, I find that neither of them are intellige... | 2009/12/02 | [
"https://Stackoverflow.com/questions/1830875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222616/"
] | [SrcExpl](http://vim.sourceforge.net/scripts/script.php?script_id=2179) might be the plugin you needed. Try it. | Seems like this would be a good candidate <http://vim.wikia.com/wiki/C%2B%2B_code_completion>. I had some good luck with it doing similar things in Java. Not entirely sure it gets you everything you're trying to do though. |
40,587,940 | I have ha a WinForms app with some `textboxes`.
At the moment the app is simple and i only want to test how it will work.
It will get mutch more complex in the future.
What i tried to do create a rule to ignore empty `textboxes` or if empty use the value 0.
The code i have is this one:
```
decimal ata;
decimal... | 2016/11/14 | [
"https://Stackoverflow.com/questions/40587940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7115573/"
] | Use `decimal.TryParse(textBox1.Text, out j);` instead of `a1 = decimal.TryParse(textBox1.Text, out j);`. Your value is returned in `j` | You are trying to assign a **bool** value to a **decimal variable** that's why getting this error.
Decimal.TryParse() will return bool value, Please take a look [here](https://msdn.microsoft.com/en-us/library/9zbda557(v=vs.110).aspx) you can use this value to check parsing is successful or not.
You will get result in ... |
37,999,286 | I use Angular2 [Webpack Starter](https://github.com/AngularClass/angular2-webpack-starter) in [this newest version](https://github.com/AngularClass/angular2-webpack-starter/commit/a4019da853c286ecbbc3d67ad669bf92b4ccaf55) and in file ./src/app/app.routes.ts I add 'my-new-route' and i want to name it as: "my.route"
``... | 2016/06/23 | [
"https://Stackoverflow.com/questions/37999286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/860099/"
] | I would just use [ng2-translate](https://github.com/ocombe/ng2-translate) and create the link for each language in your JSON files. | RC.3 is most recent Angular2 version and the new router V3-alpha7 doesn't support names. Name was removed because it didn't work out with lazy loading of routes. |
42,453,375 | My module.ts,
```
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule,Router } from '@angular/router';
import { AppComponent } from './crud/app.component';
import { Profile } from './profile/profile';
import { Mainapp } from './demo.app';... | 2017/02/25 | [
"https://Stackoverflow.com/questions/42453375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7597629/"
] | you can call `activate` method from main `router-outlet` like this
```
<router-outlet (activate)="changeOfRoutes()"></router-outlet>
```
which will call every time when route will change.
Update -
========
Another way to achieve the same is to subscribe to the router events even you can filter them out on the bas... | You can call directive in Routes like below:
```
{ path: 'dashboard', component: DashboardComponent , canActivate: [AuthGuard] },
```
Your AuthGuard component is like below where you put your code:
**auth.guard.ts**
```
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapsho... |
1,304,286 | If I have a sample space of $A$ and I randomly select $a$ elements, mark them, put them back into the sample space, then randomly select $b$ elements and I want to know what the probability is that $a$ and $b$ have precisely $y$ elements that are the same, how might I go about this?
The way I'm currently thinking abou... | 2015/05/29 | [
"https://math.stackexchange.com/questions/1304286",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/134501/"
] | Let $x$ denote the total number of elements in $A$.
---
Calculate the number of ways to choose $b$ elements from $A$, such that:
* $y$ elements are marked
* $b-y$ elements are not marked
$$\binom{a}{y}\cdot\binom{x-a}{b-y}$$
---
Calculate the number of ways to choose **any** $b$ elements from $A$:
$$\binom{x}{b}... | Regretfully, I do not have enough reputation to comment on your question. :S
If I correctly understand and $A$ is finite, then the following can work.
After marking you have two classes, the marked which has $a$ elements and the non-marked which has $|A|-a$ elements. Denote by $\xi$ the number of elements which are m... |
722,252 | I have an interesting question, I have been doing some work with javascript and a database ID came out as "3494793310847464221", now this is being entered into javascript as a number yet it is using the number as a different value, both when output to an alert and when being passed to another javascript function.
Here... | 2009/04/06 | [
"https://Stackoverflow.com/questions/722252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In JavaScript, all numbers (even integral ones) are stored as IEEE-754 floating-point numbers. However, FPs have limited "precision" (see the [Wikipedia article](http://en.wikipedia.org/wiki/Floating_point) for more info), so your number isn't able to be represented exactly.
You will need to either store your number a... | Just guessing, but perhaps the number is stored as a floating type, and the difference might be because of some rounding error. If that is the case it might work correctly if you use another interpreter (browser, or whatever you are running it in) |
1,475,562 | I need to recursively traverse directories in C#. I'm doing something like [this](http://support.microsoft.com/kb/303974). But it throws exception when iterating through system folders. How to check it before exception is thrown? | 2009/09/25 | [
"https://Stackoverflow.com/questions/1475562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You would have to check the access rights, but I would urge to to catch the exceptions instead, that makes the code easier to understand and would also deal with other issues like when you want to parse directories remotely and network gets down...
If you make a GUI for a directory tree you could also add some nice Lo... | What type of exception are you getting?
If you are getting a SecurityException you should have a look at this example on [MSDN](http://msdn.microsoft.com/en-us/library/ett3th5b.aspx) |
33,074,176 | I have a C# WPF 4.51 app. As far as I can tell, you can not bind to a property belonging to an object that is the child of a WPF *WindowsFormsHost* control. (If I am wrong in this assumption please show me how to do it):
[Bind with WindowsFormsHost](https://stackoverflow.com/questions/10885211/bind-with-windowsformsho... | 2015/10/12 | [
"https://Stackoverflow.com/questions/33074176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2561452/"
] | A simple approach here is you can create some dedicated class to contain just attached properties mapping to the properties from your winforms control. In this case I just choose `Text` as the example. With this approach, you can still set Binding normally but the attached properties will be used on the `WindowsFormsHo... | You can only achieve a very, very limited binding with a Windows Forms control as they binding won't receive update notifications and may need to be explicitly polled to get the results via a custom `RefreshValues()` method or something that polls each piece of data.
But if all you need is to access the child control,... |
74,174,630 | In Node, how can I convert a time zone (e.g. `Europe/Stockholm`) to a UTC offset (e.g. `+1` or `+2`), given a specific point in time? [`Temporal`](https://tc39.es/proposal-temporal/docs/index.html#Temporal-TimeZone) seems to be solving this in the future, but until then? Is this possible natively, or do I need somethin... | 2022/10/23 | [
"https://Stackoverflow.com/questions/74174630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/849076/"
] | I don't know your specific use case, but in general this should be the workflow:
1. Before you send date to the server, you send it in the ISO format (independent of the time zone). You can do it with native `new Date().toISOString()` method.
2. You save ISO date in the database.
3. Once it's returned to the client, y... | We can use [`Date.toLocaleString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString) to get the offset in hours and minutes using the [`ia`](https://en.wikipedia.org/wiki/Interlingua) language, this will result in a UTC offset in the format GMT+HMM, `GMT+5:30` for e... |
234,021 | The idea is to have a data structure that holds any number of objects of any type. Objects can be retrieved, or removed permanently, at random. Also, it can be cleared (or emptied).
This class just provides the ability to select a random object from a collection, with the option of removing it.
```
public class Sack
... | 2019/12/14 | [
"https://codereview.stackexchange.com/questions/234021",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/215010/"
] | * You don't use any method which is specific to `List<T>`. You should always code against interfaces if possible, meaning you should use `IList<T>` instead of `List<T>`.
* If `Retrieved` is called very often in a short time it is likely that you get the same `object` each time. This is because `Random` when [instantiat... | Testing your code
-----------------
To make your code testable, you should allow the code that uses this `Sack` to supply a custom random number generator.
In your unit test for the `Sack` class, you should create a custom `TestingRandom` class that derives from `Random` and overrides the `Next(int, int)` method. In ... |
481,382 | My problem is that I'm not able to install windows 7. Been trying to install this since past 1 week. The methods I've tried are:
1. I have a windows 7 bootable DVD which doesn't boot up. (I've set BIOS to boot from DVD ROM first but it just won't boot from the DVD).
Tried to install Windows 7 from the same DVD to a... | 2012/09/30 | [
"https://superuser.com/questions/481382",
"https://superuser.com",
"https://superuser.com/users/162215/"
] | Use a virtualization software (VMware, Virtualbox etc) and set up a dedicated guest system. Create a snapshot of the entire clean system before you start browsing, and restore this snapshot once you're done browsing. | IE supports creating a list of [restricted sites](http://windows.microsoft.com/en-MY/windows-vista/Change-Internet-Explorer-Security-settings).
>
> The level of security set for Restricted sites is applied to sites
> that might potentially damage your computer or your information.
> Adding sites to the Restricted zon... |
57,267,689 | I have a vertical navbar menu with 2 blocks.
First is nav with icons, second is text of menu.
They have a different background colors. How i can make one background color for two active nav blocks?
[design of menu](https://i.stack.imgur.com/rtTVH.png)
```html
<div class="menu__icons">
<ul class="menu__list">
<... | 2019/07/30 | [
"https://Stackoverflow.com/questions/57267689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9661289/"
] | Well basically if you want to toggle `.active` and you don't want two separate markup of list.
Notice that `font-awesome` is for demonstration purposes only.
```css
.menu__item {
width: 250px;
height: 50px;
text-align: left;
}
.menu__item.active {
background-color: #e9ebfd;
}
.menu__item.active .men... | Its doable using jQuery.
Assuming you have same number of list items in both blocks,
```
$(function(){
$('.menu__list li').on('click', function() {
var idx = $(this).index();
$('.menu__list li').removeClass('active');
$('.menu__list li:nth-child(' + idx + ')').addClass('active');
});
});
```
also add .active... |
38,732,388 | I am trying to upload a csv into MySQL using the Workbench, and so far all my attempts have proven fruitless.
I initially attempted to use the "Upload" function, but it complained about any null/empty fields I had.
I am now attempting to use this function:
```
LOAD DATA infile 'C:\\temp\\SubEq.csv'
INTO TABLE cas_as... | 2016/08/03 | [
"https://Stackoverflow.com/questions/38732388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3073006/"
] | Does your data in any of your fields in the csv file contain commas? This screws up the field termination criteria when you're trying to upload it into MySQL. If this is the case, try saving it as a tab delimited txt file and replacing
```
fields terminated BY ','
```
with
```
fields terminated BY '\t'
```
Sorry... | I had the same problem and comparing the columns in the CSV file and the table in my database resolved the issue. The number of columns, the column types, and in some cases empty values for string types (e.g., "" for string type) should be the same. |
57,600,957 | How would I go about debugging what's wrong with a string that I believe is in Base64 format, but which in VB using the below line of code
```
Dim theImage As Drawing.Image = imageUtils.Base64ToImage(teststring)
```
throws the following exception?
```
{"Base64ToImage(): The input is not a valid Base-64 string as it... | 2019/08/22 | [
"https://Stackoverflow.com/questions/57600957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11121286/"
] | You just need to map over one of the two arrays, and use the current index to retrieve the corresponding value in the other array. During each iteration, return the object you want to create:
```
cc.map((code, index) => ({ code: code, currency: ccy[index]}));
``` | ```
var cn =["AL","DZ","AS","AD","AO","AI","AG","AR","AM","AW","AU"];
var ccy = ["ALL","DZD","USD","EUR","AOA","XCD","XCD","ARS","AMD","AWG","AUD"];
var country = [];
for (let i = 0; i < cn.length; i++) {
country.push({ code: cn[i], currency: ccy[i] });
}
```
could do the work |
10,941,249 | I'm about to create a bunch of web apps from scratch. (See <http://50pop.com/code> for overview.) I'd like for them to be able to be accessed from many different clients: front-end websites, smartphone apps, backend webservices, etc. So I really want a JSON REST API for each one.
Also, I prefer working on the back-end... | 2012/06/07 | [
"https://Stackoverflow.com/questions/10941249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031790/"
] | Isomorphic rendering and progressive enhancement. Which is what I think you were headed for in option three.
**isomorphic rendering** means using the same template to generate markup server-side as you use in the client side code. Pick a templating language with good server-side and client-side implementations. Creat... | Building a JSON API in Rails is first class, The JSONAPI::Resources gem does the heavy lifting for a <http://jsonapi.org> spec'd API. |
120,462 | The idiom, *plonk (something/someone) down* means
>
> * to slap something down; to plop something down
> * to sit or lie down on something in a careless or noisy way
> * to leave someone somewhere to do this; *Dave plonked the kids in front of the TV and disappeared upstairs.*
> * to put something down heavily and w... | 2013/07/26 | [
"https://english.stackexchange.com/questions/120462",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/44619/"
] | *Plonker* used to be slang for condoms, and sometimes for penises.
There are several other possibilities, but the context makes this one seem more than plausible because it was heavily used in BBC sit-coms and they were fond of using substitute swearwords that were obscure, which those senses of *plonker* had become. ... | There are some references on the web to plonk as the lowest ranking person in the Royal Air Force (RAF), which apparently is an Aircraftman 2nd class, sometimes referred to as an [AC plonk](http://en.wiktionary.org/wiki/Transwiki%3aRAF_Speak), and another for plonk as a [slang term for mud](http://www.englishforums.com... |
86,670 | I have to set up a few servers (4 right now, more in the future) behind a firewall. The data center would like to provide a single port with a block of IP addresses, and then I'll have the firewall forward the correct IP address to the correct server.
What are your recommendations for a reasonable firewall?
Some ad... | 2009/11/20 | [
"https://serverfault.com/questions/86670",
"https://serverfault.com",
"https://serverfault.com/users/38118/"
] | There is always the possibility of just using each computer's built-in firewall rather than a separate appliance.
If you are set on a firewall, the Netscreen line will probably do what you want -- even the entry-level SSG5 will do for "light" usage (up to 8K simultaneous connections), going up from there depending on ... | Given that any "appliance" in your price range is almost certainly going to be a 1RU server with some sort of firewall software in it *anyway*, what's wrong with just removing the middleman, installing a 1RU server, and going with what you know?
Edit (under duress): If your DC will charge you less for something that i... |
27,634,913 | I have a C# project that needs to refactor. Project uses WPF+MVVM Light toolkit. I found the `MainViewModel(...)` constructor that receives about 50 parameters (factories interfaces). I think not. Am I right? I'm interested, because I want to improve my OOP thinking. Thanks.
P.S. Sorry for my grammar. Check me if you ... | 2014/12/24 | [
"https://Stackoverflow.com/questions/27634913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4324624/"
] | [Clean Code: A Handbook of Agile Software Craftsmanship](https://rads.stackoverflow.com/amzn/click/com/0132350882), page 40, states that...
>
> The ideal number of arguments for a function is zero (niladic). Next comes one (monadic), followed closely by two (dyadic). Three arguments (triadic) should be avoided where ... | You might look into using a Dependency Injector like Unity. Register all your Service, Factory, and associated Classes you need with the Unity Container and then you only need a single parameter for your ViewModel constructor which is the Unity Container.
50 parameters for a constructor seems insane to me... |
26,914,819 | I have a webhook that currently fires on `push` to any branch. This triggers the webhook far too frequently. Ideally, the webhook would only fire when a pull request is **merged** into `master`. I don't see that as an option, though:

Is there a way ... | 2014/11/13 | [
"https://Stackoverflow.com/questions/26914819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/925897/"
] | So, you can't customize the conditions of the trigger, but as LeGec mentions you can customize your code to only trigger when the Pull Request is merged.
To do that, make sure your script responds to the [PullRequestEvent](https://developer.github.com/v3/activity/events/types/#pullrequestevent). The conditions to test... | I don't see any way to customize the conditions of the trigger.
I would suggest to rather write code on the receiving end to trigger your action only when you detect that the push fits your conditions, e.g :
* `payload.ref == "refs/head/master"`
* `payload.commits[0] matches the structure of a merged pull request` (<... |
38,770,014 | I want to get the record count of a query that has a variable in it's name.
```
<cfloop query="Getteam">
<cfquery name="GetJobs#teamstaffid#" datasource="#dataSource#" >
SELECT *
FROM Request, Hist_Req_Assign, Hist_Req_status
WHERE hist_req_assign.teamstaffid = '#teamstaffid#' AND
... | 2016/08/04 | [
"https://Stackoverflow.com/questions/38770014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6678503/"
] | I would probably do something along these lines:
```
<cfscript>
try {
sql = "select * from Request, Hist_Req_Assign, Hist_Req_status where hist_req_assign.requestid = request.requestid and hist_req_status.requestid = request.requestid and hist_req_status.statusid = '3'";
principalQuery = new query();
princ... | The cfquery tag returns some result variables in a structure. So, we use result attribute in the cfquery tag we can able to get some details of the query.
For example:
1. resultname.sql
2. resultname.recordcount
```
<cfloop query="Getteam">
<cfquery name="GetJobs#teamstaffid#" datasource="#dataSource#" result="r... |
59,653 | I wonder if the "*g*" in the -ing forms is pronounced. When I hear it it seems as if it's not pronounced sometimes or just slightly, though sometimes I've been told that I should pronounce "*g*" for example in "meeting" just to avoid saying *"mitten"*.
So how should I pronounce "-**ing**"?
Sometimes -ing is written i... | 2012/02/29 | [
"https://english.stackexchange.com/questions/59653",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/6733/"
] | Using an apostrophe in place of a "g" is an informal colloquiallism. It is usually found inside a quotation, suggesting the speaker did not use much care when enunciating. Specifically, it's used to indicate the verb was spoken such that the final "g" was omitted: "*We were walkin' to the store, not botherin' nobody, w... | Actually, in older stages of English, the -ing form was used only for the gerund, while the present participle had an "-end-" ending. The "-in'" ending in colloquial English, southern American English, and many British dialects is probably a leftover from this "-end-" inflection. |
256,674 | Intro
-----
The Tetris Guidelines specify what RNG is needed for the piece selection to be called a Tetris game, called the Random Generator.
Yes, that's the actual name (["Random Generator"](https://tetris.wiki/Random_Generator)).
In essence, it acts like a bag without replacement: You can draw pieces out of the bag,... | 2023/01/13 | [
"https://codegolf.stackexchange.com/questions/256674",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/77309/"
] | [JavaScript (Node.js)](https://nodejs.org), 62 bytes
====================================================
```javascript
f=_=>x.match(i=Math.random()*7|0)?f(x=x[6]?'':x):(x+=i,i);x=''
```
[Try it online!](https://tio.run/##BcFRDoIwDADQfy@y1unClwZm5QSewBjTDCYzQM1YTD@8@3zvzV/eQk6fclxlGGuN9KSruoVLmCDRjcvkMq@DLID786/BPoK... | [Jelly](https://github.com/DennisMitchell/jelly), (4) 5 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
=======================================================================================================================
```
7ẊṄ€ß
```
A full program that prints forever.
**[Try it online!](https:/... |
39,613,822 | I have a notebook cell containing JavaScript code, and I would like the code to select this particular cell. Unfortunately, the behavior of `get_selected_cell` depends on whether I execute the cell in place, or execute and select the cell below.
**Example:**
```
%%javascript
var cell = Jupyter.notebook.get_selected_c... | 2016/09/21 | [
"https://Stackoverflow.com/questions/39613822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5276797/"
] | Your Javascript will have a handle on the OutputArea applying the Javascript, but not one all the way to the cell (in general, output areas can be used without cells or notebooks). You can find the cell by identifying the parent `.cell` element, and then getting the cell corresponding to that element:
```
%%javascript... | If you are writing a jupyter lab widget, you can get the cell index by iterating the `widget` array. This is what jupyter lab internally does ([source](https://github.com/jupyterlab/jupyterlab/blob/5755ea86fef3fdbba10cd05b23703b9d60b53226/packages/notebook/src/widget.ts#L1803)).
```
const cellIndex = ArrayExt.findFirs... |
21,695,669 | I am trying to remove last element from
```
Map<String, List<String>> map = new HashMap<String, List<String>>();
```
My code is
```
StringTokenizer stheader = new StringTokenizer(value.toString(),",");
while (stheader.hasMoreTokens()){
String tmp = stheader.nextToken();
header.add(tmp);
System.out.pri... | 2014/02/11 | [
"https://Stackoverflow.com/questions/21695669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2028043/"
] | There is no order in `HashMap`, so, you can't remove the last item. Use `LinkedHashMap` to have the order of insertion. | `HashMap` doesn't arrange it's elements according to an index, but you can retrieve only the element according to it's `key`, so if you have to use a `HashMap` you have to add an incremental index to it's key, so when you put a new element that index incremented with one and put with the key in the `HashMap`, like this... |
38,523,391 | Why my program is giving garbage value in O/P after providing sufficient inputs?
I have given I/P as `10 & 40` & choose multiplication option as `3`.
My code is as follows:
```
int main()
{
int a,b,c,x;
printf("Enter a & b \n"); //printing
scanf("%d %d, &a,&b");
printf("1. add \n 2. sub \n 3. mult... | 2016/07/22 | [
"https://Stackoverflow.com/questions/38523391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6624428/"
] | EDIT:
I found the real problem behind.
Firebase had update. User need to update the firebase version via cocopod.
After update the cocopod, can use everything normally same as firebase Doc.
==========================================
I have the same problem, but cannot fix it by updating the pod-file.
Finally, I find... | In your Podfile, add pod
```
pod 'Firebase/Database'
```
Then import Firebase Database in your ViewController
```
import FirebaseDatabase
```
Create a globle `var ref` that you can use it anywhere in viewcontroller
```
var ref: DatabaseReference!
```
Now, In `viewDidLoad` Define the `ref`
```
ref = Database.d... |
52,686,378 | >
> The lambda calculus has the following expressions:
>
>
>
> ```
> e ::= Expressions
> x Variables
> (λx.e) Functions
> e e Function application
>
> ```
>
> From this base, we can define a number of additional constructs, such as Booleans and conditional statements:
... | 2018/10/07 | [
"https://Stackoverflow.com/questions/52686378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5662198/"
] | Having the definitions
```hs
true = (λx.(λy.x))
false = (λx.(λy.y))
if = (λcond.(λthen.(λelse.cond then else)))
```
defined, means that
```hs
true x y = x
false x y = y
if cond then else = cond then else
```
Thus, e.g.,
```hs
if true true false
-- if cond then else = cond then else
= ... | Another approach:
```
if false false true
{substituting name for definition}
-> (λcond.(λthen.(λelse.cond then else))) false false true
{beta reduction}
-> (λthen.(λelse.false then else)) false true
{beta reduction}
-> (λelse.false false else) true
{beta reduction}
-> false false true
{substituting n... |
163,800 | I'm running the latest version of OS X and Preview is hanging whenever I try to start it.
It attempts to open the documents which I previously had open, which is ~10 PDFs and ~3 PostScript files, and it seems to be permanently get stuck whilst "converting" those PostScript files (even though opening them was no issue ... | 2014/12/28 | [
"https://apple.stackexchange.com/questions/163800",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/106374/"
] | Do you want to disable the App re-open the documents when you launch the App?
So, you can go to "System Preferences" > "General" and enable the "close windows when quitting and app" option. | To amplify what Nelson said above, here are the full list of steps which worked for me on OSX 10.10.2:
Quit Preview if it’s running.
Hold down the option key and select Go ▹ Library from the Finder menu bar. From the Library folder, delete the following items, if they exist:
```
Containers/com.apple.Preview
... |
3,255 | Many approaches exist to define security requirements. To keep it simple, i would say to define a security requirement, one need to model the threat encountered when building up misuse cases for specific use cases being worked out. Still, at the end, some security requirements are at architectural level while others ar... | 2011/04/21 | [
"https://security.stackexchange.com/questions/3255",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/74/"
] | I'd say - "yes, they need to be testable" and also "if you have an untestable requirement, you need to rewrite". But I work for DoD contracts, and my gut reaction is as much about a Pavlovian reflex to being beaten up by untestable requirements as it is based in any rational thought.
I've often seen high level require... | Security is a quality attribute rather than a functional attribute, and so you can't generally test for it.
What you can test for, or at least should be able to, is the presence of a control that was specified (and if the control involves code, you can test its functionality).
For example let's say that your control ... |
17,247,306 | I have an array as follows:
```
@array = ('a:b','c:d','e:f:g','h:j');
```
How can I convert this into the following using grep and map?
```
%hash={a=>1,b=>1,c=>1,d=>1,e=>1,f=>1,h=>1,j=>1};
```
I've tried:
```
@arr;
foreach(@array){
@a = split ':' , $_;
push @arr,@a;
}
%hash = map {$_=>1} @arr;
... | 2013/06/22 | [
"https://Stackoverflow.com/questions/17247306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1770135/"
] | Its very easy:
```
%hash = map {$_=>1} grep { defined $_ } map { (split /:/, $_)[0..1] } @array;
```
So, you **split** each array element with ":" delimiter, getting bigger array, take only 2 first values; then grep defined values and pass it to other **map** makng key-value pairs. | This filters out `g` key
```
my %hash = map { map { $_ => 1; } (split /:/)[0,1]; } @array;
``` |
30,072 | A number of different web-sites document this mysterious storey of an apparent traveller from an alternate history:
>
> It’s July 1954; a hot day. A man arrives at Tokyo airport in Japan. He’s of Caucasian appearance and conventional-looking. But the officials are suspicious.On checking his passport, they see that he... | 2015/09/16 | [
"https://skeptics.stackexchange.com/questions/30072",
"https://skeptics.stackexchange.com",
"https://skeptics.stackexchange.com/users/22188/"
] | This mystery was resolved by a Brazilian YouTuber, Natanael Antonioli, in [July 2019](https://www.reddit.com/r/japan/comments/cdz9kg/hi_im_an_investigative_journalist_doing_some/). Further missing pieces were added by a [Fortean researcher in March 2020](https://forums.forteana.org/index.php?threads/the-man-from-taured... | So far, it seems to just be an internet story that's been passed along by word of mouth. [There are no newspaper articles referencing it](https://www.reddit.com/r/UnresolvedMysteries/comments/1zsyz2/on_july_1954_a_man_arrives_at_tokyo_airport_in/) (outside of "Weird News" articles who are just passing on the internet s... |
37,811,034 | I have an HTML `<table>` with many columns, so when my web page is displayed on a mobile browser, it's too small. So I'm creating a media query and I want to remove some columns (That are not important).
So how to remove an html column using only css ?
For example, how to remove the column "B" in the middle of the ta... | 2016/06/14 | [
"https://Stackoverflow.com/questions/37811034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5456540/"
] | You can use n-th child to manage table columns.
```
th:nth-child(2) { display:none; }
``` | If you must use html tables I would recommend using stacktable.js. Otherwise use css display tables. |
66,001,148 | I am trying to grab the data from, <https://www.espn.com/nhl/standings>
When I try to grab it, it is putting Florida Panthers one row to high and messing up the data. All the team names need to be shifted down a row. I have tried to mutate the data and tried,
```
dataset_one = dataset_one.shift(1)
```
and then join... | 2021/02/01 | [
"https://Stackoverflow.com/questions/66001148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13527775/"
] | Providing an alternative approach to @Noah's answer. You can first add an extra row, `shift` the df down by a row and then assign the header col as index 0 value.
```
import pandas as pd
page = pd.read_html('https://www.espn.com/nhl/standings')
dataset_one = page[0] # Team Names
dataset_two = page[1] # Stats
# Shi... | Just create the df slightly differently so it knows what is the proper header
```
dataset_one = pd.DataFrame(page[0], columns=["Team Name"])
```
Then when you `join` it should be aligned properly.
Another alternative is to do the following:
```
dataset_one = page[0].to_frame(name='Team Name')
``` |
17,134,638 | If I use `get` with `defineProperty`
```
Object.defineProperty(Object.prototype,'parent',{
get:function(){return this.parentNode}
});
```
and I can call it like: `document.body.parent`, then it works.
When I use `value` with `defineProperty`
```
Object.defineProperty(Object.prototype,'parent',{
value:funct... | 2013/06/16 | [
"https://Stackoverflow.com/questions/17134638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1714907/"
] | The simplest way I see to do that is to use a foreach:
```
$myStdClass = /* ... */;
$a = '';
foreach ($myStdClass as $key => $value) {
if ($value) {
$a .= $key;
}
}
``` | One-liner solution:
```
$c = new stdClass();
$c->all = 0;
$c->book = 0;
$c->title = 1;
$c->author = 1;
$c->content = 0;
$c->source = 0;
$a = implode(',', array_keys( array_filter( (array)$c) ) );
var_dump($a);
```
Would yield
```
string(12) "title,author"
``` |
4,865,300 | I'm looking for a way to maintain the sorting on my key-value pairs. They are sorted by variables outside of the actual key-value pairs (for better UI). I am currently using a **Hashtable**, but that does not maintain the sorting =(
```
Hashtable<Integer, String> subscriptions = getUsersSubscriptions(user);
```
Is t... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4865300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365985/"
] | ```
SortedMap<Integer, String> myMap = new TreeMap<Integer,String>();
```
If you have a custom sorting, pass a [`Comparator`](http://download.oracle.com/javase/6/docs/api/java/util/Comparator.html) instance to the constructor of the [`TreeMap`](http://download.oracle.com/javase/6/docs/api/java/util/TreeMap.html). But... | >
> Is there some simple way that Java lets one store pairs?
>
>
>
Create a custom class that stores the two properties.
>
> They are sorted by variables outside of the actual key-value pairs
>
>
>
Add a third property for the sort data.
Then your class can implement Comparable to sort the data as require... |
87,884 | I am studying various ATX power supplies schematics and don't understand the need of the voltage selector as switching power supplies work at range of voltages. In most schematics i see the 110V line connected after the bridge rectifier between the resistors and filtering capacitors. Why?
 schematic in order to get the same 310V DC after the rectifier.
These solutions are pretty outdated now. The typical modern PSU is universal and can work from 90..250VAC on the input witho... | "Switching power supplies work at range of voltages." They work at a range of voltages they are designed to work at. The larger the range you want to support, the more it will cost in the design (in $, size, reliability, etc). It's one thing to make an 80W laptop supply work across 100-240V, but it's quite another to d... |
35,410,867 | I'm trying to combine the Datepicker and Timepicker directives to get the date from the first and the time from the second in a combined Date object. I came across some examples that are not using these directives like this one [Combining Date and Time input strings as a Date object](https://stackoverflow.com/questions... | 2016/02/15 | [
"https://Stackoverflow.com/questions/35410867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5390799/"
] | Internally it is really correct:
```
private static IEnumerable<TSource> SkipIterator<TSource>(IEnumerable<TSource> source, int count)
{
using (IEnumerator<TSource> enumerator = source.GetEnumerator())
{
while (count > 0 && enumerator.MoveNext())
--count;
if (count <= 0)
{
while (enumerator... | Depends on your implementation, but it would make sense to use indexed arrays for the purpose, instead. |
72,283 | I might be wrong but I think it must be 2^6 = 64 integers? | 2017/03/31 | [
"https://cs.stackexchange.com/questions/72283",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/68752/"
] | Here is a more streamlined version of your proof.
Notice first that
$$
A \cup B = (A \setminus B) \cup (B \setminus A) \cup (A \cap B), \\
A = (A \setminus B) \cup (A \cap B), \\
B = (B \setminus A) \cup (A \cap B).
$$
All these decompositions are into disjoint sets, and so
$$
|A \cup B| = |A \setminus B| + |B \setmin... | A similar, shorter, proof relies on the *inclusion/exclusion principle*, namely if $A$ and $B$ are finite sets, then
$$
|A\cup B| = |A| + |B| - |A\cap B|
$$
(If you're not familiar with this identity, look at a small Venn diagram.) So we can conclude
$$
|A\cup B| = |A| + |B| - |A\cap B| \le |A| + |B|
$$ |
41,268 | we have a requirement where we need to search metadata within Salesforce for some specifc keywords? and also replace them.
As an outside tool we can use Eclipse, but how it can be done within Salesforce? | 2014/06/23 | [
"https://salesforce.stackexchange.com/questions/41268",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/4690/"
] | I would take a look at the [Metadata Wrapper](https://github.com/financialforcedev/apex-mdapi) [Andrew Fawcett](https://salesforce.stackexchange.com/users/286/andrew-fawcett) has written - in the git hub repo linked to above, he shows how you can build a MetaData browser...so I would think you can develop that to provi... | You can access metadata for all the components in salesforce ONLY using Metadata API and for that you can use tools like Force.com IDE/ANT to download or retrieve entire metadata components which are available in eclipse and do a search for the component/variable/keyword name to see where it is referenced. |
230,532 | On the one hand, you lose "to" your rival. On the other hand, a defeat is done or comes "from" them (there are [some](https://www.google.ru/search?q=%22defeat%20from%22%20-%22jaws%20of%20victory%22&newwindow=1&tbm=nws&sxsrf=ACYBGNQnJswneyt4xFRkEGiVAmQQciXbQw:1574282402868&ei=oqTVXbjQNM2QrgSgxKTIAQ&start=0&sa=N&ved=0ahU... | 2019/11/20 | [
"https://ell.stackexchange.com/questions/230532",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/101901/"
] | **the dead** (when used as a noun) is what is known as an *uncountable noun*. It is similar to many other words which describe something made up of a varying number of other things, or where divisions are hard to define, such as "rice", or "music".
For these words, singular vs. plural does not actually make any sense ... | Certain groups of people are referred to using 'the' followed by an adjective, when the group members share a condition denoted by the adjective. The young, the old, the newborn, the dead, the brave, the rich, the poor (etc).
>
> Adjectives are often used without nouns.
>
>
> To refer to some well-known groups of ... |
22,741,824 | I am using the following codes to add two button to self.navigationItem.rightBarButtonItems, and I think in iOS7, the space between two buttons are too wide, is there a way to decrease the space between these two buttons?
```
UIBarButtonItem *saveStyleButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed... | 2014/03/30 | [
"https://Stackoverflow.com/questions/22741824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1722027/"
] | My solution is using a custom view for right bar buttons.
Create a horizontal stackview with equal spacing and add any number of buttons as subview.
Sample code:
```
func addRightBarButtonItems()
{
let btnSearch = UIButton.init(type: .custom)
btnSearch.setImage(UIImage(systemName: "magnifyingglass"), for: .no... | **Swift 5**
If you want to add space between two Bar Button items then add a flexible space in between, the two buttons will be pushed to the left and right edge as the flexible space expands to take up most of the toolbar.
For Example:
```
let toolBar = UIToolbar()
var items = [UIBarButtonItem]()
let backBarButt... |
48,650,191 | I will keep this question short. Similar questions on S/O do not address what I am wondering about, and I have struggled to find an answer.
When I point to a CBV in my urls.py, I use the as\_view class method:
>
> ...MyView.as\_view()...
>
>
>
Looking at the actual script (django/django/views/generic/base.py), ... | 2018/02/06 | [
"https://Stackoverflow.com/questions/48650191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9121609/"
] | "view" is the function name name.
In this case we have defined the function within another function - as\_view(). Think of the name "view" as a variable pointing to code rather than data.
```
view
```
is the function - we have defined it (within the as\_view() function). It already knows what arguments to expect ... | All functions in Python are first-class objects. You don`t have to call it before return, you can do whatever operations you like with functions without calling them, you can even set attrs for functions:
```
func.level = 5
```
The difference is just when you call function on return, function response would be retur... |
485,024 | When starting out with a new application, would you rather just use an existing dependency framework and risk the possible shortcomings, or would you opt to write your own which is completely adaptable and why? | 2009/01/27 | [
"https://Stackoverflow.com/questions/485024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31770/"
] | I would of course use one of the available solutions. Although it starts out simple, there are some features (like various proxying features) that are definitely not simple in full featured DI frameworks. Maybe you want some AOP too ?
But any decent DI framework should have little impact on the way you write your actu... | You can write a wrapper around the dependency injection bits so if you want to switch DI frameworks later, you don't need to worry about library dependencies or changing code anywhere. For example, instead of directly calling container.Resolve, write a factory class that calls container.Resolve for you, and only call i... |
24,738,169 | I need the current system datetime in the format "yyyy-mm-dd:hh:mm:ss".
<https://stackoverflow.com/a/19079030/2663388> helped a lot.
`new Date().toJSON()` is showing "2014-07-14T13:41:23.521Z"
Can someone help me to extract "yyyy-mm-dd:hh:mm:ss" from "2014-07-14T13:41:23.521Z"? | 2014/07/14 | [
"https://Stackoverflow.com/questions/24738169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2663388/"
] | Seems that there is no good way to do it with original code unless using Regex. There are some modules such as [Moment.js](http://momentjs.com/) though.
If you are using npm:
```
npm install moment --save
```
Then in your code:
```
var moment = require('moment');
moment().format('yyyy-mm-dd:hh:mm:ss');
```
That ... | What about:
```
new Date().toString().replace(/T/, ':').replace(/\.\w*/, '');
```
Returns for me:
```
2014-07-14:13:41:23
```
But the more safe way is using `Date` class methods which works in javascript (browser) and node.js:
```
var date = new Date();
function getDateStringCustom(oDate) {
var sDate;
... |
12,197,546 | I am newbie to mongodb (java).
I need to execute list of commands(queries in relational) by using something similar to procedures in relational db.
Is it possible in mongodb? | 2012/08/30 | [
"https://Stackoverflow.com/questions/12197546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1386792/"
] | MongoDB has no real sense of stored procedures. It has server side functions however these functions:
* Do not work with sharding
* Are slow
* Must be evaled (Dr. Evil)
* Are only really designed to be used within Map Reduces to stop you from having to house mutiple copies of common code within many places.
However y... | You can create server-side javascript functions, yes. But I advise against it, because it's will be
1. quite slow;
2. not version controlled.
Read more: <http://www.mongodb.org/display/DOCS/Server-side+Code+Execution#Server-sideCodeExecution-Storingfunctionsserverside> |
44,565,460 | I want to pass a string variable from servlet to jsp and store it's value in another variable in jsp.
Here is servlet:
```
request.setAttribute("rep", docbase);
request.getRequestDispatcher("Welcome.jsp").forward(request, response);
```
Here is my jsp:
```
</script>
<script type="text/ajavscript">
... | 2017/06/15 | [
"https://Stackoverflow.com/questions/44565460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6876654/"
] | To answer your question.
The problem with your insertion2 function is that the root variable will point to nullptr(NULL) at the called place and a new memory is allocated and pointed to a local reference inside insertion2() function. The reference change to a new memory location will not have any impact on the referen... | The Root pointer from the calling method needs to be updated as well. So, you'll have to call the Insert2 method using something similar: **Insert2(&BSTNodePtr, a)**. When you pass the address of the variable BSTNodePtr, the Insert2 method can update it's content.
Try this instead:
```
void Insert2(BSTNode **root, i... |
436,302 | So this is something that has been at the back of my mind for a while. I've seen mentions of it, I've read the [fitness web page](http://fitnesse.org/FitNesse.TwoMinuteExample) and I still don't quite grok it. It seems like Fitnesse is yet another testing framework like NUnit or MbUnit or any of the others because you ... | 2009/01/12 | [
"https://Stackoverflow.com/questions/436302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | The difference between NUnit/MbUnit and FitNesse is that NUnit/MbUnit are intended to be used for unit tests, while FitNesse is for acceptance tests.
Unit tests test a single, small unit of code, such as a method, to ensure that it executes as the programmer intended. For example, you might use a unit test to ensure t... | `FitNesse` is basically a `wiki` which stores all the test cases. Most probably for acceptance testing. In Test first development the test cases should be written at requirement gathering stage only i.e., the customer will also be included in writing tests which tends to write the tests regarding acceptance testing...
... |
41,570,513 | I would like to replace all non capitalised words in a text with "-".length of the word.
For instance I have the following Text (German):
>
> Florian Homm wuchs als Sohn des mittelständischen Handwerksunternehmers Joachim Homm und seiner Frau Maria-Barbara „Uschi“ Homm im hessischen Bad Homburg vor der Höhe auf. Sei... | 2017/01/10 | [
"https://Stackoverflow.com/questions/41570513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6743057/"
] | Try something like this
```
s.split.map { |word| ('A'..'Z').include?(word[0]) ? word : '-' * word.length }.join(' ')
``` | ```
r = /
(?<![[:alpha:]]) # do not match a letter (negative lookbehind)
[[:lower:]] # match a lowercase letter
[[:alpha:]]* # match zero or more letters
/x # free-spacing regex definition mode
str = "Frau Maria-Barbara „Uschi“ Homm im hessischen Bad Homburg vor der Höhe au... |
20,295,075 | ```
Insert into employee (newsalary)
values
('21840'), ('15600'), ('26000'),
('28847'), ('26000'), ('28600'),
('32500'), ('39000'), ('32500'),
('13026'), ('39000'), ('13026')
```
I have oldsalary with 30% increase, so i have to add new column with new salary values in new column name (newsalary) without changing... | 2013/11/30 | [
"https://Stackoverflow.com/questions/20295075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3050973/"
] | The character ” (U+201D RIGHT DOUBLE QUOTATION MARK) is very different from the character " (U+0022 QUOTATION MARK). The latter is defined to act as attribute value delimiter in HTML; the former has no special significance in HTML, it is just yet another data character.
Thus, the attribute value specified is `”red”`´,... | If the color value isn't equal to the keywords such as "red","blue" and so on,The browser assumes that value is three **hex values**, each 2 chars long just as John Hornsby said.
All the invalid chars be made 0.
IF the color value length less then 6 ,the zero will be appended in the end. |
872,442 | In [Code Complete 2](https://rads.stackoverflow.com/amzn/click/com/0735619670) (page 601 and 602) there is a table of "Cost of Common Operations".
The baseline operation integer assignment is given a value 1 and then the relative time for common operations is listed for Java and C++. For example:
```
... | 2009/05/16 | [
"https://Stackoverflow.com/questions/872442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31765/"
] | I implemented some of the tests from the book. Some raw data from my computer:
Test Run #1:
TestIntegerAssignment 00:00:00.6680000
TestCallRoutineWithNoParameters 00:00:00.9780000
TestCallRoutineWithOneParameter 00:00:00.6580000
TestCallRoutineWithTwoParameters 00:00:00.9650000
TestIntegerAddition 00:... | Straight from the source, **[Know what things cost](http://msdn.microsoft.com/en-us/library/ms973852.aspx)**.
IIRC Rico Mariani had relative measures as the ones you asked for [on his blog](http://blogs.msdn.com/ricom/default.aspx), I can't find it anymore, though (I know it's in one of thoe twohudnred "dev" bookmarks... |
56,937,577 | I'm actually having some troubles optimising my algorithm:
----------------------------------------------------------
I have a disk (centered in 0, with radius 1) filled with triangles (not necessarily of same area/length). There could be a HUGE amount of triangle (let's say from `1k` to **`300k`** triangles)
My goal... | 2019/07/08 | [
"https://Stackoverflow.com/questions/56937577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11755027/"
] | All long-bearded **HPC-professionals**, kindly do permit a bit scholastically elaborated approach here, which may ( in my honest opinion ) become interesting, if not enjoyed by, for our Community Members, that feel themselves a bit more junior than you professionally feel yourselves and who may get interested in a bit ... | I think you could make an array with boundaries for each triangle: top, bottom, right and left extremes. Then, compare your point to these boundaries. If it falls within one, THEN see if it really is within the triangle. That way, the 99.9% case doesn't involve a double floating-point multiply and a number of additions... |
15,315,300 | I have a `<div>` with an image as a background. I have it so that whenever someone hovers over the `<div>`, the background image changes to some other image. The problem is, the first time when your mouse hovers over the `<div>`, the background image flickers as it loads and you see no image for few milliseconds.
How ... | 2013/03/09 | [
"https://Stackoverflow.com/questions/15315300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1972768/"
] | Within a window.load() function,
* make sure all the images are loaded onto the page.
FYI - You probably want to set each image's CSS position to absolute, with a Top:0px and Left:0px, all within a parent div that has a position:relative, with a certain width and height.
* set display:none to the ones that should'... | You can place an image tag somewhere in your DOM referencing the image you want to preload and give it a style of `display:none; visibility: hidden;`. You could also try using a JavaScript preloading solution but it wouldn't be as reliable. |
72,926 | When running a traceroute, should I see any public IP addresses when tracing route from one MPLS point to another MPLS point? So when I do a traceroute from 10.0.0.1 to 10.0.1.1, I see some public IP address in between...
On some of the routers I see this, on others I don't, what does this mean? | 2009/10/09 | [
"https://serverfault.com/questions/72926",
"https://serverfault.com",
"https://serverfault.com/users/2561/"
] | That depend on your MPLS provider. so there are a patch for the traceroute program, that print the MPLS label using ICMP, if the LSR is configured to affich these labels ( but most of providers don't do).
You may test the [NANOG traceroute](ftp://ftp.login.com/pub/software/traceroute/) normalized in RFC 4950 | The IPs you see are probably the loopback (that is, "a virtual interface that is the first to become active and the last to disappear on a router, usually used for router ID and for management access") addresses of devices through the MPLS network.
I am actually a little bit surprised you see them from your router, th... |
64,072,259 | I've seen other post but I am trying to do this using some of the `<algorithm>` methods. I have a pointer to a map which contains a key to a vector of pointers to BaseElement classes like the following.
```
using ElementV = std::vector<std::shared_ptr<BaseElement>>;
using ElementM = std::map<int, ElementV>;
using SEle... | 2020/09/25 | [
"https://Stackoverflow.com/questions/64072259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1718761/"
] | You can get pairs of keys (first) and values (second) via iteraters of `std::map`, so inserting each vectors via [`std::for_each`](https://en.cppreference.com/w/cpp/algorithm/for_each) is one way.
```
ElementV allElems;
std::for_each(elements->begin(), elements->end(), [&allElems](const auto& p) {
allElems.insert... | You could try this:
```
ElementV allElems;
//assuming c++17 compiler
for(auto& [ind, elemVectorPtr]: *elements){ //iterate through index, element-vector pointer pair in elements map
//copy across all pointers in element-vector into allElems vector
std::copy(elemVectorPtr->begin(), elemVectorPtr->end(), std::... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.