qid
int64
10
74.7M
question
stringlengths
15
26.2k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
27
28.1k
response_k
stringlengths
23
26.8k
44,743,969
I have a text file containing information on restaurants, what is required to is,to insert this information to several dictionaries.The attributes are name, rating, price range, cuisine type Here's the content of txt ``` Georgie Porgie 87% $$$ Canadian,Pub Food Queen St. Cafe 82% $ Malaysian,Thai ``` So far ...
2017/06/25
[ "https://Stackoverflow.com/questions/44743969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5014749/" ]
You seem to have pasted a script into your terminal. It's not going to work unless you invoke `python` first
First check, whether python is on you system: ``` edwards-iMac:~$ which -a python /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python /usr/bin/python ``` To enter live interpreter do this on your commandline: ``` python ``` Now you are in the shell (Live Interpreter). Then you can enter the follow...
5,871,437
I've written some tests using Capybara, but I'm not using selenium and neither any other JS drivers. But my doubt is if I can test a destroy method this way? Since I need to confirm a JS confirmation and the data-method = "delete" can't be visited... I would like to do something very Capybara's way like: visit '/peop...
2011/05/03
[ "https://Stackoverflow.com/questions/5871437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/268673/" ]
"In general", both queries can produce different execution plans depending on data distribution. However, assuming that your second query is in fact this: ``` SELECT y.* FROM mytable y LEFT JOIN mytable y2 ON y2.person = y.person AND y2.year > y.year WHERE y2.year IS NULL ``` , the `LEFT ...
They don't look relationally equivalent - the first is doing a correlated subquery on person that's absent in the second. ``` select * from mytable y where y.year = (select max(yi.year) from mytable yi where yi.person = y.person) ``` Could be rewritten as: ``` select [list of ...
2,049,355
I have an Application that need to evaluate Excel Logical Formulas and I use Excel DLL to do this, but DLL isn't it very efficient. .NET Framework (C#) has any Class that can make this Job? An sample I Provide this ``` =IF(AND(10>=-5;10<0);(-3,8*10+335);IF(AND(10>=0;10<5);(1,4*10+335);IF(AND(10>=5;10<14,4);(-1,276...
2010/01/12
[ "https://Stackoverflow.com/questions/2049355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/237766/" ]
I am using [ActiveXls](http://www.activexls.com) and it's doing a great job. It's not a free component so you have to pay for it. I don't know if there are any good and free components out there, but I prefer to have support in case I need it :)
I used bcParser.NET is a mathematical expression parser library for the .NET platform. this utility from bestcode organisation and easy to use to calculate all type of formula. refer to this <http://www.bestcode.com/html/math_parser_for_dot_net.html>
1,460,724
I want to print a pixel on the screen using C language. When I write code and compile it shows > > graphics.h:No such file or directory > > > I found that gcc doesn't have the "graphics.h" header file. How can I add graphics.h to the gcc compiler?
2019/07/17
[ "https://superuser.com/questions/1460724", "https://superuser.com", "https://superuser.com/users/1063659/" ]
OpenSSL does not support PPK files. Only PuTTY tools do. You can use PuTTYgen to convert PPK to PEM. And then you should be able to convert PEM to PKCS12.
As @"Martin Prikryl" already mentioned, OpenSSL does not support PPK files and you need to install `putty-tools`. After that you execute `puttygen YOUR_PRIVATE.ppk -O private-openssh -o your_private_id` for your private key and `puttygen YOUR_PUBLIC.ppk -O public-openssh -o your_public_id` for your public key.
423,109
I am using `.pdf_tex` files to insert and label figures in LaTeX: ``` \begin{figure} \centering \graphicspath{{Graphics/FiltersCa/}} \input{Graphics/FiltersCa/COMB_filter_activeZ2b.pdf_tex } \caption{... } \label{fig:FiltersCa} \end{figure} ``` Is it possible to export each figure as a se...
2018/03/25
[ "https://tex.stackexchange.com/questions/423109", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/159089/" ]
The endfloat package will export all the figures (LaTeX source) to a `.fff` file. ``` \documentclass{article} \usepackage{endfloat} \usepackage{graphicx} \makeatletter \efloat@openpost{fff} \efloat@iwrite{fff}{\string\textwidth=\the\textwidth}% pass \textwidth to fff file \makeatother \begin{document} \begin{figure...
Quick update with my current work-around (figure-by-figure): * I open the original `PDF`-output with `Inkscape` (I recommend Poppler/Cairo import). You can select the page containing a specific figure. * Create an rectangle (`F4`) that outlines the region of the page, you would like to export (Figure with or without c...
2,066
We found that water with salt, sugar, or baking soda dissolved in it cools faster than pure water. Water has a very high specific heat; how do these solutes lower it? We heated a beaker (300ml) of water to 90° C and let it cool, checking the temperature every 5 minutes. We repeated the experiment adding a tablespoo...
2010/12/19
[ "https://physics.stackexchange.com/questions/2066", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/889/" ]
If your description of the experiment is accurate then the result you got is unexpected. It is true that specific heat capacity of salt solution (per *mass* unit) is lower than of pure water, you can estimate it as $$C\_{p} = wC\_{p}^{salt}+(1-w)C\_p^{H\_2O}$$ where *w* is the mass fraction of salt. However, as you des...
I think that the reason why water has a very high specific heat capacity is due to the presence of hydrogen bonding between each individual water molecule (polarity). These hydrogen bonds are capable of storing energy from heating, and so when water is heated, some heat energy becomes the bond energy and is stored, the...
54,008
I'm about to write the company guidelines about what must never appear in logs (trace of an application). In fact, some developers try to include as many information as possible in trace, **making it risky to store those logs, and extremely dangerous to submit them**, especially when the customer doesn't know this info...
2011/03/02
[ "https://softwareengineering.stackexchange.com/questions/54008", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/6605/" ]
Personally-identifiable health information covered by the Health Insurance Portability and Accountability Act of 1996 (HIPAA). [This article](http://www.twc.state.tx.us/news/efte/hipaa_basics.html) lists the following examples: * Health care claims or health care encounter information, such as documentation of doctor'...
Off the top of my head.... Credit card information should not be in logs. SSN (or SIN) data should not be in logs. ...of course there are exceptions, if you should happen to work for some central data store for a credit card company or a government agency that manages SIN data, then you might *have* to log it, becaus...
33,163
I have no idea what this thing is, and it appears to be a kitchen tool, but for what? I put up a YouTube video of it, and would love to see if anybody knows exactly what it would be used for, because we have no idea: <http://youtu.be/do5_D8Sjhk8> It would appear to be some kind of corer, or to cut shapes out of some...
2013/04/01
[ "https://cooking.stackexchange.com/questions/33163", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/6170/" ]
It looks like one I bought a few years ago, it was suppose to cut corn off the cob. You put it around the small end of the corn and rotate in a downward motion. I didn't like the results and went back to using a knife.
This looks like a butter looper/curler. They are used to create a nice presentation of butter for the bread course. <http://en.wikipedia.org/wiki/Butter_curler>
27,872,959
I am getting an issue where android studio is saying ``` Installation failed since the device has an application with the same package but a different signature. . . .. ``` This is correct, as I recently signed an APK and uploaded to the beta area of my play developer console. And now I am trying to debug it loca...
2015/01/10
[ "https://Stackoverflow.com/questions/27872959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/457172/" ]
You can sign your apps with your release key while keeping the debugging option - you just have to add your release key into Android Studio (or specify it on the command line if you are signing your apps there). In Android Studio, right click on your app in the project browser and open module settings. Select your ap...
changing the app id in gradle files did it for me ``` defaultConfig { applicationId 'com.example.app' } ```
116,615
Every once in a while, our server will do something stupid. Maybe a log file got too big and ate up all the disk space, or a process has hung. In either case, the result is our website is down. And in e-commerce, downtime = lost sales. All of the issues I can easily fix in 15 minutes or less. But the issues never occu...
2010/02/25
[ "https://serverfault.com/questions/116615", "https://serverfault.com", "https://serverfault.com/users/15623/" ]
Yes, it's called "Managed Hosting". For what it's worth, we use Rackspace.
Have you considered outsourcing your IT infrastructure that specializes in management? There are several Infrastructure as a Service (IaaS) hosting companies that provide 24x7x365 server management and support. I personally recommend NetDepot (www.netdepot.com) and have used them for over 3 years. They have on-site tec...
11,687,146
I've got the following code which makes a connection to a db > runs a stored proc > and then moves on. I believe it is easy to get db programming wrong so it is important to be *defensive*: is the following defensive? (or can it be improved?) ``` public int RunStoredProc() { SqlConnection conn = null; SqlCommand data...
2012/07/27
[ "https://Stackoverflow.com/questions/11687146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1179880/" ]
Try using, well, the `using` construct for such things. ``` using(var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["IMS"].ConnectionString) { } ``` Once you do that, I think you will be at the right level of "defense". Similarly try to do the same for anything that has to be disposed ( like the co...
If `MessageBox.Show("Error:" + ex.Number.ToString(), "Error StoredProcedure");` is how you're going to handle an exception then you're not logging or even retrieving the actual exception details.
27,237,162
I am writing a database using mysql and I am trying to show multiple columns using subquery but it gives me an error "ERROR 1241 (21000): Operand should contain 1 column(s)". the code for the query looks like this: ``` SELECT P_SSN, Name, Blood_Type FROM PATIENT WHERE P_SSN IN (SELECT P_SSN, ID FROM BLOOD_POUCH ...
2014/12/01
[ "https://Stackoverflow.com/questions/27237162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2898592/" ]
You can use `EXISTS` to check: ``` IF EXISTS (SELECT * FROM [table]) BEGIN DELETE FROM [table] ---Or for fast delete use: TRUNCATE TABLE [table] END ELSE BEGIN PRINT 'nothing in table' END ```
``` IF (SELECT COUNT(*) FROM greek_organizations) > 0 BEGIN DELETE FROM greek_organizations END ```
59,893,070
I am trying to build an image using singularity. in one step I have to run a R script to do so, in the recipe file I need to install R and I did using the following command: ``` apt-get install -y systemd systemd-sysv gdebi-core procps libssl1.1 ed wget curl libqt5webkit5 libqt5core5a libxml2-dev r-cran-xml wget libss...
2020/01/24
[ "https://Stackoverflow.com/questions/59893070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10657934/" ]
There is a problem with `new`: your code depends on the concrete class. Thus changing/evolving the code is a more difficult task. A factory is much more manageable because (1) the user code is not dependant on the concrete type (2) the code that choose the concrete type is in a single place. Then the final code is muc...
There a design pattern called `Fluent interface`, which allows "chaining" of methods, see [Wikipedia](https://en.wikipedia.org/wiki/Fluent_interface#Java). It's supposed to very readable, imitating natural speech ("get x of y with z"). It's not especially *chaining* in your example (given it consists of only one metho...
77,298
I'm running sqlcmd from a batch file and I was wondering how to make it return an ERRORLEVEL other than 0 when something goes wrong with the backup.
2014/09/22
[ "https://dba.stackexchange.com/questions/77298", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/135/" ]
You should use the option -b in sqlcmd. -b Specifies that sqlcmd exits and returns a DOS ERRORLEVEL value when an error occurs. The value that is returned to the DOS ERRORLEVEL variable is 1 when the SQL Server error message has a severity level greater than 10; otherwise, the value returned is 0 <http://msdn.microso...
I solved this with this command ``` sqlcmd -V1 -m0 -r1 -S dbHost -U dbUser -P dbPass -Q "SELECT 1 FROM xxxxxxxxx" 1>nul ```
39,119,817
Im trying Laravel 5 and cant get Session working. Im inside a `Controller` and this is what ive done on an fresh setup and fresh controller: ``` \Request::session()->put('test', 'x'); var_dump(\Request::session()->get('test')); ``` This works as long as session is being written, and once you comment the first line t...
2016/08/24
[ "https://Stackoverflow.com/questions/39119817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1093486/" ]
Ok ive found the solution myself thanks to 2 posts: [Laravel 5 - session doesn't work](https://stackoverflow.com/questions/29346743/laravel-5-session-doesnt-work?rq=1) [Session not working in middleware Laravel 5](https://stackoverflow.com/questions/29797952/session-not-working-in-middleware-laravel-5?rq=1) --- 1. ...
if you are using 5.2, make sure your controller is governed by the 'web' middleware group either via the route ``` $route->group([ 'middleware' => ['web'] .... ``` or by instantiating it in your controllers construct method; ``` $this->middleware('web'); ```
13,355,107
I've overridden the CredentialsAuthProvider like so: ``` public override bool TryAuthenticate(IServiceBase authService, string userName, string password) { //TODO: Auth the user and return if valid login return true; } public override void OnAuthenticated(IServiceBase authServi...
2012/11/13
[ "https://Stackoverflow.com/questions/13355107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/403605/" ]
The different places where you can set the Url to redirect to during [ServiceStack Authentication](https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization), in order of precedence are: 1. The **Continue** QueryString, FormData or Request DTO variable when making the request to `/auth` 2. The...
mythz, Good call on making this OSS. :) You are correct regarding the order of precedence: 1. The Continue QueryString, FormData or Request DTO variable when making the request to /auth 2. The Session.ReferrerUrl Url The HTTP 3. Referer HTTP Header 4. The CallbackUrl in the AuthConfig of the current AuthProvider use...
18,229,279
I am facing problem in sending mail to my inbox (gmail account) but everytime it goes to spam folder. Here is the code snippet ``` //$ticketDetail is array which contain required information to send. sendOwnershipEmail('dineshnagarscriet@gmail.com', $ticketDetail); function sendOwnershipEmail($ema...
2013/08/14
[ "https://Stackoverflow.com/questions/18229279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2555207/" ]
### Try changing your headers to this: ``` $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "From: successive.testing@gmail.com" . "\r\n" . "Reply-To: successive.testing@gmail.com" . "\r\n" . "X-Mailer: PHP/" . phpversion(); ``` **For a few reas...
If you are sending this through your own mail server you might need to add a "Sender" header which will contain an email address of from your own domain. Gmail will probably be spamming the email because the FROM address is a gmail address but has not been sent from their own server.
25,831,334
This is my script ``` #include <stdio.h> #define PI 3.14; int main(void){ double hasil, input; printf("Enter a positive number : "); scanf("%lf",&input); hasil = PI * input; printf("\nThe result is : %lf",hasil); getchar(); return 0; } ``` I get error \* must be a pointer? What's it? I m...
2014/09/14
[ "https://Stackoverflow.com/questions/25831334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658777/" ]
Remove `;` from your `#define`, it should be `#define PI 3.14`
change the line to, ``` hasil = input * PI; ```
47,883,066
I am trying to use the **mat-paginator** for a table where I want to show data retrieved via an HTTP call, but the problem I have is that I cannot set the **length** of the paginator to the total number of the results I get from the API. In this example, the length is hardcoded in the component, but it shoudn't be a pr...
2017/12/19
[ "https://Stackoverflow.com/questions/47883066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5142554/" ]
Answer found here <https://github.com/angular/components/issues/10526> Just remove `this.tableDataSource.paginator = this.paginator;` and definition of paginator from ts.
I advise you to take a look at [the internationalization of the paginator](https://material.angular.io/components/paginator/overview#internationalization). I will save you the research time, here is how you do it : ```js import { MatPaginatorIntl } from '@angular/material'; export class MatPaginatorI18n extends MatPa...
101,485
Normally in principal component analysis (PCA) the first few PCs are used and the low variance PCs are dropped, as they do not explain much of the variation in the data. However, are there examples where the low variation PCs are useful (i.e. have use in the context of the data, have an intuitive explanation, etc.) an...
2014/06/07
[ "https://stats.stackexchange.com/questions/101485", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/46897/" ]
Here's a cool excerpt from [Jolliffe (1982)](http://automatica.dei.unipd.it/public/Schenato/PSC/2010_2011/gruppo4-Building_termo_identification/IdentificazioneTermodinamica20072008/Biblio/Articoli/PCR%20vecchio%2082.pdf) that I didn't include in my previous answer to the very similar question, "[Low variance components...
In [this talk](https://youtu.be/E4lg3aJFXpY?t=8m46s) ([slides](https://www.slideshare.net/databricks/needle-in-the-haystackuser-behavior-anomaly-detection-for-information-security-with-ping-yan-and-wei-deng/7)) the presenters discuss their use of PCA to discriminate between high variability and low variability features...
58,998,323
Im trying to use olingo with Flutter on Android. I set up my channel and I can call the library but I keep getting this message: ``` E/AndroidRuntime(28391): FATAL EXCEPTION: main E/AndroidRuntime(28391): Process: com.example.odata, PID: 28391 E/AndroidRuntime(28391): org.apache.olingo.client.api.http.HttpClientExcep...
2019/11/22
[ "https://Stackoverflow.com/questions/58998323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12417320/" ]
Thanks for the answer, this is the solution for anyone that may be interested: ``` public void onMethodCall(MethodCall call, Result result) { if (call.method.equals("getMetaData")) { class MetadataLoader extends AsyncTask<String , Integer, String> { @Override protected String doInBackground(S...
You will need to create a new Java thread or `Worker`. (Note that the "main" thread and the "UI" thread are the same thing - so by posting to the main looper you've ended up in the same place - trying to do network i/o on the main thread.) Yes, the Flutter engine is running in different threads, but you still need to ...
20,237,905
There is such a method which read a file and do something: ``` public void readFileAndDoSomething(File file) { InputStream inputStream = new FileInputStream(file); // a lot of complex code which reads the inputStream // and we don't know if the inputStream is closed or not } ``` Now I want to test the...
2013/11/27
[ "https://Stackoverflow.com/questions/20237905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342235/" ]
Try to use all uppercase `DATE`, like this: ``` <Property Name="BuildDate" Value="$(env.DATE)" /> ``` **UPDATE**: My initial guess was not correct - environment variables are case-insensitive when referenced this way. It seems like it depends on the type of the environment variable. There are standard environment v...
To set property value from another property use the following syntax: ``` <SetProperty Id="BuildDate" Value="[Date]" After="InstallInitialize" /> ```
10,038,755
I would like to contribute to PlayFramework 2.0. Building from the command line is really not the best way to work on this overcomplex language called Scala. It really needs an IDE to ease comprehension. ( btw see <http://zeroturnaround.com/blog/scala-sink-or-swim-part-2/> for more details on this topic) What is the ...
2012/04/06
[ "https://Stackoverflow.com/questions/10038755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258689/" ]
it is not all that difficult: ### get the source ``` git clone https://github.com/playframework/Play20.git ``` ### add IDEA plugin *to `framework/project/plugins.sbt`*: ``` resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/" addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0") ``` ### ge...
Today Idea, Eclipse and Ensime - all supports importing sbt project. So, it's up to you which one to choose. Looking through commits on [Play20/.gitignore](https://github.com/playframework/Play20/commits/master/.gitignore), [Ignore IntelliJ IDEA projects](https://github.com/playframework/Play20/commit/c13d666d919d2...
16,945,308
I want to remove the last revision (or last n revisions) from a repository. How to do it? Is it possible to remove the svn revision files from `project/db/revs/` and from `project/db/revprops/` ?
2013/06/05
[ "https://Stackoverflow.com/questions/16945308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1003575/" ]
I just tried to do exactly what you suggested in your question and it worked! First, you remove the last revision from `db/revprops` and `db/revs`. Then you also have to decrement the numbers in `db/current` and `db/txn-current` If any other developer already had checked out the last revision then they must check out...
Generally, removing a revision involves creating a new copy of the repository with the particular revision removed. If it's a small check-in, I'd say get the previous version, move those files to the side, get latest, then copy the previous files on top and check back in.
426,981
We need to prove that $$\dfrac{\sin\theta - \cos\theta + 1}{\sin\theta + \cos\theta - 1} = \frac 1{\sec\theta - \tan\theta}$$ I have tried and it gets confusing.
2013/06/22
[ "https://math.stackexchange.com/questions/426981", "https://math.stackexchange.com", "https://math.stackexchange.com/users/83528/" ]
$$\frac{\sin\theta -\cos\theta +1}{\sin\theta +\cos\theta -1}= \frac{1}{\sec\theta - \tan\theta}$$ By taking $$\mbox{L.H.S ( Left hand side )} = \frac{\sin\theta -\cos\theta +1}{\sin\theta +\cos\theta -1} = \frac{2\sin\frac{\theta}{2}\cos\frac{\theta}{2}+2\sin^2\frac{\theta}{2}}{2\sin\frac{\theta}{2}\cos\frac{\theta}{...
multiply numerator and denominator by $(1-\sin\theta)$. $$\dfrac {\sin\theta-\cos\theta+1}{\sin\theta+\cos\theta-1}\times \dfrac{1-\sin\theta}{1-\sin\theta}$$ $$\dfrac {\sin\theta-\sin^2\theta-\cos\theta+\sin\theta\cdot\cos\theta+1-\sin\theta}{(\sin\theta+\cos\theta-1)(1-\sin\theta)}$$ $$\dfrac {1-\sin^2\theta-\cos\the...
27,306,371
I've been through the various `reshape` questions but don't believe this iteration has been asked before. I am dealing with a data frame of 81K rows and 4188 variables. Variables 161:4188 are the measurements present as different variables. The `idvar` is in column 1. I want to repeat columns 1:160 and create new recor...
2014/12/04
[ "https://Stackoverflow.com/questions/27306371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3328804/" ]
Might be as easy as something like this: ``` dat2 <- cbind(dat[1:4], stack( dat[5:length(dat)] ) ```
I think this should work: ``` library(tidyr) newdf <- gather(yourdf, program, minutes, -PID:-VISITOR.CODE) ```
153,776
I am inside of... ``` public class bgchange : IMapServerDropDownBoxAction { void IServerAction.ServerAction(ToolbarItemInfo info) { Some code... ``` and after "some code" I want to trigger ``` [WebMethod] public static void DoSome() { } ``` Which triggers some javascript. Is this possible? Ok, swit...
2008/09/30
[ "https://Stackoverflow.com/questions/153776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5234/" ]
You cannot call methods within a browser directly from the server. You can, however, add javascript functions to the response that will execute methods within the browser. Within the ServerAction method, do the following ``` string script = "<script language='javascript'>\n"; script += "javascriptFunctionHere();\n"; ...
hmmm... the question changed dramatically since my original answer. Now I think the answer is no. But I might be wrong.
11,307,649
Regrettably there is no way to specify a timeout when using a regular expression on a String in Java. So if you have no strict control over what patterns get applied to which input, you might end up having threads that consume a lot of CPU while endlessly trying to match (not so well designed) patterns to (malicious?) ...
2012/07/03
[ "https://Stackoverflow.com/questions/11307649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1498022/" ]
You can use Thread.stop() if you determine its the only solution available to you. You may need to shutdown and restart your applicaton to ensure its in a good state. Note: a Thread can capture and ignore `ThreadDeath` so stop isn't guarenteed to stop all threads. An alternative way to stop a thread is to run it in ...
If you specifically design your thread code to not hold locks etc., (yes, and this includes the non-explicit locks. eg. a malloc lock that may be used when changing string sizes), then stop the thread, yes. Polling an 'interrupted' flag is fine, except that it means polling an 'interrupted' flag, ie. overhead during th...
65,541,515
The main question is how to remove the "Label" namespace in the graphic if I have a count plot of three dataset files? I am using the Seaborn module. ``` #Importing the libraries import pandas as pd import numpy as np import seaborn as sb #Reading the files train_filename = 'train.csv' test_filename = 'test.csv' ...
2021/01/02
[ "https://Stackoverflow.com/questions/65541515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12963012/" ]
Create a new column `X4` that is the composition you want. ``` d={ 'id' :[1,2,3,4,5], 'X1':[25,12,3,7,1], 'X2':[3,45,3,1,6], 'X3':[6,23,9,3,2] } df=pd.DataFrame(d, columns=['id','X1','X2','X3']) df = df.assign(X4=lambda dfa: "X1:" + dfa["X1"].astype("string") + ",X2:" + dfa['X2'].astype("stri...
A different general approach: ``` def get_other_cols_vals(df1): vals = [] for i_enm, col in enumerate(df1.columns): vals.append(f"{col}:{df1.iloc[0, i_enm]}") return ",".join(vals) df['X4'] = df.groupby(df.index)[df.columns.drop('id').values].apply(get_other_cols_vals) ``` [![enter image descrip...
2,833,805
What does address operator mean. say in the method below. what should be passed in the method as parameter value of integer or the address of an integer variable. ``` void func1(int&)// method declaration void func1(int& inNumber)//method definition { //some code } ```
2010/05/14
[ "https://Stackoverflow.com/questions/2833805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276989/" ]
There is no address-of operator in your code - the ampersand is being used to declare a reference. Which C++ text book are you using that does not cover this?
its called as reference in c++ <http://en.wikipedia.org/wiki/Reference_(C%2B%2B)>
32,211,504
**Relevant code:** ``` add_action( 'wp_ajax_proj_update', 'proj_update' ); function proj_update ( ) { $id = $_POST['id']; $compname = $_POST['compname']; $projname = $_POST['projname']; $imageurl = $_POST['imageurl']; $sumsmall = $_POST['sumsmall']; $sumfull = $_POST['sumfull']; $results ...
2015/08/25
[ "https://Stackoverflow.com/questions/32211504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is because of the lack of permission to the user aseema in hdfs. Follow the steps below. Login as hduser and perform the following operations (from the logs, it seems hduser is a superuser) ``` hadoop fs -mkdir -p /user/hive/warehouse hadoop fs -mkdir /tmp hadoop fs -chmod -R 777 /user/hive hadoop fs -chmod 777 ...
If you are running from Local Mode then you should run this command from hdfs user: ``` su hdfs ``` Then change the permission like below if you want: ``` hdfs dfs -chown -R <username_of_new_owner> /user ```
35,348
My understanding is that Venus, Earth, Mars, and Jupiter are all losing mass due to their gravity, temperature, and the solar wind. But what about Mercury, Saturn, Uranus, and Neptune? Mercury has a magnetic field and so typically would repeal the worst of the solar wind and no atmosphere to lose, only an exosphere. Th...
2020/02/28
[ "https://astronomy.stackexchange.com/questions/35348", "https://astronomy.stackexchange.com", "https://astronomy.stackexchange.com/users/17272/" ]
I'm not sure how the balance between mass loss and gain works out... Yes, atmospheric escape is probably happening to some extent on all the planets, with rates that depend on escape velocity, magnetic field, atmospheric/exospheric composition, temperature, and other effects we are still learning about. But the plane...
Anything that's working, spending energy is losing mass, Einstein Mass-energy equivalence of SR along with radiant energy(electromagnetic and gravitational radiation) would be effecting all the planets, but at a different rate for each one. <https://en.m.wikipedia.org/wiki/Radiant_energy> And. <https://en.m.wikiped...
17,653,112
I have a popup on my website for some registration. When this popup opens on a phone, it is to high for the browser view port, and some of the content comes outside it. ![illustration of the problem](https://i.stack.imgur.com/wahr6.png) When I try to scroll down, it scroll the background. If I lock the background wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17653112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1211119/" ]
You can use `media` types to write CSS rules for mobile devices, tablets, etc. for example if you want the ability of scroll in you modal content you can do something like: ``` @media (max-width: 767px) { .modal-content { overflow-y: scroll; } } ```
This will display a vertical scrollbar if the container exceeds the viewport height: ``` .some-modal { maxHeight: 100vh; overflowY: 'auto'; overscrollBehavior: 'contain'; /* <-- nice to have but not required */ } ```
27,659,211
I need to insert a variable inside a jQuery selector like this example, how can I fix my problem? ``` var index = 5; $(".tables li:nth-child('+index+')").addClass('vr_active'); ```
2014/12/26
[ "https://Stackoverflow.com/questions/27659211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2678346/" ]
The issue is in the quotes ... ``` var index = 5; $(".tables li:nth-child("+index+")").addClass('vr_active'); ``` This way, the index variable is part of a concatenation of: * ".tables li:nth-child(" ... a string * index ... a variable * ")" ... a string. Functioning **[jsFiddle](http://jsfiddle.net/rfornal/pv91Le...
**A jQuery selector is just a string.** So your problem is actually "How to insert a variable into a string" and this can be done in a myriad of ways, for example: ``` ".tables li:nth-child(" + index + ")" ``` ``` var selector = ".tables li:nth-child(${index})"; selector = selector.replace("${index}", index); ``` ...
1,226,730
I am working on a continuous integration system for both .Net and VB6 applications using Subversion, CruiseControl, NAnt and Ivy. The .Net side of things isn't too much of a problem, but I need a little guidance with the VB6 side of things, more from the 'DLL-hell' side of things! My current set-up is getting all dep...
2009/08/04
[ "https://Stackoverflow.com/questions/1226730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/114805/" ]
We keep project references in separate REF files next to our VBP files and we are using custom tool to "fix" VBPs during compile. Our build process is greatly inspired by [this page (The Way We Work)](http://users.skynet.be/wvdd2/Compiling/The_Way_we_Work/the_way_we_work.html) and our REF files are direct rip-off of th...
I have found the answer to this myself; Instead of using Ivy to try to generate a list of dependencies for me on-demand, I thought I'd use the file-system to give me that same list, as Ivy has done it's job in resolving the dependencies for me, resulting in a 'lib' folder full of .dll files... All I have done, is ge...
566,065
In my biological study, **I have around 14000 independent samples**, and I study the evolution of a response variable over time. I have three groups to study. Thus, I have two factors: factor "Group" (with three levels: CTRL, VC1, VC2) and a factor "Time" (with three levels: T0, T1, T2): I have a total of 3\*3 = 9 con...
2022/02/28
[ "https://stats.stackexchange.com/questions/566065", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/203934/" ]
If you want to specify an amount that is "too small to be interesting", *and* you want a metric that will give you a metric similar to a p-value, you could do an [equivalence test](https://en.wikipedia.org/wiki/Equivalence_test), i.e. you could do a test of whether $|\beta|<0.1$ (if that is your threshold of "interesti...
You have an impression that your p-values are exaggerated. This might occur in several situations. * It can be that the data points are not entirely independent. (you say they are independent and it might be a good assumption, but if you are measuring small differences, then a small amount of dependence might become ...
38,737,955
``` import nltk import random from nltk.corpus import movie_reviews documents=[(list(movie_reviews.words(fileid)),category) for category in movie_reviews.categories() for fileid in movie_reviews.fileids(category)] random.shuffle(documents) #print(documents[1]) all_words=[] for w in movie_revie...
2016/08/03
[ "https://Stackoverflow.com/questions/38737955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5842544/" ]
Only change that needs to be made is that `features` must be initialized to a `dict` (`{}`) rather than a `list` (`[]`) and then you could populate it's contents. The `TypeError` was because `word_features` is a list of *strings* which you were trying to index using a list and lists can't have string indices. ``` fe...
You have tried to index a list `features` with a string and it is not possible with python. **List indices can only be integers**. What you need is a `dictionary`. Try using a `defaultdict` meaning that even if a key is not found in the dictionary, instead of a `KeyError` being thrown, a new entry is created ``` fro...
2,116
I am a newbie to Python and have started object-oriented programming recently. I have implemented a "Rock Paper Scissors" application in OOP. I would like for you to evaluate my code, and tell me where can I improve my code and how I can better organize the functionality. ``` import random class RockPaperScissors(obj...
2011/04/26
[ "https://codereview.stackexchange.com/questions/2116", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/3873/" ]
Your random function: ``` def __getRandomValue(self,max): val = random.randint(1,max) return self.getValueFromList(val-1) ``` 1. You only ever call this function with max = 3, since thats the only sensible argument just assume that and don't make the caller pass it 2. You pick a random value between 1 and ma...
It would be more pythonic to use properties (or public fields if you don't need any special getter/setter logic) instead of getter/setter methods.
2,432,596
I'm trying to execute a copy of the Perl interpreter using Java's Runtime.exec(). However, it returned error code `9`. After running the file a few times, the `perl` interpreter mysteriously started to return code 253 with no changes in my command at all. What does code `253` / code `9` mean? A Google search for `perl...
2010/03/12
[ "https://Stackoverflow.com/questions/2432596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69783/" ]
The perl interpreter actually *does* return exit codes of its own if the script doesn't run. Most syntax errors lead to exit code 9: Unknown function / disallowed bareword: ``` perl -e 'use strict; print scalar(localtime); schei;' ``` $? = 9 division by zero: ``` perl -e 'use strict; print scalar(localtime); my $...
Perl itself doesn't have any defined exit codes; unless the perl interpreter crashes in a really horrific way, the exit code is determined by the program that `perl` is running, not by `perl` itself.
76,558
First of all, I'm not sure about the title of this question, so please correct me if there is any title more sensible than mine. The problem is the following: I have a function f that checks if a variable as a value. For that, I need to pass the argument "by reference" that is I set HoldAll to f. ``` f[var_] := ValueQ...
2015/03/05
[ "https://mathematica.stackexchange.com/questions/76558", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/8565/" ]
The two standard approaches to this problem, [`Unevaluated`](http://reference.wolfram.com/language/ref/Unevaluated.html) and [`Listable`](http://reference.wolfram.com/language/ref/Listable.html), have already been posted. If you need a different kind of evaluation control please consider my original method:[(1)](https...
you can change the attribute of Map: ``` Clear[f] f[var_] := ValueQ[var] SetAttributes[f, HoldAll] SetAttributes[Map, HoldAll] {x, y, z} = {1, 2, 3}; Map[f, {x, y, z, k}] (*{True, True, True, False}*) ```
6,106,695
I have a Wix solution to install an application. When attempting to uninstall the application from control panel while it is running, a popup is appearing to close the application before continue. The issues is the message showing in that popup which is suppose to be an uninstall message instead of install message. T...
2011/05/24
[ "https://Stackoverflow.com/questions/6106695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/724789/" ]
Take a look at the [Identifying app installations](http://android-developers.blogspot.com/2011/03/identifying-app-installations.html) article. You can't rely on `ANDROID_ID`. The best solution is to generate a custom id with: ``` String id = UUID.randomUUID().toString(); ```
If you want to create one with the same format as real `ANDROID_ID`s, you can use the same method they use [here](https://github.com/CyanogenMod/android_frameworks_base/blob/81ed751a1dcf1e7c722db2cdded38bef4308a1c5/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java#L216): ``` private st...
29,918,351
I was asked a question > > You are given a list of characters, a score associated with each character and a dictionary of valid words ( say normal English dictionary ). you have to form a word out of the character list such that the score is maximum and the word is valid. > > > I could think of a solution involvi...
2015/04/28
[ "https://Stackoverflow.com/questions/29918351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3966664/" ]
If the number of dictionary entries is relatively small (up to a few million) you can use brute force: For each word, create a 32 bit mask. Preprocess the data: Set one bit if the letter a/b/c/.../z is used. For the six most common English characters etaoin set another bit if the letter is used twice. Create a simila...
Can we assume that the dictionary is fixed and the score are fixed and that only the letters available will change (as in scrabble) ? Otherwise, I think there is no better than looking up each word of the dictionnary as previously suggested. So let's assume that we are in this setting. Pick an order < that respects th...
16,702,672
IMO, this query should return `A=1,B=2,` ``` SELECT regexp_substr('A=1,B=2,C=3,', '.*B=.*?,') as A_and_B FROM dual ``` But it returns the whole string, `A=1,B=2,C=3,`, instead. Why? --- **Update 1:** Oracle 10.2+ is required to use Perl-style metacharacters in regular expressions. **Update 2:** A more clear for...
2013/05/22
[ "https://Stackoverflow.com/questions/16702672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1847592/" ]
It's a BUG! =========== You are right that in Perl, `'A=1,B=2,C=3,' =~ /.*B=.*?,/; print $&` prints `A=1,B=2,` What you have stumbled upon is a bug that still exists in Oracle Database 11g R2. If the exact same regular expression atom (including the quantifier but excluding the greediness modifier) appears twice in a...
Because you're selecting too much: ``` SELECT regexp_substr( 'A=1,B=2,C=3,', '.*?B=.*?,' ) as A_and_B, -- Now works as expected regexp_substr( 'A=1,B=2,C=3,', 'B=.*?,' ) as B_only -- works just fine FROM dual ``` SQL Fiddle: <http://www.sqlfiddle.com/#!4/d41d8/11450>
6,822,970
I meet a headache problem. there are too many Quotation marks in my code make me headache. I tried both of these method, but all the way are make links broken. I cheked it in `chrome`, In `elements`, I find the source code like what I add after `print($link);`. How to solve the problem? Thanks. ``` $str = 'I\'m ver...
2011/07/25
[ "https://Stackoverflow.com/questions/6822970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/783396/" ]
There is an alternate form of Throwable.printStackTrace() that takes a print stream as an argument. <http://download.oracle.com/javase/6/docs/api/java/lang/Throwable.html#printStackTrace(java.io.PrintStream)> E.g. ``` catch(Exception e) { e.printStackTrace(System.out); } ``` This will print the stack trace to s...
If you are interested in a more compact stack trace with more information (package detail) that looks like: ``` java.net.SocketTimeoutException:Receive timed out at j.n.PlainDatagramSocketImpl.receive0(Native Method)[na:1.8.0_151] at j.n.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl...
38,563,317
I'm trying to make a search fragment similar to the one in the Play Store: [![Google Play Store](https://i.stack.imgur.com/AG5KD.png)](https://i.stack.imgur.com/AG5KD.png) My `AppBarLayout` has a `CardView` in it, and the background is set to transparent: ``` <android.support.design.widget.CoordinatorLayout andr...
2016/07/25
[ "https://Stackoverflow.com/questions/38563317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1490484/" ]
The same problem happened to me and at this point it has nothing to do with the transparency of the `AppBarLayout`. But the `AppBarLayout` pushes the content of your `NestedScrollView` below itself when fading in. You can solve this by 1. moving your `NestedScrollView` up and behind the `AppBarLayout` and 2. adding...
Try putting the CardView into a FrameLayout with `match_parent` dimensions, so that the CardView has the space around it. I'm not 100% confident that it will work, but it's worth trying.
8,661,559
I have this code: ``` import java.util.Scanner; public class Example { public static void main(String[] args) { Scanner input = new Scanner(System.in); String answer = input.nextLine(); if(answer == "yes"){ System.out.println("Yea I programmed this right!"); }else{ System.out.printl...
2011/12/28
[ "https://Stackoverflow.com/questions/8661559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/924378/" ]
``` if(answer == "yes"){ ``` should be ``` if("yes".equals(answer)){ ``` (`==` is not correct for `String` equality, and we handle the case where `answer` is null)
import java.util.Scanner; public class Example { public static void main(String[] args) { ``` Scanner input = new Scanner(System.in); String answer = input.nextLine(); /*Edit your next line as mine,u'll get the correct ans...*/ if("yes".equals(answer)){ System.out.println("Yea I programmed this right!"); }else...
19,499,096
I have a bunch of subfolders and I want to put them in the drawable folder so that I can support all screens is there another way I can do it because I read that you cant put subfolder but I want to support all screens
2013/10/21
[ "https://Stackoverflow.com/questions/19499096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1975060/" ]
You don't need subfolders in the drawable folder but different drawable-folders. Such as: drawable-hdpi drawable-xhdpi drawable-mdpi and have a look at the documentation in @Raghunandan's comment!
No sub-folders is required at all for supporting in all screen sizes. Just put your data's (images, icons etc.) on the default drawable folders [drwable-hdpi,drwable-ldpi,drwable-mdpi.. ].And don't forget to keep required sizes of the images,icons for different screens. For more details please follow this [link](http:/...
27,385,506
Can someone help me confirm the default port when using ftplib.FTP\_TLS? We have opened port 990 and 21 but my script fails to connect. ``` import ftplib session = ftplib.FTP_TLS('xxx.ftp.com','user','password') file = open('Bkup.tar.gz','rb') session.storbinary('STOR Bkup.tar.gz', file) file.close() session.quit() ...
2014/12/09
[ "https://Stackoverflow.com/questions/27385506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2565554/" ]
Please don't modify the port directly. If you get a closer look at `FTP_TLS` super `__init__` you can clearly see that if it's called with a host param `connect` gets automatically called with just the host as param so the port defaults to `FTP_PORT` which is 21. A better approach would be to call `FTP_TLS` without an...
Oddly, the [FTP\_TLS](https://docs.python.org/3/library/ftplib.html#ftplib.FTP_TLS) object has no direct port parameter on the constructor like the [FTP](https://docs.python.org/3/library/ftplib.html#ftp-objects) object does. you can set the port prior to calling the constructor and that works. ``` ftplib.FTP_TLS.por...
1,073,488
I have an Excel workbook which is used to produce quotations for customers. It automatically generates a unique quotation number based on the salesperson's name, the name of the company receiving the quotation, the date, and the issue number (if two separate quotations are being made by the same salesperson, for the sa...
2016/05/05
[ "https://superuser.com/questions/1073488", "https://superuser.com", "https://superuser.com/users/565490/" ]
Resetting the Bash Subsystem is pretty easy. To uninstall it fully, use the following command: ``` lxrun /uninstall /full ``` To reinstall it, use this command: ``` lxrun /install ``` This will re-download it from the Windows Store - it is not that large and you will get a completely fresh copy. If you really scr...
Starting with the Windows 10 Fall Creators Update, you must use `wslconfig` (instead of `lxrun`) to manage the WSL distributions. You can [read the documentation from Microsoft](https://docs.microsoft.com/es-es/windows/wsl/wsl-config#managing-multiple-linux-distributions). Note that you can install multiple linux dist...
7,511,216
In my app i have 3 activities. From 1st activity it goes to 2nd and from 2nd it goes to 3rd. From 3rd it is coming to 1st again. and if I press back key from the 1st then it should go to home screen (App will stop). If I press back key of 1st its goes to 2nd activity again and if I press 2nd's back key, then it goes t...
2011/09/22
[ "https://Stackoverflow.com/questions/7511216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1147007/" ]
When you start your third activity you should call in your 2nd acitivity like this: `startActivityForResult(intent, 0)` When you finish your 3rd activity, you should include: ``` setResult(RESULT_OK); finish(); ``` It sends a signal from the 3rd activity to the 2nd. In the 2nd put: ``` protected void onActivity...
Using this way: In your first activity, declare one Activity object like this, ``` public static Activity fa; onCreate() { fa = this; } ``` now use that object in another Activity to finish first-activity like this, ``` onCreate() { FirstActivity.fa.finish(); } ``` More information : [Finish an activity f...
37,523
On rare occasions, you are in a situation where a simple *Thank You* seems like you're undermining the other person's help. You know, instances where you are too grateful to express your feelings of gratitude. When this happens face to face (or even over the phone) your body language/voice carry that feeling and the ot...
2011/08/10
[ "https://english.stackexchange.com/questions/37523", "https://english.stackexchange.com", "https://english.stackexchange.com/users/11714/" ]
You could use "Many thanks". This would sound weird in person, though. Also, emphasizing with another sentence would work: "Thank you. I genuinely appreciate it."
To literally use a superlative (in the grammatical more/most big/bigger/biggest sense), you could say: > > **I am most grateful.** > > > From the acknowledgements of R. W. G. Hunt's *Measuring Color:* (2011) > > I am most grateful to Dr M. R. Pointer of Kodak Limited for kindly making many helpful comments on t...
39,083
Suppose a bond has annual coupon of \$1 and face value of \$100 and matures in two years. If recovery rate is $50\%$ and the bond defaults before the first coupon payment. How should we receive the recovery? Is it \$50 at year 2 or \$0.5 at year 1 and \$100.5 at year 2?
2018/03/30
[ "https://quant.stackexchange.com/questions/39083", "https://quant.stackexchange.com", "https://quant.stackexchange.com/users/33550/" ]
There are at least two ways of doing it: 1) Resampling them to their median frequency. 2) Build one ML model for each data type, then combine the 4 different forecasts into a single meta-ML model. (Courtesy: MARCOS LO´PEZ DE PRADO)
Consider investigating the MIDAS approach of incorporating signals with different frequencies. The classical apporach is to create a signal based on each source and tune it to your trading/rebalancing frequency. Convert this signal to an alpha based on Grinold and Khan, then add the alphas together.
72,247
In the finale to Doctor Who's 8th series, *Death in Heaven*, > > where did the newly created Cybermen's armour come from? I mean, they rose from their graves already fully suited up. Not to mention the fuel to drive their thrusters! > > > I was hoping this would be mentioned, at least in passing, but everybody t...
2014/11/09
[ "https://scifi.stackexchange.com/questions/72247", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/4495/" ]
The Doctor stated (at 18:20 for those of you with access to IPlayer) that the rain was actually 'cyber-pollen'. > > It wasn't rain, man-scout, it was pollen. Cyber-pollen. > Every tiny particle of a cyberman contains the plans to make another cyberman > > > Combine that with the dimensionally trancendental techn...
I had noticed that the 'water' was flowing uphill so the contact in the morgue would be related to that same gravity defeating nanotechnology, the increase in mass however and the sourcing of metals from the environment rather stretches credibility.
12,709,811
Hello I would like to slightly modify the below script so that it outputs the response to a div rather than a alert see bold section. Any help appreciated! ``` function processResponse() { if (gateway.readyState == 4 && gateway.status == 200) { alert("Done loading!\n\nThe response from the PHP script was: ...
2012/10/03
[ "https://Stackoverflow.com/questions/12709811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1717236/" ]
if the div has an id try something like this: ``` document.getElementById("divId").innerHTML = gateway.responseText; ```
``` function processResponse() { if (gateway.readyState == 4 && gateway.status == 200) { document.getElementById("yourDiv").innerHTML = "php script was : " + gateway.responseText; } } ``` or if using jquery ``` function processResponse() { if (gateway.readyState == 4 && gateway.status == 200) ...
48,386,263
how do I pivot a results query? currently it looks like this ``` Hours | Volume 8 | 1000 9 | 1012 10 | 1045 11 | 1598 12 | 1145 13 | 1147 ``` into this ``` 8 |9 |10 |11 |12 |13 1000|1012|1045|1598|1145|1147 ``` I tried the following but its not working ``` Select #TEMP.volume, ...
2018/01/22
[ "https://Stackoverflow.com/questions/48386263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7345871/" ]
This assumes you are working with **SQL Server** , then it is always better to use dynamic **PIVOT** approach ``` declare @col nvarchar(max), @query nvarchar(max) select @col = stuff( (select ','+quotename(Hours) from #tm for xml path('')), 1,1, '') set @query = N'sele...
It is always good to use pivot query in addition to an ID column , to simplify u can get result set this way ``` WITH cte AS ( SELECT * FROM #TEMP PIVOT(max(volume) FOR [DialHour] IN ( "8" ,"9" ,"10" ,"11" ,"12" ...
86,066
Is explaining consciousness in the realm of physics? **Detailed question:** We know that consciousness exists. Or rather, I know that I have it. The rest of you may not be conscious, but I know that I am, so it exists. Since it's the job of physics to explain everything in the universe (even indirectly), I feel that ...
2021/09/21
[ "https://philosophy.stackexchange.com/questions/86066", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/56069/" ]
In seeking to describe the 'truths of nature', natural philosophy that focused on *physika*, 'the natural things', came to mean explicitly not animals (biology) or minds (philosophy). But physics has been on a journey of unification, which is better thought of as having arrived at the power of the 'languages' of energy...
If physics wants to explain consciousness, then it would ultimately need to discover possible measurable properties. In my mind, this comes down to finding those attributes of consciousness that may or may not happen to be exactly (or at least approximately) identical for every individual. Unfortunately, we currently...
37,815,601
I have the following entities that i want my web service to pass as jsons ``` @Entity(name = "tests") public class Test { @Id @GeneratedValue private int id; @Column(name = "test_name") private String name; @JoinColumn(name = "test_id") @OneToMany(cascade = CascadeType.REMOVE) privat...
2016/06/14
[ "https://Stackoverflow.com/questions/37815601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3852459/" ]
``` @JsonInclude(JsonInclude.Include.NON_EMPTY) ``` NON\_EMPTY makes include only non null fields and not empty collection type fields.
You have to configure your mapper to ignore empty arrays: ``` ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.WRITE_EMPTY_JSON_ARRAYS, false); ``` To ignore a specific property, the `com.fasterxml.jackson.annotation.JsonIgnore` annotation should do: ``` @JsonIgnore @JoinColumn(name =...
20,175,626
I need a program, that checks input number with latest input, and if it's true - show how many numbers were inputed (with latest 2 same); Example: Input: 3 5 24 4 3 5 3 5 3 5 5 Output: 11 ``` #include <iostream> using namespace std; int main() { int nr, am, last; cin >> nr; last = nr; am = 1; w...
2013/11/24
[ "https://Stackoverflow.com/questions/20175626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3027389/" ]
In the while guard last != nr is never true, because you read from cin first and then update last. This two statements should be switched, also initialize last with (for example) -1, so the while loop is entered the first time. initialize last: ``` last = -1; ``` in your while: ``` last = nr; cin >> nr; ```
You never enter your while loop, because you're assigning `nr` to `last` just before your test: ``` last = nr; // ... while (nr != last){ // ... } ``` `while` condition is evaluated **before** entering the loop.
162
So far on writers.SE we've had a few questions asking for examples of published works that show how to do something well. For example * [Examples for books that don't use (traditional) chapters](https://writers.stackexchange.com/questions/976/examples-for-books-that-dont-use-traditional-chapters) * [Story for children...
2010/12/21
[ "https://writers.meta.stackexchange.com/questions/162", "https://writers.meta.stackexchange.com", "https://writers.meta.stackexchange.com/users/20/" ]
This might be a bit of an odd one, but how about something with [Writing Excuses](http://www.writingexcuses.com/)? It's probably the most popular writing podcast out there, so if we can get a plug on it we'll get a lot of coverage. Even better would be if we could get the hosts to contribute to the site.
The following is a *Community Wiki* answer for the purposes of drafting a common e-mail or letter that we can use when contacting others. It is there to be edited as well as used, so please go ahead and modify it. When you are contacting people, if you already have a relationship with someone you may want to eschew the...
211,722
I want to delete an array of elements from another one, `DeleteCases` seems to be an option, but the problem is that it deletes an element more than once if available, I do not want this. I want to delete any element as many times as available in second list. For example `DeleteCases[{1, 1, 2, 3}, Alternatives@@{1, 2}...
2019/12/20
[ "https://mathematica.stackexchange.com/questions/211722", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/49535/" ]
You can use the [`ResourceFunction`](http://reference.wolfram.com/language/ref/ResourceFunction) [MultisetComplement](https://resources.wolframcloud.com/FunctionRepository/resources/MultisetComplement) to do this: ``` ResourceFunction["MultisetComplement"][{1, 1, 2, 3}, {1, 2}] ``` > > {1, 3} > > >
Another approach is to use explicit iterators in `Condition`: ``` Module[{n=1,k=1}, Replace[{1, 1, 2, 3, 2}, {1 :> Nothing/; n++ == 1, 2 :> Nothing/; k++ == 1},{1}]] ``` > > > ``` > {1, 3, 2} > > ``` > >
59,119,158
*Hello,* I'm trying to make an algorithm with pulp to resolve a JOB SEQUENCING problem. I know that it is not the best way to use a MIP solver to resolve JOB SEQUENCING, however it's just for training. But my code it's not good and doesn't produce the good solution(full 0). So if someone helpful can have a look. Than...
2019/11/30
[ "https://Stackoverflow.com/questions/59119158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12283022/" ]
Try with the default `.htaccess` and check. ``` # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress ```
I solve the above issue by updating xyz.com.conf file with below codes: ``` <Directory /var/www/html/wordpress> Require all granted RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </Directory> <Virtu...
52,773,056
I have a Problem with my code.I want to get all Cells and to put These in an Array but it didnt work. Runtime Error 13. Range -> Array ``` For z = 0 To 3 Worksheets(Tabellen(z)).Select AnzahlZellen = Application.WorksheetFunction.CountA(Range("A:A")) For n = 1 To AnzahlZellen 'Worksheets(Tabellen(z)).Sel...
2018/10/12
[ "https://Stackoverflow.com/questions/52773056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10489030/" ]
In this case you could build a one-dimensioal array like that ``` Dim vDat as variant Dim rg as range Set rg = Range("A1:A" & AnzahlZellen) vDat = WorksheetFunction.Transpose((rg)) ``` In this way you can easily read from a range of cells to an array. You can also write from an array to a range of cells. Usually you...
It looks like you are trying to store 4 worksheets' column A values into a single 1-D array, ``` dim i as long, n as long, z as long, tmp as variant for z=lbound(Tabellen) to ubound(Tabellen) with Worksheets(Tabellen(z)) if z=lbound(Tabellen) then InhaltsArray = application.transpose(.range(....
33,323,412
I am am trying to configure a magento store . I have a couple of ghost products that appear on the Front end. These Ghost products have no name, no image , and aren't found under my back-end product list. However their add to button is active and works and also has a wishlist URL in the form of. ``` example.com/wishli...
2015/10/24
[ "https://Stackoverflow.com/questions/33323412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5361888/" ]
Indeed, consider the Muenchian Grouping especially as keys are needed to align figures for group summing. ``` <xsl:key name="taxgrp" match="bus:VoPaidTax" use="concat(bus:TaxCode, bus:TaxRate)" /> <xsl:template match="bus:TaxList"> <bus:TaxList> <xsl:for-each select="bus:VoPaidTax[generate-id() ...
``` <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <xsl:key name="taxgrp" match="bus:VoPaidTax" use="concat(generate-id(..),bus:TaxCode, bus:TaxRate)" /> <xsl:template match="bus:BsAddOrderPaymentRequestPayload/bus:Request/bus:TotalPai...
2,084,979
By using the formula : $$ \cos(A)+\cos(B)+\cos(C) = 1 + 4 \sin\left(\frac{A}{2}\right)\sin\left(\frac{B}{2}\right) \sin\left(\frac{C}{2}\right) $$ I've managed to simplify it to : $$ 2\sin\left(\frac{A}{2}\right)\sin\left(\frac{B}{2}\right)=\sin\left(\frac{C}{2}\right)$$ But I have no idea how to proceed.
2017/01/05
[ "https://math.stackexchange.com/questions/2084979", "https://math.stackexchange.com", "https://math.stackexchange.com/users/397349/" ]
using $$\cos(\alpha)=\frac{b^2+c^2-a^2}{2bc}$$ and so on and plugging these equations in your equation and factorizing we get $$-1/2\,{\frac { \left( c+a-b \right) \left( -c+a-b \right) \left( -2 \,c+a+b \right) }{bca}} =0$$ can you proceed?
From : $$ \cos(A)+\cos(B)+2\cos(C)=2 \\ \implies \cos(A)+\cos(B)=2-2\cos(C) \\ \implies \cos(A)+\cos(B)=2[1-\cos(C)] \\ \\\implies \cos(A)+\cos(B)=4\sin^2\left(\frac{C}{2}\right) $$ Using Prosthaphaeresis Formulas : $$ \cos A+\cos B=2\cos\dfrac{A+B}2\cos\dfrac{A-B}2 $$ And substituting this formula in the first equ...
278,758
a person is always lying about where he is going to be or what he is going to be doing. So, when he tells me something, I don't believe him anymore. What is a word that describes me?
2015/10/08
[ "https://english.stackexchange.com/questions/278758", "https://english.stackexchange.com", "https://english.stackexchange.com/users/141855/" ]
**skeptical.** From the freedictionary.com skep·ti·cal also scep·ti·cal (skĕp′tĭ-kəl) adj. 1. Marked by or given to doubt; questioning: skeptical of political promises. 2. Relating to or characteristic of skeptics or skepticism. skep′ti·cal·ly adv.
There are a number of possibilities. **Dismissive** describes your reaction to his statements. **Incredulous** "unwilling or unable to believe something" is a good start, but the lack of belief could be caused by any number of reasons. **Profoundly mistrusting** would describe your mental state, although it is two w...
267,045
I started out with a generic interface called ILogin. The interfaces requires that you implement two properties: UserID and Password. I have many login-type classes that implement this interface. As my project grew and grew, I found that many classes repeated the UserID and Password code. Now I decide that I need a bas...
2008/11/05
[ "https://Stackoverflow.com/questions/267045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132931/" ]
If your abstract class is the *only* class that will ever implement the interface, then you can always just check for instances of the abstract class, you don't need the interface. But if you want to be future-compatible with new classes not yet written which will not extend the abstract class but could use the interfa...
Assuming you are asking specifically when the interface and the abstract class have identical signatures ... ... (If the members of the Interface are different in any way from the members of the abstract class then of course the answer is yes, there may be a need for both) ... but assuming the members are identical,...
28,391,733
This concerns "a software algorithm" from <https://stackoverflow.com/help/on-topic>, in this case the quicksort sorting algorithm This is a practice coding question(non competition) from <https://www.hackerrank.com/challenges/quicksort1> Basically you're supposed to take in a list, say ``` 4 5 3 7 2 ``` and part...
2015/02/08
[ "https://Stackoverflow.com/questions/28391733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3761297/" ]
WIthin a batch file, the metavariable (loop-control variable) requires the `%` to be doubled, so replace each `%f` with `%%f` when you mean `the loop-control variable`"f"`
Your code seems fine. The issue is, that when you run it inside a batch file, you need to put an extra % mark. In the batch try: ``` for /f "tokens=*" %%f in ('dir /b *.DAT') do "c:\Program Files\7-Zip\7z.exe" a "%%f.7z" "%%f" ```
20,951
Every automatic transmission car I've driven (not sure if all do this) allow you to shift from Reverse to Neutral and from Neutral to Drive (and therefore Reverse all the way to Drive) without pressing the brake or hitting the little shift lock on the gear selector. However, it doesn't let you go the opposite direction...
2015/09/08
[ "https://mechanics.stackexchange.com/questions/20951", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/12124/" ]
I don't have reference for this, but believe the reason for the positive lockout going from drive to reverse is so you don't *accidentally* shift from drive to reverse while at speed. Can you imagine going 60 mph down the road and dropping it from drive into reverse? You can expect catastrophic consequences for your tr...
The answer is simpler then you might think. You are allowed to pull the gear shifter into neutral regardless of where it is pulled from to disengage the transmission. This is for safety, to be able to stop a runaway car regardless of if it's in drive or reverse. The ability to pull the car into drive from neutral com...
96,479
I would like to be able to add the symbol "lambda-bar" (see below) into an equation. How can I do this? ![enter image description here](https://i.stack.imgur.com/OPmAc.png)
2013/02/02
[ "https://tex.stackexchange.com/questions/96479", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/17670/" ]
As far as I know (confirmed by the Comprehensive list of LaTeX symbols), the only package that provides `\lambdabar` is `txfonts` (and the derived `newtxmath`). Of course changing all document fonts to get that symbol is out of the question (and the lambda is quite different from other fonts, so it's also impossible to...
The answers posted earlier helped me conceptually to develop a solution for the Jupyter/Mathjax environment. I thought I should post that solution for the folks who would like a solution specific to that environment. Run this first in any cell before invoking lambdabar: ``` $$\newcommand\lambdabar{ \raise1.5pt{\mover...
252,692
In Unix, using a simple command like sed, is there a way to print the last character of a file?
2011/03/03
[ "https://superuser.com/questions/252692", "https://superuser.com", "https://superuser.com/users/-1/" ]
tail is the right tool, not sed. ``` tail -c 1 filename ```
Use: `cat test | sed -e "s/^.*\(.\)$/\1/"` where test is the name of your file.
4,668,760
What is the shortest way, preferably inline-able, to convert an int to a string? Answers using stl and boost will be welcomed.
2011/01/12
[ "https://Stackoverflow.com/questions/4668760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/166067/" ]
`boost::lexical_cast<std::string>(yourint)` from `boost/lexical_cast.hpp` Work's for everything with std::ostream support, but is not as fast as, for example, `itoa` It even appears to be faster than stringstream or scanf: * <http://www.boost.org/doc/libs/1_53_0/doc/html/boost_lexical_cast/performance.html>
You might include the implementation of itoa in your project. Here's itoa modified to work with std::string: <http://www.strudel.org.uk/itoa/>
68,679,375
I am using Couchbase 3.2 SDK, to query couchbase server. Like below ``` QueryResult result = cluster.query( "SELECT *, Meta().id FROM bucketName USE KEYS ?", queryOptions().parameters(JsonArray.from("pk")).readonly(true)); ``` The response is like ``` [{"id":"pk","bucketName...
2021/08/06
[ "https://Stackoverflow.com/questions/68679375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3892213/" ]
``` GetResult s = cluster.bucket("bucketName").defaultCollection().get("pk"); byte[] doc = s.contentAs(byte[].class); ```
It is not possible with N1QL, hence the solution in the referenced thread and the solution I provided to the specific question asked. To pair arguments with results, get creative with reactor. The following is with spring-data-couchbase, where findById() returns Airport. Using the SDK replace findById() with get() whi...
2,949,956
Where did I go wrong? (preferably a logical explanation instead of "this isn't how you use (insert name) rule) \begin{align\*} &\lim\_{x\to 0}\frac{ 1 -\cos x }{x²}\\ =&\lim\_{x\to 0}\frac{ 1 -\cos x }{(x-0)\cdot(x-0)}\\ =&\lim\_{x\to 0}\frac{\sin x }{x-0}\\ =&\lim\_{x\to 0}\cos x\\ =&1. \end{align\*}
2018/10/10
[ "https://math.stackexchange.com/questions/2949956", "https://math.stackexchange.com", "https://math.stackexchange.com/users/602618/" ]
The second equality doesn't hold. If you are using L'Hopital's rule, you should do\begin{align}\lim\_{x\to0}\frac{1-\cos x}{x^2}&=\lim\_{x\to0}\frac{\sin x}{2x}\\&=\frac12\lim\_{x\to0}\frac{\sin x}x\\&=\frac12.\end{align} --- Another possibility is:\begin{align}\lim\_{x\to0}\frac{1-\cos x}{x^2}&=\lim\_{x\to0}\frac{2\...
You have an indeterminate form. Using L'Hopital's Rule, take the derivative of numerator and denominator, transforming your limit to: \begin{align}\lim\_{x\to0}\dfrac{1-\cos{x}}{x^2}=\lim\_{x\to0}\dfrac{\sin{x}}{2x}\end{align} This is another indeterminate form. Another iteration of L'Hopital's Rule implies: \begin...
2,001,842
I cant seem to find a direct method for implementing filtering of text input into a list of items in a WPF combobox. By setting IsTextSearchEnabled to true, the comboBox dropdown will jump to whatever the first matching item is. What I need is for the list to be filtered to whatever matches the text string (e.g. If ...
2010/01/04
[ "https://Stackoverflow.com/questions/2001842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/107933/" ]
I just did this a few days ago using a modified version of the code from this site: [Credit where credit is due](http://dotbay.blogspot.ca/2009/04/building-filtered-combobox-for-wpf.html) My full code listed below: ``` using System.Collections; using System.Windows.Controls; using System.Windows.Data; using System.Wi...
Kelly's answer is great. However, there is a small bug that if you select an item in the list (highlighting the input text) then press BackSpace, the input text will revert to the selected item and the SelectedItem property of the ComboBox is still the item you selected previously. Below is the code to fix the bug and...
16,811,173
I'm trying to write a bash script, which will do the following: 1. reads the content from the first file (as a first argument) 2. reads the content from the second file (as a second argument) 3. finds the line in the second file with the given pattern (as a third argument) 4. inserts text from the first file to the se...
2013/05/29
[ "https://Stackoverflow.com/questions/16811173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2431907/" ]
You need spaces around the `=~` operator. Compare: ``` [[ foo=~bar ]] [[ foo =~ bar ]] ``` This is because the first expression essentially evaluates as "Is this string empty?" Also, the **OP code uses [small tilde](http://www.fileformat.info/info/unicode/char/02dc/index.htm) rather than [tilde](http://www.fileform...
I use sed like this and it worked as a charm ***sed -i -e '/pattern/r filetoinsert' filetobeinserted*** What it does is insert the 'filetoinsert' into 'filetobeinserted' after the line with the specified pattern Take care to choose a unique pattern, not sure how it will work with a duplicate patterns, I assume it wi...
266
While there are many open databases available, is there a database or the project that would contain the information of such databases? In other words, is there an open meta-database of open databases?
2013/05/12
[ "https://opendata.stackexchange.com/questions/266", "https://opendata.stackexchange.com", "https://opendata.stackexchange.com/users/139/" ]
### The short answer **[DataPortals.org](http://dataportals.org/)** (previously DataCatalogs.org) provides a comprehensive list of open data portals from around the world. Their (meta-)data is in the public domain and available for download as [CSV](https://raw.githubusercontent.com/okfn/dataportals.org/master/data/po...
Google offers a couple more structured ways to search just on data sets beyond the main Google search function mentioned above: 1) A Googler on Twitter [has suggested](https://twitter.com/danbri/status/391192805873172480) "try[ing] Google custom search (@googlecse) on pages that mention a <http://schema.org/Dataset> -...
5,506,061
I have a custom control that has a property that is an ObservableCollection of another custom control. I can't seem to get the DependencyProperty change event to fire in design time. I have tried to use CoerceValueCallback this doesn't fire either. can anyone give me some direction. Every thing else is working just fin...
2011/03/31
[ "https://Stackoverflow.com/questions/5506061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/686500/" ]
You may want to create a `VIEW` so you can use it for many other queries: ``` CREATE VIEW CallRecordsAgents AS ( SELECT HistoryID , CallID , Date , Data , LEFT( Agent+' ', CHARINDEX(' ', Agent+' ') - 1) AS Agent1 , RTRIM(LTRIM( SUBSTRING( Agent+' ', CHARINDEX(' ',...
I would get a count of records grouped by agent2. something like: ``` SELECT agent2, COUNT(*) FROM yourTable GROUP BY agent2 ```
125,842
We have installed *Cygwin* on a *Windows Server 2008 Standard* server and it working pretty well. Unfortunately we still have a *big problem*. We want to connect using a public key through SSH which doesn't work. It always falls back to using password login. We have appended our public key to `~/.ssh/authorized_keys` ...
2010/03/24
[ "https://serverfault.com/questions/125842", "https://serverfault.com", "https://serverfault.com/users/32224/" ]
I have three accounts on one machine (Mac OSX) and I setup all of their .ssh/authorized\_keys files to contain the id\_rsa.pub of the other two. But I could not "ssh" into one of these accounts from either of the other two, yet they could "ssh" to each other. The answer came from a blog entitled `Debugging SSH public ...
For search purpose: For me it only works, when the private key is named id\_rsa. In your verbose message u see, that this is the pattern he looks per default. otherwise you have to name it "ssh -i .ssh/keyname user@server"
13,018,312
I have the following JSON object array in javascript : ``` [{ "AuthorName" : "Abc", "BookName" : "book-1" }] [{ "AuthorName" : "Abc", "BookName" : "book-2" }] [{ "AuthorName" : "Abc", "BookName" : "book-3" }] [{ "AuthorName" : "Abc", "BookName" : "book-4" }] ``` Now I want to create a single JSON object from...
2012/10/22
[ "https://Stackoverflow.com/questions/13018312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1459031/" ]
``` var obj = {}; for(var i=0; i<myArray.length; i++) { if(obj[myArray[i].AuthorName] == null) obj[myArray[i].AuthorName] = []; obj[myArray[i].AuthorName].push(myArray[i].BookName) } ```
Hopefully, this will help: ``` var bookSort = function (bookarray) { var i, book, authorArray = [], il = bookarray.length, j, jl, authorInArray; for (i = 0; i < il; i++) { authorInArray= false; jl = authorArray.length; book = bookArray[i]...
13,231,730
Hi I'm a `c++` beginner and this is one of my assignments and I'm a bit stuck. This isn't my entire code it's just a snippet of what I need help with. What I'm trying to do is have one function dedicated to exporting everything with that function into a `text` file which is called results.txt. So the line "does this wo...
2012/11/05
[ "https://Stackoverflow.com/questions/13231730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1800033/" ]
First of all, this is fine: ``` void output(ofstream& out) { out << "does this work?" << endl; } ``` However, this is not: ``` int main() { output(ofstream& out); // what is out? ifstream in; in.open("inven.txt"); ofstream out; out.open("results.txt"); return 0; } ``` This is the first er...
Since you described yourself as a begginer, I'll answer accordingly and hopefully in a educational manner. Here is what is happening: Think of `fstream`, `ofstream` and `ifstream` as smart variable types (even if you know what classes are, think like that for the sake of **logical clarity**). Like any other variable, y...
29,208,566
I have following project strucure: `projectA build/ projectB build/ build` I would like to ignore everything which is under build folder. I used following in the .hgignore file: ``` syntax: glob build/** ``` It ignores build folder under projectA and projectB, but it doesn't ignore build folder in the ro...
2015/03/23
[ "https://Stackoverflow.com/questions/29208566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/640022/" ]
The glob syntax in Mercurial does not operate from the root folder, as you've found it'll match the path wherever in the tree it occurs. To match relative to the root you'll need to use the regexp syntax, so try: ``` syntax: regexp ^build/ ``` or ``` syntax: regexp ^build$ ``` And you can have both regexp and ...
This is how my file looks like in the end: ``` ProjectA/dist .*\.log .*\.class build/ ^\.gradle/ ^\.settings ``` I needed to restart Eclipse in order for this to work. @Nanhydrin thanks for your help :)
67,989,382
I need to check if there are some duplicates value in one column of a dataframe using Pandas and, if there is any duplicate, delete the entire row. I need to check just the first column. Example: ``` object type apple fruit ball toy banana fruit xbox videogame banana fruit apple fruit ```...
2021/06/15
[ "https://Stackoverflow.com/questions/67989382", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13421326/" ]
Pipe the object through the `keys` filter, and slice it if you really want the first 2 of more-than-2: ``` % jq 'keys[:2]' tmp.json [ "BI_Arch", "Data_Engineers" ] ```
You can use just `jq '[keys]'` Here's an online tool <https://jqplay.org/s/csowtIQRaZ>
14,501,920
Is there any other way to shorten this condition? ``` if (oper.equals("add") || oper.equals("Add") || oper.equals("addition") || oper.equals("Addition") || oper.equals("+")) ``` I was just wondering if there's something I can do to 'shortcut' this. The user will type a string when prompted what kind of operation is ...
2013/01/24
[ "https://Stackoverflow.com/questions/14501920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1882428/" ]
You can use [`String#equalsIgnoreCase(String)`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#equalsIgnoreCase%28java.lang.String%29) for 1st four strings: - ``` if (oper.equalsIgnoreCase("add") || oper.equalsIgnoreCase("addition") || oper.equals("+")) ``` If number of strings increases, y...
In addition to @Rohit's answer, I would like to add this. In case of comparison of strings, if `oper is null` a `NullPointerException` could be thrown. SO its always better to write ``` "addition".equalsIgnoreCase(oper) ``` instead of ``` oper.equalsIgnoreCase("addition") ```
52,941,249
I am new to JavaScript, so could someone explain this (in my opinion) strange behaviour (code below)? The second console.log prints 5 to the console, despite the fact that loop defines that `a` should be less than 5. Additionally, the second console.log is outside the loop. I understand that assigning value to the "le...
2018/10/23
[ "https://Stackoverflow.com/questions/52941249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9920306/" ]
`a++` increments variable `a` by 1 after its execution. `console.log` inside loop is executed till value of `a` remains less than 5. However, after the last loop iteration when the value of `a` becomes 4 and it's printed by the inside `console.log`, `a++` increments its value to 5 and then the for-loop condition `a<5`...
The scope of a variable declared with `var` is its current execution context, which is either the enclosing function or, for variables declared outside any function, `global`. Here the variable `a` is declared `globally`, and redeclaring the variable makes it `original value changed`, So when running inside for loop ...
14,410,431
In the below code once I hit check\_access as 0 how do I preserve the value and hit the if condition below ($check\_root && $check\_access) . Break will only terminate the inner loop. But the other loops will continue as per me. ``` } else { set check_access 0 break } } } ...
2013/01/19
[ "https://Stackoverflow.com/questions/14410431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1813181/" ]
One of the times that I have run into this issue is when doing a `git commit` after a `git add`. So, the following sequence will produce the rebase error you mention: ``` git add <file with conflict> git commit -m "<some message>" git rebase --continue ``` While, the sequence below runs without any errors, and con...
After a rebase with lots of conflicts (long `git status`) I couldn't figure out what it was that I was supposed to stage. I use Git integrated with PhpStorm and it didn't show any unstaged files. `git add .` didn't solve it but [this comment](https://stackoverflow.com/questions/12759390/cannot-continue-git-rebase#comm...
11,174,858
Manually built: ``` [btnRun addTarget:self action:@selector(RunApp:) forControlEvents:UIControlEventTouchUpOutside]; ``` --- Programmatically built: something of the following like ?? ``` - (void) setRunButton:(UIButton*)objectName mySelector:(NSString*)funcName myControlEvent:(NSString*) controlEvent { [objec...
2012/06/24
[ "https://Stackoverflow.com/questions/11174858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/767829/" ]
I think you'd need something like the following: ``` - (void)setRunButton:(UIButton *)objectName mySelector:(NSString *)action myControlEvent:(UIControlEvents)controlEvent { [objectName addTarget:self action:NSSelectorFromString(action) forControlEvents:controlEvent]; } ``` It is unusual to pass a selector as a...
Pass the entire selector as a parameter ``` - (void) setRunButton:(UIButton*)objectName mySelector:(SEL)action myControlEvent:(NSString*) controlEvent { [objectName addTarget:self action:action forControlEvents:controlEvent]; } ```
47,451,579
I've found some code examples that explain how I can apply a class item if conditions are met. In my .ts file I have the following: ``` private readNews : boolean = false; ``` [..] ``` ngOnInit() { localStorage.setItem('readNews', 'Read'); if (localStorage.getItem('readNews') != null || '') { this...
2017/11/23
[ "https://Stackoverflow.com/questions/47451579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8718995/" ]
``` <i [class.blink]="readNews"></i> ``` Based on cheat sheet on <https://angular.io/guide/cheatsheet>
In HTML: ``` <i *ngIf="readNews" class="fal fa-cogs fa-5x"></i> <i *ngIf="!readNews" class="fal fa-cogs fa-5x blink"></i> ``` And in typescript i would refactor as this to improve readability: ``` ngOnInit() { localStorage.setItem('readNews', 'Read'); this.readNews = (localStorage.getItem('readNews') != null || '')...
16,194,456
I must be missing something. After downloading AntlrWorks2 I found the executable bin/antlrworks2.exe and bin/antlrworks264.exe. Aren't these supposed to be the standalone version of the tool? Neither works for me; after a NetBeans splash screen, the first times around I got an error message on missing packages; after ...
2013/04/24
[ "https://Stackoverflow.com/questions/16194456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1871216/" ]
This is due to a bug in the NetBeans platform. I filed a report but it hasn't received a reply yet: [Cannot launch platform application after moving installation folder](https://netbeans.org/bugzilla/show_bug.cgi?id=227219) Here is a workaround that does not delete any preferences you have customized: > > I found...
Still an issue as of date of this post. Deleting the `.antlrworks2` folder from \users\username\AppData\Roaming does work - you can find this folder by putting `%APPDATA%` into your file explorer address bar (exactly as shown) - that will go to the app data folder for your current user login session. Delete the `.antlr...
34,249,518
I am new to mule ESB. I have a requirement to set HTTP headers where the values should be fetched from MySQLDB. I am able to fetch values from DB. DB returned multiple column values with one row. I can able to set one column value in flow variable(flowVars) and that can be set in HTTP headers. But if i have to set mu...
2015/12/13
[ "https://Stackoverflow.com/questions/34249518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4594924/" ]
I am taking the same course from Coursera as you are. Instead of going for the above solutions, do you mind trying this one. I feel this one is within the scope of what we had learnt till the above mentioned problem. It absolutely worked for me. ``` import urllib import re from bs4 import * url = 'http://python-data...
``` from urllib.request import urlopen from bs4 import BeautifulSoup import ssl import re lst = list() sum = 0 ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE url = input('Enter - ') html = urlopen(url, context=ctx).read() soup = BeautifulSoup(html, "html.parser") tags =...
7,366
This is probably a very basic question. But I am getting conflicting results from Google regarding the types of Talaq or divorce in Islam. Could someone explain how many types of Talaq are there in Islam and how are they initiated? **EDIT** I am specially bewildered by the following article. The article states that t...
2013/02/13
[ "https://islam.stackexchange.com/questions/7366", "https://islam.stackexchange.com", "https://islam.stackexchange.com/users/558/" ]
I only know of two types. You can give single talaq or triple talaq. The triple Talaq ends the marriage permentantly and you cannot marry the same woman again until she marries again, consummates the marriage and the marriage ends. In single Talaq you can get back together;if you have intercourse, the talaq is then ...
The types of Divorce ( Talaq ) are Four in other View. 1) Talaq ( in which by a husband pronounciation ) = In this type of Divorce, it is spell out by A husband to his wife, declaring a Seperation to that particular Social Contract. Once a word of Divorce in this Term is commenced, there's no amendment in which to wipe...
25,477
My plane departs from Geneva Airport (Geneva International terminal M) at 19:55. I'll be in Zürich and a bit short on time. If I take the train that arrives at "Genève-Aéroport" at 18:51, will I have enough time to find the terminal and check in? I've never been to this airport before.
2014/03/27
[ "https://travel.stackexchange.com/questions/25477", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/12593/" ]
The train station is at the airport. You have to take up two (or three) escalators from the platform and then walk for [approximately 50 meters to arrive at the check-in](http://gva.ch/en/desktopdefault.aspx/tabid-60/). There is only one terminal, so it will take you 5-10 minutes at most to go from the platform to chec...
It's really in the airport (which is itself not very big but not so efficient for its size). Arriving: Out of the baggage claim, take left, walk 50-100m tops, you are already in the station (the actual tracks run underneath the airport). In the other direction you need to take some escalators, find the right check-in d...
1,132,708
I am a student and I want to know if this proof is correct. **Proof.** If $\sqrt5$ is a natural number, it should be even or odd. If it would be even, we could express it as $2k$ for some integer $k$. If it would be odd, we could express it as $2j+1$ for some integer $j$. But those integers do not exist what is a co...
2015/02/04
[ "https://math.stackexchange.com/questions/1132708", "https://math.stackexchange.com", "https://math.stackexchange.com/users/195513/" ]
Let's assume, to the contrary, that $\sqrt{5}$ is a natural number, $n \in \mathbb{N}.$ Then, since $f(x)=\sqrt{x}$ is an increasing function, we know that $\sqrt{4}<\sqrt{5}<\sqrt{9}.$ Thus, $$\sqrt{4}<n<\sqrt{9}\implies 2<n < 3 $$ Producing a contradiction. So, it must be the case that $n \notin \mathbb{N}$.
You can prove that 5 is not rational. Suppose, without lost of generality that there exists natural numbers $p, q$ such that: $$\sqrt5 =p/q$$ $$5q^2 = p^2$$ Then, $p$ has to be multiple of 5, so $p=5 k$. Therefore: $$q^2=5k^2$$ So $p, q$ cannot be relatively prime. $\sqrt 5$ cannot be expressed as a ratio of intege...
432,143
The medians of a triangle intersect in a trisection point of each.
2013/06/29
[ "https://math.stackexchange.com/questions/432143", "https://math.stackexchange.com", "https://math.stackexchange.com/users/76961/" ]
I can propose the following evidence. Let $ABC$ be an arbitrary triangle of a Cartesian plane. Let its vertices $A$, $B$, and $C$ have the coordinates $(x\_1,y\_1)$, $(x\_2,y\_2)$ and $(x\_3, y\_3)$ respectively. Then the midpoints $A\_1$, $B\_1$, and $C\_1$ of the sides $BC$, $CA$, and $AB$ respectively have the coord...
The medians of an equilateral triangle must trisect by symmetry. Any other triangular shape can be found by performing a linear transformation on the vertices of the equilateral triangle, and such transformations preserve the medians along with their trisection point.
371
I'm curious about natural language querying. Stanford has what looks to be a strong set of [software for processing natural language](http://nlp.stanford.edu/software/index.shtml). I've also seen the [Apache OpenNLP library](http://opennlp.apache.org/documentation/1.5.3/manual/opennlp.html), and the [General Architectu...
2014/06/14
[ "https://datascience.stackexchange.com/questions/371", "https://datascience.stackexchange.com", "https://datascience.stackexchange.com/users/434/" ]
Natural language querying poses very many intricacies which can be very difficult to generalize. From a high level, I would start with trying to think of things in terms of nouns and verbs. So for the sentence: How many books were sold last month? You would start by breaking the sentence down with a parser which will...
Check [ln2sql is an NLP tool to query a database in natural language.](https://github.com/FerreroJeremy/ln2sql) [Daniel Moisset - Querying Your Database in Natural Language](https://www.youtube.com/watch?v=6RrDBKUlO4Q) In general very hard [NLU and Natural Language Interfaces to Databases](https://medium.com/ontolog...
31
When I am documenting records, do I use the name of a city or country as it is called today or as it was in the year an ancestor was there? Related to: [When documenting place names, should I write them in my language or in their native language?](https://genealogy.stackexchange.com/questions/64/when-documenting-place...
2012/10/09
[ "https://genealogy.stackexchange.com/questions/31", "https://genealogy.stackexchange.com", "https://genealogy.stackexchange.com/users/41/" ]
The problem with using "current" names as the only name, is that "current" changes over time. Is the Crimea part of the Ukraine or of Russia. If you attempt to use "current" you're dooming yourself to a never ending job of updating locations. I prefer an approach, supported by the tool I use, [Genbox](http://www.genbo...
Personally I use today's name but also place a note with the old name.
11,462
Is there a suitable tape for permanently joining pieces of cardboard or paper together, that can then have paint (or other finish) applied to it just as it could to the paper/card itself? I’ve been making some polyhedra out of cardboard—nothing fancy, just corrugated stuff cut from boxes, joined together with some pai...
2023/01/26
[ "https://crafts.stackexchange.com/questions/11462", "https://crafts.stackexchange.com", "https://crafts.stackexchange.com/users/16324/" ]
Drywall tape is cheap and pretty permanent. It is designed to have drywall mud applied over it, but paint sticks to it as well.
If you want your "art" to last a long time, I would exclude any ribbon product with glue on one side from the factory. First you should find a good glue for paper, which will not die in a few months / years. Then make your own "ribbon" of paper - cut long stretches of paper from something. You might even find for purc...
27,285,775
I have a huge problem with printing the specific word backwards. I'm trying to find words with '\*' at the beggining and print them backwards, the rest should be printed normally. ***For example:*** **Input**: `aaa1 ab0 1kk *ddd *lel 2cccc2 c1` **Output** `aaa1 ab0 1kk ddd* lel* 2cccc2 c1` All I have is finding th...
2014/12/04
[ "https://Stackoverflow.com/questions/27285775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4322758/" ]
We can generalize the solution of 3x14159265 and Seth Tisue thanks to 2 small type classes: ```scala import play.api.libs.json.Json.JsValueWrapper import play.api.libs.json._ import simulacrum._ object MapFormat { @typeclass trait ToString[A] { def toStringValue(v: A): String } @typeclass trait FromString[...
<https://gist.github.com/fancellu/0bea53f1a1dda712e179892785572ce3> Here is a way to persist a Map[NotString,...]
3,992,027
can you give me any advice how to caluclate $\int\_{0}^{1/2} \frac{e^x - 1}{x} \,dx$ ? I need to use series. I tried to split it as $$ \int\_{0}^{1/2} \frac{e^x}{x} \,dx - \int\_{0}^{1/2} \frac{1}{x} \,dx$$ and then I can use a series for the first equation but I get another $\int\_{0}^{1/2} \frac{1}{x} \,dx$. Can I so...
2021/01/19
[ "https://math.stackexchange.com/questions/3992027", "https://math.stackexchange.com", "https://math.stackexchange.com/users/876268/" ]
You cannot split the integral into two unless at least one of them is convergent. By the series definition of the exponential function, for $x\ne 0$ $$ \frac{e^x-1}{x}=\frac1x(x+\frac{x^2}{2!}+\frac{x^3}{3!}+\cdots ) =1+\frac{x}{2!}+\frac{x^2}{3!}+\cdots $$ Now define the function $f:[0,1/2]\to\mathbb{R}$ with $f(x)=...
$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \new...
29,417,783
I converted this [.ttf](http://www.dafont.com/minecraftia.font) to webfont (used in css) in many online converters but the result always has some weird space at the bottom. It's like a `line-height` and `valign` glitch. Here is an example how the links looks ![s](https://i.stack.imgur.com/wABN5.png) Also [on Ubuntu]...
2015/04/02
[ "https://Stackoverflow.com/questions/29417783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1794248/" ]
I created this little extension in **Swift 5** to convert from `UIImage` to `CKAsset`: ``` extension UIImage { func toCKAsset(name: String? = nil) -> CKAsset? { guard let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first else { return nil ...
You'll want to pick the Asset value type in the dashboard for this value. `newRecord.setValue(ImageToSave, forKey: "Image")` UIImage is not an allowed type on `CKRecord`. Your best option is to write this image out to a file, then create a `CKAsset` and set that on the record.
67,243,475
I am working on a project in Node.JS Express. I had several pages all of which are running fine but only one page (till now) is giving error in loading up. When I ran that page a error pops up, that is : ```html SyntaxError: Unexpected token catch in E:\nodeapp\views\adm.ejs while compiling ejs If the above error is ...
2021/04/24
[ "https://Stackoverflow.com/questions/67243475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11642391/" ]
That's really simple. The answer is: it's the padding. as you might know by now, padding is some pixels that get added to an element after its normal dimensions and before the border. For example: [![padding and no padding example](https://i.stack.imgur.com/bPqYw.png)](https://i.stack.imgur.com/bPqYw.png) So when you...
Its looks like your padding is pushing your content way after the 100% size. Try using `box-sizing: border-box;` and check out this documentation: <https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing>