INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
When should I use static methods in a class and what are the benefits? I have concept of static variables but what are the benefits of static methods in a class. I have worked on some projects but I did not make a method static. Whenever I need to call a method of a class, I create an object of that class and call the desired method. **Q:** Static variable in a method holds it's value even when method is executed but accessible only in its containing method but what is the best definition of static method? **Q:** Is calling the static method without creating object of that class is the only benefit of static method? **Q:** What is the accessible range for static method? Thanks
Your description of a static variable is more fitting to that found in C. The concept of a static variable in Object Oriented terms is conceptually different. I'm drawing from Java experience here. Static methods and fields are useful when they conceptually don't belong to an instance of something. Consider a Math class that contains some common values like Pi or e, and some useful functions like sin and cos. It really does not make sense to create separate instances to use this kind of functionality, thus they are better as statics: // This makes little sense Math m = new Math(); float answer = m.sin(45); // This would make more sense float answer = Math.sin(45); In OO languages (again, from a Java perspective) functions, or better known as methods, cannot have static local variables. Only classes can have static members, which as I've said, resemble little compared to the idea of static in C.
stackexchange-stackoverflow
{ "answer_score": 63, "question_score": 71, "tags": "oop, static methods, static variables" }
Java RMI new object for each call and queue There is any way of set java **rmiregistry** to return a new instance of registered object **for each calling** , or only creating a **factory pattern** at server side? Furthermore, is there a way to do a **queue** in java Rmi, if there a "overflow" of clients calling server? Thanks.
Make the factory a remote object, put it into the registry, and have the client call it whenever it wants a new object. There is no such thing as an overflow of RMI clients except at the TCP level. There already is such a queue in TCP, namely the listen backlog queue.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, rmi, remote access" }
Is extrinsic curvature a property of the manifold or the embedded surface? Good day, to explain my question further, does changing the way we embed a surface into a manifold change its extrinsic curvature? Just getting exposed to these topics of differential geometry so excuse my ignorance.
One example is to take a paper sheet and draw straight lines on it. You can make a cylinder and a plane with it. Depending on the direction you draw the lines, they are curves with non-zero curvature in the cylinder, while if you flatten it into a plane, these curves will have zero-curvature in the three dimensional space. In this case both are the same curves, under a transformation preserving distances since you do not stretch the paper. So any extrinsic measure of curvature can depend on how we embed it on the manifold.
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "differential geometry, surfaces" }
How to get value from a serializable object I pass an object from type `serializable` via a `BroadcastReceiver` from an `IntentService` to a `BroadcastReceiver`. This code is assigned to the `BroadcastReceiver`: @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "onReceive: Received Broadcast: " + intent + " from context: " + context); RetrofitResponseProfile retrofitResponseProfile = intent.getSerializableExtra(NetworkService.NETWORK_RESPONSE_PROFILE); } But my problem is, that android studio says, the `retrofitRepsonseProfile` object isn't from type `serializable`. Can anybody help me, how to receive an `serializable` object from an `IntentService` in a `BroadcastReceiver`? Many thanks in advance!
Your Class Should Be Class RetrofitResponseProfile implements Serializable{ //Create Variables And Functions } And During Call RetrofitResponseProfile retrofitResponseProfile = (RetrofitResponseProfile) intent.getSerializableExtra("Key0"); hope this may help you
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "android, serialization, intentservice" }
Qt QUrl: doesn't url-encode colon I have URL: ` I expect that it should be percent-encoded as ` But Qt leaves it as-is. My code: QUrl url(" printf("Encoded: %s\n", url.toEncoded().constData()); How should I encode colon? Manually format parameter with `QString::toPercentEncoding`?
You must replace colons because of security issues. More information: < You can use percent encoding (":" -> "%3A") for colons, see < and <
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c++, qt" }
Why is this Isinstance function not working? This does not print anything for some reason. * * * main = 60 x = isinstance(main, int) if x == ("True"): print("True") elif x == ("False"): print("False") * * *
The boolean value which is returned by the `isinstance()` function is not a string, but (as you may been able to guess) a boolean. To rewrite the code provided: main = 60 x = isinstance(main, int) if x is True: print("True") elif x is False: print("False") However, since booleans can be conditions themselves, and `isinstance()` returns a boolean, I would recommend this approach: main = 60 if isinstance(main, int): print("True") else: print("False") Alternatively, even simpler: main = 60 print(isinstance(main, int))
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -2, "tags": "python, isinstance" }
Exponential approximate result How come: $e^{M\ln(1+\mu \delta t)} \approx e^{\mu M \delta t}$ ? This implies that: $M\ln(1+\mu \delta t) \approx \mu M \delta t$ But I can't see how this is the case I think this may be a bit out of context. I just realized. Mu is the mean return on the stock, delta t is time step and M is the number of time steps. Now that I have mentioned this, I think that the question is perhaps more appropriate in QF. EDIT: I suppose this is not a question of precalculus algebra then.
$$\ln(1+x) \sim x$$ In fact, for $\vert x \vert <1$, we have $$\ln(1+x)= \sum_{k=1}^{\infty} (-1)^{k-1}\dfrac{x^k}k$$
stackexchange-math
{ "answer_score": 0, "question_score": 1, "tags": "algebra precalculus" }
How to finish the following proof? The incircle of $\triangle ABC$ touches the sides $AB, AC,$ and $BC$ at points $P, N, M$, respectively. Denote $AP = AN = x, BM = BP = y, CM = CN = z$, as tangents from an exterior point to a circle are congruent. Segment $UV$ is tangent to the incircle and parallel to the side $AC$. Prove $\displaystyle\frac{UV}{AC} = \frac{y}{x+y+z}$ **So far I have:** Since $\triangle BUV \sim \triangle BAC$ $\rightarrow$ $\displaystyle\frac{UV}{AC} = \frac{BU}{BA} = \frac{BV}{BC} = \frac{BU}{BA} \cdot \frac{BC}{BV}$. I tried plugging in the values for the sides and don't end up with the relationship that is needed to prove. Any and all help is appreciated. ![enter image description here](
First of all, let's call $R$ the intersection of $UV$ and the circle. So, $PU=UR$ and $MV=VR$ so the perimeter if the triangle $PBM$ is $$BU+UV+VB=(BP-PU)+(UR+VR)+(BM-MV)=BP+BM=2BP=2y$$ once $UV$ is parallel to $AC$ then the triangles $BUV$ and $BAC$ are similiars. So, $$\frac{UV}{AC}=\frac{\text{perimeter}(BUV)}{\text{perimeter}(BAC)}=\frac{2y}{2(x+y+z)}=\frac{y}{x+y+z}$$
stackexchange-math
{ "answer_score": 3, "question_score": 2, "tags": "geometry, euclidean geometry, circles" }
Control the Name Attribute within an ImageButton using code-behind I have an ImageButton which I want to change the NAME attribute of in the code-behind so that I can render the HTML as needed. The current Rendering is : <input id="MainContent_GridViewTracking_ibOrderDetail_15" class="smIcon" type="image" src="../Images/icons/img_page.png" text="Details" name="ctl00$MainContent$GridViewTracking$ctl17$ibOrderDetail"> I would like to control the NAME using code-behind as assign it to track.myID which would result with something like <input id="MainContent_GridViewTracking_ibOrderDetail_15" class="dhIcon" type="image" src="../Images/icons/doc_page.png" text="Details" name="1654874"> TIA
Have you tried `MyImageButtons.Attributes["name"]=xyz`? Should to the trick. Or you could add any other attribute to it like so: `MyImageButton.Attributes.Add("trackID", xyz)` and use that atribute for whatever you want to use. Or if you don't want to use that other attribute you could use jQuery to grab that other attribute's value and set it as name value.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "c#, asp.net, imagebutton" }
bitwise numbers python I'm using tiled map editor to make 2d maps for making a game with pyglet. The tiles are numbered and saved to a .tmx file. The tiles numbers start at 1 and keeps ascending but when you flip a tile that tile number is changed with bitwise so when you parse the data you know how to flip it. The document explains how to break it down [here] (< under tile flipping. I have no idea where to even start, I've never used bitwise. I looked up bitwise for python and read about & | << >> bitwise operators and played with them in the interpreter but I still don't understand how to break down the tile numbers to get the data. One of the numbers I have is 2684354578 can someone show me how to do this?
The numbers are 32 bits wide. The upper 3 bits number 31, 30 and 29 identity the flipping information. You can force these 3 bits to zero by expression result = number & 0x1FFFFFFF The prefix 0x means it is a hex number. Each digit represents 4 bits using the values 0 till 9 and A till F. The number is thus 3 zeros followed by 29 ones.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "python, bit manipulation, pyglet, tiled" }
how to let web application use the purchased domain name through ROUTE 53 in AWS? 1. I have purchased a domain name through ROUTE 53. 2) I have created a EC2 instance and put my web application inside it that is supposed to be hosted. 3) I have configured the Gunicorn and nginx as my WSGI and web server. How to use the purchased domain name to integrate with my application to see over the internet. I have seen many documents post on stackoverflow, and youtube videos. But I am not able to get the clear picture of what am suppose to do next. I get that once the domain is registered I have 4 ns records generated inside the ROUTE 53. But where to use them? how to configure them. It be helpful if somebody can give me exact steps to perform the tasks. Thank you,
Route53 is similar to other DNS servers with extra features, in your case, you will need to assign your ec2 instance a public IP address and to be safe an Elastic IP to avoid IP change on reboot, then you need to grab this public IP and assign it to your domain root A record and www CNAME record to point to that domain
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "amazon web services, amazon ec2" }
simpler way to extract and count data I need to extract specific information from my data and the summarize it. I have 246 files that I need to do the same thing. So I did for f in *.vcf; awk -F"\t" 'NR>1 {split($10,a,":"); count10[a[7]]++} END {for (i in count10) if (i>0.25) sum += count10[i]; print sum }' "$f" > ${f}.txt I get new files for each old file which contain information I extracted from the old file ( some integers ) I then concatenate the new files by using cat function to produce one final big file Is there a simpler way to concatenate all files without producing single new files
You could change the last line in your code to look like below, it will then keep appending to your FINAL output file as shown below for f in *.vcf; awk -F"\t" 'NR>1 {split($10,a,":"); count10[a[7]]++} END {for (i in count10) if (i>0.25) sum += count10[i]; print sum }' "$f" >> FINAL.txt Hope this helps..
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "shell, awk, count, cat" }
Form of matrix satisfying following equations In my lecture notes it states, with no explanation, any 2 × 2 matrix A given by $$ \begin{pmatrix} x_{11} & x_{21}\\\ x_{12} & x_{22}\\\ \end{pmatrix} $$ satisfying the two matrix equations A*(1,1)$^T$=(8,3)$^T$ and (1,1)*A=(2,9) must take the form \begin{pmatrix} \lambda & 8-\lambda\\\ 2-\lambda & 1+\lambda\\\ \end{pmatrix} Why is this the case? I have solved the two equations to find A is given by \begin{pmatrix} 2 & 6\\\ 0 & 3\\\ \end{pmatrix} but is the matrix with the $\lambda$ coefficients derived?
From those equations you get $$\begin{align} & x_{11}+x_{21}=8\\\&x_{12}+x_{22}=3\\\&x_{11}+x_{12}=2\\\&x_{21}+x_{22}=9 \end{align}$$ Let $x_{11}=\lambda$. $$\begin{align}&\implies x_{21}=8-\lambda\\\&\implies x_{12}=2-\lambda\\\&\implies x_{22}=9-(8-\lambda)=1+\lambda \end{align}$$ As required.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "matrices, linear programming" }
"Have good weekends" vs "Have a good weekend" As a co-worker walked past me and my team mates this afternoon, he said "Bye. Have good weekends" - by which he meant that he wished each of us to have a good weekend. Was this grammatically accurate and valid greeting in English? If not, what would be a better way to convey his message?
> Was this grammatically accurate and valid greeting in English? If not, what would be a better way to convey his message? Technically "Bye. Have good weekends" is correct in that he is wishing each individual a good weekend, using the collective noun for all of your weekends. However, colloquially this strikes me as lazy grammar. Expansions would be more like: * Bye, I hope each of you has a good weekend * Bye, I hope you all have a good weekend The reason I would use the longer version is that it is more personal to each team member, the blanket "have good weekends" feels like more of a throw away comment such as "bye, I'm off". > is anything grammatically wrong with the ambiguity of this statement No one would refer to "several good weekends" in this context and so I would not say this is ambiguous, it is clear he is referring to a group of people who each will experience a weekend. There is nothing particularly wrong with the statement, it is just lazy.
stackexchange-english
{ "answer_score": 1, "question_score": 6, "tags": "differences, grammatical number, greetings" }
Is it possible to suppress parent's :active pseudo class? I have the following markup: <div class="parent"> I should change my color to green when clicked <div class="element">I should do nothing when clicked</div> </div> Here is the related CSS: .parent { width:200px; height:200px; background: red; color: #fff; } .parent:active { background:green; } .element { background:blue; } Is there any way to prevent triggering `.parent`'s `:active` pseudo class when `.element` is clicked? Tried `e.stopPropogation()` when `.element` is clicked with no luck. demo
You can just use jQuery instead of `:active`, like in this demo (link). $('.element').mousedown(function(e){ e.stopPropagation(); }); $('.parent').mousedown(function(e){ $('.parent').css('background', 'green') }).mouseup(function(e){ $('.parent').css('background', 'red') });
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 5, "tags": "jquery, html, css" }
Como retornar um objeto, calculando datas? Estou a calcular a diferença entre datas em um período. De hoje até x dias anteriores: hoje = new Date(); periodo = new Date().setDate(hoje.getDate() - 5); Dessa forma a saída é a seguinte: Fri Sep 19 2014 17:05:11 GMT-0300 (Local Standard Time) 1409861111749 Eu quero que a data calculada também volte como objeto: Fri Sep 14 2014 17:05:11 GMT-0300 (Local Standard Time)
Você pode criar uma nova data a partir do timestamp retornado pela operação de setDate: periodo = new Date(new Date().setDate(hoje.getDate() - 5)) De acordo com a especificação da linguagem, setDate sempre retorna um TimeClip, que representa o número de milisegundos desde 1o. de janeiro de 1970 (UTC) até a data em questão.
stackexchange-pt_stackoverflow
{ "answer_score": 8, "question_score": 8, "tags": "javascript" }
stty: : Invalid argument I am telnet-ing into a Solaris machine and I'm getting the above error with my scripts. I realize this is a common problem, and the solution is to check for the line 'stty erase ^H' within my profile, but I can't find it. .profile doesn't have any references to stty, and I don't have a .cshrc anywhere. I performed a grep in my home directory, but I came up with nothing. Is there another source of this problem? All the solutions online refer to either .profile or .cshrc. Thanks.
I had this, it was an `stty` in .kshrc. Remember that .kshrc is sourced on all ksh scripts, interactive and non interactive. If you run a script, stty will still fire, try to work on stdin, which is a file (not a tty now) and fail with an error.
stackexchange-unix
{ "answer_score": 0, "question_score": 4, "tags": "scripting, solaris, telnet" }
curl to php code I have the following code : curl -X PUT -u "<app key>:<secret key>" \ -H "Content-Type: application/json" \ --data '{"alias": "myalias"}' \ I tried to convert it to php but it seems not working and i don't know what is the problem. this is what i tried <? $token = $_POST["token"]; $al = $_POST["alias"]; exec('curl -X PUT -u "_rEUqXXXmSVEBXXuMfdtg:vpB2XXXXX_2HZ_XXXX7t-Q" \ -H "Content-Type: application/json" \ --data \'{"alias": "'.$al.'"}\' \ ?>
$ch = curl_init(); // echo $url; die; curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_HTTPHEADER, array("custom: header")); $returned = curl_exec($ch); curl_close ($ch); There are many more options to do what you want in the PHP docs, don't they help.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -4, "tags": "php, web services, curl" }
Strange boost::this_thread::sleep behavior I was trying to implement small time delays in multithreading code using boost::this_thread::sleep. Here is code example: { boost::timer::auto_cpu_timer t;//just to check sleep interval boost::this_thread::sleep(boost::posix_time::milliseconds(25)); } Output generated by auto_cpu_timer confused me little bit: 0.025242s wall, 0.010000s user + 0.020000s system = 0.030000s CPU (118.9%) Why it **0.025242s** but not 0.0025242s ?
Because 25 milliseconds is 0.025 seconds; 0.0025 seconds would be 2.5 milliseconds.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "c++, multithreading, boost" }
Macro shifts to the right Every time I'm using this macro it shifts to the right. Why? \newcommand*{\addLine}[1]{ \begin{tikzpicture}[overlay, remember picture] \coordinate (x) at (#1,0); \draw [open triangle 45-] (0,0) -- (x); \end{tikzpicture} } **Edit** Well, I adapted my real macro (I just provided a smaller example for the sake of demonstration), but I still have a little gap: \newcommand*{\AddNote}[4]{% \begin{tikzpicture}[overlay, remember picture]% \coordinate (x) at (#2,0); \coordinate (a) at ($(x)!(#1.north)!($(x)+(0,1)$)$); \coordinate (b) at ($(a)+(0.5,0)$); \coordinate (c) at ($(b)+(0,#3)$); \draw [open triangle 45-] (a) -- (b) -- (c); \node[right] at (c) {\bf\sffamily\smaller#4}; \end{tikzpicture}% }
Your macro is introducing spurious spaces. See Why the end-of-line % in macro definitions With comment chars: !enter image description here Without comment chars: !enter image description here \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \newcommand*{\addLine}[1]{% <--- a space is introduced without this % \begin{tikzpicture}[overlay, remember picture] \coordinate (x) at (#1,0); \draw [open triangle 45-] (0,0) -- (x); \end{tikzpicture}% <--- a space is introduced without this % } \begin{document} \addLine{1}\addLine{1} \end{document}
stackexchange-tex
{ "answer_score": 8, "question_score": 4, "tags": "tikz pgf" }
How to Check the Name of Picture Inside the Cell? I want to check the name of the picture in a cell, then put a value on the next column based on the name of the picture. My program only checks if the name of the picture exists in the activesheet. Sub CheckImageName() Dim iRowCountShapes As Integer Dim sFindShape As String iRowCountShapes = 2 While Sheets("Data").Cells(iRowCountShapes, 1) <> "" If Sheets("Data").Shapes("Rock").Name = "Rock" Then Sheets("Data").Cells(iRowCountShapes, 3) = "Rock" ElseIf Sheets("Data").Shapes("Roll").Name = "Roll" Then Sheets("Data").Cells(iRowCountShapes, 3) = "Roll" Else Sheets("Data").Cells(iRowCountShapes, 3) = "Neither" End If iRowCountShapes = iRowCountShapes + 1 Wend End Sub
Images in Excel can be obsereved as shapes. If they are named correctly(with real filename) on insert then you can iterate through them like this Private Sub CommandButton1_Click() Dim doc As Worksheet Dim spe As Shape Set doc = Worksheets(1) For i = 1 To doc.Shapes.Count - 1 Set spe = doc.Shapes(i) 'for named images Debug.Print doc.Shapes(i).Name spe.Select 'for linked images Debug.Print GetSourceInfo(spe) Next End Sub Function GetSourceInfo(oShp As Shape) As String On Error GoTo Error_GetSourceInfo GetSourceInfo = oShp.LinkFormat.SourceFullName Exit Function Error_GetSourceInfo: GetSourceInfo = "" End Function Which in my case shows the excel generated imagenames: * Picture 1 * Picture 2 * Picture 3
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 2, "tags": "excel, vba" }
Eliminate ambiguity of grammar in antlr I am writing a parser. I have a production which is left-recursive `a: a op a` so I fix it in this way: `ab : () (op ab)*;` where `op : + | - | / | *` now I think this is ambiguous,for example for some statement like x+y*z . How can I eliminate this ambiguity؟
For ANTLR 3, precedence is implicit in the multiple rule invocations done for an expression. There are plenty of examples of how to build recursive descent expression parsers on the web. expr : primary (op primary)* ; is not ambiguous at all, by the way. ANTLR 4 allows you to specify left recursive expression rules and implicitly defines a precedence by the order of the alternatives, assuming there's an ambiguity. For example here's a typical rule: expr : expr '*' expr | expr '+' expr | INT ;
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "antlr, antlrworks" }
Navigation Drawer in flavoured Android I am using navigation drawer and it works fine in native android devices but stutters in opening and closing in flavoured android devices. I have made my drawer consulting this(< example. It works fine for both types of devices when implemented independently but in my app it stutters for flavoured devices. Also it stops stuttering as soon as I remove the adapter. Again stuttering is happening on only flavoured devices like samsung, mi etc.
I was setting android:alpha attribute in layout of the row of drawer which was causing problem in flavoured android.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "android" }
How to change devise's sign out to use POST instead of GET? I noticed that the sign out action of devise uses GET (I think the best practice is to put all data state-changing actions behind a POST) So how do I change the route to use a POST instead of a GET ? (Ideally without having to copy the controller code if at all that is needed) Here's the `rake route` for the current devise sign out path (wrapped on two lines): destroy_user_session GET /users/sign_out(.:format) {:controller=>"devise/sessions", :action=>"destroy"}
Found it! Latest devise version (v1.2.rc-10) has an option called `:sign_out_via` (link)
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "ruby on rails plugins, ruby on rails 3" }
What is the difference between explicit and implicit waits in Selenium? There is a lot of discussion in the selenium space about explicit and implicit waits. Getting ones wait strategy is clearly key to solving many intermittent test failures. There are warning however such as if you mix them together you can create deadlock failure situations. I find the terms confusing and misleading. Can anyone succinctly describe the differences between them. Are they conceptual as was as implemented in code? Do I need to use webdriver waits over my own strategy?
Authoritative answer from Jim Evans, Selenium contributor: never mix implicit and explicit waits \- and stick with explicit. Article explains also your other questions. Converting our code to explicit-waits-only decreased flakiness the test considerably, I suspect for the reasons Jim explains in his answer linked above. Another good read explaining waiting: How to WebDriverWait Answers linked in Niels' comment are also worth a read.
stackexchange-sqa
{ "answer_score": 3, "question_score": 2, "tags": "webdriver, intermittent failures" }
ssis Derive update Im trying to merger data together based upon a primary key that will be the same in two record sets. I have the first record set with a primary key and 5 coloums of data and then I have a second record set with the primary key and 5 new colums. I want to be able to merge both record sets together so I can see one primary key and 10 coloums with any data that is not applicable just is left null. Can anyone help please :)
< Have you had a look at the how-to guide on MSDN? It's a bit flakey with detail but it should help point you in the right direction. The most annoying part is the data must be 'sorted' before being merged. < MSSQL tips has a much more comprehensive guide on how to get the Merge Join working. Just substitute their data-source for whatever you may be using. Good luck, hope you get it working.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": ".net, ssis" }
Set virtual directory as root in apache In my linux server my www root of apache server is /var/www/html, I have a folder called blog in the above mentioned path. I have to access the the website in the blog folder by specifying ` My question is I want to be able to access the website by specifying ` in the browser(without having to move the contents of the blog folder to www root). Is there any parameter which I can set in the config file so as to be able to achieve the mentioned objective. Thanks.
Edited /etc/httpd/conf/httpd.conf file and search for DocumentRoot and change from /var/www/html TO /var/www/html/blog
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "linux, wordpress, apache" }
NHibernate, i invoke delete but update is invoked automatically! in NHibernate, i invoke delete but update is invoked automatically!! i use FluentNhibernate Automapping.
Check that each of your fields are mapped as NULLable as required. I've had a similar problem when I've forgotten to mark a field that is NULLable as NULLable in my mapping.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "nhibernate, fluent nhibernate, automapping" }
$\Delta u=\text{constant}$ in a domain with von Neumann boundary condition Consider $\Omega$ a smooth bounded domain in $\mathbb{R}^n$. Show that if $k=\dfrac{|\partial \Omega|}{|\Omega|}$ then the PDE $$\Delta u=k\ \text{in}\ \Omega,\ \dfrac{\partial u}{\partial n}=1\ \text{on}\ \partial \Omega$$ where $n$ is the normal to $\partial \Omega$, has a solution. Is the solution unique up to a constant? When $\Omega$ is the unit ball, is there an explicit formula for $u$? This is probably well-known stuff but I can't seem to find a reference, so if anyone could provide a proof or a reference it would be much appreciated.
That PDE with that boundary values has the weak formulation $$\int_{\Omega}\nabla u\cdot\nabla\varphi-k\varphi+\int_{\partial\Omega}\varphi=0$$ for every $\varphi\in C^{\infty}(\overline{\Omega})$. With this weak formulation, and with the trace inequality, it can be solved in $H^1(\Omega)$ in classical ways, for example with Lax-Milgram theorem. If $\Omega$ is the unit ball, the solution is $\frac{1}{2}|x|^2$.
stackexchange-math
{ "answer_score": 3, "question_score": 0, "tags": "partial differential equations, harmonic functions, laplacian, greens function" }
Can't solve this equation involving the natural logarithm > Solve for $y$: $\frac12\ln(\sqrt{2y+1})) = \ln(3) + \ln(y-1)$. I got to $\sqrt{2y+1} = (y+2)^2$, but then don't know where to go from here I've now got to $(\sqrt{2y+1})^\frac{1}{2} = 3y-3$
I got $$\ln(\sqrt{2y+1})=\ln(9)+\ln((y-1)^2)$$ so $$\sqrt{2y+1}=9(y-1)^2$$ Then we get $$2y+1=(3(y-1))^4$$ and this is $$81 y^4-324 y^3+486 y^2-326 y+80=0$$ The Solutions don't look nice: $$\left\\{1+\frac{1}{6} \sqrt{\frac{\sqrt[3]{2 \left(1+\sqrt{1297}\right)}}{3^{2/3}}-\frac{2\ 6^{2/3}}{\sqrt[3]{1+\sqrt{1297}}}}+\frac{1}{2} \sqrt{-\frac{\sqrt[3]{2 \left(1+\sqrt{1297}\right)}}{9\ 3^{2/3}}+\frac{2\ 2^{2/3}}{3 \sqrt[3]{3 \left(1+\sqrt{1297}\right)}}+\frac{4}{27 \sqrt{\frac{\sqrt[3]{2 \left(1+\sqrt{1297}\right)}}{3^{2/3}}-\frac{2\ 6^{2/3}}{\sqrt[3]{1+\sqrt{1297}}}}}}\right\\}$$
stackexchange-math
{ "answer_score": 2, "question_score": 0, "tags": "logarithms" }
Reset Style in certain portion of Visual Tree in WPF I am setting some global styles for TextBox, ComboBox, TextBlock, etc. in my App.xaml file. I want these styles to flow down through the visual tree for a consistent look and that is what they are doing. However, I am using a Ribbon in part of my UI. The style customizations are completely throwing off the appearance of the Ribbon. The ribbon sits at the same level as many other UI elements so is there a way to just reset the style for the ribbon and its visual children
I don't think that you can change this wpf behaviour. But you can try to contain all global styles to specific resource dictionary and use it in all other VisualTree elements. Or you can try something like this: <Window ...> <Window.Resources> <Style TargetType="Button"> <Setter Property="Background" Value="Red" /> </Style> </Window.Resources> <DockPanel LastChildFill="True"> <Button x:Name="button1" Content="button" DockPanel.Dock="Top" /> <StackPanel> <StackPanel.Resources> <Style TargetType="Button"> </Style> </StackPanel.Resources> <Button x:Name="button2" Content="lala" /> </StackPanel> </DockPanel> </Window> Element with name "button2" will be default.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "wpf, styles, ribbon" }
What is this red mark on my dog’s forehead? I was doing a little bit of a checkup on our family dog, Rocky, and I found a strange small bump on top of his forehead, in between his ears. I was a bit concerned, so I began looking online, to check whether this was a zit. While I was examining the area, Rocky seemed uncomfortable, so I stopped touching around there. After some online research I’m still not certain what this bump is. Rocky is a 10 month old bull mastiff puppy. Here’s a picture of the mark I found: ![Red Bump]( **Does anyone have any idea what this could be?**
This looks like a tick bite. Ticks are most common in coastal or in lowland areas, but as a direct result of increasing global warming, the areas where ticks can live are expanding. If you live in an area where roedeer-deer-moose-elk are common, you will most likely find ticks. More information about ticks could be found in this article. Another type of similar bitemark comes from the deer fly; a bite from this insect can often take from a month and up to a year before it heals completely. As the name says, deer fly is spread by animals in the deer family and the living area for the deer fly has been expanding during the last years (here in Scandinavia). More information about deer flies could be found in this article. Both ticks and deer flies can spread disease to people and pets, so please keep your own and your pets' vaccinations up to date.
stackexchange-pets
{ "answer_score": 4, "question_score": 2, "tags": "dogs, health" }
Ternary operators in ruby Seems like there should be a better way to do this: def some_method(argument = 'foo') bar = argument == 'foo' ? 'foo' : "#{argument.to_s}_foo" # ... do things with bar ... end Any ideas? I've also played around with bar = ("#{argument}_" if argument != 'foo').to_s + argument but if anything that seems more complicated
From your example, you don't seem to need different variables for `foo` and `argument` at all (that would be different if you need them both later, but from your example it doesn't seem like it). A simplification would be: def some_method(bar = 'foo') unless bar == 'foo' bar = "#{bar}_foo" end # Do things with bar end Of course, you can do the `unless` inline if you prefer: bar = "#{bar}_foo" unless bar == 'foo' Side note: You don't need to call `to_s` when interpolating. Ruby will do that for you.
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 0, "tags": "ruby" }
Reading an Microsoft Excel File How to read an XLS File (Microsoft Excel) using unix Bash / Korn shell (`ksh`) script?
With straight-up shell script you're more than likely sunk, but there are at least three Perl modules that can be used to parse excel spreadsheets and extract data from them. Fair warning, none of them are particularly pretty, although `Spreadsheet::ParseExcel::Simple` is probably your best bet for a quick solution. It's in debian 5.0 (Lenny) as `libspreadsheet-parseexcel-simple-perl`; Other distributions may have their own naming schemes. Depending on what you want to do with it a quick perl script should do the trick.
stackexchange-unix
{ "answer_score": 5, "question_score": 3, "tags": "bash, shell script, ksh" }
Does it matter which Certificate Authority I source my SSL Certificate from? To secure my web site with HTTPS, does it matter which company I source my SSL certificate from, or just that the browser recognizes it? * * * From the Area51 proposal.
Yes, it totally matters. You only can trust the transactions as much as you trust the certificate authority. For example, if you have a DoD-signed certificate, that's pretty trustworthy. If you have a certificate signed by Chungwa Telecom, then maybe not so much. Take a look at your browsers default CA certs sometime and think about how much you trust those parties. I recommend taking a look at this paper for a full explanation of how malicious CAs can really wreak havoc on perceived trust: Certified Lies: Detecting and Defeating Government Interception Attacks Against SSL
stackexchange-security
{ "answer_score": 7, "question_score": 35, "tags": "tls, certificate authority" }
Block multiple categories from Blog I found this code on this site by AshFrame which I added to my functions PHP file and works perfectly to stop one category being displayed on my blog (I have a custom menu so have the category displayed separately)... add_action('pre_get_posts', 'block_cat_query' ); function block_cat_query() { global $wp_query; if( is_home() ) { $wp_query->query_vars['cat'] = '-98'; } } My question is how do I format this code to include a second category (in my case -92)? I tried duplicating the code but it generates a PHP error because you can only run the function once I think.
_cat_ takes a comma deliminated list, so '-98,-92' Further reading <
stackexchange-wordpress
{ "answer_score": 1, "question_score": 1, "tags": "categories, blog, customization" }
How can I use jquery variable from html template in separate js file appended to this html template? How to use variable MEDIA_URL in my my.js? <script> $(function(){ var MEDIA_URL = '{{ MEDIA_URL }}' }) </script> <script type="text/javascript" src="{{ MEDIA_URL }}/my.js"></script>
There is no need to define MEDIA_URL in the document ready call just do: <script> var MEDIA_URL = '{{ MEDIA_URL }}' </script> <script type="text/javascript" src="{{ MEDIA_URL }}/my.js"></script>
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "jquery, django" }
GWT:how to get the value of a checkbox of a cellTable !enter image description here I have this situation , i want to delete the objects in this celltable whose checkbox is Check on the clik of this "Delete" Button , Any idea how to get those objects whose checkbox is checked in this cellTable, when i click the delte button .. Thanks
If your requirement with delete single row, then You can use SingleSelectionModel otherwise MulitiSelectionModel in celltable. I have written some code with single selection model,It may give some idea. i.e. selectionModel = new SingleSelectionModel<T>(); cellTable.setSelectionModel(selectionModel) //Set into your cellTable: When you select a checkbox, then row will auto selected and object will set in to selection model. CheckboxCell checkboxCell=new CheckboxCell(true, false); Column<T, Boolean> boolColumn=new Column<T, Boolean>( checkboxCell) { @Override public Boolean getValue(T object) { return selectionModel.isSelected(object); } }; On delete button click,use selected object,It will provide you a object for delete. `selectionModel.getSelectedObject();`
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "gwt" }
PHP Propel on macOS Sierra unable to create working symlink The manual of propel says: In order to allow an easier execution of the script, you can also add the propel generator’s bin/ directory to your PATH, or create a symlink. For example: $ cd myproject $ ln -s vendor/bin/propel propel If I do this, the symlink is created, but if I run propel I get the following error: -bash: propel: command not found Result of ln -al lrwxr-xr-x 1 user group 17 11 jan 10:47 propel -> vendor/bin/propel How can I solve this? Note: calling vendor/bin/propel is working correctly
Try ./propel Calling only 'propel' should look for global executable
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, macos, symlink, propel, propel2" }
Why is the iframe within a react native webview on iOS not rendering content? I have a ReactNative app that simply uses a webview to display our react website. Our site allows users to view emails, and in order to properly render these email messages we use an iframe. So our iframe looks like this: <iframe className={'email-view-body-iframe'} srcDoc={pViewMessage.body}/> Where srcDoc is the body of the message that is to be viewed, which may be plain text, legacy rtf messages, or html messages. And it works as expected on all platforms except iOS. I've gone through the webview docs and I'm not seeing anything that jumps out at me, and I know the iframe is there because I styled it with an odd colored background just so I could check that it was indeed being rendered in the correct place. Can someone point me in the right direction?
For showing static HTML or inline HTML, you need to set `originWhiteList` to * import { WebView } from 'react-native-webview'; class MyInlineWeb extends Component { render() { return ( <WebView originWhitelist={['*']} source={{ html: '<h1>Hello world</h1>' }} /> ); } } Similar to the example above you can load an iFrame inside of a WebView. import { WebView } from 'react-native-webview'; class MyInlineWeb extends Component { render() { return ( <WebView originWhitelist={['*']} source={{ html: "<iFrame src='your_URL' />" }} /> ); } } So as shown in the example above, your iFrame is loaded inside the WebView component. You can then render any web page or URL inside your iFrame then.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "ios, react native, iframe, react native webview" }
initialize long long with value starting with 0 leads to strange values What happened here? long long value; value = 001111011112; in Visualstudio debugging, the value shows with value 153358922. If the number doesn't start with 0, all is correct... Any recommendations how to keep using my initialization style?
In C++, a number beginning by `0` is an octal (base 8) literal. If you want to print this value with leading zeros, you can do: long long value; value = 1111011112; cout << setw(12) << setfill('0') << value;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++" }
popd before return / exit function In bash what is the proper way to `popd` before returning / exiting from a function? For example, function fn () { pushd ~ >/dev/null if [ $1 = $2 ]; then return 0; elif [ $2 = $3 ]; then return 1; else return 2; fi popd >/dev/null } Am I supposed to write `popd` before each return? Or, should I be doing this another way?
For this I'd probably do it this way: fn() { pushd ~ >/dev/null if [ "$1" = "$2" ]; then ret=0 elif [ "$2" = "$3" ]; then ret=1 else ret=2 fi popd >/dev/null return $ret } that way I wouldn't have to repeat the "cleanup" code before each return. An alternative would be to do the work in a subshell and have that `cd` to the desired directory, though that subshell could not modify the parent's environment (which is part of what we want after all). fn() ( cd ~ if [ "$1" = "$2" ]; then return 0 elif [ "$2" = "$3" ]; then return 1 else return 2 fi )
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 4, "tags": "bash" }
How to set xml:lang value at runtime? How to change xml:language in runtime? The situation is that person has let's say 'EN' selected as the browser language. Some other user has e.g 'FI' in the very same language property. For the first guy everything is shown in English, for the second one in Finnish accordingly. The two persons use Google Chrome and because both have xml:lang set to default 'en-US' on the code, the Finnish text is treated as in English. Now what I want is that the Finnish text is in the runtime recognized as Finnish also in the xml:lang setting level. So, xml:lang value cannot be hard coded as it is now. I also don't want to make 7 different pages for seven languages just because I cannot modify one field in runtime. My setting is one of having struts2 and xwork for i18n. Setup is a jsp file having html tag with variable xml:lang and that setup should be altered on runtime.
I assume you want to set this value at the `<html>` level. Example Current Code: <html lang="en" xml:lang="en"> Example Revised Code: <html lang="${action.language}" xml:lang="${action.language}"> Then, add a `getLanguage()` method on your Struts2 actions (just put it on a base action that everything inherits from), such as: public String getLanguage() { // return the appropriate language based on the user's choice }
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "html, jsp, struts2, xwork" }
SF short story (Playboy-70's?) where a man with mental powers visits the President and is killed as he leaves Trying to find this one for someone on another site. The plot synopsis as we both remember it is that a man has mental powers probably controlling type, gets into see the President and as he is leaving he's whacked on the head with a hammer and killed. My additional memory is that someone says: "He never said he could read minds." I also remember the artwork illustrating the story because I cut it out and used it on a collage. ![Story artwork showing eyes with "fire eye lashes"]( Pretty sure it was in Playboy but a search of published short story titles rang no bells.
Found it. The story is called "The Most Powerful Tailor in the World" by Michael Crichton, published in _The Best of Playboy Fiction, Volume 1_ The burning eyes can be seen on the cover image below. ![Cover of "The Best of Playboy Fiction". It says MICHAEL CRICHTON in large letters, and then "The Most Powerful Tailor in the World" directly underneath. Below that is a pair of eyes with fire covering the eyelashes and extending upwards.](
stackexchange-scifi
{ "answer_score": 11, "question_score": 8, "tags": "story identification, short stories" }
How are assemblers written and what are they written in? If you go on the internet and download an asm assembler. What is it made from. What file type does it use? And how was the assembler itself created?
There's nothing special about how an assembler is written. All it does is parse an assembly syntax and spit out machine code for a particular architecture. If your preferred programming language can read text and write binary, you can create an assembler with it.
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 2, "tags": "assembly" }
Enviar email para vários destinatários Estou com uma classe para enviar email, que funciona perfeitamente para somente um destinatário, porém preciso enviar para várias pessoas, fiz um select que busca os emails q preciso e coloca o ";". Porém quando tento enviar desta forma, me retorna o erro "Um caractere inválido foi encontrado no cabeçalho do email: ';'." Tentei colocar "," retorna o mesmo erro. Tentei fazer assim: var listaEmail = emailDestinatario; var emails = listaEmail.Split(','); foreach (var endereco in emails) { email.To.Add(endereco); } Ele não retorna erro, mas também não envia os emails. Alguma sugestão?
listaemail esta recebendo todos os email que você deseja enviar separando com ",". se estiver Tenta fazer assim: string[] emails = listaEmail.Split(','); foreach (var endereco in emails) { email.To.Add(endereco); }
stackexchange-pt_stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#" }
python tk.Canvas find_withtagで正常にidが返らない問題 tk.Canvas tagfind_withtag()idmove() self.drag tag tag_list = list() for weight in self.canvas.find_all(): t = [ (weight,tags) for tags in self.canvas.gettags(weight) if self.drag_obj in tags] tag_list.append(t) print(tag_list) print(self.canvas.find_withtag(self.drag_obj) ) self.canvas.move(self.drag_obj,dx,dy) [[], [], [], [], [], [], [], [], [], [], [(3, '000330208100')], [(4, '000330208100'), (4, '000330208100name')]] (3, 4) [[], [], [], [], [], [], [], [], [], [], [], [], [(13, '112233445566')], [(14, '112233445566'), (14, '112233445566name')]] () '000330208100''112233445566'find_withtag()'112233445566' tag
tagsidTag <
stackexchange-ja_stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "python, python3, tkinter" }
directional derivative sublinear of a convex function sublinearity problem to show How to show the following: If $f:\mathbb R^d \rightarrow \mathbb R$ is convex then its directional derivative is sublinear? Thank you...
I assume that you mean that the directional derivative is sublinear with respect to the direction? In that case we must prove that 1. $f'(x;\alpha t) = \alpha f'(x; t)$ 2. $f'(x;t + s) \leq f'(x;t) + f'(x;s)$ **Proof** : 1. $$f'(x;\alpha t) = \lim_{h \rightarrow 0 } \frac{f(x+h\alpha t) - f(x)}{h} = \alpha \lim_{h \rightarrow 0 } \frac{f(x+(h\alpha) t) - f(x)}{h\alpha} = \alpha f'(x;t)$$ 2. $$ f'(x;t + s) = \lim_{h \rightarrow 0 } \frac{f(x+h(t+s)) - f(x)}{h} \\\ \\\= \lim_{h \rightarrow 0 } \frac{f(\frac{1}{2}(x+2ht) + \frac{1}{2}(x+2hs)) - \frac{1}{2}f(x) - \frac{1}{2}f(x)}{h} \\\ \leq \lim_{h \rightarrow 0 } \frac{f((x+2ht)) - f(x)}{2h} + \lim_{h \rightarrow 0 } \frac{f((x+2hs)) - f(x)}{2h} \\\ = f'(x;t) + f'(x;s)$$ In the inequality I used the convexity of $f$. Don't hesitate to ask if something i unclear. Best regards
stackexchange-math
{ "answer_score": 5, "question_score": 1, "tags": "real analysis, functional analysis, convex analysis, convex optimization, locally convex spaces" }
Is there a circuit simulator out there that has latching relays? Okay, I'm at my wits end with this one. Having tried a dozen or so free/semi-free circuit simulators, I can't find any that include latching relays. This surprises me as they're one of the most common components I use. Am I missing something obvious like another naming convention, or is there a decent simulator out there that does include them that I just haven't found yet? I'm giving thought to coding one for Falstad's simulator, but can't do this in the office as I don't have the software... * * * The functionality I need is a single momentary switch latching the relay on, then latching it off again on the next press. I imagine I'm missing something fairly obvious in making this happen, so will keep playing, but felt it couldn't hurt to ask for an extra prod in the right direction please?
As an alternate solution, lots of people suggested creating a sub-circuit to 'latch' the relay. There was a lot of head-scratching in this, and it's far from neat/uses a lot of resources (in Falstad, at least), but in case it's of use to anyone finding this thread, here's a latching relay setup. It requires two double pole relays; the first for logic, and the second to use one pole as part of the logic and the other as the actual toggle. So in terms of treating this as a single 'latching relay', the labelled Switch is your input signal (and can be replaced with a single pole relay if this needs to be electrically triggered), and the secondary pole of the labelled Output is what is actually toggled backwards and forwards with each press of the switch. ![Latching Relay with Non-latching Relays](
stackexchange-electronics
{ "answer_score": 1, "question_score": 1, "tags": "relay, simulation, latching" }
Android: Moving buttons freely in Eclipse's Graphical Layout Editor I've developed several iPhone apps and now I'm porting them onto Android. From what I was used to, I was able to freely move buttons around using the Interface Editor for the iPhone, and from what I understand for Android, you can (or need) to use the XML layout file to "layout" your buttons and whatnot. **So this means I have to use tables right? Is there a way that I can just freely move a button where I want with my mouse using the graphical layout editor in eclipse?** I've Googled and came upon this thread WYSIWYG View Editor in 'Android'? but I don't think they came up with a good conclusion.. Thanks. -Paul
The reason for iPhone absolute layouts is that all the screens are the same size. Because there is such a wide variety of android devices, you should try getting used to relative and linear layout construction. To answer, **no** , you won't be able to place a button in an exact pixel location using the graphical layout editor.
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 7, "tags": "java, android, xml, eclipse" }
Django Template filter is passing wrong data I'm collecting data in multiple nested dicts and passing them to my template. I wrote a simple filter to get the data from the dict by key: @register.filter def get_item(dictionary, key): return dictionary.get(key) In my template I'm accessing the data: {% for location_type_id, location_type_name in location_types.items %} {% with disctrict=disctricts|get_item:location_type_id %} ... {% endwith %} {% endfor %} When I'm using {{ debug }} I see: {'districts': {5: {6: 'Friedrichshain'}, 7: {7: 'Kreuzberg', 8: 'Charlottenburg'}}, 'location_types': {5: 'Bar', 7: '5'}} But I get the error: 'str' object has no attribute 'get'. When printing the arguments of the filter I get an empty string passed to filter instead of a dict.
There's a typo in your template, which probably causes the error: `{% with disctrict=disctricts|get_item:location_type_id %}` should be `{% with disctrict=districts|get_item:location_type_id %}`
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "django, filter" }
Determine if a point is inside a triangle formed by 3 points with given latitude/longitude I have 3 points ( lat , lon ) that form a triangle.How can i find if a point is inside this triangle?
The main question is whether you can use a 2D approximation for this (in other words, is your triangle small enough). If so, something simple like barycentric coordinates will work well.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 6, "tags": "javascript, geometry, geolocation" }
concatenate string inside sql recursive WITH statement CTE i'm trying to concatenate the values from a column from all levels of a certain path this is my sql: WITH hi as ( select c.id id, cast(c.code as nvarchar) code, c.title, c.parent from CaseTypes c where c.parent is null union all select c.id, cast((h.code + c.code ) as nvarchar) code , c.title, c.parent from CaseTypes c inner join hi h on c.parent = h.id ) select * from hi the problem is that only the first level (where parent is null) is taken, the rest isn't
This code will concatenate the string and only display the last parent declare @CaseTypes table ( code nvarchar(max), title varchar(20), parent int, id int ) insert @CaseTypes values ('a', 't1', null, 1) insert @CaseTypes values ('b', 't2', 1, 2) insert @CaseTypes values ('c', 't3', 2, 3) ;with hi as ( select c.id id, cast(c.code as nvarchar) code, c.title, c.parent from @CaseTypes c where c.parent is null union all select c.id, cast((h.code + c.code ) as nvarchar) code, c.title, c.parent from @CaseTypes c inner join hi h on c.parent = h.id ) select id, code, title, parent from hi h where not exists ( select 1 from hi where h.id = parent )
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "sql, sql server, sql server 2005" }
Ghost stories white moon - cemetery tile Qi Ghost stories white moon. When using the village cemetery tile to bring a player back, the revived player gets 2 Qi. When using this same tile to bring a villager back from the graveyard, what happens with the Qi? Does the active player get them?
I can't find an authoritative answer, but I believe that no one gets any Qi. Using the Cemetery in the base game allows you to revive a taoist, which is represented by them having some amount of Qi. For play reasons, this amount is set at two. Using the Cemetery with White Moon allows you to revive a villager instead; but villagers don't have Qi, they are just either alive or dead. Looking at the flavour of the action, when you bring back a taoist you are giving them life back (at a cost), but you don't benefit; so when you bring back a villager, why should you be gaining life?
stackexchange-boardgames
{ "answer_score": 0, "question_score": 1, "tags": "ghost stories" }
Update query without condition but need to update 90% of records in a table - SQL / SnowFlake Update query without a condition but need to update a certain percentage of rows in the table for a specific column. Say I have 100 rows in a table, I want update a specific column based but no specific condition; just that 90% of the records in the table has to have this new value that I want to update. Any thoughts/ help is really appreciated.
You can use SAMPLE feature of SNOWFLAKE. Please see an example below. CREATE OR REPLACE TABLE SAMPLE_TEST(ITEMID NUMBER, ITEMDESCRIPTION VARCHAR, STATUS VARCHAR); INSERT INTO SAMPLE_TEST VALUES(1,'BOOK',NULL); INSERT INTO SAMPLE_TEST VALUES(2,'TSHIRT',NULL); INSERT INTO SAMPLE_TEST VALUES(3,'CLOTHES',NULL); INSERT INTO SAMPLE_TEST VALUES(4,'KITCHEN',NULL); INSERT INTO SAMPLE_TEST VALUES(5,'SPORTS',NULL); INSERT INTO SAMPLE_TEST VALUES(6,'ELECTRONICS',NULL); INSERT INTO SAMPLE_TEST VALUES(7,'MEDICAL',NULL); INSERT INTO SAMPLE_TEST VALUES(8,'MAGAZINES',NULL); INSERT INTO SAMPLE_TEST VALUES(9,'SHAMPOO',NULL); INSERT INTO SAMPLE_TEST VALUES(10,'TOOTHPASTE',NULL); SET COUNT=(SELECT COUNT(*)*0.9 FROM SAMPLE_TEST); UPDATE SAMPLE_TEST SET STATUS ='A' FROM (select ITEMID from SAMPLE_TEST SAMPLE($COUNT ROWS)) t1 WHERE SAMPLE_TEST.ITEMID = t1.itemid;
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "sql, snowflake cloud data platform" }
How to convert the time from AM/PM to 24 hour format in PHP? For example, I have a time in this format: eg. 09:15 AM 04:25 PM 11:25 AM How do I convert it to : 09:15 16:25 23:25 Currently my code is : $format_time = str_replace(" AM", "", $time, $count); if ($count === 0){ $format_time = strstr($time, ' PM', true); $format_time = ...... } However, it seems there are some easier and more elegant way to do this? $time = '23:45'; echo date('g:i a', strtotime($time)); How do I fit the above sample in my case? Thanks.
Try with this echo date("G:i", strtotime($time)); or you can try like this also echo date("H:i", strtotime("04:25 PM"));
stackexchange-stackoverflow
{ "answer_score": 136, "question_score": 54, "tags": "php, string, date" }
How to reset xmr-stak configuration? I've installed this recent unified miner called xmr-stak and in the first time I used I mine on `xmrpool.net`, now I want to mine on xmrpool. **eu**. If I run the program with no parameters, it doesn't show me option to set the target pool and just choose the previous configured (.net), if I run with parameter `-o xmrpool.eu:3333` it shows: > [2017-12-15 21:23:17] : Fast-connecting to xmrpool.net:3333 pool ... > > [2017-12-15 21:23:17] : Fast-connecting to xmrpool.eu:3333 pool ... So my question is, how to reset these config so it doesn't connect to the old pool?
1) Edit the **config.txt** file by changing the "pool_address" field in the "pool_list" section. You could also have a list of additional pools and adjust the weights as you wish (e.g. mentioning some backup options). OR 2) Delete the **config.txt** file. Next time you run the executable it will ask you to set the target pool as it did on the first run (it will also ask for the rest of configs as it did then).
stackexchange-monero
{ "answer_score": 2, "question_score": 1, "tags": "mining pools, mining" }
Let .. in statement doesn't work in IO? I can hardly make the difference between "where" and "let .. int" statements. Here's my code. I want 2 ways to print 5. main = do print x where x = 5 let x = 5 in print x First one works, but I get a "parse error on input 'let'" Is this a matter of indentation, or is my code plain wrong ?
`where` always ends a statement; nothing should go after `where`. So, you could write it like this: main = do let x = 5 in print x print x where x = 5 This is valid because the `where` clause ends the statement, where it should belong. Your code was invalid because the parser expected to find nothing after the `where x = 5`, but discovered your `let` clause.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 3, "tags": "haskell" }
Is there any way to use a common folder in both ios and android Application? I am developing an application in both android and ios and there I am using the web view which is common to both platform..so my question is, Is there any way to make a common folder of webView and use in both android and ios? and If it is possible.if I made any changes in common folder it should reflect in both ios and android. -please don't suggest to use ionic and cordova because my requirement is different. I am not talking about update or commit. What I am asking is that when I make changes to some file inside common, the same changes should get reflected in both ios and android. In the same way, the changes I make inside Android's common should get reflected in ios and the main common folder
Your code should be in version control, like git. You should create 3 repositories, one for each project and one for common. Add common as a sub repository for each project. Put all your html into the common repository. Include the folder that represents the common repo into each project. Technically on disk the folder will generally be different for each project, but in the approach described above you can make changes, commit them and pull those changes into the other project easily.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, android, ios, webview" }
Entity SQL: Include? I am looking for equivalent of the following for Entity SQL. from row in Parent_Table select new{ Parent_Table.include("child_table").Select("SomeField").Max(), row } Whereas this is part of whole query (how can i create a sub query while the lazy loading is off ?) as i try myObjectQuery.Include("Proj_PF_" + state_Year).Select("phisicalImprovement").Max(); phisicalImprovement is a field of Proj_PF_" + state_Year and my query is to an other table get the fallowing exception 'phisicalImprovement' is not a member of 'Transient.collection[NezaratModel.Proj_PF_58_89(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a subquery to iterate over the collection. Near simple identifier Thank you.
There is no equivalent in ESQL and it should not be needed because when you call ESQL you are using `ObjectQuery<>` so you just pass your ESQL command to the `ObjectQuery` instance and should be able to call `Include` for it: var query = (new ObjectQuery<YourEntity>("SELECT VALUE ...")).Include("SomerRelation");
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "entity framework" }
How to change the color of jQuery Mobile Listview I want to change the color of one of the `<li>` record to say "Red". Please suggest how can I do the same.
You can use the jQuery Mobile ThemeRoller to customize swatches to any colors you would like. You can have multiple swatches (from A-Z) and utilize them on an element-level with `data-theme="a"` (insert letter of swatch). Here's a theme I made for you that is ALL red. !enter image description here
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "jquery, jquery mobile, themeroller" }
Atomic operation involving separate processes I have two .NET applications I'm building which need to share a counter resource locally. I'm looking for a way to atomically increment or decrement the counter from each application. If I were doing this within a single, multi-threaded application, I would simply use one of the `System.Threading.Interlocked.Increment` and `System.Threading.Interlocked.Decrement` overloads with a shared counter variable. My applications will not have access to a database, so I can't use DBMS locking mechanisms. Ideally, I'd like to use a registry `REG_DWORD` value, but I can't figure out a way to increment or decrement it atomically. I've also considered having a file system folder where "incrementing" is putting a uniquely named file in the folder and "decrementing" is deleting a single file, but that seems a bit bulky or cumbersome of an approach. Does anyone know of a good approach to this?
You can use a shared `Mutex`.aspx) to synchronize between multiple processes. This allows you to "lock" and provide a guard around the code which accesses the registry, if that is the shared storage mechanism you choose to use.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": ".net, process, atomic" }
how to stop everyone can see my folder on website? I use magento and It worked fine.Then I migrated my website to another hosting and when I go to Url `www.mywebsite.com/skin` or some folder and it show my website folder to everyone It should be Show `404 error page` in my custom theme Please help me how to redirect `www.mywebsite.com/skin` to my `404 error page` theme Sorry for my bad english and I'm very new to website coding.
Add this code in .htaccess. It blocks the folders to be seen if no index file inside it. Options All -Indexes
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "php, apache, .htaccess, magento" }
Delphi, Integrate or combine or join cookie to internet browser I am using Mozilla firefox to logged-in a particular website, and there are times that I used Internet explorer to logged-in also in the same website. I'm also using TWebbrowser from Delphi(mywebbrowser), and when I point the URL to navigate, it points that Im already logged-in from Internet Explorer, But I want to use the cookie of Mozilla Firefox, so if Im logged-in to a website using Firefox and Use my own WebBrowser I will not have to logged-in anymore. Just want to ask if possible to set the cookie of Mozilla Firefox to Internet Explorer will solved? OR there's a lot more than that? thanks
TWebBrowser is a wrapper for IE's ActiveX/COM object, which shares the same core with the standalone IE browser, which includes cookies. For what you are asking, you would have to manually access and export Firefox's cookies (I don't know if Firefox has an API for that but I doubt it, so you will have to search online for more details) and re-format them as text files saved into IE's cookies folder. Neither Firefox nor IE will do the export/import for you.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "delphi, twebbrowser" }
get colums of three joined tables I was able to join 3 tables and count the data set, bet getting the columns on specific table it only see the 3rd table column.. SELECT * FROM `InvoiceItemTable` a JOIN `InvoiceTable` b ON (b.id = a.invoice) JOIN `products` c ON (a.product = c.id) WHERE b.status='1' AND c.store = '2' //$invoices = $inginger->fetch(PDO::FETCH_ASSOC)) echo $invoices['a.price']; This price return error : Undefined index: a.price in... there is "price" in the first table(InvoiceItemTable). echo $invoices['invoice']; There is invoice in first table(InvoiceItemTable) and it returns it works I dont want to use $invoices['price'] because there is 'price' colum in the third table too and that is what it returns, I want to get the price in the first table. $invoices['price.InvoiceItemTable'] returns undefined index
php wont recognize `$invoices['a.price'];` you have to use `$invoices['price'];` if you have same fieldname in multiple tables you have to create an alias SELECT a.price as a_price, b.price as b_price, c.price as c_price and then you can use `$invoices['a_price']`
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "php, sql" }
WCF return Types over 2 services I have a WCF Service Application. I have 2 different contracts(services). I did this because by having them one big service, there will be 80 - 90 Operation contracts. So I divided them into 2 services. Both these services share some Business objects (data contracts from DAAB layer). Both the services are used by one app. I have a ambiguous types on the client side, because even though they are one complex datatype on the service side, they are considered 2 different data types on the client side. Is there way where I can say both are of the same kind on the client side?
I ran into a similar problem on a project... We just called svcutil.exe directly to generate our client proxies. The trick is to pass in both services at the same time so that it can re-use the types. EDIT: This article appears to solve the problem you're having: < svcutil /out:api.cs /namespace:*,SomeNamespace.API
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "wcf, wcf client" }
Can I install MS Exchange Server on Windows 10? I want to develop an Outlook we add-in. When I try to run something copied from the MS tutorial, I am prompted to "Connect to Exchange email account". I am guess that this means MS Exchange Server. Which I don't have. So, I figure that I will purchase that, or download from MS if it is free; but, when I Google, I only see stuff about installing it on Windows Server. Can I install MS Exchange Server on Windows 10, which is all that I have?
> Can I install MS Exchange Server on Windows 10, which is all that I have? MS Exchange Server cannot be installed on Windows 10. > This topic provides the steps for installing the necessary Windows Server 2012, Windows Server 2012 R2, and Windows Server 2016 operating system prerequisites for the Exchange 2016 Mailbox and Edge Transport server roles. Only the Exchange 2016 management tools can be installed on Windows 10. > ![enter image description here]( It also provides the prerequisites required to install the Exchange 2016 management tools on Windows 8.1 and Windows 10 client computers. # Sources * Exchange 2016 system requirements.aspx) * Exchange 2016 prerequisites.aspx\]\[1\])
stackexchange-superuser
{ "answer_score": 1, "question_score": 1, "tags": "microsoft outlook, exchange" }
How would one create a codeception assertion to see a copyright symbol? I am attempting to create an acceptance tests which looks for a line of text that also contains a copyright symbol `(c)`. I have tried using: $I->see('&copy; 2016 MyCompany, LLC'); Using an html escape character with the assertion fails. Any tips on how to make codeception see the copyright symbol?
`see` method matches decoded html entities, so you have to use the actual character as advised by Sammitch. The alternative way is to use seeInSource method and match the entity as it is in the HTML: `$I->seeInSource('&copy; 2016 MyCompany, LLC');` Update: I checked the edit history and it appears that you used the actual © character in original question. I did a quick test and `$I->see('© 2016 MyCompany, LLC')` matched both © and `&copy;`, so it should be working for you. Make sure that your test file is saved as UTF-8 and your website is using UTF-8. If you use a different charset, use character codes in assertion.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, codeception" }
Impulse based physics - Stacking heavy object on light object I'm developing an impulse based physics engine, but I have a problem with objects of large mass difference. At each frame the engine applies impulses to handle collisions. The impulses are applied over a number of iterations, between each pair of colliding objects. This works well if the objects are about the same mass. But the problem is, that when placing a heavy object, on top of a light object, the heavy object will force then light object into the ground. The cause of the problem is, that the impulses applied between the two objects is too small, so even over a number of iterations, it will not be enough to counter the gravity on the heavy object. I believe there are ways to accurately calculate the needed impulses, but I fear it's too complicated? So mostly I'm looking for some tricks to counter this problem, but not changing the way the engine works. Thanks for any ideas!
Google for 'Shock propagation', the basic idea is that you sort your contacts in the direction of gravity (usually along the 'y' axis) and during contact resolution you freeze the lower bodies (assign to them infinite mass, that is, invMass = 0.0f and invInertiaTensor should be a zero matrix) so that they don't 'sink'. I haven't implemented that, i'm struggling with my own crappy physics engine.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "physics, game physics" }
How to create a rate and comment system for android app? I want to create a rate system for an android application using java. Ive searched around and havent found much on the web concerning this. What do i need to do to build or get started building a rate system for a android application. Such as the android market. The user is allowed to leave comments and rate a app. I want to implement the same concept except with the ability just to rate or vote up a object in my application. Has anyone implemented this before? Some guidance on this would be very helpful. Thanks
This is a pretty broad question, but I would use an approach like this: `Android Client <--> (RESTful) Web Service (e.g. PHP) <--> Database (e.g. MySQL)` The last two items, of course, reside server side in this architecture. The flow would essentially consist of the user makes a rating or comment, an HTTP request is made to your web service, the web service executes a SQL statement that adds the rating or comment to the database, which leads to a result and an HTTP response from which you can update your Android client. I would first suggest looking into RESTful web services and web services in general if you're unfamiliar with them.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": -1, "tags": "java, android, sql, java server" }
Deleting an Exe Batch Script itself I have compiled my batch (.bat) file into exe, lets name it Run.exe, I want to tell it to delete itself at the end of its work. How can I do this through commands?
Put this at the end of your script: ( del /q /f "%~f0" >nul 2>&1 & exit /b 0 ) This will tell it to exit and delete its self and i have tested it when compiled to an exe so it works. This can be a bit unreliable so you could try this also call :end&exit /b :end start /b "" cmd /c del "%~f0"&exit /b Try both and see witch one works best for you.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "windows, batch file" }
Nodejs for loop callback issues I wrote this function that should run this for loop and then the callback at the end but it keeps running the callback before it finishes the loop. The only solutions I've read said using a callback would fix this issue but it doesn't seem to be making much of a difference. function run(callback){ for(var i = 0; i < urls.length; i++){ request(url, function(error, resp, body){ //uses cheerio to iterate through some elements on the page //then saves to an object for a future response }); callback(); } }
I would add a variable called `totaltasks` and another one called `tasksfinished`. Then when a request is finished increment `tasksfinished`, and call your callback whenever `tasksfinished` equals `totaltasks`: function run(callback){ var totaltasks = urls.length; var tasksfinished = 0; // helper function var check = function() { if(totaltasks == tasksfinished) { callback(); } } for(var i = 0; i < totaltasks; i++){ try { request(url, function(error, resp, body) { tasksfinished++; check(); }); } catch(e) { tasksfinished++; check(); } } };
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, nodes" }
How to detect when the browser has finished updating the view (re-layout, apply any changed CSS) I have code that I'd like to run that looks something like this pseudocode: 1. Apply some CSS style to some element 2. Do some other action The issue is that I need to not do the 'other action' until after I'm certain that the browser has actually rendered the changed CSS and will be visible to the user. Although Javascript is single threaded, and if the 'other action' blocks the Javascript from executing further, I'd think that the browser would hopefully still be able to update the view with the new CSS values set in step 1, even if Javascript itself is blocked - but that doesn't appear to be happening (the CSS changes don't show up until after step 2 - in this case a remote service call - completes).
Adding to Grezzo's comment, you can use a JS timeout of 0 to ensure the previous line of code has finished executing. This works because it puts whatever is inside the setTimeout's closure at the very end of the internal queue of code to be run. E.g. // Update CSS $('#mydiv').css({'position' : 'relative', 'top' : 0}); setTimeout(function() { funcToRunAfterUIUpdate() }, 0); I'm too n00b on StackOverflow to post a link, I think, otherwise you can read the "MASTERING THE REFRESH() METHOD" section here: < "Here we placed the refresh call into a zero timeout, doing so we gave the browser the time to refresh itself and the new element dimensions are correctly taken. There are other ways to ensure the browser actually updated the DOM, but so far the zero-timeout has proven to be the most solid."
stackexchange-stackoverflow
{ "answer_score": 6, "question_score": 4, "tags": "javascript, browser, dom events" }
Select tag with multiple values pre-selected - Values inserted manually in database I need to pre-select multiple values in a select_tag. But I'm adding the vacancies 'manually' in table vacancies as follows: My controller: def create @hr_curriculum_generic = HrCurriculumGeneric.new(params[:hr_curriculum_generic]) if params[:vacancy_ids].present? @vacancies_ids = params[:vacancy_ids] \-- my form: @vacancies_ids.each do |vacancy_id| # Armazena os id do curriculum, vaga e do cargo na tabela CandidatosxVagas @candidates_vacancies = CandidatesVacancy.new <% @vacancies = Vacancy.all %> <%= select_tag "vacancy_ids[]", options_from_collection_for_select(Vacancy.all, "id", "title"), :multiple => true, :id => "vacancy_ids", :class => "form-control" %> ..... It works, but when I click in the edit btn, the fields are not being pre-selected.
options_from_collection_for_select has 4 parameters: * collection * id * column * selected You can provide a single value, or a hash to denote selected values. Try this: <%= select_tag "vacancy_ids[]", options_from_collection_for_select(Vacancy.all,"id","title",{:selected=>[1,2,3,4]})), :multiple => true, :id => "vacancy_ids", :class => "form-control" %> I'm not sure where the values you are trying to select come from but pipe them into the selected hash.
stackexchange-stackoverflow
{ "answer_score": 11, "question_score": 7, "tags": "ruby on rails, ruby, ruby on rails 3.2, ruby on rails 3.1" }
How do you clean a dusty lens? The lenses of my telescope and binoculars are dusty. What is the best way to clean them without damaging the optic coating?
Best advice is: _don't_ try to clean them! A little dust has absolutely no effect on the images, but a bad cleaning can damage the lenses or their coatings irreparably. If you _must_ clean them, use the techniques here: Cleaning the mirrors of reflector telescopes is even less desirable and requires even more care: <
stackexchange-physics
{ "answer_score": 7, "question_score": 8, "tags": "telescopes" }
WooCommerce META Fields in Category Page My client wants a strapline under each product name where products are shown on the category page. I understand that the best option is to include the strapline as a Custom Field and then show that information using: <?php the_meta(); ?> This seems to work perfectly well on the Product Page when used within the file `woocommerce/single-product/meta.php`, however it doesn't show up when I add it to any of the other files within the woocommerce folder (and I think by now I have added it to almost everything in various places to test it). Can anyone provide some guidance?
The answer to this is actually fairly straightforward once you know the right place to post the php. Find the file woocommerce/content-product.php Look for this line: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> and paste this beneath it: <?php the_meta(); ?> ...and you should be good to go.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "php, wordpress, woocommerce, metadata" }
how to fetch data from xml document and write to a text file? namespace readtask { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { Process.Start(@"E:\SAMPLE PROJECTS\TaskName.xml"); } } }
There are one to many ways to achieve this: using System; using System.IO; using System.Xml; public class SampleXML { public static void Main() { //Create the XmlDocument. XmlDocument doc = new XmlDocument(); doc.Load("TaskName.xml"); //Display the desired tag. XmlNodeList elemList = doc.GetElementsByTagName("name"); for (int i=0; i < elemList.Count; i++) { Console.WriteLine(elemList[i].InnerXml); } } } or this? or maybe this? definitely look at this!
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -4, "tags": "c#" }
R parallel system call on files I have to convert a large number of RAW images and am using the program DCRAW to do that. Since this program is only using one core I want to parallelize this in R. To call this function I use: system("dcraw.exe -4 -T image.NEF") This results in outputting a file called image.tiff in the same folder as the NEF file, which is totally fine. Now I tried multiple R packages to parallelize this but I only get nonsensical returns (probably caused by me). I want to run a large list (1000+ files) through this system call in r , obtained by list.files() I could only find info on parallel programming for variables within R but not for system calls. Anybody got any ideas? Thanks!
It doesnt' matter if you use variables or `system`. Assuming you're not on Windows (which doesn't support parallel), on any decent system you can run parallel::mclapply(Sys.glob("*.NEF"), function(fn) system(paste("dcraw.exe -4 -T", shQuote(fn))), mc.cores=8, mc.preschedule=F) It will run 8 jobs in parallel. But then you may as well not use R and use instead ls *.NEF | parallel -u -j8 'dcraw.exe -4 -T {}' instead (using GNU parallel).
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "r, system, dcraw" }
Bing Image Search API autocorrect feature...? I am trying to use BING's image search api, but the problem is when I miss-spell something it automatically corrects the and doesn't tell me that "Hey we have auto-corrected your query!" , I want to know if my query has been auto corrected and what's the replacement word they have used.. Has anyone done this before...? This is the query I am using.. note "Aemrica" has been mis-spelled deliberately but it still it gives me results for "America" but does not tell anything that the word has been replaced. Is there any way around it..? i am using the response for iPhone.
~~No there is no way around this. Even the SearchResponse.Query.SearchTerms response parameter appears to still be the incorrectly spelt version. I would suggest contacting Microsoft if this is a big issue for you.~~ EDIT: If you upgrade to the new Bing Search API based on the Azure marketplace, you can now get this data by first making a call to the SpellingSuggestions endpoint.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "iphone, objective c, json, bing api" }
Hashlink is not working in Safari While using haslink (#testhash) is not working on Safari. I am really unable to locate the problem. Here is the following code I am providing below <a href="?page_id=112#testhash">Click here to go to Hash</a> <div style="height:500px">&nbsp;</div> <div id="testhash"></div> <div>............Test Data............</div> When I am clicking on the link, it is got going to proper place on Safari but it is working fine on Google Chrome, Mozila Firefox and IE9. In Safari the link is redirect to the site ` instead ` after URL rewritting. The funny thing is when I am directly putting the link ` on the address bar of Safari, it is working fine but the time of clicking it is not working and also when I am writting ` it is giving problem.
You may do one thing. Give the full link instead of `?page_id` because sometime Safari or some other browsers write different rewrite rules for Wordpress and thats why Hashlinks doesn't work. You may put `<a href=" Page By Browser]/#testhash">Click here to go to Hash</a>` instead of `<a href="?page_id=112#testhash">Click here to go to Hash</a>` and it may work. *I meant by Rewritten page as the browser divides the page by parents and children like `about-us/page/etc` so the url should be from my example `
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 4, "tags": "html, wordpress, browser, safari" }
Reactive value is undefined I don't know why I cant access reactive value in methods. ... <div class="card"> <div class="card-contents"> <datafieldcheckbox class="filterComponents" :filtervalue="filterAll" @call-method="callfilteredproducts"></datafieldcheckbox> </div> </div> .... new Vue({ el: "#app", data() { return { filterAll: this.filtered(), dataCategory : ["data"] } }, ..... methods: { filtered() { console.log("this.data", this.dataCategory) // Got undefined insted of getting value. } ...
When `filtered` method is called, `data` isn't fully setup yet. It makes sense that `dataCategory` is not available. Instead, call it in `created` hook, where data is already available. export default { data() { return { filterAll: null, dataCategory: ["data"] }; }, methods: { filtered() { console.log("this.data", this.dataCategory); // Got undefined insted of getting value. } }, created() { this.filterAll = this.filtered(); } }; _( P.S. Not sure what you are trying to achieve. But it does seem wrong. )_
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "vue.js, vuejs2" }
Self-contained text on characteristic classes I am looking for a clear, self-contained text (either a book or lecture notes) that deals with characteristic classes, starting from the very basics (fiber bundle, principal bundle etc.), and preferably dealing with the special examples of Steifel-Whitney class and Euler class. Thanks!
Milnor's book on characteristic classes is almost surely exactly what you want.
stackexchange-math
{ "answer_score": 7, "question_score": 2, "tags": "reference request, algebraic topology, manifolds, low dimensional topology" }
Conservation of momentum in inelastic collisions if energy is not conserved in inelastic collisions(eg two ball collision), the energy can be lost as heat or sound, but won't the sound or heat cause the air molecules to move so the molecules also acquire momentum? Then how can momentum be conserved? or do the net momentum of the two balls system decrease?
It is a question of scale. If the linear momentum changes during a collision due to the production of sound that change in linear momentum will be very much smaller than the total linear momentum of the colliding bodies. In an inelastic collision the kinetic energy decreases due to the work done to permanently deform the colliding bodies and in the generation of heat and sound. The sound waves will be generated in all directions so the net momentum change to the colliding bodies would be very small because the **net** linear momentum of the sound waves is so small. The heat and permanent deformation is generated by internal processes involving internal forces within the colliding bodies and so the net linear momentum of the bodies will not change. Just because bits of a body are moving around internally does not matter as it is the motion of the centre of mass of the body which is important.
stackexchange-physics
{ "answer_score": 2, "question_score": 0, "tags": "newtonian mechanics, momentum, energy conservation, conservation laws, collision" }
What values of $k$ if any will make matrices $AB = BA$? $$A = \begin{bmatrix} 2 & 1\\\ 1 & -1\\\ \end{bmatrix}$$ and $$B = \begin{bmatrix} 1 & k\\\ -1 & 2\\\ \end{bmatrix}$$ I need to find a value of $k$ that will make $AB = BA$. I multiplied the two matrices and found no such value of k. Does that mean that there is no value of k that makes $AB = BA$?
You are right. No matter what $k$ is, the lower left element of $AB$ will be $2$ and the same element of $BA$ will be $0$. So these are never equal.
stackexchange-math
{ "answer_score": 2, "question_score": 2, "tags": "linear algebra, matrices" }
Reading checkbox values using implode function I have inserted this form with multiple checkbox items which collects some values, What i need to do is echo this values as a string separated by a comma, but i'm getting error in the implode function, it says Invalid arguments passed. Can you please see the code? if(isset($_POST['Submit'])) { echo "<pre>"; print_r($_POST); $checked = mysql_real_escape_string(implode(',', $_POST['checkbox'])); echo $checked; } ?> HTML Form <form action="checkbox.php" method="post"> <input type="checkbox" name="checkbox[]" value="hostess_name"> <input type="checkbox" name="checkbox[]" value="hostess_familyname_en"> <input type="checkbox" name="checkbox[]" value="hostess_id"> <input type="checkbox" name="checkbox[]" value="hostess_firstname_en"> <br> <br> <input type="submit" name="Submit" value="Submit"> </form>
try this if(isset($_POST['Submit'])) { echo "<pre>"; print_r($_POST); $checked = implode(',', $_POST['checkbox']); echo $checked; } here's the exact stuff I put in my `test.php` <?php if(isset($_POST['Submit'])) { echo "<pre>"; $checked = implode(',', $_POST['checkbox']); echo $checked; } ?> <form action="test.php" method="post"> <input type="checkbox" name="checkbox[]" value="hostess_name"> <input type="checkbox" name="checkbox[]" value="hostess_familyname_en"> <input type="checkbox" name="checkbox[]" value="hostess_id"> <input type="checkbox" name="checkbox[]" value="hostess_firstname_en"> <br> <br> <input type="submit" name="Submit" value="Submit"> </form>
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php, mysql" }
jQuery add class to current li and remove prev li automatic Below is my HTML code, I want to remove `active` class from 1st `li` and add it to 2nd `li` and viceversa automatic every 2 second using jQuery. <li class=""> <a href="#"> <img src="client_logo01.png"> </a> </li> <li class="active"> <a href="#"> <img src="client_logo02.png"> </a> </li> I'm trying to do in this way. $('ul li a').click(function() { $('ul li.current').removeClass('active'); $(this).closest('li').addClass('active'); }); But it is only working on click event.
Pretty obvious it only get's executed on click, as you only bound a click event.. setInterval(function() { // Remove .active class from the active li, select next li sibling. var next = $('ul li.active').removeClass('active').next('li'); // Did we reach the last element? Of so: select first sibling if (!next.length) next = next.prevObject.siblings(':first'); // Add .active class to the li next in line. next.addClass('active'); }, 2000); Run this on document ready and the script alters the active class onto the next sibling every 2 seconds. **this runs regardless of the number of li children your ul element has** jsfiddle demo: <
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "javascript, jquery, html, css" }
Using Gonum for graph algorithms in Go I am a new Go programmer, just finished the "A tour of Go" tutorial a couple days ago. I want to create a graph of a 150 x 120 size and then get all the edge nodes for each node and implement some graph search algorithms such as BFS and Dijkstra. I found a great looking library called Gonum with a graph package that looks promising to use. My problem is that it is a lot of information and I don't know where to get started. I was hoping there would be a tutorial of some sorts to get me started in the right direction, but I haven't had any luck finding one. The way I set this up in Python was making a numpy arrays of zero's to represent the size of the graph and then iterate through it to get each edge for each node, but I am not sure that this is the best way to think about how graphs are set up in Go.
If you're just starting with Go I would recommend sticking with the standard library for a bit and not adding more to your learning curve. Try to implement a simple graph data structure with some basic algorithms - it's very easy, and will let you practice with the language. Later on when you need more performance/features, you can look around for libraries (gonum or others). For example, a simple graph can be represented with: // Node is a node in the graph; it has a (unique) ID and a sequence of // edges to other nodes. type Node struct { Id int64 Edges []int64 } // Graph contains a set of Nodes, uniquely identified by numeric IDs. type Graph struct { Nodes map[int64]Node }
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "go, search, graph, gonum" }
How do you turn a string that looks like a List of Dictionaries into a List of Dictionaries? I have a string that looks like a List of Dictionaries: string foo = "\"[{ \"Key\":\"Value\", \"Key2\":\"Value\"}]\""; How do I actually turn this into a list of dictionaries? List<Dictionary<string, string>> bar
Since you string seems to be json, you could use this: using Newtonsoft.Json; (...) string foo = "\"[{ \"Key\":\"Value\", \"Key2\":\"Value\"}]\""; // Remove start and end quotes var json = foo.Substring(1, foo.Length - 2); var dictionary = JsonConvert.DeserializeObject<List<Dictionary<string,string>>>(json);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "c#" }
Wordpress - delete all users without role We have more than 900.000 spam users! and they haven't any role. We want to delete all spam users and their meta. In this answer and this link we can delete users based on role but our spam users doesn't have any role. This query return real users: SELECT user_id FROM wp_usermeta WHERE meta_key = 'wp_capabilities' In `usermeta` spam users doesn't have `capabilities` key. We want remove spam users with database query.
for resolve you can use subquery and in operator delete from wp_users where ID not in (select user_id from wp_usermeta where meta_key = 'wp_capabilities') select user_id from wp_usermeta where user_id not in (select ID from wp_users)
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 6, "tags": "wordpress, spam" }
Show that pair of straight lines $ax^{2}+2hxy+ay^{2}+2gx+2fy+c=0$ meet coordinate axes in concyclic points. Also find equation of the circle Show that pair of straight lines $ax^{2}+2hxy+ay^{2}+2gx+2fy+c=0$ meet coordinate axes in concyclic points. Also find equation of the circle through those cyclic points **My Attempt:** Given equation to the pair of straight lines is $ax^2+2hxy+ay^2+2gx+2fy+c=0$ Let the lines be $l_1x+m_1y+n_1=0$ and $l_2x+m_2y+n_2=0$ Now what should I do next?
Put $x=0$, $$ay^2+2fy+c=0$$ $$y_{1}y_{2} = \frac{c}{a}$$ Put $y=0$, $$ax^2+2gx+c=0$$ $$x_{1}x_{2} = \frac{c}{a}$$ Hence, $$x_{1}x_{2} = y_{1}y_{2}$$ By Converse of Intersecting chord theorem, the intercepts are concyclic. > **Note briefly:** > > Note that it's also true for any non-degenerate conics such that $g^2>ac$, $f^2>ac$ and $c\neq 0$. > > For two straight lines, > > $$\begin{vmatrix} a & h & g \\\ h & a & f \\\ g & f & c \end{vmatrix}=0$$ Now the equation of the required circle is $$\fbox{$a(x^2+y^2)+2(fx+gy)+c=0$}$$ See the link **here**. In the diagram below, $A=(x_{1},0), B=(x_{2},0), C=(0,y_{1}), D=(0,y_{2})$, $AB$ and $CD$ are the intersecting chords that meet at the origin $O$. ![enter image description here](
stackexchange-math
{ "answer_score": 1, "question_score": 1, "tags": "analytic geometry" }
Cannot open a zip file with Archive Manager I have been FTPing a database dump from my ISP using Filezilla on an Ubuntu 20.4 VM, running under Windows Hyper-V. I then open the file using Archive Manager and extract it to a folder, ready for Importing into MySQL. The problem is now that on opening the zip file, I get an error: `An error has occurred while loading the archive` I have also noticed that uploading file to my web site, they arrive with a Zero byte file length. So with all this in mind, looks like there is a problem with Filezilla, OR a network issue between Ubuntu and Hyper-V?? Any thoughts please.
Yes - that's exactly what happened; file transferred in ASCII. Switched to binary and all seems fine now. Thank you for all the replies. PS. One would expect the message to be more explicit.
stackexchange-askubuntu
{ "answer_score": 0, "question_score": 1, "tags": "archive, hyper v, filezilla" }
How can I make redis-server flushes all data when it restarts? I am studying redis. I got local redis-server(localhost) and access with terminal in same device. Since I heard that redis is memory-database, I expect all data gone when I shutdown the server. However, When I command `"shudown"/"exit"` in redis-cli and restart, data still alive. I think there is an option to control this, but I can not find. Would you let me know where to find and what has to be changed?
Look in the redis.conf file that you are using: # It is also possible to remove all the previously configured save # points by adding a save directive with a single empty string argument # like in the following example: # # save "" Stop redis-server, configure it as stated above, throw away the .rdb file, and start redis-server. From now on, on every restart, redis-server will start with no data. Plus, no automatic snapshotting will happen at all. _Note:_ I presume here that you have not configured AOF. If that's the case, the solution is similar to the method mentioned above. Hope this helps, TW
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 6, "tags": "configuration, redis, persistence, recovery" }
Prevent elements not being properly loaded in Selenium I have this whatsapp bot and I need to send messages frequently while the user does other work, so the program opens chrome and then the user overlays it with another window "chrome window, file explorer or whatever", the problem is that on windows it works just fine, but on macOS, if you don't focus on the whatsapp window, the program execute wrong commands like not seeing an element. Does anybody know a solution for this? ![enter image description here](
I'm not sure, but try running the Selenium script in headless mode. This can resolve your issue.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "python, selenium, selenium webdriver, headless browser" }
из двух масивов дат в один php ![введите сюда описание изображения]( меня есть два массива с датами 1 массив $period_data_form 2 массив $date_holidays мне необходимо исключить в 1 массиве даты 2 массива Подскажите пожалуйста как такое реализовать?
Воспользуйтесь методом `array_diff` array_diff($array1, $array2);
stackexchange-ru_stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "php" }
Peut-on mettre "il faudrait" au pluriel ? Bonjour, Je m'intérroge sur la phrase suivante : > Vous avez des documents qu'il faudrait modifier immédiatement Ce qu'il faudrait modifier ce sont les documents. Dois-je écrire : * « qu'il faudrait » car c'est indéfini comme « il pleut » * « qu'ils faudraient » pour montrer que ça se rapporte aux documents (qui sont au pluriel) * les deux sont acceptables Merci
Falloir est un verbe défectif, comme pleuvoir. Il se conjugue à tous les temps mais seulement à la troisième personne du singulier. Dans l'exemple, _les documents_ est le complément d'objet du verbe _modifier_ , pas le sujet du verbe _falloir_.
stackexchange-french
{ "answer_score": 5, "question_score": 4, "tags": "conjugaison, indéfini" }
DateTime.AddDays(7) vs Calendar.AddWeeks(1) Can both methods deliver different results under certain circumstances? Same question for negative values...
Straight from Reflector: public DateTime AddDays(double value) { return this.Add(value, 86400000); } public virtual DateTime AddWeeks(DateTime time, int weeks) { return this.AddDays(time, weeks * 7); } Note, however, that AddWeeks is defined as `virtual`.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": ".net, datetime, calendar, globalization" }
Linux script variable "$$" > **Possible Duplicate:** > What does $$ mean in the shell? I am reading a shell script for Linux and come upon the variable `$$`: two dollar signs. Basically the full line is work_dirname=/tmp/my-work-$$ What does the `$$` mean?
`$$` gives the process ID of the shell.
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "linux, shell" }
jQuery - Get mouse position while dragging link I'm trying to track the mouse position while I click and drag an `a[href]` value to the bookmarks bar (it's for a bookmarklet). It seems to stop tracking a few seconds after I start dragging. Code is below. var isDragging = false; $('a#dragthis') .mousedown(function() { $(window).mousemove(function(e) { isDragging = true; var x = e.pageX; var y = e.pageY; console.log(x + "|" + y); }); }); Here is a jsFiddle example: <
You need to `return false` in your `mousedown` handler, to prevent the default action of selecting text upon drag. Updated fiddle
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 7, "tags": "jquery, drag and drop" }
Fréchet derivative, is this true? I was just wondering whether the following statement is true: Let $H_1,H_2$ be Hilbert spaces and $\\{e_n\\}_{n\geq 0}$ be an orthonormal basis of $H_2$. Let $f:H_1\rightarrow H_2$ be an operator (not necessarily linear) and $\pi_n:H_2\rightarrow \mathbb{R}$ the $n$-th projection, i.e. $\pi_n(y) = \langle y,e_n\rangle, y\in H_2$. Then if $\pi_n f$ is Fréchet differentiable for all $n\geq 0$, so is $f$ too. I just wonder if the above statement is true even if we need to add more conditions. The question is essentially how to pass from the finite dimensional projections to the whole space $H_2$. Thanks a lot for your help!!
An additional error condition is needed such that it should be easy to identify sufficient conditions, but it may not be obvious what the necessary ones are. Passing to the coordinates in the orthonormal basis, we can write everything in coordinate vector form $f(x) = ( \pi_n f(x))_n$. Then $$ f(x+h) - f(x) = ( \pi_n f(x+h) - \pi_n f(x))_n$$ By Frechet differentiability, each projection satisfies $$ \pi_n f(x+h) - \pi_n f(x) = D_n f(x)h + E_n(h) $$ where $E_n(h) = o(h)$. And therefore $$ f(x+h) - f(x) = (D_n f(x)h + E_n(h))_n = (D_n f(x))_n h + (E_n(h))_n$$ Therefore a sufficient set of conditions is that $Df = (D_nf(x))_n$ is a bounded linear operator if $\sum_{n=1}^{\infty} \| D_nf\|^2 < \infty$, and that we have an error that is $o(h)$, which is satisfied if $\sum_{n=1}^{\infty} \| E_n(h)\|^2 / \|h\|^2 \rightarrow 0$ as $\|h\| \rightarrow 0$.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "calculus, analysis, functional analysis" }
Inequality : $\sum_{cyc}\left(\frac{a^3+1}{a^2+1}\right)^4 \geq \frac{1}{27}\left(\sum_{cyc}\sqrt{ab}\right)^4$ > Let $\\{a, b, c\\} \subset \mathbb{R}^+$, where $a+b+c=3$. Prove that: $$\left(\frac{a^3+1}{a^2+1}\right)^4 \+ \left(\frac{b^3+1}{b^2+1}\right)^4 \+ \left(\frac{c^3+1}{c^2+1}\right)^4 \geq \frac{1}{27}\left(\sqrt{ab}+\sqrt{bc}+\sqrt{ca}\right)^4.$$ My attempt : $a+b+c=3$, so $3 \geq \sqrt{ab}+\sqrt{bc}+\sqrt{ca}$ By Holder Inequality, $\left(\displaystyle\sum_{cyc}\left(\frac{a^3+1}{a^2+1}\right)^4\right)(\displaystyle\sum_{cyc}1)(\displaystyle\sum_{cyc}1) (\displaystyle\sum_{cyc}1) \geq \left(\displaystyle\sum_{cyc}\frac{a^3+1}{a^2+1}\right)^4$ $27\displaystyle\sum_{cyc}\left(\frac{a^3+1}{a^2+1}\right)^4 \geq \left(\displaystyle\sum_{cyc}\frac{a^3+1}{a^2+1}\right)^4$ We have to show that $\displaystyle\sum_{cyc}\frac{a^3+1}{a^2+1}\geq \displaystyle\sum_{cyc}\sqrt{ab}$
Since $$ab+ac+bc\leq\frac{1}{3}(a+b+c)^2=3,$$ it's enough to prove that $$\sum_{cyc}\frac{a^3+1}{a^2+1}\geq3$$ or $$\sum_{cyc}\left(\frac{a^3+1}{a^2+1}-1\right)\geq0$$ or $$\sum_{cyc}\frac{a^2(a-1)}{a^2+1}\geq0$$ or $$\sum_{cyc}\left(\frac{a^2(a-1)}{a^2+1}-\frac{1}{2}(a-1)\right)\geq0$$ or $$\sum_{cyc}\frac{(a-1)^2(a+1)}{a^2+1}\geq0.$$ Done!
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "inequality, holder inequality, tangent line method" }