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
47,239,444
I have this JSON file that I'm trying to convert to CSV to harvest data. However the output I get is far from correct. So far I have: ``` import csv import json infile = open("top40nl.json", "r") outfile = open("top40nl.csv", "w") writer = csv.writer(outfile) for row in json.loads(infile.read()): writer.writerow(ro...
2017/11/11
[ "https://Stackoverflow.com/questions/47239444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8924542/" ]
I don't understand why you want a CSV file instead of JSON, but here's how you can extract the dicts from each of the data lists and write them to CSV. To keep the example simple, I just write the output to `sys.stdout` instead of to a disk file. ``` import json import csv import sys JSON = '''\ { "info": "SQLite...
*here it goes the simplest one using pandas library* ``` import pandas as pd import json with open('top40nl.json') as fi: data = json.load(fi) df = pd.DataFrame(data=data) df.to_csv('top40nl.csv', index=False) ```
29,540,612
I use a 3rd-party javascript library (I'll just refer to it as "the jslib") in my web page that, when a certain link is clicked, dynamically generates and displays an iframe on my page. I am trying to override some styles on the iframe. In some cases I can do it, but in 1 case I cannot. Take a look: ![enter image desc...
2015/04/09
[ "https://Stackoverflow.com/questions/29540612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1136267/" ]
I would go for a better specified selector like: ``` body #PPDGFrame .panel iframe { /* Your style here */ border: 2px solid #666; } ``` I prefer to avoid using important, you will end up in a important hell, this is due to [**selector priorities**](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity)...
Try this. `border: 2px solid #666 !important;` The important flag prioritizes it over all other definitions, except other `!important` definitions.
2,159,059
I am trying to do a string replace for entire file in PHP. My file is over 100MB so I have to go line by line and can not use `file_get_contents()`. Is there a good solution to this?
2010/01/29
[ "https://Stackoverflow.com/questions/2159059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/232495/" ]
If you aren't required to use PHP, I would highly recommend performing stuff like this from the command line. It's by far the best tool for the job, and much easier to use. In any case, the [`sed` (Stream Editor)](https://en.wikipedia.org/wiki/Sed) command is what you are looking for: ``` sed s/search/replace oldfile...
something like this? ``` $infile="file"; $outfile="temp"; $f = fopen($infile,"r"); $o = fopen($outfile,"a"); $pattern="pattern"; $replace="replace"; if($f){ while( !feof($f) ){ $line = fgets($f,4096); if ( strpos($pattern,"$line") !==FALSE ){ $line=str_replace($pattern,$replace,$line);...
11,151,782
While including the simple HTML DOM library, I get the warnings: Warning: file\_get\_contents() [function.file-get-contents]: php\_network\_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\simple\_html\_dom.php on line 70 Warning: file\_get\_contents(http://www.google.com/) [function.file-g...
2012/06/22
[ "https://Stackoverflow.com/questions/11151782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1458514/" ]
This is because your host was unable to resolve DNS, this happens when simplehtmldom uses file\_get\_contents instead of curl. PHP Simple HTML DOM Parser is a great HTML parsing PHP class BUT it is slow since it uses file\_get\_contents (which is disabled on almost all configurations) instead of cURL (4-5 times faster...
That's not in any way related to `simple_html_dom`. Your server has no internet access and it fails to resolve `google.com`. Check the DNS settings and maybe the firewall.
113,693
Using OpenLayers 3, I cannot get this message to go away: ``` Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://myserver:8085/geoserver/sf/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=sf:view1&maxFeatures=1&outputFormat=JSON. This can be fixed by moving t...
2014/09/12
[ "https://gis.stackexchange.com/questions/113693", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/36275/" ]
I ran into CORS errors whilst using GetFeatureInfo requests to get info from a WMS geoserver layer in my OpenLayers map. Answer as of May 2020: <https://docs.geoserver.org/latest/en/user/production/container.html#enable-cors>
The crossOrigin-setting does only (?) exist for ol.source.TileImage. (<http://openlayers.org/en/master/apidoc/ol.source.TileImage.html> - untick "Stable only" in the upper right corner). ol.source.GeoJSON doesn't have a crossOrigin setting, because you can't access JSON via a cross-site requests. You have different w...
41,234,446
I have a scala program that runs for a while and then terminates. I'd like to provide a library to this program that, behind the scenes, schedules an asynchronous task to run every `N` seconds. I'd also like the program to terminate when the `main` entrypoint's work is finished without needing to explicitly tell the ba...
2016/12/20
[ "https://Stackoverflow.com/questions/41234446", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3562538/" ]
Okay, so if you have a one-dimensional hash table and an array for the priority of keys, then you can use an algorithm like this to select the first one available: ``` function grab(hash, keyPriority) { var value; keyPriority.some(function (key) { if (hash.hasOwnProperty(key)) { // check if the property exists...
If you are fine with using a bit of `JQuery` then the following code snippet should do the job I guess. ``` $.each(JSONObj, function(key, value){ if (!(value === "" || value === null)){ myValue = value; return false; //to break the loop once a valid value is found } }); ``` This will assign ...
1,367,025
Could you please help - as I have a weird situation that when I enter a number 22222.09482 in cell then I see a different number 22222.0948199999 in the formula bar. Below is the snapshot of the problem. ![Sample error](https://i.stack.imgur.com/2k49K.png) I see the same behavior when I enter the following numbers: ...
2018/10/15
[ "https://superuser.com/questions/1367025", "https://superuser.com", "https://superuser.com/users/954171/" ]
As I'm sure you know, computers internally work only using zeros and ones (a.k.a. bits) and have a fixed number of bits to represent a value (usually 64 bits nowadays). That means that the number of different values that can be represented is 2 to the 64th power. That's a huge number, sure, but the number of *possible*...
Computers do their math in binary, and almost always use floating point for non-integer values. The only fractional values which can be represented precisely in floating point must be a sum of some combination of fractional powers of 2 (1/2, 1/4, 1/8, 1/16, 1/32,...) terminating at the designed-in precision limit (usua...
17,462
I've only done a small amount of reading on the middle ages, and on the history of Western philosophy, but from what I can glean education and religion were tightly coupled during the period, so most thought coming from that time came from religious thinkers. It *seems* to me that secular thought started to come to t...
2014/12/09
[ "https://history.stackexchange.com/questions/17462", "https://history.stackexchange.com", "https://history.stackexchange.com/users/4886/" ]
The most prominent voice for secular thinking in medieval Europe was undoubtedly Franciscan friar [Roger Bacon](http://en.wikipedia.org/wiki/Roger_Bacon) (1214-1292). Even though Bacon was a monk, the experimental work he did led many people to start thinking and believing in natural phenomenon, whereas previously the ...
I cannot think of any examples in mediaeval Western Europe. However, the Persian philosopher Muḥammad ibn Zakariyā ar-Rāzī (died 925) taught that all religions (Christianity, Islam etc.) were taught by false prophets who received their revelations from evil spirits. The Greek philosopher Georgios Gemistos Plethon (died...
22,303,828
I am trying to create components and implement them into my JFrame from different classes within my program. I have created a JTabbedPane, and each tab represents a class. All of the components for each tab are placed in their respective tabs. ``` //creates the JTabbedPane, and the panels. object creation. //panelx...
2014/03/10
[ "https://Stackoverflow.com/questions/22303828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3026473/" ]
**The basic question is "why are you calling `GetVersionExW` in the first place?" The answer to that question determines what you should do instead.** The deprecation warning is there to give developers a heads-up about the appcompat behavior change that started in Windows 8.1. See [Windows and Windows Server compatib...
you can disable this warning and use GetVersionEx anyway by adding: ``` #pragma warning(disable : 4996) ```
7,267,116
There is an object, which can be initialized by id or by name. How it should be handled? ``` class user { function __construct($id_or_name) { if ( is_numeric($id_or_name) ) { $this->id = $id_or_name; $this->populate_by_id($this->id) } else { ...
2011/09/01
[ "https://Stackoverflow.com/questions/7267116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159982/" ]
IMHO, it's terrible. Introuce two static "fabric methods", one receive `string`, other - `integer`. And construct your object differently: ``` class user { //you might want make it private function __construct($id_or_name) { //common logic } static function construct_by_name($name){ ...
So a user can't be named 123? Do you catch that in your registration form? ;-) Since it's not clear, as an objective reader of that code, to see what the constructor does, I would change it. Why don't you use a basic constructor which does less, and call the appropriate method (either `retreive_by_id()` or `retreive_b...
33,107,790
From hours I am trying to find the root cause for one of tricky customer issue. Help is appreciated. None of the clicks events in client Chrome browser is firing. But when we call the JavaScript method from console it fires! [![enter image description here](https://i.stack.imgur.com/sVzS0.png)](https://i.stack.imgur...
2015/10/13
[ "https://Stackoverflow.com/questions/33107790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1407094/" ]
**Answer** Since the user laptop was "**HP Elitebook 840**",it was touch screen enabled. **So solution was disabling the touch screen** 1.Type below in chrome browser : chrome://flags/#touch-events 2.In the enable touch events section ,please select "Disable" from the drop down. 3.Click on "Relaunch Now"
I will jump to an empty pool here and do a wild guess as you did not provide any piece of code, check that those links don't have `pointer-events: none;` set in the css. That will prevent any click handler from being executed.
50,544,907
I read that anything between triple quotes inside print is treated literal so tried messing things a little bit. Now I am not able to get above statement working. I searched internet but could not find anything. statement: ``` print("""Hello World's"s""""") ``` Output I am getting: ``` Hello World's"s ``` Expec...
2018/05/26
[ "https://Stackoverflow.com/questions/50544907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2570189/" ]
`print("""Hello World's"s""""")` is seen as `print("""Hello World's"s""" "")` because when python find `"""` it automatically ends the previous string beginning with a triple double-quote. Try this: ``` >>> print("a"'b') ab ``` So basically your '"""Hello World's"s"""""' is just `<str1>Hello World's"s</str1><str2><...
Maybe this is what you are looking for? ``` print("\"\"Hello World's's\"\"") ``` Output: ``` ""Hello World's's"" ```
167,807
**A strange concept which I came up with after realizing that vampires, werewolves and zombies are basically created by an infection from a virus. This has lead me to brainstorm how I could make a monster formed by an already existing disease. A monster that would be human or animal and possess attributes of the diseas...
2020/02/07
[ "https://worldbuilding.stackexchange.com/questions/167807", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/-1/" ]
Monsters draw on our fears ========================== Various monster stories are rooted in key fears in the human psyche (at least partially). Zombies are often the fear of outsider hordes destroying our way of life. Werewolves can be the fear of not truly knowing someone, of the possibility that danger lurks under t...
I heard about a tumor whose cells started to differentiate into developed features like the starts of eyes and a nose. I can't find the specific case study, but in general they are apparently called "teratomas." Important notes: cancer is not caused by one specific thing. There are a million different ways to develop...
43,326
I am learning Cell Fracturing following [this video](https://www.youtube.com/watch?v=xWIxOenYPYo). But just like Mr Jee in the comments section, my model breaks as soon as I play the animation in Games Engine. ![gif of falling rigid body objects](https://i.stack.imgur.com/GLDPG.gif) The author of the video talks in h...
2015/12/19
[ "https://blender.stackexchange.com/questions/43326", "https://blender.stackexchange.com", "https://blender.stackexchange.com/users/18166/" ]
Why is it exploding? -------------------- The model explodes, because the game engine (BGE) detects an impulse from all objects against other and so every body is repelled. The impulses are calculated by BGE because the intersection of of all parts' collision bounds at the start point (here: frame 40) is interpreted a...
the breaking constraint is only availible in upbge fork of blender <https://upbge.org/>
39,795,750
I have a tab delimited data frame with a final column containing nested information that is '|' delimited. Note that all rows maintain this nested parenthetical structure preceded by 'REP=' ``` col1 col2 col3 col4 ID1 text text text...REP=(info1|info2|info3) ID2 text text text...REP=(info1...
2016/09/30
[ "https://Stackoverflow.com/questions/39795750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5437137/" ]
`perl` one liner, doesn't modify the header though ``` $ cat ip.txt col1 col2 col3 col4 ID1 text text text REP=(info1|info2|info3) ID2 text text text REP=(info1|info2|info3) $ perl -pe 's/\s*REP=\(([^)]+)\)/"\t".$1=~tr#|#\t#r/e' ip.txt col1 col2 col3 col4 ID1 text text ...
This does leave a tab at the end, but that can be fixed with an extra gsub. ``` awk 'NR==1 {print $0,"col4\tnewcol\tnewcol2\tnewcol3")} NR>1 {gsub(/...REP=\(|\||\)/, "\t");print}' input.txt ```
18,008
My son has an impression tablet 10 and has forgot the lock pattern. How can we reset it without knowing the code?
2012/01/08
[ "https://android.stackexchange.com/questions/18008", "https://android.stackexchange.com", "https://android.stackexchange.com/users/11403/" ]
Unfortunately you're probably going to have to do a factory reset, which will wipe all the data on the device (it should leave the SD card alone if there is one, though). You may be able to do this from recovery mode, which you get into by holding some of the buttons on the device while it boots up. I don't know what ...
Assuming one doesn't have a Google account (or doesn't have access to it) and one doesn't care about loosing the data, a factory reset will help. For that 1. Turn off the device. 2. Press Volume Up + Power Button for at least 15 seconds. 3. Release the buttons and a recovery menu will pop-up. 4. Select "Wipe data/fac...
182,893
Which one would sound better? ***Terrified, John locked the door and switched off the lights.*** OR ***Terrified John locked the door and switched off the lights.***
2014/07/08
[ "https://english.stackexchange.com/questions/182893", "https://english.stackexchange.com", "https://english.stackexchange.com/users/61887/" ]
The first one is best, because *John* is a name and *terrified* is an adjective describing John. If you don't add a comma, then you're naming him *Terrified John*. If you need a grammatical explanation (the rule), then I'll let the other people explain.
> > Poor John locked the door and switched off the lights. > > > is a similar looking sentence, with the adjective *poor* modifying John. It is in the attributive position (just before the noun). It does not carry the same sense as 'John was poor / hard up'. Usually, an article would be needed: > > The old care...
8,430,404
I've been seeing a lot of articles and references about how to use this patterns for my first (please keep this in mind) serious project with ASP.NET MVC 3 and EF. The project is not so big (13 tables) and it's basically a CRUD maintenance: organisations that have some users; users that can belong to a group and can c...
2011/12/08
[ "https://Stackoverflow.com/questions/8430404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1040177/" ]
You might want to check out [S#arp Lite](https://github.com/codai/Sharp-Lite) which has many good examples of how to implement the things you want and can serve as a very good base on which to build something quickly.
None of the mentioned patterns are mutually exclusive. You should use the patterns that make sense based on what you are trying to accomplish, not attempt to shoehorn your application design into someone elses idea of how it should work. Sometimes trying to bend your scenario to fit a particular design pattern / practi...
34,437
Is there any word to refer to the practice of experts in a given field aiming at maintaining their position as experts, rather than producing anything that could possibly challenge their position? I would like to describe this concisely, if possible in one *-ism* word, rather than as "experts' self-serving practice". ...
2011/07/15
[ "https://english.stackexchange.com/questions/34437", "https://english.stackexchange.com", "https://english.stackexchange.com/users/9225/" ]
The word *entrenchment* or its variations come to mind (from the OED): > > **Entrenched** - *adjective* (of attitudes, idea, etc.,) firmly established and not easily modified. > > > **Entrenchment** - *noun* entrenching; being entrenched. > > > As in, > > The group's research was intended to entrench its cu...
**Protectionism** for a professional body. **Cronyism** for personal relations
117,179
It is possible to monitor for all events that happens on Ethereum network or Binance Smart Chain network (BSC). I know that would be a lot of data however I would like later to filter that data. If yes, thank can it be achieved with help of Web3j library or maybe there is another better one. What about of past data? It...
2021/12/23
[ "https://ethereum.stackexchange.com/questions/117179", "https://ethereum.stackexchange.com", "https://ethereum.stackexchange.com/users/89597/" ]
I'm assuming from the question you want to know if there is a way to fund a contract so it performs as expected, because when it runs out of funds the program stops? Disclaimer: I am part of Chainlink Keepers team. There is a contract we created called "balance monitor" that works on EVM chains. Cryptphil is correct, ...
If you mean something like that your contract should always send Ether after some time period, then no, this is not possible. Because this would mean that your contract has to continuously run and, e.g., check for the blocktime which would cost you "infinite" gas and there would be no way to pack one execution of it i...
37,857,327
I am using [Apache RequestConfig](https://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/config/RequestConfig.html) to configure some timeouts on my `HttpClient`. ``` RequestConfig config = RequestConfig.custom() .setConnectTimeout(timeout) .setSocketTimeout(timeout) ...
2016/06/16
[ "https://Stackoverflow.com/questions/37857327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1073945/" ]
`connectionRequestTimeout` happens when you have a pool of connections and they are all busy, not allowing the connection manager to give you a connection to make the request. So, The answer to your question of: > > Does it make any sense to call setConnectionRequestTimeout(timeout) > even I don't have a custom Con...
Isuru's answer is mostly correct. The default connection manager is a `PoolingHttpClientConnectionManager`. However, by default it will only have one connection in it's pool. If you are using your `HttpClient` synchronously from the same thread you should never encounter a situation where the `ConnectionRequestTimeo...
15,793,602
I'm working with Amazon SimpleDB and attempting the creation of a DB using the following tutorial . Basically it throws an error i.e. Error occured: java.lang.String cannot be cast to org.apache.http.HttpHost. The full stacktrace is as below: > > Error occured: java.lang.String cannot be cast to org.apache.http.HttpH...
2013/04/03
[ "https://Stackoverflow.com/questions/15793602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1565545/" ]
It seems you are using the [Typica](http://code.google.com/p/typica/) client library, which is pretty much unmaintained since mid 2011, see e.g. the [rare commmits](http://code.google.com/p/typica/source/list) and the [steady growing unresolved issues](http://code.google.com/p/typica/issues/list), where the latest one ...
Please try to create instance of SimpleDB with server and port and let me know if it works. ``` public SimpleDB objSimpleDB = null; private String awsAccessKeyId = "access key"; private String awsSecretAccessKey = "secret key"; private boolean isSecure= true; private String server = "sdb.amazonaws.com"; private int p...
37,481
HD pictures has 1920x1080 = 2073600 pixels = 2025 kilopixel = 1.98 megapixel. Does this mean that we can take HD pictures with a 2 MP camera? If not, why not?
2013/04/03
[ "https://photo.stackexchange.com/questions/37481", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/19142/" ]
No, because of the Bayer filter. You would actually need around 11 megapixels. **What a Bayer filter is** Colour camera sensors use Bayer filters to capture the various colours. The Bayer filter effectively halves the resolution of the sensor for each colour (though green is left with slightly more in a checker-board...
There are three common high-definition video modes: Video Mode: Frame size (WxH): Pixels in image (resolution) Scanning Type 1. 720p 1,280x720 921,600 (almost 1MP) Progressive 2. 1080i 1,920x1,080 2,073,600 (>2MP) Interlaced 3. 1080p 1,920x1,080 2,073,600 (>2MP) Progressive it depends on what usage are you planning. ...
587,918
So this problem is actually mistaken, the condition should really be that a group of order $n$ with $\gcd(n,\varphi(n))=1$, **not** just being odd square free. Since there exists a group of order 21 which is not abelian, thanks to @NickyHekster. Sorry for the fallacy conclusion. So I posted a new one with the complete ...
2013/12/01
[ "https://math.stackexchange.com/questions/587918", "https://math.stackexchange.com", "https://math.stackexchange.com/users/112564/" ]
To find the section, use the Sylow theorems. You have found $\pi : G \to H \simeq \mathbb Z / p \mathbb Z$, an epimorphism. Now in $G$, since $|G| = p\_1\cdots p\_s$, without loss of generality assume $|H| = p\_s$. By Lagrange's theorem there exists $x \in G$ with $K \overset{def}=\langle x \rangle \simeq \mathbb Z /...
Here are some hint that can help you in proving the part b). When you have a surjective homomorphism $$\pi \colon G \to H$$ and want to show that $G \cong H \times N$ for $N=\ker \pi$ a standard technique is to find a morphisms $i \colon H \to G$ such that $\pi \circ i=1\_H$, that's the section which Patrick Da Sil...
27,072
> > It's about time she went home > > > Mein Versuch ist : > > Es ist Zeit, dass sie nach Hause gegangen ist. > > >
2015/12/09
[ "https://german.stackexchange.com/questions/27072", "https://german.stackexchange.com", "https://german.stackexchange.com/users/3480/" ]
> > It's about time she went home > > > Wenn ich diese Aussage korrekt interpretiere (und Sprachinformationsressourcen wie [diese Seite](http://idioms.thefreedictionary.com/about+time) scheinen mir da zuzustimmen), dann bedeutet die obige Aussage *nicht* zwangsläufig, dass sie bereits nach Hause gegangen ist, sond...
> > Es wurde Zeit, dass sie nach Hause gegangen ist. > > > oder etwas stärker > > Es wurde *aber auch* Zeit, dass sie nach Hause gegangen ist. > > > Edit: Diese Antwort ist falsch, da der Subjunktiv im zweiten Halbsatz nicht beachtet wird, siehe andere Antworten für korrekte Übersetzungsvorschläge.
33,205,164
Using Camel and its rabbitMQ module, how would I define an endpoint URL to a durable topic subscription? What options need to be set? what are corresponding options for what in camel JMS would be clientId and durableSubscriptionName?
2015/10/19
[ "https://Stackoverflow.com/questions/33205164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/612418/" ]
You need to use `ng-class` for this. There are two ways of writing a ternary in Angular. Prior to version 1.1.5 ``` <td ng-cloak data-ng-class="player.standing ? 'null' : 'strikethrough'">{{ player.name }}</td> ``` Version 1.1.5 and later: ``` <td ng-cloak data-ng-class="player.standing && 'null' || 'strikethrou...
For Angular 7 you can use ngClass which adds or removes css classes on HTML elements. .html ``` <td [ngClass]="player.standing ? 'null' : 'strikethrough'"> {{ player.name }} </td> ``` .css ``` .strikethrough { text-decoration: line-through; } ``` Read more on `ngClass` [here](https://angular.io/api/common/Ng...
115,022
Suppose we have $v$ and $u$, both are independent and exponentially distributed random variables with parameters $\mu$ and $\lambda$, respectively. How can we calculate the pdf of $v-u$?
2012/02/29
[ "https://math.stackexchange.com/questions/115022", "https://math.stackexchange.com", "https://math.stackexchange.com/users/26008/" ]
The right answer depends very much on what your mathematical background is. I will assume that you have seen some calculus of several variables, and not much beyond that. Instead of using your $u$ and $v$, I will use $X$ and $Y$. The density function of $X$ is $\lambda e^{-\lambda x}$ (for $x \ge 0$), and $0$ elsewher...
There is an alternative way to get the result by applying the the Law of Total Probability: $$ P[W] = \int\_Z P[W \mid Z = z]f\_Z(z)dz $$ As others have done, let $X \sim \exp(\lambda)$ and $Y \sim \exp(\mu)$. What follows is the only slightly unintuitive step: instead of directly calculating the PDF of $Y-X$, first ...
19,857,213
I started using Gradle build system a few days ago and got the script to work as I wanted, here it is: ``` buildscript { repositories { mavenCentral() } } dependencies { classpath 'com.android.tools.build:gradle:0.6.+' } apply plugin: 'com.android.application' android { compileSdkVersion 17 ...
2013/11/08
[ "https://Stackoverflow.com/questions/19857213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2161029/" ]
**UPDATE February 2018**. This block will cause a build error using Android Gradle plugin 3.0 or above. See 'deepSymmetry's comment below. The "fix" is to **delete the block altogether** and the plugin's default behavior will automatically clean up the intermediate temporary apks (ex: app-debug-unaligned.apk). --- P...
I can at least answer your bonus-question: ``` buildTypes { release { runProguard true signingConfig signingConfigs.release } } ``` If you have specific proguard-rules, just enter this line to your `defaultConfig` or to your product flavors: ``` proguardFiles getDefaultProguardFile('proguard...
42,572,571
I have the following Web services. ```html @WebService(targetNamespace="T24WebServicesImpl") @XmlSeeAlso( { MYCUSTOMERType.class, Object[].class } ) @HandlerChain(file = "./handler-chain.xml") public class T24WebServicesImpl extends TwsController { @WebMethod public void myCustomer( ....... }...
2017/03/03
[ "https://Stackoverflow.com/questions/42572571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4101458/" ]
Yes you can do it with the built-in .NET Core IOC container, using [Scrutor](https://github.com/khellang/scrutor) extension methods. It has got some nice assembly scanning functionalities. Try this: ``` services.Scan(scan => scan .FromAssemblies(typeof(yourassembly).GetTypeInfo().Assembly) ...
You can easily implement your own method to register all assembly types for a given assembly or set of assemblies... the code would be along the lines of: ``` foreach (var implementationType in assemblies.SelectMany(assembly => assembly.GetTypes()).Where(type => !type.GetTypeInfo().IsAbstract)) { foreach(var inter...
33,830,509
I have Spark application which contains the following segment: ``` val repartitioned = rdd.repartition(16) val filtered: RDD[(MyKey, myData)] = MyUtils.filter(repartitioned, startDate, endDate) val mapped: RDD[(DateTime, myData)] = filtered.map(kv=(kv._1.processingTime, kv._2)) val reduced: RDD[(DateTime, myData)] = ...
2015/11/20
[ "https://Stackoverflow.com/questions/33830509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4974387/" ]
You need to set up the passProps property on the navigator. There are a few recent examples on stack overflow, specifically [here](https://stackoverflow.com/questions/33763709/passprops-equivalent-for-navigator/33767091#33767091) and [here](https://stackoverflow.com/questions/33825524/navigator-with-args). ``` <Naviga...
Sometimes the pass prop doesn't work (at least for me) So what I do is I pass it in the route object itself ``` nav.push({ id: 'MainPage', name: 'LALA', token: tok }); ``` so to access it in the next scene I use ``` var token = this.props.navigator.navigationContext.currentRoute.token...
15,706,944
I'm looking at code that looks like ``` try { // Lots of things here. // More than I'd like to individually hover over every time I see this } catch (Exception e) { // doesn't matter } ``` For any particular method in the try block, I can find what checked exceptions it throws. Is there any way to h...
2013/03/29
[ "https://Stackoverflow.com/questions/15706944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/802500/" ]
In eclipse, if you enable "highlight occurrences" and select `Exception`, it would highlight all lines that are throwing a (checked) exception that is being caught by the catch block.
You can read the class' reference manual to figure out what exception a particular method can throw. Keep in mind java has two kinds of exception: checked and unchecked. With unchecked exception, the method doesn't have to declare it can throw the exception (for example RuntimeException) I'd also recommend you use som...
36,078,874
I placed the buttons below scroll view and enable vertical scrolling.After scrolling,the buttons are visible,If I click buttons doesn’t work. 1.This Image shows the "story Board" which contains "table view" inside "scroll view" and the "buttons" placed below "scroll view" "Buttons" shown in "blue colour". scroll view...
2016/03/18
[ "https://Stackoverflow.com/questions/36078874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5723645/" ]
This is how i got the transparent RGB integer value ``` Bitmap myDisplayBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_pic); if (myDisplayBitmap != null && !myDisplayBitmap.isRecycled()) { Palette palette = Palette.from(myDisplayBitmap).generate(); Palette.Swatch vibrantSwatch = palette.ge...
I haven't tested this but something like this should work ``` private int setAlpha(int color, int alpha) { alpha = (alpha << 24) & 0xFF000000; return alpha | color; } ```
2,289,642
What is the best route to go for learning OOP if one has done some programming in C. My intention was first to take the natural leap and "increment with one" and go for Stroustrup. But since I got my hands on the little old Bertrand Meyer's OOSC2 and I qoute from the appendix page 1135 *"..according to Donald Knuth, i...
2010/02/18
[ "https://Stackoverflow.com/questions/2289642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163407/" ]
Any language will do if you learn it from a good book. I learned both C++ and Java starting from [Bruce Eckel's books](http://www.mindviewinc.com/Books/). After you know some basics of OOP, I would suggest reading [Object-Oriented Programming with ANSI-C](http://www.planetpdf.com/codecuts/pdfs/ooc.pdf). It will give y...
I would say Java. A good book that helped me is [this one.](https://rads.stackoverflow.com/amzn/click/com/0072225130)
62,026,992
I have an external function that changes a state inside a component thru `ref` and `ImperativeHandler` hook ``` const [state, setState] = useState(0); // inside component const testFunc = () => { setState(1) } // outside of component function *generator { yield ... yield testFunc() // next yield shoul...
2020/05/26
[ "https://Stackoverflow.com/questions/62026992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11069163/" ]
Since you are using hooks and the updater function doesn't receive a 2nd argument like the class updater version, you might want to implement an updater with a 2nd argument on your own: ``` function useStateWithCallback(initState) { const cbRef = useRef(null); const [state, setState] = useState(initState); use...
> > since setState has no callback option > > > `setState` can be passed a second argument, which is a callback function executed after state has been updated. ref : <https://fr.reactjs.org/docs/react-component.html#setstate>
5,777
I'm a freelance graphic designer, so mostly, my pricing and what not is pretty casual and I don't work 24/7 as I have other things to take care of, so when I quote someone, I figure out how long it will take me roughly and also take into account how difficult it might be. I give them the price, get a deposit and start ...
2012/02/03
[ "https://graphicdesign.stackexchange.com/questions/5777", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/3494/" ]
Stefan has several excellent points, which I'll echo and expand upon: * Write up a contract. You don't start *anything* without a contract. It took me over a week to write my first contract, but that baby is as detailed and iron-clad as I could make it, and now I can slice-and-dice and adapt it to future jobs. The AIG...
I think all of us who have done the small free-lance thing have had to deal with this. Most of what I was going to write has already been covered in Stefan's answer, but I have a few more thoughts... Never *ever* feel awful about asking for money up front. They are going to have to pay for your service, whether up fro...
86,840
According to [this link](http://scopeboy.com/elec/gyrator.html), the following schematic is equivalent to an inductance R1\*R2\*C placed between input and ground. Under which conditions is this true? As a guideline, we assume Vcc=9V. See [this post](https://electronics.stackexchange.com/questions/86565/whats-the-purpos...
2013/10/29
[ "https://electronics.stackexchange.com/questions/86840", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/30909/" ]
There are better gyrator circuits so let me give you the downsides of this circuit first. The idea behind this gyrator circuit is that at the emitter there is a voltage that connects back to the input via R1. If the emitter voltage is phase shifted to the input, it will take a current (via R1) from the input that app...
Redoing the analysis, I find a somewhat different result for the real part of the impedance \$Z=R\_1+\frac{R\_2}{\beta+1} + j\omega C\_1 R\_1 R\_2\$
15,432,432
In one of the answers to [Get HWND on windows with Qt5 (from WId)](https://stackoverflow.com/questions/14048565/get-hwnd-on-windows-with-qt5-from-wid) it is suggested to employ **QPlatformNativeInterface** in order to recover the native window handler. To access the QT header though the example uses its full path: ``...
2013/03/15
[ "https://Stackoverflow.com/questions/15432432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064216/" ]
You can use ``` QT += gui-private ``` in your project file, as in the [example plugin](http://qt.gitorious.net/qt/qtbase/blobs/HEAD/src/plugins/platforms/minimal/minimal.pro), and then just ``` #include <qpa/qplatformnativeinterface.h> ``` should work (works for me at least). These APIs are indeed private, but ...
By searching a little bit more it seems that **QPlatformNativeInterface** is currently private and will be made public as part of the [Qt Platform Abstraction](http://wiki.qt.io/Qt-Platform-Abstraction) when this library will stabilize.
16,115,867
I have been having some trouble with this code. I have tried my best to stay with the book but the book seems to be wrong. The following code should display the RSS feed for which ever radio button has been selected. You can also see the website on <http://w3.cnm.edu/~bnoble/cis1210/afds/Travel/TravelDeals.html>. Tha...
2013/04/20
[ "https://Stackoverflow.com/questions/16115867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2299963/" ]
There is no element with id `rssFeed` in the page. You can solve it by adding a `div` with id `rssFeed` in the page ``` <div id="rssFeed"></div> ``` Try this complete code, because you have unclosed element in your markup ``` <html> <head> <title>Travel Deals RSS Feed</title> <script> ...
It's because you're missing a closing quote in your `td` element. You have `<td id="rssFeed" valign="top></td>` when what you want is `<td id="rssFeed" valign="top"></td>`. Fixing this should cause the element to show up.
30,491,132
After working on a repository in my computer i've opened the terminal to commit the changes to the github account with the purpose of updating the gh-pages branch (after 4 days of work). I did not notice that I was on gh-pages branch already when a did the `git status` so I did as if I where on branch master.That is...
2015/05/27
[ "https://Stackoverflow.com/questions/30491132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3456454/" ]
It looks like you pushed to the wrong branch, and then changed branches. You should be able to do this: `git checkout gh-pages` `git push origin gh-pages` and all of your work should still be on gh-pages. The master branch is right where you left it back in time. But nothing you mentioned should have removed from yo...
provided you didn't delete `gh-pages` you can do ``` git checkout gh-pages ``` and then to recover your work ``` git reset head~1 --soft ``` or you may very well merge your branch into `master` like: ``` git merge gh-pages ```
4,618,633
I'm reading [this answer](https://math.stackexchange.com/a/687751/688539), in which, one of the step involves showing that: $$s\_3(r\_1s\_2-r\_2s\_1)=0,\quad s\_1(r\_2s\_3-r\_3s\_2)=0\implies s\_2(r\_1s\_3-r\_3s\_1)=0$$ I am utterly confused on how this implication was arrived at. How does having the "s" prefactor ma...
2023/01/15
[ "https://math.stackexchange.com/questions/4618633", "https://math.stackexchange.com", "https://math.stackexchange.com/users/688539/" ]
Let $(a\_n, b\_n, c\_n, d\_n)$ be the quadruple after the $n$-th iteration, where $(a\_0, b\_0, c\_0, d\_0)$ are the initial values and can be arbitrary real numbers, the restriction to positive numbers is not necessary. Without loss of generality we can assume that $a\_0+b\_0+c\_0+d\_0 = 0$, and consequently $a\_n+b\...
**Proof** Beginning by defining the iterating sequences \begin{split} X\_n& \triangleq(w\_n,x\_n,y\_n,z\_n) \to \left(\frac{w\_n+x\_n}{2},\frac{x\_n+y\_n}{2},\frac{y\_n+z\_n}{2},\frac{z\_n+w\_n}{2}\right) \\ X\_0 & = (a,b,c,d) \end{split} So considering : $$ f (w,x,y,z) \to \left(\frac{w+x}{2},\frac{x+y}{2},\frac{y...
52,128,013
I am trying to learn react. I see a lot of style change inside java script so far. As far as I know, the style should onle be managed by css files. But I am not sure this rule also applies to React. What is the best practice for react. For instance, is the following code a clean code, or is changing the style in the Re...
2018/09/01
[ "https://Stackoverflow.com/questions/52128013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2433619/" ]
I prefer to connect external .css file - it's much more clean. If there is a need to keep styles in .js I would organize the code in that way: ``` const styles = { color: 'red', fontSize: '2rem', backgroundColor: 'forestgreen' } ``` And I would apply the styles I need just like here: ``` <div style={{color: styles....
You can also use styled components <https://www.styled-components.com/>
12,972,583
I'm having a little trouble using UNION. (at least I suspect UNION is the tool) I have the following: Table 1: `us_states.us_state` Table 2: `fex_tax_by_prov.TAX_PROVINCE` I would like to use one mysql query to return all states and provinces as one result ('region'). I have something like this but it isn't correct...
2012/10/19
[ "https://Stackoverflow.com/questions/12972583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/962136/" ]
``` select us_state as region from us_states union select tax_province from fed_tax_by_prov ``` should work as long as the two columns are of the same type, and adding an alias (only needs to be done for first select in the `union`) means you can refer to it in a wrapping `select`, much like you have in your example.
I got it, the problem was that I had an extra `SELECT *` at the beginning of the query. Much thanks your your help people.
28,178,554
I'm trying to remove all Strings that are of even length in a set. Here is my code so far, but I am having trouble getting the index from the iterator in the enhanced-for-loop. ``` public static void removeEvenLength(Set<String> list) { for (String s : list) { if (s.length() % 2 == 0) { list.re...
2015/01/27
[ "https://Stackoverflow.com/questions/28178554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3147737/" ]
Java 8 has introduced [Collection.removeIf()](https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html#removeIf-java.util.function.Predicate-), which allows you to do: ``` set.removeIf(s -> s.length() % 2 == 0) ```
You don't need the index. But you do need the explicit `Iterator`. The iterator has the [`remove()` method](http://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html#remove--), no parameters, that removes the current item from the collection. ``` Iterator<String> itr = list.iterator(); // list is a Set<String>...
27,523,372
I just wrote a method that I'm pretty sure is terribly written. I can't figure out if there is a better way to write this in ruby. It's just a simple loop that is counting stuff. Of course, I could use a select or something like that, but that would require looping twice on my array. Is there a way to increment severa...
2014/12/17
[ "https://Stackoverflow.com/questions/27523372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can use the `#reduce` method: ``` failed, passed = tests.reduce([0, 0]) do |(failed, passed), test| case test.status when :failed [failed + 1, passed] when :passed [failed, passed + 1] else [failed, passed] end end ``` Or with a `Hash` with default value, this will work with any statuses: ...
``` hash = test.reduce(Hash.new(0)) { |hash,element| hash[element.status] += 1; hash } ``` this will return a hash with the count of the elements. ex: ``` class Test attr_reader :status def initialize @status = ['pass', 'failed'].sample end end array = [] 5.times { array.push Test.new } hash = array.red...
69,916,471
I have created a simple API with FastAPI and I want to export the output in a text file (txt). This is a simplified code ``` import sys from clases.sequence import Sequence from clases.read_file import Read_file from fastapi import FastAPI app = FastAPI() @app.get("/DNA_toolkit") def sum(input: str): ...
2021/11/10
[ "https://Stackoverflow.com/questions/69916471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4913254/" ]
``` dict1={"Length":36,"Reverse":"TTTTTTTTTTGGGGGGGAAAAAAAAAAAAAAAATAT","complement":"ATATTTTTTTTTTTTTTTTCCCCCCCAAAAAAAAAA","Reverse and complement":"AAAAAAAAAACCCCCCCTTTTTTTTTTTTTTTTATA","gc_percentage":5.142857142857143} with open("output.txt","w") as data: for k,v in dict1.items(): append_data=k+" "+str...
I gonna assume that you have already got your data somehow calling your API. ``` # data = request.get(...).json() # save to file: with open("DNA_insights.txt", 'w') as f: for k, v in data.items(): f.write(f"{k}: {v}\n") ```
38,831,058
Given the following code: ``` #if MACRO_WITHOUT_A_VALUE int var; #endif int main(){} ``` When compiled with, `g++ -std=c++1z -Wundef -o main main.cpp`, it produces the following warning: ``` main.cpp:1:5: warning: "MACRO_WITHOUT_A_VALUE" is not defined [-Wundef] #if MACRO_WITHOUT_A_VALUE ^ ``` I'd lik...
2016/08/08
[ "https://Stackoverflow.com/questions/38831058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/908939/" ]
What I've done before when third party headers were inducing warnings was to wrap them in my own private header that uses `#pragma GCC system_header` to just silence all the warnings from that header. I use my own wrapper to keep the includes neat and allow for an additional customization point in the future if needed.
This isn't disabling the warning, but fixing the preprocessor code to avoid it. The below tests are based on a similar issue [here](https://stackoverflow.com/a/48403396/1888983), using `clang -Weverything`... ``` #define ZERO 0 #define ONE 1 #define EMPTY // warning: 'NOTDEFINED' is not defined, evaluates to 0 [-Wund...
8,423,410
I'm not java developer, but I need to test a code. I installed jdk and i tested Hello Word it worked fine but When i try to javac this another script, I'm gettings this error. My Code: ``` import javax.wireless.messaging.MessageConnection; import javax.wireless.messaging.TextMessage; import javax.microedition.io.Conn...
2011/12/07
[ "https://Stackoverflow.com/questions/8423410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1079325/" ]
You need to also check in `PHP.ini` file ``` extension = php_openssl.dll ``` is enable or not, if not then just enable that by removing ; sign ``` allow_url_fopen = on ```
I was using **file\_get\_contents** this way: file\_get\_contents("<https://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=>".$screenname."&count=5"); And that was not working, so I changed https to http and after that it is working well. ``` file_get_contents("http:...
373,919
I have a cross-section of $x$, $y\_1$, and $y\_2$. These are individual level data used in labor economics. I have random variation in $x$ and I'm interested in the effect of $x$ on $y\_1$. It is well established in earlier research that $x$ causally affects $y\_2$ positively. Economic intuition says that $y\_2$ will a...
2018/10/26
[ "https://stats.stackexchange.com/questions/373919", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/224884/" ]
Say you have a model $y\_i = f(X\_i;\beta) + e\_i$, where $e\_i \sim N(0,\sigma^2)$, and you obtain an estimate of $\beta$, ($\hat \beta$). Then, by definition, you also have a "predicted error term" $\hat e\_i$, which is $$ \hat e\_i \equiv y\_i - f(X\_i;\hat \beta) $$ When it comes to "predicting" $y\_i$, I can dis...
If the model you propose to describe your process neglects an error term, $y = \beta x$ You are stating the model is 100% perfectly accurate and the process that generates $y$ will never deviate from the value $\beta x$. For example, your data may look like: ``` y x 5 1 10 2 15 3 ``` If the model you propos...
26,158,515
So, I just want to know if its possible to slip in any code or a ternary operator inside the termination bit of a for loop. If it is possible, could you provide an example of a ternary operator in a for loop? Thanks! ``` for (initialization; termination; increment) { statement(s) } ```
2014/10/02
[ "https://Stackoverflow.com/questions/26158515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4001407/" ]
The `termination` clause in the `for` statement (if supplied - it's actually optional) can be any expression you want so long as it evaluates to a `boolean`. It must be an *expression*, not an arbitrary code block.
Yes you can since only thing here is `termination` should be a `boolean` ``` for (int i=0; i==10?i<5:i<6; i++) { } ``` But what is the point of this? Things to remember. Termination condition of a `for` loop should be a `boolean`
9,639,007
I have a list of constant strings that I need to display at different times during my Java program. In C I could define the strings like this at the top of my code: ```c #define WELCOME_MESSAGE "Hello, welcome to the server" #define WAIT_MESSAGE "Please wait 5 seconds" #define EXIT_MESSAGE "Bye!" ``` I am wondering...
2012/03/09
[ "https://Stackoverflow.com/questions/9639007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1259828/" ]
Typically you'd define this toward the top of a class: ``` public static final String WELCOME_MESSAGE = "Hello, welcome to the server"; ``` Of course, use the appropriate member visibility (`public`/`private`/`protected`) based on where you use this constant.
You can use ``` public static final String HELLO = "hello"; ``` if you have many string constants, you can use external property file / simple "constant holder" class
43,091,563
noob question: Any examples of how to get parameters from the connected camera, such as supported resolutions? I'm using DirectX June 2010. Code to create a device: ``` HWND m_hwnd; HDC *phdc; IDirect3D9 *m_pD3D; IDirect3DDevice9 *m_pDevice; IDirect3DSwapChai...
2017/03/29
[ "https://Stackoverflow.com/questions/43091563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7268713/" ]
I also have this problem when run in iOS 10.3.1 with xcode 8.3.2 Restart device, It will work well
I had similar issue. Tried below steps : 1. Quit Xcode `(cmd + Q)` 2. Clean project `(cmd + shift +k)` 3. Delete Derived data `(cmd + comma)` But these didn’t worked. Instead **restarting device worked**!
5,916,338
I have such HTML node: ``` <div id='parent'> <a href="#">test</a> Need this </div> ``` How to get 'Need this' text if I have handle for `parent` object? I tried something like: `$('#parent').text()` but it also returns 'test'. --- p.s. **Nothing** about editing html! I just have such content and I need to pa...
2011/05/06
[ "https://Stackoverflow.com/questions/5916338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87152/" ]
``` var temp = $('#parent').clone(); temp.children().remove(); alert(temp.text()); ``` working example: <http://jsfiddle.net/hunter/H6jQp/>
``` var $text = $("#parent").contents().filter(function(){ return this.nodeType != 1; }); alert($text.text()); ``` Seems to do the trick. ([jsFiddle](http://jsfiddle.net/JfSvd/))
662,134
I was thinking about backing up a Hyper-V host to the cloud and a potentially crazy idea came to mind. With Google Drive, you can get 1TB of storage for 2 bucks a month. This would be more than sufficient to backup all of my VMs. Is this a good idea for machines that don't contain critical / highly confidential info...
2015/01/24
[ "https://serverfault.com/questions/662134", "https://serverfault.com", "https://serverfault.com/users/243438/" ]
Like mentioned above, it's not state-of the art but you could do [Export-VM](https://docs.microsoft.com/en-us/powershell/module/hyper-v/export-vm?view=win10-ps) in a scheduled task if google drive is visible from the core hyper-v, with a drive letter. It appears you can mount google drive as a drive letter using [subs...
TLDR - this would be a bad plan for a business. Each sync would be a full sync. Backing up the VHDX file will backup the data, but it isn't a full VM backup. If you restored over the existing VHDX you wouldn't notice, but if you had to restore to a new server, you'd lose the VM configuration. If you just need a point...
37,058,528
I am a beginner to coding and am trying to shrink down a large, error prone piece of code. Pretty much I want it so ``` if (tileBlocked[row - 1][col] == true) { add tileAir[row - 1][col] to averaging } ``` such that I will find the average of the values in array tileAir only if tileBlocked does not list that ar...
2016/05/05
[ "https://Stackoverflow.com/questions/37058528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6288812/" ]
**Dont do it** ``` $scope.example = () => { $scope.example = 'object'; } ```
@Integrator wrote correct answer. Just want to add to access to the form from your angular controller you also need to write $scope.formName. For example: ``` $scope.search.username.$invalid = true; ``` In this way you set form element to invalid. So in your case angular confuse form with method. It is a good practi...
254,004
I'm trying to diagnose a relay control for a motor which was wired by someone else. **QUESTION: How does this theoretically work? What is it called?** [![picture of relay with wires](https://i.stack.imgur.com/1P6Ws.jpg)](https://i.stack.imgur.com/1P6Ws.jpg) Pictured here is the relay which controls a bidirectional m...
2016/08/24
[ "https://electronics.stackexchange.com/questions/254004", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/42934/" ]
Two SPDT latching? relays with a single bipolar coil which enables either Set or Reset. Forward or Reverse... The poles go to the motor while the "throws" go to V+ and V- cross connected for bipolar motor direction power control. Only doubt is how stop is selected before changing direction.
I think your drawings are correct. Think of it like this: to reverse the motor, you have to reverse the current going through the motor. Your motor wiring looks like ![schematic](https://i.stack.imgur.com/huxzY.png) [simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fhuxzY.png) – Sc...
349,148
What i know is that "Volume" is a undefined notion in general, and the best approach to define volume is by Lebesgue measure. I'm studying linear-algebra right now and the text says that "absolute value of determinant of n vectors is equal to n-dimensional volume formed by vectors". (Note that it is not *defined* to b...
2013/04/02
[ "https://math.stackexchange.com/questions/349148", "https://math.stackexchange.com", "https://math.stackexchange.com/users/61597/" ]
There is a proof in the book *Lebesgue integration and measure* by Alan Weir in section 6.3, called "The geometry of Lebesgue measure".
Suppose you have $n$ vectors $v\_1,v\_2,\dotsc,v\_n$ forming some $n$-parallelotope $P \subset \mathbb R^n$ of non-zero volume. Then the matrix $A = v\_1|v\_2|\dotsb|v\_n$ will be in $GL(\mathbb R^n)$ and $A([0,1]^n) = P$. From the theory of translation invariant Radon measures on $\mathbb R^n$ it is known that any su...
502,727
How can I record keyboard actions with the timestamp, either to console, or preferably to a file? I have showkey output like: ``` keycode 28 release keycode 30 press keycode 30 release keycode 48 press keycode 48 release ``` And I'd like it to be: ``` keycode 30 press 1551027529 keycode 30 release 155102753...
2019/02/24
[ "https://unix.stackexchange.com/questions/502727", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/113056/" ]
I somehow fixed it by adding a new stylesheet in qt5ct, with the content below: ```css QMenuBar { } ``` This above code pretty much does nothing. And I'm pretty sure any selector would work. But I am not sure why adding a simple blank CSS definition would fix the problem. Before: [![enter image description here](h...
On Gnome 41.2, what worked for me was a mix of [user onetusers' answer](https://unix.stackexchange.com/a/660222/507025) and user [Silence and I's answer](https://unix.stackexchange.com/a/502818/507025). I followed those steps: 1. I added in `/etc/environment` the line: ```bsh QT_QPA_PLATFORMTHEME='qt5ct' ``` so tha...
64,037,496
I am implementing some of the firebase SDKs into my pods, but I am having an issue with versioning them. I want to set Firebase 6.33. I did check the pod spec of this version and updated my pods according to that. ``` pod 'Firebase', '~> 6.33.0' pod 'FirebaseCore', '~> 6.10.3' pod 'FirebasePerformance', '~> 3.3.0' pod...
2020/09/23
[ "https://Stackoverflow.com/questions/64037496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6292521/" ]
For who is here with a Mac M1, trying to run `pod install --repo-update` in the VSCode terminal without success, the solution I found was: * Find the native Terminal on Applications * Make sure it is running with Rosetta (right click on Terminal > Obtain Information > Check Open With Rosetta) * Open the terminal * `cd...
Why all the different versions of firebase specified? For me I had three different Firebase related plugins (Analytics / Dynamiclinks / Firebasex). Each of these had a different source it was trying to pull from (some v 7.0.0 and some v 6.33.0). I went into the podfile and changed all of the versions to 6.33.0 and was ...
13,119,441
I am coding some pages in HTML and CSS which will contain samples of code. I want to have the grey box like the do on WikiPedia (I know this is done with Media Wiki). An example page is: <http://en.wikipedia.org/wiki/Dd_(Unix)#Uses> You will see the code has a grey box with dotted lines around. Also higher up the pag...
2012/10/29
[ "https://Stackoverflow.com/questions/13119441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1782547/" ]
**HTML** ``` <code>dd if=/dev/sda of=MBR.img bs=512 count=1</code>​ ``` **CSS** ``` code{background:#F8F8FF; border:black dashed 1px; padding:6px}​ ``` **[DEMO](http://jsfiddle.net/jk6wk/)**
Just use an any inspecting tool (like, e.g., Firebug) to see, what CSS has been used on a page. As for your example, this is the following: ``` { background-color: #F9F9F9; border: 1px dashed #2F6FAB; color: black; line-height: 1.1em; padding: 1em; } ``` PS: If you want to have code highlighting,...
140,296
I am a software engineer upgrading a piece of manufacturing software on site. This is only my third time going onsite. So to summarize, this has been a nightmare. I'm under-qualified for this particular onsite assignment and I warned the project lead about it. However, I agreed that I would give it my best try. A 2 day...
2019/07/13
[ "https://workplace.stackexchange.com/questions/140296", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/106806/" ]
**Definitely ask for a day off.** Be ready for a few different potential responses: 1. **Monday might not be the best day to take** (or whichever day you request). Be ready with some alternatives (e.g., making your next weekend a long weekend or adding an extra day to a holiday break). 2. **No extra days off, but you ...
This answer may not be 100% relevant due to aspects of your working contract, but maybe you can take some aspects from it. You should really take a close look at employment law where you are from and your contract. If you've been asked to drive 11 hours to get on-site, that should really be considered to be on-the-job...
4,958,189
As I've already figured out, there is at least six of them: `!@#$%&`. Here is snip: ``` Dim A!, B@, C#, D$, E%, F& Debug.Print "A! - " & TypeName(A) Debug.Print "B@ - " & TypeName(B) Debug.Print "C# - " & TypeName(C) Debug.Print "D$ - " & TypeName(D) Debug.Print "E% - " & TypeName(E) Debug.Print "F& - " & TypeName(F...
2011/02/10
[ "https://Stackoverflow.com/questions/4958189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194373/" ]
These suffixes are *type hints*, and the link in the accepted answer is outdated. ``` Dim someInteger% '% Equivalent to "As Integer" Dim someLong& '& Equivalent to "As Long" Dim someDecimal@ '@ Equivalent to "As Currency" Dim someSingle! '! Equivalent to "As Single" Dim someDouble# '# Equivalent to "As Double" Di...
A full(?) list is here <http://support.microsoft.com/kb/110264> under Variable and Function Name Prefixes. As Remou said - they are not recommended (the article says that use is "discouraged"). I believe you covered them all in your list. Date is technically a variant (stored as a floating point) so no shortcut for tha...
4,212,992
I am an Android developer and I want to write an `if` statement in my application. In this statement I want to check if the default browser (browser in Android OS) is running. How can I do this programmatically?
2010/11/18
[ "https://Stackoverflow.com/questions/4212992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/511853/" ]
Add the below Helper class: ``` public class Helper { public static boolean isAppRunning(final Context context, final String packageName) { final ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); final List<ActivityManager.RunningAp...
``` fun Context.isAppInForeground(): Boolean { val application = this.applicationContext val activityManager = this.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager val runningProcessList = activityManager.runningAppProcesses if (runningProcessList != null) { val myApp = runningProcessList.find { ...
269,468
Reading contemporary histories of the First World War, I noticed that at the start the nation in the Balkans is referred to as *Servia*, but in numbers published after the back half of 1916, it has turned into *Serbia*. Is there any particular reason for this? Consulting [Google NGrams](https://books.google.com/ngra...
2015/08/27
[ "https://english.stackexchange.com/questions/269468", "https://english.stackexchange.com", "https://english.stackexchange.com/users/305/" ]
From a not credible [source](http://www.sciforums.com/threads/servia-serbia.135160/): > > In Ancient Greek, the letter **Beta** was pronounced like English **B**. But in Modern Greek, it's pronounced like English **V**. So "Serbia" became "Servia." > > > and from another similar [source](http://www.funtrivia.com/...
Servia was the medieval Latin spelling of Serbia according to Etynomline. [Servia](https://en.wikipedia.org/wiki/Servia): > > * Historical English term, taken from Greek language, used in relation with Serbia, Serbs or the Serbian language. Wikipedia > > > [Serb](http://www.etymonline.com/index.php?term=Serb): ...
23,555
**Background** As background, I have found that taylor expansion provides poor estimates of a function at extreme parameter values. Indeed, the approximation at extreme values can get worse (more rapid exponential increase) as the order of the taylor series increases. This seems intuitive, but I don't know that it is...
2011/02/24
[ "https://math.stackexchange.com/questions/23555", "https://math.stackexchange.com", "https://math.stackexchange.com/users/3733/" ]
Yes all non-constant polynomials are unbounded. You could see [Liouville's Theorem](http://en.wikipedia.org/wiki/Liouville%27s_theorem_%28complex_analysis%29), or just notice that the leading coefficient of the polynomial will dominate. That is if I look at $$p(x)=a\_n x^n +a\_{n-1}x^{n-1}+\cdots+a\_1x+a\_0$$ then as $...
Even linear polynomials get larger (in absolute value) than any fixed number at the variable goes to $\pm \infty$ Please see the discussion cited by lhf in the comment.
376,751
I'm new to AppleScript and I've reached this problem after several other problems and work arounds (see further down for more details). My current problem is that I'm telling Pages to check if any document is open with ``` tell application "Pages" exists front document end tell ``` but *sometimes* even when Page...
2019/12/04
[ "https://apple.stackexchange.com/questions/376751", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/355200/" ]
What worked for me on Catalina 10.15.7 was to simply create a `Desktop Pictures` folder in the *root* `Library` folder at the same path, rather than trying to modify `System/Library`. In other words, instead of `/System/Library/Desktop\ Pictures` which is restricted, place your custom pictures at `/Library/Desktop\ Pic...
**Update!** I found a solution that works on Catalina and should work on Big Sur too (although this hasn't been tested). Your custom dynamic wallpapers can be stored anywhere and should be added to the Desktop & Screen Saver prefpane using the plus button in the bottom left. Once you have your custom wallpapers impo...
3,861,980
I am using AJAX to generate actions on my website. For example, a "search results page" calls Ajax which initiates "/getResults.php". This PHP file returns a JSON with 20 entries that contains the results. The HTML Page calls the callback function and re-builds the DOM with the results from the JSON. It thus seems ine...
2010/10/05
[ "https://Stackoverflow.com/questions/3861980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434273/" ]
You could use nonces or short-lived CSRF token. Write it into the page and the session and pass it back with your requests. This adds a *little* bit of impedance, but anyone that's really determined to get your data won't have much of a problem doing so, since they could just screen-scrape a token to use in their own r...
One rudimentary level of 'protection' is to check the `HTTP_REFERER` header on your server to make sure the request is coming from your own website. This can be spoofed, though, so I wouldn't trust it too much.
31,513
The following excerpt is from [Schwager's Hedge Fund Market Wizzards](http://books.google.de/books?id=eAR5mPSK9voC&lpg=PT104&ots=z34iduu-nG&dq=%22you%20can%20look%20for%20patterns%20where,%20on%22&hl=de&pg=PT104#v=onepage&q&f=false) (May 2012), an interview with the consistently successful hedge fund manager Jaffray Wo...
2012/07/02
[ "https://stats.stackexchange.com/questions/31513", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/230/" ]
Not sure if there'll be any other "ranty" responses, but heres mine. *Cross Validation* is in no way "new". Additionally, *Cross Validation* is not used when analytic solutions are found. For example you don't use cross validation to estimate the betas, you use *OLS* or *IRLS* or some other "optimal" solution. What I...
> > You can look for *patterns* where, on average, all the models > out-of-sample continue to do well. > > > My understanding of the word *patterns* here, is he means different market conditions. A naive approach will analyse all available data (we all know more data is better), to train the best curve fitting mo...
15,123,238
Hello i am trying to display the result of search in my homepage. I am running an internet radio website and i am trying to get this to work. The users will use the search engine to find a song "John" for example: <http://tir.fullerton.edu/search/searchv2.php> it will show all possible results. Then once they find it...
2013/02/27
[ "https://Stackoverflow.com/questions/15123238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2117287/" ]
[MD5](http://en.wikipedia.org/wiki/MD5) is a hash function which is irreversible and two input may produce the same output. in case the content of the files is not 'secret' you can use MD5 for a verification process, this should be quite easy. * Create a hashtabe (or just a table) with the hashes of all the resources...
If you are using your resources, you have to decrypt them then the client can use them, because they are being used in the game.
210,559
I'm trying to adjust Message Queuing properties (specifically, message storage limits) via Computer Management on my machine. It fails with the following message: The properties of cannot be set. Error: Access is denied. I am logged in with an account that is part of the local Administrators group. I can perform a...
2010/12/08
[ "https://serverfault.com/questions/210559", "https://serverfault.com", "https://serverfault.com/users/33834/" ]
This blog may also be useful: <http://blog.aggregatedintelligence.com/2012/03/msmqsecurity-descriptor-cannot-be-set.html> Basically, it says that in order to be able to change the settings of a queue, your account must be set as an owner of the queue and it explains how to do so. It worked for me.
I had the same problem and found this useful: > > 1. Go to the server which host the MSMQ > 2. Click Start > Run then Regedit > 3. Navigate to HKLM\Software\Microsoft\MSMQ\Parameters\ > 4. you will see a Binary Type ‘REG\_DWORD’ named as Workgroup. > 5. The Data for that should be 0×00000000 (0) > 6. Doubleclick on t...
69,540,428
I have files name filename.gz.1 and i need to rename them to filename.gz, There are allot of files and every name is different, I know i cant to this `for i in $(ls); do mv $i $i.1; done`, But can i do this reverse, from filename.gz.1 to filename.gz and keep the original file name? I have tried this, ``` for i in $(...
2021/10/12
[ "https://Stackoverflow.com/questions/69540428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14380853/" ]
You can use ```sh for i in ...; do echo "$i --> ${i%.*}" done ``` The `${i%.*}` will remove at the end (`%`) what match a period followed by anything (`.*`)
I was able to resolve it like this: ``` for i in $(ls | grep "xz\|gz"); do echo "mv $i $i" | rev | cut -c3- | rev; done | bash ```
12,066,555
``` TABLE T1 TABLE T2 +----+------------+ +----+------------+ | Id | Name | | Id | Some_Data | +----+------------+ +----+------------+ | | | | | | ``` Query1: ``` SELECT * FROM T1 JOIN T2 ON T1.Id=T2.Id WHERE T1.Id...
2012/08/22
[ "https://Stackoverflow.com/questions/12066555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936293/" ]
I think the problem here is that the join - with many millions of rows - always come first and only after that will come the where clause. Try this instead on your tables and see the timestamps in the messages tab: ``` declare @t1 table (id int, name nvarchar(100)); declare @t2 table (id int, name nvarchar(100)); ins...
First, this is a real question I am facing, and the database is from a third-party software product where I have read only access to generate some reports. From all the very helpful answerers, I gather that there is no straightforward answer. I conclude from the postings that: first ensure the keyed columns are indexe...
2,195,905
I have hyperlinks, all are named 'mylink'. They should all fire the same event, but only the first element named 'mylink' actually fires. My code is as follows: ``` $(document).ready(function() { $("#formID").validationEngine() $('#mylink').click(function(e){ var goto = $(this).attr('hre...
2010/02/03
[ "https://Stackoverflow.com/questions/2195905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/225239/" ]
``` $(function(){ $("#formID").validationEngine(); // don't forget your semi-colons $(".mylink").click(function(e){ // ID's should be unique, use classes instead e.preventDefault(); $.ajax({ url: $(this).attr("href") }); $(this).parent().parent().fadeOut("slow"); // refer to this as 'this' }); }); `...
You can't re-use an "id" value. A given "id" can only be used once on a page. If you need multiple elements to be affected, use a "class" component: ``` <div id="uniqueString" class="makeMeMoo makeMePurple makeMeClickable"> <!-- whatever --> </div> ```
16,664,231
This is cross-domain ajax request: ``` $.ajax({ type: "POST", dataType: "jsonp", contentType: "application/jsonp", data: '{"UserName":"newuser","Password":"pwd"}', crossDomain: true, async: false, url: "http://xxx.xx.xx.xx/MyService/Sa...
2013/05/21
[ "https://Stackoverflow.com/questions/16664231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1751860/" ]
Inputs: * 0-4 inputs * 5-9 inputs * More than 9 inputs Values: * 0-100 * 101-999 * Greater than 999 The program accepts when there are between 5 and 9 inputs and each input value is a 3-digit number between 101 and 999.
equivalence classes for your problem are: 1. set of numbers that are not three digit and greater than hundred... 2. set of numbers that are less than one hundred 3. set of numbers that are greater than one hundred and less than 999 4. set consisting of the number 100
13,521,531
Just wondering what the best way to visually represent this algorithm program might be? We want to visually represent the shortest path and the packet moving through the routers if possible? Any ideas? Looking at turtle it seems we could achieve what we want. Any pointers welcome. Thanks. Trying to visually represent...
2012/11/22
[ "https://Stackoverflow.com/questions/13521531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1378618/" ]
Try [Multimedia Timers](http://msdn.microsoft.com/en-us/library/windows/desktop/dd742877%28v=vs.85%29.aspx) - they provide greatest accuracy possible for the hardware platform. These timers schedule events at a higher resolution than other timer services. You will need following Win API functions to set timer resoluti...
Based on the other solutions and comments, I put together this VB.NET code. Can be pasted into a project with a form. I understood @HansPassant's comments as saying that as long as `timeBeginPeriod` is called, the "regular timers get accurate as well". This doesn't seem to be the case in my code. My code creates a mul...
4,746
[Bytebeat](http://canonical.org/~kragen/bytebeat/) is a style of music one can compose by writing a simple C program that's output is piped to `aplay` or `/dev/dsp`. ``` main(t){for(;;t++)putchar(((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7);} ``` There is a good deal of information on the [bytebeat site...
2012/01/24
[ "https://codegolf.stackexchange.com/questions/4746", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/3071/" ]
(Signed 16-bit little endian, 8000Hz mono (`--format=S16_LE`)) Music ----- **Much** better than before! (although it's quite long) `main(t){for(;;t++)putchar(((7&(((t>>17)+1)>>2)+((t>>10)&1+2*(t>>18&1))*(("23468643"[7&t>>12]-48)+(3&t>>11))+((3&t>>17)>0)*(3&t>>9)*!(1&t>>10)*(((2+t>>10&3)^(2+t>>11&3))))*t*"@06+"[3&t>>...
Emphasising "beat" over "byte": ``` #include<math.h> double s(double,double);double r(double,double);double d(double);double f(double); char bytebeat(int t){return (d(f(t/4000.)/3) + 1) * 63;} double f(double t){ double sn=s(1./2,t-1); sn*=(sn*sn); return 3*s(1./4,1/s(1,t))+3*s(4,1/sn)/2+s(4,1/(sn*sn*sn*sn*sn))/...
3,325,676
I got the following sets: A= { { 1 , 3 , 5 , 7 , 9 } , { 1 , 2 , 3 } , 1 , 2 , 3 , 4 , 5 } B= { 1 , 3 , 5 , 7 , 9 } I'm a bit confused. What would A ∩ B be?
2019/08/17
[ "https://math.stackexchange.com/questions/3325676", "https://math.stackexchange.com", "https://math.stackexchange.com/users/695902/" ]
$A$ is an unusual set in that some of its elements are numbers and others are sets of numbers. This kind of sets are rarely used in mathematics -- except sometimes in exercises that confuse beginning students ... $\{1,3,5,7,9\}$ is one of the elements of $A$. This set is *not an element* of $B$ -- it happens to be $B$...
To answer your question, $A\cap B=\{1,3,5\} $. And, for extra credit, appreciate the distinction between these two true statements: $$\{1,2,3,4,5\}\subset A $$ $$\{1,3,5,7,9\}\in A $$
103,247
I'm a much like beginner level, so pardon me if this is a very basic silly question. Once I've a JPEG photograph image file, how can I find out whether it is a RAW file or not?
2018/12/03
[ "https://photo.stackexchange.com/questions/103247", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/79381/" ]
> > Once I've a JPEG photograph image file, how can I find out whether it is a RAW file or not? > > > **If you have a JPEG file, then it is not a RAW file.** RAW isn't a single format, but rather a collective name for image files that contain data straight from the sensor. RAW files need to be processed in order ...
RAW format, as generally called, is a group of file types with different suffixes. There are `*.raw` files and proprietary files like `*.cr2` for Canon, for example and many others. I am a Canoneer so the following is based on my experience with my Canon. Almost every manufacturer has their own RAW file format. Be als...
1,386,243
``` Dim objMail As New Mail.MailMessage("no-reply@mywebsite.com", ToEmail, "Password Reset", body) ``` ...and the problem is that the message is sent as pure text including the `<br>` tags within the body How could i send the email as html?
2009/09/06
[ "https://Stackoverflow.com/questions/1386243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59314/" ]
Have a look at [MailMessage.IsBodyHtml](http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage.isbodyhtml.aspx)
Easy: ``` objMail.IsBodyHtml = True ```
1,263,072
I would like to change a 4x4 matrix from a right handed system where: x is left and right, y is front and back and z is up and down to a left-handed system where: x is left and right, **z** is front and back and **y** is up and down. For a vector it's easy, just swap the y and z values, but how do you do it for...
2009/08/11
[ "https://Stackoverflow.com/questions/1263072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/153844/" ]
After 12 years, the question is still misleading because of the lack of description of axis direction. What question asked for should probably be how to convert ![](https://latex.codecogs.com/svg.image?%5Cinline&space;M_r "\inline M_r") to ![](https://latex.codecogs.com/svg.image?%5Cinline&space;M_l "\inline M_l"). [!...
Since this seems like a homework answer; i'll give you a start at a hint: What can you do to make the determinant of the matrix negative? Further (better hint): Since you already know how to do that transformation with individual vectors, don't you think you'd be able to do it with the basis vectors that span the tran...
22,450
We draw $n$ values, each equiprobably among $m$ distinct values. What are the odds $p(n,m,k)$ that at least one of the values is drawn at least $k$ times? e.g. for $n=3000$, $m=300$, $k=20$. Note: I was passed a variant of this by a friend asking for "a statistical package usable for similar problems". My attempt: Th...
2012/02/08
[ "https://stats.stackexchange.com/questions/22450", "https://stats.stackexchange.com", "https://stats.stackexchange.com/users/8469/" ]
This is a harder question if you don't have the $n\gg k$ and assuming that this makes them 'close enough' to independent to not affect the answer non-trivially. Lets proceed with these assumptions. Let $X\_j \sim Binomial(n,\frac{1}{m})$ $\forall j = 1,..,m$. $$P(\max\_j X\_j \geq k) = 1 - P(\max\_j X\_j < k)$$ $$ = 1...
The collection of numbers has a multinomial distribution with $m$ categories and $n$ sample size. Letting $N\_i$ be the number of times the $i$th category is chosen/repeated, we have $$(N\_1,\dots,N\_m)\sim multinomial\left(n;\frac{1}{m},\frac{1}{m},\dots,\frac{1}{m}\right)$$ Now leveraging off of @danieljohnson's answ...
3,008,065
(also posted on maven-users) Wondering if anyone can shed some light on inheritance of the elements in pom.xml as relates to resource processing and the WAR plugin. The documentation for the pom [1] has resources listed under "Elements in the POM that are merged". Some experimentation on my local poms against maven 2...
2010/06/09
[ "https://Stackoverflow.com/questions/3008065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258670/" ]
Indeed, that's what the documentations says. But I confirm that Maven inheritance overrides resources instead of adding to them. This is actually captured in [MNG-2751](https://issues.apache.org/jira/browse/MNG-2751), and indirectly in [MNG-2027](https://issues.apache.org/jira/browse/MNG-2027), that you might want to b...
As noted in [adding additional resources to a maven pom](https://stackoverflow.com/questions/1101462/adding-additional-resources-to-a-maven-pom), this can be worked around using the [build-helper](http://www.mojohaus.org/build-helper-maven-plugin/) plugin.
56,385,498
I need to reset the input field when user clicks on the rest button, I have other content on the page which is getting cleared except input field, I'm not sure if this is happening because I'm using old values after post request. ``` <input type="text" name="app_number" class="form-control" onreset="this.value=''" v...
2019/05/30
[ "https://Stackoverflow.com/questions/56385498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4682302/" ]
Use `type="reset"` for your button: ``` <button type="reset">Cancel</button> ```
Please try to use in js like: ``` $(document).on('click', '#YourOnclickButtonID', function(){ var $alertas = $('#YourFormID'); $alertas.validate().resetForm(); }); ```
59,380,955
when performing `terraform plan`, if an `azurerm_kubernetes_cluster` (Azure) resource exists in the state, terraform will print some information from `kube_config` which seems sensitive Example printout: (all `...` values get printed) ``` kube_config = [ { client_certificate = (......
2019/12/17
[ "https://Stackoverflow.com/questions/59380955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/968087/" ]
You can get the href by using `this` ``` $('.classofButton').click ( function () { $('#content').load ($(this).attr('href')) ; } ); ```
You can do it like this. ```js $('.classofButton').click(function(event) { event.preventDefault(); var href = $(this).attr('href'); $('#content').load(href) ; }); ``` ```css #content { width: 200px; height: 200px; } ``` ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jque...
5,832,436
I got one strange problem which I never got before. Please see this code: The css: ``` #btn{ margin-left:150px; padding:10px; display:block; } #btn a{ padding:5px 20px; background:green; color:#FFF; text-decoration:none; outline:none; } #btn a:hover{ background:#933; } #btn a:f...
2011/04/29
[ "https://Stackoverflow.com/questions/5832436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/687414/" ]
Use tabindex="0" to make an element focusable if it is not already. See <https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex> for more information about tabindex. Setting tabindex to -1 makes it unfocusable. Setting tabindex to a positive integer is not recommended unless you're trying to expl...
You should know that the pseudo class :focus doesn't go with A. The A tag has 4 pseudo classes : :link, :hover, :active, :visited
9,190,663
I have a Razor view with a couple of dropdown lists. If the value of one of the dropdown's is changed I want to clear the values in the other drop down and put new ones in. What values I put in depends on the values in the model that the view uses and that is why I need to send the model back from the view to the contr...
2012/02/08
[ "https://Stackoverflow.com/questions/9190663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/991788/" ]
`each()` is a function, so you need to close its invocation parentheses. You are missing the trailing one. ``` $(document).ready(function () { $(":input").each(function() { if($(this).val() != "") window.setInterval(saveData, 5000); }); // <-- You were missing the closing `)` here. }); ``...
You need to close your `.each` function: ``` $(document).ready(function () { $(":input").each(function() { if($(this).val() != "") window.setInterval(saveData, 5000); }); }); ```
15,230,268
In x86 assembly language, is there any way to obtain the upper half of the `EAX` register? I know that the `AX` register already contains the lower half of the `EAX` register, but I don't yet know of any way to obtain the upper half. I know that `mov bx, ax` would move the lower half of `eax` into `bx`, but I want to ...
2013/03/05
[ "https://Stackoverflow.com/questions/15230268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/975097/" ]
I would do it like this: ``` mov ebx,eax shr ebx, 16 ``` ebx now contains the top 16-bits of eax
For 16-bit mode, this is the smallest (not fastest) code: only 4 bytes. ``` push eax ; 2 bytes: prefix + opcode pop ax ; 1 byte: opcode pop bx ; 1 byte: opcode ``` It's even more compact than single instruction `shld ebx,eax,16` which occupies 5 bytes of memory.
11,477,902
I've been trying to utilize a mail.php file from the jquery contactable plugin (found on google!) to use on my website. Although the script provided is fairly simple I'm running into issues with integrating it with my Host's SMTP requirement. Here is the original script without SMTP authentication: ``` <?php // A...
2012/07/13
[ "https://Stackoverflow.com/questions/11477902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1004013/" ]
For sending mails, try [PHPMailer](http://phpmailer.worxware.com/), it's tested, everybody uses it, and it just works. It also has a lot of features and configuration options. The latest version is [this one](http://sourceforge.net/projects/phpmailer/files/latest/download?source=files), as for sending mails using SMTP...
This my test script for getting around the disabled PHP mail() function. It uses PearMail. The print statements are for testing in a browser, you may want to remove them. ``` <?php /* * Script to send an email as the PHP mail() function is disabled. * The hosting company requires SMTP authentication etc. * need to ...
236
### Congratualtions BokkyPooBah for [reaching 2k reputation](https://ethereum.stackexchange.com/users?tab=Reputation&filter=all) in two weeks! Every healthy beta site needs a [dozen very active users](http://area51.stackexchange.com/proposals/89704/ethereum). BokkyPooBah managed to show us how it's possible to write a...
2016/04/13
[ "https://ethereum.meta.stackexchange.com/questions/236", "https://ethereum.meta.stackexchange.com", "https://ethereum.meta.stackexchange.com/users/87/" ]
Here we go, @BokkyPooBah already at 3k! Congratulations, now we have 5 users at 3000 reputation!
Congratualations @eth for being the first to reach 10,000 reputation! Hurray!
36,706,369
After some effort (I'm a newbie) I've managed to create a method that reads a text file and puts it into a multi dimensional array. However the array size is hard coded and it doesn't deal with blank lines very well so I have the following questions: 1) How do I define my array to be equal to the size of the text file...
2016/04/19
[ "https://Stackoverflow.com/questions/36706369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6061723/" ]
As I said in my comment, using [ArrayList](https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html) in this situation makes things much simpler since you don't have to worry about knowing the size before hand. You can implement it like so: ``` ArrayList<String[]> arrayList = new ArrayList<>(); try { // ...
Is there a particular reason why you need to use an array? Arrays are usually bad practice for this exact reason: they have a static size that needs to be changed manually to avoid over-flow. In practice almost no one uses arrays unless there is a specific need to do so. A better approach is to look at other container...
3,328,721
I have been trying to prove the inequality > > $$\int\_{0}^{\infty} |f(x)|^2 dx \leq C \int\_{0}^{\infty} x^2 |f^{\prime}(x)|^2 dx$$ > > > for some constant $C$, under the most general set of assumptions possible. Obviously we need to have that $f$ is square-integrable and differentiable. I can prove a version ...
2019/08/20
[ "https://math.stackexchange.com/questions/3328721", "https://math.stackexchange.com", "https://math.stackexchange.com/users/93509/" ]
**Constant is $\boldsymbol{\le4}$** Whatever conditions are needed to justify the following steps: $$ \begin{align} \int\_0^\infty|f(x)|^2\,\mathrm{d}x &=\int\_0^\infty\left|\int\_x^\infty f'(t)\,\mathrm{d}t\right|^2\,\mathrm{d}x\tag1\\ &\le\int\_0^\infty\int\_x^\infty t^{-3/2}\,\mathrm{d}t\int\_x^\infty t^{3/2}|f'(t)...
You say you can prove it *if* $x|f(x)|^2\to0$. It seems very likely that your proof can be modified to work without that extra assumption. Because there must exist $x\_n\to\infty$ such that $x\_n|f(x\_n)|^2\to0$; if not then $|f(x)|^2\ge c/x$ for all $x\ge A$, which implies that $\int|f(x)|^2=\infty$. I haven't seen ...
17,260,584
Let's say I have ``` e1 :: Event t A f :: A -> IO B ``` I want to create ``` e2 :: Event t B ``` which is triggered by `e1`, and whose values are determined by executing `f` on the value of `e1` at the time of the event occurrence. I see two potential ways to do this, via dynamic event switching and using handl...
2013/06/23
[ "https://Stackoverflow.com/questions/17260584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/110081/" ]
Since the function `f` has a side effect, this is actually not a simple thing to do. The main reason is that the order of side effects is not well-defined when there are multiple simultaneous events. More generally, I was unable to conceive a good semantics for dealing with IO actions in events. Consequently, reactive-...
Can you call function `f` in `reactimate` (which as far as I understand is the "proper way" to handle IO from the event network)? From there, fire a new event of type `Event t B` to the event network. Or is this what you meant by "using handlers"?
58,930,825
In my application I am getting message sent date from API response, I want to calculate the difference between current date and the date from API response in days(difference) using angular 8 and map in ngFor. <https://stackblitz.com/edit/angular-xv1twv?file=src%2Fapp%2Fapp.component.html> Please help me. Should I us...
2019/11/19
[ "https://Stackoverflow.com/questions/58930825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6898861/" ]
You don't need to use momentjs. ```js calculateDiff(data){ let date = new Date(data.sent); let currentDate = new Date(); let days = Math.floor((currentDate.getTime() - date.getTime()) / 1000 / 60 / 60 / 24); return days; } ``` ```html <div *ngFor="let data of responseData" class="dataHolder"> ...
In your html, pass the dateString to the c**alculateDiff** function ``` <div style="font-weight:bold;">sent {{calculateDiff(data.sent)}} days ago</div> ``` In your ts, change your code like this, ``` calculateDiff(date: string){ let d2: Date = new Date(); let d1 = Date.parse(date); //time in milliseconds ...
39,137,811
I want to store graph data in marklogic using semantic triple. I am able to do that when i use ttl file with uri of <http://example.org/item/item22>. But i want to store this triple wrt to documents which are stored in Marklogic. Means i have one document "Java KT" which is in relation to Java class, and all this data...
2016/08/25
[ "https://Stackoverflow.com/questions/39137811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6755516/" ]
Load your documents, load your triples, and just add extra triples with document uri as subject or object, and some triple entity uri as the other side. You could express those in another ttl file, or create them via code. Next question would be, though, how you would want to use documents and triples together? HTH!
my question is what is the IRI that i will be writing in ttl file which will be of my document available in DB. As ttl file accepts IRIs , so what is the iri for my document ? @grtjn
30,889,952
What happens if you change the variable `b`, or what if you change `a`. What does the order have to do with anything. I know `count = count + 1` but the two variables is messing up my brain. ``` b = 7; a = 7; a = b; a += 1; ``` What happens to `b`?
2015/06/17
[ "https://Stackoverflow.com/questions/30889952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3053544/" ]
> > What happens to `b`? > > > Nothing happens to `b`. When you do ``` a = b; ``` you're copying **the value** stored in `b` and putting it in `a`. (You're *not* making `a` an alias of `b`.) When you then do `a += 1;` you're changing the value stored in `a` (and the value stored in `b` remains unchanged). Yo...
**int** is raw type you don't copy reference but the value itself. This will work same way for **Integer** because it is **immutable** class. ``` int b = 7; int a = 7; a = b; a+=1; System.out.println(a);// ->8 System.out.println(b);// ->7 ```
19,535,624
I have 2 chart with different yAxis title. I need the titles to be horizontal and align to the right (on the left side of the Y line). The title align worked only on the vertical centered. (and I need my titles to be in the middle) I tried adding text-align to the style with no success. ``` yAxis: { "title": { ...
2013/10/23
[ "https://Stackoverflow.com/questions/19535624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1853546/" ]
You're gonna like this, there is not documented option "textAlign" but not under style, but title property. For example: <http://jsfiddle.net/g7kUc/1/> ``` yAxis: { "title": { "text": "test", "textAlign": "right" } } ```
One way is to just specify different offsets for the two axis labels: ``` offset:25 offset:40 ``` <http://jsfiddle.net/CTPe9/> I know it's a bit manual, but it has the right effect. If the labels change in length, you should be able to calculate the correct offset from the length of the string and the font used. ...
54,989,822
I want to make a unit test for a Mqtt client module in Android Studio, because i want to send data from an Android Device to PC, but i don't know how to test that without a real server, i'm using paho library. There is a way to do that?
2019/03/04
[ "https://Stackoverflow.com/questions/54989822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You can not use the paho library to mock a broker, but there is moquette broker (<https://github.com/moquette-io/moquette>) which you might be able to use to embed a broker in an existing Java app
Yes, it is easy to perform local offline tests while developing with Android Studio and Android Emulator at your Mac, Linux or Windows computer - First install [mosquitto](https://mosquitto.org/download/) and run the broker at the localhost (on Windows just double click the `mosquitto.exe`, on Linux/Mac run `./mosquit...
6,584,660
I am developing a site for which I would like to protect buyers by anonymizing their email addresses.Similar to craigslist's system, when a seller needs to contact a buyer they should be able to send an email to an anonymized address such as 1425415125@mysite.com which will then be routed to the user's email address. ...
2011/07/05
[ "https://Stackoverflow.com/questions/6584660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/138347/" ]
You may wish to look at mail "piping" - the ability for someone to send an email to a mail server, which then gets thrown immediately to an executable, which then forwards your mail onto the recipient (by pulling the real email address from the database based on the incoming address from the piped message). My persona...
I do not see any problem with your setup, infact that is correct way to do because if your scheduled application fails, the emails will still be in the catch-all email box. Only once the email has been successfully delivered to somebody, the email should be deleted. You will be able to monitor and log the activity of y...
29,096,687
I'm still new to Node.JS and I'm trying to call a REST API using GET method. I use 'request' package from this [link](https://www.npmjs.com/package/request). The call actually works but when I try to return the response body from other .JS file, I get 'undefined'. Here is my 'first.js' ``` var request = require('requ...
2015/03/17
[ "https://Stackoverflow.com/questions/29096687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3567018/" ]
It is rather straightforward using regexps: ``` import os, re samples = {} for f in os.listdir("."): m = re.match(r"MySample (\d+) (\d+).wav", f) if m: samples[tuple(int(x) for x in m.groups())] = f ```
You can use a regexp to match ``` import re def getKey(x): m=re.match ('MySample (\d+) (\d+).wav',x) if m: return (m.group(1),m.group(2)) ...
8,774,311
I keep getting this error when i try to read the content of a `txt` file: *index.php:* ``` <?php $handle = fopen ("php://stdin","r"); $line = fgets($handle); fwrite(STDOUT, "Welcome $handle"); ?> ``` in the command line i do: `cat texte.txt | php index.php` where `t...
2012/01/08
[ "https://Stackoverflow.com/questions/8774311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/602257/" ]
Because you used to output `$line`, not `$handle`.
You're seeing PHP's string representation of "resource" objects/vars. `fwrite` the `$line` and you should get your desired result. Example: ``` <?php echo fopen('foo.txt', 'r'); ``` Outputs: ``` Resource id #2 ```
1,532,193
Is it possible to read cookie expiration date using JavaScript? If yes, how? If not, is there a source I can look at?
2009/10/07
[ "https://Stackoverflow.com/questions/1532193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177883/" ]
If you have control over the code where the cookie is set, then you can add code to store the expiration date in the browser's local storage for later retrival. For example: ``` // set cookie with key and value to expire 30 days from now var expires = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000); document.cookie = ...
There is a work-around to OP's question if you also control the setting of the cookies. I do it like this: ```js function setCookie(name, value, expiryInDays) { const d = new Date(); d.setTime(d.getTime() + expiryInDays * 24 * 60 * 60 * 1000); document.cookie = `${name}=${value}_${d.toUTCString()};expires=${...