INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
a question about how to use 'the' Which way is correct? 1. For the 5th,7th and 8th sets of parameters 2. For the 5th, the 7th and the 8th sets of parameters Thanks!!
This is correct: > For the 5th,7th and 8th sets of parameters
stackexchange-english
{ "answer_score": -3, "question_score": 0, "tags": "vocabulary" }
mongoose $inc is not working would like to insert value increment by one I am trying to increment view field by one always when it hit this api but does not work error : Posts validation failed: view: Cast to number failed for value view: { type: Number, default: 0 }, async request(req, res) => { const post = await PostsModel.findOne({ _id: post_id }); post.view = { $inc: { view: 1 } }; await post.save(); }
In your way, you need to do `post.view = post.view + 1` instead of `post.view = { $inc: { view: 1 } };` because it will set the `view` field to be the object `{ $inc: { view: 1 } }`. Or if you want to use `$inc`, you need to make an **update operation**. Something like: await PostsModel.findOneAndUpdate({ _id: post_id }, { $inc: { view: 1 } });
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "mongodb, mongoose" }
Magento, how to get price array from grouped products? I am looking to retrieve an array with all of the final_prices for a grouped product. The goal is to be able to use this information in product/view.phtml and display a price range that reads From: $25.00 - $899.00 I have been able to get the array somewhat working in price.phtml using: $prices = array ($_taxHelper->getPrice($_product, $_product->getFinalPrice())); print_r ($prices); This will give me the array, but in the price fields of each grouped item. I need to be able to get the data and then I am thinking to use php's min & max functions to get the values with ease and display the data as shown above. This data needs to be able to be used in the view.phtml file so this creates a bit more trouble. I have tried using price in view.phtml but it seems the function becomes quite unhappy outside of the price loop. Any help would be greatly appreciated! Cheers!
You could try this in view.phtml file: $prices = array (Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice())); print_r ($prices); Hope this helps!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, mysql, magento" }
Factor space norm calculation when the subspace is finite-dimensional Let $(X,\|\;\|_X)$ be a normed vector space and let $M$ be a closed finite-dimensional subspace of $X$. I want to prove that: $$ \forall x\in X\;\;\exists\;m\in M\text{ s.t. } \|[x]_M\|_{X/M}=\|x+m\|_X $$ I'm really lost with this one since I don't get at all what it says. The only thing I managed to do is that: $\big($If any doubt, $X/M=\\{[x]_M:x\in M\\}$ and $[x]_M=\\{y\in X:y\sim x\\}$, where $y\sim x \Leftrightarrow\;y-x\in M$$\big)$ $$ \|[x]_M\|_{X/M}=\inf\\{\|y\|_X:y\sim x\\}=\inf\\{\|y\|_X:y-x\in M\\}=\inf\\{\|y\|_X:y-x=m\;\text{ for }m\in M\\}=\inf\\{\|y\|_X:y=x+m\;\text{ for }m\in M\\}=\inf\\{\|x+m\|_X:\text{ for }m\in M\\} $$ and got stucked here. Any ideas, comments and suggestions would be appreciated.
Let $x\in X$ be arbitrary. Then $\|x-m\|\ge 0,\,\forall m\in M\Rightarrow \inf\limits_{m\in M}{\|x-m\|_X}$ exists. Let $\\{m_n\\}$ be a minimizing sequence, i.e $\|x-m_n\|\to \inf\limits_{m\in M}{\|x-m\|_X}$. Because the functional $J(m)=\|x-m\|$ is coercive over $M$ it follows that $\\{m_n\\}$ is bounded in $M$ and therefore contains a convergent subsequence $\\{m_{n_k}\\}$ to some element $m_0\in M$ (because $M$ is finite dimensional and closed). For this subsequence you get $$\|x-m_0\|=\lim\limits_{k\to\infty}{\|x-m_{n_k}\|}=\inf\limits_{m\in M}{\|x-m\|_X}=\|[x]\|_{X/M}$$ In the above equality, we used the fact that the norm is continuous.
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "analysis, functional analysis, convex analysis, convex optimization" }
kendo datepicker depth year last day I am trying to initialize a Kendo "datepicker" with the following options: $("#elementid").kendoDatePicker({ //... depth: "year" }); When I change month in the widget I would like to set in my view model the last day of the selected month (not, as by default, the first one). For instance: by selecting "January" the datepicker is set on "01/01/2013", but I would like it to return "31/01/2013" (the last day). Does somebody know how can i do it?
Define you `kendoDatePicker` as: $("#elementid").kendoDatePicker({ ... depth : "year", change: function (e) { var val = this.value(); this.value(new Date(val.setMonth(val.getMonth() + 1, 0))); } }); We handle the `change` event and use JavaScript for calculating the last day of the chosen date.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "datepicker, kendo ui" }
Monitoring us president promises between times Nominees for president elections make very promises. In action, after election, the resolute on the some promises; but about some others... Is there a media/NGO/... that Monitor us president promises time to time, e.g. every month/year?
CNN, Politifact, and Washington Post are tracking Trumps promises. Politifact also tracked Obamas promises. I am not aware of any trackers for other presidents. I'm also not sure how meaningful these really are (a president could have a lot of small, simple to fulfill promises, or may be unable to fulfill promises due to factors outside their control).
stackexchange-politics
{ "answer_score": 3, "question_score": 1, "tags": "united states" }
Negate match in RE2 syntax? How can I write a regex in RE2 for "match strings not starting with 4 or 5"? In PCRE I'd use `^(?!4)` but RE2 doesn't support that syntax.
You can use this regex: ^[^45] `^` matches start and `[^45]` matches anything but `4` or `5` at start.
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 10, "tags": "regex, re2" }
li attribute returns undefined I have a nav list on the side of my bootstrap page and I would like to grab the value of the custom attribute of each item each time it is clicked. I have tried numerous various methods but I can't seem to figure out why the attribute keeps returning undefined. Here is some sample HTML: <ul id="list" class="nav nav-list"> <li class=""><a href="#" myval="firstValue">Item 1</a></li> <li class="active"><a href="#" myval="secondValue">Item 2</a></li> </ul> And here is the jQuery: $('#list').on('click', 'li:has(a[href^="#"])', function () { var currentVal= $(this).attr('myval'); alert(currentVal); });
Your custom attribute isn't on the LI. You have to get the attribute from it's child. var currentVal= $(this).children('a').attr('myval');
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "jquery, html, twitter bootstrap" }
Toggling a bool value is being flagged in the Visual Studio IDE Take this simple code: void CChristianLifeMinistryEditorDlg::OnOptionsAddTimeToConcludingComments() { BOOL bAddTime = CChristianLifeMinistryUtils::AddRemainingTimeToConcludingComments(); bAddTime = !bAddTime; CChristianLifeMinistryUtils::SetAddRemainingTimeToConcludingComments(bAddTime); UpdateMenuGUI(); SetModified(true); } The `!bAddTime` is being flagged: ![enter image description here]( It says: > Using logical '!' when bitwise '~' was probably intended. I have used this technique before to toggle boolean values it appears to operate correctly. So why the warning? It is not related to Visual Assist.
Simply change BOOL bAddTime = ... to bool bAddTime = ... I guess the static code analysis gets confused by `BOOL` being a type alias for `int`.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "visual c++, mfc, visual studio 2019, boolean expression" }
SQL CONVERT and FLOOR query What is the difference between these two queries? Why do they give different results? **Query 1** DECLARE @test nvarchar SET @test = CONVERT(nvarchar, FLOOR(10.5)) SELECT @test Results: ['1'] **Query 2** SELECT CONVERT(nvarchar, FLOOR(10.5)) Results: ['10']
DECLARE @test nvarchar That's 1 character long so truncates its assigned value; add a (size)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "sql, tsql, floor" }
Absolute Value Inequalities with Two Branches please treat my brackets as absolute value bars, or fix my formatting - I'm new here :) Q: $2 < |2x-3| < 7$ I tried to break it up, $2 < 2x-3 < 7$ $5 < 2x < 10$ $5/2 < x < 5$ Other branch, $2 < -2x+3 < 7$ $-1 < -2x < 4$ $1/2 > x > -2$ $-2 < x < 1/2$ How do I solve this? My answers are wrong?
### By the definition of absolute function we get: $|2x-3| = \max(2x-3, -(2x-3))$ ### What does it mean? Examples: 1). $x=1 \Rightarrow |2\cdot1 -3| = |-1| = \max(-1,-(-1)) =-(-1) = 1$ 2). $x=2 \Rightarrow |2\cdot2 -3| = |1| = \max(1,-(1)) = 1$ As you can see, if $2x-3\ge 0$, the absolute function chooses $2x-3$, and if $2x-3<0$ it chooses $-(2x-3)$ to make it a positive value. ### So, how can we know if $2x-3 < 0$ or $2x-3 \ge 0$? We can't, because the possible values for $x$ are all the numbers in $\mathbb{R}$. that's why we have to branch the solution. ### The solution ## $2<|2x-3|<7$ 1). $2x-3< 0 \Rightarrow 2<\max(2x-3,-(2x-3)) < 7 \Rightarrow 2<-(2x-3) < 7$ $\Rightarrow 2< -2x+3 < 7\Rightarrow -1<-2x<4 \Rightarrow \frac{1}{2}>x>-2$ 2). $2x-3\ge 0 \Rightarrow 2< \max(2x-3,-(2x-3))<7 \Rightarrow 2<2x-3<7$ $\Rightarrow 5<2x<10\Rightarrow 2\frac{1}{2}<x<5$ So, $2\frac{1}{2}<x<5$ **or** $\frac{1}{2}>x>-2$.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "algebra precalculus, absolute value" }
Are the memory mapped IO address(es) of a device mapped to the kernel space of a process? Say that I have a device that uses memory mapped IO. And we know that in Linux, each process have 3 GB of user space, and 1 GB of kernel space. Now I assume that the address(es) for this device will be mapped to the kernel space of a process, so that a process (which is running in user mode) cannot access the device. Am I correct?
> Now I assume that the address(es) for this device will be mapped to the kernel space of a process, so that a process (which is running in user mode) cannot access the device. Am I correct? Mostly. Since devices exist in physical memory, they can be mapped to multiple virtual addresses. An appropriately privileged userspace application can use `mmap()` on `/dev/mem` to remap portions of I/O memory into its address spce.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "linux, assembly, x86, operating system" }
How do I apply a patch from gist to the Django source? I want to try out a patch on gist that modifies the source code of Django: gist: 550436 How do I do it? I have never used git so a step by step instruction would be greatly appreciated.
You can use `patch` to apply diffs. Make sure you're in your django source directory (or wherever you want to apply the patch), and run something like `patch -p1 < downloaded-patch.diff`. You may want to experiment with the `-p` argument if it fails; -p tells `patch` to strip some of the directory prefix for each file in the diff (look at the first line in the diff).
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 2, "tags": "python, git, github, patch" }
How to fill entire browser window on initial load How would I fill the entire browser window with the dark brown color. Right now, the top of a YouTube video is clipping the bottom. To better understand what it is I'm describing, I'll attach at picture.![enter image description here]( On the initial page load, I do not want to see the top of YouTube video, but just the brown background.
Something like this should work: <div class="mask"></div> .mask { position: fixed; width: 100vw; height: 100vh; z-index: 11; background-color: brown; }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "javascript, html, css, reactjs" }
When does a Sequelize (ORM) instance method need `sequelize.` to refer to a different model and when not? Suppose inside a model you have the following Sequelize instance method: const Admins = require("./admin"); Organization.prototype.getAdmins = function () { // option 1 return Admins.findAll({ where: { organization_id: this.getDataValue("id") } }); // option 2 return sequelize.Admins.findAll({ where: { organization_id: this.getDataValue("id") } }); }; Sometimes I see it written as option 1 and sometimes as option 2. When do you need which option? That is, when do you need to prepend `sequelize.` before the model that you are referencing?
It depends on what you import in a certain model file: `sequelize` instance or an initialized model (that also should be initialized using `sequelize` instance). The goal is to access needed model to call its methods like `findAll`. It's up to you what approach to use but I'd recommend to access all models from `sequelize` instance or from your own object that will store all initialized models (see my answer here).
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "node.js, sequelize.js" }
How to prevent cached binaries to get deleted on file system in DXA? Knowing the fact that DXA expects all items including binaries to be published to the CD Broker database and it will cache binaries on file system of the web application server. But if we do a new EAR deployement, these cached binaries will get deleted. **Question** : Kindly suggest how to retain these cached binaries as it is, after a new deployment? So that we can reduce the DB hits. **Update:** If we do a new deployment too then those cached binaries will get deleted. So if anyone try to access these files, again application will hit the DB to fetch the binary and then it will get cached for next request. To avoid this DB hits only i am looking for a suggestion if any how we can prevent cached binaries to get deleted.
**Option1:** Try to use the persistent storage mapping in your web app, for example, try to use EFS (NFS storage) symbolic or soft link folder map to your web application for **BinaryData** folder so that every time if you do deployment it will not be getting deleted images folder. **Option2:** Alternatively, a possibility OOTB you could also achieve this by publishing the binaries to the filesystem and create custom DXA BinaryProvider and use to get the images from filesystem directly without CIL and database calls. I hope it helps
stackexchange-tridion
{ "answer_score": 2, "question_score": 1, "tags": "dxa, publishing, dxa java, binary" }
$L^p$ convergence proof check I don't have much experience with measure theory, so I want to make sure that I'm not making any bad mistakes. I also want to be sure that the theorem is true so I can use it. **Theorem:** Let $\\{u_i\\}$ be a Cauchy sequence in $L^p(U)$. Then for all $\epsilon>0$, there exists an $N$ such that $|u_i(y)-u_j(y)|<\epsilon$ almost everywhere in $U$ for all $i,j>N$. Proof: Suppose not. Then there exists an $\epsilon$ such that for all $N$ there is an $i,j>N$ such that $|u_i(y)-u_j(y)|\ge \epsilon$ for $y\in S \subset U$ with $\mu(S)>0$. Since $\\{u_i\\}$ are Cauchy in $L^p$ we have $\int_U |u_i(y)-u_j(y)|^p < |S|\epsilon^p$ for $i,j>M$. But $|S|\epsilon^p = \int_S |u_i(y)-u_j(y)|^p \le \int_U |u_i(y)-u_j(y)|^p$, a contradiction. Thank you in advance.
Your theorem is wrong (you proved convergence even in $L^\infty(U)$). The problem in your proof is, that your set $S$ (and, hence, it's measure) depends on $i,j$. Therefore, you can't choose $M$ as desired.
stackexchange-math
{ "answer_score": 3, "question_score": 1, "tags": "measure theory, convergence divergence, lp spaces" }
C# converting a decimal to an int safely I am trying to convert a decimal to an integer safely. Something like public static bool Decimal.TryConvertToInt32(decimal val, out int val) this will return false if it cannot convert to an integer, and true w/ successful output if it can. This is to avoid catching the OverflowException in decimal.ToInt32 method. What is the easiest way to do this?
Here: public static bool TryConvertToInt32(decimal val, out int intval) { if (val > int.MaxValue || val < int.MinValue) { intval = 0; // assignment required for out parameter return false; } intval = Decimal.ToInt32(val); return true; }
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 11, "tags": "c#, decimal" }
What does 出来になる mean? I saw it used and don't understand it. Here's the usage: > Any translation of () I can think of sounds nonsensical. Could someone point me in the right direction?
The means []{}, , , etc. // means //. I think it's like: "(Something) was so well-made that it could~~" "The quality (of something) was good enough to~~"
stackexchange-japanese
{ "answer_score": 2, "question_score": 0, "tags": "translation, meaning" }
Show the Items in the Folder location and not the full directory I have an array with of folders in a Directory. I want them displayed in the combo-box but I don't the full directory to display, I just want the folder names in the directory. I haven't been successful with what I have tried MY CODE string[] filePaths = Directory.GetDirectories(@"\\Mgsops\data\B&C_Poker_Builds\Release_Location\Integration\SDL\SP\Prima\"); ProjectDir.DataSource = filePaths; ProjectDir.SelectedItem.ToString(); MY RESULT ![enter image description here](
Look at the DirectoryInfo class - you can do something like this: string folder = new DirectoryInfo(path).Name; To get an array (using System.Linq), you could do the following: string[] filePaths = Directory.GetDirectories("<yourpath>").Select(d => new DirectoryInfo(d).Name).ToArray(); Or, even use the DirectoryInfo class to enumerate your directories: DirectoryInfo dir = new DirectoryInfo("<yourpath>"); string[] filePaths = dir.GetDirectories().Select(d => d.Name).ToArray();
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c#, getdirectories" }
How to use React Moment Use fromNow in element title? I am using the `react-moment` library and I am having a hard time figuring out how to set the title as follows. <Moment title={<Moment>{createdAt}</Moment>} format="MMM DD, YYYY">{createdAt}</Moment> # Output `<time datetime="1389364532000">Jan 10, 2014</time>` # Looking for? `<time datetime="1389364532000" title="6 years ago">Jan 10, 2014</time>`
Not familiar with react-moment (it is not updated in the last 6 months -> red flag for any js library), and I am not sure why would you need it? The original moment.js which you can use by by `const moment = require("moment")` can do this just by doing <time datetime={moment().format("x")}, title={moment().fromNow()}> {moment().format('...whatever')} </time> Also I am not sure what does the html time tag `<time/>` has to offer above a normal div?
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "reactjs, momentjs" }
Export joomla user with same password I am merging a small group on sort of site with my joomla site. I already have members in my joomla site so I somehow want to migrate the users of joomla to groupon database which uses a different encryption scheme for password. Is there a way to do that?
You would have to have the unencrypted passwords to be able to use that. There is no conversion from one encryption scheme to another.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "joomla, migration, export" }
Alternative to positive lookbehind regex I am working with Prism.js for syntax highlighting and I have a regex for detecting Kotlin infix function `(?<=\w\s)(\w+)(?=\s\w)` (< which uses a positive look ahead and a positive look behind, however this does not work on Safari browsers which breaks my entire website. I have seen alternatives that involve using the matcher but I don't have that option as I can only provide the regex, for example: "infix": [ { pattern: /(?<=\w\s)(\w+)(?=\s\w)/, }, ], Is there an alternative to this that would work on Safari?
If you can only provide a regex and the whole match value is highlighted, there is no way to mimic the current lookbehind pattern. The best you could think of is a regex like `/\b\s(\w+)(?=\s\w)/` that would also highlight the leading whitespace (unless there is an option to highlight only some group value). If you can tweak the inner code, you could use a group replacement: find `/(\w\s)(\w+)(?=\s\w)/` and replace with `$1<span class="highlight">$2</span>`.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "regex, safari, positive lookbehind" }
How to disable functionality of <a href> I want to disable this: <a href="javascript:void(0);" role="button" onclick="edit_user('<?php echo $data['user_id']; ?>')"><i class="glyphicon glyphicon-pencil"></i> when user_id = 1. Can someone help me?
You could check in php for $user_id ==1 and echo the code you need <a <?php echo ( $user_id ==1 ) ? '' : 'href="javascript:void(0);"' ?> role="button" onclick="edit_user('<?php echo $data['user_id']; ?>')"> <i class="glyphicon glyphicon-pencil"></i> </a>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, jquery, mysql" }
Type Conversion in Informix 4GL I want to convert a variable of type `VARCHAR` to `INTEGER` and vice versa (i.e. from `INTEGER` type to `VARCHAR`) in Informix 4GL.
DEFINE v VARCHAR(20) DEFINE i INTEGER LET v = "12345" LET i = v DISPLAY "i = ", i, "; v = ", v LET i = 123456 LET v = i DISPLAY "i = ", i, "; v = ", v Easy, huh? You run into problems if the string can't be converted to a number (run time errors, etc). In essence, I4GL will automatically convert between types if it is possible, only generating an error if it is impossible. Some conversions are impossible. For example, I don't think you'd be able to convert a DECIMAL or INTEGER into an INTERVAL YEAR TO MONTH.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "informix, 4gl" }
How do I parse content with regular expression using jQuery? I am trying to use jQuery to break right ascension and declination data into their constituents (hours, minutes, and seconds) and (degrees, arc-minutes, and arc-seconds), respectively from a string and store them in variables as numbers. For example: $dec = "-35:48:00" -> $dec_d = -35, $dec_m = 48, $dec_s = 00 Actually, the data resides in a cell (with a particular class ('ra')) in a table. At present, I have gotten this far: var $dec = $(this).find(".ra").html(); This gives me the declination as a string but I cannot figure out how to parse that string. I figured out the regular expression `(-|)+\d+` (this gives me -35 from -35:48:00) to get the first part. How do I use that in conjunction with my code above?
This should do it: var dec = '-35:48:00'; var parts = dec.split(':'); `parts[0]` would then be `-35`, `parts[1]` would be `48`, and `parts[2]` would be `00` You could run them all through `parseInt(parts[x], 0)` if you want integers out of the strings: var dec_d = parseInt(parts[0], 10); var dec_m = parseInt(parts[1], 10); var dec_s = parseInt(parts[2], 10); I should point out this really has nothing to do with jQuery and is a Javascript problem (past getting the values out of the HTML document, at least) - The practice of prefixing a variable with a `$` is usually done to signify that the variable contains a jQuery collection. Since in this situation it contains HTML, it is a little misleading
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "javascript, jquery, regex" }
Number Appears after Array Stored in SESSION I'm doing a print_r on a array stored on a session variable and for some unknown reason it's adding a number after the array prints. Example: Array ( [0] => 868 [userid] => 868 ) 1 If I do a print_r directly in the function itself and before the variable gets stored on session variable, it doesn't add that number 1. Solution: Almost at the same time as Paolo answered my question correctly I found the causing code. A simple echo on print_r
Can you post the code you are using to do this around `print_r`? The most common reason for getting a 1 is when you try to print a boolean: $my_bool = true; print $my_bool; // will be printed as 1 print_r($my_bool); // will also be printed as 1
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "php, arrays, session" }
Remove Backtick From String I am using the npm 'mysql' for a Node app I am working on. At one point that app saves a link to a table. In order to add the link to the table I have to use the npm's escapeId() function. My issue is that when I got to retrieve that link from the database I get something like this: '` I am not having an issue splitting the string at the period. I am having an issue getting rid of the backticks. Any suggestions? Using the npm or any other method. Thanks,
Use replace to remove the unwanted characters. var newStr = '` "");
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 1, "tags": "javascript, mysql, node.js" }
Asp.net Mvc Routing problem * * * alt text **Global.asax Code:** routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "article", action = "article", id = UrlParameter.Optional } // Parameter defaults ); I want to use url routing like this: www.domainname.com/Article/123/bla_article how can ı do this ? This work: www.domainname.com/article/article/123 this not work: www.domainname.com/article/123 please Help
Like this: routes.MapRoute( "Article", "Article/{id}", new { controller = "article", action = "article", id = UrlParameter.Optional } );
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "asp.net, asp.net mvc" }
Metric spaces in which the only open sets are empty set and the full set > What are the metric spaces in which the only open sets are the empty set$(\emptyset)$ and the full set$(X)$? **My attempt** : If $X=\emptyset$ then the above statement is trivially true. Suppose $(X\ne\emptyset,d)$ is a metric space in which the only open sets are $\emptyset$ and $X$, then $x\in B(x,r)=\\{y\in X|d(x,y)<r\\}$ for any $r>0$. $B(x,r)\ne \emptyset$, which implies $B(x,r) = X$. If $X$ contains only one element then our claim is true. But if it has more than two elements, say $x,y\in X$, we have two distinct points, we should be able to find an open ball around one of them that does not contain the other(Hausdorff property of metric spaces). Hence we will have an open set which is neither $X$ nor $\emptyset$. A contradiction to our statement. Hence **(X,d) is a metric space which contains at most 1 element** Is the above proof correct?
Yes, you're correct: if there are two points or more, there is an open ball that is not empty nor $X$: if $x \neq y$ are two points of $X$, set $r=d(x,y)>0$ and $x \in B(x,r), y \notin B(x,r)$. So $\emptyset \neq B(x,r) \neq X$.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "metric spaces, solution verification" }
How do I select only an image that's NOT inside a link when both are inside the same ID? I have some code that I can't alter that's like this: <div id="wombat"> <a href=""><img src="a"></a> <img src="b"> </div> I want to only target img b. #wombat img {blah} is getting both of them. I know that #wombat a img would target only img a, but is there a way to do just img b? Thank you!
You can use the sibling or the descendant operator, depending on what you want to achieve: #wombat > img { /* any images that reside directly below #wombat, without any more levels in between */ } a ~ img { /* any image that follows as a sibling to an anchor */ } a + img { /* an image that follows as direct sibling to an anchor */ } See: * < (`>`) * < (`~`) * < (`+`)
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 3, "tags": "html, css" }
Grid-like dataframe to list I have an excel dataset which contains 100 rows and 100 clolumns with order frequencies in locations described by x and y.(gird like structure) I'd like to convert it to the following structure with 3 columns: x-Coördinaten | y-Coördinaten | value The "value" column only contains positive integers. The x and y column contain float type data (geograohical coordinates. The order does not matter, as it can easily be sorted afterwards. So,basicly a merge of lists could work, e.g.: [[1,5,3,5], [4,2,5,6], [2,3,1,5]] ==> [1,5,3,5,4,2,5,6,2,3,1,5] But then i would lose the location...which is key for my project. What is the best way to accomplish this?
Assuming this input: l = [[1,5,3,5],[4,2,5,6],[2,3,1,5]] df = pd.DataFrame(l) you can use `stack`: df2 = df.rename_axis(index='x', columns='y').stack().reset_index(name='value') output: x y value 0 0 0 1 1 0 1 5 2 0 2 3 3 0 3 5 4 1 0 4 5 1 1 2 6 1 2 5 7 1 3 6 8 2 0 2 9 2 1 3 10 2 2 1 11 2 3 5 or `melt` for a different order: df2 = df.rename_axis('x').reset_index().melt('x', var_name='y', value_name='value') output: x y value 0 0 0 1 1 1 0 4 2 2 0 2 3 0 1 5 4 1 1 2 5 2 1 3 6 0 2 3 7 1 2 5 8 2 2 1 9 0 3 5 10 1 3 6 11 2 3 5
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, pandas, list, merge" }
Url rewriting issue on azure I have a subdomain, test1.test.com, i want to do a url rewriting on that subdomain to rewrite all requests to point other domain. For example i want to rewrite all request to test1.test.com to point < here is my rewrite rule. <rewrite> <rules> <rule name="Rewrite sample"> <match url="(.*)" /> <action type="Rewrite" url=" /> </rule> </rules> </rewrite> the result is not what i expected. "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
It's not possible to rewrite to another domain. Rewrite deals only with the last part of the url (after the domain) so the only way to change domain is to use redirect like this: <rewrite> <rules> <rule name="Test" stopProcessing="true"> <match url="test1.test.com" /> <action type="Redirect" url=" </rule> </rules> </rewrite>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "asp.net, azure, url rewriting" }
Expectation of square root of binomial r.v. Let $X\sim B(n,p)$ denote a binomial random variable. Is there any approximation available for the quantity $E(\sqrt{X})$? Clearly Jensen's inequality holds, but rudimentary tooling around with Maple hasn't turned up anything more substantial.
$\newcommand{\E}{\mathbf{E}}$ $\renewcommand{\P}{\mathbf{P}}$ $\DeclareMathOperator{\var}{Var}$ If we use Taylor expansion (as Anthony suggested) for $\sqrt{x}$ around 1, we get: $$\sqrt{x}\approx 1 + \frac{x-1}{2} - \frac{(x-1)^2}{8} .$$ We can use this to get an approximation of $$\E(\sqrt{X})\approx 1-\frac{\var(X)}{8} ,$$ which should be valid for any RV concentrated around an expectation of 1. Equivalently, $$\E(\sqrt{X})\approx \sqrt{\E(X)}\bigg(1-\frac{\var(X)}{8\E(X)^2}\bigg) ,$$ for any RV concentrated around its mean. As you noted, we can use Jensen inequality to get $\E(\sqrt{X})\le \sqrt{\E(X)}$ for any nonnegative RV. We can tweak the Taylor expansion to get a lower bound, by noticing that $$ 1 + \frac{x-1}{2} - \frac{(x-1)^2}{2} \le \sqrt{x} \ .$$ Hence, we get $$\sqrt{\E(X)}\bigg(1-\frac{\var(X)}{2\E(X)^2}\bigg) \le \E(\sqrt{X}) ,$$ for any nonnegative RV. In the case of $X\sim Bin(n,p)$ we get $$ \sqrt{np}-\frac{1-p}{2\sqrt{np}} \le \E(\sqrt{X})\le \sqrt{np} .$$
stackexchange-mathoverflow_net_7z
{ "answer_score": 18, "question_score": 12, "tags": "pr.probability" }
Expectation of Absolute Deviation From Mean Consider a random variable $X$ and $E[|X|] < 1$. Hence, its expectation $E[X]$ exists. Let us denote $\mu_X := E[X]$ for notational simplicity. The absolute deviation from the mean is $|X-\mu_X|$, and its expectation is denoted as $d_X := E [|X-\mu_X|]$ a) Show that $d_X ≤ \sigma_X$, where $\sigma_X$ denotes the standard deviation. b) Let $X$ be a Gaussian random variable. Derive $d_X$ in terms of $\sigma_X$. c) Let the PDF of $X$, $f_X(t)$, is proportional to $e^{-\lambda|t|}, \lambda>0$ . Derive $d_X$ in terms of $\sigma_X$. I found this question very confusing. From what I learned at class $E[X-\mu_X]=0$. How come in this question it is not equal to $0$ ?
$E[X-\mu_X]$ is $0$ but $d_X=E|X-\mu_X|$ is not $0$ unless $X$ is a constant. Part a) is an immediate apllication of Holder's / C-S inequality: $E|X-\mu_X| \leq \sqrt {E(X-\mu_X)^{2}}=\sqrt {var (X)} =\sigma_X$. For b) let $Y=\frac {X-\mu_X} {\sigma_X}$ Then $Y \sim N(0,1)$ so $d_X=E|X-\mu_X|=\sigma_X E|Y|$. You can calculate $E|Y|$ from the formula $E|Y| =\int_{\mathbb R} |x|\frac 1 {\sqrt {2 \pi}} e^{-x^{2}/2} dx$. [$E|Y|=\frac 2 {\sqrt {2\pi}}$]. c) $f_X(t)=\frac {\lambda} 2 e^{-\lambda |t|}$. [The constant is derived using the fact that $f_X$ integrates to $1$]. Note that $\mu_X=0$ in this case. Hence $d_X=\frac {\lambda} 2 \int |t|e^{-\lambda |t|}dt=\frac 1 {\lambda}$. I will let you evaluate this integral. The variance $\sigma_X$ in this case $\frac 2 {\lambda^{2}}$. [This is standard. You can prove it using integration by parts]. Hence $\sigma_X=2d_X^{2}$ or $d_X=\sqrt {\sigma_X/ 2}$
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "probability, expected value, means" }
Is it an offence to ignore a portable traffic light This is a question about laws regarding traffic lights in the UK. When companies are carrying out works on or near roads they sometimes put up their own lights to control traffic and keep it flowing. Is it an offence to ignore the lights, or do they hold the same authority as permanent traffic lights? ![enter image description here](
Portable signs are legal and you have to obey then. < <
stackexchange-law
{ "answer_score": 4, "question_score": 0, "tags": "traffic, england and wales" }
best_in_place not saving So, I'm using the best in place gem to allow users to edit their photos caption in place. However, the text that is entered isn't being saved or stored in the database. Here is a snapshot of the schema relevant to this area: create_table "photos", force: true do |t| t.string "file" t.integer "attachable_id" t.datetime "created_at" t.datetime "updated_at" t.string "attachable_type" t.string "title" t.text "description" t.boolean "profile_photo", default: false end and here's the view code: <p class="summary-info"><%= text_field photo, :description, placeholder: 'Add a description...' %></p> What am I doing wrong? **Update:** <p class="summary-info"><%= best_in_place photo, :description, type: :textarea, nil: 'Enter a Caption' %></p>
Your aren't using the `best_in_place` helper method into the view. Check out the README or the Railscasts #302. You must do something like that: <%= best_in_place @photo, :description, type: :input %> Adjust it to your needs. FYI: `text_field` is a helper method provided by Rails.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ruby on rails, ruby" }
Which is better: letting Java do autoboxing or using valueOf() I am just wondering is there any difference in letting java autobox say an integer: Integer myInteger = 3; // This will call Integer.valueOf() or having your code as Integer myInteger = Integer.valueOf(3); Is there any micro optimization on this? I know the second one is more explicit, but it is also more unnecessary typing, is there any difference besides this?.
They are equal anyway internally, so use the first variant. Chances are good, that future compiler optimizations may make the first even faster in the future.
stackexchange-stackoverflow
{ "answer_score": 19, "question_score": 20, "tags": "java, performance, autoboxing" }
How to base 64 encode a dataframe in r As an example lets take `df <- head(iris)`. How would I encode this into a base64 string. I need it for the GitHub API content argument. At the moment I have been trying to use the `base64encode()` function but get the _" error in normalizePath"_.
Specifically for the GitHub API after some research the following code worked perfectly as it was able to decode and move the table to Github: df1<-charToRaw(paste(capture.output(write.table(Table, quote=FALSE, row.names=FALSE , sep=",")), collapse="\n")) base64_code<-base64enc::base64encode(df1) This was able to be placed in the content argument of the rest API to update the file.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "r, base64, github api" }
Find the same numbers from two array Hello to everyone please help me get the same numbers from two array with function. function getIntersect(arrF, arrS){ var arrF = [ 3, 5, 8]; var arrS = [1, 2, 3, 5, 8]; var nums = []; for ( var i = 0; i < arrF.length; i++ ){ for ( var j = 0; j < arrS.length; j++ ){ if ( i == j ){ nums.push(i); nums.push(j); return nums; } } } } document.write(getIntersect());
Here is the updated code, couple of updates: * added the parameters in function * put the return statement outside both the `for` loops * compare values instead of indexes * instead of pushing both the values, push only one (since they are same) var arrF = [3, 5, 8]; var arrS = [1, 2, 3, 5, 8]; var nums = []; function getIntersect(arrF, arrS){ for ( var i = 0; i < arrF.length; i++ ){ for ( var j = 0; j < arrS.length; j++ ){ if ( arrF[i] == arrS[j] ){ nums.push(arrF[i]); } } } return nums; } document.write(getIntersect(arrF, arrS));
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript" }
Transfer MFVideoFormat from RGB24 to any other supported format by encoder I need to use the encoder H264.aspx) but the problem is that encoder does not accept except a list of MFVideoFormat. > MFVideoFormat_I420 > > MFVideoFormat_IYUV > > MFVideoFormat_NV12 > > MFVideoFormat_YUY2 > > MFVideoFormat_YV12 The problem is that the samples from my camera are RGB24 what shall I do?
You have (at least) two options: 1. Transform (by yourself) your RGB24 samples (bitmaps) into NV12 (or other) samples before you pass them to the encoder. It is not that hard. There are examples: < 2. You can create an instance of Color Converter DSP (< and configure it's input to receive RGB24 samples and it's output to desired color space. Then you call ProcessInput() and ProcessOutput() to transform.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "ms media foundation" }
Can i add more numbers to my field number value in my collection? Is it possible to to add numbers to my total price on firebase collection? For example, I have collection called wallet and there is a field called pocketMoney with number. I want to update my pocketMoney with more values. Sorry for the bad explanation I can explain more.
I think you're looking for `FieldValue.increment`, which allows you to increment a value in the database without knowing its current value on the client. For all on this see the documentation on incrementing a numeric value, which also contains this JavaScript example: var washingtonRef = db.collection('cities').doc('DC'); // Atomically increment the population of the city by 50. washingtonRef.update({ population: firebase.firestore.FieldValue.increment(50) });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "angular, firebase, google cloud firestore" }
Create New Post link not showing in magento I am running magento on localhost and want to create new post. But new post link is not showing. Pages showing under Content > Pages. I can only create pages not posts. But according to this article i can create new post too. Please let me know how to add new post. ![Snapshot of content section](
Please read this doc. it will help you to run command and give you clear understanding of what it does. < php bin/magento setup:upgrade php bin/magento setup:static-content:deploy
stackexchange-magento
{ "answer_score": 0, "question_score": 0, "tags": "magento2" }
How are DOM/rendered html and Coded-Ui are related, can coded-ui test a web application without even considering how that page is rendered in DOM? I want to know how the coded-ui in web application utilizes DOM of that page. Or is it related to that page's rendered html is coming? Edited: If suppose i have a grid having rows and column and i want to capture any particular column in it, then do coded-ui takes the help of the rendered html in this process (id,tagname etc) ?
I used codedui jquery extensions available in NuGet here . Once you will add this dll as a reference you can make use ExecuteScript() method for running a jquery script inside coded-ui. Similary you can make use of other built in members.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "html, dom, coded ui tests" }
What are the different properties available in System.DirectoryServices.DirectorySearcher.PropertiesToLoad Everything I've googled just says you can add them as a string array, but doesn't say what the available options are. What are all the different properties that are available from Directory Services?
You can put **any** of the valid LDAP attributes into `PropertiesToLoad` \- see a list of all Active Directory attributes here \- what you need is the `Ldap-Display-Name` for each attribute you're interested in. Also: Richard Mueller has a site with lots of good info on AD and LDAP \- including Excel spreadsheets of the AD attributes (and also a mapping from the Active Directory User & Computer tool to the actual AD attributes being set on those various dialog screens.
stackexchange-stackoverflow
{ "answer_score": 18, "question_score": 11, "tags": "c#, active directory, directoryservices" }
System hangs on "Open document" right click context menu (Xubuntu) Ok I recently installed Xubuntu 11.10 and I enjoy working with it. However, one issue that really stresses me, is the following; When I open **Thunar** anywere, and right click to open the Context menu, all goes well. However, when I hoover over the "Open Document" option, the system hangs for about 10 seconds. During that 10 seconds, nothing happens and nothing can be done. I have googled quite a bit, but so far didn't find anything. I now know to add items to the Thunar menu, but that didn't solve anything. Any help is appreciated!
So I have found the answer, after a extensive search on the internet and some helpful topics on Thunar. For the "Create document" right click context menu, Thunar looks in your /home/templates folder. So if you have this folder filled with random stuff (like I did, icons, other folders, backgrounds), Thunar will try to load all those items and hang/stall. So the best solution, is to have your templates directory clean and only with a few necessary .odt, .doc or .txt extensions in it.
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 2, "tags": "11.10, xubuntu, thunar" }
How to pass data to dompdf? I need to pass data to my template of pdf : So I initialize my variable with 0 value but even that I have data in DB I get always 0 as final value; It's not because of DB because even if I do just $ProductProd +=1 I get 0 also $ProductProd = 0 ; foreach ($Products as $key => $Product) {​ $ProductProd += $Product->getNbrPaquet(); }​ ob_start(); $view=''; require($view); $html = ob_get_contents(); ob_get_clean(); $dompdf->loadHtml($html); $dompdf->setPaper('A4', 'portrait'); $dompdf->render(); $dompdf->stream('pdf.pdf',array("Attachment" => 0)); Any one can help??
$view=''; require($view); Maybe you want to require a real view such as file called `require('view.php');` here ?
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, zend framework, dompdf" }
BitVector operations impossible I want to perform an xor operation on two BitVectors. While trying to turn one of the strings into a bitVector to then proceed into the xor operation, I get the following error: ValueError: invalid literal for int() with base 10: '\x91' How can I bypass this problem? I just want to xor two expressions, but one of them is a string, and it needs to be turned to a bitvector first right? However, trying to turn the string into BitVector is giving the error above. to_be_xored = BitVector.BitVector(bitstring= variable) where variable is the string, and to_be_xored is the desired Bitvector.
`bitstring` is for sequences of `'0'`s and `'1'`s. To use text use `textstring` instead.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "python, python 3.x, bitvector" }
Do you use the debugger of the language to understand code? Do you use the debugger of the language that you work in to step through code to understand what the code is doing, or do you find it easy to look at code written by someone else to figure out what is going on? I am talking about code written in C#, but it could be any language.
Yes, but generally only to investigate bugs that prove resistant to other methods. I write embedded software, so running a debugger normally involves having to physically plug a debug module into the PCB under test, add/remove links, solder on a debug socket (if not already present), etc - hence why I try to avoid it if possible. Also, some older debugger hardware/software can be a bit flaky.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "language agnostic, debugging, complexity theory" }
socket.io disconnects when using breakpoints in client code What is the best way to debug my app that uses socket.io ? The app is working fine but when I set breakpoints in the app using the chrome dev tools, after a few seconds, the socket.io client disconnects from the server ( or the server closes the connection), probably because of the client being idle while I inspect my breakpoints .. What am I missing here ? How do you all use the chrome dev tools your apps that use socket.io ?
I disabled polling in transports and that seems to have done the trick. This is what my transports look like now. io.set('transports', ['websocket']);
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 3, "tags": "socket.io, google chrome devtools" }
Transparent water shader for EEVEE? I followed a simple "how to make water in EEVEE" tutorial on youtube, but I don't know how to make it transparent. My current node setup: ![enter image description here]( **Q:** How to get the water transparent?
For EEVEE: 1. Turn “Transmission” all the way up. 2. Turn alpha down to about 0.5 3. Set blend method to either hashed or blend.
stackexchange-blender
{ "answer_score": 3, "question_score": 1, "tags": "rendering, texturing, materials, eevee render engine, transparency" }
Running the CorDapp (based on spring webserver) nodes on separate machines How can I deploy and run Corda nodes of spring webserver based "Yo!CorDapp" example (< on separate machines? What are the configuration changes I need to implement in this regard.
As long as you are running each server on the same machine as the node it talks to, there shouldn't be any configuration required. Simply start the nodes on their separate machines, then start the webserver on each machine, with the application properties modified or overridden to point to that node's RPC port. Since the nodes are on separate machines, it's even possible to use the same RPC port for all nodes, since the IP address will differ.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "corda" }
Problem with installing pytorch with pip3: -f option requires 1 argument I am trying to install torch in linux with cuda version 11.1 I checked this: Start Locally | PyTorch It says that the code is pip3 install --user torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f However, this line gives this error -f option requires 1 argument Can someone help?
you must have missed ` use the below cmd pip3 install torch==1.9.0+cu102 torchvision==0.10.0+cu102 torchaudio===0.9.0 -f
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "linux, pip, pytorch, torch" }
How to track asynchronous scripts (that do not provide a callback)? We are testing a new kind of advertising method that does call scripts asynchronously but they DO NOT provide a callback for anything. We want to track the loading time of this new method after it has finished loading and written new elements into a div or something. Is the only way to do this to looking for a change in the number of children of this specific element via setTimetout()? What other do I have to do this? I missed an existing Stack Overflow answer to this question, I apologize in advance.
It appears there is an onload event for the script, and also an onreadystatechange event. IE uses the readystate event, others use onload. See article for details. < var script = document.createElement('script'); script.type= 'text/javascript'; script.async = true; script.onreadystatechange= function () { if (this.readyState == 'complete') complete(); } script.onload= complete; script.src = 'some.js';
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "javascript, asynchronous, tracking" }
Image Intervention URL Manipulation shows blank image I'm trying to use the url manipulation of the Image Intervention package to handle image via url this tutorial. But the browser returns an empty image like this: !error I changed these line in the config file: 'route' => 'imagecache', 'paths' => array( storage_path('app/images'), ), The url that I tried is like this: localhost:3500/imagecache/original/{file_name} And leave everything else the same So are there any steps that I'm missing? Thank you
I found the solution here. There are some blank spaces before the `<?php` tag in the `config/imagecache.php` file. Delete them and everything starts working fine
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, laravel, intervention" }
Partitioning $\mathbb R$ into sets such that no mutual points have distance $1$ I was trying to partition $\mathbb R$ into two sets $A, B$ such that for all $a\in A, b\in B$ we have $|a-b|\neq 1$. An obvious way to do it is to take $\mathbb Z$ and ${\mathbb R}\setminus {\mathbb Z}$. The other examples I found all consisted of one countable set and its complement. **Question.** Is there $A\subseteq {\mathbb R}$ such that both $A$ and $B:= {\mathbb R}\setminus A$ are uncountable, and for all $a\in A, b\in B$ we have $|a-b|\neq 1$?
Converting my comment to an answer: Choose any $X\subseteq [0,1)$ which is uncountable and for which $[0,1)\setminus X$ is also uncountable (for example, $X=[0,\frac{1}{2}]$). Then set $A := \\{n+x\colon n\in\mathbb{Z}, x\in X\\}$ and $B := \\{n+x\colon n \in \mathbb{Z}, x \in [0,1)\setminus X\\}$. It is easy to see that all solutions are of this form.
stackexchange-mathoverflow_net_7z
{ "answer_score": 6, "question_score": 1, "tags": "infinite combinatorics, partitions" }
Numbers arranged in a circle are painted blue or red. Prove that the sum of the red numbers is 0. Numbers are arranged around a circle and are painted either blue or red. Every red number is equal to the sum of its two neighbors (left and right) and every blue number is equal to half the sum of its two neighbors (left and right). Prove that the sum of the red numbers is equal to $0$. It's easy to prove that all numbers can't be red if they're not all $0$ and that if all numbers are blue they must all be equal, but I'm having difficulty going from here. I can't even find an example that fits our criteria. Any help is appreciated.
Subtract from each number half the sum of its neighbors (left and right) . This will make blue numbers equal to zero and red numbers half their initial value. The total sum on the other hand will also become zero, as the value of each number is subtracted exactly once (half from its left neighbor and half from its right). So we have zero plus half the sum of red numbers is equal to zero. Therefore the sum of red numbers is zero.
stackexchange-math
{ "answer_score": 5, "question_score": 4, "tags": "combinatorics" }
Necessity of auto-incrementing ID Every implementation of a credentials table I've seen has an auto-incrmenting id to to track users. However, If I verify unique email addresses before inserting into a mySQL table, than I can guarantee the uniqueness of each row by email address...furthermore I can access the table as needed through the email address.. Does anyone see a problem with this? I'm trying to understand why others don't follow this approach?
Those email addresses are much larger than 4 bytes, perhaps even worse for the storage engine they are variable length. Also one person might want two accounts, or might have several email addresses over time. Then there are the problems associated with case folding.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "mysql" }
Is this momentum and if so how is it derived? So I'm reading Susskind's "The Theoretical Minimum" and on pages 128 and 129, he has the following equations: First he starts with the Lagrangian for the system: $$L=\frac{1}{2}(\dot{q_1}^2+\dot{q_2}^2) -V(q_1-q_2)$$ Then he shows the following two derivations: $$\dot{p_1} = -V'(q_1-q_2)$$ $$\dot{p_2} = V'(q_1-q_2)$$ Where $V'$ is stated to be the derivative of $V$. The derivation itself is left as an exercise to the reader and I can't figure it out. In the previous chapter, he had defined the momentum as: $$p_i=\frac{\partial L}{\partial \dot{q_i}}$$ on page 124. But since $V$ does not depend upon either $\dot{q_1}$ or $\dot{q_2}$, equations 2 and 3 don't seem to follow from equation 1. Could someone show me what this derivation looks like? Or maybe $p$ means something else here.
I know knzhou already offered the proper answer in the form of a comment, but allow me to expand on it by showing a series of canonical relationships, not all of which are mentioned I believe in Susskind's book. Given the action $S=\int L~dt$, defined in terms of the Lagrangian $L(q,\dot{q})$, we have the following relationships: \begin{align} L&=\frac{dS}{dt},\\\ p&=\frac{\partial S}{\partial q}=\frac{\partial L}{\partial\dot{q}},\\\ H&=p\dot{q}-L=-\frac{\partial S}{\partial t},\\\ \dot{p}&=\frac{\partial L}{\partial q}=-\frac{\partial H}{\partial q},\\\ \frac{dH}{dt}&=\frac{\partial H}{\partial t}=-\frac{\partial L}{\partial t},\\\ \dot{q}&=\frac{\partial H}{\partial p}. \end{align} These can all be derived from the properties of the Lagrangian, the Euler-Lagrange equation, or the definition of the Legendre transformation that leads to the Hamiltonian.
stackexchange-physics
{ "answer_score": 1, "question_score": 0, "tags": "lagrangian formalism, momentum, hamiltonian formalism" }
How can I use methods defined in this delegate? I'm new to iOS development, and I'm playing with an interface trying to understand some concepts. The provided SDK(which is compiled and I can't do anything to it) has the following definitions: @class HRMonitor; @protocol HRMonitorDelegate - (void) hrmon: (HRMonitor*) mon heartRateUpdate: (double) hr; // And others @end @interface HRMonitor : NSObject <NSStreamDelegate>{ } -(id) init: (id) _delegate; -(void)startup; Does anyone have idea how can I use the `heartRateUpdate` method defined in the protocol `HRMonitorDelegate`? From what I read in the iOS Developer Library, I have to have an interface that conforms to the Delegate like `HRMonitor : NSObject <HRMonitorDelegate>` to call methods in the protocol. But that's not provided in the API. Or can I use the `init` method? But then how should I pass the `_delegate`?
1. conform your interface to the delegate 2. init HRMonitor, passing your interface instance as the _delegate 3. then the - (void) hrmon: (HRMonitor*) mon heartRateUpdate: (double) hr of you interface will be called 4. make a interface conforms to the delegate, and call the method of it when you need, remember to check the delegate is not nil and response to the method you want to call @interface YourClass : NSObject <HRMonitorDelegate> @implementation HRMonitor -(void)someMethod { HRMonitor monitor = [HRMonitor alloc] init:self]; } - (void) hrmon: (HRMonitor*) mon heartRateUpdate: (double) { }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "ios, interface" }
About Redirect as POST I want to redirect the user to some url in other website, but to send with his redirect some post variable.. is this possible? And if yes, how? Thanks.
It is not. :( You can however submit an hidden form using Javascript. **EDIT** : shame upon me. It seems it can be achieved w/o Javascript. Try to post some data to a PHP page you write yourself, which basically tells the browser to do a `303 See Other` redirect. It shall work, in the sense that the browser should re-POST the data on the redirection target, but someone reports this causes the browser to show a "really repost the data?" message, like the one you see if you refresh a web page you loaded with a POST. However, even if it works, I think nobody does it.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "php, post, redirect" }
CVCalendar DayView.date Error I'm using the CVCalendar by Mozharovsky from GitHub. I'm trying to mark specific days using this method: func supplementaryView(shouldDisplayOnDayView dayView: DayView) -> Bool { if(dayView.date.day == day && dayView.date.month == month) { return true } return false } The problem is that the dayView.date is nil sometimes which causes an error: fatal error: unexpectedly found nil while unwrapping an Optional value How can I avoid the nils and the errors?
Just use the basic Optional Unwrapping to test if it's defined and do what suits your needs : func supplementaryView(shouldDisplayOnDayView dayView: DayView) -> Bool { if let date = dayView.date { if(date.day == day && date.month == month) { return true } } else { // date is nil :( } return false }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ios, xcode, swift, github, calendar" }
Como guardar datos de inputs de un Activity al pasar a otra activity y enviarlos en un email? ![MainActivity de mi aplicacion]( Como ven en la imagen, mi MainActivity es simple, con EditTexts que el usuario debe completar, en los botones flotantes, el de check, cumple una funcion que envia el email con los datos cargados, eso funciona bien. Ahora, el boton flotante con icono de agregar, tendria que abrir la misma pantalla con los inputs vacios, y al apretar el boton de enviar, se deberian enviar en el email tanto los datos cargados en la primera pantalla y en la segunda pantalla.
Para pasar datos entre activities puedes usar los **intents**. Intent intent = new Intent(this, SegundoActivity.class); intent.putString("obra", obra.getText().toString(); .... //repites el proceso con todos los datos que quieras pasar al segundo activity startIntent(intent) ; En el segundo **activity** los recoges if (getIntent().getExtras=!null){ String obra = getIntent().getExtras.getString("obra") .... Repites con el resto de datos que deseas recoger } Eso es lo que puedo entender que necesitas, si es otra tu necesidad podrías explicarnos de una forma un poco más clara, ya que ko puedo entender bien tu problema. Recuerda que "obra" sería un keyValue. Espero haber ayudado en algo, como te digo si tu problema es otro, podías detallar nos de mejor forma el problema. Saludos
stackexchange-es_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "java, android" }
how to install 'intl PHP extension' with Wamp server i want to install 'intl PHP extension' on my WAMP. i am running Wamp on windows. i have looked online but cannot find any guidance on how to do this. does anyone have any ideas.
on wamp icon click on php -> php extensions -> php_intl then restart the server
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "php, wamp" }
Are 4-float colors faster than 4-byte colors? Let's say that I'm defining a vertex structure. I can keep the vertex structure small by packing the vertex's RGBA color into a single unsigned int. Thus: struct Vertex { float pos[3]; float normal[3]; float texcoord[2]; unsigned int color; // RGBA }; Yet when the vertex arrives at my vertex shader, it will have been converted to a 4-float value: a vec4 in GLSL or a float4 in HLSL. Presumably this type conversion takes some time on the GPU. Would it therefore be faster to define the vertex's color attribute as a 4-float, thus avoiding the conversion? ... float color[4]; ... Or would the larger memory size of this color make the GPU cache less efficient and result in _slower_ rendering?
Modern GPUs have dedicated hardware for unpacking packed formats on load so the conversion is effectively free. The reduced memory bandwidth requirements and more efficient vertex cache usage will improve performance so as a rule you should pack all vertex attributes as tightly as possible while still maintaining sufficient precision for your purposes.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "performance, caching, graphics" }
Do comboboxes support keyboard input in Gtk+ 3? Several of the comboboxes that I use regularly (the box to select syntax highlighting in the gedit statusbar, boxes for choosing smart playlist criteria in Banshee, etc) require me to click on them with the mouse, scroll down for awhile, then click on the item that I want. Being able to type into these boxes and have the list jump to the first matching entry would be a nice time saver. So I'm wondering, has this been implemented in Gtk+ 3? If not, is there a bug report somewhere that I could subscribe to? And is there a technical reason that this hasn't been implemented, or is it a design decision. Since this behavior is common in all major web browsers, I'm sure I'm not the first person to think of this, but a few minutes of Googling didn't lead me to anything relevant.
**No** , this hasn't changed in gtk+ 3. Back in 2001, a bug was reported that dropdown comboboxes couldn't be navigated using the keyboard (even the arrow keys and `Enter`). All parts of this bug were fixed except the part about typing text while the combobox has focus and having the list select the correct item alphabetically. More recently, a new bug was filed requesting that combobox lists respond to all keyboard input by selecting items alphabetically. This issue is still open.
stackexchange-askubuntu
{ "answer_score": 2, "question_score": 4, "tags": "gtk, input method" }
would appreciate for some one pointing me to good DLL tutorial I would appreciate if some one can point me to DLL tutorials ( basic - advanced :) ).
Wikipedia has a good overview, as does the MSDN: < < Here's a tutorial on creating DLLs: < A very generic e-how for a board overview: <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "dll" }
Use multiple line in Elvis operator in kotlin I have this code in Android Studio: val newUser = !intent.hasExtra("newUser") val userData = intent.getParcelableExtra("newUser") ?: UserData() There is a problem in this code. if an extra that isn't `UserData` exists in intent and if its key is "newUser", `newUser` becomes `false` but `userData` becomes a new instance of `UserData`. I am looking for something like this: val userData = intent.getParcelableExtra("newUser") ?: { newUser = true UserData() } I konw this code doesn't work but is there a way to do it?
You can wrap the block in the `run` function: val userData = intent.getParcelableExtra("newUser") ?: run { newUser = true UserData() }
stackexchange-stackoverflow
{ "answer_score": 46, "question_score": 19, "tags": "android, kotlin" }
How to change icon when selected A simple question but I do not know if it is possible. Can I change an icon when it is clicked? In the case, my icon is gray, I would like it to go blue when clicked but it's pretty hard to do this in my code, so I want to know if it's possible for me to change to another icon when I click, I would then put the other icon with the blue color. While still learning ionic, then there are many doubts. Thank you to anyone who can help me! <div no-padding> <ion-segment [(ngModel)]="Menu" class="SwipedTabs-tabs"> <ion-segment-button (click)="selectTab(0)"> <ion-icon name="icon-ico_gastronomia_off"></ion-icon> </ion-segment-button>
You should be able to bind the attr name and change it via Angular `[]` \- which stand for one way data binding; html <ion-icon [name]="toShowIcon"></ion-icon> ts toShowIcon = 'icon-ico_gastronomia_off'; and than change it on click; If you want to change the icon only one time and stick with it `icona> iconb` use this code ; selectTab() { this.toShowIcon = 'your_new_icon_name'; } If you want on click to toggle the icon. `icona > iconb` and then from `iconb > icona` use this; selectTab() { if (this.toShowIcon === 'icon-ico_gastronomia_off') { this.toShowIcon = 'your_new_icon_name'; } else { this.toShowIcon = 'icon-ico_gastronomia_off'; } } Note: You can do for multiples icons as well. You just need to add the logic.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, angular, cordova, ionic framework, ionic3" }
If $P$ is the set of all distributions, the only sufficient subfield is the trivial one According to an article by Bahadur, if $P=\left\\{p\right\\}$ is the set of all probability measures on the measurable space $\left(\Omega,\mathcal{A}\right)$, $\mathcal{A}$ is the only possible sufficient subfield. The claim is left unproved in the article. Any help will be appreciated. _Bahadur, R. R. Sufficiency and Statistical Decision Functions. Ann. Math. Statist. Volume 25, Number 3 (1954), 423-462. A remark following definition 5.2_
Let $\mathcal{A}'$ be a sufficient subfield of $\mathcal{A}$. We'll show that $\mathcal{A}\subseteq\mathcal{A}'$. Let $B\in\mathcal{A}$. Since $\mathcal{A}'$ is sufficient, there's some $\mathcal{A}'/\overline{\mathfrak{B}}$-measurable $\varphi_B:\Omega\rightarrow\overline{\mathbb{R}}$ such that $p(B)=\int_\Omega fdp$ for all $p\in P$. Now let $\omega\in\Omega$ and set $p:=\delta_\omega$, where $\delta_\omega$ is the Dirac measure on $\left(\Omega,\mathcal{A}\right)$. Then $p(B)=\mathbb{1}_B\left(\omega\right)$ and $\int_\Omega fdp=f\left(\omega\right)$. Since $\omega$ was arbitrary, $f=\mathbb{1}_B$. So $B\in\mathcal{A}'$.$\square$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "statistical inference" }
c# mongodb batch insert I want to import csv file to MongoDB. The csv file have 3,00,000 records and 10 fields. I can't find good tutorial for InsertBatch method described in MongoDB documentation. Inserting records one by one using insert() method is taking more than 15 Minutes.
Does this helps you ? MongoCollection<BsonDocument> books; List<BsonDocument> batch = new List<BsonDocument>(); using (CsvReader reader = new CsvReader("users.csv")) { batch.add( new BsonDocument { { "field1", reader["field1"] }, { "field2", reader["field2"] } }), }; books.InsertBatch(batch.ToArray());
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 1, "tags": "c#, .net, mongodb" }
How to prove the value of an trigonometric term to zero? Given that , in $\triangle ABC$ , $AC \neq BC$ . We have to prove that , $\dfrac{BC\cos C-AC\cos B}{BC\cos B-AC\cos A}+\cos C=0$ ## My trying: As $AC \neq BC \Rightarrow b \neq a \Rightarrow a=c \Rightarrow A=C$ . So for the following term , $$ \\\ $$ \begin{align} \frac{BC\cos C-AC\cos B}{BC\cos B-AC\cos A}+\cos C &= \frac{a\cos C-b\cos B}{a\cos B-b\cos A}+\cos C = \frac{a\cos A-b\cos B}{a\cos B-b\cos A}+\cos A \\\\[1ex] &= \frac{a\cos A-b\cos B+a\cos A\cos B=b{\cos }^2A}{a\cos B-b\cos A} \end{align} Then I got stuck and have no clue how to go ahead . Can anyone please help me to solve this problem ? It will be of great help .
for the first numerator i have got $$1/2\,{\frac {{a}^{2}+{b}^{2}-{c}^{2}}{b}}-1/2\,{\frac {b \left( {a}^{2 }-{b}^{2}+{c}^{2} \right) }{ac}} $$ for the denominator i have got $$1/2\,{\frac {{a}^{2}-{b}^{2}+{c}^{2}}{c}}-1/2\,{\frac {-{a}^{2}+{b}^{2 }+{c}^{2}}{c}} $$ and the sum is given by $${\left( 1/2\,{\frac {{a}^{2}+{b}^{2}-{c}^{2}}{b}}-1/2\,{\frac {b \left( {a}^{2}-{b}^{2}+{c}^{2} \right) }{ac}} \right) \left( 1/2\,{ \frac {{a}^{2}-{b}^{2}+{c}^{2}}{c}}-1/2\,{\frac {-{a}^{2}+{b}^{2}+{c}^ {2}}{c}} \right) ^{-1}}+1/2\,{\frac {{a}^{2}+{b}^{2}-{c}^{2}}{ab}} $$ have you got this? the simplified numerator is given by $$1/2\,{\frac {{a}^{3}c-{a}^{2}{b}^{2}+a{b}^{2}c-a{c}^{3}+{b}^{4}-{b}^{2 }{c}^{2}}{bac}} $$ and the simplified denominator is given by $${\frac { \left( a-b \right) \left( a+b \right) }{c}}$$
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "trigonometry, triangles, recreational mathematics" }
Salesforce to Boomi callback We are doing a test path setup between sanbox boomi environment. In one of our process we had to test callback by initiating the call.But being new to this org I have no idea how to and where to check the call back is happening or not. what are the prerequisites to make a callback. When the call back happens is. The external system updates some tables data in SFDC through Boomi and the sfdc system makes a callback based on the status and I need to check whether this call back has been done or not. where can I do a check.
The call back is going through o/b MSG, I was able to find the call back in outbound message queue.
stackexchange-salesforce
{ "answer_score": 0, "question_score": 2, "tags": "callback" }
Windows 2000 and .Net 2.0+ I have heard, that Windows 2000 can only be used together with .Net 2.0 and no other version above this. Is that true and if it is, do you have an official Post or something like that from Microsoft, where I can read about the restriction? thanks.
If you go to .NET Framework System Requirements, you can select the version you want from the dropdown. Yes, `Windows 2000 Professional with SP4` is listed as being compatible with FW 2.0, but not above.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": ".net" }
Regular expression for password validation in c# Need help with regex for password validation in c# 1. minimun length of 8 caracters and maximun of 16 2. at least one digit, lower case and one uppper case What i tired: var rule = new Regex("^(?=.{8,16}(?=*[a-z])(?=.*[A-Z])(?=.*[0-9])$"); but it doesnt work :(
You forget to put closing paranthesis in the first lookahead. And also you need to add `.*` after all the lookaheads because lookrounds are zero width assertions, it won't match any character but only assert whether a match is possible or not. var rule = new Regex(@"^(?=.{8,16}$)(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[0-9]).*$"); DEMO
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "c#, regex" }
Nginx allow only root and api locations I have a server configured as a reverse proxy to my server. I want to reject all the requests except to two locations, one for root and another the api root. so the server should only allow requests to the given paths example.com/ (only the root) example.com/api/ (every url after the api root) The expected behaviour is that the server should reject all the below possibilities. example.com/location example.com/location/sublocation example.com/dynamic-location my current nginx configuration, server { # server configurations location / { # reverse proxy configurations } } How do I set up this configuration?
Here it is: location = / { # would serve only the root # ... } location /api/ { # would serve everything after the /api/ # ... } You need a special '=' modifier for the root location to work as expected From the docs: > Using the “=” modifier it is possible to define an exact match of URI and location. If an exact match is found, the search terminates. For example, if a “/” request happens frequently, defining “location = /” will speed up the processing of these requests, as search terminates right after the first comparison.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 7, "tags": "nginx, webserver, web hosting, access control, nginx location" }
Moving a ball forward, mechanical force I'd like to have a ball (blender game engine) which rolls forward by its own and with real physics and friction. It shouldn't be animated though, what I'd like to have is kind of like a "motorized ball" who rolls forward just by its own force. No work arrounds with wind or invisible objects pushing or draging it. What I did: * keyframes for the spinning animation (360 degrees) * made it a rigid body * sensors "always" and "action" so that it spins when in game mode but it just falls down to the floor and spins where it is. It doesnt react to the floor whatsoever (which has collision on and is a passive). Or is there a complete different way to do such things like "mechanical animation" or whatever it's called? Thank you in advance :)
You need to tick the _Animated_ checkbox under the _Rigid Body_ tab: !enter image description here If the object just sets there and doesn't roll, you should make sure your _Friction_ levels are set properly for the involved collision objects: !enter image description here Zero friction will result in no forward movement, make it higher and the "Stickiness" gets higher while lower settings make it more slippery.
stackexchange-blender
{ "answer_score": 1, "question_score": 2, "tags": "physics, rigid body simulation, keyframes" }
WCF Service Hosted in IIS System.Runtime.InteropServices.SEHException I have a WCF service, hosted in IIS returning the following error (when trying to call a method or even just browse to the service definition): > "Service not available" The error log shows a bit more detail: > An unhandled exception occurred and the process was terminated. > > Application ID: /LM/w3svc/1/ROOT/C_wcfService > > Process ID: 4696 > > Exception: System.Runtime.InteropServices.SEHException > > Message: External component has thrown an exception. Can anyone point me in the right direction to fix this problem?
This problem was being caused b the Execute Permissions in IIS. The virutual directory was set to "Scripts only" and changing this to "Scripts and Executables" has resolved the issue. I'm not sure how you're supposed to get to this answer from the original error (but fiddling for a while seems to work!)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "c#, .net, wcf, iis" }
JSTL hasRole chained with boolean condition So I have a conditional list that may be added to the page, And I only want to check for it if the user has an Admin Role. I am trying to do as so: <sec:authorize access="hasAnyRole('ADMIN')"> <c:if test="${empty list}"> </sec:authorize> //do stuff here <sec:authorize access="hasAnyRole('ADMIN')"> </c:if> </sec:authorize> It keep looking for an ending close tag, so this wont compile. My question is, is there a way to chain a role check along with a boolean check. Something like this: <c:if test="${empty list && hasAnyRole('ADMIN')}"> //...DO STUFF HERE </c:if>
It's possible to save the result of `<sec:authorize>` execution in a variable and use it later in the JSTL expression: <sec:authorize var="isAdmin" access="hasAnyRole('ADMIN')"> <c:if test="${isAdmin and empty list}"> //do stuff here </c:if>
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "spring, spring security, boolean, jstl" }
Fetch Merchant Name from Transaction SMS - Android I want to fetch Merchant Name from Bank Transaction SMS. For this I used following regx; Pattern.compile("(?i)(?:\\sat\\s|in\\*)([A-Za-z0-9]*\\s?-?\\s?[A-Za-z0-9]*\\s?-?\\.?)") Its works fine with those SMS which contains **at** / **in** but what if SMS contains other than this two words. For example, SMS is like ; > Dear Customer, You have made a Debit Card purchase of INR1,600.00 on 30 Jan. Info.VPS*AGGARWAL SH. Then how to fetch **AGGARWAL SH** from above SMS?
You can use this below code to fetch Merchant Name from String private void extractMerchantNameFromSMS(){ try{ String mMessage= "Dear Customer, You have made a Debit Card purchase of INR1,600.00 on 30 Jan. Info.VPS*AGGARWAL SH."; Pattern regEx = Pattern.compile("(?i)(?:\\sInfo.\\s*)([A-Za-z0-9*]*\\s?-?\\s?[A-Za-z0-9*]*\\s?-?\\.?)"); // Find instance of pattern matches Matcher m = regEx.matcher(mMessage); if(m.find()){ String mMerchantName = m.group(); mMerchantName = mMerchantName.replaceAll("^\\s+|\\s+$", "");//trim from start and end mMerchantName = mMerchantName.replace("Info.",""); FileLog.e(TAG, "MERCHANT NAME : "+mMerchantName); }else{ FileLog.e(TAG, "MATCH NOTFOUND"); } }catch(Exception e){ FileLog.e(TAG, e.toString()); } }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, parsing, sms" }
Does Mono / .NET 4.0 implement AppDomain.FirstChanceException? I am porting a C# app from .NET on Windows to Mono on Linux (both using .NET 4.0). When compiling the code I get the following code: Error CS1061: Type `System.AppDomain` does not contain a definition for `FirstChanceException` and no extension method `FirstChanceException` of type `System.AppDomain` could be found. Are you missing an assembly reference? (CS1061) (V8.Net-Console) for the following code: AppDomain.CurrentDomain.FirstChanceException += CurrentDomain_FirstChanceException; When looking at `AppDomain` via Assembly Browser I do not see any definition for `FirstChanceException`. Is it missing from Mono or is it some issue on my machine? If it is missing, what alternative is available?
According to the source file containing AppDomain class, this is not implemented on Mono yet.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "c#, .net, mono" }
What is wrong in this sentence grammatically? I am so sorry for asking such question. But my boss keep saying there are grammatical error in these sentences, and I for one, even after reading them over and over can't find one. > However, these research works lack common methodology and definition of 'X' to measure its efficiency, has been diverse and subjective at best. > > Parallelly, 'Y' framework, primarily developed in climatology field to study 'A' and 'B', has been gaining traction, both in classification methodology advancements and its applications. The framework defines 10 classes based on urban and natural features with existing research showing that each class to have its unique albedo profile. I have retracted few field specific terms.
However, the research **literature** lack common methodology and definition of 'X' to measure efficiency, have been diverse and subjective. Notes: Replaced works with literature as I use it in papers. Plural research works/literature means following word choice must cater to plural, not singular terms. **Similarly** , 'Y' framework primarily developed in **the** climatology field to study 'A' and 'B' has been gaining traction, both in classification methodology advancements and its applications. The framework defines 10 classes based on urban and natural features with existing research showing that each class **has a** unique albedo profile. Notes: small grammatical issues and word choice. Let me know if any meaning has been lost as I may have misinterpreted your text. Edit: I am new here as well, so just give me any feedback you like to help out.
stackexchange-english
{ "answer_score": 0, "question_score": 0, "tags": "grammar" }
What does and in python stands for I try some samples in python console. And was confused for the following: >>> (1 and None) >>> (1 and None) == None True >>> (1 or None) == None False >>> (1 and 2) == 2 True >>> (2 and 1) == 2 False >>> (2 and 1) == 1 True I was confused for what is the why (1 and None) does not return any thing is line 1? It should be None? And why (2 and 1) equals to 1 but not 2. Sorry for new with Python.
In python, empty string, dict, tuple, list are False. The others are True `(1 and None)` is same as `if 1 is False return 1 else None` that is why (1 and None) return None same reason == > (2 and 1) return 1 so, it's not 2. My English isn't good, you can find more information from below links 1. < 2. <
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "python" }
drawCircle vs drawBitmap I'm planning on implementing a new set of figures in my game: plain circles. The number of drawn sprites (in this case circles) starts with 2-3, and can go up endlessly (potentially). The maximum will probably be around 60 though. In total there will have to be 5 types of circles, each with a different color and probably size too. Now seeing as I won't implement it until monday I thought I'd ask it at stackoverflow. Does anybody already know which method is faster?
Bitmaps are almost always faster than any kind of draw. With the right preparation drawing a bitmap is simply dumping memory to the screen. Drawing a circle involves a significant number of calculations, including anti-aliasing. I presented a paper which covered this at JavaOne 2009, but papers that old seem to have been removed from the site. It does depend on how big your bitmap would need to be, but for sizes under 10 pixels bitmap sprites are much faster than even simple graphic operations like drawing crosses and lines. You also need to make sure that your sprite won't require any kind of transform when it is drawn, and that it is a form compatible with the screen memory. If every circle is to be a different color or thickness, or worse a different size, then that's another matter. The cost of creating each bitmap would outweigh the savings. You should also remember the first rule of optimization: don't do it unless you have to.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 4, "tags": "java, android, android canvas, draw, geometry" }
Unable to start IBM HTTP Server on Linux I am trying to install IBM HTTP Server 7.0 on my Linux machine 2.6.32-504.el6.x86_64. When i finish installation and try to start IHS using command `/opt/IBM/HTTPServer/bin/apachectl start`, i get below error : /opt/IBM/HTTPServer/bin/apachectl: line 80: @@SERVERROOT@@/bin/httpd: No such file or directory Can anyone suggest what could be the cause and how can i resolve it?
Missing libraries was the reason of this kind of error. Here's the link which helped me troubleshoot this error. <
stackexchange-superuser
{ "answer_score": 0, "question_score": 0, "tags": "linux, webserver, http" }
How to get remote host MAC address by using its ip address in c programming in linux Can some one tell me, how to get remote host MAC address by using its ip address in linux by using c programming(could be netlink sockets or BSD sockets)?
This can't be done using C programming. If it was possible then there wouldn't be any protocol like `ARP` to get the link layer address. You can implement ARP request and reply using socket programming. But that's not what you want in this case I think. Anyway in that case you can refer to this discussion link. **You can have a look at this for that purpose** source code.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "c, linux, macos, ip address, remote host" }
Is there a word for a student/person counted in a roll call I am looking for a word that represents someone who has been accounted for during a roll call or similar process if one exists. It may be considered to be the opposite of an absentee.
Attendee Collins English Dictionary defines it as: > a person who is present at a specified event If they had to sign a register, then they might be a "registered attendee", as opposed to an unregistered attendee (who is, presumably, a "gatecrasher").
stackexchange-english
{ "answer_score": 1, "question_score": 1, "tags": "single word requests" }
Java - Interfaces, methods need to return something? (1st post don't bully me :D) My question is simple, is it imperative that a method included in an interface HAS to return some value? (int, double, String etc..) Cause last time I checked I could not define a Void method in an interface, got compiling errors. Thanks in advance! Cheers!
> My question is simple, is it imperative that a method included in an interface HAS to return some value? No, absolutely not. You can declare a void method in an interface, and indeed there are plenty of standard library interfaces with such methods. `Runnable` is a fine example: public interface Runnable() { void run(); } Note that declaring that a method returns `Void` is a different matter, and _usually_ a mistake. (It's primarily useful for generic methods where you're going to return a value of type `T` \- for example, `Runnable` is similar to `Callable<Void>`.)
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "java, interface, return value, return type" }
Unity Photon Send data to server How to possible send data to server and save them there in Unity 5 and Photon? for example send device UID, device Model, Device Name.
You can override _OnPhotonSerializeView_ to write & read data. void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){ if (stream.isWriting) { // Write device info stream.SendNext (deviceUID); stream.SendNext (deviceModel); stream.SendNext (deviceName); } else { // Read device info deviceUID = (string)stream.ReceiveNext (); deviceModel = (string)stream.ReceiveNext (); deviceName = (string)stream.ReceiveNext (); } } The order of the variables you send should be in the same order you receive them. Your object also has to have a PhotonView attached to it. You can see more info here.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, unity3d" }
how can i use regex to get a certain string of a file with linux bash shell , how can i use regex to get a certain string of a file by example: for filename *.tgz do "get the certain string of filename (in my case, get 2010.04.12 of file 2010.01.12myfile.tgz)" done or should I turn to perl Merci frank
FILE=2010.01.12myfile.tgz echo ${FILE:0:10} gives 2010.01.12
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "linux, bash" }
Robocopy Access Denied Error 5 From Powershell I am copying files from my build server to a web server on Windows Server 2016. I am running the following from PowerShell. I am running this script with an administer account which has read/write access to the destination directory. robocopy $Path\Items $_\Items /Sec /copy:DT /MIR /NDL /NS /NP /MT /w:1 /r:1 /R:20 2>&1 | out-host I get the following error > ERROR 5 (0x00000005) Creating Destination Directory \SOMEPATH\Data\Items\ Access is denied.
* Ensure that you open your powershell session as an administrator (runas) * Also check the NTFS permission on the destination path and not only the security permissions. * If you are using a DFS path you should be better with the UNC path of the actual servername. Hope this helps. Actually I was not able to post this as a comment under your question, because I don't have 50 rep points yet.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "powershell, robocopy" }
kdb how to pass a column name into a function As a simplifying example, I have tbl:flip `sym`v1`v2!(`a`b`c`d; 50 280 1200 1800; 40 190 1300 1900) and I d like to pass a column name into a function like f:{[t;c];:update v3:2 * c from t;} In this form it doesnt work. any suggestion how I can make this happen? Thanks
One option to achieve this is using `@` amend: q){[t;c;n] @[t;n;:;2*t c]}[tbl;`v1;`v3] sym v1 v2 v3 ------------------ a 50 40 100 b 280 190 560 c 1200 1300 2400 d 1800 1900 3600 This updates the column `c` in table `t` saving the new value as column `n`. You could also alter this to allow you to pass in custom functions too: {[t;c;n;f] @[t;n;:;f t c]}[tbl;`v1;`v3;{2*x}]
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "kdb" }
Geometry question about triangle and a circle We have triangle $ABC$, and we construct a circle on side AC to become its diameter. This circle contains the middle point of side $BC$ and intersects side $AB$ in point D, in ratio of $AD:DB=1:2$. If $AB$ is $3cm$ what is the area of triangle $ABC$? My attempt: $CD$ seems to be the height of triangle(because it's at $90$ degrees), perpendicular to $AC$. I used that $CD=\sqrt{AD*DB}$. So I have height and base of triangle which turned out that area is $3\sqrt{2}/2$, but solution seems to be $3\sqrt{2}$. Why?
Refer to the figure: $\hspace{5cm}$![!\[enter image description here]( The angles $ADC$ and $AEC$ are right, because both subtend the diameter $AC$. From $AD:BD=1:2$ and $AB=3$ we can find $AD=1$ and $BD=2$. The line $AE$ is both height and median, it implies the triangle $ABC$ is isosceles. Hence, $AC=3$. From the right triangle $ACD$ we can find $CD=\sqrt{AC^2-AD^2}=2\sqrt{2}$. Finally, the area of the triangle $ABC$ is $\frac12 \cdot AB\cdot CD=\frac12 \cdot 3\cdot 2\sqrt{2}=3\sqrt{2}.$
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "geometry" }
Hosting React/Redux Web Apps (front end) One thing I do not quite understand yet is this. Say I have a website or single page app, made with React/Redux. Say I have no API calls or anything like this, so it's just the front-end I am talking about. Do I have any restrictions when it comes to hosting? People speak of Heroku & AWS here a lot, but as I understand it this concerns only the backend (?) Could I just host my React site with a 'traditional' provider or would I have to look out for something more specific?
There are no specific requirements for hosting a react JS webapp. Let's say you're using webpack to build your webapp, it'll build a static javascript file that need to be served just like regular static assets. So just the way you'd serve any other website that has static html/css/js assets. That is the case when you've no special requirements. Now if you wish to build on the server you'd expect the server to run nodejs and have decent memory to support the build process. If you need to do caching/load balancing/rate limiting you'll have to use different required solutions.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 0, "tags": "reactjs, heroku, hosting, react redux, web hosting" }
F#: Why can't I cons an object of type B to a list of type A when B is a subtype of A? According to the 3rd example on this site < F# lists can contain objects of different types as long as both types derive from the same super-type. However, I can't get the cons (::) operator to add subtypes to a list of the supertype module test type A() = member this.x = 2 type B() = inherit A() member this.y = 4 let mutable myList : A list = [] myList <- [B()] // Valid myList <- B()::myList // Invalid: This expression was expected to have type A but here has type B Is there a reason I can't use `::` to append to the list?
F# does not always insert upcasts (conversion to a base type) automatically, so you have to insert an explicit cast that turns the `B` value into a value of type `A`. Note that F# distinguishes between _upcasts_ \- casts to a base class (which are always correct) and _downcasts_ \- casts to a derived class (which may fail). You can either use the `upcast` keyword or you can use the `expr :> Type` notation. In both cases, the compiler can fill in the required target type, so you can just write: myList <- (upcast B())::myList myList <- (B() :> _)::myList
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "f#" }
Are hosted power counters and advancement tokens the same thing? For example: VIKTOR 2.0: > Hosted Power Counter: Do 1 brain damage Aggressive Secretary: > trash 1 program for each advancement token Can I advance a card that makes use of Hosted Power Counters in the same way that I can advance an agenda or a card like Aggressive Secretary?
Power counters don't (currently) interact with anything other than the card that placed them. A card will define when to place a power counter, and the effects of having them on itself. EG Draco lets you pay to place power counters when it's rezzed, and they boost the strength. The most complicated one currently is Personal Workshop which places power counters on hosted cards, but these cards are inactive while on the workshop, and so the power counters are only referenced by the personal workshop which placed them. So no, you cannot interchange advancement and power counters. Advancement and Virus counters are two specific types of counters which a range of cards let you place/remove/move. You can use Trick of Light or Shipment from SanSan to place or move advancement counters. The corp can clear all the virus counters, the runner can play Surge! to place extra virus counters.
stackexchange-boardgames
{ "answer_score": 4, "question_score": 2, "tags": "android netrunner" }
setting value of dropdownlist I am trying to set the value of a dropdownlist using an integer id value from a table. But whatever syntax I use (SelectedValue, SelectedItem, SelectedIndex), I keep getting a cannot convert int to string error. Here is an example of my code : ddlSupContracts2.SelectedItem.Value = Convert.ToInt32(ObjMeter.intSupplierContract); ObjMeter.intSupplierContract will be an integer. How do I use this value to set the selected item in my dropdownlist?
Try ddlSupContracts2.Items.FindByValue(ObjMeter.intSupplierContract.ToString()).Selected = true; or ddlSupContracts2.SelectedValue = ObjMeter.intSupplierContract.ToString();
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, asp.net, drop down menu" }
Get php variable from inline frame I have an inline frame within a form. The inline frame actually contains the form element which is generated programatically (a radio which holds a value). How can I retrieve that value hold by the radio from the page which contains that inline frame. Any idea? thanks for reading
What MvanGeest is suggesting is for you to use javascript to transfer values of the radio buttons to a hidden field in your main page form so for each radio button you would have `onclick="valueSet(this.value)"` and in the function `valueSet` (that you define in the iframe) you would set the value of the hidden form field function valueSet(radioValue){ window.parent.document.forms["nameOfYourForm"].elements["nameOfHiddenElement"].value = radioValue; } and in the main window, in the FORM you have `<input type="hidden" name="nameOfHiddenElement" value="" />` and you can set the default value for it as well Don't forget to give your form a name attribute and use that name in the function where it references `forms["nameOfYourForm"]` Does that make sense for your project? Or am I totally off base here?
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "php, inline, frame" }
recalculating field from datagridview I have a datagridview which is filled based on a calculation sum of another datagridview. In my DGview I have 4 columns, a number (i++), the person's name, the hours, the minutes. Person's name is a group-by, hours is the sum of all hours of DGview1, minutes is the sum of all minutes from DGview1. But it may occur that the sum of minutes results in e.g. 214. Is it possible to recalculate this into 2 other column where the sum of hours is added PLUS (214minutes) 3hours and then in another column the rest of minutes : 34? Or even better recalculated/replaced into the original columns of DGview2, so without adding 2 more columns?
Use the TimeSpan Structure to either calculate the sum all along, or use the TimeSpan.FromMinutes() method to create it from the minutes total.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, sql, visual studio, linq, datagridview" }
How to debug a nodejs readline app? I want to debug a simple nodejs readline programme. var readline = require("readline"); var rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question("What's your name \n",function(answer){ var x =10; // set the break point here console.log("your name is ",answer); rl.close(); }); I set the break point at var x = 10; inside callback function of rl.question().but the break point never hits. Why this happening I am confused. Then how to debug a readline programme.
Have you tried using node-inspector? I was able to debug fine from there. If your program is terminal-based, using a web-based debugger and thus leaving the terminal available for the app might avoid some confusion and trickiness. ![screen grab of node-inspector](
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "javascript, node.js" }