INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
ASP.Net FileUpload Control with Regex Validator postback problem
I'm trying to use a .Net FileUpload control along with a Regex Validator to limit filename to JPG, GIF, or PNG extensions. After postback, the filename is gone from the control (as expected), but this seems to cause the validator to fire and display its error text.
Can anyone suggest a fix, or a better way? Thank you!
|
Just use a custom validator with the following javascript function:
function UploadFileCheck(source, arguments)
{
var sFile = arguments.Value;
arguments.IsValid =
((sFile.endsWith('.jpg')) ||
(sFile.endsWith('.jpeg')) ||
(sFile.endsWith('.gif')) ||
(sFile.endsWith('.png')));
}
The custom validator code:
<asp:CustomValidator ID="cvalAttachment" runat="server" ControlToValidate="upAttachment" SetFocusOnError="true" Text="*" ErrorMessage="Invalid: File Type (allowed types: jpg, jpeg, gif, png)" ClientValidationFunction="UploadFileCheck"></asp:CustomValidator>
That should be all your need to stop it client side before it gets posted back.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 2,
"tags": "asp.net, regex, validation, controls"
}
|
How to Perform Invoice Capture in Magento2 Programmatically
How to capture payment for the created invoice. In Magento1.x it is like
$invoice = Mage::getModel('sales/Service_Order', $this->getOrder())->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
I have the order `increment id` which has order status `pending`. Invoice needs to be generated for that order by loading `increment id` and do invoice capture operation. I am expecting the invoice capture operation will set transaction id(Ex. 2121) and move the order status to `completed`
|
It's pretty similar to M1 in Magento 2, you need to inject the `Magento\Sales\Model\Service\InvoiceService` in your class:
protected $_invoiceService;
public function __construct(
...
\Magento\Sales\Model\Service\InvoiceService $invoiceService
...
) {
...
$this->_invoiceService = $invoiceService;
...
}
Then, assuming you have the order you can do:
$invoice = $this->_invoiceService->prepareInvoice($order);
$invoice->setRequestedCaptureCase(\Magento\Sales\Model\Order\Invoice::CAPTURE_ONLINE);
$invoice->register();
To set a transaction ID on an invoice you can simply call `setTransactionId()` method on the invoice object.
|
stackexchange-magento
|
{
"answer_score": 19,
"question_score": 9,
"tags": "magento2, orders, invoice, magento2.1.0"
}
|
Salesforce SOQL - DefaultDivision with User info
I'm trying to write a SOQL query that pulls back User information along with the DefaultDivision's name. When executing the following:
Select u.Email, u.FirstName, u.LastName, u.DefaultDivision from User u
the value for 'DefaultDivision' is an Id (like 02d3498202020222) instead of the friendly name (like North America). I know that the DefaultDivision maps to the Division object's Id, but how do I get the name?
I have tried things like:
select u.Email, (select Name from Division where Id = u.DefaultDivision) from User u
but that doesn't work because there is no direct relationship (and yet, there is...!).
|
Unlike SQL, SOQL does not support subqueries of the type you have given there.
In most cases with SOQL where there is an explicit relationship defined, you can query data from that explicit relationship directly, like
select u.Email, u.DefaultDivision.Name from User u where Id=blahblahblah
However there are some cases where such a relationship is not explicitly defined, and I believe DefaultDivision is one of those (so in fact my query above probably will not work). When this is the case, there's no single-query way to get the information you want -- you'll have to first query on divisions and their IDs, then query users with their DefaultDivision, and then resolve the division names from the IDs using the results of the first query.
Fortunately this type of situation doesn't happen very often anymore, but in using Divisions you're plumbing the depths of Salesforce.com a bit so you may find some unusual stuff there.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "salesforce, soql"
}
|
Any basic C++ websites/ book using visual studio 2008 enviroment?
I am looking for websites/books which teach C++ in visual studio 2008 THanks
|
For C++ using Visual Studio, the obvious site would be MSDN itself. Go through these:
* Visual C++ Walkthroughs
* Getting Started with Visual C++
* Introducing the Visual Studio IDE (C++)
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 1,
"tags": "c++, visual studio 2008, visual c++"
}
|
UIAlertController if iOS 8, otherwise UIAlertView
I want to conform to the UIAlertController used in iOS 8 since UIAlertView is now deprecated. Is there a way that I can use this without breaking support for iOS 7? Is there some kind of if condition I can do to check for iOS 8 otherwise do something else for iOS 7 support?
|
Please see the answer of **Erwan** (below my answer) as I see it is the best.
\--
You can check the iOS version to use appropriate control like this:
if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending)) {
// use UIAlertView
}
else {
// use UIAlertController
}
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 27,
"tags": "ios, uialertview, ios8, uialertcontroller"
}
|
How to Boost The relevance dynamically(boost value get from database) in Tire elasticsearch
if the search term provided by an end user contains any of the words or phrases (but does not need to be an exact match) contained in the **Decrease_Relevance_Text** field, then the relevance for that specific product is decreased by the amount in the **Decrease_Relevance_Points**
|
should do
custom_score :script => "_score+doc['increase_relevance_points'].value" do
boolean do
should { match :increase_relevance_text, term}
end
end
end
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "ruby on rails 3, elasticsearch"
}
|
Routing with and without controller name in ASP.NET MVC 4
I'm using ASP.NET MVC 4 and I have some problems settings up my routes. Could you tell my how to set up my routes to point urls to actions as follows:
* "/" (or "/Start") => PublicController.Start()
* "/About" => PublicController.About()
* "/MyPage" (or "/MyPage/Summary") => MyPageController.Summary()
* "/MyPage/Invoices" => MyPageController.Invoices()
* "/MyPage/Invoice/72" => MyPageController.Invoice(int id)
It's the url "/About" that messes things up for me, i.e. a url that does not specify the controller. If I make that one work the others that do specify controller stop working. I could just create a separate controller for "/About" I guess, but I'd rather not if I don't have to (I have more urls following that pattern).
|
This should do it:
routes.MapRoute(
name: "About",
url: "About",
defaults: new { controller = "Public", action = "About" }
);
routes.MapRoute(
name: "MyPageSummary",
url: "MyPage",
defaults: new { controller = "MyPage", action = "Summary" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Public", action = "Start", id = UrlParameter.Optional }
);
|
stackexchange-stackoverflow
|
{
"answer_score": 35,
"question_score": 19,
"tags": "asp.net mvc, asp.net mvc 4, asp.net mvc routing"
}
|
variance of score of a game
In a simply setting, we have 2 players, player $A$ and player $B$, playing a game of chess repeatedly. Player 1 wins with probability $p_1$, player 2 with probability $p_2$ and a draw with probability $1-p_1-p_2$.
If $n$ games are played, the score is the $n_1$ \- $n_2$ where $n_1$ is the number of times player 1 wins, and $n_2$ the number of times player 2 wins. Draws are disregarded for drawing purposes.
I would like to study $p_1 - p_2$, ie, the difference in probability of winning. To that end, I know an unbiased estimator is simply $(n_1-n_2)/n$. Can anyone give me an estimator for the variance of this estimator for $p_1 - p_2$? An estimator that does not need knowledge of $p_1$ and $p_2$ is ideal, but one that uses them works too since I can just plug in their estimators.
Thanks.
|
Let $N_3$ denote the number of games which ended in a tie. Note the random vector $(N_1,N_2,N_3)$ has a multinomial distribution with success probabilities $p_1,p_2,1-p_1-p_2$ respectively. Therefore
$$\begin{eqnarray*}V\Bigg(\frac{N_1-N_2}{n}\Bigg)&=&\frac{1}{n^2}V(N_1-N_2) \\\ &=&\frac{1}{n^2}\Bigg[V(N_1)+V(N_2)-2\text{cov}(N_1,N_2)\Bigg] \\\ &=&\frac{1}{n^2}\Bigg[np_1(1-p_1)+np_2(1-p_2)+2np_1p_2\Bigg] \\\ &=& \frac{p_1+p_2-(p_1-p_2)^2}{n}\end{eqnarray*}$$
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 0,
"tags": "probability, statistics, statistical inference, variance, parameter estimation"
}
|
Why am i getting 2 as an output?
#include<iostream>
using namespace std;
template<class T>
void f(T &i)
{
cout<<"1";
}
void f(const int&i)
{
cout<<"2";
}
int main()
{
f(7);
}
I have used a template function and a normal function. But the function with const int argument is executing when called. Why is that so?
|
When your code is compiling, depend on type of arguments and number of argument, compiler will find the most related function to response your function call `f(7)` before move to `Template` functions. In this case, the most related function is `void f(const int&i)` so you got 2 as an output.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "c++"
}
|
Spring MVC cast principal object
I currently do the following in my Spring MVC project alot:
protected String onSubmit(UploadMessagesCommand command, Principal principal) throws Exception {
MyCustomUserDetailsImpl user = (MyCustomUserDetailsImpl) principal;
//etc
}
Is there a better way of getting this to work, so I can replace the principal argument with a user argument and avoid the cast?
|
I resiliently noticed that you can use the User(Details) directly.
protected String onSubmit(UploadMessagesCommand command, User user) throws Exception {
//etc
}
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "java, spring, spring mvc"
}
|
How to provide the current route or view to the layout in ExpressJS?
I want to be able to dynamically reference JavaScript and Stylesheets depending on which page a user is on in Express. I thinking the best way to do so (though I'm open to suggestions) is to pass the current view to the layout page.
For example;
Given the url `
I would want to have some logic in layout.jade that said something to the effect of:
`script(src="/javascripts/{view}.js")`
Which would get rendered as:
`<script src="/javascripts/trees.js"></script>`
Any suggestions or best practices for doing this?
|
req.route is the matched route, so things like req.route.path etc are available, or of course req.url which may be parsed. With express 2x you can expose these values to views automatically using "dynamic helpers" or res.local()
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "node.js, express"
}
|
How commonly is the verb 'air' used in AmE?
One of the definitions Merriam-Webster gives for the verb 'air':
> to allow air from the outside to enter something (such as a room) so that it becomes fresher or cleaner
How common is this verb in (obviously colloquial) AmE speech? If it's not, what is the most common expression or verb?
My guess would be just 'let some fresh air in'.
|
M-W says of this meaning of _air_ : "often used with out" and provides this example sentence:
> She opened the windows to air the room.
I would not use the verb _air_ without _out_ , so the sentence above would not be one that I would say.
|
stackexchange-english
|
{
"answer_score": 2,
"question_score": 0,
"tags": "verbs, expression choice"
}
|
How to translate strings with link in email template (Magento2)
I'm trying to translate
{{trans 'If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}.
with this line in the .csv
"If you have questions about your order, you can email us at <a href="mailto:%store_email">%store_email</a>","Für Rückfragen stehen wir Ihnen jederzeit gerne zur Verfügung. Sie erreichen uns per E-Mail unter <a href="mailto:%store_email">%store_email</a>"
But it doesn't work. I have no problem with this one
{{trans "Thank you for your order from %store_name." store_name=$store.getFrontendName()}}
|
You should use double quotes when a translation string already has or needs quotes (for example: attributes for inline translation html elements) - like this:
"If you have questions about your order, you can email us at <a href=""mailto:%store_email">%store_email</a>"","Für Rückfragen stehen wir Ihnen jederzeit gerne zur Verfügung. Sie erreichen uns per E-Mail unter <a href=""mailto:%store_email"">%store_email</a>""
|
stackexchange-magento
|
{
"answer_score": 0,
"question_score": 1,
"tags": "magento2, email templates, localisation"
}
|
Cloudfront certificate and hostname: can they be different?
I have a certificate in IAM, registered to the hostname azb.hostname.com. Then I have 2 cloudfront distributions, with auto hostnames, something like d727.cloudfront.net and d838.cloudfront.net.
By default the certificate provided by cloudfront does not support TLSv1.1+ so I have to assign a custom certificate. I tried to use my certificate on one of them and...it works!
What I can't understand is why the cloudfront is still available on its default hostname *.cloudfront.net: shouldn't it have become azb.hostname.com? And can I assign the same certificate to both of them? Will they keep working?
|
CloudFront will be available with *.cloudfront.net even though you have added your own cert and has added your domain in Alternate domain filed, this is expected. if you don't want that , you probably need to add a WAF to read HOST header and if it's d1234xxx.cloudfront.net, block it.
You can use IAM/Cert with multiple distributions, it will not cause any problem.
Also, accessing d123.cloudfront.net supports tls1.1 and tls1.2 and I think recently, you can also restrict tls version as well.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "amazon web services, amazon cloudfront, amazon iam"
}
|
Get an array element from an array in a json attribute of a jsonb column
I am using postgres database and I have an array inside a json attribute in a jsonb column and I need to get the first element of that array. The jsonb_column structure is like the below:
"IndustryCode": {
"Code": "111110",
"Keys": [
"11",
"111",
"111110"
],}
So far I can get all the query elements by issuing the query below
select jsonb_array_elements(jsonb_column->'IndustryCode'->'Keys' ) from myindustry;
How can I query to get the first element?
|
If you just want the first element, there is no need to unnest the whole array. the `->` operator also accepts an integer which specifies the array index.
select jsonb_column -> 'IndustryCode' -> 'Keys' ->> 0
from myindustry;
Note I used `->>` to return the value as `text` not as `jsonb`
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "arrays, json, postgresql, jsonb"
}
|
Martingale convergence and simple random walk
I'm trying to solve the following exercise:
> Let $(X_n)_n $ be a collection of i.i.d $L^2$ random variables, with $E[X_n]=0 ,E[X_n^2]=1$ and let $S_n = X_1 + \ldots X_n$.
>
> Show that can't exists a random variable $X$ such that $S_n \rightarrow X$ a.s.
>
> Hint: If $S_n$ converges, then $X_n \rightarrow 0$ a.s.
* * *
First question:
* I can't undestand the hint: **Why if $S_n$ converges, then $X_n \rightarrow 0$ a.s. ?**
* * *
* Second question is about my attempt, just using the hint
Attempt:
Since $\sup_{n \in \mathbb{N} } E[X_n^2] = 1$, I have that the martingale $(X_n)_n$ is $L^2$-bounded, therefore converges a.s. and in $L^2$. By hint it converges to $0$, and the $L^2$ convergence implies that $\lim_{n} E[X_n^2] = E[0]$.
But that's a contradiction since the limit on the left is exactly $1$, while the rhs is $0$.
Is it okay?
|
Here is an alternative proof which does not use the hint. Suppose for contradiction that $S_n$ converged a.s. to some random variable $X$. Then $X/\sqrt{n}$ converges a.s. to $0$. But this contradicts the central limit theorem, which states that $S_n/\sqrt{n}$ converges a.s. to an $N(0,1)$ random variable.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 3,
"tags": "probability, stochastic processes, martingales, solution verification, random walk"
}
|
How to push custom state to window on page navigation?
I'm working on a project where navigation is solely based on ajax requests. Let's say, I've three pages, `Menu.html`, `View.html` and `Edit.html`. User navigate to Menu.html after successful login. There he can choose options to land on `view.html`. From `view.html`, he can choose more options to edit them on edit.html. Now, if the user presses 'back' button on browser, he is taken to `menu.html` rather than on `view.html`. I assume, he is landing on menu.html too only because I've redirections on index page.
So, I googled and found that I could use `window.replaceState`. But I don't know how exactly so that when user clicks back button on edit.html, he is taken back to view.html and not menu.html.
Thanks
|
use html5's pushstate and popstate
<
<
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, jquery, html, ajax"
}
|
Anyone know where I can find a list of the top 100 or so music hits in SPANISH from each year starting at the 50s or 60?
(top 100 1951,top 100 1952..etc) all the way until 1980.
I am specifically looking for latino/latin music. I've searched the Mexico google for the last few hours in spanish keywords but to no avail. I've also scoured wikipedia and a ton of data seems to be missing.
If you find one that is not top 100 by each year (top 70, top 50, etc.), that's fine.
If no page is found, where can I go to pay someone to make such lists, preferably a spanish speaking site? (I am willing to pay a good amount)
Please redirect me to any useful sources.
|
Your best source will be _Los 40 Principales_ , or as it's known now _Los 40_.
It started in Spain during the 60s as a 40 hits countdown and evolved to a broadcast network. Since their beginning they compiled a Top 40 of hits in **Spain**.
With Latin american countries you will find multiple problems:
* They didn't have something like _Billboard_ that compiled charts using radio airtime and record sales. Sadly, it makes very difficult to find information about top songs year by year.
* There is a big difference of genres country to country. So you won't find a general Latin American Top 40 by year. Mexico was during the 50s more into _bolero/ranchera_ while Colombia was more into _vallenato or cumbia_. It doesn't mean that Colombia didn't know about Mexican boleros because the film industry in Mexico exported its culture through movies with artists as Jorge Negrete or Pedro Infante.
|
stackexchange-musicfans
|
{
"answer_score": 4,
"question_score": 4,
"tags": "playlists"
}
|
Selecting every other line in VS Code with regex
I have a file where every line is duplicated (unfortunately).
My Name Is John
My Name Is John
I'm 30 years old
I'm 30 years old
New York is my home town
New York is my home town
I want to "revert" the duplication, in other words, select every other line and delete it. Is there a way to do it using regex replacement in VS Code?
(Working on a mac, so Notepad++ solutions like here are irrelevant. I know it's possible using bash, but I want to try to do it in VS Code)
|
You can achieve this using Replace-All with regex. Find:
(.*)\n\1
Replace with:
$1\n
That should do it.
|
stackexchange-stackoverflow
|
{
"answer_score": 8,
"question_score": 3,
"tags": "regex, visual studio code"
}
|
Placing an ellipse on a canvas programmatically on a Windows 8 store app
I've been successful at placing an ellipse on a canvas, but it shows up at the top left corner of it despite my trying different methods of moving it. In this attempt, I am trying to move it to the center of the canvas, but I would like to be able to move it anywhere in the canvas.
private Ellipse drawEllipse(Canvas aCanvas)
{
Ellipse newEllipse= new Ellipse();
newEllipse.Width = 40;
newEllipse.Height = 40;
newEllipse.Fill = new SolidColorBrush(Colors.Aquamarine);
aCanvas.Children.Add(lEllipse);
newEllipse.SetValue(Canvas.LeftProperty, aCanvas.ActualWidth / 2.0);
newEllipse.SetValue(Canvas.TopProperty, aCanvas.ActualHeight / 2.0);
return newEllipse;
}
|
Try this:
Canvas.SetLeft(newEllipse, aCanvas.ActualWidth/2.0);
Canvas.SetTop(newEllipse, aCanvas.ActualHeight/2.0);
I didn't try it, but it worked for me all the time.
**Edit** : Ahh and you should probably first add the ellipse to the canvas before moving the ellipse around.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "c#, xaml, canvas, shapes, ellipse"
}
|
Выборка по динамическим классам
Помогите, пожалуйста, решить проблему.
Код работает. Делает выборку по классу и выводит результат в консоль.
Представленная страничка с кодом статическая. Если я формирую блок `#tabs_zakaz` со всем содержимым динамически, используя `jqueri ui tabs`, то выборка по классу не работает, в консоли нет сообщений об ошибках. При этом `firebug` видит класс, по которому выбираю
Помогите, пожалуйста, разобраться в чем здесь дело. Эта проблема взорвала мне мозг.
Пробовал даже
$(document).ready(function() {
});
Хотя он там не нужен
|
> а можно для особо тупых разжевать?
Для того, чтоб не приходилось разжевывать, советую в вопросе указывать задачу в полном объеме, а не абстрактно. В противном случае, приходится перечислять все возможные варианты, в попытке найти тот, который окажется ближе к вашей проблеме.
Предположим, что у нас есть статический блок с **id="static_block"**. В него мы динамически добавляем еще какой-то блок(и) с классом **".dinamic_block"**. Теперь, вам нужно сделать выборку по классу этого динамического блока. И тут у меня бы возник вопрос: "В связи с чем?". Если эта выборка делается в связи с каким-либо событием пользователя, то, как я уже писал, есть метод .on() и вот как это будет выглядеть. Если же необходимо делать выборку без события пользователя, то эти действия проводятся сразу после добавления такого динамического объекта. Это же правило одинаково действует и при добавлении после ajax-запроса.
|
stackexchange-ru_stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "jquery, javascript"
}
|
Equivalence relation for which there are infinitely many equivalence classes.
On set $\mathbb{R}$ and the relation on it where $x\sim y$ if $x^{4}=y^{4}$. Then $\sim $ is equivalence relation for which there are infinitely many equivalence classes, one of which consists of a single element and, and the rest of two elements. How to go about evaluating equivalence classes of $\sim$
|
The quotient set is $$\mathbb{R}/\sim~~=\\{\\{a,-a\\}|a \in \mathbb{R}\\}$$
because $x \sim y$ if and only if $x=\pm y$
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 0,
"tags": "equivalence relations"
}
|
PHP all full-uppercase words to lowercase
I'd like to do something like this:
$string = "Lorem ipsum DOLOR Sit amet";
...some magic here... -> $finalString
$finalString = "Lorem ipsum dolor Sit amet"
Basically I wan't to convert all words that are fully uppercase to full lowercase.
|
A sans regex solution...
<?php
$string = "Lorem ipsum DOLOR Sit amet";
$str_arr = explode(' ',$string);
foreach($str_arr as &$val)
{
if($val==strtoupper($val))
{
$val=strtolower($val);
}
}
echo $str= implode(' ',$str_arr); //"prints" Lorem ipsum dolor Sit amet
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "php, string"
}
|
Is there any way to not load an element with knockout conditionals?
I have a list of items that can be one of two types - depending on the type, I need to use a different styling/layout. What I'm doing right now is iterating over all items and displaying both "templates" for each one, but displaying only one template per item depending on how the type() evaluates. This seems inelegant because I really only need one template per item - half of the markup on the page will never be visible.
Is there any way I can only load the markup I need for these items, without breaking them into two different arrays?
|
Yep, something like this should work for you.
<div data-bind="foreach: yourArray">
<div data-bind="if: isTypeOne">
<div>template for type one</div>
</div>
<div data-bind="if: isTypeTwo">
<div>template for type two</div>
</div>
</div>
This way, the template inside each conditional tag is only generated when it evaluates true.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "knockout.js"
}
|
Get-ADComputer in powershell fails with "Identity property on the argument is null or empty" error
I have a powershell script that makes a to call `Get-ADComputer`, at which point I get this error:
> Get-ADComputer : Cannot validate argument on parameter 'Identity'. The Identity property on the argument is null or empty.
Here is the script:
$computers = Get-Content -Path C:\Users\computersforscript.txt
foreach($line in $computers)
{
Get-ADComputer -Identity $line -Properties * | FT Name, LastLogonDate, MemberOf -Autosize
}
$computers |
Select-Object Name,LastLogonDate,MemberOf |
Export-CSV -Path C:\Users\output.txt -NoTypeInformation
The script does iterate through each workstation on "computersforscript.txt
" but it does not export it and it errors out.
I appreciate if you could help me resolve this issue.
|
Seems like there are empty lines in the file.
You can have a check for `NullOrEmpty` as well as trimming white spaces.
foreach($line in $computers){
if(-not [String]::IsNullOrEmpty($Line)){
Get-ADComputer -Identity $line.Trim() -Properties * | FT Name, LastLogonDate, MemberOf -Autosize
}
}
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "powershell 3.0"
}
|
Verb "render" and the following sentence
I am currently reading the Wiki about the War Of 1812, just purely out of curiosity, and I encountered a passage. It says,
> At home, British faced mounting opposition to wartime taxation and demands to reopen trade with America. With the abdication of Napoleon, the blockade of France ended and Britain ceased impressment, **rendering the issue of the impressment of American sailors moot.** The British were then able to increase the strength of the blockade on the United States coast,
About the bold part, would that mean "The abdication of Napoleon (and consequent cease of British pressure) **put the issue of impressment American sailors in a less significant position**?
|
The phrase is _to render something moot_. _Moot_ has a couple of slightly different meanings, but here it means "irrelevant, of no consequence".
So the meaning of the phrase is a bit stronger than your paraphrase: something like "making the issue of impressment of American sailors irrelevant or unimportant".
I don't think the wording is at all clear, and it could probably do with some rewriting.
|
stackexchange-ell
|
{
"answer_score": 4,
"question_score": 1,
"tags": "meaning, phrase meaning"
}
|
I have a normal body but fat belly. How to get rid of it?
I have normal arms; not too much fat, normal face, normal legs e.t.c but my belly is fat. I have alot of fat in my belly and I want to specifically lose that to make my body look good. Please help!
I have a body like the person on the right:
!'image'
Edit: I forgot to mention that i'ma computer programmer so i'm always sitting in front of the computer.
|
Visceral fat is the worst place to have it health wise. You should not only watch what you eat and drink, but how much. There are many places to get good advice in food and drink intake. Exercise is not just a good thing, but absolutely nessesary for continued good health, trouble is it's tough and time consuming, but that should not put you off. As a general rule remember fat is generated at the dining table, exercise is for strength and fitness and alone can't shift that blubber.
|
stackexchange-fitness
|
{
"answer_score": 0,
"question_score": 1,
"tags": "weight loss, bellyfat"
}
|
Why I have to "source vitrualenvwrapper.sh" every time I open a new Terminal?
I use Zsh as my shell and I want to use vitrualenvwrapper. But when I close a terminal then open a new one, I have to "source virtualenvwrapper.sh" again then I can use virtualenvwrapper.
# koen @ Evan in ~ [10:59:12]
$ lsvirtualenv
zsh: command not found: lsvirtualenv
# koen @ Evan in ~ [10:59:31] C:127
$ source /usr/local/bin/virtualenvwrapper.sh
# koen @ Evan in ~ [10:59:55]
$ lsvirtualenv
Flask_env
=========
hello_env
=========
# koen @ Evan in ~ [11:00:08]
$
|
You need to put your script `source`-ing in some shell session initialization file e.g. `/etc/zsh/zshrc` (global) or `~/.zshrc` (user-specific) will be read by `zsh` upon starting of an interactive session, with the latter one taking precedence over the former.
So, in your case, you can simple put the `source`-ing in `~/.zshrc` so that it would be read by `zsh` upon starting of the interactive session:
echo 'source /usr/local/bin/virtualenvwrapper.sh' >>~/.zshrc
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "python, linux, shell, ubuntu, zsh"
}
|
Connecting Cloud Run Node app to Cloud SQL using Sequelize
I am trying to deploy a Nodejs app on `Google Cloud Run` which is supposed to connect to the `Cloud SQL` MySQL database using `Sequelize` ORM.
It works fine if I use the local proxy for the cloud sql instance, but when I try to deploy it to Cloud Run, Sequelize is not able to find the db instance.
I tried giving '/cloudsql/' in the host property of sequelize, tried the public IP (it times out every time)
This is what my config looks like:
exports.PRODUCTION = {
HOST: "/cloudsql/<connection-name-here>",
USER: "<db-user",
PASSWORD: "<db-password>",
DB: "<db-name>",
dialect: "mysql",
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
};
What am I missing here?
Thanks in advance.
|
I figured out my mistake. I was passing the UNIX socket path in the host property (facepalm)
You have to pass the socket path in the socketPath property in dialectOptions in the config.
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 1,
"tags": "node.js, google cloud platform, sequelize.js, google cloud sql, google cloud run"
}
|
Solving $e^{iz} = 1+i$, where have I gone wrong?
I am trying to solve a question which asks to find all the solutions of $e^{iz}=1+i$. Here is what I have done:
$z = x + yi$
$e^{i(x+yi)} = 1+i$
$e^{xi-y}=1+i$
$e^{xi-y}=\sqrt2e^{(\frac\pi4 +2n\pi)i}$
$e^{-y}=\sqrt2$
$y=-\frac12ln2$
$x=\frac\pi4 +2n\pi$
$Z = i(x+yi)$
$Z = i((\frac\pi4 +2n\pi)+ (-\frac12ln2)i)$
$Z = \frac12ln2 + (\frac\pi4 +2n\pi)i$
The correct answer according to the marking scheme is:
$Z = (\frac\pi4 +2n\pi) - i\frac\pi4$
This differs slightly from my answer. Could someone please explain where I have gone wrong in my working?
|
Your answer is correct except for the extra $i$ you wrote. The answer is $$ z = x + i y = (\pi/4 + 2n \pi) + i ((-1/2) \ln 2).$$ You can check this answer is correct by plugging it in: Since $$iz = (1/2) \ln 2 + i (\pi/4 + 2n \pi),$$ we do have $$ e^{iz} = e^{(1/2)\ln 2} e^{i(\pi/4 + 2n \pi)} = \sqrt{2} e^{i(\pi/4 + 2n \pi)} = 1 + i$$ The answer $z = (\pi/4 + 2 n \pi) - i \pi/4$ in the marking scheme is wrong, because you can check to see you get $$iz = \pi/4 + i (\pi/4 + 2n \pi),$$ so $$ e^{iz} = e^{\pi/4} e^{i(\pi/4 + 2n \pi)} = e^{\pi/4} (1 + i)/\sqrt{2},$$ which does NOT equal $1 + i$.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 2,
"tags": "complex numbers"
}
|
Should there be comma here? “As a tutor running the weekly physics help room, I help students...”
> As a tutor running the weekly physics help room I help students taking their first steps in understanding new and difficult concepts, be that torque for the non-major introductory course or Lorentz contractions for the physics-major introductory course.
or
> As a tutor running the weekly physics help **room, I** help students taking their first steps in understanding new and difficult concepts, be that torque for the non-major introductory course or Lorentz contractions for the physics-major introductory course.
|
For introductory phrases it never hurts to supply a comma. That said, it's only expected if the comma helps avoid confusion in reading. Here, I don't foresee any misreading from omitting the comma, so the comma is optional.
An example of when a comma might be necessary, inspired by Daily Writing Tips:
> (Confusing) Before eating the bird should not be disturbed. ("Before eating the bird ..." is a potential misreading.)
>
> (Correct) Before eating, the bird should not be disturbed.
|
stackexchange-english
|
{
"answer_score": 2,
"question_score": 1,
"tags": "commas"
}
|
Why this reverse string logic in java wont work in python?
Please explain why this logic wont work in python. But works in java?
def reverse(number):
reversedNumber = 0;
temp = 0;
while(number > 0):
#use modulus operator to strip off the last digit
temp = number%10;
print(temp) #4
#create the reversed number
reversedNumber = reversedNumber * 10 + temp;
number = number/10;
print("reversedNumber", reversedNumber)
reverse(1234)
|
In Python 3 dividing two integers can return a float. In most languages `1/2 == 0`. In Python 3 `1/2 == 0.5`. To get integer division in python three you use a double division sign, i.e. `1//2 == 0`.
Note, this is a difference between Python 2 and 3.
Also does not work because comments in Python are written starting with a `#` not `//`.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -2,
"tags": "python, python 3.x"
}
|
How to disable headshot sound in CSGO?
When my character gets a headshot the volume of this is way too loud. I want to disable this headshot sound entirely or make it much more quiet. Is this possible?
|
No, as it currently stands there is no way of doing this. Modifying the volume of a single sound is not possible.
What you could do is changing the sound file in the game's vpk file, but that will get you blocked from pure servers, so you would only be able to join custom servers, which don't use `sv_pure 1`.
|
stackexchange-gaming
|
{
"answer_score": 4,
"question_score": 6,
"tags": "counter strike global offensive"
}
|
How to find out if a Java process was started in debugger?
I sometimes use a timer to call System.exit in order to kill my throw-away code snippet after few seconds, which is quite useful in case it eats 100% CPU and Windows gets irresponsible because of this. It's quite handy, except in case I start it in debugger. In debugger I'd like to disable it automatically, otherwise I forget it and my debugged process gets killed. **Can I find out if a process was started in debugger?**
Note: I know I should not use this for anything serious. I'm not going to.
|
Check here. This checks for the JDWP.
Basically:
boolean isDebug = java.lang.management.ManagementFactory.getRuntimeMXBean().
getInputArguments().toString().indexOf("-agentlib:jdwp") > 0;
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 3,
"tags": "java, debugging"
}
|
Adding multiple rows with the same name pandas
I have a quick question. If I have multiple rows with the same NAME but different quantities is there a pandas function to just add them?
NAME QTY
A 2
A 5
A 6
A total = 13?
|
try pivot table. if your data frame is named `df`:
df = pd.pivot_table(df, index=['NAME'],values=['QTY'],aggfunc='sum')
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -1,
"tags": "python, pandas"
}
|
Immediate error running setup.exe for IIS 7 application
We made an application for a client. The app is .NET/Silverlight 4, running on IIS7. We also made an installer using the "Web Setup Project" template from VS2010.
On our local machines, and in our test environment, the installer always worked fine. And on the client's Dev environment, it worked fine as well. But the client then built a completely new machine to use for full UAT. When the installer ran on that machine, it immediately failed and stated:
"Installation Incomplete: The installer was interrupted before could be installed. You need to restart the installer and try again. Click Close to exit"
.NET 4 is installed, Silverlight is installed, and IIS 7.5 is installed.
That is all. No indication of what the error was, just that immediate message. Any ideas?
|
One thing to check is whether the customer installed the IIS6 compatibility bits. I have a feeling this is still needed even on IIS7.x.
I'd also check the installer log if one got generated to see if anything jumps out. And it's also worth having a trawl through the server's event logs to see if anything got logged there.
|
stackexchange-stackoverflow
|
{
"answer_score": 5,
"question_score": 1,
"tags": ".net, silverlight, iis 7, installation"
}
|
How to highlight the searched item in Far manager?
Whenever I search an item(F7; Shift+F7) in a file via far manager editor(F4), I have trouble finding my cursor under the found item. It takes time to find it in the lines of code. How can I highlight the found item or the whole line in far editor?
|
When you search with f7 you can check the box "mark result".
|
stackexchange-superuser
|
{
"answer_score": 2,
"question_score": 1,
"tags": "syntax highlighting, highlighting, far manager"
}
|
ACPI conflicts with ACPI region SMRG
During startup, I noticed some error. I found this in `dmesg`:
i801_smbus 0000:00:1f.3: PCI INT B -> GSI 21 (level, low) -> IRQ 21
ACPI: I/O resource 0000:00:1f.3 [0x400-0x41f] conflicts with ACPI region SMRG [0x400-0x40f]
ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
What does this mean? Which device is it talking about and how do I know which driver I should install?
|
According to this post in the Linux kernel mailing-list, it should not mean a problem:
> Unless you need to use anything on SMBus (hardware sensors, essentially) you don't have to worry about that one. It means that the kernel has detected that the BIOS may potentially access the SMBus controller which may conflict with usage of the controller from within the OS.
|
stackexchange-unix
|
{
"answer_score": 3,
"question_score": 3,
"tags": "hardware, startup, acpi"
}
|
Eclipse: Autocompletion for Spring beans in Spring WebFlow?
I am using Spring Web Flow 1.0 and Spring 2.0 (beans are defined in XMLs).
In eclipse (Indigo 3.7), I'd like to enable autocompletion for my beans when writing web flows. I am already using Spring IDE plugin.
Example (I'd like to prompt autocompletion for action - bean and method):
<action-state id="doDeleteSelection">
<action bean="pm.TypoController" method="doDeleteElement" />
<transition to="elements" />
</action-state>
Is this possible?
|
Yes. This behavior is available in the Spring WebFlow editor. SpringIDE provides basic WebFlow editing using this editor. If you want a more sophisticated graphical editor, then you should download SpringSource Tool Suite:
<
It is possible to install STS into an existing Eclipse instance.
I must say that I am a little surprised that you are not finding this feature since the use of the webflow editor should be default for all webflow files. Perhaps there is another problem going on.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "eclipse, spring, spring webflow"
}
|
Why did I get 250 Station Cash?
I logged into Planetside 2 for the first time, and the thing that was different compared to all my friends is that I had 250 station cash. I can not seem to find any reason why I received it. The only thing I can think of is that I played Everquest I & II , and the original Planetside. I was not in the beta. Was there some promotion I missed?
|
This may be a mistake or some transaction may have happened you were not aware of. I honestly cant tell, but if you contact SOE they can check your history and probably can at least find out why you received it.
|
stackexchange-gaming
|
{
"answer_score": 1,
"question_score": 4,
"tags": "planetside 2"
}
|
DNS Round-robin failover and load balancing
Having read all of the questions and answers (1 2 3 and so on) on here relating to DNS load balancing, and Round-robin DNS, there's still a number of unanswered questions..
Large companies, and I'm looking at Google, Facebook and Twitter here, do present multiple A records.
1) If DNS loadbalancing/failover is so dodgy, why do large organisations do it?
There seems to be very little mention of "DNS Pinning", despite this (PDF) paper about it.
2) Why is DNS Pinning so seldom mentioned?
3) Are there any concrete examples of which ISPs and so on actually do rewrite DNS TTLs?
That said, I'm not entirely backing the side for using DNS for failover or any form of load balancing. For most networks, BGP diverse routing still seems to be a better fit.
DNS rears it's ugly head again. :(
|
1. because it's cheaper and easier than anycasting (BGP) and because it can be implemented entirely on your own hardware
2. from a load-balancing standpoint, there's very little you can do about the browser caching DNS results in contradiction to your TTL settings.
3. I'm not sure why ISPs would rewrite TTLs, Most requests will be from browsers, so I'm not sure it would be cost effective for them to invest in the infrastructure to do so.
I use DNS (GSLB actually) over anycasting for a couple of reasons. We've discussed BGP several times over the years, and I choose DNS over BGP because it's easier to do and, in most cases, just as or more reliable. Multiple facilities, clustered DNS servers, combined with proactively monitored GSLB and a TLD hosting service covers most potential faults.
|
stackexchange-serverfault
|
{
"answer_score": 2,
"question_score": 5,
"tags": "domain name system, load balancing, failover, bgp"
}
|
How to calculate mean by skipping String Value in Numeric Column?
Name Emp_ID Salary Age
0 John Abc 21000 31
1 mark Abn 34000 82
2 samy bbc thirty 78
3 Johny Ajc 21000 34
4 John Ajk 2100.28 twentyone
How to calculate mean of 'Age' Column without changing string value in that column. Basically i want to loop through age column for numerical value and gives mean of that list of value. If any string comes it should skip that value?
|
Use `pd.to_numeric` with the argument `errors='coerce'`, which turns values to `NaN` if it can't convert it to numeric. Then use `Series.mean`:
pd.to_numeric(df['Age'],errors='coerce').mean()
#Out
56.25
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "python 3.x, pandas, python 2.7, for loop, functional programming"
}
|
Should this question be migrated to the programme's stack exhange
It is to my understanding that programmers stack exchange is "a question and answer site for professionals and students in software development" that are asking "conceptual questions about software development" (2 minute tour of site). I have a more conceptual question on stack overflow: <
Is this question 'conceptual' enough to be migrated to programmers?
|
No, it should stay where it is since the current format of the question is too broad for either of the sites (and therefore should be put on hold / closed).
A question that demands an answer on language implementation specifics must have a language tag at least, probably even a version number since it may change over time. How would you think .NET / C# compares to C, or Swift, or PL/SQL? Giving a conclusive answer would take pages, hence the 'too broad' close reason applies:
> There are either **too many possible answers** , or good answers would be **too long for this format**. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.
|
stackexchange-meta
|
{
"answer_score": 2,
"question_score": -2,
"tags": "discussion, stack overflow, migration, site recommendation, software engineering se"
}
|
What does "&" mean in this case?
I know that it's creating a reference in other cases. But what happens here?
$crawler = &new MyCrawler();
|
It creates an instance of MyCrawler and passes the reference for that instance into $crawler. In PHP5 this is assumed so the use of the `&` is deprecated.
See Object References (the Ampersand).
|
stackexchange-stackoverflow
|
{
"answer_score": 7,
"question_score": 7,
"tags": "php"
}
|
Need help translating a few words
So far I have deciphered them, but it makes no sense.
 is the brand name.
