INSTRUCTION
stringlengths 25
999
| RESPONSE
stringlengths 0
999
| SOURCE
stringlengths 16
38
| METADATA
dict |
---|---|---|---|
The tensor product of two representation is also a representation
If $\pi: A\rightarrow B(H)$ and $\sigma: B\rightarrow B(K)$ are arbitrary representations, prove that there exists a unique extending _-homomorphism $\pi\otimes\sigma: A\otimes B\rightarrow B(H\otimes K)$ such that $\pi\otimes \sigma(a\otimes b)=\pi(a)\otimes\sigma(b)$. (The $A\otimes B$ is the spatial tensor product of C_-algebra $A$ and $B$)
This is an exercise from the book "C*-algebras and Finite Dimensional Approximations". The hint is dilating $\pi$ and $\sigma$ to faithful repersentations and then cut back down. But how to dilate $\pi$ and $\sigma$ to faithful repersentations | One can easily define $\pi\otimes\sigma$ on $A\odot B$, with the only slight difficulty in checking that it is well defined. The problem is that we need it to be bounded in order to extend to the completion.
If both representations are faithful then there is no issue with this, since $\rho_A\otimes\rho_B$ is isometric on $A\otimes B$ for any pair of faithful representations.
Fix faithful representations $\rho_A$ and $\rho_b$. Let $\tilde\pi:A\to B(H\oplus H_A)$, $\tilde\sigma:B\to B (H\oplus H_B)$ be given by $$ \tilde\pi(a)=\pi(a)\oplus \rho_A(a),\qquad\,\tilde\sigma(b)=\sigma(b)\oplus\rho_B(b). $$ Now $\tilde\pi\otimes\tilde\sigma$ is well-defined and isometric. Then, for any $x\in A\odot B$, \begin{align} \|(\pi\otimes\sigma)(x)\| &=\big\|\big((P_H\oplus0)\otimes(P_H\oplus0)\big)(\tilde\pi\otimes\tilde\sigma)(x)\,\big((P_H\oplus0)\otimes(P_H\oplus0)\big)\big\|\\\\[0.3cm] &\leq\|(\tilde\pi\otimes\tilde\sigma)(x)\|\leq\|x\|. \end{align} | stackexchange-math | {
"answer_score": 1,
"question_score": 1,
"tags": "functional analysis, operator algebras, c star algebras"
} |
Give ftp users access to directories outside their root using symlinks
I tried to give proftpd virtual users access to directories outside their home paths using symlinks I created as root through the console.
`/var/ftp/users/test` is the home of the user named `test`.
`/var/ftp/files/documents` is the directory that holds the documents, and `/var/ftp/users/test/documents` is the symlink that points to it.
But when an user connects to the FTP and tries to follow the symlink, he only sees this error:
`documents: No such file or directory`
What am I doing wrong? | Symlinks are locked into the jail the same way the user is; otherwise it would be possible for the user to break out of the jail with `cd documents`. (No, root-created symlinks can't be treated specially, for the same reason that `cd -P symlink-to-dir; cd ..` leaves you in the wrong place; the appearance of it working as you'd expect is an illusion created by the shell.) Use a bind mount instead (`mount --bind /var/ftp/files/documents /var/ftp/users/test/documents`). | stackexchange-askubuntu | {
"answer_score": 23,
"question_score": 9,
"tags": "permissions, ftp, symbolic link, chroot"
} |
One subcaption for two subfigures
I have the following code which outputs one subcaption for each subfigure:
\begin{figure}[]
\centering
\subcaptionbox{image 1}%
{\includegraphics{image1.png}\hspace{0.5cm}
\subcaptionbox{image 2}%
{\includegraphics{image2.png}}%
\bigskip
\subcaptionbox{image 3}}%
{\includegraphics{image3.png}}\hspace{0.5cm}
\subcaptionbox{image 4}%
{\includegraphics{image4.png}}%
\caption{Four images.}
\end{figure}
Is it possible to modify it to have one subcaption for images 1 and 2 and another subcaption for images 3 and 4? | Yes, just place two images in each `\subcaptionbox`.
. I understand the preserving spatial resolution, how it is computed and so on, however I can't understand why it is computationally and memory-wise less expensive than e.g. max-pooling.
ENet: < | You simply skip computational layer with a dilated convolution layer:
For example a dilated convolution with
* a filter kernel k×k = 3×3, dilation rate r = 2, stride s = 1 and no padding
**is comparable to**
* 2x downsampling followed by 3x3 convolution followed by 2x upsampling
For further reference look at the amazing paper from Vincent Dumoulin, Francesco Visin: A guide to convolution arithmetic for deep learning
Also on the github of this paper is a animation how dilated convolution works: < | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "machine learning, conv neural network, convolution, semantic segmentation, unet neural network"
} |
Download/Save/Write a file on the client's hard disk using flash/flex
I wonder how can I download/save/write a file from **my server** to a **client's computer** using flash or flex.
> An example of what I'm looking for is avilable on <
>
> 1. Sign up
> 2. Sign in
> 3. Click on the ("FREE") button placed on the right of the page. (the orange button)
> 4. Choose any product (won't cost you anything)
> 5. Press "BUY NOW"
>
>
> then you'll see a confirmation popup for the download, then you choose where do you want to save the file, and the flash movie saves the file! | **Use FileReference**
<
var request:URLRequest = new URLRequest("index.xml");
var fileRef:FileReference = new FileReference();
fileRef.download(request); | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 2,
"tags": "apache flex, flash, actionscript 3, actionscript, download"
} |
The label is falling down in the list tag
<li><span>Test:</span>
<asp:Label style="float:right;padding-right:5px"
runat="server"
ID="lblTest">
</asp:Label></li>
I have a span and a label(I am aware its also rendered as span), somehow the static span's text is fine but the label's text falls down in the Li element....down to the bottom. I have tried vertical align and text align, top:0, but no luck to have them in a straight line | <li>
<span>Test:</span>
<asp:Label style="display:inline-block;" runat="server" ID="lblTest">hi</asp:Label>
</li>
Change your style to this:
style="display:inline-block;"
It displays the block as below
!Output
# ` Working Fiddle ` | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 4,
"tags": "html, asp.net, dhtml"
} |
Is there a connection between the diagonalization of a matrix $A$ and that of the product $DA$ with a diagonal matrix $D$?
Given a diagonalizable matrix $A = P_0\Lambda_0 P_0^{-1}$ and a diagonal matrix $D$ with $\det D=1$, is there any connection between $P_0$ and the matrix $P$ of the diagonalization of $DA = P\Lambda P^{-1}$? | I know that if A is diagonalizable, and D a diagonal matrix D it is not even true that DA need to be diagonalizable. An example is: $$ D= \begin{bmatrix} 2 & 0 \\\ 0 & 1/2 \end{bmatrix}, \,\, DA = \begin{bmatrix} 1 & 1 \\\ 0 & 1 \end{bmatrix} $$ and of course $A=D^{-1}DA$.
I leave it as an exercise for the reader to verify that indeed $A$ is diagonalizable and $DA$ not.
Although not a complete answer to the question (since this example doesn't say anything about the case where both A and DA are diagonalizable) it at least shows that the question should be posed more carefully.
Also the fact that you want $\det D = 1$ will ensure that the product of the elements in the diagonal of $\Lambda_0$ will be the same as those in $\Lambda$, but I guess you don't need that info since you care about $P$ and $P_0$ | stackexchange-math | {
"answer_score": 3,
"question_score": 1,
"tags": "linear algebra, matrices, eigenvalues eigenvectors"
} |
How do I disable corpses?
I've read on the Darkest Dungeon forums that there's an option to turn off the corpses being left behind after you kill an enemy. I can't seem to find that option anywhere in the options menu, though. Where is it? | I almost deleted this question, since I found the answer a minute later and feel like a dolt, but it is in the options menu. It's just that you actually have to be in a campaign to see those options. If you're on the main title screen, you don't see them. | stackexchange-gaming | {
"answer_score": 13,
"question_score": 8,
"tags": "darkest dungeon"
} |
volume of right Parallelepiped
in a 3 day i have a national exam so i am trying to work hard i have one question from this link
see problem 76. because it is written into Georgian i will translate it right now, problem is following:as you see right Parallelepiped which has dimension `width=10cm` and `height=6cm` is divided into 6 equal right Parallelepiped,we are asked to find volume of each one,sure one of the very simple method is find length calculate volume of original and then divide by 6 i think that for original Parallelepiped,width=10,height=6,and length=10 from figure it seems that base is regular ,so volume of each will be 100cm^3 but i am not sure please help me | Since all of them are identical, from the image you can conclude that the height of each parallelepiped is $\frac{6}{3}=2$ and the width is $10$ and depth $\frac{10}{2}=5$. Hence the volume of each parallelepiped will be $2\cdot10\cdot5=100$ cm$^3$. | stackexchange-math | {
"answer_score": 2,
"question_score": 1,
"tags": "geometry"
} |
Android: bottom popup activity
Hello : i want to make my activity appear like that my activity have a edittext with button inside cardview only . , duration (elapsed time) and length (from lat and lon). How should i do it? | Have a look at ListView, SimpleCursorAdapter and maybe also ViewBinder. How to use those you will find a lot of examples, e.g. this one or this one. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -1,
"tags": "android, sqlite, gps"
} |
Traduction de « effectiveness » — « efficacité » ou « effectivité » ?
Une collègue m'a demandé récemment de relire une traduction, dans laquelle elle utilisait le mot « effectivité » (pour _effectiveness_ ). Spontanément, je voulais lui recommander d'utiliser plutôt « efficacité », mais en vérifiant, j'ai constaté qu'« effectivité » existe bel et bien.
Quel est le meilleur choix ? Quelle est la différence entre les deux ? | Les deux mots ont des sens différents (et peuvent correspondre à « effectiveness ») :
**Efficacité :** relatif à quelque chose qui fonctionne bien.
**Effectivité :** relatif à quelque chose qui est tangible.
_et aussi_ **Efficience :** évalue le degré d'efficacité.
D'instinct, j'aurais dit « efficacité ». Après recherche, mes dictionnaires proposent aussi le même mot. Comme l'indique votre source, « effectivité » est rare. J'opterais donc pour « efficacité ».
Cela étant dit, peut-être que le contexte (droit international, par exemple) fait que le choix de votre collègue est plus pertinent. | stackexchange-french | {
"answer_score": 9,
"question_score": 10,
"tags": "traduction, anglais, vocabulaire"
} |
Node.js crashes when using long interval in setinterval
function createSasTokenTimer() {
console.log("Hello");
}
setInterval(createSasTokenTimer, 3000000);
I run this code and after 50 minutes I get the following error:
Hello
timers.js:265
callback.apply(this, args);
^
TypeError: Cannot read property 'apply' of undefined
at wrapper [as _onTimeout] (timers.js:265:13)
at Timer.listOnTimeout (timers.js:110:15)
When the interval time is shorter ( **2000000** for example), everything works fine.
Is this a bug in Node.js?
* * *
**Update:**
OS: `Windows`, Node.js version: `0.12.4`
When I run only the code above it works fine, but it does break when it's inside my application, I can't point to which part of my code breaks it as it's very lengthy and nothing looks "suspicious". Anyway, when the interval is shorter it works as I wrote. | Instead of calling the Function Directly give it inside a callback.
function createSasTokenTimer() {
console.log("Hello");
}
setInterval(function(){
createSasTokenTimer();
}, 3000000);
Using this method, you are passing an anonymous function to setInterval. It will call this function once per interval, which is 3000000 miliseconds in this example.
For now, you can probably just use this code. For further understanding, I suggest researching anonymous functions and closures.
Hope this helps. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 30,
"tags": "javascript, node.js, setinterval"
} |
Switch monitor configurations on Windows 7
I use one of my PCs for flight simulation as well as for home theater. In case one it has 2 monitors attached, and in case 2 (home theater) a HD TV is being used. All 3 monitors are attached at the same time to the graphics card.
How could it best switch best between different configurations. In case 1 I'd like to have the configuration with monitor 1/2, alternatively I'd like quickly to switch to another config only with the HD TV as primary screen.
A similar question has been asked 6 months back with no full solution yet, so I come up with it again. The comment there of Darius ( **Windows + P key** ) is the best so far. | Using **Windows + P key** for a while now, and it is fine.
From above: A similar question has been asked 6 months back with no full solution yet, so I come up with it again. The comment there of Darius (Windows + P key) is the best so far. | stackexchange-superuser | {
"answer_score": 0,
"question_score": 1,
"tags": "windows 7, multiple monitors, external display"
} |
Как вывести в цикле на Python часть последовательно расположенных символов unicode?
Добрый вечер!
Подскажите, пожалуйста, как на Python вывести в цикле символы unicode. Нужно, чтобы значения элементов матрицы отображались в виде букв латинского алфавита и арабских цифр: a1, a2,...b1, b2...h1,h2...
<python>
class matrix:
def __init__(self,n,m):
b=[0]*n
for i in range(n):
b[i]=[0]*m
for i in range(0,m,1):
for r in range(0,n,1):
letter=61+i
#b[i][r]=(str(i) + str(r)+" ")
#b[i][r]=str('\x61') + str(r)+" ")
b[i][r]=str('\xletter') + str(r)+" ")
for row in b:
for elem in row:
print (elem, end=' ')
print()
mat=matrix(10,10)
</python> | from string import lowercase
for i in xrange(26):
print lowercase[i] | stackexchange-ru_stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "python, циклы, unicode"
} |
Storyboard segue
I added this code to perform a segue:
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"groupselection"];
[self.navigationController pushViewController:controller animated:YES];
I then gave the viewcontroller in the storyboard this id: groupselection
But the segue is not performed!! Any ideas? | yes, you do not push view controllers in storyboards so don't use PushViewController.
You use
[self performSegueWithIdentifier:@"Identifier you gave your segue"];
then you wire up the segue inside the storyboard by control dragging. Make sure you drag from the existing controller (the yellow circle below the controller with square inside it) to the new one, and then selecting what kind of segue you want (push, modal, replace)
!enter image description here
then you will see a wire connecting the two controllers. Click on the middle circle, when the story is zoomed in all the way. In identity inspector on the right, give this seugue an identifier. That's the name you will use in your code. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 0,
"tags": "ios, xcode"
} |
C# .net Core Fluentvalidation manual validation get validator class instance
I am trying to get the validator class instance instead of manually initiating in my method.
I am using Asp .net core webapi 2 where I register my validator in startup class using
services.AddMvc().AddFluentValidation().
In one of my action method, I had to validate a ruleset. So I am creating my validator class locally like
var validator = new MyClassValidator()
var result = validator.Validate(obj,ruleSet: "RulesetName");
I am trying to avoid this statement `var validator = new MyClassValidator()`. I would like to use IOC and get an instance. Any help? | It is required to register `MyClassValidator` in IoC container manually:
services.AddTransient<IValidator<T>, MyClassValidator>();
As documentation states, you don't need to use an instance of this class manually, `FluentValidation` will validate it automatically.
> FluentValidation can be integrated with Asp.NET Core. Once enabled, MVC will use **FluentValidation to validate objects that are passed in to controller actions by the model binding** infrastructure.
Anyway, if you need to use this class manually, you can simply add a parameter of type `IValidator<T>` to your desired constructor. | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 3,
"tags": "c#, validation, asp.net web api, asp.net core, fluentvalidation"
} |
How to exact substring from string using index value in SharePoint 2010 workflow
How to create workflow where two substring can be exacted from one and can be saved in two different column of the list. I have title like arrow_black, I want to exact arrow and black from this title.
Something like this in SharePoint using workflow
**Please note:** I want to implement this in SharePoint 2010
Title:- Arrow_black
Icon :- Arrow
Color:- Black
Thanks! | You should be able to accomplish what you want by using calculated columns, tedious I know but sometimes that's just SharePoint.
Try the following link to get the formula that you want to put in your columns
Using calculated field to retrieve substring of another field | stackexchange-sharepoint | {
"answer_score": 2,
"question_score": 1,
"tags": "2010, workflow"
} |
Find a vaule from columns of a dataset asp.net
I Want to find the value from dataset column Id. here is the dataset
Id Value
1 football
2 Tennis
3 Cricket
If any one is absent in Column then i want to append that particular value in the dataset | I guess that is a DataTable inside a DataSet. First you need to query if the id is in the DataTable:
var dataTable = dataSet.Tables[0]; //For this example I'm just getting the first DataTable of the DataSet, but it could be other.
var id = 1;
var value = "football";
//Any(...) will return true if any record matches the expression. In this case, the expression is if a Id Field of the row is equals to the provided id
var contained = dataTable.AsEnumerable().Any(x =>x.Field<int>("Id") == id);
Then, if it's not there, add a new row:
if(!contained)
{
var row = dataTable.NewRow();
row["Id"] = id;
row["Value"] = value;
dataTable.Rows.Add(row);
}
Hope it helps | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": -4,
"tags": "asp.net, dataset"
} |
How to use mirrorOf in Maven
What is the difference between using
<mirrorOf>central</mirrorOf>
and
<mirrorOf>*</mirrorOf>
We have a Nexus server running proxied to the Maven public repository and using "*" instead of "central" downloads some artifiacts but not all.
Reading < does not suggest what could cause this ? | <mirrorOf>central</mirrorOf>
says if request comes to lookup for central maven repository look in its mirror instead
where
<mirrorOf>*</mirrorOf>
says for any request to download from any repository look in this mirrored repository
if you have second and if it is failing to download some artifacts it could be because you are not proxying certain repository in your own nexus repository | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 5,
"tags": "maven, nexus"
} |
Kolsch fermentation temps and schedule
I'm brewing a Kolsch beer for the first time with a pretty straight forward recipe using WLP029 yeast. I've only brewed basic ales so far and I'm confused about the fermentation temps and times for this style. From what I read on the White Labs site this yeast is not successful below 62f, but from what I understand Kolsch style should be lagered. Should I treat it as a lager and primary ferment at 62f until it's 75% complete and then move to a secondary and lager it for several weeks at 50f or so? Or should I just keep it at 62f for primary and secondary. | Ferment at the recommended temperature until terminal gravity is achieved, and then lager at near freezing temperature. If you bring the temp down to 50 F. Before terminal gravity is reached the mostly likely outcome is a stalled fermentation. | stackexchange-homebrew | {
"answer_score": 4,
"question_score": 1,
"tags": "beer, fermentation temperature, beer styles"
} |
Xcode bug after crash
While I was creating a build to test on my iPhone xcode 8 crashed, when I re-opened xcode all of a sudden this error came about from no where.
> Command /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool failed with exit code 255. The tool may have crashed. Please file a bug report at < with the above output and attach any crash logs for ibtool, ibtoold, Xcode, and Interface Builder Cocoa Touch Tool created around the time of this failure. These logs can be found in ~/Library/Logs/DiagnosticReports or /Library/Logs/DiagnosticReports.
Can any one tell me how to resolve this. | I deleted anything related to my project from
> ~/Library/Developer/Xcode/DerivedData
and it seems to work now. | stackexchange-stackoverflow | {
"answer_score": 9,
"question_score": 8,
"tags": "ios, xcode, xcode8"
} |
Is $(x^2y,xy^2)$ log smooth?
Consider the map $$f:\mathbb C^2\to\mathbb C^2$$ $$(x,y)\mapsto(x^2y,xy^2)$$ We can view $f$ as induced by the map of monoids $g:\mathbb Z^2_{\geq 0}\to\mathbb Z^2_{\geq 0}$ given by the matrix $(\begin{smallmatrix}2&1\cr 1&2\end{smallmatrix})$. Thus $f$ is a map of log schemes.
> Is $f$ log smooth?
If I understand Proposition 6.1 from < correctly, the answer is supposed to be yes, since $\ker g$ and $(\operatorname{coker} g)_{\mathrm{tors}}$ are both finite.
On the other hand, log smooth maps are supposed to be flat, and flat maps are open. Thus if $f$ were log smooth it would have to be open. But it is not open: $(0,0)$ is in the image of $f$, but $(0,a)$ is not whenever $a\ne 0$. | It is smooth. For a log map to have good "fiber bundle properties", one needs more than smoothness. Rather, one needs the relevant maps of monoids to be **exact** in the sense of Kato. A reference is Nakayama--Ogus "Relative rounding in toric and logarithmic geometry" Mathscinet Journal. | stackexchange-mathoverflow_net_7z | {
"answer_score": 0,
"question_score": 7,
"tags": "ag.algebraic geometry, toric varieties, flatness, smoothness, log geometry"
} |
Validation for phone and mobile numbers
I tried it on Google but not get proper RE.will someone help me to achieve this : Phone Number: (Country Code)-(City Code)-(Number) Mobile Number: (Country Code)-(Number)
obviously that should not take char. Please help me | This is the site for **regular expression**. note it down for future reference, you won't ever be dissapointed
For phone numbers: **
now here are some samples from there
**PhoneNumbers**
* ^[2-9]\d{2}-\d{3}-\d{4}$
* (((\d{3}) ?)|(\d{3}-))?\d{3}-\d{4}
* (([0-9]{2}|0{1}((x|[0-9]){2}[0-9]{2})))\s*[0-9]{3,4}[- ]*[0-9]{4}
**Mobiles:**
* ^[+]447\d{9}$
* ^(+44\s?7\d{3}|(?07\d{3})?)\s?\d{3}\s?\d{3}$
Hope it helps | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 0,
"tags": "regex, validation, mobile"
} |
SQL Query Retrieving Latest Row When Other Columns Are Equal
I'm having trouble figuring out the SQL statement to retrieve a specific set of data. Where all columns are equal except the last update date, I want the most recent. For example.
Book Author Update
John Foo 1/21/2010
John Foo 1/22/2010
Fred Foo2 1/21/2010
Fred Foo2 1/22/2010
What's the query that retrieves the most recent rows? That is, the query that returns:
Book Author Update
John Foo 1/22/2010
Fred Foo2 1/22/2010
TIA,
Steve | SELECT
book,
author,
MAX(update)
FROM
My_Table
GROUP BY
book,
author
This only works in this particular case because _all_ of the other columns have the same value. If you wanted to get the latest row by book, but where the author (or some other column that you will retrieve) might be different then you could use:
SELECT
T.book,
T.author,
T.update
FROM
(SELECT book, MAX(update) AS max_update FROM My_Table GROUP BY book) SQ
INNER JOIN My_Table T ON
T.book = SQ.book AND
T.update = SQ.max_update | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 1,
"tags": "sql"
} |
Access a variable defined in a CommonJS library from the global browser scope
I have a "browserified" library which defines some React components, which I would like to load from an HTML page (served from a Rails app), and then instanciate the React components, fed by some data put inside the page by Rails.
_(The big picture is: we have a TurboLinks app, and we want to use some React components for very specific parts, needing more reactivity.
The Rails page would so load both React runtime & the needed applicative components lib, and then generate minimal raw JS to instanciate the React component as needed)_
All I found were ways to expose external libs variables to _my_ lib, but I would like to expose **_my_** variables to global browser scope.
I ended up by exporting the classes in a rather ugly way (`window.Stuff = Stuff;`) directly from the `.jsx` source file, but I feel like this code is smelling...
Any suggestion on a better way to achieve such thing? | Either expose the modules in your browserify bundle, e.g.:
browserify()
.require('./whatever', {expose: 'whatever'})
Then from the Rails page JS:
require('whatever');
Or:
Create a standalone browserify bundle something like this:
browserify('./entry', {standalone: 'something'})
`entry.js`
module.exports = {
whatever: require('./whatever')
};
Then from the Rails page JS:
window.something.whatever; | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "javascript, reactjs, browserify, commonjs, browserify shim"
} |
Php email validation (nothing happend)
Can someone tell me why this is not working to validate this email.
if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) {
echo 'Nope';
}
* * *
<div class="join input-group">
<a class="join_topic">Email *</a>
<input type="text" name="Email" id="Email" value="<?php echo escape(Input::get('Email')); ?>" class="form-control">
</div>
When i press register nothing happend when i type "123" as the email.. | "123" is not a valid email address by the specifications of the FILTER_VALIDATE_EMAIL filter which is why you're not seeing a response. Enter "[email protected]" and it should work fine. You might also want to and an else conditional while you're at it.
if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) {
echo 'Valid Email';
}else{
echo 'Not Valid';
} | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "php"
} |
Error of argument type with _beginthreadex
To define my thread I have in my Header file:
class HttpClient
{
public:
...
unsigned int __stdcall PerformLogin(void*);
...
};
Then in my cpp file I have:
unsigned int __stdcall PerformLogin(void*){
...
}
And to call this thread I use
hThread = (HANDLE)_beginthreadex( NULL, 0, &PerformLogin, NULL, 0, &threadID );
But i Have an error on the `&PerformLogin` saying that:
> the args of type unsigned int (__stdcall HttpClient:: _)(void_ ) is not compatible with the param unsigned int (__stdcall*)(void*).
I understand the error, but I really don't know how to fix this! | A possible way to fix this would be to make the member function `static`, though this means `PerformLogin()` does not have a `this` pointer and would have no access to non-static members of `HttpClient`.
Another is to move `PerformLogin()` out of `HttpClient` altogether, and make it a free function. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "c++, multithreading, arguments, beginthreadex"
} |
MS Word 2013: How do I change which text boxes are on top of the other?
I have two text boxes. One slides under the other so that it is obstructed and covered up. How I do I make one text box have precedence over another? (In terms of depth.) | Right click -> Send to back -> Send backward
You need to right click the side of the textbox and not the text itself. If the text is selected, you get the text context menu.
Alternatively, you can select the textbox and then click send backward from the drawing tools - format ribbon. | stackexchange-superuser | {
"answer_score": 1,
"question_score": 0,
"tags": "microsoft word"
} |
Set the timestamp on a Linux file in C#
does anyone know how to set the time-stamp of a Linux (text) file to an arbitrary value, not necessarily the current time, using C#?
For example, could I run code to change the timestamp of `filepath/foobar` to `Thu 04 Oct 1995 09:15:00 AM CDT`?
Preferably, this would work for both the accessed and modified stamps.
Thank you! | If I am understanding the question you would want to use File.SetLastWriteTime(). More information on it can be found here < | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 1,
"tags": "c#, linux, timestamp"
} |
Pass URL parameter to a JSF backing bean with remote Command
I want pass a URL parameter to a JSF backing bean within a remote Command.
If I print, in the page, `#{param.id}` with a `<h:outputLabel>` it works.
If I pass it to a backing bean and print it in a method's bean I get null also if passing only `{param}` I the reference to the parameter. In other if I pass a static value it works.
Page.xhtml:
<h:form>
<p:remoteCommand name="rmtinit" autoRun="true" immediate="true"
action="#{confirmbean.setta}" async="false">
<f:setPropertyActionListener target="#{confirmbean.id}" value="#{param.id}" />
<f:setPropertyActionListener target="#{confirmbean.idStatic}" value="900099" />
</p:remoteCommand>
</h:form> | Remove `immediate` attribute and try again.
Default immediate value is false.
Value of immediate attribute that determines the phaseId of the action event, when true actions are processed at "Apply Request Values", when false at "Invoke Application" phase. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "jsf 2, primefaces"
} |
How to calculate the limit of series involving logarithm
I'm trying to calculate the limit of the series
$S:=\sum_{i=1}^\infty \ln(1-2^{-i})$
and I'm not really sure how to do this. Maple is able to approximate the result but I don't think it is possible the express the result exactly. Any idea how to do approximate this result? My goal is to show that
$\exp(S)\geq 1/4$ | **Hint:** By concavity of the function $x \mapsto \ln(1 - x)$ the inequality $\ln(1 - x) \ge x \ln\left(\frac{1}{4}\right)$ holds for all $x \in \left[0, \frac{1}{2}\right]$. | stackexchange-math | {
"answer_score": 2,
"question_score": 1,
"tags": "sequences and series, numerical methods"
} |
CSS :not() not working properly
So I have a code structure like this:
.header-container a:not(.header-menu-right a) {
display: none;
}
<div class="header-container">
<div class="header-menu-right">
<ul>
<li><a href="#">link</a></li>
<!-- unimportant links -->
<li><a href="#">link</a></li>
<!-- unimportant links -->
</ul>
</div>
<a href="#">link</a>
<!-- important link -->
</div>
As you can see by the notes, I only want CSS to change the last a-tag.
What am I doing wrong here? | Try this and there you go:
.header-container > a {
display:none;
}
Thanks! | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "html, css, css selectors"
} |
What to do with star developers who don't document their work?
There is a colleague who seriously knows his stuff, he is one of the brightest I've ever worked with, but he:
* works in his own little area of his home directory rather than in the common CVS repository
* doesn't **document** his code
* doesn't **comment** his code, e.g. 3,500 SLOC of C with no comments and no blank lines to break things up
* often overcomplicates things, e.g. uses three shell scripts that call one another to do the work that one simple shell script could do.
Maybe this possibly is one of those people who thinks "if I'm the only person who knows this, they can't get rid of me"?
Any suggestions on what to do?
BTW Management knows about the situation and are trying to change things. | In my opinion somebody doing such stupid things as you have described above can't be a star developer! To me it seems like he intentionally makes things more complicated as they are, so that nobody else than himself can maintain the code. This makes himself more important than he really is! Talk to him. He has to change it! If he doesn't, replace him with a real star-developer!
I promise you, in even half a year he will not know how his own code works! Fire him and you can save a lot of time and money. | stackexchange-stackoverflow | {
"answer_score": 126,
"question_score": 43,
"tags": "collaboration"
} |
How to plot heatmap function over the unit circle
I have a function $Z(r, \theta)$ that I would like to plot over the unit disk. I could of course plot it as $Z(\sqrt{x^2+y^2}, \arctan(y/x))$, but the best I can do with this is a square plot. I would like a plot defined from $0<R<1$ and $0<\theta<2\pi$, such that it looks something like the plots shown here:
!Zernike polynomial plots
How can I make _Mathematica_ generate a plot like this? Thank you! | Here's my attempt to plot the Zernike functions on the unit disk:
ZernikeZ[n_Integer, m_Integer, r_, θ_] /; -n <= m <= n :=
If[m < 0, Sin[m θ], Cos[m θ]] ZernikeR[n, m, r]
Table[DensityPlot[ZernikeZ[n, m, Norm[{x, y}], ArcTan[x, y]], {x, y} ∈ Disk[],
ColorFunction -> (ColorData[{"ThermometerColors", "Reverse"},
LogisticSigmoid[2 #]] &),
ColorFunctionScaling -> False, Frame -> False,
PlotPoints -> 55],
{n, 0, 4}, {m, -n, n, 2}] // GraphicsGrid
!Zernike on a disk | stackexchange-mathematica | {
"answer_score": 8,
"question_score": 5,
"tags": "plotting"
} |
Replace Values in Dataframe Column based on match in second data frame columns
I've seen a half dozen or so solutions to this on Stack Overflow, but, all dealing with matches within a single data frame using 'within'. I need a solution that goes across multiple dataframes:
I have values in a column in Data Frame 1
> `DF1$A`: "1, 2, 1, 3, 2, 6, 4, 5, 8, 8, 2, 7, 4, etc."
I have a second data frame with the 'key' to these codes
> `DF2$A`: "1, 2, 3, 4, 5, 6, 7, 8, 9, 10"
>
> `DF2$B`: "Pie, Pizza, Hamburgers, etc."
How do I change the values in `DF1$A` to match the values in `DF2$B` ? | You can do this with `match` as a pointer to specific positions in `df2$B`:
# make some toy data
set.seed(1)
df1 <- data.frame(A = sample(seq(3), 10, replace = TRUE))
df2 <- data.frame(A = seq(3), B = c("pizza", "hot dog", "hamburger"), stringsAsFactors = FALSE)
df1$B <- df2$B[match(df1$A, df2$A)]
Result:
> df1
A B
1 3 hamburger
2 1 pizza
3 2 hot dog
4 1 pizza
5 1 pizza
6 2 hot dog
7 1 pizza
8 2 hot dog
9 3 hamburger
10 2 hot dog | stackexchange-stackoverflow | {
"answer_score": 11,
"question_score": 6,
"tags": "r"
} |
How to get the inactivity of the user for eg. when the device is still and not moving?
Trying to create my first android application, I am creating an application that will track a user who hasn't moved in a while and notify them to move. I need to ask how can I achieve this ? What I am essentially looking here is a timer starts when the device is inactive and when the device moves the counter stops and that data is stored. Are there any API's for this ?
**Google Fit API ?**
Many of the sleep tracking applications do this, they track the device is stable at night and when the user picks up the phone they end the timer and they display the time user was asleep at night.
Any help would be great! | I recommend using the Activity Recognition API, which is part of Google Play Services.
You would want to listen for the `STILL` event.
About using this API: Here's a tutorial video Here's a Google sample app
Some additional info:
You might want to combine this with a timer (like no change in `STILL` after X minutes or hours), and also take the time into account: The device will obviously not be moving at 3 AM, but you don't want the user to be moving at that time, since he is sleeping. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 1,
"tags": "android"
} |
How can I change the “Indexed: Yes (No Duplicates)” constraint in MS Access to “Indexed: Yes (Duplicates OK)” via SQL?
is there any possibility to change this constraint?
I dropped constraint: "ALTER TABLE [table] DROP CONSTRAINT constraint1;" but I cannot add a new constraint with Yes (Duplicates OK).
How can I do this? | It's no longer a constraint. It's just an index:
CREATE INDEX IX_ABC on Table1 (ABC); | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "sql, ms access"
} |
Using CMD to compile Jar files (for class use) with Java Files
I am trying to use the Gson Java library for ArrayLists to JSON object class use.
My current Bat code for compiling it is this:
@echo off
javac -cp ".;/gson-2.8.2.jar" AdobeExtender.java
java -cp ".;/gson-2.8.2.jar" AdobeExtender
pause
This is what I am using in my java code to call the class in the jar file
String aeKeysJson = new Gson().toJson(aeKeys);
I am using the gson-2.8.2.jar. These are all in the same directory. The file will not compile and will not recognize the class gson. | You have to remove the slash character `/` before the name of the gson-2.8.2.jar, in this way
@echo off
javac -cp ".;gson-2.8.2.jar" AdobeExtender.java
java -cp ".;gson-2.8.2.jar" AdobeExtender
pause | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 1,
"tags": "java, class, object, jar, gson"
} |
Preventing duplicate guesses
I am working on code that will prevent the String from appending duplicate guesses, preventing 2 of the same letter from showing up. Currently the code is able to detect duplicate letter, however, only displays it after a second press.For example I press "q" and nothing happens. I press "q" again, and now the string updates with q. I want it to display q right after the first guess.
Code:
public void keyPressed(KeyEvent e) {
keyChar = e.getKeyChar();
String guessedLetters = buffer.toString();
statusMsg.setText(model.guessNotification());
if(guessedLetters.contains(Character.valueOf(keyChar).toString())) {
guessedLetters = buffer.toString();
}
else{
buffer.append(keyChar);
}
} | You aren't re-assigning `guessedLetters` after you append a letter to the buffer.
(You also don't really need to re-assign `guessedLetters` in the `if` block, since the buffer hasn't changed since the first assignment. But this is not the cause of your issue.)
(Also, as others have pointed out, a collection would be a better approach than a StringBuffer. But you'd still have to convert the contents of the collection to a string for display, and you'd still have to remember to do that _after_ adding an element to the collection.) | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 1,
"tags": "java"
} |
Get array of objects from array (of strings e.g.)
I need to get array of objects from array of strings. For examaple:
var arr = ["1005", "1005", "1005", "1006", "1006", "1006", "1007", "1007"];
var result = arr.reduce((iss, index) => {
iss[index] = (iss[index] || 0) + 1;
return iss
}, {});
and the result would be
{1005: 3, 1006: 3, 1007: 2}
So is there a way to get next output:
[{"1005":3},{"1006":3},{"1007":2}] | If you really want that:
result = Object.entries(result).map(([key, value]) => ({[key]: value})); | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "javascript, arrays"
} |
Using the epsilon-delta definition, show that $\tan x$ is not uniformly continuous on $\left[0, \frac{\pi}{2} \right)$.
Fix $\varepsilon$ greater than zero. We need to find $x$ and $y$ such that $|x-y| < \delta$ then $|\tan x - \tan y| > \varepsilon$ for all $\delta$. I am having trouble finding such $x$ and $y$, do they depend on $\delta$? | By the Mean Value Theorem, for any $x,y\in [0,\pi/2)$ there is $z$ between $x$ and $y$ with $$\tan x-\tan y = \sec^2(z)(x-y),$$ and no matter how we bound $|x-y|$, this goes to infinity as we move $x$ and $y$ closer to $\pi/2$. So, you could say given any $\delta>0$ we can find $\pi/4\leq x<y$ with $|x-y|=\delta/2<\delta$ but $\sec^2(x)\geq \frac{2\varepsilon}{\delta}$ and therefore $$|\tan x-\tan y| = \sec^2(z)|x-y| > \sec^2(x)|x-y|\geq\varepsilon.$$ Alternatively, you can do it without the MVT, using that sine goes to one as $x$ and $y$ go to $\pi/2$ while cosine goes to zero. | stackexchange-math | {
"answer_score": 0,
"question_score": 0,
"tags": "real analysis, uniform continuity"
} |
What to do after running curl command in the command prompt
After I run this in the
`curl -H "Authorization: MySecretAPI" \ "
How do I use this in my JSON project in this format
`$.getJSON(URL, function (data) {...` What should I put for URL, what is the endpoint | You need to add the authentication header.
try that
$.ajax({
url : '
dataType: 'json',
headers: {'Authorization': 'MySecretAPI'},
success : function(data) {
console.log(data);
}
}); | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "javascript, json, api, curl, cmd"
} |
How to invalidate specific session at logout in Rails /w Devise?
I want to invalidate the session when a user logs out using Devise, i have a callback to catch when a user logs out, for more protection against session hijacking.
class ApplicationController < ActionController::Base
def sign_out(*args)
super(*args)
reset_session
end
end
My understanding was that this would remove the session info stored on the server side, therefore invalidating it.
However I can still login using the session id I got before signing out. Am I misunderstanding how it works? I only want to invalidate just this session, not all of them.
I am using the default for session_store. | After some googling and meditating, I came apon this question, which could be modified to fit my needs,
all I did was
application_controller.rb
def sign_out(*args)
current_user.update_attribute(:current_sign_in_token, "")
super
end
which will invalidate the sign_in_token, thus invalidating the session, so hijacking the session id will still get you kicked out. | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 8,
"tags": "ruby on rails, session, devise"
} |
Which image formats contain meta data, and how can I clear it in PHP?
Privacy concerns have lead me to believe I should scrub user uploaded images for any meta data.
I know that JPEG have EXIF, but I'm not sure about PNG or GIF (both are able to be uploaded to my site from the public).
Do these formats have meta data too, and how is it stored? What is the best way to remove it?
I'm using PHP 5.29.
Thanks | The easiest way is to copy them to a new image with GD - you keep all the image info, but get rid of the metadata. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 6,
"tags": "php, image, metadata"
} |
PHP undefined index error when clicking a url and invoking a php script
I have a call to a PHP script from my home page which I do like this:
echo '<a href="/problems/delete_problem.php?problem_id='.$problem_id.'">Delete</a>';
So it is pretty standard.
Then in my PHP I have this code:
<?php
// delete_problem
include '../connect.php'; // Here I have db connection settings
error_log ( ".......in delete problem");
$problem_id = mysql_real_escape_string($_GET["problem_id"]);
?>
And the last line where I try to get the problem_id is throwing the undefined index error. Any idea why?
Thanks! | Have you got an actual connection inside connect.php? Or does it just store variables and the like?
`mysql_real_escape_string` may be causing a problem as if a connection is not available it will fail.
Beyond that, try echoing out the contents of the GET variable. You can also check whether it exists by using `(isset($_GET["problem_id"]))`. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 0,
"tags": "php"
} |
Edit HTML in JavaScript variable using Jquery
I have this code:
var a = '<span class="select-me">hohoho</span><input type="text" class="alias" />';
$(a).filter('input.alias').val('my new alias');
console.log(a);
Can I do this using jQuery `filter` method?
Am expect console.log(a),
<span class="select-me">hohoho</span><input type="text" class="alias" value="my new alias" /> | You need to save the variable after you've changed it, also not that .val() will change the property of the input not the attribute. if you wish to change the attribute use `.attr('value','my new alias');`
var a = '<span class="select-me">hohoho</span><input type="text" class="alias" />';
a = $(a).filter('input.alias').val('my new alias');
console.log(a);
**DEMO** | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "javascript, jquery, html, variables, jquery selectors"
} |
How to store session id and expiration time to database?
How to store session id and expiration time to database? Please give me a suggest. | Creating sessions in db:
Rails sessions current practices
Sweeping sessions:
< | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "ruby on rails, ruby on rails 3, session"
} |
Interpreted string literals in Go
It's frequently nice to write long, informative strings for log messages or stderr messages. Python handles this with comma separated string literals, like:
log.warn("The operation failed on the %d iteration. "
"Resumed on the %d iteration.",
failed, resumed)
Go appears to have a solution for raw string literals, by using back quotes but I can't find any style guide for interpreted string literals. Am I missing something or is there no option but to use a variable? E.g.
msg := fmt.Sprintf("The operation failed on the %d iteration. ", failed)
msg += fmt.Sprintf("Resumed on the %d iteration.", resumed)
log.println(msg) | First of all, I don't see how your python example would even work. Here's something similar:
>>> import logging
>>> logging.warn("foo %d", "bar %d", 1,2)
causes:
TypeError: %d format: a number is required, not str
Second, in Go, you have a few options:
Multi-line strings:
msg := fmt.Sprintf(`The operation failed on the %d iteration.
Resumed on the %d iteration.`, 2, 3)
log.Println(msg)
But this will result in a multiline message.
Another option:
log.Println(fmt.Sprintf("The operation failed on the %d iteration. ", failed),
fmt.Sprintf("Resumed on the %d iteration.", resumed))
which both looks better and will probably be faster than string concatenation. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 3,
"tags": "go, coding style"
} |
Is a polypropylene container safe for sous vide use?
 plastic container which appears to be ideal for sous vide cooking. It was sold as food grade, freezer & microwave safe, and has all the relevant marks on the bottom to confirm this rating. It is manufactured from polypropylene and is (PP5) graded.
Looking online, all the other sous vide baths I see are manufactured out of much more expensive polycarbonate, and this container was a fraction of that cost. I assume here that polycarbonate has been chosen because it is more rigid than polypropylene.
I have tested this up to 85 Centigrade and the walls of the container flex and bow only slightly more than they do when cold. I doubt if I will sous vide beyond 75 Centigrade, am I taking a risk using this product here? | Polypropylene is fine for use up to (or even past) boiling temperatures. I scald milk for yogurt by steaming it in used PP5 yogurt containers.
Indeed, this list rates PC as 10°C lower service (90-125°C) than PP (100-130°C), or basically equivalent for "high heat" PC at 100-140°C). | stackexchange-cooking | {
"answer_score": 3,
"question_score": 6,
"tags": "sous vide, kitchen safety, safety"
} |
JS minus 1 day from date input
Without having to worry about timezone or anything, what's the fastest and best way to -1 day from the input=date on my form within JS, covert to string as YYYY-MM-DD so it can be parsed and used to post to API etc?  prints the string "YYYY-MM-DD" \- I need to minus 1 day from this string in a new variable
Here is my code from the date input "Date To":
<input type="date" name="date_to" />
var date_to_selector = $(this).parent().find("input[name=date_to]");
var date_to = date_to_selector.val();
I've looked into this and many suggest moment.JS or toISOString but I don't want to have to worry about timezones etc. | You can get the input's `valueAsDate` property, then set its date to the day of the selected date minus 1:
$('input[type="date"]').change(function(){
const date = $(this).prop('valueAsDate')
date.setDate(date.getDate() - 1)
const res = date.toLocaleDateString('en-US', {year: 'numeric', month: '2-digit', day: '2-digit'}).split('/').join('-');
console.log(res)
})
<script src="
<input type="date" name="date_to" /> | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 1,
"tags": "javascript, html, json"
} |
python: sort a nested dictionary
I have a nested dictionary of type following
{id_1 : [ {id_2:score},{id_3:score_2} .... and so on],id_2 :[{id_1:Score_!....]}
so basically a nested dictionary Now I want to sort this dictionary per primary id on the basis of score so basically
{id_1: [{element with max_score},{element_with next max_score....}]... id_2:[{element_with max_score},{element_with next maxx score}...]
also, the function should take an argument say (n) which returns the top n matches or if the n< number of elements of that id then it returns teh complete list any Ideas/ thoughts.. Thanks | You can use the `key` parameter to `list.sort()`. Assuming the outer dictionary is called `d`, the code could look like this:
for scores in d.itervalues():
scores.sort(key=lambda x: next(x.itervalues()), reverse=True)
The lambda function simply extracts the single value of the dictionary.
I think you'd be better off using tuples instead of dictionaries as the values of your list:
{id_1: [(id_2, score_2), (id_3, score_3),...], id_2: [(id_1, score_1),...]}
Using this data structure, the sorting code would be
for scores in d.itervalues():
scores.sort(key=lambda x: x[1], reverse=True)
or equivalently, but slightly faster
for scores in d.itervalues():
scores.sort(key=operator.itemgetter(1), reverse=True) | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 0,
"tags": "python, dictionary, nested"
} |
A is diagonalizable
Let $ f(x)= x^{n}-nx+1 $ and let $A$ be an $ n \times n $ matrix with characteristic polynomial $f$. I am going to prove that if $n> 2$ then $A$ is diagonalizable over the complex numbers.
If we show that $f$ and $f'$ do not have common zeros can we say that $f$ has no multiple zeros namely if $ \alpha $ is a zero of f $ (x-\alpha)^{2} $ is not a divisor of $f$? So we have $n$ different eigenvalues of $f$. Hence $A$ is diagonalizable.
Also $A$ is diagonalizable if $n=2$. | Correct. Whenever the characteristic polynomial has distinct roots, the corresponding linear transformation is diagonalizable. | stackexchange-math | {
"answer_score": 2,
"question_score": 3,
"tags": "linear algebra"
} |
How to get RGB values from UIColor?
I'm creating a color object using the following code.
curView.backgroundColor = [[UIColor alloc] initWithHue:229 saturation:40 brightness:75 alpha:1];
How can I retrieve RGB values from the created color object? | const CGFloat *colors = CGColorGetComponents( curView.backgroundColor.CGColor );
These links provide further details:
* UIColor Reference
* CGColorGetComponents reference | stackexchange-stackoverflow | {
"answer_score": 87,
"question_score": 104,
"tags": "ios, rgb, uicolor"
} |
How i can check MariaDB is Standard or Enterprise Edition
I am using MariaDB 10.5.13. Need to confirm is my database is enterprise or standard edition?
Checked google and I need to know if they have an ENTERPRISE or COMMUNITY MYSQL edition found below SQL Query:
SHOW VARIABLES LIKE "%version%";
When i execute above query in version_comment i am getting MariaDB Server.

{
var sb = new StringBuilder();
foreach (var x in node.ChildNodes)
{
if (x.NodeType == HtmlNodeType.Text)
sb.Append(x.InnerText);
if (x.NodeType == HtmlNodeType.Element && x.Name == "br")
sb.AppendLine();
}
return sb.ToString();
}
}
just find the node and call node.InnerText() | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": -1,
"tags": "c#, html agility pack"
} |
Skype can't connect
After I restarted my computer to finish a upgrade, I could not log in at Skype anymore.
It only shows the message:
> Skype can't connect.
If I try web version it works. I'm using Skype 4.2. | According to this post, skype versions older than 4.3 are unable to connect as of today (2014-08-01). Though it could have just been a temporary outage of the skype servers, I was able to connect after updating skype. | stackexchange-askubuntu | {
"answer_score": 67,
"question_score": 70,
"tags": "skype"
} |
What is the difference between concealment and secrecy in context of confidentiality?
I just started studying up for the CISSP and am having trouble understanding few concepts.
This is regarding `confidentiality`, Below are some of the aspects of confidentiality
* Sensitivity
* Discretion
* Criticality
* Concealment
* Secrecy
* Privacy
* Seclusion
* Isolation
My question is about `concealment` and `secrecy`. These two concepts appear to be the same. Can someone explain how they are different? | Concealment is hiding something or someone. What is concealed may or may not be protected. Perhaps it is merely hidden. Concealment is something done to prevent disclosure, usually a single action.
Sergeant Jones wants to conceal his truck from aircraft, so he hides it in a garage. But if he had wanted to protect it too, he would have put in a bunker. Concealment means hiding. We rarely speak of a level of concealment.
Now he has a plaintext message. He is going to conceal it inside a photo and send it to the friendly local militia. If he had wanted to protect that message, he would have encrypted it.
Secrecy is a practice, the state of holding secrets, between people. Everything that Sergeant Jones does is done in a climate of secrecy vis-a-vis a specific threat or threats. We can then speak of levels of secrecy. Secrecy expresses overall security needs--the big picture of relationships, trust, privacy, and disclosure. | stackexchange-security | {
"answer_score": 2,
"question_score": 1,
"tags": "confidentiality, cissp"
} |
Programmatically scroll UIScrollView using subview element
I would like to know how to access a UIScrollView using a subview UILabel.
I have tried to access the UIScrollView using `.superview`; however I am now receiving an error
No visible @interface for 'UIView' declares the selector 'scrollRectToVisible:animated:'
The code I am using looks like this
- (void) SymbolButtonPressed:(NSString *)selectedString {
UILabel *label = (UILabel *)[self.view viewWithTag:currentlySelectedTag];
// perform scrolling here, figure out what view your uilable is in.
float newPosition = label.superview.contentOffset.x+label.frame.size.width;
CGRect toVisible = CGRectMake(newPosition, 0, label.superview.frame.size.width, label.superview.frame.size.height);
[label.superview scrollRectToVisible:toVisible animated:YES];
} | The superview of a `UILabel` is of type `UIView` and so does not respond to the method you are trying to call. You can cast the superview as a `UIScrollView` so that Xcode can see the methods and properties you are trying to access. You should also check if the superview responds to the method.
if([label.superview respondsToSelector:@selector(scrollRectToVisible:animated:)]) {
[(UIScrollView *)label.superview scrollRectToVisible:toVisible animated:YES];
}
Given your sample code you will also need to cast the superview to get contentOffset
float newPosition = ((UIScrollView *)label.superview).contentOffset.x+label.frame.size.width; | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": -1,
"tags": "ios, uiscrollview, uilabel, superview"
} |
What is the different between `Listen` and `ListenTCP`?
In Go, does `net.Listen("tcp", "127.0.0.1:9090")` not meet any needs? Why do we still have `net.ListenTCP("tcp", localAddress)`? I think they are much similar in implementation. | The Listen function is a common abstraction over ListenTCP and ListenUnix. The Listen function returns a protocol specific listener type as a Listener interface.
Listen also provides the extra convenience of converting a string address to the specific address types required by ListenTCP and ListenUnix.
Use ListenTCP if you have TCPAddr in hand or need to use TCPListener methods that are not available on the Listener interface. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "go"
} |
Constructing a single page blog with pagination
Here's the scenario
I have a bunch of blogs to be displayed. 9 blogs with short description in a grid, and then click on the caption to read more of the blog
the blog grid url is www.mysite.com/person1/blog
on clicking the channel entry it takes me to the more detailed view. The url looks like this www.mysite.com/person1/blog/blog-with-url
the url title of the channel entry is blog-with-url I have accomplish this. What I am not able to achieve is, that I pagination to navigate to the next and the previous blog post. How should I do that? | With - <
{exp:channel:next_entry}
<p>Next entry: <a href="{path='site/comments'}">{title}</a></p>
{/exp:channel:next_entry}
{exp:channel:prev_entry}
<p>Previous entry: <a href="{path='site/comments'}">{title}</a></p>
{/exp:channel:prev_entry} | stackexchange-expressionengine | {
"answer_score": 3,
"question_score": 1,
"tags": "channel entries, channel, pagination, navigation"
} |
How to get Maven 3.0.4 to use Java7?
I've just updated maven from 3.0.3 to 3.0.4 using the compiled binaries from the official site.Now when I run mvn -version , it says that it uses the old java 6 version , instead of the java 7 version that I have installed on my machine (macbook pro). If I run the 3.0.3 version maven binary from inside its folder it uses the java 7 version. How can I configure maven 3.0.4 so that it uses the Java 7 version? Thank you.
PS : Java 7 is the default java version at my system (mountain lion). | Set the JAVA_HOME environment variable. | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 5,
"tags": "java, maven, maven 3, osx mountain lion"
} |
AIR how to prevent application descriptor file from reverting or updating on launch
I have a desktop application using NativeProcess and I need the follwoing in the descriptor file.
<supportedProfiles>extendedDesktop desktop</supportedProfiles>
Unfortunately the file keeps reverting to (desktop first)
<supportedProfiles>desktop extendedDesktop </supportedProfiles>
How do I prevent this? I'm using Flash Builder to launch though compiling using the Flash IDE. | Flash CS is rewriting the list based on the order of the checkboxes in the AIR Settings window. Changing the order of the profiles in the Descriptor.3.x.xsd file won't help. You could set the app.xml file to read-only, as long you don't have to make any other changes. Not a great solution... | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "air"
} |
RouteCollection.Ignore Method Syntax
I am using routing with asp.net 4.0 and Telerik controls with routing. We are using too many editors and spell checkers of telerik controls. These controls require
Telerik.Web.UI.DialogHandler.aspx
Telerik.Web.UI.SpellCheckHandler.axd
These 2 files are calling from different locations.
I want to write a general syntax for
routes.Ignore("Telerik.Web.UI.DialogHandler.aspx");
Right now I am writing too many different paths in the Ignore string.
I want a general syntax for all paths which have "Telerik.Web.UI.DialogHandler.aspx". But HOW????? | You can set the **DialogHandlerUrl** and **SpellCheckSettings-AjaxUrl** properties of the RadEditors to _"~/Telerik.Web.UI.DialogHandler.aspx"_ and _"~/Telerik.Web.UI.SpellCheckHandler.axd"_ respectively. This way the requests for those files will always have the same base URL (in the root folder of your application) and you will need to write only one ignore to the routes collection. The downside is that you need to modify all your RadEditor instances in the application and add the two properties. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "asp.net, routes, telerik, url routing"
} |
Displaying an auto updating map off a Google Sheet
I am trying to help witth rescue operations in Nepal.
I have setup a Google Form here and that information gets stored on a Google Sheet.
Now, I want to provide a map (OSM) that would autopopulate using data in the Google Sheet (there is a column with GPS coordinates.
Is this currently do-able? It would be ideal if I could provide an endpoint where various OSM maps could get the Google Sheet information from.
Thanks in advance. | You can use Leaflet or OpenLayers to place markers and popups on top of OSM maps. uMap might also be worth looking at.
Additionally there is also the Humanitarian OSM Team (HOT) doing various tasks for helping the Nepal rescue teams. The 2015 Nepal earthquake wiki contains an overview, guidelines and specific tasks. It might be useful to discuss your ideas with HOT. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "openstreetmap"
} |
Stroring Formgroup object in DB
How to use angular form application object for later use. I am creating angular application where the form has to be rendered dynamically to edit the values that where stored in the DB.
Steps Tried: 1\. Tried storing the form group object in the DB,but got a circular json error. 2\. Tried storing form group json value but since form group value is read-only, will not able to assign json value
Note: \- Tried assigning individual form control values manually which works. Is there any way where i can store and retrieve the form group object for later use(Edit) the form. | You can get the value of the FormGroup with `formGroup.value` and set it with `formGroup.patchValue(value)`. | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "typescript, angular8, angular reactive forms"
} |
How to translate "The difference between the impossible and possible lies in a person's determination"
How would you translate this quote?
> The difference between the impossible and possible lies in a person's determination.
You can translate it to this:
> Der Unterschied zwischen dem Unmöglichen und dem Möglichen liegt in der Entschlossenheit einer Person.
or maybe this:
> Der Unterschied zwischen dem Unmöglichen und dem Möglichen liegt in der Festlegung des Einzelnen.
What would you say? | Nice work, apart from your first translation I'd go for
> Der Unterschied zwischen dem Unmöglichen und dem Möglichen liegt in der Entschlossenheit des Einzelnen.
although that is obviously not gendered, so if that's required:
> Der Unterschied zwischen dem Unmöglichen und dem Möglichen liegt in der Entschlossenheit der jeweiligen Person. | stackexchange-german | {
"answer_score": 1,
"question_score": 2,
"tags": "translation, english to german"
} |
Error when can't mouse move in body using jquery?
I'm trying this demo here
In HTML:
...
<body>
<div id="button-wrapper" style="position: absolute; opacity: 1; width: 27px; height: 20px;">
<input type="submit" value="submit">
</div>
</body>
...
In jQuery:
$(document).ready(function(){
$("#button-wrapper").parent().mousemove(function(e) {
jQuery("#button-wrapper").css({
top : e.pageY - 10,
left : e.pageX + 30
});
});
});
An error occurs when I move the mouse on body. The submit button can't run on mouse move event. How should I fix this? | Try this:
$(function(){
$(document).on('mousemove',function(e) {
$("#button-wrapper").css({
top : e.pageY - 10,
left : e.pageX + 30
});
});
});
You should first use all `$(document)` since you are trying selecting `parent()` of your div which is `body` which can be easily `the document` itself. Then use `on()` for live DOM interpretation.
Then translate this `jQuery("#button-wrapper")` to `$("#button-wrapper")` just because if you use one, don't use the other.
Also translate `$(document).ready(function(){});` part into `$(function(){});`. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 0,
"tags": "javascript, jquery"
} |
Linker error with iniparser
I am trying to compile a project from source and receiving several undefined reference linker errors
g++ src/Misc/Utils.o src/Misc/Timer.o ... -o bin/nsnake -lncurses -liniparser
src/Config/INI.o: In function `INI::load(std::string)':
INI.cpp:(.text+0xbb): undefined reference to `iniparser_load(char const*)'
...
INI.cpp:(.text+0x726): undefined reference to `iniparser_dump_ini(_dictionary_*, _IO_FILE*)'
collect2: error: ld returned 1 exit status
make: *** [nsnake] Error 1
I have already checked `/lib` and `/usr/lib` and both contain `libiniparser.so.0` and the `libiniparser.so -> libiniparser.so.0` symlink. Is there something else I am missing? | I had to add `extern "C" { #include <iniparser.h> }` in order for the compiler to link correctly. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "c++, c++11, linker errors, fedora, ini"
} |
Non-system databases in SQL Server 2000
How to retrieve the names of all Nonsystem-databases from SQL Server 2000 using a TSQL query?
I have anticipated:
SELECT *
FROM sysdatabases
where dbid >4
order by dbid
it does not seem to be reliable.
Anything else? | From SQL Server 2000 Books Online:
> Each instance of SQL Server has four system databases (master, model, tempdb, and msdb) and one or more user databases.
So, master, model, msdb and temp are all the system databases. Your query can safely exclude just these. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 3,
"tags": "sql, sql server, tsql, sql server 2000"
} |
JavaScript use hundreds of closure or one function call
I have a data web page with possibly few thousands TDs in it. Some of the TD's will need a bound onclick event that uses the contents, or part of the contents of the TD.
I'm using jQuery to add the onclick closure like this:
$(".date").click(function() {
var d = this.html();
doSomething(this, d, otherparams);
}
Is this efficient? It seems that my page would contain few hundreds, or thousands of almost identical closures. Would it be better to put this `doSomething` call somewhere else. | Infact, this is **very** inefficient. Even more because you can so easily workaround it using **event delegation**. Doing that, will use only **one** event handler method instead of "thousands".
$('table').delegate('td.date', 'click', function( event ) {
var d = $(this).html();
doSomething(this, d, otherparams);
});
You need to call this construct only once (outside of any loop). It'll bind an click event handler to all tables in the above example (you should be more precise using an id for instance). Since most browser events do "bubble" up the DOM tree, any click which happens in a `<td>` element will finally reach the `<table>` and is processed there.
Ref.: .delegate() | stackexchange-stackoverflow | {
"answer_score": 7,
"question_score": 3,
"tags": "javascript, jquery, html"
} |
Probabilities with infinite sequences of letters
A drunk poet writes an infinite sequence of letters, each one chosen uniformly at random from an alphabet of 26 letters, independently of the others.
1. What is the probability that in the first $10$ digits there is at least one $A$?
My answer:
$$\frac{10\cdot 25^9}{26^{10}}$$
2. What is the probability that in the first $10$ digits there are exactly $3$ A's?
My answer:
$$ \frac{25^7}{26^{10}} $$
P.S. I do not if I must also multiply something depending on the positions assumed by the $A$'s, but I think not.
3. What is the probability that in the first $11$ digits there are exactly $3$ A's and $2$ B's.
My answer:
$$ \frac{24^5}{26^{10}} $$
P.S. I do not if I must also multiply something depending on the positions assumed by the $A$'s and the $B$'s, but I think not.
4. Show that the probability that the drunk poet sooner or later writes the word PROBABILITY is $1$.
My answer: I have no clue. | For the first two questions find $P(A\geq1)$ and $P(A=3)$ where $A$ is random variable having binomial distribution with parameters $n=10$ and $p=\frac1{26}$.
For the third question find $P(A=3,B=2,X=6)$ where $(A,B,X)$ have multinomial distribution with parameters $n=11$ and $(p_A,p_B,p_X)=(\frac1{26},\frac1{26},\frac{24}{26})$.
For the last question: Number the letters and for $n=1,2,\dots$ let $E_n$ be the event that the string "PROBABILITY" is not on the consecutive letters with numbers $100n,100n+1,\dots, 100n+10$.
Observe that these events are disjoint and independent and have equal probability.
If $E$ denotes the event that the string "PROBABILITY" does not occur in the infinite sequence for every $m$ we have:$$E\subseteq\bigcap_{n=1}^{m}E_n$$so that:$$P(E)\leq P\left(\bigcap_{n=1}^{m}E_n\right)=\prod_{n=1}^m P(E_n)=P(E_1)^m$$ Then on base of the facts that $P(E_1)<1$ and $m$ can be taken as large as we want we can conclude that $$P(E)=0\text{ or equivalently }P(E^c)=1$$ | stackexchange-math | {
"answer_score": 3,
"question_score": 2,
"tags": "probability"
} |
Method not defined in model?
I'm getting undefined method in my model but I believe I have it.
class Business < ActiveRecord::Base
attr_accessible :user_id, :name, :city, :state, :zip, :street, :latitude, :longitude
def new_address
[street, city, state, zip].join(', ')
end
geocoded_by :new_address
after_validation :geocode, :if => :new_address_changed?
end
I'm getting the undefined method error on `new_address_changed?` Is this wrong? | `*_changed?` methods are available only for active record attributes and not for user defined methods. For you, `street_changed?` etc will work.
The best way out is to define another method like so:
def address_changed?
street_changed? || city_changed? || state_changed? || zip_changed?
end | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "ruby on rails, ruby, ruby on rails 3, methods"
} |
How can I set a function's cell position by a cell value (templating/string expression)
I'd like to have something like:
A B C
1 5 1 *expression here*
2 3
3
C's expression:
= `A(B1)` - A2 // would translate to: A1 - A2 which is 2
Where B1 Holds the row number for the C column.
I know this is quite funky, but I had to ask.
(If stackoverflow isn't the right fit for this question, please let me know) | Try:
=indirect("A"&B1)-A2
in C1
Dragging down works as I would expect, I assume you want to drag across? If so, This might do what you want. If not, can you provide an example?
=A1-offset(A1,1,0) | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 0,
"tags": "google sheets"
} |
Optimize Ubuntu 13.04 for netbook (Dell Mini 10v)
I have some slight glitches running Ubuntu 13.04 in my old beloved Dell Mini 10v. How can I optimize the graphics for it?
It has got 1Gb of RAM and an N270 Atom processor. Very minimal graphics too. | Download and install Unity Tweak Tool from the Ubuntu Software Center and change the launcher and the search configs. | stackexchange-askubuntu | {
"answer_score": 2,
"question_score": 1,
"tags": "13.04, performance, dell mini 10"
} |
How do I create a View from couchbase Java sdk 2.1
I need to create a view with a map function ex:
function(doc, meta) {
if(doc.docType == "testDoc")
emit(meta.id, doc)
}
I have to create this view using couchbase java client 2.1.I could not find any thing in the documentation thanks | Here is some code to create a design document:
List<View> viewsForCurrentDesignDocument = new ArrayList<View>();
DesignDocument designDocument = DesignDocument.create("my_design_doc", viewsForCurrentDesignDocument);
And add a view:
String mapFunction =
"function (doc, meta) {\n" +
" if(doc.docType == \"testDoc\") {\n" +
" emit(meta.id, doc);\n" +
" }\n" +
"}";
String reduceFunction = "..." // or null if no reduce
View v = DefaultView.create("my_view", mapFunction, reduceFunction);
viewsForCurrentDesignDocument.add(v);
bucket.bucketManager().insertDesignDocument(designDocument);
You can check the API reference for more options(development mode, timeout, ...). | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": 3,
"tags": "couchbase, couchbase view, couchbase java api"
} |
Can I prevent a flash message from appearing after an AJAX call?
I have a website that degrades gracefully for users without javascript. For a user without javascript, the controller will respond to a form submit with HTML. For a user with javascript, there will be an AJAX form submit. This is in the create method in the controller:
if [email protected]
flash[:error] = array_to_list(@goal.errors.full_messages)
else
flash[:success] = "Your goal was successfully added."
end
respond_to do |format|
format.html { redirect_to :action => "show"}
format.js
end
I don't want to put those messages into flash if the user has javascript enabled, because then it will display after the user has already dealt with it. Is there any way to tell Rails to display a flash message _only_ if responding with html? | You can put the `flash` bits of the code into your `format.html` block in order to achieve this.
Maybe something like this:
@goal.save
respond_to do |format|
format.html do
if @goal.errors
flash[:error] = array_to_list(@goal.errors.full_messages)
else
flash[:notice] = "Your goal was successfully added."
end
redirect_to :action => "show"
end
format.js
end
Have you thought about that you might want to have some kind of error message with the AJAX request as well? It might be a good idea if your AJAX request breaks by some reason so that stuff doesn't get saved. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 1,
"tags": "ruby on rails, ajax"
} |
NSColor. Can I write this little piece of code in one line?
Can I declare and initialise the colour inside the message to myLabel? Or this the only way to do it? Sorry if this is to simple for you guys.
- (IBAction)changeLabel:(id)sender {
NSColor *green = [NSColor greenColor];
[myLabel setTextColor:green];
} | Yes you can :)
- (IBAction)changeLabel:(id)sender {
[myLabel setTextColor:[NSColor greenColor]];
} | stackexchange-stackoverflow | {
"answer_score": 5,
"question_score": -1,
"tags": "objective c, nscolor"
} |
How to get an AngularJS Expression to display nothing?
Say I have the following HTML:
<p>{{ booleanVariable ? "The variable is true!" : null }}</p>
If `booleanVariable` is false, the expression should be empty and the `<p></p>` shouldn't render. However, it just prints the "null" into the `<p>` tag, as if I'd just typed `<p>null</p>`.
How would I get the expression to just render nothing? | Empty string is make sense.
<p>{{ booleanVariable ? "The variable is true!" : '' }}</p> | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "javascript, angularjs"
} |
Creating unique keys for a message quene for an app that can have multiple instances
I have made a Linux CUI app that communicates between processes via Message-quene.
There is no problem with it as long as it is a single instance. However when there are multiple instances of the same app, the messages in the quene get sent to the wrong instance.
I understand this can be avoided by giving the msgget function a unique key. Using ftok() to create a key, but since the variables are the same they result in identical keys.
Can someone guide me how to have a unique key for each instance?
The only idea I have now is to randamize the variable given to ftok, and I know that cant be right. | Be careful with ftok!
This will only be unique for a given file system and only if then if the file system is not heavily used. fttok is driven by the file entry number in the file system.
This used to be a pretty good way of getting unique values but time and Moores law caught up with it a few years ago. It works on the lower 8 bits of the file number but the actual file number is now 32 bits and numbering starts again for each file system.
Process id is a pretty good choice, they do get re-cycled but not as long as the process is still alive. | stackexchange-stackoverflow | {
"answer_score": 2,
"question_score": 2,
"tags": "linux, ipc, message queue, ftok"
} |
Backbone.js Work with server response to save() method
I'm kind of new to Backbone. I need use the data in the server response to a save() method but I'm not sure how to get it. This is the code:
$(".act_btn").on("click", function(){
var act_id = $(this).attr("data-id");
startRecordItem = new StartRecordItem({
activity: act_id,
});
startRecordItem.save({
success: function(response){console.log(response)}
});
/*
recordItem = new RecordItem({
id: ... <---- I have to populate this with the data from the server response.
});
*/
Right now the success function doesn't work at all, what am I missing? I'd like to get an attribute from the JSON response and then use it on the ´new RecordItem´. The save itself works correctly and the response looks like this:
{"activity": 1, "id": 14} | What you're missing is that the first argument of `.save`. is the attributes that get passed into the model, pre-save. You want to do something more like this:
startRecordItem.save(null, {
success: function(response) {
console.log(response);
}
});
Since Backbone fires a `sync` event on successful save, you could also do this:
`this.listenTo(startRecordItem, 'sync', function() { /* logic here */ });` | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": 0,
"tags": "backbone.js"
} |
What is the type of QML this in C++?
I want to pass the QML item reference to C++. It works using the id explicitly:
Item {
id: qmlitem
x: CppObj.getValue(qmlitem)
}
// c++
int getValue(QObject * qmlItem) {
return 0;
}
if I pass this:
Item {
x: CppObj.getValue(this)
}
QObject * qmlItem is 0x0.
If I replace
int getValue(QObject * qmlItem)
by
int getValue(void * qmlItem)
qmlItem is not 0x0 - it has a value but of which type? Is it possible to obtain the QObject* from it? | In QML, the value of `this` is currently undefined. Passing it to C++ will not yield any meaningful result. Whatever its content may be, it is not a reference to the current QML item. So just stick to your first solution and pass an ID. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "c++, qml"
} |
Vectors in a subset
I need help making progress on a linear algebra question.
Consider the subset $W = \begin{bmatrix} x_1 \\\ x_2 \\\ x_3 \\\ \end{bmatrix}$ such that $x_1 + x_2 + x_3 = 2$
Does $x = \begin{bmatrix} 1 \\\ 0\\\ 1\\\ \end{bmatrix} \in W?$
Does $u = \begin{bmatrix} 1\\\ 1\\\ 1\\\ \end{bmatrix} \in W?$
Does $v = \begin{bmatrix} 2\\\ 1\\\ -1\\\ \end{bmatrix} \in W?$
My thoughts:
I believe that $x$ and $v$ are in in $W$ because they satisfy the condition. I believe $u$ is not in $W$ because it does not satisfy the condition.
I am not sure whether or not this is correct.
I also need to determine whether or not $W$ is a subspace of $\mathbb{R}^3$ which I do not know how to begin | A vector $(x_1, x_2, x_3)$ would be in $W$ if and only if $x_1+x_2+x_3=2$. So, as you said, $x\in W$, $u\notin W$ and $v\in W$.
Now, check your definition of subspace. Every subspace must contain the zero vector, which is $(0,0,0)$ in this case. But it doesn't satisfy the equation $x_1+x_2+x_3=2$, so $W$ isn't a subspace. | stackexchange-math | {
"answer_score": 2,
"question_score": 2,
"tags": "linear algebra"
} |
How do you return only groups that contain a specific value in MySQL?
Given a table `mytable` with 2 columns like
| foo | bar |
| a | 10 |
| b | 10 |
| b | 15 |
| c | 10 |
| c | 10 |
| c | 10 |
| d | 10 |
| d | 45 |
| e | 20 |
How I return the groups of `foo` that _only_ contain the value `10`?
The resulting dataset for the above should look like
| foo | bar |
| a | 10 |
| c | 10 |
Note that b and d do not get returned because 15 and 45 are also values in those groups. | You can use `group by` and `having`:
select foo
from mytable
group by foo
having min(bar) = max(bar) and min(bar) = 10;
if `10` is the minimum value:
having max(bar) = 10 | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 0,
"tags": "mysql, sql"
} |
Error updating notification hub Azure WNS
Error updating notification hub:
> {"error":{"message":"SubCode=40000. Failed to validate credentials with WNS. The remote server returned an error: (400) Bad Request...TrackingId:aa79d90b-f09c-4549-8a06-2086f29f02f5_M11CH3_M11CH3_G12,TimeStamp:6/4/2019 12:15:26 PM","code":"BadRequest"}}
The above error occurs when saving Package SID and Security Key in Windows(WNS) in azure notification hub portal. Can you please help this issue | In Package ID box we need to update Application ID and in Secret Key box, we need to update that new key generated in Application Secrets key. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 1,
"tags": "windows, azure, push notification"
} |
How to set default value for javafx DatePicker in FXML?
Is it possible to initialize default value for DatePicker at FXML level?
<children>
<DatePicker fx:id="datePicker" value="2015-07-20"/>
<Label fx:id="messageLabel" textAlignment="JUSTIFY" />
</children>
Obviously that throws an exception, Is it possibly to call constructor of LocalDate?
For example:
<DatePicker fx:id="datePicker" value="LocalDate.of(2015,07,20)"/> | I'm sure you can't populate DatePicker at FXML level, because you can't instantiate an LocalDate object on FXML level because
1. `LocalDate` has no default constructor
2. `LocalDate` has no static `valueOf(String)` method
3. `javafx.fxml.JavaFXBuilderFactory#getBuilder(LocalDate.class)` returns `null`, meaning there is no builder for LocalDate | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 3,
"tags": "java, datetime, datepicker, javafx 8"
} |
Basic Assumption in the Time Dilation Equation Derivation
I am familiar with the way the time dilation equation is derived since I was introduced to it in my sophomore college physics class. It's the standard derivation of a stationary observer watching a man passing in a moving train car and emitting a photon upwards, perpendicular to the horizontal motion. The Pythagorean theorem is then easily applied by assuming that both the traveler and the observer measure the same vertical distance. That assumption is the key to deriving the time dilation equation.
My question is:
How can we logically assume that the vertical distance is equal for both parties? How do we know before we do the calculations that length is NOT contracted vertically? I've tried deriving the equation by not making that assumption and I have failed every time. | Imagine a train moving down a set of tracks next to a wall. Mark on the wall the top of the train (while the train is stationary). Now, while the train is moving, extend a paintbrush out parallel to the top of the train so it paints a second line on the wall.
If there was any vertical length contraction, then the wall would be smaller when measured by the train, and so they would see the second line painted above the first. However, the train would be smaller when measured by a stationary observer, who would then see the second line painted below the first.
Since both can not occur, the amount of length contraction perpendicular to the motion must be 0, so both lines are painted at the same height from the point of view of both observers. | stackexchange-physics | {
"answer_score": 3,
"question_score": 0,
"tags": "special relativity"
} |
Auto Browser Refresh of Ring-Server with Boot
I would like my browser to refresh automatically when I change my ring handler (I'm using Hiccup to generate my html). I'm using the `:reload` option of `serve` from boot-http which works fine, but I always have to manually refresh the browser.
Leiningen seems to have an auto-refresh? option, but I couldn't find something similar for boot. There's also ring-refresh, but that's really old and seems incompatible with the latest version of Clojure.
Is there a simple way for boot to refresh the browser after my code changes? | The problem with Ring-Refresh was an outdated dependency on Compojure. Adding the latest version of Compojure as a dependency solves the problem. | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 1,
"tags": "clojure, ring, boot clj"
} |
Possible to display images in a ListBox with multiple rows
I am trying to get images in a Listbox to display in a certain way.
Listbox now:
), ]
x freq
5 1-Jan 889
4 1-Feb 880
1 1-Apr 92
2 1-Aug 1221
3 1-Dec 923 | stackexchange-stackoverflow | {
"answer_score": 1,
"question_score": -1,
"tags": "r"
} |
How to use an animation tweening library on serverside on node.js?
I try to use es6-tween on Node.js. I want to calculate the tween and on update send them over Websocket to a client. (It is needed to be serverside)
let coords = { x: 0, y: 0 }; // Start at (0, 0)
let tween = await new Tween(coords)
.to({ x: 100, y: 100 }, 1000)
.on('update', ({x, y}) => {
console.log(`The values is x: ${x} and y: ${y}`);
})
.start();
the update is never called. I don't have any errors. How could I use this on serverside? Also tried it with GASP or Tween.js | Add
const { autoPlay, Tween } = TWEEN;
autoPlay(true);
and remove the `await`.
See this pen. | stackexchange-stackoverflow | {
"answer_score": 3,
"question_score": 2,
"tags": "javascript, node.js, tween"
} |
Can you explain the composition of this sentence?
Source
> We eat a few more raspberry scones and switch over to discussing the great poet Rumi and Shams of Tabriz and **when I say that back home, we often refer to him as Shams Tabrizi, she retorts, ‘You Indians are obsessed with the British, want to rhyme everything with Angrezi — affected lot!’**
What is 'that'?
Should the sentence be separated as
_When I say that back home_ ,
1 _we often refer to him as Shams Tabrizi_ as well as
2 _she retorts, ‘You Indians are obsessed with the British, want to rhyme everything with Angrezi — affected lot!’_
The bold part is confusing me a lot.In the end, that _affected a lot_ seems weird. | We use the word that to indicate that we are quoting somebody, so
> when I say that back home, we often refer to him as Shams Tabrizi
it is equivalent to
> When I say "Back home, we often refer to him as Shams Tabrizi"
In this context, affected means **artificial and not sincere** , and lot means a group of people. I must admit that the woman's response does not seem to be a well considered responsed to the speaker's comment. | stackexchange-ell | {
"answer_score": 2,
"question_score": 0,
"tags": "meaning in context, sentence construction, compounds"
} |
How to construct a big regular formula for a model in R?
I am trying create model to predict "y" from data "D" that contain predictor x1 to x100 and other 200 variables . since all Xs are not stored consequently I can't call them by column.
I can't use `ctree( y ~ , data = D)` because other variables , Is there a way that I can refer them x1:100 ?? in the model ?
instead of writing a very long code
ctree( y = x1 + x2 + x..... x100)
Some recommendation would be appreciated. | Construct your formula as a text string, and convert it with `as.formula`.
vars <- names(D)[1:100] # or wherever your desired predictors are
fm <- paste("y ~", paste(vars, collapse="+"))
fm <- as.formula(fm)
ctree(fm, data=D, ...) | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 4,
"tags": "r, variables, regression, modeling, prediction"
} |
Are there performance reasons against goto?
GOTO, does it affect the performance while it is executed and run on the device?
Is it a good practice to use GOTO in objective C or is it bad practice to use it?
And, when is it a good choice to use GOTO statement?
Thanks. | A `goto` is simply a jump, so that its effect on performance is practically zero. It’s a bad practice because it harms code readability; you can mostly do without it. Some of the cases where it makes sense to use `goto` are described in previous questions, just search for goto. | stackexchange-stackoverflow | {
"answer_score": 6,
"question_score": 2,
"tags": "iphone, objective c, ios, c, ipad"
} |
Webservices API - WsCreateError with WS_ERROR_PROPERTY
Is it possible to to create an error obj with WSCreateError with WS_ERROR_PROPERTY set? I am getting E_INVALID_ARG.
WS_ERROR_PROPERTY Prop;
DWORD lang_Id = 1033;
Prop.id = WS_ERROR_PROPERTY_LANGID;
Prop.value = (void *)&lang_Id;
Prop.valueSize = sizeof(lang_Id);
WS_ERROR *err = NULL;
HRESULT hr = WsCreateError(&prop, 1, &err);
// returns E_INVALID_ARG
Is there anything wrong with the way I am calling this? An example with any property would be great! | lang_id needs to be of type LANGID | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "windows, web services, winapi, webservice client"
} |
How to redirect to login with react-router
my app has no home so want to redirect to "/login" when user access path "/". The route path is now home.
const Routes = () => (
<Switch>
<Route
exact
path="/"
component={Login}
render={() => path="/" && <Redirect to="/login" />}
/>
I can't remove `component={Login}` from `Route`, get a typescript error. Does anyone know other way to redirect to login? | resolved with this code.
<Route exact path="/">
<Redirect to="/login" />
</Route> | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 1,
"tags": "reactjs, react router"
} |
python list items & convert language codes to names
i have a list of languages in my data store for a country which is stored like this :
[u"[u'fa-AF'", u" u'ps'", u" u'uz-AF'", u" u'tk']"]
i want the output as:
fa-AF, ps, uz-AF, tk
or
fa-AF - ps, uz-AF - tk
i have tried a couple of things but have not succeeded yet. seems like the data that has been imported to the datastore was not imported properly. Any help Regarding this would be greatly appreciated.
Also, i would like your suggestions on how to display the language name with these codes.
for example if we have "en-US" then we would like to display it as English (United States) (Note: we do not have the language names stored in the datastore.) | a = [u"[u'fa-AF'", u" u'ps'", u" u'uz-AF'", u" u'tk']"]
Looks like a simple split of the original string. You can re-build the string or strip individual elements:
import ast
codes = [ast.literal_eval(x.strip('[] ')).encode() for x in a]
or
codes = [elem.encode() for elem in ast.literal_eval(','.join(a))]
both return:
['fa-AF', 'ps', 'uz-AF', 'tk']
The names of the languages could be stored in a dictionary, such as:
lang = {'fa-AF': 'farsi-Afghanistan', ... }
and called with
for code in codes:
print lang[code]
or you can have a look at the Babel library. | stackexchange-stackoverflow | {
"answer_score": 4,
"question_score": 0,
"tags": "python, list"
} |
Cannot read/write/delete file through Android app
I am doing this through an app I am coding.
I copy a file from **/persist/** to the internal storage of my app using SU " **cpy** " and then I " **chmod** " it to **600** or even **777**. I get " **Access denied** " exception whenever I read that file. I can read any other file I create. I also changed the owner and group from " **root** " to **my app** , but I can still not touch that file - delete, read, write all fail. | The solution was to **chcon** the file as well. Thanks to ChainFire! | stackexchange-stackoverflow | {
"answer_score": 0,
"question_score": 0,
"tags": "java, android, root, su"
} |
Re-Use Client Certifactes
I have a legacy web application where user are identified and authenticated with client certificates. Now, customer wants to use the same client certificate to authenticate against a newly created web application (different host name). I think this is not possible, since the server certificates have to be different.
Is there a way around that? Is it possible to re-sign a certificate? (I have access to all certificates, server keys and the signing CA and am writing the new application). | Client certificates are used to authenticate the clients, so they should have nothing to do with your server certificate.
**Step 1** Client certificates are signed by a CA. If you tell your web app (your server) to trust that CA, then your server will accept the client certificate. Simple as that. Depending on your setup, this is easy to do. For example, for Apache, you can add the following in httpd.conf:
SSLVerifyClient require
SSLVerifyDepth 1
SSLCACertificateFile conf/ssl.crt/ca.crt
Where the 'SSLCaCertificateFile' contains the path to the certificate of the CA which was used to sign the client certificates.
**Step 2** Step 2 is then to make sure the client is known (but this should be irrelevant for your question). This is, the certificate is trusted now (step 1), now you have to extract the client name (which is present in the certificate), and make sure this client can be granted access. | stackexchange-security | {
"answer_score": 2,
"question_score": 1,
"tags": "tls, certificate authority, openssl"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.