INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
Jquery plugin to calculate correlation coefficient
Is there any jquery plugin to calculate correlation coefficient, standard deviation and covariance. Please refer me the link | If you really need only simple stuff like covariance, correl, ..., jsanalysis should do the trick. For more advanced features, jstat probably contains everything you need. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -1,
"tags": "jquery, distribution, correlation"
} |
Grab contents of a webpage in GWT
Let's say that I have a link to a webpage that contains some text. What's the easiest way to grab this text to process?
Thanks. | Long story short, I don't think it's possible to make a request from the client js to grab the text from a url with a different domain.
It is possible to make requests to load json. This link describes how.
Basically, the steps are:
* Embed a tag in the GWT page
* after GWT page is initialized, update the script tag's src to load remote url
* remote url returns some json data padded inside a callback javascript function such as: callback({blah:foo})
So, you're only option may be writing a method on the server side that loads the url, gets the text. You could then call this method from gwt client using normal rpc technique. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 0,
"tags": "gwt"
} |
Combining layers and changing fieldnames in Arcgis Pro ModelBuilder
I have layers containing polygons. The difference between the layers are the periods of the year about which the layers have information. So layer 1 is called Lawn_p1 and layer 2 is called Lawn_p2 (p stands for period) and so on. The layers contain the same fields. With model builder I want to combine all these layers into one shapefile and also add for every field p1 up to p10. This way for every polygon I can see all the information for every period in the same row.
As a first step I want to change the field names of each layer by adding the period to it: so for layer Lawn_p1 every field should get _p1 at the end. This should then be done for all the other layers as well. Then I should merge/join the layers.
Does anyone know how to do the first step with model builder for all the layers?
I guess I have to use iteration/for loops. | I don't think you can rename fields in shapefiles, which is a very old format. Import your layers into a file geodatabase then a simple model with FeatureClass iterator you can use AlterField tool to change the name of existing fields.
If the actual boundary of each polygon does not change in shape or size then you could use the JoinField tool to join fields into layer 1. | stackexchange-gis | {
"answer_score": 2,
"question_score": 0,
"tags": "shapefile, modelbuilder, arcgis pro, iteration"
} |
Why hasn't Russia maintained significant numbers of aircraft carriers?
The United States has 11 aircraft carriers in total. Russia has only one. This is reflective of the past, in which we saw that the USSR also didn't put much importance on constructing aircraft carriers and putting them into operation.
Why hasn't Russia bothered to keep a larger inventory of aircraft carriers? Why hasn't it wanted to project its power through carriers? Why has the United States wanted to project its power through carriers?
What is the main point of difference in these two strategies? | * First of all, aircraft carriers are **expensive**. Russia (compared to USA) was never resource-rich enough to be able to afford the expense; neither was USSR.
* Second of all, Russia (or rather USSR) had no motivation. USA's main geopolitical goal is to safeguard seabourne trade routes; and to prevent strong competitors from arising and commanding great sets of resources ala Japan's goal in WW2.
Contrast that with Russia/USSR, which is dependent economically on seabourne trade to an enormously smaller extent; and whose main geopolitical concerns are right there on a landmass - protecting core russia by building a periphery barrier and keeping the populace under control. A carrier is of pretty much no help in that goal.
(as discussed in the comments - while Russia has a lot of maritime border, they aren't important for most part. Nobody'll invade - or trade - through Arctic. And since WWII, Japan hasn't been a credible geopolitical threat on the Pacific coast). | stackexchange-history | {
"answer_score": 37,
"question_score": 27,
"tags": "united states, military, soviet union, russia, naval"
} |
Create Aurora read replica option is missing from RDS Console
I have PostgreSQL DB running on Version 10.15 for which I like to created an `Aurora Read Replica` as mentioned in this official document, however in the AWS console I only have the option of `Create Read Replica` only and not `Create Aurora Read Replica`. The option is completely missing.
If I choose to Create Read Replica, it then just create another PostgreSQL instance instead of Aurora PostGres, and that's is not what I want.
P.s: I have auto back-up enabled for that instance
. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "amazon web services, amazon rds, amazon aurora"
} |
IntelliJ: Is there a shortcut for "peeking declaration"?
public static final String XYZ = "something"; // line 1
return XYZ; // line 2
With cursor on `XYZ` on line 2, I know `Ctrl`+`B` will bring me to line 1, where `XYZ` is defined.
Is there a way to **temporarily peek** at its declaration? That is, with some particular keys hold down, it goes to line 1, but returns to line 2 when I release? | `View > Quick Definition` when the cursor is on `XYZ` will cause a popup to display with the definition of that constant. Then you can hit `ESC` to dismiss the popup at which point the cursor will still be on `XYZ`.
For example:
{
int i , j , m , A[5]={0,1,15,25,20};
i = ++A[1];
printf("%d:\n",i);
j = A[1]++;
printf("%d:\n",j);
m = A[i++];
printf("%d:\n",m);
printf("%d %d %d",i,j,m);
return 0;
}
and It's output is
2:
2:
15:
3 2 15
Shouldn't the printf print the values as 2 , 2, 15 but why is it printing 3 , 2, 15
P.S : I really didn't abuse this code , someone else did (my professor perhaps) and I'm just learning C . | Lets see what we got here..
int i , j , m , A[5]={0,1,15,25,20};
i = ++A[1]; // takes the value of A[1], increment it by 1 and assign it to i. now i = 2, A[1] = 2
printf("%d:\n",i);
j = A[1]++; // takes the value of A1, assign it to j and increment the value of A[1] by 1. now j = 2, A[1] = 3
printf("%d:\n",j);
//remember the value of i? its 2
m = A[i++]; // takes the value of A2, assign it to m and increment the value of i by 1. now m = 15, i = 3
printf("%d:\n",m);
printf("%d %d %d",i,j,m); // Hola! we solve the mystery of bermuda triangle :)
return 0; | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -1,
"tags": "c, printf"
} |
Can java run a compiled scala code?
Can command `java` run a compiled scala code? If so, why do we have an exclusive command `scala`? | You can run byte code generated by Scala if you include all necessary runtime libs for Scala (scala-library.jar, scala-swing.jar ...) in the classpath. The scala command does this automatically, and supports Scala specific command line arguments. | stackexchange-stackoverflow | {
"answer_score": 50,
"question_score": 44,
"tags": "java, scala"
} |
category/ url key not accept language other than english?
i want to input some chinese url key for seo optimization in my region, but when i input some chinese character, the category and product was saved nothing.
Any solution? | Magento does not support unicode URL by default.
Problem 1
public function formatUrlKey($str)
{
$urlKey = preg_replace('#[^0-9a-z]+#i', '-', Mage::helper('catalog/product_url')->format($str));
$urlKey = strtolower($urlKey);
$urlKey = trim($urlKey, '-');
return $urlKey;
}
Function **formatUrlKey** in class **Mage_Catalog_Model_Product_Url** performs every time when you save your product. So it filters out everything from URL except digits and a-z characters.
Problem 2
You need to undecode your URL before searching it in database.
So you can write an extension yourself (check out this blogpost) or you can buy one like that. | stackexchange-magento | {
"answer_score": 0,
"question_score": 0,
"tags": "url, url rewrite"
} |
MiniDP to VGA/HDMI or HDMI to HDMI
I have external monitor with VGA and HDMI ports, i plan to connect my macbook pro (mid 2014) to connect it.
What's the best way of doing this: Direct HDMI to HDMI connection, or MiniDP to HDMI/VGA adapter? | The best way is to use the built-in HDMI port, but if for some reason you need to use the MiniDP, it's a better idea to use a MiniDP to HDMI cable instead of a MiniDP to VGA cable since VGA is analog, which means it's lower quality video and it has no audio. | stackexchange-apple | {
"answer_score": 0,
"question_score": 0,
"tags": "macbook pro, display"
} |
Do I need "cmd /c"?
I've seen two different ways of calling `icacls` from VBScript:
oShell.Exec("icacls ...
or
oShell.Exec("%COMSPEC% /c Echo Y| icacls ...
What's the difference? | Usually you don't need to run it in a Command Prompt if it's an external command (executable, script, etc.). So if you can go to _Start -> Run…_ and run it from there, then you can run your application directly with all arguments, etc.
However, if you're using CMD builtin features, like internal commands (`dir`, `echo`, `mklink`, …), the pipe (`|`), or I/O redirection (`>`, `>>`, `<`), you _must_ run the commandline in CMD, because otherwise these features wouldn't be available. The parameter `/c` is just to tell CMD to terminate after the command completes. It's not required, but it's good practice to put it there, so you can easily replace it with `/k` (keep CMD open after the command completes) for debugging purposes. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 3,
"tags": "vbscript, cmd"
} |
SAS EG - Open a table without creating table link in process flow
This seems rather trivial, but in SAS Enterprise Guide, is there a way to simply open a SAS dataset from a SAS library without having a shortcut added automatically to the process flow? | For SAS EG 5.1, you need to do the following:
1. Right click on data set
2. Select Explore
3. Go to "Data Explorer"
4. Double click on data set that you want to explore
Once it is in the Data Explorer, you don't need to do steps 1-3 again for that dataset.
;
var tds_day = tr_day.getElementsByTagName("td");
console.log($("#" + tds_day[1].id).closest('select').find(':selected').html());
JsFiddle | var tr_day = document.getElementById("tr" + 1);
var tds_day = tr_day.getElementsByTagName("td");
for (var i = 0; i < tds_day.length; i++) {
console.log($(tds_day[i]).find(":selected").text());
}
<script src="
<table>
<tr class="table-info" id="tr1">
<td>
<select class="form-control"><option>foobar/option><option>foobar2</option></select>
</td>
</tr>
</table> | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "javascript, jquery"
} |
DD-WRT: How to allow port forwarding to apply to requests originating from inside the LAN?
With the original firmware of my router I had port forwarding defined from port 80 to the server in the LAN, which I used in conjunction with an external dynamic DNS service.
I've now upgraded to DD-WRT and alas the port forwarding only works for requests to the external IP from _outside_ the LAN. From inside the LAN I can only access the server by its internal IP.
How can I get the external IP (and thereby the domain name connected to the dynamic external IP) to be properly accessible also from _inside_ the LAN?
I prefer to find out how to achieve it with standard DD-WRT definitions but using e.g. iptables isn't out of the question. | Seems like it's a bug in recent DD-WRT builds.
Use iptables:
iptables -t nat -I POSTROUTING -o br0 -s 192.168.1.0/24 -d 192.168.1.0/24 -j MASQUERADE
(change your subnet according to your specific LAN)
From < | stackexchange-superuser | {
"answer_score": 25,
"question_score": 26,
"tags": "router, port forwarding, dd wrt, dynamic dns"
} |
Is it possible to pagination on fancytree?
Right now I have to render a lot of documents on the same page and I am using francytree
Issue: Performance
MY Thinking : Is fancytree provide a pagination functionality or not? | No. There is no buit-in pagination option available as of June, 2019.
You will have to do it manually by making chunks of your input data and assign them to the tree one at a time.
However, the tree supports lazy loading. This is more of pagination for a tree.
>
> $("#tree").fancytree({
> // Initial node data that sets 'lazy' flag on some leaf nodes
> source: [
> {title: "Child 1", key: "1", lazy: true},
> {title: "Folder 2", key: "2", folder: true, lazy: true}
> ],
> lazyLoad: function(event, data) {
> var node = data.node;
> // Issue an Ajax request to load child nodes
> data.result = {
> url: "/getBranchData",
> data: {key: node.key}
> }
> }
> });
> | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "javascript, jquery, pagination, fancytree"
} |
How much fresh potato to substitute for instant potato flakes when baking?
I would like to bake hamburger buns from a recipe that calls for instant potato flakes, only I can't find instant potato flakes.
This is the original recipe:
1 cup lukewarm water
1/3 cup (3/4 ounce) instant potato flakes
2 1/4 teaspoons yeast
1 tablespoon honey
2 1/2 cups (11 1/4 ounces) bread flour
1 large egg
1 teaspoon salt
1 tablespoon olive oil
How much fresh baked potato should I substitute for the instant potato flakes? | Instant potato flakes are effectively dehydrated mashed potatoes.
In general for potato flakes you mix 3:4 volume flakes to water. They increase in volume by about two and a bit times, and weight about six times
For potato powder you mix 1:5 volume powder to water. They increase in volume by about three times, and weight about six times.
So roughly 3.75 ounces of water are required to rehydrate .75 ounces of potato flakes which gives 4.5 ounces of mash, or just less than 2/3 cup of mash
Remember to remove the equivalent water (3.75 ounces) from the recipe
This all varies slightly depending on the supplier of flakes and what variety of potato they used | stackexchange-cooking | {
"answer_score": 4,
"question_score": 5,
"tags": "baking, substitutions"
} |
Convert array to hash with custom format
Can somebody help me to convert the following array to a hash with the following format?
**Array**
`[["0", {"checkbox_2"=>"on"}], ["2", {"checkbox_1"=>"on"}]] `
**Hash**
search=>{"checkbox_2"=>"on", "checkbox_1"=>"on"} | arr = [["0", {"checkbox_2"=>"on"}], ["2", {"checkbox_1"=>"on"}]]
hash = Hash[arr.flatten.select{|e| e.is_a? Hash}.collect{|e| e.to_a.flatten}]
=> {"checkbox_2"=>"on", "checkbox_1"=>"on"} | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "ruby, arrays"
} |
Laplace transform of a 100th derivative
$f(t)=e^t\frac{d^{100}}{dt^{100}}(e^{-t}t^{100})$
This is the question. I was able to solve the last part, but how to combine the both part? | Let's call $f(t)=n!L_n(t)$ where $L_n(t)=\frac{\mathrm e^t}{n!}\frac{d^n}{dt^n}\Big(t^ne^{-t}\Big)$ is the Laguerre polynomial of order $n$.
We have $$ L_n(t)=\sum_{k=0}^n {{n} \choose {k}} (-1)^k \frac{t^k}{k!} $$ and then $$\begin{align} \mathcal L\\{L_n(t)\\}&=\int_0^\infty \mathrm e^{-st}L_n(t)\, \mathrm dt\\\ &=\sum_{k=0}^n {{n} \choose {k}} \frac{(-1)^k}{k!} \int_0^\infty t^k\, \mathrm e^{-st}\mathrm dt\\\ &=\sum_{k=0}^n {{n} \choose {k}} (-1)^k s^{-k-1}\\\ &=s^{-1}\sum_{k=0}^n {{n} \choose {k}} (-s^{-1})^{k} \\\ &=\left(\frac{s-1}{s} \right)^n \frac{1}{s} \end{align} $$ and finally $$ F(s)=\mathcal L\\{f(t)\\}=\left(\frac{s-1}{s} \right)^n \frac{n!}{s} $$
Can you write what it is for $n=100$?
Or you can apply the properties of the Laplace transform to $f(t)=\mathrm e^tg(t)$ and $g(t)=\phi^{(n)}(t)$ with $\phi(t)=t^n\mathrm e^{-t}u(t)$ and then $F(s)=G(s-1)$ and $$G(s)=s^n\Phi(s)-\sum_{i=1}^ns^{i-1}\phi^{(n-i)}(0)$$ with $\Phi(s)=\frac{n!}{(s+1)^n}$ for $\Re(s)>-1$ | stackexchange-math | {
"answer_score": 0,
"question_score": 0,
"tags": "laplace transform"
} |
Using \Alph on \foreach loop argument
Here's basically what I try to do:
\begin{tikzpicture}
\foreach \x in {1,2,3,4,5}
{
\draw (\x,1) node{\Alph{\x}};
}
\end{tikzpicture}
However if I do that, I get
ERROR: Missing number, treated as zero.
I tried to prefix the number with `\the`:
\begin{tikzpicture}
\foreach \x in {1,2,3,4,5}
{
\draw (\x,1) node{\Alph{\the\x}};
}
\end{tikzpicture}
and got:
ERROR: You can't use `the character 1' after \the.
After searching around on TeX.SE, I thought the following solution should work:
\begin{tikzpicture}
\foreach \c [count=\x] in {{A},{B},{C},{D},{E}}
{
\draw (\x,1) node{\c};
}
\end{tikzpicture}
However that got me an error that `\x` is not defined.
So, how do I get the desired result? | `\Alph` expects as its argument a counter name; in your case LaTeX looks for the inexistent counters named `1`, `2` and so on.
A way out is to use the internal command that transforms numbers to letters, that is `\@Alph`:
\makeatletter
\newcommand{\myAlph}[1]{\expandafter\@Alph#1}
\makeatother
\begin{document}
\begin{tikzpicture}
\foreach \x in {1,2,3,4,5}
{
\draw (\x,1) node{\myAlph{\x}};
}
\end{tikzpicture}
\end{document}
Alternatively, the more esoteric
\newcommand{\myAlph}[1]{\char\numexpr`A-1+#1\relax}
will do the same, but is quite different from the other one in that the former leaves the letters in the input stream. while the latter leaves the instructions to print the letters. | stackexchange-tex | {
"answer_score": 11,
"question_score": 9,
"tags": "tikz pgf, loops, foreach"
} |
Why flutter always loading latest library
In my `pubspec.yaml` file, I have declared flutter toast version 5.0.3 but it always downloading the 5.0.5 why
. I selected "Temporarily allow all this page" several times but without success. I don't know of any proxy related restrictions on my internet connection but anyhow I there were some, I couldn't change them. Does this mean I can't pass the "Human verification"?
, the `<noscript>` version of the Captcha page should get displayed, which doesn't require JavaScript at all. | stackexchange-meta | {
"answer_score": 6,
"question_score": 11,
"tags": "support, bug, captcha"
} |
Can I stream media from one Plex server to another Plex server?
I have Plex on a laptop and I can use Plex for the iDevices to stream media to them.
Can I do the same with Plex on another computer around the house like ZumoCast? | Any device with the plex front end, ie, iDevice, apple TV, LG medialink, & apple computers, can see any Plex server that is running on your local network. | stackexchange-apple | {
"answer_score": 0,
"question_score": 0,
"tags": "macos, video, streaming"
} |
Посоветуйте WiFi точку доступа
Хочу дома заменить исторически появившуюся сборную солянку из различных DLink/TP-Link.
Что хочу от точки доступа:
* Только точка доступа. Роутер не нужен. Наличие дополнительных ethernet портов будет плюсом, но в целом неважно.
* PoE будет плюсом, но в целом тоже неважно.
* Двухдиапазонная. bgn/ac
* Должна стабильно работать 24/7
* Возможность автоматизации конфигурирования. У меня дома большая часть железа конфигурируется при помощи ansible. В целом можно даже без web-интерфейса, но думаю такого оборудования уже давно нет.
* Возможность снятия подробной статистики. Хочется видеть что творится с точками. Сколько клиентов на какой, уровни сигналов, распределение по каналам и так далее. Дома развернут prometheus + grafana | После долгого но неспешного вкуривания различных моделей остановился всё-таки на MikroTik hAP ac²
* Уговорил себя, что маленький свич в кадой точке не помешает
* PoE in в наличии, равно как и питание от БП
* 802.11b/g/n + 802.11a/n/ac
* Пока нареканий нет
* Ansible умеет в RouterOS, хотя и сделано спустя рукава
* Есть готовый экспортер статистики в прометей
В целом хорошо. Вот только ansible подкачал. Боюсь всё выльется в написании собственного модуля, хотя в принципе и с существующим жить можно. | stackexchange-ru_stackoverflow | {
"answer_score": 0,
"question_score": 2,
"tags": "wifi, железо"
} |
ASP.NET + C#. Creating word document from template
I have a word document which contains only one page filled with text and graphic. The page also contains some placeholders like [Field1],[Field2],..., etc. I get data from database and I want to open this document and fill placeholders with some data. For each data row I want to open this document, fill placeholders with row's data and then concatenate all created documents into one document. What is the best and simpliest way to do this? | You'll probably need to use a third party library.
You might want to check out <
The below section specifically discusses replacing values in a Word document.
< | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "c#, asp.net, ms word, openxml sdk"
} |
A js function not called in android device and called in chrome browser
In my phonegap application, I have welcome.html page, in this page, I included :
<script type="text/javascript" src="
Then I call a function ' **myFunction** ' from myJs.js
I build the app using cordova:
cordova build android
Then I run it on my device:
cordova run android
Debugging my app with DDMS: I had this error:
uncaught ReferenceError myFunction : is not defined
I tried to open welcome.html on chrome browser, the function 'myFunction' is called without problems.
I can't catch the error ! a cross origin problem? Any help will be appreciated. | I added these plugins:
cordova plugin add cordova-plugin-whitelist
cordova plugin add org.apache.cordova.inappbrowser
already I have these plugins:
org.apache.cordova.camera
add org.apache.cordova.file
org.apache.cordova.file-transfer
org.apache.cordova.device
org.apache.cordova.splashscreen
phonegap-plugin-barcodescanner
org.apache.cordova.dialogs | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "android, cordova"
} |
Buildkite use shell variables in global hook
I used a variable in my pipeline script like this.
# This shell is a pipeline shell script
export container_id=`docker run -d MY_CONTAINER`
then regardless of the success of the result, I want to remove my container using `container_id`, like this.
# This shell is a global exit hook
docker rm ${docker stop $container_id}
but it does not work. What can I do to solve this problem? | Use command substitution:
docker rm $(docker stop $container_id) | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 2,
"tags": "docker, shell, buildkite"
} |
Why does the cache need to be cleared to affect any hook_menu() change?
I create simple module to test hook_menu() function
my_menu()
{
$item["abc"] = array(
"title"=> t("abc")
"page callback"=> "my_page");
return $item;
}
Whenever I change "title" of item (to "ABC for example"), I wonder why the cache needs to be cleared to take affect. | Because menus are cached for performance reasons. Building the site's menus takes a hefty amount of processing, which would slow down the site if done on every pageview. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 0,
"tags": "drupal, drupal 7, hook menu"
} |
QGIS crashes when using dxf to shp converter
this is my first question on Stackexchange. I use a GPS to capture data in .dxf, manipulate it in a CAD program that I know how to use, then the dxf2shp converter (I think Python is mentioned) to let me generate .shp files for the end user. Every time I've done this recently I've got a meesage from QGIS that it has stopped working and will close. I've tried re-installing QGIS (1.8.0), but still have the same message. Am I doing something wrong or is this a known problem. Please note I'm not really computer literate, so if you could avoid assuming I know what a technical term means, i'd be grateful. | You can try loading the dxf into QGIS with `Add vector layer`, and then rightclick on the layer and `Save As ...` into shapefile format.
That way you might get better error messages, and a visual control on the data.
For the shapefile, you must decide what coordinate refrenece system you are using (lat/long degrees or metres). | stackexchange-gis | {
"answer_score": 2,
"question_score": 2,
"tags": "qgis, plugins"
} |
Is organ transplantation race dependent?
I watched (IMHO canibalistic) movie "Seven Pounds" where protagonist donated many of his organs to other people and I noticed, that most recipients were black also as protagonist was.
Is race really taken into account when organ transplanting?
**UPDATE**
The question is not just about if interracial transplantation really good or bad. I can imagine, that transplantation is done same-race just in case, in favor of "do not harm" principle. | No, race is not a factor taken into account. However, due to higher genetic similarities between people of the same race, it is usually easier to find a match within a race.
Source 1
Source 2 | stackexchange-biology | {
"answer_score": 5,
"question_score": 4,
"tags": "transplantation"
} |
How can Align Bootstrap 5 Card component to Center
<
Above Screen-shot I want to align the center. My Parent division class name main-div | .main-div {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
} | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -1,
"tags": "html, css, bootstrap 5"
} |
angular fade animation with css3 transtions
I'm trying to fade in/out a div on click of a link using ngAnimate and css3 transitions. I have the following, but it isn't working. The div is shown/hidden, but does not fade in or out. Where did I go wrong:
.fade-in-out.ng-add {
transition: 1s linear all;
opacity: 0;
}
.fade-in-out.ng-add-active {
opacity: 1;
}
.fade-in-out.ng-remove {
transition: 1s linear all;
opacity: 1;
}
.fade-in-out.ng-remove-active {
opacity: 0;
}
The div is initially hidden (`showMe`=false). On the page is a link which sets `showMe` to true.
<div ng-show="showMe" class="fade-in-out">
<div style="float: right; cursor: pointer;" ng-click="showMe=false">x</div>
blablabla
</div>
Note that I'm using angular 1.2.26. | The correct classes to use are:
.my-element.ng-hide-add, .my-element.ng-hide-remove {
transition:0.5s linear all;
}
.my-element.ng-hide-add { ... }
.my-element.ng-hide-add.ng-hide-add-active { ... }
.my-element.ng-hide-remove { ... }
.my-element.ng-hide-remove.ng-hide-remove-active { ... }
In your case this will be enough:
.fade-in-out {
transition: 1s linear all;
opacity: 1;
}
.fade-in-out.ng-hide {
opacity: 0;
}
**Demo:** <
_Note that`angular-animate.js` must be loaded and `ngAnimate` must be added as a dependant module._ | stackexchange-stackoverflow | {
"answer_score": 17,
"question_score": 3,
"tags": "angularjs, animation, css transitions"
} |
Retorno função Angularjs / Javascript
como faço para recuperar o valor desta função usando desta forma:
var teste = getUser();
function getUser() {
userService.getUser(userService.getUserLogged().id).success(
function(res) {
return res.data;
}
);
} | você não vai conseguir retornar um valor de forma syncrona que está disponível em um método assíncrono. neste caso a sua melhor opção, é passar uma função de callback.
Então no lugar de ter algo como:
function getUser() {
userService.getUser(userService.getUserLogged().id).success(
function(res) {
return res.data;
}
);
}
var usuario = getUser();
// fazer algo com o usuario.
Você precisa definir uma função de callback como parâmetro do método.
function getUser(callback) {
userService.getUser(userService.getUserLogged().id).success(
function(res) {
callback(res.data);
}
);
}
getUser(function (usuario) {
// fazer algo com o usuario.
}); | stackexchange-pt_stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "javascript, angularjs"
} |
proving $1 + a + a^2 + \cdots + a^{h-1} \equiv 0 \pmod{p}$.
I am stuck with this problem . How can I prove that if $a\not\equiv 1\pmod{p}$, then $1 + a + a^2 + \cdots + a^{h-1} \equiv 0 \pmod{p}$. where p does not divide a and h is the order of a. Can the Euler Fermat theorem help ? | $1+a+\cdots +a^{h-1}=\frac{a^h-1}{a-1}$ .
But $p|a^h-1$ (since $h$ is the order of $a$) and $p$ does not divide $a-1$.
So, $p|\frac{a^h-1}{a-1}$ which means that the sum is $\equiv 0(modp)$ | stackexchange-math | {
"answer_score": 0,
"question_score": 1,
"tags": "elementary number theory"
} |
What's this little reddish beetle?
They are plentiful right now, which tends to make me suspicious. I'm noticing them around the Brussels sprouts and zucchini, but they may be congregating elsewhere too.
 is because the code in each page is compiled into a separate page assembly. References to objects outside of that page are updated during the build process. Taking the built assembly for that page and inserting it into a web application does not guarantee that the linkages are consistent. At best it is considered "undefined behavior". It may work, but doing such in a production environment is poor practice. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "c#, asp.net, visual studio"
} |
Interactive Grid columns width
How I can set Interactive Grid columns width using CSS or JavaScript? I tried to use inline CSS:
th, td {
width: 100px;
}
it's not working, with JavaScript I tried to set style.width for all of th and td elements, but is also not working. I want to set different width for two columns, and make it responsive for all displays. Solution with Minimum Column Width property does not suit me. | I found two solutions:
var ig = apex.region("REGION_NAME").widget().interactiveGrid("getViews", "grid");
ig.modelColumns.COLUMN_NAME_1.width = "50%";
ig.modelColumns.COLUMN_NAME_2.width = "50%";
and
apex.region("REGION_NAME").widget().interactiveGrid("getViews","grid").view$.grid("setColumnWidth", "COLUMN_NAME_1", 50);
apex.region("REGION_NAME").widget().interactiveGrid("getViews","grid").view$.grid("setColumnWidth", "COLUMN_NAME_2", 50); | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "oracle apex"
} |
Drive map recreation via GPO during background refresh
We have a drive map GPO that applies to our users container, so that drive maps are created on any machine the user logs into.
What we have found, is that if the maps are deleted, and a gpupdate /force is run, the maps do not reappear. In fact, they won't reappear until the user logs off and back onto the machine.
Is this expected behaviour, or should the drive map be recreated during a GP update? Our concern is that someone inadvertently disconnects their primary drive map, then after our refresh period it does not reappear automatically, meaning they call us and we have no option but to get them to log out and back in. | Seems to work when items are changed from update to replace.
Assume that when initially mapped via the GPO, it has some kind of ID relating to that policy in the background. Disconnecting does not remove this ID and as such the GPO thinks the drive is still connected.
Replace must ignore this relation and recreate the map regardless. | stackexchange-serverfault | {
"answer_score": 0,
"question_score": 1,
"tags": "group policy, mappeddrive"
} |
How to select printer and print with AutoHotKey
I am trying to automate export of Lotus Notes emails to Microsoft XPS documents so that I'll be able to search through them.
Now I would like to automate the export by using AutoHotKey to print and select 'Microsoft XPS document' in the printer name list.
I have the following script:
; F2 is my chosen HotKey that will trigger the script, starting with a CTRL-P
*F2::^p
; type 'm' to choose 'Microsoft XPS Document Printer'
Send m
{enter}
which opens the print view window, but does not select the printer, although manually typing 'm' works. I tried a sleep but did not work either. | First of all, your second command is never executed. When you place a command at the same line as your initiating code. Even when the second command was executed it could be too fast. try this:
F2:: ; Use the F2 key (I would use F1 as I never use the help key)
Send, ^p ; Send Control P to print
Sleep, 1000 ; wait 1 second (or less) for print dialoguebox
Send, m ; Select printer type
Sleep, 100 ; Wait 0.1 sec. before pressing enter
Send, {Enter} ; Press enter
Return ; End this command
Regards,
Robert Ilbrink | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "automation, autohotkey"
} |
Define operator = with std::string
Good morning! I'm trying to define the assignment operator for a class like this:
Person {
string name;int age;
Person(string name,int age);
}
I know that if name would be a char*, I've first to delete the previous version of name, make it NULL and allocate a new array of char. Now I've a string, so what I've to do?
I thought to write something like this:
Person(const Person& copy){
this->name=copy.name;
this->age=copy.age; }
but it doesn't work. I tried to delete the string name, but the compiler gives me an error. Where is the problem? Thank you! | This:
Person(const Person& copy){
is a copy constructor, if you want assignment operator then use;
Person& operator=(const Person& rop) {
name=rop.name;
age=rop.age;
return *this;
}
But the compiler with synthesize a copy-assignment operator if the class does not define one - the same applies to copy constructor. So its unclear to me where is your problem.
You are right that if you have a `char*` which is assigned buffer from dynamic allocation, then you must manage its lifetime yourself (or using smart pointer). But with std::string or any other class which uses RAII idiom, you use the so called rule of zero, so no need to worry about writing code to make copies. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "c++, operators, assignment operator"
} |
Jquery detect div scroll bar scroll to top
var Height = 600;
$('#message_container').scroll(function(){
if ($('#message_container').scrollTop() > Height){
alert('up');
}else{
alert('down');
}
});
I have div `overflow-y:auto`, it fetch out 10 messages per time.
I try to use jquery scroll up to fetch out more message.
`div` height is 600px; while im testing, **it keep alert down even i scroll up** , anyone know why?
Here is Fiddle < | from JQuery
> The vertical scroll position is the same as the number of pixels that are hidden from view above the scrollable area. If the scroll bar is at the very top, or if the element is not scrollable, this number will be 0
so test with 0 demo
$(document).ready(function(){
$("#message_container").scrollTop($("#message_container")[0].scrollHeight);
var Height = 600;
$('#message_container').scroll(function(){
if ($('#message_container').scrollTop() == 0){
$('#status').html('up');
//alert('up');
}else{
$('#status').html('down');
//alert('down');
}
});
}); | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 1,
"tags": "javascript, jquery"
} |
How to determine security types, like WPA, WPA2, WEP, using Apple80211?
I can scan and get the Wifi list in iPhoneOS4.0.
At this time, I neet to determine security types of each Wifi access point. How can I do that using the value of "CAPABILITIES" key of scanned result's NSDicionary? Which one is one of NONE, WPA, WPA2, WEP? The value of CAPABILITIES is 1057, 1025,34,33,2,1073,1041 and 3121, etc... It is too various. I don't know what it represents. I am using "WEP" and "WPA_IE" key to obtain Boolean for NSDictionary, but It is not enough.
Anyone know how to do? | I have found out the solution. Have a look the below. You can do more details using the wep, wpa, rsn. Thanks.
int adhoc = [network objectForKey:@"AP_MODE"];
if (adhoc == 1) {
ret =@"AdHoc network";
} else {
id wep = [network objectForKey:@"WEP"];
id wpa = [network objectForKey:@"WPA_IE"];
id rsn = [network objectForKey:@"RSN_IE"];
if(wep) {
ret =@"Secured network (WEP)";
} else if (wpa && rsn) {
ret =@"Secured network (WPA, WPA2)";
} else if (wpa) {
ret =@"Secured network (WPA)";
} else if (rsn) {
ret =@"Secured network (WPA2)";
} else {
ret =@"Open Network";
}
} | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 2,
"tags": "iphone, wifi"
} |
Cuda patches: install all or install latest?
There are several patches for Cuda v9.0
Should I install the latest patch or install all of the patches?
| If you want a fully patched/updated CUDA 9.0, you should install all of them. | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 2,
"tags": "cuda"
} |
JS Замыкания и цикл с таймаутом.
Всеми любимый цикл.
function f(){
for(var i = 0; i < 10; i++) {
setTimeout(function() {
console.log(i);
}, 1000);
}
}
Выводит десять десяток. Предполагаю, что цикл выполнится раньше, чем запустится анон функция. Но. Почему так случается, если цикл не переходит дальше (то есть плюсует i, делает проверку на истинность и т.д до i=10) пока не выполниться setТimeout(...)? | Почитайте, как работает setTimeout, но до этого, что такое замыкание, а то сейчас получится так. | stackexchange-ru_stackoverflow | {
"answer_score": 0,
"question_score": -1,
"tags": "javascript, замыкания"
} |
PHP different one way hashes for password security
I was wondering to hash the password in PHP using different methods available and the combination of them for more and more security. I was wondering if this would work..?
$pass = "***";
$salt = "!@)#%%@(#&@_!R151";
$pass = sha1($pass.$salt);
$pass = md5($pass); | Rather than that, you can **use a stronger hashing algorithm** like **`sha512`** with combination of a strong salt and `UserID`: Do it like this:
echo hash('sha512', 'MyPassword' . $StrongSalt . $UserID);
SHA512 is actually SHA-2 for which there are no collisions found. See at wikipedia. | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 2,
"tags": "php, security, md5, sha1, password protection"
} |
Collecting system data from Red Hat Linux
I am planning to write a small program .The input for this should be the IP,username,password for a Linux machine ,and it should give me the system details of that machine as output.
I am planning to write this using Shell ,using RSH for the login . I am in no way asking for a solution ,but could you please point me towards other options that I have ? I am not really comfortable using Shell scripts .
Thanks in advance | i have a same demand. and what i do is:
first write a script which will be executed at target host (T). something like this
> cat check_server.sh
#!/usr/bin/env bash
# execute at target host
all_cmd=(
"uname -a"
"lscpu"
"free -m"
)
function _check {
for one_cmd in "${all_cmd[@]}"; do
echo -e "\n\n$one_cmd" >> /tmp/server_info.txt
eval "$one_cmd" >> /tmp/server_info.txt
done
}
then execute it in target and copy back result, like this
_cmd=`base64 -w0 check_server`
ssh $user@$ip "echo $_cmd | base64 -d | bash"
scp $user@$ip:/tmp/server_info.txt ./ | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "linux, shell, python 3.x, operating system"
} |
exam exercise on Series problem.
The exercise states: Does the series $$\sum\limits_{n=1}^\infty \int_{0}^1 \frac{x^n dx}{x+1}$$ converge?
The solution states as the first step: $$I_n =\int_{0}^1 \frac{x^n dx}{x+1} $$ then $ \frac{1}{2(n+1)}\le I_n \le \frac{1}{n+1} $
This is not really self evident to me, could someone explain where this inequality comes from to me? | Hint: $\dfrac{x^n}{0+1} \geq\dfrac{x^n}{x+1} \geq \dfrac{x^n}{1+1}$ | stackexchange-math | {
"answer_score": 5,
"question_score": 3,
"tags": "real analysis, sequences and series, self learning"
} |
$ABCD = I$ then $B^{-1} =?$
I got this question in a practice book.
A,B,C and D are $n\times n$ matrices with non-zero determinant.
$ABCD = I$ , then $B^{-1}$ = ?
The answer to this was $B^{-1}= CDA$.
How was that answer arrived at ? | $ABCD=I$, $BCD=A^{-1}$, $CD=B^{-1}A^{-1}$, $CDA=B^{-1}$. | stackexchange-math | {
"answer_score": 11,
"question_score": 5,
"tags": "linear algebra, matrices"
} |
Hostname in id_rsa.pub file
I've generated an ssh key pair with ssh-keygen. The id_rsa.pub file looks like this:
ssh-rsa someLettersAndNumbersABC123 username@host
The host part is what bothers me. Currently it comes from the router. But I want to use that key no matter where I am, whatever the hostname some router gives me. Is it save to simply remove everything after my username? Would that even work?
Once I disabled plain password authentication I wouldn't be able to add another key (or connect at all), if the key depends on the hostname of the client. | The format of your public key file is
<keytype> <base64-encoded key> <comment>
where for protocol version 2 the keytype is `ecdsa-sha2-nistp256`, `ecdsa-sha2-nistp384`, `ecdsa-sha2-nistp521`, `ssh-ed25519`, `ssh-dss` or `ssh-rsa` and the comment field is not used for anything at all (but may be convenient for the user to identify the key).
So you can leave it, change it or remove it without repercussion.
When using your public key in an authorized_keys file, the format is:
<options> <keytype> <base64-encoded key> <comment>
where the options may be left empty but can be used to add restrictions to the level of access that is granted with that particular key pair.
Since the comment has no actual use the comment used an authorized_keys file may also be different from the comment you use in the id_rsa.pub file. | stackexchange-superuser | {
"answer_score": 3,
"question_score": 0,
"tags": "ssh, rsa"
} |
Lightweight windows xp for running .net 4 application
I need to create an extremly light version of WinXP pro (with nLite) capable to run .net 4 application. What are the minimum requirments to use .net 4 framework? What can i remove? | According to the MSDN article .NET Framework System Requirements aside from I.E. 6.0 (or later) and Windows Install 3.1 you don't need anything else to install the framework.
After that its all based on application specific requirements. For example if your application needed to write to a local MSMQ you'd need Message Queuing installed and turned on. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "windows, .net 4.0, windows xp"
} |
Finding good induced subgraph
You are given a graph $G = (V,E)$ with $n$ vertices. It might be bipartite if you want. There are $m$ sets of edges $E_1,\ldots, E_m \subseteq E$ (say disjoint). I am interested in the problem of finding a subset $S \subseteq V$, as small as possible (or even smaller), such that the induced graph $G_S$ has at least one edge from each class $E_i$, for $i=1,\ldots, m$.
Currently, I know that this problem is set cover hard. I also have a not completely obvious (roughly) $O(\sqrt{n})$ approximation.
This seems like a natural problem - is anyone aware of any relevant references, or any better algorithms? | Look for Minimum Rainbow Subgraph. | stackexchange-cstheory | {
"answer_score": 15,
"question_score": 19,
"tags": "ds.algorithms, graph theory, optimization"
} |
Sharks with frickin’ laser beams attached to their heads
The Lego Movie does not only feature sharks and lasers but also laser sharks:
 to my shark’s head?**
In the above still, the shark’s jaw seems to be detached, but that does not seem very healthy and still it only provides little space to attach anything. | The LEGO Agents Speedboat Rescue (8633) set has a set with laser sharks. The set uses a new version of the LEGO shark with two studs on the top behind the head.
 and because of their limited release they are very expensive on Bricklink.
For the original shark you could use a small Technic rubber band (or any small rubber band) to attach a laser.
In the example below, The body of each laser uses a Technic pin joiner, the rubber band runs along the slot in the brick so it's kept in place. The back end of the laser is joined together with a flexible rubber axle connector.
 | You have to add
require 'rails/generators'
at the top of your file | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "ruby on rails, ruby, path"
} |
Regex to only choose one of the defined characters are allowed
I have arrays of characters which is [-_.]. And I want to make a rule to only choose one of those characters to appear in the string. So if it's already using -, then _ and . are not allowed.
For example.
1. google-facebook = OK
2. google--facebook = OK
3. google____facebook = OK
4. google_-facebook = ERROR
5. google._facebook = ERROR
Need help to build a correct regex for these conditions. For now my current form is `^[a-z-A-Z0-9_.]$`
**Update**
-_. cannot be at the beginning or end of string
More examples
1. google-facebook_twitter = ERROR
2. google-facebook-twitter = OK
3. youtube-instagram.tiktok = ERROR
4. youtube.instagram.tiktok = OK | You can use
^[a-zA-Z0-9]+(?=([-_.]?))(?:\1+[a-zA-Z0-9]+)*$
See the regex demo.
_Details_ :
* `^` \- start of string
* `[a-zA-Z0-9]+` \- one or more letters/digits
* `(?=([-_.]?))` \- a positive lookahead (when the regex engine tries its pattern, the regex index remains where it was in the string) that captures (if present) the next `-`, `_` or `.` into Group 1
* `(?:\1+[a-zA-Z0-9]+)*` \- zero or more occurrences of
* `\1+` \- one or more occurrence of Group 1 value
* `[a-zA-Z0-9]+` \- one or more letters/digits
* `$` \- end of string. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "regex"
} |
Проверка соответствия имени файла определённому формату
Мне нужно чтобы имя загружаемого файла было в формате XX-XX-XXXX, где каждый X - это цифра. Как сделать такую проверку? | Думаю, для вашей задачи лучше использовать регулярное выражение \d{2}-\d{2}-\d{4} < | stackexchange-ru_stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "php"
} |
Time Loop in VBA - Looping through Columns
There are two sheets (sheet1 and sheet2).
Need to refresh sheet1 every 4 minutes as long as the workbook is open.
Then I Need to copy values from Column C in sheet1 to column C in sheet2 every 4 minutes.
Since new values would come in every 4 mins in sheet1, I want the values to be copied to a new column in sheet2 everytime.
I'm using the following code. The problem with my code is that the variable i is getting initiated fresh everytime and I am not able to initiate it to a value outside the module using Public i as long.
Sub copyvalues()
Dim i As Long
i = 3
Sheets(2).Columns(i).Value = Sheets(1).Range("C11:C90").Value
i = i + 1
Application.OnTime Now + TimeValue("00:04:00"), "copyvalues"
End Sub | Although you mention you can't declare variable `i` as Public, this should work:
For example, the following works without issues:
Public i As Long
Sub test()
Debug.Print i
Application.OnTime Now + TimeValue("00:00:01"), "Module1.test"
i = i + 1
End Sub
Try the following:
Public i As Long
Public SubIsRunning As Boolean
Sub initiatesubs()
If Not SubIsRunning = True Then
i = 3
Call copyvalues
SubIsRunning = True
End If
End Sub
Sub copyvalues()
Workbooks(REF).Sheets(2).Columns(i).Value = Workbooks(REF).Sheets(1).Range("C11:C90").Value
i = i + 1
Application.OnTime Now + TimeValue("00:04:00"), "Module1.copyvalues" 'assuming the sub is in Module1
End Sub | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "vba"
} |
Securing .NET JSON Web Api Service Consummed by AngularJS
I have a .NET Web Api JSON service that is going to be called by an AngularJS website. Both the website and the web service will be hosted in the same server, but may or may not be hosted within the same IIS site. At the moment, the service is fully exposed and I can call it's method's from a browser. I would like to secure this, but I am not sure what the best option would be. Ideally, I think I would require a client certificate, but since the client is JavaScript, ie Client Side, I am not sure this would work. Any advice would be appreciated. | Your Cert could easily be extracted, simple to use cors with scope rules to allow access from designatted URL's only
[EnableCors(origins: " headers: "*", methods: "*")]
How to | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": ".net, json, angularjs"
} |
How secure is it to connect to an ftp server (iPhone SDK)
How secure is it to connect to an ftp server in an iPhone application? I want to connect to my ftp server in my app but am worried that the username and password can be revealed. | Any time you use FTP, assuming there's no other connection security (e.g. being tunnelled through an SSH or VPN connection), your username and password are sent in clear text.
This is why you should use a protocol like SFTP or SCP for file transfer. | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 1,
"tags": "iphone, security, ftp"
} |
How to get the server path to the web directory in Symfony2 from inside the controller?
The question is as follows:
How can I get the server path to the web directory in Symfony2 from inside the controller (or from anywhere else for that reason)
What I've already found (also, by searching here):
This is advised in the cookbook article on Doctrine file handling
$path = __DIR__ . '/../../../../web';
Found by searching around, only usable from inside the controller (or service with kernel injected):
$path = $this->get('kernel')->getRootDir() . '/../web';
So, is there absolutely no way to get at least that 'web' part of the path? What if I, for example, decided to rename it or move or something?
Everything was easy in the first symfony, when I could get like everything I needed from anywhere in the code by calling the static sfConfig::get() method.. | There's actually no direct way to get path to webdir in Symfony2 as the framework is completely independent of the webdir.
You can use `getRootDir()` on instance of kernel class, just as you write. If you consider renaming `/web` dir in future, you should make it configurable. For example AsseticBundle has such an option in its DI configuration (see here and here). | stackexchange-stackoverflow | {
"answer_score": 47,
"question_score": 65,
"tags": "php, symfony"
} |
Webstorm: Execute .bat on save
I have a simple bat which merges my .js files into one single file. I'd like to execute it every time I save anything in webstorm.. Can this be done? | It's not possible as WebStorm saves all the files automatically when needed, there is no trigger to be called on individual file save.
As a workaround you can create a macro that will save all the files and run the external tool, then bind this macro to default Save All shortcut. Now when you save the files via hotkey, IDE will also run your batch script.
Another possible solution would be to use some external service that will watch specified files for changes and run an external tool when they change. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "webstorm"
} |
Splitting C string in Python
I would like to split a string similar to
'abc "defg hijk \\"l; mn\\" opqrs"; tuv'
into
(['abc', '"defg hijk \\"l; mn\\" opqrs"'], 33)
i.e. I don't want to break on semicolon inside (nested) quotes. What's the easiest way, tokenize? It doesn't hurt if it's fast, but short is better.
**Edit:** I forgot one more detail that makes it even more tricky. I need the position of the semicolon that is cutting off the string, or -1 if there is none. (I'm doing changes to legacy code that used to be recursive, but stackoverflowed when the string became very long.) | It's unlikely there is an easy way to solve this without a proper parser. You could probably get away with a hand built parser that doesn't require tokenizing though.
Something like the following should be a good guide:
def parse(s):
cur_s = []
strings = []
def flush_string():
strings.push(''.join(cur_s))
cur_s = []
def handle_special_cases():
# TODO: Fill this in
for c in s:
if c == ';':
break
elif c in ['\\' '"']:
handle_special_cases()
elif c == ' ':
flush_string()
else:
cur_s.push(c)
flush_string()
return strings | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "python, string, split"
} |
Is it possible to modify dynamically added DOM nodes?
I have some javascript libraries (for example Adobe Edge), which dynamically insert script nodes into DOM. I detect changes with MutationsObserver, is it possible to modify the mutated nodes? | Yes you can modify nodes that are added to the DOM dynamically just like you can any other node.
var target = document.querySelector('div');
new MutationObserver(function(mutations) {
mutations.forEach(function (mutation) {
Array.prototype.forEach.call(mutation.addedNodes, function (node) {
node.style.backgroundColor = 'red';
});
});
}).observe(document.querySelector('div'), {attributes: true, childList: true, characterData: true});
target.appendChild(document.createElement('span'));
< | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": -4,
"tags": "javascript, html, dom, mutation observers"
} |
Overriding overflow: hidden
I have a parent container with a lot of child elements. Due to animation reasons (child elements sliding in and out of the parent) I have set it's `overflow` property to `hidden`.
This works great but there are a couple of the children who I do want to be visible outside the parent's bounds.
How do I make it so that only certain children are visible outside the parent's bounds? | Answer is: You can't. Either the parent has `overflow:hidden` then all child-elements will be clipped, or you have `overflow:(visible|auto|scroll|...)` then all children are treated according to that rule. There is no possibility you could mix states - all children are treated equally.
However, you could introduce additional container-elements inside the parent (which no longer has overflow:hidden) like in this pseudo-code:
<parent>
<container1 style="overflow:hidden">
<!-- these will be clipped -->
<element>
<element>
</container>
<container2 style="overflow:visible">
<!-- these will be shown -->
<element>
<element>
</container>
</parent>
edit: **example** | stackexchange-stackoverflow | {
"answer_score": 8,
"question_score": 13,
"tags": "html, css, overflow"
} |
How can I create a custom UISearchBar
In iOS there is a search bar component with text field. How can I customize the text field to something else? with different image ?
Thanks. | How to customize apperance of UISearchBar
<
<
If you are expecting a sample code this is not an ideal website for you =)
Happy Coding | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 0,
"tags": "ios, searchbar"
} |
Can we use async attribute for script loaded dynamically?
Can we use `async` attribute to load script asynchronously for script loaded dynamically? | By `script loaded dynamically`, if you mean adding javascript code dynamically to your page, then the answer is **No**.
`async` attribute can only be used on loading external scripts that are referred to via a URL specified in `src` attribute.
> The async attribute is only for external scripts (and should only be used if the src attribute is present)
Example, You can load only scripts like this asyncronously
<script src="external-file.js" async></script> | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 2,
"tags": "html, css"
} |
Checking referenced resources with an Azure Policy
Lets say i have a `Microsoft.ApiManagement/service/products` resource named **Public** and i want to enforce a policy where only 2 API resources at `Microsoft.ApiManagement/service/products/apis` are allowed to reference the **Public** resource.
Is this possible? I only see examples where a single resource value is being checked, this is a problem where it's crossing resources.
I was thinking of doing the `Microsoft.ApiManagement/service/products[*]` iteration and then checking the api's using the `allOf` operator, but api's aren't a property value of `Microsoft.ApiManagement/service/products`, it's a separate resource. | You can try using the count feature to see how many resource reference. However, it looks like ApiManagement doesn't have any aliases so you can't use policy on it. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "azure policy"
} |
How can I deal with each adjoin two element difference greater than threshold from Spark RDD
I have a problem with Spark Scala which get the value of each adjoin two element difference greater than threshold,I create a new RDD like this:
[2,3,5,8,19,3,5,89,20,17]
I want to subtract each two adjoin element like this:
a.apply(1)-a.apply(0) ,a.apply(2)-a.apply(1),…… a.apply(a.lenght)-a.apply(a.lenght-1)
If the result greater than the threshold of 10,than output the collection,like this:
[19,89]
How can I do this with scala from RDD? | If you have data as
val data = Seq(2,3,5,8,19,3,5,89,20,17)
you can create rdd as
val rdd = sc.parallelize(data)
What you desire can be achieved by doing the following
import org.apache.spark.mllib.rdd.RDDFunctions._
val finalrdd = rdd
.sliding(2)
.map(x => (x(1), x(1)-x(0)))
.filter(y => y._2 > 10)
.map(z => z._1)
Doing
finalrdd.foreach(println)
should print
19
89 | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "scala, apache spark, rdd"
} |
Testing before_destroy method with rspec
Hi I'm having trouble of how should I test this case scenario
models/checklist.rb
before_destroy :destroyable?
def destroyable?
raise "Error" if phase.companies.count > 0
end
spec/models/checklist_spec.rb
describe 'triggers' do
describe 'destroyable?' do
it 'should raise error if checklist phase has companies' do
company = create(:company)
company2 = create(:company)
phase = create(:phase, company_ids: [company.id, company2.id])
checklist = create(:checklist, phase: phase)
expect(checklist.destroy).to raise_error(RuntimeError)
end
end
end
I'm getting this error: **RuntimeError: Error** | You have to wrap the code raising the error in a block,
expect { checklist.destroy }.to raise_error(RuntimeError) | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 4,
"tags": "ruby on rails, ruby, rspec"
} |
Regular expression in C#
I am trying to search and change all links in a html file I have.
so I want it to go throuhg and change `<a href="whatever"`
to `<a href="mynewlink"`
I can do it with visual studios find option using regular expression. But it keeps selecting too much of the string.
I have tried: `<a href=".*"`
but the problem is it will get the entire string until the last " (so if there for example:
<a href="www.google.com.au" id="myId">
it will select all the way up to the end of `myID"` | The dot can also match a quote, and the asterisk makes it match as many characters as it can, so it'll match right past the end of the `href` attribute value.
Use `<a href="[^"]*"` instead. `[^"]` means "any character except quote", so it'll never match past the attribute value. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 2,
"tags": "asp.net, regex"
} |
Why does the Java KVM client for my Dell BMC no longer work?
After upgrading Java to version 8u171 the Java KVM client provided by my Dell BMC's web interface stopped working. The only error message is "Connection failed."
I'm using the BMC on a PowerEdge C6220, but other models may also be affected.
What's going on and how can I fix it? | This is because Java 8u171 disables the use of the 3DES_EDE_CBC cipher when making TLS connections. Apparently the client (or the BMC itself) is incapable of using more modern ciphers, even with the most recent firmware.
You can reconfigure Java by editing the `java.security` file. This can be found in `lib\security` (Java 8 or earlier) or in `conf\security` (Java 9 or later). You need to remove `3DES_EDE_CBC` from the setting for `jdk.tls.disabledAlgorithms`.
For example, the default setting in Java 8u171 is
jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024, \
EC keySize < 224, DES40_CBC, RC4_40, 3DES_EDE_CBC
To re-enable 3DES_EDE_CBC, this needs to be changed to
jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024, \
EC keySize < 224, DES40_CBC, RC4_40
Java documents this here, under the title "Disable the TLS 3DES cipher suites". | stackexchange-serverfault | {
"answer_score": 4,
"question_score": 1,
"tags": "windows, java, dell poweredge, bmc"
} |
Filtering String based on a format
I have a list of Strings and I want to filter them out based on either the pattern **parta-partb-partc or parta-partb-no-partc**. The no could be any positive integer while the other parts of the string are fixed.
For example
parta-partb-partc
parta-partb-1-partc
parta-partb-1xyz-partc
parta-partb-123-partc
parta-partb-abc-partc
After filtering by a regular expression my list should be
parta-partb-partc
parta-partb-1-partc
parta-partb-123-partc
My question is how do I write a regular expression combing both the conditions? | Use `String#matches` with the following regex pattern:
parta-partb-(?:\d+-)?partc
Sample script:
String input = "parta-partb-1-partc";
if (input.matches("parta-partb-(?:\\d+-)?partc")) {
System.out.println("MATCH");
}
Note that `String#matches` by default will apply the pattern to the entire input string, so no starting/ending anchors are required. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "java, regex"
} |
Geotagging with PhotoCaptureDevice in WP8
I took a look on the new "PhotoCaptureDevice" and related classes in Windows Phone 8 but could not find means to add location data to captured images (GPS location). Are there means to add such information in Windows Phone 8? Or is this only possible with the built-in camera? | The solution is to write the EXIF location data manually before sending the image stream (memory stream) to the media gallery. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "geolocation, gps, photo, exif, windows phone 8"
} |
How to convert `BlockNumber` to `u64`?
For example, if a have a variable of type `<T as frame_system::Config>::BlockNumber` how could I convert it into a `u64`, simply putting `u64::from` doesn't work. | use sp_runtime::traits::SaturatedConversion;
fn f(block_number: BlockNumber) {
block_number.saturated_into::<u64>();
} | stackexchange-substrate | {
"answer_score": 4,
"question_score": 1,
"tags": "frame"
} |
Query a JSONObject in java
I was wondering if somewhere out there exists a java library able to query a JSONObject. In more depth I'm looking for something like:
String json = "{ data: { data2 : { value : 'hello'}}}";
...
// Somehow we managed to convert json to jsonObject
...
String result = jsonObject.getAsString("data.data2.value");
System.out.println(result);
I expect to get "hello" as output.
So far, the fastest way I have found is using Gson:
jsonObject.getAsJsonObject("data").getAsJsonObject().get("data2").getAsJsonObject("value").getAsString();
It's not actually easy to write and read. Is there something faster? | I've just unexpectedly found very interesting project: JSON Path
> JsonPath is to JSON what XPATH is to XML, a simple way to extract parts of a given document.
With this library you can do what you are requesting even easier, then my previous suggestion:
String hello = JsonPath.read(json, "$.data.data2.value");
System.out.println(hello); //prints hello
Hope this might be helpful either. | stackexchange-stackoverflow | {
"answer_score": 48,
"question_score": 49,
"tags": "java, json, jackson, gson"
} |
Mysql data recovery using mysqlbinlog
I accidentally dropped a schema without backing it up.
And now I want to use **_mysqlbinlog_** utility to perform recovery. (It seems that mysqlbinlog is a good tool). And it needs those binary log files to perform recovery.
Now I have the following confusions:
1. I **_can not_** find those binary log files. So where are they located?
2. If the operations are not logged or binary logging is not enabled, how to enable it. I have read the mysql documentation, it says they are enabled **_as default_**. But I cannot find those files,though...
3. Is it possible to recover the data and schema through the **_/var/log/mysqld.log_** file | If you have the line `log = /path/to/mysql.log` uncommented in `my.cnf`, the queries will be in the `mysql.log`. That is, answering the third question. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 2,
"tags": "mysql, binary log, mysqlbinlog"
} |
Time complexity for the following algorithm with loops
I have the following algorithm and I want to find the time complexity:
for(int i=1; i<=n; i++)
{
for(int j=1; j<=m; j++)
{
for(int k=1; k<=o; k++)
{
for(int l=1; l<=p; l++)
{
//some stuff
}
}
}
}
Is this $O(nmop)$ or $O(n^4)$ and if it is $O(nmop)$ does it mean that it is better than $O(n^4)$ | It is $O(nmop)$, not $O(nmkl)$ (although $o$ is reserved for something else), and it is not better than $O(n^4)$ since letting $n=m=o=p$ gets you there. | stackexchange-math | {
"answer_score": 1,
"question_score": 0,
"tags": "algorithms, asymptotics"
} |
How can I cache images on the client side?
How can I cache images on the client side so the client doesn't request the same images again and again unless the server side images have changed? | You can do this using apache and mod_expires: <
This tutorial may serve: < | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "php, html"
} |
Chair Placement
I have 3 chairs to place within 8 spots. All three of my chairs come in 4 different colors.
Can I represent the number of possible placements as:
${24}\choose{3}$ | OK, then choose a stool (4), a couch (4), and a crate (4), so $4\times4\times4=64$ ways to choose the furniture. Then put the stool somewhere (8), the couch somewhere (7), the crate somewhere (6), so $8\times7\times6=336$ ways to places the chosen furniture. All told, $64\times336$. | stackexchange-math | {
"answer_score": 1,
"question_score": 0,
"tags": "combinatorics"
} |
Android App options onkeydown
See that button in the right bottom corner with the red cercle around it. Sorry for the size! I would like to know if there is an KeyEvent for this key and how is the key called.
Thanks a lot!
!image | That is the soft menu button. You can intercept onKeyPressed of your activity. the KeyEvent is KEYCODE_MENU.
That said... Some people call these three dots in the soft button bar of the galaxy nexus the "menu button of shame". The menu itself is discouraged to use and the elements hidden behind it should be made available through the normal ui. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "android, keyevent"
} |
Function to pass javascript variables to a php file via a GET or POST?
I've got the following function
`function make(point, name, message, type, file, id, lat, lng)`
I want this function to pass all of these Javascript variables to a php file which would open in a window when a link is pressed how would I do this? | window.open('path/to/php?point=' + point + '&name=' + name); // etc for all other vars
make sure the values of your variables are urlsafe, i'd urlencode them with:
encodeURIComponent(variable);
**Edit re your comment**
<a href="#" onclick="make(vars, go, here); return false;">Click me!</a>
but if thats all you want, you might as well just have the link open in a blank window:
<a href="path/to/php?point=foo&etc=bar" target="_blank">Click me!</a>
It depends if `make()` is doing something else other than opening a window, i suspect so? | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 1,
"tags": "php, javascript"
} |
Bulk rename files with numbering
How do I bulk rename multiple files named
_Image401.jpg, Image402.jpg,..._
to
_Image 001.jpg, Image002.jpg, ..._ ? | You just want to change '4' to '0'?
for f in Image4*.jpg
do
# replace Image4 prefix with Image0
newname="Image0${f#Image4}"
mv "$f" "$newname"
done
Or you want to subtract 400 from the numeric part? Or something else? | stackexchange-unix | {
"answer_score": 1,
"question_score": 1,
"tags": "bash, rename"
} |
Convert Datetime2 to smalldatetime trigger
I need to convert datetime2 to smalldatetime Can someone give me a simple example of how to convert datetime2 to smalldatetime trigger
I figured a trigger was the way to do this but haven't gotten the syntax right. Can someone please show me how? I've never written a trigger before. | DECLARE @datetime2 datetime2 = '12-10-25 12:32:10.1234567';
DECLARE @smalldatetime smalldatetime = @datetime2;
SELECT @datetime2 AS '@datetime2', @smalldatetime AS '@smalldatetime';
Result :
> @datetime2 @datetime
> --------------------------- -----------------------
> 2025-12-10 12:32:10.1234567 2025-12-10 12:32:10.123
>
> (1 row(s) affected) | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "c#, sql"
} |
Can i cast a spell after collecting rewards for an adventure?
Page 13 says a player can only use his items, clues, spells, and allies during his own turn. Does this mean I can use a spell immediately after collecting adventure rewards, such as opening an other world gate? | **The rules as written do not clarify one way or the other - it is up to a house ruling.** However, many cards have specific timing for them listed (such as "At the start of your turn" or "At the end of your turn"). With this in mind, for any card that does not have a timing listed, you could make a case for justifying its usage at any time during your turn, including immediately before it ends. | stackexchange-boardgames | {
"answer_score": 2,
"question_score": 2,
"tags": "elder sign"
} |
OpenStreetMap API How to get node id where natural=peak?
I'm trying to access to the osm database... What I want to do is to get the list of all the mountains in Italy. The method I wont to emulate is a kind of SELECT WHERE natural=peak But I don't know what's the best way to do this with APIs. Can someone help me?
Really thank you so much ;) | Check out the Overpass API. You can make queries exactly as you mentionned | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "api, openstreetmap"
} |
How to make this auto-sliding effect on iOS
I'm new on iPhone. Could you please tell me how to make an auto-sliding effect like this? Thanks. Pic: < | Using a UIPageControl, here is a link to a stackoverflow answer with a link to a UIPageControl Tutorial: UIPageControl Tutorial
And using NSTimer to change page programmatically, here is a link to a stackoverflow answer explaining how to change pages programmatically: Change page Answer
To animate the page change, use UIViewAnimation methods: UIView Animation sample | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "iphone"
} |
Installing a CA certificate on multiple Windows machines (IE/Firefox)
I look after ~50 machines running XP/Vista, all on a single Windows Server 2008 domain. We are rolling out a number of test webservers internally, which have their SSL certificates signed with a company internal CA.
To prevent users being confused by SSL warnings, I need to install the CA's certificate on each of the machines.
Any ideas how to automatically install a certificate on Windows machines for IE and Firefox? | Your best bet is to deply your root certificate to the machines using group policy. This article here explains the process in good detail. | stackexchange-serverfault | {
"answer_score": 2,
"question_score": 4,
"tags": "windows server 2008, ssl certificate"
} |
Why doesn't this code generate an error on using a variable array size?
The code below should generate an error, since there is no way that the compiler can know the array size during compilation.
int f;
std::cin >> f;
int c[f];
c[100] = 5;
I am compiling with gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 and it doesn't just compile, but it runs somehow.
How does it happen? | C99 accepts variable length arrays, and gcc accepts them as an extension in C90 and C++.
Using `-pedantic` or `-Wvla` turns this into a warning in C++ code, and `-Werror=vla` turns it into an error. | stackexchange-stackoverflow | {
"answer_score": 13,
"question_score": 7,
"tags": "c++, gcc, variable length array"
} |
Excel-VBA: Variable declaration necessary?
Would it be wrong if write the following code
Sub Something()
Dim i As integer
Dim xRange As Range
Dim yRange As Range
Set xRange= Range("x_table")
Set yRange= Range("y_table")
For i = 1 To xRange.Columns.Count
xRange.Columns(i) = Application.Sum(y_table.Columns(i))
Next i
End Sub
without specifically declaring each of the variables? Like bellow;
Sub Something()
Set xRange= Range("x_table")
Set yRange= Range("y_table")
For i = 1 To xRange.Columns.Count
xRange.Columns(i) = Application.Sum(y_table.Columns(i))
Next i
End Sub | If Option Explicit isn't turned on you _can_ do it that way, but I wouldn't recommend it because then you're relying on the framework to guess at the type of variable it is dealing with, which could cause unexpected results. | stackexchange-stackoverflow | {
"answer_score": 14,
"question_score": 3,
"tags": "vba, excel, variable declaration"
} |
php preg-replace fatal situation
i need to transform nubmer to string (dividing each 3 numbers by space, i.e **20000 => 20 000** , **1400000 => 1 400 000** )
my code:
`$cena = '20000';`
`$cena = preg_replace('/\D+/g', '', $cena);`
`$cena = preg_replace('/\d(?=(?:\d{3})+(?!\d))/g', '$& ', $cena);`
this results in:
`Warning: preg_replace() [function.preg-replace]: Unknown modifier 'g' in myfile.php on line xxx`
what's wrong? | $number=1400000;
$format = number_format($number, 0, '', ' ');
echo $format; //1 400 000 | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 0,
"tags": "php, regex, preg replace"
} |
How to get the proper LightDM theme?
I've been using Oneiric since the second Alpha (had to, my new system refused to run any older Ubuntu version) and I've never been able to get the nifty LightDM theme I'm seeing everywhere. Instead, I'm alway seeing this theme instead:
!
Can anyone explain to me how to change / fix this?
Also when I do a `sudo dpkg-reconfigure lightdm`, it gives the following warnings, could that be related to my problem?:
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_NAME missing
dpkg-maintscript-helper: warning: environment variable DPKG_MAINTSCRIPT_PACKAGE missing | May seem silly, but have you `sudo apt-get install lightdm unity-greeter`? If I recall correctly `lightdm` _should_ be downloaded as a part of the ubuntu-desktop meta package - so if you've missed that package, try installing it. You should also have the `unity-greeter` packaged. It should drop right into place after installing.
You might need to manually switch to lightdm:
* How can I make LightDM the default display manager? | stackexchange-askubuntu | {
"answer_score": 5,
"question_score": 5,
"tags": "11.10, themes, lightdm"
} |
Which between random forest or extra tree is best in a unbalance dataset?
I have an unbalanced dataset, with 3 classes, with 60% of class 1, 38% of class 2, and 2% of class 3.
I don't want to generate more examples of class 3, and I cannot get more examples of class 3.
The problem is that I need to choose between RandomForest, and ExtraTree (this is homework), and explain why I choose one of these.
So I choose the Random Forest classifier, but I am not sure if my assumptions are right or no.
I choose that, because, the split of extra tree is random, so the probabilities of the pick some examples of class 3 are low, and because I think (this is the real question) that because Random is more high-variance than Extra tree, can be more useful because the high variance can help with the dataset is unbalance.
So are this two assumption especially the last one, correct? I choose correctly random forest over extra tree?
Thanks | Both Random Forest Classifier and Extra Trees randomly sample the features at each split point, but because Random Forest is greedy it will try to find the optimal split point at each node whereas Extra trees selects the split point randomly.
I would choose _Random Forest_ because it's more likely to create a split point that accounts for the imbalanced class, whereas Extra Trees might keep splitting over and over again on a subset of the data without separating out class 3 due to the random split point. | stackexchange-datascience | {
"answer_score": 3,
"question_score": 2,
"tags": "machine learning, class imbalance, variance, bias"
} |
На чем сделан интерфейс в программе Kaspersky antivirus?
Хочу вас спросить, я недавно увидел на википедии, что Kaspersky написан на c++, скажите пожалуйста, как они создали интерфейс? WinApi, Qt, или что-то другое? | Графический интерфейс последнего KIS (2019) написан с использованием .NET и WPF. Ядро, наиболее вероятно, написано на C++. Не знаю почему, но я считал, что интерфейс написан на Qt. Вероятно, раньше так оно и было. | stackexchange-ru_stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "c++, интерфейс, kaspersky"
} |
Geoexplorer displays the layers I import, but not the table behind them
If I import layers into GeoSrver, they display in GeoExplorer, and I can use the identify tool to find more info about areas of the layer I select. However the table from which this data comes from does not show at the bottom of the screen, as it does for existing example layers. I assume there is a setting somewhere to enable this? | I assume you are using the latest opengeo geoexplorer release, which has a built-in query panel. The fact that you are able to use identify & sld styling indicates that the layer is queryable. What kind of layer is this? Postgis, shapefile? Is it in the same store as the demo data? Are you able to catch any exceptions using firebug?
Also, check if the correct Namespace URI is used in the wfs requests. | stackexchange-gis | {
"answer_score": 0,
"question_score": 0,
"tags": "geoserver, table, geoexplorer"
} |
How do you include fields values in MDT packages?
I have created a Custom Metadata Type, created some records ("Manage" button) and included it into a Change Set. When I deploy the CS, I only get the structure of the MDT not its values... I though it was the point?
Not surprisingly, when taking a look at the package from an Ant perspective, I can see that my package only contains the object description and nothing about the records I have created... What needs to be added to be able to deploy it all (MDT + records) in one go? | You can deploy custom metadata records in changesets, but you have to add them to the changeset (which is different from just adding the type). In the "Component Type" dropdown, look for the name of your custom metadata type (In Summer 15, the Api Name; in Winter 16 it's the label).
Every custom metadata will itself appear in the drop down .
 {
return (
<vic.VictoryChart>
<vic.VictoryBar
data={[
{ x: 0, y: 100 },
{ x: 1, y: 150 },
{ x: 2, y: 200 },
{ x: 3, y: 50 },
{ x: 4, y: 500 },
]}
labelComponent={
<vic.VictoryLabel text={d => d.y} />
}
/>
</vic.VictoryChart>
);
}
Can someone PLEASE give me an idea of the problem here? I have no idea why I'm getting the error! | The Victory docs say:
> The labelComponent prop takes a component instance which will be used to render labels for the component
You still need to define the labels separately using the `labels` prop of `VictoryBar`. The purpose of `labelComponent` is to further customize things like positioning or add tooltip labels.
An example from the docs:
<VictoryBar
data={sampleData}
labels={(d) => d.y}
style={{ labels: { fill: "white" } }}
labelComponent={<VictoryLabel dy={30}/>}
/>
Here the `labelComponent` prop is used to move the y-axis of each label but we still have to define the label values with a separate prop. Hope this helps! | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "reactjs, typescript, react proptypes, victory charts"
} |
403 Error on an image I can view in browser
So when I try to use the image in an `<img>` tag I get a 403 error.
`<img src=" height="444px" width="300px" style="margin:0px auto;"/>`
But when I open the image in a browser(even incognito so I'm signed out of everything) It appears fine. | <img src=" style="margin:0px auto;height:444px;width:300px"/>
Should work now. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -1,
"tags": "html, css, image, web, http status code 403"
} |
Consume Webservice in VS2010 using x.509 authentication
Google and stackoverflow seem to be silent on how to do this. I must be missing something but how do you get VS2010 to allow you to add a x.509 certificate and password to authenticate an SSL service reference so that you can add it to your project?
I am trying to connect to a webservice with an address similar to: <
It requires the x.509 cert and password retrieve the wsdl. This is easy to do in SoapUI, but I can't seem to decipher how to get this going in VS2010. | Okay, so for anyone else who may not know how certificates work in the Microsoft world, VS2010 uses whatever certs you have imported on your machine to try and authenticate. You have to go into IE>Internet Options>Content>Certificates and then import your certificate here. After that, VS2010 will automatically look there for a cert which matches the URL you are using for your wsdl. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 1,
"tags": "wcf, visual studio 2010, web services, x509"
} |
Spring Security и валидный ввод
Подскажите, Spring Security устанавливает какие-то ограничения на максимальную длину лога/пароля, если да то какие? И как их можно изменить? | Длинна пароля зависит от реализации, которую вы выбрали для шифрования. Они достаточно велики, чтобы беспокоиться об ограничении с верху.
Например, для стандартной реализации BCrypt есть лимит в 72 символа, после которого добавление новых символов не приводит к изменению генерируемого хэша. | stackexchange-ru_stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "java, spring, spring security"
} |
"And you?" or "And yourself?" as response to "How are you?"
If someone asks "How are you?", which of the following is grammatically correct?
"I am well, thank you. And you?" or "I am well thank you. And yourself?"
'Yourself' sounds more formal, and is used frequently in everyday language (at least in my surroundings). However, I've been doing a little bit of investigation into the use of my vs myself and you vs yourself and it seems that it is only used reflexively to reflect back to 'you' or 'me' as the subject. E.g., you hurt yourself. In the case of "and you/yourself?", you/yourself is being used as the subject, in which case it would seem that the correct version would be "And you?".
Any clarification on this would be great! | Either of these is fine, although if you're going to use _and_ there should be a comma. The second sentence has a silent _you_ in it, referring back to the fact that it was the original person who asked first and is being thanked.
> I am well, thank you, and you?
>
> I am well, thank you, and (you) yourself?
However, asking, "How are you?" may well be derived from an old greeting, "How do you do?"
According to Stephen Fry, the only correct response to "How do you do?" is, "How do _you_ do?". Since Stephen Fry is, of course, the authoritative source of all things English, perhaps we're both wrong. | stackexchange-english | {
"answer_score": 4,
"question_score": 4,
"tags": "pronouns, greetings, reflexives"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.