INSTRUCTION
stringlengths
25
999
RESPONSE
stringlengths
0
999
SOURCE
stringlengths
16
38
METADATA
dict
Get two values from the same column in the same query I want to know how to get 2 different values from the same column in the same row. I mean, I have my table friends as shown below. id | source | target 1 1 2 1 1 3 And then I have my users table, with the following values id | name 1 John 2 Will 3 Mark I want to know which users are friends, for example, in the first case it would be John and Will are friends.
What you might be looking for is a double join of the same lookup into a single driver: SELECT src.name AS srcName, tgt.name AS targetName, FROM friends INNER JOIN users AS src ON friends.source=src.id INNER JOIN users AS tgt ON friends.target=tgt.id -- WHERE something?
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, mysql, sql, optimization" }
Add a future date manually to a Pyspark column Need to add a pyspark column with future_date: '9999-12-31' to a pyspark column Tried: .withColumn('valid_to_date', F.to_date(F.lit('9999-12-31'), 'yyyy-MM-dd')) > Error: > > AssertionError: col should be Column
Working Perfectly fine , in my case , Can you share the entire stacktrace d = { 'date_col':['10-Oct-15', '11-Oct-17', '2-Feb-20', '02-Feb-20'] } sparkDF = sql.createDataFrame(pd.DataFrame(d)) sparkDF = sparkDF.withColumn('valid_to_date', F.to_date(F.lit('9999-12-31'), 'yyyy-MM-dd')) sparkDF.show() +---------+-------------+ | date_col|valid_to_date| +---------+-------------+ |10-Oct-15| 9999-12-31| |11-Oct-17| 9999-12-31| | 2-Feb-20| 9999-12-31| |02-Feb-20| 9999-12-31| +---------+-------------+
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "pyspark" }
Check if element in for each loop is empty I am building a webcrawler right now. I've got this for each loop: for(Element src : images) { System.out.println("Source " + src.attr("abs:src")); } How do I make my program print out that there is no image if there is no element src in images?
Based on the fact that your `images` is a available `ArrayList<>`, you should do like this: if(images.size() > 0){ for (Element src : images){ if (src != null) { System.out.println("Source " + src.attr("abs:src")); } } } else { System.out.println("There are no elements in ArrayList<> images"); } First you check if there are elements in the ArrayList. If there are no Elements insite, print it out. if there are elements, you go through the foreach loop and check each elements if it is not null.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -5, "tags": "java, web crawler" }
How to redirect utf-8 output into txt file I ran a python script to write my log files using: nohup python my_script.py >> log.txt However, I thought maybe it is `>>` in Linux which doesn't support the Chinese characters encoded in `utf-8`. !enter image description here In my script I used `print` to show the `utf-8` characters and it works well in the python shell. So I want to know how can I write the `utf-8` characters to log files correctly? Thanks.
I've found the solution. Just add one line in head of the python script: # -*- coding: UTF-8 -*- For example, a simple script named utf8.py: # -*- coding: UTF-8 -*- if __name__ == '__main__': s = u'' print s.encode('utf-8') Then redirect the `print` to a txt file: [zfz@server tmp]$ python utf8.py >> utf8.txt [zfz@server tmp]$ cat utf8.txt The Chinese characters can be output to the txt file correctly.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 1, "tags": "python, shell, utf 8, stdout, nohup" }
Pycharm manage.py custom commands I'm using PyCharm 2.7.2, which is the latest version to date. In my settings file for a django project, I used the following lines to configure my `INSTALLED_APPS` setting variable. DJANGO_APPS = ( .... ) THIRD_PARTY_APPS = ( 'south', ) LOCAL_APPS = ( 'blog', ) INSTALLED_APPS = DJANGO_APPS + THIRD_PART_APPS + LOCAL_APPS Now, south's features do not show up on `manage.py`. How do I run a custom `manage.py` command to get things working?
PyCharm doesn't understand concatenation for `INSTALLED_APPS`, there is an issue logged about it: * PY-8413 PyCharm settings.py parser should understand concatenation in INSTALLED_APPS initialization
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "django, pycharm" }
Probability density of a sum of exponentially distibuted variables The $X_1, X_2, \dots\ X_n$ are identical independently distributed random variables. $X_i \sim \lambda e^{-\lambda x}$. Find pdf of their sum.
Let X be exponential distributed, i.e. $X \sim {\rm Exponential}(b)$ $$f_X(x) = be^{-bx} \qquad x,b > 0$$ Let $Y$ be Gamma distributed, i.e. $Y \sim {\rm Gamma}(a,b)$ $$f_Y(y) = \frac{b^a y^{a-1} e^{-by}}{\Gamma(a)} \qquad a,b,y>0$$ Note that for $a = 1$, the Gamma distribution $f_Y(y)$ coincides with exponential $f_X(x)$. Let $Z = X+Y$. The PDF is $$\begin{align*} f_Z(z) &= \int_{y=0}^z f_Y(y) f_X(z-y) \, dy = \int_{y=0}^z \frac{b^{a+1} y^{a-1} e^{-by} e^{-b(z-y)}}{\Gamma(a)} \, dy \\\ &= \frac{b^{a+1} e^{-bz}}{\Gamma(a)} \int_{y=0}^z y^{a-1} \, dy = \frac{b^{a+1} z^a e^{-bz}}{\Gamma(a+1)}. \end{align*}$$ Therefore, the sum $Z$ is gamma distributed with new parameter $a+1$ instead of $a$. Finally, doing this by induction $n$ times, the sum of $n$ exponential variables with common rate parameter $\lambda$ is gamma with parameter $a = n$, and rate parameter $b = \lambda$.
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "probability distributions" }
Using models in React and React native **Context** Lately, during the development of a personal app there was a misunderstanding between the backend developer and myself. This misunderstanding led to a small change in the API for which the app was not prepared to handle (a field was removed from an object response data) and consequently led to crashes when the related component was mounted. **Possible solution** After that I realized that just by adding a model which could just provide the basic values that the app needs to work, just a basic class implementation of the request (let's say a book data i.e.), could have leveraged the impact of the issue. **Actual question** As I've seen few information about the topic I would like to ask the react / react native community if this approach is anti-pattern in some way or it is actually a valid solution.
You can just use `propTypes` or `defaultProps` to catch and handle this issue from the component level. As far as in general having a client validate the response data from an API, I think the way you want to use it could be an anti-pattern in that a client should not be used to test/assert what that response data ought to be. In your specific situation, perhaps a better solution is to **_maintain the test cases for the API_**. This will let you officially communicate to your backend developer what your expectations are, and avoid these problems in the future.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "javascript, reactjs, react native, model, redux" }
Pandas: Sort by sum of 2 columns I have a DataFrame: COL1 COL2 1 1 3 1 1 3 I need to sort by COL1 + COL2. _key=lambda col: f(col)_ argument-function of _sort_values(...)_ lets you sort by a changed column but in the described case I need to sort on the basis of 2 columns. So, it would be nice if there were an opportunity to provide a _key_ argument-function for 2 or more columns but I don't know whether such a one exists. So, how can I sort its rows by sum COL1 + COL2? Thank you for your time!
This does the trick: data = {"Column 1": [1, 3, 1], "Column 2": [1, 2, 3]} df = pd.DataFrame(data) sorted_indices = (df["Column 1"] + df["Column 2"]).sort_values().index df.loc[sorted_indices, :] I just created a series that has the sum of both the columns, sorted it, got the sorted indices, and printed those indices out for the dataframe. _(I changed the data a little so you can see the sorting in action. Using the data you provided, you wouldn't have been able to see the sorted data as it would have been the same as the original one.)_
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "python, pandas, sorting" }
Cut out parts of the cone in java3d I want to cut out top of the Primitive Cone in java3d and i want to get rid of the bottom part so I can have a lamp cover that looks something like this: < How can I do this? Thanks, Eugene.
You _could_ try and do some boolen shape operations on the cone but I'm not sure it would be easier than just creating a new shape by defining two rings of vertices and connect them to form triangles. Accessing and modifying the default cone shape might be harder than it seems, but I'm not sure about this. I never tried because creating my own shapes directly was easier :) There's some math involved to calculate the positions of the vertices but I guess that's what your homework is really about. It's actually not that hard with a bit of sine/cosine usage and you'd most probably get some easier to read and understand code as well as potentially better visual results.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "java, graphics, java 3d" }
modify scrum template in TFS 2010 after project is created I have created a new team project using sfts v3.0 project template. Later I have realized that we need to customize scrum template (add some new status). How can I upgrade the scrum template once team project has been created. Can I modify the template and overwrite files to location where it is on TFS 2010 server? The new project I have created is entirely blank and I am running migration tool to migrate source code from tfs 2008 to tfs 2010 and I don't want to interrupt that process.
Use the _Process Editor_ of the TFS Power Tools. Here's a guide how to use it.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "tfs, scrum, tfs to tfs migration tool" }
How to disable momentum in specific layer in tensorflow? I have a neural network with three hidden layers, which can be trained with "pure" gradient descent or with some more sophisticated techniques. I also noticed that in the my problem momentum-based optimization methods (adam, adadelta, momentum) works much better. Now to the interesting part. By design, I want to disable momentum in the first layer of the NN. That means, I want to update weights with Adam in second and third layers, but use simple gradient descent in first layer. Of course, I can always write my own optimizer: calculate gradients with `tf.gradients(loss, tf.trainable_variables())` and then just do the momentum trick myself. But it would be nice to have option to use special optimizer parameters in every layer. Have anybody heard about the way to do such thing?
Well, you can provide the list of variables to optimize to the optimizer (docs): opt = tf.train.AdamOptimizer() opt_op = opt.minimize(loss, var_list=[W1, b1]) opt2 = tf.train.GradientDescentOptimizer(learning_rate) opt2_op = opt2.minimize(loss, var_list=[W2, b2]) You will have to extract the variable list (probably weights and biases) of a given layer yourself.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "machine learning, tensorflow, gradient descent" }
ImageView padding above and below image I am trying to set the image of an ImageView from a byte array like this: Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.length); ImageView imageView = (ImageView)findViewById(R.id.imageView); imageView.setImageBitmap(bitmap); But the image appears to have some quite large black padding at the top and the bottom, even though the actual image data does not have these. The ImageView is at the top of a LinearLayout inside a ScrollView, any ideas? My ImageView is designed like this: <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView"/>
Solved, I added android:adjustViewBounds="true" Into the XML file.
stackexchange-stackoverflow
{ "answer_score": 4, "question_score": 2, "tags": "java, android, image, imageview" }
How to split a vector into factors for box plot? I have a dataset set of earnings. I want to display a boxplot of earnings depending on race. The race is split into numbers from 0 to 10. 0 to 3 is white, 4 to 5 is black, 6 to 10 is mixed. How can I show a boxplot of earnings depending on race? I tried splitting it into factors, and I have 3 factors now using: white <- factor(Race < 4) black <- factor(Race>4 & Race<6) mixed <- factor(Race>6) But the box plot doesn't work with that.
You can do this with `cut` Race = 0:10 R2 = factor(cut(Race, breaks=c(0,3,5,10), include.lowest=TRUE), labels=c("White", "Black", "Mixed")) R2 [1] White White White White Black Black Mixed Mixed Mixed Mixed Mixed Levels: White Black Mixed
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "r" }
Magento Cron Issues Basically I have a plugin that needs to remind a user about a quote they created 2 days after they create it. The plugin company says its a cron problem why it isn't working and has left it at that. I installed AOE Scheduler which says there is No Heartbeat at the top. Can anyone advise how I can sort out my crons so I don't get this error and hopefully get this plugin working?
If you are not getting a heart beat with AOE scheduler it seems your cron is not properly setup. You will need to setup cron on the server with something like the following: * * * * * /bin/sh /path/to/your/site/cron.sh Once you have your "Heartbeat" you will see your cron items working
stackexchange-magento
{ "answer_score": 1, "question_score": 1, "tags": "magento 1.9, cron" }
Returning a value. The output always print 0 i'm learning how to return a value and try to write the following code; public class JustTryingReturn { static int a, b; static Scanner sc = new Scanner(System.in); static int nganu() { return a+b; } public static void main(String[] args) { int c = nganu(); System.out.println("Enter number "); a = sc.nextInt(); b = sc.nextInt(); System.out.println(c); } } But the output always print 0 instead of `a+b`. What did i do wrong? Thank you.
You should make the call int c = nganu(); after you assign the input values of `a` and `b`. Otherwise they'll still contain `0` by default when you compute their sum. System.out.println("Enter number "); a = sc.nextInt(); b = sc.nextInt(); int c = nganu(); System.out.println(c);
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "java, return" }
List reshape Python Is there a way to reshape a list ? Just like with an array, my problem is the following: I'd like to have my list L (see below) to have a shape (6,) is there a formula to achieve it ? (I have a similar problem with a code where I need to append several times and at the end I get a list shape (1,1,..,23) and I want to get (23,). `import numpy as np` `L = [[1,2,3,4,5,6]]` `L1 = [1,2,3,4,5,6]` `print(np.shape(L))` `print(np.shape(L1))` The output is : ` (1,6)` and `(6,) `
I think you are looking for the `numpy.ndarray.flatten()` equivalent for python lists. As far as I know, there does not exist such functionality out of the box. However, is easily done with list expressions: L1 = [item for sublist in L for item in sublist] If you can use numpy (as your example suggest), the most straight-forward solution is to apply the flatten method on your arrays: L = [[1,2,3,4,5,6]] L = np.array(L) L1 = L.flatten() Note that you then switch to numpy arrays.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "python, arrays, list" }
Notepad++.Find something in find results Its a simple question.Once I perform a search in notepad++ .Is there any posibility to search something in the result of the fisrt search? Edit. Sometimes i have to do some reports about logs and i have to find some information.In most of the cases i can manage easyly by using regexp but in some cases i have to search manually.
**Yes there is** , using **Mark** window and **Search** > **Bookmark** menu, although it is limited to lines. 1. From menu, use **Search** > **Mark...** function. 2. In Mark dialog, check **Mark Line** and perform your search. * You can perform more than one search and results add together (if **Purge** is unchecked). 3. From menu, use **Search** > **Bookmark** > **Copy bookmarked lines**. * If you want negative selection, use **Inverse bookmarks** (from the same menu) before. 4. Open new Notepad++ document and **Paste**. Here you can search in search results. Alternative way is to always work with the same document and use **Remove unmarked lines** or **Remove bookmarked lines** to throw away lines you do not need (then repeat searching).
stackexchange-superuser
{ "answer_score": 2, "question_score": 2, "tags": "notepad++" }
Mathematica ColorFunctionScaling I have a `ListDensityPlot` of a temperature in a can in Mathematica. I am animating its development over time, but the `ColorFunction` always sets the highest temperature of the current step to correspond to Red. I want my max temperature overall to correspond to red, how do I do that (I assume it's got something to do with `ColorFunctionScaling`)? Here's my code Animate[ListDensityPlot[Dev[[m, All, All]], ColorFunction -> (ColorData["TemperatureMap"])], {m, 1, t, 1}, AnimationRunning -> False]
Set `ColorFunctionScaling -> False` and manually scale the color function, using something like ColorFunction -> (ColorData["TemperatureMap"][Rescale[#, {min, max}, {0,1}]&) where `min` and `max` are the overall minimum and maximum (probably `Through[{Min,Max}[Dev]]`.)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 5, "tags": "colors, wolfram mathematica, plot" }
Negotiation for onboarding a new engineer I am currently working as a sole contributor from offshore. There are 4 more team members on-site. My employer is impressed with my work and wants to add more engineers like me. He wants to increase the offshore team size. If we get a new engineer then I would have to spend considerable amount of time beyond my work hours to train the new guy. I have learnt current work the hard way and no one has spoon fed me. My salary negotiation would be coming for discussion in the next few months. Is it possible that I can negotiate something in return for onboarding a new engineer?
Why would you spend "considerable amount of time beyond your work hours" to train the new guy? Just ask your boss how many _working_ hours you should spend training the new guy, and do as he says. Training new team members is also work. The company trains new people because they hope to gain from it, it is not a leisure activity done after work hours. Naturally, that comes at a cost, the cost being the current team member's time, which the company should be willing to bear.
stackexchange-workplace
{ "answer_score": 16, "question_score": 2, "tags": "management, salary, negotiation, training" }
Cannot open DefaultTest.dll for unit test When I try to run my unit test in VS 2012 I get the following error: 1>------ Build started: Project: Tests, Configuration: Debug Win32 ------ 1>LINK : fatal error LNK1104: cannot open file 'C:\Users\Patryk\Documents\Visual Studio 2012\Projects\LUT\Debug\DefaultTest.dll' ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ========== It works again, when I restart VS but then I get the same error after I have to rebuild the project
I get this error if the testing engine is still running in background. Check if the `vstest.executionengine.x86.exe` process is still running in background, and kill it if so. Afterwards you can rebuild and run your tests.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++" }
Unity InjectionFactory and Interceptors I'm trying to use an exception interceptor along with an injectionfactory like this: container.RegisterType<IProcessorService>( new HierarchicalLifetimeManager(), new InjectionFactory(c => processorFactory.CreateChannel()), new Interceptor<InterfaceInterceptor>(), new InterceptionBehavior<AppExceptionInterceptor>()); Only problem is the interceptor is not working. The injection factory works but not the interceptor. For other types when I do interceptors without using an injection factory everything is fine and works. Any ideas? Cheers for any wisdom!!
Forgot to add the interception extension to the container! container.AddNewExtension<Interception>();
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, inversion of control, unity container, aop, ioc container" }
PyQt setup for Qt 4.7.4 I try to install PyQt to develop Python apps using Qt. I downloaded SIP and PyQt4 from < and compiled the packages. But I encountered a problem while compiling PyQt4: I ran python configure.py in the Terminal and I got: Error: Make sure you have a working Qt v4 qmake on your PATH or use the -q argument to explicitly specify a working Qt v4 qmake. I looked in Qt settings and i saw the path for qmake defined here 'home/user/.QtSDK/Simulator/Qt/gcc/bin/qmake'. Where else should be this path set up? And how can i configure qt so i can write code directly into Qt Creator and execute it from there like any other c++ file for example. I installed Qt from the Nokia website and it was installed in /home/user/.QtSDK folder. Thanks.
The error message says that the PyQt installer cannot find the qmake executable. Running these two commands should solve it: PATH=$PATH:~/.QtSDK/Simulator/Qt/gcc/bin/ export PATH Afterwards, resume your installation.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 6, "tags": "python, qt, compilation, pyqt, configure" }
Applet lifecycle when out of focus Does a Java Applet always execute its code even when it losts focus? I've to put this applet in a web page. I'm tryng to understand this cause i've to develop an applet that listen to some hardware components through JavaPos. I have a callback method defined inside the applet and i'm not sure if it works even when users click on other page component. Thanks
> Does a Java Applet always execute its code even when it losts focus? Yes, unless of course the applet code intentionally stops execution on loss of focus.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "java, applet, japplet, javapos" }
SwiftUI onChange() event doesn't work on TabView when swiping I would like to change the value of a text when the active tab of a TabView changes. I tried using `onChange(of: activeTab, perform: {})` to change the value of the state variable that stores the text but it seems that the closure given to `onChange()` is never called. TabView(selection: $activeTab) { ForEach(exampleData) {dayMenu in DayMenuView(dayMenu: dayMenu) .padding([.leading, .bottom, .trailing]) } } .onChange(of: activeTab, perform: { index in print(activeTab) withAnimation { activeDate = dates[1] } }) Text view Text(activeDate) State variables let dates = ["Montag", "Dienstag"] @State private var activeTab: Int = 0 @State private var activeDate = "Montag"
Provided code is not testable but I think it is because `activeTab` is not changed because tab views are not identified, due to tag, so try TabView(selection: $activeTab) { ForEach(exampleData.indices, id: \.self) { index in DayMenuView(dayMenu: exampleData[index]) .padding([.leading, .bottom, .trailing]) .tag(index) } } .onChange(of: activeTab, perform: { index in
stackexchange-stackoverflow
{ "answer_score": 12, "question_score": 6, "tags": "swiftui, swiftui tabview" }
Norming functionals for vectors in intersections Suppose that $(X, \|\cdot\|_X)$, $(Y, \|\cdot\|_Y)$ are two Banach spaces such that $X\subset Y$ and $\|x\|_Y\leq \|x\|_X$ for all $x\in X$ and $X$ is dense in $(Y, \|\cdot\|_Y)$. Every functional $y^*\in Y^*$ also yields a functional $y^*|_X\in X^*$ with $\|y^*|_X\|_{X^*}\leq \|y^*\|_{Y^*}$. Suppose that $(y^*_n)_{n=1}^\infty$ is a sequence in $Y^*$ such that $\lim_n \|y^*_n\|_{Y^*}=\infty$ and $\|y^*_n|_X\|_{X^*}=1$ for all $n$. Can we find a sequence $(x_n)_{n=1}^\infty\subset B_X$ such that $\inf_n |y^*_n(x_n)|>0$ and $\lim_n \|x_n\|_Y=0$? If the answer is no in general, is it true if $A\subset B$ are subsets of $c_{00}$ (the finitely non-zero scalars sequences), $$\|x\|_X=\sup\\{|\langle f,x\rangle|: f\in B\\}$$ and $$\|y\|_Y=\sup \\{|\langle f,y\rangle|: f\in A\\},$$ and $X,Y$ are the completions of $c_{00}$ with respect to these norms?
Let $X=\ell^1$, $Y=\ell^2$. Take $y_n^*=(1,1/n,1/n,\dots,1/n,0,0,\dots)$ with $\frac 1n$ repeated $n^3$ times. Looks like we are fried, or am I missing something in the setup?
stackexchange-mathoverflow_net_7z
{ "answer_score": 1, "question_score": 2, "tags": "fa.functional analysis, banach spaces" }
The chain rule in the case of a product of multivariate function and a function of one variable Given is $F(x(p),y(p),z(p),t)=A(x(p),y(p),z(p))B(t)$ Is it correct to write $\frac{dF}{dp}=[\frac{\partial A}{\partial x}\frac{dx}{dp}+\frac{\partial A}{\partial y}\frac{dy}{dp}+\frac{\partial A}{\partial z}\frac{dz}{dp}]B(t)$ Is it correct to also write $\frac{\partial F}{\partial t}=A(x(p),y(p),z(p))\frac{dB}{dt}$ I was reading about the chain rule on Wikipedia and others but couldn't find a case with a similar product of functions. EDIT: Also given is $B(t)=\frac{dp}{dt}$, thus $p$ depends on $t$, as shown by Fimpellizieri (see below)
If $p$ and $t$ are independent, meaning $\frac{d}{dt}p=\frac{d}{dp}t=0$, then yes, both are correct. EDIT: If $p$ depends on $t$ via $\frac{d}{dt}p=B$, as indicated in the comments, then the chain rule (together with the product rule) for the second expression yields $$\frac{\partial}{\partial t}F =\left(\frac{\partial }{\partial t}A\right)B+A\left(\frac{d }{d t}B\right)\\\ =\left(\frac{\partial A}{\partial x}\frac{dx}{dp}\frac{dp}{dt} +\frac{\partial A}{\partial y}\frac{dy}{dp}\frac{dp}{dt} +\frac{\partial A}{\partial z}\frac{dz}{dp}\frac{dp}{dt}\right)B+A\cdot B'\\\ =\left(\frac{\partial A}{\partial x}\frac{dx}{dp} +\frac{\partial A}{\partial y}\frac{dy}{dp} +\frac{\partial A}{\partial z}\frac{dz}{dp}\right)B^2+A\cdot B'$$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "multivariable calculus, derivatives, chain rule" }
colorMultiply not working on custom icons [SwiftUI] When using colorMultiply on XCode's default icons, it seems to work fine but when using it on custom icons, it doesn't. Is there a workaround for this that works like Android Studio's **tint** property which caters for all images/icons? Image(systemName: "magnifyingglass").colorMultiply(.red) //magnifyingglass is default provided XCode icon works but Image("my_icon").colorMultiply(.red) isn't working. My icons are png format.
For those who come across this, `Image("my_icon").colorMultiply(.red)` only works with white images - at least in my case. I was using black icons and colorMultiply wouldn't work but when i switched to white ones, it worked just fine.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "ios, swift, swiftui" }
WPF Deployment Issue I have created a WPF application and deployed it to a location on my PC. I have installed it fine but when I open the applicaiton link I keep getting an error message saying the `application has stopped working`. I am running this on the same PC that I created the application on. Sorry if this is a silly and really easy fix but I am new to deploying applications so may have missed something out. thank you
It`s usually a good idea to catch such unhandled exceptions and show some notification to user. To do so in WPF app you can add event handlers to `DispatcherUnhandledException` and `AppDomain.CurrentDomain.UnhandledException` in App class constructor. This will allow you to show exception details in MessageBox or log them by any other means.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "wpf" }
Check Constraint- Check password contains atleast one number/special Character/uppercase I'm looking to create three separate check constraints for my SQL Server database to ensure that a password field constrains a minimum of one number, one uppercase character and one special character. I consider the best way to approach is by creating separate check constrains for example I have created the following constraint to ensure that password length is a minimum of 8 `(len([password]) <= (8))` Could any one suggest a way to establish the required validation. Thanks
You can do this with one constraint, something like: check password like '%[0-9]%' and password like '%[A-Z]%' and password like '%[!@#$%a^&*()-_+=.,;:'"`~]%' and len(password) >= 8 Just a note about the upper case comparison: this requires that the collation being used be case sensitive. You may need to specify an explicit `COLLATE` in the comparison to be sure that it is case sensitive.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "sql, sql server, check constraint" }
How to iterate over edit text fields in matlab GUI? In my GUI I have quite some edit fields with the names edit1, edit2, ..., editn. I try to access them in a loop. I tried following: for i=1:n pos = sprintf('edit%', i); content = get(handles.(pos), 'String'); with the following error message: Reference to non-existent field 'pos' Ideas? Anyone?
Change pos = sprintf('edit%', i) to pos = sprintf('edit%d', i) That specifies `i` should be formatted as an integer when building the string.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "matlab, matlab guide" }
Usage of 'is' and 'are' I've just finished watching an episode of an american tv series. At the end of the episode, the narrator said, 'there **is** only two episodes left'. My question is: because _two episodes_ is plural and countable, oughtn't it be 'there **are** only two episodes left'? I find this a bit of confusing, maybe because english isn't my first language, but until now, I thought that the language rules regarding this case aren't that complicated... Thanks!
Did they say "there is" or "there's"? The correct language would be "there are only two...". However, when this is said with a contraction, many speakers feel that "there're" (for "there are") sounds awkward, and instead say "there's" which is improper but sounds right. You can almost think of "there's" being a contraction for "there are".
stackexchange-english
{ "answer_score": 0, "question_score": 0, "tags": "grammaticality, grammatical number" }
How to make asynchronous function calls in shell scripts I have a collection of curl commands to be executed by a shell script. Now what i want is all these commands have to be executed at a regular interval of time ( which is different for every curl url ) so what i want to do is make asynchronous calls to `wait [sec]` command and execute different functions for different wait periods like start 5 timers one for 120s, 2 for 30s, 3 for 3000s etc. and then as soon as they get completed i want to trigger the execution of the handler function attached to every timeout. I can do this in javascript and nodejs easily as they are event driven programming language. But i have little knowledge about shell scripting. So, how else can i implement this or hotto make such asynchronous calls in the shell script? I dont know if i am clear enough, what other details should i mention if i am not?
Something to experiment with: delayed_ajax() { local url=$1 local callback=$2 local seconds=$3 sleep $seconds curl -s "$url" | "$callback" } my_handler() { # Read from stdin and do something. # E.g. just append to a file: cat >> /tmp/some_file.txt } for delay in 120 30 30 3000 3000; do delayed_ajax my_handler $delay & done
stackexchange-stackoverflow
{ "answer_score": 7, "question_score": 5, "tags": "bash, shell, curl, asynchronous" }
Trocar "Web Browser" vb.net Estou querendo alterar o navegador padrão do visual studio, gostaria de utilizar outro para rodar alguns scripts que estão com problemas no internet explorer. Gostaria de sugestões e exemplos de como fazer isso. Desde já, agradeço.
Você tem algumas opções, uma delas é o que o Rovann citou, pelo que pesquisei vale a pena fazer um teste no Gecko, é baseado no Mozilla. Colocarei um code sample em C# (para vb.net você nao terá dificuldades para converter) CefSharp Dotnetbrowser (pago) GeckoFX GeckoWebBrowser browser; public Form1() { InitializeComponent(); var app_dir = Path.GetDirectoryName(Application.ExecutablePath); Gecko.Xpcom.Initialize(Path.Combine(app_dir, "xulrunner")); browser = new GeckoWebBrowser(); browser.Dock = DockStyle.Fill; this.browser.Name = "browser"; this.Controls.Add(browser); }
stackexchange-pt_stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c#, .net, winforms, vb.net" }
Scilab - How to plot numbers v string Say I have been tracking my weight each month (on and off for a couple of years), and I want to plot the data, such that: * the x-axis represents the time. e.g. Jun 2015, Jul 2015, Aug 2015, Sept 2015. * the y-axis represents the weights. e.g. 75.4, 75.1, 72.6, 71.6 I thought this could be achieved by simply writing: x = ["Jun 2015", "Jul 2015", "Aug 2015", "Sept 2015"]; y = [75.4, 75.1, 72.6, 71.6]; plot(x,y); But this produces an error. How can I approach this? And on a related note: How can I have a break in the x-axis? Say that I did not weigh myself on some months, and so I want a break in the x-axis to indicate that.
You can use the axes entities to do that: n=size(y,"*"); plot(1:n,y) ax=gca(); x_ticks=ax.x_ticks; x_ticks.locations=1:n; x_ticks.labels=x; ax.x_ticks=x_ticks;
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "plot, scilab" }
How to get a property of a DynamicResource in XAML? I have a `Brush` defined in a code file and I am able to reference it using the `DynamicResource` extention in XAML at runtime. What I would like to do is to grab the `Brush.Color` and bind it to an element. I've tried the approach bellow, <SolidColorBrush Color="{DynamicResource ButtonHoverTopBrush.Color}" Opacity="0" /> but it doesn't work. How grab that `Color`?
Try this: <SolidColorBrush Color="{Binding Color, Source={StaticResource ButtonHoverTopBrush}}" Opacity="0" /> It doesn't work with `DynamicResource` instead of `StaticResource` but if you change the `Color` of `ButtonHoverTopBrush` dynamically, it will affect the above brush. You cannot replace the `Brush` itself though.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 2, "tags": "wpf, xaml, data binding" }
iPhone SDK reload UIView's content I have two views, one view takes the whole screen, the second view covers only a little portion. What I want is for that second view to be on the first view (which I already have done), but the problem is, when I set values (in this case UILabel's) the label on the screen doesn't display that new value. I know for a fact the method gets called, but for some reason it won't change the label's value. Edit: Here's the code: -(void)loadHighScores { [no1 setText:@"test"]; NSLog(@"it works"); } And here's how I call it: highscore = [[HighScore alloc] init]; [highscore loadHighScores];
Have you tried: [myView setNeedsDisplay]; Quote from Apple docs: > By default, geometry changes to a view automatically redisplays the view without needing to invoke the drawRect: method. Therefore, you need to request that a view redraw only when the data or state used for drawing a view changes. In this case, send the view the setNeedsDisplay message. Any UIView objects marked as needing display are automatically redisplayed when the application returns to the run loop.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 1, "tags": "iphone, uiview, refresh, uilabel" }
How do I add a page using Page Title under 'Default Selection' which contains commas in Data Studio? I have a Data Studio filter set up for different blog posts that are predefined by using 'Page Title' as the dimension and then under Default Section adding the page title for each blog. I have one page title that uses commas in the title, however the list is separated using commas. I've tried using adding quotation marks (") with no joy. Are there any workarounds to this? Thanks!
Regarding the default selection of the Filter Control \- It can be achieved by adding the escape sequence `\` before the comma; for example, to capture the text: A,B,C `\` would be added before each comma thus: A\,B\,C Google Data Studio Report and a GIF to elaborate: ![](
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "google data studio" }
How to create an "informative" preference I have created a PreferenceActivity. Some of the preferences are pure informative. I want them to be a bit grayed out so it will be clear that clicking on them should not do anything. How do i do that?
You could try to set its enabled attribute to false <Preference android:enabled="false" ... />
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": 3, "tags": "android, android layout, android preferences" }
PowerShell script in SharePoint 2010 works via Management Shell but it doesn't work via C# code. What are possible reasons? I'm trying to get some logs from the SP folder and to write them into another folder on the same machine. So this script works via management shell but if I try to run the same operation on the sharepoint portal's page with most powerfull rights doing it in my code like this: using (WindowsIdentity.Impersonate(System.IntPtr.Zero)) { WindowsIdentity.Impersonate(WindowsIdentity.GetCurrent().Token); SPSecurity.RunWithElevatedPrivileges( delegate() { //PowerShell runs here } } and it doesn't work. In SharePoint I have rights as Farm Admin. Maybe PowerShell needs some services I have to switch on in CA or what it could be, then?
if you execute this code in sharepoint, sharepoint will use the application pool account to execute it and that account must not have all rights. Please check that at first. If it doesn't help, you maybe have to add the application pool account as shell admin: Add-SPShellAdmin -username apppoolaccount if that also doesn't help, try to disable UAC.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "c#, sharepoint, powershell" }
An issue with javascript syntax comprehension Could someone please explain to me this statement in Javascript : var keyCode = window.event ? window.event.keyCode : e.which; Any help greatly appreciated !
var Keycode = window.event? window.event.keyCode : e.which var Keycode; if(window.event) Keycode = window.event.keyCode; else Keycode = e.which;
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": -1, "tags": "javascript, keyboard" }
Inline css attched to component Angular 4 I am facing a weird issue with angular 4, that what happened on local everything is working fine but after deployment to development server a dynamic css is going to attached with the component. <app-language-results _ngcontent-c2 style="display: none;" _nghost-c4 class="ng-tns-c4-8 ng-tns-c2-1" ng-reflect-search-results="[object Object],[object Object">…</app-language-results> ---- Some CODE---- </app-language-results> So guys, If can give some suggestion it will be very helpful. Thanks
It's Fixed. That was because of NPM issue. On my development server, There was NPM 5.4 version & on my local NPM 5.3 version.
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": -1, "tags": "angular" }
What does Travis Bickle mean when he says 'I need to get organizized' In Taxi Driver In the movie **_Taxi Driver_** there is this scene where Travis Buckle invites Betsy into a coffee shop and they start talking. What does he really mean by "organizized, Its a joke" ?
From Quora > It refers to a novelty poster that was popular in the late 1970s at the time the film was made. It's the kind of gag gift that a white-collar worker might hang in his or her cubicle. When he mentions the phrase on his date with Betsy, it suggests that the working-class Travis Bickle has white-collar aspirations, but he doesn't have the intellectual or economic wherewithal to carry them out. You can see the poster in a still from the film below. ![enter image description here]( You can buy them online ![enter image description here](
stackexchange-movies
{ "answer_score": 3, "question_score": 1, "tags": "plot explanation, taxi driver" }
Residue fields of $\mathrm{Spec} \ \mathbf{Z}[T]$. Let $f\in\mathbf{Z}[T]$ be an irreducible polynomial, and $p=(f)$. The residue field $k(p)$ at $p$ is the fraction field of $\mathbf{Z}[T]/(f)$. _Is every algebraic number field equal to some $k(p)$?_ I can't come up with counterexamples, because the number fields I know (such as the cyclotomic fields) are of this form. I think a relevant observation is that a ring of integers cannot always be generated by one element, but I don't think that this yields the answer is no (it might suggest it, though). I do understand, however, that all finite fields are of the form $k(p)$ for some maximal ideal $p$. (I came up with this question while playing around, this is not a homework question or anything.)
If $K/\mathbb{Q}$ is an algebraic number field then by the primitive element theorem there exists some element $\theta\in K$ for which $K=\mathbb{Q}(\theta)$. Let $m(T)$ be the minimal polynomial for $\theta$. Then the fraction field of $\mathbb{Z}[\theta]\cong\mathbb{Z}[T]/(m(T))$ will be $K=\mathbb{Q}(\theta)$.
stackexchange-math
{ "answer_score": 4, "question_score": 2, "tags": "algebraic number theory" }
How to simulate click on menu hardwarebutton with espresso following question: I want to simulate a click on the menu hardwarebutton. Is it possible with espresso to do this (If yes - a code snippet would be nice)?
Espresso.openActionBarOverflowOrOptionsMenu(getActivity().getApplicationContext(‌​));
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "android, android espresso" }
Apache HttpClient 4.3 on Android 4.4 Has anyone gotten Apache HttpClient 4.3 working on Android 4.4? No mater what order I export the apache jars in eclipse the device uses the version of Apache HttpClient that comes with the Android SDK.
There will be an official re-spin of Apache HttpClient 4.3 at some point. In the meantime there is not much one can do about the problem other then repackaging the stock HttpClient with a different namespace.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 5, "tags": "android, apache, httpclient, apache httpclient 4.x" }
See all changes in one place, like GitHub does? _First of all, I am not sure if StackOverflow is the place to ask this (I already considered Programmers StackExchange, but that also seemed a bit off). If this is not the right place, please help me move the question or suggest where I can ask it instead._ If you're using TFS, is there an effective way to do reviews like GitHub offers? In GitHub, you typically submit a pull request. This pull request then lets you see _all the changes_ made in that whole pull request, making it easy for you to review (because you can just keep scrolling down). Can the same be done in Visual Studio with TFS, or do I really have to see the changes for every file that has been changed manually? It just seems crazy.
I'm afraid there isn't a single overview. You do have the code request feature but that still shows a list of files. Instead of using TFVC with Code Reviews, you can also use Git as the version control system. You can then use regular pull requests in the same way you would use GitHub.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "visual studio, tfs" }
32bit ODBC Postgres driver on Windows 2008 R2 x64 I'm trying to install the Postgres ODBC 32bit driver on a Windows 2008 R2 64bit machine. After installing it, with no errors, I go to the ODBC panel, the 32bit version under the /syswow64 folder and try to add the driver, select the Postgres driver from the list but I get an error 126, saying he can't find the driver at the specified path. The problem is that the path he shows me, is the exact path the driver is in, I double checked on the registery (on the HKLM\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ location) and it's fine there too. A couple more people on technet have the same issue too. Did anyone ever run into this? Any ideas would be greatly appreciated. edit: the driver works fine on my win7 x64 test machine, this behaviour only happens on the server.
Well, I figured it out. Leaving the answer here and a couple other places for future generations: The system was missing the "secret" prerequisite of having Visual C++ 2010 Redistributable x86 installed (not the x64, that one it had). Fixed the problem instantly.
stackexchange-serverfault
{ "answer_score": 4, "question_score": 6, "tags": "windows server 2008 r2, postgresql, odbc" }
How to check generated fake dns response message? I am trying to create a fake dns response message from a valid dns query. I have finished the code and created the response message according to RFC 1035 but I am not sure if it would work if I send it to the source. is there any way or tool to check the message my code generates is valid or not?
Update your program to receive DNS queries on UDP port 53 and to send your replies back. You can then use any DNS client to see if your answers are interpreted as desired. An example client is ISC `dig`, which can be run as `dig @127.0.0.1 example.com`. There are many examples on the web that illustrate how to build a simple DNS server; a particularly short one is <
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "c, dns" }
What's the reason for having a large number of guitars? This question is motivated by Is it a good idea to leave my guitar tuned over night?. > I leave all ten of my acoustic guitars tuned all the time I'm a cellist and I just can't imagine having anywhere near ten different cellos. I'm curious. **Why might a guitarist find it helpful to have such a large number of instruments?**
The short answer (gleaned from everyone's helpful contributions): * Guitars come in a wider variety, anatomically, and can produce a wider variety of effects, than cellos * Guitars are cheaper than cellos and pianos * Guitars take up less space than pianos
stackexchange-music
{ "answer_score": 1, "question_score": 12, "tags": "guitar" }
how to use speech-recognition of mac from within python There is this awesome threat, showing how to use the say-command from mac within python: Python Text to Speech in Macintosh Is there anything similar for the speech-recognition? I would like to use the german speech-recognition from mac to get a user-input. Other possible answer for this question would be a speech-recognition within python for german-languages. Best
This would work and the SpeechRecognition package will handle German import speech_recognition as sr r = sr.Recognizer() with sr.Microphone() as source: audio = r.listen(source)
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 5, "tags": "python, macos, terminal, speech recognition" }
when to use while loop rather than for loop I am learning java as well android. Almost everything that we can perform by while loop those things we can do in for loop. I found a simple condition where using while loop is better than for loop if i have to use the value of counter in my program then i think while loop is better than for loop **Using while loop** int counter = 0; while (counter < 10) { //do some task if(some condition){ break; } } useTheCounter(counter); // method which use that value of counter do some other task In this case I found while loop is better than for loop because if i want to achieve the same in for loop i have to assign the value of counter to another variable. **But is there any specific situation when while loop is better than for loop**
One main difference is `while` loops are best suited when you do not know ahead of time the number of iterations that you need to do. When you know this before entering the loop you can use `for` loop.
stackexchange-stackoverflow
{ "answer_score": 22, "question_score": 13, "tags": "java, while loop" }
how to put the fetched values in to variable with comma separation? while working on tags process i got one problem . here i am using preg_match_all method for selecting particular tag. after using that i am getting data like that . here posting the php code and output please check. <?php $comment = $_POST['comment']; preg_match_all("/(@\w+)/", $comment, $matches); echo "<pre>"; print_r($matches); ?> output: <pre>Array ( [0] => Array ( [0] => @name [1] => @variables ) [1] => Array ( [0] => @name [1] => @variables ) ) here i am getting doubt how to convert this array with comma separation. expecting: $tagging = (@name, @variables); any one knows please help me how to solve like that.
$tagging = implode (",", $matches[1]); // '@name,@variables'
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": -1, "tags": "php" }
What is wrong with Korean displaying on the browser? When I display Korean letters on Google Chrome browser on Ubuntu Linux, I see that the fonts are rendered, but the spacing is wrong. It looks like this: !enter image description here A close up: !enter image description here What is wrong, and how can I fix it?
What version of Ubuntu do you have? This is a bug in the font rendering in Debian and Ubuntu. This bug will be fixed in the upcoming Ubuntu 14.04 version of Ubuntu. You can either upgrade to the final beta version or use the command below to update the font. $ wget $ wget $ sudo dpkg -i --auto-deconfigure fonts-wqy-microhei_0.2.0-beta-2_all.deb ttf-wqy-microhei_0.2.0-beta-2_all.deb You can read up on why this is happening in more detail here.
stackexchange-superuser
{ "answer_score": 3, "question_score": 0, "tags": "ubuntu, google chrome, fonts" }
Storing string in session variable where mode is StateServer If I store a string value in my session variable, do I need to serialize or deserialize it? I read that when you use in your `web.config` <sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" stateNetworkTimeOut="60" /> You need to serialize before you can store the value in session variable and you would then deserialize when you retrieve the value. I wonder if for example, you just place the string value to a session like: Session("MyStringVar") = "MyStringValue" and when you retrieve it, you could just do: DIm strVal as String strVal = Ctype(Session("MyStringVar"), String) Also, is the timeout specified for that is 60, is it in minutes or hours? Thanks.
No. the .net runtime will take care of all of that. However, you would need to do your own serialization if you were storing an object that wasn't marked as serializable. Also, The timeout value is in minutes.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "asp.net, session, timeout" }
Need help on calculating path integral Evaluate the folowing path integrals $\int_{c}fds$ and the following are given: $f(x,y,z) = \frac{x+y}{y+z}$ $\quad$ $c(t)=(t,\frac{2}{3}t^{3/2},t)$ I tried and then got stuck at this step. I'm not sure what trick I could use to continue from there. $\int\frac{2t\sqrt{2+t}}{\frac{2}{3}t^{2/3}+t}dt$ = $\int\frac{2\sqrt{2+t}}{\frac{2}{3}\sqrt{t}+1}dt$ =6$\int\frac{\sqrt{2+t}}{2\sqrt{t}+3}dt$ A little hint will be really appreciated.
Since $$c'(t)=\left(t,\,\frac23t^{3/2},\,t\right)\implies \left\|c'(t)\right\|=\sqrt{1+t+1}=\sqrt{t+2}$$ and our integral is $$\int_0^1\frac{t+\frac23t^{3/2}}{\frac23t^{3/2}+t}\cdot\sqrt{t+2}\,dt=\int_0^1\sqrt{t+2}\,dt=\left.\frac23(t+2)^{3/2}\right|_0^1=$$ $$=\frac23\left(3^{3/2}-2^{3/2}\right)=2\sqrt3-\frac{4\sqrt2}3$$
stackexchange-math
{ "answer_score": 0, "question_score": 0, "tags": "calculus, vector analysis" }
Setting displays force close error in texter application How can I set the settings configurations for android application for a text er application. When I run the application, and click on menu in emulator, in the bottom of the screen I get settings tab. When I select that settings tab, I get force close error. What is the problem behind this error. I have added the logcat errors in this link <
The error: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.texter.QUICKTEXT } Have you set up the activity in your manifest file correctly?? Something like this: <activity android:name="quicktext" android:label="@string/app_name" android:configChanges="orientation"> <intent-filter> <action android:name="com.texter.QUICKTEXT" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 1, "tags": "android" }
Save all POST data to database with PHP I register in a software gateway, for each sale it send many data using IPN to my server, and I want to save all of them in database. Is there any quick way to save all POST data in a database without using SQL?
When using SafeMysql abstraction library you need to list your fields only once $allowed = array('title','url','body','rating','term','type'); $data = $db->filterArray($_POST,$allowed); $sql = "INSERT INTO ?n SET ?u"; $db->query($sql,$table,$data);
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "php, mysql, post, insert" }
How to remove null date data in Teradata 16.20 I have a number of rows in which date fields are null. I need to include these rows in my answer set. The only things we've managed to accomplish is to set a "placeholder date" (01-01-1900) and remove them in Excel. I want Teradata NOT to yield "?"; I want the equivalent of ''. Here's an exact example: , CASE WHEN SOA.Performed_date IS NULL THEN '' ELSE SOA.Performed_date END AS Sequence_of_Activities The only code I've gotten to work is: , CASE WHEN SOA.Performed_date IS NULL THEN '0001-01-01' ELSE SOA.Performed_date END AS Sequence_of_Activities Here's a similar working example, equally unsatisfying: , Max(CASE WHEN Care_Activity_Type_ID = 435 THEN PERFORMED_DATE ELSE DATE '0001-01-01' end) Annl_Reassess The error for the first example is: Datatype mismatch in expression.
If you want to return `''` instead of null you must cast the date to a string: coalesce(to_char(Performed_date, 'yyyy-mm-dd'), '') Btw, the `?` representing NULL is a client setting.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "null, teradata" }
Select Features by Polygon - Not Displaying the Shape Drawn I am a relative newbie to QGIS 1.8, have looked through the previous answers, but have found nothing that resolves my issue. I have a number of datazones as polygons on a layer. One of the datazones contains two islands that I need to split. With the layer selected and visible, editing turned on, I choose Select Features by Polygon. I click on a point in the sea around the island, move my mouse to another point, click again, a line appears, repat this until I get to the point where I want to put the last dot and right click. What I understand should happen at this point is that a filled shape should appear, but it doesn't, although the islands become selected. Is this a bug or am I missing something obvious? The same is true of all of the vector layers from other shapefiles. Thanks a lot Andy
if I understand you correctly..... It sounds like you are achieving what you set out to- that is to select the relevant features in your shapefile. Are you needing then to make the selected features into a new shapefile? You do that by selecting the points as described, right clicking the layer in the table of contents and do "Save selection as", you can then add this back into your map, I sometimes have to tell QGIS what CRS the new layer has before it shows in the right place. The select tool wont add anything new in itself, you have to go through the additional steps to generate your clipped shapes.
stackexchange-gis
{ "answer_score": 0, "question_score": 1, "tags": "qgis" }
Facebook Graph Api -- Can I get the "default" fields plus some? When I make a request to < \-- I get a large JSON object with lots of good data in it. However, I want to also get the user's cover photo (if it exists). Is there a way to do this, while also retaining the default fields? For instance: < \-- returns just the cover image. If I use one field, do I need to specify exactly the other fields that I need?
You need to either itemise all the fields you want, or accept the defaults, there's no way to get 'defaults + these other fields'
stackexchange-stackoverflow
{ "answer_score": 8, "question_score": 5, "tags": "facebook graph api" }
A characterization of tempered distributions The Schwartz space on $\mathbb{R}^n$ is the function space $$ S \left(\mathbf{R}^n\right) = \left \\{ f \in C^\infty(\mathbf{R}^n) : \|f\|_{\alpha,\beta} < \infty,\, \forall \alpha, \beta\in\mathbb{Z}_+^n \right \\}, $$ where $\mathbb{Z}_+$ is the set of nonnegative integers, $C^\infty(\mathbb{R}^n)$ is the set of smooth functions from $\mathbb{R}^n$ to $\mathbb{R}$, and $$ \|f\|_{\alpha,\beta}=\sup_{x\in\mathbf{R}^n} \left |x^\alpha D^\beta f(x) \right |. $$ It is said in this note by Hunter we have the following characterization of tempered distributions: ![enter image description here]( * * * By definition, $\varphi_n\to\varphi$ in $S$ if and only if $\|\varphi_n-\varphi\|_{\alpha,\beta}\to 0$ for _every_ pair $(\alpha,\beta)$. Here is my **question** > How does such $d$ in the statement above possibly exist and why would it imply the continuity of the functional $T$ on $S$?
This is a general fact about seminormed spaces. You have a family of seminorms $\|\cdot\|_{\alpha,\beta}$. The sets $U_{\alpha,\beta,r} = \\{\phi : \|\phi\|_{\alpha,\beta}<r\\}$ form a sub-basis of neighborhoods of zero, meaning that their finite intersections yield an basis of such neighborhoods. This is precisely the topology for which the convergence of sequences is described as "$\|\phi_n-\phi\|_{\alpha,\beta}\to 0$ for all $\alpha,\beta$". Suppose $T$ is a continuous linear functional. Then the set $\\{\phi : |T(\phi)|\le 1\\}$ is an open set containing the origin. Therefore, it contains a basis neighborhood: a set of the form $\bigcap_{k=1}^n U_{\alpha_k,\beta_k,r_k}$. By homogeneity, it follows that $$ |T(\phi)| \le \max_{k=1,\dots, n} r_k^{-1} \|\phi\|_{\alpha_k,\beta_k} \tag1$$ The existence of $d$ follows from (1): take the maximum of $|\alpha_k|$, $|\beta_k|$. Conversely,(1) implies the continuity of $T$: this follows directly from the definition.
stackexchange-math
{ "answer_score": 2, "question_score": 1, "tags": "real analysis, functional analysis, distribution theory, topological vector spaces, locally convex spaces" }
React - как получить data-attribute у текущего объекта Мне надо хранить значение "выбран ли элемент" для каждого элемента. Для этого я использую `data-attribute` и вставляю это в jsx в самом элементе. Каким образом можно обратиться к значению `"data-selected"` из `className`? Как обратиться к значению из функции, вызываемой ивентом - я знаю. ![введите сюда описание изображения](
В вашем случае лучше создать компонент для представления региона. В компонент передавать пропсы, например `<Region selected={true} onClick={/** */} />`, а в самом компоненте уже, в зависимости от пропсов, присваивать те или иные классы. const Region = (props) => { return ( <div className={`${styles.option} ${props.selected ? styles.selected : ''}`} ); }
stackexchange-ru_stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "javascript, html, reactjs, jsx" }
Pass the data from Vue instance to the Vue component How can I pass the data from the Vue instance to the Vue component? I'm trying to do 'v-for' on a 'li' that resides in my component template, here's the fiddle HTML <div id="app"> <my-notification></my-notification> </div> <template id="my-template"> <ul> <li v-for="nn in notifications">{{ nn }}</li> </ul> </template> Vue script Vue.component('my-notification',{ template : '#my-template', }); new Vue({ el : '#app', data : { notifications : ['notification 1','notification 2','notification 3'] } }); Unfortunately what have I tried so far (see my fiddle) is not working, any help please?
I updated my code <div id="app"> <my-notification :notification="notifications"></my-notification> </div> <template id="my-template"> <ul> <li v-for="nn in nns">{{ nn }}</li> </ul> </template> Vue.component('my-notification',{ template : '#my-template', props : ['notification'], data : function(){ return { nns : this.notification } } }); new Vue({ el : '#app', data : { notifications : ['notification 1','notification 2','notification 3'] } });
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "javascript, vue.js, vue component" }
How to stop c++ from rounding to closest integer I'm doing an area of a cylinder calculator and for some reason, c++ is rounding to the nearest number , here's my code: int volume() { int radius; int height; double long volume; double pi; pi = 3.14; cout << "Enter Radius: "; cin >> radius; cout << "Enter height: "; cin >> height; volume = radius * radius * height * pi; return volume; } int main() { cout << "Formula Calculator \n"; cout << "The volume is " << volume(); return 0; } It always rounds the answer to the nearest integer pls help :(
double long volume() { int radius; //Radius of a cylinder int height; //Height of a cylinder double long volume; //The resulting volume of the cylinder double pi = 3.14; //The constant pi cout << "Enter Radius: "; cin >> radius; //User inputs radius of cylinder cout << "Enter height: "; cin >> height; //User inputs height of cylinder volume = radius * radius * height * pi ; // v = (pi)(h)(r)^2 return volume; } int main () { cout << "Formula Calculator \n"; cout << "The volume is " << volume(); return 0; } The only issue I found was with the declaration of your function. You used `int` instead of `double long` that you used to declare your resulting volume. Also remove the c from `cvolume()` in your main function.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "c++, cmath" }
Deploy several cod files to Blackberry Simulator I know we can deploy a cod file to blackberry simulator using: fledgecontroller /session=9800 /execute=LoadCod("C:\\temp\\test.cod") fledgecontroller /session=9800 /execute=LoadCod("updates.force") What about deploying several cod files? Seems fledgecontroller cannot deploy a zip file. So it won't help even I zip all cod files. Thank you!
Thank you, Ray! Here is the trick: fledgecontroller /session=9800 /execute=LoadCod("C:\\temp\\test.cod.pending") fledgecontroller /session=9800 /execute=LoadCod("C:\\temp\\test-1.cod.pending") fledgecontroller /session=9800 /execute=LoadCod("C:\\temp\\test-2.cod.pending") fledgecontroller /session=9800 /execute=LoadCod("C:\\temp\\test-3.cod.pending") fledgecontroller /session=9800 /execute=LoadCod("C:\\temp\\test-4.cod.pending") fledgecontroller /session=9800 /execute=LoadCod("updates.force") Now I don't have any trouble to deploy several cod files.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "deployment, blackberry" }
AWS EC - How to run phantomjs server forever I have setup phantomjs as web server for scraping on AWS EC. I don't know how to run phantoms script forever through putty? Any alternative for phantom like Forever for NodeJS?
PM2 is a good option. You can take a look at the documentation, it enables you to automatically restart your program if it crashes, and has a lot of cool features. To start your PhantomJS application using PM2, the command would be: `pm2 start app.js --interpreter phantomjs` The application will run detached to your SSH session, so you can safely quit your Putty window.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 0, "tags": "node.js, amazon web services, web scraping, phantomjs, amazon ec2" }
Elastic Beanstalk node.js app served through SSL I have develop an _node.js_ app and successfully upload and deploy it using AWS tools and Elastic Beanstalk. My app is reachable through the url provided by EB. I create a SSL Certification through AWS Certificate Manager and assign it from configuration menu. Load Balancer Config When i checked Load balancer and security group configuration everything looks fine but if i'm trying to get https:// _myappurl_.us-west-2.elasticbeanstalk.com i get privacy error response. I think that this is more likely a Amazon support question but maybe someone know if i miss something. Thanks
The SSL certificate will be for a specific domain. It is certainly not for the `myappurl.us-west-2.elasticbeanstalk.com` domain because you don't own the domain `elasticbeanstalk.com` so there's no way you could have created a valid SSL certificate for that domain. The SSL certificate is only going to work with the custom domain you created the certificate for, and only when you have that custom domain actually pointing to your Elastic Beanstalk environment.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -2, "tags": "node.js, amazon web services, ssl" }
TextInputEditText resizing text I have this TextInputEditText widget (Material Design) when there is too much text on the field, it gets cut off. I want to resize it until a certain size
There is a library for this which supports min/max size: AutoFitEditText * * * **P.S.** Probably you know, but, if anyone ended up here wondering about auto resize textviews they need something like this: <TextView android:layout_width="match_parent" android:layout_height="200dp" android:autoSizeTextType="uniform" android:autoSizeMinTextSize="12sp" android:autoSizeMaxTextSize="100sp" android:autoSizeStepGranularity="2sp" /> From:Autosizing TextViews
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 1, "tags": "android, kotlin, android textinputedittext" }
Definite Integration ( a little query) ## $$\int_0^π \frac{xdx}{a^2\cos^2x+b^2\sin^2x} \,dx$$ Using property $$\int_a^b f(x) \,dx= \int_a^b f(a+b-x) \,dx$$ (i can't write it correctly,please check it) I get, $2I=\pi\int_0^\pi \frac{dx}{a^2\cos^2x+b^2\sin^2x} \,dx$ On dividing numerator and denominator of R.H.S by $\cos^2x$ I get, $2I=\pi\int_0^\pi \frac{\sec^2xdx}{a^2+b^2\tan^2x} \,dx$ Now, solving by substitution method (taking $b\tan x=t$) I get ![enter image description here]( (i have added the image because i was not able to type this correctly) * * * As the upper limit and lower limit on the function are **zero** So, answer should be zero. But in the solution ( after getting this $2I=\pi\int_0^\pi \frac{dx}{a^2\cos^2x+b^2\sin^2x} \,dx$ )they have used the property $$\int_0^2a f(x) \,dx= 2\left(\int_0^a f(x) \,dx\right)$$ Why they didn't ended the solution in the direction in which i did **pardon for my mathjax errors**
When you substitute something that has to be increasing or decreasing throughout the interval and continuous also(otherwise you have to break the integra)l. Here you have taken tan(x) which changes on π/2.
stackexchange-math
{ "answer_score": 2, "question_score": 5, "tags": "calculus, integration, definite integrals" }
Is $z = x^2y^3(1-x-y)$ convex or concave? Is there some kind of trick to defining the domain of the concavity/convexity (if it exists)? I have no idea how to work with the resultant hessian
Easy to see that we can not say that $$\frac{\partial^2(x^2y^3(1-x-y))}{\partial x^2}\geq0$$ for all reals $x$ and $y$ and we can not say that $$\frac{\partial^2(x^2y^3(1-x-y))}{\partial x^2}\leq0$$ for all reals $x$ and $y$. What does follow from this?
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "multivariable calculus, polynomials, convex optimization, hessian matrix" }
Our app uses: ASP.Net, VB.Net, and Microsoft's AJAX implementation. Is there any unmanaged code in there? The middleware that manages talk between the mainframe and our app is blowing up randomly. It's a "such and such attempted to read/write protected memory..." error. The vendor is saying there we must be running some unmanaged code (I feel they're trying to worm out of it). I know VB's entirely managed, but does anyone know about the server portion of AJAX? Is there any server side javascript stuff that occurs before it actually gets into the .NET framework?
Neither the .NET Framework nor its AJAX add-ons contain _server-side_ JavaScript. The .NET Framework does of course contain unmanaged code, and there are rare crashing bugs in it.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 0, "tags": "asp.net, ajax, vb.net" }
How do I change Stockfish's Engine Parameters? I have no clue how to do this, I want to change its Contempt to -100.
As shown in the screenshot below. Goto Tools -> Analysis Engines -> Edit. You'll see a UCI configure dialog. In this example, I had another engine but the idea remains the same. !enter image description here
stackexchange-chess
{ "answer_score": 4, "question_score": 5, "tags": "engines, stockfish" }
How to extract read a zipped file? How can I extract a data from a zipped file uising JAVA libraries ? Is there a library that does unzipping and the I get the file and manipulate it ?
You could use the "java.util.zip" package. See this article by Sun (now Oracle).
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "java, zip" }
Alegbra Equation to solve client's request A client of mine gave me an equation to solve withholding taxes and etc. This is what he gave me: $$A = \frac{B}{(P + B) / 1.12}$$ I do not see how to rearrange this into the form of $B=\ldots$. It seems particularly difficult as there are multiple $B$'s on the left hand side.
Since $$A= \frac{1.12\cdot B}{P+B}$$ we may multiply both sides by $(P+B)$ to obtain $$AP+AB=1.12\cdot B$$ which we rearrange to $$AP=B\cdot(1.12-A)$$ Finally, dividing by $(1.12-A)$ yields $$B=\frac{AP}{1.12-A}$$ Or if you prefer integer coefficients, $$B = \frac{25AP}{28-25A}$$
stackexchange-math
{ "answer_score": 0, "question_score": -1, "tags": "algebra precalculus" }
What is the inverse of "guardian"? If I am your guardian, what does that make you to me?
Your dependent or ward (credit to amcnabb), both of which are legal entities, but both of which apply outside the legal sphere. _Dependent_ connotes a relationship in which the guardian is both provider and protector, whereas _ward_ implies that the guardian is the protector, but not much else.
stackexchange-english
{ "answer_score": 33, "question_score": 23, "tags": "word choice, single word requests, nouns, antonyms" }
find a open cover for R that has no lebesgue number. Q. find a open cover for R that has no lebesgue number. my doubt: well i am still strugling with this question. i recall that for a compact subset of metric space, every open cover has a lebesgue number. does anyone know how to do this?
For $n\in \mathbb{Z}$, take $A_n = (n,n+1)$ and $B_n := (n-1/n, n+1/n)$ and consider the open cover $\mathcal{U} := \\{A_n :n \in \mathbb{Z}\\} \cup \\{B_n : n \in \mathbb{Z}\\}$. For any $\delta > 0, \exists N \in \mathbb{N}$ such that $2/N < \delta$, so consider $$ C := (N+1-1/N, N+1+1/N) $$ Then $\text{diam}(C) < \delta$, but $C$ is not contained in any single member of $\mathcal{U}$.
stackexchange-math
{ "answer_score": 1, "question_score": 2, "tags": "real analysis" }
Pass statement in an if statement I try to understand, in this code, why python print the letter `"w"`? (I work with python 2.7.8): LetterNum = 1 for Letter in 'Howdy!': if Letter == 'w': pass print 'Encountered w, not processed.' print ('Letter', LetterNum, 'is', Letter) LetterNum+= 1 I get this result: >>> ('Letter', 1, 'is', 'H') ('Letter', 2, 'is', 'o') Encountered w, not processed. ('Letter', 3, 'is', 'w') ('Letter', 4, 'is', 'd') ('Letter', 5, 'is', 'y') ('Letter', 6, 'is', '!') While I thought I should get this result: >>> ('Letter', 1, 'is', 'H') ('Letter', 2, 'is', 'o') Encountered w, not processed. ('Letter', 4, 'is', 'd') ('Letter', 5, 'is', 'y') ('Letter', 6, 'is', '!') >>>
You are trying to use pass as though it were continue. Pass does nothing, while continue skips the current iteration. Here is code that does what you want with correct usage of continue: LetterNum = 1 for Letter in 'Howdy!': if Letter == 'w': print 'Encountered w, not processed.' continue print ('Letter', LetterNum, 'is', Letter) LetterNum+= 1
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 1, "tags": "python, python 2.7, loops, if statement, for loop" }
Magento Template Design Question In the category page of Magento, the default setting is three columns and three products a line. When I remove the left column, it appeares blank in the left sidebar and the content of the products will not be auto-width. So I need to change the CSS file so that make the page looks fine. I am new to Magento, the question is, is this the best practise or is there another way to make this? Thanks in advance!
Don't edit the default layout but rather create another page template (ie. 2columns.phtml) and then add it into the page.xml as well as adding your css for the new layout. To change the default layout, open: /app/design/frontend/default/modern/layout/page.xml on or around line 35, edit the following block: <block type="page/html" name="root" output="toHtml" template="page/3columns.phtml"> change to <block type="page/html" name="root" output="toHtml" template="page/2columns-right.phtml"> and then add your css accordingly.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "magento" }
Doesn't compile SCSS after update OSX to 10.13 (macOS High Sierra) Koala version: 2.2.0 > Error message: /scss/styles.scss /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in to_specs': Could not find 'sass' (>= 0) among 15 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/Users/monstercritic/.gem/ruby/2.3.0:/Library/Ruby/Gems/2.3.0:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0', executegem envfor more information from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:into_spec' from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in gem' from /Applications/Koala.app/Contents/Resources/app.nw/bin/sass:17:in
Step 1: Open terminal & run this code (this code for install homebrew) ruby -e "$(curl -fsSL Step 2: run these code: sudo gem uninstall sass sudo gem install sass done
stackexchange-stackoverflow
{ "answer_score": 25, "question_score": 6, "tags": "ruby, sass, koala" }
Check If a point on a circle is left or right of a point What is the best way to determine if a point on a circle is to the left or to the right of another point on that same circle?
If you mean in which direction you have to travel the shortest distance from $a$ to $b$ and assuming that the circle is centered at the origin then this is given by the sign of the determinant $\det(a\, b)$ where $a$ and $b$ are columns in a $2\times 2$ matrix. If this determinant is positive you travel in the counter clockwise direction. If it is negative you travel in the clockwise direction. If it is zero then both directions result in the same travel distance (either $a=b$ or $a$ and $b$ are antipodes).
stackexchange-math
{ "answer_score": 4, "question_score": 3, "tags": "linear algebra, trigonometry, circles" }
OmniFaces inputFile case insensitive media type filtering I'm using OmniFaces's 2.6.1 inputFile to upload files and want to apply media type filtering through the use of the accept attribute, for example `accept="image/png"`. This works fine for file names having a `.png` extension, but is apparently case sensitive. When uploading a file with a `.PNG` extension, the validation fails. I tried specifying `accept="image/PNG"` and `accept="image/*"`, but to no avail. Is there an easy way to filter on media types in a case insensitive way?
Under the covers, the `<o:inputFile>` derives the mime type from the server's mime mapping, which you can control via `<mime-mapping>` entries in `web.xml`. I can't reproduce your problem on WildFly 12. Apparently you're using a server which doesn't perform case insensitive matching on the file extension. As per issue 447 I've fixed it for 2.6.9 by explicitly lowercasing the filename before consulting the server-managed mime mapping. For now, a work around is to explicitly add a mime mapping for `PNG` extension to your webapp's `web.xml`. <mime-mapping> <extension>PNG</extension> <mime-type>image/png</mime-type> </mime-mapping> Note that this still won't match `Png`, `pNG`, `pNg`, etc.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 3, "tags": "jsf 2.2, omnifaces" }
Temperature different of adapter since Mountain Lion (maybe only rMBP related) Since I've got ML (Mountain Lion) installed, I've got the feeling that my adapter (Magsafe-2) is not getting as hot as before? Since this is my first Macbook, I really wasn't familiar with the adapter's temperature. My rMBP's adapter seemed to get so extensively hot, that I could actually smell it when holding it somewhat close to my face and could almost not keep it for longer period of time in my hand. Though, since I've got ML installed, it seems my adapter is cooler through charging my Macbook then before. Still, ofcourse, it gets hot, but definitely not as hot as before. I wondered - though not getting anything worthy out of knowing - if you guys are experiencing this as well?
Ambidex, The power usage in the rMBP is MUCH better under Mountain Lion than it was under Lion. This causes less wear and tear on the Magsafe. Depending on the amount of charge needed it's quite possible the device will work harder to power up from 20% battery than from 80%. T
stackexchange-apple
{ "answer_score": 0, "question_score": 0, "tags": "macbook pro, temperature, magsafe" }
Javascript — escape a character entity (→ is showing as &rarr;) document.title = ("hello &rarr; goodbye"); This is not outputting the arrow: "→" as it should. How does one escape that so it does?
You don't need to escape it at all. Just write document.title = "hello → goodbye"; (and make sure your file is UTF8) If you really want to escape it, you can use a Javsacript escape code: `"\u2192"` Entities are only used in HTML source; you cannot use them in ordinary strings. (Except for `innerHTML`, which is HTML source)
stackexchange-stackoverflow
{ "answer_score": 9, "question_score": 5, "tags": "javascript, string, dom" }
how to simulate pressing an arrow key in linux bash I've worked with powershell before but I'm new to linux bash scripts. Say I wanted to write a script that just presses a key (left arrow) in regular intervals (0.05s). How could I go about doing this?
Use Xdotool. Its usage is: xdotool key SPECIFY_KEY and replace SPECIFY_KEY with the required keystroke, or in **your** case: xdotool key Up/Down/etc.
stackexchange-stackoverflow
{ "answer_score": 14, "question_score": 11, "tags": "linux, bash, shell" }
Half of the screen does not seem to work correctly I am not such a professional coder but trying to code something on Unity. However, when I try to play the application in my android phone, the half of the screen does not seem to work correctly, please look at the photo: < & < Can you guess what the reason is for that? Up to now, I have changed screen resolution but it did not solve my problem. Edit: It works perfectly in my android tablet. However, as I said, I have this problem in my LG G3 android phone. Thanks for your help!
After changing Main Camera setting according to this photo: ![enter image description here]( I have solved my problem.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "unity3d, screen" }
Density plot in R, ggplot2 I am trying to plot and compare two sets of decimal numbers, between 0 and 1 using the R package, ggplot2. When I plotted using geom="density" in qplot, I noticed that the density curve goes past 1.0. I would like to have a density plot for the data that does not exceed the value range of the set, ie, all the area stays between 0 and 1. Is it possible to plot the density between the values 0 and 1, without going past 1 or 0? If so, how would I accomplish this? I need the area of the two plots to be equal between 0 and 1, the range of the data. Here is the code I used to generate the plots. Right: `qplot(precision,data = compare, fill=factor(dataset),binwidth = .05,geom="density", alpha=I(0.5))+ xlim(-1,2)` Left:`qplot(precision,data = compare, fill=factor(dataset),binwidth = .05,geom="density", alpha=I(0.5))`
You might consider using a different tool to estimate the density (the built in density functions do not consider bounds), then use ggplot2 to plot the estimated densities. The logspline package has tools that will estimate densities (useing a different algorythm than density does) and you can tell the functions that your density is bounded between 0 and 1 and it will take that into consideration in estimating the densities. Then use ggplot2 (or other code) to compare the estimated densities.
stackexchange-stackoverflow
{ "answer_score": 3, "question_score": 2, "tags": "r, ggplot2, data visualization, analysis" }
Hash of hashes of arrays of hashes, Itunes wishlist Cheers! Please, help me to solve the problem - I have a cookies, which is hash: > cookies.keys => [:wishlist] Then: > cookies[:wishlist].keys => ["result_count", "results"] results is an array of Hashie::rash > cookies[:wishlist].results[0].keys => ["wrapper_type", "kind", "artist_id", ...] cookies is hash, cookies[:wishlist] is Hashie::Rash, results is an array, which contains other Hashie::Rash'ies. The question is how could I add new data to wishlist without deleting old data (add track to wishlist, for example)?
Assuming you have this structure: cookies = { :wishlist => Hashie::Rash.new({ 'resultCount' => 2, 'results' => [ Hashie::Rash.new({ 'wrapperType' => 'foo1', 'kind' => 'bar1', 'artistId' => 'baz1' }), Hashie::Rash.new({ 'wrapperType' => 'foo2', 'kind' => 'bar2', 'artistId' => 'baz2' }) ] }) } You can simply use `Array#push` to add new items to your `results`: require 'rash' new_wishlist_item = Hashie::Rash.new({ 'wrapperType' => 'foo3', 'kind' => 'bar3', 'artistId' => 'baz3' }) cookies[:wishlist].results.push( new_wishlist_item ) cookies[:wishlist].result_count = results.count cookies[:wishlist].results.each do |r| puts r.wrapper_type end Output: foo1 foo2 foo3
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 1, "tags": "ruby on rails, ruby, cookies, hash" }
Наращения с классами школы Был вопрос о наращении в словосочетании "советник 2-го класса" (или II класса). Я же хочу спросить о школьных классах. Обязательно ли наращение или его можно опустить? Например: _1 класс или 1-й класс?_ Понятно, что с наращением в любом случае не неправильно, но можно ли без него в этом случае?
**1 класс или 1-й класс?** В правилах пишется, что следует использовать форму **1-й класс**. Но можно обратить внимание на то, что это правило для школьных классов часто нарушается. В частности, на обложках школьных учебников наращения не делаются, о чем уже были вопросы: < Соответственно, наращения не всегда делаются и в других случаях, например: все учебники для 5 класса. Возможно, это упрощенная запись. Вопрос № 227219 При оформлении условий заданий для школьной олимпиады верно писать **«9 класс», «11 класс»** (как здесь: < или все-таки «9-й класс», «11-й класс» и т. д.? Ответ справочной службы русского языка: Согласно общему правилу наращение нужно: _9-й класс, 11-й класс_. В приведенном тексте наращение не использовалось, чтобы не перегружать текст.
stackexchange-rus
{ "answer_score": 0, "question_score": 0, "tags": "орфография, наращение" }
cap:deploy not updating gems - need to run cap deploy:stop and cap deploy:start I have a Spree application, and also maintaining a bunch of gems along with it. Whenever I do a `cap deploy`, I find that I have to do `cap deploy:stop` and `cap deploy:start` in order for the changes made in the gems to be picked up. Am I during this right, because this is obviously very disruptive to the users. My setup follows mostly from the Railscasts episodes on Capistrano, Unicorn and Nginx. **UPDATE:** After a bit of research, I realized that I didn't include this in `unicorn.rb`. before_exec do |server| ENV['BUNDLE_GEMFILE'] = "#{root}/Gemfile" end Could this be the cause?
In order to have automatic bundle: * You must `require 'bundler/capistrano'` in your capistrano config file * You must not run your `cap deploy` with the option `no_release` To troubleshoot, you need first to ensure that `deploy:finalize_update` is ran bu capistrano, you could create a scenario that run `before "deploy:finalize_update"` and just output som debug text to your console, you'll know the if the problem occurs before or after finalize_update
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": -1, "tags": "ruby on rails, rubygems, capistrano, spree" }
JasperReports - last line of a table on a page I have a table that gets split onto multiple pages due to it's size. The style of the table doesn't have the border between two rows and when the table gets split the last row doesn't seem right due to the missing bottom border. I just want the last record to terminate with a border so that the page seems complete. Is there a way to set the bottom border to the last line on the page or, how should I implement this behavior?
Table column footers repeat just like column headers. By adding a top pen border to the column footer the effect is perfect.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 2, "tags": "jasper reports" }
Difference between "by draw" and "by lot" Suppose that a group of people wants to choose someone to do some task. So they write everyone's names in pieces of paper (one name per piece), put all the pieces in a bag and someone picks up a name from the bag. In this case, I'd say the person was chosen "by lot" or "by draw"? Do you know which one is correct (or both, or none and there's a better word/expression for that) and if there are any difference between them?
By lot. Someone chosen _by lot_ was chosen _in a draw_. A draw is the event of choosing something by that method, but you can't use it as an adjective like you can with "by lot". Also, as an interesting side note, in English we often say "picked out of a hat" or "a name from a hat" or "taken from a hat" or something similar, even if there was no hat involved! For some reason, in English, hat = choosing at random. Probably because in the not too recent past, everyone would have a hat to use.
stackexchange-english
{ "answer_score": 1, "question_score": 1, "tags": "meaning, word usage, differences" }
Bash sum from file I have one file, for example a 1:2:3:4:5 b 2:3:4:5:6 Output must be: a 15 b 20 I have to add numbers from the second column on output: echo $((${line// /+}));done < $1 sums, but I do not know how to change the separator `:` to `` (I don't know how to use `tr`).
You were quite close. When you have a string like `1:2:3` and you want to get the sum of the colon-separated numbers, you can use $ var='1:2:3' $ echo "$(( ${var//:/+} ))" 6 Applying this to your loop: while read -r first rest; do printf '%s %d\n' "$first" "$(( ${rest//:/+} ))" done < infile where `first` will contain the first column and `rest` is the colon-separated string. The output looks like a 15 b 20
stackexchange-stackoverflow
{ "answer_score": 5, "question_score": 0, "tags": "linux, bash, shell" }
Expand Fundamental Theorem of Algebra The fundamental theorem of algebra tells us that polynomial equation of degree $n$ can be written as $$ p(z) = a_0(z-z_1)(z-z_2)...(z-z_n) $$ How would one go about expanding this expression and what would the expansion look like?
If you look at small powered expressions, you can find the pattern nicely. For example, $$(z-z_1)(z-z_2)=z^2-(z_1+z_2)z+z_1z_2$$ $$(z-z_1)(z-z_2)(z-z_3)=z^3-(z_1+z_2+z_3)z^2+(z_1z_2+z_2z_3+z_1z_3)z-z_1z_2z_3$$ Note the sum of the roots is the coefficient for the term of degree 1 less than that of the number of roots. Note the constant term is the product of the roots...and certainly if you multiply by a constant $a_0$, what would happen there?
stackexchange-math
{ "answer_score": 1, "question_score": 0, "tags": "analysis, polynomials" }
android dexed lib is empty I use VkontakteSDK-lib and it was(!) ok. It is project imported in workspace(Eclipse) and included in my project. But now on launching this lib has size 166 bytes in dexedLibs (only META-INF inside). And of course i have in log: Could not find class 'com.perm.kate.api.Api' referenced from method com.<my_package_path>.VKController.<init> I tried copy lib from /bin and include her in my project directly (size = 86.6kb), but it still to resize to 166 bytes on bin/dexedLibs folder... Because of what it could be? **Solved** I deleted directly jar lib, removed from workspace lib project,clear my project, manually delete dexed lib from "dexedLibs" this jar (166 bytes) and again import lib project and include in my project. Again it is happiness.
Solved I deleted directly jar lib, removed from workspace lib project,clear my project, manually delete dexed lib from "dexedLibs" this jar (166 bytes) and again import lib project and include in my project. Again it is happiness.
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 0, "tags": "java, android" }
Can't switch branch: untracked working tree file because of case-insensitivity? I want to merge the develop branch into the master branch and I thougt I do something like this: git checkout master git merge --no-ff develop git tag -a 1.0.0 but on checkout I get git checkout master error: The following untracked working tree files would be overwritten by checkout: Project/Resources/someimage.png Please move or remove them before you can switch branches. Aborting But I have a file _someImage.png_ in my develop branch and it seems that git has somehow an old file. Is GIT case-sensitive? On the local folder there is no such file. Shoud I simply use `git rm -f filename`? **Edit:** Now I tried to delete the file, but I get > fatal: pathspec './Project/Resources/someimage.png' did not match any files Now I'll try to checkout the master branch with -f.
I forced the checkout like this `git checkout master -f` and the local differences should be ignored. I think through deleting and re-inserting the image there was a problem in the index or so.
stackexchange-stackoverflow
{ "answer_score": 2, "question_score": 3, "tags": "macos, git, version control, branch, case sensitive" }
SASS: calc() vs normal calculation? I previously started working with SASS (scss to be specific) and was wondering, if there's any difference/advantage/disadvantage between the css calc() method or sass calculation? $divide-by: 50; //CSS calc() .example1 { height: calc(100vw / #{$divide-by}); } //SASS calculation .example2 { height: 100vw / $divide-by; }
SASS calculation is made on compilation. While CSS `calc()` is always made on the browser. For example: SASS `height: 100px / 2;` will compile to `height: 50px;` <\- and this is what the browser will see always no matter what. CSS `width: calc(100% - 20px)` will always be this even on the browser, and at that point the browser will do the calculations depending on what that 100% looks like. in your case `height: 100vw / $divide-by;` i belive you variable will be considered as a `vw` value, so if `$divide-by` is 20, then the compiles version of that height will be `height: 5vw;` Let me know if the explanation did not help, and I will try to give you some resources to read.
stackexchange-stackoverflow
{ "answer_score": 13, "question_score": 9, "tags": "css, sass, css calc" }
I want to do an SQL query for every member in the members table How do I do that? I have a table with,at the moment, 3 members. For each one of these members I want to add a row to another table. Should I use a while inside a while? Or a Foreach loop? This is what I have so far. $sql = "SELECT email FROM members"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)){ // Do I add a new while in here? Do I use a for loop? }
based on your table info : while ($row = mysql_fetch_assoc($query)){ mysql_query("insert into aanwezigheid set email='{$row['email']}', date='{$your_date_var}', city='{$your_city_var}', address='{$your_address_var}'" ); }
stackexchange-stackoverflow
{ "answer_score": 0, "question_score": 2, "tags": "php, mysql, sql, foreach, member" }
What does the Python operator ilshift (<<=)? What does the Python operator ilshift (<<=) and where can I find infos about it? < < Found no info about what it does in the documentation.
It is an BitwiseOperators (Bitwise Right Shift): < > All of these operators share something in common -- they are "bitwise" operators. That is, they operate on numbers (normally), but instead of treating that number as if it were a single value, they treat it as if it were a string of bits, written in twos-complement binary. More infos: < What does a bitwise shift (left or right) do and what is it used for?
stackexchange-stackoverflow
{ "answer_score": -1, "question_score": -5, "tags": "python" }
How to flash HP's extracted BIOS file (AmiBIOS-MTTool) I updated microcodes in .rom file from extracted BIOS.EXE files Normally you must install this BIOS update by BIOS.exe file from windows [HP] but I extracted it and now i have these files![extracted bios files]( is it possible to flash BIOS from these files? from cmd? I updated bios file so now i can't repack it to .exe file to flash, i need another method.
I got it done by just opening/running AFUWIN.EXE and then running .bat file. BIOS will be updated then... That's it... And updated microcodes are in BEN5.37 (ROM) file...
stackexchange-superuser
{ "answer_score": 1, "question_score": 2, "tags": "bios" }
WPF GridViewColumn Cell Visiblity Not Triggering I am trying to update a cell to be visible when a value is true but it doesn't seem to be updating. I'm new to WPF so any advice would be appreciated. <GridViewColumn Width="90" Header="Completed"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock Text="Completed" Visibility="Hidden" /> <DataTemplate.Triggers> <DataTrigger Binding="{Binding ExtractionCompleted}" Value="True" > <Setter Property="TextBlock.Visibility" Value="Visible" /> </DataTrigger> </DataTemplate.Triggers> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn>
The reason it wasn't updating at runtime was because I had not implemented INotifyPropertyChanged. Once this was done the code worked.
stackexchange-stackoverflow
{ "answer_score": 1, "question_score": 0, "tags": "wpf, gridview" }