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
2,824,982
I want to capture keystrokes when the focus in on a panel in java. What should i do? I am using Netbeans as the IDE. I tried adding keyTyped event but it doesnot work. Here goes my code ``` import com.lanadmin.Interface.ClientInterface; import java.awt.Toolkit; import java.awt.event.InputEvent; import java.awt.event...
2010/05/13
[ "https://Stackoverflow.com/questions/2824982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/322897/" ]
Don't forget to invoke [`setFocusable(true)`](http://java.sun.com/javase/6/docs/api/java/awt/Component.html#setFocusable(boolean)), as discussed in [*How to Write a Key Listener*](http://java.sun.com/docs/books/tutorial/uiswing/events/keylistener.html).
Depending on what you want to achieve, you could maybe also find help here: <http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html>
6,601,898
I am trying to configure my WCF (.NET 4.0) service so that it can be tested using soapUI. I am using wsHttpBinding with message security. My goal is to expose the service on a public test endpoint and try to load-test it with loadUI which uses soapUI tests. For this to work the endpoint needs to be secure and since my ...
2011/07/06
[ "https://Stackoverflow.com/questions/6601898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/753034/" ]
You might want to check for few things. 1) Set negotiateServiceCredential="false" ``` <wsHttpBinding> <binding name="wsHttpSecure"> <security mode="Message"> <message clientCredentialType="UserName" negotiateServiceCredential="false" establishSecurityContext="false" algorithm...
There is an issue with SoapUI in a network where there is a web proxy. You must configure the proxy settings in SoapUI to get this to work, assuming there was no other problem.
1,396,458
Starting with the following (using `gcc version 4.0.1`): ``` namespace name { template <typename T> void foo(const T& t) { bar(t); } template <typename T> void bar(const T& t) { baz(t); } void baz(int) { std::cout << "baz(int)\n"; } } ``` If I add (in the *global* namespac...
2009/09/08
[ "https://Stackoverflow.com/questions/1396458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/112/" ]
I assume you added the `double` version to the global namespace too, and you call `foo` from main after everything is defined. So this is basically two phase name lookup. Looking up an unqualified function name that is dependent because an argument in the call is dependent (on its type) is done in two phases. The fir...
Do a google on "c++ koenig lookup" That should give you enough information on the template lookup rules. Herb Sutter has a good article on the subject: <http://www.gotw.ca/gotw/030.htm>
149,738
I'm (still) trying to make another submission to the [Largest Number Printable](https://codegolf.stackexchange.com/q/18028) question, and I've got the following bit of code: ``` f=->a{b,c,d=a;b ?a==b ?~-a:a==a-[c-c]?[[b,c,f[d]],~-c,b]:b:$n} h=[],$n=?~.ord,[] h=f[h]until h==p($n+=$n)-$n ``` Ungolfed: ``` f=->{b,c,d=...
2017/12/02
[ "https://codegolf.stackexchange.com/questions/149738", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/58880/" ]
JavaScript (ES6), ~~345~~ 342 bytes =================================== *Saved 2 bytes thanks to @StephenLeppik* ```js n=>[...'lmnopqsuvwxyz{}~'].reduce((s,c)=>(x=s.split(c)).join(x.pop()),` p{{yyvu{ xvs${(n&&n<60?n+'':(k=n||new Date/6e4|0,k/60%(n?k:12)|0||(n?0:12))+':'+('0'+k%60).slice(-2)).padEnd(9)}xoup__uuxx{~zzn...
C#, 701 bytes ============= [Try it Online!](https://tio.run/##jVJdS8MwFH3PrwhlsITW0s5NYbVTUXxSEDfwYYzStVmXsaXSZIq0@e3zttlwOqcGbnN77rnfSeRJkhdss5ZcZHj4LhVbBShZxlLilxJJFSue4Necp/gh5oJQVKK7tUguuFCOVAV4DfAMABziDYlpOCjBghehF3ynTUOSgF2wN2wQAup4UvqO5xjZaY2uxwvbngy8y3bU7rdx20loYPwwC60Kw2k@f5wtsbKcWchsK4qiaicAHhSZhfNwwOyWhcu5...
3,054,093
How can i do below without assign null value "Tex=null"? ``` static void Main(string[] args) { FileInfo f = new FileInfo("C:/temp/Arungg.txt"); StreamWriter Tex; Tex = null; if (!f.Exists) { f.CreateText(); } ...
2010/06/16
[ "https://Stackoverflow.com/questions/3054093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52420/" ]
You need to make sure that `Tex` is assigned in every code path. ``` if (!f.Exists) { Tex = f.CreateText(); } ``` Note that the `AppendText` method will create the file if it doesn't exist. Therefore, you don't need the `if` statement at all.
If you don't instantiate your StreamWriter, it's going to bomb on you. You need to assign a value to get it to compile, but without an instance, it's not going to do what you think it will do. Perhaps simplify and [consider using File.WriteAllText](http://msdn.microsoft.com/en-us/library/ms143375.aspx)?
34,662,803
I have this in the `<head>` of my base.html. ``` {% load staticfiles %} <link rel="stylesheet" type="text/css" href="{% static "myStyleSheet.css" %}"> ``` and I get error **Invalid block tag: 'static'** Within INSTALLED\_APPS I've included ``` 'django.contrib.staticfiles', ``` and I've included within settings.p...
2016/01/07
[ "https://Stackoverflow.com/questions/34662803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2740177/" ]
the actual problem here, I'm very sorry to say, was that within my app.yaml file I had specified a different directory for the static files and it seemed to be overriding everything else. Once removed, all sorted.
Do you have the `django.core.context_processors.static` context processor in your `TEMPLATE` settings? Here's a sample: ``` TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ ...
3,089
I would like to disallow certain address location types on Organization contacts—for example I don't want to allow "Home" addresses on an Organization. I would also like to disallow "Main" address type on the Individual contact types. Anybody try this before?
2015/06/08
[ "https://civicrm.stackexchange.com/questions/3089", "https://civicrm.stackexchange.com", "https://civicrm.stackexchange.com/users/17/" ]
Frankly, CiviCRM core should disable the Home address location for Organizations, and the Work address location for Households.
If the solution suggested by Coleman does not work, you will have to create a little extension that removes some of the options based on contact type in a buildForm hook? Or alternatively validates the selected location type against the contact type in a validateForm hook
31,120,553
I am new to android development. I am using webview to display HTML pages in android, but only the text shows up. Can you please help me with the problem. thank you in advance, would be very helpful. ``` WebView view = (WebView) this.findViewById(R.id.webView); try{ InputStream stream = this.getAssets()....
2015/06/29
[ "https://Stackoverflow.com/questions/31120553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4699944/" ]
I find the `sequence` function to be helpful in this case. If you had your data in a structure like this: ``` (info <- data.frame(start=c(1, 144, 288), len=c(6, 6, 6))) # start len # 1 1 6 # 2 144 6 # 3 288 6 ``` then you could do this in one line with: ``` sequence(info$len) + rep(info$start-1, inf...
From [R >= 4.0.0](https://stat.ethz.ch/pipermail/r-announce/2020/000653.html), you can now do this in one line with `sequence`: ```r sequence(c(6,6,6), from = c(1,144,288)) [1] 1 2 3 4 5 6 144 145 146 147 148 149 288 289 290 291 292 293 ``` The first argument, `nvec`, is the length of each sequence; the ...
15,757,105
I just wanted a fast/easy/simple way to check for existing ID on a specific element (div in this case).. Can't seem to find code sample for this..im using jquery but i dont think i need to do jquery on this one, just basic getElement.. but i need to isolate the search inside a div block.. because the id does exist in ...
2013/04/02
[ "https://Stackoverflow.com/questions/15757105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1797947/" ]
IDs are supposed to be **unique** and no two elements in page should have same id. You may search some element with some class in div with specific ID. ``` $('#divId .someClass') ``` or using [**find()**](http://api.jquery.com/find/) ``` $('#divId').find('.someClass') ``` or using [**context**](http://api.jquery....
According to my understanding on your question, You have used two id's with same name when u execute, It takes only first ID so you are asking to take id from the specific div, well that is bad type of coding to use two id for same name instead go for class if want to use same name. solution for your question is -this ...
12,096,016
I have written the following Java source file (`Hello.java`): ``` package com; public class Hello { public static void main(String[] args) { System.out.println("Hello!"); } } ``` I save this to `C:/tmpjava/Hello.java`. From the command line, I navigate to that directory and run `javac Hello.java`. ...
2012/08/23
[ "https://Stackoverflow.com/questions/12096016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/892029/" ]
Your class `Hello` belongs to the package `com`. So the fully qualified name of your class is `com.Hello`. When you invoke a program using java on the command-line, you should supply the fully-qualified class name of the class that contains your `main` method and omit the *.class*, like so: ``` java com.Hello ``` Th...
The class should be in `C:\tmpjava\com\Hello.class` And you should run from `C:\tmpjava`: `java -cp . com.Hello` When you put a class in a package it defines the file structure of the class. I.e. your class which in package `com` should be in folder `com`
743,183
SQL Server developers consider Cursors a bad practise , except under some circumstances. They believe that Cursors do not use the SQL engine optimally since it is a procedural construct and defeats the Set based concept of RDBMS. However, Oracle developers do not seem to recommend against Cursors. Oracle's DML stateme...
2009/04/13
[ "https://Stackoverflow.com/questions/743183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49189/" ]
I have always been told that cursors where evil, but always by MS SQL Server gurus, because of it's bad performance. Regarding Oracle's PL/SQL [I found this saying when to *use* cursors](http://www.dba-oracle.com/t_top_reasons_poor_performance.htm): > > Not using cursors results in repeated parses. If bind variables ...
The other answers correctly point out the performance issues with cursors, but they don't mention that SQL and relational databases are best at set-based operations and cursors are fundamentally for iterative operations. There are some operations (in the broader sense) that are easier to perform using cursors, but when...
137,598
I try to solve the differential equation ``` DSolve[{3*y[x] + 2*x*y[x]^2 + (2*x + 3*x^2*y[x])*y'[x] == 0, y[1] == 1/2}, y[x], x] ``` This produces some error messages as > > DSolve::bvnul: For some branches of the general solution, the given > boundary conditions lead to an empty solution. > > > It also pro...
2017/02/12
[ "https://mathematica.stackexchange.com/questions/137598", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/36141/" ]
Here is a refinement of @xzczd's [`Trace`](http://reference.wolfram.com/language/ref/Trace) idea (originally posted as an answer to question [(174383)](https://mathematica.stackexchange.com/q/174383/45431)): ``` Quiet @ Trace[ DSolve[{3*y[x]+2*x*y[x]^2+(2*x+3*x^2*y[x])*y'[x]==0,y[1]==1/2},y[x],x], Solve[e_, y[...
**Maple** I tried the same ode in Maple and it also produces the solution in terms of `RootOf`, the maple routine "a placeholder for representing all the roots of an equation in one variable". But there is also an option which is self explanatory `remove_RootOf`. Thus, maple was able to produce an implicit solution t...
3,293,785
Is there any specific example/instance of DI being applied as an architectural principle or design pattern **in the .NET Framework itself**? Do any (or many) of the types in the framework/BCL conform to IoC? The type names and a brief illustration/explanation based in C# would be great! This would compund the need ...
2010/07/20
[ "https://Stackoverflow.com/questions/3293785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190037/" ]
Both the StreamReader and StreamWriter could be seen as examples of IoC/DI. Each allow you to inject a different Stream object (or one of its derivatives) for reading/writing respectively. ``` FileInfo fi = new FileInfo(@"C:\MyFile.dat"); StreamWriter sw = new StreamWriter(fi.Open()); ``` Or: ``` MemoryStream ms =...
Sure - the [IServiceProvider](http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.ole.interop.iserviceprovider.aspx) interface has been part of the Framework since 1.0. This isn't DI as it is typically discussed here (using a "kernel"), but it is IoC using the Service Locator pattern. If you dig into any of...
4,507,628
How to determine wifi network interface name in java?
2010/12/22
[ "https://Stackoverflow.com/questions/4507628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/550982/" ]
Since you said that you are developing on Android use this: ``` WifiManager wifiManager = (WifiManager) this.getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); System.out.println(wifiInfo.getSSID()); ``` This will return the name of your WIFI. You have to add this permission to you...
Try: [NetworkInterface.getNetworkInterfaces();](http://download.oracle.com/javase/6/docs/api/java/net/NetworkInterface.html#getNetworkInterfaces%28%29) which will return all the interfaces present on your machine.
5,383,609
I am trying to figure out how to use git in my project workflow, and I have an existing Xcode project that I want to put into the repository. I think I have the repository set up correctly under organizer, but the Source Control menu is grayed out. Apparently, it's easy to do if you start a new project, but how do I...
2011/03/21
[ "https://Stackoverflow.com/questions/5383609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356438/" ]
Xcode 7 (and 8) =============== If you were starting a new project you would just check **Create Git repository** during the setup. (Then skip down to the Commit part below.) [![enter image description here](https://i.stack.imgur.com/cq2lF.png)](https://i.stack.imgur.com/cq2lF.png) But it you are working with an exi...
Check out my post on this topic [Setting up a git repository in XCode for a pre-existing project](https://stackoverflow.com/q/11021626/1224762). The above is correct, but it will include UserInterfaceState in your changes as you commit and this could be annoying because this file updates everytime you do anything in xc...
28,448,029
``` int[] numbers = new int[10]; numbers[0] = 20; ``` At first I thought I was so far off in syntax (I'm more of a C++ programmer), that It wouldn't work. But I whipped out the good ole' Java book and this would be correct. Is there any obvious reason why Android Studio isn't recognizing this? The first line declari...
2015/02/11
[ "https://Stackoverflow.com/questions/28448029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4535064/" ]
Your second line needs to be inside a method (function). ``` class Foo { int numbers[] = new int[10]; Foo() { numbers[0] = 20; } } ```
If you are coding for Android then ArrayList is more preferable and easy to use too, As simple as ArrayList numbers=new ArrayList(); numbers.add(20);
6,125
I played guitar since age of 12, but haven't really played for the last 5 years and would like to start again. However, when I used to play I rarely used the pinky finger because I have big hands (not an excuse, but this is how it happened). Now that I almost forgot how to play after a long absence I thought, "Why do...
2012/05/01
[ "https://music.stackexchange.com/questions/6125", "https://music.stackexchange.com", "https://music.stackexchange.com/users/2319/" ]
Minor Pentatonic scale ``` $6 2 5 $5 2 4 $4 2 4 $3 2 4 $2 2 5 $1 2 5 $3 ...or: 2 4 / 6 $2 5 7 $1 5 7 / 9 ``` Try a G chord with Ring- Middle- and a Pinky-barre. ``` %3/3.2/2.0/0.0/0.3/4.3/4 ``` In fact, all of the CAGED shapes will work your pinky if you use the "barre" fingerings: don't use the index (1) at all...
A John petrucci training exercise I used a while back helps a lot with finger dexterity You start off with a basic chord of : 1 2 3 4 X X Then move your index up a fret and switch positions with the middle finger like so: 2 1 3 4 X X Then you move up the whole 4 strings you are fretting with the index When you're done ...
1,236
How have experts estimated the amount of oil that was shooting out of that pipe in the Gulf? I bet there's some neat math or physics involved here, and some interesting assumptions considering how little concrete data are available.
2010/07/30
[ "https://math.stackexchange.com/questions/1236", "https://math.stackexchange.com", "https://math.stackexchange.com/users/41/" ]
One interesting fact told to me by my father, a chem engineer, is that if you have a high pressure gas leaking into a low pressure gas through a small hole, there is a upper limit to the rate of flow. That is, no matter how high the pressure gets on the high pressure side, the rate of flow does not surpass some finite ...
The following page should be of some help: <http://en.wikipedia.org/wiki/Diffusion>
24,212,667
I've read that methods and member variables are public by default in PHP, yet many of the code examples I look at have the `public` keyword in front. For example: ``` class SomeClass { public $data; public function someFunction() { } } ``` Is there any reason to use the `public` keyword before method a...
2014/06/13
[ "https://Stackoverflow.com/questions/24212667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1101095/" ]
> > Is there any reason to use the `public` keyword before method and > member variable names in PHP, or is clarity the only reason some > people do it? > > > The reason is clarity. Humans are coding this stuff. Humans need to read this stuff. And if a human cannot quickly decipher what is happening, lack of cl...
My personal opinion is that it is better to be explicit. No ambiguity. I also think that all member variables should be either protected or private with the appropriate getters/setters. It also aids in the documentation of your code - such as DOxygen
33,487,146
I am building a select option dynamically. I am selecting from the select option, one value. (values for list come from php How can I pass that selected value to PHP? ``` <select id ="s1" name="swimopt" class="so"> <?php echo $options; ?> </select>' ``` THe $options are coming from a MySQL and populating the dr...
2015/11/02
[ "https://Stackoverflow.com/questions/33487146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5451365/" ]
Try: ``` library(cgwtools) res <- seqle(which(df<0)) sum(res$lengths[res$lengths>=6]) [1] 13 ```
you can always define your own function and call it. ``` NegativeValues <- function(x) { count <- 0 innercount <- 0 for (i in c(x, 0)) { if (i < 0) { innercount <- innercount + 1 } else { if (innercount >= 6) count <- count + innercount innercount <- 0 ...
9,008,176
I am building a site for my professor and am trying not to repeat my code, because i will be failed for this. I have the following .getJson call that I would like to use in multiple locations so that i do not have to repeat code superfluously. ``` function GetJSON() { var a = $.getJSON("/controller_name/action",...
2012/01/25
[ "https://Stackoverflow.com/questions/9008176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/981190/" ]
If your professor is up to date with current paradigms, you should be *returning* `a` (the returned value of `$.getJSON`). It's a *deferred* object, and you can attach handlers to it any time you please, and don't have to attach them within your own `GetJSON()` function. If you have common actions that you *always* w...
I wouldn't say that's repeating code actually IMHO (unless you make the same request and update the same elements everytime). If the callbacks en request url are different everytime there isn't really a need to write a 'wrapper' for it IMHO. The way I see it as a 'native' function. E.g. `console.log()` for example. Yo...
2,905
If you're now living in a new country and have a US passport, and decide to take on the citizenship of said new country - sometimes you're unable to have dual citizenship. In this case, let's say you've giving up your US citizenship; what must you do with your US passports? Do they remain active until they run out?
2014/09/11
[ "https://expatriates.stackexchange.com/questions/2905", "https://expatriates.stackexchange.com", "https://expatriates.stackexchange.com/users/97/" ]
When United States citizens renounce their citizenship, the consular officer will punch holes in your passport just like when they void an old passport when giving you a new one. There was an article in the Korea Herald about this several years ago. > > Herald: In 1997, you gave up your U.S. citizenship and became a...
Generally the passport is considered void. The US does report cancelled/voided passports to International databases - that's how they attempted to trap Snowden in Hong Kong (he managed to pass HK border control minutes/hours before the State Department reported that his passport was revoked). Most, if not all, countrie...
31,858,560
How to write the following code so that it will not return the error object reference not set .... Below is the code. ``` Private Quantity As String Public Property Quantity1() As String Get Return Quantity.ToString() End Get Set(ByVal value As String) Quantity = value End Set End Pr...
2015/08/06
[ "https://Stackoverflow.com/questions/31858560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1664336/" ]
The variable `jsonResult` is an array of dictionaries, so you can loop through the array with ``` for anItem in jsonResult as! [Dictionary<String, AnyObject>] { // or [[String:AnyObject]] let personName = anItem["name"] as! String let personID = anItem["id"] as! Int // do something with personName and personID } ...
``` let jsonResult: AnyObject? = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments, error:&parseError) ```
950,674
Is $a^{p^n-1}=1\mod p$ where $p$ is prime number and $1\lt a\lt p-1$? When $n=1$ by little fermats theorem theorem it is true. But i can't justify generaly whether it is correct or not. But when i give number for $p=5$ and $a=3$ , it is working.
2014/09/29
[ "https://math.stackexchange.com/questions/950674", "https://math.stackexchange.com", "https://math.stackexchange.com/users/174756/" ]
There are now quite a few excellent ones, but most of these are pitched at fairly sophisticated readers-graduate students or professional mathematicans. The thinking according to such textbooks, of course,is that the readers are very far along in thier mathematical training and are ready to use that mathematics to lear...
Here is another bunch of texts. Like the ones suggested by Mathemagician1234, they are not general texts. The level of formality is variable. **Classical mechanics** F. Scheck, *Mechanics*, Springer, 2010. Although not specifically geared toward mathematicians, it makes use of mathematically advanced tools. I conside...
24,535,883
I've had this design problem for the third time and I have a feeling there is a solution out there that I simply can't figure out. I am not satisfied with the way I solved it previously, so here is where you come in. Let's say I'm designing a (C#) library that is agnostic in which system it gets used in. So I have the...
2014/07/02
[ "https://Stackoverflow.com/questions/24535883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2644/" ]
When you're consuming a class with a different interface to the one you need, you want the adapter pattern. There are a couple of variations on this, but a simple one for your case would look something like this: ``` public interface IAction { void Execute(); } public interface IUnityAction { IEnumerator Exec...
What if you use Task Parallel Library ? Sample code of Trigger where I see we can implement this (considering your Non-IEnumerator code): ``` public class Trigger { private readonly List<Task> TaskActions = new List<Task>(); public void AddAction(IAction action) { TaskActions....
48,458,696
I need to remove the key from the underscore.js result. I grouped an array,this is the result I got for underscore.js: ``` { '20': [ { Employee: 'ved', id: 20 }, { Employee: 'p', id: 20 }], '25': [ { Employee: 'ved', id: 25 } ] } ``` I tried this \_.without method , but it won't work . From the above result obje...
2018/01/26
[ "https://Stackoverflow.com/questions/48458696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9002667/" ]
You can use [`Object.values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Object/values) ```js var data = { '20': [ { Employee: 'ved', id: 20 }, { Employee: 'p', id: 20 }],'25': [ { Employee: 'ved', id: 25 } ] }, result = Object.values(data); console.log(result); ```
`Object.values()` is what you need to use, like this: ```js let input = { '20': [ { Employee: 'ved', id: 20 }, { Employee: 'p', id: 20 }], '25': [ { Employee: 'ved', id: 25 } ] }; console.log(Object.values(input)); ```
57,167,958
//I am trying to learn/understand to create a one-dimensional array which contains, in exact order, the array indices used to access a given number within a multi dimensional array ``` var multiDimensionalArray = [1, 2, 3, [4, 5, 6, [7, 8, 9, [10, 11, 12, [13, 14, [15]]]]]]; ``` // to access 15... ``` fifteen = mul...
2019/07/23
[ "https://Stackoverflow.com/questions/57167958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11772136/" ]
I had a similar situation, and I deleted `ansible_python_interpreter=/usr/bin/python3` from my inventory and it worked.
To fix, I added `ansible_python_interpreter=/usr/bin/python3` to the host in my hosts file. eg. ``` [web] 123.4.5.6 ``` became: ``` [web] 123.4.5.6 ansible_python_interpreter=/usr/bin/python3 ```
16,156,959
I have PhotoView class (subclass of UIButton) and I would like that when I press any button that is class of PhotoView, same action should be triggered. I tried something like: ``` - (void)didSelectButton:(PhotoView *)sender { // do something } ```
2013/04/22
[ "https://Stackoverflow.com/questions/16156959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1832330/" ]
There are 3 scenarios in which a message could be *thought of* as being sent or posted to a process: 1. I can "send" or "post" a [window] message to a specific process by sending it to the first enumerated window in that process 2. I can "post" a [thread] message to a specific process by posting it to the first enumer...
I just answered a very similar question (with sample code) [here](https://stackoverflow.com/a/61603909/420400). The quick answer is `PostThreadMessage()`.
3,842,507
In Axler's proof of the dimension of sum formula (page 47 of Linear Algebra Done Right), there is a step that requires showing that $u\_1,...,u\_m,v\_1,...,v\_j,w\_1,...w\_k$ is a basis of $U\_1+U\_2$. Now, I understand that first I have to show that this set of vectors spans $U\_1+U\_2$. However, he says: "Clearly s...
2020/09/27
[ "https://math.stackexchange.com/questions/3842507", "https://math.stackexchange.com", "https://math.stackexchange.com/users/829617/" ]
I'll add a little more. You are right that one technically has to show both inclusions. The since every vector $u\_{i}$, $v\_{j}$, $w\_{k}$ is in $U\_{1}+U\_{2}$, the span of them is in $U\_{1}+U\_{2}$ because it's a vector subspace (closed under vector addition and scalar multiplication). Now every vector $v\in U\_{1...
Equality is pretty clear, from the definitions of span and the sum of two vector spaces. That is, the latter is just the set of all sums. There couldn't be anything in the span of the given vectors (though you didn't say what they are) that isn't a sum of elements of $U\_1$ and $U\_2$. This follows if all the basis ve...
11,608,238
Consider the following list comprehension ``` [ (x,f(x)) for x in iterable if f(x) ] ``` This filters the iterable based a condition `f` and returns the pairs of `x,f(x)`. The problem with this approach is `f(x)` is calculated twice. It would be great if we could write like ``` [ (x,fx) for x in iterable if fx wher...
2012/07/23
[ "https://Stackoverflow.com/questions/11608238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/463758/" ]
Nothing says you must use comprehensions. In fact most style guides I've seen request that you limit them to simple constructs, anyway. You could use a generator expression, instead. ``` def fun(iterable): for x in iterable: y = f(x) if y: yield x, y print list(fun(iterable)) ```
Map and Zip ? ``` fnRes = map(f, iterable) [(x,fx) for x,fx in zip(iterable, fnRes) if fx)] ```
4,335,576
$X\sim N(0,1)$, find probability density function of $Y=e^X$. Define $\psi:=e^X$, since $\psi$ is a monotonic continues function then $\frac{f\_X(X)}{|\psi'(X)|}=f\_{\psi(X)}(X)=f\_Y(Y)$. $\frac{\frac{1}{\sqrt{2\pi}}e^\frac{-x^2}{2}}{ln(y)y}=f\_Y $ I am not sure that i can use this theorem. Is it correct ? Thanks!
2021/12/16
[ "https://math.stackexchange.com/questions/4335576", "https://math.stackexchange.com", "https://math.stackexchange.com/users/960082/" ]
No it is not correct $$f\_Y(y)=\frac{1}{y\sqrt{2\pi}}e^{-\log^2(x)/2}$$ It's a LogNormal density
The cumulative probability function of $Y$ is : $$P(Y\leq t) =P(e^X\leq t)=P(X\leq \ln(t))=\int\_{-\infty}^{\ln(t)}f\_X(u)du$$ since $f\_Y (t) = \frac{d}{dt} P(Y\leq t)$, by the FTC and the chain rule you get: $$f\_Y(t)=\frac{f\_X(\ln(t))}{t}$$ Using that $X\sim N(0,1)$ $$f\_Y(t)=\frac{1}{t\sqrt{2\pi}}e^{-\frac{\l...
1,765,010
**Input**: I have the following data; | | C | D | | --- | --- | --- | | 1 | $1 | ABC | | 2 | $2 | ABC | | 3 | $3 | DEF | | 4 | $4 | ABC | I want to create another table in the same sheet where I want to add the values in Column `C` based on the keys in Column `D`. **Output**: | | G | H | | --- | --- | --- | | 1 ...
2023/01/26
[ "https://superuser.com/questions/1765010", "https://superuser.com", "https://superuser.com/users/773310/" ]
There's really no way of doing this that I know of. If you want performance, you could probably change the console scrollback and all that stuff, but the change is going to be small. Killing all unneeded processes will likely have the largest effect. You can mass kill processes with these commands (make sure cmd is ope...
The bug-report [Slow reponse to scroll and typing #107016](https://github.com/microsoft/vscode/issues/107016) is about this very problem. There are no solutions for the problem, just workarounds, since a real solution must come from the VScode team. Most workarounds seem to indicate that VScode is very inefficient on...
2,964
It is a bit late into this new year, being that we're already in the second month, but we are now cycling the Community Promotion Ads for 2017! ### What are Community Promotion Ads? Community Promotion Ads are community-vetted advertisements that will show up on the main site, in the right sidebar. The purpose of thi...
2017/02/02
[ "https://apple.meta.stackexchange.com/questions/2964", "https://apple.meta.stackexchange.com", "https://apple.meta.stackexchange.com/users/8994/" ]
[![Internet of Things](https://i.stack.imgur.com/4pLqq.png)](http://iot.stackexchange.com)
[![Follow us on Twitter](https://i.stack.imgur.com/0hCGV.png)](http://twitter.com/askdifferent)
2,518,816
I know that it's OK for a pure virtual function to have an implementation. However, why it is like this? Is there conflict for the two concepts? What's the usage? Can any one offer any example?
2010/03/25
[ "https://Stackoverflow.com/questions/2518816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/233254/" ]
Was addressed in [GotW #31](http://www.gotw.ca/gotw/031.htm). Summary: > > There are three main reasons you might > do this. #1 is commonplace, #2 is > pretty rare, and #3 is a workaround > used occasionally by advanced > programmers working with weaker > compilers. > > > Most programmers should only ever use ...
That way you can provide a working implementation but still require the child class implementer to explicitely call that implementation.
7,496,816
[A previous question](https://stackoverflow.com/questions/5640369/ienumerablet-null-coalescing-extension) discusses IEnumerable and the convention of using empty collections instead of null valued ones. It is a good practice as it does away with many mistake-prone null checks. But the answers don't quite address one o...
2011/09/21
[ "https://Stackoverflow.com/questions/7496816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/421455/" ]
The problem locates where you got the collection(`IEnumerable<T>`). If you are always busy with checking for `null` values of a collection, you should consider to modify the source. For example: ``` public User GetUser(long id) { } public List<User> GetUsers(long companyId) { } ``` The first method makes sense if it...
Unfortunately I don't think that there is anything built-in for this. Unless you repeat yourself: ``` foreach(var item in (GetUsers() ?? new User[0])) // ... ``` A slightly 'better' implementation (taking example from what the C# compiler generates for the `yield return` sytnax), which is **marginally** less wastefu...
11,611,850
I've installed a database on an instance of SQL Server Express. My client application runs and succesfully connects with the database when I run the app from the server machine. However the application will not connect to the database when I run it on other PCs on the same network. I keep getting the error message: > ...
2012/07/23
[ "https://Stackoverflow.com/questions/11611850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1109750/" ]
Generally these errors occurred when you call a region in your `page.tpl.php` file that doesn't exist in the theme's `.info` file. In your `page.tpl.php`: ``` $page['footer_firstcolumn']; ``` In your theme's `.info`: ``` regions[footer_firstcolumn] = Footer first column ``` After rechecking all regions, don't fo...
If you want to create a fresh theme best practice is to use something like [Zen](http://drupal.org/project/zen/). It's blank and fully customizable. As long as you follow the prescribed instructions, you will avoid nasty errors like the ones you have above
38,432,993
i m pretty new in angular2 and i have a question. Is there a way to add more content in a component.ts that was imported from an external file ? I have a page-header.component in multiple pages that are all the same except i change some titles like this. ``` <page-header [headerLinks]="['link1', 'link2', 'link3']"></...
2016/07/18
[ "https://Stackoverflow.com/questions/38432993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6479112/" ]
You are trying to do right: ``` <page-header [headerLinks]="['link1', 'link2', 'link3']"> <span class="rectangle-shape"></span> <h3> title </h3> <span class="rectangle-shape"></span> </page-header> ``` You just need to add `<ng-content></ng-content>` inside page-header.component.html, like this: ``` <div clas...
You can use ``` <div [innerHTML]="somePropertyWithHTML"> ``` but that only adds plain HTML and doesn't resolve any bindings or instantiate Angular2 components or directives for the added HTML. If you need this see Maybe [How to realize website with hundreds of pages in Angular2](https://stackoverflow.com/questions/...
34,894,330
I have a table in SQL Server with data that has an auto-increment column. The data in the auto increment column is not sequential. It is like `1, 2, 3, 5, 6, 7, 9` (missing 4 and 8). I want to copy the exact data in this table to another fresh and empty identical table. The destination table also has an auto incremen...
2016/01/20
[ "https://Stackoverflow.com/questions/34894330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1404715/" ]
You can insert into an `IDENTITY` column by using `SET IDENTITY_INSERT ON` in your transaction (don't forget to turn it off afterwards): [How to turn IDENTITY\_INSERT on and off using SQL Server 2008?](https://stackoverflow.com/questions/7063501/how-to-turn-identity-insert-on-and-off-using-sql-server-2008) ``` SET ID...
You can also do this: 1. Drop the copy table 2. Create as select, which will copy the exact structure and data to the new table. ``` Select * into new_table from old_table ```
24,362,582
I am having a table which will store current year dates , I am having a start date in that table also. Is there any possibility to get all the dates between current and start date using CROSS APPLY. ``` Ex: Current_Year Start_Date 2014-06-12 2011-01-01 2014-04-12 2011-01-01 2014-02-12 ...
2014/06/23
[ "https://Stackoverflow.com/questions/24362582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3751754/" ]
The following will give the desired results using CROSS APPLY: ``` WITH T AS ( SELECT Current_Year = CAST(cy AS DATE), Start_Date = CAST(sd AS DATE) FROM (VALUES ('2014-06-12', '2011-01-01'), ('2014-04-12', '2011-01-01'), ('2014-02-12', '2011-01-01'), ...
``` DECLARE @TAB1 TABLE (CURRENT_YEAR DATE) INSERT INTO @TAB1 VALUES('2014-06-12'),('2014-04-12'),('2014-02-12'),('2014-01-12') DECLARE @TAB2 TABLE (CURRENT_YEAR DATE) INSERT INTO @TAB2 VALUES('2011-01-01'),('2011-01-01'),('2011-01-01'),('2011-01-01') ``` SQL: ``` SELECT DATEADD(YY, LU.[ROW] * (-1),A.CURRE...
7,404,709
I need to backup database (using SQL Server 2008 R2). Size of db is about 100 GB so I want backup content only of important tables (containing settings) and of course object of all tables, views, triggers etc. For example: * db: `Products` * tables: `Food, Clothes, Cars` There is too much cars in `Cars`, so I will o...
2011/09/13
[ "https://Stackoverflow.com/questions/7404709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/809009/" ]
[This](http://weblogs.asp.net/shahar/archive/2010/03/03/generating-sql-backup-script-for-tables-amp-data-from-any-net-application-using-smo.aspx) arcitle was enough informative to solve my problem. Here is my working solution. I decided script all objects to one file, it's better solution because of dependencies, I thi...
What you describe is not really a Backup but I understand what your goal is: * [Scripter sample code](http://www.sqlteam.com/article/scripting-database-objects-using-smo-updated) * [Using SMO to get create script for table defaults](https://stackoverflow.com/questions/274408/using-smo-to-get-create-script-for-table-d...
61,161,205
Not able to click button ``` <p> <img class="getdata-button" style="float:right;" src="/common/images/btn-get-data.gif" id="get" onclick="document.getElementById('submitMe').click()"> <input type="button" value="Get Results" tabindex="9" id="submitMe" onclick="submitData();" style="display:none" ;=""> </p> ...
2020/04/11
[ "https://Stackoverflow.com/questions/61161205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13288689/" ]
Use the builtin `numpy.savez_compressed`? From the [numpy docs](https://docs.scipy.org/doc/numpy/reference/generated/numpy.savez_compressed.html): ``` >>> test_vector = np.random.rand(4) >>> np.savez_compressed('/tmp/123', a=test_array, b=test_vector) >>> loaded = np.load('/tmp/123.npz') >>> print(np.array_equal(test_...
so, to sum-up, i cannot use something else than zlib for now but : * I can totaly compress/decompress a (unique) numpy array and write/read it to/from a file doing as follow : ``` row = array[0,:] with open(outputFile, 'wb') as zFile: print(row) compressed = zlib.compress(row, compressionLevel) zFile.writ...
1,766,342
What is the fastest method to fill a database table with 10 Million rows? I'm asking about the technique but also about any specific database engine that would allow for a way to do this as fast as possible. I"m not requiring this data to be indexed during this initial data-table population.
2009/11/19
[ "https://Stackoverflow.com/questions/1766342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/147141/" ]
Using SQL to load a lot of data into a database will usually result in poor performance. In order to do things quickly, you need to go around the SQL engine. Most databases (including Firebird I think) have the ability to backup all the data into a text (or maybe XML) file and to restore the entire database from such a...
Use MySQL or MS SQL and embedded functions to generate records inside the database engine. Or generate a text file (in cvs like format) and then use Bulk copy functionality.
1,338,045
I can only assume this is a bug. The first assert passes while the second fails: ``` double sum_1 = 4.0 + 6.3; assert(sum_1 == 4.0 + 6.3); double t1 = 4.0, t2 = 6.3; double sum_2 = t1 + t2; assert(sum_2 == t1 + t2); ``` If not a bug, why?
2009/08/26
[ "https://Stackoverflow.com/questions/1338045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163867/" ]
This is something that has bitten me, too. Yes, floating point numbers should never be compared for equality because of rounding error, and you probably knew that. But in this case, you're computing `t1+t2`, then computing it again. *Surely* that has to produce an identical result? Here's what's probably going on. I...
When comparing floating point numbers for closeness you usually want to measure their relative difference, which is defined as ``` if (abs(x) != 0 || abs(y) != 0) rel_diff (x, y) = abs((x - y) / max(abs(x),abs(y)) else rel_diff(x,y) = max(abs(x),abs(y)) ``` For example, ``` rel_diff(1.12345, 1.12367) = 0....
3,498,005
Are there any existing user authentication libraries for node.js? In particular I'm looking for something that can do password authentication for a user (using a custom backend auth DB), and associate that user with a session. Before I wrote an auth library, I figured I would see if folks knew of existing libraries. C...
2010/08/16
[ "https://Stackoverflow.com/questions/3498005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/170589/" ]
I was basically looking for the same thing. Specifically, I wanted the following: 1. To use express.js, which wraps Connect's middleware capability 2. "Form based" authentication 3. Granular control over which routes are authenticated 4. A database back-end for users/passwords 5. Use sessions What I ended up doing wa...
A different take on authentication is Passwordless, a [token-based authentication](https://passwordless.net) module for express that circumvents the inherent problem of passwords [1]. It's fast to implement, doesn't require too many forms, and offers better security for the average user (full disclosure: I'm the author...
35,699,502
I've finally got two pickers into one viewcontroller and i've realised they're a little tricky to see because the background is dark. How do I go about changing the colour of the pickers text? Here's my whole view controller M ``` // // ViewController.m // Repayment Calculator // // Created by Stewart Piper-S...
2016/02/29
[ "https://Stackoverflow.com/questions/35699502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4320517/" ]
`<-` is to `>>=` (`bind`) where `let` is to `fmap` in a `do` block. Stealing an example from [here](https://en.wikibooks.org/wiki/Haskell/do_notation): ``` do x1 <- action1 x0 x2 <- action2 x1 action3 x1 x2 -- is equivalent to: action1 x0 >>= \ x1 -> action2 x1 >>= \ x2 -> action3 x1 x2 ``` `action1`, `actio...
A good example to visualize what `<-` does: ``` do a <- ['a'..'z'] b <- [1..3] pure (a,b) ``` You can try this in the online REPL at [try.frege-lang.org](http://try.frege-lang.org/) (You can enter this as a single line: ``` do { a <- ['a'..'z']; b <- [1..3]; pure (a,b) } ```
396,588
For e.g "All Muslims are terrorists, that muslim guy knifed that girl in London last month" "All white men have privilege, just look at any senior level boardroom" (not the same as the fallacy for associating a group with the actions of a few)
2017/06/30
[ "https://english.stackexchange.com/questions/396588", "https://english.stackexchange.com", "https://english.stackexchange.com/users/237939/" ]
It can be a ***faulty generalization*** Described by [Wikipedia](https://en.m.wikipedia.org/wiki/Faulty_generalization) as: > > A faulty generalization is a conclusion about all or many instances of a phenomenon that has been reached on the basis of just one or just a few instances of that phenomenon. It is an exa...
This is an example of **selected instances**. The difference between this and hasty/faulty generalization is as follows: a user of selected instances deliberately tries to deceive his audience by using selected examples of his point, while one who generalizes hastily has no opinion beforehand. From the AGLOA Propagan...
27,972,715
I have the most basic net/http program that I'm using to learn the namespace in Go: ``` package main import ( "fmt" "log" "net/http" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { fmt.Println(r.URL) go HandleIndex(w, r) }) fmt.Println("Sta...
2015/01/15
[ "https://Stackoverflow.com/questions/27972715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/160527/" ]
From the documentation: ``` // WriteHeader sends an HTTP response header with status code. // If WriteHeader is not called explicitly, the first call to Write // will trigger an implicit WriteHeader(http.StatusOK). ``` What is happening in your case is that you are launching `go HandleIndex` from the handler. The...
Because modern browsers send an extra request for **/favicon.ico** which is also handled in your / request handler. If you ping your server with curl for example, you'll see only one request being sent: ``` curl localhost:5678 ``` To be sure you can add an EndPoint in your http.HandleFunc ``` http.HandleFunc("/H...
2,740,630
I find myself doing this a lot: ``` script/generate migration my_new_migration ``` .. then select & copy the generated filename, then paste it into vi to actually write the migration. Is there any way to do this in one step? i.e. when the script/generate migration runs, it creates the file the automatically opens ...
2010/04/29
[ "https://Stackoverflow.com/questions/2740630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/292008/" ]
Well to start with, I'd find out what query is being generated (in LINQ to SQL you'd set the Log on the data context) and then profile it in SQL Server Management Studio. Play with it there until you've found something that is fast enough (either by changing the query or adding indexes) and if you've had to change the ...
The `Take(100)` translates to "Select Top 100" etc. This would help if your problem was an otherwise huge result set, where there are a lot of columns returned. I bet though that your problem is a table scan resulting from the query. In this case, `.Take(100)` might not help much at all. So, the likely culprit is the...
58,205,999
First stack overflow question here. Hope I do this correctly: I need to use an external python library in AWS glue. "Openpyxl" is the name of the library. I follow these directions: <https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-python-libraries.html> However, after I have my zip file saved in the ...
2019/10/02
[ "https://Stackoverflow.com/questions/58205999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12155080/" ]
It depends if the job is Spark or Python Shell. For Spark you just need to zip the library and then when you point the job to the library S3 path, the job will import it. You just need to make sure that the zip contains this file: `__init__.py` For example, for the library you are trying to import, if you download it f...
You may use following boilerplate code to use extra files as well as external libraries - <https://github.com/fatangare/aws-python-shell-deploy>
10,092,468
I'd like to generate a random date between two dates -- for example a random date between today and 60 days from now. How do I do that? **UPDATE** Using information from the answers, I came up with this method, which I use quite often: ``` // Generate a random date sometime between now and n days before day. // Also...
2012/04/10
[ "https://Stackoverflow.com/questions/10092468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/257550/" ]
Use seconds. Pseudocode: ``` 1 Generate a random integer between 0 and (60 * 60 * 24 * 60) 2 Get the unixtime in seconds for the current time 3 Add your random integer 4 Convert this integer back to a date ```
**Swift 3.x +** ``` public extension Date { /// SwiftRandom extension public static func randomWithinDaysBeforeToday(days: Int) -> Date { let today = Date() let gregorian = Calendar(identifier: .gregorian) let r1 = arc4random_uniform(UInt32(days)) let r2 = arc4random_uniform(UI...
80,642
[![In this photo lines are clearly visible.](https://i.stack.imgur.com/KBdJz.jpg)](https://i.stack.imgur.com/KBdJz.jpg) * Shutter speed - 32 sec. * Aperture - f/9 * ISO - 100 * Lens - EF-S18-55mm f/3.5-5.6 IS II * Focal Length - 39 mm I have took the photo through the window, with the lights off
2016/08/03
[ "https://photo.stackexchange.com/questions/80642", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/54416/" ]
Although the poster hasn't specified it, this answer assumes this picture was shot on a tripod (it looks too sharp to be hand-held, even holding the camera steady against the window). Many claimed that this is caused by a movement of the camera. However, I believe that it is actually due to the optical stabilization (...
Those street light lines are due to the camera motion mostly at the time of shutter release (or shutter closing ) you may avoid them to some extent by having Camera Timer of say 3s or so
4,801,189
This is probably the weirdest problem I have run into. I have a piece of code to submit POST to a url. The code doesn't work neither throws any exceptions when fiddler isn't running, However, when fiddler is running, the code posts the data successfuly. I have access to the post page so I know if the data has been POST...
2011/01/26
[ "https://Stackoverflow.com/questions/4801189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/552301/" ]
Always use using construct. it make sure all resource release after call ``` using (HttpWebResponse responseClaimLines = (HttpWebResponse)requestClaimLines.GetResponse()) { using (StreamReader reader = new StreamReader(responseClaimLines.GetResponseStream())) ...
I found the solution in increasing the default number of connections ``` ServicePointManager.DefaultConnectionLimit = 10000; ```
19,760,590
I have two java class with same properties names.How Can I copy all the properties to another bean filled with data.I don't want to use the traditional form to copy properties because I have a lot of properties. Thanks in advance. **1 class** ``` @ManagedBean @SessionScoped public class UserManagedBean implements S...
2013/11/04
[ "https://Stackoverflow.com/questions/19760590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2683519/" ]
Use [`BeanUtils`](http://commons.apache.org/proper/commons-beanutils): ``` import org.apache.commons.beanutils.BeanUtils; UserBean newObject = new UserBean(); BeanUtils.copyProperties(newObject, oldObject); ```
Check out the [Dozer Framework](http://dozer.sourceforge.net/) - its an object to object mapping framework. The idea is that: * Usually it will map by convention. * You can override this convention with a mapping file. . . therefore mapping files are as compact as possible. Its useful for many cases, such as mapping...
36,038,616
In WebStorm to get `karma.conf` running I need to configure it in a pop up window and enter the "path to the node.js interpreter". *(for some reason this information vanished after a restart)* **Questions:** 1. What is the path to the needed file? 2. Where is the node interpreter on Mac/Linux/Windows by default? (I...
2016/03/16
[ "https://Stackoverflow.com/questions/36038616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3313410/" ]
On OSX if you've installed Node.js with brew: `/usr/local/bin/node` You can check the exact folder on your machine with the command `which node` **Important** When the finder opens on OSX, you won't be able to navigate to this path initially. You'll first need to navigate to the root folder e.g. `Macintosh HD` and ...
This can be useful for someone. I tried all the previous methods on Linux Ubuntu 19.10, none worked, neither reinstalling nodejs. So I installed Webstorm via snap, with: ``` sudo snap install webstorm sudo snap install webstorm --classic ``` And surprise, Nodejs was already configured in this version. Then I erased ...
8,854,200
I have some CSV data like this: ``` 1325318514,197.1,184.9,172.4,146.0,147.3,131.1,280.9,182.7,12.6,5.0,0.0,73001,65848,0 1325318536,196.2,184.2,172.1,146.3,147.1,131.1,264.9,175.6,12.6,5.0,0.0,71590,64616,0 1325318557,196.6,184.9,172.1,147.6,146.8,130.9,264.9,178.4,12.6,5.0,0.0,69607,61274,0 1325318578,196.7,184.2,17...
2012/01/13
[ "https://Stackoverflow.com/questions/8854200", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You don't have an element with the id *hidden* so `document.getElementById("hidden").value="hidden";` will throw an error as you can't set properties on `undefined`. The script will stop running and never reach `return false` so the form will submit as normal.
You can use ``` onclick="return test()" ``` and just return false at the end of the function.
86,102
Is there a way to programmatically (that is write a small c app or better yet a ruby or perl script) to obtain a list of all of the guests (and also details about the guests) from a VMWare Infrastructure? Thanks, Matt Delves
2009/11/18
[ "https://serverfault.com/questions/86102", "https://serverfault.com", "https://serverfault.com/users/24923/" ]
**How to reset your log files** Sooner or later, you'll want to reset your log files (`access_log` and `error_log`) because they are too big, or full of old information you don't need. `access_log` typically grows by 1Mb for each 10,000 requests. Most people's first attempt at replacing the logfile is to just move t...
Try using `logrotate` * it is a powerful tool which gives configurable options for rotating logs. * it also has facility to run command during `prerotate` and `postrotate` * `copytruncate` enables you to copy existing files and then truncate it. The copy can be moved to another storage such as hadoop, s3 for backup if...
58,143,434
Given an HTML string: ``` myhtml = "<title> my title </title>" ``` How can I write a function that returns `true` if there is a floating/unescaped `<` or `>`, along with the offending character itself? Examples: ``` myhtml = "<title> my title </title>" hasFloating(myhtml) => false myhtml = "<title> < </title>" has...
2019/09/28
[ "https://Stackoverflow.com/questions/58143434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11552811/" ]
You need to keep track of the previously selected value and remove it when the option is changed. ``` var val = ""; var theval = $("#1471599855"); $("#todoslosmodelos select").change(function(){ val = $.each($(this).children("option:selected"), ()=> { var before_change = $(this).data('pre'); let value = $(this)...
I believe, this markup and the values of the select will remain like as you have shown in your code snippet. Your existing script fetch all the existing data from $("#1471599855") and append newly selected fields without checking if the values from that dropdown is already taken or not. If I were you what I will do is...
37,729,878
I am using WooCommerce for a nonprofit website and want to change the "Place Order" button text to say "Place Donation". The button is defined in WooCommerce's payment.php file: ``` <?php echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place...
2016/06/09
[ "https://Stackoverflow.com/questions/37729878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5775880/" ]
Just came across the same issue myself. What I did to solve it is close to your solution. Instead of dequeueing it completely I dequeued it and uploaded the excact same script to my child theme + commented out ``` `/* if ( $( this ).data( 'order_button_text' ) ) { $( '#place_order' ).val( $( this ).data( 'order_...
I solved this by using CSS: ``` #place_order { font-size: 0px !important; } #place_order::after { content: 'Place Donation'; font-size: 15px; } ```
31,444,652
I am trying to load a solution in Visual Studio 2013 but I am receiving this message: ![Project Target Framework Not Installed](https://i.stack.imgur.com/O0bmy.png) When I click OK it shows another error message: > > Attempted re-targeting of the project has been canceled. Required > assemblies 'WindowsBase', 'Pr...
2015/07/16
[ "https://Stackoverflow.com/questions/31444652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5121581/" ]
Open that project file in notepad and change .net version to < your project .net version > and try loading it in VS 2013
When you get these message, you can do the following step by step: 1. open another project by +click on a yourprojectname.sln, so you have two visual studios open. (One with a working project). 2. RightClick on your projectname in the solution explore and choose "Unload project". 3. RightClick again on you project and...
5,631,730
Can any one suggest how I could remove the cancel button next to login button in the Facebook graph API for iPhone. Where does the code lie?
2011/04/12
[ "https://Stackoverflow.com/questions/5631730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/688663/" ]
Use a [DispatcherTimer](http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer.aspx), there are also examples how to use it on the given link
Use a dispatch timer like this > > Delcare it > > > ``` public System.Windows.Threading.DispatcherTimer timer1; ``` > > In the constructor > > > ``` timer1 = new System.Windows.Threading.DispatcherTimer(); timer1.Interval = TimeSpan.FromSeconds(180); // 3 mintues interval timer1.Tick += TimerTicked; // Eve...
68,703,212
I started tinkering with JavaScript (Node) recently, and I'm having a problem with a function that performs file writing. This function is always executed last, regardless of the calling order, and I can't fix it, could someone help me? (For example, in the code below, the categorySumPrice() function should run after t...
2021/08/08
[ "https://Stackoverflow.com/questions/68703212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16619374/" ]
`writeFile` is an asynchronous function, which means that it will execute in parallel to other things. So: 1. You call `writeFile` then it starts writing. 2. The rest of your code continues executing while it's writing. 3. The `writeFile` finishes writing. In order to have it execute synchronously with your other cod...
`fs.writeFile()` is executed asynchronously meaning that `categorySumPrice()` comes ahead of `createAndWriteFixedJsonFile()` because it takes time to save the file. To avoid this you need to call `categorySumPrice()` from the callback function in `fs.writeFile()`: ``` // create and write fixed Json file function crea...
92,619
I have a potential customer who has an idea for an ipad application but is unable to find sufficient fundings for this. One idea that came up is that I do the work either for free or for a minor fee and then receive a percentage of the income from appstore. How do I decide what percentage is realistic? How is this...
2011/07/13
[ "https://softwareengineering.stackexchange.com/questions/92619", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/11921/" ]
Do it like a record contract. He gets 90% of the profit, but first you get to recoup the development costs. Simple.
How much is your time worth? If you are into charity and want to spend the time to learn and help out a friend, then go ahead and do it for a percentage. However, if you expect to get any return for your time ($$), then either get paid for your time via a real contract or implement it yourself and get the rewards. You...
9,292,465
I'm trying to make a game for kids. I've a movieClip called "picChange" and inside that movieClip, there is another movieClip called "picFrame" and inside that movieClip there are three movieClips called "HolderL1", "HolderL2", "HolderL3". I use these 3 movieClips to attach movieClips(questions for game) from library. ...
2012/02/15
[ "https://Stackoverflow.com/questions/9292465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1170685/" ]
Well, to start with I'd suggest using `List<T>` instead of `ArrayList`. Then LINQ to Objects makes it really easy: ``` if (list.Any(x => x.HasFoo)) { } ``` Or without LINQ (but still `List<T>`) ``` if (list.FindIndex(x => x.HasFoo) != -1) { } ``` If you *really* need to stick with a non-generic collection but hav...
use Linq: ``` var query = from o in yourarray select o where o.atribute==ValueIWant; `query.Count()` will return the number of objects that fit the condition. ``` check that msdn example: [Linq example](http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b)
60,328,437
I am trying to plot a median time denoted `ee$rfs` per `ee$Ki67`, which is marker of many cells that proliferates in a tumor sample, ie. a continuous covariate too. I have attached my data `ee` below. I am searching for a solution in either `dplyr` or `ggplot`. Obviously, I have sought for help, such as [here](https:...
2020/02/20
[ "https://Stackoverflow.com/questions/60328437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8811399/" ]
Hadoop doesnt have an SCP upload feature. If you want to get files in without an edge node or SSH, then that's what WebHDFS or the NFSGateway offer
Transfer using pipe mkfifo - this creates pipe on local server (this doesn't store any data) try mkfifo <pipename - some path on your server where ssh keys are present> | scp : | hdfs dfs -put | rm
72,992,593
How can I format date-time in Angular with `DatePipe.format()` & skip all timezone conversion regardless where I am. For example for such examples all over the world (regardless time) I want to get `07/06/2022`: ``` console.log('2022-07-06T00:00:00.000Z :', this.datePipe.transform('2022-07-06T00:00:00.000Z', 'MM/dd/yy...
2022/07/15
[ "https://Stackoverflow.com/questions/72992593", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1645431/" ]
Haha, I tried many ways but it doesn't work, maybe just cut the string to cheat ``` const dateArr = [ '2022-07-06T00:00:00+00:00', '2022-07-06T00:00:00.000Z', '2022-07-06T06:00:00.000Z', '2022-07-06T13:00:00.000Z', '2022-07-06T23:59:59.000Z', '2022-07-06T00:00:00-07:00', '2022...
Here is what i think: In the component ts : declare a variable call d='2022-07-06T00:00:00+00:00'(for example) And in the HTML of the component : ``` <div>{{d| date:'dd/MM/YYYY'}}</div> ``` Now you should get 07/06/2022 no matter what timezone is.
1,370,277
I am a student of Pure Mathematics and also interested in programming .I have learnt C++,SAGE . Recently I have started learning "Cryptography" .But there are many definitions involved here like polynomial time algorithm,time complexity etc. My question is it all right for a student in Pure Mathematics to study Crypt...
2015/07/22
[ "https://math.stackexchange.com/questions/1370277", "https://math.stackexchange.com", "https://math.stackexchange.com/users/294365/" ]
As a computer science student who took a graduate course (albeit an introductory one) in cryptography last semester, I found myself pulling from my knowledge of number theory *immensely* more than I did from my knowledge of computer science. The field today is a highly mathematical one, with current state-of-the-art sy...
Much of cryptography today works on grounds of abstract algebra (and number theory). Clearly to show that some encryption technique has a corresponding decryption one requires proof, that is math. But that is just a small part of cryptography. The recent most talked about problems with cryptographic systems have been p...
54,019,699
I need to show alert if my parent div has a child div using JavaScript only No jQuery. I have tried using the `contains()` function to check my div and send alert but it's not working. ```html <script type="text/javascript"> var parentDiv = document.getElementById("commentBox"); var childDiv = document.getEleme...
2019/01/03
[ "https://Stackoverflow.com/questions/54019699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1933996/" ]
Make sure that the whole DOM is loaded before you execute javascript code. You can do this by adding the event listener `DOMContentLoaded` to your code or placing your scripts at the end of the file ```html <script type="text/javascript"> document.addEventListener('DOMContentLoaded', function(){ var pare...
How about using `window.onload` function? ``` <script> window.onload = function() { var parentDiv = document.getElementById("commentBox"); var childDiv = document.getElementById("comment1"); if (parentDiv.contains(childDiv)) { alert("yes"); } else { alert("n...
1,073,423
When writing a new jQuery plugin is there a straightforward way of checking that the current version of jQuery is above a certain number? Displaying a warning or logging an error otherwise. It would be nice to do something like: ``` jQuery.version >= 1.2.6 ``` in some form or another.
2009/07/02
[ "https://Stackoverflow.com/questions/1073423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/132177/" ]
``` $().jquery; ``` or ``` jQuery.fn.jquery; ```
Instead of using `parseInt` as i saw in one of the answers above i would suggest to use `parseFloat` as mentioned below ``` var _jQueryVer = parseFloat('.'+$().jquery.replace(/\./g, '')); /* Here the value of _jQueryVer would be 0.1012 if the jQuery version is 1.0.12 which in case of parseInt would be 1012 wh...
48,513,607
I've seen examples of DynamoDB as the data source for AWS AppSync but I'm wondering if Aurora (specifically PostgreSQL) can be used? If yes, what would the resolvers look like for a basic example? Are there any resources that demonstrate doing this for Aurora PostgreSQL or even MySQL?
2018/01/30
[ "https://Stackoverflow.com/questions/48513607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1843640/" ]
You can use the AWS Lambda resolver available in AWS AppSync to access Aurora Postgres. The code is similar to how you would access a relational database using any language. For example, you could use [node-postgres](https://node-postgres.com/) with NodeJS to implement the Lambda function.
As of time of writing, yes but only if it is a **Serverless** Aurora RDS cluster set to Postgres compatibility. The reason for this is it's the only RDS instance type that supports the [Data API](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html). Other RDS instances would have to be configured...
25,338
I read on Wikipedia that zero-knowledge proofs are not used for authentication in practice. Instead (I think) the server is entrusted with seeing a password in plaintext form, which it should then add a salt to and hash. But for a split moment, the server knows the secret. Why should I implicitly trust the server like ...
2015/04/30
[ "https://crypto.stackexchange.com/questions/25338", "https://crypto.stackexchange.com", "https://crypto.stackexchange.com/users/23901/" ]
Having a client (ex. your web browser) use zero-knowledge proofs to authenticate itself to a server only makes sense if the server knows about the client's public key in advance, and if the client keeps the same private key forever. So you could have the client-side generate a keypair when you register your account, an...
> > But for a split moment, the server knows the secret > > > ... and so is the wireless bug in the cable of the keyboard, the web-cam of your laptop and iPhone, the microwave microphone of the satellite eavesdropping the sound of your keystrokes, etc. If you are afraid of the server don't go in Internet (it is no...
129,713
Recently, I heard one of my colleague said "the 16-bits ADC is enough for us, we can use 'oversampling' tech...". Finally I figured out his "oversampling tech" means to sample many many cycles (AC sampling). But I wonder if we don't improve the sample rate, what is the benefit from sampling many cycles? Can it increase...
2014/09/18
[ "https://electronics.stackexchange.com/questions/129713", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/25264/" ]
Oversampling means to sample at significantly more than the Nyquist Rate. When using an ADC, the ADC generates quantisation noise because the continuous valued signal has to be translated to discrete output values. If you oversample then this noise power is "spread out" over a larger frequency range, i.e. it has a low...
The minimum sampling rate needed is twice the highest frequency of the spectrum of the signal you wish to measure. If the highest frequency in the spectrum of the signal is 10kHz then you need to sample at least twice as high (20,000 times per second) in order to avoid aliasing. Most folk go a bit better than this an...
67,736,409
I am trying to remove the brackets from the list I have created but I am not sure how to go about doing this. I thought of doing replace() but this is a list object and so this would not work. How can I remove these tuple brackets and also the numbers? I have tried using isDigit() for number removal from the list but t...
2021/05/28
[ "https://Stackoverflow.com/questions/67736409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14723580/" ]
You can use `extend` to add all items from a `tuple` to a list: ``` displayMovies = [('King Kong', 100), ('Spider-Man', 98)] noTuples = [] for item in displayMovies: noTuples.extend(item) ``` Output: ``` >>>noTuples >>>['King Kong', 100, 'Spider-Man', 98] ``` Then you can use list comprehensions to remove num...
You can try `dict.keys`: ``` displayMoviesForSort = list(movies.keys()) >>> ['Spider-Man', 'King Kong'] ``` Or: ``` #Removed brackets flatList = [item for sublist in displayMoviesForSort for item in sublist] flatList >>> ['Spider-Man', 98, 'King Kong', 100] #Removed numbers flatList = flatList[::2] flatList >>> ['...
54,019,850
I have 2 php variables in PHP (mainly $usm and $ag) and am passing them to the frontend. In Javascript am using isset to check if they have a value before executing some code but seems not to work ``` <script> if( <?php isset($usm , $ag) ?> ){ $( document ).ready(function() { var usmData = {!!...
2019/01/03
[ "https://Stackoverflow.com/questions/54019850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6013697/" ]
You need to check the isset part with PHP only. ``` <?php if(isset($usm) and isset($ag)){ ?> <script> $( document ).ready(function() { var usmData = '<?php echo json_encode($usm); ?>'; var agData = '<?php echo json_encode($ag); ?>'; }); </script> <?php } ?> ```
``` <script> <?php if(isset($usm , $ag)) { ?> $( document ).ready(function() { var usmData = {!! json_encode($usm) !!}; var agData = {!! json_encode($ag) !!}; }); <?php } ?> </script> ```
62,561,010
I am trying to append a new child when user clicks on a button. The new child is already defined with few CSS properties. Is it possible to do so ? I have tried a few codes, the best i could do is - ```js var body = document.querySelector('body'); var bubbles = document.createElement("span") function a1click(){ ...
2020/06/24
[ "https://Stackoverflow.com/questions/62561010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13779469/" ]
Use the `...` syntax with `.push()` ``` growthArr.push(...parentArr) ``` --- This works because `.push()` takes any number of arguments, and pushes them all into the targeted array. ***Note:*** This mutates the original array without creating a new one and overwriting it. This can be important if there are other r...
Use array concat() method. So the syntax would be ``` parentArr.concat(growthArr); ```
27,953,969
I'm a beginner in Python and I can't find an answer to my problem. I have a file with some data and I want to get numbers from this file. My program looks like this: ``` class Mojaklasa: def przenumeruj_pdb(self): nazwa=raw_input('Podaj nazwe pliku: ') plik=open(nazwa).readlines() write=open('out.txt','w')...
2015/01/14
[ "https://Stackoverflow.com/questions/27953969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3541098/" ]
You can replace a lot of logic with a properly formatted regular expression. ``` for i in plik: m = re.match(r'ATOM\s+.*?\s+.*?\s+.*?\s+.*?\s+(-?\d+)', i) if m: write.write(m.group(1) + '\n') ```
Here's an overall-improved approach: ``` import re class Mojaklasa: def przenumeruj_pdb(self): nazwa=raw_input('Podaj nazwe pliku: ') with open(nazwa) as plik, open('out.txt','w') as zapis: for i in plik: j = i.split() if len(j) <= 5: continue ...
71,595,911
Not sure what the right terms were to start this question but basically I have a downloaded UI tool that runs on 0.0.0.0:5000 on my AWS EC2 instance and my ec2 instance has a public ip address associated with it. So right now everyone in the world can access this tool by going to {ec2\_public\_ip}:5000. I want to run ...
2022/03/24
[ "https://Stackoverflow.com/questions/71595911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9676301/" ]
In short, the answer is *no*. If you want authorization (I think, you mean, authentication) to access an application running on the server - you need tools that run *on the server*. If your tool offers such capability - use it. It looks like Kafka Magic *has* such capability: <https://www.kafkamagic.com/faq/#how-to-aut...
You can easily create a script that uses the aws sdk or even just executes the aws CLI to view/add/remove an ip address of a security group. How you execute that script depends on your audience and what language you use. For a small number of trusted users you could issue them an IAM user and API key with a policy tha...
8,181,894
I have some doubts in JAVA. I have a task executor which will create a new Thread for each task and each thread will execute a task from jar by ``` Runtime.getRuntime().exec(" java -jar myjar"); ``` I read in some posts that by executing like this each thread will create its own JVM. Then if I want to execute the s...
2011/11/18
[ "https://Stackoverflow.com/questions/8181894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1053496/" ]
It looks like the array that comes with gcc 4.6 doesn't have a debug mode yet. Understandable since C++11 support is still experimental. There is a flag `_GLIBCXX_DEBUG` which is usually used to turn on debug mode. If you look at /usr/include/c++/4.6/debug/vector:313 you'll see `operator[]` has: ``` __glibcxx_check_s...
``` template<class T, std::size_t N> T const& at(std::array<T,N> const& arr, std::size_t pos){ #ifndef NDEBUG // debug versions, automatically range checked return arr.at(pos); #else // release version, unchecked return arr[pos]; #endif } template<class T, std::size_t N> T& at(std::array<T,N>& arr, std::si...
9,483,348
I use [google-gson](http://code.google.com/p/google-gson/) to serialize a Java map into a JSON string. It provides [a builder handles null values](https://sites.google.com/site/gson/gson-user-guide#TOC-Null-Object-Support): ``` Gson gson = new GsonBuilder().serializeNulls().create(); ``` The problem is that the resu...
2012/02/28
[ "https://Stackoverflow.com/questions/9483348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51197/" ]
In the actual version of gson you can do that: ``` Object instance = c.getConstructor().newInstance(); GsonBuilder gb = new GsonBuilder(); gb.serializeNulls(); Gson gson = gb.create(); String stringJson = gson.toJson(instance); ```
There's no solution. I've [opened an issue at Gson's page](http://code.google.com/p/google-gson/issues/detail?id=416); Hope it will get fixed on the next version.
95,337
The official help does not mention such modification, but people mention this solution at various places on the net, saying they do this for quicker page load. How can one be sure that it's an allowed modification of the default ad code (which otherwise loads during page load, before the window.load event), so one's a...
2016/06/16
[ "https://webmasters.stackexchange.com/questions/95337", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/11093/" ]
According to this [Google Policy](https://support.google.com/adsense/answer/48182#beh): > > **Publishers are permitted to make modifications to the AdSense ad code** so long as those modifications do not artificially inflate ad performance or harm advertisers. > > > Loading Ad. script on Window load event in no w...
This is not necessary. The latest ad code uses the "async" attribute on the script tag, which means it does not block rendering or delay loading of your site. The tag that loads the script looks like this: ``` <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> ``` If you are load...
19,265,917
I have a google+ share link that someone can click to share (on their own stream) a url specified by the rails app (not the current page). I want to be able to record if the link was clicked and successfully shared. Here is the google+ share link code I'm using ``` <a href="https://plus.google.com/share?url=#{@user.w...
2013/10/09
[ "https://Stackoverflow.com/questions/19265917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2135210/" ]
You cannot confirm if someone shared a post to their stream using the Share widget parameters or the JavaScript API. Niraj's answer is flawed and does not work, see [this JSBin to try it](http://jsbin.com/EhOpOba/1/edit?html,console,output). In some situations, you can surround the widget with a div that you track the...
It's possible to track a click on the button, but not the share itself. If you use the Google+ Web Share button, you can do something like the following: ``` <div class="g-plus" data-action="share" data-href="https://www.webniraj.com/2013/10/02/google-api-sharing-an-interactive-post/" data-onendinteraction="trackShare...
3,007,419
I have a function called init on my website in an external file called functions.php. Index.php loads that page and calls function init: ``` function init(){ error_reporting(0); $time_start = microtime(true); $con = mysql_connect("localhost","user123","password123"); mysql_select_db("db123"); } ``` How c...
2010/06/09
[ "https://Stackoverflow.com/questions/3007419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/336983/" ]
If you want to specifically use globals, take a look at [$GLOBALS](http://www.php.net/manual/en/reserved.variables.globals.php) array. Even though there are couple of other ways, *[Pass by reference](http://php.net/manual/en/language.references.pass.php)*, *[Data Registry Object](http://zendframework.com/manual/en/zend...
You can declare them in the global scope, then pass them to the function by reference. *After modifying the function to do so.*
934
I am at the end stages of choosing parts for my PC but am finding it quite difficult to choose a CPU cooler since there is so much to take in. Should I go for a standard CPU cooler (with fans), a fanless one or water cooling? I am considering either water cooling / fanless because they are both quieter than normal co...
2015/10/29
[ "https://hardwarerecs.stackexchange.com/questions/934", "https://hardwarerecs.stackexchange.com", "https://hardwarerecs.stackexchange.com/users/543/" ]
I don't recommend fanless or water cooling. Instead, I recommend [Cooler Master Hyper 212 EVO](http://www.newegg.com/Product/Product.aspx?Item=N82E16835103099) (which is a newer version of the [212 Plus](http://www.newegg.com/Product/Product.aspx?Item=N82E16835103065) I have). [![Cooler Master 212 EVO](https://i.stack...
This is a slightly more budget friendly option, which is according to the budget which was just edited in, the Noctua NH-D14. This CPU cooler keeps temps pretty low, about 5\*C higher on an i7-4770k than the NZXT Kraken x61 I mentioned above. The NH-D14 is an air cooler available [here](http://www.amazon.co.uk/dp/B00...
10,378,926
I m using jsf2.0. And i m making one email application, I m calling web service to read the content of the file, and i m using SAX parser to extract the content from the to read the file. And i m storing that content in string variable and set it in setter method. And displaying it in outputLabel. Now, problem is when ...
2012/04/30
[ "https://Stackoverflow.com/questions/10378926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1260898/" ]
Check out if `h:outputText`'s `escape` flag set to `false` can help you. > > escape: This attribute sets a boolean flag value that determines if > sensitive HTML and XML characters should be escaped in the output > generated by the component. It's default value is "true". > > > (Description from [here](http://w...
Set the CSS `white-space` property of the parent element to `pre`. E.g. ``` <h:outputText value="#{bean.xml}" styleClass="preformatted" /> ``` with ```css .preformatted { white-space: pre; } ```
8,985,569
I have 5 views(.ui.xml). On every view i paste soemthing like that: ``` <ui:style src="../MyStyle.css" /> ``` and on every button on every page I put styleName attribute: ``` <g:Button ui:field="buttonName" styleName="{style.myButtonStyle}" /> ``` My Question is: Do I have to put styleName for all my buttons ? ...
2012/01/24
[ "https://Stackoverflow.com/questions/8985569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/458197/" ]
Have you tried to customize [GWT themes](http://code.google.com/intl/ru/webtoolkit/doc/latest/DevGuideUiCss.html#themes) or create your own ? I think this is what you need to do.
Create your own button MyButton by extending Composite and define the UIBinder for this Button with style once. Next you can re-use this button by adding your own namespace in the views. Here's your widget : ``` package com.example.widgets; ... public class MyButton extends Composite { interface MyButtonUiBinde...
4,637,036
I have the following directory layout: ``` runner.py lib/ tests/ testsuite1/ testsuite1.py testsuite2/ testsuite2.py testsuite3/ testsuite3.py testsuite4/ testsuite4.py ``` The format of testsuite\*.py modules is as follows: ...
2011/01/09
[ "https://Stackoverflow.com/questions/4637036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/568454/" ]
With pytest-xdist there currently no kind of "per-file" or "per-test-suite" distribution. Actually, if a per-file distribution (e.g. tests in a file will be only executed by at most one worker at a time) would already help your use case i encourage you to file a feature issue with the pytest issue tracker at <https://b...
Having test suites in directory like in the question, you can run them in parallel it via: ``` pytest -n=$(ls **/test*py | wc -l) --dist=loadfile ``` If you have your tests suite files in single directory then just ``` pytest -n=$(ls test*py | wc -l) --dist=loadfile ``` In case new suite file occurs, this will i...
33,240,871
Android studio has updated and before everything was going ok but now with this update I cant seem to get my next activity after successful login to start, here: ``` public void doLogIn(View v) { EditText username = (EditText) findViewById(R.id.userEditText); EditText password = (EditText) findViewById(R.id.password...
2015/10/20
[ "https://Stackoverflow.com/questions/33240871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1423656/" ]
Solved it. The problem was that the user that handles Rails on the virtual server didn't have all the access needed to generate files on behalf of paperclip in the app's folder. So I gave larger access to the folder using this terminal command: ``` $ sudo chmod -R 775 /RailsAppFolder ```
Try to replace ``` path: "~rails/umbertoputzu/public/system/:attachment/:id/:style/:filename", ``` with ``` path: "~/rails/umbertoputzu/public/system/:attachment/:id/:style/:filename", ```
18,240
I worked for a company that named the pc's after roman gods (zeus, mars...). That was quiet funny while there where only 5 pc's on the network, but after changing the pc's several times I didn't remember my pc name. What naming convention do you use or what was the most useless naming convention you ever used?
2009/06/02
[ "https://serverfault.com/questions/18240", "https://serverfault.com", "https://serverfault.com/users/13733/" ]
There is actually an [RFC (1178)](http://www.faqs.org/rfcs/rfc1178.html) regarding best practice in naming computers. The following is discouraged by this RFC: * Don't overload other terms already in common use. * Don't choose a name after a project unique to that machine. * Don't use your own name. * Don't use long ...
I mostly use names from a **set of names**. Examples: * Characters from animated series (Simpsons, American Dad, Family Guy) * Names of [real stars](http://en.wikipedia.org/wiki/List_of_traditional_star_names) (Sol, Arktur, Maia, Bellatrix, Deneb, ...) * Names of (semi-)fictious Star Trek planets (Chronos, Vulcan, Ri...
5,601,222
I would like to know the difference between two conventions: 1. Creating an abstract base class with an abstract method which will be implemented later on the derived classes. 2. Creating an abstract base class without abstract methods but adding the relevant method later on the level of the derived classes. What ...
2011/04/08
[ "https://Stackoverflow.com/questions/5601222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/698895/" ]
Much like interfaces, abstract classes are designed to express a set of known operations for your types. Unlike interfaces however, abstract classes allow you to implement common/shared functionality that may be used by any derived type. E.g.: ``` public abstract class LoggerBase { public abstract void Write(object ...
In the case 1) you can access those methods from the abstract base type without knowing the exact type (abstract methods are virtual methods). The point of the abstract classes is usually to define some contract on the base class which is then implemented by the dervied classes (and in this context it is important to ...
121,222
I found a very old pot in my very old house. I suspect it to be carbon steel, for the following reasons: 1. It's rusty 2. It's magnetic 3. It looks a lot like the carbon steel pans that were stored with it, except it's the shape of a pot I would like to use it for the same purposes one usually uses a pot: cooking ric...
2022/08/02
[ "https://cooking.stackexchange.com/questions/121222", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/100262/" ]
I am with Bon Appetit on this one, or even more extreme - I always pan-fry mushrooms on the highest heat setting. For me, the keys for nice, browned mushrooms on a domestic stove are: * Use very *high heat*, and preheat the pan before the first batch. * *Don't crowd* the pan, make a single layer of mushrooms. * Use a...
While I often cook mushrooms the way @rumtscho does, I wouldn't discount the advice of Harold McGee ([refer to top right, p. 346](http://wtf.tw/ref/mcgee.pdf)). If you are looking to maximize flavor, it might be worth experimenting with a combination of both techniques. The important point McGee makes is that when heat...
19,331,941
Why don't the numeric arrays end with a null character? For example, ``` char name[] = {'V', 'I', 'J', 'A', 'Y', '\0'}; ``` But in case of numeric arrays there is no sign of null character at the end... For example, ``` int marks[] = {20, 22, 23}; ``` What is the reason behind that?
2013/10/12
[ "https://Stackoverflow.com/questions/19331941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2873504/" ]
An array of char not necessarilly ends with \0. It is a C convention that strings are ended with \0. This is useful to find the end of the string. But if you are only interested in holding data that is of type char, you can have a \0 at end or not. If your array of char is intended to be used as a string, you ...
**We have a convention:** special character `'0'` with numeric code `0`, marks end of the string. But if you want to mark end of `int` array, how will you know is that `0` is a valid array member or end-of-array mark? So, in general, it is not possible to have such a mark. **In other words:** The character `'\0'` (b...
41,423,373
Below is what I am trying to achieve. I have a procedure which receives employeeIds as optional arguments and stores them into a temp table (temp\_table) like this ``` empId ------- 3432 3255 5235 2434 ``` Now I need to run below query in 2 conditions: **1st condition**: if argument is non blank then my query shoul...
2017/01/02
[ "https://Stackoverflow.com/questions/41423373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7364392/" ]
I recommend to stick to what you are already doing. It is the cleanest and safest way performance wise.
Try this one ``` SELECT * FROM DEPARTMENTS WHERE ( @args <> '' OR EXISTS (SELECT 1 FROM temp_table WHERE emp_no = empId) ) ```
73,760,710
So I'm trying to study in advance about css/html. I wanted to get rid of the extra space after the navigation pane and i can't remove it. can someone help me? thanks. also I'm having a hard time putting some elements on every section and putting some animation in it(any recommendations?) ```css **/* what line should i...
2022/09/18
[ "https://Stackoverflow.com/questions/73760710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20024260/" ]
This is because of scoped recomposition. Any Composable that is not inline and returns Unit is a scope. Compose only triggers recomposition in nearest scope. In your example it's Button's scope. You can check out this question which is very similar [Why does mutableStateOf without remember work sometimes?](https://sta...
In this particular example when you click the button, only lines 42-47 will be recomposed. You can verify this by adding a log statement in line 41. When the whole `MyChildUI` composable recomposes, the value of the `count` will be reset to 1. So, you should use `remember` to avoid issues.
9,998,243
I'm trying to do some analysis for an upcoming project. It has something to do with trending, charting and analysis; so think MAX, MIN, AVG, SUM etc over a period of time. Say we have an OLAP cube that's setup to figure out these calculations against a time dimension. In theory the backend is there to query the cub...
2012/04/03
[ "https://Stackoverflow.com/questions/9998243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62068/" ]
5 years ago... I worked on a project which had a drag-and-drop interface (HTML and an awful lot of JS) to allow users to construct custom cube queries exactly as they wanted. We called an ASP with ajax to go get the cube data with ADOMD and return it as an HTML table. Charting was via custom JS which created SVG. (It ...
One thing we've done in the past that works fairly well, though some might see it as a cop-out - we've used SSIS packages with embedded MDX queries that flatten data out and stores it in two dimensional SQL tables. For example - we took an OLAP cube and flattened data out by day, week, etc. along with the calculation...
12,756,324
Is there a control to show an animated gif in a Windows Store (Metro) app in Windows 8? I am using C# and XAML with databinding.
2012/10/06
[ "https://Stackoverflow.com/questions/12756324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/573218/" ]
The Image control doesn't support animated GIFs. You will need to extract the frames and animate them on your own timer. You should take a look at this link which might help you regarding your question: <http://advertboy.wordpress.com/2012/05/08/animated-gifs-in-xamlc/>
Just for a note: you can use the BitmapDecoder class to read the GIF frames, create a storyboard an animated them. I've got an example of an Windows 8 user control on my blog: <http://www.henrikbrinch.dk/Blog/2013/02/21/Windows-8---GIF-animations--the-RIGHT-way>
25,986,114
I've just read and watched about 20 videos, StackOverFlow questions and articles but they're all outdated. [This tutorial](http://www.appcoda.com/use-storyboards-to-build-navigation-controller-and-table-view/) and [video](http://vimeo.com/53563148) were the most helpful. You can see I followed the steps, but nothing ha...
2014/09/23
[ "https://Stackoverflow.com/questions/25986114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2199852/" ]
There were two parts missing in your project: 1. The identifier for the segue on the Main.storyboard. I named it *details*. 2. `self.performSegueWithIdentifier("details", sender: self)` in the *tableView delegate* **didSelectRowAtIndexPath**. Happy xCoding.
I was about to comment, but i do not have enough reputation. in addition to what @minneostasteve said, your storyboard is actually correctly set up in the first pic but not in the second pic ie. tab bar controller -> navi controller -> tableviewcontroller -> viewcontroller
38,726,810
When the user types in the textbox i want it to format itself with decimals. For example, if the user types `10000` I want it to show up like `10,000` while he types it.
2016/08/02
[ "https://Stackoverflow.com/questions/38726810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5829467/" ]
That problem proved to be more challenging than I expected (I should have known better). Here is what I got, using vanilla Javascript. You can set event handler for the `onkeyup` event of the TextBox: ``` <asp:TextBox ID="txtAutoFormat" runat="server" onkeyup="processKeyUp(this, event)" /> ``` And here is the Javas...
Try an input mask, here is an example: <http://digitalbush.com/projects/masked-input-plugin/>
24,476,805
I am new to node.js. I downloaded and install node.js installer from the [official site](http://nodejs.org/download/). I have added this installer folder in PATH environment variable and I am able to run programs. But when I try to install some package using npm in node console it shows the error `npm should be run out...
2014/06/29
[ "https://Stackoverflow.com/questions/24476805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2396539/" ]
For Windows users, run `npm` commands from the Command Prompt (cmd.exe), not *Node.Js* (node.exe). **So your *"normal shell"* is cmd.exe**. *(I agree this message can be confusing for a Windows, Node newbie.)* By the way, the *Node.js Command Prompt* is actually just an easy shortcut to *cmd.exe*. Below is an example...
[![enter image description here](https://i.stack.imgur.com/recta.png)](https://i.stack.imgur.com/recta.png) **Just open Node.js commmand promt as run as administrator**
7,943,171
For example: ``` Pattern pattern = Pattern.compile("a(.*)b"); Matcher matcher = pattern.matcher("a19203b"); matcher.find(); System.out.println(matcher.group()); ``` This prints out the entire string (`a19203b`). All I need is `19203`. How can I get this in Java? (for example, in a mod\_rewrite rule, I would do some...
2011/10/30
[ "https://Stackoverflow.com/questions/7943171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/450164/" ]
Found the solution. Instead of `matcher.group()`, use `matcher.group(1)`. ``` Pattern pattern = Pattern.compile("a(.*)b"); Matcher matcher = pattern.matcher("a19203b"); matcher.find(); System.out.println(matcher.group(1)); ```
Use lookbehinds/lookaheads : ``` Pattern regex = Pattern.compile("(?<=a).*(?=b)"); ``` Don't capture what you don't want to capture. Here your entire match will be what you want.
29,381,233
I am using Python 2.7 and Selenium 2.44. I want to *automate drag and drop* action in Selenium WD but according to other related posts **Actions in HTML5 are not supported by Selenium** yet. Is there any way to simulate drag and drop in Python? Here is the code I tried: ``` driver = webdriver.Firefox() driver.get(...
2015/04/01
[ "https://Stackoverflow.com/questions/29381233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2100011/" ]
Yes, HTML5 "drag&drop" **is not currently supported** by Selenium: * [Issue 3604: HTML5 Drag and Drop with Selenium Webdriver](https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3604) One of the [suggested workarounds](http://elementalselenium.com/tips/39-drag-and-drop) is to *simulate HTML5 drag...
Java version is in below commit <https://github.com/vikramvi/Selenium-Java/commit/a1354ca5854315fded8fc80ba24a4717927d08c7>
22,578,737
I like to implement a function if I click on the button so in my tbody clear all tr tags after the first tr tag. Here my HTML example: ``` <table id="event_table"> <thead> <tr> <th>date</th> <th>time</th> <th>action</th> </tr> </thead> <tbody> <...
2014/03/22
[ "https://Stackoverflow.com/questions/22578737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3319587/" ]
Your selector only select the next siblind tr after the first one. If you want to select all the `tr`s after the first child use the [`~` General sibling selectors](http://www.w3.org/TR/selectors/#general-sibling-combinators), also `empty` just empties the element, it does not remove it, use `remove` instead ``` jQuer...
And also: ``` $('#event_table > tbody > tr:gt(0)').remove(); ```