Guangzhou City
Guangzhou hat factory
produced, product
specification
Reasonably, the whole thing in English might become something like (stuff that you can leave out for a nicer translation is between square brackets):
Wuyang [Hats]
A product of Guangzhou Hat Factory [in Guangzhou]
specifications
|
stackexchange-chinese
|
{
"answer_score": 8,
"question_score": -1,
"tags": "translation, word choice, word requests"
}
|
"positive" cache when got a user request - ehcache
I am in charged to improve the performance for my webapp, and of course, the solution must be caching.
At the moment, the system have feed rss data which should be a little bit fresh, the problem is it made so heavy mysql loading. I cached it 1 minutes with ehcache, actually. It means after 1 minutes, the data will be expired, when the unlucky user come, their experiences will be slow down than normal .
The configuration of ehcache like this:
<cache name="news.list" maxEntriesLocalHeap="1000" eternal="false" timeToLiveSeconds="60" statistics="true"
memoryStoreEvictionPolicy="FIFO">
</cache>
I called it as negative caching, I'm thinking about positive caching,too. If the cache of data was expired, it still return old cache data and make a parallel task to fill up-to-date data for other customer come later.
Does ehcache have any technique to support that?
Any idea is welcome, Thank you.
|
What you need here is a so called refresh-ahead cache. With this so you can instruct your cache to consistently look for expired entries and refresh them in the background. So by the time your users come around, they will likely find fresh (instantly-usable) information pre-loaded for them.
You still need to be careful with your overall configuration. **Caching done badly can cause performance degradation to your app.** You should not apply any kind of caching method without fully understanding its scope and doing tests when you can.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "java, spring, ehcache"
}
|
Practical Solutions to HTML5 Video on WordPress
I was directed here from Stack Overflow --
We work with clients who have WordPress sites and one thing we keep struggling with is implementing HTML5 video across all browsers and devices in the WordPress environment. We've tried multiple plugins (JW Player, MediaElement, Sublime Video). It seems like each one has its own bugs, and are difficult to implement video play-lists on (Not to mention having a good UI for the client to manage/add videos themselves).
What is a solid, reliable solution to HTML5 video on WordPress? Something that can support up to 4 file types at once (.mp4, .webm, ogg, flash) and possible have a playlist functionality.
Should I ditch the plugin solution entirely and write the code myself?
|
In an old project, I ended up writing my own. And working with WordPress library to feed the players (audio and video), so there's no foreign UI and a template builds the player with the proper attachment info.
The audio player was implemented with JPlayer.
> ### The jQuery HTML5 Audio / Video Library
>
> jPlayer is the completely free and open source (GPL/MIT) media library written in JavaScript. A jQuery plugin, jPlayer allows you to rapidly weave cross platform audio and video into your web pages. jPlayer's comprehensive API allows you to create innovative media solutions while support and encouragement is provided by jPlayer's active and growing community.
If my memory serves me well, I think I had to use another library to the video due to some playlist issues.
And that was done with this premium player: HTML5 Video Player with Playlist. They have a WordPress plugin version, but I needed something very customized, so built my plugin with the Html5 code.
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "plugin development, plugin recommendation, html5, video player"
}
|
Is there a group $(S, \times, n)$, such that $n^{-1} \neq n?$
> Is there a group $( S, \times, n)$, such that $n^{-1} \neq n?$
I think it is not possible since;
$$\begin{align} m \times n = n \times m &\implies n^{-1} \times n = n \times n^{-1}\\\ & \implies n^{-1} \times (n \times b) = (n \times n^{-1}) \times b \\\ & \implies n^{-1} \times b= n \times b\\\ &\implies n = n^{-1}. \end{align}$$
EDIT: There have been tremendous downvotes to close this question, so I will clarify what I mean, in the hope it can be figured out what I mean.
**In my mind** \- and I think this is proper notation -
$\langle S, \times, n\rangle$ is the notation of a Group, where S is the set of the Group, $\times$ is the operation to be performed and $n$ is the neutral element. So what my question asks, if the inverse of the neutral element cannot be the neutral element itself...
EDIT EDIT: I edited the notation
|
There is a very easy proof. By definition of inverse, $n\times n^{-1} = n$. But by definition of identity $n \times n^{-1} = n^{-1}$. So $n = n^{-1}$.
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": -4,
"tags": "group theory"
}
|
Can anyone tell me how to Stream from a HTTPS (note the S) video source on Android
Can anyone tell me how to **Stream** from a **HTTPS** (note the S) video source on Android?!
VideoView mVideoView = (VideoView) findViewById(R.id.videoplayback_videoView);
...
Uri videouri = Uri.parse("
mVideoView.setVideoURI(videouri);
mVideoView.start();
This type of approach does not work. If i remove the "S" it works.
|
I am sorry but the current data sources supported by the Android Media Framework don't include HTTPS. That is the reason because it is working using HTTP but not with HTTPS.
From Android 3.0, and I suppose it will also be included in Android 2.4, there will be a DRM framework that will allow you to include your own DRM plugins to protect your streaming content. But you need to wait for it....
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "android, video, https, streaming"
}
|
Goodness of fit for multivariate gaussian
What are good tests to check if the data is generated by multivariate jointly gaussian distribution.
I know $\chi^2$ test is commonly used as a goodness of fit metric but I did not understand how to use it for multidimensional random vector case. Most of the examples I saw were for univariate cases.
An example would help a lot.
Note: the covariance matrix isn't diagonal. No assumption of independent variables.
|
You can use the Mardia's Test.
The test has R package : < (
|
stackexchange-stats
|
{
"answer_score": 1,
"question_score": 0,
"tags": "chi squared test, goodness of fit, multivariate normal distribution"
}
|
basic integral inequality
Consider $0 < r <R $. I have a function $u \in C_{0}^{\infty}(B(x_0,R))$ such that $u=1$ on $\overline{B(x_0,r)}$ . Consider $y \in \partial B(0,1)$ (fixed) . My book says :
$$ 1 \leq \int_{r}^{R} |\frac{d}{ds}u(sy)| \ ds$$
I tried to begin with $\frac{d}{ds}u(sy) = \nabla u(sy) . y$ and this is zero if $s \leq r$. but I dont know what happen if $s > r$ ...
Someone can give me a hand to prove the inequality ?
thanks in advance
|
In the way you have stated the problem, it does not make sense, because $sy$ does not need to belong to $B(x_0,R)$. Probably what you do wanna prove is $$\tag{1}1\leq \int_r^R \left|\frac{d}{ds}u(x_0+sy)\right|$$
To prove $(1)$, define $v(s)=u(x_0+sy)$ and note that $$\tag{2}v(R)-v(r)=\int_r^R \frac{d}{ds}v(s)ds $$
From $(2)$ we conclude that $$|v(R)-v(r)|\leq\int_r^R\left|\frac{d}{ds}v(s)\right|ds$$
But $|v(R)-v(r)|=1$ which implies that $$1\leq \int_r^R\left|\frac{d}{ds}u(x_0+sy)\right|ds$$
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 2,
"tags": "real analysis, multivariable calculus, partial differential equations"
}
|
Create large amount of nodes in a neo4j database from List in Java
I have a list of 10.000 names in a Java program. I would like to create/merge a node for each of them in a Neo4j 3.3.0 database.
I know that I can contact the database through
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>1.4.4</version>
</dependency>
and send Cypher queries. I would like to avoid sending thousands of individual queries to the database. I read about the possibility of reading CSV files, but it seems strange to first write CSV file from Java, make it available through http to give it to the database.
|
You can use the `FOREACH` function to process all the names passed in via a single list parameter. This is very similar to @BrunoPeres' answer, but perhaps a bit more readable.
try ( Session session = driver.session() )
{
List<String> list = new LinkedList<>();
list.add("Jon");
list.add("Doe");
list.add("Bruno");
session.writeTransaction( new TransactionWork<String>()
{
@Override
public String execute( Transaction tx )
{
StatementResult result = tx.run(
"FOREACH(name IN $names | CREATE (p:Person) SET p.name = name)",
parameters( "names", list ) );
}
});
}
NOTE: The `FOREACH` function can only accept (after the `|`) Cypher clauses that write to the DB (like `CREATE` and `SET`).
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "java, csv, neo4j, cypher"
}
|
Is it a good practice to unit test asynchronous code?
It is definitely possible to test asynchronous code by letting the thread wait until the asynchronous code finishes. However, is it encouraged to test asynchronous code. Or instead, should we seperate the logic and only test the synchronous part?
For example, in my app I would make a REST API call to fetch json from server and then I need to parse the json.
There are two approaches:
1. Test the fetching and parsing as a whole. We can use `MockWebServer` to simulate timeout and response.
-Cons: it would bring some complexity.
2. Just test the parsing part, since we cannot control the API call part; it is controlled by `okhttp`
\--Cons: Hard to cover timeout case.
|
since your question specially ask about "Unit tests", the simple answer is "No". unless the unit you test is not interested of the result of Async call, it is not a part of your unit.unit tests should only make sure your unit works properly. in this case you should verify Async call is dispatched properly (so it will be a white box test).
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "java, android, testing"
}
|
How to remove category class from post page?
I want to remove category class from blog post page. Suppose I have 2 category one is fashion and another one is business. in blog post wordpress add class like "category-fashion category-business" . I want to remove all the classes for each category. I tried using jquery but class name hide on inspect element but not in view source from browser. if possible I want to remove using function.php file. below is my jquery code.
<script>
jQuery(window).on("load", function() {
<?php
$categories = get_categories();
foreach($categories as $category) {
echo 'jQuery(".category-' . strtolower($category->name) .'").removeClass("category-'. strtolower($category->name) . '");';
}
?>
});
</script>
|
please try this code in your theme's functions.php file, hope it will work in the blog page's post class.
add_filter( 'post_class','remove_category_post_classes' );
function remove_category_post_classes( $classes ) {
$categories = get_categories();
foreach ( $categories as $category ) {
$remove_classes[] = 'category-'.$category->slug;
}
$classes = array_diff($classes, $remove_classes);
return $classes;
}
If you want to remove the classes from the body class then you can just replace the filter with this code
add_filter( 'body_class','remove_category_post_classes' );
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "wordpress, wordpress theming"
}
|
Convert an array of bytes into one decimal number as a string
I'm trying to write function that converts an arbitrary large array of bytes (larger than 64-bit) into a decimal number represented as string in c# and I simply can't figure out how to do it.
For example the following code ...
Console.WriteLine(ConvertToString(
new byte[]
{
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00
}));
.. should print out
22774453838368691933757882222884355840
I don't want to just use an extra library like biginteger for that, because I want it to be simple and like to understand how it works.
|
Based on @Wilheim's answer:
static string BytesToString(byte[] data) {
// Minimum length 1.
if (data.Length == 0) return "0";
// length <= digits.Length.
var digits = new byte[(data.Length * 0x00026882/* (int)(Math.Log(2, 10) * 0x80000) */ + 0xFFFF) >> 16];
int length = 1;
// For each byte:
for (int j = 0; j != data.Length; ++j) {
// digits = digits * 256 + data[j].
int i, carry = data[j];
for (i = 0; i < length || carry != 0; ++i) {
int value = digits[i] * 256 + carry;
carry = Math.DivRem(value, 10, out value);
digits[i] = (byte)value;
}
// digits got longer.
if (i > length) length = i;
}
// Return string.
var result = new StringBuilder(length);
while (0 != length) result.Append((char)('0' + digits[--length]));
return result.ToString();
}
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 9,
"tags": "c#, .net"
}
|
Which reason would I use to recommend deletion of an obsolete answer in Low Quality Posts?
When recommending a Low Quality Post for deletion, these are your options:
!LQP Reasons
However, there are many times in which none of these reasons really correspond to the reason for which you would recommend deletion. For instance, an answer is no longer correct, given the introduction of new APIs or deprecation of older ones.
Wouldn't it be easier if there would be a text field where reviewers can give more details about why they recommend deletion of an answer/question?
|
> For instance, an answer is no longer correct given the introduction of new APIs or deprecation of older ones.
That's not a reason to delete an answer. Answers are not deleted based on whether or not they are correct, or if they actually succeed in answering the question.
If the answer is simply _wrong_ then you should be downvoting it, not flagging it or recommending deletion from the LQP queue.
|
stackexchange-meta_stackoverflow
|
{
"answer_score": 15,
"question_score": 5,
"tags": "discussion, review queues, low quality posts"
}
|
Feedparser newbie questions
After a break from Python(and I knew very little then!) I'm coming back to it for a project(hopefully!). I want to do some parsing using Feedparser & need a few hints to start. Before anyone shouts, I have searched Google and read the docs, but I'm a bit too rusty unfortunately!(So please don't lmgtfy me!)
If I have a rss feed, then how would I parse it in order that I get each of the item titles seperately which can then be inserted into a web page?
Hope that makes sense. Many thanks for any responses.
|
import feedparser
url = "
feed = feedparser.parse(url)
for post in feed.entries:
title = post.title
print(title)
If you'd like to extract just the third post, then you could use
post=feed.entries[2]
(since python uses 0-based indexing). Printing `post` might be helpful; it'll show you what information is available:
print post
And finally, to grab just the title of the third post:
print post['title']
or
print post.title
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, rss, feedparser"
}
|
Google App Engine null sort order
According to Googles Documentation, null values have no sort order. Is there any way to configure this behavior. For instance, if I am sorting an integer property in ascending order, can I configure the datastore to return null values last or first?
|
Your best bet may be to save the property as a blank "" string for each entity that has a null value for that property. Be sure to run put() on each entity that you alter.
employees = Employee.all().fetch(50)
for employee in employees:
if employee.hobbies is None: # Null value property
employee.hobbies = ""
employee.put()
Of course, this is not the most efficient way to perform this task. You may want to create a list object, like "batch_put_list," and append each employee object into the list. Then, perform a db.put(batch_put_list).
batch_put_list = []
employees = Employee.all().fetch(50)
for employee in employees:
if employee.hobbies is None:
employee.hobbies = ""
batch_put_list.append(employee)
db.put(batch_put_list)
Hope this helps.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "google app engine, gql"
}
|
One element only subarray max length
**Task description**
> You are given a list and an item, find the length of the longest consecutive subsequence of the list containing only the item.
**Testcases**
[1, 1, 2, 3] 1 -> 2
[1, 0, 0, 2, 3, 0, 4, 0, 0, 0, 6] 0 -> 3
This code is pretty readable in my opinion but I fear that the \$O(N^2)\$ time complexity is sub-optimal.
def subsequences(arr)
((0...arr.length).to_a)
.repeated_permutation(2)
.select {|start, finish| finish >= start}
.collect {|start, finish| arr[start..finish] }
end
def longest_item_only_subsequence_len(arr, item)
subsequences(arr)
.select {|seq| seq.all? {|i| i == item} }
.max_by(&:length)
.length
end
p subsequences([1, 2, 3])
p longest_item_only_subsequence_len([1, 0, 0, 2, 3, 0, 4, 0, 0, 0, 6], 0)
|
Yes, `chunk` is the way to go. I'd write it differently, though, using a list-comphehension approach (in Ruby: `map`+`if`+`compact`. Or with a custom method.) and taking in account the edge case (no elements `item` in the array):
def longest_item_only_subsequence_len(xs, item)
xs.chunk(&:itself).map { |y, ys| ys.size if y == item }.compact.max || 0
end
|
stackexchange-codereview
|
{
"answer_score": 4,
"question_score": 3,
"tags": "algorithm, ruby"
}
|
Index labels removed when deleting rows, do I want to fix this?
I deleted rows from my R dataframe and now the index numbers are out of order. For example, the row-index was 1,2,3,4,5 before but now it is 2,3,4 because I deleted rows 1 and 5.
Do I want to change the index labels from 2,3,4 to 1,2,3 on my new dataframe?
If so, how do I do this? If not, why not?
library(rvest)
url <- "
pg <- read_html(url) # Download webpage
pg
tb <- html_table(pg, fill = TRUE) # Extract HTML tables as data frames
tb
macdf <- tb[[2]]
macdf <- subset(macdf, select=c(1,2,5))
colnames(macdf) <- c("School","Location","NumStudent")
macdf <- macdf[-c(1,8),]
|
You can change the labels from `"2" "3" "4" "5" "6" "7" "9" "10" "11" "12" "13" "14"` to `"1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12"` using: `row.names(macdf) <- 1:nrow(macdf)`
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 1,
"tags": "r, indexing, row, rows, delete row"
}
|
Comparison woes
This is driving me crazy! I have a form and am supposed to do some validation on a text input called "range".
function splitRange($range){
if($range == ''){
$returnedValue = '';
return $returnedValue;
}
// some other code here
return false;
}
// ----------------
$myRange = splitRange($_POST['range']);
if($myRange == false){
echo 'error';
}
This keeps returning false and echoing 'error' when "range" is left blank!
|
Your final comparison at the end states
if($myRange == false){
echo 'error';
}
Which means "if `$myRange` is false-y, echo 'error'"
In other words,
if ($myRange == "")
and
if ($myRange == false)
are equivalent.
If you want it to compare whether `$myRange` is a boolean `false`, use
if($myRange === false)
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "php, string, comparison, boolean"
}
|
Run controller in angular js
I am new to Angularjs so i made one example to call a controller but i am not able to call controller ...
this is my sample code
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="angularjs/angular.min.js"></script>
</head>
<body ng-app="">
<div data-ng-controller="mycontroller">
</div>
<script>
function mycontroller($scope, $http) {
alert("alert");
}
</script>
</body>
|
try this
<body ng-app="learning">
<div data-ng-controller="mycontroller">
</div>
<script>
angular.module("learning", [])
.controller("mycontroller", function($scope, $http) {
alert("alert");
});
</script>
</body>
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 0,
"tags": "angularjs"
}
|
Check mem_limit within a docker container
After some crashes with a docker container with a too low mem_limit, how can i check **in** a container the mem_limit of this container? I want to print an error message on startup and exit if the mem_limit is set to low.
|
Worked for me in the container, thanks for the ideas Sebastian
#!/bin/sh
function memory_limit
{
awk -F: '/^[0-9]+:memory:/ {
filepath="/sys/fs/cgroup/memory"$3"/memory.limit_in_bytes";
getline line < filepath;
print line
}' /proc/self/cgroup
}
if [[ $(memory_limit) < 419430400 ]]; then
echo "Memory limit was set too small. Minimum 400m."
exit 1
fi
|
stackexchange-stackoverflow
|
{
"answer_score": 9,
"question_score": 22,
"tags": "docker, docker compose"
}
|
How To Order States and Countries Drop Down Menus
I have a form where someone would fill out an address for someone, but the form isn't the most efficient to use because eventually a state and a country are a required selection (assuming that the country selected has states to begin with).
Now usually, a country is listed last, so when I and other users tab from the City drop down, you naturally expect to enter a state, so (since I usually use Florida to test with) get the Falkland Islands in the country drop down and have to click on it and re-select the United States, and move onto State then. Below I have a screenshot of the form, to hopefully explain better what I mean:
, and then the country, then the other address fields.
It makes sense to lead with country if that determines which address fields show/hide.
When the country is changed the address fields below would reload based on the selected country. For example if you switched between USA and UK, State might change to County, and ZIP might change to Post code.
Try to retain the entered details if possibly useful e.g. retain entered zip in postcode. This is when a user tries to fill it out then realizing the country selected is wrong. It would be annoying if all data has to be entered again.
## Example

a = iris['New Cases'].str.contains[r'+[d{5}]']
iris.sort_values(a)
Stack trace:
------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input42-291424a61469> in <module>
2 import pandas as pd
3 iris = pd.read_csv('Covid-19.csv')
------> 4 a = iris['New Cases'].str.contains[r'+[d{5}]']
5 iris.sort_values(a)
TypeError 'method' object is not subscriptable
|
You may use
iris['New Cases'] = iris['New Cases'].astype(str).str.replace(r'\D+', '').astype(int)
First, you need to cast the data to string type (`.astype(str)`), then remove all chars that are not digits (`.str.replace(r'\D+', '')`), and then cast the result to an int (with `.astype(int)`).
Python pandas test:
data = { 'New Cases': ['+1,370', '+6,740', '+1,159', 0, '+9,625']}
df = pd.DataFrame(data)
df['New Cases'].astype(str).str.replace(r'\D+', '').astype(int)
# 0 1370
# 1 6740
# 2 1159
# 3 0
# 4 9625
# Name: New Cases, dtype: int32
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": -1,
"tags": "python, regex, pandas, sorting"
}
|
mysqli_query syntax error with $_SESSION used
I had got the error like this
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
Here is my code (I used $_SESSION to get variable from the other page.)
$sql="insert into data(name,sex,time,suggest,eat,problem,student_suggest,tutor_suggest,other_suggest)
values('$_SESSION['name']','$_SESSION['gender']','$_SESSION['time']','$_SESSION['suggest']','$_SESSION['eat']', '$_SESSION['problem']','$_SESSION['student']','$_SESSION['tutor']','$_SESSION['other']')";
mysqli_query($cn,$sql) or die(mysqli_error($cn));
|
You need to proper write down variables. It can't be :
`values('$_SESSION['name']',`
It has to be:
`values('".$_SESSION['name']."',`
Another good approach is to use PDO
$dbh = new PDO('mysql:host=localhost;dbname=data', $user, $pass);
$stmt = $dbh->prepare("INSERT INTO data (name, sex) VALUES (:name, :sex)");
$stmt->bindParam(':name', $_SESSION['name']);
$stmt->bindParam(':sex', $_SESSION['gender']);
$stmt->execute();
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 1,
"tags": "php"
}
|
In Loop Output Place Custom Field Content In Between Paragraphs
I'd like to place the contents of a custom field or variable in between the second and third paragraphs in the loop on a page template.
Is there a way to do this?
So for example, on a client's website I would like them to use the post editor to write out their page content, and keep things simple for them by giving them the ability to write out a call to action in a custom field that diplays between two paragraphs of
the_content();
using either a plugin or a PHP snippet or filter in functions.php.
Thanks very much.
|
After researching this, here is what works for me:
<?php
$paragraphAfter= 1; //show box after selected paragraph
$content = apply_filters('the_content', get_the_content());
$content = explode("</p>", $content);
for ($i = 0; $i <count($content); $i++) {
if ($i == $paragraphAfter) { ?>
<!-- START OF BLOCKQUOTE -->
stuff
<!-- END OF BLOCKQUOTE -->
<?php
}
echo $content[$i] . "</p>";
} ?>
|
stackexchange-wordpress
|
{
"answer_score": 0,
"question_score": 0,
"tags": "loop, the content"
}
|
How to check if a PHP list is empty
How to check if a PHP list is empty ?
This clearly doesn't work...
list($width, $height) = create_clone($size, $filename, $filepath, $file);
if (!list) {
echo 'list is filled up with values';
} else {
echo 'list contains no values';
}
|
`list(...) =` is a destructuring assignment operation for arrays. If `$foo = array("one", "two");` then `list ($x, $y) = $foo;` will make `$x` "one" and `$y` "two". When the right side is an expression, then the array in question is a temporary value with no name.
So if you're concerned that `create_clone` might return an empty array you should perhaps _give_ the array a name, like:
$clone = create_clone($size, $filename, $filepath, $file);
if (empty($clone)) {
# empty...
} else {
list($width, $height) = $clone;
}
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": -1,
"tags": "php, arrays, list"
}
|
Finding Most Efficient Block Size for Cache Blocking (Tiling) Optimization
When performing an experiment to determine the effectiveness of the cache blocking optimization technique (4kB of level 1 cache with 16 sets, 4-way associativity, and a block size of 64 bytes) against a matrix multiplication function with two 256x256 input matrices, I determined the optimal block size was 16. Is the optimal block size of this optimization directly associated with the number of sets in every case? For example, in another configuration (fully associative 64 kB of level 1 cache with a block size of 64 bytes), would the optimal block size be 1 (therefore, resulting in no optimization using this technique)?
|
No, the number of sets that are available and the optimal block size for the blocking algorithm are not related. For this particular case, blocking with a block size of half of the matrix size (128) would be the optimal size when ignoring all other factors.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": -1,
"tags": "caching, optimization"
}
|
Cross buffer search result list for Vim?
After searching in Vim you can get a list of the search results with `:g//#` and with `:bufdo g//#` you can get list of matches in all buffers.
But using it with `bufdo` is not really realistic since it does not show the file where the match came from or give an option to jump to the match.
Is there a plugin that would allow that?
Note that I want this for the internal Vim search because I often use it via `*`, `#` and similar shortcuts. I know that LustyExplorer (`LustyBufferGrep`) allows to search from all buffers, but it uses its own search input... I want reuse the internal Vim search.
|
You can paste the contents of vim search register with `CTRL-R`+`/`. Other plug-ins that can do that include Buffersaurus.
It seems to be possible to integrate the internal Vim search to Buffersaurus like this:
map <Leader>b :Bsgrep <c-r>/<cr>
Hit `Leader`+`b` to open up the list.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "vim"
}
|
Can an SVG contain audio using javascript?
I have an SVG with some basic javascript interactivity, and I would love to be able to put some audio into it as well.
To clarify:
* This is for an SVG that is by itself, not inlined in HTML
* I would prefer to avoid having to use a javascript library, but i can if it's necessary.
Any insight on how this could be accomplished?
|
If you require a browser with support for HTML5 audio, then it's possible to just put the audio elements in the svg (use the XHTML namespace for the audio element and its children). Last time I tried it didn't require a foreignObject wrapper. Here's an example showing how to do that (works in chrome, firefox and opera).
It's also possible to create HTML5 audio elements with javascript and use them inside the SVG.
|
stackexchange-stackoverflow
|
{
"answer_score": 10,
"question_score": 9,
"tags": "javascript, audio, svg"
}
|
Does List<>.IndexOf compare by reference or value?
>
> List<tinyClass> ids = new List<tinyClass();
> ids.Add(new tinyClass(1, 2));
>
> bool b = ids.IndexOf(new tinyClass(1, 2)) >= 0; //true or false?
>
If it compares by value, it should return true; if by reference, it will return false.
If it compares by reference, and I make tinyClass a struct - will that make a difference?
|
From MSDN:
> This method determines equality using the default equality comparer EqualityComparer<T>.Default for T, the type of values in the list.
>
> The Default property checks whether type T implements the System.IEquatable<T> generic interface and if so returns an EqualityComparer<T> that uses that implementation. Otherwise it returns an EqualityComparer<T> that uses the overrides of Object.Equals and Object.GetHashCode provided by T.
It seems like it uses the Equals method, unless the stored class implements the IEquatable<T> interface.
|
stackexchange-stackoverflow
|
{
"answer_score": 17,
"question_score": 7,
"tags": "c#, .net"
}
|
Looking for CSS-lint-type tool that will catch useless CSS like td{margin:15px}
I just spent a fair bit of time debugging some CSS. It turns out that the problem was that this CSS was using useless directives such as
td{margin:15px;}
What sends me for a loop is that every CSS-checking/validation tool I tried on that code was completely silent about. None gave even a mild heads-up along the lines of "BTW, that `td{margin:15px;}` is doing zilch for you...".
Does anyone know of a CSS tool that would alert one of such useless CSS?
In the past I have used code validation tools that would, for example, alert the user that the last line of the following function is never executed, and therefore, it is as useless as the `td{margin:15px}` above:
#include <stdio.h>
int main(void) {
return 0;
printf("Hello World\n");
}
I'm looking for something in the same spirit, but for CSS.
|
You will not find a **"CSS Linter"** that will tell you a `margin` on a `td` is useless because if it did it would be wrong.
It's not useless, it's only useless if the `td` has a `display` of `table-cell` otherwise it will work as normal.
**Demo:<
So yeah. a good "linter" would be **< , But he won't tell you that it's useless.
That's almost like saying you wan't a linter that will tell you that `box-shadow: 0px 0px 0px;` is useless, when in fact it is not, because that could be applied in a `:hover` declaration or whatever...
You are the best person to judge and clean your code out.
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "css"
}
|
JavaScript Date / Time Conversion
I have dates and times in a database in the following format:
2011-08-02T00:00:00-00:00
What is the easiest way to convert them to something like 8-2-2011?
Thanks,
|
var date = "2011-08-02T00:00:00-00:00".split('T')[0].split('-').reverse();
var month = date[0], day = date[1];
//remove 0 in the beginning if not necessary
if (+month < 10) {
month = month.slice(1);
}
if (+day < 10) {
day = day.slice(1);
}
//swap between the two
date[0] = day;
date[1] = month;
date.join('-');
Or you can use the boring `Date` way.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "javascript, datetime"
}
|
How to detect when an OptionMenu or Checkbutton change?
My tkinter application has several controls, and I'd like to know when any changes occur to them so that I can update other parts of the application.
Is there anything that I can do short of writing an updater function, and looping at the end with:
root.after(0, updaterfunction)
This method has worked in the past but I'm afraid that it might be expensive if there are many things to check on.
Even if I did use this method, could I save resources by only updating items with changed variables? If so, please share how, as I'm not sure how to detect specific changes outside of the update function.
|
Many tkinter controls can be associated with a variable. For those you can put a trace on the variable so that some function gets called whenever the variable changes.
Example:
In the following example the callback will be called whenever the variable changes, regardless of how it is changed.
def callback(*args):
print(f"the variable has changed to '{var.get()}'")
root = tk.Tk()
var = tk.StringVar(value="one")
var.trace("w", callback)
For more information about the arguments that are passed to the callback see this answer
|
stackexchange-stackoverflow
|
{
"answer_score": 17,
"question_score": 13,
"tags": "python, widget, tkinter"
}
|
Determine video bitrate Python
I have a video downloaded from Telegram and I need to determine its bitrate. I have moviepy (pip install moviepy, not the developer version). Also, I have ffmpeg, but I don't know how to use it in python. Also, any other library would work for me.
|
import moviepy.editor as mp
video = mp.VideoFileClip('vid.mp4')
mp3 = video.audio
if mp3 is not None:
mp3.write_audiofile("vid_audio.mp3")
mp3_size = os.path.getsize("vid_audio.mp3")
vid_size = os.path.getsize('vid.mp4')
duration = video.duration
bitrate = int((((vid_size - mp3_size)/duration)/1024*8))
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "python, ffmpeg, moviepy"
}
|
Should I update README.md when I adding new features to open source project?
I add a new feature to an open source project in Github that have no CONTRIBUTING.md. Should I explain my feature in README.md or I have to wait untill my pull request accept by Maintenance ?
|
Your PR could very well include the README amended with your new feature.
If it does not, and the PR has not yet been review, it is not too late to add one more commit to your feature branch and push it: the associate PR will be updated.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 2,
"tags": "github, pull request"
}
|
Is it possible to upload files by using inno setup?
I'm searching for a way to upload my installation log files at the post install by using inno-setup. the upload is to my FTP server.
|
You should be able to call FTP.EXE as a post-install job after installation. This can be done in code as described in the InnoSetup help file. Please be aware of the fact that user name and password of your FTP server would have to be stored in the setup file - you might want to create some sort of anonymous account before you get going...
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 1,
"tags": "upload, ftp, inno setup"
}
|
Proving part c using parts a&b in a set of matrix exercises.
I have the following 3 problems, where u is a $n \times 1$ column vector and $A,B$ are $n \times n$ matrices. Furthermore, all entries are complex numbers.
a. Show that if $A$ is Hermitian, $u^{*}Au$ is real.
b. Show that $B^{*}B$ is Hermitian.
c. Prove that $u^{*}B^{*}Bu$ is real and non-negative.
I have proven parts a and b. Note that by combining them, we may almost get c (the realness follows, but not the non-negativity).
After starting c from scratch and trying to prove it from the definition of matrix multiplication, I haven't gotten anywhere. I'm wondering whether there is a simpler approach to part c that doesn't throw away all the work I've already done.
|
We have $x^*x=\sum_j\bar{x_j}x_j=\sum_j|x_j|^2\ge0$ for any vector $x$. Apply it for $x=Bu$.
* * *
Note that $\langle x, y\rangle:=x^*y$ is an _inner product_ , the above can be rewritten $\langle x, x\rangle\ge0$ (which is an axiom for inner products, and it induces a _norm_ $\|x\|:=\sqrt{\langle x, x\rangle}$), so that we have $$u^*B^*Bu=\langle Bu, Bu\rangle=\|Bu\|^2\ge0$$
|
stackexchange-math
|
{
"answer_score": 0,
"question_score": 1,
"tags": "linear algebra, matrices"
}
|
Schrödinger equation: $\frac{\partial}{\partial t}$ and $\frac{d}{dt}$
I have seen two different forms of Schrödinger equation: $$i\hbar\frac{\partial|\psi(t)\rangle}{\partial t}=\hat{H}|\psi(t)\rangle$$ and $$i\hbar\frac{d|\psi(t)\rangle}{d t}=\hat{H}|\psi(t)\rangle.$$
Are these two equations equivalent? If not, in what situations are each equation used?
|
There is no difference. Strictly speaking the second one is correct, because the state vector is a function only of time, but physicists aren't always very careful about distinguishing partial vs single-variable derivatives. The partial derivative might have stuck because as an analogy to the wavefunction $\psi(x,t)$, for which a partial derivative is appropriate.
|
stackexchange-physics
|
{
"answer_score": 2,
"question_score": 3,
"tags": "quantum mechanics, schroedinger equation, time, differentiation, notation"
}
|
PHP Regex: Remove text within parentheses in a span.class
I have something like:
<span class="product-title">title (description)</span>
and I want to remove with PHP the parentheses and its content of all `span.product-title`, to be like this:
<span class="product-title">title</span>
I successfully removed the text and the parentheses(`/\s\([^)]+\)/`), but I want to match only the content within `span.product-title`.
How can I do this?
Thanks in advance. :)
|
All valid (and preferable) suggestions. However if you're simply looking for a quick & dirty regex fix, this should do:
/(<span class="product-title">.+?)\s*(?=\().+?\)(<\/span>)/i
replacing match with groups $1, $2 & $4.
|
stackexchange-stackoverflow
|
{
"answer_score": 1,
"question_score": 0,
"tags": "php, regex, html parsing"
}
|
XML-RPC Custom Hooks Request
I have developed my own xmlrpc hook, which have certain functions.
Basically I need to call that functions outside Drupal. So I can't use xmlrpc() function.
What is most simple method to call that functions through Drupal's xmlrpc.php?
|
PHP has an extension for XML-RPC, but it's not enabled by default. If your PHP installation doesn't have the extension, you can use one of the PHP libraries that handle XML-RPC requests, such as XML-RPC for PHP, and The Incutio XML-RPC Library for PHP; if you have downloaded the Zend Framework, you can use its XML-RPC classes.
|
stackexchange-drupal
|
{
"answer_score": 1,
"question_score": 1,
"tags": "7, hooks"
}
|
Does google cloud havea storage gateway concept like AWS?
Does google cloud have a storage gateway concept like AWS? AWS has the following < Does google cloud have a similar solution? I didnt get anything in the documentation.
|
Google Cloud does not currently support a storage gateway.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 3,
"tags": "amazon web services, google cloud platform, cloud, google cloud storage"
}
|
how to write a code to open a database view using @dblookup from lotus replica server
i am using two lotus domino servers(main server and lotus replica server), my all mail databases and workflow database are store in two servers.
Main sever name = "sanvar"
Replica Server Name = "varsan"
Mail and workflow database are replicating and working fine but workflow forms not working when my Main server down state.
ex: i am getting employees name from empentry database and it's code like
@DbLookup( "" : "NoCache" ; "sanvar": "empentry" ; "master" ; @Name([CN];@UserName) ; 2); but my main server down condition i am accessing a form through replica server it showing :
"SERVER ERROR".
pls suggest me how to get user name from replica server.
thank you.
|
Replace `"sanvar": "empentry"` in your argument list with `@DbName`, like this:
@DbLookup( "" : "NoCache" ; @DbName ; "master" ; @Name([CN];@UserName) ; 2);
This will return the name of the current server and database in a list. It is a very useful function, and can be combined with @Subset to just get the server name in cases where that's all you need. Please see the doc for @DbName here.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": -2,
"tags": "lotus notes, lotus domino, lotus formula, lotus designer"
}
|
Creating Thumbnail from PDF without Adobe SDK
I've been looking for ways by which I can generate Thumbnails from pdf, as shown in the explorer. But the problem is that without Adobe Pro, the free version **does not expose all ihe COM interfaces**. Is there any other way? please help.
|
Ghostscript (which is what ImageMagick uses) will generate images in a wide variety of different image formats... if you need something really obscure then use the imagemagick wrapper, otherwise, I prefer the straight dope.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 2,
"tags": "pdf, com"
}
|
Asterisk - executing agi script if call is not answerd?
Here is context CH1 which i want to call from .call file
[CH1]
exten=>9367,1,Playback(welcome);
same => n,Agi(agi://localhost/openlock.agi)
same => n,Background(CH1_WAVE1)
same => n,Hangup()
my .call file look like this
Channel: DAHDI/1/somemumber
CallerID:xyz
MaxRetries: 3
RetryTime: 40
WaitTime: 25
Context:CH1
Extension: 9367
Priority: 1
So my problem is this if one does not answer the call, my AGI script will not get execute, so is there any way to execute my AGI script if the call is not answered after 3 retries?
|
No way do it for 3 retries. But posible do for each retry.
In call file change channel to Local/somenumber@dialout/n
Create context
[dialout]
exten => _X.,1,Dial(DAHDI/1/${EXTEN},,g)
exten => _X.,2,Goto(${DIALSTATUS},1)
exten => BUSY,1,AGI(busy.agi)
exten => CONGESTION,1,AGI(fail.agi)
exten => FAILED,1,AGI(fail.agi)
exten => NOANSWER,1,AGI(noanaswer.agi)
Also i higly NOT recomend create dialling if you are not guru in asterisk. Use opensource engines. It have REALY allot of issues you never think about.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 4,
"tags": "asterisk, agi"
}
|
AngularJs multiple select shows unresolved list instead of contents in IE
I am using angularJs to bind a list of employees into a mult-select tag. Below is my code:
<select class="form-control" ng-model="event.attendees"
ng-options="c.Email as c.FullName for c in employees" id="eEmployees" multiple style="height:315px !important; -webkit-appearance:listbox !important;">
</select>
The result displayed correctly in Chrome and Firefox, but in IE it shows a list of {{c.FullName}}, instead of the real names. I tried to right-click to view the source in IE (and also IE inspector, F12), but in the source, the employee names display correctly.
Have anyone here ever ran into this issue before? I really have no sense why this happened. I placed my multiple select tag in a modal-dialog, does that matter?
|
I figured it out by added $scope.$apply() after angular service pulled the list data. It needs a little delay before binding it. But I still don't know why this situation only happened in IE though.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "angularjs"
}
|
Condition for two multivariate polynomials to be equal up to a permutation of variables
Consider two multivariate polynomials with integer coefficients $P(x_1,\ldots,x_n)$ and $Q(x_1,\ldots,x_n)$.
Let's evaluate the two polynomials over all the permutations of $(x_1,\ldots,x_n)$ and multiply them together to get the simmetric polynomials $P^*(x_1,\ldots,x_n)$ and $Q^*(x_1,\ldots,x_n)$ respectively. For example with three variables we have $P^*(x_1,x_2,x_3)=P(x_1,x_2,x_3)P(x_1,x_3,x_2)P(x_2,x_1,x_3)P(x_2,x_3,x_1)P(x_3,x_1,x_2)P(x_3,x_2,x_1)$.
Is it true that:
$$P^*(x_1,\ldots,x_n) = Q^*(x_1,\ldots,x_n)$$
implies that $P(x_1,\ldots,x_n)$ is equal to $Q(x_1,\ldots,x_n)$ or $Q$ evaluated on a permutation of $(x_1,\ldots,x_n)$?
|
Even with this fix it's still not true. If $\sigma \in S_n$ is a permutation and $P$ is a polynomial write $\sigma(P)$ for the result of the permutation $\sigma$ applied to the polynomial $P$. The reason is that we could have two polynomials $F, G$ such that $P = FG$ while $Q = \sigma_1(F) \sigma_2(G)$ for two different permutations $\sigma_1, \sigma_2$. For an explicit example, take $n = 2, P = x_1^2, Q = x_1 x_2$.
However, the statement is true if $P$ and $Q$ are irreducible; in this case you can just consider the irreducible factorization of $P^{\ast}$ and of $Q^{\ast}$ to conclude that $P$ is a permutation of $Q$ up to possibly a multiplication by $-1$ if $n$ is even (e.g. we could have $n = 2, P = x_1, Q = -x_2$).
|
stackexchange-math
|
{
"answer_score": 2,
"question_score": 0,
"tags": "abstract algebra, algebra precalculus, polynomials, symmetric polynomials"
}
|
In a ring $R$ with a $1_R$ with $u,v, u+v$ are units, show that $u^{-1} + v^{-1}$ is also a unit.
In a non-commutative ring $R$ with a $1_R$ with $u,v, u+v$ are units, show that $u^{-1} + v^{-1}$ is also a unit.
The question seems relatively simple, but I'm having a tricky time explicitly finding the formula.
I have tried :
$(u^{-1} + v^{-1})(u-v)=1-u^{-1}v+v^{-1}u-1=-u^{-1}v+v^{-1}u$
Hints appreciated.
|
$$ (u^{-1}+v^{-1})v(u+v)^{-1}u = (u^{-1}v + 1)(u+v)^{-1}u = u^{-1}(v+u)(u+v)^{-1}u = 1. $$ Now, try the other direction.
|
stackexchange-math
|
{
"answer_score": 3,
"question_score": 1,
"tags": "ring theory"
}
|
JqueryUI Datepicker SelectedDate after submit
I have an inline datepicker, which populates am input textbox.
$("#left-calendar").datepicker({
altField: "#left-date-text"
});
left-date-text is in a form, which with a submit button submits to a php script. The date works great $date=$_POST['d'];.
<input type="text" id="left-date-text" placeholder="Data" value='<?php echo $date; ?>' name="d" />
After submit, The inline selects today's date, which automatically populates #left-date-text. I want this to be the selected date ($date). I added a value of echo $date but it doesn't work. Seems like the jquery populates the textbox when it is rendered.
|
You can try to add `defaultDate : '$date'` to the datepicker definition, so if there's a date stored in $date, the picker will use it as default date.
EDIT: You can use the setter for the default date property of the datePicker, as shown in the jQueryUI documentation. Something like
`echo "<script>$('#left-calendar').
datepicker('option', 'defaultDate', '$date');</script>"`
in the body.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "php, javascript, jquery, jquery ui, datepicker"
}
|
TWRP boot loop on Z00T
The last LineageOS OTA caused a TWRP boot loop. I can get to fastboot with the volume keys. I can use `./adb shell` briefly before reboot.
./fastboot erase cache
./fastboot flash recovery twrp-3.1.1-0-Z00T.img
did not resolve the issue. What can be done to get this device booted?
|
On Ubuntu 18.04
sudo apt install android-sdk-platform-tools-common fastboot
fastboot continue
Got me back to LineageOS.
It also seems to have fixed TWRP.
|
stackexchange-android
|
{
"answer_score": 0,
"question_score": 0,
"tags": "boot loop, twrp, lineageos"
}
|
Is there a common notion of $\mathbb{R}^n$, for non-integer $n$?
This is not a very well-defined question.
Are there any standard constructions of metric spaces, parameterized by real-valued $n \ge 1$, such that:
1. When $n$ is an integer, the metric space is precisely $\mathbb{R}^n$.
2. When $n$ is non-integer, the metric space can be seen as a reasonable generalization of $\mathbb{R}^n$. For example, perhaps it has Hausdorff dimension of $n$.
Alternately, a non-existence result that you can't maintain some of the important properties of $\mathbb{R}^n$ in a generalization like this would be interesting to me.
|
There is no topological space $X$ such that $X\times X\cong\mathbb{R}^n$ if $n$ is an odd integer. You can prove this using homology; see, for instance, this answer on MathOverflow. In particular, this seems like pretty good evidence that there is no reasonable notion of "$\mathbb{R}^{n/2}$" when $n$ is an odd integer. By similar homology arguments you can show that if $n$ is not divisible by $m$ then there is no space $X$ such that $X^m\cong\mathbb{R}^n$, so there is no good topological candidate for $\mathbb{R}^{n/m}$.
These topological obstructions aside, I can say that if there is a "common notion" of $\mathbb{R}^n$ for non-integer $n$, it can't be _too_ common, because I've never heard of it.
|
stackexchange-math
|
{
"answer_score": 12,
"question_score": 8,
"tags": "geometry, soft question, metric spaces, dimension theory analysis"
}
|
What does "_" mean before a variable name?
I'm a beginner, just recently started reading the docs for Solidity.
I can't seem to find this anywhere on google. What does the underscore mean when placed with the `indexed` keyword? Examples:
`_from`
`_id`
`_amount`
`_account`
How are these different from other variables, and how are they used in events?
|
There's no meaning as far as Solidity is concerned.
Some programmers choose to use a leading underscore for all function parameters, just as a convention to indicate that they're function parameters.
They're also often used so as to avoid collisions, e.g.:
uint256 totalSupply;
constructor(uint256 _totalSupply) public {
totalSupply = _totalSupply;
}
There, calling the parameter `totalSupply` would shadow the existing state variable `totalSupply`, so the leading underscore is used to avoid the naming collision.
|
stackexchange-ethereum
|
{
"answer_score": 17,
"question_score": 7,
"tags": "solidity, events, state variable"
}
|
Nested if condition is good for perfomance?
I am using same php page for different operation. So condition wise I am doing some actions
Which one showing good perfomance?
This one
if($catid){ .. some action }
if($sub_catid){ .. some action }
if($sub_sub_catid){ .. some action }
OR This one
if($catid){
.. some action
}else{
if($sub_catid){
.. some action
}else{
if($sub_sub_catid){
.. some action
}
}
}
|
First off, those two have very different meanings. The first one could allow every single statement to execute if all those variables were TRUE. The second one will "short-circuit" the first time it finds something TRUE.
What I think you're looking for is:
if($catid) {
.. some action
} else if($sub_catid) {
.. some action
} else if($sub_sub_catid) {
.. some action
}
Bonus points: more readable!
|
stackexchange-stackoverflow
|
{
"answer_score": 4,
"question_score": 0,
"tags": "php, if statement"
}
|
How to debug a Java string split which is returning a string with a value but no Contents?
I trying out using regEx to split a String which gives me an array with 2 items in it. I am only really interested in the first element, however the debugger is reporting that it has nothing in(in yellow circle on screenshot) it but has a "value" of the item I matched in my Regex. (highlighted in blue on screenshot)
!enter image description here
How do I programmatically get to the value?
Here is the code I am using:
//Handle Related description by stripping off data relating to it
String[] descriptionShortened=jsonObject.getString("description").split("^.*[^Related]");
String descriptionintro=descriptionShortened[0].toString();
descriptionList.add(descriptionintro);
|
[^Related] Matches a **_Character Class_** which matches everything except the letters R, e, l, a, t, e, d. Your regex will match anything and that's why the first element of the array is empty. If you wanted to a string that has everything before the string "Related", just call
descriptionShortened = jsonObject.getString("description").split("Related");
Everything before the string `"Related"` will be in the first element in the array that is returned. For instance, if `jsonObject.getString("description")` returns `"abcdRelatedefgh"`, the code above would return an array `{ "abcd", "efgh" }`.
In regards to your first question and the screenshot, that String really is empty. The value is a pointer, but it's pointing to empty space. Every String has a value field, but that doesn't mean that it's not empty.
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "java, android, string, split"
}
|
How do I activate the Daedric gauntlet in the Midden?
> **Possible Duplicate:**
> What is the Oblivion-symbol gauntlet in the Midden?
What is the purpose of Daedric gauntlet in the Midden, and why can't I activate it? Are there fail conditions that can prevent one from activating it? If not, what do I need to do?
|
Check out this sites guide on this puzzle. It is part of a quest where you interact with Velehk Sain. UESP's Page on The Midden explains how to activate it:
The Midden Dark contains a ritual chamber with a
large black metal gauntlet on a
pedestal. The symbol of Oblivion is emblazened on the palm of the gauntlet.
The Midden Incident Report can be found on the table here,
along with the Investigator's Key.
Following the clues in the report,
the player can find the needed rings in the Arcanaeum,
in a master-locked chest. The lock can be picked,
or simply opened with the key.
Returning the rings to the gauntlet will activate it,
and the gauntlet will clench into a fist.
Shortly afterwards the dremora Velehk Sain will be summoned.
Hope this helps
|
stackexchange-gaming
|
{
"answer_score": 3,
"question_score": 2,
"tags": "the elder scrolls v skyrim"
}
|
Find minimum and maximum value of $\sqrt{5\cos ^2x+1}+\sqrt{5\sin ^2x+1}$
> Blockquote
Find min,max of function $$T=\sqrt{5\cos ^2x+1}+\sqrt{5\sin ^2x+1}$$
* * *
1. Max
By squaring both side and AMGM:
$$T^2=7+2\sqrt{5\cos^2x+1}\cdot \sqrt{5\sin^2x+1}$$
$$\le 7+5\left(\cos^2x+\sin^2x\right)+2=14$$
Or $$T\le \sqrt {14}$$
2. About minimal value:By $\sqrt x +\sqrt y \ge \sqrt{x+y}$
So $T\ge \sqrt{5+1+1}=\sqrt 7$
I think the minimal value has a little wrong. Pls help me.
|
For minimum,
$$T=\sqrt{(\sqrt{5\cos ^2x+1}+\sqrt{5\sin ^2x+1})^2}\\\ =\sqrt{7+2\sqrt{25\cos^2x\sin^2x+6}}\\\ \ge \sqrt{7+2\sqrt6}=1+\sqrt6 $$
|
stackexchange-math
|
{
"answer_score": 1,
"question_score": 1,
"tags": "inequality"
}
|
How to place the div elements inline?
I'm trying to place these two divs `inline`.
**HTML**
<div class="thisFlak">
</div>
<div class="thisFlakNotes">
</div>
**CSS**
.thisFlak{
width: 603px;
height: 253px;
border: 2px solid red;
margin-left: 10px;
margin-bottom: 30px;
}
.thisFlakNotes{
width: 100px;
height: 200px;
border: 1px solid black;
background: white;
}
I cannot mess with ".thisFlak" to much because it hold alot of other stuff.
**FIDDLE**
<
|
DEMO
CSS
.thisFlak {
width: 603px;
height: 253px;
border: 2px solid red;
margin-left: 10px;
margin-bottom: 30px;
/* to make it inline */
display: inline-block;
/* aligning vertically you can make it top / bottom / baseline */
vertical-align: middle
}
.thisFlakNotes {
width: 100px;
height: 200px;
border: 1px solid black;
background: white;
/* to make it inline */
display: inline-block;
/* aligning vertically you can make it top / bottom / baseline */
vertical-align: middle
}
|
stackexchange-stackoverflow
|
{
"answer_score": 2,
"question_score": 0,
"tags": "html, css"
}
|
How to transform "dot-notation" string keys in a Hash into a nested Hash?
How do I transform a Ruby Hash that looks like this:
{
:axis => [1,2],
:"coord.x" => [12,13],
:"coord.y" => [14,15],
}
Into this:
{
:axis => [1,2], #unchaged from input (ok)
:coord => #this has become a hash from coord.x and coord.y keys above
{
:x => [12,13]
:y => [14,15]
}
}
I have no idea where to start!
|
This code _may_ need to be refactored but it works for the input you have given.
hash = {
:axis => [1,2],
"coord.x" => [12,13],
"coord.y" => [14,15],
}
new_hash = {}
hash.each do |key, val|
new_key, new_sub_key = key.to_s.split('.')
new_key = new_key.to_sym
unless new_sub_key.nil?
new_sub_key = new_sub_key.to_sym
new_hash[new_key] = {} if new_hash[new_key].nil?
new_hash[new_key].merge!({new_sub_key => val})
else
new_hash.store(key, val)
end
end
new_hash # => {:axis=>[1, 2], :coord=>{:x=>[12, 13], :y=>[14, 15]}}
|
stackexchange-stackoverflow
|
{
"answer_score": 3,
"question_score": 2,
"tags": "ruby on rails, ruby"
}
|
File explorer, store path
I want to use a file explorer in order to get the path of the element I'll select in this explorer.
Could I use something like this :
<input type="file" webkitdirectory />
The problematic is :
I would ideally like to limit the selection to folders only, not files.
I want to retrieve the path of the selected folder in order to store it. (I'm using angularjs, so I was thinking of binding it through a model)
Is this possible or is there an alternative suiting my needs ?
|
You can't do it unless you use Java applet or Flash.
Please see this answer for details.
> Selecting a file for upload is the best you can do, and even then you won't get its full original path in modern browsers.
>
> You may be able to put something together using Java or Flash (e.g. using SWFUpload as a basis), but it's a lot of work and brings additional compatibility issues.
|
stackexchange-stackoverflow
|
{
"answer_score": 0,
"question_score": 0,
"tags": "javascript, angularjs, html"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.